Skip to content

Commit f619b07

Browse files
authored
Merge pull request #119 from mambax7/master
5.01 Beta 4
2 parents 6c7f5dc + 5a78e0e commit f619b07

106 files changed

Lines changed: 1565 additions & 1589 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

action.post.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,13 @@
1414
Tree,
1515
TopicHandler,
1616
ForumHandler,
17+
Post,
1718
PostHandler
1819
};
1920
/** @var TopicHandler $topicHandler */
2021
/** @var ForumHandler $forumHandler */
2122
/** @var PostHandler $postHandler */
23+
/** @var Post $postObject */
2224

2325
require_once __DIR__ . '/header.php';
2426

@@ -93,7 +95,7 @@
9395
$criteria = new \Criteria('post_id', '(' . implode(',', $post_id) . ')', 'IN');
9496
$postsObject = $postHandler->getObjects($criteria, true);
9597
foreach ($post_id as $post) {
96-
/** @var Newbb\Post $postObject */
98+
/** @var Post $postObject */
9799
$postObject = $postsObject[$post];
98100
if (!empty($topic_id) && $topic_id !== $postObject->getVar('topic_id')) {
99101
continue;
@@ -124,7 +126,7 @@
124126
$notificationHandler = xoops_getHandler('notification');
125127
foreach ($post_id as $post) {
126128
$tags = [];
127-
/** @var Newbb\Post[] $postsObject [$post] */
129+
/** @var Post[] $postsObject [$post] */
128130
$tags['THREAD_NAME'] = $topic_list[$postsObject[$post]->getVar('topic_id')];
129131
$tags['THREAD_URL'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/viewtopic.php?topic_id=' . $postsObject[$post]->getVar('topic_id') . '&forum=' . $postsObject[$post]->getVar('forum_id');
130132
$tags['FORUM_NAME'] = $forum_list[$postsObject[$post]->getVar('forum_id')];
@@ -162,7 +164,6 @@
162164
}
163165
break;
164166
case 'split':
165-
/** @var Newbb\Post $postObject */
166167
$postObject = $postHandler->get($post_id);
167168
if ((is_array($post_id) && 0 === count($post_id)) || $postObject->isTopic()) {
168169
break;

action.topic.php

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,24 @@
1111

1212
use Xmf\Request;
1313
use XoopsModules\Newbb\{
14+
Category,
15+
CategoryHandler,
16+
StatsHandler,
1417
Tree,
18+
Topic,
1519
TopicHandler,
20+
Forum,
1621
ForumHandler,
1722
PostHandler
1823
};
24+
/** @var Category $categories */
25+
/** @var CategoryHandler $categoryHandler */
26+
/** @var Topic $topicObject */
1927
/** @var TopicHandler $topicHandler */
28+
/** @var Forum $forumsObject */
2029
/** @var ForumHandler $forumHandler */
2130
/** @var PostHandler $postHandler */
31+
/** @var StatsHandler $statsHandler */
2232

2333
require_once __DIR__ . '/header.php';
2434

@@ -28,7 +38,7 @@
2838
$op = Request::getString('op', '', 'POST');
2939
$op = in_array($op, ['approve', 'delete', 'restore', 'move']) ? $op : '';
3040

31-
if (0 === count($topic_id) || '' === $op) {
41+
if ('' === $op || 0 === count($topic_id)) {
3242
// irmtfan - issue with javascript:history.go(-1)
3343
redirect_header(Request::getString('HTTP_REFERER', '', 'SERVER'), 2, \_MD_NEWBB_NO_SELECTION);
3444
}
@@ -49,7 +59,7 @@
4959
$forums = [];
5060
$topicsObject = $topicHandler->getAll(new \Criteria('topic_id', '(' . implode(',', $topic_id) . ')', 'IN'));
5161
foreach (array_keys($topicsObject) as $id) {
52-
/** @var Newbb\Topic $topicObject */
62+
/** @var Topic $topicObject */
5363
$topicObject = $topicsObject[$id];
5464
$topicHandler->approve($topicObject);
5565
$topicHandler->synchronization($topicObject);
@@ -66,7 +76,7 @@
6676
$forums = [];
6777
$topicsObject = $topicHandler->getAll(new \Criteria('topic_id', '(' . implode(',', $topic_id) . ')', 'IN'));
6878
foreach (array_keys($topicsObject) as $id) {
69-
/** @var Newbb\Topic $topicObject */
79+
/** @var Topic $topicObject */
7080
$topicObject = $topicsObject[$id];
7181
$topicHandler->approve($topicObject);
7282
$topicHandler->synchronization($topicObject);
@@ -91,7 +101,7 @@
91101
$tags = [];
92102
$tags['THREAD_NAME'] = $topicObject->getVar('topic_title');
93103
$tags['THREAD_URL'] = XOOPS_URL . '/modules/' . $moduleDirName . '/viewtopic.php?topic_id=' . $id . '&forum=' . $topicObject->getVar('forum_id');
94-
/** @var Newbb\Forum[] $forumsObject */
104+
/** @var Forum[] $forumsObject */
95105
$tags['FORUM_NAME'] = $forumsObject[$topicObject->getVar('forum_id')]->getVar('forum_name');
96106
$tags['FORUM_URL'] = XOOPS_URL . '/modules/' . $moduleDirName . '/viewforum.php?forum=' . $topicObject->getVar('forum_id');
97107
$notificationHandler->triggerEvent('global', 0, 'new_thread', $tags);
@@ -111,10 +121,10 @@
111121
break;
112122
case 'delete':
113123
$forums = [];
114-
/** @var Newbb\TopicHandler|\XoopsPersistableObjectHandler $topicHandler */
124+
/** @var TopicHandler|\XoopsPersistableObjectHandler $topicHandler */
115125
$topicsObject = $topicHandler->getAll(new \Criteria('topic_id', '(' . implode(',', $topic_id) . ')', 'IN'));
116126
foreach (array_keys($topicsObject) as $id) {
117-
/** @var Newbb\Topic $topicObject */
127+
/** @var Topic $topicObject */
118128
$topicObject = $topicsObject[$id];
119129
// irmtfan should be set to false to not delete topic from database
120130
$topicHandler->delete($topicObject, false);
@@ -134,23 +144,22 @@
134144
&& Request::getInt('newforum', 0, 'POST') !== $forum_id
135145
&& $forumHandler->getPermission(Request::getInt('newforum', 0, 'POST'), 'post')) {
136146
$criteria = new \Criteria('topic_id', '(' . implode(',', $topic_id) . ')', 'IN');
137-
// /** @var Newbb\PostHandler $postHandler */
147+
138148
// $postHandler = \XoopsModules\Newbb\Helper::getInstance()->getHandler('Post');
139149
$postHandler->updateAll('forum_id', Request::getInt('newforum', 0, 'POST'), $criteria, true);
140150
$topicHandler->updateAll('forum_id', Request::getInt('newforum', 0, 'POST'), $criteria, true);
141151
$forumHandler->synchronization(Request::getInt('newforum', 0, 'POST'));
142152
$forumHandler->synchronization($forum_id);
143153
} else {
144154
require_once $GLOBALS['xoops']->path('header.php');
145-
// /** @var Newbb\CategoryHandler $categoryHandler */
146-
// $categoryHandler = \XoopsModules\Newbb\Helper::getInstance()->getHandler('Category');
155+
// $categoryHandler = \XoopsModules\Newbb\Helper::getInstance()->getHandler('Category');
147156
$categories = $categoryHandler->getByPermission('access');
148157
$forums = $forumHandler->getForumsByCategory(array_keys($categories), 'post', false);
149158

150159
$box = '<select name="newforum" size="1">';
151160
if (count($categories) > 0 && count($forums) > 0) {
152161
foreach (array_keys($forums) as $key) {
153-
/** @var Newbb\Category[] $categories */
162+
/** @var Category[] $categories */
154163
$box .= "<option value='-1'>[" . $categories[$key]->getVar('cat_title') . ']</option>';
155164
foreach ($forums[$key] as $forumid => $_forum) {
156165
$box .= "<option value='" . $forumid . "'>-- " . $_forum['title'] . '</option>';

admin/about.php

Lines changed: 17 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,26 @@
11
<?php
2-
//
3-
// ------------------------------------------------------------------------ //
4-
// XOOPS - PHP Content Management System //
5-
// Copyright (c) 2000-2020 XOOPS.org //
6-
// <https://xoops.org> //
7-
// ------------------------------------------------------------------------ //
8-
// This program is free software; you can redistribute it and/or modify //
9-
// it under the terms of the GNU General Public License as published by //
10-
// the Free Software Foundation; either version 2 of the License, or //
11-
// (at your option) any later version. //
12-
// //
13-
// You may not change or alter any portion of this comment or credits //
14-
// of supporting developers from this source code or any supporting //
15-
// source code which is considered copyrighted (c) material of the //
16-
// original comment or credit authors. //
17-
// //
18-
// This program is distributed in the hope that it will be useful, //
19-
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
20-
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
21-
// GNU General Public License for more details. //
22-
// //
23-
// You should have received a copy of the GNU General Public License //
24-
// along with this program; if not, write to the Free Software //
25-
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA //
26-
// ------------------------------------------------------------------------ //
27-
// Author: Kazumi Ono (AKA onokazu) //
28-
// URL: http://www.myweb.ne.jp/, https://xoops.org/, http://jp.xoops.org/ //
29-
// Project: XOOPS Project //
30-
// ------------------------------------------------------------------------- //
2+
/*
3+
* You may not change or alter any portion of this comment or credits
4+
* of supporting developers from this source code or any supporting source code
5+
* which is considered copyrighted (c) material of the original comment or credit authors.
6+
*
7+
* This program is distributed in the hope that it will be useful,
8+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
9+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10+
*/
11+
12+
/**
13+
* @copyright XOOPS Project https://xoops.org/
14+
* @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
15+
* @author Kazumi Ono (AKA onokazu) http://www.myweb.ne.jp/, https://xoops.org/, http://jp.xoops.org/
16+
* @author XOOPS Development Team
17+
*/
3118

3219
use Xmf\Module\Admin;
3320

3421
/** @var Admin $adminObject */
3522

36-
require __DIR__ . '/admin_header.php';
23+
require_once __DIR__ . '/admin_header.php';
3724
xoops_cp_header();
3825

3926
$adminObject->displayNavigation(basename(__FILE__));

admin/admin_cat_manager.php

Lines changed: 20 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,20 @@
11
<?php
2-
//
3-
// ------------------------------------------------------------------------ //
4-
// XOOPS - PHP Content Management System //
5-
// Copyright (c) 2000-2020 XOOPS.org //
6-
// <https://xoops.org> //
7-
// ------------------------------------------------------------------------ //
8-
// This program is free software; you can redistribute it and/or modify //
9-
// it under the terms of the GNU General Public License as published by //
10-
// the Free Software Foundation; either version 2 of the License, or //
11-
// (at your option) any later version. //
12-
// //
13-
// You may not change or alter any portion of this comment or credits //
14-
// of supporting developers from this source code or any supporting //
15-
// source code which is considered copyrighted (c) material of the //
16-
// original comment or credit authors. //
17-
// //
18-
// This program is distributed in the hope that it will be useful, //
19-
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
20-
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
21-
// GNU General Public License for more details. //
22-
// //
23-
// You should have received a copy of the GNU General Public License //
24-
// along with this program; if not, write to the Free Software //
25-
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA //
26-
// ------------------------------------------------------------------------ //
27-
// Author: Kazumi Ono (AKA onokazu) //
28-
// URL: http://www.myweb.ne.jp/, https://xoops.org/, http://jp.xoops.org/ //
29-
// Project: XOOPS Project //
30-
// ------------------------------------------------------------------------- //
2+
/*
3+
* You may not change or alter any portion of this comment or credits
4+
* of supporting developers from this source code or any supporting source code
5+
* which is considered copyrighted (c) material of the original comment or credit authors.
6+
*
7+
* This program is distributed in the hope that it will be useful,
8+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
9+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10+
*/
11+
12+
/**
13+
* @copyright XOOPS Project https://xoops.org/
14+
* @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
15+
* @author Kazumi Ono (AKA onokazu) http://www.myweb.ne.jp/, https://xoops.org/, http://jp.xoops.org/
16+
* @author XOOPS Development Team
17+
*/
3118

3219
use Xmf\Module\Helper\Cache;
3320
use Xmf\Request;
@@ -74,15 +61,15 @@ function editCategory(\XoopsObject $categoryObject = null)
7461
$groups_cat_access = null;
7562
require_once $GLOBALS['xoops']->path('class/xoopsformloader.php');
7663

77-
if (!$categoryObject->isNew()) {
78-
$sform = new \XoopsThemeForm(_AM_NEWBB_EDITCATEGORY . ' ' . $categoryObject->getVar('cat_title'), 'op', xoops_getenv('SCRIPT_NAME'));
79-
} else {
64+
if ($categoryObject->isNew()) {
8065
$sform = new \XoopsThemeForm(_AM_NEWBB_CREATENEWCATEGORY, 'op', xoops_getenv('SCRIPT_NAME'));
8166
$categoryObject->setVar('cat_title', '');
8267
$categoryObject->setVar('cat_image', '');
8368
$categoryObject->setVar('cat_description', '');
8469
$categoryObject->setVar('cat_order', 0);
8570
$categoryObject->setVar('cat_url', 'https://xoops.org/modules/newbb/ newBB Support');
71+
} else {
72+
$sform = new \XoopsThemeForm(_AM_NEWBB_EDITCATEGORY . ' ' . $categoryObject->getVar('cat_title'), 'op', xoops_getenv('SCRIPT_NAME'));
8673
}
8774

8875
$sform->addElement(new \XoopsFormText(_AM_NEWBB_SETCATEGORYORDER, 'cat_order', 5, 10, $categoryObject->getVar('cat_order')), false);
@@ -165,7 +152,7 @@ function editCategory(\XoopsObject $categoryObject = null)
165152
if (!$categoryHandler->insert($categoryObject)) {
166153
$message = _AM_NEWBB_DATABASEERROR;
167154
}
168-
if (($cat_id == $categoryObject->getVar('cat_id')) && $cat_isNew) {
155+
if ($cat_isNew && ($cat_id == $categoryObject->getVar('cat_id'))) {
169156
$categoryHandler->applyPermissionTemplate($categoryObject);
170157
}
171158
redirect_header('admin_cat_manager.php', 2, $message);

admin/admin_digest.php

Lines changed: 20 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,26 @@
11
<?php
2-
//
3-
// ------------------------------------------------------------------------ //
4-
// XOOPS - PHP Content Management System //
5-
// Copyright (c) 2000-2020 XOOPS.org //
6-
// <https://xoops.org> //
7-
// ------------------------------------------------------------------------ //
8-
// This program is free software; you can redistribute it and/or modify //
9-
// it under the terms of the GNU General Public License as published by //
10-
// the Free Software Foundation; either version 2 of the License, or //
11-
// (at your option) any later version. //
12-
// //
13-
// You may not change or alter any portion of this comment or credits //
14-
// of supporting developers from this source code or any supporting //
15-
// source code which is considered copyrighted (c) material of the //
16-
// original comment or credit authors. //
17-
// //
18-
// This program is distributed in the hope that it will be useful, //
19-
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
20-
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
21-
// GNU General Public License for more details. //
22-
// //
23-
// You should have received a copy of the GNU General Public License //
24-
// along with this program; if not, write to the Free Software //
25-
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA //
26-
// ------------------------------------------------------------------------ //
27-
// Author: Kazumi Ono (AKA onokazu) //
28-
// URL: http://www.myweb.ne.jp/, https://xoops.org/, http://jp.xoops.org/ //
29-
// Project: XOOPS Project //
30-
// ------------------------------------------------------------------------- //
2+
/*
3+
* You may not change or alter any portion of this comment or credits
4+
* of supporting developers from this source code or any supporting source code
5+
* which is considered copyrighted (c) material of the original comment or credit authors.
6+
*
7+
* This program is distributed in the hope that it will be useful,
8+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
9+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10+
*/
11+
12+
/**
13+
* @copyright XOOPS Project https://xoops.org/
14+
* @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
15+
* @author Kazumi Ono (AKA onokazu) http://www.myweb.ne.jp/, https://xoops.org/, http://jp.xoops.org/
16+
* @author XOOPS Development Team
17+
*/
3118

3219
use Xmf\Request;
20+
use XoopsModules\Newbb\{
21+
DigestHandler
22+
};
23+
/** @var DigestHandler $digestHandler */
3324

3425
require_once __DIR__ . '/admin_header.php';
3526
require_once $GLOBALS['xoops']->path('class/pagenav.php');
@@ -44,7 +35,6 @@
4435
switch ($op) {
4536
case 'delete':
4637
$digest_ids = Request::getArray('digest_id', [], 'POST');
47-
// /** @var Newbb\DigestHandler $digestHandler */
4838
// $digestHandler = \XoopsModules\Newbb\Helper::getInstance()->getHandler('Digest');
4939
foreach ($digest_ids as $did => $value) {
5040
$digest = $digestHandler->get($did);
@@ -98,7 +88,6 @@
9888
echo '</tr>';
9989

10090
$digests = [];
101-
// /** @var Newbb\DigestHandler $digestHandler */
10291
// $digestHandler = \XoopsModules\Newbb\Helper::getInstance()->getHandler('Digest');
10392
$digests = $digestHandler->getAllDigests($start, $limit);
10493
foreach ($digests as $digest) {

admin/admin_footer.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,9 @@
1010
*/
1111

1212
/**
13-
* @copyright XOOPS Project https://xoops.org/
13+
* @copyright XOOPS Project (https://xoops.org)
1414
* @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html)
15-
* @package
16-
* @since
17-
* @author XOOPS Development Team
15+
* @author XOOPS Development Team
1816
*/
1917

2018
$pathIcon32 = Xmf\Module\Admin::iconUrl('', 32);

0 commit comments

Comments
 (0)