From f333f8e9aa0002b8700ba7976b07b3f8d66c6438 Mon Sep 17 00:00:00 2001
From: Peter Rotich <peter@osticket.com>
Date: Thu, 10 May 2012 16:36:27 -0400
Subject: [PATCH] Change daylight to TZ_DST

---
 include/class.format.php |  2 +-
 include/class.misc.php   |  2 +-
 include/class.staff.php  |  2 +-
 login.php                |  2 +-
 scp/profile.php          |  2 +-
 scp/staff.inc.php        | 11 +++++------
 6 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/include/class.format.php b/include/class.format.php
index a3461bf9d..2c0993c45 100644
--- a/include/class.format.php
+++ b/include/class.format.php
@@ -200,7 +200,7 @@ class Format {
     }
 
     function userdate($format,$gmtime) {
-        return Format::date($format,$gmtime,$_SESSION['TZ_OFFSET'],$_SESSION['daylight']);
+        return Format::date($format,$gmtime,$_SESSION['TZ_OFFSET'],$_SESSION['TZ_DST']);
     }
     
     function date($format,$gmtimestamp,$offset=0,$daylight=false){
diff --git a/include/class.misc.php b/include/class.misc.php
index d9f59f478..2d8e3e6b5 100644
--- a/include/class.misc.php
+++ b/include/class.misc.php
@@ -67,7 +67,7 @@ class Misc {
             $time=Misc::gmtime(); //gm time.
         else{ //user time to GM.
             $time=is_int($var)?$var:strtotime($var);
-            $offset=$_SESSION['TZ_OFFSET']+($_SESSION['daylight']?date('I',$time):0);
+            $offset=$_SESSION['TZ_OFFSET']+($_SESSION['TZ_DST']?date('I',$time):0);
             $time=$time-($offset*3600);
         }
         //gm to db time
diff --git a/include/class.staff.php b/include/class.staff.php
index 005541579..cf97785eb 100644
--- a/include/class.staff.php
+++ b/include/class.staff.php
@@ -520,7 +520,7 @@ class Staff {
             $_SESSION['_staff']['userID']=$username;
             $user->refreshSession(); //set the hash.
             $_SESSION['TZ_OFFSET']=$user->getTZoffset();
-            $_SESSION['daylight']=$user->observeDaylight();
+            $_SESSION['TZ_DST']=$user->observeDaylight();
             Sys::log(LOG_DEBUG,'Staff login',sprintf("%s logged in [%s]", $user->getUserName(), $_SERVER['REMOTE_ADDR'])); //Debug.
             $sid=session_id(); //Current ID
             session_regenerate_id(TRUE);
diff --git a/login.php b/login.php
index 48dc9ec4a..a1fb02e5e 100644
--- a/login.php
+++ b/login.php
@@ -53,7 +53,7 @@ if($_POST && (!empty($_POST['lemail']) && !empty($_POST['lticket']))):
             $_SESSION['_client']['key']      =$ticket->getExtId(); //Ticket ID --acts as password when used with email. See above.
             $_SESSION['_client']['token']    =$user->getSessionToken();
             $_SESSION['TZ_OFFSET']=$cfg->getTZoffset();
-            $_SESSION['daylight']=$cfg->observeDaylightSaving();
+            $_SESSION['TZ_DST']=$cfg->observeDaylightSaving();
             //Log login info...
             $msg=sprintf("%s/%s logged in [%s]",$ticket->getEmail(),$ticket->getExtId(),$_SERVER['REMOTE_ADDR']);
             Sys::log(LOG_DEBUG,'User login',$msg);
diff --git a/scp/profile.php b/scp/profile.php
index f9dd42a5f..e6506fa6e 100644
--- a/scp/profile.php
+++ b/scp/profile.php
@@ -29,7 +29,7 @@ if(!$errors && $_POST) { //Handle post
         $thisstaff->reload();
         $staff->reload();
         $_SESSION['TZ_OFFSET']=$thisstaff->getTZoffset();
-        $_SESSION['daylight']=$thisstaff->observeDaylight();
+        $_SESSION['TZ_DST']=$thisstaff->observeDaylight();
     }elseif(!$errors['err'])
         $errors['err']='Profile update error. Try correcting the errors below and try again!';
 }
diff --git a/scp/staff.inc.php b/scp/staff.inc.php
index 7a4dfb9e3..0256ce704 100644
--- a/scp/staff.inc.php
+++ b/scp/staff.inc.php
@@ -71,7 +71,7 @@ if(!$thisstaff->isAdmin()) {
     }
 
     //Staff are not allowed to login in offline mode!!
-    if($cfg->isHelpDeskOffline() || $cfg->isUpgradePending()) {
+    if($ost->isHelpDeskOffline() || $ost->isUpgradePending()) {
         staffLoginPage('System Offline');
         exit;
     }
@@ -83,19 +83,18 @@ $thisstaff->refreshSession();
 /******* SET STAFF DEFAULTS **********/
 //Set staff's timezone offset.
 $_SESSION['TZ_OFFSET']=$thisstaff->getTZoffset();
-$_SESSION['daylight']=$thisstaff->observeDaylight();
+$_SESSION['TZ_DST']=$thisstaff->observeDaylight();
 
-define('AUTO_REFRESH_RATE',$thisstaff->getRefreshRate()*60);
-define('PAGE_LIMIT',$thisstaff->getPageLimit()?$thisstaff->getPageLimit():DEFAULT_PAGE_LIMIT);
+define('PAGE_LIMIT', $thisstaff->getPageLimit()?$thisstaff->getPageLimit():DEFAULT_PAGE_LIMIT);
 
 //Clear some vars. we use in all pages.
 $errors=array();
 $msg=$warn=$sysnotice='';
 $tabs=array();
 $submenu=array();
-if($cfg->isUpgradePending()) {
+if($ost->isUpgradePending()) {
     $errors['err']=$sysnotice='System upgrade is pending <a href="../setup/upgrade.php">Upgrade Now</a>';
-} elseif($cfg->isHelpDeskOffline()) {
+} elseif($ost->isHelpDeskOffline()) {
     $sysnotice='<strong>System is set to offline mode</strong> - Client interface is disabled and ONLY admins can access staff control panel.';
     $sysnotice.=' <a href="settings.php">Enable</a>.';
 }
-- 
GitLab