Subversion Repositories Applications.papyrus

Rev

Rev 443 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 443 Rev 444
1
<?php
1
<?php
2
/*vim: set expandtab tabstop=4 shiftwidth=4: */ 
2
/*vim: set expandtab tabstop=4 shiftwidth=4: */ 
3
// +------------------------------------------------------------------------------------------------------+
3
// +------------------------------------------------------------------------------------------------------+
4
// | PHP version 4.1                                                                                      |
4
// | PHP version 4.1                                                                                      |
5
// +------------------------------------------------------------------------------------------------------+
5
// +------------------------------------------------------------------------------------------------------+
6
// | Copyright (C) 2005 Tela Botanica (accueil@tela-botanica.org)                                         |
6
// | Copyright (C) 2005 Tela Botanica (accueil@tela-botanica.org)                                         |
7
// +------------------------------------------------------------------------------------------------------+
7
// +------------------------------------------------------------------------------------------------------+
8
// | This file is part of Integrateur Wikini.                                                             |
8
// | This file is part of Integrateur Wikini.                                                             |
9
// |                                                                                                      |
9
// |                                                                                                      |
10
// | Foobar is free software; you can redistribute it and/or modify                                       |
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                                 |
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                                    |
12
// | the Free Software Foundation; either version 2 of the License, or                                    |
13
// | (at your option) any later version.                                                                  |
13
// | (at your option) any later version.                                                                  |
14
// |                                                                                                      |
14
// |                                                                                                      |
15
// | Foobar is distributed in the hope that it will be useful,                                            |
15
// | Foobar is distributed in the hope that it will be useful,                                            |
16
// | but WITHOUT ANY WARRANTY; without even the implied warranty of                                       |
16
// | but WITHOUT ANY WARRANTY; without even the implied warranty of                                       |
17
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                        |
17
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                        |
18
// | GNU General Public License for more details.                                                         |
18
// | GNU General Public License for more details.                                                         |
19
// |                                                                                                      |
19
// |                                                                                                      |
20
// | You should have received a copy of the GNU General Public License                                    |
20
// | You should have received a copy of the GNU General Public License                                    |
21
// | along with Foobar; if not, write to the Free Software                                                |
21
// | along with Foobar; if not, write to the Free Software                                                |
22
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
22
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
23
// +------------------------------------------------------------------------------------------------------+
23
// +------------------------------------------------------------------------------------------------------+
24
// CVS : $Id: integrateur_wikini.php,v 1.7 2005-09-20 17:01:22 ddelon Exp $
24
// CVS : $Id: integrateur_wikini.php,v 1.8 2005-09-20 20:25:39 ddelon Exp $
25
/**
25
/**
26
* Integrateur de page Wikini
26
* Integrateur de page Wikini
27
*
27
*
28
* Application permettant d'intégrer des pages wikini dans Papyrus.
28
* Application permettant d'intégrer des pages wikini dans Papyrus.
29
*
29
*
30
*@package IntegrateurWikini
30
*@package IntegrateurWikini
31
//Auteur original :
31
//Auteur original :
32
*@author        Jean-Pascal MILCENT <jpm@tela-botanica.org>
32
*@author        Jean-Pascal MILCENT <jpm@tela-botanica.org>
33
//Autres auteurs :
33
//Autres auteurs :
34
*@author        Aucun
34
*@author        Aucun
35
*@copyright     Tela-Botanica 2000-2004
35
*@copyright     Tela-Botanica 2000-2004
36
*@version       $Revision: 1.7 $ $Date: 2005-09-20 17:01:22 $
36
*@version       $Revision: 1.8 $ $Date: 2005-09-20 20:25:39 $
37
*
37
*
38
// +------------------------------------------------------------------------------------------------------+
38
// +------------------------------------------------------------------------------------------------------+
39
// |                                            ENTETE du PROGRAMME                                       |
39
// |                                            ENTETE du PROGRAMME                                       |
40
// +------------------------------------------------------------------------------------------------------+
40
// +------------------------------------------------------------------------------------------------------+
41
 
41
 
-
 
42
 
-
 
43
 
42
 
44
 
-
 
45
/** Inclusion de la classe PEAR de gestion des URL. */
-
 
46
 
-
 
