1
0
mirror of https://github.com/php/web-php.git synced 2026-03-24 07:12:16 +01:00

Add beta feature

This commit is contained in:
Hannes Magnusson
2010-12-26 16:06:23 +00:00
parent 39cd8754a5
commit c416fc0dcc
2 changed files with 36 additions and 1 deletions

View File

@@ -69,7 +69,7 @@ function myphpnet_load()
global $MYPHPNET;
// Empty the preferences array
$MYPHPNET = array(FALSE, FALSE, "NONE", 0);
$MYPHPNET = array(FALSE, FALSE, "NONE", 0, FALSE);
// If we have a cookie, set the values in the array
if (!empty($_COOKIE['MYPHPNET'])) {
@@ -158,3 +158,19 @@ function myphpnet_save()
// Set all the preferred values for a year
mirror_setcookie("MYPHPNET", join(",", $MYPHPNET), 60*60*24*365);
}
function myphpnet_setbeta($bool = false) {
global $MYPHPNET;
$MYPHPNET[4] = (bool)$bool;
}
function myphpnet_beta() {
global $MYPHPNET;
if (isset($MYPHPNET[4])) {
return $MYPHPNET[4];
}
return false;
}

19
my.php
View File

@@ -67,6 +67,10 @@ if (isset($_POST['hidesuggest'])) {
myphpnet_hidesuggest($_POST['hidesuggest']);
}
if (isset($_POST['beta'])) {
myphpnet_setbeta($_POST['beta']);
}
myphpnet_save();
site_header("My PHP.net");
@@ -269,6 +273,21 @@ foreach ($mirror_sites as $murl => $mdata) {
</select>
</div>
<h2>PHP.net beta</h2>
<p>
php.net is undergoing plastic surgery these days. If you want to see
how the site may look in the feature, you can join our beta program.
</p>
<div class="indent">
<select name="beta">
<option value="0" <?php echo myphpnet_beta() ? "" : "selected" ?>>Disable</option>
<option value="1" <?php echo myphpnet_beta() ? "selected" : "" ?>>Enable</option>
</select>
</div>
<p class="center">
<input type="submit" value="Set All Preferences" />
</p>