コード例 #1
0
ファイル: Topic.php プロジェクト: bohwaz/featherbb
 public function display($id = null, $name = null, $page = null, $pid = null)
 {
     // Antispam feature
     require $this->feather->forum_env['FEATHER_ROOT'] . 'featherbb/lang/' . $this->feather->user->language . '/antispam.php';
     $index_questions = rand(0, count($lang_antispam_questions) - 1);
     // Fetch some informations about the topic
     $cur_topic = $this->model->get_info_topic($id);
     // Sort out who the moderators are and if we are currently a moderator (or an admin)
     $mods_array = $cur_topic['moderators'] != '' ? unserialize($cur_topic['moderators']) : array();
     $is_admmod = $this->feather->user->g_id == $this->feather->forum_env['FEATHER_ADMIN'] || $this->feather->user->g_moderator == '1' && array_key_exists($this->feather->user->username, $mods_array) ? true : false;
     if ($is_admmod) {
         $admin_ids = Utils::get_admin_ids();
     }
     // Can we or can we not post replies?
     $post_link = $this->model->get_post_link($id, $cur_topic['closed'], $cur_topic['post_replies'], $is_admmod);
     // Add/update this topic in our list of tracked topics
     if (!$this->feather->user->is_guest) {
         $tracked_topics = Track::get_tracked_topics();
         $tracked_topics['topics'][$id] = time();
         Track::set_tracked_topics($tracked_topics);
     }
     // Determine the post offset (based on $_GET['p'])
     $num_pages = ceil(($cur_topic['num_replies'] + 1) / $this->feather->user->disp_posts);
     $p = !isset($page) || $page <= 1 || $page > $num_pages ? 1 : intval($page);
     $start_from = $this->feather->user->disp_posts * ($p - 1);
     $url_topic = Url::url_friendly($cur_topic['subject']);
     $url_forum = Url::url_friendly($cur_topic['forum_name']);
     // Generate paging links
     $paging_links = '<span class="pages-label">' . __('Pages') . ' </span>' . Url::paginate($num_pages, $p, 'topic/' . $id . '/' . $url_topic . '/#');
     if ($this->feather->forum_settings['o_censoring'] == '1') {
         $cur_topic['subject'] = Utils::censor($cur_topic['subject']);
     }
     $quickpost = $this->model->is_quickpost($cur_topic['post_replies'], $cur_topic['closed'], $is_admmod);
     $subscraction = $this->model->get_subscraction($cur_topic['is_subscribed'], $id);
     $lang_bbeditor = array('btnBold' => __('btnBold'), 'btnItalic' => __('btnItalic'), 'btnUnderline' => __('btnUnderline'), 'btnColor' => __('btnColor'), 'btnLeft' => __('btnLeft'), 'btnRight' => __('btnRight'), 'btnJustify' => __('btnJustify'), 'btnCenter' => __('btnCenter'), 'btnLink' => __('btnLink'), 'btnPicture' => __('btnPicture'), 'btnList' => __('btnList'), 'btnQuote' => __('btnQuote'), 'btnCode' => __('btnCode'), 'promptImage' => __('promptImage'), 'promptUrl' => __('promptUrl'), 'promptQuote' => __('promptQuote'));
     $this->feather->template->addAsset('canonical', $this->feather->urlFor('Forum', ['id' => $id, 'name' => $url_forum]));
     if ($num_pages > 1) {
         if ($p > 1) {
             $this->feather->template->addAsset('prev', $this->feather->urlFor('ForumPaginate', ['id' => $id, 'name' => $url_forum, 'page' => intval($p - 1)]));
         }
         if ($p < $num_pages) {
             $this->feather->template->addAsset('next', $this->feather->urlFor('ForumPaginate', ['id' => $id, 'name' => $url_forum, 'page' => intval($p + 1)]));
         }
     }
     if ($this->feather->forum_settings['o_feed_type'] == '1') {
         $this->feather->template->addAsset('feed', 'extern.php?action=feed&amp;fid=' . $id . '&amp;type=rss', array('title' => __('RSS forum feed')));
     } elseif ($this->feather->forum_settings['o_feed_type'] == '2') {
         $this->feather->template->addAsset('feed', 'extern.php?action=feed&amp;fid=' . $id . '&amp;type=atom', array('title' => __('Atom forum feed')));
     }
     $this->feather->template->setPageInfo(array('title' => array(Utils::escape($this->feather->forum_settings['o_board_title']), Utils::escape($cur_topic['forum_name']), Utils::escape($cur_topic['subject'])), 'active_page' => 'Topic', 'page_number' => $p, 'paging_links' => $paging_links, 'is_indexed' => true, 'id' => $id, 'pid' => $pid, 'tid' => $id, 'fid' => $cur_topic['forum_id'], 'post_data' => $this->model->print_posts($id, $start_from, $cur_topic, $is_admmod), 'cur_topic' => $cur_topic, 'subscraction' => $subscraction, 'post_link' => $post_link, 'start_from' => $start_from, 'lang_antispam' => $lang_antispam, 'quickpost' => $quickpost, 'index_questions' => $index_questions, 'lang_antispam_questions' => $lang_antispam_questions, 'lang_bbeditor' => $lang_bbeditor, 'url_forum' => $url_forum, 'url_topic' => $url_topic))->addTemplate('Topic.php')->display();
     // Increment "num_views" for topic
     $this->model->increment_views($id);
 }
