Extensions - List: Updates for PHP 8.1
This commit is contained in:
parent
4c50b6e83a
commit
c6eba58cf7
|
|
@ -48,14 +48,14 @@
|
|||
$text = $language->get();
|
||||
|
||||
//get posted data
|
||||
if (is_array($_POST['extensions'])) {
|
||||
if (!empty($_POST['extensions']) && is_array($_POST['extensions'])) {
|
||||
$action = $_POST['action'];
|
||||
$search = $_POST['search'];
|
||||
$extensions = $_POST['extensions'];
|
||||
}
|
||||
|
||||
//process the http post data by action
|
||||
if ($action != '' && is_array($extensions) && @sizeof($extensions) != 0) {
|
||||
if (!empty($action) && !empty($extensions) && is_array($extensions) && @sizeof($extensions) != 0) {
|
||||
switch ($action) {
|
||||
case 'toggle':
|
||||
if (permission_exists('extension_enabled')) {
|
||||
|
|
@ -80,8 +80,8 @@
|
|||
}
|
||||
|
||||
//get order and order by
|
||||
$order_by = $_GET["order_by"];
|
||||
$order = $_GET["order"];
|
||||
$order_by = $_GET["order_by"] ?? '';
|
||||
$order = $_GET["order"] ?? '';
|
||||
|
||||
//get total extension count for domain
|
||||
if (is_numeric($_SESSION['limit']['extensions']['numeric'])) {
|
||||
|
|
@ -94,7 +94,7 @@ if (is_numeric($_SESSION['limit']['extensions']['numeric'])) {
|
|||
}
|
||||
|
||||
//add the search term
|
||||
$search = strtolower($_GET["search"]);
|
||||
$search = strtolower($_GET["search"] ?? '');
|
||||
if (!empty($search)) {
|
||||
$sql_search = " and ( ";
|
||||
$sql_search .= "lower(extension) like :search ";
|
||||
|
|
@ -119,21 +119,21 @@ if (is_numeric($_SESSION['limit']['extensions']['numeric'])) {
|
|||
|
||||
//get total extension count
|
||||
$sql = "select count(*) from v_extensions where true ";
|
||||
if (!($_GET['show'] == "all" && permission_exists('extension_all'))) {
|
||||
if (!(!empty($_GET['show']) && $_GET['show'] == "all" && permission_exists('extension_all'))) {
|
||||
$sql .= "and domain_uuid = :domain_uuid ";
|
||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
}
|
||||
$sql .= $sql_search;
|
||||
$sql .= $sql_search ?? '';
|
||||
$database = new database;
|
||||
$num_rows = $database->select($sql, $parameters, 'column');
|
||||
$num_rows = $database->select($sql, $parameters ?? null, 'column');
|
||||
|
||||
//prepare to page the results
|
||||
$rows_per_page = ($_SESSION['domain']['paging']['numeric'] != '') ? $_SESSION['domain']['paging']['numeric'] : 50;
|
||||
$param = "&search=".$search;
|
||||
if ($_GET['show'] == "all" && permission_exists('extension_all')) {
|
||||
if (!empty($_GET['show']) && $_GET['show'] == "all" && permission_exists('extension_all')) {
|
||||
$param .= "&show=all";
|
||||
}
|
||||
$page = is_numeric($_GET['page']) ? $_GET['page'] : 0;
|
||||
$page = isset($_GET['page']) && is_numeric($_GET['page']) ? $_GET['page'] : 0;
|
||||
list($paging_controls, $rows_per_page) = paging($num_rows, $param, $rows_per_page); //bottom
|
||||
list($paging_controls_mini, $rows_per_page) = paging($num_rows, $param, $rows_per_page, true); //top
|
||||
$offset = $rows_per_page * $page;
|
||||
|
|
@ -153,13 +153,13 @@ if (is_numeric($_SESSION['limit']['extensions']['numeric'])) {
|
|||
}
|
||||
$sql .= limit_offset($rows_per_page, $offset);
|
||||
$database = new database;
|
||||
$extensions = $database->select($sql, $parameters, 'all');
|
||||
$extensions = $database->select($sql, $parameters ?? null, 'all');
|
||||
unset($sql, $parameters);
|
||||
|
||||
//get the registrations
|
||||
if (permission_exists('extension_registered')) {
|
||||
$obj = new registrations;
|
||||
if ($_GET['show'] == 'all') {
|
||||
if (!empty($_GET['show']) && $_GET['show'] == 'all') {
|
||||
$obj->show = 'all';
|
||||
}
|
||||
$registrations = $obj->get('all');
|
||||
|
|
@ -185,25 +185,25 @@ if (is_numeric($_SESSION['limit']['extensions']['numeric'])) {
|
|||
}
|
||||
$margin_left = permission_exists('extension_import') || permission_exists('extension_export') ? "margin-left: 15px;" : null;
|
||||
if (permission_exists('extension_add') && (!is_numeric($_SESSION['limit']['extensions']['numeric']) || $total_extensions < $_SESSION['limit']['extensions']['numeric'])) {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-add'],'icon'=>$_SESSION['theme']['button_icon_add'],'id'=>'btn_add','style'=>$margin_left,'link'=>'extension_edit.php']);
|
||||
echo button::create(['type'=>'button','label'=>$text['button-add'],'icon'=>$_SESSION['theme']['button_icon_add'],'id'=>'btn_add','style'=>($margin_left ?? ''),'link'=>'extension_edit.php']);
|
||||
unset($margin_left);
|
||||
}
|
||||
if (permission_exists('extension_enabled') && $extensions) {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-toggle'],'icon'=>$_SESSION['theme']['button_icon_toggle'],'id'=>'btn_toggle','name'=>'btn_toggle','style'=>'display: none; '.$margin_left,'onclick'=>"modal_open('modal-toggle','btn_toggle');"]);
|
||||
echo button::create(['type'=>'button','label'=>$text['button-toggle'],'icon'=>$_SESSION['theme']['button_icon_toggle'],'id'=>'btn_toggle','name'=>'btn_toggle','style'=>'display: none; '.($margin_left ?? ''),'onclick'=>"modal_open('modal-toggle','btn_toggle');"]);
|
||||
unset($margin_left);
|
||||
}
|
||||
if (permission_exists('extension_delete') && $extensions) {
|
||||
if (permission_exists('voicemail_delete')) {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-delete'],'icon'=>$_SESSION['theme']['button_icon_delete'],'id'=>'btn_delete','name'=>'btn_delete','style'=>'display: none; '.$margin_left,'onclick'=>"modal_open('modal-delete-options');"]);
|
||||
echo button::create(['type'=>'button','label'=>$text['button-delete'],'icon'=>$_SESSION['theme']['button_icon_delete'],'id'=>'btn_delete','name'=>'btn_delete','style'=>'display: none; '.($margin_left ?? ''),'onclick'=>"modal_open('modal-delete-options');"]);
|
||||
}
|
||||
else {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-delete'],'icon'=>$_SESSION['theme']['button_icon_delete'],'id'=>'btn_delete','name'=>'btn_delete','style'=>'display: none; '.$margin_left,'onclick'=>"modal_open('modal-delete');"]);
|
||||
echo button::create(['type'=>'button','label'=>$text['button-delete'],'icon'=>$_SESSION['theme']['button_icon_delete'],'id'=>'btn_delete','name'=>'btn_delete','style'=>'display: none; '.($margin_left ?? ''),'onclick'=>"modal_open('modal-delete');"]);
|
||||
}
|
||||
unset($margin_left);
|
||||
}
|
||||
echo "<form id='form_search' class='inline' method='get'>\n";
|
||||
if (permission_exists('extension_all')) {
|
||||
if ($_GET['show'] == 'all') {
|
||||
if (!empty($_GET['show']) && $_GET['show'] == 'all') {
|
||||
echo " <input type='hidden' name='show' value='all'>";
|
||||
}
|
||||
else {
|
||||
|
|
@ -252,10 +252,10 @@ if (is_numeric($_SESSION['limit']['extensions']['numeric'])) {
|
|||
echo "<tr class='list-header'>\n";
|
||||
if (permission_exists('extension_enabled') || permission_exists('extension_delete')) {
|
||||
echo " <th class='checkbox'>\n";
|
||||
echo " <input type='checkbox' id='checkbox_all' name='checkbox_all' onclick='list_all_toggle(); checkbox_on_change(this);' ".($extensions ?: "style='visibility: hidden;'").">\n";
|
||||
echo " <input type='checkbox' id='checkbox_all' name='checkbox_all' onclick='list_all_toggle(); checkbox_on_change(this);' ".(empty($extensions) ? "style='visibility: hidden;'" : null).">\n";
|
||||
echo " </th>\n";
|
||||
}
|
||||
if ($_GET['show'] == "all" && permission_exists('extension_all')) {
|
||||
if (!empty($_GET['show']) && $_GET['show'] == "all" && permission_exists('extension_all')) {
|
||||
echo "<th>".$text['label-domain']."</th>\n";
|
||||
//echo th_order_by('domain_name', $text['label-domain'], $order_by, $order);
|
||||
}
|
||||
|
|
@ -273,7 +273,7 @@ if (is_numeric($_SESSION['limit']['extensions']['numeric'])) {
|
|||
}
|
||||
echo th_order_by('enabled', $text['label-enabled'], $order_by, $order, null, "class='center'");
|
||||
echo th_order_by('description', $text['label-description'], $order_by, $order, null, "class='hide-sm-dn'");
|
||||
if (permission_exists('extension_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
|
||||
if (permission_exists('extension_edit') && !empty($_SESSION['theme']['list_row_edit_button']['boolean']) && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
|
||||
echo " <td class='action-button'> </td>\n";
|
||||
}
|
||||
echo "</tr>\n";
|
||||
|
|
@ -291,7 +291,7 @@ if (is_numeric($_SESSION['limit']['extensions']['numeric'])) {
|
|||
echo " <input type='hidden' name='extensions[$x][uuid]' value='".escape($row['extension_uuid'])."' />\n";
|
||||
echo " </td>\n";
|
||||
}
|
||||
if ($_GET['show'] == "all" && permission_exists('extension_all')) {
|
||||
if (!empty($_GET['show']) && $_GET['show'] == "all" && permission_exists('extension_all')) {
|
||||
echo " <td>".escape($_SESSION['domains'][$row['domain_uuid']]['domain_name'])."</td>\n";
|
||||
}
|
||||
echo " <td>";
|
||||
|
|
@ -345,7 +345,7 @@ if (is_numeric($_SESSION['limit']['extensions']['numeric'])) {
|
|||
}
|
||||
echo " </td>\n";
|
||||
echo " <td class='description overflow hide-sm-dn'>".escape($row['description'])."</td>\n";
|
||||
if (permission_exists('extension_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
|
||||
if (permission_exists('extension_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";
|
||||
|
|
|
|||
Loading…
Reference in New Issue