Re: com web/php: [beta site] implementing betasite=1 or betasite=0 parameter. this keeps the banners setting working like the myphpnet_beta setting to
give a consistent user experience without the need for beta=0 or beta=1.: include/header.inc include/prepend.inc
| From: | Hannes Magnusson | Date: | Fri, 21 Jun 2013 20:33:04 +0000 |
| Subject: | Re: com web/php: [beta site] implementing betasite=1 or betasite=0 parameter. this keeps the banners setting working like the myphpnet_beta setting to give a consistent user experience without the need for beta=0 or beta=1.: include/header.inc include/prepend.inc |
||
| References: | 1 | Groups: | php.webmaster |
| Request: | Send a blank email to php-webmaster+get-16047@lists.php.net to get a copy of this message | ||
Please revert asap.
Not all of our mirrors use sessions.
-Hannes
On Fri, Jun 21, 2013 at 1:27 PM, Paul Dragoonis <dragoonis@php.net> wrote:
> Commit: fc14dad109e6916daa41bd5269d4cfe62347bf8f
> Author: Paul Dragoonis <dragoonis@gmail.com> Fri, 21 Jun 2013 21:27:19 +0100
> Parents: 4db4b6e34c6035ba63a9d7953a49aa5f04ba0de4
> Branches: master
>
> Link:
> http://git.php.net/?p=web/php.git;a=commitdiff;h=fc14dad109e6916daa41bd5269d4cfe62347bf8f
>
> Log:
> [beta site] implementing betasite=1 or betasite=0 parameter. this keeps the banners setting
> working like the myphpnet_beta setting to give a consistent user experience without the need for
> beta=0 or beta=1.
>
> Changed paths:
> M include/header.inc
> M include/prepend.inc
>
>
> Diff:
> diff --git a/include/header.inc b/include/header.inc
> index 663ec3d..4b1870f 100644
> --- a/include/header.inc
> +++ b/include/header.inc
> @@ -83,6 +83,15 @@ if (isset($shortname) && $shortname) {
> </head>
> <body class="<?php print $curr; ?> <?php echo $classes; ?>">
>
> +<div id="head-beta-warning">
> + <div id="beta-warning">
> + <a href="#" id="beta-warning-close">X</a>
> + <span class="blurb">
> + Welcome to the php.net beta site. If you want to revert back, <a
> href="?setbeta=0">click here</a>
> + </span>
> + </div>
> +</div>
> +
> <nav id="headnav">
>
> <ul id="headmenu">
> diff --git a/include/prepend.inc b/include/prepend.inc
> index 6127845..6300b9c 100644
> --- a/include/prepend.inc
> +++ b/include/prepend.inc
> @@ -63,6 +63,16 @@ include $_SERVER['DOCUMENT_ROOT'] .
> '/include/last_updated.inc';
>
> // -----------------------------------------------------------------------------
>
> +// SETBETA Setting for temporary banners
> +if(isset($_GET['setbeta']) && !headers_sent()) {
> + global $MYSITE;
> + myphpnet_setbeta( (bool) $_GET['setbeta']);
> + myphpnet_save();
> + header("Location: " . $MYSITE);
> + exit;
> +}
> +
> +
> // Load in the user preferences
> function myphpnet_load()
> {
> @@ -166,12 +176,22 @@ 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;
> + $bool = (bool) $bool;
> +
> + // Session check, this is set when the users are clicking the temporary banners
> + if(!isset($_SESSION)) {
> + session_start();
> + }
> +
> + $_SESSION['beta_enabled'] = $bool;
> +
> + $MYPHPNET[4] = (bool) $bool;
> }
> function myphpnet_beta() {
> global $MYPHPNET;
> @@ -185,6 +205,15 @@ function myphpnet_beta() {
> return true;
> }
>
> + // Session check, this is set when the users are clicking the temporary banners
> + if(!isset($_SESSION)) {
> + session_start();
> + }
> +
> + if(isset($_SESSION['beta_enabled'])) {
> + return $_SESSION['beta_enabled'];
> + }
> +
> if (isset($MYPHPNET[4])) {
> return (bool)$MYPHPNET[4];
> }
>
>
> --
> PHP Webmaster List Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>