Subversion Repositories Applications.papyrus

Rev

Rev 1834 | 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
// +------------------------------------------------------------------------------------------------------+
1835 jp_milcent 24
// CVS : $Id: iw_integrateur.fonct.php,v 1.24 2008-04-28 17:18:42 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
1835 jp_milcent 36
*@version       $Revision: 1.24 $ $Date: 2008-04-28 17:18:42 $
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")	{
1694 ddelon 209
 
210
					require_once(ADWI_CHEMIN_BIBLIOTHEQUE.'/hashcash/secret/wp-hashcash.lib');
1835 jp_milcent 211
					if($_POST["hashcash_value"] != hashcash_field_value()) {
1834 ddelon 212
					    $error="Cette page n'a pas &eacute;t&eacute; enregistr&eacute;e car ce wiki pense que vous etes un robot.  Copiez-collez vos modifications et activez Javascript  !";
1694 ddelon 213
					}
214
 
920 ddelon 215
					// check for overwriting
216
						if ($this->page) {
217
							if ($this->page["id"] != $_POST["previous"]) {
218
								$error = "ALERTE : ".
219
								"Cette page a &eacute;t&eacute; modifi&eacute;e par quelqu'un d'autre pendant que vous l'&eacute;ditiez.<br />\n".
220
								"Veuillez copier vos changements et r&eacute;&eacute;diter cette page.\n";
221
							}
545 ddelon 222
						}
920 ddelon 223
						// store
224
						if (!$error) {
225
							$body = str_replace("\r", "", $_POST["body"]);
226
							// test si la nouvelle page est differente de la précédente
227
							if(rtrim($body)==rtrim($this->page["body"])) {
228
								$this->SetMessage("Cette page n\'a pas &eacute;t&eacute; enregistr&eacute;e car elle n\'a subi aucune modification.");
229
								$this->Redirect($this->href());
230
							}
231
 
232
							// add page (revisions)
233
							$this->SavePage($this->tag, $body);
234
 
235
							// now we render it internally so we can write the updated link table.
236
							$this->ClearLinkTable();
237
							$this->StartLinkTracking();
238
							$dummy = $this->Header();
239
							$dummy .= $this->Format($body);
240
							$dummy .= $this->Footer();
241
							$this->StopLinkTracking();
242
							$this->WriteLinkTable();
243
							$this->ClearLinkTable();
244
 
245
							// forward
545 ddelon 246
							$this->Redirect($this->href());
247
						}
248
					}
249
				}
920 ddelon 250
 
251
				// fetch fields
252
				if (!$previous = $_POST["previous"]) $previous = $this->page["id"];
253
				if (!$body = $_POST["body"]) $body = $this->page["body"];
254
 
255
				// preview?
256
				if ($_POST["submit"] == "Aperçu")
257
				{
258
					$result .=
259
						"<div class=\"prev_alert\"><strong>Aper&ccedil;u</strong></div>\n".
260
						$this->Format($body)."\n\n".
261
						$this->FormOpen("edit").
262
						"<input type=\"hidden\" name=\"previous\" value=\"".$previous."\" />\n".
263
						"<input type=\"hidden\" name=\"body\" value=\"".htmlentities($body)."\" />\n".
264
						"<br />\n".
265
						"<input name=\"submit\" type=\"submit\" value=\"Sauver\" accesskey=\"s\" />\n".
266
						"<input name=\"submit\" type=\"submit\" value=\"R&eacute;&eacute;diter \" accesskey=\"p\" />\n".
267
						"<input type=\"button\" value=\"Annulation\" onclick=\"document.location='".$this->href("")."';\" />\n".
268
						$this->FormClose()."\n";
269
					return $result;
270
				}
271
				else
