当前位置: 首页>>代码示例>>PHP>>正文


PHP Input::query方法代码示例

本文整理汇总了PHP中Input::query方法的典型用法代码示例。如果您正苦于以下问题:PHP Input::query方法的具体用法?PHP Input::query怎么用?PHP Input::query使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Input的用法示例。


在下文中一共展示了Input::query方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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();
 }
开发者ID:featherbb,项目名称:featherbb,代码行数:25,代码来源:Maintenance.php

示例2: get_query_str

 public function get_query_str()
 {
     $query_str = '';
     $per_page = Input::query('i_per_page') ? intval(Input::query('i_per_page')) : 0;
     $per_page = Container::get('hooks')->fire('model.admin.maintenance.get_query_str.per_page', $per_page);
     $start_at = Input::query('i_start_at') ? intval(Input::query('i_start_at')) : 0;
     $start_at = Container::get('hooks')->fire('model.admin.maintenance.get_query_str.start_at', $start_at);
     // Fetch posts to process this cycle
     $result['select'] = array('p.id', 'p.message', 't.subject', 't.first_post_id');
     $result = DB::for_table('posts')->table_alias('p')->select_many($result['select'])->inner_join('topics', array('t.id', '=', 'p.topic_id'), 't')->where_gte('p.id', $start_at)->order_by_asc('p.id')->limit($per_page);
     $result = Container::get('hooks')->fireDB('model.admin.maintenance.get_query_str.query', $result);
     $result = $result->find_many();
     $end_at = 0;
     foreach ($result as $cur_item) {
         echo '<p><span>' . sprintf(__('Processing post'), $cur_item['id']) . '</span></p>' . "\n";
         if ($cur_item['id'] == $cur_item['first_post_id']) {
             $this->search->update_search_index('post', $cur_item['id'], $cur_item['message'], $cur_item['subject']);
         } else {
             $this->search->update_search_index('post', $cur_item['id'], $cur_item['message']);
         }
         $end_at = $cur_item['id'];
     }
     // Check if there is more work to do
     if ($end_at > 0) {
         $id = DB::for_table('posts')->where_gt('id', $end_at)->order_by_asc('id')->find_one_col('id');
         if ($id) {
             $query_str = '?action=rebuild&i_per_page=' . $per_page . '&i_start_at=' . intval($id);
         }
     }
     $pdo = DB::get_db();
     $pdo = null;
     $query_str = Container::get('hooks')->fire('model.admin.maintenance.get_query_str', $query_str);
     return $query_str;
 }
开发者ID:featherbb,项目名称:featherbb,代码行数:34,代码来源:Maintenance.php

示例3: 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();
     }
 }
开发者ID:featherbb,项目名称:featherbb,代码行数:28,代码来源:Search.php

示例4: 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=' . urlencode($username) . '&amp;show_group=' . $show_group . '&amp;sort_by=' . $sort_by . '&amp;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();
 }
开发者ID:featherbb,项目名称:featherbb,代码行数:26,代码来源:Userlist.php

示例5: get_set

 public function get_set($lang = null)
 {
     if (isset($lang) && $this->checkLang($lang)) {
         Config::set('application.language', $lang);
     } else {
         Config::set('application.language', $this->default);
     }
     $url = Input::query('redirect_to', '/');
     return Redirect::to($url);
 }
开发者ID:jvillasante,项目名称:cubanartjb,代码行数:10,代码来源:language.php

