Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
21a9631
DirectoryChecker, FileChecker
mambax7 Nov 6, 2022
33fc0a6
template defaults
mambax7 Nov 6, 2022
f11e176
isResultSet()
mambax7 Nov 6, 2022
e6340d2
Double quotes are unnecessary
mambax7 Nov 6, 2022
70f7c53
remove typecasting
mambax7 Nov 6, 2022
54d41e2
deprecated censorString()
mambax7 Nov 6, 2022
e0bb396
PhpDoc
mambax7 Nov 6, 2022
5b0acc7
PhpDoc, cosmetics
mambax7 Nov 6, 2022
bc57c23
Inverted 'if-else' constructs
mambax7 Nov 6, 2022
a53f3c5
PSR-12: Usage of 'else if' construct
mambax7 Nov 6, 2022
cc13714
namespaces
mambax7 Nov 6, 2022
7bc195c
Case mismatch in method call or class usage
mambax7 Nov 6, 2022
ea18a21
Type cast is unnecessary
mambax7 Nov 6, 2022
1c4aad3
declare return types
mambax7 Nov 6, 2022
11b5592
Packed hashtable optimizations
mambax7 Nov 6, 2022
ea68dbb
cosmetics
mambax7 Nov 6, 2022
f20a599
Redundant 's' modifier
mambax7 Nov 6, 2022
b391134
Missing parameter's type declaration
mambax7 Nov 6, 2022
8e2b24c
Merge branch 'master' of https://github.com/mambax7/news
mambax7 Nov 6, 2022
e8dc671
fixed types
mambax7 Nov 6, 2022
f9eac16
PHP8 and Smarty3 updates, cosmetics
mambax7 Apr 21, 2023
7c90b53
fixed type
mambax7 Apr 21, 2023
21c70d6
Missing strict types declaration
mambax7 Apr 21, 2023
537aefa
Helper
mambax7 Apr 21, 2023
e11fd36
cleanup, types, cosmetics
mambax7 Apr 21, 2023
6856d90
1.73.0 Beta 2
mambax7 Sep 3, 2024
b46871e
Scrutinizer improvements
mambax7 Sep 3, 2024
3a85c1c
fix for prepare()
mambax7 Sep 3, 2024
122c31a
Merge branch 'master' of https://github.com/XoopsModules25x/news
mambax7 Jan 17, 2025
5eda831
1.73.0 Beta 3
mambax7 Jan 17, 2025
e004538
Scrutinizer cosmetics
mambax7 Jan 17, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .scrutinizer.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# language: php
build:
environment:
php: 8.0.11
php: 8.1
nodes:
tests: true
analysis:
Expand Down
2 changes: 1 addition & 1 deletion admin/about.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
xoops_cp_header();

$adminObject->displayNavigation(basename(__FILE__));
$adminObject::setPaypal('xoopsfoundation@gmail.com');
Admin::setPaypal('xoopsfoundation@gmail.com');
$adminObject->displayAbout(false);

require_once __DIR__ . '/admin_footer.php';
13 changes: 7 additions & 6 deletions admin/admin_header.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,19 @@
**/

use Xmf\Module\Admin;
use XoopsModules\News;
use XoopsModules\News\Helper;
use XoopsModules\News\{
Helper
};

require_once \dirname(__DIR__) . '/preloads/autoloader.php';

require \dirname(__DIR__, 3) . '/include/cp_header.php';
require_once $GLOBALS['xoops']->path('www/class/xoopsformloader.php');
require \dirname(__DIR__, 3) . '/class/xoopsformloader.php';
// require_once \dirname(__DIR__) . '/class/Utility.php';
require_once \dirname(__DIR__) . '/include/common.php';

require_once \dirname(__DIR__) . '/preloads/autoloader.php';

$moduleDirName = \basename(\dirname(__DIR__));
/** @var \XoopsModules\News\Helper $helper */
/** @var XoopsModules\News\Helper $helper */
$helper = Helper::getInstance();

/** @var Xmf\Module\Admin $adminObject */
Expand Down
70 changes: 45 additions & 25 deletions admin/amsimport.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,12 @@
* @copyright 2005, 2006 - Hervé Thouzard
*/

