コード例 #1
0
ファイル: Maintenance.php プロジェクト: featherbb/featherbb
 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();
 }
コード例 #2
0
ファイル: Statistics.php プロジェクト: featherbb/featherbb
 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();
 }
コード例 #3
0
ファイル: Options.php プロジェクト: bohwaz/featherbb
 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();
 }
コード例 #4
0
ファイル: Bans.php プロジェクト: bohwaz/featherbb
 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();
 }
コード例 #5
0
ファイル: Options.php プロジェクト: featherbb/featherbb
 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();
 }
コード例 #6
0
ファイル: Permissions.php プロジェクト: bohwaz/featherbb
 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();
 }
コード例 #7
0
ファイル: Bans.php プロジェクト: featherbb/featherbb
 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();
 }
コード例 #8
0
ファイル: Permissions.php プロジェクト: featherbb/featherbb
 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();
 }
コード例 #9
0
ファイル: Plugins.php プロジェクト: bohwaz/featherbb
 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();
 }
コード例 #10
0
ファイル: Groups.php プロジェクト: bohwaz/featherbb
 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();
     }
 }
コード例 #11
0
ファイル: Reports.php プロジェクト: featherbb/featherbb
 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();
 }
コード例 #12
0
ファイル: Reports.php プロジェクト: bohwaz/featherbb
 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();
 }
コード例 #13
0
ファイル: Censoring.php プロジェクト: bohwaz/featherbb
 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();
 }
コード例 #14
0
ファイル: Groups.php プロジェクト: featherbb/featherbb
 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();
     }
 }
コード例 #15
0
ファイル: Users.php プロジェクト: featherbb/featherbb
 public function display($req, $res, $args)
 {
     Container::get('hooks')->fire('controller.admin.users.display');
     // Move multiple users to other user groups
     if (Input::post('move_users') || Input::post('move_users_comply')) {
         if (User::get()->g_id > ForumEnv::get('FEATHER_ADMIN')) {
             throw new Error(__('No permission'), 403);
         }
         AdminUtils::generateAdminMenu('users');
         return View::setPageInfo(array('title' => array(Utils::escape(ForumSettings::get('o_board_title')), __('Admin'), __('Users'), __('Move users')), 'active_page' => 'moderate', 'admin_console' => true, 'move' => $this->model->move_users()))->addTemplate('admin/users/move_users.php')->display();
     }
     // Delete multiple users
     if (Input::post('delete_users') || Input::post('delete_users_comply')) {
         if (User::get()->g_id > ForumEnv::get('FEATHER_ADMIN')) {
             throw new Error(__('No permission'), 403);
         }
         AdminUtils::generateAdminMenu('users');
         return View::setPageInfo(array('title' => array(Utils::escape(ForumSettings::get('o_board_title')), __('Admin'), __('Users'), __('Delete users')), 'active_page' => 'moderate', 'admin_console' => true, 'user_ids' => $this->model->delete_users()))->addTemplate('admin/users/delete_users.php')->display();
     }
     // Ban multiple users
     if (Input::post('ban_users') || Input::post('ban_users_comply')) {
         if (User::get()->g_id != ForumEnv::get('FEATHER_ADMIN') && (User::get()->g_moderator != '1' || User::get()->g_mod_ban_users == '0')) {
             throw new Error(__('No permission'), 403);
         }
         AdminUtils::generateAdminMenu('users');
         return View::setPageInfo(array('title' => array(Utils::escape(ForumSettings::get('o_board_title')), __('Admin'), __('Users'), __('Bans')), 'active_page' => 'moderate', 'focus_element' => array('bans2', 'ban_message'), 'admin_console' => true, 'user_ids' => $this->model->ban_users()))->addTemplate('admin/users/ban_users.php')->display();
     }
     // Display bans
     if (Input::query('find_user')) {
         // Return conditions and query string for the URL
         $search = $this->model->get_user_search();
         // Fetch user count
         $num_users = $this->model->get_num_users_search($search['conditions']);
         // Determine the user offset (based on $_GET['p'])
         $num_pages = ceil($num_users / 50);
         $p = !Input::query('p') || Input::query('p') <= 1 || Input::query('p') > $num_pages ? 1 : intval(Input::query('p'));
         $start_from = 50 * ($p - 1);
         // Generate paging links
         $paging_links = '<span class="pages-label">' . __('Pages') . ' </span>' . Url::paginate_old($num_pages, $p, '?find_user=&amp;' . implode('&amp;', $search['query_str']));
         // Some helper variables for permissions
         $can_delete = $can_move = User::get()->g_id == ForumEnv::get('FEATHER_ADMIN');
         $can_ban = User::get()->g_id == ForumEnv::get('FEATHER_ADMIN') || User::get()->g_moderator == '1' && User::get()->g_mod_ban_users == '1';
         $can_action = ($can_delete || $can_ban || $can_move) && $num_users > 0;
         View::addAsset('js', 'style/imports/common.js', array('type' => 'text/javascript'));
         View::setPageInfo(array('title' => array(Utils::escape(ForumSettings::get('o_board_title')), __('Admin'), __('Users'), __('Results head')), 'active_page' => 'admin', 'admin_console' => true, 'paging_links' => $paging_links, 'search' => $search, 'start_from' => $start_from, 'can_delete' => $can_delete, 'can_ban' => $can_ban, 'can_action' => $can_action, 'can_move' => $can_move, 'user_data' => $this->model->print_users($search['conditions'], $search['order_by'], $search['direction'], $start_from)))->addTemplate('admin/users/find_users.php')->display();
     } else {
         AdminUtils::generateAdminMenu('users');
         return View::setPageInfo(array('title' => array(Utils::escape(ForumSettings::get('o_board_title')), __('Admin'), __('Users')), 'active_page' => 'admin', 'admin_console' => true, 'focus_element' => array('find_user', 'form[username]'), 'group_list' => $this->model->get_group_list()))->addTemplate('admin/users/admin_users.php')->display();
     }
 }
