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


PHP Uri::main方法代码示例

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


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

示例1: open

 /**
  * Create a form open tag
  *
  * @param   string|array  action string or array with more tag attribute settings
  * @return  string
  */
 public static function open($attributes = array(), array $hidden = array())
 {
     $attributes = !is_array($attributes) ? array('action' => $attributes) : $attributes;
     // If there is still no action set, Form-post
     if (!array_key_exists('action', $attributes) or $attributes['action'] === null) {
         $attributes['action'] = \Uri::main();
     } elseif (!strpos($attributes['action'], '://')) {
         $attributes['action'] = \Uri::create($attributes['action']);
     }
     if (empty($attributes['accept-charset'])) {
         $attributes['accept-charset'] = strtolower(\Fuel::$encoding);
     }
     // If method is empty, use POST
     !empty($attributes['method']) || ($attributes['method'] = \Config::get('form.form_method', 'post'));
     $form = '<form';
     foreach ($attributes as $prop => $value) {
         $form .= ' ' . $prop . '="' . $value . '"';
     }
     $form .= '>';
     // Add hidden fields when given
     foreach ($hidden as $field => $value) {
         $form .= PHP_EOL . static::hidden($field, $value);
     }
     return $form;
 }
开发者ID:quickpacket,项目名称:noclayer,代码行数:31,代码来源:form.php

示例2: action_index

 /**
  * @author NamNT
  * action index
  */
 public function action_index()
 {
     $model = new \Model_Person();
     $filter = array();
     $data = array();
     if (Input::get()) {
         $filter = Input::get();
         $query_string = http_build_query($filter);
         \Session::set('url_filter_persons', $query_string);
         $person_url = $query_string ? '?' . $query_string : '';
     } else {
         $person_url = '';
     }
     if (Input::get('export', false)) {
         $filter['per_page'] = 100000;
         $download_his = new \Model_Downloadhis();
         $download = array('param' => json_encode($filter), 'content' => json_encode(Input::server()));
         $download_his->set_data($download);
         if ($download_his->save_data()) {
             $this->export($model->get_filter_person($filter));
         }
     }
     $config = ['pagination_url' => \Uri::base() . 'job/persons/index' . $person_url, 'total_items' => $model->count_data($filter), 'per_page' => \Constants::$default_limit_pagination, 'uri_segment' => 'page', 'num_links' => \Constants::$default_num_links, 'show_last' => true];
     \Fuel\Core\Cookie::set('person_url', \Uri::main() . $person_url, 30 * 60);
     $pagination = \Uospagination::forge('mypagination', $config);
     $filter['offset'] = $pagination->offset;
     $filter['limit'] = $pagination->per_page;
     $data['listPerson'] = $model->get_filter_person($filter);
     $data['groups'] = (new \Model_Mgroups())->get_type(1);
     $this->template->title = 'UOS求人システム';
     $this->template->content = \View::forge('persons/persons', $data);
 }
开发者ID:huylv-hust,项目名称:uosbo,代码行数:36,代码来源:persons.php

示例3: action_index

 public function action_index()
 {
     if (!\DBUtil::table_exists('blog') && !\DBUtil::table_exists('blog_comment')) {
         \Response::redirect('blog/installrequired');
     }
     // list posts -----------------------------------------------------------------------------------------------------
     $option['limit'] = \Model_Config::getval('content_items_perpage');
     $option['offset'] = trim(\Input::get('page')) != null ? ((int) \Input::get('page') - 1) * $option['limit'] : 0;
     $list_items = \Blog\Model_Blog::listItems($option);
     // pagination config
     $config['pagination_url'] = \Uri::main() . \Uri::getCurrentQuerystrings(true, true, false);
     $config['total_items'] = $list_items['total'];
     $config['per_page'] = $option['limit'];
     $config['uri_segment'] = 'page';
     $config['num_links'] = 3;
     $config['show_first'] = true;
     $config['show_last'] = true;
     $config['first-inactive'] = "\n\t\t<li class=\"disabled\">{link}</li>";
     $config['first-inactive-link'] = '<a href="#">{page}</a>';
     $config['first-marker'] = '&laquo;';
     $config['last-inactive'] = "\n\t\t<li class=\"disabled\">{link}</li>";
     $config['last-inactive-link'] = '<a href="#">{page}</a>';
     $config['last-marker'] = '&raquo;';
     $config['previous-marker'] = '&lsaquo;';
     $config['next-marker'] = '&rsaquo;';
     $pagination = \Pagination::forge('viewlogins_pagination', $config);
     $output['list_items'] = $list_items;
     $output['pagination'] = $pagination;
     unset($config, $list_accounts, $option, $pagination);
     // <head> output ----------------------------------------------------------------------------------------------
     $output['page_title'] = $this->generateTitle(\Lang::get('blog'));
     // <head> output ----------------------------------------------------------------------------------------------
     return $this->generatePage('blog_v', $output, false);
 }
