Navigation Menu

Skip to content

Commit

Permalink
Merge pull request #29 from mambax7/master
Browse files Browse the repository at this point in the history
PHP7, XOOPS 2.5.8
  • Loading branch information
mambax7 committed Mar 14, 2016
2 parents a68e903 + a3326b8 commit faab51d
Show file tree
Hide file tree
Showing 100 changed files with 1,195 additions and 1,154 deletions.
8 changes: 0 additions & 8 deletions .travis.yml

This file was deleted.

39 changes: 20 additions & 19 deletions action.post.php
Expand Up @@ -2,10 +2,10 @@
/**
* NewBB 4.3x, the forum module for XOOPS project
*
* @copyright XOOPS Project (http://xoops.org)
* @copyright XOOPS Project (http://xoops.org)
* @license http://www.fsf.org/copyleft/gpl.html GNU public license
* @author Taiwen Jiang (phppp or D.J.) <phppp@users.sourceforge.net>
* @since 4.00
* @author Taiwen Jiang (phppp or D.J.) <phppp@users.sourceforge.net>
* @since 4.00
* @version $Id $
* @package module::newbb
*/
Expand All @@ -24,20 +24,20 @@
redirect_header($_SERVER['HTTP_REFERER'], 2, _MD_NORIGHTTOACCESS);
}

$postHandler =& xoops_getmodulehandler('post', 'newbb');
$topicHandler =& xoops_getmodulehandler('topic', 'newbb');
$forumHandler =& xoops_getmodulehandler('forum', 'newbb');
$postHandler = xoops_getModuleHandler('post', 'newbb');
$topicHandler = xoops_getModuleHandler('topic', 'newbb');
$forumHandler = xoops_getModuleHandler('forum', 'newbb');
if (empty($topic_id)) {
$forum_obj = null;
} else {
$topic_obj =& $topicHandler->get($topic_id);
$topic_obj = $topicHandler->get($topic_id);
$forum_id = $topic_obj->getVar('forum_id');
$forum_obj =& $forumHandler->get($forum_id);
$forum_obj = $forumHandler->get($forum_id);
}
$isadmin = newbb_isAdmin($forum_obj);

if (!$isadmin) {
redirect_header(XOOPS_URL .'/index.php', 2, _MD_NORIGHTTOACCESS);
redirect_header(XOOPS_URL . '/index.php', 2, _MD_NORIGHTTOACCESS);
}

