Subversion Repositories Applications.papyrus

Rev

Rev 1696 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
545 ddelon 1
<?php
581 ddelon 2
/*vim: set expandtab tabstop=4 shiftwidth=4: */
545 ddelon 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
// +------------------------------------------------------------------------------------------------------+
1833 jp_milcent 24
// CVS : $Id: iw_integrateur.fonct.php,v 1.19.6.2 2008-04-25 07:59:25 jp_milcent Exp $
545 ddelon 25
/**
26
* Fonctions de l'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        David Delon <david.delon@clapas.net>
33
//Autres auteurs :
34
*@author        Aucun
35
*@copyright     Tela-Botanica 2000-2004
1833 jp_milcent 36
*@version       $Revision: 1.19.6.2 $ $Date: 2008-04-25 07:59:25 $
545 ddelon 37
*
38
// +------------------------------------------------------------------------------------------------------+
39
// |                                            ENTETE du PROGRAMME                                       |
40
// +------------------------------------------------------------------------------------------------------+
41
 
42
 
43
 
44
 
45
/** Inclusion de la classe PEAR de gestion des URL. */
46
 
47
$GLOBALS['_PAPYRUS_']['erreur']->setActive(0);
48
 
1833 jp_milcent 49
if (!class_exists('Net_URL')) {
50
	require_once PAP_CHEMIN_API_PEAR.'Net/URL.php';
51
}
545 ddelon 52
// TODO : un seul fichier de configuration ?
53
/** Inclusion du fichier de configuration de cette application.*/
860 ddelon 54
require_once 'client/integrateur_wikini/configuration/adwi_configuration.inc.php';
545 ddelon 55
 
56
require_once ADWI_CHEMIN_BIBLIOTHEQUE.'adwi_wikini.fonct.php';
57
 
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';
60
 
61
/** Inclusion du fichier permettant d'encoder du texte mais pas les balises XHTML.*/
62
require_once IW_CHEMIN_BIBLIO.'iw_encodage.fonct.php';
63
/** Inclusion du fichier permettant d'inclure les données dans du XHTML.*/
64
require_once IW_CHEMIN_BIBLIO.'iw_affichage_xhtml.fonct.php';
65
 
66
global $wikini_config_defaut;
67
global $wiki;
68
global $wiki_p;
69
 
70
// $_REQUEST['wiki'] est obligatoire, car wakka.php envoie un redirect si non detecté, avec perte de tout l'environnement !
71
 
72
if ( ! isset( $_REQUEST['wiki'] ) ) {
73
	    $_REQUEST['wiki'] = $wikini_config_defaut['root_page'];
74
}
75
 
76
$server=$_SERVER['PHP_SELF'];
77
$_SERVER['PHP_SELF']="wakka.php";
78
 
79
// Utilise le wakkaconfig de la racine ...
80
// TODO : un wiki par défaut pour chaque papyrus à l'installation de Papyrus
81
// TODO : verifier bon dimensionnement des champs et clef de la table papyrus_wiki
82
// TODO : creation des tables par defaut à l'installation d'un wikini
83
// TODO : Fusion des fichiers de configuration ?
84
 
898 alexandre_ 85
//echo IW_CHEMIN_WIKINI_COURANT.'wakka.php';
86
if (!file_exists(IW_CHEMIN_WIKINI_COURANT.'wakka.php')) {
87
	if (GEN_DEBOGAGE) {
88
            $GLOBALS['_GEN_commun']['debogage_info'] .=
89
                'ERREUR Papyrus : le fichier '.IW_CHEMIN_WIKINI_COURANT.'wakka.php n\'existe pas.<br />'.
90
                'Identifiant : '. $id_fichier .'<br />'.
91
                'Ligne n° : '. __LINE__ .'<br />'.
92
                'Fichier : '. __FILE__;
93
    }
94
    return  ;
95
}
545 ddelon 96
ob_start();
97
include_once IW_CHEMIN_WIKINI_COURANT.'wakka.php';
556 ddelon 98
include_once(IW_CHEMIN_WIKINI_COURANT."/formatters/tableaux.php");
99
include_once(IW_CHEMIN_WIKINI_COURANT."/actions/attach.class.php");
545 ddelon 100
 
101
ob_end_clean();
102
$_SERVER['PHP_SELF']=$server;
103
 
