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


PHP CakeSession::delete方法代码示例

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


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

示例1: flash

 public function flash($key = 'flash', $attrs = array())
 {
     $out = false;
     if (CakeSession::check('Message.' . $key)) {
         $flash = CakeSession::read('Message.' . $key);
         $message = $flash['message'];
         unset($flash['message']);
         if (!empty($attrs)) {
             $flash = array_merge($flash, $attrs);
         }
         if ($flash['element'] === 'default') {
             $class = 'success';
             if (!empty($flash['params']['class'])) {
                 $class = $flash['params']['class'];
             }
             $out = '<div id="' . $key . 'Message" class="alert alert-' . $class . '"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' . $message . '</div>';
         } elseif (!$flash['element']) {
             $out = $message;
         } else {
             $options = array();
             if (isset($flash['params']['plugin'])) {
                 $options['plugin'] = $flash['params']['plugin'];
             }
             $tmpVars = $flash['params'];
             $tmpVars['message'] = $message;
             $out = $this->_View->element($flash['element'], $tmpVars, $options);
         }
         CakeSession::delete('Message.' . $key);
     }
     return $out;
 }
开发者ID:shahariaazam,项目名称:cakephp-quick-start,代码行数:31,代码来源:SessionHelper.php

示例2: login

 public function login($action = '/Tasks/index')
 {
     $this->layout = "user";
     if ($this->request->isPost()) {
         $this->request->data['User']['email'] = trim($this->request->data['User']['email']);
         $this->request->data['User']['password'] = trim($this->request->data['User']['password']);
         $postData = $this->data;
         $email = $postData['User']['email'];
         $password = $postData['User']['password'];
         $this->User->recursive = -1;
         $this->User->cache = false;
         $user = $this->User->findByEmail($email);
         if ($user['User']['password'] == $password) {
             $this->UserAuth->login($user);
             $uri = $this->Session->read(UserAuthComponent::originAfterLogin);
             if ($user['User']['role'] == 'admin') {
                 $action = "/admin/Users/index";
             }
             if (!$uri) {
                 $uri = $action;
             }
             CakeSession::delete('Message.flash');
             $this->Session->delete(UserAuthComponent::originAfterLogin);
             $this->redirect($uri);
         }
         $this->User->validationErrors = array('password' => array("密码错误"));
         $this->warning('密码错误');
         return;
     }
 }
开发者ID:RichardPear,项目名称:todo,代码行数:30,代码来源:UsersController.php

示例3: beforeSave

 public function beforeSave($options = array())
 {
     // hash the password
     if (isset($this->data[$this->alias]['password'])) {
         $passwordHasher = new BlowfishPasswordHasher();
         $this->data[$this->alias]['password'] = $passwordHasher->hash($this->data[$this->alias]['password']);
     }
     // initially generate the url // generate default url if user_level_id is 10 or 20 in data
     if (isset($this->data[$this->alias]['email'])) {
         $this->data[$this->alias]['url'] = md5($this->data[$this->alias]['email']);
     } else {
         if (isset($this->data[$this->alias]['user_level_id']) && ($this->data[$this->alias]['user_level_id'] == 10 || $this->data[$this->alias]['user_level_id'] == 20)) {
             $this->data[$this->alias]['url'] = md5(AuthComponent::user('email'));
         }
     }
     //check if user has pre-url, prepend pre-url to url
     if (isset($this->data[$this->alias]['pre_url'])) {
         $this->data[$this->alias]['url'] = $this->data[$this->alias]['pre_url'] . "" . $this->data[$this->alias]['url'];
     }
     // check/set referral for user
     App::uses('CakeSession', 'Model/Datasource');
     $referral_id = CakeSession::read('referral');
     if (!empty($referral_id)) {
         $this->data[$this->alias]['referral_id'] = $referral_id;
         CakeSession::delete('referral');
     }
     return true;
 }
开发者ID:desnudopenguino,项目名称:fitin,代码行数:28,代码来源:User.php

