cvs: phpweb / error.php /reST index.php

From: Date: Tue, 20 Nov 2007 22:10:00 +0000
Subject: cvs: phpweb / error.php /reST index.php
Groups: php.webmaster 
Request: Send a blank email to php-webmaster+get-527@lists.php.net to get a copy of this message
bjori Tue Nov 20 22:10:00 2007 UTC Added files: /phpweb/reST index.php Modified files: /phpweb error.php Log: Add reST renderer for selected files in CVS (by Lukas Smith) http://cvs.php.net/viewvc.cgi/phpweb/error.php?r1=1.74&r2=1.75&diff_format=u Index: phpweb/error.php diff -u phpweb/error.php:1.74 phpweb/error.php:1.75 --- phpweb/error.php:1.74 Sun Oct 14 15:01:49 2007 +++ phpweb/error.php Tue Nov 20 22:10:00 2007 @@ -1,6 +1,6 @@ <?php -// $Id: error.php,v 1.74 2007/10/14 15:01:49 bjori Exp $ +// $Id: error.php,v 1.75 2007/11/20 22:10:00 bjori Exp $ /* @@ -162,6 +162,13 @@ exit; } +// The rest rendering +if (strpos($URI, "reST/") === 0) { + $_GET["rel_path"] = substr($URI, 5); + include $_SERVER['DOCUMENT_ROOT'] ."/reST/index.php"; + exit; +} + // Work with lowercased URI from now $URI = strtolower($URI); http://cvs.php.net/viewvc.cgi/phpweb/reST/index.php?view=markup&rev=1.1 Index: phpweb/reST/index.php +++ phpweb/reST/index.php <?php // $Id: index.php,v 1.1 2007/11/20 22:10:00 bjori Exp $ $_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"), ""); $SIDEBAR_DATA = '<h3>File list</h3> <ul class="simple">'; $restfiles = glob($rest_dir. "/*"); $list = ""; foreach($restfiles as $filename) { $link = basename($filename, ".rest"); $text = substr($link, strpos($link, "_")+1); // Remove the fs dirname $link[strpos($link, "_")] = "/"; // Replace the first - with a directory seperator $list .= '<li><a href="/reST/' .$link.'">'.$text.'</a></li>'; } if ($list) { $SIDEBAR_DATA .= $list; } 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();

« previous php.webmaster (#527) next »