104
 
105
// On surcharge la classe Wiki pour en faire ce qu'on en veut
106
Class Wiki_Papyrus extends Wiki {
581 ddelon 107
 
108
 
545 ddelon 109
	function Header() {
581 ddelon 110
 
545 ddelon 111
		return;
581 ddelon 112
	}
113
 
545 ddelon 114
 	function Footer() {
580 ddelon 115
 		echo  "<div class=\"footer\">";
116
		echo  $this->HasAccess("write") ? "<a href=\"".$this->href("edit")."\" title=\"Cliquez pour modifier cette page.\">Modifier cette page</a> ::\n" : "";
117
		echo  $this->GetPageTime() ? "<a href=\"".$this->href("revisions")."\" title=\"Cliquez pour voir les derni&egrave;res modifications sur cette page.\">".$this->GetPageTime()."</a> ::\n" : "";
118
		// 	if this page exists
119
		if ($this->page)
120
		{
121
		// if owner is current user
122
			if ($this->UserIsOwner())
123
			{
581 ddelon 124
				echo
580 ddelon 125
				"Propri&eacute;taire&nbsp;: vous :: \n",
126
				"<a href=\"",$this->href("acls")."\" title=\"Cliquez pour modifer les permissions de cette page.\">&Eacute;diter permissions</a> :: \n",
127
				"<a href=\"",$this->href("deletepage")."\">Supprimer</a> :: \n";
128
			}
129
			else
130
			{
131
				if ($owner = $this->GetPageOwner())
132
				{
133
					echo "Propri&eacute;taire : ",$this->Format($owner);
134
				}
135
				else
136
				{
137
					echo "Pas de propri&eacute;taire ";
138
					echo ($this->GetUser() ? "(<a href=\"".$this->href("claim")."\">Appropriation</a>)" : "");
139
				}
140
				echo " :: \n";
141
			}
142
		}
143
		echo "Vous &ecirc;tes ";
144
		echo $this->Format($this->GetUserName());
145
		echo "</div>";
581 ddelon 146
 
545 ddelon 147
 	}
581 ddelon 148
 
545 ddelon 149
	function FormOpen($method = "", $tag = "", $formMethod = "post") {
581 ddelon 150
 
151
	// Le diff ne fonctionne pas avec la methode get dans papyrus. On surcharge avec du post.
152
 
545 ddelon 153
		if (($method=="diff") && $formMethod=="get") {
581 ddelon 154
			$formMethod="post";
545 ddelon 155
		}
581 ddelon 156
 
545 ddelon 157
		if ($method=="edit") {
158
            $result = "<form id=\"ACEditor\" name=\"ACEditor\" action=\"".$this->href($method, $tag)."\" method=\"".$formMethod."\">\n";
159
            return $result;
160
		}
581 ddelon 161
 
545 ddelon 162
		return parent::FormOpen($method,$tag, $formMethod);
581 ddelon 163
 
545 ddelon 164
	}
165
	// Detournement des handlers : comme ca on peut faire ce que l'on veut ....
166
	function Method($method) {
581 ddelon 167
 
690 ddelon 168
		if ($method=="xml") {
169
			header("Content-type: text/xml");
170
			if ($pages = $this->LoadRecentlyChanged(50)) {
171
 
172
				$link=ereg_replace('&','&amp;',$this->Href());
173
			    $output = "<?xml version=\"1.0\" encoding=\"iso-8859-1\" ?>\n";
174
			    $output .= '<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">' . "\n";
175
			    $output .= "<channel>\n";
176
			    $output .= "<title> Derniers changements sur ". $this->config["wakka_name"]  . "</title>\n";
177
			    $output .= "<link>" .  $link . "</link>\n";
178
			    $output .= "<description> Derniers changements sur " . $this->config["wakka_name"] . " </description>\n";
179
			    $output .= "<language>fr</language>\n";
180
			    $output .= '<generator>WikiNi ' . WIKINI_VERSION . "</generator>\n";
181
			    foreach ($pages as $i => $page)
182
			    {
183
			        $output .= "<item>\n";
184
			        $output .= "<title>" . $page["tag"] . "</title>\n";
185
			        $output .= '<dc:creator>' . $page["user"] . "</dc:creator>\n";
186
			        $output .= '<pubDate>' . date("r", strtotime($page['time'])) . "</pubDate>\n";
187
			        $output .= "<description> Modification de " . $page["tag"] . " --- par " .$page["user"] /* . " le " . $day ." - ". $hh .":". $mm */ . "</description>\n";
188
			        $link=ereg_replace('&','&amp;',$this->Href("",$page["tag"]));
189
			        $output .= "<link>" . $link . "&amp;time=" . rawurlencode($page["time"]) . "</link>\n";
190
			        $output .= "</item>\n";
191
			    }
192
			    $output .= "</channel>\n";
193
			    $output .= "</rss>\n";
194
			    echo $output ;
195
 
196
			}
197
			exit;
198
			return;
199
		}
200
 
545 ddelon 201
		if ($method=="edit") {
920 ddelon 202
 
203
			if ($this->HasAccess("write") && $this->HasAccess("read")) {
204
 
205
				$result='';
206
 
207
				if ($_POST) {
208
					if ($_POST["submit"] == "Sauver")	{
1696 ddelon 209
 
210
					require_once(ADWI_CHEMIN_BIBLIOTHEQUE.'/hashcash/secret/wp-hashcash.lib');
211
					if($_POST["hashcash_value"] != hashcash_field_value()) {
212
						$this->SetMessage("Cette page n\'a pas &eacute;t&eacute; enregistr&eacute;e car ce wiki pense que vous etes un robot !");
213
						$this->Redirect($this->href());
214
					}
215
 
920 ddelon 216
					// check for overwriting
217
						if ($this->page) {
218
							if ($this->page["id"] != $_POST["previous"]) {
219
								$error = "ALERTE : ".
220
								"Cette page a &eacute;t&eacute; modifi&eacute;e par quelqu'un d'autre pendant que vous l'&eacute;ditiez.<br />\n".
221
								"Veuillez copier vos changements et r&eacute;&eacute;diter cette page.\n";
222
							}
545 ddelon 223
						}
920 ddelon 224
						// store
225
						if (!$error) {
226
							$body = str_replace("\r", "", $_POST["body"]);
227
							// test si la nouvelle page est differente de la précédente
228
							if(rtrim($body)==rtrim($this->page["body"])) {
229
								$this->SetMessage("Cette page n\'a pas &eacute;t&eacute; enregistr&eacute;e car elle n\'a subi aucune modification.");
230
								$this->Redirect($this->href());
231
							}
232
 
233
							// add page (revisions)
234
							$this->SavePage($this->tag, $body);
235
 
236
							// now we render it internally so we can write the updated link table.
237
							$this->ClearLinkTable();
238
							$this->StartLinkTracking();
239
							$dummy = $this->Header();
240
							$dummy .= $this->Format($body);
241
							$dummy .= $this->Footer();
242
							$this->StopLinkTracking();
243
							$this->WriteLinkTable();
244
							$this->ClearLinkTable();
245
 
246
							// forward
545 ddelon 247
							$this->Redirect($this->href());
248
						}
249
					}
250
				}
920 ddelon 251
 
252
				// fetch fields
253
				if (!$previous = $_POST["previous"]) $previous = $this->page["id"];
254
				if (!$body = $_POST["body"]) $body = $this->page["body"];
255
 
256
				// preview?
257
				if ($_POST["submit"] == "Aperçu")
258
				{
259
					$result .=
260
						"<div class=\"prev_alert\"><strong>Aper&ccedil;u</strong></div>\n".
261
						$this->Format($body)."\n\n".
262
						$this->FormOpen("edit").
263
						"<input type=\"hidden\" name=\"previous\" value=\"".$previous."\" />\n".
264
						"<input type=\"hidden\" name=\"body\" value=\"".htmlentities($body)."\" />\n".
265
						"<br />\n".
266
						"<input name=\"submit\" type=\"submit\" value=\"Sauver\" accesskey=\"s\" />\n".
267
						"<input name=\"submit\" type=\"submit\" value=\"R&eacute;&eacute;diter \" accesskey=\"p\" />\n".
268
						"<input type=\"button\" value=\"Annulation\" onclick=\"document.location='".$this->href("")."';\" />\n".
269
						$this->FormClose()."\n";
270
					return $result;
271
				}
272
				else
273
				{
1696 ddelon 274
 
275
					// Edition
276
 
277
					require_once(ADWI_CHEMIN_BIBLIOTHEQUE.'/hashcash/secret/wp-hashcash.lib');
278
 
279
            		// UPDATE RANDOM SECRET
280
            		$curr = @file_get_contents(HASHCASH_SECRET_FILE);
281
            		if(empty($curr) || (time() - @filemtime(HASHCASH_SECRET_FILE)) > HASHCASH_REFRESH){
282
 
283
            			// update our secret
284
            			$fp = fopen(HASHCASH_SECRET_FILE, 'w');
285
 
286
            			if(@flock($fp, LOCK_EX)){
287
            				fwrite($fp, rand(21474836, 2126008810));
288
            				@flock($fp, LOCK_UN);
289
            			}
290
 
291
            			fclose($fp);
292
 
293
            		}
294
 
295
            		if (isset($GLOBALS['_GEN_commun']['url_sauvegarde']) && ($GLOBALS['_GEN_commun']['url_sauvegarde']!='')) {
296
	                  $a=parse_url(str_replace('&amp;', '&', $GLOBALS['_GEN_commun']['url_sauvegarde']->getUrl()));
297
					}
298
 
299
					else {
300
                        $a = parse_url($this->config['base_url']);
301
					}
302
 
303
                    $siteurl = ($a['scheme'].'://'.$a['host'].dirname($a['path']));
304
 
305
 
306
            		$ChampsHashcash =
307
            		 '<link rel="powered" title="Elliott Back\'s Antispam" href="http://elliottback.com" />'.
308
            		 '<script type="text/javascript" src="' . $siteurl . '/client/integrateur_wikini/bibliotheque/hashcash/wp-hashcash-js.php?siteurl='.$siteurl.'"></script>';
309
 
920 ddelon 310
					$ACbuttonsBar='';
311
				    require_once(IW_CHEMIN_BIBLIO_ACEDITOR."ACeditor.buttonsBar.php");
312
 
313
					$result .=
545 ddelon 314
					$this->FormOpen("edit").
920 ddelon 315
					"<input type=\"hidden\" name=\"previous\" value=\"".$previous."\" />\n".$ACbuttonsBar.
316
					"<textarea onkeydown=\"fKeyDown()\" name=\"body\" cols=\"60\" rows=\"40\" wrap=\"soft\" class=\"edit\">\n".
317
					htmlspecialchars($body).
318
					"\n</textarea><br />\n".'<div class="boutons_wiki">'.
1696 ddelon 319
					($this->config["preview_before_save"] ? "" : $ChampsHashcash."<input name=\"submit\" type=\"submit\" value=\"Sauver\" accesskey=\"s\" />\n").
920 ddelon 320
					"<input name=\"submit\" type=\"submit\" value=\"Aper&ccedil;u\" accesskey=\"p\" />\n".
321
					"<input type=\"button\" value=\"Annulation\" onclick=\"document.location='".$this->href("")."';\" /></div>\n".
322
					$this->FormClose();
323
 
324
					return $result;
325
				}
326
 
545 ddelon 327
			}
920 ddelon 328
			else {
329
				echo "<i>Vous n'avez pas acc&egrave;s en &eacute;criture &agrave; cette page !</i>\n";
330
 
545 ddelon 331
			}
332
		}
333
		else {
334
			return parent::Method($method);
335
		}
336
	}
581 ddelon 337
 
338
 
339
	// Surcharge Format a cause probleme de chemin.
340
 
545 ddelon 341
	function Format($text, $formatter = "wakka") {
581 ddelon 342
		return $this->IncludeBuffered(IW_CHEMIN_WIKINI_COURANT_FORMATTER.$formatter.".php", "<i>Impossible de trouver le formateur \"$formatter\"</i>", compact("text"));
545 ddelon 343
	}
581 ddelon 344
 
345
 
346
	// Identification
347
 
584 ddelon 348
	function SetUser($user, $remember) {
349
			// Appel à partir de Papyrus
920 ddelon 350
				if ($user=='initwiki') {
584 ddelon 351
					$remember=1;
596 ddelon 352
					$wiki_prenom=$this->versChatMot($GLOBALS['_GEN_commun']['pear_auth']->getAuthData($GLOBALS['_GEN_commun']['info_auth_bdd']->chp_personne_prenom));
353
					$wiki_nom=$this->versChatMot($GLOBALS['_GEN_commun']['pear_auth']->getAuthData($GLOBALS['_GEN_commun']['info_auth_bdd']->chp_personne_nom));
920 ddelon 354
					$_SESSION["user"]=array("name"=>$wiki_prenom.$wiki_nom,"password"=>"wikini","changescount"=> 100);
584 ddelon 355
					$this->SetPersistentCookie("name", $user["name"], $remember);
356
					$this->SetPersistentCookie("password", $user["password"], $remember);
357
					$this->SetPersistentCookie("remember", $remember, $remember);
358
				}
359
				else {
360
					parent::Setuser($user,$remember);
361
				}
362
 
580 ddelon 363
	}
581 ddelon 364
 
677 ddelon 365
	function LoadUser($name, $password = 0) {
366
		 return true;
367
	}
368
 
596 ddelon 369
	function LogoutUser() {
370
		$_SESSION["user"]="";
371
		$this->DeleteCookie("remember");
372
		parent::LogoutUser();
373
	}
677 ddelon 374
 
375
 
581 ddelon 376
 
596 ddelon 377
	function versChatMot($entree) {
378
		$sortie = strtolower(trim(strtr($entree, "àâéêèëîïôöùûüç-", "aaeeeeiioouuuc ")));
379
		$sortie = ucwords($sortie);
380
		$sortie = str_replace(" ", "",$sortie);
381
		return $sortie;
382
	}
383
 
545 ddelon 384
}
385
 
