cvs: phpweb /error index.php

From: Date: Tue, 07 Jan 2003 21:35:19 +0000
Subject: cvs: phpweb /error index.php
Groups: php.mirrors 
Request: Send a blank email to php-mirrors+get-14828@lists.php.net to get a copy of this message
goba Tue Jan 7 16:35:19 2003 EDT Modified files: /phpweb/error index.php Log: Let's be consistent with port numbers. We only support port 80 at the 90% of redirects, so let's support only port 80 in 100%. I am going to simplify those redirects, so please hold on ;) Simplify some BC redirects, do not print a HTML page anymore, as all common browsers and tools handle redirects... Use absolute path in file_exists() checks, and includes, as all other places use that (for consistency). Index: phpweb/error/index.php diff -u phpweb/error/index.php:1.93 phpweb/error/index.php:1.94 --- phpweb/error/index.php:1.93 Fri Jan 3 09:19:46 2003 +++ phpweb/error/index.php Tue Jan 7 16:35:19 2003 @@ -23,24 +23,14 @@ // ============================================================================ // Check for a manual in the mirror's default language $lang = default_language(); -if (!@is_dir("$DOCUMENT_ROOT/manual/$lang")) { +if (!@is_dir("$DOCUMENT_ROOT/manual/$lang/index.php")) { $lang = "en"; // fall back to English } // ============================================================================ // BC: handle .php3 files that were renamed to .php if (preg_match("/(.*\.php)3$/", $REQUEST_URI, $array)) { - if($SERVER_PORT!=80) { - $url = "http://".$SERVER_NAME.":".$SERVER_PORT.$array[1]; - } else { - $url = "http://".$SERVER_NAME.$array[1]; - } - $urle = htmlspecialchars($url); - - header("Location: $url"); - - print "<html><title>Redirect to $urle</title><body>"; - print "<a href=\"".$url."\">Please click here</a></body></html>"; + header("Location: http://$SERVER_NAME$array[1]"); exit; } @@ -48,17 +38,7 @@ // BC: handle moving english manual down into its own directory (also supports // default language manual accessibilty on mirror sites through /manual/filename) if (eregi("^(.*)/manual/((html/)?[^/]+)$", $REQUEST_URI, $array)) { - if ($SERVER_PORT != 80) { - $url = "http://".$SERVER_NAME.":".$SERVER_PORT."$array[1]/manual/$lang/".$array[2]; - } else { - $url = "http://".$SERVER_NAME."$array[1]/manual/$lang/".$array[2]; - } - $urle = htmlspecialchars($url); - - header("Location: $url"); - - print "<html><title>Redirect to $url</title><body>"; - print "<a href=\"".$url."\">Please click here</a></body></html>"; + header("Location: http://$SERVER_NAME$array[1]/manual/$lang/$array[2]"); exit; } @@ -79,30 +59,30 @@ // and point to pages relative to the print dir (which is nonexistent) // We need to override the 404 status in that case. if (preg_match("!^manual/(\\w+)/(print|printwn)/(.+\\.php)$!", $uri, $parts) && - @file_exists("../manual/$parts[1]/$parts[3]")) { + @file_exists("$DOCUMENT_ROOT/manual/$parts[1]/$parts[3]")) { header('Status: 200 OK'); $PRINT_PAGE = TRUE; if ($parts[2] == "printwn") { $PRINT_NOTES = TRUE; } - include "../manual/$parts[1]/$parts[3]"; + include "$DOCUMENT_ROOT/manual/$parts[1]/$parts[3]"; exit; } // BC: for old HTML directory (.html extension was used in that) elseif (preg_match("!^manual/(\\w+)/html/(.+)\\.(html|php)$!", $uri, $parts) && - @file_exists("../manual/$parts[1]/$parts[2].php")) { + @file_exists("$DOCUMENT_ROOT/manual/$parts[1]/$parts[2].php")) { header('Status: 200 OK'); $PRINT_PAGE = TRUE; - include "../manual/$parts[1]/$parts[2].php"; + include "$DOCUMENT_ROOT/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) && - @file_exists("../manual/$parts[1]/index.php")) { + @file_exists("$DOCUMENT_ROOT/manual/$parts[1]/index.php")) { header('Status: 200 OK'); $PRINT_PAGE = TRUE; if ($parts[2] == "printwn") { $PRINT_NOTES = TRUE; } - include "../manual/$parts[1]/index.php"; + include "$DOCUMENT_ROOT/manual/$parts[1]/index.php"; exit; }

« previous php.mirrors (#14828) next »