示例6: index

 public function index()
 {
     $this->layout->body_class = '';
     $zip_code = Input::query('zip_code', '');
     $distance = Input::query('distance', '50');
     if (empty($zip_code)) {
         $this->findLocation();
         $zip_code = Session::get('zip_code', '');
     }
     Session::put('zip_code', $zip_code);
     Session::put('distance', $distance);
     $data = array('search_text' => '', 'zip_code' => $zip_code, 'distance' => $distance, 'status' => $this->getStatus(), 'makes' => $this->getPropertiesList(Make::orderBy('make')->get(), 'make'), 'bodies' => $this->getPropertiesList(Body::orderBy('body')->get(), 'body'), 'transmissions' => $this->getPropertiesList(Transmission::orderBy('transmission')->get(), 'transmission'), 'drives' => $this->getPropertiesList(Drive::orderBy('drive')->get(), 'drive'), 'interiors' => $this->getPropertiesList(Interior::orderBy('interior', 'DESC')->take(10)->get(), 'interior'), 'exteriors' => $this->getPropertiesList(Exterior::orderBy('exterior', 'DESC')->take(10)->get(), 'exterior'), 'fuels' => $this->getPropertiesList(Fuel::orderBy('fuel')->get(), 'fuel'), 'doors_count' => $this->getDoorsCounts(), 'cylinders_count' => $this->getCylindersCounts());
     $this->layout->contents = View::make('search/search-advanced', $data);
 }
开发者ID:apetrailmukesh,项目名称:bootstrap,代码行数:14,代码来源:AdvancedController.php

示例7: display

 public function display($req, $res, $args)
 {
     Container::get('hooks')->fire('controller.admin.bans.display');
     // Display bans
     if (Input::query('find_ban')) {
         $ban_info = $this->model->find_ban();
         // Determine the ban offset (based on $_GET['p'])
         $num_pages = ceil($ban_info['num_bans'] / 50);
         $p = !Input::query('p') || Input::query('p') <= 1 || Input::query('p') > $num_pages ? 1 : intval(Input::query('p'));
         $start_from = 50 * ($p - 1);
         $ban_data = $this->model->find_ban($start_from);
         View::setPageInfo(array('admin_console' => true, 'page' => $p, 'title' => array(Utils::escape(ForumSettings::get('o_board_title')), __('Admin'), __('Bans'), __('Results head')), 'paging_links' => '<span class="pages-label">' . __('Pages') . ' </span>' . Url::paginate_old($num_pages, $p, '?find_ban=&amp;' . implode('&amp;', $ban_info['query_str'])), 'ban_data' => $ban_data['data']))->addTemplate('admin/bans/search_ban.php')->display();
     } else {
         AdminUtils::generateAdminMenu('bans');
         View::setPageInfo(array('admin_console' => true, 'focus_element' => array('bans', 'new_ban_user'), 'title' => array(Utils::escape(ForumSettings::get('o_board_title')), __('Admin'), __('Bans'))))->addTemplate('admin/bans/admin_bans.php')->display();
     }
 }
开发者ID:featherbb,项目名称:featherbb,代码行数:17,代码来源:Bans.php

示例8: getFilterUrlAttribute

 public function getFilterUrlAttribute()
 {
     $current_filters = Input::query();
     if (array_key_exists('financing', $current_filters)) {
         if (!is_array($current_filters['financing'])) {
             $current_filters['financing'] = [$current_filters['financing']];
         }
         if (in_array($this->id, $current_filters['financing'])) {
             unset($current_filters['financing'][array_search($this->id, $current_filters['financing'])]);
             $new_filter = array();
         } else {
             $new_filter = array('financing' => array($this->id));
         }
     } else {
         $new_filter = array('financing' => array($this->id));
     }
     $query = array_filter(array_merge_recursive($current_filters, $new_filter));
     return URL::route('schools.index', $query);
 }
开发者ID:mertindervish,项目名称:registerbg,代码行数:19,代码来源:Financing.php

