Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/mambax7/newbb5
Browse files Browse the repository at this point in the history
  • Loading branch information
aerograf committed Sep 15, 2017
2 parents 02daa7b + 171f6b4 commit fb3cfad
Show file tree
Hide file tree
Showing 49 changed files with 395 additions and 259 deletions.
12 changes: 6 additions & 6 deletions action.post.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@
// irmtfan - issue with javascript:history.go(-1)
redirect_header(Request::getString('HTTP_REFERER', '', 'SERVER'), 2, _MD_NEWBB_NO_SELECTION);
}
/** @var NewbbPostHandler $postHandler */
$postHandler = xoops_getModuleHandler('post', 'newbb');
/** @var NewbbTopicHandler $topicHandler */
$topicHandler = xoops_getModuleHandler('topic', 'newbb');
/** @var NewbbForumHandler $forumHandler */
$forumHandler = xoops_getModuleHandler('forum', 'newbb');
///** @var NewbbPostHandler $postHandler */
//$postHandler = xoops_getModuleHandler('post', 'newbb');
///** @var NewbbTopicHandler $topicHandler */
//$topicHandler = xoops_getModuleHandler('topic', 'newbb');
///** @var NewbbForumHandler $forumHandler */
//$forumHandler = xoops_getModuleHandler('forum', 'newbb');
if (empty($topic_id)) {
$forumObject = null;
} else {
Expand Down
20 changes: 10 additions & 10 deletions action.topic.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@
}

$topic_id = array_values($topic_id);
/** @var \NewbbTopicHandler|XoopsPersistableObjectHandler $topicHandler */
$topicHandler = xoops_getModuleHandler('topic', 'newbb');
/** @var \NewbbForumHandler|XoopsPersistableObjectHandler $forumHandler */
$forumHandler = xoops_getModuleHandler('forum', 'newbb');
///** @var \NewbbTopicHandler|XoopsPersistableObjectHandler $topicHandler */
//$topicHandler = xoops_getModuleHandler('topic', 'newbb');
///** @var \NewbbForumHandler|XoopsPersistableObjectHandler $forumHandler */
//$forumHandler = xoops_getModuleHandler('forum', 'newbb');

$isAdmin = newbbIsAdmin($forum_id);