581 ddelon 386
 
387
 
545 ddelon 388
// Appel du fichier de traduction des textes de l'application Integrateur Wikini
389
if (file_exists(IW_CHEMIN_LANGUES.'iw_langue_'.IW_I18N.'.inc.php')) {
390
    /** Inclusion du fichier de traduction de l'application Integrateur Wikini. */
391
    include_once IW_CHEMIN_LANGUES.'iw_langue_'.IW_I18N.'.inc.php';
392
} else {
393
    /** Inclusion du fichier de traduction fr par défaut. */
394
    include_once IW_CHEMIN_LANGUES.'iw_langue_fr.inc.php';
395
}
396
 
397
$GLOBALS['_PAPYRUS_']['erreur']->setActive(1);
398
/**
581 ddelon 399
 *
545 ddelon 400
 * Fonction afficherPageMenuWikini()
581 ddelon 401
 *
545 ddelon 402
 * Renvoie le contenu de la page Menu de Wikini
403
 *
404
 * @return string
405
 * @access public
406
 */
581 ddelon 407
 
545 ddelon 408
function afficherPageMenuWikini()
409
{
581 ddelon 410
 
545 ddelon 411
	$GLOBALS['_PAPYRUS_']['erreur']->setActive(0);
412
 
413
	global $wiki;
414
	global $wikini_config_defaut;
415
	$sortie='';
416
    $wakkaConfig = $GLOBALS['wikini_config_defaut'];
898 alexandre_ 417
    if (!class_exists('Wiki_Papyrus')) return ;
545 ddelon 418
    $wiki  = new Wiki_Papyrus($wakkaConfig);
419
 
420
    // Suppression des slash.
421
    $_REQUEST['wiki'] = preg_replace("/^\//", '',  $_REQUEST['wiki']);
422
 
423
    // split into page/method
832 florian 424
    $matches='';
545 ddelon 425
    if ( preg_match( "#^(.+?)/(.*)$#",  $_REQUEST['wiki'], $matches ) ) {
426
        list(, $page, $method) = $matches;
427
    } else if ( preg_match( "#^(.*)$#",  $_REQUEST['wiki'], $matches ) ) {
428
        list(, $page) = $matches;
429
    }
430
 
431
    $server=$_SERVER['PHP_SELF'];
432
	$_SERVER['PHP_SELF']="wakka.php";
581 ddelon 433
 
545 ddelon 434
    $contenu=$wiki->LoadPage("PageMenu");
581 ddelon 435
 
585 ddelon 436
    $sortie.="<div id=\"menu_wikini\">";
581 ddelon 437
	$sortie.=$wiki->Format($contenu['body']);
585 ddelon 438
	$sortie.="</div>";
545 ddelon 439
 
440
	$_SERVER['PHP_SELF']=$server;
581 ddelon 441
 
545 ddelon 442
	$GLOBALS['_PAPYRUS_']['erreur']->setActive(1);
581 ddelon 443
 
545 ddelon 444
	return $sortie;
581 ddelon 445
 
446
}
447
 
