cvs: phpweb /include prepend.inc

From: Date: Wed, 13 Aug 2003 13:11:10 +0000
Subject: cvs: phpweb /include prepend.inc
Groups: php.mirrors 
Request: Send a blank email to php-mirrors+get-20209@lists.php.net to get a copy of this message
goba Wed Aug 13 09:11:10 2003 EDT Modified files: /phpweb/include prepend.inc Log: Add functionality to make user specified mirror redirection work Index: phpweb/include/prepend.inc diff -u phpweb/include/prepend.inc:1.30 phpweb/include/prepend.inc:1.31 --- phpweb/include/prepend.inc:1.30 Thu Aug 7 05:30:05 2003 +++ phpweb/include/prepend.inc Wed Aug 13 09:11:09 2003 @@ -1,6 +1,6 @@ <?php // -*- C++ -*- -// $Id: prepend.inc,v 1.30 2003/08/07 09:30:05 goba Exp $ +// $Id: prepend.inc,v 1.31 2003/08/13 13:11:09 goba Exp $ // See http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9 // for cache control header descriptions (used in many places on the site). @@ -91,7 +91,7 @@ global $MYPHPNET; // Empty the preferences array - $MYPHPNET = array(FALSE, FALSE); + $MYPHPNET = array(FALSE, FALSE, "NONE"); // If we have a cookie, set the values in the array if (!empty($_COOKIE['MYPHPNET'])) { @@ -129,19 +129,35 @@ $MYPHPNET[1] = $type; } - // Return code or FALSE + // Return code or NONE elseif (isset($MYPHPNET[1])) { return $MYPHPNET[1]; } else { return MYPHPNET_URL_NONE; } } +// Set mirror site redirection +function myphpnet_mirror($murl = FALSE) +{ + global $MYPHPNET; + + // Set mirror URL if specified and if correct + if ($murl && ($murl == "AUTO" || mirror_status($murl) == MIRROR_OK)) { + $MYPHPNET[2] = $murl; + } + + // Return code or NONE + elseif (isset($MYPHPNET[2])) { + return $MYPHPNET[2]; + } else { return "NONE"; } +} + // Save user settings in cookie function myphpnet_save() { global $MYPHPNET; // Fill in values not specified - for ($i = 0; $i <= 1; $i++) { + for ($i = 0; $i <= 2; $i++) { if (!isset($MYPHPNET[$i])) { $MYPHPNET[$i] = FALSE; } }

« previous php.mirrors (#20209) next »