示例9: promote_user

 public function promote_user($id)
 {
     $id = Container::get('hooks')->fire('model.profile.promote_user_start', $id);
     $pid = Input::query('pid') ? intval(Input::query('pid')) : 0;
     // Find the group ID to promote the user to
     $next_group_id = DB::for_table('groups')->table_alias('g')->inner_join('users', array('u.group_id', '=', 'g.g_id'), 'u')->where('u.id', $id);
     $next_group_id = Container::get('hooks')->fireDB('model.profile.promote_user_group_id', $next_group_id);
     $next_group_id = $next_group_id->find_one_col('g.g_promote_next_group');
     if (!$next_group_id) {
         throw new Error(__('Bad request'), 404);
     }
     // Update the user
     $update_user = DB::for_table('users')->where('id', $id)->find_one()->set('group_id', $next_group_id);
     $update_user = Container::get('hooks')->fireDB('model.profile.promote_user_query', $update_user);
     $update_user = $update_user->save();
     $pid = Container::get('hooks')->fire('model.profile.promote_user', $pid);
     return Router::redirect(Router::pathFor('viewPost', ['pid' => $pid]) . '#p' . $pid, __('User promote redirect'));
 }
开发者ID:featherbb,项目名称:featherbb,代码行数:18,代码来源:Profile.php

示例10: find_ban

 public function find_ban($start_from = false)
 {
     $ban_info = array();
     Container::get('hooks')->fire('model.admin.bans.find_ban_start');
     // trim() all elements in $form
     $ban_info['conditions'] = $ban_info['query_str'] = array();
     $expire_after = Input::query('expire_after') ? Utils::trim(Input::query('expire_after')) : '';
     $expire_before = Input::query('expire_before') ? Utils::trim(Input::query('expire_before')) : '';
     $ban_info['order_by'] = Input::query('order_by') && in_array(Input::query('order_by'), array('username', 'ip', 'email', 'expire')) ? 'b.' . Input::query('order_by') : 'b.username';
     $ban_info['direction'] = Input::query('direction') && Input::query('direction') == 'DESC' ? 'DESC' : 'ASC';
     $ban_info['query_str'][] = 'order_by=' . $ban_info['order_by'];
     $ban_info['query_str'][] = 'direction=' . $ban_info['direction'];
     // Build the query
     $result = DB::for_table('bans')->table_alias('b')->where_gt('b.id', 0);
     // Try to convert date/time to timestamps
     if ($expire_after != '') {
         $ban_info['query_str'][] = 'expire_after=' . $expire_after;
         $expire_after = strtotime($expire_after);
         if ($expire_after === false || $expire_after == -1) {
             throw new Error(__('Invalid date message'), 400);
         }
         $result = $result->where_gt('b.expire', $expire_after);
     }
     if ($expire_before != '') {
         $ban_info['query_str'][] = 'expire_before=' . $expire_before;
         $expire_before = strtotime($expire_before);
         if ($expire_before === false || $expire_before == -1) {
             throw new Error(__('Invalid date message'), 400);
         }
         $result = $result->where_lt('b.expire', $expire_before);
     }
     if (Input::query('username')) {
         $result = $result->where_like('b.username', str_replace('*', '%', Input::query('username')));
         $ban_info['query_str'][] = 'username=' . urlencode(Input::query('username'));
     }
     if (Input::query('ip')) {
         $result = $result->where_like('b.ip', str_replace('*', '%', Input::query('ip')));
         $ban_info['query_str'][] = 'ip=' . urlencode(Input::query('ip'));
     }
     if (Input::query('email')) {
         $result = $result->where_like('b.email', str_replace('*', '%', Input::query('email')));
         $ban_info['query_str'][] = 'email=' . urlencode(Input::query('email'));
     }
     if (Input::query('message')) {
         $result = $result->where_like('b.message', str_replace('*', '%', Input::query('message')));
         $ban_info['query_str'][] = 'message=' . urlencode(Input::query('message'));
     }
     // Fetch ban count
     if (is_numeric($start_from)) {
         $ban_info['data'] = array();
         $select_bans = array('b.id', 'b.username', 'b.ip', 'b.email', 'b.message', 'b.expire', 'b.ban_creator', 'ban_creator_username' => 'u.username');
         $result = $result->select_many($select_bans)->left_outer_join('users', array('b.ban_creator', '=', 'u.id'), 'u')->order_by($ban_info['order_by'], $ban_info['direction'])->offset($start_from)->limit(50)->find_many();
         foreach ($result as $cur_ban) {
             $ban_info['data'][] = $cur_ban;
         }
     } else {
         $ban_info['num_bans'] = $result->count('id');
     }
     Container::get('hooks')->fire('model.admin.bans.find_ban', $ban_info);
     return $ban_info;
 }
