Subversion Repositories Applications.papyrus

Rev

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

Rev 453 Rev 497
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.9 2005-09-23 13:58:07 ddelon Exp $
24
// CVS : $Id: integrateur_wikini.php,v 1.10 2005-10-01 11:13:43 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.9 $ $Date: 2005-09-23 13:58:07 $
36
*@version       $Revision: 1.10 $ $Date: 2005-10-01 11:13:43 $
37
*
37
*
38
// +------------------------------------------------------------------------------------------------------+
38
// +------------------------------------------------------------------------------------------------------+
39
// |                                            ENTETE du PROGRAMME                                       |
39
// |                                            ENTETE du PROGRAMME                                       |
40
// +------------------------------------------------------------------------------------------------------+
40
// +------------------------------------------------------------------------------------------------------+
41
 
41
 
42
 
42
 
43
 
43
 
44
 
44
 
45
/** Inclusion de la classe PEAR de gestion des URL. */
45
/** Inclusion de la classe PEAR de gestion des URL. */
46
 
46
 
47
 
47
 
48
$GLOBALS['_PAPYRUS_']['erreur']->setActive(0);
48
$GLOBALS['_PAPYRUS_']['erreur']->setActive(0);
49
 
49
 
50
require_once 'Net/URL.php';
50
require_once 'Net/URL.php';
51
 
51
 
52
// TODO : un seul fichier de configuration ?
52
// TODO : un seul fichier de configuration ?
53
/** Inclusion du fichier de configuration de cette application.*/
53
/** Inclusion du fichier de configuration de cette application.*/
54
require_once 'client/integrateur_wikini/configuration/adwi_configuration.inc.php';
54
require_once 'client/integrateur_wikini/configuration/adwi_configuration.inc.php';
55
 
55
 
56
require_once ADWI_CHEMIN_BIBLIOTHEQUE.'adwi_wikini.fonct.php';
56
require_once ADWI_CHEMIN_BIBLIOTHEQUE.'adwi_wikini.fonct.php';
57
 
57
 
58
/** Inclusion du fichier de configuration général de IntegrateurWikini.*/
58
/** Inclusion du fichier de configuration général de IntegrateurWikini.*/
59
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';
60
 
60
 
61
/** 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.*/
62
require_once IW_CHEMIN_BIBLIO.'iw_encodage.fonct.php';
62
require_once IW_CHEMIN_BIBLIO.'iw_encodage.fonct.php';
63
/** 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.*/
64
require_once IW_CHEMIN_BIBLIO.'iw_affichage_xhtml.fonct.php';
64
require_once IW_CHEMIN_BIBLIO.'iw_affichage_xhtml.fonct.php';
65
 
65
 
66
global $wikini_config_defaut;
66
global $wikini_config_defaut;
67
global $wiki;
67
global $wiki;
68
global $wiki_p;
68
global $wiki_p;
69
 
69
 
70
// $_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 !
71
 
71
 
72
if ( ! isset( $_REQUEST['wiki'] ) ) {
72
if ( ! isset( $_REQUEST['wiki'] ) ) {
73
	    $_REQUEST['wiki'] = $wikini_config_defaut['root_page'];
73
	    $_REQUEST['wiki'] = $wikini_config_defaut['root_page'];
74
}
74
}
75
 
75
 
76
$server=$_SERVER['PHP_SELF'];
76
$server=$_SERVER['PHP_SELF'];
77
$_SERVER['PHP_SELF']="wakka.php";
77
$_SERVER['PHP_SELF']="wakka.php";
78
 
78
 
79
// Utilise le wakkaconfig de la racine ...
79
// Utilise le wakkaconfig de la racine ...
80
// 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,
81
// TODO : Customiser son menu avec papyrus ...
81
// TODO : Customiser son menu avec papyrus ...
82
// 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
83
// TODO : message erreur session 
83
// TODO : message erreur session 
84
// TODO : message erreur interwiki
84
// TODO : message erreur interwiki
85
// 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
86
// TODO : creation des tables par defaut à l'installation d'un wikini
86
// TODO : creation des tables par defaut à l'installation d'un wikini
87
// TODO : Fusion des fichiers de configuration ?
87
// TODO : Fusion des fichiers de configuration ?
88
// TODO : creation automatique des Wikis ...
88
// TODO : creation automatique des Wikis ...
89
 
