Пример #1
0
 /**
  * Find tags
  *
  * @return	@e void
  */
 protected function _find()
 {
     /* init */
     $app = $this->request['meta_app'];
     $area = $this->request['meta_area'];
     $parentId = intval($this->request['meta_parent_id']);
     $metaId = intval($this->request['meta_id']);
     $find = trim($this->request['find']);
     $tags = array();
     $sort = array();
     /* Checks */
     if (empty($app) or empty($area)) {
         return $this->returnJsonArray(array());
     }
     /* Init tags */
     require_once IPS_ROOT_PATH . 'sources/classes/tags/bootstrap.php';
     /*noLibHook*/
     $tagClass = classes_tags_bootstrap::run($app, $area);
     /* Get tags by whut */
     if (!empty($metaId)) {
         $tags = $tagClass->getRawTagsByMetaId($metaId, $find);
     } else {
         if (!empty($parentId)) {
             $tags = $tagClass->getRawTagsByParentId($parentId, $find);
         }
     }
     /* format */
     if (is_array($tags) && count($tags)) {
         foreach ($tags as $id => $t) {
             $sort[strlen($t['tag_text']) . '.' . md5($t['tag_text'])] = $t['tag_text'];
         }
     }
     ksort($sort);
     return $this->returnJsonArray(array_values($sort));
 }
Пример #2
0
 /**
  * Constructor
  * 
  * @return	@e void
  */
 public function __construct(ipsRegistry $registry)
 {
     /* Get class forums, used for displaying forum names on results */
     if (ipsRegistry::isClassLoaded('class_forums') !== TRUE) {
         $classToLoad = IPSLib::loadLibrary(IPSLib::getAppDir('forums') . "/sources/classes/forums/class_forums.php", 'class_forums', 'forums');
         ipsRegistry::setClass('class_forums', new $classToLoad(ipsRegistry::instance()));
         ipsRegistry::getClass('class_forums')->strip_invisible = 1;
         ipsRegistry::getClass('class_forums')->forumsInit();
     }
     /* Load tagging stuff */
     if (!$registry->isClassLoaded('tags')) {
         require_once IPS_ROOT_PATH . 'sources/classes/tags/bootstrap.php';
         /*noLibHook*/
         $registry->setClass('tags', classes_tags_bootstrap::run('forums', 'topics'));
     }
     /* Get live or archive */
     $this->searchArchives = ipsRegistry::$request['search_app_filters']['forums']['liveOrArchive'] == 'archive' ? true : false;
     if ($this->searchArchives) {
         /* Load up archive class */
         $classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/archive/reader.php', 'classes_archive_reader');
         $this->archiveReader = new $classToLoad();
         $this->archiveReader->setApp('forums');
         $this->table = $this->archiveReader->getFields();
         $this->table['_table_'] = 'forums_archive_posts';
         $this->table['_prefix_'] = 'p.archive_';
     } else {
         $this->table = array('_table_' => 'posts', '_prefix_' => 'p.', 'pid' => 'pid', 'author_id' => 'author_id', 'author_name' => 'author_name', 'ip_address' => 'ip_address', 'post_date' => 'post_date', 'post' => 'post', 'queued' => 'queued', 'topic_id' => 'topic_id', 'new_topic' => 'new_topic', 'post_bwoptions' => 'post_bwoptions', 'post_key' => 'post_key', 'post_htmlstate' => 'post_htmlstate', 'use_sig' => 'use_sig', 'use_emo' => 'use_emo', 'append_edit' => 'append_edit', 'edit_time' => 'edit_time', 'edit_name' => 'edit_name', 'post_edit_reason' => 'post_edit_reason');
     }
     parent::__construct($registry);
     /* Set up wrapper */
     $this->templates = array('group' => 'search', 'template' => 'searchResultsAsForum');
 }
