Fix the dialplan_xml filter

This commit is contained in:
FusionPBX
2026-02-26 04:52:27 -07:00
committed by GitHub
parent d11cdd1f26
commit c49ae14aa4
2 changed files with 31 additions and 1 deletions

View File

@@ -46,6 +46,9 @@
if (!empty($_REQUEST['app_uuid']) && is_uuid($_REQUEST['app_uuid'])) {
$app_uuid = $_REQUEST['app_uuid'];
}
if (!empty($_REQUEST['context']) && $_REQUEST['context'] == 'public') {
$context = $_REQUEST['context'];
}
$dialplan_xml = $_REQUEST['dialplan_xml'] ?? '';
//process the HTTP POST
@@ -180,6 +183,16 @@
$sql = "select dialplan_xml from v_dialplans ";
$sql .= "where (domain_uuid = :domain_uuid or domain_uuid is null) ";
$sql .= "and dialplan_enabled = true ";
if (!empty($app_uuid)) {
$sql .= "and app_uuid = :app_uuid ";
$parameters['app_uuid'] = $app_uuid;
}
elseif (!empty($context)) {
$sql .= "and dialplan_context = :context ";
$parameters['context'] = $context;
} else {
$sql .= "and dialplan_context <> 'public' ";
}
$sql .= "order by dialplan_order asc, lower(dialplan_name) asc ";
$parameters['domain_uuid'] = $domain_uuid;
$dialplans = $database->select($sql, $parameters, 'all');

View File

@@ -409,7 +409,24 @@
echo button::create(['type'=>'button','label'=>$text['button-delete'],'icon'=>$button_icon_delete,'id'=>'btn_delete','name'=>'btn_delete','style'=>'display: none;','onclick'=>"modal_open('modal-delete','btn_delete');"]);
}
if (permission_exists('dialplan_xml')) {
echo button::create(['type'=>'button','label'=>$text['button-xml'],'icon'=>'code','style'=>'margin-left: 3px;','link'=>'dialplan_xml.php']);
$query_params = [];
if (!empty($app_uuid) && is_uuid($app_uuid)) {
$query_params[] = 'app_uuid='.$app_uuid;
}
if (!empty($context) && $context == 'global') {
$query_params[] = 'context='.$context;
}
$query_string = '';
if (count($query_params) > 0) {
$i = 0;
foreach($query_params as $query_param) {
$delimiter = ($i == 0) ? '?' : '&';
$query_string .= $delimiter. $query_param;
$i++;
}
}
echo button::create(['type'=>'button','label'=>$text['button-xml'],'icon'=>'code','style'=>'margin-left: 3px;','link'=>'dialplan_xml.php'.$query_string]);
unset($query_string);
}
}
echo "<form id='form_search' class='inline' method='get'>\n";