[Jaws-commits] r13219 - in trunk/jaws/html/include: . Jaws Jaws/Date

afz at jaws-project.com afz at jaws-project.com
Fri Aug 3 09:24:25 UTC 2012


Author: afz
Date: 2012-08-03 09:24:24 +0000 (Fri, 03 Aug 2012)
New Revision: 13219

Modified:
   trunk/jaws/html/include/Jaws.php
   trunk/jaws/html/include/Jaws/AtomFeed.php
   trunk/jaws/html/include/Jaws/DB.php
   trunk/jaws/html/include/Jaws/Date.php
   trunk/jaws/html/include/Jaws/Date/Gregorian.php
   trunk/jaws/html/include/Jaws/Date/Jalali.php
   trunk/jaws/html/include/Jaws/Log.php
Log:
Using gmdate instead of date function

Modified: trunk/jaws/html/include/Jaws/AtomFeed.php
===================================================================
--- trunk/jaws/html/include/Jaws/AtomFeed.php	2012-08-03 08:49:31 UTC (rev 13218)
+++ trunk/jaws/html/include/Jaws/AtomFeed.php	2012-08-03 09:24:24 UTC (rev 13219)
@@ -89,7 +89,7 @@
         $hour  = substr($this->Date, 11, 2);
         $min   = substr($this->Date, 14, 2);
         $sec   = substr($this->Date, 17, 2);
