Plugin Directory

Changeset 380906


Ignore:
Timestamp:
05/04/2011 06:07:22 PM (15 years ago)
Author:
OsExpert.net
Message:
 
Location:
wp-seo-tags
Files:
15 added
2 edited

Legend:

Unmodified
Added
Removed
  • wp-seo-tags/trunk/readme.txt

    r352147 r380906  
    1818
    1919== Changelog ==
     20
     21
     22<ul>
     23    <span>2.2.4</span>
     24    <li>Fixed: Undefined index: HTTP_REFERER.</li>
     25</ul>
    2026
    2127<ul>
  • wp-seo-tags/trunk/wp-seo-tags.php

    r352147 r380906  
    44Plugin URI: http://www.saquery.com/wordpress/wp-seo-tags
    55Description: WP SEO Tags
    6 Version: 2.2.3
     6Version: 2.2.4
    77Author: Stephan Ahlf
    88Author URI: http://saquery.com
     
    9494        global $wpdb;
    9595
    96         $engines['google.'] = 'q=';
    97         $engines['altavista.com'] = 'q=';
    98         $engines['search.msn.'] = 'q=';
    99         $engines['yahoo.'] = 'p=';
    100         $engines['bing.'] = 'q=';
    101         $engines['yandex.'] = 'text=';
    102 
    103         $referer = $_SERVER['HTTP_REFERER'];
    104         $blogtarget = $_SERVER["REQUEST_URI"];
    105         $ref_arr = parse_url("$referer");
    106         $ref_host = $ref_arr['host'];
    107 
    108         foreach($engines as $host => $skey){
    109             if (strpos($ref_host, $host) !== false){
    110                
    111                 $res_query = urldecode($ref_arr['query']);
    112                 if (preg_match("/{$engines[$host]}(.*?)&/si",$res_query."&",$matches)){
    113                     $query = trim($matches[1]);
    114                     $target = str_replace("'","''",str_replace(";","",sanitize_title_with_dashes($query)));
    115                     $sql= "insert into ".$wpdb->wpseotags_dbTable.
    116                         "(q, blogtarget, target,engine) VALUES ('$query', '$blogtarget','$target', '$ref_host')  ON duplicate KEY UPDATE hits=hits+1, DT=CURRENT_TIMESTAMP";
    117                     $msg="SearchEngineRedirect successful logged.";
    118                     try {
    119                         $result = $wpdb->query($sql);
    120                         $sql = "select count(*) from ".$wpdb->wpseotags_dbTable." where moderated = 1 and target = '$target'";
    121                         $cnt=$wpdb->get_var($sql); 
    122                         if ($cnt>0){
    123                             $sql = "update ".$wpdb->wpseotags_dbTable." set moderated = 1 where moderated = 0 and target = '$target'";
     96        if (isset ($_SERVER['HTTP_REFERER'])) {
     97            $engines['google.'] = 'q=';
     98            $engines['altavista.com'] = 'q=';
     99            $engines['search.msn.'] = 'q=';
     100            $engines['yahoo.'] = 'p=';
     101            $engines['bing.'] = 'q=';
     102            $engines['yandex.'] = 'text=';
     103
     104            $referer = $_SERVER['HTTP_REFERER'];
     105            $blogtarget = $_SERVER["REQUEST_URI"];
     106            $ref_arr = parse_url("$referer");
     107            $ref_host = $ref_arr['host'];
     108
     109            foreach($engines as $host => $skey){
     110                if (strpos($ref_host, $host) !== false){
     111                   
     112                    $res_query = urldecode($ref_arr['query']);
     113                    if (preg_match("/{$engines[$host]}(.*?)&/si",$res_query."&",$matches)){
     114                        $query = trim($matches[1]);
     115                        $target = str_replace("'","''",str_replace(";","",sanitize_title_with_dashes($query)));
     116                        $sql= "insert into ".$wpdb->wpseotags_dbTable.
     117                            "(q, blogtarget, target,engine) VALUES ('$query', '$blogtarget','$target', '$ref_host')  ON duplicate KEY UPDATE hits=hits+1, DT=CURRENT_TIMESTAMP";
     118                        $msg="SearchEngineRedirect successful logged.";
     119                        try {
    124120                            $result = $wpdb->query($sql);
     121                            $sql = "select count(*) from ".$wpdb->wpseotags_dbTable." where moderated = 1 and target = '$target'";
     122                            $cnt=$wpdb->get_var($sql); 
     123                            if ($cnt>0){
     124                                $sql = "update ".$wpdb->wpseotags_dbTable." set moderated = 1 where moderated = 0 and target = '$target'";
     125                                $result = $wpdb->query($sql);
     126                            }
     127                            $sql = "select count(*) from ".$wpdb->wpseotags_dbTable." where deleted = 1 and target = '$target'";
     128                            $cnt=$wpdb->get_var($sql); 
     129                            if ($cnt>0){
     130                                $sql = "update ".$wpdb->wpseotags_dbTable." set deleted = 1 where deleted = 0 and target = '$target'";
     131                                $result = $wpdb->query($sql);
     132                            }
     133                        } catch (Exception $e) {
     134                            $msg=$e->getMessage();
    125135                        }
    126                         $sql = "select count(*) from ".$wpdb->wpseotags_dbTable." where deleted = 1 and target = '$target'";
    127                         $cnt=$wpdb->get_var($sql); 
    128                         if ($cnt>0){
    129                             $sql = "update ".$wpdb->wpseotags_dbTable." set deleted = 1 where deleted = 0 and target = '$target'";
    130                             $result = $wpdb->query($sql);
    131                         }
    132                     } catch (Exception $e) {
    133                         $msg=$e->getMessage();
     136                        echo "\n<!-- WP SEO Tags : $parm ; http://saquery.com/wp-seo-tags/ -->\n" ;
    134137                    }
    135                     echo "\n<!-- WP SEO Tags : $parm ; http://saquery.com/wp-seo-tags/ -->\n" ;
     138                    break;
    136139                }
    137                 break;
    138             }
    139         } 
     140            } 
     141        }
    140142    }
    141143
Note: See TracChangeset for help on using the changeset viewer.