47
 
-
 
48
$GLOBALS['_PAPYRUS_']['erreur']->setActive(0);
43
/** Inclusion de la classe PEAR de gestion des URL. */
49
 
44
require_once 'Net/URL.php';
50
require_once 'Net/URL.php';
45
 
51
 
46
// TODO : un seul fichier de configuration ?
52
// TODO : un seul fichier de configuration ?
47
/** Inclusion du fichier de configuration de cette application.*/
53
/** Inclusion du fichier de configuration de cette application.*/
48
require_once 'client/integrateur_wikini/configuration/adwi_configuration.inc.php';
54
require_once 'client/integrateur_wikini/configuration/adwi_configuration.inc.php';
49
 
55
 
50
require_once ADWI_CHEMIN_BIBLIOTHEQUE.'adwi_wikini.fonct.php';
56
require_once ADWI_CHEMIN_BIBLIOTHEQUE.'adwi_wikini.fonct.php';
51
 
57
 
52
/** Inclusion du fichier de configuration général de IntegrateurWikini.*/
58
/** 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';
59
require_once 'client'.GEN_SEP.'integrateur_wikini'.GEN_SEP.'configuration'.GEN_SEP.'iw_config.inc.php';
54
 
60
 
55
/** Inclusion du fichier permettant d'encoder du texte mais pas les balises XHTML.*/
61
/** Inclusion du fichier permettant d'encoder du texte mais pas les balises XHTML.*/
56
require_once IW_CHEMIN_BIBLIO.'iw_encodage.fonct.php';
62
require_once IW_CHEMIN_BIBLIO.'iw_encodage.fonct.php';
57
/** Inclusion du fichier permettant d'inclure les données dans du XHTML.*/
63
/** Inclusion du fichier permettant d'inclure les données dans du XHTML.*/
58
require_once IW_CHEMIN_BIBLIO.'iw_affichage_xhtml.fonct.php';
64
require_once IW_CHEMIN_BIBLIO.'iw_affichage_xhtml.fonct.php';
59
 
65
 
60
global $wikini_config_defaut;
66
global $wikini_config_defaut;
61
global $wiki;
67
global $wiki;
62
global $wiki_p;
68
global $wiki_p;
63
 
-
 
64
 
69
 
65
// $_REQUEST['wiki'] est obligatoire, car wakka.php envoie un redirect si non detecté, avec perte de tout l'environnement !
70
// $_REQUEST['wiki'] est obligatoire, car wakka.php envoie un redirect si non detecté, avec perte de tout l'environnement !
66
 
71
 
67
if ( ! isset( $_REQUEST['wiki'] ) ) {
72
if ( ! isset( $_REQUEST['wiki'] ) ) {
68
	    $_REQUEST['wiki'] = $wikini_config_defaut['root_page'];
73
	    $_REQUEST['wiki'] = $wikini_config_defaut['root_page'];
69
}
74
}
70
 
75
 
71
$server=$_SERVER['PHP_SELF'];
76
$server=$_SERVER['PHP_SELF'];
72
$_SERVER['PHP_SELF']="wakka.php";
77
$_SERVER['PHP_SELF']="wakka.php";
73
 
78
 
74
// Utilise le wakkaconfig de la racine ...
79
// Utilise le wakkaconfig de la racine ...
75
// TODO : Prevoir de revoir la contrib menu ... qui doit être switchable, ou plutot,
80
// TODO : Prevoir de revoir la contrib menu ... qui doit être switchable, ou plutot,
76
// TODO : Customiser son menu avec papyrus ...
81
// TODO : Customiser son menu avec papyrus ...
77
// TODO : un wiki par défaut pour chaque papyrus à l'installation de Papyrus
82
// TODO : un wiki par défaut pour chaque papyrus à l'installation de Papyrus
78
// TODO : message erreur session 
83
// TODO : message erreur session 
79
// TODO : message erreur interwiki
84
// TODO : message erreur interwiki
80
// TODO : verifier bon dimensionnement des champs et clef de la table papyrus_wiki
85
// 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
86
// TODO : creation des tables par defaut à l'installation d'un wikini
82
// TODO : Fusion des fichiers de configuration ?
87
// TODO : Fusion des fichiers de configuration ?
83
// TODO : creation automatique des Wikis ...
88
// TODO : creation automatique des Wikis ...
84
 
