1
0
mirror of https://github.com/php/web-php.git synced 2026-03-24 07:12:16 +01:00
Files
archived-web-php/reST/index.php

61 lines
1.6 KiB
PHP

<?php
// $Id$
$_SERVER['BASE_PAGE'] = 'reST/index.php';
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/prepend.inc';
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
// Pregenerated (on master) cache
$rest_dir = $_SERVER['DOCUMENT_ROOT'].'/reST/cache/';
$path = isset($_GET['rel_path']) ? $_GET['rel_path'] : "";
// Set "this pages ID" (for the notes system)
$PGI["this"] = array("reST/" . ($path ? $path : "index.php"), "");
$_SERVER['BASE_HREF'] = $MYSITE . $_SERVER['BASE_PAGE'];
$SIDEBAR_DATA = '<h3>File list</h3>
<ul class="simple" id="reSTlist">';
$restfiles = glob($rest_dir. "/*");
//$list = $lastdir = "";
$list = "";
foreach($restfiles as $filename) {
$link = basename($filename, ".rest");
$filename = basename($link);
// Only use the "last part" of the filename (i.e. README.FOOBAR => FOOBAR)
if (strpos($filename, ".") !== false) {
$filename = substr($filename, strpos($filename, ".")+1);
}
$filename = str_replace(array("-", "_"), " ", $filename);
$list .= '<li><a href="/reST/' .$link.'">'.$filename.'</a></li>'."\n";
}
if ($list) {
$SIDEBAR_DATA .= "$list</ul>";
} else {
$SIDEBAR_DATA .= "<li>No files available</li>";
}
$SIDEBAR_DATA .= "</ul>";
$filename = $rest_dir. "/" .str_replace('/', '_', $path).'.rest';
if (($k = array_search($filename, $restfiles)) === false) {
site_header("reST");
if($path) {
echo '<p class="warn">Unknown file</p>';
}
echo "<p>Please select a file from the filelist on the left</p>";
} else {
site_header(basename($path));
include $restfiles[$k];
manual_notes();
}
site_footer();