-        return date('r', mktime($hour, $min, $sec, $month, $day, $year));
+        return gmdate('r', gmmktime($hour, $min, $sec, $month, $day, $year));
     }
 
     /**

Modified: trunk/jaws/html/include/Jaws/DB.php
===================================================================
--- trunk/jaws/html/include/Jaws/DB.php	2012-08-03 08:49:31 UTC (rev 13218)
+++ trunk/jaws/html/include/Jaws/DB.php	2012-08-03 09:24:24 UTC (rev 13219)
@@ -697,7 +697,7 @@
      */
     function Date($timestamp = '')
     {
-        return empty($timestamp)? gmdate('Y-m-d H:i:s') : date('Y-m-d H:i:s', (int) $timestamp);
+        return empty($timestamp)? gmdate('Y-m-d H:i:s') : gmdate('Y-m-d H:i:s', (int)$timestamp);
     }
 
     /**

Modified: trunk/jaws/html/include/Jaws/Date/Gregorian.php
===================================================================
--- trunk/jaws/html/include/Jaws/Date/Gregorian.php	2012-08-03 08:49:31 UTC (rev 13218)
+++ trunk/jaws/html/include/Jaws/Date/Gregorian.php	2012-08-03 09:24:24 UTC (rev 13219)
@@ -26,16 +26,16 @@
         }
 
         $dt = mktime($hour, $minute, $second, $month, $day, $year);
-        return !empty($format)? date($format, $dt) :
+        return !empty($format)? gmdate($format, $dt) :
                                 array('timestamp' => $dt,
-                                      'year'      => date("Y", $dt),
-                                      'month'     => date("m", $dt),
-                                      'day'       => date("d", $dt),
-                                      'hour'      => date("H", $dt),
-                                      'minute'    => date("i", $dt),
-                                      'second'    => date("s", $dt),
-                                      'monthDays' => date("t", $dt),
-                                      'yearDay'   => date("z", $dt)
+                                      'year'      => gmdate("Y", $dt),
+                                      'month'     => gmdate("m", $dt),
+                                      'day'       => gmdate("d", $dt),
+                                      'hour'      => gmdate("H", $dt),
+                                      'minute'    => gmdate("i", $dt),
+                                      'second'    => gmdate("s", $dt),
+                                      'monthDays' => gmdate("t", $dt),
+                                      'yearDay'   => gmdate("z", $dt)
                                     );
     }
 
@@ -108,18 +108,18 @@
                     break;
                 case 'D':
                     if (substr($format, $i, 2) == 'DN') {
-                        $return .= $this->DayString(date('w', $date));
+                        $return .= $this->DayString(gmdate('w', $date));
                         $i++;
                     } else {
-                        $return .= $this->DayShortString(date('w', $date));
+                        $return .= $this->DayShortString(gmdate('w', $date));
                     }
                     break;
                 case 'M':
                     if (substr($format, $i, 2) == 'MN') {
-                        $return .= $this->MonthString(date('m', $date));
+                        $return .= $this->MonthString(gmdate('m', $date));
                         $i++;
                     } else {
-                        $return .= $this->MonthShortString(date('m', $date));
+                        $return .= $this->MonthShortString(gmdate('m', $date));
                     }
                     break;
                 case '\\':
@@ -129,7 +129,7 @@
                     if (substr($format, $i - 1, 1) == '\\') {
                         $return .= $format[$i];
                     } else {
-                        $return .= date($format[$i], $date);
+                        $return .= gmdate($format[$i], $date);
                     }
                     break;
                 }

Modified: trunk/jaws/html/include/Jaws/Date/Jalali.php
===================================================================
--- trunk/jaws/html/include/Jaws/Date/Jalali.php	2012-08-03 08:49:31 UTC (rev 13218)
+++ trunk/jaws/html/include/Jaws/Date/Jalali.php	2012-08-03 09:24:24 UTC (rev 13219)
@@ -158,7 +158,7 @@
         }
 
         $date = $GLOBALS['app']->UTC2UserTime($date);
-        $date_array = explode('-', date('Y-m-d-H-i-s', $date));
+        $date_array = explode('-', gmdate('Y-m-d-H-i-s', $date));
         $jalali_array = $this->GregorianToJalali($date_array[0], $date_array[1], $date_array[2]);
         $second = $date_array[5];
         $minute = $date_array[4];
@@ -197,7 +197,7 @@
         }
 
         $date = $GLOBALS['app']->UTC2UserTime($date);
-        $date_array = explode('-', date('Y-m-d-H-i-s', $date));
+        $date_array = explode('-', gmdate('Y-m-d-H-i-s', $date));
 
         $jalali_array = $this->GregorianToJalali($date_array[0], $date_array[1], $date_array[2]);
         $jalali_array['hour']   = $date_array[3];
@@ -235,7 +235,7 @@
                         $return .= $this->SinceFormat($date['date']);
                         $i = $i + 2;
                     } else {
-                        if (date('a', $date['date']) == 'pm') {
+                        if (gmdate('a', $date['date']) == 'pm') {
                             $return .= $this->_t_cal('DATE_HOURS_PM');
                         } else {
                             $return .= $this->_t_cal('DATE_HOURS_AM');
@@ -251,14 +251,14 @@
                 case 'D':
                 case 'l':
                     if (substr($format, $i, 2) == 'DN') {
-                        $return .= $this->DayString(date('w', $date['date']));
+                        $return .= $this->DayString(gmdate('w', $date['date']));
                         $i++;
                     } else {
-                        $return .= $this->DayShortString(date('w', $date['date']));
+                        $return .= $this->DayShortString(gmdate('w', $date['date']));
                     }
                     break;
                 case 'e':
-                    $return .= date('e', $date['date']);
+                    $return .= gmdate('e', $date['date']);
                     break;
                 case 'F':
                 case 'M':
@@ -270,14 +270,14 @@
                     }
                     break;
                 case 'g':
-                    $return .= date('g', $date['date']);
+                    $return .= gmdate('g', $date['date']);
                     break;
                 case 'G':
                 case 'H':
                     $return .= $date['hour'];
                     break;
                 case 'h':
-                    $return .= date('h', $date['date']);
+                    $return .= gmdate('h', $date['date']);
                     break;
                 case 'i':
                     $return .= $date['minute'];
@@ -290,13 +290,13 @@
                     $return .= $date['month'];
                     break;
                 case 'N':
-                    $return .= date('N', $date['date']);
+                    $return .= gmdate('N', $date['date']);
                     break;
                 case 'O':
-                    $return .= date('O', $date['date']);
+                    $return .= gmdate('O', $date['date']);
                     break;
                 case 'P':
-                    $return .= date('P', $date['date']);
+                    $return .= gmdate('P', $date['date']);
                     break;
                 case 'o':
                 case 'Y':
@@ -309,13 +309,13 @@
                     $return .= $date['second'];
                     break;
                 case 'T':
-                    $return .= date('T', $date['date']);
+                    $return .= gmdate('T', $date['date']);
                     break;
                 case 't':
                     $return .= $date['monthDays'];
                     break;
                 case 'U':
-                    $return .= date('U', $date['date']);
+                    $return .= gmdate('U', $date['date']);
                     break;
                 case 'y':
                     $return .= substr($date['year'], 2, 2);

Modified: trunk/jaws/html/include/Jaws/Date.php
===================================================================
--- trunk/jaws/html/include/Jaws/Date.php	2012-08-03 08:49:31 UTC (rev 13218)
+++ trunk/jaws/html/include/Jaws/Date.php	2012-08-03 09:24:24 UTC (rev 13219)
@@ -71,7 +71,7 @@
     function GetISO8601Timezone()
     {
         if (is_null($this->_ISO8601Timezone)) {
-            $tz = date('O');
+            $tz = gmdate('O');
             $tz = substr($tz, 0, 3) . ':' . substr($tz, 3, 2);
             $this->_ISO8601Timezone = $tz;
         }
@@ -96,7 +96,7 @@
                   substr($datetime, 12, 2);
         $datetime = strtotime($string);
         ///FIXME check if this is returning proper ISO8601 date string
-        return date('Y-m-d\TH:i:s', $datetime) . $this->GetISO8601Timezone();
+        return gmdate('Y-m-d\TH:i:s', $datetime) . $this->GetISO8601Timezone();
     }
 
     /**
@@ -110,7 +110,7 @@
     {
         if (strpos($datetime, '-')) {
             $datetime = strtotime($datetime);
-            return date('Y-m-d\TH:i:s', $datetime) . $this->GetISO8601Timezone();
+            return gmdate('Y-m-d\TH:i:s', $datetime) . $this->GetISO8601Timezone();
         }
 
         return $this->TimeStampToISO8601($datetime);
@@ -412,7 +412,7 @@
         }
 
         $dt = mktime($hour, $minute, $second, $month + 1, $days, $year);
-        return !empty($format)? date($format, $dt) :
+        return !empty($format)? gmdate($format, $dt) :
                                 array('timestamp' => $dt,
                                       'year'      => $year,
                                       'month'     => $month + 1,

Modified: trunk/jaws/html/include/Jaws/Log.php
===================================================================
--- trunk/jaws/html/include/Jaws/Log.php	2012-08-03 08:49:31 UTC (rev 13218)
+++ trunk/jaws/html/include/Jaws/Log.php	2012-08-03 09:24:24 UTC (rev 13219)
@@ -287,7 +287,7 @@
                 break;
         }
 
-        $now = date('Y-m-d H:i:s').', '.$this->ExecTime();
+        $now = gmdate('Y-m-d H:i:s').', '.$this->ExecTime();
         $msg = str_replace("\r\n", "\n", $msg);
         $msg = str_replace("\n", "\\n\\\n", $msg);
         $msg = str_replace('"', '\\"', $msg);
@@ -358,7 +358,7 @@
      */
     function SetLogStr($priority, $msg)
     {
-        $time = date('Y-m-d H:i:s');
+        $time = gmdate('Y-m-d H:i:s');
         $exec = substr($this->ExecTime(), 0, 10);
         $tmem = str_pad($this->MemUsage().'KB', 8, '-', STR_PAD_LEFT);
         $type = str_pad($this->_Log_Priority_Str[$priority - 1], 11, '-');

Modified: trunk/jaws/html/include/Jaws.php
===================================================================
--- trunk/jaws/html/include/Jaws.php	2012-08-03 08:49:31 UTC (rev 13218)
+++ trunk/jaws/html/include/Jaws.php	2012-08-03 09:24:24 UTC (rev 13219)
@@ -1180,7 +1180,7 @@
         }
         $time = is_numeric($time)? $time : strtotime($time);
         $time = $time + ($this->_UserTimezone * 3600);
-        return empty($format)? $time : date($format, $time);
+        return empty($format)? $time : gmdate($format, $time);
     }
 
     /**
@@ -1203,7 +1203,7 @@
         }
         $time = is_numeric($time)? $time : strtotime($time);
         $time = $time - ($this->_UserTimezone * 3600);
-        return empty($format)? $time : date($format, $time);
+        return empty($format)? $time : gmdate($format, $time);
     }
 
 }
\ No newline at end of file



More information about the Jaws-commits mailing list