コード例 #2
0
ファイル: Forum.php プロジェクト: bohwaz/featherbb
 public function display($fid, $name = null, $page = null)
 {
     // Fetch some informations about the forum
     $cur_forum = $this->model->get_info_forum($fid);
     // Is this a redirect forum? In that case, redirect!
     if ($cur_forum['redirect_url'] != '') {
         header('Location: ' . $cur_forum['redirect_url']);
         exit;
     }
     // Sort out who the moderators are and if we are currently a moderator (or an admin)
     $mods_array = $cur_forum['moderators'] != '' ? unserialize($cur_forum['moderators']) : array();
     $is_admmod = $this->feather->user->g_id == $this->feather->forum_env['FEATHER_ADMIN'] || $this->feather->user->g_moderator == '1' && array_key_exists($this->feather->user->username, $mods_array) ? true : false;
     $sort_by = $this->model->sort_forum_by($cur_forum['sort_by']);
     // Can we or can we not post new topics?
     if ($cur_forum['post_topics'] == '' && $this->feather->user->g_post_topics == '1' || $cur_forum['post_topics'] == '1' || $is_admmod) {
         $post_link = "\t\t\t" . '<p class="postlink conr"><a href="' . $this->feather->urlFor('newTopic', ['fid' => $fid]) . '">' . __('Post topic') . '</a></p>' . "\n";
     } else {
         $post_link = '';
     }
     // Determine the topic offset (based on $page)
     $num_pages = ceil($cur_forum['num_topics'] / $this->feather->user->disp_topics);
     $p = !isset($page) || $page <= 1 || $page > $num_pages ? 1 : intval($page);
     $start_from = $this->feather->user->disp_topics * ($p - 1);
     $url_forum = Url::url_friendly($cur_forum['forum_name']);
     // Generate paging links
     $paging_links = '<span class="pages-label">' . __('Pages') . ' </span>' . Url::paginate($num_pages, $p, 'forum/' . $fid . '/' . $url_forum . '/#');
     $forum_actions = $this->model->get_forum_actions($fid, $this->feather->forum_settings['o_forum_subscriptions'], $cur_forum['is_subscribed']);
     $this->feather->template->addAsset('canonical', $this->feather->urlFor('Forum', ['id' => $fid, 'name' => $url_forum]));
     if ($num_pages > 1) {
         if ($p > 1) {
             $this->feather->template->addAsset('prev', $this->feather->urlFor('ForumPaginate', ['id' => $fid, 'name' => $url_forum, 'page' => intval($p - 1)]));
         }
         if ($p < $num_pages) {
             $this->feather->template->addAsset('next', $this->feather->urlFor('ForumPaginate', ['id' => $fid, 'name' => $url_forum, 'page' => intval($p + 1)]));
         }
     }
     if ($this->feather->forum_settings['o_feed_type'] == '1') {
         $this->feather->template->addAsset('feed', 'extern.php?action=feed&amp;fid=' . $fid . '&amp;type=rss', array('title' => __('RSS forum feed')));
     } elseif ($this->feather->forum_settings['o_feed_type'] == '2') {
         $this->feather->template->addAsset('feed', 'extern.php?action=feed&amp;fid=' . $fid . '&amp;type=atom', array('title' => __('Atom forum feed')));
     }
     $this->feather->template->setPageInfo(array('title' => array(Utils::escape($this->feather->forum_settings['o_board_title']), Utils::escape($cur_forum['forum_name'])), 'active_page' => 'Forum', 'page_number' => $p, 'paging_links' => $paging_links, 'is_indexed' => true, 'id' => $fid, 'fid' => $fid, 'forum_data' => $this->model->print_topics($fid, $sort_by, $start_from), 'cur_forum' => $cur_forum, 'post_link' => $post_link, 'start_from' => $start_from, 'url_forum' => $url_forum, 'forum_actions' => $forum_actions))->addTemplate('Forum.php')->display();
 }