开发者ID:rundiz,项目名称:fuel-start,代码行数:34,代码来源:blog.php

示例4: __construct

 public function __construct()
 {
     parent::__construct();
     // validate admin logged in
     if (\Model_Accounts::isAdminLogin() == false) {
         \Response::redirect(\Uri::create('admin/login') . '?rdr=' . urlencode(\Uri::main()));
     }
     // load global admin language
     \Lang::load('admin');
 }
开发者ID:rundiz,项目名称:fuel-start,代码行数:10,代码来源:admincontroller.php

示例5: action_index

 public function action_index()
 {
     // log out.
     \Model_Accounts::logout();
     // go back
     if (\Input::referrer() != null && \Input::referrer() != \Uri::main()) {
         \Response::redirect(\Input::referrer());
     } else {
         \Response::redirect(\Uri::base());
     }
 }
开发者ID:rundiz,项目名称:fuel-start,代码行数:11,代码来源:logout.php

示例6: response

 public function response()
 {
     $error_code = $this->getMessage();
     $error_list = Lang::load('error/user', $error_code);
     if (!isset($error_list[$error_code])) {
         $error_code = \Model_Error::ER00001;
     }
     $error_message = $error_list[$error_code];
     $params = array('error_code' => $error_code, 'error_message' => $error_message, 'line' => $this->getLine(), 'file' => $this->getFile(), 'url' => Uri::main(), 'input' => print_r(Input::all(), true), 'real_ip' => Input::real_ip(), 'user_agent' => Input::user_agent(), 'user_id' => Auth::get_user_id(), 'occurred_at' => date('Y/m/d H:i:s'));
     $email = new Model_Email();
     $email->sendMailByParams('error', $params);
     $response = \Request::forge('errors/index', false)->execute($params)->response();
     return $response;
 }
开发者ID:eva-tuantran,项目名称:use-knife-solo-instead-chef-solo-day13,代码行数:14,代码来源:systemexception.php

示例7: fuelStartSortableLink

 /**
  * generate Fuel Start sortable link. it can generate any querystring url.
  *
  * @param array $sortable_data
  * @param array $except_querystring
  * @param string $link
  * @param string $link_text
  * @param array $attributes
  * @param boolean $secure
  * @return string
  */
 public static function fuelStartSortableLink(array $sortable_data = array(), array $except_querystring = array(), $link = null, $link_text = '', array $attributes = array(), $secure = null)
 {
     if ($link == null) {
         $link = \Uri::main();
     }
     if (!is_array($except_querystring)) {
         $except_querystring = array();
     }
     $querystring = array();
     // build querystring of sortable_data
     if (!empty($sortable_data) && is_array($sortable_data)) {
         foreach ($sortable_data as $name => $value) {
             if (!empty($name) || !empty($value)) {
                 $querystring_array[] = $name . '=' . $value;
                 $except_querystring = array_merge($except_querystring, array($name));
             }
         }
         unset($name, $value);
     }
     // build querystring of exists querystring except except_querystring
     $all_querystring = \Uri::getAllQuerystring(true);
     foreach ($all_querystring as $q_name => $q_value) {
         if (!empty($q_name) || !empty($q_value)) {
             if (!in_array(urldecode($q_name), $except_querystring)) {
                 $querystring_array[] = $q_name . '=' . $q_value;
             }
         }
     }
     // endforeach
     unset($all_querystring, $q_name, $q_value);
     if (isset($querystring_array)) {
         $querystring[1] = implode('&amp;', $querystring_array);
     }
     $querystring_str = implode('&amp;', $querystring);
     // if there is querystring. build it as string (name=val&amp;name2=val2...)
     if (!empty($querystring)) {
         $link .= '?' . $querystring_str;
         unset($i, $key, $querystring, $querystring_str, $value);
     }
     // add sorted icons.
     if (isset($sortable_data['orders']) && $sortable_data['orders'] == \Input::get('orders')) {
         if (strtoupper(\Input::get('sort')) == 'ASC') {
             $link_text .= ' <span class="glyphicon glyphicon-sort-by-attributes"></span>';
         } elseif (strtoupper(\Input::get('sort')) == 'DESC') {
             $link_text .= ' <span class="glyphicon glyphicon-sort-by-attributes-alt"></span>';
         }
     }
     return \Html::anchor($link, $link_text, $attributes, $secure);
 }