89
 
85
ob_start();
90
ob_start();
86
 
91
 
87
include_once IW_CHEMIN_WIKINI_COURANT.'wakka.php';
92
include_once IW_CHEMIN_WIKINI_COURANT.'wakka.php';
88
ob_end_clean();
93
ob_end_clean();
89
$_SERVER['PHP_SELF']=$server;
94
$_SERVER['PHP_SELF']=$server;
90
 
95
 
91
 
96
 
92
// On surcharge la classe Wiki pour en faire ce qu'on en veut
97
// On surcharge la classe Wiki pour en faire ce qu'on en veut
93
Class Wiki_Papyrus extends Wiki {
98
Class Wiki_Papyrus extends Wiki {
94
	
99
	
95
    
100
    
96
	//TODO : a gauche !
101
	//TODO : a gauche !
97
	
102
	
98
	function Header() {
103
	function Header() {
99
		
104
		
100
		return;
105
		return;
101
	}	
106
	}	
102
 
107
 
103
 	function Footer() {
108
 	function Footer() {
104
		return;
109
		return;
105
 	}
110
 	}
106
	
111
	
107
	function FormOpen($method = "", $tag = "", $formMethod = "post") {
112
	function FormOpen($method = "", $tag = "", $formMethod = "post") {
108
	
113
	
109
	// Le diff ne fonctionne pas avec la methode get dans papyrus. On surcharge avec du post. 
114
	// Le diff ne fonctionne pas avec la methode get dans papyrus. On surcharge avec du post. 
110
		
115
		
111
		if (($method=="diff") && $formMethod=="get") {
116
		if (($method=="diff") && $formMethod=="get") {
112
			$formMethod="post";	
117
			$formMethod="post";	
113
		}
118
		}
114
	
119
	
115
		if ($method=="edit") {
120
		if ($method=="edit") {
116
            $result = "<form id=\"ACEditor\" name=\"ACEditor\" action=\"".$this->href($method, $tag)."\" method=\"".$formMethod."\">\n";
121
            $result = "<form id=\"ACEditor\" name=\"ACEditor\" action=\"".$this->href($method, $tag)."\" method=\"".$formMethod."\">\n";
117
            return $result;
122
            return $result;
118
		}
123
		}
119
		
124
		
120
		return Parent::FormOpen($method,$tag, $formMethod);
125
		return Parent::FormOpen($method,$tag, $formMethod);
121
		
126
		
122
	}
127
	}
123
	// Detournement des handlers : comme ca on peut faire ce que l'on veut ....
128
	// Detournement des handlers : comme ca on peut faire ce que l'on veut ....
124
	function Method($method) {
129
	function Method($method) {
125
		
130
		
126
		if ($method=="edit") {
131
		if ($method=="edit") {
127
	
132
	
128
			echo $this->Header();
133
			echo $this->Header();
129
			
134
			
130
			$result='';
135
			$result='';
131
								
136
								
132
			if ($_POST) {
137
			if ($_POST) {
133
				if ($_POST["submit"] == "Sauver")	{
138
				if ($_POST["submit"] == "Sauver")	{
134
				// check for overwriting
139
				// check for overwriting
135
					if ($this->page) {
140
					if ($this->page) {
136
						if ($this->page["id"] != $_POST["previous"]) {
141
						if ($this->page["id"] != $_POST["previous"]) {
137
							$error = "ALERTE : ".
142
							$error = "ALERTE : ".
138
							"Cette page a &eacute;t&eacute; modifi&eacute;e par quelqu'un d'autre pendant que vous l'&eacute;ditiez.<br />\n".
143
							"Cette page a &eacute;t&eacute; modifi&eacute;e par quelqu'un d'autre pendant que vous l'&eacute;ditiez.<br />\n".
139
							"Veuillez copier vos changements et r&eacute;&eacute;diter cette page.\n";
144
							"Veuillez copier vos changements et r&eacute;&eacute;diter cette page.\n";
140
						}
145
						}
141
					}
146
					}
142
					// store
147
					// store
143
					if (!$error) {
148
					if (!$error) {
144
						$body = str_replace("\r", "", $_POST["body"]);
149
						$body = str_replace("\r", "", $_POST["body"]);
145
						// test si la nouvelle page est differente de la précédente
150
						// test si la nouvelle page est differente de la précédente
146
						if(rtrim($body)==rtrim($this->page["body"])) {
151
						if(rtrim($body)==rtrim($this->page["body"])) {
147
							$this->SetMessage("Cette page n\'a pas &eacute;t&eacute; enregistr&eacute;e car elle n\'a subi aucune modification.");
152
							$this->SetMessage("Cette page n\'a pas &eacute;t&eacute; enregistr&eacute;e car elle n\'a subi aucune modification.");
148
							$this->Redirect($this->href());
153
							$this->Redirect($this->href());
149
						}
154
						}
150
	
155
	
151
						// add page (revisions)
156
						// add page (revisions)
152
						$this->SavePage($this->tag, $body);
157
						$this->SavePage($this->tag, $body);
153
		
158
		
154
						// now we render it internally so we can write the updated link table.
159
						// now we render it internally so we can write the updated link table.
155
						$this->ClearLinkTable();
160
						$this->ClearLinkTable();
156
						$this->StartLinkTracking();
161
						$this->StartLinkTracking();
157
						$dummy = $this->Header();
162
						$dummy = $this->Header();
158
						$dummy .= $this->Format($body);
163
						$dummy .= $this->Format($body);
159
						$dummy .= $this->Footer();
164
						$dummy .= $this->Footer();
160
						$this->StopLinkTracking();
165
						$this->StopLinkTracking();
161
						$this->WriteLinkTable();
166
						$this->WriteLinkTable();
162
						$this->ClearLinkTable();
167
						$this->ClearLinkTable();
163
		
168
		
164
						// forward
169
						// forward
165
						$this->Redirect($this->href());
170
						$this->Redirect($this->href());
166
					}
171
					}
167
				}
172
				}
168
			}
173
			}
169
 
174
 
170
			// fetch fields
175
			// fetch fields
171
			if (!$previous = $_POST["previous"]) $previous = $this->page["id"];
176
			if (!$previous = $_POST["previous"]) $previous = $this->page["id"];
172
			if (!$body = $_POST["body"]) $body = $this->page["body"];
177
			if (!$body = $_POST["body"]) $body = $this->page["body"];
173
			
178
			
174
			// preview?
179
			// preview?
175
			if ($_POST["submit"] == "Aperçu")
180
			if ($_POST["submit"] == "Aperçu")
176
			{
181
			{
177
				$result .=
182
				$result .=
178
					"<div class=\"prev_alert\"><strong>Aper&ccedil;u</strong></div>\n".
183
					"<div class=\"prev_alert\"><strong>Aper&ccedil;u</strong></div>\n".
179
					$this->Format($body)."\n\n".
184
					$this->Format($body)."\n\n".
180
					$this->FormOpen("edit").
185
					$this->FormOpen("edit").
181
					"<input type=\"hidden\" name=\"previous\" value=\"".$previous."\" />\n".
186
					"<input type=\"hidden\" name=\"previous\" value=\"".$previous."\" />\n".
182
					"<input type=\"hidden\" name=\"body\" value=\"".htmlentities($body)."\" />\n".
187
					"<input type=\"hidden\" name=\"body\" value=\"".htmlentities($body)."\" />\n".
183
					"<br />\n".
188
					"<br />\n".
184
					"<input name=\"submit\" type=\"submit\" value=\"Sauver\" accesskey=\"s\" />\n".
189
					"<input name=\"submit\" type=\"submit\" value=\"Sauver\" accesskey=\"s\" />\n".
185
					"<input name=\"submit\" type=\"submit\" value=\"R&eacute;&eacute;diter \" accesskey=\"p\" />\n".
190
					"<input name=\"submit\" type=\"submit\" value=\"R&eacute;&eacute;diter \" accesskey=\"p\" />\n".
186
					"<input type=\"button\" value=\"Annulation\" onclick=\"document.location='".$this->href("")."';\" />\n".
191
					"<input type=\"button\" value=\"Annulation\" onclick=\"document.location='".$this->href("")."';\" />\n".
187
					$this->FormClose()."\n";
192
					$this->FormClose()."\n";
188
				return $result;
193
				return $result;
189
			}
194
			}
190
			else
195
			else
191
			{
196
			{
192
					
197
					
193
			    require_once(IW_CHEMIN_BIBLIO_ACEDITOR."ACeditor.buttonsBar.php");
198
			    require_once(IW_CHEMIN_BIBLIO_ACEDITOR."ACeditor.buttonsBar.php");
194
			    
199
			    
195
				$result .=
200
				$result .=
196
				$this->FormOpen("edit").
201
				$this->FormOpen("edit").
197
				"<input type=\"hidden\" name=\"previous\" value=\"".$previous."\" />\n".$ACbuttonsBar.
202
				"<input type=\"hidden\" name=\"previous\" value=\"".$previous."\" />\n".$ACbuttonsBar.
198
				"<textarea onkeydown=\"fKeyDown()\" name=\"body\" cols=\"60\" rows=\"40\" wrap=\"soft\" class=\"edit\">\n".
203
				"<textarea onkeydown=\"fKeyDown()\" name=\"body\" cols=\"60\" rows=\"40\" wrap=\"soft\" class=\"edit\">\n".
199
				htmlspecialchars($body).
204
				htmlspecialchars($body).
200
				"\n</textarea><br />\n".
205
				"\n</textarea><br />\n".
201
				($this->config["preview_before_save"] ? "" : "<input name=\"submit\" type=\"submit\" value=\"Sauver\" accesskey=\"s\" />\n").
206
				($this->config["preview_before_save"] ? "" : "<input name=\"submit\" type=\"submit\" value=\"Sauver\" accesskey=\"s\" />\n").
202
				"<input name=\"submit\" type=\"submit\" value=\"Aper&ccedil;u\" accesskey=\"p\" />\n".
207
				"<input name=\"submit\" type=\"submit\" value=\"Aper&ccedil;u\" accesskey=\"p\" />\n".
203
				"<input type=\"button\" value=\"Annulation\" onclick=\"document.location='".$this->href("")."';\" />\n".
208
				"<input type=\"button\" value=\"Annulation\" onclick=\"document.location='".$this->href("")."';\" />\n".
204
				$this->FormClose();
209
				$this->FormClose();
205
				
210
				
206
				return $result;
211
				return $result;
207
			}
212
			}
208
		
213
		
209
		}
214
		}
210
		else {
215
		else {
211
			return parent::Method($method);
216
			return parent::Method($method);
212
		}
217
		}
213
	}
218
	}
214
	
219
	
215
	
220
	
216
	// Surcharge Format a cause probleme de chemin. 
221
	// Surcharge Format a cause probleme de chemin. 
217
	
222
	
218
	function Format($text, $formatter = "wakka") {
223
	function Format($text, $formatter = "wakka") {
219
		return $this->IncludeBuffered(IW_CHEMIN_WIKINI_COURANT_FORMATTER.$formatter.".php", "<i>Impossible de trouver le formateur \"$formatter\"</i>", compact("text")); 
224
		return $this->IncludeBuffered(IW_CHEMIN_WIKINI_COURANT_FORMATTER.$formatter.".php", "<i>Impossible de trouver le formateur \"$formatter\"</i>", compact("text")); 
220
	}
225
	}
221
	
226
	
222
	
227
	
223
}
228
}
224
 
