From c32b07529cad460aff5a9c733623507b5225687c Mon Sep 17 00:00:00 2001 From: mambax7 Date: Wed, 13 Oct 2021 13:17:59 -0400 Subject: [PATCH 01/36] string required --- admin/admin_footer.php | 2 +- admin/admin_header.php | 4 ++-- config/icons.php | 2 +- include/common.php | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/admin/admin_footer.php b/admin/admin_footer.php index c86857f..86e4870 100644 --- a/admin/admin_footer.php +++ b/admin/admin_footer.php @@ -15,7 +15,7 @@ * @author XOOPS Development Team */ -$pathIcon32 = Xmf\Module\Admin::iconUrl('', 32); +$pathIcon32 = Xmf\Module\Admin::iconUrl('', '32'); echo "
\n" . "
\n" diff --git a/admin/admin_header.php b/admin/admin_header.php index 2781abd..3131534 100644 --- a/admin/admin_header.php +++ b/admin/admin_header.php @@ -48,8 +48,8 @@ $xoopsTpl = new \XoopsTpl(); } -$pathIcon16 = Admin::iconUrl('', 16); -$pathIcon32 = Admin::iconUrl('', 32); +$pathIcon16 = Admin::iconUrl('', '16'); +$pathIcon32 = Admin::iconUrl('', '32'); $pathModIcon32 = $helper->getModule()->getInfo('modicons32'); // Local icons path diff --git a/config/icons.php b/config/icons.php index cc6124d..92d718d 100644 --- a/config/icons.php +++ b/config/icons.php @@ -4,7 +4,7 @@ use Xmf\Module\Admin; -$pathIcon16 = Admin::iconUrl('', 16); +$pathIcon16 = Admin::iconUrl('', '16'); $moduleDirName = \basename(\dirname(__DIR__)); return[ diff --git a/include/common.php b/include/common.php index 0f944b1..9834073 100644 --- a/include/common.php +++ b/include/common.php @@ -124,8 +124,8 @@ /** @var Newbb\XmlrssHandler $xmlrssHandler */ $xmlrssHandler = $helper->getHandler('Xmlrss'); -$pathIcon16 = Admin::iconUrl('', 16); -$pathIcon32 = Admin::iconUrl('', 32); +$pathIcon16 = Admin::iconUrl('', '16'); +$pathIcon32 = Admin::iconUrl('', '32'); //$pathModIcon16 = $helper->getModule()->getInfo('modicons16'); //$pathModIcon32 = $helper->getModule()->getInfo('modicons32'); From c48d791372e35785b6998a8a4bd496ff8340cebb Mon Sep 17 00:00:00 2001 From: mambax7 Date: Wed, 13 Oct 2021 13:18:07 -0400 Subject: [PATCH 02/36] cosmetics --- README.md | 1 - language/english/help/disclaimer.tpl | 12 ++++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 7706e77..ab81e2e 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,6 @@ [![Scrutinizer Code Quality](https://img.shields.io/scrutinizer/g/mambax7/newbb.svg?style=flat)](https://scrutinizer-ci.com/g/mambax7/newbb5/?branch=master) [![Codacy Badge](https://api.codacy.com/project/badge/grade/2d27c0023ee54f0b9ba2b5d17a68b2a5)](https://www.codacy.com/app/mambax7/newbb5) [![Code Climate](https://img.shields.io/codeclimate/github/mambax7/newbb.svg?style=flat)](https://codeclimate.com/github/mambax7/newbb5) -[![SensioLabsInsight](https://insight.sensiolabs.com/projects/4be750c7-07e0-4317-93ba-9937c607a827/mini.png)](https://insight.sensiolabs.com/projects/4be750c7-07e0-4317-93ba-9937c607a827) [![Latest Pre-Release](https://img.shields.io/github/tag/XoopsModules25x/newbb.svg?style=flat)](https://github.com/XoopsModules25x/newbb/tags/) [![Latest Version](https://img.shields.io/github/release/XoopsModules25x/newbb.svg?style=flat)](https://github.com/XoopsModules25x/newbb/releases/) diff --git a/language/english/help/disclaimer.tpl b/language/english/help/disclaimer.tpl index b76282c..7e89ad0 100644 --- a/language/english/help/disclaimer.tpl +++ b/language/english/help/disclaimer.tpl @@ -3,7 +3,7 @@

DISCLAIMER


-

Software downloaded from the XOOPS web site is provided 'as is' without warranty +

Software downloaded from the XOOPS website is provided 'as is' without warranty of any kind, either express or implied, including, but not limited to, the implied warranties of fitness for a purpose, or the warranty of non-infringement. Without limiting the foregoing, XOOPS Projects team makes no warranty that:

