From 9313e0835103faab5d771bc0bb93ede47f069543 Mon Sep 17 00:00:00 2001 From: Luca Date: Tue, 22 Mar 2022 18:59:25 +0100 Subject: [PATCH] Fix per PHP 8.1 --- editor.php | 24 +++++++++++++----------- include/top.php | 2 +- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/editor.php b/editor.php index 749517636..1cf2daadc 100755 --- a/editor.php +++ b/editor.php @@ -40,20 +40,22 @@ if (!empty($id_record)) { Util\Query::setSegments(true); } // Rimozione della condizione deleted_at IS NULL per visualizzare anche i record eliminati -if (preg_match('/[`]*([a-z0-9_]*)[`]*[\.]*([`]*deleted_at[`]* IS NULL)/i', $query, $m)) { - $conditions_to_remove = []; +if (!empty($query)){ + if (preg_match('/[`]*([a-z0-9_]*)[`]*[\.]*([`]*deleted_at[`]* IS NULL)/i', $query, $m)) { + $conditions_to_remove = []; - $condition = trim($m[0]); + $condition = trim($m[0]); - if (!empty($table_name)) { - $condition = $table_name.'.'.$condition; + if (!empty($table_name)) { + $condition = $table_name.'.'.$condition; + } + + $conditions_to_remove[] = ' AND '.$condition; + $conditions_to_remove[] = $condition.' AND '; + + $query = str_replace($conditions_to_remove, '', $query); + $query = str_replace($condition, '', $query); } - - $conditions_to_remove[] = ' AND '.$condition; - $conditions_to_remove[] = $condition.' AND '; - - $query = str_replace($conditions_to_remove, '', $query); - $query = str_replace($condition, '', $query); } $has_access = !empty($query) ? $dbo->fetchNum($query) !== 0 : true; diff --git a/include/top.php b/include/top.php index d6afdd65b..87b14e967 100755 --- a/include/top.php +++ b/include/top.php @@ -511,7 +511,7 @@ if (Auth::check()) { $count = 0; if (!empty($plugin['options2'])){ $opt = json_decode($plugin['options2'], true); - }else{ + }else if (!empty($plugin['options'])){ $opt = json_decode($plugin['options'], true); }