229
 
225
		
230
		
226
		
231
		
227
// Appel du fichier de traduction des textes de l'application Integrateur Wikini
232
// Appel du fichier de traduction des textes de l'application Integrateur Wikini
228
if (file_exists(IW_CHEMIN_LANGUES.'iw_langue_'.IW_I18N.'.inc.php')) {
233
if (file_exists(IW_CHEMIN_LANGUES.'iw_langue_'.IW_I18N.'.inc.php')) {
229
    /** Inclusion du fichier de traduction de l'application Integrateur Wikini. */
234
    /** Inclusion du fichier de traduction de l'application Integrateur Wikini. */
230
    include_once IW_CHEMIN_LANGUES.'iw_langue_'.IW_I18N.'.inc.php';
235
    include_once IW_CHEMIN_LANGUES.'iw_langue_'.IW_I18N.'.inc.php';
231
} else {
236
} else {
232
    /** Inclusion du fichier de traduction fr par défaut. */
237
    /** Inclusion du fichier de traduction fr par défaut. */
233
    include_once IW_CHEMIN_LANGUES.'iw_langue_fr.inc.php';
238
    include_once IW_CHEMIN_LANGUES.'iw_langue_fr.inc.php';
234
}
239
}
235
 
-
 
-
 
240
 
236
 
