Changeset 620 for trunk


Ignore:
Timestamp:
03/03/2011 09:05:36 AM (15 months ago)
Author:
ofer
Message:

Don't create sessions for bots

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/WordPress/plugin/transposh/transposh.php

    r606 r620  
    458458        } 
    459459 
    460         // we'll go into this code of redirection only if we have options that need it (and no bot is involved, for the non-cookie)  and this is not a special page or one that is refered by our site 
     460        // we'll go into this code of redirection only if we have options that need it (and no bot is involved, for the non-cookie) 
     461        //  and this is not a special page or one that is refered by our site 
     462        // bots can skip this altogether 
    461463        if (($this->options->get_enable_detect_language() || $this->options->get_widget_allow_set_default_language()) && 
    462                 !($this->is_special_page($_SERVER['REQUEST_URI']) || strpos($_SERVER['HTTP_REFERER'], $this->home_url) !== false)) { 
     464                !($this->is_special_page($_SERVER['REQUEST_URI']) || strpos($_SERVER['HTTP_REFERER'], $this->home_url) !== false) && 
     465                !(preg_match("#(bot|yandex|validator|google|jeeves|spider|crawler|slurp)#si", $_SERVER['HTTP_USER_AGENT']))) { 
    463466            // we are starting a session if needed 
    464467            if (!session_id()) session_start(); 
     
    482485                    $bestlang = transposh_utils::prefered_language(explode(',', $this->options->get_viewable_langs()), $this->options->get_default_language()); 
    483486                    // we won't redirect if we should not, or this is a presumable bot 
    484                     if ($bestlang && $bestlang != $this->target_language && $this->options->get_enable_detect_language() && !(preg_match("#(bot|yandex|validator|google|jeeves|spider|crawler|slurp)#si", $_SERVER['HTTP_USER_AGENT']))) { 
     487                    if ($bestlang && $bestlang != $this->target_language && $this->options->get_enable_detect_language()) { 
    485488                        $url = transposh_utils::rewrite_url_lang_param($_SERVER['REQUEST_URI'], $this->home_url, $this->enable_permalinks_rewrite, $bestlang, $this->edit_mode); 
    486489                        if ($this->options->is_default_language($bestlang)) 
Note: See TracChangeset for help on using the changeset viewer.