Fixed missing default timezone issue
authorMarcel Werk <burntime@woltlab.com>
Thu, 30 May 2013 13:48:42 +0000 (15:48 +0200)
committerMarcel Werk <burntime@woltlab.com>
Thu, 30 May 2013 13:48:42 +0000 (15:48 +0200)
wcfsetup/install/files/lib/acp/form/StyleAddForm.class.php
wcfsetup/install/files/lib/system/WCF.class.php
wcfsetup/install/files/lib/system/exception/LoggedException.class.php
wcfsetup/install/files/lib/system/io/Zip.class.php
wcfsetup/install/files/lib/util/CronjobUtil.class.php

index 7f8c8ee9cb4cb1bf1eda51480881a3aaf726fec7..06612555b788420256c0d473ac6e86dd3856bfb7 100644 (file)
@@ -377,7 +377,7 @@ class StyleAddForm extends AbstractForm {
                
                if (empty($_POST)) {
                        $this->authorName = WCF::getUser()->username;
-                       $this->styleDate = date('Y-m-d', TIME_NOW);
+                       $this->styleDate = gmdate('Y-m-d', TIME_NOW);
                        $this->styleVersion = '1.0.0';
                }
        }
index 69c3122ffd3f249b9eab588c5c69780f5d0879a3..16e7f0dafbd67b8624bff71fb869a20d60293a28 100644 (file)
@@ -28,6 +28,11 @@ use wcf\util\StringUtil;
 // try to disable execution time limit
 @set_time_limit(0);
 
+// fix timezone warning issue
+if (!@ini_get('date.timezone')) {
+       @date_default_timezone_set('Europe/London');
+}
+
 // define current wcf version
 define('WCF_VERSION', '2.0.0 Beta 1 (Maelstrom)');
 
index 6b1bc07bd73ca44b291d92c357adbcb266721059..5128b792988f3d78c46ef29894ebc33925fc4872 100644 (file)
@@ -61,7 +61,7 @@ class LoggedException extends \Exception {
                        return;
                }
                
-               $logFile = WCF_DIR . 'log/' . date('Y-m-d', TIME_NOW) . '.txt';
+               $logFile = WCF_DIR . 'log/' . gmdate('Y-m-d', TIME_NOW) . '.txt';
                
                // try to create file
                @touch($logFile);
