From 33e941aecf33b23bced19b7c30b64aa56f28d681 Mon Sep 17 00:00:00 2001 From: "o.pinke" Date: Mon, 26 Feb 2024 10:20:31 +0100 Subject: [PATCH] recode --- conlib/db_mysqli.inc | 3 ++- conlib/local.php | 20 ++++++++++++-------- conlite/classes/con2con/class.registry.php | 8 ++++++-- 3 files changed, 20 insertions(+), 11 deletions(-) diff --git a/conlib/db_mysqli.inc b/conlib/db_mysqli.inc index 5cfd720..0089cf3 100644 --- a/conlib/db_mysqli.inc +++ b/conlib/db_mysqli.inc @@ -185,7 +185,8 @@ class DB_Sql extends DB_Sql_Abstract { /** * @see DB_Sql_Abstract::next_record() */ - public function next_record() { + public function next_record(): bool|int + { if (!$this->Query_ID instanceof mysqli_result) { return false; } diff --git a/conlib/local.php b/conlib/local.php index b622ed6..2839444 100644 --- a/conlib/local.php +++ b/conlib/local.php @@ -80,16 +80,20 @@ class DB_ConLite extends DB_Sql { /** * Fetches the next recordset from result set * - * @param bool + * @deprecated since ConLite 2.3 */ - public function next_record() { - global $cCurrentModule; - // FIXME For what reason is NoRecord used??? - $this->NoRecord = false; + public function next_record(): bool|int + { + return $this->nextRecord(); + } + + public function nextRecord(): bool|int + { + $currentModule = cRegistry::getCurrentModule(); + if (!$this->Query_ID) { - $this->NoRecord = true; - if ($cCurrentModule > 0) { - $this->halt("next_record called with no query pending in Module ID $cCurrentModule."); + if ($currentModule > 0) { + $this->halt("next_record called with no query pending in Module ID $currentModule."); } else { $this->halt("next_record called with no query pending."); } diff --git a/conlite/classes/con2con/class.registry.php b/conlite/classes/con2con/class.registry.php index 5badca4..dacd100 100644 --- a/conlite/classes/con2con/class.registry.php +++ b/conlite/classes/con2con/class.registry.php @@ -219,6 +219,11 @@ class cRegistry { return self::_fetchGlobalVariable('edit', FALSE); } + public static function getCurrentModule() + { + return self::_fetchGlobalVariable('cCurrentModule', 0); + } + /** * Fetches the global variable requested. * If variable is not set, the default value is returned. @@ -246,5 +251,4 @@ class cRegistry { return new $apiClassName($objectId); } -} -?> \ No newline at end of file +} \ No newline at end of file