View Single Post
  #18  
Old 03-11-2013, 04:12 PM
final kaoss final kaoss is offline
 
Join Date: Apr 2006
Posts: 1,314
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

No idea, it decided to dump it all into one line doing it that way.

PHP Code:
string(15810"/** * * @param $ref - string - current search engine referrer * @return string - delemiter for current search engine referrer */ function seoqueries_get_delim($ref) { // Search engine match array // Used for fast delimiter lookup for single host search engines. // Non .com Google/MSN/Yahoo referrals are checked for after this array is checked $search_engines = array( 'google.fr' => 'q', 'google.com' => 'q', 'search.yahoo.com' => 'p', 'fr.search.yahoo.com' => 'p', 'search.msn.com' => 'q', 'bing.com' => 'q', 'search.live.com' => 'q', 'rechercher.aliceadsl.fr' => 'qs', 'vachercher.lycos.fr' => 'query', 'search.lycos.com' => 'query', 'alltheweb.com' => 'q', 'search.aol.com' => 'query', 'search.ke.voila.fr' => 'rdata', 'recherche.club-internet.fr' => 'q', 'ask.com' => 'q', 'hotbot.com' => 'query', 'overture.com' => 'Keywords', 'search.netscape.com' => 'query', 'search.looksmart.com' => 'qt', 'search.earthlink.net' => 'q', 'search.viewpoint.com' => 'k', 'mamma.com' => 'query' ); $delim = FALSE; // Check to see if we have a host match in our lookup array if (isset($search_engines[$ref])) { $delim = $search_engines[$ref]; } else { // Lets check for referrals for international TLDs and sites with strange formats if (strpos($ref, 'google.') !== FALSE && strpos($ref, 'reader') === FALSE) $delim = 'q'; elseif (strpos($ref, 'search.msn.') !== FALSE) $delim = 'q'; elseif (strpos($ref, '.search.yahoo.') !== FALSE) $delim = 'q'; elseif (strpos($ref, 'exalead.') !== FALSE) $delim = 'q'; elseif (strpos($ref, 'search.aol.') !== FALSE) $delim = 'query'; elseif (strpos($ref, '.ask.com') !== FALSE) $delim = 'q'; elseif (strpos($ref, 'recherche.aol.fr') !== FALSE) $delim = (strpos($_SERVER['HTTP_REFERER'], 'query')!==FALSE)?'query':'q'; } return $delim; } function seoqueries_get_position(){ if( preg_match('/cd=(\d+)/',$_SERVER['HTTP_REFERER'],$match) ){ return $match[1]; } return 0; } /** * * @param $d - delimiter in referrer string * @return string - search keywords */ function seoqueries_get_terms($d) { $terms = null; $query_array = array(); $query_terms = null; // Get raw query $query = str_replace( 'site%3A', '', $_SERVER['HTTP_REFERER'] ); $query = explode($d.'=', $query); $query = explode('&', $query[1]); $query = urldecode($query[0]); // Remove quotes, split into words, and format for HTML display $query = str_replace("'", '', $query); $query = str_replace('"', '', $query); $query_array = preg_split('/[\s,\+]+/',$query); $query_terms = implode(' ', $query_array); global $vbulletin; if( $vbulletin->options['seofq_enc'] != '' ){ $terms = htmlspecialchars( iconv("utf-8", $vbulletin->options['seofq_enc'], urldecode($query_terms)) ); }else{ $terms = htmlspecialchars(urldecode($query_terms)); } return $terms; } /** * This function looks for referrer variable and return it in special format (without "www." prefix) * @return string - referrer value */ function seoqueries_get_refer() { // Break out quickly so we don't waste CPU cycles on non referrals if (!isset($_SERVER['HTTP_REFERER']) || ($_SERVER['HTTP_REFERER'] == '')) return FALSE; $referer_info = parse_url($_SERVER['HTTP_REFERER']); $referer = $referer_info['host']; // Remove www. is it exists if (substr($referer, 0, 4) == 'www.') $referer = substr($referer, 4); return $referer; } /** * Return true if the referer is a search engine * @param $what - what info you are going to get * @return mixed */ function seoqueries_getinfo($what) { // Did we come from a search engine? $referer = seoqueries_get_refer(); if (!$referer) return FALSE; $delimiter = seoqueries_get_delim($referer); if ($delimiter) { $terms = seoqueries_get_terms($delimiter); if ($what == 'isref') { return ($terms != ''?true:false); } if ($what == 'referrer') { $parsed = parse_url($_SERVER['HTTP_REFERER']); echo ''.$parsed['host'].''; } if ($what == 'terms') { echo $terms; } } } /** * Gets type and id for current loading page * It may be homepage, single post page, static page, category page, tag page or archive page * @return array with two keys: 'type' and 'id' */ function seoqueries_get_type_id( $param ){ if (THIS_SCRIPT == 'forumdisplay' || THIS_SCRIPT == 'index' || THIS_SCRIPT == 'showthread'){ $return['type'] = THIS_SCRIPT; }else{ return array(); } switch(THIS_SCRIPT){ case 'forumdisplay': $return['id'] = $param['forumid']; //$return['id'] = $_GET['f']; break; case 'index': $return['id'] = 0; break; case 'showthread': $return['id'] = $param['threadid']; //$return['id'] = $_GET['t']; break; }; return $return; } /** * * @param $term * @param $min_founded - int, minimal number of 'founded' value for terms * @param $max_founded - int, max number of 'founded' value for terms * @return string - tag value (by default one from 'strong','h6'-'h2' You can edit tag list in setting in the wp-admin) */ function seoqueries_get_tag( $term$min_founded$max_founded$tags_count ){ if( empty($tags_count) ) return false; $step = ($max_founded - $min_founded)/$tags_count; if ($step == 0){ return '0'; } $number = (int)($term['founded'] - $min_founded)/$step; if ($number == $tags_count){ $number--; } return $number; } function seoqueries_get_item_title($type,$id){ switch ($type){ case 'post': $post = get_post($id); return $post->post_title; case 'page': $page = get_page($id); return $page->post_title; case 'category': $cat = get_category($id); return $cat->name; case 'archive': return $id; case 'tag': $tag = get_tag($id); return $tag->name; } } function seoqueries_get_google_position($stid){ global $wpdb$sql = "SELECT position FROM {$wpdb->searchterms_statsWHERE position IS NOT NULL AND stid=$stid ORDER BY date_clicked DESC LIMIT 1"; return $wpdb->get_var($sql); } function seoqueries_last_clicked_date($stid,$page_type = false, $page_id = false){ global $wpdb$sql = "SELECT date_clicked FROM {$wpdb->searchterms_statsWHERE stid=$stid "; if (!empty($page_type) && !empty($page_id)){ $sql .=" AND page_type '$page_type' AND page_id='$page_id' "; } $sql .=" ORDER BY date_clicked DESC LIMIT 1"; return $wpdb->get_var($sql); } function seoqueries_write_to_log($str){ $file = file_get_contents('plugin-log.txt'); $file .= "\n". time() ." ". $str ."\n"; file_put_contents('plugin-log.txt', $file); } function seoqueries_init(){ global $seoqueries; global $vbulletin; if (!$seoqueries){ $seoqueries = new stdClass(); } $seoqueries->searchterms = TABLE_PREFIX .'seoqueries_terms'; $seoqueries->searchterms_data = TABLE_PREFIX .'seoqueries_data'; $seoqueries->searchterms_stats = TABLE_PREFIX .'seoqueries_terms_stats'; $seoqueries->searchterms_filter = TABLE_PREFIX .'seoqueries_filtered_terms'; //imitating http_referer variable uncomment this line if you want to test plugin /* $referers = array( 'http://google.com/?q=seoforums&cd=2','http://google.com/?q=superforum&cd=1','http://google.com/?q=vbulletin&cd=','http://google.com/?q=tendrassil','http://google.com/?q=rocket&cd=2','http://google.com/?q=moon','http://google.com/?q=beatles&cd=2','http://google.com/?q=commodi','http://google.com/?q=forum&cd=1','http://www.google.com/search?client=safari&rls=en&q=seoforums.org&ie=UTF-8&oe=UTF-8','http://google.com/?q=perspiciatis,','http://google.com/?q=omnis','http://google.com/?q=natus','http://google.com/?q=error','http://google.com/?q=voluptatem','http://google.com/?q=accusantium','http://google.com/?q=doloremque','http://google.com/?q=laudantium,','http://google.com/?q=totam','http://google.com/?q=aperiam','http://google.com/?q=eaque','http://google.com/?q=ipsa,','http://google.com/?q=inventore','http://google.com/?q=veritatis','http://google.com/?q=quasi','http://google.com/?q=architecto','http://google.com/?q=beatae','http://google.com/?q=vitae','http://google.com/?q=dicta','http://google.com/?q=sunt,','http://google.com/?q=explicabo.','http://google.com/?q=ipsam','http://google.com/?q=voluptatem,','http://google.com/?q=voluptas','http://google.com/?q=aspernatur','http://google.com/?q=fugit,','http://google.com/?q=consequuntur','http://google.com/?q=magni','http://google.com/?q=dolores','http://google.com/?q=ratione','http://google.com/?q=voluptatem','http://google.com/?q=sequi','http://google.com/?q=nesciunt,','http://google.com/?q=ne\que','http://google.com/?q=porro','http://google.com/?q=quisquam','http://google.com/?q=dolorem','http://google.com/?q=ipsum,','http://google.com/?q=dolor','http://google.com/?q=amet,','http://google.com/?q=consectetur,','http://google.com/?q=adipisci','http://google.com/?q=velit,','http://google.com/?q=numquam','http://google.com/?q=tempora','http://google.com/?q=incidunt,','http://google.com/?q=labore','http://google.com/?q=dolore','http://google.com/?q=magnam','http://google.com/?q=aliquam','http://google.com/?q=quaerat','http://google.com/?q=voluptatem.','http://google.com/?q=minima','http://google.com/?q=veniam,','http://google.com/?q=nostrum','http://google.com/?q=exercitationem','http://google.com/?q=ullam','http://google.com/?q=corporis','http://google.com/?q=suscipit','http://google.com/?q=laboriosam,','http://google.com/?q=aliquid','http://google.com/?q=commodi','http://google.com/?q=consequatur?','http://google.com/?q=autem','http://google.com/?q=reprehenderit,','http://google.com/?q=voluptate','http://google.com/?q=velit','http://google.com/?q=esse,','http://google.com/?q=nihil','http://google.com/?q=molestiae','http://google.com/?q=consequatur,','http://google.com/?q=illum,','http://google.com/?q=dolorem','http://google.com/?q=fugiat,','http://google.com/?q=voluptas','http://google.com/?q=nulla','http://google.com/?q=pariatur?', ); //$_SERVER['HTTP_REFERER'] = 'http://www.google.com/search?client=safari&rls=en&q=%D8%A7%D9%84%D8%A3%D8%BA%D8%A7%D9%86%D9%8A&ie=UTF-8&oe=UTF-8'; //shuffle($referers); //$_SERVER['HTTP_REFERER'] = array_pop($referers); $ref_count = count($referers); //$_SERVER['HTTP_REFERER'] = 'http://www.google.com/search?hl=ru&client=safari&rls=en&q=%40mail'; for($i=0;$i<100;$i++){ */ $abanded_chars=array('\'','\\','/','%','|','$','?',',','~'); $ref = seoqueries_get_refer(); $type_id = seoqueries_get_type_id($vbulletin->GPC); if (seoqueries_getinfo('isref')){ $referer = seoqueries_get_refer(); $delimiter = seoqueries_get_delim($referer); $terms = seoqueries_get_terms($delimiter); $terms_safe = str_replace($abanded_chars, '', $terms); if(strlen($terms_safe)<4){ return; } //use filter $sql = "SELECT FROM ". $seoqueries->searchterms_filter$result = $vbulletin->db->query_read_slave($sql); while( $row = $vbulletin->db->fetch_array($result) ){ //echo $row['filter'].' - '.$terms."\n"; if(stripos($terms,$row['filter'])!==false) return; } $sql = "SELECT FROM ". $seoqueries->searchterms ." WHERE term_value='". $terms_safe ."'"; $result = $vbulletin->db->query_read_slave($sql); if (!empty($result)){ $term = $vbulletin->db->fetch_array($result); } $vbulletin->db->free_result($result); if (empty($term)){ $sql = "INSERT INTO ". $seoqueries->searchterms ." (term_valueVALUES('". $terms_safe ."')"; $vbulletin->db->query_write($sql); $sql = "SELECT FROM ". $seoqueries->searchterms ." WHERE term_value='". $terms_safe ."'"; $result = $vbulletin->db->query_read_slave($sql); $term = $vbulletin->db->fetch_array($result); } if (empty($term)){ return; } //if banned if($term['ban']==1) return; global $seoqueries_type; if (empty($type_id)){ return ''; } $seoqueries_type = new stdClass(); $seoqueries_type->type = $type_id['type']; $seoqueries_type->id = $type_id['id']; $sql = " SELECT FROM ". $seoqueries->searchterms_data ." WHERE stid=". $term['stid'] ." AND page_type='". $type_id['type'] ."' AND page_id=". $type_id['id']; $result = $vbulletin->db->query_read_slave($sql); $row = $vbulletin->db->fetch_array($result); if (empty($row)){ $sql = "INSERT INTO ". $seoqueries->searchterms_data ." VALUES ". $term['stid'] ."". 1 ."'". $type_id['type'] ."'". $type_id['id'] ."CURRENT_TIMESTAMP )"; $vbulletin->db->query_write($sql); }else{ $row['founded']++; $sql = "UPDATE ". $seoqueries->searchterms_data ." SET founded=". $row['founded'] ."last_click=CURRENT_TIMESTAMP WHERE stid=". $row['stid'] ." AND page_type='". $row['page_type']. "' AND page_id=". $row['page_id']; $vbulletin->db->query_write($sql); } //post to statistic $position = seoqueries_get_position(); $sql = " INSERT INTO ". $seoqueries->searchterms_stats ." VALUES NULL". $term['stid'] ."'". $type_id['type'] ."'". $type_id['id'] ."". $position ."CURRENT_TIMESTAMP "; $vbulletin->db->query_write($sql); } //}//for 100 fish of google } class SpambotHammer { static function markup() { global $vbulletin$vbphrase$r = array( sprintf('', TIMENOW), ); if ($vbulletin->options['spambot_hammer_safety_lock']) { $constants = array( 'SPAMBOT_HAMMER_MODULE_TIMER_MATURITY', $vbulletin->options['spambot_hammer_time_difference'], 'SPAMBOT_HAMMER_MODULE_TIMER_COUNTDOWN_TEXT', addslashes_js($vbphrase['spambot_hammer_module_timer_countdown_text']) ); $script = ''; if (version_compare(FILE_VERSION, '3.0.0', '>=') && version_compare(FILE_VERSION, '3.9.9', '<=')) { eval('$script = "' . fetch_template('spambot_hammer_module_timer_js') . '";'); } if (version_compare(FILE_VERSION, '4.0.0', '>=') && version_compare(FILE_VERSION, '4.9.9', '<=')) { $script = vB_Template::create('spambot_hammer_module_timer_js')->render(); } $r[] = vsprintf('', $constants); $r[] = $script; } return implode("\n", $r); } static function upgrade() { global $vbulletin; if (isset($vbulletin->options['bot_blocker_time_difference'])) { require_once DIR . '/includes/adminfunctions_options.php'; require_once DIR . '/includes/adminfunctions_plugin.php'; save_settings(array( 'spambot_hammer_time_difference' => $vbulletin->options['bot_blocker_time_difference'], 'spambot_hammer_bounce_url' => $vbulletin->options['bot_blocker_bounce_url'], 'spambot_hammer_report_email' => $vbulletin->options['bot_blocker_report_email'], 'spambot_hammer_safety_lock' => $vbulletin->options['bot_blocker_safety_lock'] )); delete_product('bot_blocker'); } } } " 
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01270 seconds
  • Memory Usage 1,953KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_php
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • showpost_complete