コード例 #3
0
 public function show($conv_id = null, $page = null)
 {
     // First checks
     if ($conv_id < 1) {
         throw new Error('Wrong conversation ID', 400);
     }
     if (!($conv = $this->model->getConversation($conv_id, $this->feather->user->id))) {
         throw new Error('Unknown conversation ID', 404);
     } else {
         if ($this->model->isDeleted($conv_id, $this->feather->user->id)) {
             throw new Error('The conversation has been deleted', 404);
         }
     }
     // Set conversation as viewed
     if ($conv['viewed'] == 0) {
         if (!$this->model->setViewed($conv_id, $this->feather->user->id)) {
             throw new Error('Unable to set conversation as viewed', 500);
         }
     }
     $num_pages = ceil($conv['num_replies'] / $this->feather->user['disp_topics']);
     $p = !is_null($page) || $page <= 1 || $page > $num_pages ? 1 : intval($page);
     $start_from = $this->feather->user['disp_topics'] * ($p - 1);
     $paging_links = Url::paginate($num_pages, $p, $this->feather->urlFor('Conversations.show', ['tid' => $conv_id]) . '/#');
     $this->inboxes = $this->model->getInboxes($this->feather->user->id);
     $this->crumbs[$this->feather->urlFor('Conversations.home', ['inbox_id' => $conv['folder_id']])] = $this->inboxes[$conv['folder_id']]['name'];
     $this->crumbs[] = __('My conversations', 'private_messages');
     $this->crumbs[] = $conv['subject'];
     Utils::generateBreadcrumbs($this->crumbs, array('link' => $this->feather->urlFor('Conversations.reply', ['tid' => $conv['id']]), 'text' => __('Reply', 'private_messages')));
     $this->generateMenu($this->inboxes[$conv['folder_id']]['name']);
     $this->feather->template->setPageInfo(array('title' => array(Utils::escape($this->feather->config['o_board_title']), __('PMS', 'private_messages'), $this->model->getUserFolders($this->feather->user->id)[$conv['folder_id']]['name'], Utils::escape($conv['subject'])), 'admin_console' => true, 'paging_links' => $paging_links, 'start_from' => $start_from, 'cur_conv' => $conv, 'rightLink' => ['link' => $this->feather->urlFor('Conversations.reply', ['tid' => $conv['id']]), 'text' => __('Reply', 'private_messages')], 'messages' => $this->model->getMessages($conv['id'], $this->feather->user['disp_topics'], $start_from)))->addTemplate('show.php')->display();
 }