use XoopsModules\Ams;
use XoopsModules\Ams\Helper as AmsHelper;
use XoopsModules\News\Files;
use XoopsModules\News\NewsStory;
use XoopsModules\News\NewsTopic;
use XoopsModules\News\{
Files,
NewsStory,
NewsTopic
};

require \dirname(__DIR__, 3) . '/include/cp_header.php';
xoops_cp_header();
Expand All @@ -39,16 +40,7 @@
require_once XOOPS_ROOT_PATH . '/class/xoopstree.php';

if (is_object($xoopsUser) && $xoopsUser->isAdmin($xoopsModule->mid())) {
if (!isset($_POST['go'])) {
echo '<h1>Welcome to the AMS 2.41 import script</h1>';
echo '<br><br>Select the import options you wan to use :';
echo "<form method='post' action='amsimport.php'>";
echo "<br><input type='checkbox' name='useforum' value='1'> Import forums links inside news (at the bottom of the news)";
echo "<br><input type='checkbox' name='useextlinks' value='1'> Import external links inside news (at the bottom of the news)";
echo "<br><br><input type='submit' name='go' value='Import'>";
echo '</form>';
echo "<br><br>If you check the two last options then the forum's link and all the external links will be added at the end of the body text.";
} else {
if (isset($_POST['go'])) {
// Launch the import
/** @var \XoopsModules\Ams\Helper $amsHelper */
$amsHelper = AmsHelper::getInstance();
Expand Down Expand Up @@ -123,17 +115,29 @@
$ams_newsid = $article['storyid'];

// We search for the last version
$result2 = $db->query('SELECT * FROM ' . $ams_text . ' WHERE storyid=' . $ams_newsid . ' AND current=1');
$sql = 'SELECT * FROM ' . $ams_text . ' WHERE storyid=' . $ams_newsid . ' AND current=1';
$result2 = $db->query($sql);
if (!$db->isResultSet($result2)) {
\trigger_error("Query Failed! SQL: $sql Error: " . $db->error(), \E_USER_ERROR);
}
$text_lastversion = $db->fetchArray($result2);

// We search for the number of votes
$result3 = $db->query('SELECT count(*) AS cpt FROM ' . $ams_rating . ' WHERE storyid=' . $ams_newsid);
$sql = 'SELECT count(*) AS cpt FROM ' . $ams_rating . ' WHERE storyid=' . $ams_newsid;
$result3 = $db->query($sql);
if (!$db->isResultSet($result3)) {
\trigger_error("Query Failed! SQL: $sql Error: " . $db->error(), \E_USER_ERROR);
}
$votes = $db->fetchArray($result3);

// The links
$links = '';
if ($use_extlinks) {
$result7 = $db->query('SELECT * FROM ' . $ams_links . ' WHERE storyid=' . $ams_newsid . ' ORDER BY linkid');
$sql = 'SELECT * FROM ' . $ams_links . ' WHERE storyid=' . $ams_newsid . ' ORDER BY linkid';
$result7 = $db->query($sql);
if (!$db->isResultSet($result7)) {
\trigger_error("Query Failed! SQL: $sql Error: " . $db->error(), \E_USER_ERROR);
}
while (false !== ($link = $db->fetchArray($result7))) {
if ('' == trim($links)) {
$links = "\n\n" . _AMS_NW_RELATEDARTICLES . "\n\n";
Expand Down Expand Up @@ -179,7 +183,11 @@
$news_newsid = $news->storyid(); // ********************

// The files
$result4 = $db->query('SELECT * FROM ' . $ams_files . ' WHERE storyid=' . $ams_newsid);
$sql = 'SELECT * FROM ' . $ams_files . ' WHERE storyid=' . $ams_newsid;
$result4 = $db->query($sql);
if (!$db->isResultSet($result4)) {
\trigger_error("Query Failed! SQL: $sql Error: " . $db->error(), \E_USER_ERROR);
}
while (false !== ($file = $db->fetchArray($result4))) {
$sfile = new Files();
$sfile->setFileRealName($file['filerealname']);
Expand All @@ -194,16 +202,19 @@
}

// The ratings
$result5 = $db->query('SELECT * FROM ' . $ams_rating . ' WHERE storyid=' . $ams_newsid);
$sql = 'SELECT * FROM ' . $ams_rating . ' WHERE storyid=' . $ams_newsid;
$result5 = $db->query($sql);
if (!$db->isResultSet($result5)) {
\trigger_error("Query Failed! SQL: $sql Error: " . $db->error(), \E_USER_ERROR);
}
while (false !== ($ratings = $db->fetchArray($result5))) {
$result6 = $db->queryF(
'INSERT INTO ' . $news_stories_votedata . ' (storyid, ratinguser, rating, ratinghostname, ratingtimestamp) VALUES (' . $news_newsid . ',' . $ratings['ratinguser'] . ',' . $ratings['rating'] . ',' . $ratings['ratinghostname'] . ',' . $ratings['ratingtimestamp'] . ')'
);
$sql = ' INSERT INTO ' . $news_stories_votedata . ' (storyid, ratinguser, rating, ratinghostname, ratingtimestamp) VALUES (' . $news_newsid . ',' . $ratings['ratinguser'] . ',' . $ratings['rating'] . ',' . $ratings['ratinghostname'] . ',' . $ratings['ratingtimestamp'] . ')';
$result6 = $db->queryF($sql);
}

// The comments
$comments = $commentHandler->getByItemId($ams_mid, $ams_newsid, 'ASC');
if ($comments && is_array($comments)) {
if ($comments && \is_array($comments)) {
foreach ($comments as $onecomment) {
$onecomment->setNew();
$onecomment->setVar('com_modid', $news_mid);
Expand All @@ -219,7 +230,7 @@
$criteria->add(new \Criteria('not_itemid', $ams_newsid));
$criteria->setOrder('ASC');
$notifications = $notificationHandler->getObjects($criteria);
if ($notifications && is_array($notifications)) {
if ($notifications && \is_array($notifications)) {
foreach ($notifications as $onenotification) {
$onenotification->setNew();
$onenotification->setVar('not_modid', $news_mid);
Expand All @@ -235,7 +246,7 @@
$criteria->add(new \Criteria('not_category', 'global'));
$criteria->setOrder('ASC');
$notifications = $notificationHandler->getObjects($criteria);
if ($notifications && is_array($notifications)) {
if ($notifications && \is_array($notifications)) {
foreach ($notifications as $onenotification) {
$onenotification->setNew();
$onenotification->setVar('not_modid', $news_mid);
Expand All @@ -245,6 +256,15 @@
}
unset($notifications);
echo "<p><a href='" . XOOPS_URL . "/modules/news/admin/groupperms.php'>The import is finished, don't forget to verify and set the topics permissions !</a></p>";
} else {
echo '<h1>Welcome to the AMS 2.41 import script</h1>';
echo '<br><br>Select the import options you wan to use :';
echo "<form method='post' action='amsimport.php'>";
echo "<br><input type='checkbox' name='useforum' value='1'> Import forums links inside news (at the bottom of the news)";
echo "<br><input type='checkbox' name='useextlinks' value='1'> Import external links inside news (at the bottom of the news)";
echo "<br><br><input type='submit' name='go' value='Import'>";
echo '</form>';
echo "<br><br>If you check the two last options then the forum's link and all the external links will be added at the end of the body text.";
}
} else {
redirect_header(XOOPS_URL . '/modules/news/index.php', 3, _NOPERM);
Expand Down
6 changes: 3 additions & 3 deletions admin/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@
*
* NOTE : Please give credits if you copy this code !
*
* @param string $tablename
* @param string|null $tablename
* @param string $iconname
* @copyright:: (c) Hervé Thouzard (https://www.herve-thouzard.com)
* @author :: Hervé Thouzard (https://www.herve-thouzard.com) & Dojo Javscript Toolkit
*/
function news_collapsableBar($tablename = '', $iconname = ''): void
function news_collapsableBar(?string $tablename = null, string $iconname = ''): void
{
?>
?>$tablename ??= '';
<script type="text/javascript">
// function goto_URL(object) {
// window.location.href = object.options[object.selectedIndex].value;
Expand Down
Loading