]> wagnertech.de Git - timetracker.git/blobdiff - WEB-INF/lib/DateAndTime.class.php
Improved security of getRecordForFileView().
[timetracker.git] / WEB-INF / lib / DateAndTime.class.php
index 4752e99fc7411fa33e1d1354b53b7721b4ae64c7..20f274265a7762ca3c64b4865fe15c68b662e324 100644 (file)
@@ -321,18 +321,17 @@ class DateAndTime {
    */
   function preprocessFormatString($format) {
     global $i18n;
-    if (isset($GLOBALS['i18n'])) {
-      // replace locale-dependent strings
-      $format = str_replace('%a', mb_substr($i18n->getWeekDayName($this->mDay), 0, 3, 'utf-8'), $format);
-      $format = str_replace('%A', $i18n->getWeekDayName($this->mDay), $format);
-      $abbrev_month = mb_substr($i18n->monthNames[$this->mMonth], 0, 3, 'utf-8');
-      $format = str_replace('%b', $abbrev_month, $format);
-      $format = str_replace('%h', $abbrev_month, $format);
-      $format = str_replace('%z', date('O'), $format);
-      $format = str_replace('%Z', date('O'), $format); // format as 'O' for consistency with JS strftime
-      if (strpos($format, '%c') !== false) {
-        $format = str_replace('%c', $this->preprocessFormatString('%a %d %b %Y %T %Z'), $format);
-      }
+
+    // replace locale-dependent strings
+    $format = str_replace('%a', mb_substr($i18n->getWeekDayName($this->mDay), 0, 3, 'utf-8'), $format);
+    $format = str_replace('%A', $i18n->getWeekDayName($this->mDay), $format);
+    $abbrev_month = mb_substr($i18n->monthNames[$this->mMonth], 0, 3, 'utf-8');
+    $format = str_replace('%b', $abbrev_month, $format);
+    $format = str_replace('%h', $abbrev_month, $format);
+    $format = str_replace('%z', date('O'), $format);
+    $format = str_replace('%Z', date('O'), $format); // format as 'O' for consistency with JS strftime
+    if (strpos($format, '%c') !== false) {
+      $format = str_replace('%c', $this->preprocessFormatString('%a %d %b %Y %T %Z'), $format);
     }
     return $format;
   }