芝麻web文件管理V1.00
编辑当前文件:/home/seolotod/critterchoice.com/wp-content/plugins/wp-automatic/core.articlesbase.php
camp_options ); // get associated page num from the keyword and camp id from wp_automatic_articles_keys $query = "select * from {$this->wp_prefix}automatic_articles_keys where keyword = '$keyword' and camp_id = '$camp->camp_id'"; $camp_key = $this->db->get_results ( $query ); $camp_key = $camp_key [0]; // Verify keyword exists if (count ( $camp_key ) == 0){ echo '
Keyword record not found'; return false; } // Result start first= 1,51,101 .. etc $page = $camp_key->page_num; if ( $page == - 1) { //check if it is reactivated or still deactivated if($this->is_deactivated($camp->camp_id, $keyword)){ $page = '1'; }else{ //still deactivated return false; } } // Start index from 1 not 0 if($page == 0) $page=1; // Report start result echo '
Trying to call AB for new links start from result:' . $page; // Keyword encoded $keywordenc = urlencode ( 'site:articlesbase.com '. wp_automatic_trim($keyword) ); // Bing Link $curlurl="https://www.bing.com/search?q=$keywordenc&PC=U316&FORM=CHROMN&count=50&first=$page"; // Report Search Url echo '
Bing url:'.$curlurl; // Curl Get $x='error'; curl_setopt($this->ch, CURLOPT_HTTPGET, 1); curl_setopt($this->ch, CURLOPT_URL, wp_automatic_trim($curlurl)); $exec=$this->curl_exec_follow($this->ch); $x=curl_error($this->ch); //no content and 302 header exists if(wp_automatic_trim($exec) == ''){ echo '
Empty results from Bing page'; return false; } /* if(stristr($exec, 'no results') ){ echo '
Yandex No results found'; $this->deactivate_key($camp->camp_id, $keyword); return false; }*/ // Articles links
}s', $exec , $matchsArr); $foundUrls = $matchsArr[1]; // Cache urls u=" preg_match_all('{
}s', $exec , $cacheMatchsArr); $cacheLinksArr = $cacheMatchsArr[1]; // No links? return if yes if(count($foundUrls) == 0 ){ echo '
no matching results found for this keyword'; $query = "update {$this->wp_prefix}automatic_articles_keys set page_num = '-1' where keyword = '$keyword' and camp_id = '$camp->camp_id'"; $this->db->query ( $query ); //deactivate for 60 minutes if(! in_array('OPT_NO_DEACTIVATE', $camp_opt)) $this->deactivate_key($camp->camp_id, $keyword); return false; } // Report links count echo '
Links got from AB:' . count ( $foundUrls ); $this->log ( 'links found', count ( $foundUrls ) . ' New Links added from Articles base to post articles from' ); echo '
'; $i = 0; foreach ( $foundUrls as $link ) { // verify id in link echo '
Link:'.($link); $link_url = $link; if (stristr ( $link, 'articlesbase.com' ) && preg_match('{\d+\.html}', $link) ) { // verify uniqueness if( $this->is_execluded($camp->camp_id, $link_url) ){ echo '<-- Execluded'; continue; } if ( ! $this->is_duplicate($link_url) ) { $title = ''; $cache = ''; // cache link $cache = ''; $cache = $cacheLinksArr[$i]; $query = "insert into {$this->wp_prefix}automatic_articles_links (link,keyword,page_num,title,bing_cache) values('$link' ,'$keyword','$page','$title','$cache')"; $this->db->query ( $query ); $freshlinks = 1; } else { echo ' <- duplicated
#'.$this->duplicate_id.'
'; } echo '
'; // incrementing i }else{ echo '<- Not an article url,skipping'; } // if contain id $i ++; } // foreach link echo '
'; // updating page num $page = $page + 50; //check if this page exists if(stristr($exec, 'first='.$page)){ echo '
Next Page exists starts at: '.$page; }else{ // echo $exec; echo '
Last page reached resetting search index...'; $page = -1; if(! in_array('OPT_NO_DEACTIVATE', $camp_opt)) $this->deactivate_key($camp->camp_id, $keyword); } $query = "update {$this->wp_prefix}automatic_articles_keys set page_num = $page where keyword = '$keyword' and camp_id = '$camp->camp_id' "; $this->db->query ( $query ); return; } /* * ---* articlebase process camp --- */ function articlebase_get_post($camp) { $keywords = $camp->camp_keywords; $keywords = explode ( ",", $keywords ); foreach ( $keywords as $keyword ) { $keyword = wp_automatic_trim($keyword); if (wp_automatic_trim( $keyword ) != '') { //update last keyword update_post_meta($camp->camp_id, 'last_keyword', wp_automatic_trim($keyword)); // check if keyword exhausted to skip $query = "select * from {$this->wp_prefix}automatic_articles_keys where keyword = '$keyword' and camp_id='$camp->camp_id'"; $key = $this->db->get_results ( $query ); $key = $key [0]; // process feed echo '
Getting article for Keyword:
' . $keyword; // get links to fetch and post on the blogs $query = "select * from {$this->wp_prefix}automatic_articles_links where keyword = '$keyword' and status =0 and link like '%articlesbase.com%'"; $links = $this->db->get_results ( $query ); // when no links available get some links if (count ( $links ) == 0) { $this->article_base_getlinks ( $keyword, $camp ); // get links to fetch and post on the blogs $query = "select * from {$this->wp_prefix}automatic_articles_links where keyword = '$keyword' and status =0 and link like '%articlesbase.com%'"; $links = $this->db->get_results ( $query ); } // if no links then return if (count ( $links ) != 0) { foreach ( $links as $link ) { // updating status of the link to posted or 1 $query = "update {$this->wp_prefix}automatic_articles_links set status = '1' where id = '$link->id'"; $this->db->query ( $query ); // processing page and getting content $url = wp_automatic_htmlspecialchars_decode($link->link) ; $title = $link->title; echo '
Processing Article :' . ($url); $binglink = "http://webcache.googleusercontent.com/search?q=cache:".urlencode($url); curl_setopt ( $this->ch, CURLOPT_HTTPGET, 1 ); curl_setopt ( $this->ch, CURLOPT_URL, wp_automatic_trim( ( $binglink ) ) ); curl_setopt ( $this->ch, CURLOPT_REFERER, 'http://ezinearticles.com' ); $exec = curl_exec ( $this->ch ); $x = curl_error($this->ch); $cacheLoadSuccess = false; // success flag if(stristr($exec,'About the Author')){ //valid google cache echo '
Successfully loaded the page from Google Cache'; $cacheLoadSuccess = true; }else{ echo '
No valid Googe cache found'; // Bing cache $cacheLink =''; $cacheToken = $link->bing_cache; if(wp_automatic_trim($cacheToken) != '' && stristr($cacheToken, '|')){ $cacheTokenParms = explode( '|' , $cacheToken ); $cacheTokenParam1 = $cacheTokenParms[2]; $cacheTokenParam2 = $cacheTokenParms[3]; if(wp_automatic_trim($cacheTokenParam1) != '' && wp_automatic_trim($cacheTokenParam1) != ''){ $cacheLink = "http://cc.bingj.com/cache.aspx?d=$cacheTokenParam1&mkt=en-US&setlang=en-US&w=$cacheTokenParam2"; } }else{ echo '
No cache token found'; } if(wp_automatic_trim($cacheLink) != ''){ echo '
Google cache failed Loading from Bing cache
Link:'.$cacheLink; curl_setopt ( $this->ch, CURLOPT_URL, wp_automatic_trim( $cacheLink ) ); $exec = curl_exec ( $this->ch ); if(stristr($exec,'About the Author')){ //valid google cache echo '
Successfully loaded the page from Bing Cache'; $cacheLoadSuccess = true; } } if(!$cacheLoadSuccess){ // Direct call echo '
Bing cache didnot return valid result direct call to ArticleBase '.$x; curl_setopt ( $this->ch, CURLOPT_URL, wp_automatic_trim( ( urldecode( $url ) ) ) ); curl_setopt ( $this->ch, CURLOPT_REFERER, 'http://ezinearticles.com' ); $exec = curl_exec ( $this->ch ); if(stristr($exec, 'About the Author')){ echo '
Ezinearticles returned the article successfully '; }else{ $this->link_execlude( $camp->camp_id, $link->link ); echo '
No article found at this link'; return false; } } } // Extracting content preg_match('{
(.*?)
}s", '', $articleContentRaw); $articleContentClean = preg_replace("{
}s", '', $articleContentClean); $cont = wp_automatic_trim($articleContentClean); // get the title
Make Money With Google Profit Kits Exposed - Don't Get Ripped Off!
@preg_match_all ( "{
(.*?)
}", $exec, $matches, PREG_PATTERN_ORDER ); @$res = $matches [1]; @$ttl = $res [0]; if (isset ( $ttl )) { $title = $ttl; } // Extract author preg_match('{