@@ -80,7 +80,7 @@ class LoggedException extends \Exception {
                $e = ($this->getPrevious() ?: $this);
                
                // don't forget to update ExceptionLogViewPage, when changing the log file format
-               $message = date('r', TIME_NOW)."\n".
+               $message = gmdate('r', TIME_NOW)."\n".
                        'Message: '.$e->getMessage()."\n".
                        'File: '.$e->getFile().' ('.$e->getLine().")\n".
                        'PHP version: '.phpversion()."\n".
index 18be9bfbcfd59b475770d0cc48da4d183e969b3c..7b68b23c2eb08812d857e4d87825fc7b89f0431a 100644 (file)
@@ -174,7 +174,7 @@ class Zip extends File implements IArchive {
                        $day = $data['mdate'] & 31 /* 5 bits */;
                        $month = ($data['mdate'] >> 5) & 15 /* 4 bits */;
                        $year = (($data['mdate'] >> 9) & 127 /* 7 bits */) + 1980;
-                       $data['mtime'] = mktime($hour, $minute, $second, $month, $day, $year);
+                       $data['mtime'] = gmmktime($hour, $minute, $second, $month, $day, $year);
                        
                        $data += unpack('Vcrc32/VcompressedSize/Vsize/vfilenameLength/vextraFieldLength/vfileCommentLength/vdiskNo/vinternalAttr/vexternalAttr', $this->read(26));
                        $data['offset'] = $this->readAndUnpack(4, 'v');
@@ -284,7 +284,7 @@ class Zip extends File implements IArchive {
                $day = $header['mdate'] & 31 /* 5 bits */;
                $month = ($header['mdate'] >> 5) & 15 /* 4 bits */;
                $year = (($header['mdate'] >> 9) & 127 /* 7 bits */) + 1980;
-               $header['x-timestamp'] = mktime($hour, $minute, $second, $month, $day, $year);
+               $header['x-timestamp'] = gmmktime($hour, $minute, $second, $month, $day, $year);
                $header += unpack('Vcrc32/VcompressedSize/Vsize/vfilenameLength/vextraFieldLength', $this->read(16));
                
                // read filename
index 6558762401e09dd21fa54f77c090076dacc853d9..8ad15900613917cc202333dccd07aa1ed508311f 100644 (file)
@@ -124,7 +124,7 @@ final class CronjobUtil {
                self::calculateTime($values);
                
                // return timestamp
-               return mktime(
+               return gmmktime(
                        self::$result['hour'],
                        self::$result['minute'],
                        1,
@@ -142,8 +142,8 @@ final class CronjobUtil {
        protected static function calculateTime(array &$values) {
                // calculation starts with month, thus start with
                // month of $time (if within values)
-               $currentMonth = date('n', self::$timeBase);
-               $currentYear = date('Y', self::$timeBase);
+               $currentMonth = gmdate('n', self::$timeBase);
+               $currentYear = gmdate('Y', self::$timeBase);
                $index = self::findKey($currentMonth, $values['month']);
                
                self::calculateDay($values);
@@ -165,20 +165,20 @@ final class CronjobUtil {
                
                if ($addAnDay) {
                        $date = getdate($timeBase);
-                       $timeBase = mktime(0, 0, 1, $date['mon'], $date['mday'] + 1, $date['year']);
+                       $timeBase = gmmktime(0, 0, 1, $date['mon'], $date['mday'] + 1, $date['year']);
                }
                
-               $day = date('j', $timeBase);
-               $month = date('n', $timeBase);
-               $year = date('Y', $timeBase);
+               $day = gmdate('j', $timeBase);
+               $month = gmdate('n', $timeBase);
+               $year = gmdate('Y', $timeBase);
                
                // calculate date of next execution based upon day of week
                $dateDow = self::calculateDow($month, $year, $values, $day);
-               $dateDowTimestamp = mktime(0, 0, 1, $dateDow['month'], $dateDow['day'], $dateDow['year']);
+               $dateDowTimestamp = gmmktime(0, 0, 1, $dateDow['month'], $dateDow['day'], $dateDow['year']);
                
                // calculate date of next execution based upon day of month
                $dateDom = self::calculateDom($month, $year, $values, $day);
-               $dateDomTimestamp = mktime(0, 0, 1, $dateDom['month'], $dateDom['day'], $dateDom['year']);
+               $dateDomTimestamp = gmmktime(0, 0, 1, $dateDom['month'], $dateDom['day'], $dateDom['year']);
                
                // pick the earlier date if both dom and dow are restricted
                if (self::$domRestricted && self::$dowRestricted) {
@@ -216,7 +216,7 @@ final class CronjobUtil {
                // compare day, month and year wether we have to recalculate hour and minute
                if (($day != self::$result['day']) || ($month != self::$result['month']) || ($year != self::$result['year'])) {
                        // calculate new time base
-                       $timeBase = mktime(0, 0, 1, self::$result['month'], self::$result['day'], self::$result['year']);
+                       $timeBase = gmmktime(0, 0, 1, self::$result['month'], self::$result['day'], self::$result['year']);
                        
                        self::calculateHour($values, $timeBase);
                }
@@ -232,11 +232,11 @@ final class CronjobUtil {
         * @return      array
         */
        protected static function calculateDow($month, $year, array &$values, $day = 1) {
-               $days = date('t', mktime(0, 0, 1, $month, $day, $year));
+               $days = gmdate('t', gmmktime(0, 0, 1, $month, $day, $year));
                
                for ($i = $day; $i <= $days; $i++) {
                        // get dow
-                       $dow = date('w', mktime(0, 0, 1, $month, $i, $year));
+                       $dow = gmdate('w', gmmktime(0, 0, 1, $month, $i, $year));
                        
                        if (in_array($dow, $values['dow'])) {
                                return array(
@@ -261,7 +261,7 @@ final class CronjobUtil {
         * @return      array
         */
        protected static function calculateDom($month, $year, array &$values, $day = 1) {
-               $days = date('t', mktime(0, 0, 1, $month, $day, $year));
+               $days = gmdate('t', gmmktime(0, 0, 1, $month, $day, $year));
                
                for ($i = $day; $i <= $days; $i++) {
                        if (in_array($i, $values['dom'])) {
@@ -333,7 +333,7 @@ final class CronjobUtil {
                        $minute = 0;
                }
                else {
-                       $minute = date('i', $timeBase);
+                       $minute = gmdate('i', $timeBase);
                }
                
                $index = self::findKey($minute, $values['minute'], false);