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


PHP AppController::getUser方法代码示例

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


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

示例1: WHERE

 function admin_search($pattern = null)
 {
     $user = parent::getUser();
     # code after form submit
     if (!empty($this->data)) {
         $pattern = "'%" . $this->data['Rule']['pattern'] . "%'";
         $WILDCARD = "'*'";
         $search_result = $this->Rule->query('SELECT * 
                                          FROM rules LEFT JOIN groups on rules.group_id = groups.id 
                                                     LEFT JOIN locations as loc1 on rules.location_id = loc1.id 
                                                     LEFT JOIN locations as loc2 on groups.location_id = loc2.id
                                          WHERE (rules.sitename LIKE ' . $pattern . ' OR rules.sitename = ' . $WILDCARD . ')
                                          AND (rules.location_id = 1 OR rules.location_id = ' . $this->data['Rule']['locations'] . ')
                                          ORDER BY sitename, priority;', $cachequeries = false);
         #pr($search_result);
         $this->set('results', $search_result);
     }
     if (in_array($user['Role']['name'], $this->priv_roles)) {
         $allowed_locations = parent::getAdminLocationIds();
         $find_condition = array('fields' => array('Location.*'), 'conditions' => array("AND" => array('Location.id' => $allowed_locations, 'Location.id NOT' => "1")), 'order' => 'Location.code');
     } else {
         $find_condition = array('fields' => array('Location.*'), 'order' => 'Location.code', 'conditions' => array("id NOT" => "1"));
     }
     $locations_list = $this->Location->find('all', $find_condition);
     $locations = Set::combine($locations_list, '{n}.Location.id', array('%s %s', '{n}.Location.code', '{n}.Location.name'));
     $this->set(compact('locations'));
 }
开发者ID:vovchik09,项目名称:proximus-admin,代码行数:27,代码来源:rules_controller.php

示例2: array

 function admin_start()
 {
     $user = parent::getUser();
     $allowed_locations = parent::getAdminLocationIds();
     # allow everyone to view location ALL...
     array_push($allowed_locations, 1);
     if (in_array($user['Role']['name'], $this->priv_roles)) {
         $find_condition = array('fields' => array('Location.*'), 'order' => 'Location.code');
     } else {
         $find_condition = array('fields' => array('Location.*'), 'conditions' => array('Location.id' => $allowed_locations), 'order' => 'Location.code');
     }
     $locations = $this->Location->find('all', $find_condition);
     $this->set('locations', $locations);
 }
开发者ID:vovchik09,项目名称:proximus-admin,代码行数:14,代码来源:locations_controller.php

示例3: getHeader

 /**
  * Ajoute le fichier en tête à la réponse html
  */
 public static function getHeader()
 {
     $baseFolder = '';
     $urlLevel = count(explode('/', $_SERVER['REQUEST_URI'])) - 3;
     for ($i = 0; $i < $urlLevel; $i++) {
         $baseFolder .= '../';
     }
     $userMsgs = AppController::getMsg();
     if ($userMsgs == Null) {
         $userMsgs = [];
     }
     $user = AppController::getUser();
     require 'Src/View/HeaderView.php';
 }
开发者ID:rloic,项目名称:ptut,代码行数:17,代码来源:AppController.php

示例4: render

 public static function render($params = [])
 {
     $user = AppController::getUser();
     if (!$user) {
         AppController::setMsg('warning', "La zone demandée n'est pas autorisé pour les personnes non inscrites.");
         AppController::redirect('index');
     }
     $algorithms = \Root\Src\Model\AlgorithmModel::loadFunctionByUser($user->getId());
     $structures = \Root\Src\Model\StructureModel::loadStructureByUser($user->getId());
     $translationOfC = \Root\Src\Model\TranslationModel::loadTranslationByLanguage('c');
     $translationOfJava = \Root\Src\Model\TranslationModel::loadTranslationByLanguage('java');
     $translationOfJavascript = \Root\Src\Model\TranslationModel::loadTranslationByLanguage('javascript');
     $translationOfPhp = \Root\Src\Model\TranslationModel::loadTranslationByLanguage('php');
     $translationOfPython = \Root\Src\Model\TranslationModel::loadTranslationByLanguage('python');
     parent::getHeader();
     self::call('Render', ['algorithms' => $algorithms, 'structures' => $structures, 'translations' => ['c' => $translationOfC, 'java' => $translationOfJava, 'javascript' => $translationOfJavascript, 'php' => $translationOfPhp, 'python' => $translationOfPython]]);
     parent::getFooter();
 }
开发者ID:rloic,项目名称:ptut,代码行数:18,代码来源:ToolsController.php

示例5: array

 function user_logs()
 {
     $user = parent::getUser();
     $this->set('location', $user['Location']['id']);
     $this->set('user', $user);
     ##################
     # If form was submitted
     if (!empty($this->data)) {
         $model = $this->modelClass;
         $proxy = $this->ProxySetting->find('first', array('conditions' => array('Location.id' => $user['Location']['id'])));
         $this->set('proxy', $proxy);
         // use correct datasource
         $this->CommonTasks->setDataSource($proxy);
         # build up conditions for query
         $conditions = array();
         $conditions['Log.user_id'] = $user['User']['id'];
         if (!empty($this->data[$model]['site'])) {
             $conditions['Log.sitename LIKE'] = '%' . $this->data[$model]['site'] . '%';
         }
         if (!empty($this->data[$model]['status'])) {
             $conditions['Log.source'] = $this->data[$model]['status'];
         }
         if (!empty($this->data[$model]['type'])) {
             if ($this->data[$model]['type'] == "NOT null") {
                 array_push($conditions, array("not" => array("Log.parent_id" => null)));
             }
             if ($this->data[$model]['type'] == "null") {
                 $conditions['Log.parent_id'] = null;
             }
         }
         // set parrent id to avoid double entries...
         if (empty($this->data[$model]['users']) && empty($this->data[$model]['site']) && empty($this->data[$model]['type'])) {
             $conditions['Log.parent_id'] = null;
         }
         // delete if requested...
         if (isset($this->params['form']['deleteMatching'])) {
             $this->Log->deleteAll($conditions);
         }
         // do a search
         $tree = $this->Log->find('all', array('conditions' => $conditions));
         $this->set('logs', $tree);
     }
 }
开发者ID:vovchik09,项目名称:proximus-admin,代码行数:43,代码来源:profiles_controller.php

示例6: array

 function admin_index()
 {
     # get global settings
     $settings = $this->CommonTasks->getGlobalSettings();
     $this->set('settings', $settings);
     $user = parent::getUser();
     $conditions = array();
     # get proxys / locations
     if (!in_array($user['Role']['name'], $this->priv_roles)) {
         $allowed_locations = parent::getAdminLocationIds();
         $conditions['Location.id'] = $allowed_locations;
     }
     # If form has been submitted
     if (!empty($this->data) && isset($this->data['User']['searchstring'])) {
         $string = $this->data['User']['searchstring'];
         $conditions = array("User.username LIKE '%{$string}%' OR User.realname LIKE '%{$string}%'");
     }
     $this->User->recursive = 0;
     $this->set('users', $this->paginate('User', $conditions));
 }
开发者ID:vovchik09,项目名称:proximus-admin,代码行数:20,代码来源:users_controller.php

示例7: giveHelp

 /**
  * 
  */
 public static function giveHelp()
 {
     debug($_POST);
     if (isset($_POST['msgHelpedId']) && isset($_POST['helpMsg']) && AppController::getUser()) {
         $msg = new \Root\Src\Model\MailModel();
         $msg->setContent($_POST['helpMsg']);
         $msg->setSubjectId($_POST['msgHelpedId']);
         $msg->setOwnerId(AppController::getUser()->getId());
         debug($msg);
         $msg->send();
         AppController::setMsg("success", "Votre aide a bien été publiée.");
     } else {
         if (!AppController::getUser()) {
             AppController::setMsg("warning", "Vous devez être connecté pour poster des messages d'aide");
         } else {
             AppController::setMsg("warning", "Aucun message n'a été saisi, vous devez en saisir un pour obtenir de l'aide");
         }
     }
     self::render();
 }
开发者ID:rloic,项目名称:ptut,代码行数:23,代码来源:IndexController.php

示例8: connect

 /**
  * Methode de connexion
  */
 public static function connect()
 {
     if (AppController::getUser() != Null) {
         AppController::setMsg("warning", "Vous êtes déjà connecté. Veuillez vous déconnecter pour changer de compte.");
     } else {
         $login = '';
         $password = '';
         if (isset($_POST['login']) && isset($_POST['password'])) {
             $login = $_POST['login'];
             $password = $_POST['password'];
         }
         $user = new \Root\Src\Model\UserModel($login, $password);
         $user = $user->exist();
         if ($user) {
             AppController::setUser($user);
             AppController::setMsg("success", "Vous avez bien été connecté.");
             parent::redirect('index');
         } else {
             AppController::setMsg("warning", "Le mot de passe ou l'identifiant est incorrect.");
             self::render();
         }
     }
 }
开发者ID:rloic,项目名称:ptut,代码行数:26,代码来源:ConnectionController.php

示例9: update

 /**
  * Fonction de mise à jour d'un compte
  */
 public static function update()
 {
     if (isset($_POST['oldPassword'])) {
         $validPassword = AppController::getUser();
         $validPassword->setPassword($_POST['oldPassword']);
         $validPassword = $validPassword->exist();
         if (!$validPassword) {
             AppController::setMsg("warning", "Le mot de passe saisit n'est pas correct.");
         }
         if ($_POST['newPassword'] != $_POST['passwordConfirmation']) {
             AppController::setMsg("warning", "Les deux mots de passes ne sont pas les mêmes");
         }
         if (!AppController::hasError()) {
             $user = AppController::getUser();
             $user->setPassword($_POST['newPassword']);
             $user->updatePassword();
         }
     }
     $user = AppController::getUser();
     $user->setName($_POST['name']);
     $user->setEmail($_POST['email']);
     $user->setAvatar('');
     $user->update();
 }
开发者ID:rloic,项目名称:ptut,代码行数:27,代码来源:AccountController.php

示例10: load

 /**
  * Méthode de chargement d'une structure
  * @param type $params
  */
 public static function load($params = [])
 {
     if (isset($params[0])) {
         $_POST['idStructure'] = $params[0];
         $structure = \Root\Src\Model\StructureModel::loadStructureById($_POST['idStructure']);
         $user = AppController::getUser();
         if ($structure && $user && $structure->getOwnerId() == $user->getId()) {
             $_POST['idStructure'] = $structure->getId();
             $_POST['structure'] = $structure->getCode();
             $tranlsationToC = \Root\Src\Model\TranslationModel::loadTranslationByIdAndLanguage($structure->getId(), 'c');
             if ($tranlsationToC) {
                 $_POST['translationToC'] = $tranlsationToC->getCode();
             }
             $tranlsationToPhp = \Root\Src\Model\TranslationModel::loadTranslationByIdAndLanguage($structure->getId(), 'php');
             if ($tranlsationToPhp) {
                 $_POST['translationToPhp'] = $tranlsationToPhp->getCode();
             }
             $tranlsationToJava = \Root\Src\Model\TranslationModel::loadTranslationByIdAndLanguage($structure->getId(), 'java');
             if ($tranlsationToJava) {
                 $_POST['translationToJava'] = $tranlsationToJava->getCode();
             }
             $tranlsationToJavascript = \Root\Src\Model\TranslationModel::loadTranslationByIdAndLanguage($structure->getId(), 'javascript');
             if ($tranlsationToJavascript) {
                 $_POST['translationToJavascript'] = $tranlsationToJavascript->getCode();
             }
             $tranlsationToPython = \Root\Src\Model\TranslationModel::loadTranslationByIdAndLanguage($structure->getId(), 'python');
             if ($tranlsationToPython) {
                 $_POST['translationToPython'] = $tranlsationToPython->getCode();
             } else {
                 unset($_POST['idStructure']);
             }
         }
     }
     self::render();
 }
开发者ID:rloic,项目名称:ptut,代码行数:39,代码来源:StructureController.php

示例11: askForHelp

 /**
  * 
  */
 public static function askForHelp()
 {
     debug($_POST);
     if (isset($_POST['id']) && isset($_POST['helpMsg']) && AppController::getUser()) {
         $msg = new \Root\Src\Model\MailModel();
         $msg->setContent($_POST['helpMsg']);
         $msg->setSubjectId($_POST['id']);
         $msg->setOwnerId(AppController::getUser()->getId());
         debug($msg);
         $msg->send();
         AppController::setMsg("success", "Votre demande d'aide a bien été publiée.");
     } else {
         AppController::setMsg("warning", "Aucun message n'a été saisi, vous devez en saisir un pour obtenir de l'aide");
     }
     unset($_POST['askForHelp']);
     self::render();
 }
开发者ID:berseker10000,项目名称:ptut,代码行数:20,代码来源:CodeController.php

示例12: array

 function admin_searchlist()
 {
     /* # don't really know.......
        if ($this->Session->read('Auth.godmode') != 1) {
           $this->Session->setFlash(__('You are not allowed to access this search method', true));
           $this->Tracker->back();
        }
        */
     $user = parent::getUser();
     # get proxys / locations
     if ($user['Role']['name'] == "admin_global") {
         $find_conditions = array("Location.id NOT" => "1");
     } else {
         $allowed_locations = parent::getAdminLocationIds();
         $find_conditions = array('Location.id' => $allowed_locations, 'Location.id NOT' => "1");
     }
     $proxy_list = $this->ProxySetting->find('all', array('fields' => array('Location.id', 'Location.code', 'Location.name', 'ProxySetting.fqdn_proxy_hostname', 'ProxySetting.id'), 'conditions' => $find_conditions, 'order' => array('Location.code')));
     $proxyIds = Set::combine($proxy_list, '{n}.ProxySetting.id', array('%s - %s', '{n}.Location.code', '{n}.ProxySetting.fqdn_proxy_hostname'));
     $this->set(compact('proxyIds'));
     ##################
     # If form was submitted
     if (!empty($this->data) && isset($this->data['Log']['proxyId'])) {
         $proxy = $this->ProxySetting->findById($this->data['Log']['proxyId']);
         // check permissions
         if (!parent::checkSecurity($proxy['ProxySetting']['location_id'])) {
             $this->Tracker->back();
         }
         // use correct datasource
         $this->CommonTasks->setDataSource($proxy);
         # build up conditions for query
         $conditions = array();
         if (!empty($this->data['Log']['site'])) {
             $conditions['Log.sitename LIKE'] = '%' . $this->data['Log']['site'] . '%';
         }
         if (!empty($this->data['Log']['onlyThisLoc'])) {
             $conditions['Log.location_id'] = $proxy['ProxySetting']['location_id'];
         }
         if (!empty($this->data['Log']['status'])) {
             $conditions['Log.source'] = $this->data['Log']['status'];
         }
         if (!empty($this->data['Log']['type'])) {
             if ($this->data['Log']['type'] == "NOT null") {
                 array_push($conditions, array("not" => array("Log.parent_id" => null)));
             }
             if ($this->data['Log']['type'] == "null") {
                 $conditions['Log.parent_id'] = null;
             }
         }
         if (!empty($this->data['Log']['users'])) {
             # first get the ids of the matching users
             $user_ids = $this->User->find('all', array('fields' => 'id', 'conditions' => array('or' => array('User.realname LIKE' => '%' . $this->data['Log']['users'] . '%', 'User.username LIKE' => '%' . $this->data['Log']['users'] . '%'))));
             $user_ids = Set::extract('/User/id', $user_ids);
             $conditions['Log.user_id'] = $user_ids;
         }
         // set parrent id to avoid double entries...
         if (empty($this->data['Log']['users']) && empty($this->data['Log']['site']) && empty($this->data['Log']['type'])) {
             $conditions['Log.parent_id'] = null;
         }
         // delete if requested...
         if (isset($this->params['form']['deleteMatching'])) {
             $this->Log->deleteAll($conditions);
         }
         // do a search
         $tree = $this->Log->find('all', array('conditions' => $conditions));
         $this->set('logs', $tree);
         $this->log($this->MyAuth->user('username') . "; {$this->name}; search logs", "activity");
         #pr($conditions);    # debug
     }
 }
开发者ID:vovchik09,项目名称:proximus-admin,代码行数:69,代码来源:logs_controller.php


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