Expand Down Expand Up @@ -125,16 +125,16 @@
&& Request::getInt('newforum', 0, 'POST') !== $forum_id
&& $forumHandler->getPermission(Request::getInt('newforum', 0, 'POST'), 'post')) {
$criteria = new Criteria('topic_id', '(' . implode(',', $topic_id) . ')', 'IN');
/** @var \NewbbPostHandler $postHandler */
$postHandler = xoops_getModuleHandler('post', 'newbb');
// /** @var \NewbbPostHandler $postHandler */
// $postHandler = xoops_getModuleHandler('post', 'newbb');
$postHandler->updateAll('forum_id', Request::getInt('newforum', 0, 'POST'), $criteria, true);
$topicHandler->updateAll('forum_id', Request::getInt('newforum', 0, 'POST'), $criteria, true);
$forumHandler->synchronization(Request::getInt('newforum', 0, 'POST'));
$forumHandler->synchronization($forum_id);
} else {
include $GLOBALS['xoops']->path('header.php');
/** @var \NewbbCategoryHandler $categoryHandler */
$categoryHandler = xoops_getModuleHandler('category', 'newbb');
// /** @var \NewbbCategoryHandler $categoryHandler */
// $categoryHandler = xoops_getModuleHandler('category', 'newbb');
$categories = $categoryHandler->getByPermission('access');
$forums = $forumHandler->getForumsByCategory(array_keys($categories), 'post', false);

Expand Down Expand Up @@ -181,8 +181,8 @@
}
break;
}
/** @var \NewbbStatsHandler $statsHandler */
$statsHandler = xoops_getModuleHandler('stats', 'newbb');
///** @var \NewbbStatsHandler $statsHandler */
//$statsHandler = xoops_getModuleHandler('stats', 'newbb');
$statsHandler->reset();
if (empty($forum_id)) {
redirect_header(XOOPS_URL . '/modules/newbb/list.topic.php', 2, _MD_NEWBB_DBUPDATED);
Expand Down
10 changes: 5 additions & 5 deletions admin/admin_cat_manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@
$op = Request::getCmd('op', Request::getCmd('op', '', 'POST'), 'GET'); //!empty($_GET['op'])? $_GET['op'] : (!empty($_POST['op'])?$_POST['op']:"");
$cat_id = Request::getInt('cat_id', Request::getInt('cat_id', 0, 'POST'), 'GET'); // (int)( !empty($_GET['cat_id']) ? $_GET['cat_id'] : @$_POST['cat_id'] );

/** @var \NewbbCategoryHandler $categoryHandler */
$categoryHandler = xoops_getModuleHandler('category', 'newbb');
///** @var \NewbbCategoryHandler $categoryHandler */
//$categoryHandler = xoops_getModuleHandler('category', 'newbb');

/**
* newCategory()
Expand All @@ -59,7 +59,7 @@ function newCategory()
function editCategory(XoopsObject $categoryObject = null)
{
global $xoopsModule;
$categoryHandler = xoops_getModuleHandler('category', 'newbb');
// $categoryHandler = xoops_getModuleHandler('category', 'newbb');
if (null === $categoryObject) {
$categoryObject = $categoryHandler->create();
}
Expand Down Expand Up @@ -168,15 +168,15 @@ function editCategory(XoopsObject $categoryObject = null)
default:
if (!$categories = $categoryHandler->getByPermission('all')) {
$adminObject->addItemButton(_AM_NEWBB_CREATENEWCATEGORY, 'admin_cat_manager.php?op=mod', $icon = 'add');
$adminObject->displayButton();
$adminObject->displayButton('left');

echo '<br>';
newCategory();
break;
}
$adminObject->displayNavigation(basename(__FILE__));
$adminObject->addItemButton(_AM_NEWBB_CREATENEWCATEGORY, 'admin_cat_manager.php?op=mod', $icon = 'add');
$adminObject->displayButton();
$adminObject->displayButton('left');

echo "<table width='100%' border='0' cellspacing='1' class='outer'>" . "<tr><td class='odd'>";
echo "<table border='0' cellpadding='4' cellspacing='1' width='100%' class='outer'>";
Expand Down
12 changes: 6 additions & 6 deletions admin/admin_digest.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@
switch ($op) {
case 'delete':
$digest_ids = Request::getArray('digest_id', [], 'POST');
/** @var \NewbbDigestHandler $digestHandler */
$digestHandler = xoops_getModuleHandler('digest', 'newbb');
// /** @var \NewbbDigestHandler $digestHandler */
// $digestHandler = xoops_getModuleHandler('digest', 'newbb');
foreach ($digest_ids as $did => $value) {
$digest = $digestHandler->get($did);
$digestHandler->delete($digest);
Expand All @@ -59,7 +59,7 @@
case 'digestconfirmed':
$message = '';
if ('POST' === Request::getMethod()) {
$digestHandler = xoops_getModuleHandler('digest', 'newbb');
// $digestHandler = xoops_getModuleHandler('digest', 'newbb');

switch ($digestHandler->process(true)) {
case 0:
Expand All @@ -83,7 +83,7 @@
$adminObject->displayNavigation(basename(__FILE__));

$adminObject->addItemButton(_AM_NEWBB_DIGEST, 'admin_digest.php?op=digest', $icon = 'add');
$adminObject->displayButton();
$adminObject->displayButton('left');

//if (!$newXoopsModuleGui) loadModuleAdminMenu(7,_AM_NEWBB_DIGESTADMIN);
// else $adminObject->displayNavigation(basename(__FILE__));
Expand All @@ -100,8 +100,8 @@
echo '</tr>';

$digests = [];
/** @var \NewbbDigestHandler $digestHandler */
$digestHandler = xoops_getModuleHandler('digest', 'newbb');
// /** @var \NewbbDigestHandler $digestHandler */
// $digestHandler = xoops_getModuleHandler('digest', 'newbb');
$digests = $digestHandler->getAllDigests($start, $limit);
foreach ($digests as $digest) {
echo "<tr class='odd' align='left'>";
Expand Down
24 changes: 12 additions & 12 deletions admin/admin_forum_manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@
$op = Request::getCmd('op', Request::getCmd('op', '', 'POST'), 'GET'); // !empty($_GET['op'])? $_GET['op'] : (!empty($_POST['op'])?$_POST['op']:"");
$forum_id = Request::getInt('forum', Request::getInt('forum', 0, 'POST'), 'GET'); //(int)( !empty($_GET['forum'])? $_GET['forum'] : (!empty($_POST['forum'])?$_POST['forum']:0) );

/** @var \NewbbForumHandler $forumHandler */
$forumHandler = xoops_getModuleHandler('forum', 'newbb');
///** @var \NewbbForumHandler $forumHandler */
//$forumHandler = xoops_getModuleHandler('forum', 'newbb');
switch ($op) {
case 'moveforum':
//if (!$newXoopsModuleGui) loadModuleAdminMenu(2, "");
Expand Down Expand Up @@ -173,21 +173,21 @@
if ($forumHandler->insert($forumObject)) {
//$cacheHelper->delete('forum');
if (Request::getInt('perm_template', 0, 'POST')) {
/** @var \NewbbPermissionHandler $grouppermHandler */
$grouppermHandler = xoops_getModuleHandler('permission', $xoopsModule->getVar('dirname'));
$perm_template = $grouppermHandler->getTemplate();
// /** @var \NewbbPermissionHandler $permHandler */
// $permHandler = xoops_getModuleHandler('permission', 'newbb');
$perm_template = $permHandler->getTemplate();
/** @var \XoopsMemberHandler $memberHandler */
$memberHandler = xoops_getHandler('member');
$glist = $memberHandler->getGroupList();
$perms = $grouppermHandler->getValidForumPerms(true);
$perms = $permHandler->getValidForumPerms(true);
foreach (array_keys($glist) as $group) {
foreach ($perms as $perm) {
$ids = $grouppermHandler->getItemIds($perm, $group, $xoopsModule->getVar('mid'));
$ids = $permHandler->getItemIds($perm, $group, $xoopsModule->getVar('mid'));
if (!in_array($forumObject->getVar('forum_id'), $ids)) {
if (empty($perm_template[$group][$perm])) {
$grouppermHandler->deleteRight($perm, $forumObject->getVar('forum_id'), $group, $xoopsModule->getVar('mid'));
$permHandler->deleteRight($perm, $forumObject->getVar('forum_id'), $group, $xoopsModule->getVar('mid'));
} else {
$grouppermHandler->addRight($perm, $forumObject->getVar('forum_id'), $group, $xoopsModule->getVar('mid'));
$permHandler->addRight($perm, $forumObject->getVar('forum_id'), $group, $xoopsModule->getVar('mid'));
}
}
}
Expand Down Expand Up @@ -231,8 +231,8 @@

default:

/** @var \NewbbCategoryHandler $categoryHandler */
$categoryHandler = xoops_getModuleHandler('category', 'newbb');
// /** @var \NewbbCategoryHandler $categoryHandler */
// $categoryHandler = xoops_getModuleHandler('category', 'newbb');
$criteriaCategory = new CriteriaCompo(new criteria('1', 1));
$criteriaCategory->setSort('cat_order');
$categories = $categoryHandler->getList($criteriaCategory);
Expand All @@ -252,7 +252,7 @@
$echo .= "<th class='bg3'>" . _AM_NEWBB_MERGE . '</th>';
$echo .= '</tr>';

$categoryHandler = xoops_getModuleHandler('category', 'newbb');
// $categoryHandler = xoops_getModuleHandler('category', 'newbb');
$criteriaCategory = new CriteriaCompo(new criteria('1', 1));
$criteriaCategory->setSort('cat_order');
$categories = $categoryHandler->getList($criteriaCategory);
Expand Down
4 changes: 2 additions & 2 deletions admin/admin_forum_prune.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@
return _MD_NEWBB_ERROR;
}
// SYNC FORUMS AFTER DELETE
/** @var \NewbbForumHandler $forumHandler */
$forumHandler = xoops_getModuleHandler('forum', 'newbb');
// /** @var \NewbbForumHandler $forumHandler */
// $forumHandler = xoops_getModuleHandler('forum', 'newbb');
$forumHandler->synchronization();
// I THINK POSTS AND TOPICS HAVE BEEN DESTROYED :LOL:
}
Expand Down
8 changes: 4 additions & 4 deletions admin/admin_forum_reorder.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@
echo "<td class='head' align='center'><strong>" . _AM_NEWBB_REORDERWEIGHT . '</strong></td>';
echo '</tr>';

/** @var \NewbbForumHandler $forumHandler */
$forumHandler = xoops_getModuleHandler('forum', 'newbb');
/** @var \NewbbCategoryHandler $categoryHandler */
$categoryHandler = xoops_getModuleHandler('category', 'newbb');
// /** @var \NewbbForumHandler $forumHandler */
// $forumHandler = xoops_getModuleHandler('forum', 'newbb');
// /** @var \NewbbCategoryHandler $categoryHandler */
// $categoryHandler = xoops_getModuleHandler('category', 'newbb');
$criteriaCategory = new CriteriaCompo(new criteria('1', 1));
$criteriaCategory->setSort('cat_order');
$categories = $categoryHandler->getAll($criteriaCategory, ['cat_id', 'cat_order', 'cat_title']);
Expand Down
8 changes: 4 additions & 4 deletions admin/admin_groupmod.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
$adminObject->displayNavigation(basename(__FILE__));
/** @var \XoopsMemberHandler $memberHandler */
$memberHandler = xoops_getHandler('member');
/** @var \NewbbForumHandler $forumHandler */
$forumHandler = xoops_getModuleHandler('forum', 'newbb');
///** @var \NewbbForumHandler $forumHandler */
//$forumHandler = xoops_getModuleHandler('forum', 'newbb');
if (Request::getString('submit', '', 'POST')) {
$fgroups = Request::getArray('group', '', 'POST');// !empty($_POST['group']) ? $_POST['group'] : '';
$fforum = Request::getInt('forenid', 0, 'POST');// (int)($_POST['forenid']);
Expand Down Expand Up @@ -73,8 +73,8 @@
echo _AM_NEWBB_GROUPMOD_TITLEDESC;
echo "<br><br><table width='100%' border='0' cellspacing='1' class='outer'>" . "<tr><td class='odd'>";
echo "<form name='reorder' method='post'>";
/** @var \NewbbCategoryHandler $categoryHandler */
$categoryHandler = xoops_getModuleHandler('category', 'newbb');
///** @var \NewbbCategoryHandler $categoryHandler */
//$categoryHandler = xoops_getModuleHandler('category', 'newbb');
$criteriaCategory = new CriteriaCompo(new criteria('1', 1));
$criteriaCategory->setSort('cat_order');
$categories = $categoryHandler->getAll($criteriaCategory, ['cat_id', 'cat_order', 'cat_title']);
Expand Down
21 changes: 13 additions & 8 deletions admin/admin_header.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,14 @@
//include_once $GLOBALS['xoops']->path('Frameworks/art/functions.admin.php');

include_once dirname(__DIR__) . '/include/config.php';
include_once dirname(__DIR__) . '/include/common.php';

$moduleDirName = basename(dirname(__DIR__));

if (false !== ($moduleHelper = Xmf\Module\Helper::getHelper($moduleDirName))) {
} else {
$moduleHelper = Xmf\Module\Helper::getHelper('system');
}
//if (false !== ($moduleHelper = Xmf\Module\Helper::getHelper($moduleDirName))) {
//} else {
// $moduleHelper = Xmf\Module\Helper::getHelper('system');
//}
/** @var Xmf\Module\Admin $adminObject */
$adminObject = Xmf\Module\Admin::getInstance();

Expand All @@ -59,13 +60,17 @@

$pathIcon16 = Xmf\Module\Admin::iconUrl('', 16);
$pathIcon32 = Xmf\Module\Admin::iconUrl('', 32);
$pathModIcon32 = $moduleHelper->getModule()->getInfo('modicons32');
//$pathModIcon32 = $moduleHelper->getModule()->getInfo('modicons32');
$pathModIcon32 = $helper->getModule()->getInfo('modicons32');

// Local icons path
$xoopsTpl->assign('pathModIcon16', $pathIcon16);
$xoopsTpl->assign('pathModIcon32', $pathIcon32);

// Load language files
$moduleHelper->loadLanguage('admin');
$moduleHelper->loadLanguage('modinfo');
$moduleHelper->loadLanguage('main');
//$moduleHelper->loadLanguage('admin');
//$moduleHelper->loadLanguage('modinfo');
//$moduleHelper->loadLanguage('main');
$helper->loadLanguage('admin');
$helper->loadLanguage('modinfo');
$helper->loadLanguage('main');
6 changes: 3 additions & 3 deletions admin/admin_report.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@
$op = Request::hasVar('submit', 'POST') ? 'save' : $op;
$op = Request::hasVar('delete', 'POST') ? 'delete' : $op;

/** @var \NewbbReportHandler $reportHandler */
$reportHandler = xoops_getModuleHandler('report', 'newbb');
///** @var \NewbbReportHandler $reportHandler */
//$reportHandler = xoops_getModuleHandler('report', 'newbb');

xoops_cp_header();

Expand Down Expand Up @@ -112,7 +112,7 @@
//if (!$newXoopsModuleGui) loadModuleAdminMenu(6,_AM_NEWBB_REPORTADMIN);
// else $adminObject->displayNavigation(basename(__FILE__));
$adminObject->addItemButton($title_other, $item_other, $icon = 'add');
$adminObject->displayButton();
$adminObject->displayButton('left');
echo _AM_NEWBB_REPORTADMIN_HELP;
echo "<table width='100%' border='0' cellspacing='1' class='outer'>" . "<tr><td class='odd'>";
echo '<form action="' . xoops_getenv('PHP_SELF') . '" method="post">';
Expand Down
4 changes: 2 additions & 2 deletions admin/admin_synchronization.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
// irmtfan rewrite topic sync
case 'topic':
$limit = Request::getInt('limit', 1000, 'POST'); //empty($_GET['limit']) ? 1000 : (int)($_GET['limit']);
/** @var \NewbbTopicHandler $topicHandler */
$topicHandler = xoops_getModuleHandler('topic', 'newbb');
// /** @var \NewbbTopicHandler $topicHandler */
// $topicHandler = xoops_getModuleHandler('topic', 'newbb');
$criteria = new Criteria('approved', 1);
if ($start >= ($count = $topicHandler->getCount($criteria))) {
break;
Expand Down
Loading

0 comments on commit fb3cfad

Please sign in to comment.