diff options
| author | David Aspinall | 2002-07-18 22:10:25 +0000 |
|---|---|---|
| committer | David Aspinall | 2002-07-18 22:10:25 +0000 |
| commit | 5c7722f8abcc683ec0ad06b12b0b2e03a0439495 (patch) | |
| tree | 5dd54cae93ae5f7cbad7efb411a0d12d54225ebb /html | |
| parent | d97ad726b1e0868783c2de2cb9f15d2d19b5bbdd (diff) | |
Move fileshow code into lib
Diffstat (limited to 'html')
| -rw-r--r-- | html/fileshow.php | 18 | ||||
| -rw-r--r-- | html/functions.php3 | 19 |
2 files changed, 20 insertions, 17 deletions
diff --git a/html/fileshow.php b/html/fileshow.php index 09747fda..ded131d6 100644 --- a/html/fileshow.php +++ b/html/fileshow.php @@ -4,21 +4,5 @@ $filename=$HTTP_GET_VARS["file"]; $title=$HTTP_GET_VARS["title"]; $expanded=$HTTP_GET_VARS["expanded"]; - if ($title=="") { $title = $filename; }; - small_header($title); - print "<pre>\n"; - /* I hope this is enough to prevent access outside cwd */ - if (substr($filename,0,1)=="." or - substr($filename,0,1)=="/" or - substr($filename,0,1)=="~") { - print "Sorry, can't show you that file!\n"; - } elseif (substr($filename,-3)==".el") { - elisp_markup($filename,"fileshow.php"); - } else { - outline_markup($filename,"fileshow.php",$expanded); - } - print "</pre>\n"; - print "<hr>"; - click_to_go_back(); - footer(); + fileshowmarkup($file,$title,$expanded); ?> diff --git a/html/functions.php3 b/html/functions.php3 index bf15be94..1a3a1457 100644 --- a/html/functions.php3 +++ b/html/functions.php3 @@ -187,6 +187,25 @@ function fileshow($filename,$text="",$title="") { $text, $message); } +function fileshowmarkup($filename,$title="",$expanded="") { + if ($title=="") { $title = $filename; }; + small_header($title); + print "<pre>\n"; + /* I hope this is enough to prevent access outside cwd */ + if (substr($filename,0,1)=="." or + substr($filename,0,1)=="/" or + substr($filename,0,1)=="~") { + print "Sorry, can't show you that file!\n"; + } elseif (substr($filename,-3)==".el") { + elisp_markup($filename,"fileshow.php"); + } else { + outline_markup($filename,"fileshow.php",$expanded); + } + print "</pre>\n"; + print "<hr>"; + click_to_go_back(); + footer(); +} /* Similar for html file (NB: could pick automatically) */ |
