mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2025-12-30 00:53:50 +00:00
Prevent duplicate values from being saved in the vars.xml file and remove some trailing spaces and fix some of the indentation.
This commit is contained in:
@@ -121,15 +121,15 @@ EOD;
|
||||
}
|
||||
}
|
||||
unset($prep_statement, $sql, $result);
|
||||
|
||||
|
||||
if ( $country_iso===NULL ) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if(isset($countries[$country_iso])){
|
||||
$country = $countries[$country_iso];
|
||||
|
||||
// Set default Country ISO code
|
||||
|
||||
// Set default Country ISO code
|
||||
$sql = "select count(*) as num_rows from v_vars ";
|
||||
$sql .= "where var_name = 'default_country' ";
|
||||
$sql .= "and var_cat = 'Defaults' ";
|
||||
@@ -165,8 +165,8 @@ EOD;
|
||||
}
|
||||
}
|
||||
unset($prep_statement, $sql);
|
||||
|
||||
// Set default Country code
|
||||
|
||||
//Set default Country code
|
||||
$sql = "select count(*) as num_rows from v_vars ";
|
||||
$sql .= "where var_name = 'default_countrycode' ";
|
||||
$sql .= "and var_cat = 'Defaults' ";
|
||||
@@ -201,8 +201,8 @@ EOD;
|
||||
}
|
||||
}
|
||||
unset($prep_statement, $sql);
|
||||
|
||||
// Set default International Direct Dialing code
|
||||
|
||||
// Set default International Direct Dialing code
|
||||
$sql = "select count(*) as num_rows from v_vars ";
|
||||
$sql .= "where var_name = 'default_exitcode' ";
|
||||
$sql .= "and var_cat = 'Defaults' ";
|
||||
@@ -242,15 +242,15 @@ EOD;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$x = 1;
|
||||
|
||||
|
||||
//if there are no variables in the vars table then add them
|
||||
if ($domains_processed == 1) {
|
||||
|
||||
|
||||
$result = json_decode($vars, true);
|
||||
foreach($result as $row) {
|
||||
|
||||
|
||||
$sql = "select count(*) as num_rows from v_vars ";
|
||||
$sql .= "where var_name = '".$row['var_name']."' ";
|
||||
$sql .= "and var_cat = '".$row['var_cat']."' ";
|
||||
@@ -259,7 +259,7 @@ EOD;
|
||||
$prep_statement->execute();
|
||||
$row2 = $prep_statement->fetch(PDO::FETCH_ASSOC);
|
||||
if ($row2['num_rows'] == 0) {
|
||||
|
||||
|
||||
$sql = "insert into v_vars ";
|
||||
$sql .= "(";
|
||||
$sql .= "var_uuid, ";
|
||||
@@ -283,11 +283,9 @@ EOD;
|
||||
$db->exec($sql);
|
||||
unset($sql);
|
||||
$x++;
|
||||
|
||||
}
|
||||
}
|
||||
unset($prep_statement, $row2);
|
||||
|
||||
}
|
||||
unset($result, $row);
|
||||
}
|
||||
@@ -344,4 +342,4 @@ EOD;
|
||||
//save the vars.xml file
|
||||
save_var_xml();
|
||||
}
|
||||
?>
|
||||
?>
|
||||
@@ -410,17 +410,12 @@ function save_var_xml() {
|
||||
$xml .= "<!-- ".base64_decode($row['var_description'])." -->\n";
|
||||
}
|
||||
}
|
||||
|
||||
if ($row['var_cat'] == 'Exec-Set') { $var_cmd = 'exec-set'; } else { $var_cmd = 'set'; }
|
||||
if (strlen($row['var_hostname']) == 0) {
|
||||
$xml .= "<X-PRE-PROCESS cmd=\"set\" data=\"".$row['var_name']."=".$row['var_value']."\"/>\n";
|
||||
$xml .= "<X-PRE-PROCESS cmd=\"".$var_cmd."\" data=\"".$row['var_name']."=".$row['var_value']."\" />\n";
|
||||
} elseif ($row['var_hostname'] == $hostname) {
|
||||
$xml .= "<X-PRE-PROCESS cmd=\"set\" data=\"".$row['var_name']."=".$row['var_value']."\"/>\n";
|
||||
}
|
||||
$var_cmd = 'set';
|
||||
if ($row['var_cat'] == 'Exec-Set') { $var_cmd = 'exec-set'; }
|
||||
if (strlen($row['var_hostname']) == 0) {
|
||||
$xml .= "<X-PRE-PROCESS cmd=\"".$var_cmd."\" data=\"".$row['var_name']."=".$row['var_value']."\"/>\n";
|
||||
} elseif ($row['var_hostname'] == $hostname) {
|
||||
$xml .= "<X-PRE-PROCESS cmd=\"".$var_cmd."\" data=\"".$row['var_name']."=".$row['var_value']."\"/>\n";
|
||||
$xml .= "<X-PRE-PROCESS cmd=\"".$var_cmd."\" data=\"".$row['var_name']."=".$row['var_value']."\" />\n";
|
||||
}
|
||||
}
|
||||
$prev_var_cat = $row['var_cat'];
|
||||
@@ -1484,7 +1479,7 @@ if(!function_exists('path_join')) {
|
||||
}
|
||||
|
||||
if(!function_exists('find_php_by_extension')) {
|
||||
/*Tesetd on WAMP and OpenServer*/
|
||||
// Tested on WAMP and OpenServer
|
||||
function find_php_by_extension(){
|
||||
$bin_dir = get_cfg_var('extension_dir');
|
||||
|
||||
@@ -1502,4 +1497,4 @@ if(!function_exists('find_php_by_extension')) {
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
Reference in New Issue
Block a user