mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2026-01-06 11:43:50 +00:00
remove instances where a pointer is used in a foreach loop for value (#7108)
This commit is contained in:
@@ -645,14 +645,14 @@
|
||||
$tmp = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
if ($this->type == "pgsql" || $this->type == "sqlite" || $this->type == "mssql") {
|
||||
if (is_array($tmp)) {
|
||||
foreach ($tmp as &$row) {
|
||||
foreach ($tmp as $row) {
|
||||
$result[]['name'] = $row['name'];
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($this->type == "mysql") {
|
||||
if (is_array($tmp)) {
|
||||
foreach ($tmp as &$row) {
|
||||
foreach ($tmp as $row) {
|
||||
$table_array = array_values($row);
|
||||
$result[]['name'] = $table_array[0];
|
||||
}
|
||||
@@ -2815,7 +2815,7 @@
|
||||
|
||||
//get the domain_uuid
|
||||
$domain_uuid = '';
|
||||
foreach($old_array as &$data_array) {
|
||||
foreach ($old_array as $data_array) {
|
||||
foreach ($data_array as $row) {
|
||||
if (!empty($row['domain_uuid'])) {
|
||||
$domain_uuid = $row['domain_uuid'];
|
||||
@@ -2968,7 +2968,7 @@
|
||||
$config_list = glob($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . "/*/*/app_config.php");
|
||||
$x = 0;
|
||||
if (is_array($config_list)) {
|
||||
foreach ($config_list as &$config_path) {
|
||||
foreach ($config_list as $config_path) {
|
||||
include($config_path);
|
||||
$x++;
|
||||
}
|
||||
@@ -3011,7 +3011,7 @@
|
||||
//search through all fields to see if domain_uuid exists
|
||||
foreach (self::$apps as $x => &$app) {
|
||||
if (is_array($app['db'])) {
|
||||
foreach ($app['db'] as $y => &$row) {
|
||||
foreach ($app['db'] as $y => $row) {
|
||||
if (is_array($row['table']['name'])) {
|
||||
$table_name = $row['table']['name']['text'];
|
||||
}
|
||||
@@ -3065,15 +3065,15 @@
|
||||
}
|
||||
}
|
||||
$x = 0;
|
||||
foreach ($config_list as &$config_path) {
|
||||
foreach ($config_list as $config_path) {
|
||||
include($config_path);
|
||||
$x++;
|
||||
}
|
||||
|
||||
//search through all fields to find relations
|
||||
if (!empty($apps) && is_array($apps)) {
|
||||
foreach ($apps as $x => &$app) {
|
||||
foreach ($app['db'] as $y => &$row) {
|
||||
foreach ($apps as $x => $app) {
|
||||
foreach ($app['db'] as $y => $row) {
|
||||
foreach ($row['fields'] as $z => $field) {
|
||||
if (!empty($field['deprecated']) && $field['deprecated'] != "true") {
|
||||
if (!empty($field['key']['type']) && $field['key']['type'] == "foreign") {
|
||||
|
||||
@@ -501,7 +501,7 @@
|
||||
$call_group = $row['call_group'];
|
||||
$call_group = str_replace(";", ",", $call_group);
|
||||
$tmp_array = explode(",", $call_group);
|
||||
foreach ($tmp_array as &$tmp_call_group) {
|
||||
foreach ($tmp_array as $tmp_call_group) {
|
||||
if (!empty($tmp_call_group)) {
|
||||
if (empty($call_group_array[$tmp_call_group])) {
|
||||
$call_group_array[$tmp_call_group] = $row['extension'];
|
||||
@@ -603,7 +603,7 @@
|
||||
$xml .= " to keep searching for the user in the directory.\n";
|
||||
$xml .= " -->\n";
|
||||
$extension_array = explode(",", $extension_list);
|
||||
foreach ($extension_array as &$tmp_extension) {
|
||||
foreach ($extension_array as $tmp_extension) {
|
||||
$xml .= " <user id=\"$tmp_extension\" type=\"pointer\"/>\n";
|
||||
}
|
||||
$xml .= " </users>\n";
|
||||
|
||||
@@ -144,13 +144,13 @@ if (!class_exists('domains')) {
|
||||
//get the $apps array from the installed apps from the core and mod directories
|
||||
$config_list = glob($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/*/*/app_config.php");
|
||||
$x=0;
|
||||
if (isset($config_list)) foreach ($config_list as &$config_path) {
|
||||
if (isset($config_list)) foreach ($config_list as $config_path) {
|
||||
include($config_path);
|
||||
$x++;
|
||||
}
|
||||
|
||||
//delete the domain data from all tables in the database
|
||||
if (isset($apps)) foreach ($apps as &$app) {
|
||||
if (isset($apps)) foreach ($apps as $app) {
|
||||
if (isset($app['db'])) foreach ($app['db'] as $row) {
|
||||
if (is_array($row['table']['name'])) {
|
||||
$table_name = $row['table']['name']['text'];
|
||||
@@ -623,7 +623,7 @@ if (!class_exists('domains')) {
|
||||
$config_list = array_merge((array)$config_list_1, (array)$config_list_2);
|
||||
unset($config_list_1,$config_list_2);
|
||||
$x=0;
|
||||
foreach ($config_list as &$config_path) {
|
||||
foreach ($config_list as $config_path) {
|
||||
$app_path = dirname($config_path);
|
||||
$app_path = preg_replace('/\A.*(\/.*\/.*)\z/', '$1', $app_path);
|
||||
include($config_path);
|
||||
@@ -650,7 +650,7 @@ if (!class_exists('domains')) {
|
||||
|
||||
//get the list of installed apps from the core and mod directories and run the php code in app_defaults.php
|
||||
$default_list = glob($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . "/*/*/app_defaults.php");
|
||||
foreach ($default_list as &$default_path) {
|
||||
foreach ($default_list as $default_path) {
|
||||
include($default_path);
|
||||
}
|
||||
|
||||
|
||||
@@ -142,7 +142,7 @@ if (!class_exists('email')) {
|
||||
|
||||
//get the attachments and add to the email
|
||||
$x = 0;
|
||||
foreach ($decoded[0]["Parts"] as &$parts_array) {
|
||||
foreach ($decoded[0]["Parts"] as $parts_array) {
|
||||
//image/tiff;name="testfax.tif"
|
||||
//text/plain; charset=ISO-8859-1; format=flowed
|
||||
$content_type = $parts_array["Parts"][0]["Headers"]["content-type:"];
|
||||
|
||||
@@ -216,7 +216,7 @@ class event_socket {
|
||||
}
|
||||
|
||||
$cmd_array = explode("\n", $cmd);
|
||||
foreach ($cmd_array as &$value) {
|
||||
foreach ($cmd_array as $value) {
|
||||
fputs($this->fp, $value."\n");
|
||||
}
|
||||
fputs($this->fp, "\n"); //second line feed to end the headers
|
||||
|
||||
@@ -459,7 +459,7 @@ if (!class_exists('groups')) {
|
||||
//build the apps array
|
||||
$config_list = glob($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/*/*/app_config.php");
|
||||
$x = 0;
|
||||
foreach ($config_list as &$config_path) {
|
||||
foreach ($config_list as $config_path) {
|
||||
include($config_path);
|
||||
$x++;
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ if (!class_exists('schema')) {
|
||||
//get the list of installed apps from the core and mod directories
|
||||
$config_list = glob($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . "/*/*/app_config.php");
|
||||
$x=0;
|
||||
foreach ($config_list as &$config_path) {
|
||||
foreach ($config_list as $config_path) {
|
||||
try {
|
||||
include($config_path);
|
||||
}
|
||||
@@ -137,7 +137,7 @@ if (!class_exists('schema')) {
|
||||
|
||||
//check if a column exists in sqlite
|
||||
private function sqlite_column_exists($table_info, $column_name) {
|
||||
foreach ($table_info as $key => &$row) {
|
||||
foreach ($table_info as $key => $row) {
|
||||
if ($row['name'] == $column_name) {
|
||||
return true;
|
||||
}
|
||||
@@ -274,21 +274,21 @@ if (!class_exists('schema')) {
|
||||
//database type
|
||||
private function db_data_type($db_type, $table_info, $column_name) {
|
||||
if ($db_type == "sqlite") {
|
||||
foreach ($table_info as $key => &$row) {
|
||||
foreach ($table_info as $key => $row) {
|
||||
if ($row['name'] == $column_name) {
|
||||
return $row['type'];
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($db_type == "pgsql") {
|
||||
foreach ($table_info as $key => &$row) {
|
||||
foreach ($table_info as $key => $row) {
|
||||
if ($row['column_name'] == $column_name) {
|
||||
return $row['data_type'];
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($db_type == "mysql") {
|
||||
foreach ($table_info as $key => &$row) {
|
||||
foreach ($table_info as $key => $row) {
|
||||
if ($row['Field'] == $column_name) {
|
||||
return $row['Type'];
|
||||
}
|
||||
@@ -298,7 +298,7 @@ if (!class_exists('schema')) {
|
||||
|
||||
//sqlite column exists
|
||||
private function db_sqlite_column_exists($table_info, $column_name) {
|
||||
foreach ($table_info as $key => &$row) {
|
||||
foreach ($table_info as $key => $row) {
|
||||
if ($row['name'] == $column_name) {
|
||||
return true;
|
||||
}
|
||||
@@ -348,7 +348,7 @@ if (!class_exists('schema')) {
|
||||
//database create table
|
||||
public function db_create_table ($apps, $db_type, $table) {
|
||||
if (empty($apps)) { return false; }
|
||||
if (is_array($apps)) foreach ($apps as $x => &$app) {
|
||||
if (is_array($apps)) foreach ($apps as $x => $app) {
|
||||
if (!empty($app['db']) && is_array($app['db'])) foreach ($app['db'] as $y => $row) {
|
||||
if (!empty($row['table']['name']) && is_array($row['table']['name'])) {
|
||||
$table_name = $row['table']['name']['text'];
|
||||
@@ -393,7 +393,7 @@ if (!class_exists('schema')) {
|
||||
//database insert
|
||||
private function db_insert_into ($apps, $db_type, $table) {
|
||||
global $db_name;
|
||||
foreach ($apps as $x => &$app) {
|
||||
foreach ($apps as $x => $app) {
|
||||
foreach ($app['db'] as $y => $row) {
|
||||
if ($row['table']['name'] == $table) {
|
||||
$sql = "INSERT INTO " . $row['table']['name'] . " (";
|
||||
@@ -520,8 +520,8 @@ if (!class_exists('schema')) {
|
||||
|
||||
//update the app db array add exists true or false
|
||||
$sql = '';
|
||||
foreach ($this->apps as $x => &$app) {
|
||||
if (isset($app['db'])) foreach ($app['db'] as $y => &$row) {
|
||||
foreach ($this->apps as $x => $app) {
|
||||
if (isset($app['db'])) foreach ($app['db'] as $y => $row) {
|
||||
if (isset($row['table']['name'])) {
|
||||
if (is_array($row['table']['name'])) {
|
||||
$table_name = $row['table']['name']['text'];
|
||||
@@ -582,8 +582,8 @@ if (!class_exists('schema')) {
|
||||
$sql_update = '';
|
||||
|
||||
//add missing tables and fields
|
||||
foreach ($this->apps as $x => &$app) {
|
||||
if (isset($app['db'])) foreach ($app['db'] as $y => &$row) {
|
||||
foreach ($this->apps as $x => $app) {
|
||||
if (isset($app['db'])) foreach ($app['db'] as $y => $row) {
|
||||
if (is_array($row['table']['name'])) {
|
||||
$table_name = $row['table']['name']['text'];
|
||||
if ($this->db_table_exists($db_type, $db_name, $row['table']['name']['deprecated'])) {
|
||||
@@ -735,8 +735,8 @@ if (!class_exists('schema')) {
|
||||
}
|
||||
}
|
||||
//rebuild and populate the table
|
||||
foreach ($this->apps as $x => &$app) {
|
||||
if (isset($app['db'])) foreach ($app['db'] as $y => &$row) {
|
||||
foreach ($this->apps as $x => $app) {
|
||||
if (isset($app['db'])) foreach ($app['db'] as $y => $row) {
|
||||
if (is_array($row['table']['name'])) {
|
||||
$table_name = $row['table']['name']['text'];
|
||||
}
|
||||
@@ -792,7 +792,7 @@ if (!class_exists('schema')) {
|
||||
$response .= "<tr>\n";
|
||||
//build the html while looping through the app db array
|
||||
$sql = '';
|
||||
foreach ($this->apps as &$app) {
|
||||
foreach ($this->apps as $app) {
|
||||
if (isset($app['db'])) foreach ($app['db'] as $row) {
|
||||
if (is_array($row['table']['name'])) {
|
||||
$table_name = $row['table']['name']['text'];
|
||||
|
||||
@@ -48,7 +48,7 @@ class sounds {
|
||||
$database = new database;
|
||||
$recordings = $database->select($sql, $parameters, 'all');
|
||||
if (is_array($recordings) && @sizeof($recordings) != 0) {
|
||||
foreach ($recordings as $x => &$row) {
|
||||
foreach ($recordings as $x => $row) {
|
||||
$recording_name = $row["recording_name"];
|
||||
$recording_filename = $row["recording_filename"];
|
||||
$recording_path = !empty($this->full_path) && is_array($this->full_path) && in_array('recordings', $this->full_path) ? $_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/' : null;
|
||||
@@ -66,7 +66,7 @@ class sounds {
|
||||
$database = new database;
|
||||
$phrases = $database->select($sql, $parameters, 'all');
|
||||
if (is_array($phrases) && @sizeof($phrases) != 0) {
|
||||
foreach ($phrases as &$row) {
|
||||
foreach ($phrases as $row) {
|
||||
$array['phrases'][$x]['name'] = "phrase:".$row["phrase_name"];
|
||||
$array['phrases'][$x]['value'] = "phrase:".$row["phrase_uuid"];
|
||||
$x++;
|
||||
|
||||
@@ -845,7 +845,7 @@
|
||||
if (is_numeric(trim($phone_number ?? '', ' +'))) {
|
||||
if (isset($_SESSION["format"]["phone"])) {
|
||||
$phone_number = trim($phone_number, ' +');
|
||||
foreach ($_SESSION["format"]["phone"] as &$format) {
|
||||
foreach ($_SESSION["format"]["phone"] as $format) {
|
||||
$format_count = substr_count($format, 'x');
|
||||
$format_count = $format_count + substr_count($format, 'R');
|
||||
$format_count = $format_count + substr_count($format, 'r');
|
||||
|
||||
@@ -299,7 +299,7 @@
|
||||
echo "<select name='domain_name' class='txt login' style='".$placeholder_color." width: 200px; text-align: center; text-align-last: center; margin-bottom: 8px;' onclick=\"this.style.color='".$click_change_color."';\" onchange=\"this.style.color='".$click_change_color."';\">\n";
|
||||
echo " <option value='' disabled selected hidden>".$text['label-domain']."</option>\n";
|
||||
sort($_SESSION['login']['domain_name']);
|
||||
foreach ($_SESSION['login']['domain_name'] as &$row) {
|
||||
foreach ($_SESSION['login']['domain_name'] as $row) {
|
||||
echo " <option value='".escape($row)."'>".escape($row)."</option>\n";
|
||||
}
|
||||
echo "</select><br />\n";
|
||||
|
||||
@@ -142,7 +142,7 @@ function save_gateway_xml() {
|
||||
$database = new database;
|
||||
$result = $database->select($sql, $parameters, 'all');
|
||||
if (!empty($result)) {
|
||||
foreach ($result as &$row) {
|
||||
foreach ($result as $row) {
|
||||
if ($row['enabled'] != "false") {
|
||||
//set the default profile as external
|
||||
$profile = $row['profile'];
|
||||
@@ -284,7 +284,7 @@ function save_var_xml() {
|
||||
$prev_var_category = '';
|
||||
$xml = '';
|
||||
if (!empty($variables)) {
|
||||
foreach ($variables as &$row) {
|
||||
foreach ($variables as $row) {
|
||||
if ($row['var_category'] != 'Provision') {
|
||||
if ($prev_var_category != $row['var_category']) {
|
||||
$xml .= "\n<!-- ".$row['var_category']." -->\n";
|
||||
@@ -359,7 +359,7 @@ function outbound_route_to_bridge($domain_uuid, $destination_number, array $chan
|
||||
$result = $database->select($sql, $parameters, 'all');
|
||||
unset($sql, $parameters);
|
||||
if (!empty($result)) {
|
||||
foreach ($result as &$row) {
|
||||
foreach ($result as $row) {
|
||||
$dialplan_uuid = $row["dialplan_uuid"];
|
||||
$dialplan_detail_uuid = $row["dialplan_detail_uuid"];
|
||||
$outbound_routes[$dialplan_uuid][$dialplan_detail_uuid]["dialplan_detail_tag"] = $row["dialplan_detail_tag"];
|
||||
@@ -371,9 +371,9 @@ function outbound_route_to_bridge($domain_uuid, $destination_number, array $chan
|
||||
|
||||
if (!empty($outbound_routes)) {
|
||||
$x = 0;
|
||||
foreach ($outbound_routes as &$dialplan) {
|
||||
foreach ($outbound_routes as $dialplan) {
|
||||
$condition_match = [];
|
||||
foreach ($dialplan as &$dialplan_details) {
|
||||
foreach ($dialplan as $dialplan_details) {
|
||||
if (!empty($dialplan_details['dialplan_detail_tag']) && $dialplan_details['dialplan_detail_tag'] == "condition") {
|
||||
if ($dialplan_details['dialplan_detail_type'] == "destination_number") {
|
||||
$pattern = '/'.$dialplan_details['dialplan_detail_data'].'/';
|
||||
@@ -404,7 +404,7 @@ function outbound_route_to_bridge($domain_uuid, $destination_number, array $chan
|
||||
}
|
||||
|
||||
if (!in_array('false', $condition_match)) {
|
||||
foreach ($dialplan as &$dialplan_details) {
|
||||
foreach ($dialplan as $dialplan_details) {
|
||||
$dialplan_detail_data = $dialplan_details['dialplan_detail_data'] ?? '';
|
||||
if (
|
||||
!empty($dialplan_details['dialplan_detail_tag']) &&
|
||||
@@ -433,7 +433,7 @@ function outbound_route_to_bridge($domain_uuid, $destination_number, array $chan
|
||||
}
|
||||
//$destination_number = '1231234';
|
||||
//$bridge_array = outbound_route_to_bridge ($domain_uuid, $destination_number);
|
||||
//foreach ($bridge_array as &$bridge) {
|
||||
//foreach ($bridge_array as $bridge) {
|
||||
// echo "bridge: ".$bridge."<br />";
|
||||
//}
|
||||
|
||||
@@ -561,7 +561,7 @@ if (!function_exists('save_call_center_xml')) {
|
||||
|
||||
//prepare Queue XML string
|
||||
$x=0;
|
||||
foreach ($call_center_queues as &$row) {
|
||||
foreach ($call_center_queues as $row) {
|
||||
$queue_name = $row["queue_name"];
|
||||
$queue_extension = $row["queue_extension"];
|
||||
$queue_strategy = $row["queue_strategy"];
|
||||
@@ -631,7 +631,7 @@ if (!function_exists('save_call_center_xml')) {
|
||||
|
||||
$x=0;
|
||||
if (!empty($result)) {
|
||||
foreach ($result as &$row) {
|
||||
foreach ($result as $row) {
|
||||
//get the values from the db and set as php variables
|
||||
$agent_name = $row["agent_name"];
|
||||
$agent_type = $row["agent_type"];
|
||||
@@ -721,7 +721,7 @@ if (!function_exists('save_call_center_xml')) {
|
||||
|
||||
$x=0;
|
||||
if (!empty($result)) {
|
||||
foreach ($result as &$row) {
|
||||
foreach ($result as $row) {
|
||||
$agent_name = $row["agent_name"];
|
||||
$queue_name = $row["queue_name"];
|
||||
$tier_level = $row["tier_level"];
|
||||
@@ -913,7 +913,7 @@ if (!function_exists('save_sip_profile_xml')) {
|
||||
$result_2 = $database->select($sql, $parameters, 'all');
|
||||
if (!empty($result_2)) {
|
||||
$sip_profile_settings = '';
|
||||
foreach ($result_2 as &$row_2) {
|
||||
foreach ($result_2 as $row_2) {
|
||||
$sip_profile_settings .= " <param name=\"".$row_2["sip_profile_setting_name"]."\" value=\"".$row_2["sip_profile_setting_value"]."\"/>\n";
|
||||
}
|
||||
}
|
||||
@@ -991,7 +991,7 @@ if(!function_exists('path_join')) {
|
||||
}
|
||||
|
||||
$prefix = null;
|
||||
foreach($paths as &$path) {
|
||||
foreach ($paths as $path) {
|
||||
if($prefix === null && !empty($path)) {
|
||||
if(substr($path, 0, 1) == '/') $prefix = '/';
|
||||
else $prefix = '';
|
||||
|
||||
Reference in New Issue
Block a user