cvs: pearweb /include pear-format-html.php pear-prepend.php /public_html/error 404.php

From: Date: Mon, 03 Jun 2002 14:05:44 +0000
Subject: cvs: pearweb /include pear-format-html.php pear-prepend.php /public_html/error 404.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-4390@lists.php.net to get a copy of this message
richard Mon Jun 3 10:05:44 2002 EDT Modified files: /pearweb/include pear-prepend.php pear-format-html.php /pearweb/public_html/error 404.php Log: * Converted 404.php to use localRedirect() Index: pearweb/include/pear-prepend.php diff -u pearweb/include/pear-prepend.php:1.30 pearweb/include/pear-prepend.php:1.31 --- pearweb/include/pear-prepend.php:1.30 Sun Jun 2 20:40:57 2002 +++ pearweb/include/pear-prepend.php Mon Jun 3 10:05:43 2002 @@ -89,31 +89,4 @@ return $data; } } - -/** -* Returns an absolute URL using Net_URL -* -* @param string $url All/part of a url -* @return string Full url -*/ -function getURL($url) -{ - include_once('Net/URL.php'); - $obj = new Net_URL($url); - return $obj->getURL(); -} - -/** -* Redirects to the given full or partial URL. -* will turn the given url into an absolute url -* using the above getURL() function. This function -* does not return. -* -* @param string $url Full/partial url to redirect to -*/ -function redirect($url) -{ - header('Location: ' . getURL($url)); - exit; -} ?> Index: pearweb/include/pear-format-html.php diff -u pearweb/include/pear-format-html.php:1.38 pearweb/include/pear-format-html.php:1.39 --- pearweb/include/pear-format-html.php:1.38 Tue May 21 17:36:55 2002 +++ pearweb/include/pear-format-html.php Mon Jun 3 10:05:43 2002 @@ -286,11 +286,38 @@ print $html; } -function localRedirect($file) +/** +* Returns an absolute URL using Net_URL +* +* @param string $url All/part of a url +* @return string Full url +*/ +function getURL($url) { - $location = "http://" . $GLOBALS['HTTP_SERVER_VARS']['HTTP_HOST'] . "/" . $file; - header("Location: " . $location); + include_once('Net/URL.php'); + $obj = new Net_URL($url); + return $obj->getURL(); } + +/** +* Redirects to the given full or partial URL. +* will turn the given url into an absolute url +* using the above getURL() function. This function +* does not return. +* +* @param string $url Full/partial url to redirect to +*/ +function localRedirect($url) +{ + header('Location: ' . getURL($url)); + exit; +} + +#function localRedirect($file) +#{ +# $location = "http://" . $GLOBALS['HTTP_SERVER_VARS']['HTTP_HOST'] . "/" . $file; +# header("Location: " . $location); +#} function displayed_user_email($user) { Index: pearweb/public_html/error/404.php diff -u pearweb/public_html/error/404.php:1.3 pearweb/public_html/error/404.php:1.4 --- pearweb/public_html/error/404.php:1.3 Mon Jun 3 09:13:52 2002 +++ pearweb/public_html/error/404.php Mon Jun 3 10:05:44 2002 @@ -2,8 +2,8 @@ /** * Filename.......: 404.php * Project........: Pearweb -* Last Modified..: $Date: 2002/06/03 13:13:52 $ -* CVS Revision...: $Revision: 1.3 $ +* Last Modified..: $Date: 2002/06/03 14:05:44 $ +* CVS Revision...: $Revision: 1.4 $ * * On 404 error this will search for a package with the same * name as the requested document. Thus enabling urls such as: @@ -18,7 +18,7 @@ ORDER BY p.name", basename($_SERVER['REDIRECT_URL'])), DB_FETCHMODE_ASSOC); if (count($packages) == 1) { - redirect($pinfo_url . $packages[0]['id']); + localRedirect($pinfo_url . $packages[0]['id']); } elseif (count($packages) > 3) { $packages = array($packages[0], $packages[1], $packages[2]);

« previous php.pear.cvs (#4390) next »