Gateway - List/Edit: Maintain search, order by and page values through paging and update. (Part 3)

This commit is contained in:
fusionate
2026-02-20 19:24:26 -07:00
committed by GitHub
parent 1218b8058c
commit 65ff94c0fe

View File

@@ -39,6 +39,12 @@
$language = new text;
$text = $language->get();
//get order and order by, page
$order_by = preg_replace('#[^a-zA-Z0-9_\-]#', '', ($_REQUEST["order_by"] ?? ''));
$order = $_REQUEST["order"] ?? 'asc';
$page = isset($_REQUEST['page']) && is_numeric($_REQUEST['page']) ? $_REQUEST['page'] : 0;
$search = $_REQUEST['search'] ?? null;
//set the http get/post variable(s) to a php variable
if (is_uuid($_REQUEST["id"])) {
$gateway_uuid = $_REQUEST["id"];
@@ -53,6 +59,7 @@
$gateway = $row["gateway"];
$username = $row["username"];
$password = $row["password"];
$distinct_to = !empty($row["distinct_to"]) ? 'true' : 'false';
$auth_username = $row["auth_username"];
$realm = $row["realm"];
$from_user = $row["from_user"];
@@ -61,7 +68,7 @@
$register_proxy = $row["register_proxy"];
$outbound_proxy = $row["outbound_proxy"];
$expire_seconds = $row["expire_seconds"];
$register = $row["register"] ?? false;
$register = !empty($row["register"]) ? 'true' : 'false';
$register_transport = $row["register_transport"];
$contact_params = $row["contact_params"];
$retry_seconds = $row["retry_seconds"];
@@ -70,10 +77,10 @@
$ping = $row["ping"];
$ping_min = $row["ping_min"];
$ping_max = $row["ping_max"];
$contact_in_ping = $row["contact_in_ping"] ?? false;
$contact_in_ping = !empty($row["contact_in_ping"]) ? 'true' : 'false';
// $channels = $row["channels"];
$caller_id_in_from = $row["caller_id_in_from"] ?? false;
$supress_cng = $row["supress_cng"] ?? false;
$caller_id_in_from = !empty($row["caller_id_in_from"]) ? 'true' : 'false';
$supress_cng = !empty($row["supress_cng"]) ? 'true' : 'false';
$sip_cid_type = $row["sip_cid_type"];
$extension_in_contact = $row["extension_in_contact"];
$effective_caller_id_name = $row["effective_caller_id_name"];
@@ -82,7 +89,7 @@
$outbound_caller_id_number = $row["outbound_caller_id_number"];
$context = $row["context"];
$profile = $row["profile"];
$enabled = $row["enabled"] ?? false;
$enabled = !empty($row["enabled"]) ? 'true' : 'false';
$description = $row["description"]." (".$text['label-copy'].")";
}
unset($sql, $parameters, $row);
@@ -102,6 +109,7 @@
$array['gateways'][0]['gateway'] = $gateway;
$array['gateways'][0]['username'] = $username;
$array['gateways'][0]['password'] = $password;
$array['gateways'][0]['distinct_to'] = $distinct_to;
$array['gateways'][0]['auth_username'] = $auth_username;
$array['gateways'][0]['realm'] = $realm;
$array['gateways'][0]['from_user'] = $from_user;
@@ -134,7 +142,7 @@
unset($array);
//add new gateway to session variable
if ($enabled == true) {
if (!empty($enabled)) {
$_SESSION['gateways'][$gateway_uuid] = $gateway;
}
@@ -150,7 +158,7 @@
}
//redirect the user
header("Location: gateways.php");
header("Location: gateways.php?".(!empty($order_by) ? '&order_by='.$order_by.'&order='.$order : null).(isset($page) && is_numeric($page) ? '&page='.$page : null).(!empty($search) ? '&search='.urlencode($search) : null));
return;
?>
?>