diff options
-rw-r--r-- | application/TimeZone.php | 4 | ||||
-rw-r--r-- | index.php | 20 | ||||
-rw-r--r-- | tests/TimeZoneTest.php | 2 |
3 files changed, 13 insertions, 13 deletions
diff --git a/application/TimeZone.php b/application/TimeZone.php index e363d90a..26f2232d 100644 --- a/application/TimeZone.php +++ b/application/TimeZone.php | |||
@@ -101,10 +101,6 @@ function generateTimeZoneForm($preselectedTimezone='') | |||
101 | */ | 101 | */ |
102 | function isTimeZoneValid($continent, $city) | 102 | function isTimeZoneValid($continent, $city) |
103 | { | 103 | { |
104 | if ($continent == 'UTC' && $city == 'UTC') { | ||
105 | return true; | ||
106 | } | ||
107 | |||
108 | return in_array( | 104 | return in_array( |
109 | $continent.'/'.$city, | 105 | $continent.'/'.$city, |
110 | timezone_identifiers_list() | 106 | timezone_identifiers_list() |
@@ -1276,11 +1276,15 @@ function renderPage() | |||
1276 | { | 1276 | { |
1277 | if (!empty($_POST['title']) ) | 1277 | if (!empty($_POST['title']) ) |
1278 | { | 1278 | { |
1279 | if (!tokenOk($_POST['token'])) die('Wrong token.'); // Go away! | 1279 | if (!tokenOk($_POST['token'])) { |
1280 | die('Wrong token.'); // Go away! | ||
1281 | } | ||
1280 | $tz = 'UTC'; | 1282 | $tz = 'UTC'; |
1281 | if (!empty($_POST['continent']) && !empty($_POST['city'])) | 1283 | if (!empty($_POST['continent']) && !empty($_POST['city']) |
1282 | if (isTimeZoneValid($_POST['continent'],$_POST['city'])) | 1284 | && isTimeZoneValid($_POST['continent'], $_POST['city']) |
1283 | $tz = $_POST['continent'].'/'.$_POST['city']; | 1285 | ) { |
1286 | $tz = $_POST['continent'] . '/' . $_POST['city']; | ||
1287 | } | ||
1284 | $GLOBALS['timezone'] = $tz; | 1288 | $GLOBALS['timezone'] = $tz; |
1285 | $GLOBALS['title']=$_POST['title']; | 1289 | $GLOBALS['title']=$_POST['title']; |
1286 | $GLOBALS['titleLink']=$_POST['titleLink']; | 1290 | $GLOBALS['titleLink']=$_POST['titleLink']; |
@@ -2113,10 +2117,10 @@ function install() | |||
2113 | if (!empty($_POST['setlogin']) && !empty($_POST['setpassword'])) | 2117 | if (!empty($_POST['setlogin']) && !empty($_POST['setpassword'])) |
2114 | { | 2118 | { |
2115 | $tz = 'UTC'; | 2119 | $tz = 'UTC'; |
2116 | if (!empty($_POST['continent']) && !empty($_POST['city'])) { | 2120 | if (!empty($_POST['continent']) && !empty($_POST['city']) |
2117 | if (isTimeZoneValid($_POST['continent'], $_POST['city'])) { | 2121 | && isTimeZoneValid($_POST['continent'], $_POST['city']) |
2118 | $tz = $_POST['continent'].'/'.$_POST['city']; | 2122 | ) { |
2119 | } | 2123 | $tz = $_POST['continent'].'/'.$_POST['city']; |
2120 | } | 2124 | } |
2121 | $GLOBALS['timezone'] = $tz; | 2125 | $GLOBALS['timezone'] = $tz; |
2122 | // Everything is ok, let's create config file. | 2126 | // Everything is ok, let's create config file. |
diff --git a/tests/TimeZoneTest.php b/tests/TimeZoneTest.php index b219030a..2976d116 100644 --- a/tests/TimeZoneTest.php +++ b/tests/TimeZoneTest.php | |||
@@ -67,7 +67,6 @@ class TimeZoneTest extends PHPUnit_Framework_TestCase | |||
67 | { | 67 | { |
68 | $this->assertTrue(isTimeZoneValid('America', 'Argentina/Ushuaia')); | 68 | $this->assertTrue(isTimeZoneValid('America', 'Argentina/Ushuaia')); |
69 | $this->assertTrue(isTimeZoneValid('Europe', 'Oslo')); | 69 | $this->assertTrue(isTimeZoneValid('Europe', 'Oslo')); |
70 | $this->assertTrue(isTimeZoneValid('UTC', 'UTC')); | ||
71 | } | 70 | } |
72 | 71 | ||
73 | /** | 72 | /** |
@@ -78,5 +77,6 @@ class TimeZoneTest extends PHPUnit_Framework_TestCase | |||
78 | $this->assertFalse(isTimeZoneValid('CEST', 'CEST')); | 77 | $this->assertFalse(isTimeZoneValid('CEST', 'CEST')); |
79 | $this->assertFalse(isTimeZoneValid('Europe', 'Atlantis')); | 78 | $this->assertFalse(isTimeZoneValid('Europe', 'Atlantis')); |
80 | $this->assertFalse(isTimeZoneValid('Middle_Earth', 'Moria')); | 79 | $this->assertFalse(isTimeZoneValid('Middle_Earth', 'Moria')); |
80 | $this->assertFalse(isTimeZoneValid('UTC', 'UTC')); | ||
81 | } | 81 | } |
82 | } | 82 | } |