272
				{
1694 ddelon 273
 
274
					// Edition
275
 
276
					require_once(ADWI_CHEMIN_BIBLIOTHEQUE.'/hashcash/secret/wp-hashcash.lib');
277
 
278
            		// UPDATE RANDOM SECRET
279
            		$curr = @file_get_contents(HASHCASH_SECRET_FILE);
280
            		if(empty($curr) || (time() - @filemtime(HASHCASH_SECRET_FILE)) > HASHCASH_REFRESH){
281
 
282
            			// update our secret
283
            			$fp = fopen(HASHCASH_SECRET_FILE, 'w');
284
 
285
            			if(@flock($fp, LOCK_EX)){
286
            				fwrite($fp, rand(21474836, 2126008810));
287
            				@flock($fp, LOCK_UN);
288
            			}
289
 
290
            			fclose($fp);
291
 
292
            		}
293
 
294
            		if (isset($GLOBALS['_GEN_commun']['url_sauvegarde']) && ($GLOBALS['_GEN_commun']['url_sauvegarde']!='')) {
295
	                  $a=parse_url(str_replace('&amp;', '&', $GLOBALS['_GEN_commun']['url_sauvegarde']->getUrl()));
296
					}
297
 
298
					else {
299
                        $a = parse_url($this->config['base_url']);
300
					}
301
 
302
                    $siteurl = ($a['scheme'].'://'.$a['host'].dirname($a['path']));
303
 
1834 ddelon 304
            	// display form
305
					if (isset($error)) {
306
						if (!isset($output)) $output = '';
307
						$output .= "<div class=\"error\">$error</div>\n";
308
					}
1694 ddelon 309
 
1834 ddelon 310
 
1694 ddelon 311
            		$ChampsHashcash =
312
            		 '<link rel="powered" title="Elliott Back\'s Antispam" href="http://elliottback.com" />'.
313
            		 '<script type="text/javascript" src="' . $siteurl . '/client/integrateur_wikini/bibliotheque/hashcash/wp-hashcash-js.php?siteurl='.$siteurl.'"></script>';
314
 
920 ddelon 315
					$ACbuttonsBar='';
316
				    require_once(IW_CHEMIN_BIBLIO_ACEDITOR."ACeditor.buttonsBar.php");
317
 
318
					$result .=
545 ddelon 319
					$this->FormOpen("edit").
920 ddelon 320
					"<input type=\"hidden\" name=\"previous\" value=\"".$previous."\" />\n".$ACbuttonsBar.
321
					"<textarea onkeydown=\"fKeyDown()\" name=\"body\" cols=\"60\" rows=\"40\" wrap=\"soft\" class=\"edit\">\n".
322
					htmlspecialchars($body).
323
					"\n</textarea><br />\n".'<div class="boutons_wiki">'.
1694 ddelon 324
					($this->config["preview_before_save"] ? "" : $ChampsHashcash."<input name=\"submit\" type=\"submit\" value=\"Sauver\" accesskey=\"s\" />\n").
920 ddelon 325
					"<input name=\"submit\" type=\"submit\" value=\"Aper&ccedil;u\" accesskey=\"p\" />\n".
326
					"<input type=\"button\" value=\"Annulation\" onclick=\"document.location='".$this->href("")."';\" /></div>\n".
327
					$this->FormClose();
328
 
329
					return $result;
330
				}
331
 
545 ddelon 332
			}
920 ddelon 333
			else {
334
				echo "<i>Vous n'avez pas acc&egrave;s en &eacute;criture &agrave; cette page !</i>\n";
335
 
545 ddelon 336
			}
337
		}
338
		else {
339
			return parent::Method($method);
340
		}
341
	}
581 ddelon 342
 
343
 
344
	// Surcharge Format a cause probleme de chemin.
345
 
545 ddelon 346
	function Format($text, $formatter = "wakka") {
581 ddelon 347
		return $this->IncludeBuffered(IW_CHEMIN_WIKINI_COURANT_FORMATTER.$formatter.".php", "<i>Impossible de trouver le formateur \"$formatter\"</i>", compact("text"));
545 ddelon 348
	}
581 ddelon 349
 
350
 
351
	// Identification
352
 
584 ddelon 353
	function SetUser($user, $remember) {
354
			// Appel à partir de Papyrus
920 ddelon 355
				if ($user=='initwiki') {
584 ddelon 356
					$remember=1;
596 ddelon 357
					$wiki_prenom=$this->versChatMot($GLOBALS['_GEN_commun']['pear_auth']->getAuthData($GLOBALS['_GEN_commun']['info_auth_bdd']->chp_personne_prenom));
358
					$wiki_nom=$this->versChatMot($GLOBALS['_GEN_commun']['pear_auth']->getAuthData($GLOBALS['_GEN_commun']['info_auth_bdd']->chp_personne_nom));
920 ddelon 359
					$_SESSION["user"]=array("name"=>$wiki_prenom.$wiki_nom,"password"=>"wikini","changescount"=> 100);
584 ddelon 360
					$this->SetPersistentCookie("name", $user["name"], $remember);
361
					$this->SetPersistentCookie("password", $user["password"], $remember);
362
					$this->SetPersistentCookie("remember", $remember, $remember);
363
				}
364
				else {
365
					parent::Setuser($user,$remember);
366
				}
367
 
580 ddelon 368
	}
