From ad89dda4fdde5dd9be57cfe0f1f7ec609acf02b6 Mon Sep 17 00:00:00 2001 From: Nik Okuntseff Date: Sun, 28 Jan 2018 22:57:19 +0000 Subject: [PATCH] Replaced intval() calls with a faster cast to int. --- WEB-INF/lib/I18n.class.php | 2 +- WEB-INF/lib/ttReportHelper.class.php | 2 +- WEB-INF/lib/ttTeamHelper.class.php | 10 +++++----- WEB-INF/templates/footer.tpl | 2 +- quotas.php | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/WEB-INF/lib/I18n.class.php b/WEB-INF/lib/I18n.class.php index a9f1b434..fd158f58 100644 --- a/WEB-INF/lib/I18n.class.php +++ b/WEB-INF/lib/I18n.class.php @@ -54,7 +54,7 @@ class I18n { // TODO: refactoring ongoing down from here... function getWeekDayName($id) { - $id = intval($id); + $id = (int) $id; return $this->weekdayNames[$id]; } diff --git a/WEB-INF/lib/ttReportHelper.class.php b/WEB-INF/lib/ttReportHelper.class.php index 31395184..e58241e0 100644 --- a/WEB-INF/lib/ttReportHelper.class.php +++ b/WEB-INF/lib/ttReportHelper.class.php @@ -1381,7 +1381,7 @@ class ttReportHelper { $items = ttReportHelper::getFavItems($report); $condition = str_replace('count', '', $condition); - $count_required = intval(trim(str_replace('>', '', $condition))); + $count_required = (int) trim(str_replace('>', '', $condition)); if (count($items) > $count_required) return true; // Condition ok. diff --git a/WEB-INF/lib/ttTeamHelper.class.php b/WEB-INF/lib/ttTeamHelper.class.php index 9a57d9c6..e54aa9bf 100644 --- a/WEB-INF/lib/ttTeamHelper.class.php +++ b/WEB-INF/lib/ttTeamHelper.class.php @@ -798,7 +798,7 @@ class ttTeamHelper { $time_format_part = ''; $week_start_part = ''; $tracking_mode_part = ''; - $task_required_part = ' , task_required = '.intval($fields['task_required']); + $task_required_part = ' , task_required = '.(int) $fields['task_required']; $record_type_part = ''; $uncompleted_indicators_part = ''; $bcc_email_part = ''; @@ -811,10 +811,10 @@ class ttTeamHelper { if (isset($fields['decimal_mark'])) $decimal_mark_part = ', decimal_mark = '.$mdb2->quote($fields['decimal_mark']); if (isset($fields['date_format'])) $date_format_part = ', date_format = '.$mdb2->quote($fields['date_format']); if (isset($fields['time_format'])) $time_format_part = ', time_format = '.$mdb2->quote($fields['time_format']); - if (isset($fields['week_start'])) $week_start_part = ', week_start = '.intval($fields['week_start']); - if (isset($fields['tracking_mode'])) $tracking_mode_part = ', tracking_mode = '.intval($fields['tracking_mode']); - if (isset($fields['record_type'])) $record_type_part = ', record_type = '.intval($fields['record_type']); - if (isset($fields['uncompleted_indicators'])) $uncompleted_indicators_part = ', uncompleted_indicators = '.intval($fields['uncompleted_indicators']); + if (isset($fields['week_start'])) $week_start_part = ', week_start = '.(int) $fields['week_start']; + if (isset($fields['tracking_mode'])) $tracking_mode_part = ', tracking_mode = '.(int) $fields['tracking_mode']; + if (isset($fields['record_type'])) $record_type_part = ', record_type = '.(int) $fields['record_type']; + if (isset($fields['uncompleted_indicators'])) $uncompleted_indicators_part = ', uncompleted_indicators = '.(int) $fields['uncompleted_indicators']; if (isset($fields['bcc_email'])) $bcc_email_part = ', bcc_email = '.$mdb2->quote($fields['bcc_email']); if (isset($fields['plugins'])) $plugins_part = ', plugins = '.$mdb2->quote($fields['plugins']); if (isset($fields['lock_spec'])) $lock_spec_part = ', lock_spec = '.$mdb2->quote($fields['lock_spec']); diff --git a/WEB-INF/templates/footer.tpl b/WEB-INF/templates/footer.tpl index 814420ce..93734994 100644 --- a/WEB-INF/templates/footer.tpl +++ b/WEB-INF/templates/footer.tpl @@ -12,7 +12,7 @@
-
 Anuko Time Tracker 1.17.9.3816 | Copyright © Anuko | +  Anuko Time Tracker 1.17.9.3817 | Copyright © Anuko | {$i18n.footer.credits} | {$i18n.footer.license} | {$i18n.footer.improve} diff --git a/quotas.php b/quotas.php index 375d8a78..d79e433a 100644 --- a/quotas.php +++ b/quotas.php @@ -61,7 +61,7 @@ $selectedYear = $request->getParameter('year'); if (!$selectedYear or !ttValidInteger($selectedYear)){ $selectedYear = date('Y'); } else { - $selectedYear = intval($selectedYear); + $selectedYear = (int) $selectedYear; } // Months are zero indexed. @@ -88,7 +88,7 @@ if ($request->isPost()){ } // Handle monthly quotas for a selected year. - $selectedYear = intval($request->getParameter('year')); + $selectedYear = (int) $request->getParameter('year'); for ($i = 0; $i < count($months); $i++){ if (!$quota->update($selectedYear, $i+1, $request->getParameter($months[$i]))) $err->add($i18n->getKey('error.db')); -- 2.20.1