diff --git a/app/conference_controls/conference_control_detail_edit.php b/app/conference_controls/conference_control_detail_edit.php index 6f22700a8..1a911d78a 100644 --- a/app/conference_controls/conference_control_detail_edit.php +++ b/app/conference_controls/conference_control_detail_edit.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Portions created by the Initial Developer are Copyright (C) 2018-2025 + Portions created by the Initial Developer are Copyright (C) 2018-2026 the Initial Developer. All Rights Reserved. Contributor(s): @@ -43,6 +43,28 @@ $control_action = ''; $control_data = ''; +// Set variables from GET parameters + $page = is_numeric($_GET['page'] ?? '') ? $_GET['page'] : 0; + $order_by = preg_replace('#[^a-zA-Z0-9_\-]#', '', ($_GET['order_by'] ?? 'control_name')); + $order = ($_GET['order'] ?? '') === 'desc' ? 'desc' : 'asc'; + $search = $_GET['search'] ?? ''; + +// Build the query string + $param = []; + if (!empty($page)) { + $param['page'] = $page; + } + if (!empty($_GET['order_by'])) { + $param['order_by'] = $order_by; + } + if (!empty($_GET['order'])) { + $param['order'] = $order; + } + if (!empty($search)) { + $param['search'] = $search; + } + $query_string = http_build_query($param); + //action add or update if (!empty($_REQUEST["id"]) && is_uuid($_REQUEST["id"])) { $action = "update"; @@ -124,7 +146,7 @@ unset($array); } - header('Location: conference_control_edit.php?id='.$conference_control_uuid); + header('Location: conference_control_edit.php?id='.$conference_control_uuid.($query_string ? '&'.$query_string : '')); exit; } @@ -165,7 +187,7 @@ echo "
\n"; echo "
".$text['title-conference_control_detail']."
\n"; echo "
\n"; - echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$settings->get('theme', 'button_icon_back'),'id'=>'btn_back','collapse'=>'hide-xs','style'=>'margin-right: 15px;','link'=>'conference_control_edit.php?id='.urlencode($conference_control_uuid ?? '')]); + echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$settings->get('theme', 'button_icon_back'),'id'=>'btn_back','collapse'=>'hide-xs','style'=>'margin-right: 15px;','link'=>'conference_control_edit.php?id='.urlencode($conference_control_uuid ?? '').($query_string ? '&'.$query_string : '')]); echo button::create(['type'=>'submit','label'=>$text['button-save'],'icon'=>$settings->get('theme', 'button_icon_save'),'id'=>'btn_save','collapse'=>'hide-xs']); echo "
\n"; echo "
\n"; diff --git a/app/conference_controls/conference_control_details.php b/app/conference_controls/conference_control_details.php index 5ed9c180f..64c69956f 100644 --- a/app/conference_controls/conference_control_details.php +++ b/app/conference_controls/conference_control_details.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Portions created by the Initial Developer are Copyright (C) 2018-2025 + Portions created by the Initial Developer are Copyright (C) 2018-2026 the Initial Developer. All Rights Reserved. Contributor(s): @@ -39,6 +39,28 @@ $language = new text; $text = $language->get(); +// Set variables from GET parameters + $page = is_numeric($_GET['page'] ?? '') ? $_GET['page'] : 0; + $order_by = preg_replace('#[^a-zA-Z0-9_\-]#', '', ($_GET['order_by'] ?? '')); + $order = ($_GET['order'] ?? '') === 'desc' ? 'desc' : 'asc'; + $search = $_GET['search'] ?? ''; + +// Build the query string + $param = []; + if (!empty($page)) { + $param['page'] = $page; + } + if (!empty($_GET['order_by'])) { + $param['order_by'] = $order_by; + } + if (!empty($_GET['order'])) { + $param['order'] = $order; + } + if (!empty($search)) { + $param['search'] = $search; + } + $query_string = http_build_query($param); + //set from session variables $list_row_edit_button = $settings->get('theme', 'list_row_edit_button', false); @@ -68,44 +90,18 @@ break; } - header('Location: conference_control_edit.php?id='.urlencode($conference_control_uuid)); + header('Location: conference_control_edit.php?id='.urlencode($conference_control_uuid).($query_string ? '&'.$query_string : '')); exit; } -//get variables used to control the order - $order_by = $_GET["order_by"] ?? ''; - $order = $_GET["order"] ?? ''; - -//add the search term - $search = $_GET["search"] ?? ''; - if (!empty($search)) { - $sql_search = "and ("; - $sql_search .= "control_digits like :search"; - $sql_search .= "or control_action like :search"; - $sql_search .= "or control_data like :search"; - $sql_search .= "or control_enabled like :search"; - $sql_search .= ")"; - $parameters['search'] = '%'.$search.'%'; - } - //prepare to page the results $sql = "select count(conference_control_detail_uuid) "; $sql .= "from v_conference_control_details "; $sql .= "where conference_control_uuid = :conference_control_uuid "; - $sql .= $sql_search ?? ''; $parameters['conference_control_uuid'] = $conference_control_uuid ?? ''; $num_rows = $database->select($sql, $parameters ?? null, 'column'); unset($sql, $parameters); -//prepare to page the results - $rows_per_page = $settings->get('domain', 'paging', 50); - $param = "&id=".!empty($conference_control_uuid); - if (isset($_GET['page'])) { - $page = isset($_GET['page']) ? $_GET['page'] : 0; - list($paging_controls, $rows_per_page) = paging($num_rows, $param, $rows_per_page); - $offset = $rows_per_page * $page; - } - //get the list $sql = "select "; $sql .= "conference_control_detail_uuid, "; @@ -115,8 +111,7 @@ $sql .= "control_data, "; $sql .= "cast(control_enabled as text) "; $sql .= "from v_conference_control_details "; - $sql .= $sql_search ?? ''; - $sql .= order_by($order_by, $order, 'control_digits', 'asc'); + $sql .= order_by(null, null, 'control_digits', 'asc'); $sql .= limit_offset($rows_per_page, !empty($offset)); $result = $database->select($sql, $parameters ?? null, 'all'); unset($sql, $parameters); @@ -162,10 +157,10 @@ echo " \n"; echo " \n"; } - echo th_order_by('control_digits', $text['label-control_digits'], $order_by, $order, null, "class='pct-5 center'", $param); - echo th_order_by('control_action', $text['label-control_action'], $order_by, $order, null, null, $param); - echo th_order_by('control_data', $text['label-control_data'], $order_by, $order, null, "class='pct-50 hide-xs'", $param); - echo th_order_by('control_enabled', $text['label-control_enabled'], $order_by, $order, null, "class='center'", $param); + echo "".$text['label-control_digits']."\n"; + echo "".$text['label-control_action']."\n"; + echo "".$text['label-control_data']."\n"; + echo "".$text['label-control_enabled']."\n"; if (permission_exists('conference_control_detail_edit') && $list_row_edit_button) { echo "  \n"; } @@ -175,7 +170,7 @@ $x = 0; foreach ($result as $row) { if (permission_exists('conference_control_detail_edit')) { - $list_row_url = 'conference_control_detail_edit.php?conference_control_uuid='.urlencode($row['conference_control_uuid']).'&id='.urlencode($row['conference_control_detail_uuid']); + $list_row_url = 'conference_control_detail_edit.php?conference_control_uuid='.urlencode($row['conference_control_uuid']).'&id='.urlencode($row['conference_control_detail_uuid']).($query_string ? '&'.$query_string : ''); } echo "\n"; if (permission_exists('conference_control_detail_edit') || permission_exists('conference_control_detail_delete')) { diff --git a/app/conference_controls/conference_control_edit.php b/app/conference_controls/conference_control_edit.php index 83015e883..787240b57 100644 --- a/app/conference_controls/conference_control_edit.php +++ b/app/conference_controls/conference_control_edit.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Portions created by the Initial Developer are Copyright (C) 2018-2025 + Portions created by the Initial Developer are Copyright (C) 2018-2026 the Initial Developer. All Rights Reserved. Contributor(s): @@ -42,6 +42,28 @@ $control_name = ''; $control_description = ''; +// Set variables from GET parameters + $page = is_numeric($_GET['page'] ?? '') ? $_GET['page'] : 0; + $order_by = preg_replace('#[^a-zA-Z0-9_\-]#', '', ($_GET['order_by'] ?? 'control_name')); + $order = ($_GET['order'] ?? '') === 'desc' ? 'desc' : 'asc'; + $search = $_GET['search'] ?? ''; + +// Build the query string + $param = []; + if (!empty($page)) { + $param['page'] = $page; + } + if (!empty($_GET['order_by'])) { + $param['order_by'] = $order_by; + } + if (!empty($_GET['order'])) { + $param['order'] = $order; + } + if (!empty($search)) { + $param['search'] = $search; + } + $query_string = http_build_query($param); + //action add or update if (!empty($_REQUEST["id"]) && is_uuid($_REQUEST["id"])) { $action = "update"; @@ -70,7 +92,7 @@ $token = new token; if (!$token->validate($_SERVER['PHP_SELF'])) { message::add($text['message-invalid_token'],'negative'); - header('Location: conference_controls.php'); + header('Location: conference_controls.php'.($query_string ? '?'.$query_string : '')); exit; } @@ -119,7 +141,7 @@ if ($action == "update") { message::add($text['message-update']); } - header("Location: conference_controls.php"); + header("Location: conference_controls.php".($query_string ? '?'.$query_string : '')); return; } } //(is_array($_POST) && empty($_POST["persistformvar"])) @@ -157,7 +179,7 @@ echo "
\n"; echo "
".$text['title-conference_control']."
\n"; echo "
\n"; - echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$settings->get('theme', 'button_icon_back'),'id'=>'btn_back','collapse'=>'hide-xs','style'=>'margin-right: 15px;','link'=>'conference_controls.php']); + echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$settings->get('theme', 'button_icon_back'),'id'=>'btn_back','collapse'=>'hide-xs','style'=>'margin-right: 15px;','link'=>'conference_controls.php'.($query_string ? '?'.$query_string : '')]); echo button::create(['type'=>'submit','label'=>$text['button-save'],'icon'=>$settings->get('theme', 'button_icon_save'),'id'=>'btn_save','collapse'=>'hide-xs']); echo "
\n"; echo "
\n"; diff --git a/app/conference_controls/conference_controls.php b/app/conference_controls/conference_controls.php index 4c9db3b54..af3c289ac 100644 --- a/app/conference_controls/conference_controls.php +++ b/app/conference_controls/conference_controls.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Portions created by the Initial Developer are Copyright (C) 2018-2025 + Portions created by the Initial Developer are Copyright (C) 2018-2026 the Initial Developer. All Rights Reserved. Contributor(s): @@ -39,13 +39,34 @@ $language = new text; $text = $language->get(); +// Set variables from GET parameters + $page = is_numeric($_GET['page'] ?? '') ? $_GET['page'] : 0; + $order_by = preg_replace('#[^a-zA-Z0-9_\-]#', '', ($_GET['order_by'] ?? 'control_name')); + $order = ($_GET['order'] ?? '') === 'desc' ? 'desc' : 'asc'; + $search = $_GET['search'] ?? ''; + +// Build the query string + $param = []; + if (!empty($page)) { + $param['page'] = $page; + } + if (!empty($_GET['order_by'])) { + $param['order_by'] = $order_by; + } + if (!empty($_GET['order'])) { + $param['order'] = $order; + } + if (!empty($search)) { + $param['search'] = $search; + } + $query_string = http_build_query($param); + //set from session variables $list_row_edit_button = $settings->get('theme', 'list_row_edit_button', false); //get the http post data if (!empty($_POST['conference_controls'])) { $action = $_POST['action']; - $search = $_POST['search'] ?? ''; $conference_controls = $_POST['conference_controls']; } @@ -72,36 +93,26 @@ break; } - header('Location: conference_controls.php'.(!empty($search) ? '?search='.urlencode($search) : '')); + header('Location: conference_controls.php'.($query_string ? '?'.$query_string : '')); exit; } -//get order and order by - $order_by = $_GET["order_by"] ?? ''; - $order = $_GET["order"] ?? ''; - -//add the search string - $search = strtolower($_GET["search"] ?? ''); - if (!empty($search)) { - $sql_search = "where ("; - $sql_search .= " lower(control_name) like :search "; - $sql_search .= " or lower(control_description) like :search "; - $sql_search .= ") "; - $parameters['search'] = '%'.$search.'%'; - } - //get the count $sql = "select count(conference_control_uuid) from v_conference_controls "; - $sql .= $sql_search ?? ''; + if (!empty($search)) { + $sql .= "where ("; + $sql .= " lower(control_name) like :search "; + $sql .= " or lower(control_description) like :search "; + $sql .= ") "; + $parameters['search'] = '%'.lower_case($search).'%'; + } $num_rows = $database->select($sql, $parameters ?? null, 'column'); unset($sql); //prepare to page the results $rows_per_page = $settings->get('domain', 'paging', 50); - $param = $search ? "&search=".$search : null; - $page = isset($_GET['page']) ? $_GET['page'] : 0; - list($paging_controls, $rows_per_page) = paging($num_rows, $param, $rows_per_page); - list($paging_controls_mini, $rows_per_page) = paging($num_rows, $param, $rows_per_page, true); + list($paging_controls, $rows_per_page) = paging($num_rows, $query_string, $rows_per_page); + list($paging_controls_mini, $rows_per_page) = paging($num_rows, $query_string, $rows_per_page, true); $offset = $rows_per_page * $page; //get the list @@ -111,7 +122,13 @@ $sql .= "cast(control_enabled as text), "; $sql .= "control_description "; $sql .= "from v_conference_controls "; - $sql .= $sql_search ?? ''; + if (!empty($search)) { + $sql .= "where ("; + $sql .= " lower(control_name) like :search "; + $sql .= " or lower(control_description) like :search "; + $sql .= ") "; + $parameters['search'] = '%'.lower_case($search).'%'; + } $sql .= order_by($order_by, $order, 'control_name', 'asc'); $sql .= limit_offset($rows_per_page, $offset); $conference_controls = $database->select($sql, $parameters ?? null, 'all'); @@ -130,7 +147,7 @@ echo "
".$text['title-conference_controls']."
".number_format($num_rows)."
\n"; echo "
\n"; if (permission_exists('conference_control_add')) { - echo button::create(['type'=>'button','label'=>$text['button-add'],'icon'=>$settings->get('theme', 'button_icon_add'),'id'=>'btn_add','link'=>'conference_control_edit.php']); + echo button::create(['type'=>'button','label'=>$text['button-add'],'icon'=>$settings->get('theme', 'button_icon_add'),'id'=>'btn_add','link'=>'conference_control_edit.php'.($query_string ? '?'.$query_string : '')]); } if (permission_exists('conference_control_add') && $conference_controls) { echo button::create(['type'=>'button','label'=>$text['button-copy'],'icon'=>$settings->get('theme', 'button_icon_copy'),'id'=>'btn_copy','name'=>'btn_copy','style'=>'display: none;','onclick'=>"modal_open('modal-copy','btn_copy');"]); @@ -141,12 +158,17 @@ if (permission_exists('conference_control_delete') && $conference_controls) { echo button::create(['type'=>'button','label'=>$text['button-delete'],'icon'=>$settings->get('theme', 'button_icon_delete'),'id'=>'btn_delete','name'=>'btn_delete','style'=>'display: none;','onclick'=>"modal_open('modal-delete','btn_delete');"]); } - echo "\n"; echo "
\n"; @@ -168,7 +190,6 @@ echo "
\n"; echo "\n"; - echo "\n"; echo "
\n"; echo "\n"; @@ -178,8 +199,8 @@ echo " \n"; echo " \n"; } - echo th_order_by('control_name', $text['label-control_name'], $order_by, $order); - echo th_order_by('control_enabled', $text['label-control_enabled'], $order_by, $order, null, "class='center shrink'"); + echo th_order_by('control_name', $text['label-control_name'], $order_by, $order, null, null, $query_string); + echo th_order_by('control_enabled', $text['label-control_enabled'], $order_by, $order, null, "class='center shrink'", $query_string); echo " \n"; if (permission_exists('conference_control_edit') && $list_row_edit_button) { echo " \n"; @@ -190,7 +211,7 @@ $x = 0; foreach ($conference_controls as $row) { if (permission_exists('conference_control_edit')) { - $list_row_url = "conference_control_edit.php?id=".urlencode($row['conference_control_uuid']); + $list_row_url = "conference_control_edit.php?id=".urlencode($row['conference_control_uuid']).($query_string ? '&'.$query_string : ''); } echo "\n"; if (permission_exists('conference_control_add') || permission_exists('conference_control_edit') || permission_exists('conference_control_delete')) {
".$text['label-control_description']."