Пример #3
0
 /**
  * Class entry point
  *
  * @param	object		Registry reference
  * @return	@e void
  */
 public function __construct(ipsRegistry $registry)
 {
     /* Make objects */
     $this->registry = $registry;
     $this->DB = $this->registry->DB();
     $this->settings =& $this->registry->fetchSettings();
     $this->request =& $this->registry->fetchRequest();
     $this->lang = $this->registry->getClass('class_localization');
     $this->member = $this->registry->member();
     $this->memberData =& $this->registry->member()->fetchMemberData();
     $this->cache = $this->registry->cache();
     $this->caches =& $this->registry->cache()->fetchCaches();
     /* Check for class_forums */
     if (ipsRegistry::isClassLoaded('class_forums') !== TRUE) {
         $classToLoad = IPSLib::loadLibrary(IPSLib::getAppDir('forums') . "/sources/classes/forums/class_forums.php", 'class_forums', 'forums');
         $this->registry->setClass('class_forums', new $classToLoad($registry));
         $this->registry->class_forums->forumsInit();
     }
     /* Init */
     if (!$this->registry->isClassLoaded('topics')) {
         $classToLoad = IPSLib::loadLibrary(IPSLib::getAppDir('forums') . "/sources/classes/topics.php", 'app_forums_classes_topics', 'forums');
         $this->registry->setClass('topics', new $classToLoad($this->registry));
     }
     /* Load tagging stuff */
     if (!$this->registry->isClassLoaded('tags')) {
         require_once IPS_ROOT_PATH . 'sources/classes/tags/bootstrap.php';
         /*noLibHook*/
         $this->registry->setClass('tags', classes_tags_bootstrap::run('forums', 'topics'));
     }
 }
Пример #4
0
 /**
  * Delete a forum
  *
  * @return	@e void		Outputs to screen
  */
 public function doDelete()
 {
     //-----------------------------------------
     // Auth check...
     //-----------------------------------------
     $this->registry->adminFunctions->checkSecurityKey();
     //-----------------------------------------
     // Continue
     //-----------------------------------------
     $this->request['f'] = intval($this->request['f']);
     $this->request['new_parent_id'] = intval($this->request['new_parent_id']);
     $forum = $this->registry->class_forums->forum_by_id[$this->request['f']];
     if (!$forum['id']) {
         $this->registry->output->showError($this->lang->words['for_noid_source'], 11313);
     }
     if (!$this->request['new_parent_id']) {
         $this->request['new_parent_id'] = -1;
     } else {
         if ($this->request['new_parent_id'] == $this->request['f']) {
             $this->registry->output->global_message = $this->lang->words['for_child_no_parent'];
             $this->deleteForm();
             return;
         }
     }
     //-----------------------------------------
     // Would deleting this category orphan the only
     // remaining forums?
     //-----------------------------------------
     if ($forum['parent_id'] == -1) {
         $otherParent = 0;
         foreach ($this->registry->class_forums->forum_by_id as $id => $data) {
             if ($data['parent_id'] == -1) {
                 $otherParent = $id;
                 break;
             }
         }
         if (!$otherParent) {
             $this->registry->output->showError($this->lang->words['nodelete_last_cat'], 11364);
         }
     }
     //-----------------------------------------
     // Get library
     //-----------------------------------------
     $classToLoad = IPSLib::loadLibrary(IPSLib::getAppDir('forums') . '/sources/classes/moderate.php', 'moderatorLibrary', 'forums');
     $modfunc = new $classToLoad($this->registry);
     /* Load tagging stuff */
     if (!$this->registry->isClassLoaded('tags')) {
         require_once IPS_ROOT_PATH . 'sources/classes/tags/bootstrap.php';
         /*noLibHook*/
         $this->registry->setClass('tags', classes_tags_bootstrap::run('forums', 'topics'));
     }
     //-----------------------------------------
     // Move stuff
     //-----------------------------------------
     if (isset($this->request['MOVE_ID'])) {
         $this->request['MOVE_ID'] = intval($this->request['MOVE_ID']);
         if (!$this->request['MOVE_ID']) {
             $this->registry->output->global_error = $this->lang->words['forum_delete_none_selected'];
             $this->deleteForm();
             return;
         }
         if ($this->request['MOVE_ID'] == $this->request['f']) {
             $this->registry->output->global_error = $this->lang->words['for_wherewhatwhy'];
             $this->deleteForm();
             return;
         }
         //-----------------------------------------
         // Move topics...
         //-----------------------------------------
         $this->DB->update('topics', array('forum_id' => $this->request['MOVE_ID']), 'forum_id=' . $this->request['f']);
         //-----------------------------------------
         // Move polls...
         //-----------------------------------------
         $this->DB->update('polls', array('forum_id' => $this->request['MOVE_ID']), 'forum_id=' . $this->request['f']);
         //-----------------------------------------
         // Move voters...
         //-----------------------------------------
         $this->DB->update('voters', array('forum_id' => $this->request['MOVE_ID']), 'forum_id=' . $this->request['f']);
         /* Move tags */
         $this->registry->tags->moveTagsByParentId($this->request['f'], $this->request['MOVE_ID']);
         $modfunc->forumRecount($this->request['MOVE_ID']);
     }
     //-----------------------------------------
     // Delete the forum
     //-----------------------------------------
     $this->DB->delete('forums', "id=" . $this->request['f']);
     $this->DB->delete('permission_index', "app='forums' AND perm_type='forum' AND perm_type_id=" . $this->request['f']);
     //-----------------------------------------
     // Remove moderators from this forum
     //-----------------------------------------
     $this->DB->build(array('select' => '*', 'from' => 'moderators', 'where' => "forum_id LIKE '%,{$this->request['f']},%'"));
     $outer = $this->DB->execute();
     while ($r = $this->DB->fetch($outer)) {
         $forums = explode(',', IPSText::cleanPermString($r['forum_id']));
         $newForums = array();
         foreach ($forums as $aForumId) {
             if ($aForumId != $this->request['f']) {
                 $newForums[] = $aForumId;
             }
         }
         if (!count($newForums)) {
             $this->DB->delete('moderators', "mid=" . $r['mid']);
         } else {
             $this->DB->update('moderators', array('forum_id' => ',' . implode(',', $newForums) . ','), 'mid=' . $r['mid']);
         }
     }
     //-----------------------------------------
     // Delete forum subscriptions
     //-----------------------------------------
     require_once IPS_ROOT_PATH . 'sources/classes/like/composite.php';
     /*noLibHook*/
     $_like = classes_like::bootstrap('forums', 'forums');
     $_like->remove($this->request['f']);
     //-----------------------------------------
     // Update children
     //-----------------------------------------
     $this->DB->update('forums', array('parent_id' => $this->request['new_parent_id']), "parent_id=" . $this->request['f']);
     //-----------------------------------------
     // Rebuild moderator cache
     //-----------------------------------------
     $classToLoad = IPSLib::loadActionOverloader(IPSLib::getAppDir('forums') . '/modules_admin/forums/moderator.php', 'admin_forums_forums_moderator');
     $moderator = new $classToLoad();
     $moderator->makeRegistryShortcuts($this->registry);
     $moderator->rebuildModeratorCache();
     $this->registry->adminFunctions->saveAdminLog(sprintf($this->lang->words['for_removedlog'], $forum['name']));
     $this->registry->output->global_message = $this->lang->words['for_removed'];
     $this->registry->output->silentRedirectWithMessage($this->settings['base_url'] . $this->form_code);
 }
