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 |
// +------------------------------------------------------------------------------------------------------+
|
439 |
ddelon |
24 |
// CVS : $Id: integrateur_wikini.php,v 1.5 2005-09-09 09:37:17 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
|
439 |
ddelon |
36 |
*@version $Revision: 1.5 $ $Date: 2005-09-09 09:37:17 $
|
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 ...
|
437 |
ddelon |
75 |
// TODO : Prevoir de revoir la contrib menu ... qui doit être switchable, ou plutot,
|
|
|
76 |
// TODO : Customiser son menu avec papyrus ...
|
|
|
77 |
// TODO : un wiki par défaut pour chaque papyrus à l'installation de Papyrus
|
|
|
78 |
// TODO : message erreur session
|
|
|
79 |
// TODO : message erreur interwiki
|
|
|
80 |
// TODO : verifier bon dimensionnement des champs et clef de la table papyrus_wiki
|
|
|
81 |
// TODO : creation des tables par defaut à l'installation d'un wikini
|
|
|
82 |
// TODO : Fusion des fichiers de configuration ?
|
|
|
83 |
// TODO : creation automatique des Wikis ...
|
434 |
ddelon |
84 |
|
|
|
85 |
ob_start();
|
436 |
ddelon |
86 |
include_once IW_CHEMIN_WIKINI_COURANT.'wakka.php';
|
434 |
ddelon |
87 |
ob_end_clean();
|
|
|
88 |
$_SERVER['PHP_SELF']=$server;
|
|
|
89 |
|
|
|
90 |
|
|
|
91 |
// On surcharge la classe Wiki pour en faire ce qu'on en veut
|
|
|
92 |
Class Wiki_Papyrus extends Wiki {
|
|
|
93 |
function Format($text, $formatter = "wakka") {
|
436 |
ddelon |
94 |
return $this->IncludeBuffered(IW_CHEMIN_WIKINI_COURANT_FORMATTER.$formatter.".php", "<i>Impossible de trouver le formateur \"$formatter\"</i>", compact("text"));
|
434 |
ddelon |
95 |
}
|
439 |
ddelon |
96 |
|
|
|
97 |
//TODO : a gauche !
|
|
|
98 |
|
434 |
ddelon |
99 |
function Header() {
|
439 |
ddelon |
100 |
return;
|
434 |
ddelon |
101 |
}
|
|
|
102 |
|
|
|
103 |
function Footer() {
|
|
|
104 |
return;
|
|
|
105 |
}
|
439 |
ddelon |
106 |
|
|
|
107 |
// Le diff ne fonctionne pas avec la methode get dans papyrus. On surcharge avec du post.
|
|
|
108 |
|
|
|
109 |
function FormOpen($method = "", $tag = "", $formMethod = "post") {
|
|
|
110 |
|
|
|
111 |
if (($method=="diff") && $formMethod=="get") {
|
|
|
112 |
$formMethod="post";
|
|
|
113 |
}
|
|
|
114 |
|
|
|
115 |
// Appel methode parent
|
|
|
116 |
return parent::FormOpen($method, $tag, $formMethod);
|
|
|
117 |
}
|
434 |
ddelon |
118 |
}
|
|
|
119 |
|
|
|
120 |
|
433 |
ddelon |
121 |
// Appel du fichier de traduction des textes de l'application Integrateur Wikini
|
|
|
122 |
if (file_exists(IW_CHEMIN_LANGUES.'iw_langue_'.IW_I18N.'.inc.php')) {
|
|
|
123 |
/** Inclusion du fichier de traduction de l'application Integrateur Wikini. */
|
|
|
124 |
include_once IW_CHEMIN_LANGUES.'iw_langue_'.IW_I18N.'.inc.php';
|
|
|
125 |
} else {
|
|
|
126 |
/** Inclusion du fichier de traduction fr par défaut. */
|
|
|
127 |
include_once IW_CHEMIN_LANGUES.'iw_langue_fr.inc.php';
|
|
|
128 |
}
|
434 |
ddelon |
129 |
|
|
|
130 |
|
439 |
ddelon |
131 |
/**
|
|
|
132 |
* Renvoie le menu général de l'integrateur Wikini : derniers changement etc.
|
|
|
133 |
*
|
|
|
134 |
* @return string
|
|
|
135 |
* @access public
|
|
|
136 |
*/
|
|
|
137 |
|
|
|
138 |
function afficherContenuMenu()
|
|
|
139 |
{
|
|
|
140 |
|
|
|
141 |
// TODO
|
|
|
142 |
// Changement du niveau d'erreur pour éviter les Notices PHP dues à Wikini
|
|
|
143 |
// error_reporting(E_PARSE);
|
|
|
144 |
|
|
|
145 |
// Autre possibilite : la page speciale MENU
|
|
|
146 |
|
|
|
147 |
|
|
|
148 |
global $wiki;
|
|
|
149 |
global $wikini_config_defaut;
|
|
|
150 |
$sortie='';
|
|
|
151 |
$wakkaConfig = $GLOBALS['wikini_config_defaut'];
|
|
|
152 |
$wiki = new Wiki_Papyrus($wakkaConfig);
|
|
|
153 |
|
|
|
154 |
// Suppression des slash.
|
|
|
155 |
$_REQUEST['wiki'] = preg_replace("/^\//", '', $_REQUEST['wiki']);
|
|
|
156 |
|
|
|
157 |
// split into page/method
|
|
|
158 |
if ( preg_match( "#^(.+?)/(.*)$#", $_REQUEST['wiki'], $matches ) ) {
|
|
|
159 |
list(, $page, $method) = $matches;
|
|
|
160 |
} else if ( preg_match( "#^(.*)$#", $_REQUEST['wiki'], $matches ) ) {
|
|
|
161 |
list(, $page) = $matches;
|
|
|
162 |
}
|
|
|
163 |
|
|
|
164 |
$server=$_SERVER['PHP_SELF'];
|
|
|
165 |
$_SERVER['PHP_SELF']="wakka.php";
|
|
|
166 |
|
|
|
167 |
// Affichage par defaut :
|
|
|
168 |
|
|
|
169 |
$sortie=$wiki->Format("\n----PagePrincipale\nDerniersChangements\nDerniersCommentaires----");
|
|
|
170 |
$sortie.="<a href=\"".$wiki->href("edit",$page)."\" title=\"Cliquez pour éditer cette page.\">Éditer cette page</a>";
|
|
|
171 |
|
|
|
172 |
// Sinon Affichage Page Menu (configurable TODO ?)
|
|
|
173 |
|
|
|
174 |
$contenu=$wiki->LoadPage("PageMenu");
|
|
|
175 |
|
|
|
176 |
$sortie.=$wiki->Format("----");
|
|
|
177 |
$sortie.=$wiki->Format($contenu['body']);
|
|
|
178 |
|
|
|
179 |
$_SERVER['PHP_SELF']=$server;
|
|
|
180 |
|
|
|
181 |
// TODO
|
|
|
182 |
// Retour au niveau d'erreur définit dans le fichier de config de Papyrus
|
|
|
183 |
// error_reporting(GEN_DEBOGAGE_NIVEAU);
|
|
|
184 |
|
|
|
185 |
return $sortie;
|
|
|
186 |
|
|
|
187 |
}
|
|
|
188 |
|
|
|
189 |
|
433 |
ddelon |
190 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
191 |
// | CORPS du PROGRAMME |
|
|
|
192 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
193 |
/** Fonction afficherContenuCorps() - Fonction appelé par le gestionnaire Papyrus.
|
|
|
194 |
*
|
|
|
195 |
* Elle retourne le contenu de l'application.
|
|
|
196 |
*
|
|
|
197 |
* @return string du code XHTML correspondant au contenu renvoyé par l'application.
|
|
|
198 |
*/
|
|
|
199 |
function afficherContenuCorps()
|
|
|
200 |
{
|
439 |
ddelon |
201 |
|
|
|
202 |
print "la";
|
|
|
203 |
// TODO
|
|
|
204 |
// Changement du niveau d'erreur pour éviter les Notices PHP dues à Wikini
|
|
|
205 |
// error_reporting(E_PARSE);
|
436 |
ddelon |
206 |
|
434 |
ddelon |
207 |
global $wiki;
|
436 |
ddelon |
208 |
global $wikini_config_defaut;
|
434 |
ddelon |
209 |
$sortie='';
|
433 |
ddelon |
210 |
$wakkaConfig = $GLOBALS['wikini_config_defaut'];
|
434 |
ddelon |
211 |
$wiki = new Wiki_Papyrus($wakkaConfig);
|
|
|
212 |
|
439 |
ddelon |
213 |
|
434 |
ddelon |
214 |
// Gestion de la variable de session "linktracking"
|
433 |
ddelon |
215 |
if ( ! isset( $_SESSION['linktracking'] ) ) {
|
|
|
216 |
$_SESSION['linktracking'] = 1;
|
|
|
217 |
}
|
434 |
ddelon |
218 |
|
433 |
ddelon |
219 |
// Suppression des slash.
|
434 |
ddelon |
220 |
$_REQUEST['wiki'] = preg_replace("/^\//", '', $_REQUEST['wiki']);
|
|
|
221 |
|
433 |
ddelon |
222 |
// split into page/method
|
434 |
ddelon |
223 |
if ( preg_match( "#^(.+?)/(.*)$#", $_REQUEST['wiki'], $matches ) ) {
|
433 |
ddelon |
224 |
list(, $page, $method) = $matches;
|
434 |
ddelon |
225 |
} else if ( preg_match( "#^(.*)$#", $_REQUEST['wiki'], $matches ) ) {
|
433 |
ddelon |
226 |
list(, $page) = $matches;
|
|
|
227 |
}
|
|
|
228 |
|
|
|
229 |
// Vérification de la méthode d'affichage employée!
|
|
|
230 |
if ( ! isset( $method ) ) {
|
|
|
231 |
$method = '';
|
|
|
232 |
}
|
434 |
ddelon |
233 |
|
433 |
ddelon |
234 |
//Récupération du contenu de la page Wikini
|
|
|
235 |
|
434 |
ddelon |
236 |
ob_start();
|
|
|
237 |
|
|
|
238 |
$server=$_SERVER['PHP_SELF'];
|
|
|
239 |
$_SERVER['PHP_SELF']="wakka.php";
|
|
|
240 |
|
|
|
241 |
$wiki->Run($page, $method);
|
|
|
242 |
|
|
|
243 |
$_SERVER['PHP_SELF']=$server;
|
|
|
244 |
|
|
|
245 |
$sortie.= ob_get_contents();
|
|
|
246 |
ob_end_clean();
|
|
|
247 |
|
439 |
ddelon |
248 |
// TODO
|
|
|
249 |
// Retour au niveau d'erreur définit dans le fichier de config de Papyrus
|
|
|
250 |
// error_reporting(GEN_DEBOGAGE_NIVEAU);
|
|
|
251 |
|
434 |
ddelon |
252 |
return remplacerEntiteHTLM("<div id=\"wikini_page\" ondblclick=\"document.location='".$wiki->href("edit")."';"."\">"."\n".$sortie.'</div>'."\n");
|
|
|
253 |
|
|
|
254 |
|
433 |
ddelon |
255 |
}
|
|
|
256 |
|
434 |
ddelon |
257 |
|
|
|
258 |
// TODO : qu'affiche-t-on en pied ?
|
433 |
ddelon |
259 |
/** Fonction afficherContenuPied() - Fonction appelé par le gestionnaire Papyrus.
|
|
|
260 |
*
|
|
|
261 |
* Elle retourne le pied de l'application.
|
|
|
262 |
*
|
|
|
263 |
* @return string du code XHTML correspondant au pied renvoyé par l'application.
|
|
|
264 |
*/
|
|
|
265 |
function afficherContenuPied()
|
|
|
266 |
{
|
|
|
267 |
return inclusion_html('pied_page');
|
|
|
268 |
}
|
|
|
269 |
?>
|