public function showRepliesQueue() { $mod = new \CODOF\Forum\Moderation(\DB::getPDO()); $topics = $mod->getReplies(); $this->smarty->assign('mod_queue', \CODOF\HB\Render::tpl('moderation/queue', array("topics" => $topics))); $num_topics = $mod->getNumTopics(); $num_replies = $mod->getNumReplies(); if ($num_replies === 0) { $this->smarty->assign('present', false); } else { $this->smarty->assign('present', true); } $this->smarty->assign('num_topics', $num_topics ? $num_topics : '0 '); $this->smarty->assign('num_replies', $num_replies ? $num_replies : '0 '); $this->css_files = array('moderation'); $this->smarty->assign('tab_option', 'replies'); $this->smarty->assign('reply_head', 'codo_active_head_item'); $this->smarty->assign('topic_head', ''); $this->view = 'moderation/moderation'; \CODOF\Store::set('sub_title', _t('Moderation queue')); }
public static function access_denied() { $css_files = array(); $view = 'access_denied'; \CODOF\Store::set('sub_title', _t('Access denied')); Layout::load($view, $css_files); }
public static function not_found() { $this->view = 'not_found'; \CODOF\Store::set('sub_title', _t('Not found')); }
public function listTaggedTopics($tag, $page = 1) { $posts_per_page = \CODOF\Util::get_opt("num_posts_all_topics"); if ($page == null) { $page = 1; } $page = (int) $page; if ($page <= 1) { $from = 0; } else { $from = ($page - 1) * $posts_per_page; } $topics = new \Controller\Ajax\forum\topics(); $taggedTopics = $topics->getTaggedTopics($tag, $from); $topic = new \CODOF\Forum\Topic($this->db); $num_pages = $topic->get_num_pages($topic->getTaggedTopicsCount($tag), $posts_per_page); $url = 'tags/' . $tag . '/'; $curr_page = $page; //var_dump($taggedTopics); $this->smarty->assign('tag', $tag); $this->smarty->assign('curr_page', $curr_page); $this->smarty->assign('url', RURI . $url); $this->smarty->assign('num_pages', $num_pages); $this->smarty->assign('topics', json_encode($taggedTopics)); $this->smarty->assign('tags', json_encode($taggedTopics['tags'])); $this->css_files = array('tags'); $this->js_files = array(array('tags/tags.js', array('type' => 'defer'))); $this->view = 'forum/tags'; \CODOF\Store::set('sub_title', $tag . ' - ' . _t('Tags')); }
} //exit; }); //-------------PAGES-------------------------- dispatch_get('/page/:id/:url', function ($id, $url) { $pid = (int) $id; $user = \CODOF\User\User::get(); $qry = 'SELECT title, content FROM ' . PREFIX . 'codo_pages p ' . ' LEFT JOIN ' . PREFIX . 'codo_page_roles r ON r.pid=p.id ' . ' WHERE (r.rid IS NULL OR (r.rid IS NOT NULL AND r.rid IN (' . implode($user->rids) . ')))' . ' AND p.id=' . $pid; $res = \DB::getPDO()->query($qry); $row = $res->fetch(); if ($row) { $title = $row['title']; $content = $row['content']; $smarty = CODOF\Smarty\Single::get_instance(); $smarty->assign('contents', $content); \CODOF\Store::set('sub_title', $title); \CODOF\Smarty\Layout::load('page'); \CODOF\Hook::call('on_page_load', array($id)); } else { $page = \DB::table(PREFIX . 'codo_pages')->where('id', $id)->first(); if ($page == null) { \CODOF\Smarty\Layout::not_found(); } else { \CODOF\Smarty\Layout::access_denied(); } } }); //-------------USER------------------------------------------------------------- dispatch_get('/user/logout', function () { $user = new \Controller\user(); $user->logout();