diff --git a/app/access_controls/resources/classes/access_controls.php b/app/access_controls/resources/classes/access_controls.php index c6fd4dab73..ca56cd09dd 100644 --- a/app/access_controls/resources/classes/access_controls.php +++ b/app/access_controls/resources/classes/access_controls.php @@ -121,16 +121,16 @@ if (!class_exists('access_controls')) { //get checked records foreach($records as $x => $record) { if ($record['checked'] == 'true' && is_uuid($record['uuid'])) { - $record_uuids[] = $this->uuid_prefix."uuid = '".$record['uuid']."'"; + $uuids[] = "'".$record['uuid']."'"; } } //create insert array from existing data - if (is_array($record_uuids) && @sizeof($record_uuids) != 0) { + if (is_array($uuids) && @sizeof($uuids) != 0) { //primary table $sql = "select * from v_".$this->table." "; - $sql .= "where ".implode(' or ', $record_uuids)." "; + $sql .= "where ".$this->uuid_prefix."uuid in (".implode(', ', $uuids).") "; $database = new database; $rows = $database->select($sql, $parameters, 'all'); if (is_array($rows) && @sizeof($rows) != 0) { diff --git a/app/call_block/resources/classes/call_block.php b/app/call_block/resources/classes/call_block.php index dc86c4a587..3d6ab1c4f8 100644 --- a/app/call_block/resources/classes/call_block.php +++ b/app/call_block/resources/classes/call_block.php @@ -118,13 +118,13 @@ if (!class_exists('call_block')) { //get current toggle state foreach($records as $x => $record) { if ($record['checked'] == 'true' && is_uuid($record['uuid'])) { - $record_uuids[] = $this->uuid_prefix."uuid = '".$record['uuid']."'"; + $uuids[] = "'".$record['uuid']."'"; } } - if (is_array($record_uuids) && @sizeof($record_uuids) != 0) { + if (is_array($uuids) && @sizeof($uuids) != 0) { $sql = "select ".$this->uuid_prefix."uuid as uuid, ".$this->toggle_field." as toggle from v_".$this->table." "; $sql .= "where (domain_uuid = :domain_uuid or domain_uuid is null) "; - $sql .= "and ( ".implode(' or ', $record_uuids)." ) "; + $sql .= "and ".$this->uuid_prefix."uuid in (".implode(', ', $uuids).") "; $parameters['domain_uuid'] = $_SESSION['domain_uuid']; $database = new database; $rows = $database->select($sql, $parameters, 'all'); @@ -187,15 +187,15 @@ if (!class_exists('call_block')) { //get checked records foreach($records as $x => $record) { if ($record['checked'] == 'true' && is_uuid($record['uuid'])) { - $record_uuids[] = $this->uuid_prefix."uuid = '".$record['uuid']."'"; + $uuids[] = "'".$record['uuid']."'"; } } //create insert array from existing data - if (is_array($record_uuids) && @sizeof($record_uuids) != 0) { + if (is_array($uuids) && @sizeof($uuids) != 0) { $sql = "select * from v_".$this->table." "; $sql .= "where (domain_uuid = :domain_uuid or domain_uuid is null) "; - $sql .= "and ( ".implode(' or ', $record_uuids)." ) "; + $sql .= "and ".$this->uuid_prefix."uuid in (".implode(', ', $uuids).") "; $parameters['domain_uuid'] = $_SESSION['domain_uuid']; $database = new database; $rows = $database->select($sql, $parameters, 'all'); diff --git a/app/call_broadcast/resources/classes/call_broadcast.php b/app/call_broadcast/resources/classes/call_broadcast.php index 9f4b64cf9c..d1058729dc 100644 --- a/app/call_broadcast/resources/classes/call_broadcast.php +++ b/app/call_broadcast/resources/classes/call_broadcast.php @@ -114,15 +114,15 @@ if (!class_exists('call_broadcast')) { //get checked records foreach($records as $x => $record) { if ($record['checked'] == 'true' && is_uuid($record['uuid'])) { - $record_uuids[] = $this->uuid_prefix."uuid = '".$record['uuid']."'"; + $uuids[] = "'".$record['uuid']."'"; } } //create insert array from existing data - if (is_array($record_uuids) && @sizeof($record_uuids) != 0) { + if (is_array($uuids) && @sizeof($uuids) != 0) { $sql = "select * from v_".$this->table." "; $sql .= "where (domain_uuid = :domain_uuid or domain_uuid is null) "; - $sql .= "and ( ".implode(' or ', $record_uuids)." ) "; + $sql .= "and ".$this->uuid_prefix."uuid in (".implode(', ', $uuids).") "; $parameters['domain_uuid'] = $_SESSION['domain_uuid']; $database = new database; $rows = $database->select($sql, $parameters, 'all'); diff --git a/app/call_centers/resources/classes/call_center.php b/app/call_centers/resources/classes/call_center.php index e03eb5b005..0cdc144d2f 100644 --- a/app/call_centers/resources/classes/call_center.php +++ b/app/call_centers/resources/classes/call_center.php @@ -432,16 +432,16 @@ //get checked records foreach($records as $x => $record) { if ($record['checked'] == 'true' && is_uuid($record['uuid'])) { - $record_uuids[] = $this->uuid_prefix."uuid = '".$record['uuid']."'"; + $uuids[] = "'".$record['uuid']."'"; } } //create insert array from existing data - if (is_array($record_uuids) && @sizeof($record_uuids) != 0) { + if (is_array($uuids) && @sizeof($uuids) != 0) { //primary table $sql = "select * from v_".$this->table." "; - $sql .= "where ".implode(' or ', $record_uuids)." "; + $sql .= "where ".$this->uuid_prefix."uuid in (".implode(', ', $uuids).") "; $database = new database; $rows = $database->select($sql, $parameters, 'all'); if (is_array($rows) && @sizeof($rows) != 0) { @@ -535,16 +535,16 @@ //get checked records foreach($records as $x => $record) { if ($record['checked'] == 'true' && is_uuid($record['uuid'])) { - $record_uuids[] = $this->uuid_prefix."uuid = '".$record['uuid']."'"; + $uuids[] = "'".$record['uuid']."'"; } } //create insert array from existing data - if (is_array($record_uuids) && @sizeof($record_uuids) != 0) { + if (is_array($uuids) && @sizeof($uuids) != 0) { //primary table $sql = "select * from v_".$this->table." "; - $sql .= "where ".implode(' or ', $record_uuids)." "; + $sql .= "where ".$this->uuid_prefix."uuid in (".implode(', ', $uuids).") "; $database = new database; $rows = $database->select($sql, $parameters, 'all'); if (is_array($rows) && @sizeof($rows) != 0) { diff --git a/app/call_flows/resources/classes/call_flows.php b/app/call_flows/resources/classes/call_flows.php index b5c6e23445..42a1bbdc84 100644 --- a/app/call_flows/resources/classes/call_flows.php +++ b/app/call_flows/resources/classes/call_flows.php @@ -118,13 +118,13 @@ if (!class_exists('call_flows')) { //get current toggle state foreach($records as $x => $record) { if ($record['checked'] == 'true' && is_uuid($record['uuid'])) { - $record_uuids[] = $this->uuid_prefix."uuid = '".$record['uuid']."'"; + $uuids[] = "'".$record['uuid']."'"; } } - if (is_array($record_uuids) && @sizeof($record_uuids) != 0) { + if (is_array($uuids) && @sizeof($uuids) != 0) { $sql = "select ".$this->uuid_prefix."uuid as uuid, ".$this->toggle_field." as toggle from v_".$this->table." "; $sql .= "where (domain_uuid = :domain_uuid or domain_uuid is null) "; - $sql .= "and ( ".implode(' or ', $record_uuids)." ) "; + $sql .= "and ".$this->uuid_prefix."uuid in (".implode(', ', $uuids).") "; $parameters['domain_uuid'] = $_SESSION['domain_uuid']; $database = new database; $rows = $database->select($sql, $parameters, 'all'); @@ -187,15 +187,15 @@ if (!class_exists('call_flows')) { //get checked records foreach($records as $x => $record) { if ($record['checked'] == 'true' && is_uuid($record['uuid'])) { - $record_uuids[] = $this->uuid_prefix."uuid = '".$record['uuid']."'"; + $uuids[] = "'".$record['uuid']."'"; } } //create insert array from existing data - if (is_array($record_uuids) && @sizeof($record_uuids) != 0) { + if (is_array($uuids) && @sizeof($uuids) != 0) { $sql = "select * from v_".$this->table." "; $sql .= "where (domain_uuid = :domain_uuid or domain_uuid is null) "; - $sql .= "and ( ".implode(' or ', $record_uuids)." ) "; + $sql .= "and ".$this->uuid_prefix."uuid in (".implode(', ', $uuids).") "; $parameters['domain_uuid'] = $_SESSION['domain_uuid']; $database = new database; $rows = $database->select($sql, $parameters, 'all'); diff --git a/app/calls/resources/classes/call_forward.php b/app/calls/resources/classes/call_forward.php index f04485f3e0..b11979144f 100644 --- a/app/calls/resources/classes/call_forward.php +++ b/app/calls/resources/classes/call_forward.php @@ -147,13 +147,13 @@ include "root.php"; //get current toggle state foreach($records as $x => $record) { if ($record['checked'] == 'true' && is_uuid($record['uuid'])) { - $record_uuids[] = $this->uuid_prefix."uuid = '".$record['uuid']."'"; + $uuids[] = "'".$record['uuid']."'"; } } - if (is_array($record_uuids) && @sizeof($record_uuids) != 0) { + if (is_array($uuids) && @sizeof($uuids) != 0) { $sql = "select ".$this->uuid_prefix."uuid as uuid, ".$this->toggle_field." as toggle, forward_all_destination, follow_me_uuid from v_".$this->table." "; $sql .= "where (domain_uuid = :domain_uuid or domain_uuid is null) "; - $sql .= "and ( ".implode(' or ', $record_uuids)." ) "; + $sql .= "and ".$this->uuid_prefix."uuid in (".implode(', ', $uuids).") "; $parameters['domain_uuid'] = $_SESSION['domain_uuid']; $database = new database; $rows = $database->select($sql, $parameters, 'all'); diff --git a/app/calls/resources/classes/do_not_disturb.php b/app/calls/resources/classes/do_not_disturb.php index dbf5b947e3..6288605c07 100644 --- a/app/calls/resources/classes/do_not_disturb.php +++ b/app/calls/resources/classes/do_not_disturb.php @@ -170,13 +170,13 @@ include "root.php"; //get current toggle state foreach($records as $x => $record) { if ($record['checked'] == 'true' && is_uuid($record['uuid'])) { - $record_uuids[] = $this->uuid_prefix."uuid = '".$record['uuid']."'"; + $uuids[] = "'".$record['uuid']."'"; } } - if (is_array($record_uuids) && @sizeof($record_uuids) != 0) { + if (is_array($uuids) && @sizeof($uuids) != 0) { $sql = "select ".$this->uuid_prefix."uuid as uuid, ".$this->toggle_field." as toggle, follow_me_uuid from v_".$this->table." "; $sql .= "where (domain_uuid = :domain_uuid or domain_uuid is null) "; - $sql .= "and ( ".implode(' or ', $record_uuids)." ) "; + $sql .= "and ".$this->uuid_prefix."uuid in (".implode(', ', $uuids).") "; $parameters['domain_uuid'] = $_SESSION['domain_uuid']; $database = new database; $rows = $database->select($sql, $parameters, 'all'); diff --git a/app/calls/resources/classes/follow_me.php b/app/calls/resources/classes/follow_me.php index a0eba6d852..72506e523e 100644 --- a/app/calls/resources/classes/follow_me.php +++ b/app/calls/resources/classes/follow_me.php @@ -313,13 +313,13 @@ include "root.php"; //get current toggle state foreach($records as $x => $record) { if ($record['checked'] == 'true' && is_uuid($record['uuid'])) { - $record_uuids[] = $this->uuid_prefix."uuid = '".$record['uuid']."'"; + $uuids[] = "'".$record['uuid']."'"; } } - if (is_array($record_uuids) && @sizeof($record_uuids) != 0) { + if (is_array($uuids) && @sizeof($uuids) != 0) { $sql = "select ".$this->uuid_prefix."uuid as uuid, ".$this->toggle_field." as toggle, follow_me_uuid from v_".$this->table." "; $sql .= "where (domain_uuid = :domain_uuid or domain_uuid is null) "; - $sql .= "and ( ".implode(' or ', $record_uuids)." ) "; + $sql .= "and ".$this->uuid_prefix."uuid in (".implode(', ', $uuids).") "; $parameters['domain_uuid'] = $_SESSION['domain_uuid']; $database = new database; $rows = $database->select($sql, $parameters, 'all'); diff --git a/app/conference_centers/resources/classes/conference_centers.php b/app/conference_centers/resources/classes/conference_centers.php index 5a97fddb95..f9a10afa46 100644 --- a/app/conference_centers/resources/classes/conference_centers.php +++ b/app/conference_centers/resources/classes/conference_centers.php @@ -425,13 +425,13 @@ if (!class_exists('conference_centers')) { //get current toggle state foreach($records as $x => $record) { if ($record['checked'] == 'true' && is_uuid($record['uuid'])) { - $record_uuids[] = $this->uuid_prefix."uuid = '".$record['uuid']."'"; + $uuids[] = "'".$record['uuid']."'"; } } - if (is_array($record_uuids) && @sizeof($record_uuids) != 0) { + if (is_array($uuids) && @sizeof($uuids) != 0) { $sql = "select ".$this->uuid_prefix."uuid as uuid, ".$this->toggle_field." as toggle, dialplan_uuid from v_".$this->table." "; $sql .= "where (domain_uuid = :domain_uuid or domain_uuid is null) "; - $sql .= "and ( ".implode(' or ', $record_uuids)." ) "; + $sql .= "and ".$this->uuid_prefix."uuid in (".implode(', ', $uuids).") "; $parameters['domain_uuid'] = $_SESSION['domain_uuid']; $database = new database; $rows = $database->select($sql, $parameters, 'all'); @@ -524,15 +524,15 @@ if (!class_exists('conference_centers')) { //get checked records foreach($records as $x => $record) { if ($record['checked'] == 'true' && is_uuid($record['uuid'])) { - $record_uuids[] = $this->uuid_prefix."uuid = '".$record['uuid']."'"; + $uuids[] = "'".$record['uuid']."'"; } } //create insert array from existing data - if (is_array($record_uuids) && @sizeof($record_uuids) != 0) { + if (is_array($uuids) && @sizeof($uuids) != 0) { $sql = "select * from v_".$this->table." "; $sql .= "where (domain_uuid = :domain_uuid or domain_uuid is null) "; - $sql .= "and ( ".implode(' or ', $record_uuids)." ) "; + $sql .= "and ".$this->uuid_prefix."uuid in (".implode(', ', $uuids).") "; $parameters['domain_uuid'] = $_SESSION['domain_uuid']; $database = new database; $rows = $database->select($sql, $parameters, 'all'); diff --git a/app/conferences/resources/classes/conferences.php b/app/conferences/resources/classes/conferences.php index 666a0bcf08..4a592f45c0 100644 --- a/app/conferences/resources/classes/conferences.php +++ b/app/conferences/resources/classes/conferences.php @@ -179,13 +179,13 @@ if (!class_exists('conferences')) { //get current toggle state foreach($records as $x => $record) { if ($record['checked'] == 'true' && is_uuid($record['uuid'])) { - $record_uuids[] = $this->uuid_prefix."uuid = '".$record['uuid']."'"; + $uuids[] = "'".$record['uuid']."'"; } } - if (is_array($record_uuids) && @sizeof($record_uuids) != 0) { + if (is_array($uuids) && @sizeof($uuids) != 0) { $sql = "select ".$this->uuid_prefix."uuid as uuid, ".$this->toggle_field." as toggle, dialplan_uuid from v_".$this->table." "; $sql .= "where (domain_uuid = :domain_uuid or domain_uuid is null) "; - $sql .= "and ( ".implode(' or ', $record_uuids)." ) "; + $sql .= "and ".$this->uuid_prefix."uuid in (".implode(', ', $uuids).") "; $parameters['domain_uuid'] = $_SESSION['domain_uuid']; $database = new database; $rows = $database->select($sql, $parameters, 'all'); @@ -268,15 +268,15 @@ if (!class_exists('conferences')) { //get checked records foreach($records as $x => $record) { if ($record['checked'] == 'true' && is_uuid($record['uuid'])) { - $record_uuids[] = $this->uuid_prefix."uuid = '".$record['uuid']."'"; + $uuids[] = "'".$record['uuid']."'"; } } //create insert array from existing data - if (is_array($record_uuids) && @sizeof($record_uuids) != 0) { + if (is_array($uuids) && @sizeof($uuids) != 0) { $sql = "select * from v_".$this->table." "; $sql .= "where (domain_uuid = :domain_uuid or domain_uuid is null) "; - $sql .= "and ( ".implode(' or ', $record_uuids)." ) "; + $sql .= "and ".$this->uuid_prefix."uuid in (".implode(', ', $uuids).") "; $parameters['domain_uuid'] = $_SESSION['domain_uuid']; $database = new database; $rows = $database->select($sql, $parameters, 'all'); diff --git a/app/devices/resources/classes/device.php b/app/devices/resources/classes/device.php index 0382c8d47f..9e40a04eaf 100644 --- a/app/devices/resources/classes/device.php +++ b/app/devices/resources/classes/device.php @@ -510,13 +510,13 @@ include "root.php"; //get current toggle state foreach($records as $x => $record) { if ($record['checked'] == 'true' && is_uuid($record['uuid'])) { - $record_uuids[] = $this->uuid_prefix."uuid = '".$record['uuid']."'"; + $uuids[] = "'".$record['uuid']."'"; } } - if (is_array($record_uuids) && @sizeof($record_uuids) != 0) { + if (is_array($uuids) && @sizeof($uuids) != 0) { $sql = "select ".$this->uuid_prefix."uuid as uuid, ".$this->toggle_field." as toggle from v_".$this->table." "; $sql .= "where (domain_uuid = :domain_uuid or domain_uuid is null) "; - $sql .= "and ( ".implode(' or ', $record_uuids)." ) "; + $sql .= "and ".$this->uuid_prefix."uuid in (".implode(', ', $uuids).") "; $parameters['domain_uuid'] = $_SESSION['domain_uuid']; $database = new database; $rows = $database->select($sql, $parameters, 'all'); @@ -592,12 +592,12 @@ include "root.php"; //get current toggle state foreach($records as $x => $record) { if ($record['checked'] == 'true' && is_uuid($record['uuid'])) { - $record_uuids[] = $this->uuid_prefix."uuid = '".$record['uuid']."'"; + $uuids[] = "'".$record['uuid']."'"; } } - if (is_array($record_uuids) && @sizeof($record_uuids) != 0) { + if (is_array($uuids) && @sizeof($uuids) != 0) { $sql = "select ".$this->uuid_prefix."uuid as uuid, ".$this->toggle_field." as toggle from v_".$this->table." "; - $sql .= "where ( ".implode(' or ', $record_uuids)." ) "; + $sql .= "where ".$this->uuid_prefix."uuid in (".implode(', ', $uuids).") "; $database = new database; $rows = $database->select($sql, $parameters, 'all'); if (is_array($rows) && @sizeof($rows) != 0) { @@ -665,12 +665,12 @@ include "root.php"; //get current toggle state foreach($records as $x => $record) { if ($record['checked'] == 'true' && is_uuid($record['uuid'])) { - $record_uuids[] = $this->uuid_prefix."uuid = '".$record['uuid']."'"; + $uuids[] = "'".$record['uuid']."'"; } } - if (is_array($record_uuids) && @sizeof($record_uuids) != 0) { + if (is_array($uuids) && @sizeof($uuids) != 0) { $sql = "select ".$this->uuid_prefix."uuid as uuid, ".$this->toggle_field." as toggle from v_".$this->table." "; - $sql .= "where ( ".implode(' or ', $record_uuids)." ) "; + $sql .= "where ".$this->uuid_prefix."uuid in (".implode(', ', $uuids).") "; $database = new database; $rows = $database->select($sql, $parameters, 'all'); if (is_array($rows) && @sizeof($rows) != 0) { @@ -739,15 +739,15 @@ include "root.php"; //get checked records foreach($records as $x => $record) { if ($record['checked'] == 'true' && is_uuid($record['uuid'])) { - $record_uuids[] = $this->uuid_prefix."uuid = '".$record['uuid']."'"; + $uuids[] = "'".$record['uuid']."'"; } } //create insert array from existing data - if (is_array($record_uuids) && @sizeof($record_uuids) != 0) { + if (is_array($uuids) && @sizeof($uuids) != 0) { $sql = "select * from v_".$this->table." "; $sql .= "where (domain_uuid = :domain_uuid or domain_uuid is null) "; - $sql .= "and ( ".implode(' or ', $record_uuids)." ) "; + $sql .= "and ".$this->uuid_prefix."uuid in (".implode(', ', $uuids).") "; $parameters['domain_uuid'] = $_SESSION['domain_uuid']; $database = new database; $rows = $database->select($sql, $parameters, 'all'); diff --git a/app/dialplans/resources/classes/dialplan.php b/app/dialplans/resources/classes/dialplan.php index fa4a42ae84..2de94ab444 100644 --- a/app/dialplans/resources/classes/dialplan.php +++ b/app/dialplans/resources/classes/dialplan.php @@ -1169,13 +1169,13 @@ include "root.php"; //get current toggle state foreach($records as $x => $record) { if ($record['checked'] == 'true' && is_uuid($record['uuid'])) { - $record_uuids[] = $this->uuid_prefix."uuid = '".$record['uuid']."'"; + $uuids[] = "'".$record['uuid']."'"; } } - if (is_array($record_uuids) && @sizeof($record_uuids) != 0) { + if (is_array($uuids) && @sizeof($uuids) != 0) { $sql = "select ".$this->uuid_prefix."uuid as uuid, ".$this->toggle_field." as toggle, dialplan_context from v_".$this->table." "; $sql .= "where (domain_uuid = :domain_uuid or domain_uuid is null) "; - $sql .= "and ( ".implode(' or ', $record_uuids)." ) "; + $sql .= "and ".$this->uuid_prefix."uuid in (".implode(', ', $uuids).") "; $parameters['domain_uuid'] = $_SESSION['domain_uuid']; $database = new database; $rows = $database->select($sql, $parameters, 'all'); @@ -1280,16 +1280,16 @@ include "root.php"; //get checked records foreach($records as $x => $record) { if ($record['checked'] == 'true' && is_uuid($record['uuid'])) { - $record_uuids[] = $this->uuid_prefix."uuid = '".$record['uuid']."'"; + $uuids[] = "'".$record['uuid']."'"; } } //create insert array from existing data - if (is_array($record_uuids) && @sizeof($record_uuids) != 0) { + if (is_array($uuids) && @sizeof($uuids) != 0) { //primary table $sql = "select * from v_".$this->table." "; - $sql .= "where ".implode(' or ', $record_uuids)." "; + $sql .= "where ".$this->uuid_prefix."uuid in (".implode(', ', $uuids).") "; $database = new database; $rows = $database->select($sql, $parameters, 'all'); if (is_array($rows) && @sizeof($rows) != 0) { diff --git a/app/email_logs/resources/classes/email_logs.php b/app/email_logs/resources/classes/email_logs.php index 225f9a0a79..6542543771 100644 --- a/app/email_logs/resources/classes/email_logs.php +++ b/app/email_logs/resources/classes/email_logs.php @@ -133,19 +133,19 @@ if (!class_exists('email_logs')) { //retrieve checked records foreach($records as $x => $record) { if ($record['checked'] == 'true' && is_uuid($record['uuid'])) { - $record_uuids[] = $record['uuid']; + $uuids[] = $record['uuid']; } } //resend emails - if (is_array($record_uuids) && @sizeof($record_uuids) != 0) { + if (is_array($uuids) && @sizeof($uuids) != 0) { $x = 0; - foreach ($record_uuids as $x => $record_uuid) { + foreach ($uuids as $x => $uuid) { //get email message $sql = "select email from v_email_logs "; $sql .= "where email_log_uuid = :email_log_uuid "; - $parameters['email_log_uuid'] = $record_uuid; + $parameters['email_log_uuid'] = $uuid; $database = new database; $email = $database->select($sql, $parameters, 'column'); $found = $email != '' ? true : false; @@ -159,7 +159,7 @@ if (!class_exists('email_logs')) { if ($mailer_error == '') { //build the delete array - $array[$this->table][$x][$this->uuid_prefix.'uuid'] = $record_uuid; + $array[$this->table][$x][$this->uuid_prefix.'uuid'] = $uuid; //grant temporary permissions $p = new permissions; @@ -222,18 +222,18 @@ if (!class_exists('email_logs')) { //retrieve checked records foreach($records as $x => $record) { if ($record['checked'] == 'true' && is_uuid($record['uuid'])) { - $record_uuids[] = $record['uuid']; + $uuids[] = $record['uuid']; } } //download emails - if (is_array($record_uuids) && @sizeof($record_uuids) != 0) { - foreach ($record_uuids as $x => $record_uuid) { + if (is_array($uuids) && @sizeof($uuids) != 0) { + foreach ($uuids as $x => $uuid) { //get email details $sql = "select call_uuid, sent_date, type, email from v_email_logs "; $sql .= "where email_log_uuid = :email_log_uuid "; - $parameters['email_log_uuid'] = $record_uuid; + $parameters['email_log_uuid'] = $uuid; $database = new database; $row = $database->select($sql, $parameters, 'row'); if (is_array($row) && @sizeof($row) != 0 && is_uuid($row['call_uuid'])) { @@ -246,7 +246,7 @@ if (!class_exists('email_logs')) { $email_filename = $sent_date.'_'.$type.'_'.$row['call_uuid'].'.eml'; //single email - if (@sizeof($record_uuids) == 1) { + if (@sizeof($uuids) == 1) { //set headers header("Content-Type: message/rfc822"); diff --git a/app/email_templates/resources/classes/email_templates.php b/app/email_templates/resources/classes/email_templates.php index 1e57565a73..578255f7c3 100644 --- a/app/email_templates/resources/classes/email_templates.php +++ b/app/email_templates/resources/classes/email_templates.php @@ -137,13 +137,13 @@ if (!class_exists('email_templates')) { //get current toggle state foreach($records as $x => $record) { if ($record['checked'] == 'true' && is_uuid($record['uuid'])) { - $record_uuids[] = $this->uuid_prefix."uuid = '".$record['uuid']."'"; + $uuids[] = "'".$record['uuid']."'"; } } - if (is_array($record_uuids) && @sizeof($record_uuids) != 0) { + if (is_array($uuids) && @sizeof($uuids) != 0) { $sql = "select ".$this->uuid_prefix."uuid as uuid, ".$this->toggle_field." as toggle from v_".$this->table." "; $sql .= "where (domain_uuid = :domain_uuid or domain_uuid is null) "; - $sql .= "and ( ".implode(' or ', $record_uuids)." ) "; + $sql .= "and ".$this->uuid_prefix."uuid in (".implode(', ', $uuids).") "; $parameters['domain_uuid'] = $_SESSION['domain_uuid']; $database = new database; $rows = $database->select($sql, $parameters, 'all'); @@ -206,15 +206,15 @@ if (!class_exists('email_templates')) { //get checked records foreach($records as $x => $record) { if ($record['checked'] == 'true' && is_uuid($record['uuid'])) { - $record_uuids[] = $this->uuid_prefix."uuid = '".$record['uuid']."'"; + $uuids[] = "'".$record['uuid']."'"; } } //create insert array from existing data - if (is_array($record_uuids) && @sizeof($record_uuids) != 0) { + if (is_array($uuids) && @sizeof($uuids) != 0) { $sql = "select * from v_".$this->table." "; $sql .= "where (domain_uuid = :domain_uuid or domain_uuid is null) "; - $sql .= "and ( ".implode(' or ', $record_uuids)." ) "; + $sql .= "and ".$this->uuid_prefix."uuid in (".implode(', ', $uuids).") "; $parameters['domain_uuid'] = $_SESSION['domain_uuid']; $database = new database; $rows = $database->select($sql, $parameters, 'all'); diff --git a/app/extensions/resources/classes/extension.php b/app/extensions/resources/classes/extension.php index 73b5e71170..9fafece109 100644 --- a/app/extensions/resources/classes/extension.php +++ b/app/extensions/resources/classes/extension.php @@ -677,13 +677,13 @@ if (!class_exists('extension')) { //get current toggle state foreach($records as $x => $record) { if ($record['checked'] == 'true' && is_uuid($record['uuid'])) { - $record_uuids[] = $this->uuid_prefix."uuid = '".$record['uuid']."'"; + $uuids[] = "'".$record['uuid']."'"; } } - if (is_array($record_uuids) && @sizeof($record_uuids) != 0) { + if (is_array($uuids) && @sizeof($uuids) != 0) { $sql = "select ".$this->uuid_prefix."uuid as uuid, ".$this->toggle_field." as toggle, extension, number_alias, user_context from v_".$this->table." "; $sql .= "where domain_uuid = :domain_uuid "; - $sql .= "and ( ".implode(' or ', $record_uuids)." ) "; + $sql .= "and ".$this->uuid_prefix."uuid in (".implode(', ', $uuids).") "; $parameters['domain_uuid'] = $_SESSION['domain_uuid']; $database = new database; $rows = $database->select($sql, $parameters, 'all'); diff --git a/app/fax/resources/classes/fax.php b/app/fax/resources/classes/fax.php index 8e32ba81c6..0ce590c8ae 100644 --- a/app/fax/resources/classes/fax.php +++ b/app/fax/resources/classes/fax.php @@ -328,15 +328,15 @@ //get checked records foreach($records as $x => $record) { if ($record['checked'] == 'true' && is_uuid($record['uuid'])) { - $record_uuids[] = $this->uuid_prefix."uuid = '".$record['uuid']."'"; + $uuids[] = "'".$record['uuid']."'"; } } //create insert array from existing data - if (is_array($record_uuids) && @sizeof($record_uuids) != 0) { + if (is_array($uuids) && @sizeof($uuids) != 0) { $sql = "select * from v_".$this->table." "; $sql .= "where (domain_uuid = :domain_uuid or domain_uuid is null) "; - $sql .= "and ( ".implode(' or ', $record_uuids)." ) "; + $sql .= "and ".$this->uuid_prefix."uuid in (".implode(', ', $uuids).") "; $parameters['domain_uuid'] = $_SESSION['domain_uuid']; $database = new database; $rows = $database->select($sql, $parameters, 'all'); diff --git a/app/gateways/resources/classes/gateways.php b/app/gateways/resources/classes/gateways.php index 171ae28b0c..65be13b34f 100644 --- a/app/gateways/resources/classes/gateways.php +++ b/app/gateways/resources/classes/gateways.php @@ -91,15 +91,15 @@ if (!class_exists('gateways')) { //filter out unchecked gateways, build where clause for below foreach($records as $record) { if ($record['checked'] == 'true' && is_uuid($record['uuid'])) { - $record_uuids[] = $this->uuid_prefix."uuid = '".$record['uuid']."'"; + $uuids[] = "'".$record['uuid']."'"; } } //get necessary gateway details - if (is_array($record_uuids) && @sizeof($record_uuids) != 0) { + if (is_array($uuids) && @sizeof($uuids) != 0) { $sql = "select ".$this->uuid_prefix."uuid as uuid, gateway, profile, enabled from v_".$this->table." "; $sql .= "where (domain_uuid = :domain_uuid ".(permission_exists('gateway_domain') ? " or domain_uuid is null " : null).") "; - $sql .= "and ( ".implode(' or ', $record_uuids)." ) "; + $sql .= "and ".$this->uuid_prefix."uuid in (".implode(', ', $uuids).") "; $parameters['domain_uuid'] = $_SESSION['domain_uuid']; $database = new database; $rows = $database->select($sql, $parameters, 'all'); @@ -165,15 +165,15 @@ if (!class_exists('gateways')) { //filter out unchecked gateways, build where clause for below foreach($records as $record) { if ($record['checked'] == 'true' && is_uuid($record['uuid'])) { - $record_uuids[] = $this->uuid_prefix."uuid = '".$record['uuid']."'"; + $uuids[] = "'".$record['uuid']."'"; } } //get necessary gateway details - if (is_array($record_uuids) && @sizeof($record_uuids) != 0) { + if (is_array($uuids) && @sizeof($uuids) != 0) { $sql = "select ".$this->uuid_prefix."uuid as uuid, gateway, profile, enabled from v_".$this->table." "; $sql .= "where (domain_uuid = :domain_uuid ".(permission_exists('gateway_domain') ? " or domain_uuid is null " : null).") "; - $sql .= "and ( ".implode(' or ', $record_uuids)." ) "; + $sql .= "and ".$this->uuid_prefix."uuid in (".implode(', ', $uuids).") "; $parameters['domain_uuid'] = $_SESSION['domain_uuid']; $database = new database; $rows = $database->select($sql, $parameters, 'all'); @@ -239,15 +239,15 @@ if (!class_exists('gateways')) { //filter out unchecked gateways, build where clause for below foreach ($records as $record) { if ($record['checked'] == 'true' && is_uuid($record['uuid'])) { - $record_uuids[] = $this->uuid_prefix."uuid = '".$record['uuid']."'"; + $uuids[] = "'".$record['uuid']."'"; } } //get necessary gateway details - if (is_array($record_uuids) && @sizeof($record_uuids) != 0) { + if (is_array($uuids) && @sizeof($uuids) != 0) { $sql = "select ".$this->uuid_prefix."uuid as uuid, gateway, profile from v_".$this->table." "; $sql .= "where (domain_uuid = :domain_uuid ".(permission_exists('gateway_domain') ? " or domain_uuid is null " : null).") "; - $sql .= "and ( ".implode(' or ', $record_uuids)." ) "; + $sql .= "and ".$this->uuid_prefix."uuid in (".implode(', ', $uuids).") "; $parameters['domain_uuid'] = $_SESSION['domain_uuid']; $database = new database; $rows = $database->select($sql, $parameters, 'all'); @@ -370,13 +370,13 @@ if (!class_exists('gateways')) { //get current toggle state foreach($records as $record) { if ($record['checked'] == 'true' && is_uuid($record['uuid'])) { - $record_uuids[] = $this->uuid_prefix."uuid = '".$record['uuid']."'"; + $uuids[] = "'".$record['uuid']."'"; } } - if (is_array($record_uuids) && @sizeof($record_uuids) != 0) { + if (is_array($uuids) && @sizeof($uuids) != 0) { $sql = "select ".$this->uuid_prefix."uuid as uuid, ".$this->toggle_field." as state, gateway, profile from v_".$this->table." "; $sql .= "where (domain_uuid = :domain_uuid ".(permission_exists('gateway_domain') ? " or domain_uuid is null " : null).") "; - $sql .= "and ( ".implode(' or ', $record_uuids)." ) "; + $sql .= "and ".$this->uuid_prefix."uuid in (".implode(', ', $uuids).") "; $parameters['domain_uuid'] = $_SESSION['domain_uuid']; $database = new database; $rows = $database->select($sql, $parameters, 'all'); @@ -496,15 +496,15 @@ if (!class_exists('gateways')) { //get checked records foreach($records as $record) { if ($record['checked'] == 'true' && is_uuid($record['uuid'])) { - $record_uuids[] = $this->uuid_prefix."uuid = '".$record['uuid']."'"; + $uuids[] = "'".$record['uuid']."'"; } } //create insert array from existing data - if (is_array($record_uuids) && @sizeof($record_uuids) != 0) { + if (is_array($uuids) && @sizeof($uuids) != 0) { $sql = "select * from v_".$this->table." "; $sql .= "where (domain_uuid = :domain_uuid ".(permission_exists('gateway_domain') ? " or domain_uuid is null " : null).") "; - $sql .= "and ( ".implode(' or ', $record_uuids)." ) "; + $sql .= "and ".$this->uuid_prefix."uuid in (".implode(', ', $uuids).") "; $parameters['domain_uuid'] = $_SESSION['domain_uuid']; $database = new database; $rows = $database->select($sql, $parameters, 'all'); diff --git a/app/ivr_menus/resources/classes/ivr_menu.php b/app/ivr_menus/resources/classes/ivr_menu.php index abbcda9c60..bc8921d8c8 100644 --- a/app/ivr_menus/resources/classes/ivr_menu.php +++ b/app/ivr_menus/resources/classes/ivr_menu.php @@ -112,15 +112,15 @@ if (!class_exists('ivr_menu')) { //filter out unchecked ivr menus, build where clause for below foreach ($records as $record) { if ($record['checked'] == 'true' && is_uuid($record['uuid'])) { - $record_uuids[] = $this->uuid_prefix."uuid = '".$record['uuid']."'"; + $uuids[] = "'".$record['uuid']."'"; } } //get necessary ivr menu details - if (is_array($record_uuids) && @sizeof($record_uuids) != 0) { + if (is_array($uuids) && @sizeof($uuids) != 0) { $sql = "select ".$this->uuid_prefix."uuid as uuid, dialplan_uuid, ivr_menu_context from v_".$this->table." "; $sql .= "where (domain_uuid = :domain_uuid) "; - $sql .= "and ( ".implode(' or ', $record_uuids)." ) "; + $sql .= "and ".$this->uuid_prefix."uuid in (".implode(', ', $uuids).") "; $parameters['domain_uuid'] = $_SESSION['domain_uuid']; $database = new database; $rows = $database->select($sql, $parameters, 'all'); @@ -205,13 +205,13 @@ if (!class_exists('ivr_menu')) { //get current toggle state foreach($records as $x => $record) { if ($record['checked'] == 'true' && is_uuid($record['uuid'])) { - $record_uuids[] = $this->uuid_prefix."uuid = '".$record['uuid']."'"; + $uuids[] = "'".$record['uuid']."'"; } } - if (is_array($record_uuids) && @sizeof($record_uuids) != 0) { + if (is_array($uuids) && @sizeof($uuids) != 0) { $sql = "select ".$this->uuid_prefix."uuid as uuid, ".$this->toggle_field." as toggle, dialplan_uuid from v_".$this->table." "; $sql .= "where domain_uuid = :domain_uuid "; - $sql .= "and ( ".implode(' or ', $record_uuids)." ) "; + $sql .= "and ".$this->uuid_prefix."uuid in (".implode(', ', $uuids).") "; $parameters['domain_uuid'] = $_SESSION['domain_uuid']; $database = new database; $rows = $database->select($sql, $parameters, 'all'); @@ -291,17 +291,17 @@ if (!class_exists('ivr_menu')) { //get checked records foreach($records as $x => $record) { if ($record['checked'] == 'true' && is_uuid($record['uuid'])) { - $record_uuids[] = $this->uuid_prefix."uuid = '".$record['uuid']."'"; + $uuids[] = "'".$record['uuid']."'"; } } //create insert array from existing data - if (is_array($record_uuids) && @sizeof($record_uuids) != 0) { + if (is_array($uuids) && @sizeof($uuids) != 0) { //primary table $sql = "select * from v_".$this->table." "; $sql .= "where domain_uuid = :domain_uuid "; - $sql .= "and ( ".implode(' or ', $record_uuids)." ) "; + $sql .= "and ".$this->uuid_prefix."uuid in (".implode(', ', $uuids).") "; $parameters['domain_uuid'] = $_SESSION['domain_uuid']; $database = new database; $rows = $database->select($sql, $parameters, 'all'); diff --git a/app/modules/resources/classes/modules.php b/app/modules/resources/classes/modules.php index 53d608355a..34398736d6 100644 --- a/app/modules/resources/classes/modules.php +++ b/app/modules/resources/classes/modules.php @@ -870,14 +870,14 @@ if (!class_exists('modules')) { //filter out unchecked modules, build where clause for below foreach($records as $record) { if ($record['checked'] == 'true' && is_uuid($record['uuid'])) { - $record_uuids[] = $this->uuid_prefix."uuid = '".$record['uuid']."'"; + $uuids[] = "'".$record['uuid']."'"; } } //get module details - if (is_array($record_uuids) && @sizeof($record_uuids) != 0) { + if (is_array($uuids) && @sizeof($uuids) != 0) { $sql = "select ".$this->uuid_prefix."uuid as uuid, module_name as module, module_enabled as enabled from v_".$this->table." "; - $sql .= "where ( ".implode(' or ', $record_uuids)." ) "; + $sql .= "where ".$this->uuid_prefix."uuid in (".implode(', ', $uuids).") "; $database = new database; $rows = $database->select($sql, $parameters, 'all'); if (is_array($rows) && @sizeof($rows) != 0) { @@ -946,14 +946,14 @@ if (!class_exists('modules')) { //filter out unchecked modules, build where clause for below foreach($records as $record) { if ($record['checked'] == 'true' && is_uuid($record['uuid'])) { - $record_uuids[] = $this->uuid_prefix."uuid = '".$record['uuid']."'"; + $uuids[] = "'".$record['uuid']."'"; } } //get module details - if (is_array($record_uuids) && @sizeof($record_uuids) != 0) { + if (is_array($uuids) && @sizeof($uuids) != 0) { $sql = "select ".$this->uuid_prefix."uuid as uuid, module_name as module from v_".$this->table." "; - $sql .= "where ( ".implode(' or ', $record_uuids)." ) "; + $sql .= "where ".$this->uuid_prefix."uuid in (".implode(', ', $uuids).") "; $database = new database; $rows = $database->select($sql, $parameters, 'all'); if (is_array($rows) && @sizeof($rows) != 0) { @@ -1039,12 +1039,12 @@ if (!class_exists('modules')) { //get current toggle state foreach($records as $x => $record) { if ($record['checked'] == 'true' && is_uuid($record['uuid'])) { - $record_uuids[] = $this->uuid_prefix."uuid = '".$record['uuid']."'"; + $uuids[] = "'".$record['uuid']."'"; } } - if (is_array($record_uuids) && @sizeof($record_uuids) != 0) { + if (is_array($uuids) && @sizeof($uuids) != 0) { $sql = "select ".$this->uuid_prefix."uuid as uuid, ".$this->toggle_field." as state, module_name as name from v_".$this->table." "; - $sql .= "where ( ".implode(' or ', $record_uuids)." ) "; + $sql .= "where ".$this->uuid_prefix."uuid in (".implode(', ', $uuids).") "; $database = new database; $rows = $database->select($sql, $parameters, 'all'); if (is_array($rows) && @sizeof($rows) != 0) { diff --git a/app/number_translations/resources/classes/number_translations.php b/app/number_translations/resources/classes/number_translations.php index 93f91efb7f..faf5958e9c 100644 --- a/app/number_translations/resources/classes/number_translations.php +++ b/app/number_translations/resources/classes/number_translations.php @@ -225,12 +225,12 @@ if (!class_exists('number_translations')) { //get current toggle state foreach($records as $x => $record) { if ($record['checked'] == 'true' && is_uuid($record['uuid'])) { - $record_uuids[] = $this->uuid_prefix."uuid = '".$record['uuid']."'"; + $uuids[] = "'".$record['uuid']."'"; } } - if (is_array($record_uuids) && @sizeof($record_uuids) != 0) { + if (is_array($uuids) && @sizeof($uuids) != 0) { $sql = "select ".$this->uuid_prefix."uuid as uuid, ".$this->toggle_field." as toggle from v_".$this->table." "; - $sql .= "where ( ".implode(' or ', $record_uuids)." ) "; + $sql .= "where ".$this->uuid_prefix."uuid in (".implode(', ', $uuids).") "; $database = new database; $rows = $database->select($sql, $parameters, 'all'); if (is_array($rows) && @sizeof($rows) != 0) { @@ -292,16 +292,16 @@ if (!class_exists('number_translations')) { //get checked records foreach($records as $x => $record) { if ($record['checked'] == 'true' && is_uuid($record['uuid'])) { - $record_uuids[] = $this->uuid_prefix."uuid = '".$record['uuid']."'"; + $uuids[] = "'".$record['uuid']."'"; } } //create insert array from existing data - if (is_array($record_uuids) && @sizeof($record_uuids) != 0) { + if (is_array($uuids) && @sizeof($uuids) != 0) { //primary table $sql = "select * from v_".$this->table." "; - $sql .= "where ".implode(' or ', $record_uuids)." "; + $sql .= "where ".$this->uuid_prefix."uuid in (".implode(', ', $uuids).") "; $database = new database; $rows = $database->select($sql, $parameters, 'all'); if (is_array($rows) && @sizeof($rows) != 0) { diff --git a/app/phrases/resources/classes/phrases.php b/app/phrases/resources/classes/phrases.php index 15978f643d..a67bb78f4c 100644 --- a/app/phrases/resources/classes/phrases.php +++ b/app/phrases/resources/classes/phrases.php @@ -91,15 +91,15 @@ if (!class_exists('phrases')) { //filter out unchecked phrases, build where clause for below foreach($records as $record) { if ($record['checked'] == 'true' && is_uuid($record['uuid'])) { - $record_uuids[] = $this->uuid_prefix."uuid = '".$record['uuid']."'"; + $uuids[] = "'".$record['uuid']."'"; } } //get phrase languages - if (is_array($record_uuids) && @sizeof($record_uuids) != 0) { + if (is_array($uuids) && @sizeof($uuids) != 0) { $sql = "select ".$this->uuid_prefix."uuid as uuid, phrase_language as lang from v_".$this->table." "; $sql .= "where domain_uuid = :domain_uuid "; - $sql .= "and ( ".implode(' or ', $record_uuids)." ) "; + $sql .= "and ".$this->uuid_prefix."uuid in (".implode(', ', $uuids).") "; $parameters['domain_uuid'] = $_SESSION['domain_uuid']; $database = new database; $rows = $database->select($sql, $parameters, 'all'); @@ -179,13 +179,13 @@ if (!class_exists('phrases')) { //get current toggle state and language foreach($records as $x => $record) { if ($record['checked'] == 'true' && is_uuid($record['uuid'])) { - $record_uuids[] = $this->uuid_prefix."uuid = '".$record['uuid']."'"; + $uuids[] = "'".$record['uuid']."'"; } } - if (is_array($record_uuids) && @sizeof($record_uuids) != 0) { + if (is_array($uuids) && @sizeof($uuids) != 0) { $sql = "select ".$this->uuid_prefix."uuid as uuid, ".$this->toggle_field." as toggle, phrase_language as lang from v_".$this->table." "; $sql .= "where domain_uuid = :domain_uuid "; - $sql .= "and ( ".implode(' or ', $record_uuids)." ) "; + $sql .= "and ".$this->uuid_prefix."uuid in (".implode(', ', $uuids).") "; $parameters['domain_uuid'] = $_SESSION['domain_uuid']; $database = new database; $rows = $database->select($sql, $parameters, 'all'); @@ -256,17 +256,17 @@ if (!class_exists('phrases')) { //get checked records foreach($records as $x => $record) { if ($record['checked'] == 'true' && is_uuid($record['uuid'])) { - $record_uuids[] = $this->uuid_prefix."uuid = '".$record['uuid']."'"; + $uuids[] = "'".$record['uuid']."'"; } } //create insert array from existing data - if (is_array($record_uuids) && @sizeof($record_uuids) != 0) { + if (is_array($uuids) && @sizeof($uuids) != 0) { //primary table $sql = "select * from v_".$this->table." "; $sql .= "where (domain_uuid = :domain_uuid or domain_uuid is null) "; - $sql .= "and ( ".implode(' or ', $record_uuids)." ) "; + $sql .= "and ".$this->uuid_prefix."uuid in (".implode(', ', $uuids).") "; $parameters['domain_uuid'] = $_SESSION['domain_uuid']; $database = new database; $rows = $database->select($sql, $parameters, 'all'); diff --git a/app/pin_numbers/resources/classes/pin_numbers.php b/app/pin_numbers/resources/classes/pin_numbers.php index 8d0cdefb1d..d34d83ec80 100644 --- a/app/pin_numbers/resources/classes/pin_numbers.php +++ b/app/pin_numbers/resources/classes/pin_numbers.php @@ -138,13 +138,13 @@ if (!class_exists('pin_numbers')) { //get current toggle state foreach($records as $x => $record) { if ($record['checked'] == 'true' && is_uuid($record['uuid'])) { - $record_uuids[] = $this->uuid_prefix."uuid = '".$record['uuid']."'"; + $uuids[] = "'".$record['uuid']."'"; } } - if (is_array($record_uuids) && @sizeof($record_uuids) != 0) { + if (is_array($uuids) && @sizeof($uuids) != 0) { $sql = "select ".$this->uuid_prefix."uuid as uuid, ".$this->toggle_field." as toggle from v_".$this->table." "; $sql .= "where (domain_uuid = :domain_uuid or domain_uuid is null) "; - $sql .= "and ( ".implode(' or ', $record_uuids)." ) "; + $sql .= "and ".$this->uuid_prefix."uuid in (".implode(', ', $uuids).") "; $parameters['domain_uuid'] = $_SESSION['domain_uuid']; $database = new database; $rows = $database->select($sql, $parameters, 'all'); @@ -207,15 +207,15 @@ if (!class_exists('pin_numbers')) { //get checked records foreach($records as $x => $record) { if ($record['checked'] == 'true' && is_uuid($record['uuid'])) { - $record_uuids[] = $this->uuid_prefix."uuid = '".$record['uuid']."'"; + $uuids[] = "'".$record['uuid']."'"; } } //create insert array from existing data - if (is_array($record_uuids) && @sizeof($record_uuids) != 0) { + if (is_array($uuids) && @sizeof($uuids) != 0) { $sql = "select * from v_".$this->table." "; $sql .= "where (domain_uuid = :domain_uuid or domain_uuid is null) "; - $sql .= "and ( ".implode(' or ', $record_uuids)." ) "; + $sql .= "and ".$this->uuid_prefix."uuid in (".implode(', ', $uuids).") "; $parameters['domain_uuid'] = $_SESSION['domain_uuid']; $database = new database; $rows = $database->select($sql, $parameters, 'all'); diff --git a/app/ring_groups/resources/classes/ring_groups.php b/app/ring_groups/resources/classes/ring_groups.php index 7997fa6e7f..15835223f4 100644 --- a/app/ring_groups/resources/classes/ring_groups.php +++ b/app/ring_groups/resources/classes/ring_groups.php @@ -91,15 +91,15 @@ if (!class_exists('ring_groups')) { //filter out unchecked ring groups, build where clause for below foreach ($records as $record) { if ($record['checked'] == 'true' && is_uuid($record['uuid'])) { - $record_uuids[] = $this->uuid_prefix."uuid = '".$record['uuid']."'"; + $uuids[] = "'".$record['uuid']."'"; } } //get necessary ring group details - if (is_array($record_uuids) && @sizeof($record_uuids) != 0) { + if (is_array($uuids) && @sizeof($uuids) != 0) { $sql = "select ".$this->uuid_prefix."uuid as uuid, dialplan_uuid, ring_group_context from v_".$this->table." "; $sql .= "where domain_uuid = :domain_uuid "; - $sql .= "and ".implode(' or ', $record_uuids)." "; + $sql .= "and ".$this->uuid_prefix."uuid in (".implode(', ', $uuids).") "; $parameters['domain_uuid'] = $_SESSION['domain_uuid']; $database = new database; $rows = $database->select($sql, $parameters, 'all'); @@ -196,13 +196,13 @@ if (!class_exists('ring_groups')) { //get current toggle state foreach($records as $x => $record) { if ($record['checked'] == 'true' && is_uuid($record['uuid'])) { - $record_uuids[] = $this->uuid_prefix."uuid = '".$record['uuid']."'"; + $uuids[] = "'".$record['uuid']."'"; } } - if (is_array($record_uuids) && @sizeof($record_uuids) != 0) { + if (is_array($uuids) && @sizeof($uuids) != 0) { $sql = "select ".$this->uuid_prefix."uuid as uuid, ".$this->toggle_field." as toggle, dialplan_uuid, ring_group_context from v_".$this->table." "; $sql .= "where domain_uuid = :domain_uuid "; - $sql .= "and ( ".implode(' or ', $record_uuids)." ) "; + $sql .= "and ".$this->uuid_prefix."uuid in (".implode(', ', $uuids).") "; $parameters['domain_uuid'] = $_SESSION['domain_uuid']; $database = new database; $rows = $database->select($sql, $parameters, 'all'); @@ -291,17 +291,17 @@ if (!class_exists('ring_groups')) { //get checked records foreach($records as $record) { if ($record['checked'] == 'true' && is_uuid($record['uuid'])) { - $record_uuids[] = $this->uuid_prefix."uuid = '".$record['uuid']."'"; + $uuids[] = "'".$record['uuid']."'"; } } //create insert array from existing data - if (is_array($record_uuids) && @sizeof($record_uuids) != 0) { + if (is_array($uuids) && @sizeof($uuids) != 0) { //primary table $sql = "select * from v_".$this->table." "; $sql .= "where domain_uuid = :domain_uuid "; - $sql .= "and ( ".implode(' or ', $record_uuids)." ) "; + $sql .= "and ".$this->uuid_prefix."uuid in (".implode(', ', $uuids).") "; $parameters['domain_uuid'] = $_SESSION['domain_uuid']; $database = new database; $rows = $database->select($sql, $parameters, 'all');