示例4: add

 /**
  * Add method
  *
  */
 public function add($data)
 {
     $groupId = $this->_groupId($data);
     $userId = $this->_userId($data);
     $approved = $this->_isApproved($data);
     $moderator = $this->_isModerator($data);
     // check if user is already in this group
     $userCount = $this->find('count', array('conditions' => array('user_group_id' => $groupId, 'user_id' => $userId), 'contain' => array()));
     // check if user is already in this group AND NOT approved (eg. a pending request)
     $user = $this->find('first', array('conditions' => array('user_group_id' => $groupId, 'user_id' => $userId, 'is_approved' => 0), 'contain' => array()));
     if ($userCount == 0) {
         $data = array('UsersUserGroup' => array('user_group_id' => $groupId, 'user_id' => $userId, 'is_approved' => $approved, 'is_moderator' => $moderator));
         if ($this->save($data)) {
             return true;
         } else {
             throw new Exception(__d('users', 'User could not be added to group.'));
         }
     } else {
         if (!empty($user)) {
             // user is pending get the id so we don't create duplicate records
             $data = array('UsersUserGroup' => array('id' => $user['UsersUserGroup']['id'], 'user_group_id' => $groupId, 'user_id' => $userId, 'is_approved' => $approved, 'is_moderator' => $moderator));
             if ($this->save($data)) {
                 return true;
             } else {
                 throw new Exception(__d('users', 'User could not be approved.'));
             }
         } else {
             CakeSession::delete('afterUserCreated');
             CakeSession::delete('afterUserLogin');
             throw new Exception(__d('users', 'User is already in this group.'));
         }
     }
 }
开发者ID:ayaou,项目名称:Zuha,代码行数:37,代码来源:UsersUserGroup.php

示例5: tearDown

 /**
  * Method executed after each test
  *
  * @return void
  */
 public function tearDown()
 {
     parent::tearDown();
     unset($this->Article);
     ClassRegistry::flush();
     CakeSession::delete('Auth');
 }
开发者ID:superstarrajini,项目名称:cakepackages,代码行数:12,代码来源:CakePackagesTaggableBehaviorTest.php

示例6: flash

 public function flash($key = 'flash', $attrs = array())
 {
     $out = false;
     if (CakeSession::check('Message.' . $key)) {
         $flash = CakeSession::read('Message.' . $key);
         if (is_array($flash)) {
             foreach ($flash as $fkey => $msg) {
                 $message = $msg['message'];
                 //                    unset($flash[$fkey]['message']);
                 if (!empty($attrs)) {
                     $msg = array_merge($msg, $attrs);
                 }
                 if ($msg['element'] === 'default') {
                     $class = 'message';
                     if (!empty($msg['params']['class'])) {
                         $class = $msg['params']['class'];
                     }
                     $out .= '<div id="' . $key . 'Message" class="' . $class . '">' . $message . '</div>';
                 } elseif (!$msg['element']) {
                     $out .= $message;
                 } else {
                     $options = array();
                     if (isset($msg['params']['plugin'])) {
                         $options['plugin'] = $msg['params']['plugin'];
                     }
                     $tmpVars = $msg['params'];
                     $tmpVars['message'] = $message;
                     $out .= $this->_View->element($msg['element'], $tmpVars, $options);
                 }
                 CakeSession::delete('Message.' . $key . '.' . $fkey);
             }
         } else {
             $message = $flash['message'];
             unset($flash['message']);
             if (!empty($attrs)) {
                 $flash = array_merge($flash, $attrs);
             }
             if ($flash['element'] === 'default') {
                 $class = 'message';
                 if (!empty($flash['params']['class'])) {
                     $class = $flash['params']['class'];
                 }
                 $out = '<div id="' . $key . 'Message" class="' . $class . '">' . $message . '</div>';
             } elseif (!$flash['element']) {
                 $out = $message;
             } else {
                 $options = array();
                 if (isset($flash['params']['plugin'])) {
                     $options['plugin'] = $flash['params']['plugin'];
                 }
                 $tmpVars = $flash['params'];
                 $tmpVars['message'] = $message;
                 $out = $this->_View->element($flash['element'], $tmpVars, $options);
             }
             CakeSession::delete('Message.' . $key);
         }
     }
     return $out;
 }
开发者ID:Marcin11,项目名称:_mojePanstwo-Portal,代码行数:59,代码来源:MySessionHelper.php

