448 |
ddelon |
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être \"page\" est manquant.//");
|
|
|
33 |
}else{
|
|
|
34 |
if (eregi("^".$redirPageName."$",$this->GetPageTag())){
|
|
|
35 |
echo $this->Format("//Impossible à une page de se rediriger vers elle même.//");
|
|
|
36 |
}else{
|
|
|
37 |
$fromPages = array();
|
|
|
38 |
$fromPages = explode(":",$_COOKIE['redirectfrom']);
|
|
|
39 |
if (in_array($this->GetPageTag(),$fromPages)){
|
|
|
40 |
echo $this->Format("//Redirection circulaire.//");
|
|
|
41 |
}else{
|
|
|
42 |
$fromPages[] = $this->GetPageTag();
|
|
|
43 |
SetCookie('redirectfrom', implode(":",$fromPages), time() + 30, $this->CookiePath);
|
|
|
44 |
$this->Redirect($this->Href('', $redirPageName));
|
|
|
45 |
}
|
|
|
46 |
}
|
|
|
47 |
}
|
|
|
48 |
?>
|