Extensions - List: Updates for PHP 8.1
This commit is contained in:
parent
4c50b6e83a
commit
c6eba58cf7
|
|
@ -48,14 +48,14 @@
|
||||||
$text = $language->get();
|
$text = $language->get();
|
||||||
|
|
||||||
//get posted data
|
//get posted data
|
||||||
if (is_array($_POST['extensions'])) {
|
if (!empty($_POST['extensions']) && is_array($_POST['extensions'])) {
|
||||||
$action = $_POST['action'];
|
$action = $_POST['action'];
|
||||||
$search = $_POST['search'];
|
$search = $_POST['search'];
|
||||||
$extensions = $_POST['extensions'];
|
$extensions = $_POST['extensions'];
|
||||||
}
|
}
|
||||||
|
|
||||||
//process the http post data by action
|
//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) {
|
switch ($action) {
|
||||||
case 'toggle':
|
case 'toggle':
|
||||||
if (permission_exists('extension_enabled')) {
|
if (permission_exists('extension_enabled')) {
|
||||||
|
|
@ -80,8 +80,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
//get order and order by
|
//get order and order by
|
||||||
$order_by = $_GET["order_by"];
|
$order_by = $_GET["order_by"] ?? '';
|
||||||
$order = $_GET["order"];
|
$order = $_GET["order"] ?? '';
|
||||||
|
|
||||||
//get total extension count for domain
|
//get total extension count for domain
|
||||||
if (is_numeric($_SESSION['limit']['extensions']['numeric'])) {
|
if (is_numeric($_SESSION['limit']['extensions']['numeric'])) {
|
||||||
|
|
@ -94,7 +94,7 @@ if (is_numeric($_SESSION['limit']['extensions']['numeric'])) {
|
||||||
}
|
}
|
||||||
|
|
||||||
//add the search term
|
//add the search term
|
||||||
$search = strtolower($_GET["search"]);
|
$search = strtolower($_GET["search"] ?? '');
|
||||||
if (!empty($search)) {
|
if (!empty($search)) {
|
||||||
$sql_search = " and ( ";
|
$sql_search = " and ( ";
|
||||||
$sql_search .= "lower(extension) like :search ";
|
$sql_search .= "lower(extension) like :search ";
|
||||||
|
|
@ -119,21 +119,21 @@ if (is_numeric($_SESSION['limit']['extensions']['numeric'])) {
|
||||||
|
|
||||||
//get total extension count
|
//get total extension count
|
||||||
$sql = "select count(*) from v_extensions where true ";
|
$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 ";
|
$sql .= "and domain_uuid = :domain_uuid ";
|
||||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||||
}
|
}
|
||||||
$sql .= $sql_search;
|
$sql .= $sql_search ?? '';
|
||||||
$database = new database;
|
$database = new database;
|
||||||
$num_rows = $database->select($sql, $parameters, 'column');
|
$num_rows = $database->select($sql, $parameters ?? null, 'column');
|
||||||
|
|
||||||
//prepare to page the results
|
//prepare to page the results
|
||||||
$rows_per_page = ($_SESSION['domain']['paging']['numeric'] != '') ? $_SESSION['domain']['paging']['numeric'] : 50;
|
$rows_per_page = ($_SESSION['domain']['paging']['numeric'] != '') ? $_SESSION['domain']['paging']['numeric'] : 50;
|
||||||
$param = "&search=".$search;
|
$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";
|
$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, $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
|
list($paging_controls_mini, $rows_per_page) = paging($num_rows, $param, $rows_per_page, true); //top
|
||||||
$offset = $rows_per_page * $page;
|
$offset = $rows_per_page * $page;
|
||||||
|
|
@ -153,13 +153,13 @@ if (is_numeric($_SESSION['limit']['extensions']['numeric'])) {
|
||||||
}
|
}
|
||||||
$sql .= limit_offset($rows_per_page, $offset);
|
$sql .= limit_offset($rows_per_page, $offset);
|
||||||
$database = new database;
|
$database = new database;
|
||||||
$extensions = $database->select($sql, $parameters, 'all');
|
$extensions = $database->select($sql, $parameters ?? null, 'all');
|
||||||
unset($sql, $parameters);
|
unset($sql, $parameters);
|
||||||
|
|
||||||
//get the registrations
|
//get the registrations
|
||||||
if (permission_exists('extension_registered')) {
|
if (permission_exists('extension_registered')) {
|
||||||
$obj = new registrations;
|
$obj = new registrations;
|
||||||
if ($_GET['show'] == 'all') {
|
if (!empty($_GET['show']) && $_GET['show'] == 'all') {
|
||||||
$obj->show = 'all';
|
$obj->show = 'all';
|
||||||
}
|
}
|
||||||
$registrations = $obj->get('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;
|
$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'])) {
|
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);
|
unset($margin_left);
|
||||||
}
|
}
|
||||||
if (permission_exists('extension_enabled') && $extensions) {
|
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);
|
unset($margin_left);
|
||||||
}
|
}
|
||||||
if (permission_exists('extension_delete') && $extensions) {
|
if (permission_exists('extension_delete') && $extensions) {
|
||||||
if (permission_exists('voicemail_delete')) {
|
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 {
|
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);
|
unset($margin_left);
|
||||||
}
|
}
|
||||||
echo "<form id='form_search' class='inline' method='get'>\n";
|
echo "<form id='form_search' class='inline' method='get'>\n";
|
||||||
if (permission_exists('extension_all')) {
|
if (permission_exists('extension_all')) {
|
||||||
if ($_GET['show'] == 'all') {
|
if (!empty($_GET['show']) && $_GET['show'] == 'all') {
|
||||||
echo " <input type='hidden' name='show' value='all'>";
|
echo " <input type='hidden' name='show' value='all'>";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
@ -252,10 +252,10 @@ if (is_numeric($_SESSION['limit']['extensions']['numeric'])) {
|
||||||
echo "<tr class='list-header'>\n";
|
echo "<tr class='list-header'>\n";
|
||||||
if (permission_exists('extension_enabled') || permission_exists('extension_delete')) {
|
if (permission_exists('extension_enabled') || permission_exists('extension_delete')) {
|
||||||
echo " <th class='checkbox'>\n";
|
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";
|
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>".$text['label-domain']."</th>\n";
|
||||||
//echo th_order_by('domain_name', $text['label-domain'], $order_by, $order);
|
//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('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'");
|
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 " <td class='action-button'> </td>\n";
|
||||||
}
|
}
|
||||||
echo "</tr>\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 " <input type='hidden' name='extensions[$x][uuid]' value='".escape($row['extension_uuid'])."' />\n";
|
||||||
echo " </td>\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>".escape($_SESSION['domains'][$row['domain_uuid']]['domain_name'])."</td>\n";
|
||||||
}
|
}
|
||||||
echo " <td>";
|
echo " <td>";
|
||||||
|
|
@ -345,7 +345,7 @@ if (is_numeric($_SESSION['limit']['extensions']['numeric'])) {
|
||||||
}
|
}
|
||||||
echo " </td>\n";
|
echo " </td>\n";
|
||||||
echo " <td class='description overflow hide-sm-dn'>".escape($row['description'])."</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 " <td class='action-button'>";
|
||||||
echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]);
|
echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]);
|
||||||
echo " </td>\n";
|
echo " </td>\n";
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue