Skip to content

Commit

Permalink
Revert "Use correct 'UTC' timezone"
Browse files Browse the repository at this point in the history
This reverts commit d15a72b.
  • Loading branch information
portailp authored Mar 20, 2017
1 parent 9910d54 commit 831f0f1
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
4 changes: 4 additions & 0 deletions application/TimeZone.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,10 @@ function generateTimeZoneForm($preselectedTimezone='')
*/
function isTimeZoneValid($continent, $city)
{
if ($continent == 'UTC' && $city == 'UTC') {
return true;
}

return in_array(
$continent.'/'.$city,
timezone_identifiers_list()
Expand Down
20 changes: 8 additions & 12 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -1277,15 +1277,11 @@ function renderPage()
{
if (!empty($_POST['title']) )
{
if (!tokenOk($_POST['token'])) {
die('Wrong token.'); // Go away!
}
if (!tokenOk($_POST['token'])) die('Wrong token.'); // Go away!
$tz = 'UTC';
if (!empty($_POST['continent']) && !empty($_POST['city'])
&& isTimeZoneValid($_POST['continent'], $_POST['city'])
) {
$tz = $_POST['continent'] . '/' . $_POST['city'];
}
if (!empty($_POST['continent']) && !empty($_POST['city']))
if (isTimeZoneValid($_POST['continent'],$_POST['city']))
$tz = $_POST['continent'].'/'.$_POST['city'];
$GLOBALS['timezone'] = $tz;
$GLOBALS['title']=$_POST['title'];
$GLOBALS['titleLink']=$_POST['titleLink'];
Expand Down Expand Up @@ -2112,10 +2108,10 @@ function install()
if (!empty($_POST['setlogin']) && !empty($_POST['setpassword']))
{
$tz = 'UTC';
if (!empty($_POST['continent']) && !empty($_POST['city'])
&& isTimeZoneValid($_POST['continent'], $_POST['city'])
) {
$tz = $_POST['continent'].'/'.$_POST['city'];
if (!empty($_POST['continent']) && !empty($_POST['city'])) {
if (isTimeZoneValid($_POST['continent'], $_POST['city'])) {
$tz = $_POST['continent'].'/'.$_POST['city'];
}
}
$GLOBALS['timezone'] = $tz;
// Everything is ok, let's create config file.
Expand Down
2 changes: 1 addition & 1 deletion tests/TimeZoneTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ public function testValidTimeZone()
{
$this->assertTrue(isTimeZoneValid('America', 'Argentina/Ushuaia'));
$this->assertTrue(isTimeZoneValid('Europe', 'Oslo'));
$this->assertTrue(isTimeZoneValid('UTC', 'UTC'));
}

/**
Expand All @@ -77,6 +78,5 @@ public function testInvalidTimeZone()
$this->assertFalse(isTimeZoneValid('CEST', 'CEST'));
$this->assertFalse(isTimeZoneValid('Europe', 'Atlantis'));
$this->assertFalse(isTimeZoneValid('Middle_Earth', 'Moria'));
$this->assertFalse(isTimeZoneValid('UTC', 'UTC'));
}
}

0 comments on commit 831f0f1

Please sign in to comment.