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++;
|
||||
|
||||
Reference in New Issue
Block a user