コード例 #4
0
ファイル: Search.php プロジェクト: bohwaz/featherbb
 public function display_search_results($search)
 {
     $search = $this->hook->fire('display_search_results_start', $search);
     // Get topic/forum tracking data
     if (!$this->user->is_guest) {
         $tracked_topics = Track::get_tracked_topics();
     }
     $post_count = $topic_count = 0;
     foreach ($search['search_set'] as $cur_search) {
         $forum_name = Url::url_friendly($cur_search['forum_name']);
         $forum = '<a href="' . $this->feather->urlFor('Forum', ['id' => $cur_search['forum_id'], 'name' => $forum_name]) . '">' . Utils::escape($cur_search['forum_name']) . '</a>';
         $url_topic = Url::url_friendly($cur_search['subject']);
         if ($this->config['o_censoring'] == '1') {
             $cur_search['subject'] = Utils::censor($cur_search['subject']);
         }
         if ($search['show_as'] == 'posts') {
             ++$post_count;
             $cur_search['icon_type'] = 'icon';
             if (!$this->user->is_guest && $cur_search['last_post'] > $this->user->last_visit && (!isset($tracked_topics['topics'][$cur_search['tid']]) || $tracked_topics['topics'][$cur_search['tid']] < $cur_search['last_post']) && (!isset($tracked_topics['forums'][$cur_search['forum_id']]) || $tracked_topics['forums'][$cur_search['forum_id']] < $cur_search['last_post'])) {
                 $cur_search['item_status'] = 'inew';
                 $cur_search['icon_type'] = 'icon icon-new';
                 $cur_search['icon_text'] = __('New icon');
             } else {
                 $cur_search['item_status'] = '';
                 $cur_search['icon_text'] = '<!-- -->';
             }
             if ($this->config['o_censoring'] == '1') {
                 $cur_search['message'] = Utils::censor($cur_search['message']);
             }
             $cur_search['message'] = $this->feather->parser->parse_message($cur_search['message'], $cur_search['hide_smilies']);
             $pposter = Utils::escape($cur_search['pposter']);
             if ($cur_search['poster_id'] > 1 && $this->user->g_view_users == '1') {
                 $cur_search['pposter_disp'] = '<strong><a href="' . $this->feather->urlFor('userProfile', ['id' => $cur_search['poster_id']]) . '">' . $pposter . '</a></strong>';
             } else {
                 $cur_search['pposter_disp'] = '<strong>' . $pposter . '</strong>';
             }
             $this->feather->template->setPageInfo(array('post_count' => $post_count, 'url_topic' => $url_topic, 'cur_search' => $cur_search, 'forum' => $forum));
         } else {
             ++$topic_count;
             $status_text = array();
             $cur_search['item_status'] = $topic_count % 2 == 0 ? 'roweven' : 'rowodd';
             $cur_search['icon_type'] = 'icon';
             $subject = '<a href="' . $this->feather->urlFor('Topic', ['id' => $cur_search['tid'], 'name' => $url_topic]) . '">' . Utils::escape($cur_search['subject']) . '</a> <span class="byuser">' . __('by') . ' ' . Utils::escape($cur_search['poster']) . '</span>';
             if ($cur_search['sticky'] == '1') {
                 $cur_search['item_status'] .= ' isticky';
                 $status_text[] = '<span class="stickytext">' . __('Sticky') . '</span>';
             }
             if ($cur_search['closed'] != '0') {
                 $status_text[] = '<span class="closedtext">' . __('Closed') . '</span>';
                 $cur_search['item_status'] .= ' iclosed';
             }
             if (!$this->user->is_guest && $cur_search['last_post'] > $this->user->last_visit && (!isset($tracked_topics['topics'][$cur_search['tid']]) || $tracked_topics['topics'][$cur_search['tid']] < $cur_search['last_post']) && (!isset($tracked_topics['forums'][$cur_search['forum_id']]) || $tracked_topics['forums'][$cur_search['forum_id']] < $cur_search['last_post'])) {
                 $cur_search['item_status'] .= ' inew';
                 $cur_search['icon_type'] = 'icon icon-new';
                 $subject = '<strong>' . $subject . '</strong>';
                 $subject_new_posts = '<span class="newtext">[ <a href="' . $this->feather->urlFor('topicAction', ['id' => $cur_search['tid'], 'action' => 'new']) . '" title="' . __('New posts info') . '">' . __('New posts') . '</a> ]</span>';
             } else {
                 $subject_new_posts = null;
             }
             // Insert the status text before the subject
             $subject = implode(' ', $status_text) . ' ' . $subject;
             $num_pages_topic = ceil(($cur_search['num_replies'] + 1) / $this->user->disp_posts);
             if ($num_pages_topic > 1) {
                 $subject_multipage = '<span class="pagestext">[ ' . Url::paginate($num_pages_topic, -1, 'topic/' . $cur_search['tid'] . '/' . $url_topic . '/#') . ' ]</span>';
             } else {
                 $subject_multipage = null;
             }
             // Should we show the "New posts" and/or the multipage links?
             if (!empty($subject_new_posts) || !empty($subject_multipage)) {
                 $subject .= !empty($subject_new_posts) ? ' ' . $subject_new_posts : '';
                 $subject .= !empty($subject_multipage) ? ' ' . $subject_multipage : '';
             }
             if (!isset($cur_search['start_from'])) {
                 $start_from = 0;
             } else {
                 $start_from = $cur_search['start_from'];
             }
             $this->feather->template->setPageInfo(array('cur_search' => $cur_search, 'start_from' => $start_from, 'topic_count' => $topic_count, 'subject' => $subject, 'forum' => $forum, 'post_count' => $post_count, 'url_topic' => $url_topic));
         }
     }
     $search = $this->hook->fire('display_search_results', $search);
 }
