Index: globals.php =================================================================== --- globals.php (revision 15437) +++ globals.php (working copy) @@ -180,7 +180,7 @@ */ public static function getConfigVars() { - static $vars = null; + static $vars = NULL; if ( !isset($vars) ) { $vars = self::parseConfig(); @@ -313,7 +313,7 @@ * @access public * @deprecated */ - public static function curl_post($url, $data, $headers = null, $request_type = 'POST', $curl_options = null) + public static function curl_post($url, $data, $headers = NULL, $request_type = 'POST', $curl_options = NULL) { $application =& kApplication::Instance(); @@ -673,6 +673,27 @@ { return sprintf('%u', crc32($str)); } + + /** + * Returns instance of DateTime class with date set based on timestamp + * + * @static + * @param int $timestamp + * @return DateTime + */ + public static function dateFromTimestamp($timestamp) + { + if ( version_compare(PHP_VERSION, '5.3.0', '<') ) { + $date = new DateTime('@' . $timestamp); + $date->setTimezone(new DateTimeZone(getenv('TZ'))); + } + else { + $date = new DateTime(); + $date->setTimestamp($timestamp); + } + + return $date; + } } /** @@ -710,7 +731,7 @@ * @param int $scanner_mode * @return Array */ - function parse_ini_string($ini, $process_sections = false, $scanner_mode = null) + function parse_ini_string($ini, $process_sections = false, $scanner_mode = NULL) { # Generate a temporary file. $tempname = tempnam('/tmp', 'ini');