89
 
90
ob_start();
90
ob_start();
91
 
91
 
92
include_once IW_CHEMIN_WIKINI_COURANT.'wakka.php';
92
include_once IW_CHEMIN_WIKINI_COURANT.'wakka.php';
93
ob_end_clean();
93
ob_end_clean();
94
$_SERVER['PHP_SELF']=$server;
94
$_SERVER['PHP_SELF']=$server;
95
 
95
 
96
 
96
 
97
// 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
98
Class Wiki_Papyrus extends Wiki {
98
Class Wiki_Papyrus extends Wiki {
99
	
99
	
100
    
100
    
101
	//TODO : a gauche !
101
	//TODO : a gauche !
102
	
102
	
103
	function Header() {
103
	function Header() {
104
		
104
		
105
		return;
105
		return;
106
	}	
106
	}	
107
 
107
 
108
 	function Footer() {
108
 	function Footer() {
109
		return;
109
		return;
110
 	}
110
 	}
111
	
111
	
112
	function FormOpen($method = "", $tag = "", $formMethod = "post") {
112
	function FormOpen($method = "", $tag = "", $formMethod = "post") {
113
	
113
	
114
	// 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. 
115
		
115
		
116
		if (($method=="diff") && $formMethod=="get") {
116
		if (($method=="diff") && $formMethod=="get") {
117
			$formMethod="post";	
117
			$formMethod="post";	
118
		}
118
		}
119
	
119
	
120
		if ($method=="edit") {
120
		if ($method=="edit") {
121
            $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";
122
            return $result;
122
            return $result;
123
		}
123
		}
124
		
124
		
125
		return parent::FormOpen($method,$tag, $formMethod);
125
		return parent::FormOpen($method,$tag, $formMethod);
126
		
126
		
127
	}
127
	}
128
	// 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 ....
129
	function Method($method) {
129
	function Method($method) {
130
		
130
		
131
		if ($method=="edit") {
131
		if ($method=="edit") {
132
	
132
	
133
			echo $this->Header();
133
			echo $this->Header();
134
			
134
			
135
			$result='';
135
			$result='';
136
								
136
								
137
			if ($_POST) {
137
			if ($_POST) {
138
				if ($_POST["submit"] == "Sauver")	{
138
				if ($_POST["submit"] == "Sauver")	{
139
				// check for overwriting
139
				// check for overwriting
140
					if ($this->page) {
140
					if ($this->page) {
141
						if ($this->page["id"] != $_POST["previous"]) {
141
						if ($this->page["id"] != $_POST["previous"]) {
142
							$error = "ALERTE : ".
142
							$error = "ALERTE : ".
143
							"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".
144
							"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";
145
						}
145
						}
146
					}
146
					}
147
					// store
147
					// store
148
					if (!$error) {
148
					if (!$error) {
149
						$body = str_replace("\r", "", $_POST["body"]);
149
						$body = str_replace("\r", "", $_POST["body"]);
150
						// 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
151
						if(rtrim($body)==rtrim($this->page["body"])) {
151
						if(rtrim($body)==rtrim($this->page["body"])) {
152
							$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.");
153
							$this->Redirect($this->href());
153
							$this->Redirect($this->href());
154
						}
154
						}
155
	
155
	
156
						// add page (revisions)
156
						// add page (revisions)
157
						$this->SavePage($this->tag, $body);
157
						$this->SavePage($this->tag, $body);
158
		
158
		
159
						// 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.
160
						$this->ClearLinkTable();
160
						$this->ClearLinkTable();
161
						$this->StartLinkTracking();
161
						$this->StartLinkTracking();
162
						$dummy = $this->Header();
162
						$dummy = $this->Header();
163
						$dummy .= $this->Format($body);
163
						$dummy .= $this->Format($body);
164
						$dummy .= $this->Footer();
164
						$dummy .= $this->Footer();
165
						$this->StopLinkTracking();
165
						$this->StopLinkTracking();
166
						$this->WriteLinkTable();
166
						$this->WriteLinkTable();
167
						$this->ClearLinkTable();
167
						$this->ClearLinkTable();
168
		
168
		
169
						// forward
169
						// forward
170
						$this->Redirect($this->href());
170
						$this->Redirect($this->href());
171
					}
171
					}
172
				}
172
				}
173
			}
173
			}
174
 
174
 
175
			// fetch fields
175
			// fetch fields
176
			if (!$previous = $_POST["previous"]) $previous = $this->page["id"];
176
			if (!$previous = $_POST["previous"]) $previous = $this->page["id"];
177
			if (!$body = $_POST["body"]) $body = $this->page["body"];
177
			if (!$body = $_POST["body"]) $body = $this->page["body"];
178
			
178
			
179
			// preview?
179
			// preview?
180
			if ($_POST["submit"] == "Aperçu")
180
			if ($_POST["submit"] == "Aperçu")
181
			{
181
			{
182
				$result .=
182
				$result .=
183
					"<div class=\"prev_alert\"><strong>Aper&ccedil;u</strong></div>\n".
183
					"<div class=\"prev_alert\"><strong>Aper&ccedil;u</strong></div>\n".
184
					$this->Format($body)."\n\n".
184
					$this->Format($body)."\n\n".
185
					$this->FormOpen("edit").
185
					$this->FormOpen("edit").
186
					"<input type=\"hidden\" name=\"previous\" value=\"".$previous."\" />\n".
186
					"<input type=\"hidden\" name=\"previous\" value=\"".$previous."\" />\n".
187
					"<input type=\"hidden\" name=\"body\" value=\"".htmlentities($body)."\" />\n".
187
					"<input type=\"hidden\" name=\"body\" value=\"".htmlentities($body)."\" />\n".
188
					"<br />\n".
188
					"<br />\n".
189
					"<input name=\"submit\" type=\"submit\" value=\"Sauver\" accesskey=\"s\" />\n".
189
					"<input name=\"submit\" type=\"submit\" value=\"Sauver\" accesskey=\"s\" />\n".
190
					"<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".
191
					"<input type=\"button\" value=\"Annulation\" onclick=\"document.location='".$this->href("")."';\" />\n".
191
					"<input type=\"button\" value=\"Annulation\" onclick=\"document.location='".$this->href("")."';\" />\n".
192
					$this->FormClose()."\n";
192
					$this->FormClose()."\n";
193
				return $result;
193
				return $result;
194
			}
194
			}
195
			else
195
			else
196
			{
196
			{
197
					
197
					
198
			    require_once(IW_CHEMIN_BIBLIO_ACEDITOR."ACeditor.buttonsBar.php");
198
			    require_once(IW_CHEMIN_BIBLIO_ACEDITOR."ACeditor.buttonsBar.php");
199
			    
199
			    
200
				$result .=
200
				$result .=
201
				$this->FormOpen("edit").
201
				$this->FormOpen("edit").
202
				"<input type=\"hidden\" name=\"previous\" value=\"".$previous."\" />\n".$ACbuttonsBar.
202
				"<input type=\"hidden\" name=\"previous\" value=\"".$previous."\" />\n".$ACbuttonsBar.
203
				"<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".
204
				htmlspecialchars($body).
204
				htmlspecialchars($body).
205
				"\n</textarea><br />\n".
205
				"\n</textarea><br />\n".
206
				($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").
207
				"<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".
208
				"<input type=\"button\" value=\"Annulation\" onclick=\"document.location='".$this->href("")."';\" />\n".
208
				"<input type=\"button\" value=\"Annulation\" onclick=\"document.location='".$this->href("")."';\" />\n".
209
				$this->FormClose();
209
				$this->FormClose();
210
				
210
				
211
				return $result;
211
				return $result;
212
			}
212
			}
213
		
213
		
214
		}
214
		}
215
		else {
215
		else {
216
			return parent::Method($method);
216
			return parent::Method($method);
217
		}
217
		}
218
	}
218
	}
219
	
219
	
220
	
220
	
221
	// Surcharge Format a cause probleme de chemin. 
221
	// Surcharge Format a cause probleme de chemin. 
222
	
222
	
223
	function Format($text, $formatter = "wakka") {
223
	function Format($text, $formatter = "wakka") {
224
		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")); 
225
	}
225
	}
226
	
226
	
227
	
227
	
228
}
228
}
229
 
229
 
230
		
230
		
231
		
231
		
232
// 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
233
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')) {
234
    /** Inclusion du fichier de traduction de l'application Integrateur Wikini. */
234
    /** Inclusion du fichier de traduction de l'application Integrateur Wikini. */
235
    include_once IW_CHEMIN_LANGUES.'iw_langue_'.IW_I18N.'.inc.php';
235
    include_once IW_CHEMIN_LANGUES.'iw_langue_'.IW_I18N.'.inc.php';
236
} else {
236
} else {
237
    /** Inclusion du fichier de traduction fr par défaut. */
237
    /** Inclusion du fichier de traduction fr par défaut. */
238
    include_once IW_CHEMIN_LANGUES.'iw_langue_fr.inc.php';
238
    include_once IW_CHEMIN_LANGUES.'iw_langue_fr.inc.php';
239
}
239
}
240
 
