Retour [2.19_4b/index.php]
show/hide
0
1 <?php
2    
// TigerWiki 2 (Version 2.19 - 2006-11-02)
3    // Copyleft (C) Arsenic 2005-2006, licence GNU/GPL (disponible sur www.gnu.org)
4    // http://chabel.org/ - root chez chabel point org
5    
$WIKI_VERSION "TigerWiki 2.19+4b";
6
7    
//Fichier de configuration
8    
include("_config.php");
9
10    
/** test si l'utilisateur est authentifié
11     * pose cookie si absent
12     */
13    
function authentified()
14    {
15       global 
$PASSWORD;
16       if ((
$_COOKIE['AutorisationTigerWiki'] == md5($PASSWORD)) || ($_POST["sc"] == $PASSWORD))
17       {
18          if ((
$PASSWORD != "") && empty($_COOKIE['AutorisationTigerWiki'])) {
19             
$pwd=md5($PASSWORD);
20             
setcookie('AutorisationTigerWiki',$pwdtime() + 365*24*3600);
21             
$_COOKIE['AutorisationTigerWiki'] = $pwd;
22             }
23          return 
TRUE;
24       }
25       else
26          return 
FALSE;
27    } 
// authentified()
28
29    /** Verifie la validite d'un path
30     * retire .., ^/, //, /$ et decode un chemin
31     * input: le path
32     * return le path corrigé
33     */
34    
function cleanInput($input)
35    {
36       return 
trim(preg_replace('/(\.\.|^\/|\/\/)/','',urldecode($input)),'/');
37    }
38
39    
// Effacement du cookie
40    
if ($_GET['erasecookie'] == 1)
41    {
42       
setcookie('AutorisationTigerWiki');
43       
$_COOKIE['AutorisationTigerWiki'] = ""// JJL: remove cookie without reloading
44    
}
45
46    
// Trouver la page a afficher
47    
if (! $PAGE_TITLE stripslashes($_GET["page"]))
48    {
49       if (
$_GET["action"] == "search")
50          if (
$_GET["query"] != "")
51             
$PAGE_TITLE "$SEARCH_RESULTS \"$_GET[query]\"";
52          else
53             
$PAGE_TITLE $LIST " (" count(glob("$PAGES_DIR/*.*")) . ")";
54       elseif (
$_GET["action"] == "recent")
55          
$PAGE_TITLE "$RECENT_CHANGES";
56       elseif (
$_GET["action"] == "upload"// JJL upload
57          
$PAGE_TITLE $UPLOAD_BUTTON;
58       else
59          
$PAGE_TITLE "$START_PAGE";
60    }
61    if (
$_GET["page"] == $UPLOAD_BUTTON)
62       
$action="upload";
63    else
64       
$action $_GET["action"];
65    
66    if (isset(
$_GET["time"]))
67       
$gtime $_GET["time"];
68    
$datetw date("Y/m/d H:i"mktime(date("H") + $LOCAL_HOUR));
69
70    
// Arreter les acces malicieux via repertoire et accents
71    
if (preg_match("/\//"$PAGE_TITLE))
72       
$PAGE_TITLE $START_PAGE;
73    if (
preg_match("/\//"$gtime))
74       
$gtime '';
75
76    
// Ecrire les modifications, s'il y a lieu
77    
if ($_POST["content"] != "")
78    {
79       if (
$_SERVER["REQUEST_METHOD"] == "POST")
80       {
81          if (
authentified())
82          {
83             if (! 
$file = @fopen($PAGES_DIR stripslashes($_POST["page"]) . ".txt""w"))
84                die(
"Could not write page!");
85             if (
get_magic_quotes_gpc())
86                
fputs($filetrim(stripslashes($_POST["content"])));
87             else
88                
fputs($filetrim($_POST["content"]));
89             
fclose($file);
90             if (
$BACKUP_DIR <> '')
91             {
92                
$complete_dir_s $BACKUP_DIR $_POST["page"] . "/";
93                if (! 
$dir = @opendir($complete_dir_s))
94                {
95                   
mkdir($complete_dir_s);
96                   
chmod($complete_dir_s,0777);
97                }
98                if (! 
$file = @fopen($complete_dir_s date("Ymd-Hi"mktime(date("H") + $LOCAL_HOUR)) . ".bak""a"))
99                   die(
"Could not write backup of page!");
100                
fputs($file"\n// " $datetw " / " " " $_SERVER['REMOTE_ADDR'] . "\n");
101                if (
get_magic_quotes_gpc())
102                   
fputs($filetrim(stripslashes($_POST["content"])));
103                else
104                   
fputs($filetrim($_POST["content"]) . "\n\n");
105                
fclose($file);
106             }
107             include(
"ModuleRSS.php");
108             
header("location: ./?page=" urlencode(stripslashes($_POST[page])));
109          }
110          else
111          {
112             
header("location: ./?page=" $_POST[page]."&action=edit&error=1");
113          }
114       }
115    }
116    elseif (isset(
$_POST["content"]) && $_POST["content"] == "")
117    {
118       if (
authentified())
119       {
120          
unlink($PAGES_DIR stripslashes($_POST["page"]) . ".txt");
121       }
122       else
123          
header("location: ./?page=".$_POST["page"]."&action=edit&error=1");
124    }
125
126    
// Lecture et analyse du mod�le de page
127    
if (! $file = @fopen("template.html""r"))
128       die(
"'template.html' is missing!");
129    
$template fread($filefilesize("template.html"));
130    
fclose($file);
131
132    
// Lecture du contenu et de la date de modification de la page
133    
if (($file = @fopen($PAGES_DIR $PAGE_TITLE ".txt""r")) || $action <> "")
134    {
135       if (
file_exists($PAGES_DIR $PAGE_TITLE ".txt"))
136          
$TIME date("Y/m/d H:i", @filemtime($PAGES_DIR $PAGE_TITLE ".txt") + $LOCAL_HOUR 3600);
137       
$CONTENT "\n" . @fread($file, @filesize($PAGES_DIR $PAGE_TITLE ".txt")) . "\n";
138       
// Restaurer une page
139       
if (isset($_GET["page"]) && isset($gtime) && $_GET["restore"] == 1)
140          if (
$file = @fopen($BACKUP_DIR $PAGE_TITLE "/" $gtime"r"))
141             
$CONTENT "\n" . @fread($file, @filesize($BACKUP_DIR $PAGE_TITLE "/" $gtime)) . "\n";
142       @
fclose($file);
143       
$CONTENT preg_replace("/\\$/Umsi""&#036;"$CONTENT);
144       
$CONTENT preg_replace("/\\\/Umsi""&#092;"$CONTENT);
145    }
146    else
147    {
148       if (!
file_exists($PAGES_DIR $PAGE_TITLE ".txt"))
149          
$CONTENT "\n" $DEFAULT_CONTENT;
150       else
151          
$action "edit";
152    }
153
154    
// D�terminer le mode d'acc�s
155    
if ($action == "edit" || $action == "search" || $action == "recent" || $action == "upload")
156       
$html preg_replace('/{EDIT}/'$EDIT_BUTTON$template);
157    elseif (
is_writable($PAGES_DIR $PAGE_TITLE ".txt") || !file_exists($PAGES_DIR $PAGE_TITLE ".txt"))
158       
$html preg_replace('/{EDIT}/'"<a href=\"./?page=".$PAGE_TITLE."&amp;action=edit\" accesskey=\"5\">$EDIT_BUTTON</a>"$template);
159    else
160       
$html preg_replace('/{EDIT}/'$PROTECTED_BUTTON$template);
161    if (
$action == "recent" || $action == "upload")
162       
$html preg_replace('/{RECENT_CHANGES}/'$RECENT_CHANGES$html);
163    else
164       
$html preg_replace('/{RECENT_CHANGES}/'"<a href=\"./?action=recent\" accesskey=\"3\">$RECENT_CHANGES</a>"$html);
165    
166
167    
// Remplacer les variables par des valeurs (dans le style de page)
168    
$html preg_replace('/{PAGE_TITLE_BRUT}/'$PAGE_TITLE$html);
169    if (
$action != "" && $action != "recent" && $action != "search" && $action != "upload")
170       
$html preg_replace('/{PAGE_TITLE}/'"<a href=\"./?page=".$PAGE_TITLE."\">".$PAGE_TITLE."</a>"$html);
171    else
172       
$html preg_replace('/{PAGE_TITLE}/'$PAGE_TITLE$html);
173    if (
$PAGE_TITLE == $START_PAGE && $action <> "search")
174       
$html preg_replace('/{HOME}/'$HOME_BUTTON$html);
175    else
176       
$html preg_replace('/{HOME}/'"<a href=\"./?page=".$START_PAGE."\" accesskey=\"1\">$HOME_BUTTON</a>"$html);
177    
$html preg_replace('/{WIKI_TITLE}/'$WIKI_TITLE$html);
178    
$html preg_replace('/{LAST_CHANGE}/'$LAST_CHANGES." :"$html);
179    if (
$action != "edit")
180       
$html preg_replace('/{HELP}/'""$html);
181    else
182       
$html preg_replace('/{HELP}/'"(<a href=\"./?page=$HELP_BUTTON\" accesskey=\"2\">$HELP_BUTTON</a>)"$html);
183    
$html preg_replace('/{SEARCH}/'"<form method=\"get\" action=\"./?page=".$_GET[page]."\"><div><input type=\"hidden\" name=\"action\" value=\"search\" /><input type=\"text\" name=\"query\" value=\"$_GET[query]\" /> <input type=\"submit\" value=\"$SEARCH_BUTTON\" accesskey=\"q\" /></div></form>"$html);
184    if (
$action == "edit")
185    {
186       
$html preg_replace('/{HISTORY}/'"/ <a href=\"?page=".$PAGE_TITLE."&amp;action=history\" accesskey=\"6\">".$HISTORY_BUTTON."</a> / <a href=./?action=upload>".$UPLOAD_BUTTON."</a><br />"$html);
187       
$CONTENT "<form method=\"post\" action=\"./\"><textarea name=\"content\" cols=\"83\" rows=\"30\" style=\"width: 100%;\">$CONTENT</textarea><input type=\"hidden\" name=\"page\" value=\"".$PAGE_TITLE."\" /><br /><p align=\"right\">";
188       if (!
authentified())
189          
$CONTENT .= $MDP." : <input type=\"password\" name=\"sc\" />";
190       
$CONTENT .= " <input type=\"submit\" value=\"$DONE_BUTTON\" accesskey=\"s\" /></p></div></form>";
191    }
192    elseif (
$action != "history" && $action != "diff")
193       
$html preg_replace('/{HISTORY}/'""$html);
194
195    
// Liste des versions historiques d'une page
196    
if ($action == "history" && !isset($gtime))
197    {
198       
$html preg_replace('/{HISTORY}/'"/ ".$HISTORY_BUTTON$html);
199       
$complete_dir $BACKUP_DIR $_GET["page"] . "/";
200       if (
$opening_dir = @opendir($complete_dir))
201       {
202          while (
false !== ($filename = @readdir($opening_dir)))
203             
$files[] = $filename;
204          
rsort ($files);
205          
$affichage .= "<form method=\"GET\" action=\"./\">\n<input type=hidden name=action value=diff><input type=hidden name=page value=\"".$_GET['page']."\">";
206          for (
$cptfiles 0$cptfiles sizeof($files)-2$cptfiles++)
207          {
208             
// for diff
209             
$affichage .= "<input type=radio name=f1 value=$files[$cptfiles]><input type=radio name=f2 value=$files[$cptfiles] />";
210             
$affichage $affichage."<a href=\"?page=".$_GET["page"]."&amp;action=history&amp;time=".$files[$cptfiles]."\">".$files[$cptfiles]."</a><br />";
211          }
212          
$affichage .= "<input type=submit value=diff></form>";
213          
$html preg_replace('/{CONTENT}/'$affichage$html);
214       }
215       else
216          
$html preg_replace('/{CONTENT}/'$NO_HISTORY$html);
217    }
218
219    
// Affichage d'un fichier historique
220    
if ($action == "history" && isset($gtime))
221    {
222       
$complete_dir $BACKUP_DIR $PAGE_TITLE "/";
223       if (
$file = @fopen($BACKUP_DIR $PAGE_TITLE "/" $gtime"r"))
224       {
225          
$html preg_replace('/{HISTORY}/'"/ <a href=\"?page=".$PAGE_TITLE."&amp;action=history\">".$HISTORY_BUTTON."</a> (<a href=\"?page=".$PAGE_TITLE."&amp;action=edit&amp;time=".$gtime."&amp;restore=1\">".$RESTORE."</a>)"$html);
226          
$CONTENT = @fread($file, @filesize($complete_dir $gtime)) . "\n";
227       }
228       else
229          
$html preg_replace('/{HISTORY}/'"/ <a href=\"?page=".$PAGE_TITLE."&amp;action=history\">".$HISTORY_BUTTON."</a> (-)"$html);
230    }
231
232    
// affichage/gestion des fichiers uploadés
233    
if ($action == "upload")
234    {
235       if (
is_dir($DATA_DIR))
236       {
237          
// Set current dir
238          
if (isset($_REQUEST['current']))
239             
$current cleanInput($_REQUEST['current']); // POST ou GET
240          
if (!preg_match('/^'.trim($DATA_DIR,"/").'/',$current))
241             
$current trim($DATA_DIR,"/"); // on considere que $DATA_DIR est clean
242          
$affichage .= "Entrez eventuellement votre mot de passe.<br/>Choississez le fichier &agrave; uploader en cliquant sur <i>Parcourir</i> ou le r&eacute;pertoire &agrave; cr&eacute;er. Cliquez sur <i>Envoyer</i><br/>Si vous &ecirc;tes identifi&eacute;, vous pouvez effacer un fichier en cliquant sur &dagger;<hr/>";
243          
// Copie du fichier
244          
if (authentified())
245          {  
// password is ok
246             // Upload de fichier
247             
if (!empty($_FILES['fichier']['tmp_name']))
248             { 
//Un fichier a ete envoye, nous pouvons le traiter
249                
if(is_uploaded_file($_FILES['fichier']['tmp_name']))
250                {
251                   @
move_uploaded_file($_FILES['fichier']['tmp_name'],$current."/".$_FILES['fichier']['name']);
252                }
253             }
254             
// Creation de repertoire
255             
$repertoire cleanInput($_POST["repertoire"]);
256             if (
$repertoire != "")
257             {
258                @
mkdir($current."/".$repertoire);
259             }
260             
// Effacement de fichier/repertoire
261             
if (isset($_GET['del']))
262             { 
// Fichier à effacer
263                
$dir cleanInput($_GET['del']);
264                if (
is_dir($dir))
265                   @
rmdir($dir);
266                else
267                   @
unlink($dir);
268             }
269          }
270          elseif (
$_SERVER["REQUEST_METHOD"] == "POST")
271          { 
// pas authentifié, mais clique sur envoyer --> mauvais password
272             
header("location: ./?action=".$action."&error=1");
273          }
274
275          
// liste des fichiers
276          
if ($opening_dir = @opendir($current))
277          {
278             
$affichage .= "<h3>".$current."</h3>";
279
280             while (
false !== ($filename = @readdir($opening_dir)))
281                if ((
$filename != '.') and !($filename=='..' and $current==trim($DATA_DIR,"/")))
282                   
$files[] = $filename;
283             if (
$files)
284                
sort ($files);
285             for (
$cptfiles 0$files[$cptfiles] != ''$cptfiles++)
286             {
287                if (
$files[$cptfiles] == "..")
288                   
$path substr($current,0,strrpos($current,'/'));
289                else
290                   
$path $current."/".$files[$cptfiles];
291                if (
is_dir($path))
292                { 
// repertoire
293                   
$affichage $affichage.'<a href="./?action='.$action."&current=".urlencode($path).'">'.$files[$cptfiles].'/</a>';
294                }
295                else
296                {
297                   
$affichage $affichage.'<a href="'.$path.'">'.$files[$cptfiles].'</a>';
298                }
299                if ((
authentified()) and ($files[$cptfiles] != ".."))
300                   
// autendified donc peut effacer
301                   
$affichage .= ' (</font><a title="delete" href="./?action=upload&del='.urlencode($path)."&current=".urlencode($current).'">&dagger;</a>)';
302                
$affichage .= '<br />';
303             }
304          }
305          
// formulaire d'upload
306          
$affichage .= "<br/><form method=\"post\" action=\"./?action=".$action."\" enctype= \"multipart/form-data\"><p align=\"right\">";
307          if (!
authentified())
308             
$affichage .= $MDP." : <input type=\"password\" name=\"sc\" /> <br />";
309          
$affichage .= '<input type="hidden" name="current" value="'.$current.'" /> <br/>';
310          
$affichage .= $FILE.' : <input type="file" name="fichier" /> <br/>';
311          
$affichage .= $DIR.' : <input type="text" name="repertoire" /> <br/>';
312          
$affichage .= " <input type=\"submit\" value=\"$SEND_BUTTON\" accesskey=\"s\" /></p></div></form>";
313       }
314       else
315          
$affichage $NO_DATA// page désactivée
316       
$html preg_replace('/{CONTENT}/'$affichage$html);
317    } 
// Upload
318
319
320    // diff très simple entre deux pages
321    
if ($action == "diff" && isset($_GET['f1']))
322    {
323       function 
pcolor($color,$txt)
324          {return 
"<font color=$color>$txt</font><br/>";}
325       
$html preg_replace('/{HISTORY}/'"/ <a href=\"?page=".$PAGE_TITLE."&amp;action=history\">".$HISTORY_BUTTON."</a>"$html);
326       if (!
strpos($_GET['f1'],'/'))
327          
$fn1 $BACKUP_DIR $_GET["page"] . "/" $_GET["f1"];
328       if (!
strpos($_GET['f2'],'/'))
329          
$fn2 $BACKUP_DIR $_GET["page"] . "/" $_GET["f2"];
330       if (
$fn2 $fn1) {$tmp=$fn1;$fn1=$fn2;$fn2=$tmp;}
331       
$a1 explode("\n",@fread(@fopen($fn1,"r"),@filesize($fn1)));
332       
$a2 explode("\n",@fread(@fopen($fn2,"r"),@filesize($fn2)));
333       
// fclose ?
334       
$d1 array_diff($a1,$a2);
335       
$d2 array_diff($a2,$a1);
336       for (
$i=0;$i<=max(sizeof($a2),sizeof($a1));$i++)
337       {
338          if (
array_key_exists($i,$d1))
339             
$affichage .= pcolor("red",$d1[$i]);
340          if (
array_key_exists($i,$d2))
341             
$affichage .= pcolor("green",$d2[$i]);
342          if (!(
array_key_exists($i,$d1) && array_key_exists($i,$d2)) && $d2[$i] != $a2[$i])
343             
$affichage .= pcolor ("black",$a2[$i]);
344       }
345       
$html preg_replace('/{CONTENT}/'$affichage$html);
346    }
347    elseif (
$action == "diff")
348    { 
// diff auto entre les 2 dernières versions
349       
$complete_dir $BACKUP_DIR $_GET["page"] . "/";
350       if (
$opening_dir = @opendir($complete_dir))
351       {
352          while (
false !== ($filename = @readdir($opening_dir)))
353             
$files[] = $filename;
354          
rsort ($files);
355          
header("location: ./?page=" urlencode($_GET[page]) ."&action=".$action."&f1=".$files[0]."&f2=".$files[1]);
356       }   
357    }
358
359    
// Erreur du mot de passe
360    
if ($_GET['error'] == 1)
361       
$html preg_replace('/{ERROR}/'$ERROR$html);
362    else
363       
$html preg_replace('/{ERROR}/'""$html);
364
365    
// Page de recherche
366    
if ($action == "search")
367    {
368       
$dir opendir(getcwd() . "/$PAGES_DIR");
369       while (
$file readdir($dir))
370       {
371          if (
preg_match("/.txt/"$file))
372          {
373             
$handle fopen($PAGES_DIR $file"r");
374             @
$content fread($handlefilesize($PAGES_DIR $file));
375             
fclose($handle);
376             if (
preg_match("/$_GET[query]/i"$content) || preg_match("/$_GET[query]/i""$PAGES_DIR/$file"))
377             {
378                
$file substr($file0strlen($file) - 4);
379                
$CONTENT .= "<a href=\"./?page=$file\">$file</a><br />";
380             }
381          }
382       }
383    }
384
385    
// Changements r�cents
386    
elseif ($action == "recent")
387    {
388       
$dir opendir(getcwd() . "/$PAGES_DIR");
389       while (
$file readdir($dir))
390          if (
preg_match("/.txt/"$file))
391             
$filetime[$file] = filemtime($PAGES_DIR $file);
392       
arsort($filetime);
393       
$filetime array_slice($filetime010);
394       foreach (
$filetime as $filename => $timestamp)
395       {
396          
$filename substr($filename0strlen($filename) - 4);
397          
$CONTENT .= "<a href=\"./?page=$filename\">$filename</a> (" strftime("$TIME_FORMAT"$timestamp $LOCAL_HOUR 3600) . " - <a href=\"./?page=$filename&amp;action=diff\">diff</a>".")<br />";
398       }
399    }
400
401    
// Formatage de page
402    
elseif ($action <> "edit")
403    {
404
405       if (
preg_match("/%html%\s/"$CONTENT))
406
407          
$CONTENT preg_replace("/%html%\s/"""$CONTENT);
408       else
409       {
410          
$CONTENT htmlentities($CONTENT);
411          
$CONTENT preg_replace("/&amp;#036;/Umsi""&#036;"$CONTENT);
412          
$CONTENT preg_replace("/&amp;#092;/Umsi""&#092;"$CONTENT);
413          
// JJL fleches (c) (r)
414          
$CONTENT preg_replace("/&lt;\-\-&gt;/Umsi""&harr;"$CONTENT);
415          
$CONTENT preg_replace("/-\-&gt;/Umsi""&rarr;"$CONTENT);
416          
$CONTENT preg_replace("/&lt;\--/Umsi""&larr;"$CONTENT);
417          
$CONTENT preg_replace("/\([cC]\)/Umsi""&copy;"$CONTENT);
418          
$CONTENT preg_replace("/\([rR]\)/Umsi""&reg;"$CONTENT);
419          
420          
$CONTENT preg_replace("/\^(.)/Umsie""'&#'.ord('\\1').';'"$CONTENT);
421          
$CONTENT preg_replace('#\[(.+)\|([0-9a-zA-Z\.\'\s\#/~\-_%=\?\&amp;,\+]*)\]#U''<a href="$2" class="url">$1</a>'$CONTENT);
422          
$CONTENT preg_replace('#\[(.+)\|h(ttps?://[0-9a-zA-Z\.\#/~\-_%=\?\&amp;,\+]*)\]#U''<a href="xx$2" class="url">$1</a>'$CONTENT);
423          
$CONTENT preg_replace('#\[h(ttps?://[0-9a-zA-Z\.\&amp;\#\:/~\-_%=?]*\.(jpg|gif|png))\]#i''<img src="xx$1" />'$CONTENT);
424          
$CONTENT preg_replace('#\[([0-9a-zA-Z\.\&amp;\#\:/~\-_%=?]*\.(jpg|gif|png))\]#i''<img src="$1" />'$CONTENT);
425          
$CONTENT preg_replace('#(https?://[0-9a-zA-Z\.\&amp;\#\:/~\-_%=?]*)#i''<a href="$0" class="url">$1</a>'$CONTENT);
426          
$CONTENT preg_replace('#xxttp#''http'$CONTENT);
427          
preg_match_all("/\[([^\/]+)\]/U"$CONTENT$matchesPREG_PATTERN_ORDER); //Pour bloquer les liens accentu�s : "/\[([0-9a-zA-Z\- :\.,\(\)\']+)\]/U"
428          
foreach ($matches[1] as $match)
429             if (
file_exists(html_entity_decode($PAGES_DIR."$match.txt")))
430                
$CONTENT str_replace("[$match]""<a href=\"./?page=".$match."\">$match</a>"$CONTENT);
431             else
432                
$CONTENT str_replace("[$match]""<a class=\"pending\" href=\"./?page=".$match."\">$match</a>"$CONTENT);
433          
$CONTENT preg_replace('#(\[\?(.+)\]*)#i''<a href="http://fr.wikipedia.org/wiki/$0" class="url">$0</a>'$CONTENT);
434          
$CONTENT preg_replace('#([0-9a-zA-Z\./~\-_]+@[0-9a-z\./~\-_]+)#i''<a href="mailto:$0">$0</a>'$CONTENT);
435          
$CONTENT preg_replace('/^\*\*\*(.*)(\n)/Um'"<ul><ul><ul><li>$1</li></ul></ul></ul>$2"$CONTENT);
436          
$CONTENT preg_replace('/^\*\*(.*)(\n)/Um'"<ul><ul><li>$1</li></ul></ul>$2"$CONTENT);
437          
$CONTENT preg_replace('/^\*(.*)(\n)/Um'"<ul><li>$1</li></ul>$2"$CONTENT);
438          
$CONTENT preg_replace('/^\#\#\#(.*)(\n)/Um'"<ol><ol><ol><li>$1</li></ol></ol></ol>$2"$CONTENT);
439          
$CONTENT preg_replace('/^\#\#(.*)(\n)/Um'"<ol><ol><li>$1</li></ol></ol>$2"$CONTENT);
440          
$CONTENT preg_replace('/^\#(.*)(\n)/Um'"<ol><li>$1</li></ol>$2"$CONTENT);
441
442          
$CONTENT preg_replace('/(<\/ol>\n*<ol>|<\/ul>\n*<ul>)/'""$CONTENT);
443          
$CONTENT preg_replace('/(<\/ol>\n*<ol>|<\/ul>\n*<ul>)/'""$CONTENT);
444          
$CONTENT preg_replace('/(<\/ol>\n*<ol>|<\/ul>\n*<ul>)/'""$CONTENT);
445
446
447          
$CONTENT preg_replace('/^!!!(.*)(\n)/Um''<h1>$1</h1>$2'$CONTENT);
448          
$CONTENT preg_replace('/^!!(.*)(\n)/Um''<h2>$1</h2>$2'$CONTENT);
449          
$CONTENT preg_replace('/^!(.*)(\n)/Um''<h3>$1</h3>$2'$CONTENT);
450          while (
preg_match('/^  /Um'$CONTENT))
451             
$CONTENT preg_replace('/^( +) ([^ ])/Um''$1&nbsp;&nbsp;&nbsp;&nbsp;$2'$CONTENT);
452          
$CONTENT preg_replace('/^ /Um''&nbsp;&nbsp;&nbsp;&nbsp;'$CONTENT);
453          
$CONTENT preg_replace('/----*(\r\n|\r|\n)/m''<hr />'$CONTENT);
454          
$CONTENT preg_replace('/\n/''<br />'$CONTENT);
455          
$CONTENT preg_replace('#</ul>(<br />)*#'"</ul>"$CONTENT);
456          
$CONTENT preg_replace('#</ol>(<br />)*#'"</ol>"$CONTENT);
457
458          
$CONTENT preg_replace('#</li><ul><li>*#'"<ul><li>"$CONTENT);
459          
$CONTENT preg_replace('#</ul></ul>*#'"</ul></li></ul>"$CONTENT);
460          
$CONTENT preg_replace('#</ul></ul>*#'"</ul></li></ul>"$CONTENT);
461          
$CONTENT preg_replace('#</li></ul><li>*#'"</li></ul></li><li>"$CONTENT);
462
463          
$CONTENT preg_replace('#</li><ol><li>*#'"<ol><li>"$CONTENT);
464          
$CONTENT preg_replace('#</ol></ol>*#'"</ol></li></ol>"$CONTENT);
465          
$CONTENT preg_replace('#</ol></ol>*#'"</ol></li></ol>"$CONTENT);
466          
$CONTENT preg_replace('#</li></ol><li>*#'"</li></ol></li><li>"$CONTENT);
467
468          
$CONTENT preg_replace('#(</h[123]>)<br />#'"$1"$CONTENT);
469          
$CONTENT preg_replace("/{(.+)}/Ue""'<pre><code>' . preg_replace('#<br />#', '', '\\1') . '</code></pre>'"$CONTENT);
470          
$CONTENT preg_replace("/'''''(.*)'''''/Um"'<strong><em>$1</em></strong>'$CONTENT);
471          
$CONTENT preg_replace("/'''(.*)'''/Um"'<strong>$1</strong>'$CONTENT);
472          
$CONTENT preg_replace("/''(.*)''/Um"'<em>$1</em>'$CONTENT);
473          
// JJL chaine barree/soulign�e
474          
$CONTENT preg_replace("/'--(.*)--'/Um"'<strike>$1</strike>'$CONTENT);
475          
$CONTENT preg_replace("/'__(.*)__'/Um"'<u>$1</u>'$CONTENT);
476          
$CONTENT substr($CONTENT6strlen($CONTENT) - 6);
477          
$CONTENT html_entity_decode($CONTENT);
478       }
479    }
480    if (
$action != "" && $action != "edit" || (!file_exists($PAGES_DIR $PAGE_TITLE ".txt")))
481       
$TIME "-";
482    
$html preg_replace("/{CONTENT}/"$CONTENT$html);
483    
$html preg_replace("/{LANG}/"$LANG$html);
484    
$html preg_replace("/{WIKI_VERSION}/"$WIKI_VERSION$html);
485    
$html preg_replace("/{CHARSET}/"$CHARSET$html);
486    
$html preg_replace('/{TIME}/'$TIME$html);
487    
$html preg_replace('/{DATE}/'$datetw$html);
488    
$html preg_replace('/{IP}/'$_SERVER['REMOTE_ADDR'], $html);
489    if (
$_COOKIE['AutorisationTigerWiki'] != "")
490       
$html preg_replace('/{COOKIE}/''-- <a href="./?page='.$PAGE_TITLE.'&erasecookie=1">'.$ERASE_COOKIE.'</a>'$html);
491    else
492       
$html preg_replace('/{COOKIE}/'''$html);
493
494    
// Affichage de la page
495    
echo $html;
496
497
?>
498

499