Removing 5.2 validations.

1.9.x
Julio Montoya 12 years ago
parent f7e4ac2604
commit 64cda540cb
  1. 30
      main/inc/lib/internationalization.lib.php

@ -509,11 +509,8 @@ function api_detect_language(&$string, $encoding = null) {
*
* @author Guillaume Viguier <guillaume.viguier@beeznest.com>
*/
function api_get_timezones() {
if (!DATE_TIME_INSTALLED) {
// This occurs when PHP < 5.2
return array('' => '');
}
function api_get_timezones()
{
$timezone_identifiers = DateTimeZone::listIdentifiers();
sort($timezone_identifiers);
$out = array();
@ -575,10 +572,6 @@ function api_get_utc_datetime($time = null, $return_null_if_invalid_date = false
$time = intval($time);
return gmdate('Y-m-d H:i:s', $time);
}
if (!DATE_TIME_INSTALLED) {
// This occurs when PHP < 5.2
return $time;
}
try {
$date = new DateTime($time, new DateTimezone($from_timezone));
$date->setTimezone(new DateTimeZone($to_timezone));
@ -591,25 +584,16 @@ function api_get_utc_datetime($time = null, $return_null_if_invalid_date = false
/**
* Returns a DATETIME string converted to the right timezone
* @param mixed The time to be converted
* @param string The timezone to be converted to. If null, the timezone will be determined based on user preference, or timezone chosen by the admin for the platform.
* @param string The timezone to be converted to.
* If null, the timezone will be determined based on user preference,
* or timezone chosen by the admin for the platform.
* @param string The timezone to be converted from. If null, UTC will be assumed.
* @return string The converted time formatted as Y-m-d H:i:s
*
* @author Guillaume Viguier <guillaume.viguier@beeznest.com>
*/
function api_get_local_time($time = null, $to_timezone = null, $from_timezone = null, $return_null_if_invalid_date = false) {
if (!DATE_TIME_INSTALLED) {
// This occurs when PHP < 5.2
if (is_null($time) || empty($time) || $time == '0000-00-00 00:00:00') {
$time = time();
}
if (is_numeric($time)) {
$time = intval($time);
$time = date('Y-m-d H:i:s', $time);
}
return $time;
}
function api_get_local_time($time = null, $to_timezone = null, $from_timezone = null, $return_null_if_invalid_date = false)
{
// Determining the timezone to be converted from
if (is_null($from_timezone)) {
$from_timezone = 'UTC';

Loading…
Cancel
Save