cvs: php-bugs-web / source.php

From: Date: Sun, 27 May 2007 01:18:05 +0000
Subject: cvs: php-bugs-web / source.php
Groups: php.mirrors 
Request: Send a blank email to php-mirrors+get-35506@lists.php.net to get a copy of this message
sniper Sun May 27 01:18:05 2007 UTC Modified files: /php-bugs-web source.php Log: cleanup http://cvs.php.net/viewvc.cgi/php-bugs-web/source.php?r1=1.6&r2=1.7&diff_format=u Index: php-bugs-web/source.php diff -u php-bugs-web/source.php:1.6 php-bugs-web/source.php:1.7 --- php-bugs-web/source.php:1.6 Sun Feb 11 07:23:28 2007 +++ php-bugs-web/source.php Sun May 27 01:18:05 2007 @@ -1,53 +1,49 @@ <?php + require_once 'prepend.inc'; commonHeader('Show Source'); -if (!isset($url)) { - echo "No page URL specified."; +if (!isset($_GET['url'])) { + echo 'No page URL specified.'; commonFooter(); exit; } -?> -Source of: <? echo htmlspecialchars($url, ENT_QUOTES); ?><BR> +$out_url = htmlspecialchars($_GET['url'], ENT_QUOTES); +echo "Source of: $out_url<br />\n", hdelim(); -<? - -echo hdelim(); - -$legal_dirs = array( - "/manual" => 1, - "/include" => 1, - "/stats" => 1); - -$dir = dirname($url); -if ($dir && $legal_dirs[$dir]) { - $page_name = $DOCUMENT_ROOT . htmlspecialchars($url, ENT_QUOTES); +$legal_dirs = array ( + 'manual' => 1, + 'include' => 1, + 'stats' => 1, +); +$dir = dirname($_GET['url']); +$basedir = dirname(__FILE__); +if ($dir && isset($legal_dirs[$dir])) { + $page_name = "$basedir/$out_url"; } else { - $page_name = basename(htmlspecialchars($url, ENT_QUOTES)); + $page_name = basename($out_url); } echo("<!-- $page_name -->\n"); if (file_exists($page_name) && !is_dir($page_name)) { - show_source($page_name); + show_source($page_name); } else if (is_dir($page_name)) { - echo "<P>No file specified. Can't show source for a directory.</P>\n"; + echo "<p>No file specified. Can't show source for a directory.</p>\n"; } echo hdelim(); ?> -<P> -The syntax highlighted source is automatically generated by PHP from the plaintext script.<br> -If you're interested in what's behind the <B>commonHeader()</B> and <B>commonFooter()</B> functions, +<p> +The syntax highlighted source is automatically generated by PHP from the plaintext script.<br /> +If you're interested in what's behind the <b>commonHeader()</b> and <b>commonFooter()</b> functions, you can always take a look at the source of the -<? print_link("/source.php?url=/include/layout.inc", "layout.inc"); ?> files. -And, of course, if you want to see the source of this page, have a look -<? print_link("/source.php?url=/source.php", "here"); ?>. -</P> -<? +<?php print_link('source.php?url=include/layout.inc', 'layout.inc'); ?> files. +And, of course, if you want to see the source of this page, have a look +<?php print_link('source.php?url=source.php', 'here'); ?>. +</p> +<?php commonFooter(); -?> -

« previous php.mirrors (#35506) next »