开发者ID:featherbb,项目名称:featherbb,代码行数:61,代码来源:Bans.php

示例11:

<input type="text" name="dvs-filters[<?php 
echo $filterName;
?>
]" data-dvs-replacement="<?php 
echo $replacementSelector;
?>
" value="<?php 
echo Input::query('dvs-filters[' . $filterName . ']');
?>
" <?php 
echo $attributes;
?>
>
开发者ID:devisephp,项目名称:cms,代码行数:13,代码来源:sort-filter.blade.php

示例12: get_search_results

 public function get_search_results()
 {
     $search = array();
     $search = Container::get('hooks')->fire('model.search.get_search_results_start', $search);
     $action = Input::query('action') ? Input::query('action') : null;
     $forums = Input::query('forums') ? is_array(Input::query('forums')) ? Input::query('forums') : array_filter(explode(',', Input::query('forums'))) : (Input::query('forums') ? array(Input::query('forums')) : array());
     $sort_dir = Input::query('sort_dir') && Input::query('sort_dir') == 'DESC' ? 'DESC' : 'ASC';
     $forums = array_map('intval', $forums);
     // Allow the old action names for backwards compatibility reasons
     if ($action == 'show_user') {
         $action = 'show_user_posts';
     } elseif ($action == 'show_24h') {
         $action = 'show_recent';
     }
     // If a search_id was supplied
     if (Input::query('search_id')) {
         $search_id = intval(Input::query('search_id'));
         if ($search_id < 1) {
             throw new Error(__('Bad request'), 400);
         }
     } elseif ($action == 'search') {
         $keywords = Input::query('keywords') ? utf8_strtolower(Utils::trim(Input::query('keywords'))) : null;
         $author = Input::query('author') ? utf8_strtolower(Utils::trim(Input::query('author'))) : null;
         if (preg_match('%^[\\*\\%]+$%', $keywords) || Utils::strlen(str_replace(array('*', '%'), '', $keywords)) < ForumEnv::get('FEATHER_SEARCH_MIN_WORD') && !$this->search->is_cjk($keywords)) {
             $keywords = '';
         }
         if (preg_match('%^[\\*\\%]+$%', $author) || Utils::strlen(str_replace(array('*', '%'), '', $author)) < 2) {
             $author = '';
         }
         if (!$keywords && !$author) {
             throw new Error(__('No terms'), 400);
         }
         if ($author) {
             $author = str_replace('*', '%', $author);
         }
         $show_as = Input::query('show_as') && Input::query('show_as') == 'topics' ? 'topics' : 'posts';
         $sort_by = Input::query('sort_by') ? intval(Input::query('sort_by')) : 0;
         $search_in = !Input::query('search_in') || Input::query('search_in') == '0' ? 0 : (Input::query('search_in') == '1' ? 1 : -1);
     } elseif ($action == 'show_user_posts' || $action == 'show_user_topics' || $action == 'show_subscriptions') {
         $user_id = Input::query('user_id') ? intval(Input::query('user_id')) : User::get()->id;
         if ($user_id < 2) {
             throw new Error(__('Bad request'), 404);
         }
         // Subscribed topics can only be viewed by admins, moderators and the users themselves
         if ($action == 'show_subscriptions' && !User::get()->is_admmod && $user_id != User::get()->id) {
             throw new Error(__('No permission'), 403);
         }
     } elseif ($action == 'show_recent') {
         $interval = Input::query('value') ? intval(Input::query('value')) : 86400;
     } elseif ($action == 'show_replies') {
         if (User::get()->is_guest) {
             throw new Error(__('Bad request'), 404);
         }
     } elseif ($action != 'show_new' && $action != 'show_unanswered') {
         throw new Error(__('Bad request'), 404);
     }
     // If a valid search_id was supplied we attempt to fetch the search results from the db
     if (isset($search_id)) {
         $ident = User::get()->is_guest ? Utils::getIp() : User::get()->username;
         $search_data = DB::for_table('search_cache')->where('id', $search_id)->where('ident', $ident);
         $search_data = Container::get('hooks')->fireDB('model.search.get_search_results_search_data_query', $search_data);
         $search_data = $search_data->find_one_col('search_data');
         if ($search_data) {
             $temp = unserialize($search_data);
             $temp = Container::get('hooks')->fire('model.search.get_search_results_temp', $temp);
             $search_ids = unserialize($temp['search_ids']);
             $num_hits = $temp['num_hits'];
             $sort_by = $temp['sort_by'];
             $sort_dir = $temp['sort_dir'];
             $show_as = $temp['show_as'];
             $search_type = $temp['search_type'];
             unset($temp);
         } else {
             throw new Error(__('No hits'), 404);
         }
     } else {
         $keyword_results = $author_results = array();
         // Search a specific forum?
         $forum_sql = !empty($forums) || empty($forums) && ForumSettings::get('o_search_all_forums') == '0' && !User::get()->is_admmod ? ' AND t.forum_id IN (' . implode(',', $forums) . ')' : '';
         if (!empty($author) || !empty($keywords)) {
             // Flood protection
             if (User::get()->last_search && time() - User::get()->last_search < User::get()->g_search_flood && time() - User::get()->last_search >= 0) {
                 throw new Error(sprintf(__('Search flood'), User::get()->g_search_flood, User::get()->g_search_flood - (time() - User::get()->last_search)), 429);
             }
             if (!User::get()->is_guest) {
                 $update_last_search = DB::for_table('users')->where('id', User::get()->id);
             } else {
                 $update_last_search = DB::for_table('online')->where('ident', Utils::getIp());
             }
             $update_last_search = Container::get('hooks')->fireDB('model.search.get_search_results_update_last_search', $update_last_search);
             $update_last_search = $update_last_search->update_many('last_search', time());
             switch ($sort_by) {
                 case 1:
                     $sort_by_sql = $show_as == 'topics' ? 't.poster' : 'p.poster';
                     $sort_type = SORT_STRING;
                     break;
                 case 2:
                     $sort_by_sql = 't.subject';
                     $sort_type = SORT_STRING;
                     break;
//.........这里部分代码省略.........
开发者ID:featherbb,项目名称:featherbb,代码行数:101,代码来源:Search.php

示例13: validateField

 /**
  * API for model field frontend validation
  * @return json
  */
 public function validateField()
 {
     // get field to validate
     $field = key(Input::query());
     // create validator
     $validator = Validator::make(Input::all(), Role::$rules);
     $messages = $validator->messages();
     if ($messages->has($field)) {
         // return error message
         //return json_encode(array("error"=>$messages->first($field)));
         return Response::make(array("error" => $messages->first($field)), 404);
     }
     return Response::make(array(), 200);
 }
开发者ID:hilmysyarif,项目名称:laravel-easyui,代码行数:18,代码来源:RoleController.php

示例14: validateField

 /**
  * API for model field frontend validation
  * @return json
  */
 public function validateField()
 {
     // get field to validate
     $field = key(Input::query());
     // create validator
     $validator = Validator::make(Input::all(), Functionalscope::$rules);
     $messages = $validator->messages();
     if ($messages->has($field)) {
         // return error message
         return json_encode(array("error" => $messages->first($field)));
     } else {
         // return true
         return json_encode(array("success" => ''));
     }
 }
开发者ID:MiqdadM,项目名称:human-capital,代码行数:19,代码来源:FunctionalscopesController.php

示例15: action

 public function action($req, $res, $args)
 {
     // Include UTF-8 function
     require ForumEnv::get('FEATHER_ROOT') . 'featherbb/Helpers/utf8/substr_replace.php';
     require ForumEnv::get('FEATHER_ROOT') . 'featherbb/Helpers/utf8/ucwords.php';
     // utf8_ucwords needs utf8_substr_replace
     require ForumEnv::get('FEATHER_ROOT') . 'featherbb/Helpers/utf8/strcasecmp.php';
     $args['id'] = Container::get('hooks')->fire('controller.profile.action', $args['id']);
     if ($args['action'] != 'change_pass' || !Input::query('key')) {
         if (User::get()->g_read_board == '0') {
             throw new Error(__('No view'), 403);
         } elseif (User::get()->g_view_users == '0' && (User::get()->is_guest || User::get()->id != $args['id'])) {
             throw new Error(__('No permission'), 403);
         }
     }
     if ($args['action'] == 'change_pass') {
         if (Request::isPost()) {
             // TODO: Check if security "if (User::get()->id != $id)" (l.58 of Model/Profile) isn't bypassed
             // FOR ALL chained if below
             return $this->model->change_pass($args['id']);
         }
         View::setPageInfo(array('title' => array(Utils::escape(ForumSettings::get('o_board_title')), __('Profile'), __('Change pass')), 'active_page' => 'profile', 'id' => $args['id'], 'required_fields' => array('req_old_password' => __('Old pass'), 'req_new_password1' => __('New pass'), 'req_new_password2' => __('Confirm new pass')), 'focus_element' => array('change_pass', !User::get()->is_admmod ? 'req_old_password' : 'req_new_password1')));
         View::addTemplate('profile/change_pass.php')->display();
     } elseif ($args['action'] == 'change_email') {
         if (Request::isPost()) {
             return $this->model->change_email($args['id']);
         }
         View::setPageInfo(array('title' => array(Utils::escape(ForumSettings::get('o_board_title')), __('Profile'), __('Change email')), 'active_page' => 'profile', 'required_fields' => array('req_new_email' => __('New email'), 'req_password' => __('Password')), 'focus_element' => array('change_email', 'req_new_email'), 'id' => $args['id']));
         View::addTemplate('profile/change_mail.php')->display();
     } elseif ($args['action'] == 'upload_avatar' || $args['action'] == 'upload_avatar2') {
         if (ForumSettings::get('o_avatars') == '0') {
             throw new Error(__('Avatars disabled'), 400);
         }
         if (User::get()->id != $args['id'] && !User::get()->is_admmod) {
             throw new Error(__('No permission'), 403);
         }
         if (Request::isPost()) {
             return $this->model->upload_avatar($args['id'], $_FILES);
         }
         View::setPageInfo(array('title' => array(Utils::escape(ForumSettings::get('o_board_title')), __('Profile'), __('Upload avatar')), 'active_page' => 'profile', 'required_fields' => array('req_file' => __('File')), 'focus_element' => array('upload_avatar', 'req_file'), 'id' => $args['id']));
         View::addTemplate('profile/upload_avatar.php')->display();
     } elseif ($args['action'] == 'delete_avatar') {
         if (User::get()->id != $args['id'] && !User::get()->is_admmod) {
             throw new Error(__('No permission'), 403);
         }
         $this->model->delete_avatar($args['id']);
         return Router::redirect(Router::pathFor('profileSection', array('id' => $args['id'], 'section' => 'personality')), __('Avatar deleted redirect'));
     } elseif ($args['action'] == 'promote') {
         if (User::get()->g_id != ForumEnv::get('FEATHER_ADMIN') && (User::get()->g_moderator != '1' || User::get()->g_mod_promote_users == '0')) {
             throw new Error(__('No permission'), 403);
         }
         $this->model->promote_user($args['id']);
     } else {
         throw new Error(__('Bad request'), 404);
     }
 }
开发者ID:featherbb,项目名称:featherbb,代码行数:56,代码来源:Profile.php


注:本文中的Input::query方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。