From cd763cadf98fea7c4783a36fa87c98e023817c85 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Fri, 12 Feb 2021 11:43:17 -0500 Subject: [PATCH 1/5] check if $criteria is_subclass_of CriteriaElement --- class/ForumHandler.php | 2 +- class/OnlineHandler.php | 7 ++++--- class/PostHandler.php | 4 ++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/class/ForumHandler.php b/class/ForumHandler.php index 0d1088e6..a9a63863 100644 --- a/class/ForumHandler.php +++ b/class/ForumHandler.php @@ -37,7 +37,7 @@ public function __construct(\XoopsDatabase $db = null) /** * @param \XoopsObject $object * @param bool $force - * @return bool + * @return bool|int * @internal param \XoopsObject $forum */ public function insert(\XoopsObject $object, $force = true) //insert($forum) diff --git a/class/OnlineHandler.php b/class/OnlineHandler.php index 662d3a91..82af3425 100644 --- a/class/OnlineHandler.php +++ b/class/OnlineHandler.php @@ -295,6 +295,7 @@ public function gc($expire) $sql = 'DELETE FROM ' . $this->db->prefix('newbb_online') . ' WHERE online_updated < ' . (\time() - (int)$expire); $this->db->queryF($sql); + /** @var \XoopsOnlineHandler $xoopsOnlineHandler */ $xoopsOnlineHandler = \xoops_getHandler('online'); $xoopsOnlineHandler->gc($expire); } @@ -302,7 +303,7 @@ public function gc($expire) /** * Get an array of online information * - * @param \CriteriaElement|\CriteriaCompo|null $criteria {@link \CriteriaElement} + * @param \CriteriaElement|null $criteria {@link \CriteriaElement} * @return array Array of associative arrays of online information */ public function getAll($criteria = null) @@ -310,7 +311,7 @@ public function getAll($criteria = null) $ret = []; $limit = $start = 0; $sql = 'SELECT * FROM ' . $this->db->prefix('newbb_online'); - if (\is_object($criteria) && $criteria instanceof CriteriaElement) { + if (\is_object($criteria) && is_subclass_of($criteria, \CriteriaElement::class)) { $sql .= ' ' . $criteria->renderWhere(); $limit = $criteria->getLimit(); $start = $criteria->getStart(); @@ -371,7 +372,7 @@ public function checkStatus($uids) public function getCount($criteria = null) { $sql = 'SELECT COUNT(*) FROM ' . $this->db->prefix('newbb_online'); - if (\is_object($criteria) && $criteria instanceof CriteriaElement) { + if (\is_object($criteria) && is_subclass_of($criteria, \CriteriaElement::class)) { $sql .= ' ' . $criteria->renderWhere(); } if (!$result = $this->db->query($sql)) { diff --git a/class/PostHandler.php b/class/PostHandler.php index cb2dd90c..823bf607 100644 --- a/class/PostHandler.php +++ b/class/PostHandler.php @@ -483,7 +483,7 @@ public function getPostCount($criteria = null, $join = null) // LEFT JOIN $sql .= $join; // WHERE - if (null !== $criteria && $criteria instanceof \CriteriaElement) { + if (\is_object($criteria) && is_subclass_of($criteria, \CriteriaElement::class)) { $sql .= ' ' . $criteria->renderWhere(); } if (!$result = $this->db->query($sql)) { @@ -515,7 +515,7 @@ public function getPostsByLimit($criteria = null, $limit = 1, $start = 0, $join if (!empty($join)) { $sql .= $join; } - if (null !== $criteria && $criteria instanceof \CriteriaElement) { + if (\is_object($criteria) && is_subclass_of($criteria, \CriteriaElement::class)) { $sql .= ' ' . $criteria->renderWhere(); if ('' !== $criteria->getSort()) { $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder(); From efec778ad1848846a78c149ec6afaac25a7ad53b Mon Sep 17 00:00:00 2001 From: mambax7 Date: Fri, 12 Feb 2021 12:33:34 -0500 Subject: [PATCH 2/5] scrutinizer --- class/OnlineHandler.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/class/OnlineHandler.php b/class/OnlineHandler.php index 82af3425..35a60930 100644 --- a/class/OnlineHandler.php +++ b/class/OnlineHandler.php @@ -257,6 +257,7 @@ public function write($uid, $uname, $time, $forum_id, $ip, $topic_id) return false; } + /** @var \XoopsOnlineHandler $xoopsOnlineHandler */ $xoopsOnlineHandler = \xoops_getHandler('online'); $xoopsOnlineTable = $xoopsOnlineHandler->table; @@ -311,7 +312,7 @@ public function getAll($criteria = null) $ret = []; $limit = $start = 0; $sql = 'SELECT * FROM ' . $this->db->prefix('newbb_online'); - if (\is_object($criteria) && is_subclass_of($criteria, \CriteriaElement::class)) { + if (\is_object($criteria) && ($criteria instanceof \CriteriaCompo || $criteria instanceof \Criteria)) { $sql .= ' ' . $criteria->renderWhere(); $limit = $criteria->getLimit(); $start = $criteria->getStart(); From 233bf9bc237efa546ba5b0c52d96034fbba92103 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Fri, 12 Feb 2021 12:46:27 -0500 Subject: [PATCH 3/5] scrutinizer --- class/OnlineHandler.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/class/OnlineHandler.php b/class/OnlineHandler.php index 35a60930..9ce6fd26 100644 --- a/class/OnlineHandler.php +++ b/class/OnlineHandler.php @@ -373,7 +373,7 @@ public function checkStatus($uids) public function getCount($criteria = null) { $sql = 'SELECT COUNT(*) FROM ' . $this->db->prefix('newbb_online'); - if (\is_object($criteria) && is_subclass_of($criteria, \CriteriaElement::class)) { + if (\is_object($criteria) && ($criteria instanceof \CriteriaCompo || $criteria instanceof \Criteria)) { $sql .= ' ' . $criteria->renderWhere(); } if (!$result = $this->db->query($sql)) { From 71a7ca16b301f046aa741e7dfa8ce66a355be314 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Sun, 14 Feb 2021 21:41:48 -0500 Subject: [PATCH 4/5] xoops_loadLanguage --- blocks/newbb_block.php | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/blocks/newbb_block.php b/blocks/newbb_block.php index 9b0e731b..bf9960b9 100644 --- a/blocks/newbb_block.php +++ b/blocks/newbb_block.php @@ -929,11 +929,7 @@ function b_newbb_author_edit($options) function b_newbb_custom($options) { // if no newbb module block set, we have to include the language file - if (is_readable($GLOBALS['xoops']->path('modules/newbb/language/' . $GLOBALS['xoopsConfig']['language'] . '/blocks.php'))) { - require_once $GLOBALS['xoops']->path('modules/newbb/language/' . $GLOBALS['xoopsConfig']['language'] . '/blocks.php'); - } else { - require_once $GLOBALS['xoops']->path('modules/newbb/language/english/blocks.php'); - } + xoops_loadLanguage('blocks', 'newbb'); $options = explode('|', $options); $block = b_newbb_show($options); From 4b4f8721c7e5eed53edaf6819bd4e2aa6995b0a6 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Sun, 14 Feb 2021 21:46:16 -0500 Subject: [PATCH 5/5] 5.01 Beta 3 --- docs/changelog.txt | 2 +- xoops_version.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/changelog.txt b/docs/changelog.txt index f1c97a50..83bc8ce1 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -1,4 +1,4 @@ -
5.01 Beta 3 [NOT RELEASED]
Dev: XOOPS 2.5.11, PHP 7.4.14, PHP 8.0.1 +
5.01 Beta 3 [2021-02-14]
Dev: XOOPS 2.5.11, PHP 7.4.14, PHP 8.0.2
- 'isset' replaced with coalesce (mamba) - rename $newbbpermHandler (mamba) diff --git a/xoops_version.php b/xoops_version.php index 91b29548..9447495b 100644 --- a/xoops_version.php +++ b/xoops_version.php @@ -16,7 +16,7 @@ $modversion = [ 'version' => 5.01, 'module_status' => 'Beta 3', - 'release_date' => '2021/01/31', + 'release_date' => '2021/02/14', 'name' => _MI_NEWBB_NAME, 'description' => _MI_NEWBB_DESC, 'help' => 'page=help',