448
 
545 ddelon 449
// +------------------------------------------------------------------------------------------------------+
450
// |                                            CORPS du PROGRAMME                                        |
451
// +------------------------------------------------------------------------------------------------------+
452
/** Fonction afficherPageWikini() - Fonction appelé par le gestionnaire Papyrus.
453
*
454
* Elle retourne le contenu de l'application.
455
*
456
* @return  string  du code XHTML correspondant au contenu renvoyé par l'application.
457
*/
458
function afficherPageWikini()
459
{
920 ddelon 460
 
545 ddelon 461
 
462
	$GLOBALS['_PAPYRUS_']['erreur']->setActive(0);
581 ddelon 463
 
545 ddelon 464
	// Ajout d'une feuille de style externe
465
	GEN_stockerStyleExterne ('wikini', 'client/integrateur_wikini/presentations/styles/wikini.css') ;
581 ddelon 466
 
545 ddelon 467
	global $wiki;
468
	global $wikini_config_defaut;
469
	$sortie='';
470
    $wakkaConfig = $GLOBALS['wikini_config_defaut'];
898 alexandre_ 471
    if (!class_exists ('Wiki_Papyrus')) return ;
545 ddelon 472
    $wiki  = new Wiki_Papyrus($wakkaConfig);
473
 
581 ddelon 474
	if  ($GLOBALS['_GEN_commun']['pear_auth']->checkAuth()) {
921 ddelon 475
	//	if (!isset($_SESSION["user"]) || ($_SESSION["user"]=="")) {
920 ddelon 476
			$wiki->SetUser('initwiki');
921 ddelon 477
	//	}
580 ddelon 478
	}
479
	else {
480
		$wiki->LogoutUser();
481
	}
581 ddelon 482
 
545 ddelon 483
	// Gestion de la variable de session "linktracking"
484
    if ( ! isset( $_SESSION['linktracking'] ) ) {
485
        $_SESSION['linktracking'] = 1;
486
    }
487
 
488
    // Suppression des slash.
489
    $_REQUEST['wiki'] = preg_replace("/^\//", '',  $_REQUEST['wiki']);
490
 
491
    // split into page/method
832 florian 492
    $matches='';
545 ddelon 493
    if ( preg_match( "#^(.+?)/(.*)$#",  $_REQUEST['wiki'], $matches ) ) {
494
        list(, $page, $method) = $matches;
495
    } else if ( preg_match( "#^(.*)$#",  $_REQUEST['wiki'], $matches ) ) {
496
        list(, $page) = $matches;
497
    }
581 ddelon 498
 
545 ddelon 499
    // Vérification de la méthode d'affichage employée!
500
    if ( ! isset( $method ) ) {
501
        $method = '';
502
    }
581 ddelon 503
 
545 ddelon 504
    //Récupération du contenu de la page Wikini
581 ddelon 505
 
545 ddelon 506
    ob_start();
581 ddelon 507
 
545 ddelon 508
    $server=$_SERVER['PHP_SELF'];
509
	$_SERVER['PHP_SELF']="wakka.php";
581 ddelon 510
 
545 ddelon 511
	$wiki->Run($page, $method);
581 ddelon 512
 
545 ddelon 513
    $_SERVER['PHP_SELF']=$server;
581 ddelon 514
 
545 ddelon 515
    $sortie.= ob_get_contents();
516
    ob_end_clean();
517
 
518
	$GLOBALS['_PAPYRUS_']['erreur']->setActive(1);
519
 
676 ddelon 520
	if ($method!="edit") {
521
		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");
522
	}
523
	else {
524
		return remplacerEntiteHTLM("<script type=\"text/javascript\" src=\"".IW_CHEMIN_BIBLIO_ACEDITOR."ACeditor.js\"></script><div id=\"wikini_page\">"."\n".$sortie.'</div>'."\n");
525
	}
690 ddelon 526
 
527
 
545 ddelon 528
}
529
 
530
?>