php 8.1 changes (#6719)

* Update email_template_edit.php

* Update menu.php

* Update menu_edit.php

* Update number_translations.php

* Update number_translations.php

* Update email_templates.php

* Update email_templates.php

* Update setting_edit.php

* Update call_block.php

* Update call_block_edit.php

* Update email_template_edit.php

* Update call_block.php
This commit is contained in:
Alex
2023-05-25 12:38:32 -06:00
committed by GitHub
parent e3dce560cf
commit 5bb29763ad
8 changed files with 126 additions and 107 deletions

View File

@@ -45,15 +45,21 @@
$language = new text;
$text = $language->get();
//set additional variables
$search = $_GET["search"] ?? '';
//set from session variables
$list_row_edit_button = !empty($_SESSION['theme']['list_row_edit_button']['boolean']) ? $_SESSION['theme']['list_row_edit_button']['boolean'] : 'false';
//get posted data
if (is_array($_POST['call_blocks'])) {
if (!empty($_POST['call_blocks'])) {
$action = $_POST['action'];
$search = $_POST['search'];
$call_blocks = $_POST['call_blocks'];
}
//process the http post data by action
if ($action != '' && is_array($call_blocks) && @sizeof($call_blocks) != 0) {
if (!empty($action) && !empty($call_blocks)) {
switch ($action) {
case 'copy':
if (permission_exists('call_block_add')) {
@@ -80,18 +86,18 @@
}
//get variables used to control the order
$order_by = $_GET["order_by"];
$order = $_GET["order"];
$order_by = $_GET["order_by"] ?? '';
$order = $_GET["order"] ?? '';
//add the search term
if (isset($_GET["search"])) {
if (!empty($_GET["search"])) {
$search = strtolower($_GET["search"]);
}
//prepare to page the results
$sql = "select count(*) from view_call_block ";
$sql .= "where true ";
if ($_GET['show'] == "all" && permission_exists('call_block_all')) {
if (!empty($_GET['show']) == "all" && permission_exists('call_block_all')) {
//$sql .= "and (domain_uuid = :domain_uuid or domain_uuid is null) ";
//$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
}
@@ -110,7 +116,7 @@
}
$sql .= ") ";
}
if (isset($search)) {
if (!empty($search)) {
$sql .= "and (";
$sql .= " lower(call_block_name) like :search ";
$sql .= " or lower(call_block_direction) like :search ";
@@ -122,16 +128,16 @@
$parameters['search'] = '%'.$search.'%';
}
$database = new database;
$num_rows = $database->select($sql, $parameters, 'column');
$num_rows = $database->select($sql, $parameters ?? '', 'column');
unset($parameters);
//prepare to page the results
$rows_per_page = ($_SESSION['domain']['paging']['numeric'] != '') ? $_SESSION['domain']['paging']['numeric'] : 50;
$rows_per_page = (!empty($_SESSION['domain']['paging']['numeric'])) ? $_SESSION['domain']['paging']['numeric'] : 50;
$param = "&search=".$search;
if ($_GET['show'] == "all" && permission_exists('call_block_all')) {
if (!empty($_GET['show']) == "all" && permission_exists('call_block_all')) {
$param .= "&show=all";
}
$page = $_GET['page'];
$page = $_GET['page'] ?? '';
if (empty($page)) { $page = 0; $_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);
@@ -140,7 +146,7 @@
//get the list
$sql = "select * from view_call_block ";
$sql .= "where true ";
if ($_GET['show'] == "all" && permission_exists('call_block_all')) {
if (!empty($_GET['show']) == "all" && permission_exists('call_block_all')) {
//$sql .= "and (domain_uuid = :domain_uuid or domain_uuid is null) ";
//$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
}
@@ -148,7 +154,7 @@
$sql .= "and (domain_uuid = :domain_uuid) ";
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
}
if (!permission_exists('call_block_all') && is_array($_SESSION['user']['extension']) && count($_SESSION['user']['extension']) > 0) {
if (!permission_exists('call_block_all') && !empty($_SESSION['user']['extension']) && count($_SESSION['user']['extension']) > 0) {
$sql .= "and extension_uuid in (";
$x = 0;
foreach ($_SESSION['user']['extension'] as $field) {
@@ -159,7 +165,7 @@
}
$sql .= ") ";
}
if (isset($search)) {
if (!empty($search)) {
$sql .= "and (";
$sql .= " lower(call_block_name) like :search ";
$sql .= " or lower(call_block_direction) like :search ";
@@ -173,7 +179,7 @@
$sql .= order_by($order_by, $order, ['call_block_country_code','call_block_number']);
$sql .= limit_offset($rows_per_page, $offset);
$database = new database;
$result = $database->select($sql, $parameters, 'all');
$result = $database->select($sql, $parameters ?? '', 'all');
unset($sql, $parameters);
//create token
@@ -202,7 +208,7 @@
}
echo "<form id='form_search' class='inline' method='get'>\n";
if (permission_exists('call_block_all')) {
if ($_GET['show'] == 'all') {
if (!empty($_GET['show']) == 'all') {
echo " <input type='hidden' name='show' value='all'>";
}
else {
@@ -241,10 +247,10 @@
echo "<tr class='list-header'>\n";
if (permission_exists('call_block_add') || permission_exists('call_block_edit') || permission_exists('call_block_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;'").">\n";
echo " </th>\n";
}
if ($_GET['show'] == 'all' && permission_exists('domain_all')) {
if (!empty($_GET['show']) == 'all' && permission_exists('domain_all')) {
echo th_order_by('domain_name', $text['label-domain'], $order_by, $order);
}
echo th_order_by('call_block_direction', $text['label-direction'], $order_by, $order, null, "style='width: 1%;' class='center'");
@@ -257,12 +263,12 @@
echo th_order_by('call_block_enabled', $text['label-enabled'], $order_by, $order, null, "class='center'");
echo th_order_by('date_added', $text['label-date-added'], $order_by, $order, null, "class='shrink no-wrap'");
echo "<th class='hide-md-dn pct-20'>".$text['label-description']."</th>\n";
if (permission_exists('call_block_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
if (permission_exists('call_block_edit') && $list_row_edit_button == 'true') {
echo " <td class='action-button'>&nbsp;</td>\n";
}
echo "</tr>\n";
if (is_array($result)) {
if (!empty($result)) {
$x = 0;
foreach($result as $row) {
if (permission_exists('call_block_edit')) {
@@ -275,7 +281,7 @@
echo " <input type='hidden' name='call_blocks[".$x."][uuid]' value='".escape($row['call_block_uuid'])."' />\n";
echo " </td>\n";
}
if ($_GET['show'] == 'all' && permission_exists('domain_all')) {
if (!empty($_GET['show']) == 'all' && permission_exists('domain_all')) {
echo " <td>".escape($_SESSION['domains'][$row['domain_uuid']]['domain_name'])."</td>\n";
}
echo " <td class='center'>";
@@ -320,9 +326,9 @@
echo $text['label-'.$row['call_block_enabled']];
}
echo " </td>\n";
echo " <td class='no-wrap'>".date('j M Y', $row['date_added'])." <span class='hide-sm-dn'>".date(($_SESSION['domain']['time_format']['text'] == '12h' ? 'h:i:s a' : 'H:i:s'), $row['date_added'])."</span></td>\n";
echo " <td class='no-wrap'>".date('j M Y', $row['date_added'])." <span class='hide-sm-dn'>".date((!empty($_SESSION['domain']['time_format']['text']) == '12h' ? 'h:i:s a' : 'H:i:s'), $row['date_added'])."</span></td>\n";
echo " <td class='description overflow hide-md-dn'>".escape($row['call_block_description'])."</td>\n";
if (permission_exists('call_block_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
if (permission_exists('call_block_edit') && $list_row_edit_button == '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";

View File

@@ -79,7 +79,7 @@
if (count($_POST) > 0 && empty($_POST["persistformvar"])) {
//handle action
if ($_POST['action'] != '') {
if (!empty($_POST['action'])) {
switch ($_POST['action']) {
case 'delete':
if (permission_exists('call_block_delete') && is_uuid($call_block_uuid)) {
@@ -135,7 +135,7 @@
}
//add or update the database
if (is_array($_POST) && sizeof($_POST) != 0 && $_POST["persistformvar"] != "true") {
if (!empty($_POST) && empty($_POST["persistformvar"])) {
//ensure call block is enabled in the dialplan
if ($action == "add" || $action == "update") {
@@ -147,7 +147,7 @@
$database = new database;
$rows = $database->select($sql, $parameters);
if (is_array($rows) && sizeof($rows) != 0) {
if (!empty($rows)) {
foreach ($rows as $index => $row) {
$array['dialplans'][$index]['dialplan_uuid'] = $row['dialplan_uuid'];
$array['dialplans'][$index]['dialplan_enabled'] = 'true';
@@ -208,7 +208,7 @@
$parameters['call_block_uuid'] = $call_block_uuid;
$database = new database;
$result = $database->select($sql, $parameters);
if (is_array($result) && sizeof($result) != 0) {
if (!empty($result)) {
//set the domain_name
$domain_name = $result[0]["domain_name"];
@@ -248,7 +248,7 @@
}
//pre-populate the form
if (count($_GET) > 0 && $_POST["persistformvar"] != "true") {
if (count($_GET) > 0 && !empty($_POST["persistformvar"])) {
$call_block_uuid = $_GET["id"];
$sql = "select * from v_call_block ";
$sql .= "where domain_uuid = :domain_uuid ";
@@ -257,7 +257,7 @@
$parameters['call_block_uuid'] = $call_block_uuid;
$database = new database;
$row = $database->select($sql, $parameters, 'row');
if (is_array($row) && sizeof($row) != 0) {
if (!empty($row)) {
$call_block_direction = $row["call_block_direction"];
$extension_uuid = $row["extension_uuid"];
$call_block_name = $row["call_block_name"];
@@ -385,7 +385,7 @@ if (permission_exists('call_block_all') || permission_exists('call_block_ring_gr
echo "<td width='70%' class='vtable' align='left'>\n";
echo " <select class='formfld' name='extension_uuid'>\n";
echo " <option value=''>".$text['label-all']."</option>\n";
if (is_array($extensions) && sizeof($extensions) != 0) {
if (!empty($extensions)) {
foreach ($extensions as $row) {
$selected = $extension_uuid == $row['extension_uuid'] ? "selected='selected'" : null;
echo " <option value='".urlencode($row["extension_uuid"])."' ".$selected.">".escape($row['extension'])." ".escape($row['description'])."</option>\n";
@@ -404,7 +404,7 @@ if (permission_exists('call_block_all') || permission_exists('call_block_ring_gr
echo " ".$text['label-name']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='call_block_name' maxlength='255' value=\"".escape($call_block_name)."\">\n";
echo " <input class='formfld' type='text' name='call_block_name' maxlength='255' value=\"".escape($call_block_name ?? '')."\">\n";
echo "<br />\n";
echo $text['description-call_block_name']."\n";
echo "</td>\n";
@@ -415,8 +415,8 @@ if (permission_exists('call_block_all') || permission_exists('call_block_ring_gr
echo " ".$text['label-number']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='call_block_country_code' maxlength='6' style='width: 60px;' value=\"".escape($call_block_country_code)."\">\n";
echo " <input class='formfld' type='text' name='call_block_number' maxlength='255' value=\"".escape($call_block_number)."\">\n";
echo " <input class='formfld' type='text' name='call_block_country_code' maxlength='6' style='width: 60px;' value=\"".escape($call_block_country_code ?? '')."\">\n";
echo " <input class='formfld' type='text' name='call_block_number' maxlength='255' value=\"".escape($call_block_number ?? '')."\">\n";
echo "<br />\n";
echo $text['description-call_block_number']."\n";
echo "<br />\n";
@@ -453,7 +453,7 @@ if (permission_exists('call_block_all') || permission_exists('call_block_ring_gr
echo " <option value='hold'>".$text['label-hold']."</option>\n";
}
if (permission_exists('call_block_extension')) {
if (is_array($extensions) && sizeof($extensions) != 0) {
if (!empty($extensions)) {
echo " <optgroup label='".$text['label-extension']."'>\n";
foreach ($extensions as &$row) {
$selected = ($call_block_app == 'extension' && $call_block_data == $row['extension']) ? "selected='selected'" : null;
@@ -463,7 +463,7 @@ if (permission_exists('call_block_all') || permission_exists('call_block_ring_gr
}
}
if (permission_exists('call_block_ivr')) {
if (is_array($ivrs) && sizeof($ivrs) != 0) {
if (!empty($ivrs)) {
echo " <optgroup label='".$text['label-ivr_menus']."'>\n";
foreach ($ivrs as &$row) {
$selected = ($call_block_app == 'ivr' && $call_block_data == $row['ivr_menu_extension']) ? "selected='selected'" : null;
@@ -473,7 +473,7 @@ if (permission_exists('call_block_all') || permission_exists('call_block_ring_gr
}
}
if (permission_exists('call_block_ring_group')) {
if (is_array($ring_groups) && sizeof($ring_groups) != 0) {
if (!empty($ring_groups)) {
echo " <optgroup label='".$text['label-ring_groups']."'>\n";
foreach ($ring_groups as &$row) {
$selected = ($call_block_app == 'ring_group' && $call_block_data == $row['ring_group_extension']) ? "selected='selected'" : null;
@@ -483,7 +483,7 @@ if (permission_exists('call_block_all') || permission_exists('call_block_ring_gr
}
}
if (permission_exists('call_block_voicemail')) {
if (is_array($voicemails) && sizeof($voicemails) != 0) {
if (!empty($voicemails)) {
echo " <optgroup label='".$text['label-voicemail']."'>\n";
foreach ($voicemails as &$row) {
$selected = ($call_block_app == 'voicemail' && $call_block_data == $row['voicemail_id']) ? "selected='selected'" : null;
@@ -529,7 +529,7 @@ if (permission_exists('call_block_all') || permission_exists('call_block_ring_gr
echo " ".$text['label-description']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='call_block_description' maxlength='255' value=\"".escape($call_block_description)."\">\n";
echo " <input class='formfld' type='text' name='call_block_description' maxlength='255' value=\"".escape($call_block_description ?? '')."\">\n";
echo "<br />\n";
echo $text['description-description']."\n";
echo "</td>\n";
@@ -549,18 +549,18 @@ if (permission_exists('call_block_all') || permission_exists('call_block_ring_gr
if (!is_uuid($_REQUEST["id"])) {
//without block all permission, limit to assigned extension(s)
if (!permission_exists('call_block_all') && is_array($_SESSION['user']['extension'])) {
if (!permission_exists('call_block_all') && !empty($_SESSION['user']['extension'])) {
foreach ($_SESSION['user']['extension'] as $assigned_extension) {
$assigned_extensions[$assigned_extension['extension_uuid']] = $assigned_extension['user'];
}
if (is_array($assigned_extensions) && sizeof($assigned_extensions) != 0) {
if (!empty($assigned_extensions)) {
$x = 0;
foreach ($assigned_extensions as $assigned_extension_uuid => $assigned_extension) {
$sql_where_array[] = "extension_uuid = :extension_uuid_".$x;
$parameters['extension_uuid_'.$x] = $assigned_extension_uuid;
$x++;
}
if (is_array($sql_where_array) && sizeof($sql_where_array) != 0) {
if (!empty($sql_where_array)) {
$sql_where .= "and (".implode(' or ', $sql_where_array).") ";
}
unset($sql_where_array);
@@ -599,7 +599,7 @@ if (permission_exists('call_block_all') || permission_exists('call_block_ring_gr
echo "<select class='formfld' style='".$select_margin."' name='extension_uuid'>\n";
echo " <option value='' disabled='disabled'>".$text['label-extension']."</option>\n";
echo " <option value='' selected='selected'>".$text['label-all']."</option>\n";
if (is_array($extensions) && sizeof($extensions) != 0) {
if (!empty($extensions)) {
foreach ($extensions as $row) {
$selected = $extension_uuid == $row['extension_uuid'] ? "selected='selected'" : null;
echo " <option value='".urlencode($row["extension_uuid"])."' ".$selected.">".escape($row['extension'])." ".escape($row['description'])."</option>\n";
@@ -633,7 +633,7 @@ if (permission_exists('call_block_all') || permission_exists('call_block_ring_gr
echo th_order_by('duration', $text['label-duration'], $order_by, $order, null, "class='right hide-sm-dn'");
echo "</tr>";
if (is_array($result) && @sizeof($result) != 0) {
if (!empty($result)) {
foreach ($result as $x => $row) {
if ($row['direction'] == $direction) {
$list_row_onclick_uncheck = "if (!this.checked) { document.getElementById('checkbox_all_".$direction."').checked = false; }";

View File

@@ -65,7 +65,7 @@
}
//process the user data and save it to the database
if (count($_POST) > 0 && empty($_POST["persistformvar"])) {
if (!empty($_POST) && empty($_POST["persistformvar"])) {
//get the uuid from the POST
if ($action == "update") {
@@ -145,7 +145,7 @@
}
//pre-populate the form
if (is_array($_GET) && $_POST["persistformvar"] != "true") {
if (count($_GET)>0 && empty($_POST["persistformvar"])) {
$email_template_uuid = $_GET["id"];
$sql = "select * from v_email_templates ";
$sql .= "where email_template_uuid = :email_template_uuid ";
@@ -154,7 +154,7 @@
//$parameters['domain_uuid'] = $domain_uuid;
$database = new database;
$row = $database->select($sql, $parameters, 'row');
if (is_array($row) && @sizeof($row) != 0) {
if (!empty($row)) {
$domain_uuid = $row["domain_uuid"];
$template_language = $row["template_language"];
$template_category = $row["template_category"];
@@ -172,11 +172,11 @@
if (empty($template_enabled)) { $template_enabled = 'true'; }
//load editor preferences/defaults
$setting_size = $_SESSION["editor"]["font_size"]["text"] != '' ? $_SESSION["editor"]["font_size"]["text"] : '12px';
$setting_theme = $_SESSION["editor"]["theme"]["text"] != '' ? $_SESSION["editor"]["theme"]["text"] : 'cobalt';
$setting_invisibles = $_SESSION["editor"]["invisibles"]["boolean"] != '' ? $_SESSION["editor"]["invisibles"]["boolean"] : 'false';
$setting_indenting = $_SESSION["editor"]["indent_guides"]["boolean"] != '' ? $_SESSION["editor"]["indent_guides"]["boolean"] : 'false';
$setting_numbering = $_SESSION["editor"]["line_numbers"]["boolean"] != '' ? $_SESSION["editor"]["line_numbers"]["boolean"] : 'true';
$setting_size = !empty($_SESSION["editor"]["font_size"]["text"]) ? $_SESSION["editor"]["font_size"]["text"] : '12px';
$setting_theme = !empty($_SESSION["editor"]["theme"]["text"]) ? $_SESSION["editor"]["theme"]["text"] : 'cobalt';
$setting_invisibles = !empty($_SESSION["editor"]["invisibles"]["boolean"]) ? $_SESSION["editor"]["invisibles"]["boolean"] : 'false';
$setting_indenting = !empty($_SESSION["editor"]["indent_guides"]["boolean"]) ? $_SESSION["editor"]["indent_guides"]["boolean"] : 'false';
$setting_numbering = !empty($_SESSION["editor"]["line_numbers"]["boolean"]) ? $_SESSION["editor"]["line_numbers"]["boolean"] : 'true';
//create token
$object = new token;
@@ -410,7 +410,7 @@
}
echo " </select>\n";
echo "<br />\n";
echo $text['description-domain_uuid']."\n";
echo !empty($text['description-domain_uuid'])."\n";
echo "</td>\n";
echo "</tr>\n";

View File

@@ -77,7 +77,7 @@
break;
}
header('Location: email_templates.php?'.(!empty($search) ? '&search='.urlencode($search) : null).($category != '' ? '&category='.urlencode($category) : null));
header('Location: email_templates.php?'.(!empty($search) ? '&search='.urlencode($search) : null).(!empty($category) ? '&category='.urlencode($category) : null));
exit;
}
@@ -126,7 +126,7 @@
}
$sql .= $sql_category ?? '';
$database = new database;
$num_rows = $database->select($sql, $parameters, 'column');
$num_rows = $database->select($sql, $parameters ?? '', 'column');
//prepare to page the results
$rows_per_page = (!empty($_SESSION['domain']['paging']['numeric'])) ? $_SESSION['domain']['paging']['numeric'] : 50;
@@ -200,7 +200,7 @@
echo "<select name='category' id='category' class='formfld' style='margin-left: 18px;' onchange=\"$('#form_search').submit();\">\n";
echo "<option value='' ".(!$category ? "selected='selected'" : null)." disabled='disabled'>".$text['label-category']."...</option>\n";
echo "<option value=''></option>\n";
if (is_array($template_categories) && @sizeof($template_categories) != 0) {
if (!empty($template_categories)) {
foreach ($template_categories as $template_category_value => $template_category_label) {
echo "<option value='".$template_category_value."' ".($category == $template_category_value ? "selected='selected'" : null).">".escape($template_category_label)."</option>\n";
}
@@ -209,7 +209,7 @@
echo "<input type='text' class='txt list-search' name='search' id='search' value=\"".escape($search)."\" placeholder=\"".$text['label-search']."\" onkeydown=''>";
echo button::create(['label'=>$text['button-search'],'icon'=>$_SESSION['theme']['button_icon_search'],'type'=>'submit','id'=>'btn_search']);
//echo button::create(['label'=>$text['button-reset'],'icon'=>$_SESSION['theme']['button_icon_reset'],'type'=>'button','id'=>'btn_reset','link'=>'email_templates.php','style'=>($search == '' ? 'display: none;' : null)]);
if ($paging_controls_mini != '') {
if (!empty($paging_controls_mini)) {
echo "<span style='margin-left: 15px;'>".$paging_controls_mini."</span>";
}
echo " </form>\n";
@@ -257,7 +257,7 @@
}
echo "</tr>\n";
if (is_array($result) && @sizeof($result) != 0) {
if (!empty($result)) {
$x = 0;
foreach($result as $row) {
if (permission_exists('email_template_edit')) {

View File

@@ -46,15 +46,21 @@
$language = new text;
$text = $language->get();
//set additional variables
$search = $_GET["search"] ?? '';
//set from session variables
$list_row_edit_button = !empty($_SESSION['theme']['list_row_edit_button']['boolean']) ? $_SESSION['theme']['list_row_edit_button']['boolean'] : 'false';
//get the http post data
if (is_array($_POST['number_translations'])) {
if (!empty($_POST['number_translations'])) {
$action = $_POST['action'];
$search = $_POST['search'];
$number_translations = $_POST['number_translations'];
}
//process the http post data by action
if ($action != '' && is_array($number_translations) && @sizeof($number_translations) != 0) {
if (!empty($action) && !empty($number_translations)) {
//validate the token
$token = new token;
@@ -97,16 +103,16 @@
}
//redirect the user
header('Location: number_translations.php'.($search != '' ? '?search='.urlencode($search) : null));
header('Location: number_translations.php'.(!empty($search) ? '?search='.urlencode($search) : null));
exit;
}
//get order and order by
$order_by = $_GET["order_by"];
$order = $_GET["order"];
$order_by = $_GET["order_by"] ?? '';
$order = $_GET["order"] ?? '';
//add the search
if (isset($_GET["search"])) {
if (!empty($search)) {
$search = strtolower($_GET["search"]);
$parameters['search'] = '%'.$search.'%';
}
@@ -114,19 +120,19 @@
//get the count
$sql = "select count(number_translation_uuid) ";
$sql .= "from v_number_translations ";
if (isset($_GET["search"])) {
if (!empty($search)) {
$sql .= "where (";
$sql .= " lower(number_translation_name) like :search ";
$sql .= " or lower(number_translation_description) like :search ";
$sql .= ") ";
}
$database = new database;
$num_rows = $database->select($sql, $parameters, 'column');
$num_rows = $database->select($sql, $parameters ?? '', 'column');
//prepare to page the results
$rows_per_page = ($_SESSION['domain']['paging']['numeric'] != '') ? $_SESSION['domain']['paging']['numeric'] : 50;
$rows_per_page = (!empty($_SESSION['domain']['paging']['numeric'])) ? $_SESSION['domain']['paging']['numeric'] : 50;
$param = $search ? "&search=".$search : null;
$page = is_numeric($_GET['page']) ? $_GET['page'] : 0;
$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;
@@ -138,7 +144,7 @@
$sql .= "cast(number_translation_enabled as text), ";
$sql .= "number_translation_description ";
$sql .= "from v_number_translations ";
if (isset($_GET["search"])) {
if (!empty($search)) {
$sql .= "where (";
$sql .= " lower(number_translation_name) like :search ";
$sql .= " or lower(number_translation_description) like :search ";
@@ -147,7 +153,7 @@
$sql .= order_by($order_by, $order, 'number_translation_name', 'asc');
$sql .= limit_offset($rows_per_page, $offset);
$database = new database;
$number_translations = $database->select($sql, $parameters, 'all');
$number_translations = $database->select($sql, $parameters ?? '', 'all');
unset($sql, $parameters);
//create token
@@ -178,7 +184,7 @@
echo "<input type='text' class='txt list-search' name='search' id='search' value=\"".escape($search)."\" placeholder=\"".$text['label-search']."\" onkeydown=''>";
echo button::create(['label'=>$text['button-search'],'icon'=>$_SESSION['theme']['button_icon_search'],'type'=>'submit','id'=>'btn_search']);
//echo button::create(['label'=>$text['button-reset'],'icon'=>$_SESSION['theme']['button_icon_reset'],'type'=>'button','id'=>'btn_reset','link'=>'number_translations.php','style'=>($search == '' ? 'display: none;' : null)]);
if ($paging_controls_mini != '') {
if (!empty($paging_controls_mini)) {
echo "<span style='margin-left: 15px;'>".$paging_controls_mini."</span>\n";
}
echo " </form>\n";
@@ -207,18 +213,18 @@
echo "<tr class='list-header'>\n";
if (permission_exists('number_translation_add') || permission_exists('number_translation_edit') || permission_exists('number_translation_delete')) {
echo " <th class='checkbox'>\n";
echo " <input type='checkbox' id='checkbox_all' name='checkbox_all' onclick='list_all_toggle(); checkbox_on_change(this);' ".($number_translations ?: "style='visibility: hidden;'").">\n";
echo " <input type='checkbox' id='checkbox_all' name='checkbox_all' onclick='list_all_toggle(); checkbox_on_change(this);' ".(!empty($number_translations) ?: "style='visibility: hidden;'").">\n";
echo " </th>\n";
}
echo th_order_by('number_translation_name', $text['label-number_translation_name'], $order_by, $order);
echo th_order_by('number_translation_enabled', $text['label-number_translation_enabled'], $order_by, $order, null, "class='center'");
echo " <th class='hide-sm-dn'>".$text['label-number_translation_description']."</th>\n";
if (permission_exists('number_translation_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
if (permission_exists('number_translation_edit') && $list_row_edit_button == 'true') {
echo " <td class='action-button'>&nbsp;</td>\n";
}
echo "</tr>\n";
if (is_array($number_translations) && @sizeof($number_translations) != 0) {
if (!empty($number_translations)) {
$x = 0;
foreach ($number_translations as $row) {
if (permission_exists('number_translation_edit')) {
@@ -250,7 +256,7 @@
}
echo " </td>\n";
echo " <td class='description overflow hide-sm-dn'>".escape($row['number_translation_description'])."</td>\n";
if (permission_exists('number_translation_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
if (permission_exists('number_translation_edit') && $list_row_edit_button == 'true') {
echo " <td class='action-button'>\n";
echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]);
echo " </td>\n";

View File

@@ -49,7 +49,7 @@
//get the number of rows in v_extensions
$sql = " select count(*) from v_settings ";
$database = new database;
$num_rows = $database->select($sql, $parameters, 'column');
$num_rows = $database->select($sql, $parameters ?? '', 'column');
//set the action
$action = $num_rows == 0 ? "add" : "update";
@@ -103,7 +103,7 @@ if (count($_POST)>0 && empty($_POST["persistformvar"])) {
}
//add or update the database
if ($_POST["persistformvar"] != "true") {
if (empty($_POST["persistformvar"])) {
if (permission_exists('setting_edit')) {
//build array
$array['settings'][0]['setting_uuid'] = $action == "add" ? uuid() : $setting_uuid;
@@ -151,11 +151,11 @@ if (count($_POST)>0 && empty($_POST["persistformvar"])) {
}
//pre-populate the form
if ($_POST["persistformvar"] != "true") {
if (empty($_POST["persistformvar"])) {
$sql = "select * from v_settings ";
$database = new database;
$row = $database->select($sql, null, 'row');
if (is_array($row) && @sizeof($row) != 0) {
if (!empty($row)) {
$setting_uuid = $row['setting_uuid'];
$event_socket_ip_address = $row["event_socket_ip_address"];
$event_socket_port = $row["event_socket_port"];
@@ -242,7 +242,7 @@ if (count($_POST)>0 && empty($_POST["persistformvar"])) {
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='event_socket_acl' id='event_socket_acl' maxlength='50' value=\"".escape($event_socket_acl)."\">\n";
echo "<br />\n";
echo $text['description-event_socket_acl']."\n";
echo !empty($text['description-event_socket_acl'])."\n";
echo "</td>\n";
echo "</tr>\n";
@@ -363,4 +363,4 @@ if (count($_POST)>0 && empty($_POST["persistformvar"])) {
//show the footer
require_once "resources/footer.php";
?>
?>