cvs: phpweb /error index.php
| From: | Gabor Hojtsy | Date: | Wed, 14 Aug 2002 09:40:20 +0000 |
| Subject: | cvs: phpweb /error index.php | ||
| Groups: | php.mirrors | ||
| Request: | Send a blank email to php-mirrors+get-11955@lists.php.net to get a copy of this message | ||
goba Wed Aug 14 05:40:20 2002 EDT
Modified files:
/phpweb/error index.php
Log:
IMHO, it's more correct to only return a 200 if we really found
that page. Otherwise, it will go forward in the search process...
Index: phpweb/error/index.php
diff -u phpweb/error/index.php:1.78 phpweb/error/index.php:1.79
--- phpweb/error/index.php:1.78 Wed Aug 14 05:32:04 2002
+++ phpweb/error/index.php Wed Aug 14 05:40:20 2002
@@ -81,8 +81,9 @@
// and not redirected, as this way all relative URL's will retain their meaning
// and point to pages relative to the print dir (which is nonexistent)
// We need to override the 404 status in that case.
-header('HTTP/1.1 200 OK');
-if (preg_match("!^manual/(\\w+)/(print|printwn)/(.+\\.php)$!", $uri, $parts)) {
+if (preg_match("!^manual/(\\w+)/(print|printwn)/(.+\\.php)$!", $uri, $parts) &&
+ @file_exists("../manual/$parts[1]/$parts[3]")) {
+ header('HTTP/1.1 200 OK');
$PRINT_PAGE = TRUE;
if ($parts[2] == "printwn") { $PRINT_NOTES = TRUE; }
include "../manual/$parts[1]/$parts[3]";
@@ -90,14 +91,18 @@
}
// BC: for old HTML directory (.html extension was used in that)
-elseif (preg_match("!^manual/(\\w+)/html/(.+)\\.(html|php)$!", $uri, $parts)) {
+elseif (preg_match("!^manual/(\\w+)/html/(.+)\\.(html|php)$!", $uri, $parts) &&
+ @file_exists("../manual/$parts[1]/$parts[2].php")) {
+ header('HTTP/1.1 200 OK');
$PRINT_PAGE = TRUE;
include "../manual/$parts[1]/$parts[2].php";
exit;
}
// The index file needs to be handled in a special way
-elseif (preg_match("!^manual/(\\w+)/(print|printwn|html)(/)?$!", $uri, $parts)) {
+elseif (preg_match("!^manual/(\\w+)/(print|printwn|html)(/)?$!", $uri, $parts) &&
+ @file_exists("../manual/$parts[1]/index.php")) {
+ header('HTTP/1.1 200 OK');
$PRINT_PAGE = TRUE;
if ($parts[2] == "printwn") { $PRINT_NOTES = TRUE; }
include "../manual/$parts[1]/index.php";