cvs: phpweb /include prepend.inc

From: Date: Tue, 29 Jul 2003 12:55:24 +0000
Subject: cvs: phpweb /include prepend.inc
Groups: php.mirrors 
Request: Send a blank email to php-mirrors+get-19625@lists.php.net to get a copy of this message
goba Tue Jul 29 08:55:24 2003 EDT Modified files: /phpweb/include prepend.inc Log: Only set language if properly specified, and fill in the blanks when saving settings, so they will come back in the right position in the preference list from the cookie Index: phpweb/include/prepend.inc diff -u phpweb/include/prepend.inc:1.28 phpweb/include/prepend.inc:1.29 --- phpweb/include/prepend.inc:1.28 Tue Jul 29 07:35:24 2003 +++ phpweb/include/prepend.inc Tue Jul 29 08:55:24 2003 @@ -1,6 +1,6 @@ <?php // -*- C++ -*- -// $Id: prepend.inc,v 1.28 2003/07/29 11:35:24 goba Exp $ +// $Id: prepend.inc,v 1.29 2003/07/29 12:55:24 goba Exp $ // Start measuring time spent on page $page_creation_start = getmicrotime(); @@ -101,10 +101,10 @@ global $MYPHPNET; // Empty the preferences array - $MYPHPNET = array(); + $MYPHPNET = array(FALSE, FALSE); // If we have a cookie, set the values in the array - if (isset($_COOKIE['MYPHPNET'])) { + if (!empty($_COOKIE['MYPHPNET'])) { $MYPHPNET = explode(",", $_COOKIE['MYPHPNET']); } } @@ -112,10 +112,10 @@ // Get or set preferred language code function myphpnet_language($langcode = FALSE) { - global $MYPHPNET; + global $MYPHPNET, $LANGUAGES; // Set language code - if ($langcode) { + if ($langcode && isset($LANGUAGES[$langcode])) { $MYPHPNET[0] = $langcode; } // Return code or FALSE @@ -149,6 +149,11 @@ function myphpnet_save() { global $MYPHPNET; + + // Fill in values not specified + for ($i = 0; $i <= 1; $i++) { + if (!isset($MYPHPNET[$i])) { $MYPHPNET[$i] = FALSE; } + } // Set all the preferred values for a year mirror_setcookie("MYPHPNET", join(",", $MYPHPNET), 60*60*24*365);

« previous php.mirrors (#19625) next »