[ Index ]
 

Code source de WikiNi 0.4.4

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/actions/ -> redirect.php (source)

   1  <?php
   2  /*
   3  redirect.php : Permet de faire une redirection vers une autre pages Wiki du site
   4  
   5  Copyright 2003  Eric FELDSTEIN
   6  Copyright 2003  David DELON
   7  Copyright 2004  Jean Christophe ANDRE
   8  This program is free software; you can redistribute it and/or modify
   9  it under the terms of the GNU General Public License as published by
  10  the Free Software Foundation; either version 2 of the License, or
  11  (at your option) any later version.
  12  
  13  This program is distributed in the hope that it will be useful,
  14  but WITHOUT ANY WARRANTY; without even the implied warranty of
  15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16  GNU General Public License for more details.
  17  
  18  You should have received a copy of the GNU General Public License
  19  along with this program; if not, write to the Free Software
  20  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  21  */
  22  
  23  /*
  24  Parametres : page : nom wiki de la page vers laquelle ont doit rediriger (obligatoire)
  25  exemple : {{redirect page="BacASable"}}
  26  */
  27  
  28  //recuperation du parametres
  29  $redirPageName = $this->GetParameter("page");
  30  
  31  if (empty($redirPageName)){
  32      echo $this->Format("//Le param&ecirc;tre \"page\" est manquant.//");
  33  }elseif ($this->GetMethod() == 'show'){
  34      if (eregi("^".$redirPageName."$",$this->GetPageTag())){
  35          echo $this->Format("//Impossible &agrave; une page de se rediriger vers elle m&ecirc;me.//");
  36      }else{
  37          $fromPages = isset($_COOKIE['redirectfrom']) ? explode(":",$_COOKIE['redirectfrom']) : array();
  38          if (in_array($this->GetPageTag(),$fromPages)){
  39              echo $this->Format("//Redirection circulaire.//");
  40          } else {
  41              $fromPages[] = $this->GetPageTag();
  42              SetCookie('redirectfrom', implode(":",$fromPages), time() + 30, $this->CookiePath);
  43              $this->Redirect($this->Href('', $redirPageName));
  44          }
  45      }
  46  }else{
  47      echo '<span style="color: red; weight: bold">Pr&eacute;sence d\'une redirection vers "' . $this->Link($redirPageName) . '"</span>';
  48  }
  49  ?>


Généré le : Mon Nov 26 12:05:46 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics