From a4400b24975e4e4073bc3c05fadd993022ababce Mon Sep 17 00:00:00 2001 From: markjcrane Date: Wed, 11 May 2016 13:23:53 -0600 Subject: [PATCH] Fix some warnings more warnings. --- app/calls/resources/classes/call_forward.php | 18 ++++++------ .../resources/classes/do_not_disturb.php | 22 +++++++-------- app/calls/resources/classes/follow_me.php | 28 ++++++++----------- 3 files changed, 30 insertions(+), 38 deletions(-) diff --git a/app/calls/resources/classes/call_forward.php b/app/calls/resources/classes/call_forward.php index af35bbed74..e4054a0cd6 100644 --- a/app/calls/resources/classes/call_forward.php +++ b/app/calls/resources/classes/call_forward.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Copyright (C) 2010 - 2014 + Copyright (C) 2010 - 2016 All Rights Reserved. Contributor(s): @@ -56,15 +56,13 @@ include "root.php"; $prep_statement = $db->prepare(check_sql($sql)); $prep_statement->execute(); $result = $prep_statement->fetchAll(PDO::FETCH_NAMED); - if (count($result) > 0) { - foreach ($result as &$row) { - $this->extension = $row["extension"]; - $this->number_alias = $row["number_alias"]; - $this->accountcode = $row["accountcode"]; - $this->toll_allow = $row["toll_allow"]; - $this->outbound_caller_id_name = $row["outbound_caller_id_name"]; - $this->outbound_caller_id_number = $row["outbound_caller_id_number"]; - } + if (is_array($result)) foreach ($result as &$row) { + $this->extension = $row["extension"]; + $this->number_alias = $row["number_alias"]; + $this->accountcode = $row["accountcode"]; + $this->toll_allow = $row["toll_allow"]; + $this->outbound_caller_id_name = $row["outbound_caller_id_name"]; + $this->outbound_caller_id_number = $row["outbound_caller_id_number"]; } unset ($prep_statement); diff --git a/app/calls/resources/classes/do_not_disturb.php b/app/calls/resources/classes/do_not_disturb.php index 0b675867d8..7712a81198 100644 --- a/app/calls/resources/classes/do_not_disturb.php +++ b/app/calls/resources/classes/do_not_disturb.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Copyright (C) 2010 + Copyright (C) 2010 - 2016 All Rights Reserved. Contributor(s): @@ -77,18 +77,16 @@ include "root.php"; $prep_statement = $db->prepare(check_sql($sql)); $prep_statement->execute(); $result = $prep_statement->fetchAll(PDO::FETCH_NAMED); - if (count($result) > 0) { - foreach ($result as &$row) { - if (strlen($this->extension_uuid) == 0) { - $this->extension_uuid = $row["extension_uuid"]; + if (is_array($result)) foreach ($result as &$row) { + if (strlen($this->extension_uuid) == 0) { + $this->extension_uuid = $row["extension_uuid"]; + } + if (strlen($this->extension) == 0) { + if(strlen($row["number_alias"]) == 0) { + $this->extension = $row["extension"]; } - if (strlen($this->extension) == 0) { - if(strlen($row["number_alias"]) == 0) { - $this->extension = $row["extension"]; - } - else { - $this->extension = $row["number_alias"]; - } + else { + $this->extension = $row["number_alias"]; } } } diff --git a/app/calls/resources/classes/follow_me.php b/app/calls/resources/classes/follow_me.php index 741514241d..6c48b34026 100644 --- a/app/calls/resources/classes/follow_me.php +++ b/app/calls/resources/classes/follow_me.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Copyright (C) 2010 - 2014 + Copyright (C) 2010 - 2016 All Rights Reserved. Contributor(s): @@ -244,14 +244,12 @@ include "root.php"; $prep_statement = $db->prepare(check_sql($sql)); $prep_statement->execute(); $result = $prep_statement->fetchAll(PDO::FETCH_NAMED); - if (count($result) > 0) { - foreach ($result as &$row) { - $this->extension = $row["extension"]; - $this->accountcode = $row["accountcode"]; - $this->toll_allow = $row["toll_allow"]; - $this->outbound_caller_id_name = $row["outbound_caller_id_name"]; - $this->outbound_caller_id_number = $row["outbound_caller_id_number"]; - } + if (is_array($result)) foreach ($result as &$row) { + $this->extension = $row["extension"]; + $this->accountcode = $row["accountcode"]; + $this->toll_allow = $row["toll_allow"]; + $this->outbound_caller_id_name = $row["outbound_caller_id_name"]; + $this->outbound_caller_id_number = $row["outbound_caller_id_number"]; } //determine whether to update the dial string @@ -261,12 +259,10 @@ include "root.php"; $prep_statement = $db->prepare(check_sql($sql)); $prep_statement->execute(); $result = $prep_statement->fetchAll(PDO::FETCH_NAMED); - if (count($result) > 0) { - foreach ($result as &$row) { - $follow_me_uuid = $row["follow_me_uuid"]; - $this->cid_name_prefix = $row["cid_name_prefix"]; - $this->cid_number_prefix = $row["cid_number_prefix"]; - } + if (is_array($result)) foreach ($result as &$row) { + $follow_me_uuid = $row["follow_me_uuid"]; + $this->cid_name_prefix = $row["cid_name_prefix"]; + $this->cid_number_prefix = $row["cid_number_prefix"]; } unset ($prep_statement); @@ -345,7 +341,7 @@ include "root.php"; $dial_string .= ",toll_allow='".$this->toll_allow."'"; $dial_string .= "}"; $x = 0; - foreach ($result as &$row) { + if (is_array($result)) foreach ($result as &$row) { if ($x > 0) { $dial_string .= ","; }