240
 
241
$GLOBALS['_PAPYRUS_']['erreur']->setActive(1);
241
$GLOBALS['_PAPYRUS_']['erreur']->setActive(1);
242
/**
242
/**
243
 * 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.
244
 *
244
 *
245
 * @return string
245
 * @return string
246
 * @access public
246
 * @access public
247
 */
247
 */
248
   
248
   
249
function afficherContenuMenu()
249
function afficherContenuMenu()
250
{
250
{
251
	
251
	
252
	$GLOBALS['_PAPYRUS_']['erreur']->setActive(0);
252
	$GLOBALS['_PAPYRUS_']['erreur']->setActive(0);
253
 
253
 
254
  // TODO
254
  // TODO
255
  // 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
256
  //  error_reporting(E_PARSE);
256
  //  error_reporting(E_PARSE);
257
  
257
  
258
  // Autre possibilite : la page speciale MENU 
258
  // Autre possibilite : la page speciale MENU 
259
	
259
	
260
	global $wiki;
260
	global $wiki;
261
	global $wikini_config_defaut;
261
	global $wikini_config_defaut;
262
	$sortie='';
262
	$sortie='';
263
    $wakkaConfig = $GLOBALS['wikini_config_defaut'];
263
    $wakkaConfig = $GLOBALS['wikini_config_defaut'];
264
    $wiki  = new Wiki_Papyrus($wakkaConfig);
264
    $wiki  = new Wiki_Papyrus($wakkaConfig);
265
 
265
 
266
    // Suppression des slash.
266
    // Suppression des slash.
267
    $_REQUEST['wiki'] = preg_replace("/^\//", '',  $_REQUEST['wiki']);
267
    $_REQUEST['wiki'] = preg_replace("/^\//", '',  $_REQUEST['wiki']);
268
 
268
 
269
    // split into page/method
269
    // split into page/method
270
    if ( preg_match( "#^(.+?)/(.*)$#",  $_REQUEST['wiki'], $matches ) ) {
270
    if ( preg_match( "#^(.+?)/(.*)$#",  $_REQUEST['wiki'], $matches ) ) {
271
        list(, $page, $method) = $matches;
271
        list(, $page, $method) = $matches;
272
    } else if ( preg_match( "#^(.*)$#",  $_REQUEST['wiki'], $matches ) ) {
272
    } else if ( preg_match( "#^(.*)$#",  $_REQUEST['wiki'], $matches ) ) {
273
        list(, $page) = $matches;
273
        list(, $page) = $matches;
274
    }
274
    }
275
 
275
 
276
    $server=$_SERVER['PHP_SELF'];
276
    $server=$_SERVER['PHP_SELF'];
277
	$_SERVER['PHP_SELF']="wakka.php";
277
	$_SERVER['PHP_SELF']="wakka.php";
278
    
278
	
279
    // Affichage par defaut : 
-
 
280
    
-
 
281
	$sortie=$wiki->Format("\n----PagePrincipale\nDerniersChangements\nDerniersCommentaires----");
-
 
282
    $sortie.="<a href=\"".$wiki->href("edit",$page)."\" title=\"Cliquez pour &eacute;diter cette page.\">&Eacute;diter cette page</a>";
-
 
283
    
-
 
284
    // Sinon Affichage Page Menu (configurable TODO ?) 
279
    // Sinon Affichage Page Menu (configurable TODO ?) 
285
    
280
    
286
    $contenu=$wiki->LoadPage("PageMenu");
281
    $contenu=$wiki->LoadPage("PageMenu");
287
    
282
    
288
    $sortie.=$wiki->Format("----");
283
    $sortie.=$wiki->Format("----");
289
	$sortie.=$wiki->Format($contenu['body']);   
284
	$sortie.=$wiki->Format($contenu['body']);   
290
 
285
 
291
	$_SERVER['PHP_SELF']=$server;
286
	$_SERVER['PHP_SELF']=$server;
292
	
287
	
293
	$GLOBALS['_PAPYRUS_']['erreur']->setActive(1);
288
	$GLOBALS['_PAPYRUS_']['erreur']->setActive(1);
294
	
289
	
295
	return $sortie;
290
	return $sortie;
296
	
291
	
297
} 
292
} 
298
			
