cvs: phpweb /error index.php

From: Date: Fri, 12 Jan 2001 20:59:57 +0000
Subject: cvs: phpweb /error index.php
Groups: php.mirrors 
Request: Send a blank email to php-mirrors+get-3373@lists.php.net to get a copy of this message
jimw Fri Jan 12 12:59:57 2001 EDT Modified files: /phpweb/error index.php Log: handle moved english manual, and use manual-lookup.inc Index: phpweb/error/index.php diff -u phpweb/error/index.php:1.8 phpweb/error/index.php:1.9 --- phpweb/error/index.php:1.8 Wed Dec 27 09:30:10 2000 +++ phpweb/error/index.php Fri Jan 12 12:59:57 2001 @@ -1,4 +1,6 @@ -<? +<?php + +# 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]; @@ -14,60 +16,47 @@ exit; } +# handle moving english manual down into its own directory +if (eregi("/manual/([^/]+.php3?)", $REQUEST_URI, $array)) { + if($SERVER_PORT!=80) { + $url = "http://".$SERVER_NAME.":".$SERVER_PORT."/manual/$DEFAULT_LANG/".$array[1]; + } else { + $url = "http://".$SERVER_NAME."/manual/$DEFAULT_LANG/".$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>"; + exit; +} + $uri=substr($REDIRECT_REDIRECT_ERROR_NOTES,strpos($REDIRECT_REDIRECT_ERROR_NOTES,$DOCUMENT_ROOT)+strlen($DOCUMENT_ROOT)+1); +# try to find the uri as a manual entry + +require "manual-lookup.inc"; if(strchr($uri,'/')) { list($lang,$function) = explode('/',$uri,2); - $lang .= '/'; $function = strtolower($function); $lang = strtolower($lang); -} else $function = strtolower($uri); - -if($lang=='en') $lang = ''; - -$try_files = array(); - -function tryprefix($lang, $func, $prefix) { - global $try_files; - - $func = ereg_replace("_","-",$func); - $func = ereg_replace('\(.*\)',"-",$func); - $try_files[] = "/manual/${lang}${prefix}${func}.php"; - $nosp = ereg_replace(" ", "", $func); - if ($nosp != $func) { - $try_files[] = "/manual/${lang}${prefix}${nosp}.php"; - } - $dasp = ereg_replace(" ", "-", $func); - if ($dasp != $func) { - $try_files[] = "/manual/${lang}${prefix}${dasp}.php"; - } - $noul = ereg_replace("-", "", $func); - if ($noul != $func) { - $try_files[] = "/manual/${lang}${prefix}${noul}.php"; - } +} else { + $function = strtolower($uri); + $lang = $MIRRORS[$MYSITE][6]; } -tryprefix($lang,$function, "function."); -tryprefix($lang,$function, "class."); -tryprefix($lang,$function, "ref."); -tryprefix($lang,$function, "feature-"); -tryprefix($lang,$function, "construct."); -tryprefix($lang,$function, "control-structures."); - -reset($try_files); -while (list($dummy, $file) = each($try_files)) { - if (file_exists($DOCUMENT_ROOT.$file)) { - Header("Location: $file"); - exit; - } +$try = find_manual_page($lang, $function); +if ($try) { + header("Location: $try"); + exit; } ?> -<?Header("http/1.0 404 Not Found")?> +<?Header("HTTP/1.0 404 Not Found")?> <html><title>404 - <?echo $REDIRECT_REDIRECT_ERROR_NOTES?></title> <body> <? - require "../configuration.inc"; if(!isset($pattern)) { $pattern = $uri; }

« previous php.mirrors (#3373) next »