Пример #5
0
 /**
  * Construct
  *
  * @param	object	ipsRegistry Object
  * @return	@e void
  */
 public function __construct(ipsRegistry $registry)
 {
     /* Make object */
     $this->registry = $registry;
     $this->DB = $this->registry->DB();
     $this->settings =& $this->registry->fetchSettings();
     $this->request =& $this->registry->fetchRequest();
     $this->lang = $this->registry->getClass('class_localization');
     $this->member = $this->registry->member();
     $this->memberData =& $this->registry->member()->fetchMemberData();
     $this->cache = $this->registry->cache();
     $this->caches =& $this->registry->cache()->fetchCaches();
     $this->registry->getClass('class_localization')->loadLanguageFile(array('public_post'), 'forums');
     IPSText::getTextClass('bbcode')->parsing_section = 'topics';
     IPSText::getTextClass('bbcode')->parsing_mgroup = $this->memberData['member_group_id'];
     IPSText::getTextClass('bbcode')->parsing_mgroup_others = $this->memberData['mgroup_others'];
     /* Just to be sure */
     $this->setBypassPermissionCheck(false);
     /* Prevent some notices */
     $this->request['mod_options'] = isset($this->request['mod_options']) ? $this->request['mod_options'] : null;
     /* Load editor stuff */
     $classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/editor/composite.php', 'classes_editor_composite');
     $this->editor = new $classToLoad();
     /* Turn off legacy mode */
     $this->editor->setLegacyMode(false);
     /* Load tagging stuff */
     if (!$this->registry->isClassLoaded('tags')) {
         require_once IPS_ROOT_PATH . 'sources/classes/tags/bootstrap.php';
         /*noLibHook*/
         $this->registry->setClass('tags', classes_tags_bootstrap::run('forums', 'topics'));
     }
     if (!$this->registry->isClassLoaded('topics')) {
         $classToLoad = IPSLib::loadLibrary(IPSLib::getAppDir('forums') . "/sources/classes/topics.php", 'app_forums_classes_topics', 'forums');
         $this->registry->setClass('topics', new $classToLoad($this->registry));
     }
 }
 /**
  * Constructor
  *
  * @param	object		ipsRegistry reference
  * @return	@e void
  */
 public function __construct(ipsRegistry $registry)
 {
     /* Make object */
     $this->registry = $registry;
     $this->DB = $this->registry->DB();
     $this->settings =& $this->registry->fetchSettings();
     $this->request =& $this->registry->fetchRequest();
     $this->cache = $this->registry->cache();
     $this->caches =& $this->registry->cache()->fetchCaches();
     $this->lang = $this->registry->getClass('class_localization');
     $this->member = $this->registry->member();
     $this->memberData =& $this->registry->member()->fetchMemberData();
     if (IN_ACP) {
         try {
             require_once IPSLib::getAppDir('forums') . "/sources/classes/forums/class_forums.php";
             /*noLibHook*/
             $classToLoad = IPSLib::loadLibrary(IPSLib::getAppDir('forums') . "/sources/classes/forums/admin_forum_functions.php", 'admin_forum_functions', 'forums');
             $this->registry->setClass('class_forums', new $classToLoad($registry));
             $this->registry->getClass('class_forums')->strip_invisible = 0;
         } catch (Exception $error) {
             IPS_exception_error($error);
         }
     } else {
         try {
             $classToLoad = IPSLib::loadLibrary(IPSLib::getAppDir('forums') . "/sources/classes/forums/class_forums.php", 'class_forums', 'forums');
             $this->registry->setClass('class_forums', new $classToLoad($registry));
             $this->registry->getClass('class_forums')->strip_invisible = 1;
         } catch (Exception $error) {
             IPS_exception_error($error);
         }
     }
     //---------------------------------------------------
     // Grab and cache the topic now as we need the 'f' attr for
     // the skins...
     //---------------------------------------------------
     if (!empty($_GET['showtopic'])) {
         /* Load tagging stuff */
         if (!$this->registry->isClassLoaded('tags')) {
             require_once IPS_ROOT_PATH . 'sources/classes/tags/bootstrap.php';
             /*noLibHook*/
             $this->registry->setClass('tags', classes_tags_bootstrap::run('forums', 'topics'));
         }
         $this->request['t'] = intval($_GET['showtopic']);
         $this->DB->build(array('select' => 't.*', 'from' => array('topics' => 't'), 'where' => 't.tid=' . $this->request['t'], 'add_join' => array($this->registry->tags->getCacheJoin(array('meta_id_field' => 't.tid')))));
         $this->DB->execute();
         $topic = $this->DB->fetch();
         $this->registry->getClass('class_forums')->topic_cache = $topic;
         $this->request['f'] = $topic['forum_id'];
         /* Update query location */
         $this->member->sessionClass()->addQueryKey('location_2_id', ipsRegistry::$request['f']);
     }
     $this->registry->getClass('class_forums')->forumsInit();
     //-----------------------------------------
     // Set up moderators
     //-----------------------------------------
     $this->memberData = IPSMember::setUpModerator($this->memberData);
     /* Other set up for this app */
     $this->settings['topic_title_max_len'] = $this->settings['topic_title_max_len'] > 2 ? $this->settings['topic_title_max_len'] : 2;
 }
