$forum = $forumdata['forum_id']; $can_post = 0; $show_reg = 0; // ADMIN FLAG if (is_object(@$xoopsUser) && ($xoopsUser->isAdmin($xoopsModule->mid()) || xhnewbb_is_moderator($forum, $xoopsUser->getVar('uid')))) { $isadminormod = true; } else { $isadminormod = false; } // CHECK PRIVILEGES FOR VIEW if ($forumdata['forum_type'] == 1) { // this is a private forum. $accesserror = 0; if ($xoopsUser) { if (!$xoopsUser->isAdmin($xoopsModule->mid())) { if (!xhnewbb_check_priv_forum_read($xoopsUser->getVar('uid'), $forum)) { $accesserror = 1; } } } else { $accesserror = 1; } if ($accesserror == 1) { die(_MD_XHNEWBB_NORIGHTTOACCESS); } $can_post = 1; $show_reg = 1; } else { // this is not a priv forum if ($forumdata['forum_access'] == 1) { // this is a reg user only forum
$categories[] = $cat_row; } if ($uid > 0) { $sql = 'SELECT f.*, u.uname, u.uid, p.topic_id, p.post_time, p.subject, p.icon, u2t.u2t_time FROM ' . $xoopsDB->prefix('xhnewbb_forums') . ' f LEFT JOIN ' . $xoopsDB->prefix('xhnewbb_posts') . ' p ON p.post_id = f.forum_last_post_id LEFT JOIN ' . $xoopsDB->prefix('users') . ' u ON u.uid = p.uid LEFT JOIN ' . $xoopsDB->prefix('xhnewbb_users2topics') . ' u2t ON u2t.topic_id = p.topic_id AND u2t.uid = ' . $uid . ' WHERE ' . $whr_categories; } else { $sql = 'SELECT f.*, u.uname, u.uid, p.topic_id, p.post_time, p.subject, p.icon, 0 AS u2t_time FROM ' . $xoopsDB->prefix('xhnewbb_forums') . ' f LEFT JOIN ' . $xoopsDB->prefix('xhnewbb_posts') . ' p ON p.post_id = f.forum_last_post_id LEFT JOIN ' . $xoopsDB->prefix('users') . ' u ON u.uid = p.uid' . ' WHERE ' . $whr_categories; } if (!($result = $xoopsDB->query($sql . ' ORDER BY f.cat_id, f.forum_weight, f.forum_id'))) { if (!($result = $xoopsDB->query($sql . ' ORDER BY f.cat_id, f.forum_id'))) { die('Error'); } } $forums = array(); while ($forum_data = $xoopsDB->fetchArray($result)) { // private or public if ($forum_data['forum_type'] == 0 || $uid > 0 && ($xoopsUser->isAdmin($xoopsModule->mid()) || xhnewbb_check_priv_forum_read($uid, $forum_data['forum_id']))) { $forums[] = $forum_data; } } $cat_count = count($categories); if ($cat_count > 0) { for ($i = 0; $i < $cat_count; $i++) { $categories[$i]['cat_title'] = $myts->makeTboxData4Show($categories[$i]['cat_title']); if ($viewcat != 0 && $categories[$i]['cat_id'] != $viewcat) { $xoopsTpl->append("categories", $categories[$i]); continue; } foreach ($forums as $forum_row) { unset($last_post); if ($forum_row['cat_id'] == $categories[$i]['cat_id']) { if ($forum_row['post_time']) {