本文整理汇总了PHP中Uri::string方法的典型用法代码示例。如果您正苦于以下问题:PHP Uri::string方法的具体用法?PHP Uri::string怎么用?PHP Uri::string使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Uri
的用法示例。
在下文中一共展示了Uri::string方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: before
public function before()
{
parent::before();
$auth = \Auth::instance('SimpleAuth');
if (\Input::get('logout')) {
$auth->logout();
\Response::redirect(\Uri::base(false) . 'admin/login');
}
$uri = explode('/', \Uri::string());
if ($auth->check()) {
if (count($uri) < 3 && (empty($uri[1]) || $uri[1] == 'login')) {
\Response::redirect(\Uri::base(false) . 'admin/list');
}
// Load admin Config for List View and default to first tab
$this->data['tabs'] = $this->template->tabs = \Config::get('admin.tabs');
$this->data['table'] = $this->param('item', '');
// get item from URI
if (!$this->data['table']) {
list($this->data['table']) = array_slice(array_keys($this->data['tabs']), 0, 1);
}
$this->template->table = $this->data['table'];
} elseif (count($uri) > 1 && $uri[1] != 'login') {
\Response::redirect(\Uri::base(false) . 'admin/login');
}
if ($this->auto_render === true) {
// set up defaults
$this->template->body = '';
}
return true;
}
示例2: before
public function before()
{
if (!\CMF\Auth::check(null, 'view', 'admin_site')) {
\Response::redirect("/admin/login?next=" . \Uri::string(), 'location');
}
\Lang::$autosave = false;
// Find the lang from the session, or from the user
if ($this->lang_enabled = \Config::get('cmf.languages.enabled', false)) {
$lang = \Session::get('cmf.admin.language');
if ($lang === null) {
$user = \CMF\Auth::current_user();
$lang = $user->default_language;
}
if (!empty($lang) && strlen($lang) !== 0 && $lang !== null) {
\CMF::setLang($lang);
}
}
// Allows us to set the interface template via an integer
$this->mode = \Input::param('_mode', 'default');
$this->interface_template = \Config::get('cmf.admin.interface_templates.' . $this->mode);
// A unique ID that can be passed through
$this->cid = \Input::param('_cid', 'none');
// Lang info
$this->current_lang = \Lang::get_lang();
$this->fallback_lang = \Lang::$fallback;
$this->lang_lines = \Lang::$lines;
}
示例3: before
/**
* @param none
* @throws none
* @returns void
*/
public function before()
{
$result = array();
// users need to be logged in to access this controller
if (!\Sentry::check()) {
$result = array('message' => 'You need to be logged in to access that page.', 'url' => '/admin/login');
// Don't show this message if url is just 'admin'
if (\Uri::string() == 'admin/admin/index') {
unset($result['message']);
}
\Session::set('redirect_to', \Uri::admin('current'));
} else {
if (!\Sentry::user()->is_admin()) {
$result = array('message' => 'Access denied. You need to be a member of staff to access that page.', 'url' => '/admin/login');
\Session::set('redirect_to', \Uri::admin('current'));
}
}
if (!empty($result)) {
if (\Input::is_ajax()) {
\Messages::error('You need to be logged in to complete this action.');
echo \Messages::display('left', false);
exit;
} else {
if (isset($result['message'])) {
\Messages::warning($result['message']);
}
\Response::redirect($result['url']);
}
}
parent::before();
}
示例4: before
public function before()
{
$this->nocversion = 'none';
$path = $this->request->route->path;
if ($path != 'auth/login') {
$this->check_license($path);
}
parent::before();
//$auth = Auth::instance();
//Auth::instance()->login('hrvoje','hajduk81');
/*
if(!$this->check_license())
\Response::redirect(\Config::get('base_url').'/ajax/license');
*/
$uri_string = explode('/', Uri::string());
if (count($uri_string) > 1 and $uri_string[0] == 'auth' and $uri_string[1] == 'login') {
return;
}
if ($path != '_root_') {
if (\Sentry::check()) {
$this->user = Sentry::user()->get('id');
$this->username = Sentry::user()->get('username');
return;
} else {
$this->user = false;
$this->username = '';
\Response::redirect(\Config::get('base_url') . 'auth/login');
}
}
}
示例5: before
public function before()
{
parent::before();
if (Request::active()->controller !== 'Controller_Admin' or !in_array(Request::active()->action, array('login', 'logout'))) {
if (Auth::check()) {
} else {
\Cookie::set('redirect_back_url', \Uri::string(), 60 * 10);
\Response::redirect('admin/login');
}
}
}
示例6: before
public function before()
{
parent::before();
$uri_string = explode('/', Uri::string());
$this->template->logged_in = false;
if (count($uri_string) > 1 and $uri_string[0] == 'users' and $uri_string[1] == 'login') {
return;
} else {
if (\Auth::check()) {
$user = \Auth::instance()->get_user_id();
$this->user_id = $user[1];
$this->template->logged_in = true;
} else {
\Response::redirect('/users/login');
}
}
}
示例7: before
public function before()
{
$uri_string = explode('/', Uri::string());
if (count($uri_string) > 1 and $uri_string[0] == 'user' and $uri_string[1] == 'login') {
return;
} else {
$user_id = \Auth\Auth::instance()->get_user_id()[1];
/*($user_id);
exit();*/
if ($user_id) {
$user = Model_User::find($user_id);
if (!$user || $user->group != 100) {
Response::redirect('/user/login');
}
} else {
Response::redirect('/user/login');
}
}
}
示例8: before
public function before()
{
parent::before();
\Session::set("current_page", \Uri::string());
$segments = implode(\Uri::segments());
if (Auth::check() || $segments == 'userlogin') {
list($driver, $user_id) = Auth::get_user_id();
$this->current_user = Model_User::find($user_id);
} else {
if ($segments != 'userlogin') {
Session::set("lastpage", implode("/", \Uri::segments()));
}
$this->current_user = null;
Response::redirect('user/login');
}
if ($segments != 'userlogin') {
View::set_global('group_name', Auth_Group_SimpleGroup::instance()->get_name($this->current_user->group));
View::set_global('current_user', $this->current_user);
}
}
示例9: check_ssl_required_request_and_redirect
protected function check_ssl_required_request_and_redirect()
{
if (IS_SSL) {
return;
}
if (!FBD_SSL_MODE || !in_array(FBD_SSL_MODE, array('ALL', 'PARTIAL'))) {
return;
}
$ssl_url = Uri::create(Uri::string_with_query(), array(), array(), true);
if (FBD_SSL_MODE == 'ALL') {
Response::redirect($ssl_url);
}
$module = Site_Util::get_module_name();
if ($module && in_array($module, conf('ssl_required.modules'))) {
Response::redirect($ssl_url);
}
if (Site_Util::check_ssl_required_uri(Uri::string(), false, false)) {
Response::redirect($ssl_url);
}
}
示例10: action_index
public function action_index()
{
echo 'uri::string = ' . \Uri::string() . '<br><br>';
echo "\n\n";
echo __FILE__ . '<br><br>';
echo "\n\n";
echo '\\' . __NAMESPACE__ . '<br>';
echo "\n";
echo __CLASS__ . '::' . __FUNCTION__ . '<br><br>';
echo "\n\n";
echo \Html::anchor('', 'root') . '<br>';
echo "\n";
echo \Html::anchor('admin', 'root admin') . '<br>';
echo "\n";
echo \Html::anchor('tmd', 'test module') . '<br>';
echo "\n";
echo \Html::anchor('tmd/admin', 'test module admin') . '<br>';
echo "\n";
echo \Html::anchor('tmd/admin/cont', 'test module admin controller') . '<br>';
echo "\n";
}
示例11: action_view
/**
* Display detailed page of Article
*
* @param void
* @access public
* @author Nguyen Van Hiep
*
* @version 1.0
* @since 1.0
*/
public function action_view()
{
$art_check = Model_Article::get_art_from_slug(Uri::segment(2));
if (!$art_check) {
Response::redirect('common/error');
}
$uri = explode('-', Uri::string());
$id = array_pop($uri);
$art = Model_Article::find($id);
$cat = Model_Categories::get_cat_from_slug(Uri::segment(1));
$related_arts = Model_Article::articles_of_cat_limit($cat->id, $this->lang, $id);
if (!$art) {
Session::set_flash('error', __('message.art_not_exist'));
Response::redirect('common/404');
}
$art->views = $art->views + 1;
$art->save();
if ($cat->display_type == DS_SANPHAM) {
$this->template = \View::forge('customer/template_sanpham_detail');
$view = View::forge('customer/article/detail_sp_slide');
} elseif ($cat->display_type == DS_MONAN) {
$this->template = \View::forge('customer/template_monan');
$view = View::forge('customer/article/detail_monan_slide');
} elseif ($cat->display_type == QUY_TRINH_SX) {
$view = View::forge('customer/article/detail_quytrinhsx');
} else {
$view = View::forge('customer/article/detail');
}
$view->art = $art;
$view->related_arts = $related_arts;
$view->cat = $cat;
if (!empty($cat->parent_id)) {
$view->p_cat = Model_Categories::find($cat->parent_id);
}
// data to display menu
$this->template->cats = Model_Categories::get_cats_home($this->lang);
$this->template->pepper_arts = Model_Article::pepper_artilces($this->lang);
$this->template->title = Security::strip_tags($art->title);
$this->template->content = $view;
}
示例12: action_view
/**
* Display articles in category
*
* @param void
* @access public
* @author Nguyen Van Hiep
*
* @version 1.0
* @since 1.0
*/
public function action_view()
{
$uri = explode('/', Uri::string());
$slug = str_replace('.html', '', $uri[1]);
$cat = Model_Categories::get_cat_from_slug($slug);
if (!$cat) {
Response::redirect('common/404');
}
$arts = Model_Article::articles_of_cat($cat->id, $this->lang, $cat->art_display_by_order);
switch ($cat->display_type) {
case DS_SANPHAM:
//Hien thi phan [san pham]
$this->ds_sanpham($arts, $cat);
break;
case CHUNGNHAN:
//Hien thi phan [san pham]
$this->chungnhan($arts, $cat);
break;
case VECHUNGTOI:
//Hien thi phan [chung toi]
$this->vechungtoi($arts, $cat);
break;
case THUONGHIEU:
$this->thuonghieu($arts, $cat);
break;
case DS_TINTUC:
$ret = $this->article_list($arts, $cat);
break;
// hien thi khi click vao AM THUC
// hien thi khi click vao AM THUC
case DS_MONAN:
$this->ds_monan($arts, $cat);
break;
case QUY_TRINH_SX:
$ret = $this->quytrinh_sx($arts, $cat);
break;
default:
break;
}
}
示例13: before
public function before()
{
$this->template = $this->newIntranet() ? "templates/layout" : "template";
\Session::set("current_page", \Uri::string());
$segments = implode(\Uri::segments());
if (\Auth::check() || $segments == 'userlogin') {
list($driver, $user_id) = \Auth::get_user_id();
$this->current_user = \Model_User::find($user_id);
} else {
if ($segments != 'userlogin') {
\Session::set("lastpage", implode("/", \Uri::segments()));
}
$this->current_user = null;
\Response::redirect('user/login');
}
if ($segments != 'userlogin') {
\View::set_global('group_name', \Auth_Group_SimpleGroup::instance()->get_name($this->current_user->group));
\View::set_global('current_user', $this->current_user);
}
parent::before();
// Remove when login implemented
}
示例14: AjaxConstruct
/**
* constructor de Link y Ajax javascript
* requiere obligadamente algunos Atributos como el Nombre del Model actual
* argumentos : db_table
*/
protected function AjaxConstruct($field_html)
{
$table_this = substr($this->attributes->NameModel, '4', '-6');
$uri = new Uri();
$uri_string = $uri->string();
$uri_string = str_replace($table_this, $this->args->db_table, $uri_string);
$uri_string_save = $uri_string;
$uri_string = explode('/edit/', $uri_string);
$bl = count($uri_string);
if (count($uri_string) == 1) {
$uri_string = explode('/add', $uri_string_save);
}
$uri_string_ajax = url::base(FALSE) . $uri_string[0] . '/ajax/' . $this->PkID . '/ajaxfield/' . $this->field_name;
$uri_string_ajax = str_replace(array("mod/" . $this->args->db_table, 'tbl_' . $this->args->db_table), array("mod/" . $table_this, 'tbl_' . $table_this), $uri_string_ajax);
$_SESSION['PKID'] = $this->PkID;
$uri_string = $uri_string[0] . '/add';
$href = fpp::iconify('Agregar', 'plusthick');
$props = array("class" => 'AjaxOTO', "id" => 'AjaxTBL_' . $this->field_name, "logme" => $bl, 'refresh_to' => $uri_string_ajax, 'field_name' => $this->field_name);
$href = html::anchor($uri_string, $href, $props);
$div = "<div class='AjaxTBL_{$this->field_name} DIVJAX' style='display:none;' ></div>";
return $div . "<table border=0><tr><td>" . $field_html . '</td><td>' . $href . '</td></tr></table>';
}
示例15: action_index
public function action_index()
{
// check permission
if (\Model_AccountLevelPermission::checkAdminPermission('cacheman_perm', 'cacheman_clearcache_perm') == false) {
\Session::set_flash('form_status', array('form_status' => 'error', 'form_status_message' => \Lang::get('admin_permission_denied', array('page' => \Uri::string()))));
\Response::redirect(\Uri::create('admin'));
}
// read flash message for display errors.
$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);
// if form submitted
if (\Input::method() == 'POST') {
$act = \Input::post('act');
if ($act == 'clear') {
\Extension\Cache::deleteCache('ALL');
\Session::set_flash('form_status', array('form_status' => 'success', 'form_status_message' => \Lang::get('cacheman_all_cleared')));
}
// go back
\Response::redirect(\Uri::create('admin/cacheman'));
}
// <head> output ----------------------------------------------------------------------------------------------
$output['page_title'] = $this->generateTitle(\Lang::get('cacheman'));
// <head> output ----------------------------------------------------------------------------------------------
// breadcrumb -------------------------------------------------------------------------------------------------
$page_breadcrumb = [];
$page_breadcrumb[0] = ['name' => \Lang::get('admin_admin_home'), 'url' => \Uri::create('admin')];
$page_breadcrumb[1] = ['name' => \Lang::get('cacheman'), 'url' => \Uri::create('admin/cacheman')];
$output['page_breadcrumb'] = $page_breadcrumb;
unset($page_breadcrumb);
// breadcrumb -------------------------------------------------------------------------------------------------
return $this->generatePage('admin/templates/cacheman/index_v', $output, false);
}