cvs: phpweb / error.php /include site.inc
| From: | Gabor Hojtsy | Date: | Sat, 16 Aug 2003 11:58:34 +0000 |
| Subject: | cvs: phpweb / error.php /include site.inc | ||
| Groups: | php.mirrors | ||
| Request: | Send a blank email to php-mirrors+get-20403@lists.php.net to get a copy of this message | ||
goba Sat Aug 16 07:58:34 2003 EDT
Modified files:
/phpweb error.php
/phpweb/include site.inc
Log:
Drop the need to specify that a redirection is really external, as
this is already in the first parameter. If there is a protocol part,
then it is external. Reflect this change in the errorhandler too.
Index: phpweb/error.php
diff -u phpweb/error.php:1.5 phpweb/error.php:1.6
--- phpweb/error.php:1.5 Wed Aug 13 07:53:37 2003
+++ phpweb/error.php Sat Aug 16 07:58:34 2003
@@ -1,6 +1,6 @@
<?php
-// $Id: error.php,v 1.5 2003/08/13 11:53:37 goba Exp $
+// $Id: error.php,v 1.6 2003/08/16 11:58:34 goba Exp $
/*
@@ -36,7 +36,7 @@
// ============================================================================
// BC: handle bugs.php moved completely to bugs.php.net
if (preg_match("!^bugs.php?(.+)$!", $URI, $array)) {
- mirror_redirect("http://bugs.php.net/?$array[1]", TRUE);
+ mirror_redirect("http://bugs.php.net/?$array[1]");
}
// ============================================================================
@@ -212,8 +212,7 @@
// ============================================================================
// Execute external redirect if a rule exists for the URI
if (isset($external_redirects[$URI])) {
- $true_external = (substr($external_redirects[$URI], 0, 1) != '/');
- mirror_redirect($external_redirects[$URI], $true_external);
+ mirror_redirect($external_redirects[$URI]);
}
// Temporary hack for books and mirror-info, until all the pages
Index: phpweb/include/site.inc
diff -u phpweb/include/site.inc:1.252 phpweb/include/site.inc:1.253
--- phpweb/include/site.inc:1.252 Sat Aug 16 06:55:08 2003
+++ phpweb/include/site.inc Sat Aug 16 07:58:34 2003
@@ -1,6 +1,6 @@
<?php // -*- C++ -*-
-// $Id: site.inc,v 1.252 2003/08/16 10:55:08 goba Exp $
+// $Id: site.inc,v 1.253 2003/08/16 11:58:34 goba Exp $
// Define $MIRRORS array, and some constants
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/mirrors.inc';
@@ -125,22 +125,20 @@
return $count;
}
-// Redirect to an URI on this mirror
-// site or outside this site
-function mirror_redirect($absoluteURI, $remote = FALSE)
+// Redirect to an URI on this mirror site or outside this site
+function mirror_redirect($absoluteURI)
{
global $MYSITE;
- // A local or remote redirect is needed
- if (!$remote) {
- $URI = substr($MYSITE, 0, -1) . $absoluteURI;
- } else {
- $URI = $absoluteURI;
+ // Test if there is no protocol spec
+ // in the URL, then prepend local site URI
+ if (!preg_match("!^[a-z]+://!", $absoluteURI)) {
+ $absoluteURI = substr($MYSITE, 0, -1) . $absoluteURI;
}
-
+
// Do a redirection, if headers are not sent
if (!headers_sent()) {
- header("Location: $URI");
+ header("Location: $absoluteURI");
}
// Always exit (the page is not to be displayed)