/** * Create full title of the topic * * the title is composed of [type_name] if type_id is greater than 0 plus topic_title * */ function getFullTitle() { $topic_title = $this->getVar("topic_title"); if (!$this->getVar("type_id")) { return $topic_title; } $type_handler =& xoops_getmodulehandler('type', 'newbb'); if (!($type_obj =& $type_handler->get($this->getVar("type_id")))) { return $topic_title; } mod_loadFunctions("topic", "newbb"); return getTopicTitle($topic_title, $type_obj->getVar("type_name"), $type_obj->getVar("type_color")); }
function breadcrumbs($fid, $tid = null) { $title = getForumTitle($fid); $temp_fid = $fid; $breadcrumbs = []; while (true) { $res = dbquery("SELECT parent_id, main FROM forums\n WHERE fid=:fid", array("fid" => $temp_fid)); $pid = $res->fetch(PDO::FETCH_ASSOC); if ($pid['main'] == 1) { /*$cid = $pid['parent_id']; $res = dbquery("SELECT title FROM categories WHERE cid=:cid", array("cid"=>$cid)); $title = $res->fetch(PDO::FETCH_ASSOC); $breadcrumbs[$cid] = $title;*/ break; } else { $temp_fid = $pid['parent_id']; $breadcrumbs[$temp_fid] = getForumTitle($temp_fid); } } echo "<div id='breadcrumbs'><a href='/'>Board index </a>"; foreach (array_reverse($breadcrumbs, true) as $temp_fid => $temp_title) { echo ">> <a href='/?page=forum&fid={$temp_fid}'>{$temp_title} </a>"; } echo ">> <a href='/?page=forum&fid={$fid}'>{$title} </a>"; if ($tid != null) { $title = getTopicTitle($tid); echo ">> <a href='/?page=thread&tid={$tid}'>{$title}</a></div>"; } else { echo "</div>"; } }
$xoopsTpl->assign('newpost_link', "viewpost.php?status=new&forum=" . $forum_id); $query_type = $query_array; unset($query_type["type"]); $page_query_type = implode("&", array_values($query_type)); unset($query_type); $type_handler =& xoops_getmodulehandler('type', 'newbb'); $type_options = null; if ($types = $type_handler->getByForum($forum_id)) { $type_options[] = array("title" => _ALL, "link" => "viewforum.php?{$page_query_type}"); foreach ($types as $key => $item) { $type_options[] = array("title" => $item["type_name"], "link" => "viewforum.php?{$page_query_type}&type={$key}"); } } if ($type > 0) { mod_loadFunctions("topic", "newbb"); $xoopsTpl->assign('forum_topictype', getTopicTitle("", $types[$type]["type_name"], $types[$type]["type_color"])); } $xoopsTpl->assign_by_ref('type_options', $type_options); $query_status = $query_array; unset($query_status["status"]); $page_query_status = implode("&", array_values($query_status)); unset($query_status); $xoopsTpl->assign('newpost_link', "viewpost.php?status=new&forum=" . $forum_obj->getVar('forum_id')); $xoopsTpl->assign('all_link', "viewforum.php?{$page_query_status}"); $xoopsTpl->assign('digest_link', "viewforum.php?{$page_query_status}&status=digest"); $xoopsTpl->assign('unreplied_link', "viewforum.php?{$page_query_status}&status=unreplied"); $xoopsTpl->assign('unread_link', "viewforum.php?{$page_query_status}&status=unread"); switch ($status) { case 'digest': $current_status = _MD_DIGEST; break;
} } } elseif (!(array_key_exists('tid', $_GET) || array_key_exists('fid', $_GET) || array_key_exists('pid', $_GET))) { echo "Forum or thread not defined"; } else { $content = ""; if (array_key_exists('tid', $_GET)) { $tid = $_GET['tid']; $title = "Re: " . getTopicTitle($tid); $fid = getParent($tid); $legend = "New post in {$title}"; $button = "Post"; } elseif (array_key_exists('pid', $_GET)) { $pid = $_GET['pid']; $tid = getThread($pid); $title = getTopicTitle($tid); $fid = getParent($tid); $content = getPost($pid)->content; $legend = "Edit Post"; $button = "Edit"; } else { $title = ""; $tid = ""; $fid = $_GET['fid']; $legend = "New Thread"; $button = "Create Thread"; } ?> <!-- Temporary link to profile, should link to thread page --> <div id="registration">
function getAllTopics(&$forum, $criteria = null) { global $xoopsModule, $xoopsConfig, $xoopsModuleConfig, $myts, $xoopsUser, $viewall_forums; 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"; $criteria_vars = array("startdate", "start", "sort", "order", "type", "status", "excerpt"); foreach ($criteria_vars as $var) { ${$var} = $criteria[$var]; } $topic_lastread = newbb_getcookie('LT', true); if (is_object($forum)) { $criteria_forum = ' AND t.forum_id = ' . $forum->getVar('forum_id'); $hot_threshold = $forum->getVar('hot_threshold'); } else { $hot_threshold = 10; if (is_array($forum) && count($forum) > 0) { $criteria_forum = ' AND t.forum_id IN (' . implode(',', array_keys($forum)) . ')'; } elseif (!empty($forum)) { $criteria_forum = ' AND t.forum_id =' . intval($forum); } else { $criteria_forum = ''; } } $criteria_post = $startdate ? ' p.post_time > ' . $startdate : " 1 = 1 "; $criteria_topic = empty($type) ? '' : " AND t.type_id={$type}"; $criteria_extra = ''; $criteria_approve = ' AND t.approved = 1'; $post_on = ' p.post_id = t.topic_last_post_id'; $leftjoin = ' LEFT JOIN ' . $this->db->prefix('bb_posts') . ' p ON p.post_id = t.topic_last_post_id'; $sort_array = array(); switch ($status) { case 'digest': $criteria_extra = ' AND t.topic_digest = 1'; break; case 'unreplied': $criteria_extra = ' AND t.topic_replies < 1'; break; case 'unread': if (empty($xoopsModuleConfig["read_mode"])) { } elseif ($xoopsModuleConfig["read_mode"] == 2) { $leftjoin .= ' LEFT JOIN ' . $this->db->prefix('bb_reads_topic') . ' r ON r.read_item = t.topic_id'; $criteria_post .= ' AND (r.read_id IS NULL OR r.post_id < t.topic_last_post_id)'; } elseif ($xoopsModuleConfig["read_mode"] == 1) { $topics = array(); $topic_lastread = newbb_getcookie('LT', true); if (count($topic_lastread) > 0) { foreach ($topic_lastread as $id => $time) { if ($time > $time_criterion) { $topics[] = $id; } } } if (count($topics) > 0) { $criteria_extra = ' AND t.topic_id NOT IN (' . implode(",", $topics) . ')'; } if ($lastvisit = max($GLOBALS['last_visit'], $startdate)) { $criteria_post = ' p.post_time > ' . max($GLOBALS['last_visit'], $startdate); } } break; case 'pending': $post_on = ' p.topic_id = t.topic_id'; $criteria_post .= ' AND p.pid = 0'; $criteria_approve = ' AND t.approved = 0'; break; case 'deleted': $criteria_approve = ' AND t.approved = -1'; break; case 'all': // For viewall.php; do not display sticky topics at first // For viewall.php; do not display sticky topics at first case 'active': // same as "all" break; default: if ($startdate > 0) { $criteria_post = ' (p.post_time > ' . $startdate . ' OR t.topic_sticky=1)'; } $sort_array[] = 't.topic_sticky DESC'; break; } $select = 't.*, ' . ' p.post_time as last_post_time, p.poster_name as last_poster_name, p.icon, p.post_id, p.uid'; $from = $this->db->prefix("bb_topics") . ' t ' . $leftjoin; $where = $criteria_post . $criteria_topic . $criteria_forum . $criteria_extra . $criteria_approve; if ($excerpt) { $select .= ', p.post_karma, p.require_reply, pt.post_text'; $from .= ' LEFT JOIN ' . $this->db->prefix('bb_posts_text') . ' pt ON pt.post_id = t.topic_last_post_id'; } if ($sort == "u.uname") { $sort = "t.topic_poster"; } $sort_array[] = trim($sort . ' ' . $order); $sortby = implode(", ", array_filter($sort_array)); if (empty($sortby)) { $sortby = 't.topic_last_post_id DESC'; } $sql = 'SELECT ' . $select . ' FROM ' . $from . ' WHERE ' . $where . ' ORDER BY ' . $sortby; if (!($result = $this->db->query($sql, $xoopsModuleConfig['topics_per_page'], $start))) { redirect_header('index.php', 2, _MD_ERROROCCURED); exit; } $sticky = 0; $topics = array(); $posters = array(); $reads = array(); $types = array(); $type_handler =& xoops_getmodulehandler('type', 'newbb'); $typen = $type_handler->getByForum($forum->getVar('forum_id')); while ($myrow = $this->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) / $xoopsModuleConfig['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) * $xoopsModuleConfig['posts_per_page'] . '">' . $i . '</a>]'; $topic_page_jump_icon = "<a href='" . XOOPS_URL . "/modules/newbb/viewtopic.php?post_id=" . $myrow['post_id'] . "&start=" . ($i - 1) * $xoopsModuleConfig['posts_per_page'] . "'>" . newbb_displayImage('document', _MD_NEWBB_GOTOLASTPOST) . "</a>"; } } } else { $topic_page_jump_icon = "<a href='" . XOOPS_URL . "/modules/newbb/viewtopic.php?post_id=" . $myrow['post_id'] . "'>" . newbb_displayImage('document', _MD_NEWBB_GOTOLASTPOST) . "</a>"; } // ------------------------------------------------------ // => topic array if (!empty($viewall_forums[$myrow['forum_id']])) { $forum_link = '<a href="' . XOOPS_URL . '/modules/newbb/viewforum.php?forum=' . $myrow['forum_id'] . '">' . $viewall_forums[$myrow['forum_id']]['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>"; } 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($myts->displayTarea($myrow['post_text'])), 0, $excerpt); $topic_excerpt = str_replace("[", "[", $myts->htmlSpecialChars($topic_excerpt)); } /* users */ $posters[$myrow['topic_poster']] = 1; $posters[$myrow['uid']] = 1; // reads if (!empty($xoopsModuleConfig["read_mode"])) { $reads[$myrow['topic_id']] = $xoopsModuleConfig["read_mode"] == 1 ? $myrow['last_post_time'] : $myrow["topic_last_post_id"]; } $topic_poster = newbb_getUnameFromId($myrow['topic_poster'], $xoopsModuleConfig['show_realname'], true); $topic_last_poster = newbb_getUnameFromId($myrow['uid'], $xoopsModuleConfig['show_realname'], true); $topic_isRead = newbb_isRead("topic", $reads); $topic_prefix = !empty($typen[$myrow['type_id']]) ? getTopicTitle("", $typen[$myrow['type_id']]["type_name"], $typen[$myrow['type_id']]["type_color"]) : ""; // ------------------------------------------------------ // topic_folder: priority: newhot -> hot/new -> regular if ($myrow['topic_status'] == 1) { $topic_folder = 'topic_locked'; $topic_folder_text = _MD_TOPICLOCKED; } else { if ($myrow['topic_digest']) { $topic_folder = 'topic_digest'; $topic_folder_text = _MD_TOPICDIGEST; } elseif ($myrow['topic_replies'] >= $hot_threshold) { $topic_folder = empty($topic_isRead[$myrow['topic_id']]) ? 'topic_hot_new' : 'topic_hot'; $topic_folder_text = empty($topic_isRead[$myrow['topic_id']]) ? _MD_MORETHAN : _MD_MORETHAN2; } else { $topic_folder = empty($topic_isRead[$myrow['topic_id']]) ? 'topic_new' : 'topic'; $topic_folder_text = empty($topic_isRead[$myrow['topic_id']]) ? _MD_NEWPOSTS : _MD_NONEWPOSTS; } } $topics[$myrow['topic_id']] = array('topic_id' => $myrow['topic_id'], 'topic_icon' => $topic_icon, 'type_id' => $myrow['type_id'], 'type_text' => $topic_prefix, 'topic_title' => $topic_title, 'topic_link' => 'viewtopic.php?topic_id=' . $myrow['topic_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' => $myts->htmlSpecialChars($myrow['poster_name'] ? $myrow['poster_name'] : $xoopsConfig['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' => $myts->htmlSpecialChars($myrow['last_poster_name'] ? $myrow['last_poster_name'] : $xoopsConfig['anonymous']), 'topic_forum_link' => $forum_link, 'topic_excerpt' => $topic_excerpt, 'stick' => empty($myrow['topic_sticky']), "topic_poster" => $topic_poster, "topic_last_poster" => $topic_last_poster, "topic_folder" => newbb_displayImage($topic_folder, $topic_folder_text)); } if (count($topics) > 0) { $sql = " SELECT DISTINCT topic_id FROM " . $this->db->prefix("bb_posts") . " WHERE attachment != ''" . " AND topic_id IN (" . implode(',', array_keys($topics)) . ")"; if ($result = $this->db->query($sql)) { while (list($topic_id) = $this->db->fetchRow($result)) { $topics[$topic_id]['attachment'] = ' ' . newbb_displayImage('attachment', _MD_TOPICSHASATT); } } } return array($topics, $sticky); }
/** * Create full title of a topic * * the title is composed of [type_name] if type_id is greater than 0 plus topic_title * */ function newbb_getTopicTitle($topic_title, $prefix_name = null, $prefix_color = null) { return getTopicTitle($topic_title, $prefix_name = null, $prefix_color = null); }
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'; } $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; } mod_loadFunctions("render", "newbb"); mod_loadFunctions("session", "newbb"); mod_loadFunctions("time", "newbb"); mod_loadFunctions("read", "newbb"); mod_loadFunctions("topic", "newbb"); $sticky = 0; $topics = array(); $posters = array(); $reads = array(); $types = array(); $forums = array(); $anonymous = $myts->htmlSpecialChars($GLOBALS["xoopsConfig"]['anonymous']); 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'] . "" . "'>" . newbb_displayImage('document', _MD_NEWBB_GOTOLASTPOST) . "</a>"; } } } else { $topic_page_jump_icon = "<a href='" . XOOPS_URL . "/modules/newbb/viewtopic.php?topic_id=" . $myrow['topic_id'] . "" . "'>" . newbb_displayImage('document', _MD_NEWBB_GOTOLASTPOST) . "</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 { $topic_excerpt = xoops_substr(newbb_html2text($myts->displayTarea($myrow['post_text'])), 0, $this->config["post_excerpt"]); $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; } $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'); if (count($forums) > 0) { $forum_list = $forum_handler->getAll(new Criteria("forum_id", "(" . implode(", ", array_keys($forums)) . ")", "IN"), array("forum_name", "hot_threshold"), false); } else { $forum_list = $forum_handler->getAll(); } 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"] = 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); }