Fax Server: Updates for PHP 8.1

This commit is contained in:
fusionate
2023-05-29 22:25:48 +00:00
parent 88a966cbcc
commit 0406eeb14f

View File

@@ -47,14 +47,14 @@
$text = $language->get();
//get posted data
if (is_array($_POST['fax_servers'])) {
if (!empty($_POST['fax_servers']) && is_array($_POST['fax_servers'])) {
$action = $_POST['action'];
$search = $_POST['search'];
$fax_servers = $_POST['fax_servers'];
}
//process the http post data by action
if ($action != '' && is_array($fax_servers) && @sizeof($fax_servers) != 0) {
if (!empty($action) && !empty($fax_servers) && is_array($fax_servers) && @sizeof($fax_servers) != 0) {
switch ($action) {
case 'copy':
if (permission_exists('fax_extension_copy')) {
@@ -75,8 +75,8 @@
}
//get order and order by
$order_by = $_GET["order_by"];
$order = $_GET["order"];
$order_by = $_GET["order_by"] ?? null;
$order = $_GET["order"] ?? null;
//add the search
if (isset($_GET["search"])) {
@@ -84,7 +84,7 @@
}
//get record counts
if (permission_exists('fax_extension_view_all') && $_GET['show'] == 'all') {
if (permission_exists('fax_extension_view_all') && !empty($_GET['show']) && $_GET['show'] == 'all') {
//count the fax extensions
$sql = "select count(f.fax_uuid) from v_fax as f ";
if (isset($search)) {
@@ -148,15 +148,15 @@
//prepare paging
$rows_per_page = ($_SESSION['domain']['paging']['numeric'] != '') ? $_SESSION['domain']['paging']['numeric'] : 50;
$param = $search ? "search=".$search : null;
$param .= permission_exists('fax_extension_view_all') && $_GET['show'] == 'all' ? ($search ? '&' : '?')."show=all" : null;
$page = is_numeric($_GET['page']) ? $_GET['page'] : 0;
$param = !empty($search) ? "search=".$search : null;
$param .= permission_exists('fax_extension_view_all') && !empty($_GET['show']) && $_GET['show'] == 'all' ? (!empty($search) ? '&' : '?')."show=all" : null;
$page = !empty($_GET['page']) && is_numeric($_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 fax extensions
if (permission_exists('fax_extension_view_all') && $_GET['show'] == 'all') {
if (permission_exists('fax_extension_view_all') && !empty($_GET['show']) && $_GET['show'] == 'all') {
//show all fax extensions
$sql = "select f.fax_uuid, f.domain_uuid, fax_extension, fax_prefix, fax_name, fax_email, fax_description ";
$sql .= "from v_fax as f ";
@@ -244,16 +244,16 @@
if (permission_exists('fax_extension_delete') && $result) {
echo button::create(['type'=>'button','label'=>$text['button-delete'],'icon'=>$_SESSION['theme']['button_icon_delete'],'id'=>'btn_delete','name'=>'btn_delete','style'=>'display: none;','onclick'=>"modal_open('modal-delete','btn_delete');"]);
}
if (permission_exists('fax_extension_view_all') && $_GET['show'] != 'all') {
echo button::create(['type'=>'button','label'=>$text['button-show_all'],'icon'=>$_SESSION['theme']['button_icon_all'],'link'=>'?show=all'.($search ? '&search='.urlencode($search) : null)]);
if (permission_exists('fax_extension_view_all') && !empty($_GET['show']) && $_GET['show'] != 'all') {
echo button::create(['type'=>'button','label'=>$text['button-show_all'],'icon'=>$_SESSION['theme']['button_icon_all'],'link'=>'?show=all'.(!empty($search) ? '&search='.urlencode($search) : null)]);
}
echo "<form id='form_search' class='inline' method='get'>\n";
if (permission_exists('fax_extension_view_all') && $_GET['show'] == 'all') {
if (permission_exists('fax_extension_view_all') && !empty($_GET['show']) && $_GET['show'] == 'all') {
echo "<input type='hidden' name='show' value='all'>\n";
}
echo "<input type='text' class='txt list-search' name='search' id='search' value=\"".escape($search)."\" placeholder=\"".$text['label-search']."\" onkeydown='list_search_reset();'>";
echo button::create(['label'=>$text['button-search'],'icon'=>$_SESSION['theme']['button_icon_search'],'type'=>'submit','id'=>'btn_search','style'=>($search != '' ? 'display: none;' : null)]);
echo button::create(['label'=>$text['button-reset'],'icon'=>$_SESSION['theme']['button_icon_search'],'type'=>'button','id'=>'btn_reset','link'=>'fax.php'.($_GET['show'] == 'all' ? '?show=all' : null),'style'=>($search == '' ? 'display: none;' : null)]);
echo "<input type='text' class='txt list-search' name='search' id='search' value=\"".escape($search ?? '')."\" placeholder=\"".$text['label-search']."\" onkeydown='list_search_reset();'>";
echo button::create(['label'=>$text['button-search'],'icon'=>$_SESSION['theme']['button_icon_search'],'type'=>'submit','id'=>'btn_search','style'=>(!empty($search) ? 'display: none;' : null)]);
echo button::create(['label'=>$text['button-reset'],'icon'=>$_SESSION['theme']['button_icon_search'],'type'=>'button','id'=>'btn_reset','link'=>'fax.php'.(!empty($_GET['show']) && $_GET['show'] == 'all' ? '?show=all' : null),'style'=>(empty($search) ? 'display: none;' : null)]);
if ($paging_controls_mini != '') {
echo "<span style='margin-left: 15px;'>".$paging_controls_mini."</span>";
}
@@ -274,16 +274,16 @@
echo "<form id='form_list' method='post'>\n";
echo "<input type='hidden' id='action' name='action' value=''>\n";
echo "<input type='hidden' name='search' value=\"".escape($search)."\">\n";
echo "<input type='hidden' name='search' value=\"".escape($search ?? '')."\">\n";
echo "<table class='list'>\n";
echo "<tr class='list-header'>\n";
if (permission_exists('fax_extension_add') || permission_exists('fax_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);' ".($result ?: "style='visibility: hidden;'").">\n";
echo " <input type='checkbox' id='checkbox_all' name='checkbox_all' onclick='list_all_toggle(); checkbox_on_change(this);' ".(empty($result) ? "style='visibility: hidden;'" : null).">\n";
echo " </th>\n";
}
if (permission_exists('fax_extension_view_all') && $_GET['show'] == 'all') {
if (permission_exists('fax_extension_view_all') && !empty($_GET['show']) && $_GET['show'] == 'all') {
echo th_order_by('domain_name', $text['label-domain'], $order_by, $order);
}
echo th_order_by('fax_name', $text['label-name'], $order_by, $order);
@@ -291,7 +291,7 @@
echo th_order_by('fax_email', $text['label-email'], $order_by, $order);
echo " <th>".$text['label-tools']."</th>";
echo th_order_by('fax_description', $text['label-description'], $order_by, $order, null, "class='hide-sm-dn'");
if (permission_exists('fax_extension_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
if (permission_exists('fax_extension_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";
@@ -309,7 +309,7 @@
echo " <input type='hidden' name='fax_servers[$x][uuid]' value='".escape($row['fax_uuid'])."' />\n";
echo " </td>\n";
}
if (permission_exists('fax_extension_view_all') && $_GET['show'] == 'all') {
if (permission_exists('fax_extension_view_all') && !empty($_GET['show']) && $_GET['show'] == 'all') {
echo " <td>".escape($_SESSION['domains'][$row['domain_uuid']]['domain_name'])."</td>\n";
}
echo " <td>";
@@ -321,13 +321,13 @@
}
echo " </td>\n";
echo " <td>".escape($row['fax_extension'])."</td>\n";
echo " <td class='overflow' style='min-width: 25%;'>".escape(str_replace("\\",'', $row['fax_email']))."&nbsp;</td>\n";
echo " <td class='overflow' style='min-width: 25%;'>".escape(str_replace("\\",'', $row['fax_email'] ?? ''))."&nbsp;</td>\n";
echo " <td class='no-link no-wrap'>";
if (permission_exists('fax_send')) {
echo " <a href='fax_send.php?id=".urlencode($row['fax_uuid'])."'>".$text['label-new']."</a>&nbsp;&nbsp;";
}
if (permission_exists('fax_inbox_view')) {
if ($row['fax_email_inbound_subject_tag'] != '') {
if (!empty($row['fax_email_inbound_subject_tag'])) {
$file = "fax_files_remote.php";
$box = escape($row['fax_email_connection_mailbox']);
}
@@ -353,7 +353,7 @@
echo " </td>\n";
echo " <td class='description overflow hide-sm-dn'>".escape($row['fax_description'])."&nbsp;</td>\n";
if (permission_exists('fax_extension_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
if (permission_exists('fax_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";