From d1e2f8e52c931f84c11d4f54f32959710d528182 Mon Sep 17 00:00:00 2001 From: VirtualTam Date: Sat, 11 Jul 2015 01:29:12 +0200 Subject: PHP: ensure 5.3 compatibility, refactor timezone utilities Relates to #250 Modifications - supported version - bump required version from 5.1.0 to 5.3.x - update README - add PHP 5.3 to Travis environments - rewrite array declarations: explicitely use array() instead of [] - move checkPHPVersion to application/Utils.php - move timezone functions to application/TimeZone.php - cleanup code - improve test coverage Signed-off-by: VirtualTam --- application/Config.php | 6 +-- application/TimeZone.php | 110 +++++++++++++++++++++++++++++++++++++++++++++++ application/Utils.php | 23 +++++++++- 3 files changed, 135 insertions(+), 4 deletions(-) create mode 100644 application/TimeZone.php (limited to 'application') diff --git a/application/Config.php b/application/Config.php index 0b01b524..ec799d7f 100755 --- a/application/Config.php +++ b/application/Config.php @@ -19,10 +19,10 @@ function writeConfig($config, $isLoggedIn) { // These fields are required in configuration. - $MANDATORY_FIELDS = [ + $MANDATORY_FIELDS = array( 'login', 'hash', 'salt', 'timezone', 'title', 'titleLink', 'redirector', 'disablesessionprotection', 'privateLinkByDefault' - ]; + ); if (!isset($config['config']['CONFIG_FILE'])) { throw new MissingFieldConfigException('CONFIG_FILE'); @@ -126,4 +126,4 @@ class UnauthorizedConfigException extends Exception { $this->message = 'You are not authorized to alter config.'; } -} \ No newline at end of file +} diff --git a/application/TimeZone.php b/application/TimeZone.php new file mode 100644 index 00000000..ccbef918 --- /dev/null +++ b/application/TimeZone.php @@ -0,0 +1,110 @@ +'.$city.''; + } + } + + $continents_html = ''; + $continents = array_keys($continents); + + foreach ($continents as $continent) { + $continents_html .= '