From 74704a7d4ecfb939bbcddeeec397b9de3b85bd2f Mon Sep 17 00:00:00 2001 From: Nik Okuntseff Date: Mon, 14 Mar 2016 20:45:12 +0000 Subject: [PATCH] Got rid of PHP warnning when argument is not an array --- WEB-INF/templates/footer.tpl | 2 +- mobile/time.php | 14 ++++++++------ mobile/time_edit.php | 14 ++++++++------ time.php | 11 ++++++----- time_edit.php | 11 ++++++----- 5 files changed, 29 insertions(+), 23 deletions(-) diff --git a/WEB-INF/templates/footer.tpl b/WEB-INF/templates/footer.tpl index 4bb4447a..f9626846 100644 --- a/WEB-INF/templates/footer.tpl +++ b/WEB-INF/templates/footer.tpl @@ -12,7 +12,7 @@
-
 Anuko Time Tracker 1.9.15.3414 | Copyright © Anuko | +  Anuko Time Tracker 1.9.15.3415 | Copyright © Anuko | {$i18n.footer.credits} | {$i18n.footer.license} | {$i18n.footer.improve} diff --git a/mobile/time.php b/mobile/time.php index 0e787fc6..dda3767c 100644 --- a/mobile/time.php +++ b/mobile/time.php @@ -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 diff --git a/mobile/time_edit.php b/mobile/time_edit.php index 00255894..b961d1f7 100644 --- a/mobile/time_edit.php +++ b/mobile/time_edit.php @@ -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 diff --git a/time.php b/time.php index 60b396a6..f290e55b 100644 --- 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);', diff --git a/time_edit.php b/time_edit.php index 36f8cc98..01d1797b 100644 --- a/time_edit.php +++ b/time_edit.php @@ -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);', -- 2.20.1