コード例 #5
0
ファイル: Moderate.php プロジェクト: bohwaz/featherbb
 public function display_topics($fid, $sort_by, $start_from)
 {
     $this->hook->fire('display_topics_start', $fid, $sort_by, $start_from);
     $topic_data = array();
     // Get topic/forum tracking data
     if (!$this->user->is_guest) {
         $tracked_topics = Track::get_tracked_topics();
     }
     // Retrieve a list of topic IDs, LIMIT is (really) expensive so we only fetch the IDs here then later fetch the remaining data
     $result = DB::for_table('topics')->select('id')->where('forum_id', $fid)->order_by_expr('sticky DESC, ' . $sort_by)->limit($this->user->disp_topics)->offset($start_from);
     $result = $this->hook->fireDB('display_topics_list_ids', $result);
     $result = $result->find_many();
     // If there are topics in this forum
     if ($result) {
         foreach ($result as $id) {
             $topic_ids[] = $id['id'];
         }
         unset($result);
         // Select topics
         $result['select'] = array('id', 'poster', 'subject', 'posted', 'last_post', 'last_post_id', 'last_poster', 'num_views', 'num_replies', 'closed', 'sticky', 'moved_to');
         $result = DB::for_table('topics')->select_many($result['select'])->where_in('id', $topic_ids)->order_by_desc('sticky')->order_by_expr($sort_by)->order_by_desc('id');
         $result = $this->hook->fireDB('display_topics_query', $result);
         $result = $result->find_many();
         $topic_count = 0;
         foreach ($result as $cur_topic) {
             ++$topic_count;
             $status_text = array();
             $cur_topic['item_status'] = $topic_count % 2 == 0 ? 'roweven' : 'rowodd';
             $cur_topic['icon_type'] = 'icon';
             $url_topic = Url::url_friendly($cur_topic['subject']);
             if (is_null($cur_topic['moved_to'])) {
                 $cur_topic['last_post_disp'] = '<a href="' . $this->feather->urlFor('viewPost', ['pid' => $cur_topic['last_post_id']]) . '#p' . $cur_topic['last_post_id'] . '">' . $this->feather->utils->format_time($cur_topic['last_post']) . '</a> <span class="byuser">' . __('by') . ' ' . Utils::escape($cur_topic['last_poster']) . '</span>';
                 $cur_topic['ghost_topic'] = false;
             } else {
                 $cur_topic['last_post_disp'] = '- - -';
                 $cur_topic['ghost_topic'] = true;
             }
             if ($this->config['o_censoring'] == '1') {
                 $cur_topic['subject'] = Utils::censor($cur_topic['subject']);
             }
             if ($cur_topic['sticky'] == '1') {
                 $cur_topic['item_status'] .= ' isticky';
                 $status_text[] = '<span class="stickytext">' . __('Sticky') . '</span>';
             }
             if ($cur_topic['moved_to'] != 0) {
                 $cur_topic['subject_disp'] = '<a href="' . $this->feather->urlFor('Topic', ['id' => $cur_topic['moved_to'], 'name' => $url_topic]) . '">' . Utils::escape($cur_topic['subject']) . '</a> <span class="byuser">' . __('by') . ' ' . Utils::escape($cur_topic['poster']) . '</span>';
                 $status_text[] = '<span class="movedtext">' . __('Moved') . '</span>';
                 $cur_topic['item_status'] .= ' imoved';
             } elseif ($cur_topic['closed'] == '0') {
                 $cur_topic['subject_disp'] = '<a href="' . $this->feather->urlFor('Topic', ['id' => $cur_topic['id'], 'name' => $url_topic]) . '">' . Utils::escape($cur_topic['subject']) . '</a> <span class="byuser">' . __('by') . ' ' . Utils::escape($cur_topic['poster']) . '</span>';
             } else {
                 $cur_topic['subject_disp'] = '<a href="' . $this->feather->urlFor('Topic', ['id' => $cur_topic['id'], 'name' => $url_topic]) . '">' . Utils::escape($cur_topic['subject']) . '</a> <span class="byuser">' . __('by') . ' ' . Utils::escape($cur_topic['poster']) . '</span>';
                 $status_text[] = '<span class="closedtext">' . __('Closed') . '</span>';
                 $cur_topic['item_status'] .= ' iclosed';
             }
             if (!$cur_topic['ghost_topic'] && $cur_topic['last_post'] > $this->user->last_visit && (!isset($tracked_topics['topics'][$cur_topic['id']]) || $tracked_topics['topics'][$cur_topic['id']] < $cur_topic['last_post']) && (!isset($tracked_topics['forums'][$fid]) || $tracked_topics['forums'][$fid] < $cur_topic['last_post'])) {
                 $cur_topic['item_status'] .= ' inew';
                 $cur_topic['icon_type'] = 'icon icon-new';
                 $cur_topic['subject_disp'] = '<strong>' . $cur_topic['subject_disp'] . '</strong>';
                 $subject_new_posts = '<span class="newtext">[ <a href="' . $this->feather->urlFor('Topic', ['id' => $cur_topic['id'], 'action' => 'new']) . '" title="' . __('New posts info') . '">' . __('New posts') . '</a> ]</span>';
             } else {
                 $subject_new_posts = null;
             }
             // Insert the status text before the subject
             $cur_topic['subject_disp'] = implode(' ', $status_text) . ' ' . $cur_topic['subject_disp'];
             $num_pages_topic = ceil(($cur_topic['num_replies'] + 1) / $this->user->disp_posts);
             if ($num_pages_topic > 1) {
                 $subject_multipage = '<span class="pagestext">[ ' . Url::paginate($num_pages_topic, -1, 'topic/' . $cur_topic['id'] . '/' . $url_topic . '/#') . ' ]</span>';
             } else {
                 $subject_multipage = null;
             }
             // Should we show the "New posts" and/or the multipage links?
             if (!empty($subject_new_posts) || !empty($subject_multipage)) {
                 $cur_topic['subject_disp'] .= !empty($subject_new_posts) ? ' ' . $subject_new_posts : '';
                 $cur_topic['subject_disp'] .= !empty($subject_multipage) ? ' ' . $subject_multipage : '';
             }
             $topic_data[] = $cur_topic;
         }
     }
     $topic_data = $this->hook->fire('display_topics', $topic_data);
     return $topic_data;
 }
