Dialplan - Edit: Updates for PHP 8.1
This commit is contained in:
parent
dc613c7c44
commit
c9122ded11
|
|
@ -66,7 +66,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
//set the app_uuid
|
//set the app_uuid
|
||||||
if (is_uuid($_REQUEST["app_uuid"])) {
|
if (!empty($_REQUEST["app_uuid"]) && is_uuid($_REQUEST["app_uuid"])) {
|
||||||
$app_uuid = $_REQUEST["app_uuid"];
|
$app_uuid = $_REQUEST["app_uuid"];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -77,15 +77,15 @@
|
||||||
$dialplan_number = $_POST["dialplan_number"];
|
$dialplan_number = $_POST["dialplan_number"];
|
||||||
$dialplan_order = $_POST["dialplan_order"];
|
$dialplan_order = $_POST["dialplan_order"];
|
||||||
$dialplan_continue = $_POST["dialplan_continue"] != '' ? $_POST["dialplan_continue"] : 'false';
|
$dialplan_continue = $_POST["dialplan_continue"] != '' ? $_POST["dialplan_continue"] : 'false';
|
||||||
$dialplan_details = $_POST["dialplan_details"];
|
$dialplan_details = $_POST["dialplan_details"] ?? null;
|
||||||
$dialplan_context = $_POST["dialplan_context"];
|
$dialplan_context = $_POST["dialplan_context"];
|
||||||
$dialplan_enabled = $_POST["dialplan_enabled"];
|
$dialplan_enabled = $_POST["dialplan_enabled"];
|
||||||
$dialplan_description = $_POST["dialplan_description"];
|
$dialplan_description = $_POST["dialplan_description"];
|
||||||
$dialplan_details_delete = $_POST["dialplan_details_delete"];
|
$dialplan_details_delete = $_POST["dialplan_details_delete"] ?? null;
|
||||||
}
|
}
|
||||||
|
|
||||||
//get the list of applications
|
//get the list of applications
|
||||||
if (!is_array($_SESSION['switch']['applications'])) {
|
if (empty($_SESSION['switch']['applications']) || !is_array($_SESSION['switch']['applications'])) {
|
||||||
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
|
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
|
||||||
if ($fp) {
|
if ($fp) {
|
||||||
$result = event_socket_request($fp, 'api show application');
|
$result = event_socket_request($fp, 'api show application');
|
||||||
|
|
@ -132,11 +132,11 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
//process the http post data by submitted action
|
//process the http post data by submitted action
|
||||||
if ($_POST['action'] != '' && is_uuid($_POST['dialplan_uuid'])) {
|
if (!empty($_POST['action']) && is_uuid($_POST['dialplan_uuid'])) {
|
||||||
$array[0]['checked'] = 'true';
|
$array[0]['checked'] = 'true';
|
||||||
$array[0]['uuid'] = $_POST['dialplan_uuid'];
|
$array[0]['uuid'] = $_POST['dialplan_uuid'];
|
||||||
|
|
||||||
$list_page = 'dialplans.php'.(is_uuid($app_uuid) ? '?app_uuid='.urlencode($app_uuid) : null);
|
$list_page = 'dialplans.php'.(!empty($app_uuid) && is_uuid($app_uuid) ? '?app_uuid='.urlencode($app_uuid) : null);
|
||||||
|
|
||||||
switch ($_POST['action']) {
|
switch ($_POST['action']) {
|
||||||
case 'copy':
|
case 'copy':
|
||||||
|
|
@ -148,7 +148,7 @@
|
||||||
permission_exists('time_condition_add')
|
permission_exists('time_condition_add')
|
||||||
) {
|
) {
|
||||||
$obj = new dialplan;
|
$obj = new dialplan;
|
||||||
$obj->app_uuid = $app_uuid;
|
$obj->app_uuid = $app_uuid ?? null;
|
||||||
$obj->list_page = $list_page;
|
$obj->list_page = $list_page;
|
||||||
$obj->copy($array);
|
$obj->copy($array);
|
||||||
}
|
}
|
||||||
|
|
@ -162,7 +162,7 @@
|
||||||
permission_exists('time_condition_delete')
|
permission_exists('time_condition_delete')
|
||||||
) {
|
) {
|
||||||
$obj = new dialplan;
|
$obj = new dialplan;
|
||||||
$obj->app_uuid = $app_uuid;
|
$obj->app_uuid = $app_uuid ?? null;
|
||||||
$obj->list_page = $list_page;
|
$obj->list_page = $list_page;
|
||||||
$obj->delete($array);
|
$obj->delete($array);
|
||||||
}
|
}
|
||||||
|
|
@ -240,7 +240,7 @@
|
||||||
$array['dialplans'][$x]['dialplan_enabled'] = $_POST["dialplan_enabled"];
|
$array['dialplans'][$x]['dialplan_enabled'] = $_POST["dialplan_enabled"];
|
||||||
$array['dialplans'][$x]['dialplan_description'] = $_POST["dialplan_description"];
|
$array['dialplans'][$x]['dialplan_description'] = $_POST["dialplan_description"];
|
||||||
$y = 0;
|
$y = 0;
|
||||||
if (is_array($_POST["dialplan_details"])) {
|
if (!empty($_POST["dialplan_details"]) && is_array($_POST["dialplan_details"])) {
|
||||||
foreach ($_POST["dialplan_details"] as $row) {
|
foreach ($_POST["dialplan_details"] as $row) {
|
||||||
if (!empty($row["dialplan_detail_tag"])) {
|
if (!empty($row["dialplan_detail_tag"])) {
|
||||||
if (!empty($row["dialplan_detail_uuid"])) {
|
if (!empty($row["dialplan_detail_uuid"])) {
|
||||||
|
|
@ -275,7 +275,7 @@
|
||||||
//add or update the database
|
//add or update the database
|
||||||
$database = new database;
|
$database = new database;
|
||||||
$database->app_name = 'dialplans';
|
$database->app_name = 'dialplans';
|
||||||
$database->app_uuid = $app_uuid;
|
$database->app_uuid = $app_uuid ?? null;
|
||||||
if ( strlen($dialplan_uuid)>0 )
|
if ( strlen($dialplan_uuid)>0 )
|
||||||
$database->uuid($dialplan_uuid);
|
$database->uuid($dialplan_uuid);
|
||||||
$database->save($array);
|
$database->save($array);
|
||||||
|
|
@ -290,7 +290,7 @@
|
||||||
) {
|
) {
|
||||||
$obj = new dialplan;
|
$obj = new dialplan;
|
||||||
$obj->dialplan_uuid = $dialplan_uuid;
|
$obj->dialplan_uuid = $dialplan_uuid;
|
||||||
$obj->app_uuid = $app_uuid;
|
$obj->app_uuid = $app_uuid ?? null;
|
||||||
$obj->delete_details($dialplan_details_delete);
|
$obj->delete_details($dialplan_details_delete);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -320,13 +320,13 @@
|
||||||
else if ($action == "update") {
|
else if ($action == "update") {
|
||||||
message::add($text['message-update']);
|
message::add($text['message-update']);
|
||||||
}
|
}
|
||||||
header("Location: ?id=".escape($dialplan_uuid).(is_uuid($app_uuid) ? "&app_uuid=".$app_uuid : null));
|
header("Location: ?id=".escape($dialplan_uuid).(!empty($app_uuid) && is_uuid($app_uuid) ? "&app_uuid=".$app_uuid : null));
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
} //(count($_POST)>0 && empty($_POST["persistformvar"]))
|
} //(count($_POST)>0 && empty($_POST["persistformvar"]))
|
||||||
|
|
||||||
//pre-populate the form
|
//pre-populate the form
|
||||||
if (count($_GET) > 0 && $_POST["persistformvar"] != "true") {
|
if (!empty($_GET) && count($_GET) > 0 && (empty($_POST["persistformvar"]) || $_POST["persistformvar"] != "true")) {
|
||||||
$sql = "select * from v_dialplans ";
|
$sql = "select * from v_dialplans ";
|
||||||
$sql .= "where dialplan_uuid = :dialplan_uuid ";
|
$sql .= "where dialplan_uuid = :dialplan_uuid ";
|
||||||
$parameters['dialplan_uuid'] = $dialplan_uuid;
|
$parameters['dialplan_uuid'] = $dialplan_uuid;
|
||||||
|
|
@ -506,10 +506,10 @@
|
||||||
echo "<div class='action_bar' id='action_bar'>\n";
|
echo "<div class='action_bar' id='action_bar'>\n";
|
||||||
echo " <div class='heading'><b>".$text['title-dialplan_edit']."</b></div>\n";
|
echo " <div class='heading'><b>".$text['title-dialplan_edit']."</b></div>\n";
|
||||||
echo " <div class='actions'>\n";
|
echo " <div class='actions'>\n";
|
||||||
echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'id'=>'btn_back','link'=>'dialplans.php'.(is_uuid($app_uuid) ? "?app_uuid=".urlencode($app_uuid) : null)]);
|
echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'id'=>'btn_back','link'=>'dialplans.php'.(!empty($app_uuid) && is_uuid($app_uuid) ? "?app_uuid=".urlencode($app_uuid) : null)]);
|
||||||
if ($action == 'update') {
|
if ($action == 'update') {
|
||||||
if (permission_exists('dialplan_xml')) {
|
if (permission_exists('dialplan_xml')) {
|
||||||
echo button::create(['type'=>'button','label'=>$text['button-xml'],'icon'=>'code','style'=>'margin-left: 15px;','link'=>'dialplan_xml.php?id='.urlencode($dialplan_uuid).(is_uuid($app_uuid) ? "&app_uuid=".urlencode($app_uuid) : null)]);
|
echo button::create(['type'=>'button','label'=>$text['button-xml'],'icon'=>'code','style'=>'margin-left: 15px;','link'=>'dialplan_xml.php?id='.urlencode($dialplan_uuid ?? null).(!empty($app_uuid) && is_uuid($app_uuid) ? "&app_uuid=".urlencode($app_uuid ?? null) : null)]);
|
||||||
}
|
}
|
||||||
$button_margin = 'margin-left: 15px;';
|
$button_margin = 'margin-left: 15px;';
|
||||||
if (
|
if (
|
||||||
|
|
@ -519,7 +519,7 @@
|
||||||
permission_exists('fifo_add') ||
|
permission_exists('fifo_add') ||
|
||||||
permission_exists('time_condition_add')
|
permission_exists('time_condition_add')
|
||||||
) {
|
) {
|
||||||
echo button::create(['type'=>'button','label'=>$text['button-copy'],'icon'=>$_SESSION['theme']['button_icon_copy'],'name'=>'btn_copy','style'=>$button_margin,'onclick'=>"modal_open('modal-copy','btn_copy');"]);
|
echo button::create(['type'=>'button','label'=>$text['button-copy'],'icon'=>$_SESSION['theme']['button_icon_copy'],'name'=>'btn_copy','style'=>$button_margin ?? null,'onclick'=>"modal_open('modal-copy','btn_copy');"]);
|
||||||
unset($button_margin);
|
unset($button_margin);
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
|
|
@ -530,7 +530,7 @@
|
||||||
permission_exists('fifo_delete') ||
|
permission_exists('fifo_delete') ||
|
||||||
permission_exists('time_condition_delete')
|
permission_exists('time_condition_delete')
|
||||||
) {
|
) {
|
||||||
echo button::create(['type'=>'button','label'=>$text['button-delete'],'icon'=>$_SESSION['theme']['button_icon_delete'],'name'=>'btn_delete','style'=>$button_margin,'onclick'=>"modal_open('modal-delete','btn_delete');"]);
|
echo button::create(['type'=>'button','label'=>$text['button-delete'],'icon'=>$_SESSION['theme']['button_icon_delete'],'name'=>'btn_delete','style'=>$button_margin ?? null,'onclick'=>"modal_open('modal-delete','btn_delete');"]);
|
||||||
unset($button_margin);
|
unset($button_margin);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -802,7 +802,7 @@
|
||||||
foreach($group as $index => $row) {
|
foreach($group as $index => $row) {
|
||||||
|
|
||||||
//get the values from the database and set as variables
|
//get the values from the database and set as variables
|
||||||
$dialplan_detail_uuid = $row['dialplan_detail_uuid'];
|
$dialplan_detail_uuid = $row['dialplan_detail_uuid'] ?? null;
|
||||||
$dialplan_detail_tag = $row['dialplan_detail_tag'];
|
$dialplan_detail_tag = $row['dialplan_detail_tag'];
|
||||||
$dialplan_detail_type = $row['dialplan_detail_type'];
|
$dialplan_detail_type = $row['dialplan_detail_type'];
|
||||||
$dialplan_detail_data = $row['dialplan_detail_data'];
|
$dialplan_detail_data = $row['dialplan_detail_data'];
|
||||||
|
|
@ -1051,7 +1051,7 @@
|
||||||
|
|
||||||
echo "<br /><br />\n";
|
echo "<br /><br />\n";
|
||||||
|
|
||||||
echo "<input type='hidden' name='app_uuid' value='".escape($app_uuid)."'>\n";
|
echo "<input type='hidden' name='app_uuid' value='".escape($app_uuid ?? null)."'>\n";
|
||||||
if ($action == "update") {
|
if ($action == "update") {
|
||||||
echo " <input type='hidden' name='dialplan_uuid' value='".escape($dialplan_uuid)."'>\n";
|
echo " <input type='hidden' name='dialplan_uuid' value='".escape($dialplan_uuid)."'>\n";
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue