PHP 8.1 changes

This commit is contained in:
markjcrane 2023-05-25 10:52:28 -06:00
parent 7d2b43dc15
commit d0357b6124
2 changed files with 36 additions and 13 deletions

View File

@ -45,8 +45,18 @@
$language = new text;
$text = $language->get();
//define the variables
$module_label = '';
$modules = '';
$module_name = '';
$module_description = '';
$module_category = '';
$module_order = '';
$module_enabled = '';
$module_default_enabled = '';
//determin the action add or update
if (is_uuid($_REQUEST["id"])) {
if (!empty($_REQUEST["id"]) && is_uuid($_REQUEST["id"])) {
$action = "update";
$module_uuid = $_REQUEST["id"];
}
@ -55,7 +65,7 @@
}
//set the http post variables to php variables
if (count($_POST)>0) {
if (!empty($_POST)) {
$module_label = $_POST["module_label"];
$module_name = $_POST["module_name"];
$module_description = $_POST["module_description"];
@ -66,7 +76,7 @@
}
//process the data
if (count($_POST)>0 && empty($_POST["persistformvar"])) {
if (!empty($_POST) && empty($_POST["persistformvar"])) {
//get the uuid
if ($action == "update") {
@ -103,7 +113,7 @@
}
//add or update the database
if ($_POST["persistformvar"] != "true") {
if (empty($_POST["persistformvar"])) {
if ($action == "add" && permission_exists('module_add')) {
$module_uuid = uuid();
$array['modules'][0]['module_uuid'] = $module_uuid;
@ -144,7 +154,7 @@
}
//pre-populate the form
if (count($_GET)>0 && $_POST["persistformvar"] != "true") {
if (!empty($_GET) && empty($_POST["persistformvar"])) {
$module_uuid = $_GET["id"];
$sql = "select * from v_modules ";
$sql .= "where module_uuid = :module_uuid ";

View File

@ -46,12 +46,25 @@
$language = new text;
$text = $language->get();
//define the variables
$action = '';
$search = '';
$modules = '';
//get posted data
if (is_array($_POST['modules'])) {
$action = $_POST['action'];
$search = $_POST['search'];
if (!empty($_POST['modules'])) {
$modules = $_POST['modules'];
}
if (!empty($_POST['action'])) {
$action = $_POST['action'];
}
if (!empty($_POST['search'])) {
$search = $_POST['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';
//process the http post data by action
if ($action != '' && is_array($modules) && @sizeof($modules) != 0) {
@ -142,7 +155,7 @@
echo " <div style='clear: both;'></div>\n";
echo "</div>\n";
if (permission_exists('module_edit') && $modules && $fp) {
if (permission_exists('module_edit') && !empty($modules) && $fp) {
echo modal::create(['id'=>'modal-stop','type'=>'general','message'=>$text['confirm-stop_modules'],'actions'=>button::create(['type'=>'button','label'=>$text['button-continue'],'icon'=>'check','id'=>'btn_stop','style'=>'float: right; margin-left: 15px;','collapse'=>'never','onclick'=>"modal_close(); list_action_set('stop'); list_form_submit('form_list');"])]);
echo modal::create(['id'=>'modal-start','type'=>'general','message'=>$text['confirm-start_modules'],'actions'=>button::create(['type'=>'button','label'=>$text['button-continue'],'icon'=>'check','id'=>'btn_start','style'=>'float: right; margin-left: 15px;','collapse'=>'never','onclick'=>"modal_close(); list_action_set('start'); list_form_submit('form_list');"])]);
}
@ -162,7 +175,7 @@
echo "<table class='list'>\n";
function write_header($modifier) {
global $fp, $text, $modules;
global $fp, $text, $modules, $list_row_edit_button;
$modifier = str_replace('/', '', $modifier);
$modifier = str_replace(' ', ' ', $modifier);
$modifier = str_replace(' ', '_', $modifier);
@ -171,7 +184,7 @@
echo "<tr class='list-header'>\n";
if (permission_exists('module_edit') || permission_exists('module_delete')) {
echo " <th class='checkbox'>\n";
echo " <input type='checkbox' id='checkbox_all_".$modifier."' name='checkbox_all' onclick=\"list_all_toggle('".$modifier."'); checkbox_on_change(this);\" ".($modules ?: "style='visibility: hidden;'").">\n";
echo " <input type='checkbox' id='checkbox_all_".$modifier."' name='checkbox_all' onclick=\"list_all_toggle('".$modifier."'); checkbox_on_change(this);\" ".(!empty($modules) ?: "style='visibility: hidden;'").">\n";
echo " </th>\n";
}
echo "<th>".$text['label-label']."</th>\n";
@ -181,7 +194,7 @@
}
echo "<th class='center'>".$text['label-enabled']."</th>\n";
echo "<th class='hide-sm-dn' style='min-width: 40%;'>".$text['label-description']."</th>\n";
if (permission_exists('module_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
if (permission_exists('module_edit') && $list_row_edit_button == 'true') {
echo "<td class='action-button'>&nbsp;</td>\n";
}
echo "</tr>\n";
@ -253,7 +266,7 @@
}
echo " </td>\n";
echo " <td class='description overflow hide-sm-dn'>".escape($row["module_description"])."&nbsp;</td>\n";
if (permission_exists('module_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
if (permission_exists('module_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";