293
			
299
	
294
	
300
// +------------------------------------------------------------------------------------------------------+
295
// +------------------------------------------------------------------------------------------------------+
301
// |                                            CORPS du PROGRAMME                                        |
296
// |                                            CORPS du PROGRAMME                                        |
302
// +------------------------------------------------------------------------------------------------------+
297
// +------------------------------------------------------------------------------------------------------+
303
/** Fonction afficherContenuCorps() - Fonction appelé par le gestionnaire Papyrus.
298
/** Fonction afficherContenuCorps() - Fonction appelé par le gestionnaire Papyrus.
304
*
299
*
305
* Elle retourne le contenu de l'application.
300
* Elle retourne le contenu de l'application.
306
*
301
*
307
* @return  string  du code XHTML correspondant au contenu renvoyé par l'application.
302
* @return  string  du code XHTML correspondant au contenu renvoyé par l'application.
308
*/
303
*/
309
function afficherContenuCorps()
304
function afficherContenuCorps()
310
{
305
{
311
 
306
 
312
	$GLOBALS['_PAPYRUS_']['erreur']->setActive(0);
307
	$GLOBALS['_PAPYRUS_']['erreur']->setActive(0);
313
	
308
	
314
	// Ajout d'une feuille de style externe
309
	// Ajout d'une feuille de style externe
315
	GEN_stockerStyleExterne ('wikini', 'client/integrateur_wikini/presentations/styles/wikini.css') ;
310
	GEN_stockerStyleExterne ('wikini', 'client/integrateur_wikini/presentations/styles/wikini.css') ;
316
	
311
	
317
  // TODO
312
  // TODO
318
  // Changement du niveau d'erreur pour éviter les Notices PHP dues à Wikini
313
  // Changement du niveau d'erreur pour éviter les Notices PHP dues à Wikini
319
   	
314
   	
320
   
315
   
321
	global $wiki;
316
	global $wiki;
322
	global $wikini_config_defaut;
317
	global $wikini_config_defaut;
323
	$sortie='';
318
	$sortie='';
324
    $wakkaConfig = $GLOBALS['wikini_config_defaut'];
319
    $wakkaConfig = $GLOBALS['wikini_config_defaut'];
325
    $wiki  = new Wiki_Papyrus($wakkaConfig);
320
    $wiki  = new Wiki_Papyrus($wakkaConfig);
326
 
321
 
327
 
322
 
328
	// Gestion de la variable de session "linktracking"
323
	// Gestion de la variable de session "linktracking"
329
    if ( ! isset( $_SESSION['linktracking'] ) ) {
324
    if ( ! isset( $_SESSION['linktracking'] ) ) {
330
        $_SESSION['linktracking'] = 1;
325
        $_SESSION['linktracking'] = 1;
331
    }
326
    }
332
 
327
 
333
    // Suppression des slash.
328
    // Suppression des slash.
334
    $_REQUEST['wiki'] = preg_replace("/^\//", '',  $_REQUEST['wiki']);
329
    $_REQUEST['wiki'] = preg_replace("/^\//", '',  $_REQUEST['wiki']);
335
 
330
 
336
    // split into page/method
331
    // split into page/method
337
    if ( preg_match( "#^(.+?)/(.*)$#",  $_REQUEST['wiki'], $matches ) ) {
332
    if ( preg_match( "#^(.+?)/(.*)$#",  $_REQUEST['wiki'], $matches ) ) {
338
        list(, $page, $method) = $matches;
333
        list(, $page, $method) = $matches;
339
    } else if ( preg_match( "#^(.*)$#",  $_REQUEST['wiki'], $matches ) ) {
334
    } else if ( preg_match( "#^(.*)$#",  $_REQUEST['wiki'], $matches ) ) {
340
        list(, $page) = $matches;
335
        list(, $page) = $matches;
341
    }
336
    }
342
    
337
    
343
    // Vérification de la méthode d'affichage employée!
338
    // Vérification de la méthode d'affichage employée!
344
    if ( ! isset( $method ) ) {
339
    if ( ! isset( $method ) ) {
345
        $method = '';
340
        $method = '';
346
    }
341
    }
347
		
342
		
348
    //Récupération du contenu de la page Wikini
343
    //Récupération du contenu de la page Wikini
349
    
344
    
350
    ob_start();
345
    ob_start();
351
    
346
    
352
    $server=$_SERVER['PHP_SELF'];
347
    $server=$_SERVER['PHP_SELF'];
353
	$_SERVER['PHP_SELF']="wakka.php";
348
	$_SERVER['PHP_SELF']="wakka.php";
354
    
349
    
355
	$wiki->Run($page, $method);
350
	$wiki->Run($page, $method);
356
    
351
    
357
    $_SERVER['PHP_SELF']=$server;
352
    $_SERVER['PHP_SELF']=$server;
358
    
353
    
359
    $sortie.= ob_get_contents();
354
    $sortie.= ob_get_contents();
360
    ob_end_clean();
355
    ob_end_clean();
361
 
356
 
362
	$GLOBALS['_PAPYRUS_']['erreur']->setActive(1);
357
	$GLOBALS['_PAPYRUS_']['erreur']->setActive(1);
363
 
358
 
364
	//return remplacerEntiteHTLM("<div id=\"wikini_page\" onLoad=\"thisForm=document.ACEditor;\" ondblclick=\"document.location='".$wiki->href("edit")."';"."\">"."\n".$sortie.'</div>'."\n");
359
	//return remplacerEntiteHTLM("<div id=\"wikini_page\" onLoad=\"thisForm=document.ACEditor;\" 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"); 
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"); 
366
		
361
		
367
}
362
}
368
 
363
 
369
 
364
 
370
// TODO : qu'affiche-t-on en pied ?
365
// TODO : qu'affiche-t-on en pied ?
371
/** Fonction afficherContenuPied() - Fonction appelé par le gestionnaire Papyrus.
366
/** Fonction afficherContenuPied() - Fonction appelé par le gestionnaire Papyrus.
372
*
367
*
373
* Elle retourne le pied de l'application.
368
* Elle retourne le pied de l'application.
374
*
369
*
375
* @return  string  du code XHTML correspondant au pied renvoyé par l'application.
370
* @return  string  du code XHTML correspondant au pied renvoyé par l'application.
376
*/
371
*/
377
function afficherContenuPied()
372
function afficherContenuPied()
378
{
373
{
379
    return inclusion_html('pied_page');
374
    return inclusion_html('pied_page');
380
}
375
}
381
?>
376
?>