Update switch.php
This commit is contained in:
parent
c88ecf8976
commit
e4462ba232
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
The Initial Developer of the Original Code is
|
The Initial Developer of the Original Code is
|
||||||
Mark J Crane <markjcrane@fusionpbx.com>
|
Mark J Crane <markjcrane@fusionpbx.com>
|
||||||
Portions created by the Initial Developer are Copyright (C) 2008-2016
|
Portions created by the Initial Developer are Copyright (C) 2008-2018
|
||||||
the Initial Developer. All Rights Reserved.
|
the Initial Developer. All Rights Reserved.
|
||||||
|
|
||||||
Contributor(s):
|
Contributor(s):
|
||||||
|
|
@ -399,33 +399,33 @@ function save_var_xml() {
|
||||||
//build the xml
|
//build the xml
|
||||||
$sql = "select * from v_vars ";
|
$sql = "select * from v_vars ";
|
||||||
$sql .= "where var_enabled = 'true' ";
|
$sql .= "where var_enabled = 'true' ";
|
||||||
$sql .= "order by var_cat, var_order asc ";
|
$sql .= "order by var_category, var_order asc ";
|
||||||
$prep_statement = $db->prepare(check_sql($sql));
|
$prep_statement = $db->prepare(check_sql($sql));
|
||||||
$prep_statement->execute();
|
$prep_statement->execute();
|
||||||
$prev_var_cat = '';
|
$variables = $prep_statement->fetchAll(PDO::FETCH_ASSOC);
|
||||||
$result = $prep_statement->fetchAll(PDO::FETCH_ASSOC);
|
$prev_var_category = '';
|
||||||
$xml = '';
|
$xml = '';
|
||||||
foreach ($result as &$row) {
|
foreach ($variables as &$row) {
|
||||||
if ($row['var_cat'] != 'Provision') {
|
if ($row['var_cat'] != 'Provision') {
|
||||||
if ($prev_var_cat != $row['var_cat']) {
|
if ($prev_var_cat != $row['var_cat']) {
|
||||||
$xml .= "\n<!-- ".$row['var_cat']." -->\n";
|
$xml .= "\n<!-- ".$row['var_category']." -->\n";
|
||||||
if (strlen($row["var_description"]) > 0) {
|
if (strlen($row["var_description"]) > 0) {
|
||||||
$xml .= "<!-- ".base64_decode($row['var_description'])." -->\n";
|
$xml .= "<!-- ".base64_decode($row['var_description'])." -->\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (strlen($row['var_command']) == 0) { $row['var_command'] = 'set'; }
|
||||||
if ($row['var_cat'] == 'Exec-Set') { $var_cmd = 'exec-set'; } else { $var_cmd = 'set'; }
|
if ($row['var_category'] == 'Exec-Set') { $row['var_command'] = 'exec-set'; }
|
||||||
if (strlen($row['var_hostname']) == 0) {
|
if (strlen($row['var_hostname']) == 0) {
|
||||||
$xml .= "<X-PRE-PROCESS cmd=\"".$var_cmd."\" data=\"".$row['var_name']."=".$row['var_value']."\" />\n";
|
$xml .= "<X-PRE-PROCESS cmd=\"".$row['var_command']."\" data=\"".$row['var_name']."=".$row['var_value']."\" />\n";
|
||||||
} elseif ($row['var_hostname'] == $hostname) {
|
} 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=\"".$row['var_command']."\" data=\"".$row['var_name']."=".$row['var_value']."\" />\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$prev_var_cat = $row['var_cat'];
|
$prev_var_category = $row['var_category'];
|
||||||
}
|
}
|
||||||
$xml .= "\n";
|
$xml .= "\n";
|
||||||
fwrite($fout, $xml);
|
fwrite($fout, $xml);
|
||||||
unset($xml);
|
unset($prep_statement, $variables, $xml);
|
||||||
fclose($fout);
|
fclose($fout);
|
||||||
|
|
||||||
//apply settings
|
//apply settings
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue