Use not empty arround the arrays
This commit is contained in:
parent
a066277460
commit
d48f4a0b89
|
|
@ -378,6 +378,7 @@
|
|||
|
||||
//add the destinations and asscociated dialplans
|
||||
$x = 0;
|
||||
if (!empty($destination_numbers)) {
|
||||
foreach($destination_numbers as $destination_number) {
|
||||
|
||||
//convert the number to a regular expression
|
||||
|
|
@ -457,6 +458,7 @@
|
|||
}
|
||||
|
||||
//set the last destination_app and destination_data variables
|
||||
if (!empty($destination_actions)) {
|
||||
foreach($destination_actions as $destination_action) {
|
||||
$action_array = explode(":", $destination_action, 2);
|
||||
if (isset($action_array[0]) && !empty($action_array[0])) {
|
||||
|
|
@ -464,6 +466,7 @@
|
|||
$destination_data = $action_array[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//build the xml dialplan
|
||||
$dialplan["dialplan_xml"] = "<extension name=\"".xml::sanitize($dialplan["dialplan_name"])."\" continue=\"false\" uuid=\"".xml::sanitize($dialplan_uuid)."\">\n";
|
||||
|
|
@ -533,6 +536,7 @@
|
|||
}
|
||||
|
||||
//add the actions to the dialplan_xml
|
||||
if (!empty($destination_actions)) {
|
||||
foreach($destination_actions as $destination_action) {
|
||||
$action_array = explode(":", $destination_action, 2);
|
||||
if (isset($action_array[0]) && !empty($action_array[0])) {
|
||||
|
|
@ -558,6 +562,7 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$dialplan["dialplan_xml"] .= " </condition>\n";
|
||||
$dialplan["dialplan_xml"] .= "</extension>\n";
|
||||
|
|
@ -921,6 +926,7 @@
|
|||
}
|
||||
|
||||
//add the actions
|
||||
if (!empty($destination_actions)) {
|
||||
foreach($destination_actions as $field) {
|
||||
$action_array = explode(":", $field, 2);
|
||||
$action_app = $action_array[0] ?? null;
|
||||
|
|
@ -947,6 +953,7 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//delete the previous details
|
||||
$sql = "delete from v_dialplan_details ";
|
||||
|
|
@ -1020,6 +1027,7 @@
|
|||
|
||||
//prepare the $actions array
|
||||
$y=0;
|
||||
if (!empty($destination_actions)) {
|
||||
foreach($destination_actions as $destination_action) {
|
||||
$action_array = explode(":", $destination_action, 2);
|
||||
$action_app = $action_array[0] ?? null;
|
||||
|
|
@ -1032,6 +1040,7 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$array['destinations'][$x]["destination_actions"] = json_encode($actions ?? null);
|
||||
$array['destinations'][$x]["destination_order"] = $destination_order;
|
||||
$array['destinations'][$x]["destination_enabled"] = $destination_enabled;
|
||||
|
|
@ -1042,6 +1051,7 @@
|
|||
$array['dialplans'][] = $dialplan;
|
||||
unset($dialplan);
|
||||
} //foreach($destination_numbers as $destination_number)
|
||||
}
|
||||
|
||||
//add the dialplan permission
|
||||
$p = new permissions;
|
||||
|
|
@ -1088,6 +1098,7 @@
|
|||
|
||||
//add the destinations and asscociated dialplans
|
||||
$x = 0;
|
||||
if (!empty($destination_numbers)) {
|
||||
foreach($destination_numbers as $destination_number) {
|
||||
|
||||
//if empty then get new uuid
|
||||
|
|
@ -1095,7 +1106,6 @@
|
|||
$destination_uuid = uuid();
|
||||
}
|
||||
|
||||
|
||||
//if the destination range is true then set a new uuid for each iteration of the loop
|
||||
if ($destination_number_range) {
|
||||
$destination_uuid = uuid();
|
||||
|
|
@ -1113,6 +1123,7 @@
|
|||
$array['destinations'][$x]["destination_description"] = $destination_description;
|
||||
$x++;
|
||||
}
|
||||
}
|
||||
|
||||
//save the destination
|
||||
$database = new database;
|
||||
|
|
@ -1279,6 +1290,7 @@
|
|||
|
||||
//remove previous fax details
|
||||
$x = 0;
|
||||
if (!empty($dialplan_details)) {
|
||||
foreach($dialplan_details as $row) {
|
||||
if ($row['dialplan_detail_data'] == "tone_detect_hits=1") {
|
||||
unset($dialplan_details[$x]);
|
||||
|
|
@ -1301,6 +1313,7 @@
|
|||
//increment the row id
|
||||
$x++;
|
||||
}
|
||||
}
|
||||
|
||||
//set the defaults
|
||||
if (empty($destination_order)) { $destination_order = '100'; }
|
||||
|
|
@ -1609,6 +1622,7 @@
|
|||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
$x=0;
|
||||
if (!empty($destination_conditions)) {
|
||||
foreach ($destination_conditions as $row) {
|
||||
echo " <select name=\"destination_conditions[$x][condition_field]\" id='destination_conditions' class='formfld' style='".$select_style."'>\n";
|
||||
echo " <option value=''></option>\n";
|
||||
|
|
@ -1627,6 +1641,7 @@
|
|||
}
|
||||
$x++;
|
||||
}
|
||||
}
|
||||
echo " ".$text['description-destination_conditions']."\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
|
@ -1668,6 +1683,7 @@
|
|||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <select name='fax_uuid' id='fax_uuid' class='formfld' style='".$select_style."'>\n";
|
||||
echo " <option value=''></option>\n";
|
||||
if (!empty($result)) {
|
||||
foreach ($result as &$row) {
|
||||
if ($row["fax_uuid"] == $fax_uuid) {
|
||||
echo " <option value='".escape($row["fax_uuid"])."' selected='selected'>".escape($row["fax_extension"])." ".escape($row["fax_name"])."</option>\n";
|
||||
|
|
@ -1676,6 +1692,7 @@
|
|||
echo " <option value='".escape($row["fax_uuid"])."'>".escape($row["fax_extension"])." ".escape($row["fax_name"])."</option>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
echo " </select>\n";
|
||||
echo " <br />\n";
|
||||
echo " ".$text['description-fax_uuid']."\n";
|
||||
|
|
@ -1694,6 +1711,7 @@
|
|||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <select name='provider_uuid' id='provider_uuid' class='formfld' style='".$select_style."'>\n";
|
||||
echo " <option value=''></option>\n";
|
||||
if (!empty($providers)) {
|
||||
foreach ($providers as &$row) {
|
||||
if ($row["provider_uuid"] == $provider_uuid) {
|
||||
echo " <option value='".escape($row["provider_uuid"])."' selected='selected'>".escape($row["provider_name"])."</option>\n";
|
||||
|
|
@ -1702,6 +1720,7 @@
|
|||
echo " <option value='".escape($row["provider_uuid"])."'>".escape($row["provider_name"])."</option>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
echo " </select>\n";
|
||||
echo " <br />\n";
|
||||
echo " ".$text['description-providers']."\n";
|
||||
|
|
@ -1718,10 +1737,12 @@
|
|||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <select name=\"user_uuid\" class='formfld' style='width: auto;'>\n";
|
||||
echo " <option value=\"\"></option>\n";
|
||||
if (!empty($users)) {
|
||||
foreach($users as $field) {
|
||||
if ($field['user_uuid'] == $user_uuid) { $selected = "selected='selected'"; } else { $selected = ''; }
|
||||
echo " <option value='".escape($field['user_uuid'])."' $selected>".escape($field['username'])."</option>\n";
|
||||
}
|
||||
}
|
||||
echo " </select>";
|
||||
unset($users);
|
||||
echo " <br>\n";
|
||||
|
|
@ -1739,10 +1760,12 @@
|
|||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <select name=\"group_uuid\" class='formfld' style='width: auto;'>\n";
|
||||
echo " <option value=\"\"></option>\n";
|
||||
if (!empty($groups)) {
|
||||
foreach($groups as $field) {
|
||||
if ($field['group_uuid'] == $group_uuid) { $selected = "selected='selected'"; } else { $selected = ''; }
|
||||
echo " <option value='".escape($field['group_uuid'])."' $selected>".escape($field['group_name'])."</option>\n";
|
||||
}
|
||||
}
|
||||
echo " </select>";
|
||||
unset($groups);
|
||||
echo " <br>\n";
|
||||
|
|
@ -1868,6 +1891,7 @@
|
|||
else {
|
||||
echo " <option value=''>".$text['select-global']."</option>\n";
|
||||
}
|
||||
if (!empty($_SESSION['domains'])) {
|
||||
foreach ($_SESSION['domains'] as $row) {
|
||||
if ($row['domain_uuid'] == $domain_uuid) {
|
||||
echo " <option value='".escape($row['domain_uuid'])."' selected='selected'>".escape($row['domain_name'])."</option>\n";
|
||||
|
|
@ -1876,6 +1900,7 @@
|
|||
echo " <option value='".escape($row['domain_uuid'])."'>".escape($row['domain_name'])."</option>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
echo " </select>\n";
|
||||
echo "<br />\n";
|
||||
echo $text['description-domain_name']."\n";
|
||||
|
|
@ -1975,3 +2000,4 @@
|
|||
require_once "resources/footer.php";
|
||||
|
||||
?>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue