function current() { $temp = parent::current(); /* Cache this forum in the session */ cache_forum($temp); /** * Do the icon */ switch ($temp['row_type']) { case FORUM: $temp['forum_icon'] = 'forum_off'; forum_icon($temp, $temp['forum_icon']); break; case GALLERY: $temp['forum_icon'] = 'forum_gallery'; break; case METAFORUM: $temp['forum_icon'] = 'forum_meta'; break; case ARCHIVEFORUM: $temp['forum_icon'] = 'forum_archive'; break; } /* Set a nice representation of what level we're on */ $temp['level'] = @str_repeat(' ', $this->level); /* Should we query down to the next level of forums? */ if ($temp['row_type'] & CATEGORY) { $temp['forums'] =& new K4ForumsIterator($this->dba, "SELECT * FROM " . K4FORUMS . " WHERE parent_id = " . $temp['forum_id'] . " ORDER BY row_order ASC", TRUE, $this->level + 1); } if ($this->do_recurse) { if ($temp['subforums'] > 0 && $this->settings['showsubforums'] == 1) { $it = new K4ForumsIterator($this->dba, "SELECT * FROM " . K4FORUMS . " WHERE parent_id = " . intval($temp['forum_id']) . " ORDER BY row_order ASC", FALSE, $this->level + 1); if ($it->hasNext()) { // add the iterator $temp['subforums_list'] = $it; } else { // if this forum doesn't actually have subforums, fix it $this->dba->executeUpdate("UPDATE " . K4FORUMS . " SET subforums=0 WHERE forum_id = " . intval($temp['forum_id'])); } } } /** * Get the moderators */ $temp['moderators'] = array(); $temp['are_moderators'] = 0; if ($temp['moderating_groups'] != '') { $groups = explode('|', $temp['moderating_groups']); if (is_array($groups)) { foreach ($groups as $g) { if (isset($this->usergroups[$g])) { $temp['U_USERGROUPURL'] = K4Url::getUserGroupUrl($g); $temp['moderators'][] = $this->usergroups[$g]; } } $temp['are_moderators'] = 1; } } if ($temp['moderating_users'] != '') { $users = force_unserialize($temp['moderating_users']); if (is_array($users) && !empty($users)) { foreach ($users as $user_id => $username) { $temp['U_GMEMBERURL'] = K4Url::getMemberUrl($user_id); $temp['moderators'][] = array('user_id' => $user_id, 'name' => $username); } $temp['are_moderators'] = 1; } } $temp['moderators'] =& new FAArrayIterator($temp['moderators']); /* Replace topic/post names with censors */ replace_censors($temp['topic_name']); replace_censors($temp['post_name']); $temp['topics'] = number_format($temp['topics']); $temp['replies'] = number_format($temp['replies']); $temp['posts'] = number_format($temp['posts']); // /* Set cookies for all of the topics */ // bb_settopic_cache_item('forums', serialize($this->forums), time() + 3600 * 25 * 5); $temp['safe_description'] = strip_tags($temp['description']); $temp['forum'] = $temp['row_type'] == CATEGORY ? 0 : 1; // custom url's $temp['U_FORUMURL'] = K4Url::getForumUrl($temp['forum_id']); $temp['U_TOPICURL'] = K4Url::getTopicUrl($temp['post_id']); $temp['U_POSTURL'] = K4Url::getPostUrl($temp['post_id']); $temp['U_FINDPOSTURL'] = K4Url::getPostUrl($temp['post_id']); $temp['U_MEMBERURL'] = K4Url::getMemberUrl($temp['post_uid']); $temp['U_REDIRECTURL'] = K4Url::getRedirectUrl($temp['forum_id']); /* Return the formatted forum info */ return $temp; }
function follow_forum_ids($breadcrumbs, $forum) { switch ($forum['row_type']) { case CATEGORY: case FORUM: case GALLERY: $forum['location'] = K4Url::getForumUrl($forum['forum_id']); break; } $breadcrumbs[] = $forum; if (isset($forum['parent_id']) && $forum['parent_id'] > 0) { global $_ALLFORUMS; $breadcrumbs = follow_forum_ids($breadcrumbs, $_ALLFORUMS[$forum['parent_id']]); unset($all_forums); } return $breadcrumbs; }