コード例 #16
0
ファイル: Censoring.php プロジェクト: featherbb/featherbb
 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();
 }
コード例 #17
0
ファイル: Plugins.php プロジェクト: featherbb/featherbb
 /**
  * Uninstall a plugin after deactivated
  */
 public function uninstall($name)
 {
     $name = Container::get('hooks')->fire('model.plugin.uninstall.name', $name);
     $activePlugins = $this->manager->getActivePlugins();
     // Check if plugin is disabled, for security
     if (!in_array($name, $activePlugins)) {
         $plugin = DB::for_table('plugins')->where('name', $name)->find_one();
         if ($plugin) {
             $plugin->delete();
         }
         // Allow additional uninstalling functions
         $this->manager->uninstall($name);
         if (file_exists(ForumEnv::get('FEATHER_ROOT') . 'plugins' . DIRECTORY_SEPARATOR . $name)) {
             AdminUtils::delete_folder(ForumEnv::get('FEATHER_ROOT') . 'plugins' . DIRECTORY_SEPARATOR . $name);
         }
         $this->manager->setActivePlugins();
     }
     return true;
 }
コード例 #18
0
ファイル: Index.php プロジェクト: bohwaz/featherbb
 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();
 }
コード例 #19
0
ファイル: Maintenance.php プロジェクト: bohwaz/featherbb
 public function display()
 {
     $action = '';
     if ($this->feather->request->post('action')) {
         $action = $this->feather->request->post('action');
     } elseif ($this->feather->request->get('action')) {
         $action = $this->feather->request->get('action');
     }
     if ($action == 'rebuild') {
         $this->model->rebuild();
         $this->feather->template->setPageInfo(array('page_title' => array(Utils::escape($this->feather->forum_settings['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($this->feather->request->post('prune_from'));
         $prune_sticky = intval($this->feather->request->post('prune_sticky'));
         AdminUtils::generateAdminMenu('maintenance');
         if ($this->feather->request->post('prune_comply')) {
             $this->model->prune_comply($prune_from, $prune_sticky);
         }
         $this->feather->template->setPageInfo(array('title' => array(Utils::escape($this->feather->forum_settings['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');
     $this->feather->template->setPageInfo(array('title' => array(Utils::escape($this->feather->forum_settings['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();
 }
コード例 #20
0
ファイル: Index.php プロジェクト: featherbb/featherbb
 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();
 }
コード例 #21
0
ファイル: Statistics.php プロジェクト: bohwaz/featherbb
 public function display()
 {
     AdminUtils::generateAdminMenu('index');
     $total = $this->model->get_total_size();
     $this->feather->template->setPageInfo(array('title' => array(Utils::escape($this->config['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();
 }
コード例 #22
0
ファイル: Forums.php プロジェクト: bohwaz/featherbb
 public function display()
 {
     if ($this->request->post('update_positions')) {
         $this->edit_positions();
     }
     AdminUtils::generateAdminMenu('forums');
     $categories_model = new \FeatherBB\Model\Admin\Categories();
     $this->feather->template->setPageInfo(array('title' => array(Utils::escape($this->config['o_board_title']), __('Admin'), __('Forums')), 'active_page' => 'admin', 'admin_console' => true, 'cat_list' => $categories_model->get_cat_list(), 'forum_data' => $this->model->get_forums(), 'cur_index' => 4))->addTemplate('admin/forums/admin_forums.php')->display();
 }
コード例 #23
0
ファイル: Parser.php プロジェクト: featherbb/featherbb
 public function display($req, $res, $args)
 {
     global $lang_admin_parser;
     Container::get('hooks')->fire('controller.admin.parser.display');
     // Legacy
     require ForumEnv::get('FEATHER_ROOT') . 'featherbb/lang/' . User::get()->language . '/admin/parser.php';
     // This is where the parser data lives and breathes.
     $cache_file = ForumEnv::get('FEATHER_ROOT') . 'cache/cache_parser_data.php';
     // If RESET button pushed, or no cache file, re-compile master bbcode source file.
     if (Input::post('reset') || !file_exists($cache_file)) {
         require_once ForumEnv::get('FEATHER_ROOT') . 'featherbb/Core/parser/bbcd_source.php';
         require_once ForumEnv::get('FEATHER_ROOT') . 'featherbb/Core/parser/bbcd_compile.php';
         return Router::redirect(Router::pathFor('adminParser'), $lang_admin_parser['reset_success']);
     }
     // Load the current BBCode $pd array from featherbb/Core/parser/parser_data.inc.php.
     require_once $cache_file;
     // Fetch $pd compiled global regex data.
     $bbcd = $pd['bbcd'];
     // Local scratch copy of $bbcd.
     $smilies = $pd['smilies'];
     // Local scratch copy of $smilies.
     $config = $pd['config'];
     // Local scratch copy of $config.
     $count = count($bbcd);
     if (Input::post('form_sent')) {
         // Upload new smiley image to style/img/smilies
         if (Input::post('upload') && isset($_FILES['new_smiley']) && isset($_FILES['new_smiley']['error'])) {
             $f = $_FILES['new_smiley'];
             switch ($f['error']) {
                 case 0:
                     // 0: Successful upload.
                     $name = str_replace(' ', '_', $f['name']);
                     // Convert spaces to underscoree.
                     $name = preg_replace('/[^\\w\\-.]/S', '', $name);
                     // Weed out all unsavory filename chars.
                     if (preg_match('/^[\\w\\-.]++$/', $name)) {
                         // If we have a valid filename?
                         if (preg_match('%^image/%', $f['type'])) {
                             // If we have an image file type?
                             if ($f['size'] > 0 && $f['size'] <= ForumSettings::get('o_avatars_size')) {
                                 if (move_uploaded_file($f['tmp_name'], ForumEnv::get('FEATHER_ROOT') . 'style/img/smilies/' . $name)) {
                                     return Router::redirect(Router::pathFor('adminParser'), $lang_admin_parser['upload success']);
                                 } else {
                                     //  Error #1: 'Smiley upload failed. Unable to move to smiley folder.'.
                                     throw new Error($lang_admin_parser['upload_err_1'], 500);
                                 }
                             } else {
                                 // Error #2: 'Smiley upload failed. File is too big.'
                                 throw new Error($lang_admin_parser['upload_err_2'], 400);
                             }
                         } else {
                             // Error #3: 'Smiley upload failed. File type is not an image.'.
                             throw new Error($lang_admin_parser['upload_err_3'], 400);
                         }
                     } else {
                         // Error #4: 'Smiley upload failed. Bad filename.'
                         throw new Error($lang_admin_parser['upload_err_4'], 400);
                     }
                     break;
                 case 1:
                     // case 1 similar to case 2 so fall through...
                 // case 1 similar to case 2 so fall through...
                 case 2:
                     throw new Error($lang_admin_parser['upload_err_2'], 400);
                     // File exceeds MAX_FILE_SIZE.
                 // File exceeds MAX_FILE_SIZE.
                 case 3:
                     throw new Error($lang_admin_parser['upload_err_5'], 400);
                     // File only partially uploaded.
                     //        case 4: break; // No error. Normal response when this form element left empty
                 // File only partially uploaded.
                 //        case 4: break; // No error. Normal response when this form element left empty
                 case 4:
                     throw new Error($lang_admin_parser['upload_err_6'], 400);
                     // No filename.
                 // No filename.
                 case 6:
                     throw new Error($lang_admin_parser['upload_err_7'], 500);
                     // No temp folder.
                 // No temp folder.
                 case 7:
                     throw new Error($lang_admin_parser['upload_err_8'], 500);
                     // Cannot write to disk.
                 // Cannot write to disk.
                 default:
                     throw new Error($lang_admin_parser['upload_err_9'], 500);
                     // Generic/unknown error
             }
         }
         // Set new $config values:
         if (Input::post('config')) {
             $pcfg = Input::post('config');
             if (isset($pcfg['textile'])) {
                 if ($pcfg['textile'] == '1') {
                     $config['textile'] = true;
                 } else {
                     $config['textile'] = false;
                 }
             }
             if (isset($pcfg['quote_links'])) {
                 if ($pcfg['quote_links'] == '1') {
                     $config['quote_links'] = true;
                 } else {
                     $config['quote_links'] = false;
                 }
             }
             if (isset($pcfg['quote_imgs'])) {
                 if ($pcfg['quote_imgs'] == '1') {
                     $config['quote_imgs'] = true;
                 } else {
                     $config['quote_imgs'] = false;
                 }
             }
             if (isset($pcfg['valid_imgs'])) {
                 if ($pcfg['valid_imgs'] == '1') {
                     $config['valid_imgs'] = true;
                 } else {
                     $config['valid_imgs'] = false;
                 }
             }
             if (isset($pcfg['click_imgs'])) {
                 if ($pcfg['click_imgs'] == '1') {
                     $config['click_imgs'] = true;
                 } else {
                     $config['click_imgs'] = false;
                 }
             }
             if (isset($pcfg['max_size']) && preg_match('/^\\d++$/', $pcfg['max_size'])) {
                 $config['max_size'] = (int) $pcfg['max_size'];
             }
             if (isset($pcfg['max_width']) && preg_match('/^\\d++$/', $pcfg['max_width'])) {
                 $config['max_width'] = (int) $pcfg['max_width'];
                 // Limit default to maximum.
                 if ($config['def_width'] > $config['max_width']) {
                     $config['def_width'] = $config['max_width'];
                 }
             }
             if (isset($pcfg['max_height']) && preg_match('/^\\d++$/', $pcfg['max_height'])) {
                 $config['max_height'] = (int) $pcfg['max_height'];
                 // Limit default to maximum.
                 if ($config['def_height'] > $config['max_height']) {
                     $config['def_height'] = $config['max_height'];
                 }
             }
             if (isset($pcfg['def_width']) && preg_match('/^\\d++$/', $pcfg['def_width'])) {
                 $config['def_width'] = (int) $pcfg['def_width'];
                 // Limit default to maximum.
                 if ($config['def_width'] > $config['max_width']) {
                     $config['def_width'] = $config['max_width'];
                 }
             }
             if (isset($pcfg['def_height']) && preg_match('/^\\d++$/', $pcfg['def_height'])) {
                 $config['def_height'] = (int) $pcfg['def_height'];
                 // Limit default to maximum.
                 if ($config['def_height'] > $config['max_height']) {
                     $config['def_height'] = $config['max_height'];
                 }
             }
             if (isset($pcfg['smiley_size']) && preg_match('/^\\s*+(\\d++)\\s*+%?+\\s*+$/', $pcfg['smiley_size'], $m)) {
                 $config['smiley_size'] = (int) $m[1];
                 // Limit default to maximum.
             }
         }
         // Set new $bbcd values:
         foreach ($bbcd as $tagname => $tagdata) {
             if ($tagname == '_ROOT_') {
                 continue;
                 // Skip last pseudo-tag
             }
             $tag =& $bbcd[$tagname];
             if (Input::post($tagname . '_in_post') && Input::post($tagname . '_in_post') == '1') {
                 $tag['in_post'] = true;
             } else {
                 $tag['in_post'] = false;
             }
             if (Input::post($tagname . '_in_sig') && Input::post($tagname . '_in_sig') == '1') {
                 $tag['in_sig'] = true;
             } else {
                 $tag['in_sig'] = false;
             }
             if (Input::post($tagname . '_depth_max') && preg_match('/^\\d++$/', Input::post($tagname . '_depth_max'))) {
                 $tag['depth_max'] = (int) Input::post($tagname . '_depth_max');
             }
         }
         // Set new $smilies values:
         if (Input::post('smiley_text') && is_array(Input::post('smiley_text')) && Input::post('smiley_file') && is_array(Input::post('smiley_file')) && count(Input::post('smiley_text')) === count(Input::post('smiley_file'))) {
             $stext = Input::post('smiley_text');
             $sfile = Input::post('smiley_file');
             $len = count($stext);
             $good = '';
             $smilies = array();
             for ($i = 0; $i < $len; ++$i) {
                 // Loop through all posted smileys.
                 if ($stext[$i] && $sfile !== 'select new file') {
                     $smilies[$stext[$i]] = array('file' => $sfile[$i]);
                 }
             }
         }
         require_once 'featherbb/Core/parser/bbcd_compile.php';
         // Compile $bbcd and save into $pd['bbcd']
         return Router::redirect(Router::pathFor('adminParser'), $lang_admin_parser['save_success']);
     }
     AdminUtils::generateAdminMenu('parser');
     return View::setPageInfo(array('title' => array(Utils::escape(ForumSettings::get('o_board_title')), __('Admin'), __('Parser')), 'active_page' => 'admin', 'admin_console' => true, 'lang_admin_parser' => $lang_admin_parser, 'smiley_files' => $this->model->get_smiley_files(), 'bbcd' => $bbcd, 'config' => $config, 'smilies' => $smilies, 'i' => -1))->addTemplate('admin/parser.php')->display();
 }
コード例 #24
0
ファイル: Forums.php プロジェクト: featherbb/featherbb
 public function display($req, $res, $args)
 {
     Container::get('hooks')->fire('controller.admin.forums.display');
     if (Input::post('update_positions')) {
         $this->edit_positions();
     }
     AdminUtils::generateAdminMenu('forums');
     $categories_model = new \FeatherBB\Model\Admin\Categories();
     View::setPageInfo(array('title' => array(Utils::escape(ForumSettings::get('o_board_title')), __('Admin'), __('Forums')), 'active_page' => 'admin', 'admin_console' => true, 'cat_list' => $categories_model->get_cat_list(), 'forum_data' => $this->model->get_forums(), 'cur_index' => 4))->addTemplate('admin/forums/admin_forums.php')->display();
 }
コード例 #25
0
ファイル: _upgrade.php プロジェクト: featherbb/bbcode-toolbar
<?php

/**
 * Copyright (C) 2015-2016 FeatherBB
 * based on code by (C) 2008-2012 FluxBB
 * and Rickard Andersson (C) 2002-2008 PunBB
 * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
 */
namespace FeatherBB\Plugins;

use FeatherBB\Core\AdminUtils;
// Make sure no one attempts to run this script "directly"
if (isset($upgrade_script)) {
    // Check if 'style' folder from version <= 0.2.2 exists
    if (is_dir(__DIR__ . '/style')) {
        AdminUtils::delete_folder(__DIR__ . '/style');
    }
}
コード例 #26
0
ファイル: Plugins.php プロジェクト: featherbb/featherbb
 /**
  * Load plugin info if it exists
  * @param null $pluginName
  * @throws Error
  */
 public function info($req, $res, $args)
 {
     $formattedPluginName = str_replace('-', '', $args['name']);
     $new = "\\FeatherBB\\Plugins\\Controller\\" . $formattedPluginName;
     if (class_exists($new)) {
         $plugin = new $new();
         if (method_exists($plugin, 'info')) {
             AdminUtils::generateAdminMenu($args['name']);
             return $plugin->info($req, $res, $args);
         } else {
             throw new Error(__('Bad request'), 400);
         }
     } else {
         throw new Error(__('Bad request'), 400);
     }
 }
コード例 #27
0
ファイル: Categories.php プロジェクト: featherbb/featherbb
 public function display($req, $res, $args)
 {
     Container::get('hooks')->fire('controller.admin.categories.display');
     AdminUtils::generateAdminMenu('categories');
     View::setPageInfo(array('title' => array(Utils::escape(ForumSettings::get('o_board_title')), __('Admin'), __('Categories')), 'active_page' => 'admin', 'admin_console' => true, 'cat_list' => $this->model->get_cat_list()))->addTemplate('admin/categories.php')->display();
 }
コード例 #28
0
ファイル: Categories.php プロジェクト: bohwaz/featherbb
 public function display()
 {
     AdminUtils::generateAdminMenu('categories');
     $this->feather->template->setPageInfo(array('title' => array(Utils::escape($this->config['o_board_title']), __('Admin'), __('Categories')), 'active_page' => 'admin', 'admin_console' => true, 'cat_list' => $this->model->get_cat_list()))->addTemplate('admin/categories.php')->display();
 }
コード例 #29
0
ファイル: reports.php プロジェクト: featherbb/featherbb
                <div class="inform">
                    <fieldset>
                        <legend><?php 
        printf(__('Zapped subhead'), Utils::format_time($report['zapped']), $report['zapped_by'] != '' ? '<a href="' . Router::pathFor('userProfile', ['id' => $report['zapped_by_id']]) . '">' . Utils::escape($report['zapped_by']) . '</a>' : __('NA'));
        ?>
</legend>
                        <div class="infldset">
                            <table class="aligntop">
                                <tr>
                                    <th scope="row"><?php 
        printf(__('Reported by'), $report['reporter'] != '' ? '<a href="' . Router::pathFor('userProfile', ['id' => $report['reported_by']]) . '">' . Utils::escape($report['reporter']) . '</a>' : __('Deleted user'));
        ?>
</th>
                                    <td class="location">
                                        <?php 
        echo AdminUtils::breadcrumbs_admin(array($report['forum_name'] => Router::pathFor('Forum', ['id' => $report['forum_id'], 'name' => Url::url_friendly($report['forum_name'])]), $report['subject'] => Router::pathFor('Forum', ['id' => $report['topic_id'], 'name' => Url::url_friendly($report['subject'])]), sprintf(__('Post ID'), $report['pid']) => Router::pathFor('viewPost', ['pid' => $report['pid']]) . '#p' . $report['pid']));
        ?>
                                    </td>
                                </tr>
                                <tr>
                                    <th scope="row"><?php 
        _e('Reason');
        ?>
</th>
                                    <td><?php 
        echo str_replace("\n", '<br />', Utils::escape($report['message']));
        ?>
</td>
                                </tr>
                            </table>
                        </div>