<{section name=i loop=$columns}>
- <{foreach item=topic from=$columns[i]}>
+ <{foreach item=topic from=$columns[i]|default:null}>
<{$topic.title}>
+ href="<{$xoops_url}>/modules/<{$xoops_dirname}>/index.php?storytopic=<{$topic.id}>"><{$topic.title}>
<{counter start=0 print=false assign=storynum}>
- <{foreach item=story from=$topic.stories}>
+ <{foreach item=story from=$topic.stories|default:null}>
<{if $storynum == 0}>
<{include file="db:news_item.tpl" story=$story}>
<{else}>
@@ -17,7 +17,7 @@
<{/if}>
- <{$story.title}>
+ href="<{$xoops_url}>/modules/<{$xoops_dirname}>/article.php?storyid=<{$story.id}>"><{$story.title}>
(<{$story.posttime}>)
<{/if}>
@@ -26,7 +26,7 @@
<{if $storynum > 1}>
<{$lang_morereleases}><{$topic.title}>
+ href="<{$xoops_url}>/modules/<{$xoops_dirname}>/index.php?storytopic=<{$topic.id}>"><{$lang_morereleases}><{$topic.title}>
<{/if}>
<{/foreach}>
diff --git a/templates/news_index.tpl b/templates/news_index.tpl
index 9567480..bf55d5e 100644
--- a/templates/news_index.tpl
+++ b/templates/news_index.tpl
@@ -5,7 +5,7 @@
<{if $displaynav === true}>
-
@@ -20,7 +20,7 @@
<{section name=i loop=$columns}>
- | <{foreach item=story from=$columns[i]}><{include file="db:news_item.tpl" story=$story}><{/foreach}> |
+ <{foreach item=story from=$columns[i]|default:null}><{include file="db:news_item.tpl" story=$story}><{/foreach}> |
<{/section}>
diff --git a/templates/news_item.tpl b/templates/news_item.tpl
index 3f94a68..692d13e 100644
--- a/templates/news_item.tpl
+++ b/templates/news_item.tpl
@@ -1,7 +1,8 @@
- <{if $displaytopictitle === true}> <{$story.topic_title}> - <{/if}> <{$story.news_title}>
+ <{if $displaytopictitle === true}> <{$story.topic_title}> <{/if}>
+ <{$story.news_title}>
<{$story.subtitle|default:''}>
@@ -25,10 +26,10 @@
diff --git a/templates/news_ratenews.tpl b/templates/news_ratenews.tpl
index 98f5318..53e2bb2 100644
--- a/templates/news_ratenews.tpl
+++ b/templates/news_ratenews.tpl
@@ -10,8 +10,8 @@
-
diff --git a/templates/news_rss.tpl b/templates/news_rss.tpl
index 20feb0a..f89627e 100644
--- a/templates/news_rss.tpl
+++ b/templates/news_rss.tpl
@@ -20,7 +20,7 @@
<{$image_height}>
<{/if}>
- <{foreach item=item from=$items}>
+ <{foreach item=item from=$items|default:null}>
-
<{$item.title}>
<{$item.link}>
diff --git a/templates/news_topics_directory.tpl b/templates/news_topics_directory.tpl
index 2020756..1f11186 100644
--- a/templates/news_topics_directory.tpl
+++ b/templates/news_topics_directory.tpl
@@ -5,7 +5,7 @@
<{foreach item=topic from=$topics}>
- <{$topic.prefix}><{$topic.title}>
+ href="<{$xoops_url}>/modules/<{$xoops_dirname}>/index.php?storytopic=<{$topic.id}>"><{$topic.title}>
(<{$topic.news_count}>)
<{/foreach}>
diff --git a/templates/news_whos_who.tpl b/templates/news_whos_who.tpl
index f47d524..65772a4 100644
--- a/templates/news_whos_who.tpl
+++ b/templates/news_whos_who.tpl
@@ -5,7 +5,7 @@
<{foreach item=who from=$whoswho}>
- <{$who.name}>
+ href="<{$xoops_url}>/modules/<{$xoops_dirname}>/newsbythisauthor.php?uid=<{$who.uid}>"><{$who.name}>
<{/foreach}>
diff --git a/testdata/index.php b/testdata/index.php
index 03f6922..ecae985 100644
--- a/testdata/index.php
+++ b/testdata/index.php
@@ -99,7 +99,7 @@ function loadSampleData(): void
loadTableFromArrayWithReplace($table, $tabledata, 'gperm_modid', $mid);
// --- COPY test folder files ---------------
- if (is_array($configurator->copyTestFolders) && count($configurator->copyTestFolders) > 0) {
+ if ($configurator->copyTestFolders && \is_array($configurator->copyTestFolders)) {
// $file = \dirname(__DIR__) . '/testdata/images/';
foreach (array_keys($configurator->copyTestFolders) as $i) {
$src = $configurator->copyTestFolders[$i][0];
@@ -159,16 +159,16 @@ function exportSchema(): void
/**
* loadTableFromArrayWithReplace
*
- * @param string $table value with should be used insead of original value of $search
+ * @param string $table value which should be used instead of original value of $search
*
* @param array $data array of rows to insert
* Each element of the outer array represents a single table row.
* Each row is an associative array in 'column' => 'value' format.
* @param string $search name of column for which the value should be replaced
- * @param $replace
+ * @param int $replace
* @return int number of rows inserted
*/
-function loadTableFromArrayWithReplace($table, $data, $search, $replace)
+function loadTableFromArrayWithReplace(string $table, array $data, string $search, int $replace): int
{
/** @var \XoopsMySQLDatabase $db */
$db = \XoopsDatabaseFactory::getDatabaseConnection();
diff --git a/topics_directory.php b/topics_directory.php
index 98d64f1..337932a 100644
--- a/topics_directory.php
+++ b/topics_directory.php
@@ -25,8 +25,11 @@
* @copyright (c) Hervé Thouzard - https://www.herve-thouzard.com
*/
-use XoopsModules\News;
-use XoopsModules\News\NewsTopic;
+use XoopsModules\News\{
+ Helper,
+ NewsTopic,
+ Utility
+};
require_once \dirname(__DIR__, 2) . '/mainfile.php';
//require_once XOOPS_ROOT_PATH . '/modules/news/class/class.newsstory.php';
@@ -40,7 +43,7 @@
$newscountbytopic = $tbl_topics = [];
$perms = '';
$xt = new NewsTopic();
-$restricted = News\Utility::getModuleOption('restrictindex');
+$restricted = Utility::getModuleOption('restrictindex');
if ($restricted) {
global $xoopsUser;
/** @var \XoopsModuleHandler $moduleHandler */
@@ -59,7 +62,7 @@
}
$topics_arr = $xt->getChildTreeArray(0, 'topic_title', $perms);
$newscountbytopic = $xt->getNewsCountByTopic();
-if (is_array($topics_arr) && count($topics_arr)) {
+if ($topics_arr && \is_array($topics_arr)) {
foreach ($topics_arr as $onetopic) {
$count = 0;
if (array_key_exists($onetopic['topic_id'], $newscountbytopic)) {
@@ -82,12 +85,12 @@
}
$xoopsTpl->assign('topics', $tbl_topics);
-$xoopsTpl->assign('advertisement', News\Utility::getModuleOption('advertisement'));
+$xoopsTpl->assign('advertisement', Utility::getModuleOption('advertisement'));
/**
- * Manage all the meta datas
+ * Manage all the metadatas
*/
-News\Utility::createMetaDatas();
+Utility::createMetaDatas();
$xoopsTpl->assign('xoops_pagetitle', _AM_NEWS_TOPICS_DIRECTORY);
$meta_description = _AM_NEWS_TOPICS_DIRECTORY . ' - ' . $xoopsModule->name('s');
diff --git a/view.tag.php b/view.tag.php
index 6f074c1..fce5540 100644
--- a/view.tag.php
+++ b/view.tag.php
@@ -29,7 +29,7 @@
require_once __DIR__ . '/header.php';
-if (!News\Utility::getModuleOption('tags') || !xoops_isActiveModule('tag')) {
+if (!Utility::getModuleOption('tags') || !xoops_isActiveModule('tag')) {
redirect_header('index.php', 2, _ERRORS);
}
require_once XOOPS_ROOT_PATH . '/modules/tag/view.tag.php';
diff --git a/visit.php b/visit.php
index 2ba5ccc..d449b19 100644
--- a/visit.php
+++ b/visit.php
@@ -16,8 +16,10 @@
*/
use Xmf\Request;
-use XoopsModules\News\Files;
-use XoopsModules\News\NewsStory;
+use XoopsModules\News\{
+ Files,
+ NewsStory
+};
require_once \dirname(__DIR__, 2) . '/mainfile.php';
// require_once XOOPS_ROOT_PATH . '/modules/news/class/class.sfiles.php';
diff --git a/whoswho.php b/whoswho.php
index 0053181..02e52c3 100644
--- a/whoswho.php
+++ b/whoswho.php
@@ -25,25 +25,27 @@
* @copyright (c) Hervé Thouzard (https://www.herve-thouzard.com)
*/
-use XoopsModules\News;
-use XoopsModules\News\NewsStory;
+use XoopsModules\News\{
+ NewsStory,
+ Utility
+};
require_once \dirname(__DIR__, 2) . '/mainfile.php';
//require_once XOOPS_ROOT_PATH . '/modules/news/class/class.newsstory.php';
//require_once XOOPS_ROOT_PATH . '/modules/news/class/class.newstopic.php';
//require_once XOOPS_ROOT_PATH . '/modules/news/class/class.sfiles.php';
-if (!News\Utility::getModuleOption('newsbythisauthor')) {
+if (!Utility::getModuleOption('newsbythisauthor')) {
redirect_header('index.php', 2, _ERRORS);
}
$GLOBALS['xoopsOption']['template_main'] = 'news_whos_who.tpl';
require_once XOOPS_ROOT_PATH . '/header.php';
-$option = News\Utility::getModuleOption('displayname');
+$option = Utility::getModuleOption('displayname');
$article = new NewsStory();
$uid_ids = [];
-$uid_ids = $article->getWhosWho(News\Utility::getModuleOption('restrictindex'));
+$uid_ids = $article->getWhosWho(Utility::getModuleOption('restrictindex'));
if (count($uid_ids) > 0) {
$lst_uid = implode(',', $uid_ids);
/** @var \XoopsMemberHandler $memberHandler */
@@ -75,12 +77,12 @@
}
}
-$xoopsTpl->assign('advertisement', News\Utility::getModuleOption('advertisement'));
+$xoopsTpl->assign('advertisement', Utility::getModuleOption('advertisement'));
/**
* Manage all the meta datas
*/
-News\Utility::createMetaDatas($article);
+Utility::createMetaDatas($article);
$xoopsTpl->assign('xoops_pagetitle', _AM_NEWS_WHOS_WHO);
$myts = \MyTextSanitizer::getInstance();
diff --git a/xoops_version.php b/xoops_version.php
index 197cba2..821572b 100644
--- a/xoops_version.php
+++ b/xoops_version.php
@@ -15,20 +15,23 @@
* @author XOOPS Development Team
*/
-use XoopsModules\News;
-use XoopsModules\News\NewsTopic;
+use XoopsModules\News\{
+ Helper,
+ NewsTopic,
+ Utility
+};
require_once __DIR__ . '/preloads/autoloader.php';
-/** @var News\Helper $helper */
-$helper = News\Helper::getInstance();
+/** @var Helper $helper */
+$helper = Helper::getInstance();
$helper->loadLanguage('common');
$moduleDirName = basename(__DIR__);
$moduleDirNameUpper = \mb_strtoupper($moduleDirName);
-$modversion['version'] = '1.72.0';
-$modversion['module_status'] = 'Beta 6';
-$modversion['release_date'] = '2022/10/24';
+$modversion['version'] = '1.73.0';
+$modversion['module_status'] = 'Beta 3';
+$modversion['release_date'] = '2025/01/16';
$modversion['name'] = _MI_NEWS_NAME;
$modversion['description'] = _MI_NEWS_DESC;
$modversion['credits'] = 'XOOPS Project, Christian, Pilou, Marco, ALL the members of the Newbb Team, GIJOE, Zoullou, Mithrandir, Setec Astronomy, Marcan, 5vision, Anne, Trabis, dhsoft, Mamba, Mage, Timgno';
@@ -44,15 +47,16 @@
//$modversion['icons16'] = '../../Frameworks/moduleclasses/icons/16';
//$modversion['icons32'] = '../../Frameworks/moduleclasses/icons/32';
$modversion['onInstall'] = 'include/install_function.php';
-$modversion['onUpdate'] = 'include/update_function.php';
+//$modversion['onUpdate'] = 'include/update_function.php';
+$modversion['onUpdate'] = 'include/onupdate.php';
$modversion['module_website_url'] = 'www.xoops.org/';
$modversion['module_website_name'] = 'XOOPS';
$modversion['author_website_url'] = 'https://xoops.org/';
$modversion['author_website_name'] = 'XOOPS';
$modversion['min_php'] = '7.4';
-$modversion['min_xoops'] = '2.5.10';
+$modversion['min_xoops'] = '2.5.11';
$modversion['min_admin'] = '1.2';
-$modversion['min_db'] = ['mysql' => '5.5'];
+$modversion['min_db'] = ['mysql' => '5.7'];
$modversion['sqlfile']['mysql'] = 'sql/mysql.sql';
@@ -230,7 +234,7 @@
// 2) If there's no topics to display as sub menus we can go on
if (!isset($_SESSION['items_count']) || -1 == $_SESSION['items_count']) {
$sql = 'SELECT COUNT(*) AS cpt FROM ' . $xoopsDB->prefix('news_topics') . ' WHERE menu=1';
- $result = $xoopsDB->query($sql);
+ $result = Utility::queryAndCheck($xoopsDB, $sql);
[$count] = $xoopsDB->fetchRow($result);
$_SESSION['items_count'] = $count;
} else {
@@ -240,7 +244,7 @@
require_once XOOPS_ROOT_PATH . '/class/tree.php';
// require_once XOOPS_ROOT_PATH . '/modules/news/class/class.newstopic.php';
$xt = new NewsTopic();
- $allTopics = $xt->getAllTopics(News\Utility::getModuleOption('restrictindex'));
+ $allTopics = $xt->getAllTopics(Utility::getModuleOption('restrictindex'));
$topic_tree = new \XoopsObjectTree($allTopics, 'topic_id', 'topic_pid');
$topics_arr = $topic_tree->getAllChild(0);
if ($module) {
@@ -267,7 +271,7 @@
unset($cansubmit);
//;
-if (News\Utility::getModuleOption('newsbythisauthor')) {
+if (Utility::getModuleOption('newsbythisauthor')) {
++$i;
$modversion['sub'][$i]['name'] = _MI_NEWS_WHOS_WHO;
$modversion['sub'][$i]['url'] = 'whoswho.php';
@@ -303,7 +307,7 @@
'formtype' => 'select',
'valuetype' => 'int',
'default' => 5,
- 'options' => ['5' => 5, '10' => 10, '15' => 15, '20' => 20, '25' => 25, '30' => 30],
+ 'options' => [5 => 5, 10 => 10, 15 => 15, 20 => 20, 25 => 25, 30 => 30],
];
/**
* Format of the date to use in the module, if you don't specify anything then the default date's format will be used
@@ -417,14 +421,14 @@
'valuetype' => 'int',
'default' => 10,
'options' => [
- '5' => 5,
- '10' => 10,
- '15' => 15,
- '20' => 20,
- '25' => 25,
- '30' => 30,
- '35' => 35,
- '40' => 40,
+ 5 => 5,
+ 10 => 10,
+ 15 => 15,
+ 20 => 20,
+ 25 => 25,
+ 30 => 30,
+ 35 => 35,
+ 40 => 40,
],
];
@@ -565,7 +569,7 @@
/**
* If you set this option to yes then the approvers can type the keyword
- * and description's meta datas
+ * and description's metadatas
*/
$modversion['config'][] = [
'name' => 'metadata',
|