Пример #7
0
 /**
  * Convert tags
  *
  * @access	public
  * @param 	array		Tags
  * @param 	array 		Data to insert to tags
  * @return 	boolean		Success or fail
  **/
 public function convertTags($tags, $info, $app = 'forums', $area = 'topics')
 {
     //-----------------------------------------
     // Make sure we have everything we need
     //-----------------------------------------
     if (!$info['tag_meta_id']) {
         $this->logError($id, 'No ID number provided');
         return false;
     }
     if (!$info['tag_meta_parent_id']) {
         $this->logError($id, 'No parent ID number provided');
         return false;
     }
     // Clean tags
     foreach ($tags as $key => $tag) {
         $tags[$key] = trim(IPSText::htmlspecialchars($tag));
     }
     // Load tagging library
     if (!$this->registry->isClassLoaded('tags')) {
         require_once IPS_ROOT_PATH . 'sources/classes/tags/bootstrap.php';
         /*noLibHook*/
     }
     $this->registry->setClass('tags', classes_tags_bootstrap::run($app, $area));
     $this->registry->tags = ipsRegistry::getClass('tags');
     switch ($area) {
         case 'topics':
             $linkType = 'topics';
             $linkParentType = 'forums';
             break;
     }
     // Get links
     $info['tag_meta_id'] = $this->getLink($info['tag_meta_id'], $linkType);
     $info['tag_meta_parent_id'] = $this->getLink($info['tag_meta_parent_id'], $linkParentType);
     $info['tag_member_id'] = $info['tag_member_id'] ? $this->getLink($info['tag_member_id'], 'members') : 0;
     if (!$info['tag_meta_id']) {
         $this->logError($id, 'No ID number available');
         return false;
     }
     if (!$info['tag_meta_parent_id']) {
         $this->logError($id, 'No parent ID number available');
         return false;
     }
     $this->registry->tags->add($tags, $info, 'add');
     return true;
 }