开发者ID:rundiz,项目名称:fuel-start,代码行数:60,代码来源:html.php

示例8: getAndSetSubmitRedirection

 /**
  * get and set submit redirection url
  * 
  * @return string
  */
 private function getAndSetSubmitRedirection()
 {
     $session = \Session::forge();
     if ($session->get('submitted_redirect') == null) {
         if (\Input::referrer() != null && \Input::referrer() != \Uri::main()) {
             $session->set('submitted_redirect', \Input::referrer());
             return \Input::referrer();
         } else {
             $redirect_uri = 'dbhelper/admin';
             $session->set('submitted_redirect', $redirect_uri);
             return $redirect_uri;
         }
     } else {
         return $session->get('submitted_redirect');
     }
 }
开发者ID:rundiz,项目名称:fuel-start,代码行数:21,代码来源:index.php

示例9: __

" class="btn btn-default btn-sm"><?php 
echo __('account_forgot_username_or_password');
?>
</a>
            </div>
        </div>
    <?php 
echo \Form::close();
?>
 
    
    <hr />
    <h2>Ajax form</h2>
    
    <?php 
echo \Form::open(array('action' => \Uri::main() . (isset($go_to) ? '?rdr=' . $go_to : ''), 'class' => 'form-horizontal ajax-member-login', 'role' => 'form'));
?>
 
        <div class="form-status-placeholder">
            <?php 
