Replaced intval() calls with a faster cast to int.
authorNik Okuntseff <support@anuko.com>
Sun, 28 Jan 2018 22:57:19 +0000 (22:57 +0000)
committerNik Okuntseff <support@anuko.com>
Sun, 28 Jan 2018 22:57:19 +0000 (22:57 +0000)
WEB-INF/lib/I18n.class.php
WEB-INF/lib/ttReportHelper.class.php
WEB-INF/lib/ttTeamHelper.class.php
WEB-INF/templates/footer.tpl
quotas.php

index a9f1b43..fd158f5 100644 (file)
@@ -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];
     }
 
index 3139518..e58241e 100644 (file)
@@ -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.
index 9a57d9c..e54aa9b 100644 (file)
@@ -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']);
index 814420c..9373499 100644 (file)
@@ -12,7 +12,7 @@
       <br>
       <table cellspacing="0" cellpadding="4" width="100%" border="0">
         <tr>
-          <td align="center">&nbsp;Anuko Time Tracker 1.17.9.3816 | Copyright &copy; <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
+          <td align="center">&nbsp;Anuko Time Tracker 1.17.9.3817 | Copyright &copy; <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
             <a href="https://www.anuko.com/lp/tt_4.htm" target="_blank">{$i18n.footer.credits}</a> |
             <a href="https://www.anuko.com/lp/tt_5.htm" target="_blank">{$i18n.footer.license}</a> |
             <a href="https://www.anuko.com/lp/tt_7.htm" target="_blank">{$i18n.footer.improve}</a>
index 375d8a7..d79e433 100644 (file)
@@ -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'));