Пример #8
0
 /**
  * Setup for the forum controller
  *
  * @return	@e void
  */
 public function initForums()
 {
     $this->registry->getClass('class_localization')->loadLanguageFile(array('public_forums', 'public_boards'));
     //-----------------------------------------
     // Multi TIDS?
     // If st is not defined then kill cookie
     // st will always be defined across pages
     //-----------------------------------------
     if (!array_key_exists('page', $this->request) and !array_key_exists('prune_day', $this->request)) {
         IPSCookie::set('modtids', ',', 0);
         $this->request['selectedtids'] = '';
     } else {
         $this->request['selectedtids'] = IPSCookie::get('modtids');
     }
     //-----------------------------------------
     // Get the forum info based on the forum ID,
     // and get the category name, ID, etc.
     //-----------------------------------------
     $this->forum = $this->registry->getClass('class_forums')->getForumById($this->request['f']);
     /* Followed stuffs */
     require_once IPS_ROOT_PATH . 'sources/classes/like/composite.php';
     /*noLibHook*/
     $this->_like = classes_like::bootstrap('forums', 'forums');
     /* Load tagging stuff */
     if (!$this->registry->isClassLoaded('tags')) {
         require_once IPS_ROOT_PATH . 'sources/classes/tags/bootstrap.php';
         /*noLibHook*/
         $this->registry->setClass('tags', classes_tags_bootstrap::run('forums', 'topics'));
     }
     /* Init */
     if (!$this->registry->isClassLoaded('topics')) {
         $classToLoad = IPSLib::loadLibrary(IPSLib::getAppDir('forums') . "/sources/classes/topics.php", 'app_forums_classes_topics', 'forums');
         $this->registry->setClass('topics', new $classToLoad($this->registry));
     }
 }