コード例 #6
0
ファイル: Topic.php プロジェクト: featherbb/featherbb
 public function moderate($req, $res, $args)
 {
     Container::get('hooks')->fire('controller.topic.moderate');
     // Make sure that only admmods allowed access this page
     $forumModel = new \FeatherBB\Model\Forum();
     $moderators = $forumModel->get_moderators($args['id']);
     $mods_array = $moderators != '' ? unserialize($moderators) : array();
     if (User::get()->g_id != ForumEnv::get('FEATHER_ADMIN') && (User::get()->g_moderator == '0' || !array_key_exists(User::get()->username, $mods_array))) {
         throw new Error(__('No permission'), 403);
     }
     $cur_topic = $this->model->get_topic_info($args['fid'], $args['id']);
     // Determine the post offset (based on $_GET['p'])
     $num_pages = ceil(($cur_topic['num_replies'] + 1) / User::get()->disp_posts);
     $p = !isset($args['page']) || $args['page'] <= 1 || $args['page'] > $num_pages ? 1 : intval($args['page']);
     $start_from = User::get()->disp_posts * ($p - 1);
     // Delete one or more posts
     if (Input::post('delete_posts_comply')) {
         return $this->model->delete_posts($args['id'], $args['fid']);
     } else {
         if (Input::post('delete_posts')) {
             $posts = $this->model->delete_posts($args['id'], $args['fid']);
             View::setPageInfo(array('title' => array(Utils::escape(ForumSettings::get('o_board_title')), __('Moderate')), 'active_page' => 'moderate', 'posts' => $posts))->addTemplate('moderate/delete_posts.php')->display();
         } else {
             if (Input::post('split_posts_comply')) {
                 return $this->model->split_posts($args['id'], $args['fid'], $p);
             } else {
                 if (Input::post('split_posts')) {
                     View::setPageInfo(array('title' => array(Utils::escape(ForumSettings::get('o_board_title')), __('Moderate')), 'focus_element' => array('subject', 'new_subject'), 'page' => $p, 'active_page' => 'moderate', 'id' => $args['id'], 'posts' => $this->model->split_posts($args['id'], $args['fid'], $p), 'list_forums' => $this->model->get_forum_list_split($args['fid'])))->addTemplate('moderate/split_posts.php')->display();
                 } else {
                     // Show the moderate posts view
                     // Used to disable the Move and Delete buttons if there are no replies to this topic
                     $button_status = $cur_topic['num_replies'] == 0 ? ' disabled="disabled"' : '';
                     /*if (isset($_GET['action']) && $_GET['action'] == 'all') {
                               User::get()->disp_posts = $cur_topic['num_replies'] + 1;
                       }*/
                     if (ForumSettings::get('o_censoring') == '1') {
                         $cur_topic['subject'] = Utils::censor($cur_topic['subject']);
                     }
                     View::setPageInfo(array('title' => array(Utils::escape(ForumSettings::get('o_board_title')), Utils::escape($cur_topic['forum_name']), Utils::escape($cur_topic['subject'])), 'page' => $p, 'active_page' => 'moderate', 'cur_topic' => $cur_topic, 'url_topic' => Url::url_friendly($cur_topic['subject']), 'url_forum' => Url::url_friendly($cur_topic['forum_name']), 'fid' => $args['fid'], 'id' => $args['id'], 'paging_links' => '<span class="pages-label">' . __('Pages') . ' </span>' . Url::paginate($num_pages, $p, 'topic/moderate/' . $args['id'] . '/forum/' . $args['fid'] . '/#'), 'post_data' => $this->model->display_posts_moderate($args['id'], $start_from), 'button_status' => $button_status, 'start_from' => $start_from))->addTemplate('moderate/posts_view.php')->display();
                 }
             }
         }
     }
 }
