From 82f5ab5175c73c84653d13c0bbc0c9b31c60f052 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Mon, 11 May 2015 16:22:14 -0400 Subject: [PATCH] Fix use of DEFINED. It takes a string not a constant. When COOKIE is not set or has changed, set it --- web/index.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/web/index.php b/web/index.php index 1eff72974..6167dc4dc 100644 --- a/web/index.php +++ b/web/index.php @@ -63,30 +63,30 @@ if ( isset($_GET['skin']) ) $skin = $_GET['skin']; elseif ( isset($_COOKIE['zmSkin']) ) $skin = $_COOKIE['zmSkin']; -elseif ( defined(ZM_SKIN_DEFAULT) ) +elseif ( defined('ZM_SKIN_DEFAULT') ) $skin = ZM_SKIN_DEFAULT; else $skin = "classic"; $skins = array_map( 'basename', glob('skins/*',GLOB_ONLYDIR) ); if ( ! in_array( $skin, $skins ) ) { - Error( "Invalid skin '$skin'" ); - $skin = 'classic'; + Error( "Invalid skin '$skin' setting to " . $skins[0] ); + $skin = $skins[0]; } if ( isset($_GET['css']) ) $css = $_GET['css']; elseif ( isset($_COOKIE['zmCSS']) ) $css = $_COOKIE['zmCSS']; -elseif (defined(ZM_CSS_DEFAULT)) +elseif (defined('ZM_CSS_DEFAULT')) $css = ZM_CSS_DEFAULT; else $css = "classic"; $css_skins = array_map( 'basename', glob('skins/'.$skin.'/css/*',GLOB_ONLYDIR) ); if ( ! in_array( $css, $css_skins ) ) { - Error( "Invalid skin css '$css'" ); - $css = 'classic'; + Error( "Invalid skin css '$css' setting to " . $css_skins[0] ); + $css = $css_skins[0]; } define( "ZM_BASE_PATH", dirname( $_SERVER['REQUEST_URI'] ) ); @@ -102,13 +102,13 @@ ini_set( "session.name", "ZMSESSID" ); session_start(); -if ( !isset($_SESSION['skin']) || isset($_REQUEST['skin']) ) +if ( !isset($_SESSION['skin']) || isset($_REQUEST['skin']) || !isset($_COOKIE['zmSkin']) || $_COOKIE['zmSkin'] != $skin ) { $_SESSION['skin'] = $skin; setcookie( "zmSkin", $skin, time()+3600*24*30*12*10 ); } -if ( !isset($_SESSION['css']) || isset($_REQUEST['css']) ) { +if ( !isset($_SESSION['css']) || isset($_REQUEST['css']) || !isset($_COOKIE['zmCSS']) || $_COOKIE['zmCSS'] != $css ) { $_SESSION['css'] = $css; setcookie( "zmCSS", $css, time()+3600*24*30*12*10 ); }