Пример #9
0
 /**
  * getCloudData
  * 
  * Filters:
  * limit		Limit the number of tags returned
  * visible		The number of visible tags
  * noCache		Bypass any caching and always fetch fresh
  * 
  * @param	array	Filters (limit, visible)
  * @return	@e array
  */
 public function getCloudData($filters = array())
 {
     /* INIT */
     $where = array();
     $data = array();
     $raw = array();
     $nums = array('min' => 0, 'max' => 0, 'count' => 0);
     $final = array('tags' => array(), 'nums' => array());
     /* Clean up filters */
     $filters['limit'] = intval($filters['limit']);
     $filters['offset'] = intval($filters['offset']);
     $filters['visible'] = !isset($filters['visible']) ? 1 : intval($filters['visible']);
     if ($this->getApp() && $this->getArea() && $this->getRelId()) {
         $where[] = "t.tag_aai_lookup='" . $this->_getKey(array('meta_id' => $this->getRelId())) . "'";
     } else {
         if ($this->getApp() && $this->getArea() && $this->getParentId()) {
             $where[] = "t.tag_aap_lookup='" . $this->_getKey(array('meta_parent_id' => $this->getParentId())) . "'";
         }
     }
     if ($this->getApp()) {
         $where[] = "t.tag_meta_app='" . $this->DB->addSlashes($this->getApp()) . "'";
     }
     if ($this->getArea()) {
         $where[] = "t.tag_meta_area='" . $this->DB->addSlashes($this->getArea()) . "'";
     }
     /* Test against cache class */
     if (empty($filters['noCache'])) {
         $cacheKey = 'tagCloud-' . md5(implode('&', $where));
         $cached = $this->registry->getClass('cacheSimple')->get($cacheKey);
         if ($cached !== null && is_array($cached['data'])) {
             $cached['data']['cached'] = $cached['time'];
             return $cached['data'];
         }
     }
     /* Still here? Fetch from the database */
     $this->DB->allow_sub_select = true;
     $this->DB->loadCacheFile(IPSLib::getAppDir('core') . '/sql/' . ips_DBRegistry::getDriverType() . '_tag_queries.php', 'public_tag_sql_queries');
     $this->DB->buildFromCache('getCloudData', array('where' => $where, 'limit' => array($filters['offset'], $filters['limit'])), 'public_tag_sql_queries');
     $o = $this->DB->execute();
     while ($tag = $this->DB->fetch()) {
         $raw[$tag['times'] . '.' . md5($tag['tag_text'])] = $tag;
         if (empty($nums['min']) or $nums['min'] > $tag['times']) {
             $nums['min'] = $tag['times'];
         }
         if ($nums['max'] < $tag['times']) {
             $nums['max'] = $tag['times'];
         }
         $nums['count'] += $tag['times'];
     }
     /* Sort it */
     krsort($raw);
     require_once IPS_ROOT_PATH . 'sources/classes/tags/bootstrap.php';
     /*noLibHook*/
     /* Now give out some useful data */
     foreach ($raw as $key => $data) {
         /* Get plugin class to work out 'section' */
         if (!isset($this->plugins[$data['tag_meta_area']])) {
             $this->plugins[$data['tag_meta_area']] = classes_tags_bootstrap::run($data['tag_meta_app'], $data['tag_meta_area']);
         }
         /* Section */
         $section = $this->plugins[$data['tag_meta_area']]->getSearchSection();
         /* Work out a percentage */
         $percent = sprintf('%.2F', $data['times'] / $nums['max'] * 100);
         $final['tags'][] = array('tag' => $data['tag_text'], 'count' => $data['times'], 'app' => $data['tag_meta_app'], 'section' => $section, 'percent' => $percent, 'weight' => sprintf('%.2F', $percent / 100));
     }
     $final['nums'] = $nums;
     /* Cache */
     $this->registry->getClass('cacheSimple')->set($cacheKey, $final);
     return $final;
 }
Пример #10
0
 /**
  * Auto populate the data and that. Populated topicData and forumData. Also does rudimentary access checks
  *
  * @param	mixed	$topic	Array of topic data, or single topic id
  * @param	bool	$return	Return errors instead of printing
  * @return	@e void
  */
 public function autoPopulate($topic = "", $return = true)
 {
     /* @todo Remove other calls to request['t'] - intvalled here because it's called in a million places */
     $this->request['t'] = intval($this->request['t']);
     $this->return = $return;
     /* Sanitize */
     $topicId = intval($this->request['t']);
     if (!is_array($topic)) {
         if (!$topicId) {
             throw new Exception('EX_topics_no_tid');
         }
         /* May have loaded topic data previously */
         if (empty($this->registry->class_forums->topic_cache['tid'])) {
             /* Load tagging stuff */
             if (!$this->registry->isClassLoaded('tags')) {
                 require_once IPS_ROOT_PATH . 'sources/classes/tags/bootstrap.php';
                 /*noLibHook*/
                 $this->registry->setClass('tags', classes_tags_bootstrap::run('forums', 'topics'));
             }
             $this->DB->build(array('select' => 't.*', 'from' => array('topics' => 't'), 'where' => 't.tid=' . $topicId, 'add_join' => array($this->registry->tags->getCacheJoin(array('meta_id_field' => 't.tid')))));
             $this->DB->execute();
             $this->setTopicData($this->DB->fetch());
         } else {
             $this->setTopicData($this->registry->class_forums->topic_cache);
         }
     } else {
         $this->setTopicData($topic);
     }
     $this->topicData['title'] = IPSText::stripAttachTag($this->topicData['title']);
     /* @todo Remove other calls to request['f'] - intvalled here because it's called in a million places */
     $this->request['f'] = intval($this->topicData['forum_id']);
     /* Check to see if stuff is stuffable */
     $result = $this->canView();
     if ($result === false) {
         throw new Exception($this->getErrorMessage());
     }
     if (!empty($this->topicData['tag_cache_key'])) {
         $this->topicData['tags'] = $this->registry->tags->formatCacheJoinData($this->topicData);
     }
     /* Set up */
     $this->topicData = $this->setUpTopic($this->topicData);
 }