241
$GLOBALS['_PAPYRUS_']['erreur']->setActive(1);
237
/**
242
/**
238
 * Renvoie le menu général de l'integrateur Wikini : derniers  changement etc.
243
 * Renvoie le menu général de l'integrateur Wikini : derniers  changement etc.
239
 *
244
 *
240
 * @return string
245
 * @return string
241
 * @access public
246
 * @access public
242
 */
247
 */
243
   
248
   
244
function afficherContenuMenu()
249
function afficherContenuMenu()
245
{
250
{
-
 
251
	
-
 
252
	$GLOBALS['_PAPYRUS_']['erreur']->setActive(0);
246
	
253
 
247
  // TODO
254
  // TODO
248
  // Changement du niveau d'erreur pour éviter les Notices PHP dues à Wikini
255
  // Changement du niveau d'erreur pour éviter les Notices PHP dues à Wikini
249
  //  error_reporting(E_PARSE);
256
  //  error_reporting(E_PARSE);
250
  
257
  
251
  // Autre possibilite : la page speciale MENU 
258
  // Autre possibilite : la page speciale MENU 
252
	
259
	
253
	global $wiki;
260
	global $wiki;
254
	global $wikini_config_defaut;
261
	global $wikini_config_defaut;
255
	$sortie='';
262
	$sortie='';
256
    $wakkaConfig = $GLOBALS['wikini_config_defaut'];
263
    $wakkaConfig = $GLOBALS['wikini_config_defaut'];
257
    $wiki  = new Wiki_Papyrus($wakkaConfig);
264
    $wiki  = new Wiki_Papyrus($wakkaConfig);
258
 
265
 
259
    // Suppression des slash.
266
    // Suppression des slash.
260
    $_REQUEST['wiki'] = preg_replace("/^\//", '',  $_REQUEST['wiki']);
267
    $_REQUEST['wiki'] = preg_replace("/^\//", '',  $_REQUEST['wiki']);
261
 
268
 
262
    // split into page/method
269
    // split into page/method
263
    if ( preg_match( "#^(.+?)/(.*)$#",  $_REQUEST['wiki'], $matches ) ) {
270
    if ( preg_match( "#^(.+?)/(.*)$#",  $_REQUEST['wiki'], $matches ) ) {
264
        list(, $page, $method) = $matches;
271
        list(, $page, $method) = $matches;
265
    } else if ( preg_match( "#^(.*)$#",  $_REQUEST['wiki'], $matches ) ) {
272
    } else if ( preg_match( "#^(.*)$#",  $_REQUEST['wiki'], $matches ) ) {
266
        list(, $page) = $matches;
273
        list(, $page) = $matches;
267
    }
274
    }
268
 
275
 
269
    $server=$_SERVER['PHP_SELF'];
276
    $server=$_SERVER['PHP_SELF'];
270
	$_SERVER['PHP_SELF']="wakka.php";
277
	$_SERVER['PHP_SELF']="wakka.php";
271
    
278
    
272
    // Affichage par defaut : 
279
    // Affichage par defaut : 
273
    
280
    
274
	$sortie=$wiki->Format("\n----PagePrincipale\nDerniersChangements\nDerniersCommentaires----");
281
	$sortie=$wiki->Format("\n----PagePrincipale\nDerniersChangements\nDerniersCommentaires----");
275
    $sortie.="<a href=\"".$wiki->href("edit",$page)."\" title=\"Cliquez pour &eacute;diter cette page.\">&Eacute;diter cette page</a>";
282
    $sortie.="<a href=\"".$wiki->href("edit",$page)."\" title=\"Cliquez pour &eacute;diter cette page.\">&Eacute;diter cette page</a>";
276
    
283
    
277
    // Sinon Affichage Page Menu (configurable TODO ?) 
284
    // Sinon Affichage Page Menu (configurable TODO ?) 
278
    
285
    
279
    $contenu=$wiki->LoadPage("PageMenu");
286
    $contenu=$wiki->LoadPage("PageMenu");
280
    
287
    
281
    $sortie.=$wiki->Format("----");
288
    $sortie.=$wiki->Format("----");
282
	$sortie.=$wiki->Format($contenu['body']);   
289
	$sortie.=$wiki->Format($contenu['body']);   
283
 
290
 
284
	$_SERVER['PHP_SELF']=$server;
291
	$_SERVER['PHP_SELF']=$server;
285
	
-
 
286
	// TODO
-
 
287
	// Retour au niveau d'erreur définit dans le fichier de config de Papyrus
292
	
288
    // error_reporting(GEN_DEBOGAGE_NIVEAU);
293
	$GLOBALS['_PAPYRUS_']['erreur']->setActive(1);
289
    
294
	
290
	return $sortie;
295
	return $sortie;
291
	
296
	
292
} 
297
} 
293
			
