Category and Search pass-through (#6511)

* Update default_settings.php

* Update default_setting_edit.php
This commit is contained in:
FusionPBX
2022-12-20 14:12:47 -07:00
committed by GitHub
parent ee17eb2665
commit a44ca60441
2 changed files with 33 additions and 10 deletions

View File

@@ -17,7 +17,7 @@
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2021
Portions created by the Initial Developer are Copyright (C) 2008-2022
the Initial Developer. All Rights Reserved.
Contributor(s):
@@ -66,6 +66,20 @@
$default_setting_description = $_POST["default_setting_description"];
}
//sanitize the variables
$search = preg_replace('#[^a-zA-Z0-9_\-\. ]#', '', $search);
$default_setting_category = preg_replace('#[^a-zA-Z0-9_\-\.]#', '', $default_setting_category);
//build the query string
$query_string = '';
if ($search != '') {
$query_string .= 'search='.urlencode($search);
}
if ($default_setting_category != '') {
if ($query_string == '') { $query_string = ''; } else { $query_string .= '&'; }
$query_string .= 'default_setting_category='.urlencode($default_setting_category);
}
//process the http post
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
@@ -81,7 +95,7 @@
$token = new token;
if (!$token->validate($_SERVER['PHP_SELF'])) {
message::add($text['message-invalid_token'],'negative');
header('Location: default_settings.php');
header('Location: default_settings.php?'.$query_string);
exit;
}
@@ -200,12 +214,12 @@
//set the message and redirect the user
if ($action == "add" && permission_exists('default_setting_add')) {
message::add($text['message-add']);
header("Location: default_settings.php".(($search != '') ? "?search=".$search : null)."#anchor_".$default_setting_category);
header("Location: default_settings.php?".$query_string."#anchor_".$default_setting_category);
return;
}
if ($action == "update" && permission_exists('default_setting_edit')) {
message::add($text['message-update']);
header("Location: default_settings.php".(($search != '') ? "?search=".$search : null)."#anchor_".$default_setting_category);
header("Location: default_settings.php?".$query_string."#anchor_".$default_setting_category);
return;
}
} //if ($_POST["persistformvar"] != "true")
@@ -258,7 +272,7 @@
}
echo " </div>\n";
echo " <div class='actions'>\n";
echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'id'=>'btn_back','style'=>'margin-right: 15px;','link'=>'default_settings.php'.($search != '' ? "?search=".urlencode($search) : null)]);
echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'id'=>'btn_back','style'=>'margin-right: 15px;','link'=>'default_settings.php?'.$query_string]);
echo button::create(['type'=>'button','label'=>$text['button-save'],'icon'=>$_SESSION['theme']['button_icon_save'],'id'=>'btn_save','onclick'=>'submit_form();']);
echo " </div>\n";
echo " <div style='clear: both;'></div>\n";