Retour [./index.php]
show/hide
0
1 <!--
2 Afficheur de source initialement développé par eomsys
3    http://eomys.free.fr/wikidev/
4 Modifié par JJL
5    http://kubuntu.free.fr/TigerWiki/
6 -->
7  
8  
9 <html>
10 <head>
11 <style>
12 span { background: #eee; border: #ddd solid 1px; color: #000; white-space: pre; font-family: monospace; visibility:'visible'; }
13 body {white-space:nowrap;}
14 </style>
15 <script language="JavaScript">
16     function toggleVisibility(tag)
17    {
18       list = document.getElementsByTagName(tag);
19       for (var i=0;i<list.length;i++)
20       {
21          if (list[i].style.visibility == 'visible')
22             list[i].style.visibility = 'hidden';
23          else
24             list[i].style.visibility = 'visible';
25       }
26     }
27 </script>
28 </head>
29
30 <body onLoad="toggleVisibility('span')">
31 <?php
32     
function html($s) { return htmlentities($sENT_COMPAT"UTF-8"); }
33     function 
listdir($dir) {
34         
$d dir($dir);
35         echo(
"<ul>");
36         while (
$e $d->read()) 
37             if (
substr($e01) != '.') {
38                 if (
is_dir("$dir/$e")) {
39                     echo(
"<li><b>[" html($e) . "]</b></li>");
40                     
listdir("$dir/$e");
41                 } else
42                     echo(
"<li><a href=\"".$_SERVER['SCRIPT_NAME']."?file=" urlencode("$dir/$e") . "\">" html($e) . "</a></li>");
43             }
44         echo(
"</ul>");
45     }
46     
47     if (
$_GET['file'] && !preg_match('/(\.\.|^\/|\/\/)/'$_GET['file'])) {
48         echo(
"<a href=\"".$_SERVER['SCRIPT_NAME']."\">Retour</a> <b>[" html($_GET['file']) . "]</b><hr>\n");
49       echo(
"<a href=# onClick=\"toggleVisibility('span')\">show/hide</a> ");
50         
$l 0;
51         print(
preg_replace("#<br />|^#me"'sprintf("<br/><span>%6d </span> ", $l++)'highlight_string(file_get_contents($_GET['file']),TRUE)));
52       
//~ echo highlight_string(file_get_contents($_GET['file']),TRUE);
53     
} else {
54         echo(
"<a href=\".\">Retour</a> <b>[.]</b><hr>");
55         
listdir('.');
56     }
57
?>
58
</body>
59 </html>

60