298
			
294
	
299
	
295
// +------------------------------------------------------------------------------------------------------+
300
// +------------------------------------------------------------------------------------------------------+
296
// |                                            CORPS du PROGRAMME                                        |
301
// |                                            CORPS du PROGRAMME                                        |
297
// +------------------------------------------------------------------------------------------------------+
302
// +------------------------------------------------------------------------------------------------------+
298
/** Fonction afficherContenuCorps() - Fonction appelé par le gestionnaire Papyrus.
303
/** Fonction afficherContenuCorps() - Fonction appelé par le gestionnaire Papyrus.
299
*
304
*
300
* Elle retourne le contenu de l'application.
305
* Elle retourne le contenu de l'application.
301
*
306
*
302
* @return  string  du code XHTML correspondant au contenu renvoyé par l'application.
307
* @return  string  du code XHTML correspondant au contenu renvoyé par l'application.
303
*/
308
*/
304
function afficherContenuCorps()
309
function afficherContenuCorps()
305
{
310
{
-
 
311
 
-
 
312
	$GLOBALS['_PAPYRUS_']['erreur']->setActive(0);
306
 
313
	
307
	// Ajout d'une feuille de style externe
314
	// Ajout d'une feuille de style externe
308
	GEN_stockerStyleExterne ('wikini', 'client/integrateur_wikini/presentations/styles/wikini.css') ;
315
	GEN_stockerStyleExterne ('wikini', 'client/integrateur_wikini/presentations/styles/wikini.css') ;
309
	
316
	
310
  // TODO
317
  // TODO
311
  // Changement du niveau d'erreur pour éviter les Notices PHP dues à Wikini
318
  // Changement du niveau d'erreur pour éviter les Notices PHP dues à Wikini
312
  //  error_reporting(E_PARSE);
-
 
313
	
319
   	
-
 
320
   
314
	global $wiki;
321
	global $wiki;
315
	global $wikini_config_defaut;
322
	global $wikini_config_defaut;
316
	$sortie='';
323
	$sortie='';
317
    $wakkaConfig = $GLOBALS['wikini_config_defaut'];
324
    $wakkaConfig = $GLOBALS['wikini_config_defaut'];
318
    $wiki  = new Wiki_Papyrus($wakkaConfig);
325
    $wiki  = new Wiki_Papyrus($wakkaConfig);
319
 
326
 
320
 
327
 
321
	// Gestion de la variable de session "linktracking"
328
	// Gestion de la variable de session "linktracking"
322
    if ( ! isset( $_SESSION['linktracking'] ) ) {
329
    if ( ! isset( $_SESSION['linktracking'] ) ) {
323
        $_SESSION['linktracking'] = 1;
330
        $_SESSION['linktracking'] = 1;
324
    }
331
    }
325
 
332
 
326
    // Suppression des slash.
333
    // Suppression des slash.
327
    $_REQUEST['wiki'] = preg_replace("/^\//", '',  $_REQUEST['wiki']);
334
    $_REQUEST['wiki'] = preg_replace("/^\//", '',  $_REQUEST['wiki']);
328
 
335
 
329
    // split into page/method
336
    // split into page/method
330
    if ( preg_match( "#^(.+?)/(.*)$#",  $_REQUEST['wiki'], $matches ) ) {
337
    if ( preg_match( "#^(.+?)/(.*)$#",  $_REQUEST['wiki'], $matches ) ) {
331
        list(, $page, $method) = $matches;
338
        list(, $page, $method) = $matches;
332
    } else if ( preg_match( "#^(.*)$#",  $_REQUEST['wiki'], $matches ) ) {
339
    } else if ( preg_match( "#^(.*)$#",  $_REQUEST['wiki'], $matches ) ) {
333
        list(, $page) = $matches;
340
        list(, $page) = $matches;
334
    }
341
    }
335
    
342
    
336
    // Vérification de la méthode d'affichage employée!
343
    // Vérification de la méthode d'affichage employée!
337
    if ( ! isset( $method ) ) {
344
    if ( ! isset( $method ) ) {
338
        $method = '';
345
        $method = '';
339
    }
346
    }
340
		
347
		
341
    //Récupération du contenu de la page Wikini
348
    //Récupération du contenu de la page Wikini
342
    
349
    
343
    ob_start();
350
    ob_start();
344
    
351
    
345
    $server=$_SERVER['PHP_SELF'];
352
    $server=$_SERVER['PHP_SELF'];
346
	$_SERVER['PHP_SELF']="wakka.php";
353
	$_SERVER['PHP_SELF']="wakka.php";
347
    
354
    
348
	$wiki->Run($page, $method);
355
	$wiki->Run($page, $method);
349
    
356
    
350
    $_SERVER['PHP_SELF']=$server;
357
    $_SERVER['PHP_SELF']=$server;
351
    
358
    
352
    $sortie.= ob_get_contents();
359
    $sortie.= ob_get_contents();
353
    ob_end_clean();
360
    ob_end_clean();
354
 
-
 
355
	// TODO
-
 
356
	// Retour au niveau d'erreur définit dans le fichier de config de Papyrus
361
 
357
    // error_reporting(GEN_DEBOGAGE_NIVEAU);
362
	$GLOBALS['_PAPYRUS_']['erreur']->setActive(1);
358
    
363
 
359
	//return remplacerEntiteHTLM("<div id=\"wikini_page\" onLoad=\"thisForm=document.ACEditor;\" ondblclick=\"document.location='".$wiki->href("edit")."';"."\">"."\n".$sortie.'</div>'."\n");
364
	//return remplacerEntiteHTLM("<div id=\"wikini_page\" onLoad=\"thisForm=document.ACEditor;\" ondblclick=\"document.location='".$wiki->href("edit")."';"."\">"."\n".$sortie.'</div>'."\n");
360
	return remplacerEntiteHTLM("<script type=\"text/javascript\" src=\"".IW_CHEMIN_BIBLIO_ACEDITOR."ACeditor.js\"></script><div id=\"wikini_page\"  ondblclick=\"document.location='".$wiki->href("edit")."';"."\">"."\n".$sortie.'</div>'."\n"); 
365
	return remplacerEntiteHTLM("<script type=\"text/javascript\" src=\"".IW_CHEMIN_BIBLIO_ACEDITOR."ACeditor.js\"></script><div id=\"wikini_page\"  ondblclick=\"document.location='".$wiki->href("edit")."';"."\">"."\n".$sortie.'</div>'."\n"); 
361
		
366
		
362
}
367
}
363
 
368
 
364
 
369
 
365
// TODO : qu'affiche-t-on en pied ?
370
// TODO : qu'affiche-t-on en pied ?
366
/** Fonction afficherContenuPied() - Fonction appelé par le gestionnaire Papyrus.
371
/** Fonction afficherContenuPied() - Fonction appelé par le gestionnaire Papyrus.
367
*
372
*
368
* Elle retourne le pied de l'application.
373
* Elle retourne le pied de l'application.
369
*
374
*
370
* @return  string  du code XHTML correspondant au pied renvoyé par l'application.
375
* @return  string  du code XHTML correspondant au pied renvoyé par l'application.
371
*/
376
*/
372
function afficherContenuPied()
377
function afficherContenuPied()
373
{
378
{
374
    return inclusion_html('pied_page');
379
    return inclusion_html('pied_page');
375
}
380
}
376
?>
381
?>