581 ddelon 369
 
677 ddelon 370
	function LoadUser($name, $password = 0) {
371
		 return true;
372
	}
373
 
596 ddelon 374
	function LogoutUser() {
1831 ddelon 375
	            unset($_SESSION["user"]["name"]);
376
                unset($_SESSION["user"]["password"]);
377
                unset($_SESSION["user"]["changescount"]);
378
                $this->DeleteCookie("name");
379
                $this->DeleteCookie("password");
380
                $this->DeleteCookie("remember");
381
                unset($_COOKIE["name"]);
382
 
596 ddelon 383
		$_SESSION["user"]="";
384
		$this->DeleteCookie("remember");
385
		parent::LogoutUser();
386
	}
677 ddelon 387
 
388
 
581 ddelon 389
 
596 ddelon 390
	function versChatMot($entree) {
391
		$sortie = strtolower(trim(strtr($entree, "àâéêèëîïôöùûüç-", "aaeeeeiioouuuc ")));
392
		$sortie = ucwords($sortie);
393
		$sortie = str_replace(" ", "",$sortie);
394
		return $sortie;
395
	}
396
 
545 ddelon 397
}
398
 
581 ddelon 399
 
400
 
545 ddelon 401
// Appel du fichier de traduction des textes de l'application Integrateur Wikini
402
if (file_exists(IW_CHEMIN_LANGUES.'iw_langue_'.IW_I18N.'.inc.php')) {
403
    /** Inclusion du fichier de traduction de l'application Integrateur Wikini. */
404
    include_once IW_CHEMIN_LANGUES.'iw_langue_'.IW_I18N.'.inc.php';
405
} else {
406
    /** Inclusion du fichier de traduction fr par défaut. */
407
    include_once IW_CHEMIN_LANGUES.'iw_langue_fr.inc.php';
408
}
409
 
410
$GLOBALS['_PAPYRUS_']['erreur']->setActive(1);
411
/**
581 ddelon 412
 *
545 ddelon 413
 * Fonction afficherPageMenuWikini()
581 ddelon 414
 *
545 ddelon 415
 * Renvoie le contenu de la page Menu de Wikini
416
 *
417
 * @return string
418
 * @access public
419
 */
581 ddelon 420
 
545 ddelon 421
function afficherPageMenuWikini()
422
{
581 ddelon 423
 
545 ddelon 424
	$GLOBALS['_PAPYRUS_']['erreur']->setActive(0);
425
 
426
	global $wiki;
427
	global $wikini_config_defaut;
428
	$sortie='';
429
    $wakkaConfig = $GLOBALS['wikini_config_defaut'];
898 alexandre_ 430
    if (!class_exists('Wiki_Papyrus')) return ;
545 ddelon 431
    $wiki  = new Wiki_Papyrus($wakkaConfig);
432
 
433
    // Suppression des slash.
434
    $_REQUEST['wiki'] = preg_replace("/^\//", '',  $_REQUEST['wiki']);
435
 
436
    // split into page/method
832 florian 437
    $matches='';
545 ddelon 438
    if ( preg_match( "#^(.+?)/(.*)$#",  $_REQUEST['wiki'], $matches ) ) {
439
        list(, $page, $method) = $matches;
440
    } else if ( preg_match( "#^(.*)$#",  $_REQUEST['wiki'], $matches ) ) {
441
        list(, $page) = $matches;
442
    }
443
 
444
    $server=$_SERVER['PHP_SELF'];
445
	$_SERVER['PHP_SELF']="wakka.php";
581 ddelon 446
 
545 ddelon 447
    $contenu=$wiki->LoadPage("PageMenu");
581 ddelon 448
 
585 ddelon 449
    $sortie.="<div id=\"menu_wikini\">";
581 ddelon 450
	$sortie.=$wiki->Format($contenu['body']);
585 ddelon 451
	$sortie.="</div>";
545 ddelon 452
 
453
	$_SERVER['PHP_SELF']=$server;
581 ddelon 454
 
545 ddelon 455
	$GLOBALS['_PAPYRUS_']['erreur']->setActive(1);
581 ddelon 456
 
545 ddelon 457
	return $sortie;
581 ddelon 458
 
459
}
460
 
