$value) { if (!in_array($name, $protected)) { unset($GLOBALS[$name]); } } } // Load in the user preferences function myphpnet_load() { global $MYPHPNET; // Empty the preferences array $MYPHPNET = array(FALSE, FALSE, "NONE"); // If we have a cookie, set the values in the array if (!empty($_COOKIE['MYPHPNET'])) { $MYPHPNET = explode(",", $_COOKIE['MYPHPNET']); } } // Get or set preferred language code function myphpnet_language($langcode = FALSE) { global $MYPHPNET, $LANGUAGES; // Set language code if ($langcode && isset($LANGUAGES[$langcode])) { $MYPHPNET[0] = $langcode; } // Return code or FALSE elseif (isset($MYPHPNET[0])) { return $MYPHPNET[0]; } else { return FALSE; } } define("MYPHPNET_URL_NONE", FALSE); define("MYPHPNET_URL_FUNC", 'quickref'); define("MYPHPNET_URL_MANUAL", 'manual'); // Set URL search fallback preference function myphpnet_urlsearch($type = FALSE) { global $MYPHPNET; // Set type if specified and if correct if ($type && in_array($type, array(MYPHPNET_URL_FUNC, MYPHPNET_URL_MANUAL))) { $MYPHPNET[1] = $type; } // 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 <= 2; $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); }