@@ -15,21 +15,21 @@ accurate or reliable
  • the quality of the software will meet your expectations any errors in the - software obtained from XOOPS web site will be corrected. + software obtained from XOOPS website will be corrected.

  • -

    Software and its documentation made available on the XOOPS web site:

    +

    Software and its documentation made available on the XOOPS website:


    1. could include technical or other mistakes, inaccuracies or typographical errors. XOOPS may make changes to the software or documentation made available - on its web site. + on its website.
    2. may be out of date, and XOOPS makes no commitment to update such materials.
    3. XOOPS assumes no responsibility for errors or omissions in the software - or documentation available from its web site. + or documentation available from its website.


    In no event shall XOOPS team be liable to you or any third parties for @@ -43,6 +43,6 @@ and risk and with agreement that you will be solely responsible for any damage to your computer system or loss of data that results from such activities. No advice or information, whether oral or written, obtained by you from XOOPS or from XOOPS - web site shall create any warranty for the software

    + website shall create any warranty for the software

    From 0ef8478532c686467eb6b0cffb3ee0137ddf6a0e Mon Sep 17 00:00:00 2001 From: mambax7 Date: Fri, 26 Nov 2021 09:26:27 -0500 Subject: [PATCH 03/36] change to "initial" font weight --- templates/css/language/english/style.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/css/language/english/style.css b/templates/css/language/english/style.css index 17217c7..0ecf69f 100644 --- a/templates/css/language/english/style.css +++ b/templates/css/language/english/style.css @@ -373,7 +373,7 @@ span.forum_icon.forum_button { border-style: solid; border-radius: 5px; box-shadow: 0 1px 7px #080808; - font-weight: bold; + font-weight: initial; } span.forum_icon.forum_button:hover { From 193549ce22f7ae106708dd512e6d965ab6010266 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Fri, 26 Nov 2021 09:31:37 -0500 Subject: [PATCH 04/36] cosmetics --- .scrutinizer.yml | 2 ++ admin/admin_permissions.php | 10 +++++----- admin/menu.php | 2 +- class/Common/FilesManagement.php | 2 +- class/Common/ServerStats.php | 2 +- class/Common/SysUtility.php | 4 ++-- class/Common/TestdataButtons.php | 2 +- class/Common/VersionChecks.php | 20 ++++++++++---------- class/ForumHandler.php | 2 +- class/PermissionForumHandler.php | 4 ++-- class/Plugin/userlog.php | 2 +- class/Post.php | 2 +- class/PostHandler.php | 4 ++-- class/Uploader.php | 4 ++-- class/Xmlrss.php | 2 +- config/config.php | 2 +- config/imageconfig.php | 2 +- config/paths.php | 4 ++-- docs/changelog.txt | 8 +++++++- footer.php | 2 +- include/config.php | 2 +- include/functions.time.php | 2 +- include/onuninstall.php | 2 +- include/onupdate.php | 2 +- language/english/common.php | 2 +- search.php | 4 ++-- testdata/index.php | 10 +++++----- viewtopic.php | 6 +++--- votepolls.php | 14 +++++++------- xoops_version.php | 4 ++-- 30 files changed, 69 insertions(+), 61 deletions(-) diff --git a/.scrutinizer.yml b/.scrutinizer.yml index 22ad269..265627b 100644 --- a/.scrutinizer.yml +++ b/.scrutinizer.yml @@ -1,5 +1,7 @@ # language: php build: + environment: + php: 8.0.11 nodes: tests: true analysis: diff --git a/admin/admin_permissions.php b/admin/admin_permissions.php index c9ec66b..5b4e342 100644 --- a/admin/admin_permissions.php +++ b/admin/admin_permissions.php @@ -51,7 +51,7 @@ */ //$action = isset($_REQUEST['action']) ? strtolower($_REQUEST['action']) : ""; -$action = mb_strtolower(Request::getCmd('action', '')); +$action = \mb_strtolower(Request::getCmd('action', '')); $module_id = $xoopsModule->getVar('mid'); $permissionHandler = Helper::getInstance()->getHandler('Permission'); $perms = $permissionHandler->getValidForumPerms(); @@ -94,7 +94,7 @@ $checked = in_array('forum_' . $perm, $selected) ? ' checked' : ''; $option_id = $perm . '_' . $i; $option_ids[] = $option_id; - $ret_ele .= '' . constant('_AM_NEWBB_CAN_' . mb_strtoupper($perm)) . '
    '; + $ret_ele .= '' . constant('_AM_NEWBB_CAN_' . \mb_strtoupper($perm)) . '
    '; } $ret_ele .= ''; $ret_ele .= _ALL . ' '; @@ -235,9 +235,9 @@ ], ]; foreach ($perms as $perm) { - $op_options[$perm] = constant('_AM_NEWBB_CAN_' . mb_strtoupper($perm)); + $op_options[$perm] = constant('_AM_NEWBB_CAN_' . \mb_strtoupper($perm)); $fm_options[$perm] = [ - 'title' => constant('_AM_NEWBB_CAN_' . mb_strtoupper($perm)), + 'title' => constant('_AM_NEWBB_CAN_' . \mb_strtoupper($perm)), 'item' => 'forum_' . $perm, 'desc' => '', 'anonymous' => true, @@ -245,7 +245,7 @@ } $op_keys = array_keys($op_options); - $op = mb_strtolower(Request::getCmd('op', Request::getCmd('op', '', 'COOKIE'), 'GET')); + $op = \mb_strtolower(Request::getCmd('op', Request::getCmd('op', '', 'COOKIE'), 'GET')); if (empty($op)) { $op = $op_keys[0]; setcookie('op', $op_keys[1] ?? ''); diff --git a/admin/menu.php b/admin/menu.php index b3e8472..3fd0050 100644 --- a/admin/menu.php +++ b/admin/menu.php @@ -21,7 +21,7 @@ }; $moduleDirName = \basename(\dirname(__DIR__)); -$moduleDirNameUpper = mb_strtoupper($moduleDirName); +$moduleDirNameUpper = \mb_strtoupper($moduleDirName); $helper = Helper::getInstance(); $helper->loadLanguage('common'); diff --git a/class/Common/FilesManagement.php b/class/Common/FilesManagement.php index 2cf6c2b..5ae6fdd 100644 --- a/class/Common/FilesManagement.php +++ b/class/Common/FilesManagement.php @@ -48,7 +48,7 @@ public static function createFolder($folder) * @param $folder * @return bool */ - public static function copyFile($file, $folder) + public static function copyFile(string $file, string $folder): bool { return \copy($file, $folder); } diff --git a/class/Common/ServerStats.php b/class/Common/ServerStats.php index 5ffe503..ed6fc45 100644 --- a/class/Common/ServerStats.php +++ b/class/Common/ServerStats.php @@ -28,7 +28,7 @@ public static function getServerStats() { //mb $wfdownloads = WfdownloadsWfdownloads::getInstance(); $moduleDirName = \basename(\dirname(__DIR__, 2)); - $moduleDirNameUpper = mb_strtoupper($moduleDirName); + $moduleDirNameUpper = \mb_strtoupper($moduleDirName); \xoops_loadLanguage('common', $moduleDirName); $html = ''; // $sql = 'SELECT metavalue'; diff --git a/class/Common/SysUtility.php b/class/Common/SysUtility.php index 90b365f..98e19e1 100644 --- a/class/Common/SysUtility.php +++ b/class/Common/SysUtility.php @@ -86,7 +86,7 @@ public static function truncateHtml($text, $length = 100, $ending = '...', $exac // if tag is an opening tag } elseif (\preg_match('/^<\s*([^\s>!]+).*?' . '>$/s', $line_matchings[1], $tag_matchings)) { // add tag to the beginning of $open_tags list - \array_unshift($open_tags, mb_strtolower($tag_matchings[1])); + \array_unshift($open_tags, \mb_strtolower($tag_matchings[1])); } // add html-tag to $truncate'd text $truncate .= $line_matchings[1]; @@ -194,7 +194,7 @@ public static function getEditor($helper = null, $options = null) * * @return bool */ - public static function fieldExists($fieldname, $table) + public static function fieldExists(string $fieldname, string $table): bool { global $xoopsDB; $result = $xoopsDB->queryF("SHOW COLUMNS FROM $table LIKE '$fieldname'"); diff --git a/class/Common/TestdataButtons.php b/class/Common/TestdataButtons.php index 11544e5..cf05c26 100644 --- a/class/Common/TestdataButtons.php +++ b/class/Common/TestdataButtons.php @@ -36,7 +36,7 @@ class TestdataButtons public static function loadButtonConfig($adminObject) { $moduleDirName = \basename(\dirname(__DIR__, 2)); - $moduleDirNameUpper = mb_strtoupper($moduleDirName); + $moduleDirNameUpper = \mb_strtoupper($moduleDirName); $yamlFile = \dirname(__DIR__, 2) . '/config/admin.yml'; $config = Yaml::readWrapped($yamlFile); // work with phpmyadmin YAML dumps $displaySampleButton = $config['displaySampleButton']; diff --git a/class/Common/VersionChecks.php b/class/Common/VersionChecks.php index e1f89ef..2f59369 100644 --- a/class/Common/VersionChecks.php +++ b/class/Common/VersionChecks.php @@ -30,7 +30,7 @@ trait VersionChecks public static function checkVerXoops(\XoopsModule $module = null, $requiredVer = null) { $moduleDirName = \basename(\dirname(__DIR__, 2)); - $moduleDirNameUpper = mb_strtoupper($moduleDirName); + $moduleDirNameUpper = \mb_strtoupper($moduleDirName); if (null === $module) { $module = \XoopsModule::getByDirname($moduleDirName); } @@ -62,7 +62,7 @@ public static function checkVerXoops(\XoopsModule $module = null, $requiredVer = public static function checkVerPhp(\XoopsModule $module = null) { $moduleDirName = \basename(\dirname(__DIR__, 2)); - $moduleDirNameUpper = mb_strtoupper($moduleDirName); + $moduleDirNameUpper = \mb_strtoupper($moduleDirName); if (null === $module) { $module = \XoopsModule::getByDirname($moduleDirName); } @@ -87,7 +87,7 @@ public static function checkVerPhp(\XoopsModule $module = null) /** * - * compares current module version with latest GitHub release + * compares current module version with the latest GitHub release * @static * @param \Xmf\Module\Helper $helper * @param string|null $source @@ -96,14 +96,14 @@ public static function checkVerPhp(\XoopsModule $module = null) * @return string|array info about the latest module version, if newer */ - public static function checkVerModule($helper, $source = 'github', $default = 'master') + public static function checkVerModule(\Xmf\Module\Helper $helper, ?string $source = 'github', ?string $default = 'master'): ?array { $moduleDirName = \basename(\dirname(__DIR__, 2)); - $moduleDirNameUpper = mb_strtoupper($moduleDirName); + $moduleDirNameUpper = \mb_strtoupper($moduleDirName); $update = ''; $repository = 'XoopsModules25x/' . $moduleDirName; // $repository = 'XoopsModules25x/publisher'; //for testing only - $ret = ''; + $ret = null; $infoReleasesUrl = "https://api.github.com/repos/$repository/releases"; if ('github' === $source) { if (\function_exists('curl_init') && false !== ($curlHandle = \curl_init())) { @@ -125,14 +125,14 @@ public static function checkVerModule($helper, $source = 'github', $default = 'm $update = \constant('CO_' . $moduleDirNameUpper . '_' . 'NEW_VERSION') . $latestVersion; } //"PHP-standardized" version - $latestVersion = mb_strtolower($latestVersion); + $latestVersion = \mb_strtolower($latestVersion); if (false !== mb_strpos($latestVersion, 'final')) { - $latestVersion = \str_replace('_', '', mb_strtolower($latestVersion)); - $latestVersion = \str_replace('final', '', mb_strtolower($latestVersion)); + $latestVersion = \str_replace('_', '', \mb_strtolower($latestVersion)); + $latestVersion = \str_replace('final', '', \mb_strtolower($latestVersion)); } $moduleVersion = ($helper->getModule()->getInfo('version') . '_' . $helper->getModule()->getInfo('module_status')); //"PHP-standardized" version - $moduleVersion = \str_replace(' ', '', mb_strtolower($moduleVersion)); + $moduleVersion = \str_replace(' ', '', \mb_strtolower($moduleVersion)); // $moduleVersion = '1.0'; //for testing only // $moduleDirName = 'publisher'; //for testing only if (!$prerelease && \version_compare($moduleVersion, $latestVersion, '<')) { diff --git a/class/ForumHandler.php b/class/ForumHandler.php index aa41cde..899a74d 100644 --- a/class/ForumHandler.php +++ b/class/ForumHandler.php @@ -620,7 +620,7 @@ public function getPermission($forum, $type = 'access', $checkCategory = true) } } - $type = mb_strtolower($type); + $type = \mb_strtolower($type); // START irmtfan commented and removed //if ('moderate' === $type) { //require_once $GLOBALS['xoops']->path('modules/newbb/include/functions.user.php'); diff --git a/class/PermissionForumHandler.php b/class/PermissionForumHandler.php index d7f2989..e8ff7a0 100644 --- a/class/PermissionForumHandler.php +++ b/class/PermissionForumHandler.php @@ -188,9 +188,9 @@ public function getPermissionTable($forum = 0, $topic_locked = false, $isAdmin = || (isset($permission_set[$forumId]['forum_' . $item]) && (!$topic_locked || 'view' === $item))) { - $perm[] = \constant('_MD_NEWBB_CAN_' . mb_strtoupper($item)); + $perm[] = \constant('_MD_NEWBB_CAN_' . \mb_strtoupper($item)); } else { - $perm[] = \constant('_MD_NEWBB_CANNOT_' . mb_strtoupper($item)); + $perm[] = \constant('_MD_NEWBB_CANNOT_' . \mb_strtoupper($item)); } } diff --git a/class/Plugin/userlog.php b/class/Plugin/userlog.php index 8708b99..85adb76 100644 --- a/class/Plugin/userlog.php +++ b/class/Plugin/userlog.php @@ -69,7 +69,7 @@ public function item($subscribe_from) case 'viewtopic.php': /** @var Newbb\TopicHandler $topicHandler */ $topicHandler = Helper::getInstance()->getHandler('Topic'); $post_id = Request::getInt('post_id', 0); // !empty($_REQUEST["post_id"]) ? (int)($_REQUEST["post_id"]) : 0; - $move = mb_strtolower(Request::getString('move', '', 'GET')); // isset($_GET['move'])? strtolower($_GET['move']) : ''; + $move = \mb_strtolower(Request::getString('move', '', 'GET')); // isset($_GET['move'])? strtolower($_GET['move']) : ''; $topic_id = Request::getInt('topic_id', 0); // !empty($_REQUEST["topic_id"]) ? (int)($_REQUEST["topic_id"]) : 0; if (!empty($post_id)) { $topicObject = $topicHandler->getByPost($post_id); diff --git a/class/Post.php b/class/Post.php index f5475cd..6d2012b 100644 --- a/class/Post.php +++ b/class/Post.php @@ -496,7 +496,7 @@ public function showPost($isAdmin) $uid = \is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getVar('uid') : 0; ++$post_NO; - if ('desc' === mb_strtolower($order)) { + if ('desc' === \mb_strtolower($order)) { $post_no = $total_posts - ($start + $post_NO) + 1; } else { $post_no = $start + $post_NO; diff --git a/class/PostHandler.php b/class/PostHandler.php index 8ea2ed4..2254f5e 100644 --- a/class/PostHandler.php +++ b/class/PostHandler.php @@ -469,7 +469,7 @@ public function getPostCount($criteria = null, $join = null) // LEFT JOIN $sql .= $join; // WHERE - if (\is_object($criteria) && \is_subclass_of($criteria, \CriteriaElement::class)) { + if (($criteria instanceof \CriteriaCompo) || ($criteria instanceof \Criteria)) { $sql .= ' ' . $criteria->renderWhere(); } if (!$result = $this->db->query($sql)) { @@ -501,7 +501,7 @@ public function getPostsByLimit($criteria = null, $limit = 1, $start = 0, $join if (!empty($join)) { $sql .= $join; } - if (\is_object($criteria) && \is_subclass_of($criteria, \CriteriaElement::class)) { + if (($criteria instanceof \CriteriaCompo) || ($criteria instanceof \Criteria)) { $sql .= ' ' . $criteria->renderWhere(); if ('' !== $criteria->getSort()) { $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder(); diff --git a/class/Uploader.php b/class/Uploader.php index 3c6ad88..80d08ad 100644 --- a/class/Uploader.php +++ b/class/Uploader.php @@ -45,7 +45,7 @@ public function __construct($uploadDir, $allowedMimeTypes = 0, $maxFileSize = 0, if (empty($allowedMimeTypes) || '*' === $allowedMimeTypes) { $allowedMimeTypes = []; } else { - $allowedMimeTypes = \array_filter(\array_map('\trim', \explode('|', mb_strtolower($allowedMimeTypes)))); + $allowedMimeTypes = \array_filter(\array_map('\trim', \explode('|', \mb_strtolower($allowedMimeTypes)))); } } $_allowedMimeTypes = []; @@ -97,7 +97,7 @@ public function setFileSizeCheck($value) */ public function getExt() { - $this->ext = mb_strtolower(\ltrim(mb_strrchr($this->getMediaName(), '.'), '.')); + $this->ext = \mb_strtolower(\ltrim(mb_strrchr($this->getMediaName(), '.'), '.')); return $this->ext; } diff --git a/class/Xmlrss.php b/class/Xmlrss.php index e65ec84..fd237df 100644 --- a/class/Xmlrss.php +++ b/class/Xmlrss.php @@ -108,7 +108,7 @@ public function addItem($title, $link, $description = '', $label = '', $pubdate */ public function cleanup($text, $trim = 0) { - if ('utf-8' === mb_strtolower($this->xml_encoding) && \strncasecmp(_CHARSET, $this->xml_encoding, 5)) { + if ('utf-8' === \mb_strtolower($this->xml_encoding) && \strncasecmp(_CHARSET, $this->xml_encoding, 5)) { $text = \XoopsLocal::convert_encoding($text, 'utf-8'); } if (!empty($trim)) { diff --git a/config/config.php b/config/config.php index f99f525..2c65c42 100644 --- a/config/config.php +++ b/config/config.php @@ -18,7 +18,7 @@ use Xmf\Module\Admin; $moduleDirName = \basename(\dirname(__DIR__)); -$moduleDirNameUpper = mb_strtoupper($moduleDirName); +$moduleDirNameUpper = \mb_strtoupper($moduleDirName); return (object)[ 'name' => $moduleDirNameUpper . ' Module Configurator', diff --git a/config/imageconfig.php b/config/imageconfig.php index 80891ce..b418130 100644 --- a/config/imageconfig.php +++ b/config/imageconfig.php @@ -1,7 +1,7 @@ mb_strtoupper($moduleDirName) . ' PathConfigurator', + 'name' => \mb_strtoupper($moduleDirName) . ' PathConfigurator', 'dirname' => $moduleDirName, 'admin' => XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/admin', 'modPath' => XOOPS_ROOT_PATH . '/modules/' . $moduleDirName, diff --git a/docs/changelog.txt b/docs/changelog.txt index 8e853b9..2523f74 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -1,10 +1,16 @@ -
    5.01 Beta 5 [NOT RELEASED]
    Dev: XOOPS 2.5.11, PHP 7.4.22, PHP 8.0.8 +
    5.01 Beta 5 [NOT RELEASED]
    Dev: XOOPS 2.5.11, PHP 7.4.26, PHP 8.0.13, PHP 8.1.0
    - removed NEWBB_ADMIN_DEFINED from admin.php (JJDai) - fixed "Parameter must be an array or an object that implements Countable" (cesagonchu/mamba) - changed _MD_NEWBB_NEWBB_TYPE to _MD_NEWBB_TYPE (alain01/mamba) - remove Google Plus icon (cesagonchu/mamba) - fix Undefined variable: postParentObject in form.post.php #77 (cesagonchu/mamba) +- semantic versioning (mamba) +- changed font-weight to "initial" (heyula/mamba) +- cosmetics and PHP 8 adjustments (mamba) + + +
    5.01 Beta 4 [2021-03-21]
    Dev: XOOPS 2.5.11, PHP 7.4.16, PHP 8.0.3
    diff --git a/footer.php b/footer.php index 8938544..b05e123 100644 --- a/footer.php +++ b/footer.php @@ -34,7 +34,7 @@ xoops_load('XoopsLists'); $allfiles = \XoopsLists::getFileListAsArray($GLOBALS['xoops']->path($js_rel_path)); foreach ($allfiles as $jsfile) { - if ('js' === mb_strtolower(pathinfo($jsfile, PATHINFO_EXTENSION))) { + if ('js' === \mb_strtolower(pathinfo($jsfile, PATHINFO_EXTENSION))) { $xoTheme->addScript($js_rel_path . '/' . $jsfile); } } diff --git a/include/config.php b/include/config.php index 0113856..c519db5 100644 --- a/include/config.php +++ b/include/config.php @@ -29,7 +29,7 @@ */ $moduleDirName = \basename(\dirname(__DIR__)); -$moduleDirNameUpper = mb_strtoupper($moduleDirName); +$moduleDirNameUpper = \mb_strtoupper($moduleDirName); return (object)[ 'name' => $moduleDirNameUpper . ' Module Configurator', diff --git a/include/functions.time.php b/include/functions.time.php index 2aed10c..ab3da74 100644 --- a/include/functions.time.php +++ b/include/functions.time.php @@ -27,7 +27,7 @@ function newbbFormatTimestamp($time, $format = 'c', $timeoffset = '') xoops_loadLanguage('locale'); $newbbConfig = newbbLoadConfig(); - $format = mb_strtolower($format); + $format = \mb_strtolower($format); if ('reg' === $format || '' === $format) { $format = 'c'; } diff --git a/include/onuninstall.php b/include/onuninstall.php index ea83a5a..2964eba 100644 --- a/include/onuninstall.php +++ b/include/onuninstall.php @@ -39,7 +39,7 @@ function xoops_module_uninstall_newbb(\XoopsModule $module) // return true; $moduleDirName = \basename(\dirname(__DIR__)); - $moduleDirNameUpper = mb_strtoupper($moduleDirName); + $moduleDirNameUpper = \mb_strtoupper($moduleDirName); $helper = Helper::getInstance(); $utility = new Utility(); diff --git a/include/onupdate.php b/include/onupdate.php index 884650c..416743f 100644 --- a/include/onupdate.php +++ b/include/onupdate.php @@ -58,7 +58,7 @@ function xoops_module_pre_update_newbb(\XoopsModule $module) function xoops_module_update_newbb(\XoopsModule $module, $previousVersion = null) { $moduleDirName = \basename(\dirname(__DIR__)); - $moduleDirNameUpper = mb_strtoupper($moduleDirName); + $moduleDirNameUpper = \mb_strtoupper($moduleDirName); /** @var \XoopsModules\Newbb\Helper $helper */ /** @var \XoopsModules\Newbb\Utility $utility */ /** @var \XoopsModules\Newbb\Common\Configurator $configurator */ diff --git a/language/english/common.php b/language/english/common.php index c60bc5c..6f3029f 100644 --- a/language/english/common.php +++ b/language/english/common.php @@ -15,7 +15,7 @@ * @author Xoops Development Team */ $moduleDirName = \basename(\dirname(__DIR__, 2)); -$moduleDirNameUpper = mb_strtoupper($moduleDirName); +$moduleDirNameUpper = \mb_strtoupper($moduleDirName); \define('CO_' . $moduleDirNameUpper . '_GDLIBSTATUS', 'GD library support: '); \define('CO_' . $moduleDirNameUpper . '_GDLIBVERSION', 'GD Library version: '); diff --git a/search.php b/search.php index d69bdbb..87b7171 100644 --- a/search.php +++ b/search.php @@ -96,7 +96,7 @@ $addterms = Request::getString('andor', 'AND'); $next_search['andor'] = $addterms; - $andor = mb_strtoupper($addterms); + $andor = \mb_strtoupper($addterms); if (!in_array($addterms, ['OR', 'AND'])) { $andor = 'AND'; } @@ -237,7 +237,7 @@ // irmtfan if all results skipped then redirect to the next/previous page if ($num_results == $skipresults) { $direction = Request::getString('direction', 'next'); - $search_url_redirect = ('next' === mb_strtolower($direction)) ? $search_url_next : $search_url_prev; + $search_url_redirect = ('next' === \mb_strtolower($direction)) ? $search_url_next : $search_url_prev; redirect_header($search_url_redirect, 1, constant(mb_strtoupper("_SR_{$direction}"))); } } diff --git a/testdata/index.php b/testdata/index.php index 8159391..86d5c4e 100644 --- a/testdata/index.php +++ b/testdata/index.php @@ -31,7 +31,7 @@ $op = Request::getCmd('op', ''); $moduleDirName = \basename(\dirname(__DIR__)); -$moduleDirNameUpper = mb_strtoupper($moduleDirName); +$moduleDirNameUpper = \mb_strtoupper($moduleDirName); $helper = Helper::getInstance(); // Load language files @@ -64,7 +64,7 @@ function loadSampleData() { global $xoopsConfig; $moduleDirName = \basename(\dirname(__DIR__)); - $moduleDirNameUpper = mb_strtoupper($moduleDirName); + $moduleDirNameUpper = \mb_strtoupper($moduleDirName); $utility = new Utility(); $configurator = new Configurator(); @@ -105,7 +105,7 @@ function saveSampleData() { global $xoopsConfig; $moduleDirName = \basename(\dirname(__DIR__)); - $moduleDirNameUpper = mb_strtoupper($moduleDirName); + $moduleDirNameUpper = \mb_strtoupper($moduleDirName); $helper = Helper::getInstance(); $tables = $helper->getModule()->getInfo('tables'); @@ -134,7 +134,7 @@ function saveSampleData() function exportSchema() { $moduleDirName = \basename(\dirname(__DIR__)); - $moduleDirNameUpper = mb_strtoupper($moduleDirName); + $moduleDirNameUpper = \mb_strtoupper($moduleDirName); try { // TODO set exportSchema @@ -204,7 +204,7 @@ function loadTableFromArrayWithReplace($table, $data, $search, $replace) function clearSampleData(){ $moduleDirName = \basename(\dirname(__DIR__)); - $moduleDirNameUpper = mb_strtoupper($moduleDirName); + $moduleDirNameUpper = \mb_strtoupper($moduleDirName); $helper = Helper::getInstance(); // Load language files $helper->loadLanguage('common'); diff --git a/viewtopic.php b/viewtopic.php index e0c58ad..0bbe3dc 100644 --- a/viewtopic.php +++ b/viewtopic.php @@ -65,7 +65,7 @@ && 'new' === Request::getString('read', '', 'GET')) ? Request::getString('read', '', 'GET') : ''; $topic_id = Request::getInt('topic_id', 0, 'GET'); // isset($_GET['topic_id']) ? (int)($_GET['topic_id']) : 0; $post_id = Request::getInt('post_id', 0, 'GET'); // !empty($_GET['post_id']) ? (int)($_GET['post_id']) : 0; -$move = mb_strtolower(Request::getString('move', '', 'GET')); // isset($_GET['move']) ? strtolower($_GET['move']) : ''; +$move = \mb_strtolower(Request::getString('move', '', 'GET')); // isset($_GET['move']) ? strtolower($_GET['move']) : ''; $start = Request::getInt('start', 0, 'GET'); // !empty($_GET['start']) ? (int)($_GET['start']) : 0; $status = (Request::getString('status', '', 'GET') && in_array(Request::getString('status', '', 'GET'), ['active', 'pending', 'deleted'])) ? Request::getString('status', '', 'GET') : ''; @@ -541,8 +541,8 @@ 'is_visible' => $isVisible, 'visible_message' => $visibleMsg, 'disp_votes' => $xp_config['disp_vote_nums'], - 'lang_vote' => constant('_MD_' . mb_strtoupper($GLOBALS['xoopsModuleConfig']['poll_module']) . '_VOTE'), - 'lang_results' => constant('_MD_' . mb_strtoupper($GLOBALS['xoopsModuleConfig']['poll_module']) . '_RESULTS'), + 'lang_vote' => constant('_MD_' . \mb_strtoupper($GLOBALS['xoopsModuleConfig']['poll_module']) . '_VOTE'), + 'lang_results' => constant('_MD_' . \mb_strtoupper($GLOBALS['xoopsModuleConfig']['poll_module']) . '_RESULTS'), 'back_link' => '', ] ); diff --git a/votepolls.php b/votepolls.php index c958e7a..9f17bcf 100644 --- a/votepolls.php +++ b/votepolls.php @@ -70,9 +70,9 @@ } if ($pollObject->hasExpired()) { /* poll has expired so just show the results */ - $msg = constant('_MD_' . mb_strtoupper($GLOBALS['xoopsModuleConfig']['poll_module']) . 'SORRYEXPIRED'); + $msg = constant('_MD_' . \mb_strtoupper($GLOBALS['xoopsModuleConfig']['poll_module']) . 'SORRYEXPIRED'); } else { - $msg = constant('_MD_' . mb_strtoupper($GLOBALS['xoopsModuleConfig']['poll_module']) . '_MUSTLOGIN'); + $msg = constant('_MD_' . \mb_strtoupper($GLOBALS['xoopsModuleConfig']['poll_module']) . '_MUSTLOGIN'); //@todo:: add $url to all redirects // $url = $GLOBALS['xoops']->buildUrl("index.php", array('poll_id' => $poll_id)); if ($pollObject->isAllowedToVote()) { @@ -86,13 +86,13 @@ echo $pollObject->getHtmlErrors(); exit(); } - $msg = constant('_MD_' . mb_strtoupper($GLOBALS['xoopsModuleConfig']['poll_module']) . '_THANKSFORVOTE'); + $msg = constant('_MD_' . \mb_strtoupper($GLOBALS['xoopsModuleConfig']['poll_module']) . '_THANKSFORVOTE'); } else { /* there was a problem registering the vote */ - redirect_header($GLOBALS['xoops']->buildUrl('index.php', ['poll_id' => $poll_id]), Constants::REDIRECT_DELAY_MEDIUM, constant('_MD_' . mb_strtoupper($GLOBALS['xoopsModuleConfig']['poll_module']) . '_VOTE_ERROR')); + redirect_header($GLOBALS['xoops']->buildUrl('index.php', ['poll_id' => $poll_id]), Constants::REDIRECT_DELAY_MEDIUM, constant('_MD_' . \mb_strtoupper($GLOBALS['xoopsModuleConfig']['poll_module']) . '_VOTE_ERROR')); } } else { - $msg = constant('_MD_' . mb_strtoupper($GLOBALS['xoopsModuleConfig']['poll_module']) . '_ALREADYVOTED'); + $msg = constant('_MD_' . \mb_strtoupper($GLOBALS['xoopsModuleConfig']['poll_module']) . '_ALREADYVOTED'); } /* set anon user vote (and the time they voted) */ if (!is_object($GLOBALS['xoopsUser'])) { @@ -101,11 +101,11 @@ $classPollUtility::setVoteCookie($poll_id, $voteTime, 0); } } else { - $msg = constant('_MD_' . mb_strtoupper($GLOBALS['xoopsModuleConfig']['poll_module']) . '_CANNOTVOTE'); + $msg = constant('_MD_' . \mb_strtoupper($GLOBALS['xoopsModuleConfig']['poll_module']) . '_CANNOTVOTE'); } } } else { - $msg = constant('_MD_' . mb_strtoupper($GLOBALS['xoopsModuleConfig']['poll_module']) . '_ERROR_INVALID_POLLID'); + $msg = constant('_MD_' . \mb_strtoupper($GLOBALS['xoopsModuleConfig']['poll_module']) . '_ERROR_INVALID_POLLID'); } if (null !== $url) { redirect_header($url, Constants::REDIRECT_DELAY_MEDIUM, $msg); diff --git a/xoops_version.php b/xoops_version.php index a949d72..0f101b4 100644 --- a/xoops_version.php +++ b/xoops_version.php @@ -12,10 +12,10 @@ require_once __DIR__ . '/preloads/autoloader.php'; $moduleDirName = basename(__DIR__); -$moduleDirNameUpper = mb_strtoupper($moduleDirName); +$moduleDirNameUpper = \mb_strtoupper($moduleDirName); $modversion = [ - 'version' => 5.01, + 'version' => '5.01.0', 'module_status' => 'Beta 5 NOT RELEASED', 'release_date' => '2021/08/09', 'name' => _MI_NEWBB_NAME, From 03780fce21d55700613f1745db8b0e8f560b3dd6 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Tue, 8 Mar 2022 04:23:24 -0500 Subject: [PATCH 05/36] updates --- .scrutinizer.yml | 3 - EXTRA/index.php | 2 +- EXTRA/themes/index.php | 2 +- .../blocks/index.php | 2 +- .../templates_fulldiv_opacity/css/index.php | 2 +- .../css/language/english/index.php | 2 +- .../css/language/index.php | 2 +- .../css/language/persian/index.php | 2 +- .../images/icon/index.php | 2 +- .../images/index.php | 2 +- .../images/language/english/index.php | 2 +- .../images/language/index.php | 2 +- .../images/language/persian/index.php | 2 +- .../images/mime/index.php | 2 +- .../images/rpg/index.php | 2 +- .../templates_fulldiv_opacity/index.php | 2 +- .../templates_fulldiv_opacity/js/index.php | 2 +- .../js/language/english/index.php | 2 +- .../js/language/index.php | 2 +- .../templates_fulldiv_opacity/newbb_rss.tpl | 2 +- .../newbb_thread.tpl | 2 +- EXTRA/themes/xbootstrap/index.php | 2 +- EXTRA/themes/xbootstrap/modules/index.php | 2 +- .../themes/xbootstrap/modules/newbb/index.php | 2 +- .../modules/newbb/newbb_edit_post.tpl | 4 +- .../xbootstrap/modules/newbb/newbb_thread.tpl | 2 +- .../xoopsorg/modules/newbb/blocks/index.php | 2 +- .../xoopsorg/modules/newbb/css/index.php | 2 +- .../newbb/css/language/english/index.php | 2 +- .../modules/newbb/css/language/index.php | 2 +- .../newbb/css/language/persian/index.php | 2 +- .../xoopsorg/modules/newbb/css0__/index.php | 2 +- .../newbb/css0__/language/english/index.php | 2 +- .../modules/newbb/css0__/language/index.php | 2 +- .../newbb/css0__/language/persian/index.php | 2 +- EXTRA/themes/xoopsorg/modules/newbb/index.php | 2 +- README.md | 2 +- action.post.php | 17 ++- action.topic.php | 11 +- admin/about.php | 7 +- admin/admin_cat_manager.php | 11 +- admin/admin_digest.php | 6 +- admin/admin_footer.php | 7 +- admin/admin_forum_manager.php | 11 +- admin/admin_forum_prune.php | 10 +- admin/admin_forum_reorder.php | 10 +- admin/admin_groupmod.php | 10 +- admin/admin_header.php | 6 +- admin/admin_permissions.php | 13 +-- admin/admin_report.php | 6 +- admin/admin_synchronization.php | 15 ++- admin/admin_type_manager.php | 8 +- admin/admin_votedata.php | 12 +- admin/index.php | 42 ++++--- admin/menu.php | 13 +-- admin/migrate.php | 58 +++++----- assets/css/index.php | 2 +- assets/images/category/index.php | 2 +- assets/images/filetypes/index.php | 2 +- assets/images/icons/index.php | 2 +- assets/images/index.php | 2 +- assets/images/menu/index.php | 2 +- assets/index.php | 2 +- assets/js/index.php | 2 +- blocks/index.php | 2 +- blocks/list_topic.php | 11 +- blocks/newbb_block.php | 11 +- blocks/newbb_block_tag.php | 6 +- class/Category.php | 5 +- class/CategoryHandler.php | 9 +- class/Common/Breadcrumb.php | 11 +- class/Common/Configurator.php | 6 +- class/Common/FilesManagement.php | 14 +-- class/Common/Migrate.php | 16 +-- class/Common/ServerStats.php | 6 +- class/Common/SysUtility.php | 16 +-- class/Common/TestdataButtons.php | 51 +++++--- class/Common/VersionChecks.php | 11 +- class/Common/index.php | 2 +- class/Constants.php | 6 +- class/Digest.php | 11 +- class/DigestHandler.php | 12 +- class/Forum.php | 5 +- class/ForumHandler.php | 109 +++++++++--------- class/GroupFormCheckBox.php | 6 +- class/GroupPermForm.php | 3 +- class/Helper.php | 8 +- class/IconHandler.php | 25 ++-- class/IpCheck.php | 4 +- class/KarmaHandler.php | 11 +- class/Moderate.php | 8 +- class/ModerateHandler.php | 7 +- class/ObjectTree.php | 17 ++- class/OnlineHandler.php | 22 ++-- class/PermissionCategoryHandler.php | 6 +- class/PermissionForumHandler.php | 5 +- class/PermissionHandler.php | 20 ++-- class/Plugin/index.php | 2 +- class/Plugin/userlog.php | 12 +- class/Post.php | 34 +++--- class/PostHandler.php | 28 ++--- class/Rate.php | 2 +- class/RateHandler.php | 4 +- class/Read.php | 5 +- class/ReadHandler.php | 7 +- class/Readforum.php | 5 +- class/ReadforumHandler.php | 11 +- class/Readtopic.php | 5 +- class/ReadtopicHandler.php | 10 +- class/Report.php | 6 +- class/ReportHandler.php | 9 +- class/StatsHandler.php | 10 +- class/Text.php | 6 +- class/TextHandler.php | 6 +- class/Topic.php | 12 +- class/TopicHandler.php | 24 ++-- class/TopicRenderer.php | 40 +++---- class/Tree.php | 18 ++- class/Type.php | 6 +- class/TypeHandler.php | 7 +- class/Uploader.php | 12 +- class/User.php | 12 +- class/UserHandler.php | 11 +- class/Userstats.php | 6 +- class/UserstatsHandler.php | 6 +- class/Utility.php | 5 +- class/Xmlrss.php | 8 +- class/XmlrssHandler.php | 5 +- class/index.php | 2 +- class/plugins/index.php | 2 +- class/plugins/plugin.tag.php | 10 +- class/xoopsformloader.php | 3 +- config/config.php | 13 +-- config/icons.php | 8 +- config/imageconfig.php | 2 +- config/index.php | 2 +- config/paths.php | 8 +- delete.php | 11 +- digest.php | 6 +- dl_attachment.php | 7 +- docs/changelog.txt | 2 - docs/index.php | 2 +- edit.php | 12 +- footer.php | 8 +- header.php | 16 +-- include/common.php | 11 +- include/config.php | 11 +- include/display.php | 5 +- include/form.forum.php | 10 +- include/form.post.php | 15 ++- include/functions.config.php | 10 +- include/functions.forum.php | 17 ++- include/functions.image.php | 42 +++---- include/functions.ini.php | 2 +- include/functions.language.php | 6 +- include/functions.php | 6 +- include/functions.read.php | 7 +- include/functions.recon.php | 10 +- include/functions.render.php | 22 ++-- include/functions.rpc.php | 8 +- include/functions.session.php | 10 +- include/functions.stats.php | 7 +- include/functions.text.php | 22 ++-- include/functions.time.php | 6 +- include/functions.topic.php | 6 +- include/functions.user.php | 33 +++--- include/functions.welcome.inc.php | 14 +-- include/functions.welcome.php | 12 +- include/images.php | 5 +- include/index.php | 2 +- include/module.php | 4 +- include/module.v100.php | 4 +- include/module.v220.php | 4 +- include/module.v400.php | 22 ++-- include/notification.inc.php | 2 +- include/oninstall.php | 6 +- include/onuninstall.php | 33 +++--- include/onupdate.php | 17 +-- include/plugin.dist.php | 5 +- include/plugin.php | 5 +- include/search.inc.php | 6 +- include/sitemap.plugin.php | 4 +- include/vars.php | 6 +- index.php | 27 +++-- language/english/admin.php | 2 +- language/english/blocks.php | 2 +- language/english/common.php | 10 +- language/english/help/index.php | 2 +- language/english/index.php | 2 +- language/english/mail_template/index.php | 2 +- language/english/main.php | 6 +- language/english/modinfo.php | 4 +- language/index.php | 2 +- list.tag.php | 6 +- list.topic.php | 6 +- makepdf.php | 4 +- moderate.php | 11 +- newtopic.php | 7 +- notification_update.php | 6 +- polls.php | 56 +++++---- post.php | 35 +++--- preloads/autoloader.php | 6 +- preloads/core.php | 4 +- preloads/index.php | 2 +- print.php | 2 +- ratethread.php | 8 +- reply.php | 8 +- report.php | 3 +- rss.php | 6 +- search.php | 13 +-- seo.php | 6 +- seo_url.php | 6 +- sql/index.php | 2 +- templates/blocks/index.php | 2 +- templates/css/index.php | 2 +- templates/css/language/english/index.php | 2 +- templates/css/language/index.php | 2 +- templates/css/language/persian/index.php | 2 +- templates/images/icon/index.php | 2 +- templates/images/index.php | 2 +- templates/images/language/english/index.php | 2 +- templates/images/language/german/index.php | 2 +- templates/images/language/index.php | 2 +- templates/images/language/persian/index.php | 2 +- templates/images/mime/index.php | 2 +- templates/images/rpg/index.php | 2 +- templates/index.php | 2 +- templates/js/index.php | 2 +- templates/js/language/english/index.php | 2 +- templates/js/language/index.php | 2 +- templates/newbb_rss.tpl | 2 +- templates/newbb_thread.tpl | 2 +- testdata/images/index.php | 2 +- testdata/index.php | 26 +++-- topicmanager.php | 6 +- update_type.php | 5 +- view.tag.php | 5 +- viewforum.php | 28 +++-- viewpost.php | 12 +- viewtopic.php | 39 ++++--- votepolls.php | 3 +- xoops_version.php | 9 +- 242 files changed, 990 insertions(+), 1132 deletions(-) diff --git a/.scrutinizer.yml b/.scrutinizer.yml index 265627b..3e8b44b 100644 --- a/.scrutinizer.yml +++ b/.scrutinizer.yml @@ -18,9 +18,6 @@ build: tests: override: - php-scrutinizer-run --enable-security-analysis - environment: - php: - version: "7.2" filter: dependency_paths: - XoopsCore25/* diff --git a/EXTRA/index.php b/EXTRA/index.php index 6a50543..e5ee072 100644 --- a/EXTRA/index.php +++ b/EXTRA/index.php @@ -1,2 +1,2 @@ -<{$rss.channel_link}> <{$rss.channel_desc}> <{$rss.channel_lastbuild}> - http://backend.userland.com/rss/ + https://backend.userland.com/rss/ <{$rss.channel_generator}> <{$rss.channel_category}> <{$rss.channel_editor}> diff --git a/EXTRA/themes/templates_fulldiv_opacity/newbb_thread.tpl b/EXTRA/themes/templates_fulldiv_opacity/newbb_thread.tpl index 375292b..aebc748 100644 --- a/EXTRA/themes/templates_fulldiv_opacity/newbb_thread.tpl +++ b/EXTRA/themes/templates_fulldiv_opacity/newbb_thread.tpl @@ -85,7 +85,7 @@
    <{if $topic_post.poster_ip}> IP: - <{$topic_post.poster_ip}> + <{$topic_post.poster_ip}> <{/if}>
    diff --git a/EXTRA/themes/xbootstrap/index.php b/EXTRA/themes/xbootstrap/index.php index 6a50543..e5ee072 100644 --- a/EXTRA/themes/xbootstrap/index.php +++ b/EXTRA/themes/xbootstrap/index.php @@ -1,2 +1,2 @@ -" <{$form_post.extra}> > <{foreach item=element from=$form_post.elements}> - <{if $element.hidden|default:false != true}> + <{if $element.hidden|default:false !== true}>
    <{foreach item=element from=$form_post.elements}> - <{if $element.hidden|default:false == true}> + <{if $element.hidden|default:false === true}> <{$element.body}> <{/if}> <{/foreach}> diff --git a/EXTRA/themes/xbootstrap/modules/newbb/newbb_thread.tpl b/EXTRA/themes/xbootstrap/modules/newbb/newbb_thread.tpl index f85608c..98c761d 100644 --- a/EXTRA/themes/xbootstrap/modules/newbb/newbb_thread.tpl +++ b/EXTRA/themes/xbootstrap/modules/newbb/newbb_thread.tpl @@ -74,7 +74,7 @@
      <{if $topic_post.poster_ip}> -
    • IP: <{$topic_post.poster_ip}>
    • +
    • IP: <{$topic_post.poster_ip}>
    • <{/if}> <{if $topic_post.poster.uid|default:'' gt 0}> diff --git a/EXTRA/themes/xoopsorg/modules/newbb/blocks/index.php b/EXTRA/themes/xoopsorg/modules/newbb/blocks/index.php index 6a50543..e5ee072 100644 --- a/EXTRA/themes/xoopsorg/modules/newbb/blocks/index.php +++ b/EXTRA/themes/xoopsorg/modules/newbb/blocks/index.php @@ -1,2 +1,2 @@ - * @since 4.00 - * @package module::newbb */ use Xmf\Request; use XoopsModules\Newbb\{ - Tree, TopicHandler, ForumHandler, Post, - PostHandler + PostHandler, + Tree }; /** @var TopicHandler $topicHandler */ /** @var ForumHandler $forumHandler */ /** @var PostHandler $postHandler */ /** @var Post $postObject */ - require_once __DIR__ . '/header.php'; $topic_id = Request::getInt('topic_id', 0, 'POST'); @@ -37,7 +36,7 @@ $uid = Request::getInt('uid', 0, 'GET'); $op = Request::getCmd('op', Request::getCmd('op', '', 'POST'), 'GET'); -$op = in_array($op, ['approve', 'delete', 'restore', 'split']) ? $op : ''; +$op = in_array($op, ['approve', 'delete', 'restore', 'split'], true) ? $op : ''; $mode = Request::getInt('mode', 1, 'GET'); if (0 === $post_id || '' === $op) { @@ -131,7 +130,7 @@ $tags['THREAD_URL'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/viewtopic.php?topic_id=' . $postsObject[$post]->getVar('topic_id') . '&forum=' . $postsObject[$post]->getVar('forum_id'); $tags['FORUM_NAME'] = $forum_list[$postsObject[$post]->getVar('forum_id')]; $tags['FORUM_URL'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/viewforum.php?forum=' . $postsObject[$post]->getVar('forum_id'); - $tags['POST_URL'] = $tags['THREAD_URL'] . '&topic_id=' . $postsObject[$post]->getVar('topic_id') . '#forumpost' . $post; + $tags['POST_URL'] = $tags['THREAD_URL'] . '&topic_id=' . $postsObject[$post]->getVar('topic_id') . '#forumpost' . $post; $notificationHandler->triggerEvent('thread', $postsObject[$post]->getVar('topic_id'), 'new_post', $tags); $notificationHandler->triggerEvent('forum', $postsObject[$post]->getVar('forum_id'), 'new_post', $tags); $notificationHandler->triggerEvent('global', 0, 'new_post', $tags); @@ -232,7 +231,7 @@ $forum_id = $postObject->getVar('forum_id'); $topicHandler->synchronization($topic_id); $topicHandler->synchronization($new_topic_id); -// $sql = sprintf('UPDATE "%s" SET forum_topics = forum_topics+1 WHERE forum_id = "%u"', $GLOBALS['xoopsDB']->prefix('newbb_forums'), $forum_id); + // $sql = sprintf('UPDATE "%s" SET forum_topics = forum_topics+1 WHERE forum_id = "%u"', $GLOBALS['xoopsDB']->prefix('newbb_forums'), $forum_id); $sql = sprintf('UPDATE %s SET forum_topics = forum_topics+1 WHERE forum_id = %u', $GLOBALS['xoopsDB']->prefix('newbb_forums'), $forum_id); $result = $GLOBALS['xoopsDB']->queryF($sql); diff --git a/action.topic.php b/action.topic.php index e1528e6..23d5ecc 100644 --- a/action.topic.php +++ b/action.topic.php @@ -1,12 +1,12 @@ - * @since 4.00 - * @package module::newbb */ use Xmf\Request; @@ -29,14 +29,13 @@ /** @var ForumHandler $forumHandler */ /** @var PostHandler $postHandler */ /** @var StatsHandler $statsHandler */ - require_once __DIR__ . '/header.php'; $forum_id = Request::getInt('forum_id', 0, 'POST'); $topic_id = Request::getArray('topic_id', [], 'POST'); $op = Request::getString('op', '', 'POST'); -$op = in_array($op, ['approve', 'delete', 'restore', 'move']) ? $op : ''; +$op = in_array($op, ['approve', 'delete', 'restore', 'move'], true) ? $op : ''; if ('' === $op || 0 === count($topic_id)) { // irmtfan - issue with javascript:history.go(-1) @@ -152,7 +151,7 @@ $forumHandler->synchronization($forum_id); } else { require_once $GLOBALS['xoops']->path('header.php'); - // $categoryHandler = \XoopsModules\Newbb\Helper::getInstance()->getHandler('Category'); + // $categoryHandler = \XoopsModules\Newbb\Helper::getInstance()->getHandler('Category'); $categories = $categoryHandler->getByPermission('access'); $forums = $forumHandler->getForumsByCategory(array_keys($categories), 'post', false); diff --git a/admin/about.php b/admin/about.php index 3d17509..8a00357 100644 --- a/admin/about.php +++ b/admin/about.php @@ -1,4 +1,4 @@ -getHandler('Category'); diff --git a/admin/admin_digest.php b/admin/admin_digest.php index c8bd833..16e6a81 100644 --- a/admin/admin_digest.php +++ b/admin/admin_digest.php @@ -1,4 +1,4 @@ -\n" diff --git a/admin/admin_forum_manager.php b/admin/admin_forum_manager.php index 4021c13..db9da66 100644 --- a/admin/admin_forum_manager.php +++ b/admin/admin_forum_manager.php @@ -1,4 +1,4 @@ -path('class/xoopstree.php'); require_once $GLOBALS['xoops']->path('class/pagenav.php'); @@ -145,7 +144,6 @@ } break; case 'save': - if ($forum_id) { $forumObject = $forumHandler->get($forum_id); $message = _AM_NEWBB_FORUMUPDATE; @@ -181,7 +179,7 @@ foreach (array_keys($glist) as $group) { foreach ($perms as $perm) { $ids = $permHandler->getItemIds($perm, $group, $xoopsModule->getVar('mid')); - if (!in_array($forumObject->getVar('forum_id'), $ids)) { + if (!in_array($forumObject->getVar('forum_id'), $ids, true)) { if (empty($perm_template[$group][$perm])) { $permHandler->deleteRight($perm, $forumObject->getVar('forum_id'), $group, $xoopsModule->getVar('mid')); } else { @@ -224,7 +222,6 @@ require_once $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar('dirname') . '/include/form.forum.php'); break; default: - // $categoryHandler = \XoopsModules\Newbb\Helper::getInstance()->getHandler('Category'); $criteriaCategory = new \CriteriaCompo(new \Criteria('cat_id')); $criteriaCategory->setSort('cat_order'); diff --git a/admin/admin_forum_prune.php b/admin/admin_forum_prune.php index 5ecea9b..425dd7f 100644 --- a/admin/admin_forum_prune.php +++ b/admin/admin_forum_prune.php @@ -1,4 +1,4 @@ -path('class/xoopsformloader.php'); @@ -127,7 +127,7 @@ // ARCHIVING POSTS if (1 == $archive) { $result = $GLOBALS['xoopsDB']->query('SELECT p.topic_id, p.post_id, t.post_text FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_posts') . ' p, ' . $GLOBALS['xoopsDB']->prefix('newbb_posts_text') . " t WHERE p.post_id IN ($post_list) AND p.post_id=t.post_id"); - while (list($topic_id, $post_id, $post_text) = $GLOBALS['xoopsDB']->fetchRow($result)) { + while ([$topic_id, $post_id, $post_text] = $GLOBALS['xoopsDB']->fetchRow($result)) { $sql = $GLOBALS['xoopsDB']->query('INSERT INTO ' . $GLOBALS['xoopsDB']->prefix('newbb_archive') . " (topic_id, post_id, post_text) VALUES ($topic_id, $post_id, $post_text)"); } } @@ -147,7 +147,7 @@ return _MD_NEWBB_ERROR; } // SYNC FORUMS AFTER DELETE - // /** @var Newbb\ForumHandler $forumHandler */ + // /** @var Newbb\ForumHandler $forumHandler */ // $forumHandler = \XoopsModules\Newbb\Helper::getInstance()->getHandler('Forum'); $forumHandler->synchronization(); // I THINK POSTS AND TOPICS HAVE BEEN DESTROYED :LOL: diff --git a/admin/admin_forum_reorder.php b/admin/admin_forum_reorder.php index 401c734..a9a2483 100644 --- a/admin/admin_forum_reorder.php +++ b/admin/admin_forum_reorder.php @@ -1,4 +1,4 @@ -'; // $forumHandler = \XoopsModules\Newbb\Helper::getInstance()->getHandler('Forum'); - // /** @var Newbb\CategoryHandler $categoryHandler */ + // /** @var Newbb\CategoryHandler $categoryHandler */ // $categoryHandler = \XoopsModules\Newbb\Helper::getInstance()->getHandler('Category'); $criteriaCategory = new \CriteriaCompo(new \Criteria('cat_id')); $criteriaCategory->setSort('cat_order'); diff --git a/admin/admin_groupmod.php b/admin/admin_groupmod.php index 1769250..638149d 100644 --- a/admin/admin_groupmod.php +++ b/admin/admin_groupmod.php @@ -1,4 +1,4 @@ -path('class/xoopsformloader.php'); @@ -39,7 +39,7 @@ foreach ($fgroups as $k) { $gg = $memberHandler->getUsersByGroup($k, false); foreach ($gg as $f) { - if (!in_array($f, $fuser)) { + if (!in_array($f, $fuser, true)) { $fuser[] = $f; } } diff --git a/admin/admin_header.php b/admin/admin_header.php index 3131534..e30dc45 100644 --- a/admin/admin_header.php +++ b/admin/admin_header.php @@ -1,4 +1,4 @@ -path('class/xoopsformloader.php'); if (!class_exists('XoopsGroupPermForm')) { @@ -51,10 +50,10 @@ */ //$action = isset($_REQUEST['action']) ? strtolower($_REQUEST['action']) : ""; -$action = \mb_strtolower(Request::getCmd('action', '')); -$module_id = $xoopsModule->getVar('mid'); +$action = \mb_strtolower(Request::getCmd('action', '')); +$module_id = $xoopsModule->getVar('mid'); $permissionHandler = Helper::getInstance()->getHandler('Permission'); -$perms = $permissionHandler->getValidForumPerms(); +$perms = $permissionHandler->getValidForumPerms(); switch ($action) { case 'template': @@ -91,7 +90,7 @@ if (0 == $ii % 5) { $ret_ele .= ''; } - $checked = in_array('forum_' . $perm, $selected) ? ' checked' : ''; + $checked = in_array('forum_' . $perm, $selected, true) ? ' checked' : ''; $option_id = $perm . '_' . $i; $option_ids[] = $option_id; $ret_ele .= '' . constant('_AM_NEWBB_CAN_' . \mb_strtoupper($perm)) . '
      '; diff --git a/admin/admin_report.php b/admin/admin_report.php index a4224d7..0cb664b 100644 --- a/admin/admin_report.php +++ b/admin/admin_report.php @@ -1,4 +1,4 @@ - * @since 4.00 - * @package module::newbb */ use Xmf\Module\Admin; use Xmf\Request; -use XoopsModules\Newbb\{ - TopicHandler -}; +use XoopsModules\Newbb\TopicHandler; + /** @var Admin $adminObject */ /** @var TopicHandler $topicHandler */ @@ -38,7 +37,7 @@ // irmtfan rewrite topic sync case 'topic': $limit = Request::getInt('limit', 1000, 'POST'); //empty($_GET['limit']) ? 1000 : (int)($_GET['limit']); - // /** @var Newbb\TopicHandler $topicHandler */ + // /** @var Newbb\TopicHandler $topicHandler */ // $topicHandler = \XoopsModules\Newbb\Helper::getInstance()->getHandler('Topic'); $criteria = new \Criteria('approved', 1); if ($start >= ($count = $topicHandler->getCount($criteria))) { @@ -70,7 +69,7 @@ } $sql = ' SELECT uid' . ' FROM ' . $GLOBALS['xoopsDB']->prefix('users'); $result = $GLOBALS['xoopsDB']->query($sql, $limit, $start); - while (list($uid) = $GLOBALS['xoopsDB']->fetchRow($result)) { + while ([$uid] = $GLOBALS['xoopsDB']->fetchRow($result)) { // irmtfan approved=1 AND $sql = ' SELECT count(*)' . ' FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_topics') . " WHERE topic_poster = {$uid}"; $ret = $GLOBALS['xoopsDB']->query($sql); diff --git a/admin/admin_type_manager.php b/admin/admin_type_manager.php index d6312b9..afa5ec9 100644 --- a/admin/admin_type_manager.php +++ b/admin/admin_type_manager.php @@ -1,13 +1,13 @@ - * @since 4.00 - * @package module::newbb */ use Xmf\Module\Helper\Cache; @@ -44,7 +44,7 @@ 'save_forum', 'add', ]; -if (!in_array($op, $validOps)) { +if (!in_array($op, $validOps, true)) { $op = ''; } diff --git a/admin/admin_votedata.php b/admin/admin_votedata.php index 8535297..fee431f 100644 --- a/admin/admin_votedata.php +++ b/admin/admin_votedata.php @@ -1,4 +1,4 @@ -query($query); $votesDB = $GLOBALS['xoopsDB']->getRowsNum($voteresult); $totalrating = 0; - while (list($rating) = $GLOBALS['xoopsDB']->fetchRow($voteresult)) { + while ([$rating] = $GLOBALS['xoopsDB']->fetchRow($voteresult)) { $totalrating += $rating; } $finalrating = $totalrating / $votesDB; @@ -58,7 +58,7 @@ $uservotes = $GLOBALS['xoopsDB']->getRowsNum($result2); $useravgrating = 0; - while (list($rating2) = $GLOBALS['xoopsDB']->fetchRow($result2)) { + while ([$rating2] = $GLOBALS['xoopsDB']->fetchRow($result2)) { // $useravgrating = $useravgrating + $rating2; $useravgrating += $rating2; } @@ -92,7 +92,7 @@ if (0 == $votes) { echo "" . _AM_NEWBB_VOTE_NOVOTES . ''; } - while (list($ratingid, $topic_id, $ratinguser, $rating, $ratinghostname, $ratingtimestamp) = $GLOBALS['xoopsDB']->fetchRow($results)) { + while ([$ratingid, $topic_id, $ratinguser, $rating, $ratinghostname, $ratingtimestamp] = $GLOBALS['xoopsDB']->fetchRow($results)) { $sql = 'SELECT topic_title FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_topics') . ' WHERE topic_id=' . $topic_id . ' '; $down_array = $GLOBALS['xoopsDB']->fetchArray($GLOBALS['xoopsDB']->query($sql)); diff --git a/admin/index.php b/admin/index.php index ba98ea0..06c86da 100644 --- a/admin/index.php +++ b/admin/index.php @@ -1,4 +1,4 @@ -loadLanguage('common'); $helper->loadLanguage('feedback'); -$pathIcon32 = Admin::menuIconPath(''); -$pathModIcon32 = XOOPS_URL . '/modules/' . $moduleDirName . '/assets/images/icons/32/'; +$pathIcon32 = Admin::menuIconPath(''); +$pathModIcon32 = XOOPS_URL . '/modules/' . $moduleDirName . '/assets/images/icons/32/'; if (is_object($helper->getModule()) && false !== $helper->getModule()->getInfo('modicons32')) { $pathModIcon32 = $helper->url($helper->getModule()->getInfo('modicons32')); } diff --git a/admin/migrate.php b/admin/migrate.php index 675c251..ba9cddd 100644 --- a/admin/migrate.php +++ b/admin/migrate.php @@ -1,24 +1,29 @@ + * @author Michael Beck */ -use Xmf\Request; use Xmf\Module\Admin; -use XoopsModules\Newbb\{Common\Configurator, +use Xmf\Request; +use XoopsModules\Newbb\{ + Common\Configurator, Common\Migrate, Helper }; @@ -26,25 +31,24 @@ /** @var Admin $adminObject */ /** @var Helper $helper */ /** @var Configurator $configurator */ - require_once __DIR__ . '/admin_header.php'; xoops_cp_header(); $adminObject->displayNavigation(basename(__FILE__)); echo << -
      - -
      -
      - -
      -
      - -
      - -EOF; +
      +
      + +
      +
      + +
      +
      + +
      +
      + EOF; //XoopsLoad::load('migrate', 'newbb'); diff --git a/assets/css/index.php b/assets/css/index.php index 2ea9b7d..b295ab9 100644 --- a/assets/css/index.php +++ b/assets/css/index.php @@ -1,3 +1,3 @@ -, irmtfan * @author The Persian Xoops Support Site * @since 4.3 - * @package module::newbb */ -use XoopsModules\Newbb\{Helper, + +use XoopsModules\Newbb\{ ForumHandler, + Helper, TopicRenderer }; /** @var Helper $helper */ /** @var ForumHandler $forumHandler */ - if (defined('LIST_TOPIC_DEFINED')) { return; } diff --git a/blocks/newbb_block.php b/blocks/newbb_block.php index a919623..88d2bae 100644 --- a/blocks/newbb_block.php +++ b/blocks/newbb_block.php @@ -1,4 +1,4 @@ - Change to support jumping directly to that post, vs just the page that the topic is on + //BigKev73 > Change to support jumping directly to that post, vs just the page that the topic is on $seo_url = XOOPS_URL . '/' . SEO_MODULE_NAME . '/viewtopic.php?topic_id=' . $topic['id'] . '&post_id=' . $topic['post_id'] . '#forumpost' . $topic['post_id']; $seo_topic_url = XOOPS_URL . '/' . SEO_MODULE_NAME . '/viewtopic.php?topic_id=' . $topic['id']; $seo_forum_url = XOOPS_URL . '/' . SEO_MODULE_NAME . '/viewforum.php?forum=' . $topic['forum_id']; diff --git a/blocks/newbb_block_tag.php b/blocks/newbb_block_tag.php index ef7daf0..7847f5b 100644 --- a/blocks/newbb_block_tag.php +++ b/blocks/newbb_block_tag.php @@ -1,12 +1,12 @@ - * @since 4.00 - * @package module::newbb/tag */ use XoopsModules\Newbb; diff --git a/class/Category.php b/class/Category.php index 30d1268..9c42180 100644 --- a/class/Category.php +++ b/class/Category.php @@ -1,4 +1,4 @@ - * @since 4.00 - * @package module::newbb */ class Category extends \XoopsObject { diff --git a/class/CategoryHandler.php b/class/CategoryHandler.php index 46526dd..459250d 100644 --- a/class/CategoryHandler.php +++ b/class/CategoryHandler.php @@ -1,4 +1,4 @@ - * @since 4.00 - * @package module::newbb */ use XoopsModules\Newbb; @@ -60,7 +59,7 @@ public function &getByPermission($permission = 'access', $tags = null, $asObject /** * @param \XoopsObject $category - * @param bool $force + * @param bool $force * @return mixed */ public function insert(\XoopsObject $category, $force = true) @@ -79,7 +78,7 @@ public function insert(\XoopsObject $category, $force = true) /** * @param \XoopsObject $category - * @param bool $force + * @param bool $force * @return bool|mixed * @internal param Category $category */ diff --git a/class/Common/Breadcrumb.php b/class/Common/Breadcrumb.php index 48881fd..31db63b 100644 --- a/class/Common/Breadcrumb.php +++ b/class/Common/Breadcrumb.php @@ -1,4 +1,4 @@ - - * @package newbb * * Example: - * $breadcrumb = new PedigreeBreadcrumb(); + * $breadcrumb = new Breadcrumb(); * $breadcrumb->addLink( 'bread 1', 'index1.php' ); * $breadcrumb->addLink( 'bread 2', '' ); * $breadcrumb->addLink( 'bread 3', 'index3.php' ); @@ -48,7 +47,7 @@ public function __construct() * @param string $title * @param string $link */ - public function addLink($title = '', $link = '') + public function addLink($title = '', $link = ''): void { $this->bread[] = [ 'link' => $link, @@ -61,7 +60,7 @@ public function addLink($title = '', $link = '') * * @return void */ - public function render() + public function render(): void { /* TODO if you want to use the render code below, diff --git a/class/Common/Configurator.php b/class/Common/Configurator.php index 9a78b24..c0f9aad 100644 --- a/class/Common/Configurator.php +++ b/class/Common/Configurator.php @@ -1,4 +1,4 @@ -name = $config->name; @@ -61,6 +60,5 @@ public function __construct() $this->icons = require \dirname(__DIR__, 2) . '/config/icons.php'; $this->paths = require \dirname(__DIR__, 2) . '/config/paths.php'; - } } diff --git a/class/Common/FilesManagement.php b/class/Common/FilesManagement.php index 5ae6fdd..6e0ad51 100644 --- a/class/Common/FilesManagement.php +++ b/class/Common/FilesManagement.php @@ -1,4 +1,4 @@ - */ trait FilesManagement @@ -28,7 +26,7 @@ trait FilesManagement * * @param string $folder The full path of the directory to check */ - public static function createFolder($folder) + public static function createFolder($folder): void { try { if (!\is_dir($folder)) { @@ -38,7 +36,7 @@ public static function createFolder($folder) file_put_contents($folder . '/index.html', ''); } - } catch (\Exception $e) { + } catch (\Throwable $e) { echo 'Caught exception: ', $e->getMessage(), "\n", '
      '; } } @@ -57,7 +55,7 @@ public static function copyFile(string $file, string $folder): bool * @param $src * @param $dst */ - public static function recurseCopy($src, $dst) + public static function recurseCopy($src, $dst): void { $dir = \opendir($src); // @mkdir($dst); @@ -160,6 +158,7 @@ public static function rrmdir($src) } } $iterator = null; // clear iterator Obj to close file/directory + return \rmdir($src); // remove the directory & return results } @@ -200,6 +199,7 @@ public static function rmove($src, $dest) } } $iterator = null; // clear iterator Obj to close file/directory + return \rmdir($src); // remove the directory & return results } diff --git a/class/Common/Migrate.php b/class/Common/Migrate.php index 08ba882..7049040 100644 --- a/class/Common/Migrate.php +++ b/class/Common/Migrate.php @@ -1,4 +1,4 @@ - * @copyright 2016 XOOPS Project (https://xoops.org) - * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) + * @license GNU GPL 2.0 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @link https://xoops.org */ class Migrate extends \Xmf\Database\Migrate @@ -46,7 +42,7 @@ public function __construct(Newbb\Common\Configurator $configurator) /** * change table prefix if needed */ - private function changePrefix() + private function changePrefix(): void { foreach ($this->renameTables as $oldName => $newName) { if ($this->tableHandler->useTable($oldName) && !$this->tableHandler->useTable($newName)) { @@ -78,7 +74,7 @@ private function changePrefix() * @param string $tableName table to convert * @param string $columnName column with IP address */ - private function convertIPAddresses($tableName, $columnName) + private function convertIPAddresses($tableName, $columnName): void { if ($this->tableHandler->useTable($tableName)) { $attributes = $this->tableHandler->getColumnAttributes($tableName, $columnName); @@ -96,7 +92,7 @@ private function convertIPAddresses($tableName, $columnName) /** * Move do* columns from newbb_posts to newbb_posts_text table */ - private function moveDoColumns() + private function moveDoColumns(): void { $tableName = 'newbb_posts_text'; $srcTableName = 'newbb_posts'; @@ -120,7 +116,7 @@ private function moveDoColumns() * table and column renames * data conversions */ - protected function preSyncActions() + protected function preSyncActions(): void { // change 'bb' table prefix to 'newbb' $this->changePrefix(); diff --git a/class/Common/ServerStats.php b/class/Common/ServerStats.php index ed6fc45..2a502ab 100644 --- a/class/Common/ServerStats.php +++ b/class/Common/ServerStats.php @@ -1,4 +1,4 @@ - */ trait ServerStats @@ -47,7 +47,7 @@ public static function getServerStats() $gdlib = \function_exists('gd_info') ? '' . \constant('CO_' . $moduleDirNameUpper . '_GDON') . '' : '' . \constant('CO_' . $moduleDirNameUpper . '_GDOFF') . ''; $html .= '
    • ' . \constant('CO_' . $moduleDirNameUpper . '_GDLIBSTATUS') . $gdlib; if (\function_exists('gd_info')) { - if (true == ($gdlib = gd_info())) { + if (true === ($gdlib = gd_info())) { $html .= '
    • ' . \constant('CO_' . $moduleDirNameUpper . '_GDLIBVERSION') . '' . $gdlib['GD Version'] . ''; } } diff --git a/class/Common/SysUtility.php b/class/Common/SysUtility.php index 98e19e1..daacbbd 100644 --- a/class/Common/SysUtility.php +++ b/class/Common/SysUtility.php @@ -1,4 +1,4 @@ - * @author Mamba */ -use MyTextSanitizer; -use XoopsFormDhtmlTextArea; -use XoopsFormTextArea; use XoopsModules\Newbb\Helper; /** @@ -230,12 +226,13 @@ public static function cloneRecord($tableName, $id_field, $id) // set the auto-incremented id's value to blank. unset($tempTable[$id_field]); // insert cloned copy of the original record - $result = $GLOBALS['xoopsDB']->queryF("INSERT INTO $table (" . \implode(', ', \array_keys($tempTable)) . ") VALUES ('" . \implode("', '", \array_values($tempTable)) . "')") or exit ($GLOBALS['xoopsDB']->error()); + $result = $GLOBALS['xoopsDB']->queryF("INSERT INTO $table (" . \implode(', ', \array_keys($tempTable)) . ") VALUES ('" . \implode("', '", \array_values($tempTable)) . "')") or exit($GLOBALS['xoopsDB']->error()); if ($result) { // Return the new id $new_id = $GLOBALS['xoopsDB']->getInsertId(); } + return $new_id; } @@ -245,8 +242,7 @@ public static function cloneRecord($tableName, $id_field, $id) * @param $field * @param $table * @return bool|\mysqli_result - * @package News - * @author Hervé Thouzard (http://www.herve-thouzard.com) + * @author Hervé Thouzard (https://www.herve-thouzard.com) * @copyright (c) Hervé Thouzard */ public function addField($field, $table) @@ -262,14 +258,14 @@ public function addField($field, $table) * * @param string $folder Le chemin complet du répertoire à vérifier */ - public static function prepareFolder($folder) + public static function prepareFolder($folder): void { try { if (!@\mkdir($folder) && !\is_dir($folder)) { throw new \RuntimeException(\sprintf('Unable to create the %s directory', $folder)); } file_put_contents($folder . '/index.html', ''); - } catch (\Exception $e) { + } catch (\Throwable $e) { echo 'Caught exception: ', $e->getMessage(), "\n", '
      '; } } diff --git a/class/Common/TestdataButtons.php b/class/Common/TestdataButtons.php index cf05c26..cf08f10 100644 --- a/class/Common/TestdataButtons.php +++ b/class/Common/TestdataButtons.php @@ -1,6 +1,4 @@ - * @copyright {@link https://xoops.org/ XOOPS Project} - * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) + * @license GNU GPL 2.0 or later (https://www.gnu.org/licenses/gpl-2.0.html) */ use Xmf\Yaml; use XoopsModules\Newbb\Helper; + /** @var Helper $helper */ /** @@ -31,18 +29,27 @@ */ class TestdataButtons { + /** Button status constants */ + private const SHOW_BUTTONS = 1; + private const HIDE_BUTTONS = 0; - //functions for import buttons - public static function loadButtonConfig($adminObject) + /** + * Load the test button configuration + * + * @param \Xmf\Module\Admin $adminObject + * + * @return void + */ + public static function loadButtonConfig($adminObject): void { $moduleDirName = \basename(\dirname(__DIR__, 2)); $moduleDirNameUpper = \mb_strtoupper($moduleDirName); - $yamlFile = \dirname(__DIR__, 2) . '/config/admin.yml'; + $helper = Helper::getInstance(); + $yamlFile = $helper->path('/config/admin.yml'); $config = Yaml::readWrapped($yamlFile); // work with phpmyadmin YAML dumps $displaySampleButton = $config['displaySampleButton']; - $helper = Helper::getInstance(); - if (1 == $displaySampleButton) { + if (self::SHOW_BUTTONS == $displaySampleButton) { \xoops_loadLanguage('admin/modulesadmin', 'system'); $adminObject->addItemButton(\constant('CO_' . $moduleDirNameUpper . '_' . 'LOAD_SAMPLEDATA'), $helper->url('testdata/index.php?op=load'), 'add'); $adminObject->addItemButton(\constant('CO_' . $moduleDirNameUpper . '_' . 'SAVE_SAMPLEDATA'), $helper->url('testdata/index.php?op=save'), 'add'); @@ -55,20 +62,30 @@ public static function loadButtonConfig($adminObject) } } - public static function hideButtons() + /** + * Hide the test buttons + * + * @return void + */ + public static function hideButtons(): void { - $yamlFile = \dirname(__DIR__, 2) . '/config/admin.yml'; + $yamlFile = \dirname(__DIR__, 2) . '/config/admin.yml'; $app = []; - $app['displaySampleButton'] = 0; + $app['displaySampleButton'] = self::HIDE_BUTTONS; Yaml::save($app, $yamlFile); \redirect_header('index.php', 0, ''); } - public static function showButtons() + /** + * Show the test buttons + * + * @return void + */ + public static function showButtons(): void { - $yamlFile = \dirname(__DIR__, 2) . '/config/admin.yml'; + $yamlFile = \dirname(__DIR__, 2) . '/config/admin.yml'; $app = []; - $app['displaySampleButton'] = 1; + $app['displaySampleButton'] = self::SHOW_BUTTONS; Yaml::save($app, $yamlFile); \redirect_header('index.php', 0, ''); } diff --git a/class/Common/VersionChecks.php b/class/Common/VersionChecks.php index 2f59369..13d5565 100644 --- a/class/Common/VersionChecks.php +++ b/class/Common/VersionChecks.php @@ -1,4 +1,4 @@ - */ trait VersionChecks @@ -24,7 +24,7 @@ trait VersionChecks * @static * @param \XoopsModule|null $module * - * @param null|string $requiredVer + * @param null|string $requiredVer * @return bool true if meets requirements, false if not */ public static function checkVerXoops(\XoopsModule $module = null, $requiredVer = null) @@ -86,7 +86,6 @@ public static function checkVerPhp(\XoopsModule $module = null) } /** - * * compares current module version with the latest GitHub release * @static * @param \Xmf\Module\Helper $helper @@ -95,7 +94,6 @@ public static function checkVerPhp(\XoopsModule $module = null) * * @return string|array info about the latest module version, if newer */ - public static function checkVerModule(\Xmf\Module\Helper $helper, ?string $source = 'github', ?string $default = 'master'): ?array { $moduleDirName = \basename(\dirname(__DIR__, 2)); @@ -114,7 +112,7 @@ public static function checkVerModule(\Xmf\Module\Helper $helper, ?string $sourc $curlReturn = \curl_exec($curlHandle); if (false === $curlReturn) { \trigger_error(\curl_error($curlHandle)); - } elseif (false !== \strpos($curlReturn, 'Not Found')) { + } elseif (false !== \mb_strpos($curlReturn, 'Not Found')) { \trigger_error('Repository Not Found: ' . $infoReleasesUrl); } else { $file = json_decode($curlReturn, false); @@ -144,6 +142,7 @@ public static function checkVerModule(\Xmf\Module\Helper $helper, ?string $sourc \curl_close($curlHandle); } } + return $ret; } } diff --git a/class/Common/index.php b/class/Common/index.php index 6a50543..e5ee072 100644 --- a/class/Common/index.php +++ b/class/Common/index.php @@ -1,2 +1,2 @@ - * @since 4.00 - * @package module::newbb */ class Digest extends \XoopsObject { @@ -29,12 +28,12 @@ public function __construct() $this->items = []; } - public function setHtml() + public function setHtml(): void { $this->isHtml = true; } - public function setSummary() + public function setSummary(): void { $this->isSummary = true; } @@ -45,7 +44,7 @@ public function setSummary() * @param $author * @param string $summary */ - public function addItem($title, $link, $author, $summary = '') + public function addItem($title, $link, $author, $summary = ''): void { $title = $this->cleanup($title); $author = $this->cleanup($author); diff --git a/class/DigestHandler.php b/class/DigestHandler.php index b0dec6a..6a509c6 100644 --- a/class/DigestHandler.php +++ b/class/DigestHandler.php @@ -1,4 +1,4 @@ - * @since 4.00 - * @package module::newbb */ use Xmf\Metagen; @@ -98,6 +97,7 @@ public function getAllDigests($start = 0, $perpage = 5) $ret[] = $myrow; // return as array } } + return $ret; } @@ -116,7 +116,7 @@ public function getDigestCount() return $array['count']; } - public function getLastDigest() + public function getLastDigest(): void { $sql = 'SELECT MAX(digest_time) AS last_digest FROM ' . $this->db->prefix('newbb_digest'); $result = $this->db->query($sql); @@ -145,7 +145,7 @@ public function checkStatus() /** * @param \XoopsObject $digest - * @param bool $force flag to force the query execution despite security settings + * @param bool $force flag to force the query execution despite security settings * @return mixed object ID or false */ public function insert(\XoopsObject $digest, $force = true) @@ -174,7 +174,7 @@ public function insert(\XoopsObject $digest, $force = true) /** * @param \XoopsObject $digest - * @param bool $force (ignored) + * @param bool $force (ignored) * @return bool FALSE if failed. */ public function delete(\XoopsObject $digest, $force = false) diff --git a/class/Forum.php b/class/Forum.php index 671fba4..4126598 100644 --- a/class/Forum.php +++ b/class/Forum.php @@ -1,4 +1,4 @@ - */ diff --git a/class/ForumHandler.php b/class/ForumHandler.php index 899a74d..b345412 100644 --- a/class/ForumHandler.php +++ b/class/ForumHandler.php @@ -1,4 +1,4 @@ - */ @@ -36,7 +35,7 @@ public function __construct(\XoopsDatabase $db = null) /** * @param \XoopsObject $object - * @param bool $force + * @param bool $force * @return bool|int * @internal param \XoopsObject $forum */ @@ -56,7 +55,7 @@ public function insert(\XoopsObject $object, $force = true) //insert($forum) /** * @param \XoopsObject $forum - * @param bool $force + * @param bool $force * @return bool */ public function delete(\XoopsObject $forum, $force = false) //delete(&$forum) @@ -166,21 +165,21 @@ public function getAllTopics($forum, $criteria = null) { global $myts, $viewAllForums, $xoopsUser; $startdate = ''; - $type = ''; - $status = ''; - $excerpt = ''; - $sort = ''; - $order = ''; - $start = ''; + $type = ''; + $status = ''; + $excerpt = ''; + $sort = ''; + $order = ''; + $start = ''; require_once $GLOBALS['xoops']->path('modules/newbb/include/functions.render.php'); require_once $GLOBALS['xoops']->path('modules/newbb/include/functions.session.php'); require_once $GLOBALS['xoops']->path('modules/newbb/include/functions.time.php'); require_once $GLOBALS['xoops']->path('modules/newbb/include/functions.read.php'); require_once $GLOBALS['xoops']->path('modules/newbb/include/functions.topic.php'); - - //BigKev73 > Added this to suport the call into the Topic Handler - $topicHandler = Helper::getInstance()->getHandler('Topic'); + + //BigKev73 > Added this to suport the call into the Topic Handler + $topicHandler = Helper::getInstance()->getHandler('Topic'); $criteria_vars = ['startdate', 'start', 'sort', 'order', 'type', 'status', 'excerpt']; foreach ($criteria_vars as $var) { @@ -344,16 +343,16 @@ public function getAllTopics($forum, $criteria = null) $append = true; } } else { - //BigKev73 - Made change so link scroll directly to that post - $topic_page_jump .= '[' . $i . ']'; - // $topic_page_jump .= '[' . $i . ']'; + //BigKev73 - Made change so link scroll directly to that post + $topic_page_jump .= '[' . $i . ']'; + // $topic_page_jump .= '[' . $i . ']'; // irmtfan remove here and move //$topic_page_jump_icon = "" . newbbDisplayImage('lastposticon',_MD_NEWBB_GOTOLASTPOST) . ''; } } } // irmtfan - move here for both topics with and without pages - $topic_page_jump_icon = "" . \newbbDisplayImage('lastposticon', \_MD_NEWBB_GOTOLASTPOST) . ''; + $topic_page_jump_icon = "" . \newbbDisplayImage('lastposticon', \_MD_NEWBB_GOTOLASTPOST) . ''; // ------------------------------------------------------ // => topic array @@ -380,29 +379,29 @@ public function getAllTopics($forum, $criteria = null) $topic_excerpt = \str_replace('[', '[', \htmlspecialchars($topic_excerpt, \ENT_QUOTES | \ENT_HTML5)); } // START irmtfan move here - + //BigKev73 > Adding this code to support jumping directly to the last read post if that value exists for a user, block also would need to change to support same functionality - $topicLink ='viewtopic.php?topic_id=' . $myrow['topic_id']; - - if ($xoopsUser){ - $lastRead = \newbbGetRead('topic', $myrow['topic_id']); - if (isset($lastRead)){ - if (!empty($lastRead)){ - if ($lastRead<$myrow['topic_last_post_id']){ - $topicLink = 'viewtopic.php?topic_id=' . $myrow['topic_id'] .'&post_id=' . $lastRead . '#forumpost'.$lastRead; - - //BigKev73 > Adding this code to support jumping to the next post after the LastReadPost, otherwise we could end up on the prior page - // if the lastread post is not on the last page and the next new post. Added getNextPostId to topichandler to support this - $nextPostID = $topicHandler->getNextPostId($myrow['topic_id'],$lastRead); - if(!empty($nextPostID)){ - $topicLink = 'viewtopic.php?topic_id=' . $myrow['topic_id'] .'&post_id=' . $nextPostID . '#forumpost'.$nextPostID; - print ('LastRead='.$lastRead. ', NextPostID= ' . $nextPostID); - } - } - } - } - } - + $topicLink = 'viewtopic.php?topic_id=' . $myrow['topic_id']; + + if ($xoopsUser) { + $lastRead = \newbbGetRead('topic', $myrow['topic_id']); + if (isset($lastRead)) { + if (!empty($lastRead)) { + if ($lastRead < $myrow['topic_last_post_id']) { + $topicLink = 'viewtopic.php?topic_id=' . $myrow['topic_id'] . '&post_id=' . $lastRead . '#forumpost' . $lastRead; + + //BigKev73 > Adding this code to support jumping to the next post after the LastReadPost, otherwise we could end up on the prior page + // if the lastread post is not on the last page and the next new post. Added getNextPostId to topichandler to support this + $nextPostID = $topicHandler->getNextPostId($myrow['topic_id'], $lastRead); + if (!empty($nextPostID)) { + $topicLink = 'viewtopic.php?topic_id=' . $myrow['topic_id'] . '&post_id=' . $nextPostID . '#forumpost' . $nextPostID; + print('LastRead=' . $lastRead . ', NextPostID= ' . $nextPostID); + } + } + } + } + } + $topics[$myrow['topic_id']] = [ 'topic_id' => $myrow['topic_id'], 'topic_icon' => $topic_icon, @@ -487,7 +486,7 @@ public function getAllTopics($forum, $criteria = null) $sql = ' SELECT DISTINCT topic_id FROM ' . $this->db->prefix('newbb_posts') . " WHERE attachment != ''" . ' AND topic_id IN (' . \implode(',', \array_keys($topics)) . ')'; $result = $this->db->query($sql); if ($result) { - while (list($topic_id) = $this->db->fetchRow($result)) { + while ([$topic_id] = $this->db->fetchRow($result)) { $topics[$topic_id]['attachment'] = ' ' . \newbbDisplayImage('attachment', \_MD_NEWBB_TOPICSHASATT); } } @@ -797,14 +796,13 @@ public function getSubforumStats($passedSubForums = null) } } -// $forums_id = []; -// foreach (\array_keys($sub_forums) as $id) { -// if (empty($sub_forums[$id])) { -// continue; -// } -// $forums_id = \array_merge($forums_id, $sub_forums[$id]); -// } - + // $forums_id = []; + // foreach (\array_keys($sub_forums) as $id) { + // if (empty($sub_forums[$id])) { + // continue; + // } + // $forums_id = \array_merge($forums_id, $sub_forums[$id]); + // } $forums_id = []; foreach (\array_keys($sub_forums) as $id) { @@ -815,9 +813,6 @@ public function getSubforumStats($passedSubForums = null) } $forums_id = \array_merge([], ...$forums_id); // the empty array covers cases when no loops were made - - - if (empty($forums_id)) { return $stats; } @@ -938,10 +933,10 @@ public function &display($forums, $length_title_index = 30, $count_subforum = 1) // irmtfan change if/endif to if{} method $post_id = $forum['forum_last_post_id']; if ($post_id) { - $post = &$posts[$post_id]; - $_forum_data['forum_lastpost_id'] = $post_id; - $_forum_data['forum_lastpost_topicid'] = $post['topic_id']; - $_forum_data['forum_lastpost_time'] = \newbbFormatTimestamp($post['post_time']); + $post = &$posts[$post_id]; + $_forum_data['forum_lastpost_id'] = $post_id; + $_forum_data['forum_lastpost_topicid'] = $post['topic_id']; + $_forum_data['forum_lastpost_time'] = \newbbFormatTimestamp($post['post_time']); if (!empty($users_linked[$post['uid']])) { $_forum_data['forum_lastpost_user'] = $users_linked[$post['uid']]; } elseif ($poster_name = $post['poster_name']) { @@ -1078,7 +1073,7 @@ public function &getParents($object) * @param int|text|array $values : positive values = forums | negative values = cats | $values=0 = all valid forums, $permission , true/false $parse_cats * @param string $permission * @param bool $parse_cats - * @return array|mixed $validForums + * @return array|mixed */ public function getIdsByValues($values = 0, $permission = 'access', $parse_cats = true) { diff --git a/class/GroupFormCheckBox.php b/class/GroupFormCheckBox.php index a011a18..c179f77 100644 --- a/class/GroupFormCheckBox.php +++ b/class/GroupFormCheckBox.php @@ -1,4 +1,4 @@ - 0) { $tree .= $prefix . '_value)) { + if (\in_array($option['id'], $this->_value, true)) { $tree .= ' checked'; } $tree .= ' >' . $option['name'] . ' * @since 4.00 - * @package module::newbb */ /** @@ -31,7 +30,6 @@ * * @author D.J. (phppp) * @copyright copyright © Xoops Project - * @package module::newbb */ class IconHandler { @@ -99,8 +97,11 @@ public function getPath($type, $dirname = 'newbb', $default = '', $endDir = 'ima if (empty($default)) { $path = \is_dir($theme_path . "/{$rel_dir}/{$type}/") ? $theme_path . "/{$rel_dir}/{$type}" : (\is_dir(\XOOPS_THEME_PATH . "/default/{$rel_dir}/{$type}/") ? \XOOPS_THEME_PATH . "/default/{$rel_dir}/{$type}" : $GLOBALS['xoops']->path("modules/{$dirname}/templates/{$endDir}/{$type}")); } else { - $path = \is_dir($theme_path . "/{$rel_dir}/{$type}/") ? $theme_path . "/{$rel_dir}/{$type}" : (\is_dir($theme_path . "/{$rel_dir}/{$default}/") ? $theme_path . "/{$rel_dir}/{$default}" : (\is_dir(\XOOPS_THEME_PATH . "/default/{$rel_dir}/{$type}/") ? \XOOPS_THEME_PATH - . "/default/{$rel_dir}/{$type}" : (\is_dir( + $path = \is_dir($theme_path . "/{$rel_dir}/{$type}/") ? $theme_path . "/{$rel_dir}/{$type}" : ( + \is_dir($theme_path . "/{$rel_dir}/{$default}/") ? $theme_path . "/{$rel_dir}/{$default}" : ( + \is_dir(\XOOPS_THEME_PATH . "/default/{$rel_dir}/{$type}/") ? \XOOPS_THEME_PATH + . "/default/{$rel_dir}/{$type}" : ( + \is_dir( \XOOPS_THEME_PATH . "/default/{$rel_dir}/{$default}/" ) ? \XOOPS_THEME_PATH . "/default/{$rel_dir}/{$default}" : (\is_dir($GLOBALS['xoops']->path("modules/{$dirname}/templates/{$endDir}/{$type}/")) ? $GLOBALS['xoops']->path("modules/{$dirname}/templates/{$endDir}/{$type}") : $GLOBALS['xoops']->path( "modules/{$dirname}/templates/{$endDir}/{$default}" @@ -121,9 +122,11 @@ public function getPath($type, $dirname = 'newbb', $default = '', $endDir = 'ima * @param string $language * @param string $dirname */ - public function init(/*$set = "default", */ $language = 'english', + public function init( + /*$set = "default", */ + $language = 'english', $dirname = 'newbb' - ) { + ): void { $this->forumImage = require_once $GLOBALS['xoops']->path("modules/{$dirname}/include/images.php"); $this->forumImage['icon'] = XOOPS_URL . $this->getPath('icon', $dirname) . '/'; @@ -135,7 +138,7 @@ public function init(/*$set = "default", */ $language = 'english', * @param string $alt * @param string $extra */ - public function setImage($image, $alt = '', $extra = '') + public function setImage($image, $alt = '', $extra = ''): void { if (!isset($this->images[$image])) { $imageSource = $this->getImageSource($image); @@ -178,7 +181,7 @@ public function assignImage($image, $alt = '', $extra = '') $this->setImage($image, $alt, $extra); // START hacked by irmtfan - improve function to CSS3 buttons - add alt and title attributes - use span instead of button to support IE7&8 $tag = 'span'; - if ("class='forum_icon'" === $extra && \in_array(mb_substr($image, 0, 2), ['t_', 'p_', 'up'])) { + if ("class='forum_icon'" === $extra && \in_array(mb_substr($image, 0, 2), ['t_', 'p_', 'up'], true)) { $extra = "class='forum_icon forum_button'"; } @@ -189,7 +192,7 @@ public function assignImage($image, $alt = '', $extra = '') /** * @param $images */ - public function assignImages($images) + public function assignImages($images): void { foreach ($images as $myImage) { [$image, $alt, $extra] = $myImage; diff --git a/class/IpCheck.php b/class/IpCheck.php index 9e78851..962342c 100644 --- a/class/IpCheck.php +++ b/class/IpCheck.php @@ -1,4 +1,4 @@ -ipin = $ipValue; $this->ipver = 0; diff --git a/class/KarmaHandler.php b/class/KarmaHandler.php index daf247c..b46ba9b 100644 --- a/class/KarmaHandler.php +++ b/class/KarmaHandler.php @@ -1,4 +1,4 @@ - * @since 4.00 - * @package module::newbb */ class KarmaHandler { @@ -40,15 +39,15 @@ public function calculateUserKarma($user) return $user_karma; } - public function updateUserKarma() + public function updateUserKarma(): void { } - public function writeUserKarma() + public function writeUserKarma(): void { } - public function readUserKarma() + public function readUserKarma(): void { } } diff --git a/class/Moderate.php b/class/Moderate.php index 49ce798..b3e3bea 100644 --- a/class/Moderate.php +++ b/class/Moderate.php @@ -1,4 +1,4 @@ - * @since 4.00 - * @package module::newbb */ /** * A handler for User moderation management * - * @package newbb * - * @author D.J. (phppp, http://xoopsforge.com) + * @author D.J. (phppp, https://xoopsforge.com) * @copyright copyright (c) 2005 XOOPS.org */ class Moderate extends \XoopsObject diff --git a/class/ModerateHandler.php b/class/ModerateHandler.php index 11b587d..829e2ae 100644 --- a/class/ModerateHandler.php +++ b/class/ModerateHandler.php @@ -1,4 +1,4 @@ - * @since 4.00 - * @package module::newbb */ use Xmf\IPAddress; @@ -34,7 +33,7 @@ public function __construct(\XoopsDatabase $db = null) * * @param int $expire Expiration time in UNIX, 0 for time() */ - public function clearGarbage($expire = 0) + public function clearGarbage($expire = 0): void { $expire = \time() - (int)$expire; $sql = \sprintf('DELETE FROM `%s` WHERE mod_end < %u', $this->db->prefix('newbb_moderates'), $expire); diff --git a/class/ObjectTree.php b/class/ObjectTree.php index 6d3f678..3fc92bb 100644 --- a/class/ObjectTree.php +++ b/class/ObjectTree.php @@ -1,4 +1,4 @@ -path('class/tree.php'); if (!\class_exists('ObjectTree')) { @@ -50,7 +48,7 @@ public function __construct($objectArr, $rootId = null) * @internal param string $selected Value to display as selected * @access private */ - protected function makeTreeItems($key, &$ret, $prefix_orig, $prefix_curr = '', $tags = null) + protected function makeTreeItems($key, &$ret, $prefix_orig, $prefix_curr = '', $tags = null): void { if ($key > 0) { if (\count($tags) > 0) { @@ -103,7 +101,7 @@ public function &makeTree($prefix = '-', $key = 0, $tags = null) * @param string $prefix_curr String to indent the current item * @access private */ - public function _makeSelBoxOptions($fieldName, $selected, $key, &$ret, $prefix_orig, $prefix_curr = '') + public function _makeSelBoxOptions($fieldName, $selected, $key, &$ret, $prefix_orig, $prefix_curr = ''): void { if ($key > 0) { $value = $this->tree[$key]['obj']->getVar($this->myId); @@ -144,8 +142,7 @@ public function makeSelBox( $addEmptyOption = false, $key = 0, $extra = '' - ) //makeSelBox($name, $prefix = '-', $selected = '', $EmptyOption = false, $key = 0) - { + ) { //makeSelBox($name, $prefix = '-', $selected = '', $EmptyOption = false, $key = 0) $trace = \debug_backtrace(\DEBUG_BACKTRACE_IGNORE_ARGS, 1); \trigger_error("makeSelBox() is deprecated since 2.5.9, please use makeSelectElement(), accessed from {$trace[0]['file']} line {$trace[0]['line']},"); @@ -167,7 +164,7 @@ public function makeSelBox( * @param int $depth level of subcategories * @internal param array $tags fields to be used */ - public function getAllChildObject($key, &$ret, $depth = 0) + public function getAllChildObject($key, &$ret, $depth = 0): void { if (0 == --$depth) { return; @@ -210,7 +207,7 @@ public function &makeObjectTree($key = 0, $depth = 0) * @param array $tags fields to be used * @param int $depth level of subcategories */ - public function getAllChildArray($key, &$ret, array $tags = [], $depth = 0) + public function getAllChildArray($key, &$ret, array $tags = [], $depth = 0): void { if (0 == --$depth) { return; diff --git a/class/OnlineHandler.php b/class/OnlineHandler.php index bb96a9b..259c969 100644 --- a/class/OnlineHandler.php +++ b/class/OnlineHandler.php @@ -6,10 +6,9 @@ * NewBB 5.0x, the forum module for XOOPS project * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) + * @license GNU GPL 2.0 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @author Taiwen Jiang (phppp or D.J.) * @since 4.00 - * @package module::newbb */ use Criteria; @@ -20,7 +19,6 @@ use XoopsModules\Newbb; /** @var \XoopsOnlineHandler $xoopsOnlineHandler */ - require_once \dirname(__DIR__) . '/include/functions.config.php'; /** @@ -36,7 +34,6 @@ class OnlineHandler /** * OnlineHandler constructor. - * @param \XoopsDatabase|null $db */ public function __construct(XoopsDatabase $db = null) { @@ -50,7 +47,7 @@ public function __construct(XoopsDatabase $db = null) * @param null|Newbb\Forum $forum * @param null|Topic $forumtopic */ - public function init($forum = null, $forumtopic = null) + public function init($forum = null, $forumtopic = null): void { if (\is_object($forum)) { $this->forum_id = $forum->getVar('forum_id'); @@ -71,7 +68,7 @@ public function init($forum = null, $forumtopic = null) $this->update(); } - public function update() + public function update(): void { global $xoopsModule; @@ -103,7 +100,7 @@ public function update() /** * @param $xoopsTpl */ - public function render(Smarty $xoopsTpl) + public function render(Smarty $xoopsTpl): void { require_once \dirname(__DIR__) . '/include/functions.render.php'; require_once \dirname(__DIR__) . '/include/functions.user.php'; @@ -209,9 +206,9 @@ public function showOnline() } foreach ($users_online as $uid => $user) { - if (\in_array($uid, $administrator_list)) { + if (\in_array($uid, $administrator_list, true)) { $user['level'] = 2; - } elseif (\in_array($uid, $moderator_list)) { + } elseif (\in_array($uid, $moderator_list, true)) { $user['level'] = 1; } else { $user['level'] = 0; @@ -291,7 +288,7 @@ public function write($uid, $uname, $time, $forum_id, $ip, $topic_id) * * @param int $expire Expiration time in seconds */ - public function gc($expire) + public function gc($expire): void { global $xoopsModule; $sql = 'DELETE FROM ' . $this->db->prefix('newbb_online') . ' WHERE online_updated < ' . (\time() - (int)$expire); @@ -329,6 +326,7 @@ public function getAll($criteria = null) } $this->user_ids = \array_unique($this->user_ids); } + return $ret; } @@ -352,12 +350,12 @@ public function checkStatus($uids) if (!$result) { return $ret; } - while (list($uid) = $this->db->fetchRow($result)) { + while ([$uid] = $this->db->fetchRow($result)) { $online_users[] = $uid; } } foreach ($uids as $uid) { - if (\in_array($uid, $online_users)) { + if (\in_array($uid, $online_users, true)) { $ret[$uid] = 1; } } diff --git a/class/PermissionCategoryHandler.php b/class/PermissionCategoryHandler.php index f69eb63..c5f8afd 100644 --- a/class/PermissionCategoryHandler.php +++ b/class/PermissionCategoryHandler.php @@ -1,4 +1,4 @@ - * @since 4.00 - * @package module::newbb */ use XoopsModules\Newbb; @@ -19,7 +18,6 @@ /** * Class PermissionCategoryHandler - * @package XoopsModules\Newbb */ class PermissionCategoryHandler extends Newbb\PermissionHandler { diff --git a/class/PermissionForumHandler.php b/class/PermissionForumHandler.php index e8ff7a0..0f23887 100644 --- a/class/PermissionForumHandler.php +++ b/class/PermissionForumHandler.php @@ -1,4 +1,4 @@ - * @since 4.00 - * @package module::newbb */ use Xmf\IPAddress; diff --git a/class/PermissionHandler.php b/class/PermissionHandler.php index a6e878a..8ad9396 100644 --- a/class/PermissionHandler.php +++ b/class/PermissionHandler.php @@ -1,4 +1,4 @@ - * @since 4.00 - * @package module::newbb */ use Xmf\Module\Helper\Cache; -/** @var \Xmf\Module\Helper\Cache */ +/** @var \Xmf\Module\Helper\Cache */ \defined('NEWBB_FUNCTIONS_INI') || require $GLOBALS['xoops']->path('modules/newbb/include/functions.ini.php'); \define('NEWBB_HANDLER_PERMISSION', 1); @@ -31,7 +30,8 @@ class PermissionHandler extends \XoopsGroupPermHandler protected $cacheHelper; /** @var array */ private $_handler; - /** @var Helper $helper */ + + /** @var Helper */ private $helper; /** @@ -41,7 +41,7 @@ class PermissionHandler extends \XoopsGroupPermHandler public function __construct(\XoopsDatabase $db = null, $helper = null) { $this->cacheHelper = new Cache('newbb'); - if (null === $helper){ + if (null === $helper) { $helper = Helper::getInstance(); } $this->helper = $helper; @@ -57,8 +57,8 @@ public function __construct(\XoopsDatabase $db = null, $helper = null) public function loadHandler($name) { if (!isset($this->_handler[$name])) { -// $className = '\\XoopsModules\\Newbb\\Permission' . \ucfirst($name) . 'Handler'; -// $this->_handler[$name] = new $className($this->db); + // $className = '\\XoopsModules\\Newbb\\Permission' . \ucfirst($name) . 'Handler'; + // $this->_handler[$name] = new $className($this->db); $this->_handler[$name] = $this->helper->getHandler('Permission' . \ucfirst($name)); } @@ -246,12 +246,12 @@ public function createPermData($perm_name = 'forum_all') unset($module); } - if (\in_array($perm_name, ['forum_all', 'category_all'])) { + if (\in_array($perm_name, ['forum_all', 'category_all'], true)) { /** @var \XoopsMemberHandler $memberHandler */ $memberHandler = \xoops_getHandler('member'); $groups = \array_keys($memberHandler->getGroupList()); - $type = ('category_all' === $perm_name) ? 'Category' : 'Forum'; + $type = ('category_all' === $perm_name) ? 'Category' : 'Forum'; /** @var \XoopsPersistableObjectHandler $objectHandler */ $objectHandler = Helper::getInstance()->getHandler($type); $object_ids = $objectHandler->getIds(); diff --git a/class/Plugin/index.php b/class/Plugin/index.php index 2ea9b7d..b295ab9 100644 --- a/class/Plugin/index.php +++ b/class/Plugin/index.php @@ -1,3 +1,3 @@ - */ -class Plugin extends Userlog\Plugin\PluginAbstract implements Userlog\Plugin\PluginInterface +class userlog extends Userlog\Plugin\PluginAbstract implements Userlog\Plugin\PluginInterface { /** * @param string $subscribe_from Name of the script @@ -50,12 +48,12 @@ class Plugin extends Userlog\Plugin\PluginAbstract implements Userlog\Plugin\Plu * 'allow_bookmark' = 1; * * empty($subscribe_from): - * @return bool|array $script_arr["item_name"] name of the item = array("subscribe_from1", "subscribe_from2") Name of the script + * @return bool|array["item_name"] name of the item = array("subscribe_from1", "subscribe_from2") Name of the script * * !empty($subscribe_from): * @return bool|array $item["item_name"] name of the item, $item["item_id"] id of the item */ - public function item($subscribe_from) + public function item(string $subscribe_from) { if (empty($subscribe_from)) { $script_arr = []; diff --git a/class/Post.php b/class/Post.php index 6d2012b..7718fc6 100644 --- a/class/Post.php +++ b/class/Post.php @@ -1,4 +1,4 @@ - $attach) { - if (\in_array($key, $attachArray)) { + if (\in_array($key, $attachArray, true)) { $file = $GLOBALS['xoops']->path($GLOBALS['xoopsModuleConfig']['dir_attachments'] . '/' . $attach['name_saved']); @\unlink($file); $file = $GLOBALS['xoops']->path($GLOBALS['xoopsModuleConfig']['dir_attachments'] . '/thumbs/' . $attach['name_saved']); // delete thumbnails @@ -168,14 +168,13 @@ public function setAttachment($name_saved = '', $nameDisplay = '', $mimetype = ' $key = (string)(\time() + $counter++); $this->attachmentArray[$key] = [ 'name_saved' => $name_saved, - // BigKev73 > without this change the nameDisplay will always get set to the $name_Saved, so in the forum it will show the on-disk filename instead of the name of the orginal file + // BigKev73 > without this change the nameDisplay will always get set to the $name_Saved, so in the forum it will show the on-disk filename instead of the name of the orginal file //'nameDisplay' => empty($nameDisplay) ? $nameDisplay : $name_saved, 'nameDisplay' => !empty($nameDisplay) ? $nameDisplay : $name_saved, 'mimetype' => $mimetype, // BigKev73 > without this change the numDownload will always be set to 0 //'numDownload' => empty($numDownload) ? (int)$numDownload : 0, 'numDownload' => !empty($numDownload) ? (int)$numDownload : 0, - ]; } $attachmentSave = null; @@ -216,7 +215,7 @@ public function displayAttachment($asSource = false) $file_size = @\filesize($GLOBALS['xoops']->path($GLOBALS['xoopsModuleConfig']['dir_attachments'] . '/' . $att['name_saved'])); $file_size = \number_format($file_size / 1024, 2) . ' KB'; if ($GLOBALS['xoopsModuleConfig']['media_allowed'] - && \in_array(mb_strtolower($file_extension), $image_extensions)) { + && \in_array(mb_strtolower($file_extension), $image_extensions, true)) { $post_attachment .= '
      ' . $filetype . '  ' . $att['nameDisplay'] . ' (' . $file_size . ')'; $post_attachment .= '
      ' . \newbbAttachmentImage($att['name_saved']); $isDisplayed = true; @@ -291,7 +290,7 @@ public function setPostEdit($poster_name = '', $post_editmsg = '') if (empty($GLOBALS['xoopsModuleConfig']['recordedit_timelimit']) || $this->getVar('approved') < 1 || (\time() - $this->getVar('post_time')) < $GLOBALS['xoopsModuleConfig']['recordedit_timelimit'] * 60 - ) { + ) { return true; } if (\is_object($GLOBALS['xoopsUser']) && $GLOBALS['xoopsUser']->isActive()) { @@ -509,7 +508,7 @@ public function showPost($isAdmin) $post_text = "
      " . \sprintf(\_MD_NEWBB_KARMA_REQUIREMENT, $user_karma, $this->getVar('post_karma')) . '
      '; $post_attachment = ''; } elseif ($GLOBALS['xoopsModuleConfig']['allow_require_reply'] && $this->getVar('require_reply') - && (!$uid || !\in_array($uid, $viewtopic_posters))) { + && (!$uid || !\in_array($uid, $viewtopic_posters, true))) { $post_text = "
      " . \_MD_NEWBB_REPLY_REQUIREMENT . '
      '; $post_attachment = ''; } else { @@ -557,7 +556,7 @@ public function showPost($isAdmin) } if ($GLOBALS['xoopsModuleConfig']['enable_permcheck']) { - // /** @var TopicHandler $topicHandler */ + // /** @var TopicHandler $topicHandler */ // $topicHandler = Newbb\Helper::getInstance()->getHandler('Topic'); $topic_status = $topicObject->getVar('topic_status'); if ($topicHandler->getPermission($forum_id, $topic_status, 'edit')) { @@ -635,16 +634,16 @@ public function showPost($isAdmin) $full_title = $this->getVar('subject'); $clean_title = \preg_replace('/[^A-Za-z0-9-]+/', '+', $this->getVar('subject')); // BigKev73 - added to make page scroll to the last post - $full_link = XOOPS_URL . '/modules/newbb/viewtopic.php?post_id=' . $post_id . '#forumpost='. $post_id; + $full_link = XOOPS_URL . '/modules/newbb/viewtopic.php?post_id=' . $post_id . '#forumpost=' . $post_id; //$full_link = XOOPS_URL . '/modules/newbb/viewtopic.php?post_id=' . $post_id; $thread_action['social_twitter']['image'] = \newbbDisplayImage('twitter', \_MD_NEWBB_SHARE_TWITTER); - $thread_action['social_twitter']['link'] = 'http://twitter.com/share?text=' . $clean_title . '&url=' . $full_link; + $thread_action['social_twitter']['link'] = 'https://twitter.com/share?text=' . $clean_title . '&url=' . $full_link; $thread_action['social_twitter']['name'] = \_MD_NEWBB_SHARE_TWITTER; $thread_action['social_twitter']['target'] = '_blank'; $thread_action['social_facebook']['image'] = \newbbDisplayImage('facebook', \_MD_NEWBB_SHARE_FACEBOOK); - $thread_action['social_facebook']['link'] = 'http://www.facebook.com/sharer.php?u=' . $full_link; + $thread_action['social_facebook']['link'] = 'https://www.facebook.com/sharer.php?u=' . $full_link; $thread_action['social_facebook']['name'] = \_MD_NEWBB_SHARE_FACEBOOK; $thread_action['social_facebook']['target'] = '_blank'; @@ -653,27 +652,27 @@ public function showPost($isAdmin) $thread_action['social_gplus']['target'] = '_blank'; $thread_action['social_linkedin']['image'] = \newbbDisplayImage('linkedin', \_MD_NEWBB_SHARE_LINKEDIN); - $thread_action['social_linkedin']['link'] = 'http://www.linkedin.com/shareArticle?mini=true&title=' . $full_title . '&url=' . $full_link; + $thread_action['social_linkedin']['link'] = 'https://www.linkedin.com/shareArticle?mini=true&title=' . $full_title . '&url=' . $full_link; $thread_action['social_linkedin']['name'] = \_MD_NEWBB_SHARE_LINKEDIN; $thread_action['social_linkedin']['target'] = '_blank'; $thread_action['social_delicious']['image'] = \newbbDisplayImage('delicious', \_MD_NEWBB_SHARE_DELICIOUS); - $thread_action['social_delicious']['link'] = 'http://del.icio.us/post?title=' . $full_title . '&url=' . $full_link; + $thread_action['social_delicious']['link'] = 'https://del.icio.us/post?title=' . $full_title . '&url=' . $full_link; $thread_action['social_delicious']['name'] = \_MD_NEWBB_SHARE_DELICIOUS; $thread_action['social_delicious']['target'] = '_blank'; $thread_action['social_digg']['image'] = \newbbDisplayImage('digg', \_MD_NEWBB_SHARE_DIGG); - $thread_action['social_digg']['link'] = 'http://digg.com/submit?phase=2&title=' . $full_title . '&url=' . $full_link; + $thread_action['social_digg']['link'] = 'https://digg.com/submit?phase=2&title=' . $full_title . '&url=' . $full_link; $thread_action['social_digg']['name'] = \_MD_NEWBB_SHARE_DIGG; $thread_action['social_digg']['target'] = '_blank'; $thread_action['social_reddit']['image'] = \newbbDisplayImage('reddit', \_MD_NEWBB_SHARE_REDDIT); - $thread_action['social_reddit']['link'] = 'http://reddit.com/submit?title=' . $full_title . '&url=' . $full_link; + $thread_action['social_reddit']['link'] = 'https://reddit.com/submit?title=' . $full_title . '&url=' . $full_link; $thread_action['social_reddit']['name'] = \_MD_NEWBB_SHARE_REDDIT; $thread_action['social_reddit']['target'] = '_blank'; $thread_action['social_wong']['image'] = \newbbDisplayImage('wong', \_MD_NEWBB_SHARE_MRWONG); - $thread_action['social_wong']['link'] = 'http://www.mister-wong.de/index.php?action=addurl&bm_url=' . $full_link; + $thread_action['social_wong']['link'] = 'https://www.mister-wong.de/index.php?action=addurl&bm_url=' . $full_link; $thread_action['social_wong']['name'] = \_MD_NEWBB_SHARE_MRWONG; $thread_action['social_wong']['target'] = '_blank'; } @@ -698,9 +697,8 @@ public function showPost($isAdmin) 'mod_buttons' => $mod_buttons, 'poster' => $poster, //Modified by BigKev73 - 'post_permalink' => '', + 'post_permalink' => '', - //'post_permalink' => '', ]; diff --git a/class/PostHandler.php b/class/PostHandler.php index 2254f5e..7715176 100644 --- a/class/PostHandler.php +++ b/class/PostHandler.php @@ -1,4 +1,4 @@ -type) ? 'LF' : 'LT'; $lastview = \newbbGetCookie($cookie_name, true); diff --git a/class/Readforum.php b/class/Readforum.php index e2e306d..dfe7910 100644 --- a/class/Readforum.php +++ b/class/Readforum.php @@ -1,4 +1,4 @@ - * @since 4.00 - * @package module::newbb */ - \defined('NEWBB_FUNCTIONS_INI') || require $GLOBALS['xoops']->path('modules/newbb/include/functions.ini.php'); /** diff --git a/class/ReportHandler.php b/class/ReportHandler.php index 06ecf68..cde540d 100644 --- a/class/ReportHandler.php +++ b/class/ReportHandler.php @@ -1,4 +1,4 @@ - * @since 4.00 - * @package module::newbb */ - \defined('NEWBB_FUNCTIONS_INI') || require $GLOBALS['xoops']->path('modules/newbb/include/functions.ini.php'); /** @@ -101,13 +99,14 @@ public function getAllReports($forums = 0, $order = 'ASC', $perpage = 0, &$start $ret[] = $myrow; // return as array } } + return $ret; } /** * @return void */ - public function synchronization() + public function synchronization(): void { // return; } diff --git a/class/StatsHandler.php b/class/StatsHandler.php index 8a0abe3..9abaf1b 100644 --- a/class/StatsHandler.php +++ b/class/StatsHandler.php @@ -1,4 +1,4 @@ - * @since 4.00 - * @package module::newbb */ - \defined('NEWBB_FUNCTIONS_INI') || require __DIR__ . '/functions.ini.php'; \define('NEWBB_STATS_TYPE_TOPIC', 1); @@ -162,7 +160,7 @@ public function getStats(array $ids = [], array $types = [], array $periods = [] return $ret; } - public function reset() + public function reset(): void { $this->db->queryF('TRUNCATE TABLE ' . $this->table); $now = \time(); @@ -175,7 +173,7 @@ public function reset() $sql = ' SELECT forum_id' . ' FROM ' . $this->db->prefix('newbb_forums'); $ret = $this->db->query($sql); - while (list($forum_id) = $this->db->fetchRow($ret)) { + while ([$forum_id] = $this->db->fetchRow($ret)) { $sql = ' SELECT COUNT(*), SUM(topic_views)' . ' FROM ' . $this->db->prefix('newbb_topics') . " WHERE approved=1 AND forum_id = {$forum_id}"; $result = $this->db->query($sql); [$topics, $views] = $this->db->fetchRow($result); diff --git a/class/Text.php b/class/Text.php index 903465c..a23344c 100644 --- a/class/Text.php +++ b/class/Text.php @@ -1,4 +1,4 @@ - * @since 4.00 - * @package module::newbb */ - \defined('NEWBB_FUNCTIONS_INI') || require $GLOBALS['xoops']->path('modules/newbb/include/functions.ini.php'); /** diff --git a/class/TextHandler.php b/class/TextHandler.php index 6d7331b..fe4e495 100644 --- a/class/TextHandler.php +++ b/class/TextHandler.php @@ -1,4 +1,4 @@ - * @since 4.00 - * @package module::newbb */ - \defined('NEWBB_FUNCTIONS_INI') || require $GLOBALS['xoops']->path('modules/newbb/include/functions.ini.php'); /** diff --git a/class/Topic.php b/class/Topic.php index f4d03ce..b7d319f 100644 --- a/class/Topic.php +++ b/class/Topic.php @@ -1,4 +1,4 @@ - * @since 4.00 - * @package module::newbb */ use XoopsModules\Newbb; @@ -48,7 +47,7 @@ public function __construct() } // irmtfan add LAST_INSERT_ID to enhance the mysql performances - public function incrementCounter() + public function incrementCounter(): void { $sql = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix('newbb_topics') . ' SET topic_views = LAST_INSERT_ID(topic_views + 1) WHERE topic_id =' . $this->getVar('topic_id'); $GLOBALS['xoopsDB']->queryF($sql); @@ -80,9 +79,8 @@ public function getFullTitle() /** * Load functions needed for old xoopspoll (older than version 1.4 by zyspec) and umfrage modules * - * @access public * @param string $pollModule dirname of the poll module - * @return string|false $classPoll = the name of the old poll class eg: "XoopsPoll" | "Umfrage" + * @return string|false = the name of the old poll class eg: "XoopsPoll" | "Umfrage" */ public function loadOldPoll($pollModule = null) { @@ -117,7 +115,6 @@ public function loadOldPoll($pollModule = null) /** * delete a poll in database * - * @access public * @param int $poll_id * @return bool */ @@ -170,7 +167,6 @@ public function deletePoll($poll_id) /** * get a poll object from a poll module. * note: can be used to find if a poll exist in a module - * @access public * @param int $poll_id * @param string $pollModule dirname of the poll module * @return bool|\XoopsObject poll diff --git a/class/TopicHandler.php b/class/TopicHandler.php index ebfa1c5..0f97491 100644 --- a/class/TopicHandler.php +++ b/class/TopicHandler.php @@ -1,4 +1,4 @@ - * @since 4.00 - * @package module::newbb */ use XoopsModules\Newbb; @@ -56,7 +55,7 @@ public function get($id = null, $fields = null) //get($id, $var = null) /** * @param \XoopsObject $object - * @param bool $force + * @param bool $force * @return mixed */ public function insert(\XoopsObject $object, $force = true) @@ -69,9 +68,8 @@ public function insert(\XoopsObject $object, $force = true) } $newbbConfig = \newbbLoadConfig(); - if (!empty($newbbConfig['do_tag']) && \class_exists('TagFormTag') - && @require $GLOBALS['xoops']->path('modules/tag/include/functions.php')) { - $tagHandler = \tag_getTagHandler(); + if (!empty($newbbConfig['do_tag']) && \class_exists('XoopsModules\Tag\FormTag')) { + $tagHandler = Tag\Helper::getInstance()->getHandler('Tag'); if ($tagHandler) { $tagHandler->updateByItem($object->getVar('topic_tags', 'n'), $object->getVar('topic_id'), 'newbb'); } @@ -125,7 +123,6 @@ public function approve($object, $force = false) *
    • >0 : inside the forum
    • *
    • <= 0: global
    • *
    - * @access public * @return mixed|null|\XoopsObject */ public function &getByMove($topic_id, $action, $forum_id = 0) @@ -261,9 +258,7 @@ public function getNextPostId($topic_id, $lastreadpost_id) return $post_id; } - - - + /** * @param $topic * @param string $order @@ -391,6 +386,7 @@ public function getAllPosters($topic, $isApproved = true) $ret[] = $myrow['uid']; } } + return $ret; } @@ -497,7 +493,7 @@ public function cleanExpires($expire = 0) /** * @param \XoopsObject|int|string|null $object - * @param bool $force + * @param bool $force * @return bool */ public function synchronization($object = null, $force = true) @@ -543,7 +539,6 @@ public function synchronization($object = null, $force = true) /** * get all active poll modules in the current xoops installtion. - * @access public * @return array $pollDirs = array($dirname1=>$dirname1, $dirname2=>$dirname2, ...) dirnames of all active poll modules */ public function getActivePolls() @@ -566,9 +561,8 @@ public function getActivePolls() /** * find poll module that is in used in the current newbb installtion. - * @access public * @param array $pollDirs dirnames of all active poll modules - * @return bool|string $dir_def | true | false + * @return bool|string | true | false * $dir_def: dirname of poll module that is in used in the current newbb installtion. * true: no poll module is installed | newbb has no topic with poll | newbb has no topic * false: errors (see below xoops_errors) diff --git a/class/TopicRenderer.php b/class/TopicRenderer.php index 0db1151..8997c17 100644 --- a/class/TopicRenderer.php +++ b/class/TopicRenderer.php @@ -1,4 +1,4 @@ - * @since 4.00 - * @package module::newbb */ use Xmf\Request; @@ -20,7 +19,6 @@ * * @author D.J. (phppp) * @copyright copyright © Xoops Project - * @package module::newbb */ class TopicRenderer { @@ -81,7 +79,7 @@ public static function getInstance() return $instance; } - public function init() + public function init(): void { $this->noperm = false; $this->query = []; @@ -134,12 +132,12 @@ public function setVar($var, $val) /** * @param array $vars */ - public function setVars(array $vars = []) + public function setVars(array $vars = []): void { $this->init(); foreach ($vars as $var => $val) { - if (!\in_array($var, $this->args)) { + if (!\in_array($var, $this->args, true)) { continue; } } @@ -149,7 +147,7 @@ public function setVars(array $vars = []) /** * @param string $hash request hash, i.e. get, post */ - public function setVarsFromRequest($hash = 'get') + public function setVarsFromRequest($hash = 'get'): void { $this->init(); @@ -173,7 +171,7 @@ public function setVarsFromRequest($hash = 'get') /** * @param null $status */ - public function myParseStatus($status = null) + public function myParseStatus($status = null): void { switch ($status) { case 'digest': @@ -325,7 +323,7 @@ public function myParseStatus($status = null) * @param $var * @param $val */ - public function parseVar($var, $val) + public function parseVar($var, $val): void { switch ($var) { case 'forum': @@ -365,12 +363,12 @@ public function parseVar($var, $val) if (!empty($val)) { // START irmtfan if unread && read_mode = 1 and last_visit > startdate do not add where query | to accept multiple status $startdate = \time() - \newbbGetSinceTime($val); - if (\in_array('unread', \explode(',', $this->vars['status'])) && 1 == $this->config['read_mode'] + if (\in_array('unread', \explode(',', $this->vars['status']), true) && 1 == $this->config['read_mode'] && $GLOBALS['last_visit'] > $startdate) { break; } // irmtfan digest_time | to accept multiple status - if (\in_array('digest', \explode(',', $this->vars['status']))) { + if (\in_array('digest', \explode(',', $this->vars['status']), true)) { $this->query['where'][] = 't.digest_time > ' . $startdate; } // irmtfan - should be >= instead of = @@ -617,7 +615,7 @@ public function getStatus($type = null, $status = null) * @param \Smarty $xoopsTpl * @throws \RuntimeException */ - public function buildSelection(\Smarty $xoopsTpl) + public function buildSelection(\Smarty $xoopsTpl): void { $selection = ['action' => $this->page]; $selection['vars'] = $this->vars; @@ -653,7 +651,7 @@ public function buildSelection(\Smarty $xoopsTpl) /** * @param \Smarty $xoopsTpl */ - public function buildSearch(\Smarty $xoopsTpl) + public function buildSearch(\Smarty $xoopsTpl): void { $search = []; $search['forum'] = @$this->vars['forum']; @@ -667,7 +665,7 @@ public function buildSearch(\Smarty $xoopsTpl) * @param \Smarty $xoopsTpl * @throws \RuntimeException */ - public function buildHeaders(\Smarty $xoopsTpl) + public function buildHeaders(\Smarty $xoopsTpl): void { $args = []; foreach ($this->vars as $var => $val) { @@ -695,7 +693,7 @@ public function buildHeaders(\Smarty $xoopsTpl) /** * @param \Smarty $xoopsTpl */ - public function buildFilters(\Smarty $xoopsTpl) + public function buildFilters(\Smarty $xoopsTpl): void { $args = []; foreach ($this->vars as $var => $val) { @@ -790,7 +788,7 @@ public function buildCurrent(\Smarty $xoopsTpl) /** * @param \Smarty $xoopsTpl */ - public function buildPagenav(\Smarty $xoopsTpl) + public function buildPagenav(\Smarty $xoopsTpl): void { $count_topic = $this->getCount(); if ($count_topic > $this->config['topics_per_page']) { @@ -966,10 +964,10 @@ public function renderTopics(\Smarty $xoopsTpl = null) } } // BigKev73 - Added to make jump ICON, jump and scroll to the correct "last post" - $topic_page_jump_icon = "" . \newbbDisplayImage('lastposticon', \_MD_NEWBB_GOTOLASTPOST) . ''; - + $topic_page_jump_icon = "" . \newbbDisplayImage('lastposticon', \_MD_NEWBB_GOTOLASTPOST) . ''; + // irmtfan - move here for both topics with and without pages - change topic_id to post_id - //$topic_page_jump_icon = "" . newbbDisplayImage('lastposticon', _MD_NEWBB_GOTOLASTPOST) . ''; + //$topic_page_jump_icon = "" . newbbDisplayImage('lastposticon', _MD_NEWBB_GOTOLASTPOST) . ''; // ------------------------------------------------------ // => topic array @@ -1108,7 +1106,7 @@ public function renderTopics(\Smarty $xoopsTpl = null) $sql = ' SELECT DISTINCT topic_id FROM ' . $this->handler->db->prefix('newbb_posts') . " WHERE attachment != ''" . ' AND topic_id IN (' . \implode(',', \array_keys($topics)) . ')'; $result = $this->handler->db->query($sql); if ($result) { - while (list($topic_id) = $this->handler->db->fetchRow($result)) { + while ([$topic_id] = $this->handler->db->fetchRow($result)) { $topics[$topic_id]['attachment'] = ' ' . \newbbDisplayImage('attachment', \_MD_NEWBB_TOPICSHASATT); } } diff --git a/class/Tree.php b/class/Tree.php index 1d7ff19..98aac44 100644 --- a/class/Tree.php +++ b/class/Tree.php @@ -1,4 +1,4 @@ -path('class/xoopstree.php'); /** @@ -50,7 +48,7 @@ public function __construct($table_name, $id_name = 'post_id', $pid_name = 'pid' /** * @param string $val */ - public function setPrefix($val = '') + public function setPrefix($val = ''): void { $this->prefix = $val; $this->increment = $val; @@ -60,7 +58,7 @@ public function setPrefix($val = '') * @param $sel_id * @param string $order */ - public function getAllPostArray($sel_id, $order = '') + public function getAllPostArray($sel_id, $order = ''): void { $this->postArray = $this->getAllChild($sel_id, $order); } @@ -68,7 +66,7 @@ public function getAllPostArray($sel_id, $order = '') /** * @param $postArray */ - public function setPostArray($postArray) + public function setPostArray($postArray): void { $this->postArray = $postArray; } @@ -76,9 +74,9 @@ public function setPostArray($postArray) // returns an array of first child objects for a given id($sel_id) /** - * @param $postTree_array - * @param int $pid - * @param string $prefix + * @param mixed $postTree_array + * @param int $pid + * @param string $prefix * @return bool */ public function getPostTree(&$postTree_array, $pid = 0, $prefix = '  ') diff --git a/class/Type.php b/class/Type.php index bcff68c..1877598 100644 --- a/class/Type.php +++ b/class/Type.php @@ -1,4 +1,4 @@ - * @since 4.00 - * @package module::newbb */ /** @@ -17,7 +16,6 @@ * * @author D.J. (phppp) * @copyright copyright © 2006 XoopsForge.com - * @package module::newbb **/ class Type extends \XoopsObject { diff --git a/class/TypeHandler.php b/class/TypeHandler.php index 5729827..afbc9d0 100644 --- a/class/TypeHandler.php +++ b/class/TypeHandler.php @@ -1,4 +1,4 @@ - * @since 4.00 - * @package module::newbb */ /** * Type object handler class. - * @package module::newbb * * @author D.J. (phppp) * @copyright copyright © 2006 XOOPS Project @@ -62,6 +60,7 @@ public function getByForum($forums = null) ]; } } + return $ret; } diff --git a/class/Uploader.php b/class/Uploader.php index 80d08ad..8f359fa 100644 --- a/class/Uploader.php +++ b/class/Uploader.php @@ -1,4 +1,4 @@ - * @since 4.00 - * @package module::newbb */ - require_once $GLOBALS['xoops']->path('class/uploader.php'); /** @@ -66,7 +64,7 @@ public function __construct($uploadDir, $allowedMimeTypes = 0, $maxFileSize = 0, * * @param bool|string $value */ - public function setCheckMediaTypeByExt($value = true) + public function setCheckMediaTypeByExt($value = true): void { } @@ -76,7 +74,7 @@ public function setCheckMediaTypeByExt($value = true) * * @param string $value */ - public function setImageSizeCheck($value) + public function setImageSizeCheck($value): void { } @@ -86,7 +84,7 @@ public function setImageSizeCheck($value) * * @param string $value */ - public function setFileSizeCheck($value) + public function setFileSizeCheck($value): void { } diff --git a/class/User.php b/class/User.php index a9d8ee4..1503ebf 100644 --- a/class/User.php +++ b/class/User.php @@ -1,4 +1,4 @@ - * @since 4.00 - * @package module::newbb */ - \defined('NEWBB_FUNCTIONS_INI') || require $GLOBALS['xoops']->path('modules/newbb/include/functions.ini.php'); /** @@ -142,7 +140,7 @@ public function getUserbar() $icq = $user->getVar('user_icq'); if ($icq) { $userbar['icq'] = [ - 'link' => "javascript:void window.open('http://wwp.icq.com/scripts/search.dll?to=" . $icq . "', 'new');", + 'link' => "javascript:void window.open('https://wwp.icq.com/scripts/search.dll?to=" . $icq . "', 'new');", 'name' => \_MD_NEWBB_ICQ, ]; } @@ -156,14 +154,14 @@ public function getUserbar() $yim = $user->getVar('user_yim'); if ($yim) { $userbar['yim'] = [ - 'link' => "javascript:void window.open('http://edit.yahoo.com/config/send_webmesg?.target=" . $yim . '&.src=pg' . "', 'new');", + 'link' => "javascript:void window.open('https://edit.yahoo.com/config/send_webmesg?.target=" . $yim . '&.src=pg' . "', 'new');", 'name' => \_MD_NEWBB_YIM, ]; } $msn = $user->getVar('user_msnm'); if ($msn) { $userbar['msnm'] = [ - 'link' => "javascript:void window.open('http://members.msn.com?mem=" . $msn . "', 'new');", + 'link' => "javascript:void window.open('https://members.msn.com?mem=" . $msn . "', 'new');", 'name' => \_MD_NEWBB_MSNM, ]; } diff --git a/class/UserHandler.php b/class/UserHandler.php index 2e9335a..858bd23 100644 --- a/class/UserHandler.php +++ b/class/UserHandler.php @@ -1,4 +1,4 @@ - * @since 4.00 - * @package module::newbb */ use XoopsModules\Newbb; @@ -40,7 +39,7 @@ public function __construct($enableGroup = true, $enableOnline = true) $this->enableOnline = $enableOnline; } - public function loadUserInfo() + public function loadUserInfo(): void { $helper = Helper::getInstance(); $helper->loadLanguage('user'); @@ -55,7 +54,7 @@ public function loadUserInfo() } } - public function loadUserOnline() + public function loadUserOnline(): void { if (empty($this->users) || !$this->enableOnline) { return; @@ -80,7 +79,7 @@ public function loadUserOnline() // } // END irmtfan remove function - no deprecated is needed because just use in this file - public function loadUserDigest() + public function loadUserDigest(): void { if (empty($this->users)) { return; diff --git a/class/Userstats.php b/class/Userstats.php index 3cbeb2e..0b97a15 100644 --- a/class/Userstats.php +++ b/class/Userstats.php @@ -1,4 +1,4 @@ - * @since 4.00 - * @package module::newbb */ - \defined('NEWBB_FUNCTIONS_INI') || require $GLOBALS['xoops']->path('modules/newbb/include/functions.ini.php'); /** diff --git a/class/UserstatsHandler.php b/class/UserstatsHandler.php index 5f72b1b..66292ad 100644 --- a/class/UserstatsHandler.php +++ b/class/UserstatsHandler.php @@ -1,4 +1,4 @@ - * @since 4.00 - * @package module::newbb */ - \defined('NEWBB_FUNCTIONS_INI') || require $GLOBALS['xoops']->path('modules/newbb/include/functions.ini.php'); /** diff --git a/class/Utility.php b/class/Utility.php index e928473..85b99a1 100644 --- a/class/Utility.php +++ b/class/Utility.php @@ -1,4 +1,4 @@ - * @since 4.00 - * @package module::newbb */ - \defined('NEWBB_FUNCTIONS_INI') || require $GLOBALS['xoops']->path('modules/newbb/include/functions.ini.php'); //load_functions('locale'); @@ -62,7 +60,7 @@ public function __construct() * @param $var * @param $val */ - public function setVarRss($var, $val) + public function setVarRss($var, $val): void { $this->$var = $this->cleanup($val); } diff --git a/class/XmlrssHandler.php b/class/XmlrssHandler.php index d07f1df..ae2fc33 100644 --- a/class/XmlrssHandler.php +++ b/class/XmlrssHandler.php @@ -1,4 +1,4 @@ - * @since 4.00 - * @package module::newbb */ use XoopsModules\Newbb; diff --git a/class/index.php b/class/index.php index 2ea9b7d..b295ab9 100644 --- a/class/index.php +++ b/class/index.php @@ -1,3 +1,3 @@ - * @since 4.00 - * @package module::newbb */ use Criteria; -use XoopsModules\Newbb\{ - Helper -}; use XoopsModules\Tag; /** @@ -78,7 +74,7 @@ function newbb_tag_iteminfo(&$items) * * @param $mid */ -function newbb_tag_synchronization($mid) +function newbb_tag_synchronization($mid): void { /** @var TopicHandler $itemHandler */ $itemHandler = Helper::getInstance()->getHandler('Topic'); diff --git a/class/xoopsformloader.php b/class/xoopsformloader.php index 0c84774..17989c3 100644 --- a/class/xoopsformloader.php +++ b/class/xoopsformloader.php @@ -1,5 +1,4 @@ -path('Frameworks/compat/class/xoopsformloader.php')) { require_once $GLOBALS['xoops']->path('class/xoopsformloader.php'); diff --git a/config/config.php b/config/config.php index 2c65c42..f93586e 100644 --- a/config/config.php +++ b/config/config.php @@ -1,4 +1,4 @@ - [// 'XX_archive' => 'ZZZZ_archive', + 'renameTables' => [// 'XX_archive' => 'ZZZZ_archive', ], 'renameColumns' => [// 'extcal_event' => ['from' => 'event_etablissement', 'to' => 'event_location'], ], - 'moduleStats' => [ + 'moduleStats' => [ // 'totalcategories' => $helper->getHandler('Category')->getCategoriesCount(-1), // 'totalitems' => $helper->getHandler('Item')->getItemsCount(), // 'totalsubmitted' => $helper->getHandler('Item')->getItemsCount(-1, [Constants::PUBLISHER_STATUS_SUBMITTED]), ], - 'modCopyright' => " + 'modCopyright' => " XOOPS Project", ]; - diff --git a/config/icons.php b/config/icons.php index 92d718d..a43bdff 100644 --- a/config/icons.php +++ b/config/icons.php @@ -1,14 +1,12 @@ - \mb_strtoupper($moduleDirName) . ' IconConfigurator', +return [ + 'name' => \mb_strtoupper($moduleDirName) . ' IconConfigurator', 'edit' => " . _EDIT . ' title=' . _EDIT . ", 'delete' => " . _DELETE . ' title=' . _DELETE . ", 'clone' => " . _CLONE . ' title=' . _CLONE . ", diff --git a/config/imageconfig.php b/config/imageconfig.php index b418130..85852b6 100644 --- a/config/imageconfig.php +++ b/config/imageconfig.php @@ -1,4 +1,4 @@ - * @since 4.00 - * @package module::newbb */ use Xmf\Request; use XoopsModules\Newbb\{ OnlineHandler, - StatsHandler, - Post + Post, + StatsHandler }; /** @var StatsHandler $statsHandler */ /** @var OnlineHandler $onlineHandler */ @@ -21,7 +21,6 @@ /** @var ForumHandler $forumHandler */ /** @var TopicHandler $topicHandler */ /** @var PostHandler $postHandler */ - require_once __DIR__ . '/header.php'; $ok = Request::getInt('ok', 0, 'POST'); diff --git a/digest.php b/digest.php index 77889cd..ea4d9fb 100644 --- a/digest.php +++ b/digest.php @@ -1,12 +1,12 @@ - * @since 4.00 - * @package module::newbb */ use XoopsModules\Newbb\{ diff --git a/dl_attachment.php b/dl_attachment.php index ae627ef..bf1c14f 100644 --- a/dl_attachment.php +++ b/dl_attachment.php @@ -1,12 +1,12 @@ - * @since 4.00 - * @package module::newbb */ use Xmf\Request; @@ -20,7 +20,6 @@ /** @var PostHandler $postHandler */ /** @var TopicHandler $topicHandler */ /** @var ForumHandler $forumHandler */ - ob_start(); require_once __DIR__ . '/header.php'; require_once $GLOBALS['xoops']->path('header.php'); diff --git a/docs/changelog.txt b/docs/changelog.txt index 2523f74..32afd87 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -10,8 +10,6 @@ - cosmetics and PHP 8 adjustments (mamba) - -
    5.01 Beta 4 [2021-03-21]
    Dev: XOOPS 2.5.11, PHP 7.4.16, PHP 8.0.3
    - Update functions.image.php (BigKev73) diff --git a/docs/index.php b/docs/index.php index 2ea9b7d..b295ab9 100644 --- a/docs/index.php +++ b/docs/index.php @@ -1,3 +1,3 @@ - * @since 4.00 - * @package module::newbb */ use Xmf\Request; @@ -21,8 +21,7 @@ PostHandler, StatsHandler, Topic, - TopicHandler, - Tree + TopicHandler }; /** @var Category $categories */ /** @var CategoryHandler $categoryHandler */ @@ -36,7 +35,6 @@ /** @var StatsHandler $statsHandler */ /** @var Topic $topicObject */ /** @var TopicHandler $topicHandler */ - require_once __DIR__ . '/header.php'; foreach (['forum', 'topic_id', 'post_id', 'order'] as $getint) { @@ -50,7 +48,7 @@ $forumHandler = Helper::getInstance()->getHandler('Forum'); $topicHandler = Helper::getInstance()->getHandler('Topic'); -$postHandler = Helper::getInstance()->getHandler('Post'); +$postHandler = Helper::getInstance()->getHandler('Post'); $postObject = $postHandler->get($post_id); $topicObject = $topicHandler->get($postObject->getVar('topic_id')); diff --git a/footer.php b/footer.php index b05e123..2a34ecd 100644 --- a/footer.php +++ b/footer.php @@ -1,4 +1,4 @@ - * @author The Persian Xoops Support Site */ - global $xoTheme; require_once $GLOBALS['xoops']->path('modules/newbb/include/functions.render.php'); diff --git a/header.php b/header.php index f14ee9f..df9d4ae 100644 --- a/header.php +++ b/header.php @@ -1,17 +1,18 @@ - * @since 4.00 - * @package module::newbb */ use Xmf\Request; -use XoopsModules\Newbb\{Helper, +use XoopsModules\Newbb\{ ForumHandler, + Helper, PostHandler, TopicHandler }; @@ -20,7 +21,6 @@ /** @var ForumHandler $forumHandler */ /** @var TopicHandler $topicHandler */ /** @var PostHandler $postHandler */ - require_once \dirname(__DIR__, 2) . '/mainfile.php'; require_once __DIR__ . '/include/common.php'; @@ -32,7 +32,7 @@ $forumHandler = Helper::getInstance()->getHandler('Forum'); $topicHandler = Helper::getInstance()->getHandler('Topic'); -$postHandler = Helper::getInstance()->getHandler('Post'); +$postHandler = Helper::getInstance()->getHandler('Post'); /** @var \XoopsLogger $xoopsLogger */ $xoopsLogger->startTime('newBB_Header'); @@ -51,7 +51,7 @@ $redir = false; if (true === mb_strpos(getenv('REQUEST_URI'), 'mark_read=') || true === mb_strpos(getenv('REQUEST_URI'), 'mark=')) { // Mark Forums - } elseif (in_array(basename(getenv('SCRIPT_NAME')), $toseo_url)) { + } elseif (in_array(basename(getenv('SCRIPT_NAME')), $toseo_url, true)) { //rewrite only for files if ('' !== trim(getenv('SCRIPT_NAME'))) { @@ -64,7 +64,7 @@ } if (true === $redir) { - $s = 'http://' . getenv('HTTP_HOST') . getenv('REQUEST_URI'); + $s = 'https://' . getenv('HTTP_HOST') . getenv('REQUEST_URI'); $s = str_replace('/' . REAL_MODULE_NAME . '/', '/' . SEO_MODULE_NAME . '/', $s); $newurl = seo_urls(''); $newurl = str_replace('' . $forum['prefix'] . $forum['forum_name'] . "\n"; + $box .= "\n"; } } } else { @@ -99,7 +98,7 @@ function newbbMakeJumpbox($forum_id = 0) $box .= ''; $box .= newbbForumSelectBox($forum_id); $box .= " "; -// unset($forums, $categories); + // unset($forums, $categories); return $box; } diff --git a/include/functions.image.php b/include/functions.image.php index 5daf9e5..7425ed6 100644 --- a/include/functions.image.php +++ b/include/functions.image.php @@ -1,4 +1,4 @@ - 0) ? $imginfo[0] . 'X' . $imginfo[1] . ' px' : ''; + $img_info = (count($imginfo) > 0) ? $imginfo[0] . 'X' . $imginfo[1] . ' px' : ''; //} if ($GLOBALS['xoopsModuleConfig']['max_image_width'] > 0 @@ -50,24 +50,24 @@ function newbbAttachmentImage($source) } } } - + //BigKev73 Change to remove height value - - if ($imginfo[0] > $GLOBALS['xoopsModuleConfig']['max_image_width'] - || $imginfo[1] > $GLOBALS['xoopsModuleConfig']['max_image_height']) { - $pseudo_width = $GLOBALS['xoopsModuleConfig']['max_image_width']; - $pseudo_height = $GLOBALS['xoopsModuleConfig']['max_image_width'] * ($imginfo[1] / $imginfo[0]); - $pseudo_size = "width='" . $pseudo_width . "' height='" . $pseudo_height ."'"; - } - // irmtfan to fix Undefined variable: pseudo_height - if (!empty($pseudo_height) && $GLOBALS['xoopsModuleConfig']['max_image_height'] > 0 - && $pseudo_height > $GLOBALS['xoopsModuleConfig']['max_image_height']) { - $pseudo_height = $GLOBALS['xoopsModuleConfig']['max_image_height']; - $pseudo_width = $GLOBALS['xoopsModuleConfig']['max_image_height'] * ($imginfo[0] / $imginfo[1]); - $pseudo_size = "width='" . $pseudo_width . "' height='" . $pseudo_height ."'"; - } - //BigKev73 Change to add max with property to properly scale photos + if ($imginfo[0] > $GLOBALS['xoopsModuleConfig']['max_image_width'] + || $imginfo[1] > $GLOBALS['xoopsModuleConfig']['max_image_height']) { + $pseudo_width = $GLOBALS['xoopsModuleConfig']['max_image_width']; + $pseudo_height = $GLOBALS['xoopsModuleConfig']['max_image_width'] * ($imginfo[1] / $imginfo[0]); + $pseudo_size = "width='" . $pseudo_width . "' height='" . $pseudo_height . "'"; + } + // irmtfan to fix Undefined variable: pseudo_height + if (!empty($pseudo_height) && $GLOBALS['xoopsModuleConfig']['max_image_height'] > 0 + && $pseudo_height > $GLOBALS['xoopsModuleConfig']['max_image_height']) { + $pseudo_height = $GLOBALS['xoopsModuleConfig']['max_image_height']; + $pseudo_width = $GLOBALS['xoopsModuleConfig']['max_image_height'] * ($imginfo[0] / $imginfo[1]); + $pseudo_size = "width='" . $pseudo_width . "' height='" . $pseudo_height . "'"; + } + + //BigKev73 Change to add max with property to properly scale photos if (file_exists($thumb)) { $attachmentImage = ''; $attachmentImage .= '' . $source . ' ' . $img_info . ''; @@ -171,7 +171,7 @@ function newbbCreateThumbnail($source, $thumb_width) $imageCreateFunction = function_exists('imagecreatetruecolor') ? 'imagecreatetruecolor' : 'imagecreate'; - if (in_array($type, $supported_types)) { + if (in_array($type, $supported_types, true)) { switch ($type) { case 1: if (!function_exists('imagecreatefromgif')) { diff --git a/include/functions.ini.php b/include/functions.ini.php index 7f5ee39..2ed213d 100644 --- a/include/functions.ini.php +++ b/include/functions.ini.php @@ -1,4 +1,4 @@ - * @since 4.00 - * @package module::newbb */ - defined('NEWBB_FUNCTIONS_INI') || require __DIR__ . '/functions.ini.php'; define('NEWBB_FUNCTIONS_LANGUAGE_LOADED', true); diff --git a/include/functions.php b/include/functions.php index af7e552..7666ed0 100644 --- a/include/functions.php +++ b/include/functions.php @@ -1,14 +1,12 @@ - * @since 4.00 - * @package module::newbb */ - defined('NEWBB_FUNCTIONS_INI') || require __DIR__ . '/functions.ini.php'; define('NEWBB_FUNCTIONS_LOADED', true); diff --git a/include/functions.read.php b/include/functions.read.php index e265baa..beb9432 100644 --- a/include/functions.read.php +++ b/include/functions.read.php @@ -1,12 +1,12 @@ - * @since 4.00 - * @package module::newbb */ use XoopsModules\Newbb\{ @@ -17,7 +17,6 @@ /** @var Helper $helper */ /** @var ReadHandler $readHandler */ - defined('NEWBB_FUNCTIONS_INI') || require __DIR__ . '/functions.ini.php'; define('NEWBB_FUNCTIONS_READ_LOADED', true); diff --git a/include/functions.recon.php b/include/functions.recon.php index 1ac8dba..6939061 100644 --- a/include/functions.recon.php +++ b/include/functions.recon.php @@ -1,19 +1,17 @@ - * @since 4.00 - * @package module::newbb */ -use XoopsModules\Newbb\{Helper -}; +use XoopsModules\Newbb\Helper; /** @var Helper $helper */ - defined('NEWBB_FUNCTIONS_INI') || require __DIR__ . '/functions.ini.php'; define('NEWBB_FUNCTIONS_RECON_LOADED', true); diff --git a/include/functions.render.php b/include/functions.render.php index 14c4d1a..e427e75 100644 --- a/include/functions.render.php +++ b/include/functions.render.php @@ -1,19 +1,17 @@ - * @since 4.00 - * @package module::newbb */ -use XoopsModules\Newbb\{IconHandler -}; +use XoopsModules\Newbb\IconHandler; /** @var IconHandler $iconHandler */ - defined('NEWBB_FUNCTIONS_INI') || require __DIR__ . '/functions.ini.php'; define('NEWBB_FUNCTIONS_RENDER_LOADED', true); @@ -33,12 +31,12 @@ function newbbHtmlspecialchars($text) } /** - * @param $text - * @param int $html - * @param int $smiley - * @param int $xcode - * @param int $image - * @param int $br + * @param mixed $text + * @param int $html + * @param int $smiley + * @param int $xcode + * @param int $image + * @param int $br * @return mixed */ function &newbbDisplayTarea(&$text, $html = 0, $smiley = 1, $xcode = 1, $image = 1, $br = 1) diff --git a/include/functions.rpc.php b/include/functions.rpc.php index 59b5d63..dba4761 100644 --- a/include/functions.rpc.php +++ b/include/functions.rpc.php @@ -1,14 +1,12 @@ - * @since 4.00 - * @package module::newbb */ - defined('NEWBB_FUNCTIONS_INI') || require __DIR__ . '/functions.ini.php'; define('NEWBB_FUNCTIONS_RPC_LOADED', true); @@ -20,7 +18,7 @@ * @param int $error * @param string $error_message */ - function newbbTrackbackResponse($error = 0, $error_message = '') + function newbbTrackbackResponse($error = 0, $error_message = ''): void { $moduleConfig = newbbLoadConfig(); diff --git a/include/functions.session.php b/include/functions.session.php index 0526b0a..cf1fbb4 100644 --- a/include/functions.session.php +++ b/include/functions.session.php @@ -1,12 +1,12 @@ - * @since 4.00 - * @package module::newbb */ use Xmf\Request; @@ -27,7 +27,7 @@ * @param $name * @param string|array $string */ - function newbbSetSession($name, $string = '') + function newbbSetSession($name, $string = ''): void { if (is_array($string)) { $value = []; @@ -68,7 +68,7 @@ function newbbGetSession($name, $isArray = false) * @param string|array $string * @param int $expire */ - function newbbSetCookie($name, $string = '', $expire = 0) + function newbbSetCookie($name, $string = '', $expire = 0): void { global $forumCookie; if (is_array($string)) { diff --git a/include/functions.stats.php b/include/functions.stats.php index f8d1a2f..015cd4a 100644 --- a/include/functions.stats.php +++ b/include/functions.stats.php @@ -1,12 +1,12 @@ - * @since 4.00 - * @package module::newbb */ use XoopsModules\Newbb\{Helper, @@ -18,7 +18,6 @@ /** @var Helper $helper */ /** @var TopicHandler $topicHandler */ /** @var PostHandler $postHandler */ - defined('NEWBB_FUNCTIONS_INI') || require __DIR__ . '/functions.ini.php'; define('NEWBB_FUNCTIONS_STATS_LOADED', true); diff --git a/include/functions.text.php b/include/functions.text.php index 9cde147..d810fb5 100644 --- a/include/functions.text.php +++ b/include/functions.text.php @@ -1,14 +1,12 @@ -, irmtfan * @since 4.3 - * @package module::newbb */ - define('NEWBB_FUNCTIONS_TEXT_LOADED', true); if (!defined('NEWBB_FUNCTIONS_TEXT')) { @@ -24,9 +22,8 @@ * @param string $excludetags * @param string $start_trimmarker * @param string $end_trimmarker - * @return string $select_text + * @return string */ - function newbb_selectText( $text, $queryarray, @@ -39,18 +36,18 @@ function newbb_selectText( ) { $sanitized_text = $striptags ? strip_tags($text, $excludetags) : $text; $queryarray = newbb_str2array($queryarray); - $text_i = strtolower($sanitized_text); + $text_i = mb_strtolower($sanitized_text); $queryarray = array_map('\strtolower', $queryarray); $lengtharray = array_map('\strlen', $queryarray); $maxlengthquery = max($lengtharray); - $lengthend_trimmarker = strlen($end_trimmarker); + $lengthend_trimmarker = mb_strlen($end_trimmarker); $select_text = ''; $startpos = 0; - $endpos = strlen($sanitized_text); + $endpos = mb_strlen($sanitized_text); while ($startpos < $endpos) { $pos = $endpos; foreach ($queryarray as $query) { - if (false !== ($thispos = strpos($text_i, $query, $startpos))) { + if (false !== ($thispos = mb_strpos($text_i, $query, $startpos))) { $pos = min($thispos, $pos); } } @@ -67,6 +64,7 @@ function newbb_selectText( if (empty($select_text)) { return ''; } // if no text return empty string + return '' . $select_text . ''; } @@ -75,9 +73,8 @@ function newbb_selectText( * * @param string $text * @param array|string $queryarray - * @return string $highlight_text + * @return string */ - function newbb_highlightText($text, $queryarray) { if (empty($GLOBALS['xoopsModuleConfig']['highlight_search_enable'])) { @@ -112,7 +109,6 @@ function newbb_highlighter($query, $i) * @param string|array $str * @return array */ - function newbb_str2array($str) { if (is_array($str)) { diff --git a/include/functions.time.php b/include/functions.time.php index ab3da74..bdebfee 100644 --- a/include/functions.time.php +++ b/include/functions.time.php @@ -1,14 +1,12 @@ - * @since 4.00 - * @package module::newbb */ - defined('NEWBB_FUNCTIONS_INI') || require __DIR__ . '/functions.ini.php'; define('NEWBB_FUNCTIONS_TIME_LOADED', true); diff --git a/include/functions.topic.php b/include/functions.topic.php index f25751e..ccff881 100644 --- a/include/functions.topic.php +++ b/include/functions.topic.php @@ -1,14 +1,12 @@ - * @since 4.00 - * @package module::newbb */ - defined('NEWBB_FUNCTIONS_INI') || require __DIR__ . '/functions.ini.php'; define('NEWBB_FUNCTIONS_TOPIC_LOADED', true); diff --git a/include/functions.user.php b/include/functions.user.php index 1273c28..76f6d40 100644 --- a/include/functions.user.php +++ b/include/functions.user.php @@ -1,4 +1,5 @@ - */ -use XoopsModules\Newbb\{Helper, - Forum +use XoopsModules\Newbb\{ + Forum, + Helper }; /** @var Helper $helper */ /** * Function to a list of user names associated with their user IDs - * @param int $uid - * @param int $usereal - * @param bool $linked + * @param int $uid + * @param int $usereal + * @param bool $linked * @return array */ function newbbGetUnameFromIds($uid, $usereal = 0, $linked = false) @@ -38,9 +39,9 @@ function newbbGetUnameFromIds($uid, $usereal = 0, $linked = false) } /** - * @param int $uid - * @param int $usereal - * @param bool $linked + * @param int $uid + * @param int $usereal + * @param bool $linked * @return string */ function newbbGetUnameFromId($uid, $usereal = 0, $linked = false) @@ -99,8 +100,8 @@ function newbbIsAdministrator($user = -1, $mid = 0) /** * Function to check if a user is a moderator of a forum * - * @param $forum - * @param int|array |string|\XoopsUser $user + * @param mixed $forum + * @param int|array |string|\XoopsUser $user * @return bool */ function newbbIsModerator(&$forum, $user = -1) @@ -122,7 +123,7 @@ function newbbIsModerator(&$forum, $user = -1) } $uid = is_object($user) ? $user->getVar('uid', 'n') : (int)$user; - return in_array($uid, $forum->getVar('forum_moderator')); + return in_array($uid, $forum->getVar('forum_moderator'), true); } /** @@ -157,7 +158,7 @@ function newbbIsAdmin($forum = 0) $_cachedModerators[$cache_id] = $forum->getVar('forum_moderator'); } - return in_array($GLOBALS['xoopsUser']->getVar('uid'), $_cachedModerators[$cache_id]); + return in_array($GLOBALS['xoopsUser']->getVar('uid'), $_cachedModerators[$cache_id], true); } /* use hardcoded DB query to save queries */ @@ -214,7 +215,7 @@ function newbbIsModuleAdministrators(array $uid = []) /* use hardcoded DB query to save queries */ /** * @param array $uid - * @param int $mid + * @param int $mid * @return array */ function newbbIsForumModerators(array $uid = [], $mid = 0) diff --git a/include/functions.welcome.inc.php b/include/functions.welcome.inc.php index 48a3c15..8672788 100644 --- a/include/functions.welcome.inc.php +++ b/include/functions.welcome.inc.php @@ -1,20 +1,18 @@ - * @since 4.00 - * @package module::newbb */ use Xmf\IPAddress; -use XoopsModules\Newbb\{Helper -}; +use XoopsModules\Newbb\Helper; /** @var Helper $helper */ - global $xoopsModule, $myts, $xoopsUser, $forumObject; if (!defined('XOOPS_ROOT_PATH') || !is_object($forumObject) || !is_object($GLOBALS['xoopsUser']) @@ -92,7 +90,7 @@ // Add dynamic fields foreach (array_keys($fields) as $i) { - if (in_array($fields[$i]->getVar('fieldid'), $fieldids)) { + if (in_array($fields[$i]->getVar('fieldid'), $fieldids, true)) { $catid = isset($fieldcats[$fields[$i]->getVar('fieldid')]) ? $fieldcats[$fields[$i]->getVar('fieldid')]['catid'] : 0; $value = $fields[$i]->getOutputValue($GLOBALS['xoopsUser']); if (is_array($value)) { @@ -118,7 +116,7 @@ $message = sprintf(_MD_NEWBB_WELCOME_MESSAGE, $GLOBALS['xoopsUser']->getVar('uname')) . "\n\n"; //$message .= _PROFILE . ": getVar('uid') . "'>" . $GLOBALS['xoopsUser']->getVar('uname') . ' '; //$message .= " | getVar('uid') . "'>" . _MD_NEWBB_PM . "\n"; -$message .= sprintf($GLOBALS['xoopsModuleConfig']['welcome_forum_message']); +$message .= $GLOBALS['xoopsModuleConfig']['welcome_forum_message']; //foreach ($categories as $category) { // if (isset($category['fields'])) { // $message .= "\n\n" . $category['cat_title'] . ":\n\n"; diff --git a/include/functions.welcome.php b/include/functions.welcome.php index 49ac01f..75cadab 100644 --- a/include/functions.welcome.php +++ b/include/functions.welcome.php @@ -1,21 +1,21 @@ - * @since 4.00 - * @package module::newbb */ -use XoopsModules\Newbb\{Helper, - ForumHandler +use XoopsModules\Newbb\{ + ForumHandler, + Helper }; /** @var Helper $helper */ /** @var ForumHandler $forumHandler */ - defined('NEWBB_FUNCTIONS_INI') || require __DIR__ . '/functions.ini.php'; define('NEWBB_FUNCTIONS_WELCOME_LOADED', true); diff --git a/include/images.php b/include/images.php index ce74489..db7b8e0 100644 --- a/include/images.php +++ b/include/images.php @@ -1,12 +1,11 @@ - * @since 4.00 - * @package module::newbb */ /** diff --git a/include/index.php b/include/index.php index 2ea9b7d..b295ab9 100644 --- a/include/index.php +++ b/include/index.php @@ -1,3 +1,3 @@ - * @since 4.00 - * @package module::newbb - * @param XoopsModule $module * @return bool */ +use XoopsModules\Tag; + function xoops_module_update_newbb_v400(XoopsModule $module) { $statsHandler = xoops_getModuleHandler('stats', 'newbb'); @@ -83,19 +83,21 @@ function xoops_module_update_newbb_v400(XoopsModule $module) xoops_error($GLOBALS['xoopsDB']->error() . '
    ' . $sql); } - @require_once $GLOBALS['xoops']->path('modules/tag/include/functions.php'); - if (function_exists('tag_getTagHandler') && $tag_handler = tag_getTagHandler()) { + if (\class_exists(\XoopsModules\Tag\TagHandler::class) && xoops_isActiveModule('tag')) { + $tagHandler = \XoopsModules\Tag\Helper::getInstance()->getHandler('Tag'); $table_topic = $GLOBALS['xoopsDB']->prefix('bb_topics'); $sql = ' SELECT topic_id, topic_tags' . " FROM {$table_topic}"; if (false === ($result = $GLOBALS['xoopsDB']->query($sql))) { xoops_error($GLOBALS['xoopsDB']->error()); } - while (false !== ($myrow = $GLOBALS['xoopsDB']->fetchArray($result))) { - if (empty($myrow['topic_tags'])) { - continue; + if ($result instanceof \mysqli_result) { + while (false !== ($myrow = $GLOBALS['xoopsDB']->fetchArray($result))) { + if (empty($myrow['topic_tags'])) { + continue; + } + $tagHandler->updateByItem($myrow['topic_tags'], $myrow['topic_id'], $module->getVar('mid')); } - $tag_handler->updateByItem($myrow['topic_tags'], $myrow['topic_id'], $module->getVar('mid')); } } diff --git a/include/notification.inc.php b/include/notification.inc.php index 7b8e287..cec37e7 100644 --- a/include/notification.inc.php +++ b/include/notification.inc.php @@ -1,4 +1,4 @@ -loadLanguage('admin'); - //------------------------------------------------------------------ - // Remove uploads folder (and all subfolders) if they exist - //------------------------------------------------------------------ - - $old_directories = [$GLOBALS['xoops']->path("uploads/{$moduleDirName}")]; - foreach ($old_directories as $old_dir) { - $dirInfo = new \SplFileInfo($old_dir); - if ($dirInfo->isDir()) { - // The directory exists so delete it - if (false === $utility::rrmdir($old_dir)) { - $module->setErrors(sprintf(constant('CO_' . $moduleDirNameUpper . '_ERROR_BAD_DEL_PATH'), $old_dir)); - $success = false; - } + // Rename uploads folder to BAK and add date to name + $uploadDirectory = $GLOBALS['xoops']->path("uploads/$moduleDirName"); + $dirInfo = new \SplFileInfo($uploadDirectory); + if ($dirInfo->isDir()) { + // The directory exists so rename it + $date = date('Y-m-d'); + if (!rename($uploadDirectory, $uploadDirectory . "_bak_$date")) { + $module->setErrors(sprintf(constant('CO_' . $moduleDirNameUpper . '_ERROR_BAD_DEL_PATH'), $uploadDirectory)); + $success = false; } - unset($dirInfo); } + unset($dirInfo); /* //------------ START ---------------- //------------------------------------------------------------------ diff --git a/include/onupdate.php b/include/onupdate.php index 416743f..1f63dda 100644 --- a/include/onupdate.php +++ b/include/onupdate.php @@ -1,4 +1,4 @@ -isAdmin()) { exit('Restricted access' . PHP_EOL); @@ -36,7 +39,7 @@ function xoops_module_pre_update_newbb(\XoopsModule $module) { $moduleDirName = \basename(\dirname(__DIR__)); - $utility = new Utility(); + $utility = new Utility(); $configurator = new Configurator(); $xoopsSuccess = $utility::checkVerXoops($module); @@ -102,7 +105,7 @@ function xoops_module_update_newbb(\XoopsModule $module, $previousVersion = null // foreach (array_keys($GLOBALS['uploadFolders']) as $i) { foreach (array_keys($configurator->oldFolders) as $i) { $tempFolder = $GLOBALS['xoops']->path('modules/' . $moduleDirName . $configurator->oldFolders[$i]); - /* @var \XoopsObjectHandler $folderHandler */ + /** @var \XoopsObjectHandler $folderHandler */ $folderHandler = \XoopsFile::getHandler('folder', $tempFolder); $folderHandler->delete($tempFolder); } diff --git a/include/plugin.dist.php b/include/plugin.dist.php index f05b39e..3ae61f7 100644 --- a/include/plugin.dist.php +++ b/include/plugin.dist.php @@ -1,4 +1,4 @@ - * @since 4.00 - * @package module::newbb */ xoops_loadLanguage('main', 'newbb'); diff --git a/include/plugin.php b/include/plugin.php index da638cb..f502eee 100644 --- a/include/plugin.php +++ b/include/plugin.php @@ -1,13 +1,12 @@ - * @since 4.00 - * @package module::newbb */ xoops_loadLanguage('main', 'newbb'); diff --git a/include/search.inc.php b/include/search.inc.php index 8b8d008..46179d6 100644 --- a/include/search.inc.php +++ b/include/search.inc.php @@ -1,12 +1,12 @@ -, irmtfan * @since 4.3 - * @package module::newbb */ use XoopsModules\Newbb\{ diff --git a/include/sitemap.plugin.php b/include/sitemap.plugin.php index 1c903a0..f04d8f6 100644 --- a/include/sitemap.plugin.php +++ b/include/sitemap.plugin.php @@ -1,8 +1,8 @@ - -// WEB :: Ryu's Planning +// WEB :: Ryu's Planning // NewBB plugin: D.J., https://xoops.org.cn diff --git a/include/vars.php b/include/vars.php index 2f2c4fc..c9c19e3 100644 --- a/include/vars.php +++ b/include/vars.php @@ -1,12 +1,12 @@ - * @since 4.00 - * @package module::newbb */ use Xmf\IPAddress; diff --git a/index.php b/index.php index 53948e3..ccf9f7b 100644 --- a/index.php +++ b/index.php @@ -1,15 +1,16 @@ - * @since 4.00 - * @package module::newbb */ use Xmf\Request; +use XoopsModules\Newbb\ForumHandler; use XoopsModules\Newbb\{Helper, ForumHandler, ObjectTree, @@ -21,7 +22,6 @@ /** @var OnlineHandler $onlineHandler */ /** @var ForumHandler $forumHandler */ /** @var UserstatsHandler $userstatsHandler */ - require_once __DIR__ . '/header.php'; /* deal with marks */ @@ -180,7 +180,7 @@ $onecat = $categories[$id]; $cat_element_id = 'cat_' . $onecat['cat_id']; - $expand = (count($toggles) > 0) ? (!in_array($cat_element_id, $toggles)) : true; + $expand = (count($toggles) > 0) ? (!in_array($cat_element_id, $toggles, true)) : true; // START irmtfan to improve newbbDisplayImage if ($expand) { $cat_display = 'block'; //irmtfan move semicolon @@ -198,7 +198,7 @@ } $cat_sponsor = []; - @list($url, $title) = array_map('\trim', explode(' ', $onecat['cat_url'], 2)); + @[$url, $title] = array_map('\trim', explode(' ', $onecat['cat_url'], 2)); if ('' === $title) { $title = $url; } @@ -209,7 +209,7 @@ //$cat_image = $onecat['cat_image']; $cat_image = ''; $cat_image = $onecat['cat_image']; - if ('' !== $cat_image && $cat_image) { + if ('' !== $cat_image && $cat_image) { $cat_image = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname', 'n') . '/assets/images/category/' . $cat_image; } $category_array[] = [ @@ -303,12 +303,11 @@ require_once __DIR__ . '/footer.php'; require_once $GLOBALS['xoops']->path('footer.php'); //added missing php closing tag -?> +?> diff --git a/language/english/admin.php b/language/english/admin.php index 32b3608..85160b4 100644 --- a/language/english/admin.php +++ b/language/english/admin.php @@ -1,4 +1,4 @@ - * @since 4.00 - * @package module::newbb */ require_once __DIR__ . '/header.php'; if ((!class_exists('TagFormTag')) || (class_exists('TagFormTag') && !@require $GLOBALS['xoops']->path('modules/tag/list.tag.php'))) { return null; } - diff --git a/list.topic.php b/list.topic.php index ef4feef..4e7d571 100644 --- a/list.topic.php +++ b/list.topic.php @@ -1,12 +1,12 @@ - * @since 4.00 - * @package module::newbb */ use Xmf\Request; diff --git a/makepdf.php b/makepdf.php index 2381260..e579b86 100644 --- a/makepdf.php +++ b/makepdf.php @@ -1,4 +1,4 @@ - * @since 4.00 - * @package module::newbb */ use Xmf\IPAddress; @@ -22,7 +22,6 @@ /** @var ForumHandler $forumHandler */ /** @var PostHandler $postHandler */ /** @var Post $post */ - require_once __DIR__ . '/header.php'; global $xoTheme, $xoopsTpl; @@ -123,12 +122,12 @@ } $users = newbbGetUnameFromIds(array_keys($_users), $GLOBALS['xoopsModuleConfig']['show_realname'], true); - $columnHeaders ['uid'] = [ + $columnHeaders['uid'] = [ 'url' => 'moderate.php?forum=' . $forum_id . '&start=' . $start . '&sort=uid', 'header' => _MD_NEWBB_SUSPEND_UID, 'title' => _MD_NEWBB_SUSPEND_UID, ]; - $columnHeaders ['start'] = [ + $columnHeaders['start'] = [ 'url' => 'moderate.php?forum=' . $forum_id . '&start=' . $start . '&sort=start', 'header' => _MD_NEWBB_SUSPEND_START, 'title' => _MD_NEWBB_SUSPEND_START, diff --git a/newtopic.php b/newtopic.php index eee6b53..588fa74 100644 --- a/newtopic.php +++ b/newtopic.php @@ -1,12 +1,12 @@ - * @since 4.00 - * @package module::newbb */ use Xmf\Request; @@ -17,7 +17,6 @@ /** @var Helper $helper */ /** @var OnlineHandler $onlineHandler */ - require_once __DIR__ . '/header.php'; if (!$forum = Request::getString('forum', '', 'GET')) { diff --git a/notification_update.php b/notification_update.php index cd34bdd..9a5c2aa 100644 --- a/notification_update.php +++ b/notification_update.php @@ -1,4 +1,4 @@ - */ @@ -57,7 +57,7 @@ 'log', ]; $op = $_REQUEST['op'] ?? 'add'; -$op = (!in_array($op, $goodOps)) ? 'add' : $op; +$op = (!in_array($op, $goodOps, true)) ? 'add' : $op; $poll_id = Request::getInt('poll_id', Request::getInt('poll_id', 0, 'GET'), 'POST'); $topic_id = Request::getInt('topic_id', Request::getInt('topic_id', 0, 'GET'), 'POST'); @@ -93,7 +93,6 @@ $xpPollHandler = $pollHelper->getHandler('Poll'); /** @var \XoopsModules\XoopsPoll $pollObject */ $pollObject = $xpPollHandler->get($poll_id); // will create poll if poll_id = 0 exist - } elseif ($pollModuleHandler->getVar('version') >= 140) { xoops_load('constants', $GLOBALS['xoopsModuleConfig']['poll_module']); xoops_load('pollUtility', $GLOBALS['xoopsModuleConfig']['poll_module']); @@ -118,7 +117,7 @@ if (is_object($GLOBALS['xoopsUser']) && !newbbIsAdmin($forumObject)) { $perm = false; if ($topicHandler->getPermission($forumObject, $topicObject->getVar('topic_status'), 'addpoll')) { - if (in_array($op, ['add', 'save', 'update']) && !$topicObject->getVar('topic_haspoll') + if (in_array($op, ['add', 'save', 'update'], true) && !$topicObject->getVar('topic_haspoll') && ($GLOBALS['xoopsUser']->getVar('uid') == $topicObject->getVar('topic_poster'))) { $perm = true; } elseif (!empty($poll_id) && ($GLOBALS['xoopsUser']->getVar('uid') == $pollObject->getVar('user_id'))) { @@ -181,7 +180,8 @@ $color_select->addOptionArray($barcolor_array); $color_select->setExtra("onchange='showImgSelected(\"option_color_image[{$i}]\", \"option_color[{$i}]\", \"modules/" . $GLOBALS['xoopsModuleConfig']['poll_module'] . '/assets/images/colorbars", "", "' . XOOPS_URL . "\")'"); $color_label = new \XoopsFormLabel( - '', "
    " + '', + "
    " ); $option_tray->addElement($color_select); $option_tray->addElement($color_label); @@ -223,7 +223,8 @@ if ($pollObject->hasExpired()) { // irmtfan full URL - add topic_id $restart_label = new \XoopsFormLabel( - _MD_NEWBB_POLL_EXPIRATION, sprintf(_MD_NEWBB_POLL_EXPIREDAT, $date) . "
    getVar('dirname') . "/polls.php?op=restart&poll_id={$poll_id}&topic_id={$topic_id}'>" . _MD_NEWBB_POLL_RESTART . '' + _MD_NEWBB_POLL_EXPIRATION, + sprintf(_MD_NEWBB_POLL_EXPIREDAT, $date) . "
    getVar('dirname') . "/polls.php?op=restart&poll_id={$poll_id}&topic_id={$topic_id}'>" . _MD_NEWBB_POLL_RESTART . '' ); $poll_form->addElement($restart_label); } else { @@ -278,19 +279,12 @@ case 'save': // new xoopspoll module if ($pollModuleHandler->getVar('version') >= 201) { - $xpPollHandler->insert($pollObject); - - - // old xoopspoll or umfrage or any clone from them } elseif ($pollModuleHandler->getVar('version') >= 140) { - - } - - // old xoopspoll or umfrage or any clone from them + } // old xoopspoll or umfrage or any clone from them elseif ($pollModuleHandler->getVar('version') < 140) { -// if ($pollModuleHandler->getVar('version') >= 140) { + // if ($pollModuleHandler->getVar('version') >= 140) { // check security token if (!$GLOBALS['xoopsSecurity']->check()) { redirect_header(Request::getString('SCRIPT_NAME', '', 'SERVER'), 2, implode('
    ', $GLOBALS['xoopsSecurity']->getErrors())); @@ -375,12 +369,11 @@ // no break case 'update': // check security token -// if (!$GLOBALS['xoopsSecurity']->check()) { -// redirect_header(Request::getString('SCRIPT_NAME', '', 'SERVER'), 2, implode('
    ', $GLOBALS['xoopsSecurity']->getErrors())); -// } + // if (!$GLOBALS['xoopsSecurity']->check()) { + // redirect_header(Request::getString('SCRIPT_NAME', '', 'SERVER'), 2, implode('
    ', $GLOBALS['xoopsSecurity']->getErrors())); + // } /* make sure there's at least one option */ - $option_text = Request::getString('option_text', '', 'POST'); $option_string = is_array($option_text) ? implode('', $option_text) : $option_text; $option_string = trim($option_string); @@ -395,10 +388,10 @@ /** @var \XoopsModules\Xoopspoll\LogHandler $xpLogHandler */ $xpLogHandler = $pollHelper->getHandler('Log'); -// $xpOptHandler = xoops_getModuleHandler('option', $GLOBALS['xoopsModuleConfig']['poll_module']); -// $xpLogHandler = xoops_getModuleHandler('log', $GLOBALS['xoopsModuleConfig']['poll_module']); + // $xpOptHandler = xoops_getModuleHandler('option', $GLOBALS['xoopsModuleConfig']['poll_module']); + // $xpLogHandler = xoops_getModuleHandler('log', $GLOBALS['xoopsModuleConfig']['poll_module']); // $classRequest = ucfirst($GLOBALS['xoopsModuleConfig']["poll_module"]) . "Request"; -// $classConstants = ucfirst($GLOBALS['xoopsModuleConfig']['poll_module']) . 'Constants'; + // $classConstants = ucfirst($GLOBALS['xoopsModuleConfig']['poll_module']) . 'Constants'; $notify = Request::getInt('notify', PollConstants::NOTIFICATION_ENABLED, 'POST'); $currentTimestamp = time(); @@ -479,10 +472,8 @@ unset($optionObject); } } - } elseif ($pollModuleHandler->getVar('version') >= 140) { - -// if ($pollModuleHandler->getVar('version') >= 140) { + // if ($pollModuleHandler->getVar('version') >= 140) { $xpOptHandler = xoops_getModuleHandler('option', $GLOBALS['xoopsModuleConfig']['poll_module']); $xpLogHandler = xoops_getModuleHandler('log', $GLOBALS['xoopsModuleConfig']['poll_module']); // $classRequest = ucfirst($GLOBALS['xoopsModuleConfig']["poll_module"]) . "Request"; @@ -571,7 +562,7 @@ } else { $pollObject->setVar('question', Request::getString('question', '', 'POST')); $pollObject->setVar('description', Request::getString('description', '', 'POST')); - $classConstants = ucfirst($GLOBALS['xoopsModuleConfig']['poll_module']) . 'Constants'; + $classConstants = ucfirst($GLOBALS['xoopsModuleConfig']['poll_module']) . 'Constants'; $end_time = Request::getString('end_time', '', 'POST'); if ('' !== $end_time) { @@ -652,7 +643,8 @@ $color_select->addOptionArray($barcolor_array); $color_select->setExtra("onchange='showImgSelected(\"option_color_image[{$i}]\", \"option_color[{$i}]\", \"modules/{$GLOBALS['xoopsModuleConfig']['poll_module']}/assets/images/colorbars\", \"\", \"" . XOOPS_URL . "\")'"); $color_label = new \XoopsFormLabel( - '', "url("modules/{$GLOBALS['xoopsModuleConfig']['poll_module']}/assets/images/colorbars/{$current_bar}") . "' name='option_color_image[{$i}]' id='option_color_image[{$i}]' class='alignbottom' width='30' height='15' alt='' >
    " + '', + "url("modules/{$GLOBALS['xoopsModuleConfig']['poll_module']}/assets/images/colorbars/{$current_bar}") . "' name='option_color_image[{$i}]' id='option_color_image[{$i}]' class='alignbottom' width='30' height='15' alt='' >
    " ); $option_tray->addElement($color_select); $option_tray->addElement($color_label); @@ -802,7 +794,11 @@ _MD_NEWBB_POLL_EXPIRATION . '
    ' . _MD_NEWBB_POLL_FORMAT . '
    ' . sprintf(_MD_NEWBB_POLL_CURRENTTIME, formatTimestamp(time(), 'Y-m-d H:i:s')) . '
    ' . sprintf( _MD_NEWBB_POLL_EXPIREDAT, formatTimestamp($pollObject->getVar('end_time'), 'Y-m-d H:i:s') - ) . '
    ', 'end_time', 20, 19, formatTimestamp(time() + $default_poll_duration, 'Y-m-d H:i:s') + ) . '', + 'end_time', + 20, + 19, + formatTimestamp(time() + $default_poll_duration, 'Y-m-d H:i:s') ); $poll_form->addElement($expire_text); $poll_form->addElement(new \XoopsFormRadioYN(_MD_NEWBB_POLL_NOTIFY, 'notify', 1)); diff --git a/post.php b/post.php index 9fdc10f..ec27a5a 100644 --- a/post.php +++ b/post.php @@ -1,4 +1,5 @@ - */ @@ -25,12 +25,12 @@ Post, PostHandler }; + /** @var ForumHandler $forumHandler */ /** @var TopicHandler $topicHandler */ /** @var OnlineHandler $onlineHandler */ /** @var PostHandler $postHandler */ /** @var Post $postObject */ - require_once __DIR__ . '/header.php'; foreach ( @@ -54,7 +54,6 @@ redirect_header('index.php', 2, _MD_NEWBB_ERRORFORUM); } - //$forumHandler = \XoopsModules\Newbb\Helper::getInstance()->getHandler('Forum'); //$topicHandler = \XoopsModules\Newbb\Helper::getInstance()->getHandler('Topic'); //$postHandler = \XoopsModules\Newbb\Helper::getInstance()->getHandler('Post'); @@ -101,7 +100,7 @@ setcookie($GLOBALS['xoopsConfig']['session_name'], session_id(), time() + (60 * $GLOBALS['xoopsConfig']['session_expire']), '/', '', 0); } $user_theme = $user->getVar('theme'); - if (in_array($user_theme, $GLOBALS['xoopsConfig']['theme_set_allowed'])) { + if (in_array($user_theme, $GLOBALS['xoopsConfig']['theme_set_allowed'], true)) { $_SESSION['xoopsUserTheme'] = $user_theme; } } @@ -335,8 +334,8 @@ $tags = []; $tags['THREAD_NAME'] = Request::getString('subject', '', 'POST'); $tags['THREAD_URL'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname', 'n') . '/viewtopic.php?topic_id=' . $topicObject->getVar('topic_id'); - $tags['POST_URL'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname', 'n') . '/viewtopic.php?topic_id=' . $topicObject->getVar('topic_id') . '&post_id=' . $postid . '#forumpost' . $postid; - + $tags['POST_URL'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname', 'n') . '/viewtopic.php?topic_id=' . $topicObject->getVar('topic_id') . '&post_id=' . $postid . '#forumpost' . $postid; + require_once __DIR__ . '/include/notification.inc.php'; $forum_info = newbb_notify_iteminfo('forum', $forumObject->getVar('forum_id')); $tags['FORUM_NAME'] = $forum_info['name']; @@ -396,7 +395,7 @@ $GLOBALS['xoopsDB']->queryF(' REPLACE INTO ' . $GLOBALS['xoopsDB']->prefix('newbb_user_stats') . " SET uid = '{$uid}', user_topics = '{$topics}', user_posts = '{$posts}', user_digests = '{$digests}', user_lastpost = '{$lastpost}'"); } - $redirect = XOOPS_URL . '/modules/newbb/viewtopic.php?topic_id=' . $topicObject->getVar('topic_id') . '&post_id=' . $postid . '#forumpost' . $postid ; + $redirect = XOOPS_URL . '/modules/newbb/viewtopic.php?topic_id=' . $topicObject->getVar('topic_id') . '&post_id=' . $postid . '#forumpost' . $postid; $message = _MD_NEWBB_THANKSSUBMIT . '
    ' . $error_upload; } else { $redirect = XOOPS_URL . '/modules/newbb/viewforum.php?forum=' . $postObject->getVar('forum_id'); @@ -419,15 +418,15 @@ //$xoopsTpl->assign('xoops_module_header', $xoops_module_header); if (Request::getString('contents_upload', null, 'POST')) { - // BigKev73 > This line needs to be removed as it will cause any attachement already added in this editing session to be throw away. This is one of the reasons why multi-file attachment - // was not working like it used to in CBB. - // $attachments_tmp = []; - - // This shoue be Request::getString, not Request::getArray, otherwise this will always return a null value. This is one of the reasons why multi-file attachment - // was not working like it used to in CBB. - // if (Request::getArray('attachments_tmp', null, 'POST')) { - // $attachments_tmp = unserialize(base64_decode(Request::getArray('attachments_tmp', [], 'POST'), true)); - if (Request::getString('attachments_tmp', '', 'POST')) { + // BigKev73 > This line needs to be removed as it will cause any attachement already added in this editing session to be throw away. This is one of the reasons why multi-file attachment + // was not working like it used to in CBB. + // $attachments_tmp = []; + + // This shoue be Request::getString, not Request::getArray, otherwise this will always return a null value. This is one of the reasons why multi-file attachment + // was not working like it used to in CBB. + // if (Request::getArray('attachments_tmp', null, 'POST')) { + // $attachments_tmp = unserialize(base64_decode(Request::getArray('attachments_tmp', [], 'POST'), true)); + if (Request::getString('attachments_tmp', '', 'POST')) { $attachments_tmp = unserialize(base64_decode(Request::getString('attachments_tmp', [], 'POST'), true)); if (Request::getArray('delete_tmp', null, 'POST') && count(Request::getArray('delete_tmp', null, 'POST'))) { foreach (Request::getArray('delete_tmp', '', 'POST') as $key) { diff --git a/preloads/autoloader.php b/preloads/autoloader.php index e97644e..f8de47d 100644 --- a/preloads/autoloader.php +++ b/preloads/autoloader.php @@ -1,10 +1,10 @@ -getVar('uid') : 0; @@ -92,13 +90,13 @@ $voteresult = $GLOBALS['xoopsDB']->query($query); $votesDB = $GLOBALS['xoopsDB']->getRowsNum($voteresult); $totalrating = 0; -while (list($rating) = $GLOBALS['xoopsDB']->fetchRow($voteresult)) { +while ([$rating] = $GLOBALS['xoopsDB']->fetchRow($voteresult)) { $totalrating += $rating; } $finalrating = $totalrating / $votesDB; $finalrating = number_format($finalrating, 4); //$sql = sprintf('UPDATE "%s" SET rating = "%u", votes = "%u" WHERE topic_id = "%u"', $GLOBALS['xoopsDB']->prefix('newbb_topics'), $finalrating, $votesDB, $topic_id); -$sql = sprintf('UPDATE %s SET rating = %u, votes = %u WHERE topic_id = %u', $GLOBALS['xoopsDB']->prefix('newbb_topics'), $finalrating, $votesDB, $topic_id); +$sql = sprintf('UPDATE %s SET rating = %u, votes = %u WHERE topic_id = %u', $GLOBALS['xoopsDB']->prefix('newbb_topics'), $finalrating, $votesDB, $topic_id); $GLOBALS['xoopsDB']->queryF($sql); $ratemessage = _MD_NEWBB_VOTEAPPRE . '
    ' . sprintf(_MD_NEWBB_THANKYOU, $GLOBALS['xoopsConfig']['sitename']); diff --git a/reply.php b/reply.php index 7cdda2f..7be9ffe 100644 --- a/reply.php +++ b/reply.php @@ -1,4 +1,4 @@ -getHandler('Forum'); $topicHandler = Helper::getInstance()->getHandler('Topic'); -$postHandler = Helper::getInstance()->getHandler('Post'); +$postHandler = Helper::getInstance()->getHandler('Post'); if (!$pid = $post_id) { $pid = $topicHandler->getTopPostId($topic_id); @@ -82,7 +80,7 @@ } if ($GLOBALS['xoopsModuleConfig']['wol_enabled']) { - // /** @var OnlineHandler $onlineHandler */ + // /** @var OnlineHandler $onlineHandler */ // $onlineHandler = \XoopsModules\Newbb\Helper::getInstance()->getHandler('Online'); $onlineHandler->init($forumObject); } diff --git a/report.php b/report.php index ecd8c07..0350dae 100644 --- a/report.php +++ b/report.php @@ -1,4 +1,4 @@ -path('class/template.php'); require_once $GLOBALS['xoops']->path('modules/newbb/include/functions.rpc.php'); diff --git a/search.php b/search.php index 87b7171..3e91d23 100644 --- a/search.php +++ b/search.php @@ -1,11 +1,10 @@ - + * Author: Sudhaker Raj * Licence: GNU */ $seoOp = Request::getString('seoOp', '', 'GET'); @@ -26,7 +26,7 @@ 'pdf' => 'makepdf.php', ]; -if (!empty($seoOp) && !empty($seoMap[$seoOp]) && in_array($seoOp, $seos)) { +if (!empty($seoOp) && !empty($seoMap[$seoOp]) && in_array($seoOp, $seos, true)) { // module specific dispatching logic, other module must implement as // per their requirements. $ori_self = Request::getString('SCRIPT_NAME', '', 'SERVER'); diff --git a/seo_url.php b/seo_url.php index 9ce1d39..bc3164f 100644 --- a/seo_url.php +++ b/seo_url.php @@ -1,12 +1,12 @@ -<{$rss.channel_link}> <{$rss.channel_desc}> <{$rss.channel_lastbuild}> - http://backend.userland.com/rss/ + https://backend.userland.com/rss/ <{$rss.channel_generator}> <{$rss.channel_category}> <{$rss.channel_editor}> diff --git a/templates/newbb_thread.tpl b/templates/newbb_thread.tpl index f4659ec..a85c72c 100644 --- a/templates/newbb_thread.tpl +++ b/templates/newbb_thread.tpl @@ -106,7 +106,7 @@
    <{if $topic_post.poster_ip}> IP: - <{$topic_post.poster_ip}> + <{$topic_post.poster_ip}> | <{/if}> <{if $topic_post.poster.uid gt 0}> diff --git a/testdata/images/index.php b/testdata/images/index.php index 2ea9b7d..b295ab9 100644 --- a/testdata/images/index.php +++ b/testdata/images/index.php @@ -1,3 +1,3 @@ - 1, 'op' => 'load'], 'index.php', sprintf(constant('CO_' . $moduleDirNameUpper . '_' . 'LOAD_SAMPLEDATA_CONFIRM')), constant('CO_' . $moduleDirNameUpper . '_' . 'CONFIRM'), true); + xoops_confirm(['ok' => 1, 'op' => 'load'], 'index.php', constant('CO_' . $moduleDirNameUpper . '_' . 'LOAD_SAMPLEDATA_CONFIRM'), constant('CO_' . $moduleDirNameUpper . '_' . 'CONFIRM'), true); xoops_cp_footer(); } break; @@ -54,13 +54,22 @@ saveSampleData(); break; case 'clear': - clearSampleData(); + if (Request::hasVar('ok', 'REQUEST') && 1 === Request::getInt('ok', 0)) { + if (!$GLOBALS['xoopsSecurity']->check()) { + redirect_header($helper->url('admin/index.php'), 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); + } + clearSampleData(); + } else { + xoops_cp_header(); + xoops_confirm(['ok' => 1, 'op' => 'clear'], 'index.php', sprintf(constant('CO_' . $moduleDirNameUpper . '_' . 'CLEAR_SAMPLEDATA')), constant('CO_' . $moduleDirNameUpper . '_' . 'CONFIRM'), true); + xoops_cp_footer(); + } break; } // XMF TableLoad for SAMPLE data -function loadSampleData() +function loadSampleData(): void { global $xoopsConfig; $moduleDirName = \basename(\dirname(__DIR__)); @@ -101,7 +110,7 @@ function loadSampleData() \redirect_header('../admin/index.php', 1, \constant('CO_' . $moduleDirNameUpper . '_' . 'LOAD_SAMPLEDATA_SUCCESS')); } -function saveSampleData() +function saveSampleData(): void { global $xoopsConfig; $moduleDirName = \basename(\dirname(__DIR__)); @@ -131,7 +140,7 @@ function saveSampleData() \redirect_header('../admin/index.php', 1, \constant('CO_' . $moduleDirNameUpper . '_' . 'SAVE_SAMPLEDATA_SUCCESS')); } -function exportSchema() +function exportSchema(): void { $moduleDirName = \basename(\dirname(__DIR__)); $moduleDirNameUpper = \mb_strtoupper($moduleDirName); @@ -202,7 +211,8 @@ function loadTableFromArrayWithReplace($table, $data, $search, $replace) return $count; } -function clearSampleData(){ +function clearSampleData(): void +{ $moduleDirName = \basename(\dirname(__DIR__)); $moduleDirNameUpper = \mb_strtoupper($moduleDirName); $helper = Helper::getInstance(); diff --git a/topicmanager.php b/topicmanager.php index 21e62d6..92706d2 100644 --- a/topicmanager.php +++ b/topicmanager.php @@ -1,4 +1,4 @@ -

    '; } elseif ('merge' === $mode) { - // $postHandler = \XoopsModules\Newbb\Helper::getInstance()->getHandler('Post'); // $rateHandler = \XoopsModules\Newbb\Helper::getInstance()->getHandler('Rate'); @@ -259,7 +257,7 @@ $topicObject->loadFilters('update'); //$sql = sprintf('UPDATE "%s" SET forum_id = "%u" WHERE topic_id = "%u"', $GLOBALS['xoopsDB']->prefix('newbb_posts'), $newforum, $topic_id); - $sql = sprintf('UPDATE %s SET forum_id = %u WHERE topic_id = %u', $GLOBALS['xoopsDB']->prefix('newbb_posts'), $newforum, $topic_id); + $sql = sprintf('UPDATE %s SET forum_id = %u WHERE topic_id = %u', $GLOBALS['xoopsDB']->prefix('newbb_posts'), $newforum, $topic_id); if (!$r = $GLOBALS['xoopsDB']->query($sql)) { return false; } diff --git a/update_type.php b/update_type.php index 6e922ed..ce93aaf 100644 --- a/update_type.php +++ b/update_type.php @@ -1,13 +1,12 @@ - * @since 4.00 - * @package module::newbb */ require_once __DIR__ . '/header.php'; diff --git a/view.tag.php b/view.tag.php index 07bbf2b..037085a 100644 --- a/view.tag.php +++ b/view.tag.php @@ -1,13 +1,12 @@ - * @since 4.00 - * @package module::newbb */ require_once __DIR__ . '/header.php'; diff --git a/viewforum.php b/viewforum.php index 48ac51f..ec77a04 100644 --- a/viewforum.php +++ b/viewforum.php @@ -1,22 +1,22 @@ - * @since 4.00 - * @package module::newbb */ use Xmf\Request; use XoopsModules\Newbb\{ - OnlineHandler, - ForumHandler + ForumHandler, + OnlineHandler + }; /** @var OnlineHandler $onlineHandler */ /** @var ForumHandler $forumHandler */ - require_once __DIR__ . '/header.php'; if (!Request::getInt('forum', 0, 'GET')) { @@ -76,7 +76,6 @@ true )) ? 2 : Request::getInt('mode', 0, 'GET'); - //$forumHandler = \XoopsModules\Newbb\Helper::getInstance()->getHandler('Forum'); $forumObject = $forumHandler->get($forum_id); @@ -116,7 +115,7 @@ $xoopsTpl->assign('viewer_level', $isAdmin ? 2 : 0); /* Only admin has access to admin mode */ if (!$isAdmin) { - $status = (!empty($status) && in_array($status, ['active', 'pending', 'deleted'])) ? '' : $status; + $status = (!empty($status) && in_array($status, ['active', 'pending', 'deleted'], true)) ? '' : $status; // irmtfan add mode $mode = 0; } @@ -365,12 +364,11 @@ require_once __DIR__ . '/footer.php'; require_once $GLOBALS['xoops']->path('footer.php'); //added missing php closing tag -?> +?> diff --git a/viewpost.php b/viewpost.php index 5e9c103..2d656d0 100644 --- a/viewpost.php +++ b/viewpost.php @@ -1,4 +1,4 @@ -getHandler('Forum'); @@ -57,7 +57,7 @@ /* Only admin has access to admin mode */ if (!$isAdmin && 2 === $mode) { - $status = in_array($status, ['active', 'pending', 'deleted']) ? '' : $status; + $status = in_array($status, ['active', 'pending', 'deleted'], true) ? '' : $status; $mode = 0; } if ($mode) { @@ -153,7 +153,7 @@ } $viewmode = Request::getString('viewmode', (!empty($viewmode_cookie) ? $viewmode_cookie : (@$valid_modes[$GLOBALS['xoopsModuleConfig']['view_mode'] - 1])), 'GET'); -$viewmode = in_array($viewmode, $valid_modes) ? $viewmode : $valid_modes[0]; +$viewmode = in_array($viewmode, $valid_modes, true) ? $viewmode : $valid_modes[0]; $postCount = $postHandler->getPostCount($criteria_count, $join); // irmtfan add join for read_mode = 2 $posts = $postHandler->getPostsByLimit($criteria_post, $post_perpage, $start, $join); // irmtfan add join for read_mode = 2 diff --git a/viewtopic.php b/viewtopic.php index 0bbe3dc..3c595fd 100644 --- a/viewtopic.php +++ b/viewtopic.php @@ -1,4 +1,4 @@ -startTime('newBB_viewtopic'); require_once __DIR__ . '/include/functions.read.php'; @@ -68,10 +68,10 @@ $move = \mb_strtolower(Request::getString('move', '', 'GET')); // isset($_GET['move']) ? strtolower($_GET['move']) : ''; $start = Request::getInt('start', 0, 'GET'); // !empty($_GET['start']) ? (int)($_GET['start']) : 0; $status = (Request::getString('status', '', 'GET') - && in_array(Request::getString('status', '', 'GET'), ['active', 'pending', 'deleted'])) ? Request::getString('status', '', 'GET') : ''; + && in_array(Request::getString('status', '', 'GET'), ['active', 'pending', 'deleted'], true)) ? Request::getString('status', '', 'GET') : ''; $mode = Request::getInt('mode', (!empty($status) ? 2 : 0), 'GET'); // !empty($_GET['mode']) ? (int)($_GET['mode']) : (!empty($status) ? 2 : 0); $order = (Request::getString('order', '', 'GET') - && in_array(Request::getString('order', '', 'GET'), ['ASC', 'DESC'])) ? Request::getString('order', '', 'GET') : ''; + && in_array(Request::getString('order', '', 'GET'), ['ASC', 'DESC'], true)) ? Request::getString('order', '', 'GET') : ''; if ('' === $order) { if (is_object($GLOBALS['xoopsUser']) && $GLOBALS['xoopsUser']->isActive()) { @@ -524,7 +524,7 @@ // new xoopspoll module if ($pollModuleHandler->getVar('version') >= 201) { $xpollHandler = PollHelper::getInstance()->getHandler('Poll'); - $pollObject = $xpollHandler->get($poll_id); + $pollObject = $xpollHandler->get($poll_id); if (is_object($pollObject)) { /* check to see if user has rights to view the results */ $vis_return = $pollObject->isResultVisible(); @@ -547,7 +547,7 @@ ] ); $classRenderer = ucfirst($GLOBALS['xoopsModuleConfig']['poll_module']) . 'Renderer'; - $renderer = new Xoopspoll\Renderer($pollObject); + $renderer = new Xoopspoll\Renderer($pollObject); // check to see if user has voted, show form if not, otherwise get results for form $logHandler = PollHelper::getInstance()->getHandler('Log'); @@ -772,15 +772,15 @@ } //$quickform = ( !empty($GLOBALS['xoopsModuleConfig']["editor_default"]) ) ? $GLOBALS['xoopsModuleConfig']["editor_default"] : "textarea"; - $quickform = !empty($GLOBALS['xoopsModuleConfig']['editor_quick_default']) ? $GLOBALS['xoopsModuleConfig']['editor_quick_default'] : 'textarea'; - $editor_configs = []; - $editor_configs ['name'] = 'message'; + $quickform = !empty($GLOBALS['xoopsModuleConfig']['editor_quick_default']) ? $GLOBALS['xoopsModuleConfig']['editor_quick_default'] : 'textarea'; + $editor_configs = []; + $editor_configs['name'] = 'message'; //$editor_configs [ "value" ] = $message ; - $editor_configs ['rows'] = empty($GLOBALS['xoopsModuleConfig'] ['editor_rows']) ? 10 : $GLOBALS['xoopsModuleConfig'] ['editor_rows']; - $editor_configs ['cols'] = empty($GLOBALS['xoopsModuleConfig'] ['editor_cols']) ? 30 : $GLOBALS['xoopsModuleConfig'] ['editor_cols']; - $editor_configs ['width'] = empty($GLOBALS['xoopsModuleConfig'] ['editor_width']) ? '100%' : $GLOBALS['xoopsModuleConfig'] ['editor_width']; - $editor_configs ['height'] = empty($GLOBALS['xoopsModuleConfig'] ['editor_height']) ? '400px' : $GLOBALS['xoopsModuleConfig'] ['editor_height']; - $_editor = new \XoopsFormEditor(_MD_NEWBB_MESSAGEC, $quickform, $editor_configs, true); + $editor_configs['rows'] = empty($GLOBALS['xoopsModuleConfig']['editor_rows']) ? 10 : $GLOBALS['xoopsModuleConfig']['editor_rows']; + $editor_configs['cols'] = empty($GLOBALS['xoopsModuleConfig']['editor_cols']) ? 30 : $GLOBALS['xoopsModuleConfig']['editor_cols']; + $editor_configs['width'] = empty($GLOBALS['xoopsModuleConfig']['editor_width']) ? '100%' : $GLOBALS['xoopsModuleConfig']['editor_width']; + $editor_configs['height'] = empty($GLOBALS['xoopsModuleConfig']['editor_height']) ? '400px' : $GLOBALS['xoopsModuleConfig']['editor_height']; + $_editor = new \XoopsFormEditor(_MD_NEWBB_MESSAGEC, $quickform, $editor_configs, true); $forum_form->addElement($_editor, true); $forum_form->addElement(new \XoopsFormHidden('dohtml', 0)); @@ -816,7 +816,7 @@ 'collapse' => $iconHandler->getImageSource($qr_collapse), ]; $quickreply['show'] = 1; // = !empty($GLOBALS['xoopsModuleConfig']['quickreply_enabled'] - $quickreply['expand'] = (count($toggles) > 0) ? (!in_array('qr', $toggles)) : true; + $quickreply['expand'] = (count($toggles) > 0) ? (!in_array('qr', $toggles, true)) : true; if ($quickreply['expand']) { $quickreply['style'] = 'block'; //irmtfan move semicolon $quickreply_icon_display = $qr_expand; @@ -835,10 +835,11 @@ $xoopsTpl->assign('quickreply', ['show' => 0]); } -if ($GLOBALS['xoopsModuleConfig']['do_tag'] && class_exists('TagFormTag') - && @require $GLOBALS['xoops']->path('modules/tag/include/tagbar.php')) { - $xoopsTpl->assign('tagbar', tagBar($topicObject->getVar('topic_tags', 'n'))); +if (1 == $helper->getConfig('do_tag') && \class_exists(\XoopsModules\Tag\Tagbar::class) && \xoops_isActiveModule('tag')) { + $tagbarObj = new \XoopsModules\Tag\Tagbar(); + $xoopsTpl->assign('tagbar', $tagbarObj->getTagbar($topicObject->getVar('topic_tags', 'n'))); } + // irmtfan move to footer.php require_once __DIR__ . '/footer.php'; require_once $GLOBALS['xoops']->path('footer.php'); diff --git a/votepolls.php b/votepolls.php index 9f17bcf..5dbd893 100644 --- a/votepolls.php +++ b/votepolls.php @@ -1,4 +1,4 @@ - * @since 4.00 - * @package module::newbb */ require_once __DIR__ . '/preloads/autoloader.php'; -$moduleDirName = basename(__DIR__); +$moduleDirName = basename(__DIR__); $moduleDirNameUpper = \mb_strtoupper($moduleDirName); $modversion = [ @@ -31,7 +30,7 @@ 'author_email' => '', 'module_website_url' => 'www.xoops.org/', 'module_website_name' => 'XOOPS', - 'min_php' => '7.3', + 'min_php' => '7.4', 'min_xoops' => '2.5.10', 'min_admin' => '1.2', 'min_db' => ['mysql' => '5.5'], From 8e01a33f30a8bcfa60cf388082827844863ae131 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Thu, 27 Oct 2022 06:51:43 -0400 Subject: [PATCH 06/36] English --- language/english/common.php | 49 +++++++++++++++++-- .../mail_template/forum_newpost_notify.tpl | 2 +- .../mail_template/forum_newthread_notify.tpl | 2 +- .../mail_template/global_digest_notify.tpl | 2 +- .../mail_template/global_newforum_notify.tpl | 2 +- .../global_newfullpost_notify.tpl | 2 +- .../mail_template/global_newpost_notify.tpl | 2 +- .../mail_template/thread_newpost_notify.tpl | 2 +- language/english/modinfo.php | 2 +- 9 files changed, 53 insertions(+), 12 deletions(-) diff --git a/language/english/common.php b/language/english/common.php index a5d9be6..d1c4169 100644 --- a/language/english/common.php +++ b/language/english/common.php @@ -58,7 +58,7 @@ //\define('CO_' . $moduleDirNameUpper . '_HELP_DIR', __DIR__); -//help multi-page +//help multipage \define('CO_' . $moduleDirNameUpper . '_DISCLAIMER', 'Disclaimer'); \define('CO_' . $moduleDirNameUpper . '_LICENSE', 'License'); \define('CO_' . $moduleDirNameUpper . '_SUPPORT', 'Support'); @@ -160,10 +160,18 @@ \define('CO_' . $moduleDirNameUpper . '_' . 'FILECOPIED', 'The file has been copied'); \define('CO_' . $moduleDirNameUpper . '_' . 'FILENOTCOPIED', 'The file cannot be copied'); -\define('CO_' . $moduleDirNameUpper . '_' . 'TRUNCATE_LENGTH', 'Number of Characters to truncate to the long text field'); -\define('CO_' . $moduleDirNameUpper . '_' . 'TRUNCATE_LENGTH_DESC', 'Set the maximum number of characters to truncate the long text fields'); +//\define('CO_' . $moduleDirNameUpper . '_' . 'PERMSET', 'The permission has been set'); +//\define('CO_' . $moduleDirNameUpper . '_' . 'PERMNOTSET', 'The permission cannot be set'); //image config +\define('CO_' . $moduleDirNameUpper . '_' . 'CONFIG_EXT_IMAGE', 'EXTERNAL Image configuration'); + +\define('CO_' . $moduleDirNameUpper . '_' . 'CONFIG_STYLING_START', ':: '); +\define('CO_' . $moduleDirNameUpper . '_' . 'CONFIG_STYLING_END', ' :: '); +\define('CO_' . $moduleDirNameUpper . '_' . 'CONFIG_STYLING_DESC_START', ''); +\define('CO_' . $moduleDirNameUpper . '_' . 'CONFIG_STYLING_DESC_END', ' '); + +\define('CO_' . $moduleDirNameUpper . '_' . 'PREFERENCE_BREAK_CONFIG_IMAGE', constant('CO_' . $moduleDirNameUpper . '_' . 'CONFIG_STYLING_START') . constant('CO_' . $moduleDirNameUpper . '_' . 'CONFIG_EXT_IMAGE') . constant('CO_' . $moduleDirNameUpper . '_' . 'CONFIG_STYLING_END')); \define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_WIDTH', 'Image Display Width'); \define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_WIDTH_DSC', 'Display width for image'); \define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_HEIGHT', 'Image Display Height'); @@ -174,7 +182,7 @@ \define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_UPLOAD_PATH_DSC', 'Path for uploading images'); \define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_FILE_SIZE', 'Image File Size (in Bytes)'); -\define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_FILE_SIZE_DSC', 'The maximum file size of the image file (in Bytes)'); +\define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_FILE_SIZE_DSC','The maximum file size of the image file (in Bytes)'); //Module Stats \define('CO_' . $moduleDirNameUpper . '_' . 'STATS_SUMMARY', 'Module Statistics'); @@ -186,3 +194,36 @@ \define('CO_' . $moduleDirNameUpper . '_' . 'TOTAL_SUBMITTED', 'Submitted'); \define('CO_' . $moduleDirNameUpper . '_' . 'ERROR403', 'You are not allowed to view this page!'); + +//Preferences +\define('CO_' . $moduleDirNameUpper . '_' . 'TRUNCATE_LENGTH', 'Number of Characters to truncate to the long text field'); +\define('CO_' . $moduleDirNameUpper . '_' . 'TRUNCATE_LENGTH_DESC', 'Set the maximum number of characters to truncate the long text fields'); + +\define('CO_' . $moduleDirNameUpper . '_' . 'DELETE_BLOCK_CONFIRM', 'Are you sure to delete this Block?'); + +//Cloning +\define('CO_' . $moduleDirNameUpper . '_' . 'CLONE', 'Clone'); +\define('CO_' . $moduleDirNameUpper . '_' . 'CLONE_DSC', 'Cloning a module has never been this easy! Just type in the name you want for it and hit submit button!'); +\define('CO_' . $moduleDirNameUpper . '_' . 'CLONE_TITLE', 'Clone %s'); +\define('CO_' . $moduleDirNameUpper . '_' . 'CLONE_NAME', 'Choose a name for the new module'); +\define('CO_' . $moduleDirNameUpper . '_' . 'CLONE_NAME_DSC', 'Do not use special characters!
    Do not choose an existing module dirname or database table name!'); +\define('CO_' . $moduleDirNameUpper . '_' . 'CLONE_INVALIDNAME', 'ERROR: Invalid module name, please try another one!'); +\define('CO_' . $moduleDirNameUpper . '_' . 'CLONE_EXISTS', 'ERROR: Module name already taken, please try another one!'); +\define('CO_' . $moduleDirNameUpper . '_' . 'CLONE_CONGRAT', 'Congratulations! %s was sucessfully created!
    You may want to make changes in language files.'); +\define('CO_' . $moduleDirNameUpper . '_' . 'CLONE_IMAGEFAIL', 'Attention, we failed creating the new module logo. Please consider modifying assets/images/logo_module.png manually!'); +\define('CO_' . $moduleDirNameUpper . '_' . 'CLONE_FAIL', "Sorry, we failed in creating the new clone. Maybe you need to temporally set write permissions (CHMOD 777) to 'modules' folder and try again."); + +//JSON-LD generation of www.schema.org +\define('CO_' . $moduleDirNameUpper . '_' . 'GENERATE_JSONLD', 'Generate Schema Markup through JSON LD'); +\define('CO_' . $moduleDirNameUpper . '_' . 'GENERATE_JSONLD_DESC', 'Mark up your module with structured data to help search engines better understand the content of your web page'); + +//Repository not found +\define('CO_' . $moduleDirNameUpper . '_' . 'REPO_NOT_FOUND', 'Repository Not Found: '); +//Release not found +\define('CO_' . $moduleDirNameUpper . '_' . 'NO_REL_FOUND', 'Released Version Not Found: '); +//rename upload folder on uninstall +\define('CO_' . $moduleDirNameUpper . '_' . 'ERROR_FOLDER_RENAME_FAILED', 'Could not rename upload folder, please rename manually'); + +//TCPDF +\define('CO_' . $moduleDirNameUpper . '_' . 'ERROR_NO_PDF', 'TCPDF for XOOPS is not installed in /class/libraries/vendor/tecnickcom/tcpdf/
    Please read the /docs/readme.txt or click on the Help tab to learn how to get it!'); + diff --git a/language/english/mail_template/forum_newpost_notify.tpl b/language/english/mail_template/forum_newpost_notify.tpl index dfb534f..c31be63 100644 --- a/language/english/mail_template/forum_newpost_notify.tpl +++ b/language/english/mail_template/forum_newpost_notify.tpl @@ -9,7 +9,7 @@ Follow this link to view the post: You are receiving this message because you selected to be notified when new posts are added to this forum. -If this is an error or you wish not to receive further such notifications, pleas +If this is an error, or if you wish not to receive further such notifications, pleas e update your subscriptions by visiting the link below: {X_UNSUBSCRIBE_URL} diff --git a/language/english/mail_template/forum_newthread_notify.tpl b/language/english/mail_template/forum_newthread_notify.tpl index c746b9a..0673a30 100644 --- a/language/english/mail_template/forum_newthread_notify.tpl +++ b/language/english/mail_template/forum_newthread_notify.tpl @@ -12,7 +12,7 @@ Follow this link to view the forum: You are receiving this message because you selected to be notified when new topics are started in this forum. -If this is an error or you wish not to receive further such notifications, pleas +If this is an error, or if you wish not to receive further such notifications, pleas e update your subscriptions by visiting the link below: {X_UNSUBSCRIBE_URL} diff --git a/language/english/mail_template/global_digest_notify.tpl b/language/english/mail_template/global_digest_notify.tpl index 3151e07..d27dc03 100644 --- a/language/english/mail_template/global_digest_notify.tpl +++ b/language/english/mail_template/global_digest_notify.tpl @@ -10,7 +10,7 @@ Follow these links to view the full topics in the forums: You are receiving this message because you selected to be notified of post digest. -If this is an error or you wish not to receive further such notifications, please update your subscriptions by visiting the link below: +If this is an error, or if you wish not to receive further such notifications, please update your subscriptions by visiting the link below: {X_UNSUBSCRIBE_URL} ----------- diff --git a/language/english/mail_template/global_newforum_notify.tpl b/language/english/mail_template/global_newforum_notify.tpl index dc8e59c..9a33ef3 100644 --- a/language/english/mail_template/global_newforum_notify.tpl +++ b/language/english/mail_template/global_newforum_notify.tpl @@ -15,7 +15,7 @@ Follow this link to view the forum index: You are receiving this message because you selected to be notified when new forums are added to our site. -If this is an error or you wish not to receive further such notifications, please update your subscriptions by visiting the link below: +If this is an error, or if you wish not to receive further such notifications, please update your subscriptions by visiting the link below: {X_UNSUBSCRIBE_URL} ----------- diff --git a/language/english/mail_template/global_newfullpost_notify.tpl b/language/english/mail_template/global_newfullpost_notify.tpl index f6f7cb1..caabbea 100644 --- a/language/english/mail_template/global_newfullpost_notify.tpl +++ b/language/english/mail_template/global_newfullpost_notify.tpl @@ -13,7 +13,7 @@ Follow this link to view the post in the forums (where you can reply): You are receiving this message because you selected to be notified of all new posts. -If this is an error or you wish not to receive further such notifications, pleas +If this is an error, or if you wish not to receive further such notifications, pleas e update your subscriptions by visiting the link below: {X_UNSUBSCRIBE_URL} diff --git a/language/english/mail_template/global_newpost_notify.tpl b/language/english/mail_template/global_newpost_notify.tpl index 28dccba..eed59e6 100644 --- a/language/english/mail_template/global_newpost_notify.tpl +++ b/language/english/mail_template/global_newpost_notify.tpl @@ -9,7 +9,7 @@ Follow this link to view the post: You are receiving this message because you selected to be notified of all new posts. -If this is an error or you wish not to receive further such notifications, pleas +If this is an error, or if you wish not to receive further such notifications, pleas e update your subscriptions by visiting the link below: {X_UNSUBSCRIBE_URL} diff --git a/language/english/mail_template/thread_newpost_notify.tpl b/language/english/mail_template/thread_newpost_notify.tpl index af4b3f3..255ceed 100644 --- a/language/english/mail_template/thread_newpost_notify.tpl +++ b/language/english/mail_template/thread_newpost_notify.tpl @@ -12,7 +12,7 @@ Follow this link to view the thread: You are receiving this message because you selected to be notified when new posts are added to this topic. -If this is an error or you wish not to receive further such notifications, pleas +If this is an error, or if you wish not to receive further such notifications, pleas e update your subscriptions by visiting the link below: {X_UNSUBSCRIBE_URL} diff --git a/language/english/modinfo.php b/language/english/modinfo.php index a357364..0230367 100644 --- a/language/english/modinfo.php +++ b/language/english/modinfo.php @@ -334,7 +334,7 @@ //define('_MI_NEWBB_HELP_DIR', __DIR__); -//help multi-page +//help multipage define('_MI_NEWBB_HELP_DISCLAIMER', 'Disclaimer'); define('_MI_NEWBB_LICENSE', 'License'); define('_MI_NEWBB_SUPPORT', 'Support'); From 66555c96338d5ff946c154ce469a475482ef710e Mon Sep 17 00:00:00 2001 From: mambax7 Date: Thu, 27 Oct 2022 06:52:08 -0400 Subject: [PATCH 07/36] D3LanguageManager --- include/common.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/include/common.php b/include/common.php index 941cb4c..b15f234 100644 --- a/include/common.php +++ b/include/common.php @@ -161,3 +161,11 @@ $GLOBALS['xoopsTpl']->assign('pathModIcon16', XOOPS_URL . '/modules/' . $moduleDirName . '/' . $pathModIcon16); $GLOBALS['xoopsTpl']->assign('pathModIcon32', $pathModIcon32); } + +xoops_loadLanguage('main', $moduleDirName); +if (class_exists('D3LanguageManager')) { + require_once XOOPS_TRUST_PATH . "/libs/altsys/class/D3LanguageManager.class.php"; + $langman = D3LanguageManager::getInstance(); + $langman->read('main.php', $moduleDirName); +} + From fd91b1e917321050cdaad46722e0073b41c36c80 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Thu, 27 Oct 2022 06:53:08 -0400 Subject: [PATCH 08/36] isResultSet() --- class/DigestHandler.php | 2 +- class/OnlineHandler.php | 2 +- class/PostHandler.php | 4 ++-- class/ReportHandler.php | 2 +- class/TopicHandler.php | 2 +- class/TypeHandler.php | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/class/DigestHandler.php b/class/DigestHandler.php index 6a509c6..2e7b9d1 100644 --- a/class/DigestHandler.php +++ b/class/DigestHandler.php @@ -92,7 +92,7 @@ public function getAllDigests($start = 0, $perpage = 5) $result = $this->db->query($sql, $perpage, $start); $ret = []; // $reportHandler = Newbb\Helper::getInstance()->getHandler('Report'); - if ($result instanceof \mysqli_result) { + if ($this->db->isResultSet($result)) { while (false !== ($myrow = $this->db->fetchArray($result))) { $ret[] = $myrow; // return as array } diff --git a/class/OnlineHandler.php b/class/OnlineHandler.php index 259c969..765025f 100644 --- a/class/OnlineHandler.php +++ b/class/OnlineHandler.php @@ -316,7 +316,7 @@ public function getAll($criteria = null) $start = $criteria->getStart(); } $result = $this->db->query($sql, $limit, $start); - if ($result instanceof \mysqli_result) { + if ($this->db->isResultSet($result)) { while (false !== ($myrow = $this->db->fetchArray($result))) { $ret[] = $myrow; if ($myrow['online_uid'] > 0) { diff --git a/class/PostHandler.php b/class/PostHandler.php index 7715176..d31cf1c 100644 --- a/class/PostHandler.php +++ b/class/PostHandler.php @@ -86,7 +86,7 @@ public function &getByLimit( . ' ORDER BY p.post_time DESC'; $result = $this->db->query($sql, $limit, 0); $ret = []; - if ($result instanceof \mysqli_result) { + if ($this->db->isResultSet($result)) { while (false !== ($myrow = $this->db->fetchArray($result))) { $post = $this->create(false); $post->assignVars($myrow); @@ -509,7 +509,7 @@ public function getPostsByLimit($criteria = null, $limit = 1, $start = 0, $join } } $result = $this->db->query($sql, (int)$limit, (int)$start); - if ($result instanceof \mysqli_result) { + if ($this->db->isResultSet($result)) { while (false !== ($myrow = $this->db->fetchArray($result))) { $post = $this->create(false); $post->assignVars($myrow); diff --git a/class/ReportHandler.php b/class/ReportHandler.php index cde540d..b5f193e 100644 --- a/class/ReportHandler.php +++ b/class/ReportHandler.php @@ -94,7 +94,7 @@ public function getAllReports($forums = 0, $order = 'ASC', $perpage = 0, &$start $result = $this->db->query($sql, $perpage, $start); $ret = []; //$reportHandler = Newbb\Helper::getInstance()->getHandler('Report'); - if ($result instanceof \mysqli_result) { + if ($this->db->isResultSet($result)) { while (false !== ($myrow = $this->db->fetchArray($result))) { $ret[] = $myrow; // return as array } diff --git a/class/TopicHandler.php b/class/TopicHandler.php index 0f97491..d1b76fc 100644 --- a/class/TopicHandler.php +++ b/class/TopicHandler.php @@ -381,7 +381,7 @@ public function getAllPosters($topic, $isApproved = true) $sql .= ' AND approved = 1'; } $result = $this->db->query($sql); - if ($result instanceof \mysqli_result) { + if ($this->db->isResultSet($result)) { while (false !== ($myrow = $this->db->fetchArray($result))) { $ret[] = $myrow['uid']; } diff --git a/class/TypeHandler.php b/class/TypeHandler.php index afbc9d0..1385ca6 100644 --- a/class/TypeHandler.php +++ b/class/TypeHandler.php @@ -50,7 +50,7 @@ public function getByForum($forums = null) . ' ORDER BY l.type_order ASC'; $result = $this->db->query($sql); - if ($result instanceof \mysqli_result) { + if ($this->db->isResultSet($result)) { while (false !== ($myrow = $this->db->fetchArray($result))) { $ret[$myrow[$this->keyName]] = [ 'type_id' => $myrow[$this->keyName], From 8a43ed65c0003a99610d3cd2996645e160b5849a Mon Sep 17 00:00:00 2001 From: mambax7 Date: Thu, 27 Oct 2022 06:54:03 -0400 Subject: [PATCH 09/36] https:// cosmetics --- class/Common/Breadcrumb.php | 2 +- class/Common/Configurator.php | 2 +- class/Common/FilesManagement.php | 2 +- class/Common/ServerStats.php | 2 +- class/Common/VersionChecks.php | 2 +- include/functions.text.php | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/class/Common/Breadcrumb.php b/class/Common/Breadcrumb.php index 31db63b..627a536 100644 --- a/class/Common/Breadcrumb.php +++ b/class/Common/Breadcrumb.php @@ -15,7 +15,7 @@ * Breadcrumb Class * * @copyright XOOPS Project (https://xoops.org) - * @license https://www.fsf.org/copyleft/gpl.html GNU public license + * @license GNU GPL 2.0 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @author lucio * * Example: diff --git a/class/Common/Configurator.php b/class/Common/Configurator.php index c0f9aad..8a1aa03 100644 --- a/class/Common/Configurator.php +++ b/class/Common/Configurator.php @@ -15,7 +15,7 @@ * Configurator Class * * @copyright XOOPS Project (https://xoops.org) - * @license https://www.fsf.org/copyleft/gpl.html GNU public license + * @license GNU GPL 2.0 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @author XOOPS Development Team */ diff --git a/class/Common/FilesManagement.php b/class/Common/FilesManagement.php index 6e0ad51..e28e98d 100644 --- a/class/Common/FilesManagement.php +++ b/class/Common/FilesManagement.php @@ -16,7 +16,7 @@ /** * @copyright XOOPS Project (https://xoops.org) - * @license https://www.fsf.org/copyleft/gpl.html GNU public license + * @license GNU GPL 2.0 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @author mamba */ trait FilesManagement diff --git a/class/Common/ServerStats.php b/class/Common/ServerStats.php index 2a502ab..3e55a2c 100644 --- a/class/Common/ServerStats.php +++ b/class/Common/ServerStats.php @@ -14,7 +14,7 @@ /** * @copyright XOOPS Project (https://xoops.org) - * @license https://www.fsf.org/copyleft/gpl.html GNU public license + * @license GNU GPL 2.0 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @author mamba */ trait ServerStats diff --git a/class/Common/VersionChecks.php b/class/Common/VersionChecks.php index 13d5565..74be4ca 100644 --- a/class/Common/VersionChecks.php +++ b/class/Common/VersionChecks.php @@ -14,7 +14,7 @@ /** * @copyright XOOPS Project (https://xoops.org) - * @license https://www.fsf.org/copyleft/gpl.html GNU public license + * @license GNU GPL 2.0 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @author mamba */ trait VersionChecks diff --git a/include/functions.text.php b/include/functions.text.php index d810fb5..a5ddd16 100644 --- a/include/functions.text.php +++ b/include/functions.text.php @@ -3,7 +3,7 @@ * NewBB 4.3x, the forum module for XOOPS project * * @copyright XOOPS Project (https://xoops.org) - * @license https://www.fsf.org/copyleft/gpl.html GNU public license + * @license GNU GPL 2.0 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @author Taiwen Jiang (phppp or D.J.) , irmtfan * @since 4.3 */ From eb220636ec6692b6a428364b5ff2ddab95932ccf Mon Sep 17 00:00:00 2001 From: mambax7 Date: Thu, 27 Oct 2022 06:56:23 -0400 Subject: [PATCH 10/36] https:// --- admin/about.php | 4 ++-- admin/admin_digest.php | 4 ++-- admin/admin_forum_manager.php | 6 +++--- admin/admin_forum_reorder.php | 4 ++-- admin/admin_groupmod.php | 2 +- admin/admin_header.php | 4 ++-- admin/admin_report.php | 4 ++-- admin/admin_votedata.php | 4 ++-- admin/menu.php | 4 ++-- class/ObjectTree.php | 2 +- class/Tree.php | 2 +- include/onuninstall.php | 2 +- notification_update.php | 4 ++-- rss.php | 2 +- 14 files changed, 24 insertions(+), 24 deletions(-) diff --git a/admin/about.php b/admin/about.php index 8a00357..aed9fd7 100644 --- a/admin/about.php +++ b/admin/about.php @@ -10,9 +10,9 @@ */ /** - * @copyright XOOPS Project https://xoops.org/ + * @copyright XOOPS Project (https://xoops.org)/ * @license GNU GPL 2.0 or later (https://www.gnu.org/licenses/gpl-2.0.html) - * @author Kazumi Ono (AKA onokazu) https://www.myweb.ne.jp/, https://xoops.org/, https://jp.xoops.org/ + * @author Kazumi Ono (AKA onokazu) http://www.myweb.ne.jp/, https://xoops.org/, http://jp.xoops.org/ * @author XOOPS Development Team */ diff --git a/admin/admin_digest.php b/admin/admin_digest.php index 16e6a81..2871984 100644 --- a/admin/admin_digest.php +++ b/admin/admin_digest.php @@ -10,9 +10,9 @@ */ /** - * @copyright XOOPS Project https://xoops.org/ + * @copyright XOOPS Project (https://xoops.org)/ * @license GNU GPL 2.0 or later (https://www.gnu.org/licenses/gpl-2.0.html) - * @author Kazumi Ono (AKA onokazu) https://www.myweb.ne.jp/, https://xoops.org/, https://jp.xoops.org/ + * @author Kazumi Ono (AKA onokazu) http://www.myweb.ne.jp/, https://xoops.org/, http://jp.xoops.org/ * @author XOOPS Development Team */ diff --git a/admin/admin_forum_manager.php b/admin/admin_forum_manager.php index db9da66..1ed0e21 100644 --- a/admin/admin_forum_manager.php +++ b/admin/admin_forum_manager.php @@ -10,9 +10,9 @@ */ /** - * @copyright XOOPS Project https://xoops.org/ + * @copyright XOOPS Project (https://xoops.org)/ * @license GNU GPL 2.0 or later (https://www.gnu.org/licenses/gpl-2.0.html) - * @author Kazumi Ono (AKA onokazu) https://www.myweb.ne.jp/, https://xoops.org/, https://jp.xoops.org/ + * @author Kazumi Ono (AKA onokazu) http://www.myweb.ne.jp/, https://xoops.org/, http://jp.xoops.org/ * @author XOOPS Development Team */ @@ -35,7 +35,7 @@ require_once \dirname(__DIR__) . '/include/functions.forum.php'; require_once \dirname(__DIR__) . '/include/functions.render.php'; -$cacheHelper = new Cache('newbb'); +//$cacheHelper = new Cache('newbb'); Utility::cleanCache(); xoops_cp_header(); diff --git a/admin/admin_forum_reorder.php b/admin/admin_forum_reorder.php index a9a2483..86fd65b 100644 --- a/admin/admin_forum_reorder.php +++ b/admin/admin_forum_reorder.php @@ -11,9 +11,9 @@ */ /** - * @copyright XOOPS Project https://xoops.org/ + * @copyright XOOPS Project (https://xoops.org)/ * @license GNU GPL 2.0 or later (https://www.gnu.org/licenses/gpl-2.0.html) - * @author Kazumi Ono (AKA onokazu) https://www.myweb.ne.jp/, https://xoops.org/, https://jp.xoops.org/ + * @author Kazumi Ono (AKA onokazu) http://www.myweb.ne.jp/, https://xoops.org/, http://jp.xoops.org/ * @author XOOPS Development Team */ diff --git a/admin/admin_groupmod.php b/admin/admin_groupmod.php index 638149d..e618442 100644 --- a/admin/admin_groupmod.php +++ b/admin/admin_groupmod.php @@ -11,7 +11,7 @@ */ /** - * @copyright XOOPS Project https://xoops.org/ + * @copyright XOOPS Project (https://xoops.org)/ * @license GNU GPL 2.0 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @author Dirk Herrmann (AKA alfred) https://www.mymyxoops.org/, https://simple-xoops.de/ * @author XOOPS Development Team diff --git a/admin/admin_header.php b/admin/admin_header.php index e30dc45..b48df2f 100644 --- a/admin/admin_header.php +++ b/admin/admin_header.php @@ -10,9 +10,9 @@ */ /** - * @copyright XOOPS Project https://xoops.org/ + * @copyright XOOPS Project (https://xoops.org)/ * @license GNU GPL 2.0 or later (https://www.gnu.org/licenses/gpl-2.0.html) - * @author Kazumi Ono (AKA onokazu) https://www.myweb.ne.jp/, https://xoops.org/, https://jp.xoops.org/ + * @author Kazumi Ono (AKA onokazu) http://www.myweb.ne.jp/, https://xoops.org/, http://jp.xoops.org/ * @author XOOPS Development Team */ diff --git a/admin/admin_report.php b/admin/admin_report.php index 0cb664b..a8e8318 100644 --- a/admin/admin_report.php +++ b/admin/admin_report.php @@ -11,9 +11,9 @@ */ /** - * @copyright XOOPS Project https://xoops.org/ + * @copyright XOOPS Project (https://xoops.org)/ * @license GNU GPL 2.0 or later (https://www.gnu.org/licenses/gpl-2.0.html) - * @author Kazumi Ono (AKA onokazu) https://www.myweb.ne.jp/, https://xoops.org/, https://jp.xoops.org/ + * @author Kazumi Ono (AKA onokazu) http://www.myweb.ne.jp/, https://xoops.org/, http://jp.xoops.org/ * @author XOOPS Development Team */ diff --git a/admin/admin_votedata.php b/admin/admin_votedata.php index fee431f..6b82700 100644 --- a/admin/admin_votedata.php +++ b/admin/admin_votedata.php @@ -10,9 +10,9 @@ */ /** - * @copyright XOOPS Project https://xoops.org/ + * @copyright XOOPS Project (https://xoops.org)/ * @license GNU GPL 2.0 or later (https://www.gnu.org/licenses/gpl-2.0.html) - * @author Kazumi Ono (AKA onokazu) https://www.myweb.ne.jp/, https://xoops.org/, https://jp.xoops.org/ + * @author Kazumi Ono (AKA onokazu) http://www.myweb.ne.jp/, https://xoops.org/, http://jp.xoops.org/ * @author XOOPS Development Team */ diff --git a/admin/menu.php b/admin/menu.php index 4e0ce16..4f87098 100644 --- a/admin/menu.php +++ b/admin/menu.php @@ -10,9 +10,9 @@ */ /** - * @copyright XOOPS Project https://xoops.org/ + * @copyright XOOPS Project (https://xoops.org)/ * @license GNU GPL 2.0 or later (https://www.gnu.org/licenses/gpl-2.0.html) - * @author Kazumi Ono (AKA onokazu) https://www.myweb.ne.jp/, https://xoops.org/, https://jp.xoops.org/ + * @author Kazumi Ono (AKA onokazu) http://www.myweb.ne.jp/, https://xoops.org/, http://jp.xoops.org/ * @author XOOPS Development Team */ diff --git a/class/ObjectTree.php b/class/ObjectTree.php index 3fc92bb..ceccb64 100644 --- a/class/ObjectTree.php +++ b/class/ObjectTree.php @@ -13,7 +13,7 @@ */ /** - * @copyright XOOPS Project https://xoops.org/ + * @copyright XOOPS Project (https://xoops.org)/ * @license GNU GPL 2.0 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @author phppp (D.J., infomax@gmail.com) * @author XOOPS Development Team diff --git a/class/Tree.php b/class/Tree.php index 98aac44..1888ac9 100644 --- a/class/Tree.php +++ b/class/Tree.php @@ -13,7 +13,7 @@ */ /** - * @copyright XOOPS Project https://xoops.org/ + * @copyright XOOPS Project (https://xoops.org)/ * @license GNU GPL 2.0 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @author phppp (D.J., infomax@gmail.com) * @author XOOPS Development Team diff --git a/include/onuninstall.php b/include/onuninstall.php index 90378b0..c587773 100644 --- a/include/onuninstall.php +++ b/include/onuninstall.php @@ -5,7 +5,7 @@ * * @author XOOPS Module Development Team * @copyright {@link https://xoops.org 2001-2016 XOOPS Project} - * @license {@link https://www.fsf.org/copyleft/gpl.html GNU public license} + * @license {@link https://www.gnu.org/licenses/gpl-2.0.html GNU GPL 2.0 or later} * @link https://xoops.org XOOPS */ diff --git a/notification_update.php b/notification_update.php index 9a5c2aa..ce0d5d0 100644 --- a/notification_update.php +++ b/notification_update.php @@ -10,9 +10,9 @@ */ /** - * @copyright XOOPS Project https://xoops.org/ + * @copyright XOOPS Project (https://xoops.org)/ * @license GNU GPL 2.0 or later (https://www.gnu.org/licenses/gpl-2.0.html) - * @author Kazumi Ono (AKA onokazu) https://www.myweb.ne.jp/, https://xoops.org/, https://jp.xoops.org/ + * @author Kazumi Ono (AKA onokazu) http://www.myweb.ne.jp/, https://xoops.org/, http://jp.xoops.org/ * @author XOOPS Development Team */ require_once \dirname(__DIR__, 2) . '/mainfile.php'; diff --git a/rss.php b/rss.php index b5a2e3a..e0eb9f5 100644 --- a/rss.php +++ b/rss.php @@ -11,7 +11,7 @@ */ /** - * @copyright XOOPS Project https://xoops.org/ + * @copyright XOOPS Project (https://xoops.org)/ * @license GNU GPL 2.0 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @author phppp (D.J., infomax@gmail.com) * @author XOOPS Development Team From a619b71a46223b094ecc182bad656af607f2e32d Mon Sep 17 00:00:00 2001 From: mambax7 Date: Thu, 27 Oct 2022 06:57:05 -0400 Subject: [PATCH 11/36] isResultSet() --- include/module.v400.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/module.v400.php b/include/module.v400.php index a463d57..d232e6d 100644 --- a/include/module.v400.php +++ b/include/module.v400.php @@ -3,7 +3,7 @@ * NewBB 4.3x, the forum module for XOOPS project * * @copyright XOOPS Project (https://xoops.org) - * @license https://www.fsf.org/copyleft/gpl.html GNU public license + * @license GNU GPL 2.0 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @author Taiwen Jiang (phppp or D.J.) * @since 4.00 * @return bool @@ -91,7 +91,7 @@ function xoops_module_update_newbb_v400(XoopsModule $module) if (false === ($result = $GLOBALS['xoopsDB']->query($sql))) { xoops_error($GLOBALS['xoopsDB']->error()); } - if ($result instanceof \mysqli_result) { + if ($GLOBALS['xoopsDB']->isResultSet($result)) { while (false !== ($myrow = $GLOBALS['xoopsDB']->fetchArray($result))) { if (empty($myrow['topic_tags'])) { continue; From b5cdfa8c9f44da1baa41dbc40ce9f237728d21d7 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Thu, 27 Oct 2022 06:59:22 -0400 Subject: [PATCH 12/36] updates --- admin/admin_cat_manager.php | 6 +++--- admin/admin_permissions.php | 7 ++++--- admin/index.php | 7 ++++--- class/Common/SysUtility.php | 23 +++++++++++++++++------ class/Common/TestdataButtons.php | 3 ++- class/Post.php | 1 + class/TopicRenderer.php | 4 ++-- class/UserHandler.php | 1 + config/config.php | 4 +++- docs/changelog.txt | 5 +++++ include/functions.image.php | 9 +++++---- include/functions.session.php | 4 ++-- include/functions.time.php | 2 +- include/functions.user.php | 6 +++--- index.php | 3 +-- makepdf.php | 9 +++++++-- xoops_version.php | 5 +++-- 17 files changed, 64 insertions(+), 35 deletions(-) diff --git a/admin/admin_cat_manager.php b/admin/admin_cat_manager.php index f45061a..cd7f24d 100644 --- a/admin/admin_cat_manager.php +++ b/admin/admin_cat_manager.php @@ -10,9 +10,9 @@ */ /** - * @copyright XOOPS Project https://xoops.org/ + * @copyright XOOPS Project (https://xoops.org)/ * @license GNU GPL 2.0 or later (https://www.gnu.org/licenses/gpl-2.0.html) - * @author Kazumi Ono (AKA onokazu) https://www.myweb.ne.jp/, https://xoops.org/, https://jp.xoops.org/ + * @author Kazumi Ono (AKA onokazu) http://www.myweb.ne.jp/, https://xoops.org/, http://jp.xoops.org/ * @author XOOPS Development Team */ @@ -200,7 +200,7 @@ function editCategory(\XoopsObject $categoryObject = null): void break; } -$cacheHelper = Utility::cleanCache(); //$cacheHelper->delete('permission_category'); +Utility::cleanCache(); require_once __DIR__ . '/admin_footer.php'; diff --git a/admin/admin_permissions.php b/admin/admin_permissions.php index 92a4ac5..e2109e2 100644 --- a/admin/admin_permissions.php +++ b/admin/admin_permissions.php @@ -10,7 +10,7 @@ */ /** - * @copyright XOOPS Project https://xoops.org/ + * @copyright XOOPS Project (https://xoops.org)/ * @license GNU GPL 2.0 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @author XOOPS Development Team */ @@ -185,8 +185,8 @@ } $permissionHandler->applyTemplate($forum, $module_id); } - $cacheHelper = Utility::cleanCache(); //$cacheHelper->delete('permission'); + Utility::cleanCache(); redirect_header('admin_permissions.php', 2, _AM_NEWBB_PERM_TEMPLATE_APPLIED); break; default: @@ -296,8 +296,9 @@ /** var Newbb\PermissionHandler $permissionHandler */ $permissionHandler = Helper::getInstance()->getHandler('Permission'); $permissionHandler->createPermData(); - $cacheHelper = Utility::cleanCache(); //$cacheHelper->delete('permission'); + Utility::cleanCache(); + require_once __DIR__ . '/admin_footer.php'; break; } diff --git a/admin/index.php b/admin/index.php index 06c86da..9893783 100644 --- a/admin/index.php +++ b/admin/index.php @@ -10,12 +10,13 @@ */ /** - * @copyright XOOPS Project https://xoops.org/ + * @copyright XOOPS Project (https://xoops.org)/ * @license GNU GPL 2.0 or later (https://www.gnu.org/licenses/gpl-2.0.html) - * @author Kazumi Ono (AKA onokazu) https://www.myweb.ne.jp/, https://xoops.org/, https://jp.xoops.org/ + * @author Kazumi Ono (AKA onokazu) http://www.myweb.ne.jp/, https://xoops.org/, http://jp.xoops.org/ * @author XOOPS Development Team */ +use Xmf\Request; use Xmf\Module\Admin; use XoopsModules\Newbb\{ Common\TestdataButtons, @@ -174,7 +175,7 @@ function newbb_getImageLibs() require_once __DIR__ . '/admin_footer.php'; -$cacheHelper = Utility::cleanCache(); +Utility::cleanCache(); //$cacheHelper = new \Xmf\Module\Helper\Cache('newbb'); //$cacheHelper->delete('config'); //$cacheHelper->delete('permission'); diff --git a/class/Common/SysUtility.php b/class/Common/SysUtility.php index daacbbd..9064c65 100644 --- a/class/Common/SysUtility.php +++ b/class/Common/SysUtility.php @@ -16,7 +16,7 @@ */ /** - * @license https://www.fsf.org/copyleft/gpl.html GNU public license + * @license GNU GPL 2.0 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @copyright https://xoops.org 2000-2020 © XOOPS Project * @author ZySpec * @author Mamba @@ -199,20 +199,31 @@ public static function fieldExists(string $fieldname, string $table): bool } /** - * @param string $tablename + * Check if dB table exists * - * @return bool + * @param string $tablename dB tablename with prefix + * @return bool true if table exists */ - public static function tableExists($tablename) + public static function tableExists(string $tablename): bool { + $ret = false; + $trace = \debug_backtrace(\DEBUG_BACKTRACE_IGNORE_ARGS, 1); + \trigger_error(__FUNCTION__ . " is deprecated, called from {$trace[0]['file']} line {$trace[0]['line']}"); + $GLOBALS['xoopsLogger']->addDeprecated( + \basename(\dirname(__DIR__, 2)) . ' Module: ' . __FUNCTION__ . ' function is deprecated, please use Xmf\Database\Tables method(s) instead.' . " Called from {$trace[0]['file']}line {$trace[0]['line']}" + ); $result = $GLOBALS['xoopsDB']->queryF("SHOW TABLES LIKE '$tablename'"); - return $GLOBALS['xoopsDB']->getRowsNum($result) > 0; + if ($GLOBALS['xoopsDB']->isResultSet($result)) { + $ret = $GLOBALS['xoopsDB']->getRowsNum($result) > 0; + } + + return $ret; } /** * @param array|string $tableName - * @param int $id_field + * @param string $id_field * @param int $id * * @return false diff --git a/class/Common/TestdataButtons.php b/class/Common/TestdataButtons.php index cf08f10..42eca8c 100644 --- a/class/Common/TestdataButtons.php +++ b/class/Common/TestdataButtons.php @@ -46,7 +46,8 @@ public static function loadButtonConfig($adminObject): void $moduleDirNameUpper = \mb_strtoupper($moduleDirName); $helper = Helper::getInstance(); $yamlFile = $helper->path('/config/admin.yml'); - $config = Yaml::readWrapped($yamlFile); // work with phpmyadmin YAML dumps + /** @var array $config */ + $config = Yaml::readWrapped($yamlFile); // work with phpmyadmin YAML dumps $displaySampleButton = $config['displaySampleButton']; if (self::SHOW_BUTTONS == $displaySampleButton) { diff --git a/class/Post.php b/class/Post.php index 7718fc6..b78be59 100644 --- a/class/Post.php +++ b/class/Post.php @@ -214,6 +214,7 @@ public function displayAttachment($asSource = false) } $file_size = @\filesize($GLOBALS['xoops']->path($GLOBALS['xoopsModuleConfig']['dir_attachments'] . '/' . $att['name_saved'])); $file_size = \number_format($file_size / 1024, 2) . ' KB'; + $att['nameDisplay'] = $att['nameDisplay']??''; if ($GLOBALS['xoopsModuleConfig']['media_allowed'] && \in_array(mb_strtolower($file_extension), $image_extensions, true)) { $post_attachment .= '
    ' . $filetype . '  ' . $att['nameDisplay'] . ' (' . $file_size . ')'; diff --git a/class/TopicRenderer.php b/class/TopicRenderer.php index 8997c17..ec99d51 100644 --- a/class/TopicRenderer.php +++ b/class/TopicRenderer.php @@ -330,7 +330,7 @@ public function parseVar($var, $val): void /** @var Newbb\ForumHandler $forumHandler */ $forumHandler = \XoopsModules\Newbb\Helper::getInstance()->getHandler('Forum'); // START irmtfan - get forum Ids by values. parse positive values to forum IDs and negative values to category IDs. value=0 => all valid forums // Get accessible forums - $accessForums = $forumHandler->getIdsByValues(\array_map('\intval', @\explode('|', $val))); + $accessForums = $forumHandler->getIdsByValues(\array_map('\intval', @\explode('|', (string)$val))); // Filter specified forums if any //if (!empty($val) && $_forums = @explode('|', $val)) { //$accessForums = array_intersect($accessForums, array_map('intval', $_forums)); @@ -725,7 +725,7 @@ public function getTypes($type_id = null) /** @var Newbb\TypeHandler $typeHandler */ $typeHandler = Helper::getInstance()->getHandler('Type'); - $types = $typeHandler->getByForum(\explode('|', @$this->vars['forum'])); + $types = $typeHandler->getByForum(\explode('|', (string)@$this->vars['forum'])); } if (empty($type_id)) { diff --git a/class/UserHandler.php b/class/UserHandler.php index 858bd23..0414839 100644 --- a/class/UserHandler.php +++ b/class/UserHandler.php @@ -28,6 +28,7 @@ class UserHandler private $enableOnline; /** @var array */ private $userlist = []; + public $online; /** * @param bool $enableGroup diff --git a/config/config.php b/config/config.php index d99c115..b9ddebd 100644 --- a/config/config.php +++ b/config/config.php @@ -56,7 +56,7 @@ 'templateFolders' => [ '/templates/', - // '/templates/blocks/', + '/templates/blocks/', // '/templates/admin/' ], 'oldFiles' => [ @@ -72,7 +72,9 @@ '/images', '/css', '/js', + '/fpdf', '/tcpdf', + '/images', ], 'renameTables' => [// 'XX_archive' => 'ZZZZ_archive', diff --git a/docs/changelog.txt b/docs/changelog.txt index 6dac588..c98c770 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -1,3 +1,8 @@ +
    5.1.0 Beta 6 [NOT RELEASED]
    Dev: XOOPS 2.5.11-Beta2, PHP 7.4.32, PHP 8.2.0 RC5 +
    +- PHP 8.2 updates (mamba) + +
    5.1.0 Beta 5 [2022-02-22]
    Dev: XOOPS 2.5.11, PHP 7.4.22, PHP 8.0.8
    - index.html in /preloads (mamba) diff --git a/include/functions.image.php b/include/functions.image.php index 7425ed6..42c323f 100644 --- a/include/functions.image.php +++ b/include/functions.image.php @@ -35,12 +35,13 @@ function newbbAttachmentImage($source) $img_info = ''; $imginfo = @getimagesize($image); + // Change by BigKev73 - Removed the is_array check, otherwise the img_info is never set //if (is_array($image)) { - $img_info = (count($imginfo) > 0) ? $imginfo[0] . 'X' . $imginfo[1] . ' px' : ''; + $img_info = (is_array($imginfo) && count($imginfo) > 0) ? $imginfo[0] . 'X' . $imginfo[1] . ' px' : ''; //} - if ($GLOBALS['xoopsModuleConfig']['max_image_width'] > 0 + if (is_array($imginfo) && $GLOBALS['xoopsModuleConfig']['max_image_width'] > 0 && $GLOBALS['xoopsModuleConfig']['max_image_height'] > 0) { if ($imginfo[0] > $GLOBALS['xoopsModuleConfig']['max_image_width'] || $imginfo[1] > $GLOBALS['xoopsModuleConfig']['max_image_height']) { @@ -53,8 +54,8 @@ function newbbAttachmentImage($source) //BigKev73 Change to remove height value - if ($imginfo[0] > $GLOBALS['xoopsModuleConfig']['max_image_width'] - || $imginfo[1] > $GLOBALS['xoopsModuleConfig']['max_image_height']) { + if (is_array($imginfo) && ($imginfo[0] > $GLOBALS['xoopsModuleConfig']['max_image_width'] + || $imginfo[1] > $GLOBALS['xoopsModuleConfig']['max_image_height'])) { $pseudo_width = $GLOBALS['xoopsModuleConfig']['max_image_width']; $pseudo_height = $GLOBALS['xoopsModuleConfig']['max_image_width'] * ($imginfo[1] / $imginfo[0]); $pseudo_size = "width='" . $pseudo_width . "' height='" . $pseudo_height . "'"; diff --git a/include/functions.session.php b/include/functions.session.php index cf1fbb4..8568b2f 100644 --- a/include/functions.session.php +++ b/include/functions.session.php @@ -64,7 +64,7 @@ function newbbGetSession($name, $isArray = false) } /** - * @param $name + * @param string $name * @param string|array $string * @param int $expire */ @@ -78,7 +78,7 @@ function newbbSetCookie($name, $string = '', $expire = 0): void } $string = implode(',', $value); } - setcookie($forumCookie['prefix'] . $name, $string, (int)$expire, $forumCookie['path'], $forumCookie['domain'], $forumCookie['secure']); + setcookie($forumCookie['prefix'] . $name, (string)$string, (int)$expire, $forumCookie['path'], $forumCookie['domain'], $forumCookie['secure']); } /** diff --git a/include/functions.time.php b/include/functions.time.php index bdebfee..3c138c2 100644 --- a/include/functions.time.php +++ b/include/functions.time.php @@ -85,7 +85,7 @@ function newbbSinceSelectBox($selected = 100) if ($since > 0) { $forum_selection_since .= sprintf(_MD_NEWBB_FROMLASTDAYS, $since); } else { - $forum_selection_since .= sprintf(_MD_NEWBB_FROMLASTHOURS, abs($since)); + $forum_selection_since .= sprintf(_MD_NEWBB_FROMLASTHOURS, abs((int)$since)); } } // END irmtfan functional since 0 and 365 diff --git a/include/functions.user.php b/include/functions.user.php index 76f6d40..ee25bd0 100644 --- a/include/functions.user.php +++ b/include/functions.user.php @@ -222,7 +222,7 @@ function newbbIsForumModerators(array $uid = [], $mid = 0) { $forum_moderators = []; - if (!(bool)$uid) { + if (empty($uid)) { return $forum_moderators; } @@ -233,10 +233,10 @@ function newbbIsForumModerators(array $uid = [], $mid = 0) if (empty($myrow['forum_moderator'])) { continue; } - $forum_moderators = array_merge($forum_moderators, unserialize($myrow['forum_moderator'])); + $forum_moderators = array_merge($forum_moderators, (array)unserialize($myrow['forum_moderator'])); } } - return array_unique($forum_moderators); + return array_unique($forum_moderators??[]); } //ENDIF; diff --git a/index.php b/index.php index ccf9f7b..4bf6e25 100644 --- a/index.php +++ b/index.php @@ -10,7 +10,6 @@ */ use Xmf\Request; -use XoopsModules\Newbb\ForumHandler; use XoopsModules\Newbb\{Helper, ForumHandler, ObjectTree, @@ -202,7 +201,7 @@ if ('' === $title) { $title = $url; } - $title = htmlspecialchars($title, ENT_QUOTES | ENT_HTML5); + $title = htmlspecialchars($title??'', ENT_QUOTES | ENT_HTML5); if ('' !== $url) { $cat_sponsor = ['title' => $title, 'link' => formatURL($url)]; } diff --git a/makepdf.php b/makepdf.php index e579b86..273bfe5 100644 --- a/makepdf.php +++ b/makepdf.php @@ -13,12 +13,16 @@ * oledrion * * @copyright {@link https://xoops.org/ XOOPS Project} - * @license {@link https://www.fsf.org/copyleft/gpl.html GNU public license} + * @license {@link https://www.gnu.org/licenses/gpl-2.0.html GNU GPL 2.0 or later} * @author phppp (D.J., infomax@gmail.com) */ use Xmf\Request; use XoopsModules\Xlanguage\Utility as XlanguageUtility; +use XoopsModules\Newbb\Helper; + +$moduleDirName = basename(__DIR__); +$moduleDirNameUpper = \mb_strtoupper($moduleDirName); //use tecnickcom\TCPDF; @@ -26,6 +30,7 @@ error_reporting(0); require_once __DIR__ . '/header.php'; +$helper = Helper::getInstance(); $attach_id = Request::getString('attachid', '', 'GET'); $forum = Request::getInt('forum', 0, 'GET'); $topic_id = Request::getInt('topic_id', 0, 'GET'); @@ -34,7 +39,7 @@ if (is_file(XOOPS_ROOT_PATH . '/class/libraries/vendor/tecnickcom/tcpdf/tcpdf.php')) { require_once XOOPS_ROOT_PATH . '/class/libraries/vendor/tecnickcom/tcpdf/tcpdf.php'; } else { - redirect_header(XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/viewtopic.php?topic_id=' . $topic_id, 3, 'TCPDF for Xoops not installed'); + redirect_header($helper->url('viewtopic.php?topic_id=' . $topic_id), 3, \constant('CO_' . $moduleDirNameUpper . '_' . 'ERROR_NO_PDF')); } if (empty($post_id)) { diff --git a/xoops_version.php b/xoops_version.php index bcbb335..01133d8 100644 --- a/xoops_version.php +++ b/xoops_version.php @@ -15,8 +15,8 @@ $modversion = [ 'version' => '5.1.0', - 'module_status' => 'Beta 5', - 'release_date' => '2022/02/20', + 'module_status' => 'Beta 6', + 'release_date' => '2022/10/26', 'name' => _MI_NEWBB_NAME, 'description' => _MI_NEWBB_DESC, 'help' => 'page=help', @@ -81,6 +81,7 @@ // ------------------- Install/Update ------------------- 'onInstall' => 'include/module.php', 'onUpdate' => 'include/module.php', +// 'onUpdate' => 'include/onupdate.php', // 'onUninstall' => 'include/onuninstall.php', ]; // ------------------- Help files ------------------- // From be98fa98381cda92a330fd39753503dd52531323 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Thu, 27 Oct 2022 07:03:26 -0400 Subject: [PATCH 13/36] xswatch4 --- .../xswatch4/modules/newbb/blocks/index.php | 2 + .../newbb/blocks/newbb_block_author.tpl | 30 ++ .../modules/newbb/blocks/newbb_block_post.tpl | 58 ++++ EXTRA/themes/xswatch4/modules/newbb/index.php | 2 + .../modules/newbb/newbb_edit_post.tpl | 90 ++++++ .../xswatch4/modules/newbb/newbb_index.tpl | 218 +++++++++++++ .../modules/newbb/newbb_index_menu.tpl | 18 ++ .../xswatch4/modules/newbb/newbb_moderate.tpl | 53 ++++ .../newbb/newbb_notification_select.tpl | 43 +++ .../xswatch4/modules/newbb/newbb_online.tpl | 26 ++ .../xswatch4/modules/newbb/newbb_search.tpl | 106 +++++++ .../modules/newbb/newbb_searchresults.tpl | 51 ++++ .../xswatch4/modules/newbb/newbb_thread.tpl | 159 ++++++++++ .../xswatch4/modules/newbb/newbb_viewall.tpl | 287 ++++++++++++++++++ .../modules/newbb/newbb_viewforum.tpl | 243 +++++++++++++++ .../modules/newbb/newbb_viewforum_menu.tpl | 22 ++ .../newbb/newbb_viewforum_subforum.tpl | 42 +++ .../xswatch4/modules/newbb/newbb_viewpost.tpl | 159 ++++++++++ .../modules/newbb/newbb_viewtopic.tpl | 269 ++++++++++++++++ 19 files changed, 1878 insertions(+) create mode 100644 EXTRA/themes/xswatch4/modules/newbb/blocks/index.php create mode 100644 EXTRA/themes/xswatch4/modules/newbb/blocks/newbb_block_author.tpl create mode 100644 EXTRA/themes/xswatch4/modules/newbb/blocks/newbb_block_post.tpl create mode 100644 EXTRA/themes/xswatch4/modules/newbb/index.php create mode 100644 EXTRA/themes/xswatch4/modules/newbb/newbb_edit_post.tpl create mode 100644 EXTRA/themes/xswatch4/modules/newbb/newbb_index.tpl create mode 100644 EXTRA/themes/xswatch4/modules/newbb/newbb_index_menu.tpl create mode 100644 EXTRA/themes/xswatch4/modules/newbb/newbb_moderate.tpl create mode 100644 EXTRA/themes/xswatch4/modules/newbb/newbb_notification_select.tpl create mode 100644 EXTRA/themes/xswatch4/modules/newbb/newbb_online.tpl create mode 100644 EXTRA/themes/xswatch4/modules/newbb/newbb_search.tpl create mode 100644 EXTRA/themes/xswatch4/modules/newbb/newbb_searchresults.tpl create mode 100644 EXTRA/themes/xswatch4/modules/newbb/newbb_thread.tpl create mode 100644 EXTRA/themes/xswatch4/modules/newbb/newbb_viewall.tpl create mode 100644 EXTRA/themes/xswatch4/modules/newbb/newbb_viewforum.tpl create mode 100644 EXTRA/themes/xswatch4/modules/newbb/newbb_viewforum_menu.tpl create mode 100644 EXTRA/themes/xswatch4/modules/newbb/newbb_viewforum_subforum.tpl create mode 100644 EXTRA/themes/xswatch4/modules/newbb/newbb_viewpost.tpl create mode 100644 EXTRA/themes/xswatch4/modules/newbb/newbb_viewtopic.tpl diff --git a/EXTRA/themes/xswatch4/modules/newbb/blocks/index.php b/EXTRA/themes/xswatch4/modules/newbb/blocks/index.php new file mode 100644 index 0000000..47f76a0 --- /dev/null +++ b/EXTRA/themes/xswatch4/modules/newbb/blocks/index.php @@ -0,0 +1,2 @@ + + + <{if $block.disp_mode == 0}> + + <{$smarty.const._MB_NEWBB_AUTHOR}> + <{$smarty.const._MB_NEWBB_COUNT}> + + <{foreach item=author key=uid from=$block.authors}> + + <{$author.name}> + <{$author.count}> + + <{/foreach}> + + <{elseif $block.disp_mode == 1}> + + <{foreach item=author key=uid from=$block.authors}> + + <{$author.name}> <{$author.count}> + + <{/foreach}> + + <{/if}> + + +<{if $block.indexNav}> + +<{/if}> diff --git a/EXTRA/themes/xswatch4/modules/newbb/blocks/newbb_block_post.tpl b/EXTRA/themes/xswatch4/modules/newbb/blocks/newbb_block_post.tpl new file mode 100644 index 0000000..70814fb --- /dev/null +++ b/EXTRA/themes/xswatch4/modules/newbb/blocks/newbb_block_post.tpl @@ -0,0 +1,58 @@ + + <{if $block.disp_mode == 0}> + + + + + + <{foreach item=topic from=$block.topics}> + + + + + + <{/foreach}> + + <{elseif $block.disp_mode == 1}> + + + + + <{foreach item=topic from=$block.topics}> + + + + + <{/foreach}> + + <{elseif $block.disp_mode == 2}> + + <{foreach item=topic from=$block.topics}> + + + + <{/foreach}> + + <{else}> + <{foreach item=topic from=$block.topics}> + + + + + <{/foreach}> + <{/if}> + +
    <{$smarty.const._MB_NEWBB_FORUM}><{$smarty.const._MB_NEWBB_TITLE}><{$smarty.const._MB_NEWBB_AUTHOR}>
    <{$topic.forum_name}><{$topic.title}><{$topic.time}>
    <{$topic.topic_poster}>
    <{$smarty.const._MB_NEWBB_TOPIC}><{$smarty.const._MB_NEWBB_AUTHOR}>
    <{$topic.title}><{$topic.topic_poster}> <{$topic.time}>
    <{$topic.title}>
    + <{$topic.title}> +
    <{$topic.forum_name}> +
    <{$topic.topic_poster}> | <{$topic.time}> +
    +
    <{$topic.post_text|truncateHtml:40:'...'}>
    +
    + +<{if $block.indexNav}> + +<{/if}> diff --git a/EXTRA/themes/xswatch4/modules/newbb/index.php b/EXTRA/themes/xswatch4/modules/newbb/index.php new file mode 100644 index 0000000..47f76a0 --- /dev/null +++ b/EXTRA/themes/xswatch4/modules/newbb/index.php @@ -0,0 +1,2 @@ + + +
    +
    +
    + +<{if $disclaimer|default:''}> +
    <{$disclaimer}>
    +
    +
    +<{/if}> + +<{if $error_message|default:''}> +
    <{$error_message}>
    +
    +
    +<{/if}> + +<{if $post_preview|default:''}> + + + + + + + +
    <{$post_preview.subject}>
    <{$post_preview.meta}>

    + <{$post_preview.content}> +
    +
    +
    +<{/if}> + +
    > +
    + <{foreach item=element from=$form_post.elements}> + <{if $element.hidden|default:false != true}> + +
    + <{$element.body}> + <{if $element.description|default:'' != ''}> +

    <{$element.description}>

    + <{/if}> +
    + <{/if}> + <{/foreach}> +
    + <{foreach item=element from=$form_post.elements}> + <{if $element.hidden|default:false == true}> + <{$element.body}> + <{/if}> + <{/foreach}> +
    +<{$form_post.javascript}> +
    +
    + +<{if $posts_context|default:''}> + + <{foreach item=post from=$posts_context}> + + + + + + + <{/foreach}> +
    <{$post.subject}>
    <{$post.meta}>

    + <{$post.content}> +
    +<{/if}> diff --git a/EXTRA/themes/xswatch4/modules/newbb/newbb_index.tpl b/EXTRA/themes/xswatch4/modules/newbb/newbb_index.tpl new file mode 100644 index 0000000..2acccd6 --- /dev/null +++ b/EXTRA/themes/xswatch4/modules/newbb/newbb_index.tpl @@ -0,0 +1,218 @@ +
    + +
    +

    + + <{$index_title}> + +

    + +

    <{$index_desc}>

    + +
    +
    +
    + <{include file="db:newbb_index_menu.tpl"}> +
    +
    + + <{if $viewer_level gt 1}> +
    + +
    + + <{/if}> +
    +
    + + + <{foreach item=category from=$categories}> + + + + + + + + + + + + + + <{foreach item=forum from=$category.forums}> + + + + + + + + <{/foreach}> + + <{/foreach}> +
    + + <{$category.cat_title}> +
    <{$category.cat_description}> +
    <{$smarty.const._MD_NEWBB_FORUM}><{$smarty.const._MD_NEWBB_TOPICS}><{$smarty.const._MD_NEWBB_POSTS}><{$smarty.const._MD_NEWBB_LASTPOST}>
    <{$forum.forum_folder|default:''}><{$forum.forum_name}> +
    <{$forum.forum_desc}>
    <{$forum.forum_topics}><{$forum.forum_posts}> + <{if $forum.forum_lastpost_subject|default:''}> + <{$forum.forum_lastpost_time}> <{$smarty.const._MD_NEWBB_BY}> <{$forum.forum_lastpost_user}> +
    + + <{$forum.forum_lastpost_subject}> + + + <{else}> + <{$smarty.const._MD_NEWBB_NOTOPIC}> + <{/if}> + <{if $forum.subforum|default:false}> +
    <{$smarty.const._MD_NEWBB_SUBFORUMS}> + <{foreach item=subforum from=$forum.subforum|default:false}>
    + [<{$subforum.forum_name}>] + <{/foreach}> + <{/if}> +
    + +
    +
    + <{$img_forum_new}> = <{$smarty.const._MD_NEWBB_NEWPOSTS}> + <{$img_forum}> = <{$smarty.const._MD_NEWBB_NONEWPOSTS}> +
    +
    + +
    +
    + +
    + +
    + + <{if $currenttime}> +
    +

    <{$online.statistik}> <{$smarty.const._MD_NEWBB_STATS}>

    +
    + +
    + +
    +
      + <{if $userstats}> +
    • <{*$userstats.lastvisit*}> + <{$userstats.lastpost}> +
    • + <{/if}> + +
    • <{$smarty.const._MD_NEWBB_TODAYTOPICSC}> <{$stats[0].topic.day|default:0}>
    • +
    • <{$smarty.const._MD_NEWBB_TODAYPOSTSC}> <{$stats[0].post.day|default:0}>
    • + + <{if $userstats}> +
    • <{$userstats.topics}> | <{$userstats.posts}>
    • + <{if $userstats.digests}> +
    • <{$userstats.digests}>
    • + <{/if}> + <{/if}> +
    +
    + +
    + <{/if}> + + <{if $online}> + <{include file="db:newbb_online.tpl"}> + <{/if}> + + NewBB Version <{$version}> + <{if $rss_button}> + + <{/if}> + + <{include file='db:system_notification_select.tpl'}> + +
    diff --git a/EXTRA/themes/xswatch4/modules/newbb/newbb_index_menu.tpl b/EXTRA/themes/xswatch4/modules/newbb/newbb_index_menu.tpl new file mode 100644 index 0000000..19a8a8f --- /dev/null +++ b/EXTRA/themes/xswatch4/modules/newbb/newbb_index_menu.tpl @@ -0,0 +1,18 @@ + diff --git a/EXTRA/themes/xswatch4/modules/newbb/newbb_moderate.tpl b/EXTRA/themes/xswatch4/modules/newbb/newbb_moderate.tpl new file mode 100644 index 0000000..46654d4 --- /dev/null +++ b/EXTRA/themes/xswatch4/modules/newbb/newbb_moderate.tpl @@ -0,0 +1,53 @@ +
    + +
    + +<{if $error_message}> +
    <{$error_message}>
    +
    +
    +<{/if}> + +

    <{$smarty.const._MD_NEWBB_SUSPEND_LIST}>

    +
    + + + + <{foreach item=colHead from=$columnHeaders}> + + <{/foreach}> + + + + <{foreach item=row from=$columnRows}> + + + + + + + + + <{/foreach}> + +
    + <{if $colHead.url}> + <{$colHead.header}> + <{else}> + <{$colHead.header}> + <{/if}> +
    <{$row.uid}><{$row.start}><{$row.expire}><{$row.forum}><{$row.desc}><{$row.options}>
    +
    +
    + <{$moderate_page_nav|default:''|replace:'form':'div'|replace:'id="xo-pagenav"':''}> +
    + + +
    +
    +<{$suspend_form.rendered|replace:''}> +
    +
    diff --git a/EXTRA/themes/xswatch4/modules/newbb/newbb_notification_select.tpl b/EXTRA/themes/xswatch4/modules/newbb/newbb_notification_select.tpl new file mode 100644 index 0000000..f0ae84c --- /dev/null +++ b/EXTRA/themes/xswatch4/modules/newbb/newbb_notification_select.tpl @@ -0,0 +1,43 @@ +<{if $xoops_notification.show}> +
    +

    <{$lang_activenotifications}>

    + + <{securityToken}> + + + + + + + + + + <{foreach name=outer item=category from=$xoops_notification.categories}> + <{foreach name=inner item=event from=$category.events}> + + <{if $smarty.foreach.inner.first}> + + <{/if}> + + + + <{/foreach}> + <{/foreach}> + + + +
    <{$lang_notificationoptions}>
    <{$lang_category}><{$lang_events}>
    <{$category.title}> + <{counter assign=index}> + + checked="checked"<{/if}> > + <{$event.caption}>
    +
    + <{$lang_notificationmethodis}>: <{$user_method}>   + [<{$lang_change}>] +
    +
    +<{/if}> diff --git a/EXTRA/themes/xswatch4/modules/newbb/newbb_online.tpl b/EXTRA/themes/xswatch4/modules/newbb/newbb_online.tpl new file mode 100644 index 0000000..8936bd9 --- /dev/null +++ b/EXTRA/themes/xswatch4/modules/newbb/newbb_online.tpl @@ -0,0 +1,26 @@ +
    +
    + <{$online.image}> + <{$smarty.const._MD_NEWBB_USERS_ONLINE}> <{$online.num_total}> <{$smarty.const._MD_NEWBB_BROWSING_FORUM}> +
    +
    + [ <{$smarty.const._MD_NEWBB_ADMINISTRATOR}> ] [ <{$smarty.const._MD_NEWBB_MODERATOR}> ] +
    <{$online.num_anonymous}> <{$smarty.const._MD_NEWBB_ANONYMOUS_USERS}> + <{if $online.num_user}> +
    + <{$online.num_user}> <{$smarty.const._MD_NEWBB_REGISTERED_USERS}> + <{foreach item=user from=$online.users}> + + <{if $user.level eq 2}> + <{$user.uname}> + <{elseif $user.level eq 1}> + <{$user.uname}> + <{else}> + <{$user.uname}> + <{/if}> + + <{/foreach}> + <{/if}> +
    +
    diff --git a/EXTRA/themes/xswatch4/modules/newbb/newbb_search.tpl b/EXTRA/themes/xswatch4/modules/newbb/newbb_search.tpl new file mode 100644 index 0000000..cd985c1 --- /dev/null +++ b/EXTRA/themes/xswatch4/modules/newbb/newbb_search.tpl @@ -0,0 +1,106 @@ + +<{if $search_info|default:''}> + <{include file="db:newbb_searchresults.tpl" results=$results}> +<{/if}> + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <{if $search_rule}> + + + + + + <{/if}> + + + + + + +
    <{$smarty.const._SR_KEYWORDS}> 
    <{$smarty.const._SR_TYPE}> <{$andor_selection_box}>
    <{$smarty.const._MD_NEWBB_FORUMC}> <{$forum_selection_box}>
    <{$smarty.const._SR_SEARCHIN}>  + <{*$searchin_radio*}> +
    + + +
    +
    + + +
    +
    + + +
    +
    <{$smarty.const._MD_NEWBB_AUTHOR}> 
    <{$smarty.const._MD_NEWBB_SORTBY}> <{$sortby_selection_box}>
    <{$smarty.const._MD_NEWBB_SINCE}> <{$since_selection_box}>
    + <{$smarty.const._MD_NEWBB_SELECT_STARTLAG}>  + + +
    <{$smarty.const._MD_NEWBB_SELECT_LENGTH}> 
    <{$smarty.const._MD_NEWBB_SHOWSEARCH}>  + <{*$show_search_radio*}> +
    + + +
    +
    + + +
    + +
    <{$smarty.const._SR_SEARCHRULE}> <{$search_rule}>
     
    +
    diff --git a/EXTRA/themes/xswatch4/modules/newbb/newbb_searchresults.tpl b/EXTRA/themes/xswatch4/modules/newbb/newbb_searchresults.tpl new file mode 100644 index 0000000..ef95ba4 --- /dev/null +++ b/EXTRA/themes/xswatch4/modules/newbb/newbb_searchresults.tpl @@ -0,0 +1,51 @@ +
    <{$search_info}>
    +
    +<{if $results}> + + + + + + + + + + + + <{section name=i loop=$results}> + + + + + + + + + + <{if $results[i].post_text }> + + + + + + + <{/if}> + + + <{/section}> + + + <{if $search_next|default:'' or $search_prev|default:''}> + + + + + + <{/if}> + +
    <{$smarty.const._MD_NEWBB_FORUMC}><{$smarty.const._MD_NEWBB_SUBJECT}><{$smarty.const._MD_NEWBB_AUTHOR}><{$smarty.const._MD_NEWBB_POSTTIME}>
    <{$results[i].forum_name}><{$results[i].title}><{$results[i].poster}><{$results[i].post_time}>
    <{$results[i].post_text}>
    <{$search_prev|default:''}> <{$search_next|default:''}>
    +
    +<{elseif $lang_nomatch}> +
    <{$lang_nomatch}>
    +
    +<{/if}> diff --git a/EXTRA/themes/xswatch4/modules/newbb/newbb_thread.tpl b/EXTRA/themes/xswatch4/modules/newbb/newbb_thread.tpl new file mode 100644 index 0000000..a03cbfd --- /dev/null +++ b/EXTRA/themes/xswatch4/modules/newbb/newbb_thread.tpl @@ -0,0 +1,159 @@ +
    + <{if $forum_post_prefix|default:null === null }> + <{assign var=forum_post_prefix value="forumpost"}> +
    + <{/if}> +
    +
    +
    + <{$topic_post.poster.link}> + + <{if $topic_post.poster.uid|default:'' gt -1}> + <{if $topic_post.poster.uid != 0}> + <{if $topic_post.poster.avatar != "blank.gif"}> + <{$topic_post.poster.name}> + <{else}> + <{$topic_post.poster.name}> + <{/if}> + + <{if $topic_post.poster.rank.title !=""}> +
      +
    • <{$topic_post.poster.rank.title}>
    • +
    • <{$topic_post.poster.rank.title}>
    • +
    + <{/if}> + + <{if $infobox.show|default:''}> + +
    +
      +
    • <{$smarty.const._MD_NEWBB_JOINED}>: <{$topic_post.poster.regdate}>
    • + <{if $topic_post.poster.from}> +
    • <{$smarty.const._MD_NEWBB_FROM}> + <{$topic_post.poster.from}>
    • + <{/if}> + + <{if $topic_post.poster.groups}> +
    • <{$smarty.const._MD_NEWBB_GROUP}> + <{foreach item=group from=$topic_post.poster.groups}> + <{$group}> + <{/foreach}>
    • + <{/if}> + +
    • + <{$smarty.const._MD_NEWBB_POSTS}>: + <{if $topic_post.poster.posts gt 0}> + + <{$topic_post.poster.posts}> + + <{else}> + 0 + <{/if}> +
    • + <{if isset($topic_post.poster.digests) && is_array($topic_post.poster.digests) && $topic_post.poster.digests gt 0}> +
    • + <{$smarty.const._MD_NEWBB_DIGESTS}>: <{$topic_post.poster.digests}> +
    • + <{/if}> + + <{if $topic_post.poster.level|default:''}> +
    • <{$topic_post.poster.level}>
    • + <{/if}> + + <{if $topic_post.poster.status}> +
    • <{$topic_post.poster.status}>
    • + <{/if}> +
    +
    + <{/if}> + <{else}> +
    <{$anonymous_prefix}><{$topic_post.poster.name}>
    + <{/if}> + <{else}> +   + <{/if}> + +
      + <{if $topic_post.poster_ip}> +
    • IP: <{$topic_post.poster_ip}>
    • + <{/if}> + + <{if $topic_post.poster.uid|default:'' gt 0}> +
    • <{$smarty.const._MD_NEWBB_POSTEDON}><{$topic_post.post_date}>
    • + <{/if}> +
    + +
    + +
    +
    +
    + <{$topic_post.post_title}> + + <{if $topic_post.post_id > 0}> + + #<{$topic_post.post_no}> + + <{/if}> +
    + + <{$topic_post.post_text}> + + <{if $topic_post.post_attachment}> +
    + <{$topic_post.post_attachment}> +
    + <{/if}> + + <{if $topic_post.post_edit}> +
    + <{$topic_post.post_edit}> +
    + <{/if}> + + <{if $topic_post.post_signature}> +
    + <{$topic_post.post_signature}> +
    + <{/if}> +
    +
    +
    +
    + + diff --git a/EXTRA/themes/xswatch4/modules/newbb/newbb_viewall.tpl b/EXTRA/themes/xswatch4/modules/newbb/newbb_viewall.tpl new file mode 100644 index 0000000..cb00635 --- /dev/null +++ b/EXTRA/themes/xswatch4/modules/newbb/newbb_viewall.tpl @@ -0,0 +1,287 @@ + +
    + +
    + <{if $mode gt 1}> +
    + <{/if}> + <{if $viewer_level gt 1}> + + +
    + <{else}> +
    + <{/if}> +
    + +
    +
    + <{if $menumode eq 0}> + + <{elseif $menumode eq 1}> + + + + <{elseif $menumode eq 2}> + + <{/if}> +
    + +
    + <{$pagenav|replace:'form':'div'|replace:'id="xo-pagenav"':''|replace:' //':'/'}> + +
    +
    +
    +
    +
    + <{if $mode gt 1}> +
    + <{/if}> + +
    +
    + + + + + + + + + + + + + + <{foreach name=loop item=topic from=$topics}> + "> + + + + + + + + + + + + + + + <{/foreach}> + + + + + +
    + <{if $mode gt 1}> + <{$smarty.const._ALL}>: + + <{else}> +   + <{/if}> + + <{$headers.topic.title}><{$headers.forum.title}> <{$headers.replies.title}><{$headers.poster.title}> + <{$headers.views.title}><{$headers.lastpost.title}>
    + <{if $mode gt 1}> + + <{else}> + + <{$topic.topic_folder}><{$topic.lock}> + <{/if}> + <{$topic.topic_icon}><{$topic.sticky}>
    <{$topic.digest}><{$topic.poll}>
      + <{$topic.topic_title}><{$topic.attachment|default:''}> <{$topic.topic_page_jump}> + +
    + <{$headers.publish.title}>: <{$topic.topic_time}> + <{if $rating_enable && $topic.votes}> + |  + <{$headers.votes.title}>: <{$topic.votes}> <{$topic.rating_img}> + <{/if}> +
    <{$topic.topic_forum_link}><{$topic.topic_replies}><{$topic.topic_poster}><{$topic.topic_views}><{$topic.topic_last_posttime}>
    + <{$smarty.const._MD_NEWBB_BY}> <{$topic.topic_last_poster}>  <{$topic.topic_page_jump_icon}> +
    + <{strip}> +
    +
      +
    • <{$smarty.const._MD_NEWBB_SORTEDBY}>:
    • +
    • <{$selection.sort|replace:'
    • +
    • <{$selection.since}>
    • +
    + <{foreach item=hidval key=hidvar from=$selection.vars}> + <{if $hidval && $hidvar neq "sort" && $hidvar neq "order" && $hidvar neq "since"}> + + + <{/if}> + <{/foreach}> + + +
    + <{/strip}> +
    + + +<{if $pagenav}> + +
    <{$pagenav|replace:'form':'div'|replace:'id="xo-pagenav"':''|replace:' //':'/'}> +
    +
    +<{/if}> +
    + +
    +
    + <{$img_newposts}> = <{$smarty.const._MD_NEWBB_NEWPOSTS}> (<{$img_hotnewposts}> = <{$smarty.const._MD_NEWBB_MORETHAN}>)
    + <{$img_folder}> = <{$smarty.const._MD_NEWBB_NONEWPOSTS}> (<{$img_hotfolder}> = <{$smarty.const._MD_NEWBB_MORETHAN2}>)
    + <{$img_locked}> = <{$smarty.const._MD_NEWBB_TOPICLOCKED}>
    + <{$img_sticky}> = <{$smarty.const._MD_NEWBB_TOPICSTICKY}>
    + <{$img_digest}> = <{$smarty.const._MD_NEWBB_TOPICDIGEST}>
    + <{$img_poll}> = <{$smarty.const._MD_NEWBB_TOPICHASPOLL}> +
    + +
    +
    + + <{foreach item=hidval key=hidvar from=$search}> + <{if $hidval }> + + + <{/if}> + <{/foreach}> +
    + [<{$smarty.const._MD_NEWBB_ADVSEARCH}>] +
    +
    +
    + <{$forum_jumpbox|replace:' class="select"':' class="btn btn-light"'|replace:"'button'":'"btn btn-sm btn-light"'}> +
    +
    +
    +
    +
    + +<{if $online}><{include file="db:newbb_online.tpl"}><{/if}> +<{include file='db:system_notification_select.tpl'}> + diff --git a/EXTRA/themes/xswatch4/modules/newbb/newbb_viewforum.tpl b/EXTRA/themes/xswatch4/modules/newbb/newbb_viewforum.tpl new file mode 100644 index 0000000..ef26363 --- /dev/null +++ b/EXTRA/themes/xswatch4/modules/newbb/newbb_viewforum.tpl @@ -0,0 +1,243 @@ +
    + +
    +
    + <{if $viewer_level gt 1}> + <{$smarty.const.THEME_FORUM_NEWTOPIC}> + <{else}> + <{if $xoops_isuser}> + <{$smarty.const.THEME_FORUM_NEWTOPIC}> + <{else}> + <{$smarty.const.THEME_FORUM_REGISTER}> + <{/if}> + <{/if}> + + <{if $forum_topictype|default:''}><{$forum_topictype}><{/if}> + + <{if $forum_topicstatus}> + <{$forum_topicstatus}> + <{else}> + + <{$smarty.const._MD_NEWBB_DIGEST}> + + <{/if}> + + + + + + <{if $subforum|default:''}> + <{include file="db:newbb_viewforum_subforum.tpl"}> + <{/if}> +
    +
    + + +
    + +
    +
    +
    +
    +
    + <{if $mode gt 1}> +
    + <{/if}> + + <{if $viewer_level gt 1}> + <{if $mode gt 1}> +
    +
    +
    + + +
    +
    +
    + +
    + +
    + +
    + +
    + <{else}> + <{$smarty.const.THEME_ADD_POLL}> + <{$smarty.const._MD_NEWBB_TYPE_ADMIN}> + <{$smarty.const._MD_NEWBB_TYPE_PENDING}> + <{$smarty.const._MD_NEWBB_TYPE_DELETED}> + + <{/if}> + + <{else}> + <{$smarty.const.THEME_ADD_POLL}> + <{/if}> +
    +
    + <{include file="db:newbb_viewforum_menu.tpl"}> +
    +
    +
    +
    + <{$forum_pagenav|replace:'form':'div'|replace:'id="xo-pagenav"':''}> +
    + +
    + <{* assign var='desctext' value=`$smarty.const._MD_NEWBB_FORUMDESCRIPTION` *}> + <{* $desctext|regex_replace:"/:$/":"" *}> +
    +

    <{$forum_name}>

    + <{$forumDescription}> +
    + + + <{foreach item=topic from=$topics}> + + <{if $mode gt 1}> + + <{/if}> + + + + + + + <{if $rating_enable}> + + <{/if}> + <{assign var='golast' value=`$smarty.const._MD_NEWBB_GOTOLASTPOST`}> + <{assign var='golastimg' value=""}> + + + <{/foreach}> + + + + <{if $mode gt 1}> + + <{/if}> + + + + + + + <{if $rating_enable}> + + <{/if}> + + + +
    <{$topic.topic_folder}><{$topic.topic_title}> <{$topic.topic_poster}><{$topic.topic_time}><{$topic.topic_replies}><{$topic.topic_views}><{$topic.rating_img}><{$topic.topic_last_posttime}> <{$smarty.const._MD_NEWBB_BY}> <{$topic.topic_last_poster}> <{$topic.topic_page_jump_icon|regex_replace:'//':$golastimg}>
    <{$smarty.const._MD_NEWBB_TOPICS}> <{$smarty.const._MD_NEWBB_TOPICPOSTER}> <{$smarty.const._MD_NEWBB_TOPICTIME}> <{$smarty.const._MD_NEWBB_REPLIES}> <{$smarty.const._MD_NEWBB_VIEWS}> <{$smarty.const._MD_NEWBB_RATINGS}> <{$smarty.const._MD_NEWBB_LASTPOSTTIME}>
    + <{if empty($topics)}> + + <{/if}> + <{if $mode gt 1}> + + <{/if}> + +
    + +
    <{$forum_pagenav|replace:'form':'div'|replace:'id="xo-pagenav"':''}>
    + +
    +
    + <{strip}> +
    +
      +
    • <{$smarty.const._MD_NEWBB_SORTEDBY}>:
    • +
    • <{$forum_selection_sort|replace:'
    • +
    • <{$forum_selection_since}>
    • + + +
    • +
    +
    + <{/strip}> +
    + +
    +
    <{$forum_jumpbox|replace:' class="select"':' class="btn btn-light"'|replace:"'button'":'"btn btn-sm btn-light"'}>
    + +
    + +
    +
    + <{foreach item=perm from=$permission_table|default:''}> + <{$perm}> + <{/foreach}> +
    + +
    +
      +
    • <{$img_newposts}> = <{$smarty.const._MD_NEWBB_NEWPOSTS}> (<{$img_hotnewposts}> = <{$smarty.const._MD_NEWBB_MORETHAN}>)
    • +
    • <{$img_folder}> = <{$smarty.const._MD_NEWBB_NONEWPOSTS}> (<{$img_hotfolder}> = <{$smarty.const._MD_NEWBB_MORETHAN2}>)
    • +
    • <{$img_locked}> = <{$smarty.const._MD_NEWBB_TOPICLOCKED}>
    • +
    • <{$img_sticky}> = <{$smarty.const._MD_NEWBB_TOPICSTICKY}>
    • +
    • <{$img_digest}> = <{$smarty.const._MD_NEWBB_TOPICDIGEST}>
    • +
    • <{$img_poll}> = <{$smarty.const._MD_NEWBB_TOPICHASPOLL}>
    • +
    +
    +
    + +<{if $online}> + <{include file="db:newbb_online.tpl"}> +<{/if}> + +NewBB Version <{$version}> +<{if $rss_button}> + + <{$rss_button}> + +<{/if}> +<{include file='db:system_notification_select.tpl'}> +
    diff --git a/EXTRA/themes/xswatch4/modules/newbb/newbb_viewforum_menu.tpl b/EXTRA/themes/xswatch4/modules/newbb/newbb_viewforum_menu.tpl new file mode 100644 index 0000000..f6a51ea --- /dev/null +++ b/EXTRA/themes/xswatch4/modules/newbb/newbb_viewforum_menu.tpl @@ -0,0 +1,22 @@ + + +<{if $typeOptions}> + +<{/if}> diff --git a/EXTRA/themes/xswatch4/modules/newbb/newbb_viewforum_subforum.tpl b/EXTRA/themes/xswatch4/modules/newbb/newbb_viewforum_subforum.tpl new file mode 100644 index 0000000..f76b6fc --- /dev/null +++ b/EXTRA/themes/xswatch4/modules/newbb/newbb_viewforum_subforum.tpl @@ -0,0 +1,42 @@ + + <{$smarty.const._MD_NEWBB_SUBFORUMS}> + +
    +
    + + + + + + + + + + + + <{foreach item=sforum from=$subforum}> + + + + + + + + + <{/foreach}> + +
    <{$smarty.const._MD_NEWBB_FORUM}><{$smarty.const._MD_NEWBB_TOPICS}><{$smarty.const._MD_NEWBB_POSTS}><{$smarty.const._MD_NEWBB_LASTPOST}>
    <{$sforum.forum_folder}><{$sforum.forum_name}> +
    <{$sforum.forum_desc}>
    <{$sforum.forum_topics}><{$sforum.forum_posts}> + <{if $sforum.forum_lastpost_subject}> + <{$sforum.forum_lastpost_time}> <{$smarty.const._MD_NEWBB_BY}> <{$sforum.forum_lastpost_user}> +
    + + <{$sforum.forum_lastpost_subject}> + + + <{else}> + <{$smarty.const._MD_NEWBB_NOTOPIC}> + <{/if}> +
    +
    +
    diff --git a/EXTRA/themes/xswatch4/modules/newbb/newbb_viewpost.tpl b/EXTRA/themes/xswatch4/modules/newbb/newbb_viewpost.tpl new file mode 100644 index 0000000..5213ab3 --- /dev/null +++ b/EXTRA/themes/xswatch4/modules/newbb/newbb_viewpost.tpl @@ -0,0 +1,159 @@ +
    + +
    +
    +<{if $viewer_level gt 1}> +
    + <{if $mode gt 1}> +
    +
    +
    +
    + + +
    +
    +
    + +
    + +
    + +
    + +
    + <{else}> + <{$smarty.const._MD_NEWBB_TYPE_ADMIN}> | + <{$smarty.const._MD_NEWBB_TYPE_PENDING}> | + <{$smarty.const._MD_NEWBB_TYPE_DELETED}> + <{/if}> +
    +<{/if}> +
    +
    + + + +
    +
    +
    +
    + +
    +
    + +
    +
    + + +
    + <{$pagenav|replace:'form':'div'|replace:'id="xo-pagenav"':''}> +
    +
    +
    +
    + +<{foreach item=post from=$posts}> +<{include file="db:newbb_thread.tpl" topic_post=$post}> + + +
    +
    +
    +<{/foreach}> + +<{if $mode gt 1}> + +<{/if}> + +
    +
    +
    + + + +
    + +
    + <{$pagenav|replace:'form':'div'|replace:'id="xo-pagenav"':''}> + +
    +
    +
    + +
    +
    + <{$forum_jumpbox|replace:' class="select"':' class="btn btn-light"'|replace:"'button'":'"btn btn-sm btn-light"'}> +
    + +
    +
    +
    +<{if $online|default:''}> +
    + <{include file="db:newbb_online.tpl"}> +<{/if}> +<{include file='db:system_notification_select.tpl'}> + diff --git a/EXTRA/themes/xswatch4/modules/newbb/newbb_viewtopic.tpl b/EXTRA/themes/xswatch4/modules/newbb/newbb_viewtopic.tpl new file mode 100644 index 0000000..ee3a991 --- /dev/null +++ b/EXTRA/themes/xswatch4/modules/newbb/newbb_viewtopic.tpl @@ -0,0 +1,269 @@ +
    + + + <{if $tagbar|default:false}> +
    + <{include file="db:tag_bar.tpl"}> +
    + <{/if}> + + <{if $online}> +
    +
    + <{$smarty.const._MD_NEWBB_BROWSING}> + <{foreach item=user from=$online.users}> + + <{if $user.level eq 2}> + + <{elseif $user.level eq 1}> + + <{else}> + + <{/if}> + + <{/foreach}> + + <{if $online.num_anonymous}> + <{$online.num_anonymous}> <{$smarty.const._MD_NEWBB_ANONYMOUS_USERS}> + <{/if}> +
    +
    + <{/if}> + +
    + <{if $viewer_level gt 1}> +
    + <{if $mode gt 1}> +
    +
    +
    +
    + + +
    +
    +
    + +
    + +
    + +
    + +
    + <{else}> + <{$smarty.const._MD_NEWBB_TYPE_ADMIN}> | + <{$smarty.const._MD_NEWBB_TYPE_PENDING}> | + <{$smarty.const._MD_NEWBB_TYPE_DELETED}> + <{/if}> +
    + <{/if}> +
    + <{$forum_page_nav|replace:'form':'div'|replace:'id="xo-pagenav"':''}> +
    +
    + + <{if $mode lte 1}> + <{if $topic_poll|default:''}> + <{if $topic_pollresult|default:''}> + <{include file="db:newbb_poll_results.tpl" poll=$poll|default:''}> + <{else}> + <{include file="db:newbb_poll_view.tpl" poll=$poll|default:''}> + <{/if}> + <{/if}> + <{/if}> + + + + + +
    +
    + +
    + <{if $rating_enable && $forum_post && $forum_reply}> +
    + +
    + <{/if}> +
    + +
    +
    + + <{if $viewer_level gt 1 && $topic_status == 1}> + <{$smarty.const._MD_NEWBB_TOPICLOCK}> + <{/if}> + + <{foreach item=topic_post from=$topic_posts}> + <{include file="db:newbb_thread.tpl" topic_post=$topic_post mode=$mode}> + <{foreachelse}> + + <{/foreach}> + + <{if $mode gt 1}> + + <{/if}> + + + +<{include file='db:system_notification_select.tpl'}> + +
    + + + + From b9a07cfff2ef329c6d2dbfeae554d5f86908ee27 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Thu, 27 Oct 2022 10:55:08 -0400 Subject: [PATCH 14/36] EXTRA template updates --- .../templates_fulldiv_opacity/newbb_index.tpl | 2 +- .../newbb_viewforum.tpl | 2 +- .../themes/xbootstrap/modules/newbb/index.php | 2 +- .../modules/newbb/newbb_edit_post.tpl | 4 +- .../xbootstrap/modules/newbb/newbb_index.tpl | 12 ++--- .../newbb/newbb_notification_select.tpl | 2 +- .../xbootstrap/modules/newbb/newbb_thread.tpl | 6 +-- .../modules/newbb/newbb_viewforum.tpl | 6 +-- .../newbb/newbb_viewforum_subforum.tpl | 2 +- .../modules/newbb/newbb_viewpost.tpl | 6 +-- .../modules/newbb/newbb_viewtopic.tpl | 48 +++++++++---------- 11 files changed, 46 insertions(+), 46 deletions(-) diff --git a/EXTRA/themes/templates_fulldiv_opacity/newbb_index.tpl b/EXTRA/themes/templates_fulldiv_opacity/newbb_index.tpl index 2a9d7b7..b453e9f 100644 --- a/EXTRA/themes/templates_fulldiv_opacity/newbb_index.tpl +++ b/EXTRA/themes/templates_fulldiv_opacity/newbb_index.tpl @@ -221,7 +221,7 @@ <{$rss_button}>
    - NewBB Version <{$version/100}> + NewBB Version <{$version}>
    <{/if}>
    diff --git a/EXTRA/themes/templates_fulldiv_opacity/newbb_viewforum.tpl b/EXTRA/themes/templates_fulldiv_opacity/newbb_viewforum.tpl index 082f87b..0202597 100644 --- a/EXTRA/themes/templates_fulldiv_opacity/newbb_viewforum.tpl +++ b/EXTRA/themes/templates_fulldiv_opacity/newbb_viewforum.tpl @@ -222,7 +222,7 @@ <{$rss_button}> - NewBB Version <{$version/100}> + NewBB Version <{$version}>
    <{/if}> <{$forum_jumpbox}> diff --git a/EXTRA/themes/xbootstrap/modules/newbb/index.php b/EXTRA/themes/xbootstrap/modules/newbb/index.php index e5ee072..6a50543 100644 --- a/EXTRA/themes/xbootstrap/modules/newbb/index.php +++ b/EXTRA/themes/xbootstrap/modules/newbb/index.php @@ -1,2 +1,2 @@ -" <{$form_post.extra}> > <{foreach item=element from=$form_post.elements}> - <{if $element.hidden|default:false !== true}> + <{if $element.hidden|default:false != true}>
    <{foreach item=element from=$form_post.elements}> - <{if $element.hidden|default:false === true}> + <{if $element.hidden|default:false == true}> <{$element.body}> <{/if}> <{/foreach}> diff --git a/EXTRA/themes/xbootstrap/modules/newbb/newbb_index.tpl b/EXTRA/themes/xbootstrap/modules/newbb/newbb_index.tpl index cfffa8b..c10b936 100644 --- a/EXTRA/themes/xbootstrap/modules/newbb/newbb_index.tpl +++ b/EXTRA/themes/xbootstrap/modules/newbb/newbb_index.tpl @@ -105,7 +105,7 @@