if (isset($form_status) && isset($form_status_message)) {
    ?>
 
            <div class="alert alert-<?php 
    echo str_replace('error', 'danger', $form_status);
    ?>
"><button type="button" class="close" data-dismiss="alert">&times;</button><?php 
    echo $form_status_message;
    ?>
</div>
            <?php 
开发者ID:rundiz,项目名称:fuel-start,代码行数:31,代码来源:login_v.php

示例10: action_accountMultisite

 public function action_accountMultisite()
 {
     $act = trim(\Input::post('act'));
     $output = [];
     if (strtolower(\Fuel\Core\Input::method()) == 'post') {
         if ($act == 'createmaintable') {
             $create_table = \Fuel\Core\DBUtil::create_table('testmultisiteaccount', ['id' => ['constraint' => 11, 'type' => 'int', 'auto_increment' => true], 'account_id' => ['constraint' => 11, 'type' => 'int', 'null' => true, 'comment' => 'refer to accounts.account_id'], 'actdate' => ['type' => 'bigint', 'null' => true, 'comment' => 'date/time of record date.']], ['id'], true);
             $output['create_table_result'] = $create_table;
             $output['result'] = true;
         } elseif ($act == 'insertdemodata') {
             // get accounts that is not guest
             $account_result = \DB::select('account_id')->as_object()->from('accounts')->where('account_id', '!=', '0')->execute();
             // get all sites from site table
             $sites_result = \DB::select('site_id')->as_object()->from('sites')->execute();
             $output['tables_data'] = [];
             if ($sites_result != null) {
                 foreach ($sites_result as $site) {
                     if ($site->site_id == '1') {
                         $test_table = 'testmultisiteaccount';
                     } else {
                         $test_table = $site->site_id . '_testmultisiteaccount';
                     }
                     if (\DBUtil::table_exists($test_table)) {
                         \DBUtil::truncate_table($test_table);
                         if ($account_result != null) {
                             foreach ($account_result as $account) {
                                 \DB::insert($test_table)->set(['account_id' => $account->account_id, 'actdate' => time()])->execute();
                             }
                             // endforeach; $account_result
                         }
                         // endif; $account_result
                         // finished insert get data from this table.
                         $this_table_result = \DB::select()->as_object('stdClass')->from($test_table)->limit(10)->order_by('id', 'DESC')->execute()->as_array();
                         $output['tables_data'][$test_table] = $this_table_result;
                         unset($this_table_result);
                     }
                     unset($test_table);
                 }
                 // endforeach; $sites_result
                 $output['result'] = true;
             }
             // endif; $sites_result
             unset($account, $account_result, $site, $sites_result);
         } elseif ($act == 'loaddemodata') {
             // get all sites from site table
             $sites_result = \DB::select('site_id')->as_object()->from('sites')->execute();
             $output['tables_data'] = [];
             if ($sites_result != null) {
                 foreach ($sites_result as $site) {
                     if ($site->site_id == '1') {
                         $test_table = 'testmultisiteaccount';
                     } else {
                         $test_table = $site->site_id . '_testmultisiteaccount';
                     }
                     if (\DBUtil::table_exists($test_table)) {
                         $this_table_result = \DB::select()->as_object('stdClass')->from($test_table)->limit(10)->order_by('id', 'DESC')->execute()->as_array();
                         $output['tables_data'][$test_table] = $this_table_result;
                         unset($this_table_result);
                     }
                 }
                 // endforeach; $sites_result
                 $output['result'] = true;
             }
             // endif; $sites_result
             unset($site, $sites_result);
         } elseif ($act == 'droptable') {
             // get all sites from site table
             $sites_result = \DB::select('site_id')->as_object()->from('sites')->execute();
             if ($sites_result != null) {
                 foreach ($sites_result as $site) {
                     if ($site->site_id == '1') {
                         $test_table = 'testmultisiteaccount';
                     } else {
                         $test_table = $site->site_id . '_testmultisiteaccount';
                     }
                     if (\DBUtil::table_exists($test_table)) {
                         \DBUtil::drop_table($test_table);
                     }
                 }
                 // endforeach; $sites_result
                 $output['result'] = true;
             }
             // endif; $sites_result
             unset($site, $sites_result);
         }
         // endif; $act
         if (\Input::is_ajax()) {
             $response = new \Response();
             // no cache
             $response->set_header('Cache-Control', 'no-cache, no-store, max-age=0, must-revalidate');
             $response->set_header('Cache-Control', 'post-check=0, pre-check=0', false);
             $response->set_header('Expires', 'Sat, 26 Jul 1997 05:00:00 GMT');
             $response->set_header('Pragma', 'no-cache');
             // content type
             $response->set_header('Content-Type', 'application/json');
             // set body
             if ($output == null) {
                 $output = [];
             }
             $response->body(json_encode($output));
//.........这里部分代码省略.........
开发者ID:rundiz,项目名称:fuel-start,代码行数:101,代码来源:index.php

示例11: __

<article class="general-page-container">
    <h1><?php 
echo __('account_confirm_change_email');
?>
</h1>
    
    <?php 
echo \Form::open(array('action' => \Uri::main(), 'class' => 'form-horizontal', 'role' => 'form'));
?>
 
        <div class="form-status-placeholder">
            <?php 
if (isset($form_status) && isset($form_status_message)) {
    ?>
 
            <div class="alert alert-<?php 
    echo str_replace('error', 'danger', $form_status);
    ?>
"><button type="button" class="close" data-dismiss="alert">&times;</button><?php 
    echo $form_status_message;
    ?>
</div>
            <?php 
}
?>
 
        </div>
        <?php 
echo \Extension\NoCsrf::generate();
?>
 
开发者ID:rundiz,项目名称:fuel-start,代码行数:30,代码来源:confirmchangeemail_v.php

示例12: _make_link

 /**
  * Generate a pagination link
  */
 protected function _make_link($page)
 {
     // make sure we have a valid page number
     empty($page) and $page = 1;
     // construct a pagination url if we don't have one
     if (is_null($this->config['pagination_url'])) {
         // start with the main uri
         $this->config['pagination_url'] = \Uri::main();
         \Input::get() and $this->config['pagination_url'] .= '?' . http_build_query(\Input::get());
     }
     // was a placeholder defined in the url?
     if (strpos($this->config['pagination_url'], '{page}') === false) {
         // break the url in bits so we can insert it
         $url = parse_url($this->config['pagination_url']);
         // parse the query string
         if (isset($url['query'])) {
             parse_str($url['query'], $url['query']);
         } else {
             $url['query'] = array();
         }
         // do we have a segment offset due to the base_url containing segments?
         $seg_offset = parse_url(rtrim(\Uri::base(), '/'));
         $seg_offset = empty($seg_offset['path']) ? 0 : count(explode('/', trim($seg_offset['path'], '/')));
         // is the page number a URI segment?
         if (is_numeric($this->config['uri_segment'])) {
             // get the URL segments
             $segs = isset($url['path']) ? explode('/', trim($url['path'], '/')) : array();
             // do we have enough segments to insert? we can't fill in any blanks...
             if (count($segs) < $this->config['uri_segment'] - 1) {
                 throw new \RuntimeException("Not enough segments in the URI, impossible to insert the page number");
             }
             // replace the selected segment with the page placeholder
             $segs[$this->config['uri_segment'] - 1 + $seg_offset] = '{page}';
             $url['path'] = '/' . implode('/', $segs);
         } else {
             // add our placeholder
             $url['query'][$this->config['uri_segment']] = '{page}';
         }
         // re-assemble the url
         $query = empty($url['query']) ? '' : '?' . preg_replace('/%7Bpage%7D/', '{page}', http_build_query($url['query']));
         unset($url['query']);
         empty($url['scheme']) or $url['scheme'] .= '://';
         empty($url['port']) or $url['host'] .= ':';
         $this->config['pagination_url'] = implode($url) . $query;
     }
     // return the page link
     return str_replace('{page}', $page, $this->config['pagination_url']);
 }
开发者ID:cloudetm,项目名称:development,代码行数:51,代码来源:pagination.php

示例13: action_index

 public function action_index()
 {
     // load language
     \Lang::load('account');
     // is user logged in?
     if (\Model_Accounts::isMemberLogin() == false) {
         \Response::redirect(\Uri::create('account/login') . '?rdr=' . urlencode(\Uri::main()));
     }
     // load config from db.
     $cfg_values = array('allow_avatar', 'avatar_size', 'avatar_allowed_types');
     $config = \Model_Config::getvalues($cfg_values);
     $output['config'] = $config;
     // set config data to display in view file.
     $output['allow_avatar'] = $config['allow_avatar']['value'];
     $output['avatar_size'] = $config['avatar_size']['value'];
     $output['avatar_allowed_types'] = $config['avatar_allowed_types']['value'];
     unset($cfg_values);
     // read flash message for display errors. this is REQUIRED if you coding the check login with simultaneous login detection on.
     $form_status = \Session::get_flash('form_status');
     if (isset($form_status['form_status']) && isset($form_status['form_status_message'])) {
         $output['form_status'] = $form_status['form_status'];
         $output['form_status_message'] = $form_status['form_status_message'];
     }
     unset($form_status);
     // get account id
     $cookie_account = \Model_Accounts::forge()->getAccountCookie();
     // get account data
     $query = \Model_Accounts::query()->where('account_id', $cookie_account['account_id'])->where('account_username', $cookie_account['account_username'])->where('account_email', $cookie_account['account_email']);
     if ($query->count() > 0) {
         // found
         $row = $query->get_one();
         $output['row'] = $row;
         // loop set data for display in form.
         foreach ($row as $key => $field) {
             $output[$key] = $field;
         }
         // get account_fields data of current user and send to views form
         // to access data from view, use $account_field['field_name']. for example: the field_name is phone, just use $account_field['phone'];
         $account_fields = \Model_AccountFields::getData($cookie_account['account_id']);
         if ($account_fields->count() > 0) {
             foreach ($account_fields as $af) {
                 $output['account_field'][$af->field_name] = \Extension\Str::isJsonFormat($af->field_value) ? json_decode($af->field_value, true) : $af->field_value;
             }
         }
         unset($account_fields, $af);
         // get timezone list to display.
         \Config::load('timezone', 'timezone');
         $output['timezone_list'] = \Config::get('timezone.timezone', array());
         unset($query);
     } else {
         // not found account.
         unset($cookie_account, $query);
         \Model_Accounts::logout();
         \Response::redirect(\Uri::create('account/login') . '?rdr=' . urlencode(\Uri::main()));
     }
     // if form submitted
     if (\Input::method() == 'POST') {
         // store data for save to db.
         $data['account_id'] = $cookie_account['account_id'];
         $data['account_username'] = $cookie_account['account_username'];
         //trim(\Input::post('account_username'));//no, do not edit username.
         $data['account_old_email'] = $cookie_account['account_email'];
         $data['account_email'] = \Security::strip_tags(trim(\Input::post('account_email')));
         $data['account_password'] = trim(\Input::post('account_password'));
         $data['account_new_password'] = trim(\Input::post('account_new_password'));
         $data['account_display_name'] = \Security::htmlentities(\Input::post('account_display_name'));
         $data['account_firstname'] = \Security::htmlentities(trim(\Input::post('account_firstname', null)));
         if ($data['account_firstname'] == null) {
             $data['account_firstname'] = null;
         }
         $data['account_middlename'] = \Security::htmlentities(trim(\Input::post('account_middlename', null)));
         if ($data['account_middlename'] == null) {
             $data['account_middlename'] = null;
         }
         $data['account_lastname'] = \Security::htmlentities(trim(\Input::post('account_lastname', null)));
         if ($data['account_lastname'] == null) {
             $data['account_lastname'] = null;
         }
         $data['account_birthdate'] = \Security::strip_tags(trim(\Input::post('account_birthdate', null)));
         if ($data['account_birthdate'] == null) {
             $data['account_birthdate'] = null;
         }
         $data['account_signature'] = \Security::htmlentities(trim(\Input::post('account_signature', null)));
         if ($data['account_signature'] == null) {
             $data['account_signature'] = null;
         }
         $data['account_timezone'] = \Security::strip_tags(trim(\Input::post('account_timezone')));
         $data['account_language'] = \Security::strip_tags(trim(\Input::post('account_language', null)));
         if ($data['account_language'] == null) {
             $data['account_language'] = null;
         }
         // store data for account_fields
         $data_field = array();
         if (is_array(\Input::post('account_field'))) {
             foreach (\Input::post('account_field') as $field_name => $field_value) {
                 if (is_string($field_name)) {
                     if (is_array($field_value)) {
                         $field_value = json_encode($field_value);
                     }
                     $data_field[$field_name] = $field_value;
//.........这里部分代码省略.........
开发者ID:rundiz,项目名称:fuel-start,代码行数:101,代码来源:edit.php

示例14: action_index


//.........这里部分代码省略.........
         } elseif (!$validate->run()) {
             // validate failed
             $output['form_status'] = 'error';
             $output['form_status_message'] = $validate->show_errors();
             if (\Input::is_ajax()) {
                 $response = new \Response();
                 $response->set_header('Content-Type', 'application/json');
                 $response->body(json_encode($output));
                 return $response;
             }
         } else {
             // count login failed and wait if it was exceed max failed allowed.
             if (\Session::get('login_all_fail_count', '0') > $config['member_max_login_fail']['value'] && (time() - \Session::get('login_all_fail_time', time())) / 60 <= $config['member_login_fail_wait_time']['value']) {
                 // continuous login failed over max fail limit.
                 $result = Lang::get('account_login_failed_too_many', array('wait_minute' => $config['member_login_fail_wait_time']['value'], 'wait_til_time' => date('d F Y H:i:s', time() + $config['member_login_fail_wait_time']['value'] * 60)));
             } else {
                 // not reach maximum limit
                 // check if show captcha
                 if (isset($output['show_captcha']) && $output['show_captcha'] === true) {
                     include APPPATH . 'vendor' . DS . 'securimage' . DS . 'securimage.php';
                     $securimage = new \Securimage();
                     if ($securimage->check(\Input::post('captcha')) == false) {
                         $result = \Lang::get('account_wrong_captcha_code');
                     }
                 }
                 // try to login. ---------------------------------------------
                 if (!isset($result) || isset($result) && $result == null) {
                     $result = \Model_Accounts::adminLogin($data);
                 }
             }
             // check login result ----------------------------------------------
             if ($result === true) {
                 // success
                 $all_fail_count = 0;
                 \Session::delete('login_all_fail_count');
                 \Session::delete('login_all_fail_time');
                 \Session::delete('show_captcha');
                 if (\Input::is_ajax()) {
                     $output['login_status'] = true;
                     $output['form_status'] = 'success';
                     $output['form_status_message'] = \Lang::get('account_login_success');
                     if (!isset($output['go_to'])) {
                         $output['go_to'] = \Uri::main();
                     } else {
                         $output['go_to'] = urldecode($output['go_to']);
                     }
                     $response = new \Response();
                     $response->set_header('Content-Type', 'application/json');
                     $response->body(json_encode($output));
                     return $response;
                 } else {
                     if (isset($output['go_to'])) {
                         \Response::redirect(urldecode($output['go_to']));
                     } else {
                         \Response::redirect(\Uri::base());
                     }
                 }
             } else {
                 // failed
                 $all_fail_count = \Session::get('login_all_fail_count', '0') + 1;
                 \Session::set('login_all_fail_count', $all_fail_count);
                 \Session::set('login_all_fail_time', time());
                 // if login fail count more than or equal to fail time show captcha
                 if ($all_fail_count >= $this->login_fail_time_show_captcha) {
                     $output['show_captcha'] = true;
                     \Session::set('show_captcha', true);
                 }
                 $output['form_status'] = 'error';
                 $output['form_status_message'] = $result;
                 if (\Input::is_ajax()) {
                     $response = new \Response();
                     $response->set_header('Content-Type', 'application/json');
                     $response->body(json_encode($output));
                     return $response;
                 }
             }
         }
         // re-populate form
         $output['account_identity'] = $data['account_identity'];
     }
     // <head> output ----------------------------------------------------------------------------------------------
     $output['page_title'] = $this->generateTitle(\Lang::get('account_login'));
     $output['page_meta'][] = '<meta name="robots" content="noindex, nofollow" />';
     // <head> output ----------------------------------------------------------------------------------------------
     // breadcrumb -------------------------------------------------------------------------------------------------
     $page_breadcrumb = [];
     $page_breadcrumb[0] = ['name' => \Lang::get('admin_admin_home'), 'url' => \Uri::create('admin')];
     $page_breadcrumb[1] = ['name' => \Lang::get('account_login'), 'url' => \Uri::create('admin/login')];
     $output['page_breadcrumb'] = $page_breadcrumb;
     unset($page_breadcrumb);
     // breadcrumb -------------------------------------------------------------------------------------------------
     if (\Input::is_ajax()) {
         $response = new \Response();
         $response->set_header('Content-Type', 'application/json');
         $response->body(json_encode($output));
         return $response;
     } else {
         return $theme->view('admin/templates/login/index_v', $output, false);
     }
 }
开发者ID:rundiz,项目名称:fuel-start,代码行数:101,代码来源:login.php

示例15: _make_link

 /**
  * リンク生成
  * 
  * Paginationクラスからの改変はコメント部分の一行のみ
  * 
  *  @param int     $page Paginationのページ番号
  *  @return string       URL
  */
 protected function _make_link($page)
 {
     empty($page) and $page = 1;
     if (is_null($this->config['pagination_url'])) {
         $this->config['pagination_url'] = \Uri::main();
         // <<< GET変数の引き継ぎに関するここの一行を削除 >>>
     }
     if (strpos($this->config['pagination_url'], '{page}') === false) {
         $url = parse_url($this->config['pagination_url']);
         if (isset($url['query'])) {
             parse_str($url['query'], $url['query']);
         } else {
             $url['query'] = array();
         }
         $seg_offset = parse_url(rtrim(\Uri::base(), '/'));
         $seg_offset = empty($seg_offset['path']) ? 0 : count(explode('/', trim($seg_offset['path'], '/')));
         if (is_numeric($this->config['uri_segment'])) {
             $segs = isset($url['path']) ? explode('/', trim($url['path'], '/')) : array();
             if (count($segs) < $this->config['uri_segment'] - 1) {
                 throw new \RuntimeException("Not enough segments in the URI, impossible to insert the page number");
             }
             $segs[$this->config['uri_segment'] - 1 + $seg_offset] = '{page}';
             $url['path'] = '/' . implode('/', $segs);
         } else {
             $url['query'][$this->config['uri_segment']] = '{page}';
         }
         $query = empty($url['query']) ? '' : '?' . preg_replace('/%7Bpage%7D/', '{page}', http_build_query($url['query'], '', '&amp;'));
         unset($url['query']);
         empty($url['scheme']) or $url['scheme'] .= '://';
         empty($url['port']) or $url['host'] .= ':';
         $this->config['pagination_url'] = implode($url) . $query;
     }
     return str_replace('{page}', $page, $this->config['pagination_url']);
 }
开发者ID:rrrz,项目名称:pagination-syllabary,代码行数:42,代码来源:syllabary.php


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