コード例 #7
0
ファイル: Forum.php プロジェクト: featherbb/featherbb
 public function moderate($req, $res, $args)
 {
     Container::get('hooks')->fire('controller.forum.moderate');
     // Make sure that only admmods allowed access this page
     $moderators = $this->model->get_moderators($args['fid']);
     $mods_array = $moderators != '' ? unserialize($moderators) : array();
     if (User::get()->g_id != ForumEnv::get('FEATHER_ADMIN') && (User::get()->g_moderator == '0' || !array_key_exists(User::get()->username, $mods_array))) {
         throw new Error(__('No permission'), 403);
     }
     // Fetch some info about the forum
     $cur_forum = $this->model->get_forum_info($args['fid']);
     // Is this a redirect forum? In that case, abort!
     if ($cur_forum['redirect_url'] != '') {
         throw new Error(__('Bad request'), '404');
     }
     $sort_by = $this->model->sort_forum_by($cur_forum['sort_by']);
     // Determine the topic offset (based on $_GET['p'])
     $num_pages = ceil($cur_forum['num_topics'] / User::get()->disp_topics);
     $p = !isset($args['page']) || $args['page'] <= 1 || $args['page'] > $num_pages ? 1 : intval($args['page']);
     $start_from = User::get()->disp_topics * ($p - 1);
     $url_forum = Url::url_friendly($cur_forum['forum_name']);
     View::setPageInfo(array('title' => array(Utils::escape(ForumSettings::get('o_board_title')), Utils::escape($cur_forum['forum_name'])), 'active_page' => 'moderate', 'page' => $p, 'id' => $args['fid'], 'p' => $p, 'url_forum' => $url_forum, 'cur_forum' => $cur_forum, 'paging_links' => '<span class="pages-label">' . __('Pages') . ' </span>' . Url::paginate($num_pages, $p, 'forum/moderate/' . $args['fid'] . '/#'), 'topic_data' => $this->model->display_topics_moderate($args['fid'], $sort_by, $start_from), 'start_from' => $start_from))->addTemplate('moderate/moderator_forum.php')->display();
 }
