Dotclear

Changeset 353


Ignore:
Timestamp:
03/08/08 12:43:13 (16 years ago)
Author:
sacha
Message:

Arlequin - avoid duplicate content by redirecting to HTTP_REFERER

Location:
plugins/arlequin
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • plugins/arlequin/_define.php

    r308 r353  
    33 *  This is 'Arlequin', a plugin for Dotclear 2                * 
    44 *                                                             * 
    5  *  Copyright (c) 2007                                         * 
     5 *  Copyright (c) 2007,2008                                    * 
    66 *  Oleksandr Syenchuk and contributors.                       * 
    77 *                                                             * 
     
    1919     /* Description*/    "Allows visitors choose a theme", 
    2020     /* Author */        "Oleksandr Syenchuk", 
    21      /* Version */       '0.5.4', 
     21     /* Version */       '0.6', 
    2222     /* Permissions */   'contentadmin' 
    2323); 
  • plugins/arlequin/_public.php

    r304 r353  
    33 *  This is 'Arlequin', a plugin for Dotclear 2                * 
    44 *                                                             * 
    5  *  Copyright (c) 2007                                         * 
     5 *  Copyright (c) 2007,2008                                    * 
    66 *  Oleksandr Syenchuk and contributors.                       * 
    77 *                                                             * 
     
    2929class publicArlequinEngine 
    3030{ 
     31     public static $cookie_theme; 
     32     public static $cookie_upddt; 
     33      
    3134     public static function trigger(&$blog) 
    3235     { 
    33           $cookie_theme = 'mt_blog_'.$blog->id.'_theme'; 
    34           $cookie_upddt = 'mt_blog_'.$blog->id.'_upddt'; 
     36          $cname = base_convert(substr(md5($blog->id),0,8),16,36); 
     37          self::$cookie_theme = 'dc_theme_'.$cname; 
     38          self::$cookie_upddt = 'dc_user_upddt_'.$cname; 
    3539           
    3640          if (!empty($_REQUEST['theme'])) 
    3741          { 
    3842               # Set cookie for 365 days 
    39                setcookie($cookie_theme,$_REQUEST['theme'],time()+31536000,'/'); 
    40                setcookie($cookie_upddt,time(),time()+31536000,'/'); 
     43               setcookie(self::$cookie_theme,$_REQUEST['theme'],time()+31536000,'/'); 
     44               setcookie(self::$cookie_upddt,time(),time()+31536000,'/'); 
     45                
     46               if (!empty($_SERVER['HTTP_REFERER']) 
     47               && strpos($_SERVER['HTTP_REFERER'],$blog->url) === 0 
     48               && !preg_match('#(&|\?)theme=#',$_SERVER['HTTP_REFERER'])) { 
     49                    http::redirect($_SERVER['HTTP_REFERER']); 
     50                    exit; 
     51               } 
     52 
    4153               self::switchTheme($blog,$_REQUEST['theme']); 
    4254          } 
    43           elseif (!empty($_COOKIE[$cookie_theme])) 
     55          elseif (!empty($_COOKIE[self::$cookie_theme])) 
    4456          { 
    45                self::switchTheme($blog,$_COOKIE[$cookie_theme]); 
     57               self::switchTheme($blog,$_COOKIE[self::$cookie_theme]); 
    4658          } 
    4759     } 
     
    6375     public static function adjustCache(&$core) 
    6476     { 
    65           $cookie_upddt = 'mt_blog_'.$core->blog->id.'_upddt'; 
    66            
    67           if (!empty($_COOKIE[$cookie_upddt])) { 
    68                $GLOBALS['mod_ts'][] = (int) $_COOKIE[$cookie_upddt]; 
     77          if (!empty($_COOKIE[self::$cookie_upddt])) { 
     78               $GLOBALS['mod_ts'][] = (int) $_COOKIE[self::$cookie_upddt]; 
    6979          } 
    7080     } 
  • plugins/arlequin/forms.php

    r305 r353  
    5151<p>Voici la liste des variables que vous pouvez utiliser :</p> 
    5252<h3>'.__('In switcher HTML code').'</h3> 
    53 <table> 
     53<table><thead> 
    5454<tr><th>'.__('Variable').'</th><th>'.__('Meaning').'</th></tr> 
    55 <tr><td>%1$s</td><td>'.sprintf(__('Current page %sURL%s'), 
     55</thead><tbody class="noborder"> 
     56<tr><th>%1$s</th><td>'.sprintf(__('Current page %sURL%s'), 
    5657     '<acronym title="'.__('Uniform Ressource Locator').'">','</acronym>'). 
    5758     '</td></tr> 
    58 <tr><td>%2$s</td><td>'.__('Items HTML code').'</td></tr> 
    59 </table> 
     59<tr><th>%2$s</th><td>'.__('Items HTML code').'</td></tr> 
     60</tbody></table> 
    6061<h3>'.__('In items HTML code').'</h3> 
    61 <table> 
     62<table><thead> 
    6263<tr><th>'.__('Variable').'</th><th>'.__('Meaning').'</th></tr> 
    63 <tr><td>%1$s</td><td>'.sprintf(__('Current page %sURL%s'), 
     64</thead><tbody class="noborder"> 
     65<tr><th>%1$s</th><td>'.sprintf(__('Current page %sURL%s'), 
    6466     '<acronym title="'.__('Uniform Ressource Locator').'">','</acronym>'). 
    6567     '</td></tr> 
    66 <tr><td>%2$s</td><td>'. 
     68<tr><th>%2$s</th><td>'. 
    6769     sprintf(__('A suffix to send theme setting through %sURL%s, e.g. \'%3$s\''), 
    6870     '<acronym title="'.__('Uniform Ressource Locator').'">','</acronym>', 
    6971     '<strong>&amp;theme=</strong>').'</td></tr> 
    70 <tr><td>%3$s</td><td>'.__('Theme identifier').' '.'<em>à utiliser uniquement dans une URL</em>'.'</td></tr> 
    71 <tr><td>%4$s</td><td>'.__('Theme name').'</td></tr> 
    72 <tr><td>%5$s</td><td>'.__('Theme description').'</td></tr> 
    73 <tr><td>%6$s</td><td>'.__('Theme identifier').'</td></tr> 
    74 </table> 
     72<tr><th>%3$s</th><td>'.__('Theme identifier').' '.'<em>à utiliser uniquement dans une URL</em>'.'</td></tr> 
     73<tr><th>%4$s</th><td>'.__('Theme name').'</td></tr> 
     74<tr><th>%5$s</th><td>'.__('Theme description').'</td></tr> 
     75<tr><th>%6$s</th><td>'.__('Theme identifier').'</td></tr> 
     76</tbody></table> 
    7577<h2>Ajouter ses propres modèles prédéfinis</h2> 
    7678<p>Si vous êtes l\'administrateur d\'une plateforme de blogs, vous pouvez modifier les modèles prédéfinis en éditant le fichier <strong>plugins/arlequin/models.php</strong>.</p> 
Note: See TracChangeset for help on using the changeset viewer.

Sites map