public function display() { if ($this->user->g_search == '0') { throw new Error(__('No search permission'), 403); } // Figure out what to do :-) if ($this->request->get('action') || $this->request->get('search_id')) { $search = $this->model->get_search_results(); // We have results to display if (isset($search['is_result'])) { $this->feather->template->setPageInfo(array('title' => array(Utils::escape($this->config['o_board_title']), __('Search results')), 'active_page' => 'search')); $this->model->display_search_results($search, $this->feather); $this->feather->template->setPageInfo(array('search' => $search)); $this->feather->template->addTemplate('search/header.php', 1); if ($search['show_as'] == 'posts') { $this->feather->template->addTemplate('search/posts.php', 5); } else { $this->feather->template->addTemplate('search/topics.php', 5); } $this->feather->template->addTemplate('search/footer.php', 10)->display(); } else { Url::redirect($this->feather->urlFor('search'), __('No hits')); } } else { $this->feather->template->setPageInfo(array('title' => array(Utils::escape($this->config['o_board_title']), __('Search')), 'active_page' => 'search', 'focus_element' => array('search', 'keywords'), 'is_indexed' => true, 'forums' => $this->model->get_list_forums()))->addTemplate('search/form.php')->display(); } }
public function display($req, $res, $args) { Container::get('hooks')->fire('controller.search.display'); if (User::get()->g_search == '0') { throw new Error(__('No search permission'), 403); } // Figure out what to do :-) if (Input::query('action') || Input::query('search_id')) { $search = $this->model->get_search_results(); // We have results to display if (!is_object($search) && isset($search['is_result'])) { View::setPageInfo(array('title' => array(Utils::escape(ForumSettings::get('o_board_title')), __('Search results')), 'active_page' => 'search', 'search' => $search, 'footer' => $search)); $display = $this->model->display_search_results($search); View::setPageInfo(array('display' => $display)); View::addTemplate('search/header.php', 1); if ($search['show_as'] == 'posts') { View::addTemplate('search/posts.php', 5); } else { View::addTemplate('search/topics.php', 5); } View::addTemplate('search/footer.php', 10)->display(); } else { return Router::redirect(Router::pathFor('search'), __('No hits')); } } else { View::setPageInfo(array('title' => array(Utils::escape(ForumSettings::get('o_board_title')), __('Search')), 'active_page' => 'search', 'focus_element' => array('search', 'keywords'), 'is_indexed' => true, 'forums' => $this->model->get_list_forums()))->addTemplate('search/form.php')->display(); } }
public function display($req, $res, $args) { Container::get('hooks')->fire('controller.admin.statistics.display'); AdminUtils::generateAdminMenu('index'); $total = $this->model->get_total_size(); return View::setPageInfo(array('title' => array(Utils::escape(ForumSettings::get('o_board_title')), __('Admin'), __('Server statistics')), 'active_page' => 'admin', 'admin_console' => true, 'server_load' => $this->model->get_server_load(), 'num_online' => $this->model->get_num_online(), 'total_size' => $total['size'], 'total_records' => $total['records'], 'php_accelerator' => $this->model->get_php_accelerator()))->addTemplate('admin/statistics.php')->display(); }
public function display($req, $res, $args) { Container::get('hooks')->fire('controller.admin.maintenance.display'); $action = ''; if (Input::post('action')) { $action = Input::post('action'); } elseif (Input::query('action')) { $action = Input::query('action'); } if ($action == 'rebuild') { $this->model->rebuild(); View::setPageInfo(array('page_title' => array(Utils::escape(ForumSettings::get('o_board_title')), __('Rebuilding search index')), 'query_str' => $this->model->get_query_str()))->addTemplate('admin/maintenance/rebuild.php')->display(); } if ($action == 'prune') { $prune_from = Utils::trim(Input::post('prune_from')); $prune_sticky = intval(Input::post('prune_sticky')); AdminUtils::generateAdminMenu('maintenance'); if (Input::post('prune_comply')) { $this->model->prune_comply($prune_from, $prune_sticky); } View::setPageInfo(array('title' => array(Utils::escape(ForumSettings::get('o_board_title')), __('Admin'), __('Prune')), 'active_page' => 'admin', 'admin_console' => true, 'prune_sticky' => $prune_sticky, 'prune_from' => $prune_from, 'prune' => $this->model->get_info_prune($prune_sticky, $prune_from)))->addTemplate('admin/maintenance/prune.php')->display(); } AdminUtils::generateAdminMenu('maintenance'); View::setPageInfo(array('title' => array(Utils::escape(ForumSettings::get('o_board_title')), __('Admin'), __('Maintenance')), 'active_page' => 'admin', 'admin_console' => true, 'first_id' => $this->model->get_first_id(), 'categories' => $this->model->get_categories()))->addTemplate('admin/maintenance/admin_maintenance.php')->display(); }
public function display($req, $res, $args) { Container::get('hooks')->fire('controller.userlist.display'); if (User::get()->g_view_users == '0') { throw new Error(__('No permission'), 403); } // Determine if we are allowed to view post counts $show_post_count = ForumSettings::get('o_show_post_count') == '1' || User::get()->is_admmod ? true : false; $username = Input::query('username') && User::get()->g_search_users == '1' ? Utils::trim(Input::query('username')) : ''; $show_group = Input::query('show_group') ? intval(Input::query('show_group')) : -1; $sort_by = Input::query('sort_by') && (in_array(Input::query('sort_by'), array('username', 'registered')) || Input::query('sort_by') == 'num_posts' && $show_post_count) ? Input::query('sort_by') : 'username'; $sort_dir = Input::query('sort_dir') && Input::query('sort_dir') == 'DESC' ? 'DESC' : 'ASC'; $num_users = $this->model->fetch_user_count($username, $show_group); // Determine the user offset (based on $page) $num_pages = ceil($num_users / 50); $p = !Input::query('p') || $page <= 1 || $page > $num_pages ? 1 : intval($page); $start_from = 50 * ($p - 1); if (User::get()->g_search_users == '1') { $focus_element = array('userlist', 'username'); } else { $focus_element = array(); } // Generate paging links $paging_links = '<span class="pages-label">' . __('Pages') . ' </span>' . Url::paginate_old($num_pages, $p, '?username='******'&show_group=' . $show_group . '&sort_by=' . $sort_by . '&sort_dir=' . $sort_dir); View::setPageInfo(array('title' => array(Utils::escape(ForumSettings::get('o_board_title')), __('User list')), 'active_page' => 'userlist', 'page_number' => $p, 'paging_links' => $paging_links, 'focus_element' => $focus_element, 'is_indexed' => true, 'username' => $username, 'show_group' => $show_group, 'sort_by' => $sort_by, 'sort_dir' => $sort_dir, 'show_post_count' => $show_post_count, 'dropdown_menu' => $this->model->generate_dropdown_menu($show_group), 'userlist_data' => $this->model->print_users($username, $start_from, $sort_by, $sort_dir, $show_group)))->addTemplate('userlist.php')->display(); }
public function display() { if ($this->feather->request->isPost()) { $this->model->update_options(); } AdminUtils::generateAdminMenu('options'); $this->feather->template->setPageInfo(array('title' => array(Utils::escape($this->config['o_board_title']), __('Admin'), __('Options')), 'active_page' => 'admin', 'admin_console' => true, 'languages' => $this->model->get_langs(), 'styles' => $this->model->get_styles(), 'times' => $this->model->get_times()))->addTemplate('admin/options.php')->display(); }
public function edit($id) { if ($this->request->post('add_edit_ban')) { $this->model->insert_ban(); } AdminUtils::generateAdminMenu('bans'); $this->feather->template->setPageInfo(array('admin_console' => true, 'focus_element' => array('bans2', 'ban_user'), 'title' => array(Utils::escape($this->config['o_board_title']), __('Admin'), __('Bans')), 'ban' => $this->model->edit_ban_info($id)))->addTemplate('admin/bans/add_ban.php')->display(); }
public function rules() { Container::get('hooks')->fire('controller.index.rules'); if (ForumSettings::get('o_rules') == '0' || User::get()->is_guest && User::get()->g_read_board == '0' && ForumSettings::get('o_regs_allow') == '0') { throw new Error(__('Bad request'), 404); } View::setPageInfo(array('title' => array(Utils::escape(ForumSettings::get('o_board_title')), __('Forum rules')), 'active_page' => 'rules'))->addTemplate('misc/rules.php')->display(); }
public function display($req, $res, $args) { Container::get('hooks')->fire('controller.admin.options.display'); if (Request::isPost()) { return $this->model->update_options(); } AdminUtils::generateAdminMenu('options'); View::setPageInfo(array('title' => array(Utils::escape(ForumSettings::get('o_board_title')), __('Admin'), __('Options')), 'active_page' => 'admin', 'admin_console' => true, 'languages' => $this->model->get_langs(), 'styles' => $this->model->get_styles(), 'times' => $this->model->get_times()))->addTemplate('admin/options.php')->display(); }
public function edit($req, $res, $args) { Container::get('hooks')->fire('controller.admin.bans.edit'); if (Input::post('add_edit_ban')) { return $this->model->insert_ban(); } AdminUtils::generateAdminMenu('bans'); View::setPageInfo(array('admin_console' => true, 'focus_element' => array('bans2', 'ban_user'), 'title' => array(Utils::escape(ForumSettings::get('o_board_title')), __('Admin'), __('Bans')), 'ban' => $this->model->edit_ban_info($args['id'])))->addTemplate('admin/bans/add_ban.php')->display(); }
public function display() { // Update permissions if ($this->feather->request->isPost()) { $this->model->update_permissions(); } AdminUtils::generateAdminMenu('permissions'); $this->feather->template->setPageInfo(array('title' => array(Utils::escape($this->config['o_board_title']), __('Admin'), __('Permissions')), 'active_page' => 'admin', 'admin_console' => true))->addTemplate('admin/permissions.php')->display(); }
public function index($req, $res, $args) { Container::get('hooks')->fire('controller.admin.plugins.index'); View::addAsset('js', 'style/imports/common.js', array('type' => 'text/javascript')); $availablePlugins = Lister::getPlugins(); $activePlugins = Container::get('cache')->isCached('activePlugins') ? Container::get('cache')->retrieve('activePlugins') : array(); $officialPlugins = Lister::getOfficialPlugins(); AdminUtils::generateAdminMenu('plugins'); View::setPageInfo(array('admin_console' => true, 'active_page' => 'admin', 'availablePlugins' => $availablePlugins, 'activePlugins' => $activePlugins, 'officialPlugins' => $officialPlugins, 'title' => array(Utils::escape(ForumSettings::get('o_board_title')), __('Admin'), __('Extension'))))->addTemplate('admin/plugins.php')->display(); }
public function getName($items) { // Split name $classNamespace = explode('\\', get_class($this)); $className = end($classNamespace); // Prettify and return name of child class preg_match_all('%[A-Z]*[a-z]+%m', $className, $result, PREG_PATTERN_ORDER); $items[] = Utils::escape(implode(' ', $result[0])); return $items; }
public function display($req, $res, $args) { Container::get('hooks')->fire('controller.admin.permissions.display'); // Update permissions if (Request::isPost()) { return $this->model->update_permissions(); } AdminUtils::generateAdminMenu('permissions'); return View::setPageInfo(array('title' => array(Utils::escape(ForumSettings::get('o_board_title')), __('Admin'), __('Permissions')), 'active_page' => 'admin', 'admin_console' => true))->addTemplate('admin/permissions.php')->display(); }
public function addedit($id = '') { $groups = $this->model->fetch_groups(); // Add/edit a group (stage 2) if ($this->request->post('add_edit_group')) { $this->model->add_edit_group($groups, $this->feather); } elseif ($this->request->post('add_group') || isset($id)) { AdminUtils::generateAdminMenu('groups'); $group = $this->model->info_add_group($groups, $id); $this->feather->template->setPageInfo(array('title' => array(Utils::escape($this->config['o_board_title']), __('Admin'), __('User groups')), 'active_page' => 'admin', 'admin_console' => true, 'focus_element' => array('groups2', 'req_title'), 'required_fields' => array('req_title' => __('Group title label')), 'group' => $group, 'groups' => $groups, 'id' => $id, 'group_list' => $this->model->get_group_list($groups, $group)))->addTemplate('admin/groups/add_edit_group.php')->display(); } }
public function display() { // Zap a report if ($this->feather->request->isPost()) { $zap_id = intval(key($this->request->post('zap_id'))); $user_id = $this->user->id; $this->model->zap_report($zap_id, $user_id); Url::redirect($this->feather->urlFor('adminReports'), __('Report zapped redirect')); } AdminUtils::generateAdminMenu('reports'); $this->feather->template->setPageInfo(array('title' => array(Utils::escape($this->config['o_board_title']), __('Admin'), __('Reports')), 'active_page' => 'admin', 'admin_console' => true, 'report_data' => $this->model->get_reports(), 'report_zapped_data' => $this->model->get_zapped_reports()))->addTemplate('admin/reports.php')->display(); }
/** * Generate breadcrumbs from an array of name and URLs */ public static function breadcrumbs_admin(array $links) { foreach ($links as $name => $url) { if ($name != '' && $url != '') { $tmp[] = '<span><a href="' . $url . '">' . Utils::escape($name) . '</a></span>'; } else { $tmp[] = '<span>' . __('Deleted') . '</span>'; return implode(' » ', $tmp); } } return implode(' » ', $tmp); }
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&fid=' . $id . '&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&fid=' . $id . '&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); }
public function index() { // AdminUtils::generateAdminMenu('plugins'); $this->feather->template->addAsset('js', 'style/imports/common.js', array('type' => 'text/javascript')); $availablePlugins = Lister::getPlugins(); // var_dump($availablePlugins); $activePlugins = $this->feather->cache->isCached('active_plugins') ? $this->feather->cache->retrieve('active_plugins') : array(); // var_dump($activePlugins); // $this->feather->cache->delete('active_plugins'); AdminUtils::generateAdminMenu('plugins'); $this->feather->template->setPageInfo(array('admin_console' => true, 'active_page' => 'admin', 'availablePlugins' => $availablePlugins, 'activePlugins' => $activePlugins, 'title' => array(Utils::escape($this->config['o_board_title']), __('Admin'), __('Extension'))))->addTemplate('admin/plugins.php')->display(); }
public function display($req, $res, $args) { Container::get('hooks')->fire('controller.admin.reports.display'); // Zap a report if (Request::isPost()) { $zap_id = intval(key(Input::post('zap_id'))); $this->model->zap_report($zap_id); return Router::redirect(Router::pathFor('adminReports'), __('Report zapped redirect')); } AdminUtils::generateAdminMenu('reports'); return View::setPageInfo(array('title' => array(Utils::escape(ForumSettings::get('o_board_title')), __('Admin'), __('Reports')), 'active_page' => 'admin', 'admin_console' => true, 'report_data' => $this->model->get_reports(), 'report_zapped_data' => $this->model->get_zapped_reports()))->addTemplate('admin/reports.php')->display(); }
public function addedit($req, $res, $args) { Container::get('hooks')->fire('controller.admin.groups.addedit'); $groups = $this->model->fetch_groups(); // Add/edit a group (stage 2) if (Input::post('add_edit_group')) { return $this->model->add_edit_group($groups); } elseif (Input::post('add_group') || isset($args['id'])) { AdminUtils::generateAdminMenu('groups'); $group = $this->model->info_add_group($groups, $args['id']); View::setPageInfo(array('title' => array(Utils::escape(ForumSettings::get('o_board_title')), __('Admin'), __('User groups')), 'active_page' => 'admin', 'admin_console' => true, 'focus_element' => array('groups2', 'req_title'), 'required_fields' => array('req_title' => __('Group title label')), 'group' => $group, 'groups' => $groups, 'id' => $args['id'], 'group_list' => $this->model->get_group_list($groups, $group)))->addTemplate('admin/groups/add_edit_group.php')->display(); } }
public function display() { // Add a censor word if ($this->request->post('add_word')) { $this->model->add_word(); } elseif ($this->request->post('update')) { $this->model->update_word(); } elseif ($this->request->post('remove')) { $this->model->remove_word(); } AdminUtils::generateAdminMenu('censoring'); $this->feather->template->setPageInfo(array('title' => array(Utils::escape($this->config['o_board_title']), __('Admin'), __('Censoring')), 'focus_element' => array('censoring', 'new_search_for'), 'active_page' => 'admin', 'admin_console' => true, 'word_data' => $this->model->get_words()))->addTemplate('admin/censoring.php')->display(); }
public function display($req, $res, $args) { Container::get('hooks')->fire('controller.admin.censoring.display'); // Add a censor word if (Input::post('add_word')) { return $this->model->add_word(); } elseif (Input::post('update')) { return $this->model->update_word(); } elseif (Input::post('remove')) { return $this->model->remove_word(); } AdminUtils::generateAdminMenu('censoring'); return View::setPageInfo(array('title' => array(Utils::escape(ForumSettings::get('o_board_title')), __('Admin'), __('Censoring')), 'focus_element' => array('censoring', 'new_search_for'), 'active_page' => 'admin', 'admin_console' => true, 'word_data' => $this->model->get_words()))->addTemplate('admin/censoring.php')->display(); }
public function rules() { // If we are logged in, we shouldn't be here if (!$this->user->is_guest) { Url::redirect($this->feather->urlFor('home')); } // Display an error message if new registrations are disabled if ($this->config['o_regs_allow'] == '0') { throw new Error(__('No new regs'), 403); } if ($this->config['o_rules'] != '1') { Url::redirect($this->feather->urlFor('register')); } $this->feather->template->setPageInfo(array('title' => array(Utils::escape($this->config['o_board_title']), __('Register'), __('Forum rules')), 'active_page' => 'register'))->addTemplate('register/rules.php')->display(); }
public function rules($req, $res, $args) { Container::get('hooks')->fire('controller.register.rules'); // If we are logged in, we shouldn't be here if (!User::get()->is_guest) { return Router::redirect(Router::pathFor('home')); } // Display an error message if new registrations are disabled if (ForumSettings::get('o_regs_allow') == '0') { throw new Error(__('No new regs'), 403); } if (ForumSettings::get('o_rules') != '1') { return Router::redirect(Router::pathFor('register')); } View::setPageInfo(array('title' => array(Utils::escape(ForumSettings::get('o_board_title')), __('Register'), __('Forum rules')), 'active_page' => 'register'))->addTemplate('register/rules.php')->display(); }
public function generate_dropdown_menu($show_group) { $show_group = $this->hook->fire('generate_dropdown_menu_start', $show_group); $dropdown_menu = ''; $result['select'] = array('g_id', 'g_title'); $result = DB::for_table('groups')->select_many($result['select'])->where_not_equal('g_id', $this->feather->forum_env['FEATHER_GUEST'])->order_by('g_id'); $result = $this->hook->fireDB('generate_dropdown_menu_query', $result); $result = $result->find_many(); foreach ($result as $cur_group) { if ($cur_group['g_id'] == $show_group) { $dropdown_menu .= "\t\t\t\t\t\t\t" . '<option value="' . $cur_group['g_id'] . '" selected="selected">' . Utils::escape($cur_group['g_title']) . '</option>' . "\n"; } else { $dropdown_menu .= "\t\t\t\t\t\t\t" . '<option value="' . $cur_group['g_id'] . '">' . Utils::escape($cur_group['g_title']) . '</option>' . "\n"; } } $dropdown_menu = $this->hook->fire('generate_dropdown_menu', $dropdown_menu); return $dropdown_menu; }
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&fid=' . $fid . '&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&fid=' . $fid . '&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(); }
public function editpost($id) { // Fetch some informations about the post, the topic and the forum $cur_post = $this->model->get_info_edit($id); // Sort out who the moderators are and if we are currently a moderator (or an admin) $mods_array = $cur_post['moderators'] != '' ? unserialize($cur_post['moderators']) : array(); $is_admmod = $this->user->g_id == $this->feather->forum_env['FEATHER_ADMIN'] || $this->user->g_moderator == '1' && array_key_exists($this->user->username, $mods_array) ? true : false; $can_edit_subject = $id == $cur_post['first_post_id']; if ($this->config['o_censoring'] == '1') { $cur_post['subject'] = Utils::censor($cur_post['subject']); $cur_post['message'] = Utils::censor($cur_post['message']); } // Do we have permission to edit this post? if (($this->user->g_edit_posts == '0' || $cur_post['poster_id'] != $this->user->id || $cur_post['closed'] == '1') && !$is_admmod) { throw new Error(__('No permission'), 403); } if ($is_admmod && $this->user->g_id != $this->feather->forum_env['FEATHER_ADMIN'] && in_array($cur_post['poster_id'], Utils::get_admin_ids())) { throw new Error(__('No permission'), 403); } // Start with a clean slate $errors = array(); if ($this->feather->request()->isPost()) { // Let's see if everything went right $errors = $this->model->check_errors_before_edit($can_edit_subject, $errors); // Setup some variables before post $post = $this->model->setup_variables($cur_post, $is_admmod, $can_edit_subject, $errors); // Did everything go according to plan? if (empty($errors) && !$this->request->post('preview')) { // Edit the post $this->model->edit_post($id, $can_edit_subject, $post, $cur_post, $is_admmod); Url::redirect($this->feather->urlFor('viewPost', ['pid' => $id]) . '#p' . $id, __('Post redirect')); } } else { $post = ''; } if ($this->request->post('preview')) { $preview_message = $this->feather->parser->parse_message($post['message'], $post['hide_smilies']); } else { $preview_message = ''; } $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->setPageInfo(array('title' => array(Utils::escape($this->config['o_board_title']), __('Edit post')), 'required_fields' => array('req_subject' => __('Subject'), 'req_message' => __('Message')), 'focus_element' => array('edit', 'req_message'), 'cur_post' => $cur_post, 'errors' => $errors, 'preview_message' => $preview_message, 'id' => $id, 'checkboxes' => $this->model->get_checkboxes($can_edit_subject, $is_admmod, $cur_post, 1), 'can_edit_subject' => $can_edit_subject, 'lang_bbeditor' => $lang_bbeditor, 'post' => $post))->addTemplate('edit.php')->display(); }
public function display($action = null) { // Check for upgrade if ($action == 'check_upgrade') { if (!ini_get('allow_url_fopen')) { throw new Error(__('fopen disabled message'), 500); } $latest_version = trim(@file_get_contents('http://featherbb.org/latest_version')); if (empty($latest_version)) { throw new Error(__('Upgrade check failed message'), 500); } if (version_compare($this->config['o_cur_version'], $latest_version, '>=')) { Url::redirect($this->feather->urlFor('adminIndex'), __('Running latest version message')); } else { Url::redirect($this->feather->urlFor('adminIndex'), sprintf(__('New version available message'), '<a href="http://featherbb.org/">FeatherBB.org</a>')); } } AdminUtils::generateAdminMenu('index'); $this->feather->template->setPageInfo(array('title' => array(Utils::escape($this->config['o_board_title']), __('Admin'), __('Index')), 'active_page' => 'admin', 'admin_console' => true))->addTemplate('admin/index.php')->display(); }
public function display($req, $res, $args) { if (!isset($args['action'])) { $args['action'] = null; } Container::get('hooks')->fire('controller.admin.index.display'); // Check for upgrade if ($args['action'] == 'check_upgrade') { if (!ini_get('allow_url_fopen')) { throw new Error(__('fopen disabled message'), 500); } $latest_version = trim(@file_get_contents('http://featherbb.org/latest_version.html')); if (empty($latest_version)) { throw new Error(__('Upgrade check failed message'), 500); } if (version_compare(ForumSettings::get('o_cur_version'), $latest_version, '>=')) { return Router::redirect(Router::pathFor('adminIndex'), __('Running latest version message')); } else { return Router::redirect(Router::pathFor('adminIndex'), sprintf(__('New version available message'), '<a href="http://featherbb.org/">FeatherBB.org</a>')); } } AdminUtils::generateAdminMenu('index'); return View::setPageInfo(array('title' => array(Utils::escape(ForumSettings::get('o_board_title')), __('Admin'), __('Index')), 'active_page' => 'admin', 'admin_console' => true))->addTemplate('admin/index.php')->display(); }