/** * Display forrum button * * @param string $image image/button name, without extension * @param string $alt alt message * @param boolean $asImage true for image mode; false for text mode * @param string $extra extra attribute for the button * @return mixed */ function newbb_getButton($link, $button, $alt = "", $asImage = true, $extra = "class='forum_button'") { if (empty($asImage)) { $button = "<a href='{$link}' title='{$alt}' {$extra}>" . newbb_displayImage($button, $alt, true) . "</a>"; } else { $button = "<input type='button' name='{$button}' {$extra} value='{$alt}' onclick='window.location.href={$link}' />"; } return $button; }
$xoopsTpl->assign('pagenav', $nav->renderNav(4)); } else { $xoopsTpl->assign('pagenav', ''); } $xoopsTpl->assign('lang_forum_index', sprintf(_MD_FORUMINDEX, htmlspecialchars($xoopsConfig['sitename'], ENT_QUOTES))); $xoopsTpl->assign('folder_topic', newbb_displayImage($forumImage['folder_topic'])); $xoopsTpl->assign('lang_title', $isnew ? _MD_VIEWNEWPOSTS : _MD_VIEWALLPOSTS); $xoopsTpl->assign('p_up', newbb_displayImage($forumImage['p_up'], _MD_TOP)); $xoopsTpl->assign('groupbar_enable', $xoopsModuleConfig['groupbar_enabled']); $xoopsTpl->assign('anonymous_prefix', $xoopsModuleConfig['anonymous_prefix']); $xoopsTpl->assign('down', newbb_displayImage($forumImage['doubledown'])); $xoopsTpl->assign('down2', newbb_displayImage($forumImage['down'])); $xoopsTpl->assign('up', newbb_displayImage($forumImage['up'])); $xoopsTpl->assign('printer', newbb_displayImage($forumImage['printer'])); $xoopsTpl->assign('personal', newbb_displayImage($forumImage['personal'])); $xoopsTpl->assign('post_content', newbb_displayImage($forumImage['post_content'])); $all_link = "viewall.php?forum=" . $forum_id . "&start={$start}"; $post_link = "viewpost.php?forum=" . $forum_id; $newpost_link = "viewpost.php?forum=" . $forum_id . "&new=1"; $digest_link = "viewall.php?forum=" . $forum_id . "&start={$start}&type=digest"; $unreplied_link = "viewall.php?forum=" . $forum_id . "&start={$start}&type=unreplied"; $unread_link = "viewall.php?forum=" . $forum_id . "&start={$start}&type=unread"; $xoopsTpl->assign('all_link', $all_link); $xoopsTpl->assign('post_link', $post_link); $xoopsTpl->assign('newpost_link', $newpost_link); $xoopsTpl->assign('digest_link', $digest_link); $xoopsTpl->assign('unreplied_link', $unreplied_link); $xoopsTpl->assign('unread_link', $unread_link); $viewmode_options = array(); if ($isnew) { if ($order == 'DESC') {
function loadUserOnline() { if (empty($this->users) || !$this->enableOnline) { return; } mod_loadFunctions("render", "newbb"); $image_online = newbb_displayImage('online', _MD_ONLINE); $image_offline = newbb_displayImage('offline', _MD_OFFLINE); $online_handler =& xoops_getmodulehandler('online', 'newbb'); $onlines = $online_handler->checkStatus(array_keys($this->users)); foreach (array_keys($this->users) as $uid) { $this->userlist[$uid]["status"] = empty($onlines[$uid]) ? $image_offline : $image_online; } }
function display_topic($forum, $topic_id, $content_only = 1) { global $db, $myts, $xoopsUser, $xoopsModule, $forumTable, $meta; if ($content_only == 0) { include_once XOOPS_ROOT_PATH . "/header.php"; } $q = "select * from " . $forumTable['forums'] . " WHERE forum_id=" . $forum; $result = $db->query($q); $forumdata = $db->fetch_array($result); $q = "select * from " . $forumTable['topics'] . " WHERE topic_id=" . $topic_id; $result = $db->query($q); $topicdata = $db->fetch_array($result); echo "<table border='0' width='100%' cellpadding='5'>"; echo "<tr><td align='left'>" . newbb_displayImage('f_open') . " <a href='" . $forumPath['url'] . "archive.php'>"; echo _MD_FORUM_ARCHIVE . "</a>"; if ($forumdata['parent_forum'] == 0) { echo "<br /> " . newbb_displayImage('f_open') . " <a href='archive.php?forum={$forum}'>" . $myts->htmlSpecialChars($forumdata['forum_name']) . "</a>"; echo "<br />" . newbb_displayImage('f_content') . " <strong>" . $myts->htmlSpecialChars($topicdata['topic_title']) . "</strong><br />"; } else { $q = "select forum_name from " . $forumTable['forums'] . " WHERE forum_id=" . $forumdata['parent_forum']; $row = $db->fetch_array($db->query($q)); echo "<br /> " . newbb_displayImage('f_open') . " <a href='" . $forumPath['url'] . "archive.php?forum=" . $forumdata['parent_forum'] . "'>" . $myts->htmlSpecialChars($row['forum_name']) . "</a>"; echo "<br /> " . newbb_displayImage('f_open') . " <a href='archive.php?forum={$forum}'>" . $myts->htmlSpecialChars($forumdata['forum_name']) . "</a>"; echo "<br /> " . newbb_displayImage('f_content') . " <strong>" . $myts->htmlSpecialChars($topicdata['topic_title']) . "</strong><br />"; } echo "</td></tr></table><br />"; // =============== LINK HEADER =============== echo "<table border='0' width='640' cellpadding='5' cellspacing='0' bgcolor='#FFFFFF' align=center><tr><td>"; echo "<h3>" . _MD_FORUM . " : " . $forumdata['forum_name'] . "</h3>"; echo "<h3>" . _MD_SUBJECT . " : " . $topicdata['topic_title'] . "</h3>"; echo "<i><strong>" . $meta['copyright'] . "<br /><a href=" . XOOPS_URL . ">" . XOOPS_URL . "</a>\r\n<br /><br />" . _MD_PRINT_TOPIC_LINK . "<br />\r\n<a href='" . XOOPS_URL . "/modules/" . $xoopsModule->dirname() . "/viewtopic.php?topic_id={$topic_id}&forum={$forum}'>" . XOOPS_URL . "/modules/" . $xoopsModule->dirname() . "/viewtopic.php?topic_id={$topic_id}&forum={$forum}</a>\r\n</strong></i><br /><br />"; // ============= END LINK HEADER ============= $forumpost = new ForumPosts(); $forumpost->setOrder("post_time ASC"); $forumpost->setTopicId($topic_id); $forumpost->setParent(0); $postsArray = $forumpost->getAllPosts(); $count = 0; echo "<table border='0' width='100%' cellpadding='5' cellspacing='0' bgcolor='#FFFFFF'><tr><td>"; foreach ($postsArray as $obj) { if (!($count % 2)) { $row_color = 1; } else { $row_color = 2; } echo "<tr><td>"; $forumpost->setType($obj->type); $obj->showPostForPrint($order); $count++; echo "</td></tr>"; } echo "</table>"; echo "</td></tr></table>"; if ($content_only == 0) { include_once XOOPS_ROOT_PATH . "/footer.php"; } }
echo "\n\t\t<table width='100%' cellspacing='1' cellpadding='3' border='0' class='outer'>\n\n <tr>\n\n <td width='10%' class='bg3' align='center'><strong>" . _AM_NEWBB_POSTID . "</strong></td>\n\n <td width='20%' class='bg3' align='center'><strong>" . _AM_NEWBB_POSTER . "</strong></td>\n\n <td width='40%'class='bg3' align='center'><strong>" . _AM_NEWBB_SUBJECT . "</strong></td>\n\n <td width='15%' class='bg3' align='center'><strong>" . _AM_NEWBB_POSTDATE . "</strong></td>\n\n <td width='15%' class='bg3' align='center'><strong>" . _AM_NEWBB_ACTION . "</strong></td>\n\n </tr>"; if ($numrows > 0) { // That is, if there ARE columns in the system while ($post = $xoopsDB->fetchArray($result)) { $user = getLinkUsernameFromUid($post['uid'], 0); $modify = "<a href='index.php?op=mod&post_id=" . $post['post_id'] . "'>" . newbb_displayImage($forumImage['edit'], _EDIT) . "</a>"; $delete = "<a href='index.php?op=del&post_id=" . $post['post_id'] . "'>" . newbb_displayImage($forumImage['delete'], _DELETE) . "</a>"; $approve = "<a href='index.php?op=approve&post_id=" . $post['post_id'] . "&approved=1'>" . newbb_displayImage($forumImage['approve'], _AM_NEWBB_APPROVE) . "</a>"; $text = $myts->displayTarea($post['post_text'], $post['dohtml'], $post['dosmiley'], $post['doxcode']); echo "<tr>\n\n <td class='head' align='center'>" . $post['post_id'] . "</td>\n\n <td class='even' align='center'>" . $user . "</td>\n\n <td class='even'>" . $post['subject'] . "</td>\n\n <td class='even'>" . formatTimestamp($post['post_time']) . "</td>\n\n <td class='even' align='center'> {$modify} {$approve} {$delete} </td>\n\n </tr>\n\n <tr>\n\n <td align='center' class='odd'>" . $post['post_id'] . "</td>\n\n <td colspan='4' align='center' class='odd'>" . _AM_NEWBB_APPROVETEXT . "</td>\n\n </tr><tr>\n\n <td align='center' class='odd'>" . $post['post_id'] . "</td>\n\n <td colspan='4' class='odd'>" . $text . "</td>\n\n </tr>"; } } else { // that is, $numrows = 0, there's no columns yet echo "<tr>\n\n <td class='head' align='center' colspan='5'>" . _AM_NEWBB_NOAPPROVEPOST . "</td>\n\n </tr>"; } echo "</table>\n\n </fieldset>"; $sql = "SELECT t.* FROM " . $xoopsDB->prefix("bb_topics") . " t LEFT JOIN " . $xoopsDB->prefix("bb_posts") . " p ON p.topic_id=t.topic_id WHERE p.pid = 0 AND p.approved = 1 AND t.approved = 0"; $result = $xoopsDB->query($sql); $numrows = $xoopsDB->getRowsNum($result); if ($numrows > 0) { echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _AM_NEWBB_ORPHAN_TOPICS_FOR_AUTH . "</legend><br />\n\n <table width='100%' cellspacing='1' cellpadding='3' border='0' class='outer'>\n\n <tr>\n\n <td width='10%' class='bg3' align='center'><strong>" . _AM_NEWBB_TOPICID . "</strong></td>\n\n <td class='bg3' align='center'><strong>" . _AM_NEWBB_SUBJECT . "</strong></td>\n\n <td width='15%' class='bg3' align='center'><strong>" . _AM_NEWBB_POSTDATE . "</strong></td>\n\n <td width='15%' class='bg3' align='center'><strong>" . _AM_NEWBB_ACTION . "</strong></td>\n\n </tr>"; while ($topic = $xoopsDB->fetchArray($result)) { $approve = "<a href='index.php?op=approve&topic_id=" . $topic['topic_id'] . "&approved=1'>" . newbb_displayImage($forumImage['approve'], _AM_NEWBB_APPROVE) . "</a>"; echo "<tr>\n\n <td class='head' align='center'>" . $topic['topic_id'] . "</td>\n\n <td class='even' align='center'>" . $topic['topic_title'] . "</td>\n\n <td class='even' align='center'>" . formatTimestamp($topic['topic_time']) . "</td>\n\n <td class='even' align='center'> {$approve} </td>\n\n </tr>"; } echo "</table>\n\n </fieldset>"; } echo "<br /><br />"; xoops_cp_footer(); break; }
function showPost($isadmin, $forumdata) { global $xoopsConfig, $xoopsModule, $xoopsModuleConfig, $xoopsUser, $myts, $xoopsTpl, $forumUrl, $forumImage, $viewtopic_users, $viewtopic_posters, $viewtopic_forum, $online, $user_karma, $viewmode, $order, $start, $total_posts; static $post_NO = 0; static $user_ip; $post_NO++; if (strtolower($order) == "desc") { $post_no = $total_posts - ($start + $post_NO) + 1; } else { $post_no = $start + $post_NO; } $uid = is_object($xoopsUser) ? $xoopsUser->getVar('uid') : 0; if ($isadmin or $this->checkIdentity()) { $post_text = $this->getVar('post_text'); $post_attachment = $this->displayAttachment(); } elseif ($xoopsModuleConfig['enable_karma'] && $this->getVar('post_karma') > $user_karma) { $post_text = "<div class='karma'>" . sprintf(_MD_KARMA_REQUIREMENT, $user_karma, $this->getVar('post_karma')) . "</div>"; $post_attachment = ''; } elseif ($xoopsModuleConfig['allow_require_reply'] && $this->getVar('require_reply') && (!$uid || !in_array($uid, $viewtopic_posters))) { $post_text = "<div class='karma'>" . _MD_REPLY_REQUIREMENT . "</div>"; $post_attachment = ''; } else { $post_text = $this->getVar('post_text'); $post_attachment = $this->displayAttachment(); } $poster = $this->getVar('uid') > 0 && isset($viewtopic_users[$this->getVar('uid')]) ? $viewtopic_users[$this->getVar('uid')] : array('poster_uid' => 0, 'name' => $this->getVar('poster_name') ? $this->getVar('poster_name') : $myts->HtmlSpecialChars($xoopsConfig['anonymous']), 'link' => $this->getVar('poster_name') ? $this->getVar('poster_name') : $myts->HtmlSpecialChars($xoopsConfig['anonymous'])); $posticon = $this->getVar('icon'); if (isset($posticon) && $posticon != '') { $post_image = '<a name="' . $this->getVar('post_id') . '"><img src="' . XOOPS_URL . '/images/subject/' . $this->getVar('icon') . '" alt="" /></a>'; } else { $post_image = '<a name="' . $this->getVar('post_id') . '"><img src="' . XOOPS_URL . '/images/icons/posticon.gif" alt="" /></a>'; } $post_title = $this->getVar('subject'); $thread_buttons = array(); $topic_handler =& xoops_getmodulehandler('topic', 'newbb'); if ($topic_handler->getPermission($viewtopic_forum, $forumdata['topic_status'], "edit")) { $edit_ok = false; if ($isadmin) { $edit_ok = true; } elseif ($this->checkIdentity() && $this->checkTimelimit('edit_timelimit')) { $edit_ok = true; } if ($edit_ok) { $thread_buttons['edit']['image'] = newbb_displayImage($forumImage['p_edit'], _EDIT); $thread_buttons['edit']['link'] = "edit.php?forum=" . $forumdata['forum_id'] . "&topic_id=" . $this->getVar('topic_id') . "&viewmode={$viewmode}&order={$order}"; $thread_buttons['edit']['name'] = _EDIT; } else { $thread_buttons['edit']['image'] = ""; $thread_buttons['edit']['link'] = ""; $thread_buttons['edit']['name'] = ""; } } if ($topic_handler->getPermission($viewtopic_forum, $forumdata['topic_status'], "delete")) { $delete_ok = false; if ($isadmin) { $delete_ok = true; } elseif ($this->checkIdentity() && $this->checkTimelimit('delete_timelimit')) { $delete_ok = true; } if ($delete_ok) { $thread_buttons['delete']['image'] = newbb_displayImage($forumImage['p_delete'], _DELETE); $thread_buttons['delete']['link'] = "delete.php?forum=" . $forumdata['forum_id'] . "&topic_id=" . $this->getVar('topic_id') . "&viewmode={$viewmode}&order={$order}&act=1"; $thread_buttons['delete']['name'] = _DELETE; } else { $thread_buttons['delete']['image'] = ""; $thread_buttons['delete']['link'] = ""; $thread_buttons['delete']['name'] = ""; } if ($isadmin) { $thread_buttons['delete']['image'] = newbb_displayImage($forumImage['p_delete'], _DELETE); $thread_buttons['delete']['link'] = "delete.php?forum=" . $forumdata['forum_id'] . "&topic_id=" . $this->getVar('topic_id') . "&viewmode={$viewmode}&order={$order}&act=99"; $thread_buttons['delete']['name'] = _DELETE; } } if ($topic_handler->getPermission($viewtopic_forum, $forumdata['topic_status'], "reply")) { $t_reply = newbb_displayImage($forumImage['t_reply'], _MD_POSTREPLY); $xoopsTpl->assign('forum_reply', "<a href=\"reply.php?forum=" . $forumdata['forum_id'] . "&topic_id=" . $this->getVar('topic_id') . "&viewmode=" . $viewmode . "&start={$start}&post_id=" . $forumdata['topic_last_post_id'] . "\">" . $t_reply . "</a>"); $thread_buttons['reply']['image'] = newbb_displayImage($forumImage['p_reply'], _MD_REPLY); $thread_buttons['reply']['link'] = "reply.php?forum=" . $forumdata['forum_id'] . "&topic_id=" . $this->getVar('topic_id') . "&viewmode={$viewmode}&order={$order}&start={$start}"; $thread_buttons['reply']['name'] = _MD_REPLY; $thread_buttons['quote']['image'] = newbb_displayImage($forumImage['p_quote'], _MD_QUOTE); $thread_buttons['quote']['link'] = "reply.php?forum=" . $forumdata['forum_id'] . "&topic_id=" . $this->getVar('topic_id') . "&viewmode={$viewmode}&order={$order}&start={$start}&quotedac=1"; $thread_buttons['quote']['name'] = _MD_QUOTE; } if (!$isadmin && $xoopsModuleConfig['reportmod_enabled']) { $thread_buttons['report']['image'] = newbb_displayImage($forumImage['p_report'], _MD_REPORT); $thread_buttons['report']['link'] = "report.php?forum=" . $forumdata['forum_id'] . "&topic_id=" . $this->getVar('topic_id') . "&viewmode={$viewmode}&order={$order}"; $thread_buttons['report']['name'] = _MD_REPORT; } if ($isadmin) { $thread_action['news']['image'] = newbb_displayImage($forumImage['news'], _MD_POSTTONEWS); $thread_action['news']['link'] = "posttonews.php?topic_id=" . $this->getVar('topic_id'); $thread_action['news']['name'] = _MD_POSTTONEWS; } $thread_action['pdf']['image'] = newbb_displayImage($forumImage['pdf'], _MD_PDF); $thread_action['pdf']['link'] = "makepdf.php?type=post&pageid=0&scale=0.66"; $thread_action['pdf']['name'] = _MD_PDF; $thread_action['print']['image'] = newbb_displayImage($forumImage['printer'], _MD_PRINT); $thread_action['print']['link'] = "print.php?form=2&forum=" . $forumdata['forum_id'] . "&topic_id=" . $this->getVar('topic_id'); $thread_action['print']['name'] = _MD_PRINT; if (is_object($xoopsUser) && $this->getVar('uid') > 0 && isset($viewtopic_users[$this->getVar('uid')])) { $thread_action['pm']['image'] = $image_url = "<img src=\"" . $forumImage['pm'] . "\" alt=\"" . _MD_PM . "\" align=\"middle\" />"; $thread_action['pm']['link'] = "posttopm.php?"; $thread_action['pm']['name'] = _MD_PM; } $xoopsTpl->append('topic_posts', array('post_id' => $this->getVar('post_id'), 'post_parent_id' => $this->getVar('pid'), 'post_date' => newbb_formatTimestamp($this->getVar('post_time')), 'post_image' => $post_image, 'post_title' => $post_title, 'post_text' => $post_text, 'post_attachment' => $post_attachment, 'post_edit' => $this->displayPostEdit(), 'post_no' => $post_no, 'post_signature' => $this->getVar('attachsig') ? @$poster["signature"] : "", 'poster_ip' => $isadmin && $xoopsModuleConfig['show_ip'] ? long2ip($this->getVar('poster_ip')) : "", 'thread_action' => $thread_action, 'thread_buttons' => $thread_buttons, 'poster' => $poster)); unset($thread_buttons); unset($eachposter); }
function showPost($isadmin) { global $xoopsConfig, $xoopsModule, $xoopsModuleConfig, $xoopsUser, $myts; global $forumUrl, $forumImage; global $viewtopic_users, $viewtopic_posters, $forum_obj, $topic_obj, $online, $user_karma, $viewmode, $order, $start, $total_posts, $topic_status; static $post_NO = 0; static $name_anonymous; if (!isset($name_anonymous)) { $name_anonymous = $myts->HtmlSpecialChars($GLOBALS["xoopsConfig"]['anonymous']); } mod_loadFunctions("time", "newbb"); mod_loadFunctions("render", "newbb"); $post_id = $this->getVar('post_id'); $topic_id = $this->getVar('topic_id'); $forum_id = $this->getVar('forum_id'); $query_vars = array("status", "order", "start", "mode", "viewmode"); $query_array = array(); $query_array["topic_id"] = "topic_id={$topic_id}"; foreach ($query_vars as $var) { if (!empty($_GET[$var])) { $query_array[$var] = "{$var}={$_GET[$var]}"; } } $page_query = htmlspecialchars(implode("&", array_values($query_array))); $uid = is_object($xoopsUser) ? $xoopsUser->getVar('uid') : 0; $post_NO++; if (strtolower($order) == "desc") { $post_no = $total_posts - ($start + $post_NO) + 1; } else { $post_no = $start + $post_NO; } if ($isadmin || $this->checkIdentity()) { $post_text = $this->getVar('post_text'); $post_attachment = $this->displayAttachment(); } elseif ($xoopsModuleConfig['enable_karma'] && $this->getVar('post_karma') > $user_karma) { $post_text = "<div class='karma'>" . sprintf(_MD_KARMA_REQUIREMENT, $user_karma, $this->getVar('post_karma')) . "</div>"; $post_attachment = ''; } elseif ($xoopsModuleConfig['allow_require_reply'] && $this->getVar('require_reply') && (!$uid || !in_array($uid, $viewtopic_posters))) { $post_text = "<div class='karma'>" . _MD_REPLY_REQUIREMENT . "</div>"; $post_attachment = ''; } else { $post_text = $this->getVar('post_text'); $post_attachment = $this->displayAttachment(); } if (isset($viewtopic_users[$this->getVar('uid')])) { $poster = $viewtopic_users[$this->getVar('uid')]; } else { $name = ($post_name = $this->getVar('poster_name')) ? $post_name : $name_anonymous; $poster = array('poster_uid' => 0, 'name' => $name, 'link' => $name); } if ($posticon = $this->getVar('icon')) { $post_image = '<a name="' . $post_id . '"><img src="' . XOOPS_URL . '/images/subject/' . $posticon . '" alt="" /></a>'; } else { $post_image = '<a name="' . $post_id . '"><img src="' . XOOPS_URL . '/images/icons/posticon.gif" alt="" /></a>'; } $thread_buttons = array(); $mod_buttons = array(); if ($isadmin && ($xoopsUser && $xoopsUser->getVar('uid') != $this->getVar('uid')) && $this->getVar('uid') > 0) { $mod_buttons['bann']['image'] = newbb_displayImage('p_bann', _MD_SUSPEND_MANAGEMENT); $mod_buttons['bann']['link'] = "moderate.php?forum=" . $forum_id . "&fuid=" . $this->getVar('uid'); $mod_buttons['bann']['name'] = _MD_SUSPEND_MANAGEMENT; $thread_buttons['bann']['image'] = newbb_displayImage('p_bann', _MD_SUSPEND_MANAGEMENT); $thread_buttons['bann']['link'] = "moderate.php?forum=" . $forum_id . "&fuid=" . $this->getVar('uid'); $thread_buttons['bann']['name'] = _MD_SUSPEND_MANAGEMENT; } if ($GLOBALS["xoopsModuleConfig"]['enable_permcheck']) { $topic_handler =& xoops_getmodulehandler('topic', 'newbb'); $topic_status = $topic_obj->getVar('topic_status'); if ($topic_handler->getPermission($forum_id, $topic_status, "edit")) { $edit_ok = $isadmin || $this->checkIdentity() && $this->checkTimelimit('edit_timelimit'); if ($edit_ok) { $thread_buttons['edit']['image'] = newbb_displayImage('p_edit', _EDIT); $thread_buttons['edit']['link'] = "edit.php?{$page_query}"; $thread_buttons['edit']['name'] = _EDIT; $mod_buttons['edit']['image'] = newbb_displayImage('p_edit', _EDIT); $mod_buttons['edit']['link'] = "edit.php?{$page_query}"; $mod_buttons['edit']['name'] = _EDIT; } } if ($topic_handler->getPermission($forum_id, $topic_status, "delete")) { $delete_ok = $isadmin || $this->checkIdentity() && $this->checkTimelimit('delete_timelimit'); if ($delete_ok) { $thread_buttons['delete']['image'] = newbb_displayImage('p_delete', _DELETE); $thread_buttons['delete']['link'] = "delete.php?{$page_query}"; $thread_buttons['delete']['name'] = _DELETE; $mod_buttons['delete']['image'] = newbb_displayImage('p_delete', _DELETE); $mod_buttons['delete']['link'] = "delete.php?{$page_query}"; $mod_buttons['delete']['name'] = _DELETE; } } if ($topic_handler->getPermission($forum_id, $topic_status, "reply")) { $thread_buttons['reply']['image'] = newbb_displayImage('p_reply', _MD_REPLY); $thread_buttons['reply']['link'] = "reply.php?{$page_query}"; $thread_buttons['reply']['name'] = _MD_REPLY; $thread_buttons['quote']['image'] = newbb_displayImage('p_quote', _MD_QUOTE); $thread_buttons['quote']['link'] = "reply.php?{$page_query}&quotedac=1"; $thread_buttons['quote']['name'] = _MD_QUOTE; } } else { $mod_buttons['edit']['image'] = newbb_displayImage('p_edit', _EDIT); $mod_buttons['edit']['link'] = "edit.php?{$page_query}"; $mod_buttons['edit']['name'] = _EDIT; $mod_buttons['delete']['image'] = newbb_displayImage('p_delete', _DELETE); $mod_buttons['delete']['link'] = "delete.php?{$page_query}"; $mod_buttons['delete']['name'] = _DELETE; $thread_buttons['reply']['image'] = newbb_displayImage('p_reply', _MD_REPLY); $thread_buttons['reply']['link'] = "reply.php?{$page_query}"; $thread_buttons['reply']['name'] = _MD_REPLY; } if (!$isadmin && $xoopsModuleConfig['reportmod_enabled']) { $thread_buttons['report']['image'] = newbb_displayImage('p_report', _MD_REPORT); $thread_buttons['report']['link'] = "report.php?{$page_query}"; $thread_buttons['report']['name'] = _MD_REPORT; } $thread_action = array(); $thread_action['pdf']['image'] = newbb_displayImage('pdf', _MD_PDF); $thread_action['pdf']['link'] = "makepdf.php?type=post&pageid=0&scale=0.66"; $thread_action['pdf']['name'] = _MD_PDF; $thread_action['pdf']['target'] = '_blank'; $thread_action['print']['image'] = newbb_displayImage('printer', _MD_PRINT); $thread_action['print']['link'] = "print.php?form=2&forum=" . $forum_id . "&topic_id=" . $topic_id; $thread_action['print']['name'] = _MD_PRINT; $thread_action['print']['target'] = '_blank'; $post = array('post_id' => $post_id, 'post_parent_id' => $this->getVar('pid'), 'post_date' => newbb_formatTimestamp($this->getVar('post_time')), 'post_image' => $post_image, 'post_title' => $this->getVar('subject'), 'post_text' => $post_text, 'post_attachment' => $post_attachment, 'post_edit' => $this->displayPostEdit(), 'post_no' => $post_no, 'post_signature' => $this->getVar('attachsig') ? @$poster["signature"] : "", 'poster_ip' => $isadmin && $xoopsModuleConfig['show_ip'] ? long2ip($this->getVar('poster_ip')) : "", 'thread_action' => $thread_action, 'thread_buttons' => $thread_buttons, 'mod_buttons' => $mod_buttons, 'poster' => $poster, 'post_permalink' => '<a href="viewtopic.php?post_id=' . $post_id . '"></a>'); unset($thread_buttons); unset($mod_buttons); unset($eachposter); return $post; }
break; } $xoopsTpl->assign('forum_topicstatus', $current_status); $all_topics = $forum_handler->getTopicCount($forum_obj, $startdate, $status); if ($all_topics > $xoopsModuleConfig['topics_per_page']) { include XOOPS_ROOT_PATH . '/class/pagenav.php'; $query_nav = $query_array; unset($query_nav["start"]); $page_query_nav = implode("&", array_values($query_nav)); unset($query_nav); $nav = new XoopsPageNav($all_topics, $xoopsModuleConfig['topics_per_page'], $start, "start", $page_query_nav); $xoopsTpl->assign('forum_pagenav', $nav->renderNav(4)); } else { $xoopsTpl->assign('forum_pagenav', ''); } if (!empty($xoopsModuleConfig['show_jump'])) { mod_loadFunctions("forum", "newbb"); $xoopsTpl->assign('forum_jumpbox', newbb_make_jumpbox($forum_id)); } $xoopsTpl->assign('menumode', $menumode); $xoopsTpl->assign('menumode_other', $menumode_other); if ($xoopsModuleConfig['show_permissiontable']) { $perm_handler = xoops_getmodulehandler('permission', 'newbb'); $permission_table = $perm_handler->permission_table($forum_id, false, $isadmin); $xoopsTpl->assign_by_ref('permission_table', $permission_table); unset($permission_table); } if ($xoopsModuleConfig['rss_enable'] == 1) { $xoopsTpl->assign("rss_button", "<div align='right'><a href='" . XOOPS_URL . "/modules/" . $xoopsModule->dirname() . "/rss.php?f=" . $forum_id . "' title='RSS feed' target='_blank'>" . newbb_displayImage('rss', 'RSS feed') . "</a></div>"); } include XOOPS_ROOT_PATH . "/footer.php";
function &display($forums, $length_title_index = 30, $count_subforum = 1) { global $xoopsModule, $xoopsConfig, $xoopsModuleConfig, $myts; $posts = array(); $posts_obj = array(); foreach (array_keys($forums) as $id) { $posts[] = $forums[$id]["forum_last_post_id"]; } if (!empty($posts)) { $post_handler =& xoops_getmodulehandler('post', 'newbb'); $tags_post = array("uid", "topic_id", "post_time", "poster_name", "icon"); if (!empty($length_title_index)) { $tags_post[] = "subject"; } $posts = $post_handler->getAll(new Criteria("post_id", "(" . implode(", ", $posts) . ")", "IN"), $tags_post, false); } // Get topic/post stats per forum $stats_forum = array(); if (!empty($count_subforum)) { $stats_forum = $this->getSubforumStats(array_keys($forums)); } $users = array(); $reads = array(); $topics = array(); foreach (array_keys($forums) as $id) { $forum =& $forums[$id]; if (!$forum["forum_last_post_id"]) { continue; } if (!($post = @$posts[$forum["forum_last_post_id"]])) { $forum["forum_last_post_id"] = 0; continue; } $users[] = $post["uid"]; if ($moderators[$id] = $forum["forum_moderator"]) { $users = array_merge($users, $moderators[$id]); } // reads if (!empty($xoopsModuleConfig["read_mode"])) { $reads[$id] = $xoopsModuleConfig["read_mode"] == 1 ? $post['post_time'] : $post['post_id']; } } require_once XOOPS_ROOT_PATH . "/modules/newbb/include/functions.user.php"; require_once XOOPS_ROOT_PATH . "/modules/newbb/include/functions.time.php"; require_once XOOPS_ROOT_PATH . "/modules/newbb/include/functions.render.php"; require_once XOOPS_ROOT_PATH . "/modules/newbb/include/functions.read.php"; $forum_isread = newbb_isRead("forum", $reads); $users_linked = newbb_getUnameFromIds(array_unique($users), !empty($xoopsModuleConfig['show_realname']), true); $forums_array = array(); $name_anonymous = $myts->htmlSpecialChars($GLOBALS["xoopsConfig"]["anonymous"]); foreach (array_keys($forums) as $id) { $forum =& $forums[$id]; $_forum_data = array(); $_forum_data["forum_order"] = $forum['forum_order']; $_forum_data["forum_id"] = $id; $_forum_data["forum_cid"] = $forum['cat_id']; $_forum_data["forum_name"] = $forum['forum_name']; $_forum_data["forum_desc"] = $myts->displayTarea($forum['forum_desc']); $_forum_data["forum_topics"] = $forum["forum_topics"] + @$stats_forum[$id]["topics"]; $_forum_data["forum_posts"] = $forum["forum_posts"] + @$stats_forum[$id]["posts"]; //$_forum_data["forum_type"] = $forum['forum_type']; $forum_moderators = array(); if (!empty($moderators[$id])) { foreach (@$moderators[$id] as $moderator) { $forum_moderators[] = @$users_linked[$moderator]; } } $_forum_data["forum_moderators"] = implode(", ", $forum_moderators); if ($post_id = $forum["forum_last_post_id"]) { $post =& $posts[$post_id]; $_forum_data['forum_lastpost_id'] = $post_id; $_forum_data['forum_lastpost_time'] = newbb_formatTimestamp($post['post_time']); if (!empty($users_linked[$post["uid"]])) { $_forum_data["forum_lastpost_user"] = $users_linked[$post["uid"]]; } elseif ($poster_name = $post["poster_name"]) { $_forum_data["forum_lastpost_user"] = $poster_name; } else { $_forum_data["forum_lastpost_user"] = $name_anonymous; } if (!empty($length_title_index)) { $subject = $post["subject"]; if ($length_title_index < 255) { $subject = xoops_substr($subject, 0, $length_title_index); } $_forum_data['forum_lastpost_subject'] = $subject; } if ($icon = $post['icon']) { $_forum_data['forum_lastpost_icon'] = $icon; } else { $_forum_data['forum_lastpost_icon'] = 'icon1.gif'; } } $forum_folder = empty($forum_isread[$id]) ? 'forum_new' : 'forum'; $_forum_data['forum_folder'] = newbb_displayImage($forum_folder); $forums_array[$forum['parent_forum']][] = $_forum_data; } return $forums_array; }
$uservotes = $xoopsDB->getRowsNum($result2); $useravgrating = 0; while (list($rating2) = $xoopsDB->fetchRow($result2)) { $useravgrating = $useravgrating + $rating2; } if ($useravgrating > 0) { $useravgrating = $useravgrating / $uservotes; $useravgrating = number_format($useravgrating, 2); } xoops_cp_header(); $xTheme->loadModuleAdminMenu(10, _AM_NEWBB_VOTE_RATINGINFOMATION); echo "\n\t\t<fieldset><legend style='font-weight: bold; color: #900;'>" . _AM_NEWBB_VOTE_DISPLAYVOTES . "</legend>\n\n\t\t<div style='padding: 8px;'>\n\n\t\t<div><strong>" . _AM_NEWBB_VOTE_USERAVG . ": </strong>{$useravgrating}</div>\n\n\t\t<div><strong>" . _AM_NEWBB_VOTE_TOTALRATE . ": </strong>{$uservotes}</div>\n\n\t\t<div style='padding: 8px;'>\n\n\t\t<ul><li>" . newbb_displayImage($forumImage['delete'], _DELETE) . " " . _AM_NEWBB_VOTE_DELETEDSC . "</li></ul>\n\t\t<div>\n\n\t\t</fieldset>\n\n\t\t<br />\n\n\n\t\t<table width='100%' cellspacing='1' cellpadding='2' class='outer'>\n\n\t\t<tr>\n\n\t\t<th align='center'>" . _AM_NEWBB_VOTE_ID . "</th>\n\n\t\t<th align='center'>" . _AM_NEWBB_VOTE_USER . "</th>\n\n\t\t<th align='center'>" . _AM_NEWBB_VOTE_IP . "</th>\n\n\t\t<th align='center'>" . _AM_NEWBB_VOTE_FILETITLE . "</th>\n\n\t\t<th align='center'>" . _AM_NEWBB_VOTE_RATING . "</th>\n\n\t\t<th align='center'>" . _AM_NEWBB_VOTE_DATE . "</th>\n\n\t\t<th align='center'>" . _AM_NEWBB_ACTION . "</th></tr>\n"; if ($votes == 0) { echo "<tr><td align='center' colspan='7' class='head'>" . _AM_NEWBB_VOTE_NOVOTES . "</td></tr>"; } while (list($ratingid, $topic_id, $ratinguser, $rating, $ratinghostname, $ratingtimestamp) = $xoopsDB->fetchRow($results)) { $sql = "SELECT topic_title FROM " . $xoopsDB->prefix('bb_topics') . " WHERE topic_id=" . $topic_id . ""; $down_array = $xoopsDB->fetchArray($xoopsDB->query($sql)); $formatted_date = formatTimestamp($ratingtimestamp, _DATESTRING); $ratinguname = newbb_getUnameFromId($ratinguser, $xoopsModuleConfig['show_realname']); echo "\n\t\t<tr>\n\n\t\t<td class='head' align='center'>{$ratingid}</td>\n\n\t\t<td class='even' align='center'>{$ratinguname}</td>\n\n\t\t<td class='even' align='center' >{$ratinghostname}</td>\n\n\t\t<td class='even' align='center'>" . $myts->htmlSpecialChars($down_array['topic_title']) . "</td>\n\n\t\t<td class='even' align='center'>{$rating}</td>\n\n\t\t<td class='even' align='center'>{$formatted_date}</td>\n\n\t\t<td class='even' align='center'><strong><a href='admin_votedata.php?op=delvotes&topic_id={$topic_id}&rid={$ratingid}'>" . newbb_displayImage($forumImage['delete'], _DELETE) . "</a></strong></td>\n\n\t\t</tr>\n"; } echo "</table>"; //Include page navigation include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; $page = $votes > 20 ? _AM_NEWBB_MINDEX_PAGE : ''; $pagenav = new XoopsPageNav($page, 20, $start, 'start'); echo '<div align="right" style="padding: 8px;">' . $page . '' . $pagenav->renderImageNav(4) . '</div>'; break; } xoops_cp_footer();
$topic_renderer->buildFilters($xoopsTpl); $topic_renderer->buildTypes($xoopsTpl); $topic_renderer->buildCurrent($xoopsTpl); $topic_renderer->renderTopics($xoopsTpl); $topic_renderer->buildSearch($xoopsTpl); $topic_renderer->buildPagenav($xoopsTpl); $topic_renderer->buildSelection($xoopsTpl); $xoopsTpl->assign('rating_enable', $xoopsModuleConfig['rating_enabled']); $xoopsTpl->assign('img_newposts', newbb_displayImage('topic_new')); $xoopsTpl->assign('img_hotnewposts', newbb_displayImage('topic_hot_new')); $xoopsTpl->assign('img_folder', newbb_displayImage('topic')); $xoopsTpl->assign('img_hotfolder', newbb_displayImage('topic_hot')); $xoopsTpl->assign('img_locked', newbb_displayImage('topic_locked')); $xoopsTpl->assign('img_sticky', newbb_displayImage('topic_sticky', _MD_TOPICSTICKY)); $xoopsTpl->assign('img_digest', newbb_displayImage('topic_digest', _MD_TOPICDIGEST)); $xoopsTpl->assign('img_poll', newbb_displayImage('poll', _MD_TOPICHASPOLL)); $xoopsTpl->assign('post_link', "viewpost.php"); $xoopsTpl->assign('newpost_link', "viewpost.php?status=new"); if (!empty($xoopsModuleConfig['show_jump'])) { mod_loadFunctions("forum", "newbb"); $xoopsTpl->assign('forum_jumpbox', newbb_make_jumpbox()); } $xoopsTpl->assign('menumode', $menumode); $xoopsTpl->assign('menumode_other', $menumode_other); $xoopsTpl->assign('mode', $mode); $xoopsTpl->assign('status', $status); $xoopsTpl->assign('viewer_level', $isadmin ? 2 : is_object($xoopsUser)); $pagetitle = sprintf(_MD_FORUMINDEX, htmlspecialchars($xoopsConfig['sitename'], ENT_QUOTES)); $xoopsTpl->assign('forum_index_title', $pagetitle); $xoopsTpl->assign('xoops_pagetitle', $pagetitle); include XOOPS_ROOT_PATH . "/footer.php";
$cat_image = XOOPS_URL . "/modules/" . $xoopsModule->dirname() . "/images/category/" . $onecat->getVar('cat_image'); } else { $cat_image = ""; } $category_array[] = array('cat_order' => $onecat->getVar('cat_order'), 'cat_id' => $onecat->getVar('cat_id'), 'cat_title' => $onecat->getVar('cat_title'), 'cat_image' => $cat_image, 'cat_sponsor' => $cat_sponsor, 'cat_description' => $myts->displayTarea($cat_description, 1), 'cat_display' => $display, 'cat_display_icon' => $display_icon, 'forums' => $forums); $cat_order[] = $onecat->getVar('cat_order'); } array_multisort($category_array, $cat_order); $xoopsTpl->assign("categories", $category_array); unset($category_array); $xoopsTpl->assign("subforum_display", $xoopsModuleConfig['subforum_display']); $xoopsTpl->assign('mark_read', "index.php?mark_read=1"); $xoopsTpl->assign('mark_unread', "index.php?mark_read=2"); $xoopsTpl->assign('all_link', "viewall.php"); $xoopsTpl->assign('post_link', "viewpost.php"); $xoopsTpl->assign('newpost_link', "viewpost.php?new=1"); $xoopsTpl->assign('digest_link', "viewall.php?type=digest"); $xoopsTpl->assign('unreplied_link', "viewall.php?type=unreplied"); $xoopsTpl->assign('unread_link', "viewall.php?type=unread"); $xoopsTpl->assign('down', newbb_displayImage($forumImage['doubledown'])); $xoopsTpl->assign('menumode', $menumode); $xoopsTpl->assign('menumode_other', $menumode_other); if (is_object($xoopsUser) && $xoopsUser->isAdmin($xoopsModule->mid())) { $xoopsTpl->assign('forum_index_cpanel', array("link" => "admin/index.php", "name" => _MD_ADMINCP)); } if ($xoopsModuleConfig['rss_enable'] == 1) { $xoopsTpl->assign("rss_enable", 1); $xoopsTpl->assign("rss_button", "<div align='right'><a href='" . XOOPS_URL . "/modules/" . $xoopsModule->dirname() . "/rss.php?c=" . $viewcat . "' title='RSS feed' target='_blank'>" . newbb_displayImage($forumImage['rss']) . "</a></div>"); } $xoopsTpl->assign(array("img_hotfolder" => newbb_displayImage($forumImage['newposts_forum']), "img_folder" => newbb_displayImage($forumImage['folder_forum']), "img_locked_nonewposts" => newbb_displayImage($forumImage['locked_forum']), "img_locked_newposts" => newbb_displayImage($forumImage['locked_forum_newposts']), 'img_subforum' => newbb_displayImage($forumImage['subforum']))); include_once XOOPS_ROOT_PATH . '/footer.php';
$echo .= "<td align='center'>" . $f_edit_link . "</td>"; $echo .= "<td align='center'>" . $f_del_link . "</td>"; $echo .= "<td align='center'>" . $sf_add_link . "</td>"; $echo .= "<td align='center'>" . $f_move_link . "</td>"; $echo .= "<td align='center'>" . $f_merge_link . "</td>"; $echo .= "</tr>"; if (!isset($forums[$c][$f]["sub"])) { continue; } foreach (array_keys($forums[$c][$f]["sub"]) as $s) { $f_link = " <a href=\"" . $forumUrl['root'] . "/viewforum.php?forum=" . $s . "\">-->" . $forums[$c][$f]["sub"][$s]["title"] . "</a>"; $f_edit_link = "<a href=\"admin_forum_manager.php?op=mod&forum=" . $s . "\">" . newbb_displayImage($forumImage['edit']) . "</a>"; $f_del_link = "<a href=\"admin_forum_manager.php?op=del&forum=" . $s . "\">" . newbb_displayImage($forumImage['delete']) . "</a>"; $sf_add_link = ""; $f_move_link = "<a href=\"admin_forum_manager.php?op=moveforum&forum=" . $s . "\">" . newbb_displayImage($forumImage['move_topic']) . "</a>"; $f_merge_link = "<a href=\"admin_forum_manager.php?op=mergeforum&forum=" . $s . "\">" . newbb_displayImage($forumImage['move_topic']) . "</a>"; $echo .= "<tr class='odd' align='left'><td></td>"; $echo .= "<td><strong>" . $f_link . "</strong></td>"; $echo .= "<td align='center'>" . $f_edit_link . "</td>"; $echo .= "<td align='center'>" . $f_del_link . "</td>"; $echo .= "<td align='center'>" . $sf_add_link . "</td>"; $echo .= "<td align='center'>" . $f_move_link . "</td>"; $echo .= "<td align='center'>" . $f_merge_link . "</td>"; $echo .= "</tr>"; } } } unset($forums, $categories); echo $echo; echo "</table>"; echo "</fieldset>";
/** * Deprecated */ function &show_online() { require_once XOOPS_ROOT_PATH . "/modules/newbb/include/functions.render.php"; require_once XOOPS_ROOT_PATH . "/modules/newbb/include/functions.user.php"; if ($this->topic_id) { $criteria = new Criteria('online_topic', $this->topic_id); } elseif ($this->forum_id) { $criteria = new Criteria('online_forum', $this->forum_id); } else { $criteria = null; } $users =& $this->getAll($criteria); $num_total = count($users); $num_user = 0; $users_id = array(); $users_online = array(); for ($i = 0; $i < $num_total; $i++) { if (empty($users[$i]['online_uid'])) { continue; } $users_id[] = $users[$i]['online_uid']; $users_online[$users[$i]['online_uid']] = array("link" => XOOPS_URL . "/userinfo.php?uid=" . $users[$i]['online_uid'], "uname" => $users[$i]['online_uname']); $num_user++; } $num_anonymous = $num_total - $num_user; $online = array(); $online['image'] = newbb_displayImage('whosonline'); $online['num_total'] = $num_total; $online['num_user'] = $num_user; $online['num_anonymous'] = $num_anonymous; $administrator_list = newbb_isModuleAdministrators($users_id); if ($member_list = array_diff(array_keys($administrator_list), $users_id)) { if (is_object($this->forum_object)) { $moderator_list = $this->forum_object->getVar("forum_moderator"); } else { $moderator_list = newbb_isForumModerators($member_list); } } foreach ($users_online as $uid => $user) { if (!empty($administrator_list[$uid])) { $user['level'] = 2; } elseif (!empty($moderator_list[$uid])) { $user['level'] = 1; } else { $user['level'] = 0; } $online["users"][] = $user; } return $online; }
echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _AM_NEWBB_CREATENEWCATEGORY . "</legend>"; echo "<br />"; newCategory(); echo "</fieldset>"; break; } loadModuleAdminMenu(1, _AM_NEWBB_CATADMIN); echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _AM_NEWBB_CATADMIN . "</legend>"; echo "<br />"; echo "<a style='border: 1px solid #5E5D63; color: #000000; font-family: verdana, tahoma, arial, helvetica, sans-serif; font-size: 1em; padding: 4px 8px; text-align:center;' href='admin_cat_manager.php?op=mod'>" . _AM_NEWBB_CREATENEWCATEGORY . "</a><br /><br />"; echo "<table border='0' cellpadding='4' cellspacing='1' width='100%' class='outer'>"; echo "<tr align='center'>"; echo "<td class='bg3'>" . _AM_NEWBB_CATEGORY1 . "</td>"; echo "<td class='bg3' width='10%'>" . _AM_NEWBB_EDIT . "</td>"; echo "<td class='bg3' width='10%'>" . _AM_NEWBB_DELETE . "</td>"; echo "</tr>"; foreach ($categories as $key => $onecat) { $cat_edit_link = "<a href=\"admin_cat_manager.php?op=mod&cat_id=" . $onecat->getVar('cat_id') . "\">" . newbb_displayImage('admin_edit', _EDIT) . "</a>"; $cat_del_link = "<a href=\"admin_cat_manager.php?op=del&cat_id=" . $onecat->getVar('cat_id') . "\">" . newbb_displayImage('admin_delete', _DELETE) . "</a>"; $cat_title_link = "<a href=\"" . XOOPS_URL . "/modules/" . $xoopsModule->getVar("dirname") . "/index.php?cat=" . $onecat->getVar('cat_id') . "\">" . $onecat->getVar('cat_title') . "</a>"; echo "<tr class='odd' align='left'>"; echo "<td>" . $cat_title_link . "</td>"; echo "<td align='center'>" . $cat_edit_link . "</td>"; echo "<td align='center'>" . $cat_del_link . "</td>"; echo "</tr>"; } echo "</table>"; echo "</fieldset>"; break; } xoops_cp_footer();
$uservotes = $xoopsDB->getRowsNum($result2); $useravgrating = 0; while (list($rating2) = $xoopsDB->fetchRow($result2)) { $useravgrating = $useravgrating + $rating2; } if ($useravgrating > 0) { $useravgrating = $useravgrating / $uservotes; $useravgrating = number_format($useravgrating, 2); } xoops_cp_header(); loadModuleAdminMenu(10, _AM_NEWBB_VOTE_RATINGINFOMATION); echo "\r\n <fieldset><legend style='font-weight: bold; color: #900;'>" . _AM_NEWBB_VOTE_DISPLAYVOTES . "</legend>\n\r\n <div style='padding: 8px;'>\n\r\n <div><strong>" . _AM_NEWBB_VOTE_USERAVG . ": </strong>{$useravgrating}</div>\n\r\n <div><strong>" . _AM_NEWBB_VOTE_TOTALRATE . ": </strong>{$uservotes}</div>\n\r\n <div style='padding: 8px;'>\n\r\n <ul><li>" . newbb_displayImage('admin_delete', _DELETE) . " " . _AM_NEWBB_VOTE_DELETEDSC . "</li></ul>\r\n <div>\n\r\n </fieldset>\n\r\n <br />\n\r\n\r\n <table width='100%' cellspacing='1' cellpadding='2' class='outer'>\n\r\n <tr>\n\r\n <th align='center'>" . _AM_NEWBB_VOTE_ID . "</th>\n\r\n <th align='center'>" . _AM_NEWBB_VOTE_USER . "</th>\n\r\n <th align='center'>" . _AM_NEWBB_VOTE_IP . "</th>\n\r\n <th align='center'>" . _AM_NEWBB_VOTE_FILETITLE . "</th>\n\r\n <th align='center'>" . _AM_NEWBB_VOTE_RATING . "</th>\n\r\n <th align='center'>" . _AM_NEWBB_VOTE_DATE . "</th>\n\r\n <th align='center'>" . _AM_NEWBB_ACTION . "</th></tr>\n"; if ($votes == 0) { echo "<tr><td align='center' colspan='7' class='head'>" . _AM_NEWBB_VOTE_NOVOTES . "</td></tr>"; } while (list($ratingid, $topic_id, $ratinguser, $rating, $ratinghostname, $ratingtimestamp) = $xoopsDB->fetchRow($results)) { $sql = "SELECT topic_title FROM " . $xoopsDB->prefix('bb_topics') . " WHERE topic_id=" . $topic_id . ""; $down_array = $xoopsDB->fetchArray($xoopsDB->query($sql)); $formatted_date = formatTimestamp($ratingtimestamp, _DATESTRING); $ratinguname = newbb_getUnameFromId($ratinguser, $xoopsModuleConfig['show_realname']); echo "\r\n <tr>\n\r\n <td class='head' align='center'>{$ratingid}</td>\n\r\n <td class='even' align='center'>{$ratinguname}</td>\n\r\n <td class='even' align='center'>{$ratinghostname}</td>\n\r\n <td class='even' align='left'><a href='" . XOOPS_URL . "/modules/newbb/viewtopic.php?topic_id={$topic_id}' rel='external'>" . $myts->htmlSpecialChars($down_array['topic_title']) . "</a></td>\n\r\n <td class='even' align='center'>{$rating}</td>\n\r\n <td class='even' align='center'>{$formatted_date}</td>\n\r\n <td class='even' align='center'><strong><a href='admin_votedata.php?op=delvotes&topic_id={$topic_id}&rid={$ratingid}'>" . newbb_displayImage('admin_delete', _DELETE) . "</a></strong></td>\n\r\n </tr>\n"; } echo "</table>"; //Include page navigation include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; $page = $votes > 20 ? _AM_NEWBB_MINDEX_PAGE : ''; $pagenav = new XoopsPageNav($page, 20, $start, 'start'); echo '<div align="right" style="padding: 8px;">' . $page . '' . $pagenav->renderImageNav(4) . '</div>'; break; } xoops_cp_footer();
$forum_form->addElement(new XoopsFormHidden('forum', $forum_id)); $forum_form->addElement(new XoopsFormHidden('viewmode', $viewmode)); $forum_form->addElement(new XoopsFormHidden('order', $order)); $forum_form->addElement(new XoopsFormHidden('start', $start)); // backward compatible if (!class_exists("XoopsSecurity")) { $post_valid = 1; $_SESSION['submit_token'] = $post_valid; $forum_form->addElement(new XoopsFormHidden('post_valid', $post_valid)); } $forum_form->addElement(new XoopsFormHidden('notify', -1)); $forum_form->addElement(new XoopsFormHidden('contents_submit', 1)); $submit_button = new XoopsFormButton('', 'quick_submit', _SUBMIT, "submit"); $submit_button->setExtra('onclick="if (document.forms.quick_reply.message.value == \'RE\' || document.forms.quick_reply.message.value == \'\') { alert(\'' . _MD_QUICKREPLY_EMPTY . '\'); return false;} else { return true;}"'); $button_tray = new XoopsFormElementTray(''); $button_tray->addElement($submit_button); $forum_form->addElement($button_tray); $toggles = newbb_getcookie('G', true); $display = in_array('qr', $toggles) ? 'none;' : 'block;'; $xoopsTpl->assign('quickreply', array('show' => 1, 'display' => $display, 'icon' => newbb_displayImage($forumImage['t_qr']), 'form' => $forum_form->render())); unset($forum_form); } else { $xoopsTpl->assign('quickreply', array('show' => 0)); } if ($xoopsModuleConfig["do_tag"] && @(include_once XOOPS_ROOT_PATH . "/modules/tag/include/tagbar.php")) { $xoopsTpl->assign('tagbar', tagBar($topic_obj->getVar("topic_tags", "n"))); } if ($transferbar = (include XOOPS_ROOT_PATH . "/Frameworks/transfer/bar.transfer.php")) { $xoopsTpl->assign('transfer', $transferbar); } include XOOPS_ROOT_PATH . '/footer.php';
/* display forum stats */ $stats_handler =& xoops_getmodulehandler('stats'); $stats = $stats_handler->getStats(array_merge(array(0), $forums_available)); $xoopsTpl->assign_by_ref("stats", $stats); $xoopsTpl->assign("subforum_display", $xoopsModuleConfig['subforum_display']); $xoopsTpl->assign('mark_read', "index.php?mark_read=1"); $xoopsTpl->assign('mark_unread', "index.php?mark_read=2"); $xoopsTpl->assign('all_link', "list.topic.php?status=all"); $xoopsTpl->assign('post_link', "viewpost.php?status=all"); $xoopsTpl->assign('newpost_link', "viewpost.php?status=new"); $xoopsTpl->assign('digest_link', "viewall.php?status=digest"); $xoopsTpl->assign('unreplied_link', "viewall.php?status=unreplied"); $xoopsTpl->assign('unread_link', "viewall.php?status=unread"); $xoopsTpl->assign('menumode', $menumode); $xoopsTpl->assign('menumode_other', $menumode_other); $isadmin = $GLOBALS["xoopsUserIsAdmin"]; $xoopsTpl->assign('viewer_level', $isadmin ? 2 : is_object($xoopsUser)); $mode = !empty($_GET['mode']) ? intval($_GET['mode']) : 0; $xoopsTpl->assign('mode', $mode); $xoopsTpl->assign('viewcat', $viewcat); $xoopsTpl->assign('version', $xoopsModule->getVar("version")); /* To be removed */ if ($isadmin) { $xoopsTpl->assign('forum_index_cpanel', array("link" => "admin/index.php", "name" => _MD_ADMINCP)); } if ($xoopsModuleConfig['rss_enable'] == 1) { $xoopsTpl->assign("rss_enable", 1); $xoopsTpl->assign("rss_button", newbb_displayImage('rss', 'RSS feed')); } $xoopsTpl->assign(array("img_forum_new" => newbb_displayImage('forum_new', _MD_NEWPOSTS), "img_forum" => newbb_displayImage('forum', _MD_NONEWPOSTS), 'img_subforum' => newbb_displayImage('subforum'))); include_once XOOPS_ROOT_PATH . '/footer.php';
function &show_online() { global $xoopsModuleConfig, $forumImage; if ($this->forumtopic) { $num_total = $this->getCount(new Criteria('online_topic', $this->forumtopic)); } elseif ($this->forum) { $num_total = $this->getCount(new Criteria('online_forum', $this->forum)); } else { $num_total = $this->getCount(); } if ($this->forumtopic) { $criteria = new CriteriaCompo(new Criteria('online_topic', $this->forumtopic)); $criteria->add(new Criteria('online_uid', '0', '<>')); } elseif ($this->forum) { $criteria = new CriteriaCompo(new Criteria('online_forum', $this->forum)); $criteria->add(new Criteria('online_uid', '0', '<>')); } else { $criteria = new Criteria('online_uid', '0', '<>'); } $users =& $this->getAll($criteria); $num_user = count($users); $num_anonymous = $num_total - $num_user; $online = array(); $online['image'] = newbb_displayImage($forumImage['whosonline']); $online['num_total'] = $num_total; $online['num_user'] = $num_user; $online['num_anonymous'] = $num_anonymous; for ($i = 0; $i < $num_user; $i++) { $online['users'][$i]['link'] = XOOPS_URL . "/userinfo.php?uid=" . $users[$i]['online_uid']; $online['users'][$i]['uname'] = $users[$i]['online_uname']; if (newbb_isAdministrator($users[$i]['online_uid'])) { $online['users'][$i]['color'] = $xoopsModuleConfig['wol_admin_col']; } elseif (newbb_isModerator($this->forum_object, $users[$i]['online_uid'])) { $online['users'][$i]['color'] = $xoopsModuleConfig['wol_mod_col']; } else { $online['users'][$i]['color'] = ""; } } return $online; }
$xoopsTpl->assign('img_folder', newbb_displayImage($forumImage['folder_topic'])); $xoopsTpl->assign('img_hotfolder', newbb_displayImage($forumImage['hot_folder_topic'])); $xoopsTpl->assign('img_locked', newbb_displayImage($forumImage['locked_topic'])); $xoopsTpl->assign('img_sticky', newbb_displayImage($forumImage['folder_sticky'], _MD_TOPICSTICKY)); $xoopsTpl->assign('img_digest', newbb_displayImage($forumImage['folder_digest'], _MD_TOPICDIGEST)); $xoopsTpl->assign('img_poll', newbb_displayImage($forumImage['poll'], _MD_TOPICHASPOLL)); $xoopsTpl->assign('all_link', $all_link); $xoopsTpl->assign('post_link', $post_link); $xoopsTpl->assign('newpost_link', $newpost_link); $xoopsTpl->assign('digest_link', $digest_link); $xoopsTpl->assign('unreplied_link', $unreplied_link); $xoopsTpl->assign('unread_link', $unread_link); $xoopsTpl->assign('current_type', $current_type); $xoopsTpl->assign('current_link', $current_link); //newbb_message($post_link); $all_topics = $forum_handler->getTopicCount(0, $startdate, $type); if ($all_topics > $xoopsModuleConfig['topics_per_page']) { include XOOPS_ROOT_PATH . '/class/pagenav.php'; $nav = new XoopsPageNav($all_topics, $xoopsModuleConfig['topics_per_page'], $start, "start", 'sortname=' . $sortname . '&sortorder=' . $sortorder . '&since=' . $since . "&type={$type}"); $xoopsTpl->assign('forum_pagenav', $nav->renderNav(4)); } else { $xoopsTpl->assign('forum_pagenav', ''); } if (!empty($xoopsModuleConfig['show_jump'])) { $xoopsTpl->assign('forum_jumpbox', newbb_make_jumpbox(0)); } $xoopsTpl->assign('down', newbb_displayImage($forumImage['doubledown'])); $xoopsTpl->assign('menumode', $menumode); $xoopsTpl->assign('menumode_other', $menumode_other); $xoopsTpl->assign('xoops_pagetitle', $xoopsModule->getVar('name') . ' - ' . $current_type); include XOOPS_ROOT_PATH . "/footer.php";
$echo .= "<td align='center'>" . $forum_add_link . "</td>"; $echo .= "<td></td>"; $echo .= "<td></td>"; $echo .= "</tr>"; if (!isset($forums[$c])) { continue; } $i = 0; foreach (array_keys($forums[$c]) as $f) { $forum = $forums[$c][$f]; $f_link = $forum["prefix"] . "<a href=\"" . XOOPS_URL . '/modules/' . $xoopsModule->getVar("dirname", "n") . "/viewforum.php?forum=" . $f . "\">" . $forum["forum_name"] . "</a>"; $f_edit_link = "<a href=\"admin_forum_manager.php?op=mod&forum=" . $f . "\">" . newbb_displayImage('admin_edit', _AM_NEWBB_EDIT) . "</a>"; $f_del_link = "<a href=\"admin_forum_manager.php?op=del&forum=" . $f . "\">" . newbb_displayImage('admin_delete', _AM_NEWBB_DELETE) . "</a>"; $sf_add_link = "<a href=\"admin_forum_manager.php?op=addforum&cat_id=" . $c . "&forum=" . $f . "\">" . newbb_displayImage('new_forum', _AM_NEWBB_CREATEFORUM) . "</a>"; $f_move_link = "<a href=\"admin_forum_manager.php?op=moveforum&forum=" . $f . "\">" . newbb_displayImage('admin_move', _AM_NEWBB_MOVE) . "</a>"; $f_merge_link = "<a href=\"admin_forum_manager.php?op=mergeforum&forum=" . $f . "\">" . newbb_displayImage('admin_merge', _AM_NEWBB_MERGE) . "</a>"; $class = ++$i % 2 ? "odd" : "even"; $echo .= "<tr class='" . $class . "' align='left'><td></td>"; $echo .= "<td><strong>" . $f_link . "</strong></td>"; $echo .= "<td align='center'>" . $f_edit_link . "</td>"; $echo .= "<td align='center'>" . $f_del_link . "</td>"; $echo .= "<td align='center'>" . $sf_add_link . "</td>"; $echo .= "<td align='center'>" . $f_move_link . "</td>"; $echo .= "<td align='center'>" . $f_merge_link . "</td>"; $echo .= "</tr>"; } } unset($forums, $categories); echo $echo; echo "</table>"; echo "</fieldset>";
function renderTopics($xoopsTpl = null) { global $myts; $ret = array(); //$this->parseVars(); if ($this->noperm) { if (is_object($xoopsTpl)) { $xoopsTpl->assign_by_ref("topics", $ret); return; } return $ret; } $selects = array(); $froms = array(); $joins = array(); $wheres = array(); // topic fields $selects[] = 't.*'; // post fields $selects[] = 'p.post_time as last_post_time, p.poster_name as last_poster_name, p.icon, p.post_id, p.uid'; $froms[] = $this->handler->db->prefix("bb_topics") . ' AS t '; $joins[] = 'LEFT JOIN ' . $this->handler->db->prefix('bb_posts') . ' AS p ON p.post_id = t.topic_last_post_id'; $wheres[] = "1 = 1"; if (!empty($this->config['post_excerpt'])) { $selects[] = 'p.post_karma, p.require_reply, pt.post_text'; $this->query["join"][] = 'LEFT JOIN ' . $this->handler->db->prefix('bb_posts_text') . ' AS pt ON pt.post_id = t.topic_last_post_id'; } if (empty($this->query["sort"])) { $this->query["sort"][] = 't.topic_last_post_id DESC'; } $GLOBALS['xoopsLogger']->startTime('XOOPS output module - render - topics - query'); $sql = ' SELECT ' . implode(", ", $selects) . ' FROM ' . implode(", ", $froms) . ' ' . implode(" ", $joins) . ' ' . implode(" ", $this->query["join"]) . ' WHERE ' . implode(" AND ", $wheres) . ' AND ' . @implode(" AND ", @$this->query["where"]) . ' ORDER BY ' . implode(", ", $this->query["sort"]); if (!($result = $this->handler->db->query($sql, $this->config['topics_per_page'], @$this->vars["start"]))) { if (is_object($xoopsTpl)) { $xoopsTpl->assign_by_ref("topics", $ret); return; } return $ret; } $GLOBALS['xoopsLogger']->stopTime('XOOPS output module - render - topics - query'); require_once XOOPS_ROOT_PATH . "/modules/newbb/include/functions.render.php"; require_once XOOPS_ROOT_PATH . "/modules/newbb/include/functions.session.php"; require_once XOOPS_ROOT_PATH . "/modules/newbb/include/functions.time.php"; require_once XOOPS_ROOT_PATH . "/modules/newbb/include/functions.read.php"; require_once XOOPS_ROOT_PATH . "/modules/newbb/include/functions.topic.php"; $sticky = 0; $topics = array(); $posters = array(); $reads = array(); $types = array(); $forums = array(); $anonymous = $myts->htmlSpecialChars($GLOBALS["xoopsConfig"]['anonymous']); $GLOBALS['xoopsLogger']->startTime('XOOPS output module - render - topics - fetch'); while ($myrow = $this->handler->db->fetchArray($result)) { if ($myrow['topic_sticky']) { $sticky++; } // ------------------------------------------------------ // topic_icon: priority: sticky -> digest -> regular if ($myrow['topic_haspoll']) { if ($myrow['topic_sticky']) { $topic_icon = newbb_displayImage("topic_sticky", _MD_TOPICSTICKY) . '<br />' . newbb_displayImage("poll", _MD_TOPICHASPOLL); } else { $topic_icon = newbb_displayImage('poll', _MD_TOPICHASPOLL); } } elseif ($myrow['topic_sticky']) { $topic_icon = newbb_displayImage('topic_sticky', _MD_TOPICSTICKY); } elseif (!empty($myrow['icon'])) { $topic_icon = '<img src="' . XOOPS_URL . '/images/subject/' . htmlspecialchars($myrow['icon']) . '" alt="" />'; } else { $topic_icon = '<img src="' . XOOPS_URL . '/images/icons/no_posticon.gif" alt="" />'; } // ------------------------------------------------------ // rating_img $rating = number_format($myrow['rating'] / 2, 0); $rating_img = newbb_displayImage($rating < 1 ? 'blank' : 'rate' . $rating); // ------------------------------------------------------ // topic_page_jump $topic_page_jump = ''; $topic_page_jump_icon = ''; $totalpages = ceil(($myrow['topic_replies'] + 1) / $this->config['posts_per_page']); if ($totalpages > 1) { $topic_page_jump .= ' '; $append = false; for ($i = 1; $i <= $totalpages; $i++) { if ($i > 3 && $i < $totalpages) { if (!$append) { $topic_page_jump .= "..."; $append = true; } } else { $topic_page_jump .= '[<a href="viewtopic.php?topic_id=' . $myrow['topic_id'] . '&start=' . ($i - 1) * $this->config['posts_per_page'] . '">' . $i . '</a>]'; $topic_page_jump_icon = "<a href='" . XOOPS_URL . "/modules/newbb/viewtopic.php?topic_id=" . $myrow['topic_id'] . "&start=" . ($i - 1) * $this->config['posts_per_page'] . "#forumpost" . $myrow['post_id'] . "'>" . newbb_displayImage('document') . "</a>"; } } } else { $topic_page_jump_icon = "<a href='" . XOOPS_URL . "/modules/newbb/viewtopic.php?topic_id=" . $myrow['topic_id'] . "#forumpost" . $myrow['post_id'] . "'>" . newbb_displayImage('document') . "</a>"; } // ------------------------------------------------------ // => topic array $topic_title = $myts->htmlSpecialChars($myrow['topic_title']); if ($myrow['topic_digest']) { $topic_title = "<span class='digest'>" . $topic_title . "</span>"; } if (empty($this->config["post_excerpt"])) { $topic_excerpt = ""; } elseif (($myrow['post_karma'] > 0 || $myrow['require_reply'] > 0) && !newbb_isAdmin($myrow['forum_id'])) { $topic_excerpt = ""; } else { $GLOBALS['xoopsLogger']->startTime('XOOPS output module - render - topics - fetch - substr ' . $myrow['topic_id']); $topic_excerpt = xoops_substr(newbb_html2text($myts->displayTarea($myrow['post_text'])), 0, $this->config["post_excerpt"]); $GLOBALS['xoopsLogger']->stopTime('XOOPS output module - render - topics - fetch - substr ' . $myrow['topic_id']); $topic_excerpt = str_replace("[", "[", $myts->htmlSpecialChars($topic_excerpt)); } $topics[$myrow['topic_id']] = array('topic_id' => $myrow['topic_id'], 'topic_icon' => $topic_icon, 'type_id' => $myrow['type_id'], 'topic_title' => $topic_title, 'topic_link' => 'viewtopic.php?topic_id=' . $myrow['topic_id'] . '&forum=' . $myrow['forum_id'], 'rating_img' => $rating_img, 'topic_page_jump' => $topic_page_jump, 'topic_page_jump_icon' => $topic_page_jump_icon, 'topic_replies' => $myrow['topic_replies'], 'topic_poster_uid' => $myrow['topic_poster'], 'topic_poster_name' => !empty($myrow['poster_name']) ? $myts->htmlSpecialChars($myrow['poster_name']) : $anonymous, 'topic_views' => $myrow['topic_views'], 'topic_time' => newbb_formatTimestamp($myrow['topic_time']), 'topic_last_posttime' => newbb_formatTimestamp($myrow['last_post_time']), 'topic_last_poster_uid' => $myrow['uid'], 'topic_last_poster_name' => !empty($myrow['last_poster_name']) ? $myts->htmlSpecialChars($myrow['last_poster_name']) : $anonymous, 'topic_forum' => $myrow['forum_id'], 'topic_excerpt' => $topic_excerpt, 'stick' => empty($myrow['topic_sticky']), "stats" => array($myrow['topic_status'], $myrow['topic_digest'], $myrow['topic_replies'])); /* users */ $posters[$myrow['topic_poster']] = 1; $posters[$myrow['uid']] = 1; // reads if (!empty($this->config["read_mode"])) { $reads[$myrow['topic_id']] = $this->config["read_mode"] == 1 ? $myrow['last_post_time'] : $myrow["topic_last_post_id"]; } // types if (!empty($myrow['type_id'])) { //$types[$myrow['type_id']] = 1; } // forums $forums[$myrow['forum_id']] = 1; } $GLOBALS['xoopsLogger']->stopTime('XOOPS output module - render - topics - fetch'); $posters_name = newbb_getUnameFromIds(array_keys($posters), $this->config['show_realname'], true); $topic_isRead = newbb_isRead("topic", $reads); /* $type_list = array(); if (count($types) > 0) { $type_handler =& xoops_getmodulehandler('type', 'newbb'); $type_list = $type_handler->getAll(new Criteria("type_id", "(".implode(", ", array_keys($types)).")", "IN"), null, false); } */ $type_list = $this->getTypes(); $forum_handler =& xoops_getmodulehandler('forum', 'newbb'); $forum_list = $forum_handler->getAll(new Criteria("forum_id", "(" . implode(", ", array_keys($forums)) . ")", "IN"), array("forum_name", "hot_threshold"), false); foreach (array_keys($topics) as $id) { $topics[$id]["topic_forum_link"] = '<a href="' . XOOPS_URL . '/modules/newbb/viewforum.php?forum=' . $topics[$id]["topic_forum"] . '">' . $forum_list[$topics[$id]["topic_forum"]]["forum_name"] . '</a>'; if (!empty($topics[$id]["type_id"]) && isset($type_list[$topics[$id]["type_id"]])) { $topics[$id]["topic_title"] = newbb_getTopicTitle($topics[$id]["topic_title"], $type_list[$topics[$id]["type_id"]]["type_name"], $type_list[$topics[$id]["type_id"]]["type_color"]); } $topics[$id]["topic_poster"] = !empty($posters_name[$topics[$id]["topic_poster_uid"]]) ? $posters_name[$topics[$id]["topic_poster_uid"]] : $topics[$id]["topic_poster_name"]; $topics[$id]["topic_last_poster"] = !empty($posters_name[$topics[$id]["topic_last_poster_uid"]]) ? $posters_name[$topics[$id]["topic_last_poster_uid"]] : $topics[$id]["topic_last_poster_name"]; // ------------------------------------------------------ // topic_folder: priority: newhot -> hot/new -> regular list($topic_status, $topic_digest, $topic_replies) = $topics[$id]["stats"]; if ($topic_status == 1) { $topic_folder = 'topic_locked'; } else { if ($topic_digest) { $topic_folder = 'topic_digest'; } elseif ($topic_replies >= $forum_list[$topics[$id]["topic_forum"]]["hot_threshold"]) { $topic_folder = empty($topic_isRead[$id]) ? 'topic_hot_new' : 'topic_hot'; } else { $topic_folder = empty($topic_isRead[$id]) ? 'topic_new' : 'topic'; } } $topics[$id]['topic_folder'] = newbb_displayImage($topic_folder); unset($topics[$id]["topic_poster_name"], $topics[$id]["topic_last_poster_name"], $topics[$id]["stats"]); } if (count($topics) > 0) { $sql = " SELECT DISTINCT topic_id FROM " . $this->handler->db->prefix("bb_posts") . " WHERE attachment != ''" . " AND topic_id IN (" . implode(',', array_keys($topics)) . ")"; if ($result = $this->handler->db->query($sql)) { while (list($topic_id) = $this->handler->db->fetchRow($result)) { $topics[$topic_id]['attachment'] = ' ' . newbb_displayImage('attachment', _MD_TOPICSHASATT); } } } if (is_object($xoopsTpl)) { $xoopsTpl->assign_by_ref("sticky", $sticky); $xoopsTpl->assign_by_ref("topics", $topics); return; } return array($topics, $sticky); }
function loadUserOnline() { if (empty($this->users) || !$this->enableOnline) { return; } require_once XOOPS_ROOT_PATH . "/modules/newbb/include/functions.render.php"; $image_online = newbb_displayImage('online', _MD_ONLINE); $image_offline = newbb_displayImage('offline', _MD_OFFLINE); $online_handler =& xoops_getmodulehandler('online', 'newbb'); $onlines = $online_handler->checkStatus(array_keys($this->users)); foreach (array_keys($this->users) as $uid) { $this->userlist[$uid]["status"] = empty($onlines[$uid]) ? $image_offline : $image_online; } }
function getAllTopics($forum, $startdate, $start, $sortname, $sortorder, $type = '', $excerpt = 0) { global $xoopsModule, $xoopsConfig, $xoopsModuleConfig, $forumImage, $forumUrl, $myts, $xoopsUser, $viewall_forums; $UserUid = is_object($xoopsUser) ? $xoopsUser->getVar('uid') : null; $topic_lastread = newbb_getcookie('LT', true); if (is_object($forum)) { $forum_criteria = ' AND t.forum_id = ' . $forum->getVar('forum_id'); $hot_threshold = $forum->getVar('hot_threshold'); $allow_subject_prefix = $forum->getVar('allow_subject_prefix'); } else { $hot_threshold = 10; $allow_subject_prefix = 0; if (is_array($viewall_forums) && count($viewall_forums) > 0) { $forum_criteria = ' AND t.forum_id IN (' . implode(',', array_keys($viewall_forums)) . ')'; } else { $forum_criteria = ''; } } $sort_sticky = ''; switch ($type) { case 'digest': $post_time = ' p.post_time > ' . $startdate; $extra_criteria = ' AND topic_digest = 1'; break; case 'unreplied': $post_time = ' p.post_time > ' . $startdate; $extra_criteria = ' AND topic_replies < 1'; break; case 'unread': $post_time = ' p.post_time > ' . max($GLOBALS['last_visit'], $startdate); $extra_criteria = ''; break; case 'all': // For viewall.php; do not display sticky topics at first $post_time = ' p.post_time > ' . $startdate; $extra_criteria = ''; break; default: $post_time = ' (p.post_time > ' . $startdate . ' OR t.topic_sticky=1)'; $sort_sticky = ' t.topic_sticky DESC'; $extra_criteria = ''; break; } $sort = $sort_sticky; $sort_in = trim($sortname . ' ' . $sortorder); if ($sort) { if ($sort_in) { $sort .= ', ' . $sort_in; } } elseif ($sort_in) { $sort = $sort_in; } if (!empty($sort)) { $sort = ' ORDER BY ' . $sort; } $approve_criteria = ' AND t.approved = 1 AND p.approved = 1'; if ($excerpt == 0) { $sql = 'SELECT t.*, u.name, u.uname, u2.uid, u2.name as last_post_name, u2.uname as last_poster, p.post_time as last_post_time, p.poster_name as last_poster_name, p.icon, p.post_id FROM ' . $this->db->prefix("bb_topics") . ' t LEFT JOIN ' . $this->db->prefix("users") . ' u ON u.uid = t.topic_poster LEFT JOIN ' . $this->db->prefix('bb_posts') . ' p ON p.post_id = t.topic_last_post_id LEFT JOIN ' . $this->db->prefix("users") . ' u2 ON u2.uid = p.uid WHERE '; } else { $sql = 'SELECT t.*, u.name, u.uname, u2.uid, u2.name as last_post_name, u2.uname as last_poster, p.post_time as last_post_time, p.poster_name as last_poster_name, p.icon, p.post_id, p.post_karma, p.require_reply, pt.post_text FROM ' . $this->db->prefix("bb_topics") . ' t LEFT JOIN ' . $this->db->prefix("users") . ' u ON u.uid = t.topic_poster LEFT JOIN ' . $this->db->prefix('bb_posts') . ' p ON p.post_id = t.topic_last_post_id LEFT JOIN ' . $this->db->prefix('bb_posts_text') . ' pt ON pt.post_id = t.topic_last_post_id LEFT JOIN ' . $this->db->prefix("users") . ' u2 ON u2.uid = p.uid WHERE '; } $sql .= $post_time . $forum_criteria . $extra_criteria . $approve_criteria . $sort; if (!($result = $this->db->query($sql, $xoopsModuleConfig['topics_per_page'], $start))) { redirect_header('index.php', 2, _MD_ERROROCCURED . '<br />' . $sql); exit; } $sticky = 0; $topics = array(); while ($myrow = $this->db->fetchArray($result)) { // ------------------------------------------------------ /* Necessary and sufficient conditions for an unread topic: 1. the last_post_time must be later than the last_vist; 2. the last_post_time must be later than the topic_lastread; */ $is_unread = false; $lastread = empty($topic_lastread[$myrow['topic_id']]) ? 0 : $topic_lastread[$myrow['topic_id']]; if (max($GLOBALS['last_visit'], $lastread) < $myrow['last_post_time']) { $is_unread = true; } // ------------------------------------------------------ // ------------------------------------------------------ // topic_icon: priority: sticky -> digest -> regular // ------------------------------------------------------ // type: if 'unread' topics if ('unread' == $type) { if (!$is_unread) { continue; } } // ------------------------------------------------------ // topic_icon: priority: sticky -> digest -> regular if ($myrow['icon'] && is_file(XOOPS_ROOT_PATH . '/images/subject/' . $myrow['icon'])) { $topic_icon = '<img src="' . XOOPS_URL . '/images/subject/' . $myrow['icon'] . '" alt="" />'; $stick = 1; } else { $topic_icon = '<img src="' . XOOPS_URL . '/images/icons/no_posticon.gif" alt="" />'; $stick = 1; } if ($myrow['topic_sticky']) { $topic_icon = newbb_displayImage($forumImage['folder_sticky'], _MD_TOPICSTICKY); $stick = 0; $sticky++; } if ($myrow['topic_haspoll']) { $topic_icon = newbb_displayImage($forumImage['poll'], _MD_TOPICHASPOLL); } if ($myrow['topic_haspoll'] && $myrow['topic_sticky']) { $topic_icon = newbb_displayImage($forumImage['folder_sticky'], _MD_TOPICSTICKY) . '<br />' . newbb_displayImage($forumImage['poll'], _MD_TOPICHASPOLL); $stick = 0; //$sticky++; } // ------------------------------------------------------ // topic_folder: priority: newhot -> hot/new -> regular if ($myrow['topic_status'] == 1) { $topic_folder = $forumImage['locked_topic']; } else { if ($myrow['topic_digest']) { $topic_folder = $forumImage['folder_digest']; } elseif ($myrow['topic_replies'] >= $hot_threshold) { if ($is_unread) { $topic_folder = $forumImage['hot_newposts_topic']; } else { $topic_folder = $forumImage['hot_folder_topic']; } } else { if ($is_unread) { $topic_folder = $forumImage['newposts_topic']; } else { $topic_folder = $forumImage['folder_topic']; } } } // ------------------------------------------------------ // rating_img $rating = number_format($myrow['rating'] / 2, 0); if ($rating < 1) { $rating_img = newbb_displayImage($forumImage['blank']); } else { $rating_img = newbb_displayImage($forumImage['rate' . $rating]); } // ------------------------------------------------------ // topic_page_jump if ($myrow['icon']) { $last_post_icon = '<img src="' . XOOPS_URL . '/images/subject/' . $myrow['icon'] . '" alt="" />'; } else { $last_post_icon = '<img src="' . XOOPS_URL . '/images/subject/icon1.gif" alt="" />'; } $topic_page_jump = ''; $topic_page_jump_icon = ''; $totalpages = ceil(($myrow['topic_replies'] + 1) / $xoopsModuleConfig['posts_per_page']); if ($totalpages > 1) { $topic_page_jump .= ' <img src="' . XOOPS_URL . '/images/icons/posticon.gif" alt="" /> '; $append = false; for ($i = 1; $i <= $totalpages; $i++) { if ($i > 3 && $i < $totalpages) { if (!$append) { $topic_page_jump .= "..."; $append = true; } } else { $topic_page_jump .= '[<a href="viewtopic.php?topic_id=' . $myrow['topic_id'] . '&start=' . ($i - 1) * $xoopsModuleConfig['posts_per_page'] . '">' . $i . '</a>]'; $topic_page_jump_icon = "<a href='" . XOOPS_URL . "/modules/newbb/viewtopic.php?topic_id=" . $myrow['topic_id'] . "&start=" . ($i - 1) * $xoopsModuleConfig['posts_per_page'] . "#forumpost" . $myrow['post_id'] . "'>" . newbb_displayImage($forumImage['docicon']) . "</a>"; } } } else { $topic_page_jump_icon = "<a href='" . XOOPS_URL . "/modules/newbb/viewtopic.php?topic_id=" . $myrow['topic_id'] . "#forumpost" . $myrow['post_id'] . "'>" . newbb_displayImage($forumImage['docicon']) . "</a>"; } // ------------------------------------------------------ // topic_poster if ($myrow['topic_poster'] != 0 && $myrow['uname']) { if ($xoopsModuleConfig['show_realname'] && $myrow['name']) { $topic_poster = '<a href="' . XOOPS_URL . '/userinfo.php?uid=' . $myrow['topic_poster'] . '">' . $myts->htmlSpecialChars($myrow['name']) . '</a>'; } else { $topic_poster = '<a href="' . XOOPS_URL . '/userinfo.php?uid=' . $myrow['topic_poster'] . '">' . $myts->htmlSpecialChars($myrow['uname']) . '</a>'; } } else { $topic_poster = $myrow['poster_name'] ? $myts->htmlSpecialChars($myrow['poster_name']) : $xoopsConfig['anonymous']; } // ------------------------------------------------------ // topic_last_poster if ($xoopsModuleConfig['show_realname'] && $myrow['last_post_name']) { $topic_last_poster = $myts->htmlSpecialChars($myrow['last_post_name']); } elseif ($myrow['last_poster']) { $topic_last_poster = $myts->htmlSpecialChars($myrow['last_poster']); } elseif ($myrow['last_poster_name']) { $topic_last_poster = $myts->htmlSpecialChars($myrow['last_poster_name']); } else { $topic_last_poster = $xoopsConfig['anonymous']; } if ($myrow['uid'] > 0) { $topic_last_poster = '<a href="' . XOOPS_URL . '/userinfo.php?uid=' . $myrow['uid'] . '">' . $topic_last_poster . '</a>'; } // ------------------------------------------------------ // => topic array if (is_object($viewall_forums[$myrow['forum_id']])) { $forum_link = '<a href="' . XOOPS_URL . '/modules/newbb/viewforum.php?forum=' . $myrow['forum_id'] . '">' . $myts->htmlSpecialChars($viewall_forums[$myrow['forum_id']]->getVar('forum_name')) . '</a>'; } else { $forum_link = ''; } $topic_title = $myts->htmlSpecialChars($myrow['topic_title']); if ($myrow['topic_digest']) { $topic_title = "<span class='digest'>" . $topic_title . "</span>"; } $subjectpres = explode(',', $xoopsModuleConfig['subject_prefix']); if (count($subjectpres) > 1) { foreach ($subjectpres as $subjectpre) { $subject_array[] = $subjectpre; } } $subject_array[0] = null; if ($excerpt == 0) { $topic_excerpt = ""; } elseif (($myrow['post_karma'] > 0 || $myrow['require_reply'] > 0) && !newbb_isAdmin($forum)) { $topic_excerpt = ""; } else { $topic_excerpt = xoops_substr(newbb_html2text($myrow['post_text']), 0, $excerpt); $topic_excerpt = $myts->htmlSpecialChars($topic_excerpt); } $topic_subject = $allow_subject_prefix ? $subject_array[$myrow['topic_subject']] : ""; $topics[$myrow['topic_id']] = array('topic_icon' => $topic_icon, 'topic_folder' => newbb_displayImage($topic_folder), 'topic_title' => $topic_subject . $topic_title, 'topic_link' => 'viewtopic.php?topic_id=' . $myrow['topic_id'] . '&forum=' . $myrow['forum_id'], 'rating_img' => $rating_img, 'topic_page_jump' => $topic_page_jump, 'topic_page_jump_icon' => $topic_page_jump_icon, 'topic_replies' => $myrow['topic_replies'], 'topic_poster' => $topic_poster, 'topic_views' => $myrow['topic_views'], 'topic_time' => newbb_formatTimestamp($myrow['topic_time']), 'topic_last_posttime' => newbb_formatTimestamp($myrow['last_post_time']), 'topic_last_poster' => $topic_last_poster, 'topic_forum_link' => $forum_link, 'topic_excerpt' => $topic_excerpt, 'stick' => $stick); } if (is_array($topics) && count($topics) > 0) { $result2 = $this->db->query("SELECT attachment,topic_id FROM " . $this->db->prefix("bb_posts") . " WHERE topic_id IN (" . implode(',', array_keys($topics)) . ")"); if ($result2) { while ($arr2 = $this->db->fetchArray($result2)) { if ($arr2['attachment']) { $topics[$arr2['topic_id']]['attachment'] = ' ' . newbb_displayImage($forumImage['clip'], _MD_TOPICSHASATT); } unset($arr2); } } } return array($topics, $sticky); }
break; case 'new': $lang_title = _MD_NEWPOSTS; break; default: $lang_title = _MD_VIEWALLPOSTS; break; } if ($uid > 0) { $lang_title .= ' (' . XoopsUser::getUnameFromId($uid) . ')'; } $xoopsTpl->assign('lang_title', $lang_title); $xoopsTpl->assign('up', newbb_displayImage('up', _MD_TOP)); $xoopsTpl->assign('groupbar_enable', $xoopsModuleConfig['groupbar_enabled']); $xoopsTpl->assign('anonymous_prefix', $xoopsModuleConfig['anonymous_prefix']); $xoopsTpl->assign('down', newbb_displayImage('down', _MD_BOTTOM)); $all_link = "viewall.php?forum=" . $forum_id . "&start={$start}"; $post_link = "viewpost.php?forum=" . $forum_id; $newpost_link = "viewpost.php?forum=" . $forum_id . "&status=new"; $digest_link = "viewall.php?forum=" . $forum_id . "&start={$start}&status=digest"; $unreplied_link = "viewall.php?forum=" . $forum_id . "&start={$start}&status=unreplied"; $unread_link = "viewall.php?forum=" . $forum_id . "&start={$start}&status=unread"; $xoopsTpl->assign('all_link', $all_link); $xoopsTpl->assign('post_link', $post_link); $xoopsTpl->assign('newpost_link', $newpost_link); $xoopsTpl->assign('digest_link', $digest_link); $xoopsTpl->assign('unreplied_link', $unreplied_link); $xoopsTpl->assign('unread_link', $unread_link); $viewmode_options = array(); if ($viewmode == "compact") { $viewmode_options[] = array("link" => "viewpost.php?viewmode=flat&order=" . $order . "&forum=" . $forum_id, "title" => _FLAT);
$uid = 0; $forum = 0; $sortby = 'p.post_time DESC'; $subquery = ""; $searchin = "both"; $sort = ""; $since = isset($_POST['since']) ? $_POST['since'] : (isset($_GET['since']) ? $_GET['since'] : null); $next_search['since'] = $since; $term = isset($_POST['term']) ? $_POST['term'] : (isset($_GET['term']) ? $_GET['term'] : null); $uname = isset($_POST['uname']) ? $_POST['uname'] : (isset($_GET['uname']) ? $_GET['uname'] : null); if ($xoopsModuleConfig['wol_enabled']) { $online_handler =& xoops_getmodulehandler('online', 'newbb'); $online_handler->init(0); } $xoopsTpl->assign("forumindex", sprintf(_MD_FORUMINDEX, htmlspecialchars($xoopsConfig['sitename'], ENT_QUOTES))); $xoopsTpl->assign("img_folder", newbb_displayImage($forumImage['folder_topic'])); if (!empty($_POST['submit']) || !empty($_GET['submit']) || !empty($uname) || !empty($term)) { $start = isset($_GET['start']) ? $_GET['start'] : 0; $forum = isset($_POST['forum']) ? $_POST['forum'] : (isset($_GET['forum']) ? $_GET['forum'] : null); if (empty($forum) or $forum == 'all' or is_array($forum) and in_array('all', $forum)) { $forum = array(); } elseif (!is_array($forum)) { $forum = array_map("intval", explode(",", $forum)); } $next_search['forum'] = implode(",", $forum); $addterms = isset($_POST['andor']) ? $_POST['andor'] : (isset($_GET['andor']) ? $_GET['andor'] : ""); $next_search['andor'] = $addterms; if (!in_array(strtolower($addterms), array("or", "and", "exact"))) { $andor = "AND"; } else { $andor = strtoupper($addterms);
function &get($uid) { global $xoopsModuleConfig, $forumImage; if (!isset($this->users[$uid])) { return false; } if (class_exists("User_language")) { $user = new User_language($this->users[$uid]); } else { $user = new User($this->users[$uid]); } $userinfo =& $user->getInfo(); if ($xoopsModuleConfig['groupbar_enabled']) { foreach ($userinfo["groups_id"] as $id) { if (isset($this->groups[$id])) { $userinfo['groups'][] = $this->groups[$id]; } } } if ($xoopsModuleConfig['wol_enabled']) { $userinfo["status"] = isset($this->status[$uid]) ? newbb_displayImage($forumImage['online'], _MD_ONLINE) : newbb_displayImage($forumImage['offline'], _MD_OFFLINE); } return $userinfo; }
if ($all_topics > $xoopsModuleConfig['topics_per_page']) { include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; $query_nav = $query_array; unset($query_nav["start"]); $page_query_nav = implode("&", array_values($query_nav)); unset($query_nav); $nav = new XoopsPageNav($all_topics, $xoopsModuleConfig['topics_per_page'], $start, "start", $page_query_nav); $xoopsTpl->assign('forum_pagenav', $nav->renderNav(4)); } else { $xoopsTpl->assign('forum_pagenav', ''); } $xoopsLogger->stopTime('XOOPS output module - forum - count'); if (!empty($xoopsModuleConfig['show_jump'])) { require_once XOOPS_ROOT_PATH . "/modules/newbb/include/functions.forum.php"; $xoopsTpl->assign('forum_jumpbox', newbb_make_jumpbox($forum_id)); } $xoopsTpl->assign('menumode', $menumode); $xoopsTpl->assign('menumode_other', $menumode_other); $xoopsLogger->startTime('XOOPS output module - forum - permtable'); if ($xoopsModuleConfig['show_permissiontable']) { $perm_handler = xoops_getmodulehandler('permission', 'newbb'); $permission_table = $perm_handler->permission_table($forum_id, false, $isadmin); $xoopsTpl->assign_by_ref('permission_table', $permission_table); unset($permission_table); } $xoopsLogger->stopTime('XOOPS output module - forum - permtable'); if ($xoopsModuleConfig['rss_enable'] == 1) { $xoopsTpl->assign("rss_button", "<div align='right'><a href='" . XOOPS_URL . "/modules/" . $xoopsModule->getVar("dirname", "n") . "/rss.php?f={$forum_id}' title='RSS feed' rel='external'>" . newbb_displayImage('rss', 'RSS feed') . "</a></div>"); } $xoopsLogger->stopTime('XOOPS output module - forum'); include XOOPS_ROOT_PATH . "/footer.php";