Fixed Errors for Streams & Ring Groups (#6728)

* Fixed Errors streams.php

* Update streams.php

* Update stream_edit.php

* Update ring_groups.php

* Update tones.php

* Update ringbacks.php

* Update ring_group_edit.php
This commit is contained in:
Anthony
2023-05-31 11:00:55 -06:00
committed by GitHub
parent 410f5e6f68
commit f0598117ab
6 changed files with 92 additions and 57 deletions

View File

@@ -47,15 +47,21 @@
$language = new text;
$text = $language->get();
//set additional variables
$show = $_GET["show"] ?? '';
//set the defaults
$search = '';
//get posted data
if (is_array($_POST['ring_groups'])) {
if (!empty($_POST['ring_groups'])) {
$action = $_POST['action'];
$search = $_POST['search'];
$ring_groups = $_POST['ring_groups'];
}
//process the http post data by action
if ($action != '' && is_array($ring_groups) && @sizeof($ring_groups) != 0) {
if (!empty($action) && !empty($ring_groups)) {
switch ($action) {
case 'copy':
$obj = new ring_groups;
@@ -76,8 +82,8 @@
}
//get order and order by
$order_by = $_GET["order_by"];
$order = $_GET["order"];
$order_by = $_GET["order_by"] ?? '';
$order = $_GET["order"] ?? '';
//add the search term
if (isset($_GET["search"])) {
@@ -93,7 +99,7 @@
$num_rows = $total_ring_groups;
//get filtered ring group count
if ($search) {
if (!empty($search)) {
$sql = "select count(*) from v_ring_groups where true ";
if ($_GET['show'] != "all" || !permission_exists('ring_group_all')) {
$sql .= "and domain_uuid = :domain_uuid ";
@@ -117,15 +123,15 @@
//prepare to page the results
$rows_per_page = ($_SESSION['domain']['paging']['numeric'] != '') ? $_SESSION['domain']['paging']['numeric'] : 50;
$param = $search ? "&search=".$search : null;
$param = ($_GET['show'] == "all" && permission_exists('ring_group_all')) ? "&show=all" : null;
$page = is_numeric($_GET['page']) ? $_GET['page'] : 0;
$param = ($show == "all" && permission_exists('ring_group_all')) ? "&show=all" : 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);
$offset = $rows_per_page * $page;
//get the list
$sql = "select * from v_ring_groups where true ";
if ($_GET['show'] != "all" || !permission_exists('ring_group_all')) {
if ($show != "all" || !permission_exists('ring_group_all')) {
$sql .= "and domain_uuid = :domain_uuid ";
$parameters['domain_uuid'] = $domain_uuid;
}
@@ -156,10 +162,10 @@
echo "<div class='action_bar' id='action_bar'>\n";
echo " <div class='heading'><b>".$text['title-ring_groups']." (".$num_rows.")</b></div>\n";
echo " <div class='actions'>\n";
if (permission_exists('ring_group_add') && (!is_numeric($_SESSION['limit']['ring_groups']['numeric']) || ($total_ring_groups < $_SESSION['limit']['ring_groups']['numeric']))) {
if (permission_exists('ring_group_add') && (!isset($_SESSION['limit']['ring_groups']['numeric']) || ($total_ring_groups < $_SESSION['limit']['ring_groups']['numeric']))) {
echo button::create(['type'=>'button','label'=>$text['button-add'],'icon'=>$_SESSION['theme']['button_icon_add'],'id'=>'btn_add','link'=>'ring_group_edit.php']);
}
if (permission_exists('ring_group_add') && $ring_groups && (!is_numeric($_SESSION['limit']['ring_groups']['numeric']) || ($total_ring_groups < $_SESSION['limit']['ring_groups']['numeric']))) {
if (permission_exists('ring_group_add') && $ring_groups && (!isset($_SESSION['limit']['ring_groups']['numeric']) || ($total_ring_groups < $_SESSION['limit']['ring_groups']['numeric']))) {
echo button::create(['type'=>'button','label'=>$text['button-copy'],'icon'=>$_SESSION['theme']['button_icon_copy'],'name'=>'btn_copy','onclick'=>"modal_open('modal-copy','btn_copy');"]);
}
if (permission_exists('ring_group_edit') && $ring_groups) {
@@ -170,7 +176,7 @@
}
echo "<form id='form_search' class='inline' method='get'>\n";
if (permission_exists('ring_group_all')) {
if ($_GET['show'] == 'all') {
if ($show == 'all') {
echo " <input type='hidden' name='show' value='all'>";
}
else {
@@ -188,7 +194,7 @@
echo " <div style='clear: both;'></div>\n";
echo "</div>\n";
if (permission_exists('ring_group_add') && $ring_groups && (!is_numeric($_SESSION['limit']['ring_groups']['numeric']) || ($total_ring_groups < $_SESSION['limit']['ring_groups']['numeric']))) {
if (permission_exists('ring_group_add') && $ring_groups && (!isset($_SESSION['limit']['ring_groups']['numeric']) || ($total_ring_groups < $_SESSION['limit']['ring_groups']['numeric']))) {
echo modal::create(['id'=>'modal-copy','type'=>'copy','actions'=>button::create(['type'=>'button','label'=>$text['button-continue'],'icon'=>'check','id'=>'btn_copy','style'=>'float: right; margin-left: 15px;','collapse'=>'never','onclick'=>"modal_close(); list_action_set('copy'); list_form_submit('form_list');"])]);
}
if (permission_exists('ring_group_edit') && $ring_groups) {
@@ -209,10 +215,10 @@
echo "<tr class='list-header'>\n";
if (permission_exists('ring_group_add') || permission_exists('ring_group_edit') || permission_exists('ring_group_delete')) {
echo " <th class='checkbox'>\n";
echo " <input type='checkbox' id='checkbox_all' name='checkbox_all' onclick='list_all_toggle();' ".($ring_groups ?: "style='visibility: hidden;'").">\n";
echo " <input type='checkbox' id='checkbox_all' name='checkbox_all' onclick='list_all_toggle();' ".!empty($ring_groups ?: "style='visibility: hidden;'").">\n";
echo " </th>\n";
}
if ($_GET['show'] == "all" && permission_exists('ring_group_all')) {
if ($show == "all" && permission_exists('ring_group_all')) {
echo th_order_by('domain_name', $text['label-domain'], $order_by, $order);
}
echo th_order_by('ring_group_name', $text['label-name'], $order_by, $order);
@@ -221,7 +227,7 @@
echo th_order_by('ring_group_forward_enabled', $text['label-forwarding'], $order_by, $order);
echo th_order_by('ring_group_enabled', $text['label-enabled'], $order_by, $order, null, "class='center'");
echo th_order_by('ring_group_description', $text['header-description'], $order_by, $order, null, "class='hide-sm-dn'");
if (permission_exists('ring_group_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
if (permission_exists('ring_group_edit') && !empty($_SESSION['theme']['list_row_edit_button']['boolean']) && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
echo " <td class='action-button'>&nbsp;</td>\n";
}
echo "</tr>\n";
@@ -239,7 +245,7 @@
echo " <input type='hidden' name='ring_groups[$x][uuid]' value='".escape($row['ring_group_uuid'])."' />\n";
echo " </td>\n";
}
if ($_GET['show'] == "all" && permission_exists('ring_group_all')) {
if ($show == "all" && permission_exists('ring_group_all')) {
echo " <td>".escape($_SESSION['domains'][$row['domain_uuid']]['domain_name'])."</td>\n";
}
echo " <td>";
@@ -263,7 +269,7 @@
}
echo " </td>\n";
echo " <td class='description overflow hide-sm-dn'>".escape($row['ring_group_description'])."&nbsp;</td>\n";
if (permission_exists('ring_group_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
if (permission_exists('ring_group_edit') && !empty($_SESSION['theme']['list_row_edit_button']['boolean']) && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
echo " <td class='action-button'>";
echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]);
echo " </td>\n";