コード例 #8
0
ファイル: Moderate.php プロジェクト: bohwaz/featherbb
 public function display($id, $name = null, $page = null)
 {
     // Make sure that only admmods allowed access this page
     $moderators = $this->model->get_moderators($id);
     $mods_array = $moderators != '' ? unserialize($moderators) : array();
     if ($this->user->g_id != $this->feather->forum_env['FEATHER_ADMIN'] && ($this->user->g_moderator == '0' || !array_key_exists($this->user->username, $mods_array))) {
         throw new Error(__('No permission'), 403);
     }
     // Fetch some info about the forum
     $cur_forum = $this->model->get_forum_info($id);
     // Is this a redirect forum? In that case, abort!
     if ($cur_forum['redirect_url'] != '') {
         throw new Error(__('Bad request'), '404');
     }
     $sort_by = $this->model->forum_sort_by($cur_forum['sort_by']);
     // Determine the topic offset (based on $_GET['p'])
     $num_pages = ceil($cur_forum['num_topics'] / $this->user->disp_topics);
     $p = !isset($page) || $page <= 1 || $page > $num_pages ? 1 : intval($page);
     $start_from = $this->user->disp_topics * ($p - 1);
     $url_forum = Url::url_friendly($cur_forum['forum_name']);
     $this->feather->template->setPageInfo(array('title' => array(Utils::escape($this->config['o_board_title']), Utils::escape($cur_forum['forum_name'])), 'active_page' => 'moderate', 'page' => $p, 'id' => $id, 'p' => $p, 'url_forum' => $url_forum, 'cur_forum' => $cur_forum, 'paging_links' => '<span class="pages-label">' . __('Pages') . ' </span>' . Url::paginate($num_pages, $p, 'moderate/forum/' . $id . '/#'), 'topic_data' => $this->model->display_topics($id, $sort_by, $start_from), 'start_from' => $start_from))->addTemplate('moderate/moderator_forum.php')->display();
 }