Subversion Repositories Applications.papyrus

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
448 ddelon 1
<?php
2
/*
3
include.php : Permet d'inclure une page Wiki dans un autre page
4
 
5
Copyright 2003  Eric FELDSTEIN
6
Copyright 2003  Charles NEPOTE
7
This program is free software; you can redistribute it and/or modify
8
it under the terms of the GNU General Public License as published by
9
the Free Software Foundation; either version 2 of the License, or
10
(at your option) any later version.
11
 
12
This program is distributed in the hope that it will be useful,
13
but WITHOUT ANY WARRANTY; without even the implied warranty of
14
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
GNU General Public License for more details.
16
 
17
You should have received a copy of the GNU General Public License
18
along with this program; if not, write to the Free Software
19
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20
*/
21
 
22
/* Paramètres :
23
 -- page : nom wiki de la page a inclure (obligatoire)
24
 -- class : nom de la classe de style à inclure (facultatif)
25
*/
26
 
27
 
28
// récuperation du parametres
29
$incPageName = $this->GetParameter("page");
30
// TODO : améliorer le traitement des classes
31
if ($this->GetParameter("class")) {
32
	$classes='';
33
	$array_classes = explode(" ", $this->GetParameter("class"));
34
	foreach ($array_classes as $c) { $classes = $classes . "include_" . $c . " "; }
35
	}
36
 
37
// Affichage de la page ou d'un message d'erreur
38
if (empty($incPageName)) {
39
	echo $this->Format("//Le paramètre \"page\" est manquant.//");
40
} else {
41
	if (eregi("^".$incPageName."$",$this->GetPageTag())) {
42
		echo $this->Format("//Impossible à une page de s'inclure dans elle même.//");
43
	} else {
44
		if (!$this->HasAccess("read",$incPageName)){
45
			echo $this->Format("//Lecture de la page inclue $page non autorisée.//");
46
		} else {
47
			$incPage = $this->LoadPage($incPageName);
48
			$output = $this->Format($incPage["body"]);
49
			if ($classes) echo "<div class=\"", $classes,"\">\n", $output, "</div>\n";
50
			else echo $output;
51
		}
52
	}
53
}
54
 
55
?>