示例7: logout

 public function logout()
 {
     // ログイン状態を削除する
     CakeSession::delete('loginId');
     // 		CakeSession::destroy();
     // ログイン画面を表示する
     $this->redirect("../login/");
 }
开发者ID:tatakauashi,项目名称:meiteampower,代码行数:8,代码来源:LoginController.php

示例8: delete

 public function delete($id)
 {
     if (CakeSession::delete('TempItems.' . $id)) {
         return true;
     } else {
         return false;
     }
 }
开发者ID:Marcin11,项目名称:_mojePanstwo-Portal,代码行数:8,代码来源:BdlTempItem.php

示例9: home

 public function home()
 {
     $this->layout = 'Home_layout';
     $key = 'iznWsaal5lKhOKu4f7f0YagKW81ClEBXqVuTjrFovrXXtOggrqHdDJqkGXsQpHf';
     CakeSession::delete('session_id');
     CakeSession::delete('session_name');
     CakeSession::delete('session_email');
     CakeSession::delete('session_code');
 }
开发者ID:amolshirude,项目名称:IdeaClicksPhp,代码行数:9,代码来源:LoginController.php

示例10: beforeRender

 public function beforeRender()
 {
     parent::beforeRender();
     $this->set("title_for_layout", "サマリー");
     if (CakeSession::check('errMsg')) {
         $this->set("errMsg", CakeSession::read('errMsg'));
         CakeSession::delete('errMsg');
     }
 }
开发者ID:tatakauashi,项目名称:meiteampower,代码行数:9,代码来源:SummaryController.php

示例11: testListLanguages

 public function testListLanguages()
 {
     CakeSession::delete('Config.language');
     $result = $this->MultiLanguage->listLanguages();
     $this->assertRegExp('/<span class="hhh">\\s*English\\s*<\\/span>/i', $result);
     CakeSession::write('Config.language', 'fra');
     $result = $this->MultiLanguage->listLanguages();
     $this->assertRegExp('/<span class="hhh">\\s*Français\\s*<\\/span>/i', $result);
 }
开发者ID:pdkhuong,项目名称:BBG,代码行数:9,代码来源:MultiLanguageHelperTest.php

示例12: removeItemCart

 public function removeItemCart($id)
 {
     $products = CakeSession::read('Cart');
     foreach ($products as $key => $product) {
         if ($product['Product']['id'] == $id) {
             CakeSession::delete('Cart.' . $key);
         }
     }
 }
开发者ID:pmoraes,项目名称:cakephp-project,代码行数:9,代码来源:ClientService.php

示例13: logout

 public function logout()
 {
     try {
         CakeSession::delete('User.identity');
         $this->redirect('/admin/login');
     } catch (Exception $e) {
         $this->Session->setFlash(__('Error occured. Error Message: ' . $e->getMessage()), 'flash/error_flash', null, 'error');
     }
 }
开发者ID:ruzdi,项目名称:bestjokes,代码行数:9,代码来源:AdminDashbordsController.php

示例14: setUp

 public function setUp()
 {
     parent::setUp();
     // BUGFIX for CakePHP2.5 - One has to write to the session before deleting actually works
     CakeSession::write('Auth', '');
     CakeSession::delete('Auth');
     $this->Controller = new CommonComponentTestController(new CakeRequest(), new CakeResponse());
     $this->Controller->constructClasses();
     $this->Controller->startupProcess();
 }
开发者ID:Jony01,项目名称:LLD,代码行数:10,代码来源:CommonComponentTest.php

示例15: testInitialize

 public function testInitialize()
 {
     CakeSession::delete('Config.language');
     $this->MultiLanguageComponent->initialize($this->Controller);
     $fallback = array_keys(Configure::read('MultiLanguage.fallback'));
     $this->assertEqual(Configure::read('Config.language'), $fallback[0]);
     CakeSession::write('Config.language', 'deu');
     $this->MultiLanguageComponent->initialize($this->Controller);
     $this->assertEqual(Configure::read('Config.language'), 'deu');
 }
开发者ID:pdkhuong,项目名称:BBG,代码行数:10,代码来源:MultiLanguageComponentTest.php


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