Got rid of PHP warnning when argument is not an array
authorNik Okuntseff <support@anuko.com>
Mon, 14 Mar 2016 20:45:12 +0000 (20:45 +0000)
committerNik Okuntseff <support@anuko.com>
Mon, 14 Mar 2016 20:45:12 +0000 (20:45 +0000)
WEB-INF/templates/footer.tpl
mobile/time.php
mobile/time_edit.php
time.php
time_edit.php

index 4bb4447..f962684 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.9.15.3414 | Copyright &copy; <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
+          <td align="center">&nbsp;Anuko Time Tracker 1.9.15.3415 | 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 0e787fc..dda3767 100644 (file)
@@ -125,12 +125,13 @@ if (MODE_PROJECTS == $user->tracking_mode || MODE_PROJECTS_AND_TASKS == $user->t
     // Build a client list out of active clients. Use only clients that are relevant to user.
     // Also trim their associated project list to only assigned projects (to user).
     foreach($active_clients as $client) {
-         $projects_assigned_to_client = explode(',', $client['projects']);
-         $intersection = array_intersect($projects_assigned_to_client, $projects_assigned_to_user);
-         if ($intersection) {
-           $client['projects'] = implode(',', $intersection);
-           $client_list[] = $client;
-         }
+      $projects_assigned_to_client = explode(',', $client['projects']);
+      if (is_array($projects_assigned_to_client) && is_array($projects_assigned_to_user))
+        $intersection = array_intersect($projects_assigned_to_client, $projects_assigned_to_user);
+      if ($intersection) {
+        $client['projects'] = implode(',', $intersection);
+        $client_list[] = $client;
+      }
     }
     $form->addInput(array('type'=>'combobox',
       'onchange'=>'fillProjectDropdown(this.value);',
@@ -305,3 +306,4 @@ $smarty->assign('timestring', $selected_date->toString($user->date_format));
 $smarty->assign('title', $i18n->getKey('title.time'));
 $smarty->assign('content_page_name', 'mobile/time.tpl');
 $smarty->display('mobile/index.tpl');
+?>
\ No newline at end of file
index 0025589..b961d1f 100644 (file)
@@ -143,12 +143,13 @@ if (MODE_PROJECTS == $user->tracking_mode || MODE_PROJECTS_AND_TASKS == $user->t
     // Build a client list out of active clients. Use only clients that are relevant to user.
     // Also trim their associated project list to only assigned projects (to user).
     foreach($active_clients as $client) {
-         $projects_assigned_to_client = explode(',', $client['projects']);
-         $intersection = array_intersect($projects_assigned_to_client, $projects_assigned_to_user);
-         if ($intersection) {
-           $client['projects'] = implode(',', $intersection);
-           $client_list[] = $client;
-         }
+      $projects_assigned_to_client = explode(',', $client['projects']);
+      if (is_array($projects_assigned_to_client) && is_array($projects_assigned_to_user))
+        $intersection = array_intersect($projects_assigned_to_client, $projects_assigned_to_user);
+      if ($intersection) {
+        $client['projects'] = implode(',', $intersection);
+        $client_list[] = $client;
+      }
     }
     $form->addInput(array('type'=>'combobox',
       'onchange'=>'fillProjectDropdown(this.value);',
@@ -347,3 +348,4 @@ $smarty->assign('onload', 'onLoad="fillDropdowns()"');
 $smarty->assign('title', $i18n->getKey('title.edit_time_record'));
 $smarty->assign('content_page_name', 'mobile/time_edit.tpl');
 $smarty->display('mobile/index.tpl');
+?>
\ No newline at end of file
index 60b396a..f290e55 100644 (file)
--- a/time.php
+++ b/time.php
@@ -145,11 +145,12 @@ if (MODE_PROJECTS == $user->tracking_mode || MODE_PROJECTS_AND_TASKS == $user->t
     // Also trim their associated project list to only assigned projects (to user).
     foreach($active_clients as $client) {
       $projects_assigned_to_client = explode(',', $client['projects']);
-         $intersection = array_intersect($projects_assigned_to_client, $projects_assigned_to_user);
-         if ($intersection) {
-           $client['projects'] = implode(',', $intersection);
-           $client_list[] = $client;
-         }
+      if (is_array($projects_assigned_to_client) && is_array($projects_assigned_to_user))
+        $intersection = array_intersect($projects_assigned_to_client, $projects_assigned_to_user);
+      if ($intersection) {
+        $client['projects'] = implode(',', $intersection);
+        $client_list[] = $client;
+      }
     }
     $form->addInput(array('type'=>'combobox',
       'onchange'=>'fillProjectDropdown(this.value);',
index 36f8cc9..01d1797 100644 (file)
@@ -143,12 +143,13 @@ if (MODE_PROJECTS == $user->tracking_mode || MODE_PROJECTS_AND_TASKS == $user->t
     // Build a client list out of active clients. Use only clients that are relevant to user.
     // Also trim their associated project list to only assigned projects (to user).
     foreach($active_clients as $client) {
-         $projects_assigned_to_client = explode(',', $client['projects']);
-         $intersection = array_intersect($projects_assigned_to_client, $projects_assigned_to_user);
-         if ($intersection) {
+      $projects_assigned_to_client = explode(',', $client['projects']);
+      if (is_array($projects_assigned_to_client) && is_array($projects_assigned_to_user))
+        $intersection = array_intersect($projects_assigned_to_client, $projects_assigned_to_user);
+      if ($intersection) {
         $client['projects'] = implode(',', $intersection);
-           $client_list[] = $client;
-         }
+        $client_list[] = $client;
+      }
     }
     $form->addInput(array('type'=>'combobox',
       'onchange'=>'fillProjectDropdown(this.value);',