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


PHP Environment::getUser方法代码示例

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


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

示例1: getUser

 /**
  * @return User
  */
 public function getUser()
 {
     if ($this->user === null) {
         $this->user = Environment::getUser();
     }
     return $this->user;
 }
开发者ID:radypala,项目名称:maga-website,代码行数:10,代码来源:BaseModel.php

示例2: beforeRender

 public function beforeRender()
 {
     $filters = $this->getUniqueValues(array('works' => array('year', 'award', 'type'), 'authors' => array('class')));
     $temp = $filters['authors'];
     unset($filters['authors']);
     //$filters['works']['category'] = Model::palicky();// + array(5=>'palice');    // 'category'=>'Kategorie',
     $filters['works']['grade'] = Model::rocniky();
     $filters['palicka']['category'] = Model::palicky();
     $filters['authors'] = $temp;
     //{link :Front:Default:works "category"=>palicka}
     $this->template->filters = $filters;
     $this->template->schoolYear = Model::getSchoolYear();
     $newest = dibi::query('SELECT
       url,
       title,
       CONCAT_WS(" ", name, surname) as authorName          
       FROM [works] 
       join [authors] on author = authorId', 'ORDER BY %by', array('added' => 'desc'), 'LIMIT %i', 2)->fetchAll();
     $this->template->newest = $newest;
     $mostread = dibi::query('SELECT
       url,
       title,
       CONCAT_WS(" ", name, surname) as authorName          
       FROM [works] 
       join [authors] on author = authorId', 'ORDER BY %by', array('read' => 'desc'), 'LIMIT %i', 3)->fetchAll();
     $this->template->mostread = $mostread;
     $user = Environment::getUser();
     if ($user->isLoggedIn()) {
         $this->template->adminMode = true;
     }
 }
开发者ID:xixixao,项目名称:chytrapalice,代码行数:31,代码来源:BasePresenter.php

示例3: handleLogout

 public function handleLogout()
 {
     $user = Environment::getUser();
     // odhlášení
     $user->signOut();
     $this->redirect(':Front:Default:');
 }
开发者ID:xixixao,项目名称:chytrapalice,代码行数:7,代码来源:LoginPresenter.php

示例4: formLoginAjaxSubmitted

 public function formLoginAjaxSubmitted($form)
 {
     $values = $form->getValues();
     if ($form->isValid()) {
         $login = $values['login'];
         $password = $values['password'];
         $user = Environment::getUser();
         $user->setAuthenticationHandler(new Admin_UserModel());
         try {
             $user->authenticate($login, $password);
             $session_conf = Environment::getVariable('session');
             $user->setExpiration($session_conf['expiration'], true);
             //$session = $this->getSession('backlink');
             //$session->in_application = true;
             //$this->getApplication()->restoreRequest($session['backlink']);
             //$this->redirect('Dashboard:default');
             $this->payload->cmds = array();
             $this->payload->cmds[] = 'login_ok';
             $this->flash('Login OK');
             if ($this->isAjax()) {
                 $this->sendPayload();
                 $this->terminate();
             }
         } catch (AuthenticationException $e) {
             $form->setValues($values);
             $this->invalidateControl('frmLogin');
             if ($this->isAjax()) {
                 $this->invalidateControl('formLoginAjax');
             }
             //$this->flash('Error: '. $e->getMessage());
             $this->payload->error = $e - getMessage();
         }
     }
 }
开发者ID:bazo,项目名称:Mokuji,代码行数:34,代码来源:AdminLoginPresenter.php

示例5: actionDefault

 public function actionDefault()
 {
     if (Environment::getUser()->getIdentity()->role == 'super admin') {
         $this->config_data = ConfigAdapterIni::load(APP_DIR . '/config/admin.ini', 'admin');
         $this->profile_data = $this->config_data['admin'];
         $this->mode = 'superadmin';
     }
     $this->view = 'profile';
 }
开发者ID:bazo,项目名称:Mokuji,代码行数:9,代码来源:AdminMyProfilePresenter.php

示例6: startup

 public function startup()
 {
     parent::startup();
     $user = Environment::getUser();
     if ($user->isAuthenticated()) {
         $roles = Environment::getUser()->getIdentity()->getRoles();
         $role = $roles[0];
         $this->redirect(":{$role}:Default:default");
     }
 }
开发者ID:bazo,项目名称:diplomovka,代码行数:10,代码来源:DefaultPresenter.php

示例7: startup

 protected function startup()
 {
     parent::startup();
     $this->model = new Model();
     $this->fileModel = new FileModel();
     $user = Environment::getUser();
     if (!$user->isLoggedIn()) {
         // je uživatel přihlášen?
         $this->redirect(':Admin:Login:');
     }
 }
开发者ID:xixixao,项目名称:chytrapalice,代码行数:11,代码来源:BasePresenter.php

示例8: loginFormSubmitted

 public function loginFormSubmitted($form)
 {
     try {
         $user = Environment::getUser();
         $user->authenticate($form['username']->getValue(), $form['password']->getValue());
         $this->getApplication()->restoreRequest($this->backlink);
         $this->redirect('Dashboard:');
     } catch (AuthenticationException $e) {
         $form->addError($e->getMessage());
     }
 }
开发者ID:vrana,项目名称:nette,代码行数:11,代码来源:AuthPresenter.php

示例9: beforeRender

 public function beforeRender()
 {
     // curly brackets
     $this->template->registerFilter('Nette\\Templates\\CurlyBracketsFilter::invoke');
     // texy
     $texy = new Texy();
     $this->template->registerHelper('texy', array($texy, 'process'));
     // user
     $this->template->user = Environment::getUser();
     // order statuses
     $this->template->order_statuses = mapper::order_statuses()->findAll();
     // date
     $this->template->registerHelper('date', array(__CLASS__, 'date'));
 }
开发者ID:jakubkulhan,项目名称:shopaholic,代码行数:14,代码来源:BasePresenter.php

示例10: onLoginFormSubmit

 public function onLoginFormSubmit(Form $form)
 {
     $user = Environment::getUser();
     $user->setAuthenticationHandler(new SimpleAuthenticator(array(ADMIN_USERNAME => ADMIN_PASSWORD)));
     $values = $form->getValues();
     try {
         $user->authenticate($values['username'], $values['password']);
         adminlog::log(__('Successfully logged in as "%s"'), Environment::getUser()->getIdentity()->getName());
         $this->redirect('Dashboard:default');
         $this->terminate();
     } catch (AuthenticationException $e) {
         adminlog::log(__('Unsuccessful log in (username: "%s", password: "%s")'), $values['username'], $values['password']);
         $this->template->error = $e;
     }
 }
开发者ID:jakubkulhan,项目名称:shopaholic,代码行数:15,代码来源:LoginPresenter.php

示例11: login

 private function login($username, $password)
 {
     $user = Environment::getUser();
     if (!$user->isAuthenticated()) {
         $user->setAuthenticationHandler(new Admin_UserModel());
         try {
             $user->authenticate($username, $password);
             $session_conf = Environment::getVariable('session');
             $user->setExpiration($session_conf['expiration'], true);
             return $user;
         } catch (AuthenticationException $e) {
             $this->error = new IXR_Error(403, $e->getMessage());
             return false;
         }
     }
     return $user;
 }
开发者ID:bazo,项目名称:Mokuji,代码行数:17,代码来源:AdminPublishPresenter.php

示例12: checkAuthorization

 private function checkAuthorization()
 {
     $presenter = String::lower($this->getReflection()->getName());
     $user = Environment::getUser();
     $user->setAuthorizationHandler(MokujiServiceLocator::getService('UserAuthorizator'));
     //if(Environment::getServiceLocator()->hasService('UserAuthorizator')) $user->setAuthorizationHandler(Environment::getService('UserAuthorizator'));
     //else $user->setAuthorizationHandler(new Admin_UserModel());
     if ($this->formatActionMethod($this->action) == 'actiondeny') {
         return;
     }
     if ($user->isAllowed($presenter, $this->formatActionMethod($this->action)) === true) {
         if ($user->isAllowed($presenter, $this->formatSignalMethod($this->signal)) === false) {
             throw new AuthenticationException('This action is not allowed');
         }
     } else {
         throw new AuthenticationException('This action is not allowed');
     }
 }
开发者ID:bazo,项目名称:Mokuji,代码行数:18,代码来源:AdminSecurePresenter.php

示例13: isAllowed

 public function isAllowed($role = self::ALL, $resource = self::ALL, $privilege = self::ALL)
 {
     if ($privilege == 'actionDeny') {
         return true;
     }
     $data = Environment::getUser()->getIdentity()->permissions;
     if (isset($data[String::lower($resource)])) {
         if ($privilege == null) {
             return true;
         }
         foreach ($data[String::lower($resource)] as $user_privilege) {
             if (String::lower($privilege) == String::lower($user_privilege)) {
                 return true;
             }
         }
         return false;
     } else {
         return false;
     }
 }
开发者ID:bazo,项目名称:Mokuji,代码行数:20,代码来源:UsersModuleModel.php

示例14: formLoginSubmitted

 public function formLoginSubmitted($form)
 {
     $modul = explode(':', $this->getName());
     $module = $modul[0];
     $user = Environment::getUser();
     $user->setAuthenticationHandler(new Authenticator());
     $values = $form->getValues();
     if ($form->isValid()) {
         $email = $values['email'];
         $password = $values['password'];
         try {
             $user->authenticate($email, $password, $module);
             $user->setExpiration('+ 30 minutes');
             $this->redirect(":{$module}:default:default");
         } catch (AuthenticationException $e) {
             $this->flashMessage('Error: ' . $e->getMessage(), 'error');
             $this->invalidateControl('flash');
             if (!$this->isAjax()) {
                 $this->redirect('this');
             }
         }
     }
 }
开发者ID:bazo,项目名称:diplomovka,代码行数:23,代码来源:CombinedLoginPresenter.php

示例15: actionLogout

 public function actionLogout()
 {
     Environment::getUser()->signOut();
     $this->flashMessage('You have been logged off.');
     $this->redirect('Auth:login');
 }
开发者ID:vrana,项目名称:nette,代码行数:6,代码来源:DashboardPresenter.php


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