• 30-06-2013, 12:01:31
    #1
    Merhaba Arkadaşlar bir bot kullanıyorum

    http://siteadi.com/wp-content/upload...4mm2381814.jpg

    olarak çekiyor ama bu şekil çekmesi gerekli

    http://siteadi.com/wp-content/upload...4mm2381814.jpg

    kullanıdıgım temanın resim için ozel alan adı ise resim

    olay tahminim function.php deki function resimbotu_ResimCek($ResimYolu) da bitiyor ama wp kodlamasını bilmediğimden yardımınıza ihtiyacım var

    function.php

    <?php
    
    function dil($veri)
    {
    return iconv("ISO-8859-9","UTF-8",$veri);
    }
    function fixEncoding($x) 
    { 
      if(mb_detect_encoding($x)=='UTF-8'){ 
        return $x; 
      }else{ 
        return utf8_encode($x); 
      } 
    } // fixEncoding 
    
    function haberbotu_DetayliHaberler()
    {
    	$Veri = haberbotu_HaberListele();
    	$SonVeri = array();
    	foreach($Veri AS $Link)
    	{
    		$SonVeri[] = haberbotu_HaberDetay("http://www.trthaber.com/".$Link);
    	}
    	return $SonVeri;
    	exit;
    }
    function haberbotu_Baglan($url)
    {  $ch = curl_init();
       $timeout = 5;
    
      curl_setopt($ch,CURLOPT_URL,$url);
      curl_setopt($ch,CURLOPT_HEADER,true);
      curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
      curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout);
      curl_setopt($ch,CURLOPT_REFERER,"http://www.trthaber.com/");
      curl_setopt($ch,CURLOPT_USERAGENT,"Mozilla/5.0 (Windows NT 6.1; rv:5.0) Gecko/20100101 Firefox/5.02011-10-16 20:21:42");
      $data = curl_exec($ch);
      
      curl_close($ch);
      return $data;
    }
    
    
    function resimbotu_Baglan($url)
    {  $ch = curl_init();
       $timeout = 5;
    
      curl_setopt($ch,CURLOPT_URL,$url);
      curl_setopt($ch,CURLOPT_HEADER,true);
      curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
      curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout);
      curl_setopt($ch,CURLOPT_REFERER,"http://galeri.haberturk.com/");
      curl_setopt($ch,CURLOPT_USERAGENT,"Mozilla/5.0 (Windows NT 6.1; rv:5.0) Gecko/20100101 Firefox/5.02011-10-16 20:21:42");
      $data = curl_exec($ch);
      
      curl_close($ch);
      return $data;
    }
    
    function haberbotu_ResimCek($ResimYolu)
    {
    	$ResimAdi = basename($ResimYolu);
    	$Ky = wp_upload_dir();
    	$KlasorYolu = $Ky['path'].'/';
    	//copy($ResimYolu,'.././'.$ResimAdi);
    	
    	$chi = curl_init($ResimYolu); //dosyayı burada alıyoruz kendi serverımıza  
    	$fpi = fopen($KlasorYolu.$ResimAdi, "w"); 
    	curl_setopt($chi, CURLOPT_FILE, $fpi);   
    	curl_setopt($chi, CURLOPT_HEADER, 0);  
    	curl_exec($chi);  
    	curl_close($chi);  
    	fclose($fpi);  
    	
    	
    	
    	return $ResimAdi;
    }
    
    	
    function resimbotu_Escape($deger)
    {
    return $deger;
    }
    
    function resimbotu_ResimCek($ResimYolu)
    {
    	$ResimAdi = uniqid().'.jpg';
    	$Ky = wp_upload_dir();
    	$KlasorYolu = $Ky['path'].'/';
    	//copy($ResimYolu,'.././'.$ResimAdi);
    
    if(function_exists('curl_init'))
    {
    $fp = fopen($KlasorYolu.$ResimAdi,'w+');
    $ch = curl_init();
    curl_setopt($ch , CURLOPT_URL, $ResimYolu);
    curl_setopt($ch , CURLOPT_USERAGENT, 'firefox/2.0.11');
    curl_setopt($ch , CURLOPT_FILE, $fp);
    curl_exec($ch);
    curl_close($ch);
    fclose($fp);
    }
    else
    {
    copy($ResimYolu,$KlasorYolu.$ResimAdi); 
    }
    		return $ResimAdi;
    }
    
    
    function resimbotu_ResimEkle()
    {	
    include("../././wp-load.php");
    include("../././wp-config.php");
    include("../././wp-admin/includes/image.php");
    include("../././wp-includes/pluggable.php");
    
    
    $altlink=$_POST['altlink'];
    $GaleriAyir="";
    		$AltKonuUrl = resimbotu_Baglan($altlink);
    		preg_match_all('|<span style="color: #676767">/(.*?)</span>|si',$AltKonuUrl,$ResimSayisi,PREG_PATTERN_ORDER);
    		$sayi[]=$ResimSayisi[1][0];
    	for ($i = 1; $i <= $ResimSayisi[1][0]; $i++) {
    		$Altresim = resimbotu_Baglan($altlink."/1/".$i);
    		preg_match_all('|<div class="mansetResimBox">(.*?)</div>|si',$Altresim,$GaleriResimleri,PREG_PATTERN_ORDER);
    		$GaleriResimTagTemizle = strip_tags($GaleriResimleri[1][0],"<img>");
    		preg_match_all('|src="(.*?).jpg|si',$GaleriResimTagTemizle,$GaleriCiktisi,PREG_PATTERN_ORDER);
    		$GaleriAyir .= $GaleriCiktisi[1][0].",";
    		
    	
    		}
    	
    
    
    
    $PostOlustur = explode(',', $GaleriAyir);
    $upload_dir = wp_upload_dir();
    
    foreach($PostOlustur AS $PostResmi)
    {
    if(@$PostResmi){
    	$OlusanPost .= '<img src="'.$upload_dir[url].'/'.resimbotu_ResimCek($PostResmi.".jpg").'" /><!--nextpage-->';
    }
    }
    if (strpos($_POST['kat_id'],',') === false) {
    $PostKat = array($_POST['kat_id']);
    }else{
    $PostKat = explode(',',$_POST['kat_id']);
    }
    
    			$ResimiCek= resimbotu_ResimCek($_POST['resim']);
    			$ResimCek = $upload_dir[url].'/'.$ResimiCek;
    		
                $my_post = array();
                $my_post['post_title'] = resimbotu_Escape($_POST['baslik']);
                $my_post['post_content'] = substr($OlusanPost,0,-15);
                $my_post['post_status'] = 'publish';
                $my_post['post_author'] = '1';
                $my_post['post_category'] = $PostKat;
                $my_post['tags_input'] = resimbotu_Escape($_POST['etiket']);
    
    
           
                $post_id = wp_insert_post($my_post)or die(mysql_error());
    	
    		$wp_filetype = wp_check_filetype(basename($ResimCek), null );
                $attachment = array(
                    'guid' => $ResimCek,
                    'post_mime_type' => $wp_filetype['type'],
                    'post_title' => $my_post['post_title'] = resimbotu_Escape($_POST['baslik']),
                    'post_content' => resimbotu_Escape($_POST['altaciklama']),
                    'post_type' => 'attachment',
                    'post_parent' => $post_id
                );
    
    	
    
    
                $attach_id = wp_insert_attachment($attachment, $ResimCek, $post_id);
                $attach_data = wp_generate_attachment_metadata($attach_id, $ResimCek);
                wp_update_attachment_metadata($attach_id, $attach_data);
                add_post_meta($post_id, 'resim', $ResimCek, true);
    			add_post_meta($post_id, 'bilgi', resimbotu_Escape($_POST['altbaslik']), true);
    		
    		return '<input type="button" style="width:100%;background-color:#58ACFA;color:white;font-weight:bold" value="'.$_POST['baslik'].' başlıklı galeri başarı ile eklendi." disabled="disabled"/>';
    }
    
    
    function haberbotu_HaberEkle()
    {
    include("../././wp-load.php");
    include("../././wp-config.php");
    include("../././wp-admin/includes/image.php");
    include("../././wp-includes/pluggable.php");
    if (strpos($_POST['kat_id'],',') === false) {
    $PostKat = array($_POST['kat_id']);
    }else{
    $PostKat = explode(',',$_POST['kat_id']);
    }
    
    			$ResimCek = haberbotu_ResimCek($_POST['resim']);
                $my_post = array();
                $my_post['post_title'] = $_POST['baslik'];
                $my_post['post_content'] = $_POST['aciklama'];
                $my_post['post_status'] = 'publish';
                $my_post['post_author'] = '1';
                $my_post['post_category'] = $PostKat;
                $my_post['tags_input'] = $_POST['etiket'];
    
    
           
                $post_id = wp_insert_post($my_post)or die(mysql_error());
    	
    		$wp_filetype = wp_check_filetype(basename($ResimCek), null );
                $attachment = array(
                    'guid' => $ResimCek,
                    'post_mime_type' => $wp_filetype['type'],
                    'post_title' => $my_post['post_title'] = $_POST['baslik'],
                    'post_content' => $_POST['altaciklama'],
                    'post_type' => 'attachment',
                    'post_parent' => $post_id
                );
    
    
                $attach_id = wp_insert_attachment($attachment, $ResimCek, $post_id);
                $attach_data = wp_generate_attachment_metadata($attach_id, $ResimCek);
                wp_update_attachment_metadata($attach_id, $attach_data);
    			$ResimYoluBul = wp_get_attachment_image_src($attach_id);
                add_post_meta($post_id, 'resim', $ResimYoluBul[0], true);
    			if($_POST["bot"]=="ensonvideo")
    			{
                add_post_meta($post_id, 'video', $_POST['altbaslik'], true);
    			}
    			else
    			{
    			if($_POST["bot"]=="youtube")
    			{
    			add_post_meta($post_id, 'video', $_POST['altbaslik'], true);
    			}
    			else
    			{
                add_post_meta($post_id, 'bilgi', $_POST['altbaslik'], true);
    			}
    			}
    		return '<input type="button" style="width:100%;background-color:#58ACFA;color:white;font-weight:bold" value="'.$_POST['baslik'].' başlıklı içerik başarı ile eklendi." disabled="disabled"/>';
    }
    ?>
  • 30-06-2013, 23:09:15
    #2
    fikri olan varmı arkadaşlar.
  • 30-06-2013, 23:34:52
    #3
    tahminimce wp-admin/ayarlar/ortam'dan
    Yüklemelerimi aylık -ve yıllık- bazda klasörlerde tut. seçeneğini seçerek botu çalıştırırsanız olur gibi sistemsel olabilir.