Skip to content

Commit 75eff17

Browse files
committed
A bit of refactoring with getting rid of some GLOBALS.
1 parent de518d7 commit 75eff17

3 files changed

Lines changed: 12 additions & 15 deletions

File tree

WEB-INF/lib/DateAndTime.class.php

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -321,18 +321,17 @@ function incDay(/*int*/$days=1) {
321321
*/
322322
function preprocessFormatString($format) {
323323
global $i18n;
324-
if (isset($GLOBALS['i18n'])) {
325-
// replace locale-dependent strings
326-
$format = str_replace('%a', mb_substr($i18n->getWeekDayName($this->mDay), 0, 3, 'utf-8'), $format);
327-
$format = str_replace('%A', $i18n->getWeekDayName($this->mDay), $format);
328-
$abbrev_month = mb_substr($i18n->monthNames[$this->mMonth], 0, 3, 'utf-8');
329-
$format = str_replace('%b', $abbrev_month, $format);
330-
$format = str_replace('%h', $abbrev_month, $format);
331-
$format = str_replace('%z', date('O'), $format);
332-
$format = str_replace('%Z', date('O'), $format); // format as 'O' for consistency with JS strftime
333-
if (strpos($format, '%c') !== false) {
334-
$format = str_replace('%c', $this->preprocessFormatString('%a %d %b %Y %T %Z'), $format);
335-
}
324+
325+
// replace locale-dependent strings
326+
$format = str_replace('%a', mb_substr($i18n->getWeekDayName($this->mDay), 0, 3, 'utf-8'), $format);
327+
$format = str_replace('%A', $i18n->getWeekDayName($this->mDay), $format);
328+
$abbrev_month = mb_substr($i18n->monthNames[$this->mMonth], 0, 3, 'utf-8');
329+
$format = str_replace('%b', $abbrev_month, $format);
330+
$format = str_replace('%h', $abbrev_month, $format);
331+
$format = str_replace('%z', date('O'), $format);
332+
$format = str_replace('%Z', date('O'), $format); // format as 'O' for consistency with JS strftime
333+
if (strpos($format, '%c') !== false) {
334+
$format = str_replace('%c', $this->preprocessFormatString('%a %d %b %Y %T %Z'), $format);
336335
}
337336
return $format;
338337
}

WEB-INF/templates/footer.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<br>
1313
<table cellspacing="0" cellpadding="4" width="100%" border="0">
1414
<tr>
15-
<td align="center">&nbsp;Anuko Time Tracker 1.13.15.3744 | Copyright &copy; <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
15+
<td align="center">&nbsp;Anuko Time Tracker 1.13.15.3745 | Copyright &copy; <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
1616
<a href="https://www.anuko.com/lp/tt_4.htm" target="_blank">{$i18n.footer.credits}</a> |
1717
<a href="https://www.anuko.com/lp/tt_5.htm" target="_blank">{$i18n.footer.license}</a> |
1818
<a href="https://www.anuko.com/lp/tt_7.htm" target="_blank">{$i18n.footer.improve}</a>

initialize.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,6 @@
199199
$i18n->load($lang);
200200
$GLOBALS['I18N'] = &$i18n;
201201

202-
$GLOBALS['USER'] = &$user;
203-
204202
// Assign things for smarty to use in template files.
205203
$smarty->assign('i18n', $i18n->keys);
206204
$smarty->assign('err', $err);

0 commit comments

Comments
 (0)