From: Marcel Werk Date: Thu, 30 May 2013 13:48:42 +0000 (+0200) Subject: Fixed missing default timezone issue X-Git-Tag: 2.0.0_Beta_2~16 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=102fb48958dd0cfc1fc790a3ee36d947afb2b6bd;p=GitHub%2FWoltLab%2FWCF.git Fixed missing default timezone issue --- diff --git a/wcfsetup/install/files/lib/acp/form/StyleAddForm.class.php b/wcfsetup/install/files/lib/acp/form/StyleAddForm.class.php index 7f8c8ee9cb..06612555b7 100644 --- a/wcfsetup/install/files/lib/acp/form/StyleAddForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/StyleAddForm.class.php @@ -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'; } } diff --git a/wcfsetup/install/files/lib/system/WCF.class.php b/wcfsetup/install/files/lib/system/WCF.class.php index 69c3122ffd..16e7f0dafb 100644 --- a/wcfsetup/install/files/lib/system/WCF.class.php +++ b/wcfsetup/install/files/lib/system/WCF.class.php @@ -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)'); diff --git a/wcfsetup/install/files/lib/system/exception/LoggedException.class.php b/wcfsetup/install/files/lib/system/exception/LoggedException.class.php index 6b1bc07bd7..5128b79298 100644 --- a/wcfsetup/install/files/lib/system/exception/LoggedException.class.php +++ b/wcfsetup/install/files/lib/system/exception/LoggedException.class.php @@ -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". diff --git a/wcfsetup/install/files/lib/system/io/Zip.class.php b/wcfsetup/install/files/lib/system/io/Zip.class.php index 18be9bfbcf..7b68b23c2e 100644 --- a/wcfsetup/install/files/lib/system/io/Zip.class.php +++ b/wcfsetup/install/files/lib/system/io/Zip.class.php @@ -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 diff --git a/wcfsetup/install/files/lib/util/CronjobUtil.class.php b/wcfsetup/install/files/lib/util/CronjobUtil.class.php index 6558762401..8ad1590061 100644 --- a/wcfsetup/install/files/lib/util/CronjobUtil.class.php +++ b/wcfsetup/install/files/lib/util/CronjobUtil.class.php @@ -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);