433 |
ddelon |
1 |
<?php
|
|
|
2 |
/*vim: set expandtab tabstop=4 shiftwidth=4: */
|
|
|
3 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
4 |
// | PHP version 4.1 |
|
|
|
5 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
6 |
// | Copyright (C) 2005 Tela Botanica (accueil@tela-botanica.org) |
|
|
|
7 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
8 |
// | This file is part of Integrateur Wikini. |
|
|
|
9 |
// | |
|
|
|
10 |
// | Foobar is free software; you can redistribute it and/or modify |
|
|
|
11 |
// | it under the terms of the GNU General Public License as published by |
|
|
|
12 |
// | the Free Software Foundation; either version 2 of the License, or |
|
|
|
13 |
// | (at your option) any later version. |
|
|
|
14 |
// | |
|
|
|
15 |
// | Foobar is distributed in the hope that it will be useful, |
|
|
|
16 |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
|
|
17 |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
|
|
18 |
// | GNU General Public License for more details. |
|
|
|
19 |
// | |
|
|
|
20 |
// | You should have received a copy of the GNU General Public License |
|
|
|
21 |
// | along with Foobar; if not, write to the Free Software |
|
|
|
22 |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
|
|
23 |
// +------------------------------------------------------------------------------------------------------+
|
436 |
ddelon |
24 |
// CVS : $Id: integrateur_wikini.php,v 1.3 2005-08-31 17:34:52 ddelon Exp $
|
433 |
ddelon |
25 |
/**
|
|
|
26 |
* Integrateur de page Wikini
|
|
|
27 |
*
|
|
|
28 |
* Application permettant d'intégrer des pages wikini dans Papyrus.
|
|
|
29 |
*
|
|
|
30 |
*@package IntegrateurWikini
|
|
|
31 |
//Auteur original :
|
|
|
32 |
*@author Jean-Pascal MILCENT <jpm@tela-botanica.org>
|
|
|
33 |
//Autres auteurs :
|
|
|
34 |
*@author Aucun
|
|
|
35 |
*@copyright Tela-Botanica 2000-2004
|
436 |
ddelon |
36 |
*@version $Revision: 1.3 $ $Date: 2005-08-31 17:34:52 $
|
434 |
ddelon |
37 |
*
|
433 |
ddelon |
38 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
39 |
// | ENTETE du PROGRAMME |
|
|
|
40 |
// +------------------------------------------------------------------------------------------------------+
|
436 |
ddelon |
41 |
|
|
|
42 |
|
433 |
ddelon |
43 |
/** Inclusion de la classe PEAR de gestion des URL. */
|
|
|
44 |
require_once 'Net/URL.php';
|
436 |
ddelon |
45 |
|
|
|
46 |
// TODO : un seul fichier de configuration ?
|
|
|
47 |
/** Inclusion du fichier de configuration de cette application.*/
|
|
|
48 |
require_once 'client/integrateur_wikini/configuration/adwi_configuration.inc.php';
|
|
|
49 |
|
|
|
50 |
require_once ADWI_CHEMIN_BIBLIOTHEQUE.'adwi_wikini.fonct.php';
|
|
|
51 |
|
433 |
ddelon |
52 |
/** Inclusion du fichier de configuration général de IntegrateurWikini.*/
|
|
|
53 |
require_once 'client'.GEN_SEP.'integrateur_wikini'.GEN_SEP.'configuration'.GEN_SEP.'iw_config.inc.php';
|
|
|
54 |
|
|
|
55 |
/** Inclusion du fichier permettant d'encoder du texte mais pas les balises XHTML.*/
|
|
|
56 |
require_once IW_CHEMIN_BIBLIO.'iw_encodage.fonct.php';
|
|
|
57 |
/** Inclusion du fichier permettant d'inclure les données dans du XHTML.*/
|
|
|
58 |
require_once IW_CHEMIN_BIBLIO.'iw_affichage_xhtml.fonct.php';
|
|
|
59 |
|
436 |
ddelon |
60 |
global $wikini_config_defaut;
|
434 |
ddelon |
61 |
global $wiki;
|
|
|
62 |
global $wiki_p;
|
433 |
ddelon |
63 |
|
436 |
ddelon |
64 |
|
|
|
65 |
// $_REQUEST['wiki'] est obligatoire, car wakka.php envoie un redirect si non detecté, avec perte de tout l'environnement !
|
|
|
66 |
|
434 |
ddelon |
67 |
if ( ! isset( $_REQUEST['wiki'] ) ) {
|
436 |
ddelon |
68 |
$_REQUEST['wiki'] = $wikini_config_defaut['root_page'];
|
434 |
ddelon |
69 |
}
|
|
|
70 |
|
|
|
71 |
$server=$_SERVER['PHP_SELF'];
|
|
|
72 |
$_SERVER['PHP_SELF']="wakka.php";
|
|
|
73 |
|
|
|
74 |
// Utilise le wakkaconfig de la racine ...
|
|
|
75 |
// TODO : generer un wakkaconfig en fonction des parametres, dans un temp et l'ecrire
|
|
|
76 |
// juste avant ... : bof (car conflits possibles).
|
|
|
77 |
// Ou alors : on utilise un wakkaconfig generique à minima ...
|
|
|
78 |
// Dans tous les cas, il faut gerer le WakaConfig Generique !
|
|
|
79 |
// Prevoir de revoir la contrib menu ... qui doit être switchable, ou plutot,
|
|
|
80 |
// Customiser son menu avec papyrus ...
|
|
|
81 |
|
|
|
82 |
ob_start();
|
436 |
ddelon |
83 |
include_once IW_CHEMIN_WIKINI_COURANT.'wakka.php';
|
434 |
ddelon |
84 |
ob_end_clean();
|
|
|
85 |
$_SERVER['PHP_SELF']=$server;
|
|
|
86 |
|
|
|
87 |
|
|
|
88 |
// On surcharge la classe Wiki pour en faire ce qu'on en veut
|
|
|
89 |
Class Wiki_Papyrus extends Wiki {
|
|
|
90 |
function Format($text, $formatter = "wakka") {
|
436 |
ddelon |
91 |
return $this->IncludeBuffered(IW_CHEMIN_WIKINI_COURANT_FORMATTER.$formatter.".php", "<i>Impossible de trouver le formateur \"$formatter\"</i>", compact("text"));
|
434 |
ddelon |
92 |
}
|
|
|
93 |
function Header() {
|
|
|
94 |
|
|
|
95 |
$sortie='';
|
|
|
96 |
$sortie.='<h1 class="wiki_name">';
|
|
|
97 |
// Todo : Initialiser : wakka_nom
|
|
|
98 |
$sortie.= $this->config["wakka_name"];
|
|
|
99 |
$sortie.='</h1>';
|
|
|
100 |
$sortie.='<h1 class="page_name">';
|
|
|
101 |
$sortie.='<a href="';
|
|
|
102 |
$sortie.=$this->config["base_url"];
|
|
|
103 |
$sortie.='RechercheTexte&phrase=';
|
|
|
104 |
$sortie.=htmlentities($this->GetPageTag());
|
|
|
105 |
$sortie.='">';
|
|
|
106 |
$sortie.=htmlentities($this->GetPageTag());
|
|
|
107 |
$sortie.='</a>';
|
|
|
108 |
$sortie.='</h1>';
|
|
|
109 |
|
|
|
110 |
$sortie.='<div class="header">';
|
|
|
111 |
$sortie.= $this->ComposeLinkToPage($this->config["root_page"]).'::';
|
|
|
112 |
$sortie.= $this->config["navigation_links"] ? $this->Format($this->config["navigation_links"])." :: \n" : "";
|
|
|
113 |
$sortie.='Vous êtes ';
|
|
|
114 |
$sortie.= $this->Format($this->GetUserName());
|
|
|
115 |
if ($user = $this->GetUser()) {
|
|
|
116 |
$sortie.="(<a href=\"".$this->config["base_url"]."ParametresUtilisateur&action=logout\">Déconnexion</a>)\n";
|
|
|
117 |
}
|
|
|
118 |
$sortie.='</div>';
|
|
|
119 |
return $sortie;
|
|
|
120 |
}
|
|
|
121 |
|
|
|
122 |
function Footer() {
|
|
|
123 |
return;
|
|
|
124 |
}
|
|
|
125 |
}
|
|
|
126 |
|
|
|
127 |
|
433 |
ddelon |
128 |
// Appel du fichier de traduction des textes de l'application Integrateur Wikini
|
|
|
129 |
if (file_exists(IW_CHEMIN_LANGUES.'iw_langue_'.IW_I18N.'.inc.php')) {
|
|
|
130 |
/** Inclusion du fichier de traduction de l'application Integrateur Wikini. */
|
|
|
131 |
include_once IW_CHEMIN_LANGUES.'iw_langue_'.IW_I18N.'.inc.php';
|
|
|
132 |
} else {
|
|
|
133 |
/** Inclusion du fichier de traduction fr par défaut. */
|
|
|
134 |
include_once IW_CHEMIN_LANGUES.'iw_langue_fr.inc.php';
|
|
|
135 |
}
|
434 |
ddelon |
136 |
|
|
|
137 |
|
433 |
ddelon |
138 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
139 |
// | CORPS du PROGRAMME |
|
|
|
140 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
141 |
/** Fonction afficherContenuCorps() - Fonction appelé par le gestionnaire Papyrus.
|
|
|
142 |
*
|
|
|
143 |
* Elle retourne le contenu de l'application.
|
|
|
144 |
*
|
|
|
145 |
* @return string du code XHTML correspondant au contenu renvoyé par l'application.
|
|
|
146 |
*/
|
|
|
147 |
function afficherContenuCorps()
|
|
|
148 |
{
|
436 |
ddelon |
149 |
|
434 |
ddelon |
150 |
global $wiki;
|
436 |
ddelon |
151 |
global $wikini_config_defaut;
|
434 |
ddelon |
152 |
$sortie='';
|
433 |
ddelon |
153 |
$wakkaConfig = $GLOBALS['wikini_config_defaut'];
|
434 |
ddelon |
154 |
$wiki = new Wiki_Papyrus($wakkaConfig);
|
|
|
155 |
|
|
|
156 |
// Gestion de la variable de session "linktracking"
|
433 |
ddelon |
157 |
if ( ! isset( $_SESSION['linktracking'] ) ) {
|
|
|
158 |
$_SESSION['linktracking'] = 1;
|
|
|
159 |
}
|
434 |
ddelon |
160 |
|
433 |
ddelon |
161 |
// Suppression des slash.
|
434 |
ddelon |
162 |
$_REQUEST['wiki'] = preg_replace("/^\//", '', $_REQUEST['wiki']);
|
|
|
163 |
|
433 |
ddelon |
164 |
// split into page/method
|
434 |
ddelon |
165 |
if ( preg_match( "#^(.+?)/(.*)$#", $_REQUEST['wiki'], $matches ) ) {
|
433 |
ddelon |
166 |
list(, $page, $method) = $matches;
|
434 |
ddelon |
167 |
} else if ( preg_match( "#^(.*)$#", $_REQUEST['wiki'], $matches ) ) {
|
433 |
ddelon |
168 |
list(, $page) = $matches;
|
|
|
169 |
}
|
|
|
170 |
|
|
|
171 |
// Vérification de la méthode d'affichage employée!
|
|
|
172 |
if ( ! isset( $method ) ) {
|
|
|
173 |
$method = '';
|
|
|
174 |
}
|
434 |
ddelon |
175 |
|
433 |
ddelon |
176 |
//Récupération du contenu de la page Wikini
|
|
|
177 |
|
434 |
ddelon |
178 |
ob_start();
|
|
|
179 |
|
|
|
180 |
$server=$_SERVER['PHP_SELF'];
|
|
|
181 |
$_SERVER['PHP_SELF']="wakka.php";
|
|
|
182 |
|
|
|
183 |
$wiki->Run($page, $method);
|
|
|
184 |
|
|
|
185 |
$_SERVER['PHP_SELF']=$server;
|
|
|
186 |
|
|
|
187 |
$sortie.= ob_get_contents();
|
|
|
188 |
ob_end_clean();
|
|
|
189 |
|
|
|
190 |
|
|
|
191 |
return remplacerEntiteHTLM("<div id=\"wikini_page\" ondblclick=\"document.location='".$wiki->href("edit")."';"."\">"."\n".$sortie.'</div>'."\n");
|
|
|
192 |
|
|
|
193 |
|
433 |
ddelon |
194 |
}
|
|
|
195 |
|
434 |
ddelon |
196 |
|
|
|
197 |
// TODO : qu'affiche-t-on en pied ?
|
433 |
ddelon |
198 |
/** Fonction afficherContenuPied() - Fonction appelé par le gestionnaire Papyrus.
|
|
|
199 |
*
|
|
|
200 |
* Elle retourne le pied de l'application.
|
|
|
201 |
*
|
|
|
202 |
* @return string du code XHTML correspondant au pied renvoyé par l'application.
|
|
|
203 |
*/
|
|
|
204 |
function afficherContenuPied()
|
|
|
205 |
{
|
436 |
ddelon |
206 |
return;
|
433 |
ddelon |
207 |
return inclusion_html('pied_page');
|
|
|
208 |
}
|
|
|
209 |
?>
|