switch ($op) {
Expand All @@ -47,7 +47,7 @@
$topics = array();
$forums = array();
foreach ($post_id as $post) {
$post_obj =& $postHandler->get($post);
$post_obj = $postHandler->get($post);
if ($post_obj->getVar('topic_id') < 1) {
continue;
}
Expand All @@ -71,7 +71,7 @@
$criteria = new Criteria('post_id', '(' . implode(',', $post_id) . ')', 'IN');
$posts_obj =& $postHandler->getObjects($criteria, true);
foreach ($post_id as $post) {
$post_obj =& $posts_obj[$post];
$post_obj = $posts_obj[$post];
if (!empty($topic_id) && $topic_id !== $post_obj->getVar('topic_id')) {
continue;
}
Expand All @@ -91,13 +91,13 @@
}

$criteria_topic = new Criteria('topic_id', '(' . implode(',', array_keys($topics)) . ')', 'IN');
$topic_list =& $topicHandler->getList($criteria_topic, true);
$topic_list = $topicHandler->getList($criteria_topic, true);

$criteria_forum = new Criteria('forum_id', '(' . implode(',', array_keys($forums)) . ')', 'IN');
$forum_list =& $forumHandler->getList($criteria_forum);
$forum_list = $forumHandler->getList($criteria_forum);

include_once 'include/notification.inc.php';
$notificationHandler =& xoops_gethandler('notification');
include_once __DIR__ . '/include/notification.inc.php';
$notificationHandler = xoops_getHandler('notification');
foreach ($post_id as $post) {
$tags = array();
$tags['THREAD_NAME'] = $topic_list[$posts_obj[$post]->getVar('topic_id')];
Expand All @@ -120,7 +120,7 @@
$topics = array();
$forums = array();
foreach ($post_id as $post) {
$post_obj =& $postHandler->get($post);
$post_obj = $postHandler->get($post);
if (!empty($topic_id) && $topic_id !== $post_obj->getVar('topic_id')) {
continue;
}
Expand All @@ -143,7 +143,7 @@
}
$topic_id = $post_obj->getVar('topic_id');

$newtopic =& $topicHandler->create();
$newtopic = $topicHandler->create();
$newtopic->setVar('topic_title', $post_obj->getVar('subject'), true);
$newtopic->setVar('topic_poster', $post_obj->getVar('uid'), true);
$newtopic->setVar('forum_id', $post_obj->getVar('forum_id'), true);
Expand Down Expand Up @@ -183,12 +183,13 @@
$criteria = new CriteriaCompo(new Criteria('topic_id', $new_topic_id));
$criteria->add(new Criteria('post_id', $post_id, '>'));
$postHandler->identifierName = 'pid';
$posts = $postHandler->getList($criteria);
$posts = $postHandler->getList($criteria);

unset($criteria);
$post_update = array();
foreach ($posts as $postid => $pid) {
if (!in_array($pid, array_keys($posts))) {
// if (!in_array($pid, array_keys($posts))) {
if (!array_key_exists($pid, $posts)) {
$post_update[] = $pid;
}
if (!array_key_exists($pid, $posts)) {
Expand Down
28 changes: 14 additions & 14 deletions action.topic.php
Expand Up @@ -23,8 +23,8 @@
}

$topic_id = array_values($topic_id);
$topicHandler =& xoops_getmodulehandler('topic', 'newbb');
$forumHandler =& xoops_getmodulehandler('forum', 'newbb');
$topicHandler = xoops_getModuleHandler('topic', 'newbb');
$forumHandler = xoops_getModuleHandler('forum', 'newbb');

$isadmin = newbb_isAdmin($forum_id);

Expand All @@ -34,23 +34,23 @@
switch ($op) {
case 'restore':
$forums = array();
$topics_obj =& $topicHandler->getAll(new Criteria('topic_id', '(' . implode(',', $topic_id) . ')', 'IN'));
$topics_obj = $topicHandler->getAll(new Criteria('topic_id', '(' . implode(',', $topic_id) . ')', 'IN'));
foreach (array_keys($topics_obj) as $id) {
$topic_obj =& $topics_obj[$id];
$topicHandler->approve($topic_obj);
$topicHandler->synchronization($topic_obj);
$forums[$topic_obj->getVar('forum_id')] = 1;
}
$criteria_forum = new Criteria('forum_id', '(' . implode(',', array_keys($forums)) . ')', 'IN');
$forums_obj =& $forumHandler->getAll($criteria_forum);
$forums_obj = $forumHandler->getAll($criteria_forum);
foreach (array_keys($forums_obj) as $id) {
$forumHandler->synchronization($forums_obj[$id]);
}
unset($topics_obj, $forums_obj);
break;
case 'approve':
$forums = array();
$topics_obj =& $topicHandler->getAll(new Criteria('topic_id', '(' . implode(',', $topic_id) . ')', 'IN'));
$topics_obj = $topicHandler->getAll(new Criteria('topic_id', '(' . implode(',', $topic_id) . ')', 'IN'));
foreach (array_keys($topics_obj) as $id) {
$topic_obj =& $topics_obj[$id];
$topicHandler->approve($topic_obj);
Expand All @@ -59,7 +59,7 @@
}

$criteria_forum = new Criteria('forum_id', '(' . implode(',', array_keys($forums)) . ')', 'IN');
$forums_obj =& $forumHandler->getAll($criteria_forum);
$forums_obj = $forumHandler->getAll($criteria_forum);
foreach (array_keys($forums_obj) as $id) {
$forumHandler->synchronization($forums_obj[$id]);
}
Expand All @@ -68,8 +68,8 @@
break;
}

include_once 'include/notification.inc.php';
$notificationHandler =& xoops_gethandler('notification');
include_once __DIR__ . '/include/notification.inc.php';
$notificationHandler = xoops_getHandler('notification');
foreach (array_keys($topics_obj) as $id) {
$topic_obj =& $topics_obj[$id];
$tags = array();
Expand All @@ -79,7 +79,7 @@
$tags['FORUM_URL'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/viewforum.php?forum=' . $topic_obj->getVar('forum_id');
$notificationHandler->triggerEvent('global', 0, 'new_thread', $tags);
$notificationHandler->triggerEvent('forum', $topic_obj->getVar('forum_id'), 'new_thread', $tags);
$post_obj =& $topicHandler->getTopPost($id);
$post_obj = $topicHandler->getTopPost($id);
$tags['POST_URL'] = $tags['THREAD_URL'] . '#forumpost' . $post_obj->getVar('post_id');
$notificationHandler->triggerEvent('thread', $id, 'new_post', $tags);
$notificationHandler->triggerEvent('forum', $topic_obj->getVar('forum_id'), 'new_post', $tags);
Expand All @@ -94,7 +94,7 @@
break;
case 'delete':
$forums = array();
$topics_obj =& $topicHandler->getAll(new Criteria('topic_id', '(' . implode(',', $topic_id) . ')', 'IN'));
$topics_obj = $topicHandler->getAll(new Criteria('topic_id', '(' . implode(',', $topic_id) . ')', 'IN'));
foreach (array_keys($topics_obj) as $id) {
$topic_obj =& $topics_obj[$id];
// irmtfan should be set to false to not delete topic from database
Expand All @@ -104,7 +104,7 @@
}

$criteria_forum = new Criteria('forum_id', '(' . implode(',', array_keys($forums)) . ')', 'IN');
$forums_obj =& $forumHandler->getAll($criteria_forum);
$forums_obj = $forumHandler->getAll($criteria_forum);
foreach (array_keys($forums_obj) as $id) {
$forumHandler->synchronization($forums_obj[$id]);
}
Expand All @@ -113,14 +113,14 @@
case 'move':
if (XoopsRequest::getInt('newforum', 0, 'POST') && XoopsRequest::getInt('newforum', 0, 'POST') !== $forum_id && $forumHandler->getPermission(XoopsRequest::getInt('newforum', 0, 'POST'), 'post')) {
$criteria = new Criteria('topic_id', '(' . implode(',', $topic_id) . ')', 'IN');
$postHandler =& xoops_getmodulehandler('post', 'newbb');
$postHandler = xoops_getModuleHandler('post', 'newbb');
$postHandler->updateAll('forum_id', XoopsRequest::getInt('newforum', 0, 'POST'), $criteria, true);
$topicHandler->updateAll('forum_id', XoopsRequest::getInt('newforum', 0, 'POST'), $criteria, true);
$forumHandler->synchronization(XoopsRequest::getInt('newforum', 0, 'POST'));
$forumHandler->synchronization($forum_id);
} else {
include $GLOBALS['xoops']->path('header.php');
$categoryHandler =& xoops_getmodulehandler('category', 'newbb');
$categoryHandler = xoops_getModuleHandler('category', 'newbb');
$categories = $categoryHandler->getByPermission('access');
$forums = $forumHandler->getForumsByCategory(array_keys($categories), 'post', false);

Expand Down Expand Up @@ -165,7 +165,7 @@
}
break;
}
$statsHandler = &xoops_getmodulehandler('stats', 'newbb');
$statsHandler = xoops_getModuleHandler('stats', 'newbb');
$statsHandler->reset();
if (empty($forum_id)) {
redirect_header(XOOPS_URL . '/modules/newbb/list.topic.php', 2, _MD_DBUPDATED);
Expand Down
8 changes: 4 additions & 4 deletions admin/about.php
Expand Up @@ -33,13 +33,13 @@
xoops_cp_header();

if ($newXoopsModuleGui) {
$module_info =& $module_handler->get($xoopsModule->getVar('mid'));
$module_info = $module_handler->get($xoopsModule->getVar('mid'));
$aboutAdmin = new ModuleAdmin();
echo $aboutAdmin->addNavigation('about.php');
echo $aboutAdmin->renderAbout('PBQZ7D6LT6UBC', true);
} else {
$module_handler =& xoops_gethandler('module');
$versioninfo =& $module_handler->get($xoopsModule->getVar('mid'));
$module_handler = xoops_getHandler('module');
$versioninfo = $module_handler->get($xoopsModule->getVar('mid'));

//loadModuleAdminMenu(13, _AM_NEWBB_ABOUT . " " . $versioninfo->getInfo('name'));

Expand Down Expand Up @@ -156,7 +156,7 @@
echo "<td class='bg3' align='left'><strong>" . _AM_NEWBB_AUTHOR_WORD . '</strong></td>';
echo '</tr>';

$extra = (defined('_AM_NEWBB_AUTHOR_WORD_EXTRA')) ? _AM_NEWBB_AUTHOR_WORD_EXTRA : '';
$extra = defined('_AM_NEWBB_AUTHOR_WORD_EXTRA') ? _AM_NEWBB_AUTHOR_WORD_EXTRA : '';
echo '<tr>';
echo "<td class='even' align='left'>" . $versioninfo->getInfo('author_word') . '</td>';
echo '</tr>';
Expand Down
16 changes: 8 additions & 8 deletions admin/admin_cat_manager.php
Expand Up @@ -35,7 +35,7 @@
$op = XoopsRequest::getCmd('op', XoopsRequest::getCmd('op', '', 'POST'), 'GET'); //!empty($_GET['op'])? $_GET['op'] : (!empty($_POST['op'])?$_POST['op']:"");
$cat_id = XoopsRequest::getInt('cat_id', XoopsRequest::getInt('cat_id', 0, 'POST'), 'GET'); // (int)( !empty($_GET['cat_id']) ? $_GET['cat_id'] : @$_POST['cat_id'] );

$categoryHandler =& xoops_getmodulehandler('category', 'newbb');
$categoryHandler = xoops_getModuleHandler('category', 'newbb');

/**
* newCategory()
Expand All @@ -55,9 +55,9 @@ function newCategory()
function editCategory(XoopsObject $category_obj = null)
{
global $xoopsModule;
$categoryHandler = &xoops_getmodulehandler('category', 'newbb');
$categoryHandler = xoops_getModuleHandler('category', 'newbb');
if (null === $category_obj) {
$category_obj =& $categoryHandler->create();
$category_obj = $categoryHandler->create();
}
$groups_cat_access = null;
include_once $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar('dirname') . '/class/xoopsformloader.php');
Expand All @@ -80,7 +80,7 @@ function editCategory(XoopsObject $category_obj = null)
$imgdir = '/modules/' . $xoopsModule->getVar('dirname') . '/assets/images/category';
$cat_image = $category_obj->getVar('cat_image');
$cat_image = empty($cat_image) ? 'blank.gif' : $cat_image;
$graph_array =& XoopsLists::getImgListAsArray(XOOPS_ROOT_PATH . $imgdir . '/');
$graph_array = XoopsLists::getImgListAsArray(XOOPS_ROOT_PATH . $imgdir . '/');
array_unshift($graph_array, _NONE);
$cat_image_select = new XoopsFormSelect('', 'cat_image', $category_obj->getVar('cat_image'));
$cat_image_select->addOptionArray($graph_array);
Expand Down Expand Up @@ -122,11 +122,11 @@ function editCategory(XoopsObject $category_obj = null)
break;

case 'del':
if (!(XoopsRequest::getBool('confirm', '', 'POST'))) {
if (!XoopsRequest::getBool('confirm', '', 'POST')) {
xoops_confirm(array('op' => 'del', 'cat_id' => XoopsRequest::getInt('cat_id', 0, 'GET'), 'confirm' => 1), 'admin_cat_manager.php', _AM_NEWBB_WAYSYWTDTTAL);
break;
} else {
$category_obj =& $categoryHandler->create(false);
$category_obj = $categoryHandler->create(false);
$category_obj->setVar('cat_id', XoopsRequest::getInt('cat_id', 0, 'POST'));
$categoryHandler->delete($category_obj);

Expand All @@ -137,10 +137,10 @@ function editCategory(XoopsObject $category_obj = null)
case 'save':
mod_clearCacheFile('permission_category', 'newbb');
if ($cat_id) {
$category_obj =& $categoryHandler->get($cat_id);
$category_obj = $categoryHandler->get($cat_id);
$message = _AM_NEWBB_CATEGORYUPDATED;
} else {
$category_obj =& $categoryHandler->create();
$category_obj = $categoryHandler->create();
$message = _AM_NEWBB_CATEGORYCREATED;
}

Expand Down
8 changes: 4 additions & 4 deletions admin/admin_digest.php
Expand Up @@ -36,13 +36,13 @@
$item = XoopsRequest::getString('op', XoopsRequest::getInt('item', 'process', 'POST'), 'GET'); //!empty($_GET['op'])? $_GET['item'] : (!empty($_POST['item'])?$_POST['item']:"process");

$start = XoopsRequest::getInt('start', 0, 'GET');
//$reportHandler =& xoops_getmodulehandler('report', 'newbb');
//$reportHandler = xoops_getModuleHandler('report', 'newbb');

xoops_cp_header();
switch ($op) {
case 'delete':
$digest_ids = XoopsRequest::getArray('digest_id', '', 'POST');
$digestHandler =& xoops_getmodulehandler('digest', 'newbb');
$digestHandler = xoops_getModuleHandler('digest', 'newbb');
if ($digest_ids !== '') {
foreach ($digest_ids as $did => $value) {
$digestHandler->delete($did);
Expand All @@ -68,8 +68,8 @@
echo '</tr>';

$digests = array();
$digestHandler =& xoops_getmodulehandler('digest', 'newbb');
$digests =& $digestHandler->getAllDigests($start, $limit);
$digestHandler = xoops_getModuleHandler('digest', 'newbb');
$digests = $digestHandler->getAllDigests($start, $limit);
foreach ($digests as $digest) {
echo "<tr class='odd' align='left'>";
echo '<td><strong>#' . $digest['digest_id'] . ' @ ' . formatTimestamp($digest['digest_time']) . '</strong><br />' . str_replace("\n", '<br />', $digest['digest_content']) . '</td>';
Expand Down

0 comments on commit faab51d

Please sign in to comment.