461
 
545 ddelon 462
// +------------------------------------------------------------------------------------------------------+
463
// |                                            CORPS du PROGRAMME                                        |
464
// +------------------------------------------------------------------------------------------------------+
465
/** Fonction afficherPageWikini() - Fonction appelé par le gestionnaire Papyrus.
466
*
467
* Elle retourne le contenu de l'application.
468
*
469
* @return  string  du code XHTML correspondant au contenu renvoyé par l'application.
470
*/
471
function afficherPageWikini()
472
{
920 ddelon 473
 
545 ddelon 474
 
475
	$GLOBALS['_PAPYRUS_']['erreur']->setActive(0);
581 ddelon 476
 
545 ddelon 477
	// Ajout d'une feuille de style externe
478
	GEN_stockerStyleExterne ('wikini', 'client/integrateur_wikini/presentations/styles/wikini.css') ;
581 ddelon 479
 
545 ddelon 480
	global $wiki;
481
	global $wikini_config_defaut;
482
	$sortie='';
483
    $wakkaConfig = $GLOBALS['wikini_config_defaut'];
898 alexandre_ 484
    if (!class_exists ('Wiki_Papyrus')) return ;
545 ddelon 485
    $wiki  = new Wiki_Papyrus($wakkaConfig);
486
 
581 ddelon 487
	if  ($GLOBALS['_GEN_commun']['pear_auth']->checkAuth()) {
921 ddelon 488
	//	if (!isset($_SESSION["user"]) || ($_SESSION["user"]=="")) {
920 ddelon 489
			$wiki->SetUser('initwiki');
921 ddelon 490
	//	}
580 ddelon 491
	}
492
	else {
493
		$wiki->LogoutUser();
494
	}
581 ddelon 495
 
545 ddelon 496
	// Gestion de la variable de session "linktracking"
497
    if ( ! isset( $_SESSION['linktracking'] ) ) {
498
        $_SESSION['linktracking'] = 1;
499
    }
500
 
501
    // Suppression des slash.
502
    $_REQUEST['wiki'] = preg_replace("/^\//", '',  $_REQUEST['wiki']);
503
 
504
    // split into page/method
832 florian 505
    $matches='';
545 ddelon 506
    if ( preg_match( "#^(.+?)/(.*)$#",  $_REQUEST['wiki'], $matches ) ) {
507
        list(, $page, $method) = $matches;
508
    } else if ( preg_match( "#^(.*)$#",  $_REQUEST['wiki'], $matches ) ) {
509
        list(, $page) = $matches;
510
    }
581 ddelon 511
 
545 ddelon 512
    // Vérification de la méthode d'affichage employée!
513
    if ( ! isset( $method ) ) {
514
        $method = '';
515
    }
581 ddelon 516
 
545 ddelon 517
    //Récupération du contenu de la page Wikini
581 ddelon 518
 
545 ddelon 519
    ob_start();
581 ddelon 520
 
545 ddelon 521
    $server=$_SERVER['PHP_SELF'];
522
	$_SERVER['PHP_SELF']="wakka.php";
581 ddelon 523
 
545 ddelon 524
	$wiki->Run($page, $method);
581 ddelon 525
 
545 ddelon 526
    $_SERVER['PHP_SELF']=$server;
581 ddelon 527
 
545 ddelon 528
    $sortie.= ob_get_contents();
529
    ob_end_clean();
530
 
531
	$GLOBALS['_PAPYRUS_']['erreur']->setActive(1);
532
 
676 ddelon 533
	if ($method!="edit") {
534
		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");
535
	}
536
	else {
537
		return remplacerEntiteHTLM("<script type=\"text/javascript\" src=\"".IW_CHEMIN_BIBLIO_ACEDITOR."ACeditor.js\"></script><div id=\"wikini_page\">"."\n".$sortie.'</div>'."\n");
538
	}
690 ddelon 539
 
540
 
545 ddelon 541
}
542
 
543
?>