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">×</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; }
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; } }
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; }
/** * 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.')); } } }
/** * Method executed after each test * * @return void */ public function tearDown() { parent::tearDown(); unset($this->Article); ClassRegistry::flush(); CakeSession::delete('Auth'); }
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; }
public function logout() { // ログイン状態を削除する CakeSession::delete('loginId'); // CakeSession::destroy(); // ログイン画面を表示する $this->redirect("../login/"); }
public function delete($id) { if (CakeSession::delete('TempItems.' . $id)) { return true; } else { return false; } }
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'); }
public function beforeRender() { parent::beforeRender(); $this->set("title_for_layout", "サマリー"); if (CakeSession::check('errMsg')) { $this->set("errMsg", CakeSession::read('errMsg')); CakeSession::delete('errMsg'); } }
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); }
public function removeItemCart($id) { $products = CakeSession::read('Cart'); foreach ($products as $key => $product) { if ($product['Product']['id'] == $id) { CakeSession::delete('Cart.' . $key); } } }
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'); } }
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(); }
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'); }
/** * connect method */ public function connect() { CakeSession::delete('Twitter.User'); if (!empty($this->consumerKey) && !empty($this->consumerSecret)) { $this->Twitter->setupApp($this->consumerKey, $this->consumerSecret); $this->Twitter->connectApp(Router::url(array('action' => 'authorization'), true)); } else { echo 'App key and secret key are not set'; break; } }
/** * SetUp method * * @return void */ public function setUp() { parent::setUp(); $this->Controller = new MobileComponentTestController(new CakeRequest(null, false), new CakeResponse()); $this->Controller->constructClasses(); $this->Controller->Mobile->Controller = $this->Controller; CakeSession::write('User', ''); CakeSession::delete('User'); CakeSession::write('Session', ''); CakeSession::delete('Session'); Configure::delete('User'); }
/** * Used to render the message set in FlashComponent::set() * * In your view: $this->Flash->render('somekey'); * Will default to flash if no param is passed * * You can pass additional information into the flash message generation. This allows you * to consolidate all the parameters for a given type of flash message into the view. * * ``` * echo $this->Flash->render('flash', array('params' => array('name' => $user['User']['name']))); * ``` * * This would pass the current user's name into the flash message, so you could create personalized * messages without the controller needing access to that data. * * Lastly you can choose the element that is used for rendering the flash message. Using * custom elements allows you to fully customize how flash messages are generated. * * ``` * echo $this->Flash->render('flash', array('element' => 'my_custom_element')); * ``` * * If you want to use an element from a plugin for rendering your flash message * you can use the dot notation for the plugin's element name: * * ``` * echo $this->Flash->render('flash', array( * 'element' => 'MyPlugin.my_custom_element', * )); * ``` * * @param string $key The [Message.]key you are rendering in the view. * @param array $options Additional options to use for the creation of this flash message. * Supports the 'params', and 'element' keys that are used in the helper. * @return string|null Rendered flash message or null if flash key does not exist * in session. * @throws UnexpectedValueException If value for flash settings key is not an array. */ public function render($key = 'flash', $options = array()) { if (!CakeSession::check("Message.{$key}")) { return; } $flash = CakeSession::read("Message.{$key}"); if (!is_array($flash)) { throw new UnexpectedValueException(sprintf('Value for flash setting key "%s" must be an array.', $key)); } $flash = $options + $flash; CakeSession::delete("Message.{$key}"); return $this->_View->element($flash['element'], $flash); }
public function delSession() { $menus = array(); $id = array(); $i = 0; $menus = CakeSession::read('Cart'); foreach ($menus as $menu) { $id[$i] = $menu['Menu']['id']; CakeSession::delete($id[$i]); $i++; } CakeSession::delete('Cart'); CakeSession::delete('Counter'); }
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); } $tmpVars = $flash['params']; $tmpVars['message'] = $message; $tmpOptions = array('plugin' => 'TwitterBootstrap'); $out = $this->_View->element('alert', $tmpVars, $tmpOptions); CakeSession::delete('Message.' . $key); } return $out; }
/** * Display all flash messages. * * TODO: export div wrapping method (for static messaging on a page) * * @param array $types Types to output. Defaults to all if none are specified. * @return string HTML */ public function flash(array $types = array()) { // Get the messages from the session $messages = (array) $this->Session->read('messages'); $cMessages = (array) Configure::read('messages'); if (!empty($cMessages)) { $messages = (array) Hash::merge($messages, $cMessages); } $html = ''; if (!empty($messages)) { $html = '<div class="flash-messages flashMessages">'; if ($types) { foreach ($types as $type) { // Add a div for each message using the type as the class. foreach ($messages as $messageType => $msgs) { if ($messageType !== $type) { continue; } foreach ((array) $msgs as $msg) { $html .= $this->_message($msg, $messageType); } } } } else { foreach ($messages as $messageType => $msgs) { foreach ((array) $msgs as $msg) { $html .= $this->_message($msg, $messageType); } } } $html .= '</div>'; if ($types) { foreach ($types as $type) { CakeSession::delete('messages.' . $type); Configure::delete('messages.' . $type); } } else { CakeSession::delete('messages'); Configure::delete('messages'); } } return $html; }
/** * Renders a webservice response * * @return void */ public function render() { Configure::write('debug', 0); $textarea = isset($this->viewVars['webserviceTextarea']); $noXjson = isset($this->viewVars['webserviceNoxjson']); foreach ($this->_webserviceBlacklistVars as $blacklisted) { if (isset($this->viewVars[$blacklisted])) { unset($this->viewVars[$blacklisted]); } } if (!empty($this->validationErrors)) { $this->viewVars['validationErrors'] = $this->validationErrors; } if ($this->_webserviceSessionFlash) { $this->viewVars['messages'] = CakeSession::read('Message'); CakeSession::delete('Message'); if (empty($this->viewVars['messages'])) { unset($this->viewVars['messages']); } } $format = $textarea ? '<textarea>%s</textarea>' : '%s'; $ext = 'json'; if (!empty($this->params->params['ext'])) { $ext = $this->params->params['ext']; } if ($ext == 'json') { $this->_header("Pragma: no-cache"); $this->_header("Cache-Control: no-store, no-cache, max-age=0, must-revalidate"); $this->_header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); $this->_header("Last-Modified: " . gmdate('D, d M Y H:i:s') . ' GMT'); if (!$textarea) { $this->_header('Content-type: application/json'); } $output = json_encode($this->viewVars); if (!$noXjson) { $this->_header("X-JSON: " . $output); } return sprintf($format, $output); } $this->_header('Content-type: application/xml'); return sprintf($format, $this->toXml($this->viewVars)); }
public function afterRender($viewFile) { CakeSession::delete('HighchartsPlugin.Charts'); }
public function tearDown() { parent::tearDown(); ClassRegistry::flush(); CakeSession::delete('Auth'); }
public function testsetExpressCheckout($ppdata) { //create config $paypalmode = $this->PayPalMode == 'sandbox' ? '.sandbox' : ''; //debug($this->PayPalMode); //exit(1); if (is_array($ppdata)) { //destroy all session first() CakeSession::delete('SessionData'); foreach ($ppdata['items'] as $n => $item) { foreach ($item as $items) { #if tax enable if (isset($ppdata['tax'])) { $tax = $ppdata['tax']; } else { $tax = null; } #if shipping enable if (isset($ppdata['shipcost'])) { $shipcost = $ppdata['shipcost']; } else { $shipcost = null; } #if ship discount enable if (isset($ppdata['shipdiscount'])) { $shipdiscount = $ppdata['shipdiscount']; } else { $shipdiscount = null; } #if handling cost enable if (isset($ppdata['handlingcost'])) { $handlingcost = $ppdata['handlingcost']; } else { $handlingcost = null; } #if insurance cost enable if (isset($ppdata['insurancecost'])) { $insurancecost = $ppdata['insurancecost']; } else { $insurancecost = null; } #if items quantity is more than 1 $totalprice = $items['price'] * $items['quantity']; $grandtotal = $items['price'] + $tax + $shipcost + $shipdiscount + $handlingcost + $insurancecost; //echo $grandTotal . '<br />'; $ppdata = "&METHOD=SetExpressCheckout" . "&RETURNURL=" . urlencode($this->PayPalReturnURL) . "&CANCELURL=" . urlencode($this->PayPalCancelURL) . "&PAYMENTREQUEST_0_PAYMENTACTION=" . urlencode("SALE") . "&L_PAYMENTREQUEST_0_NAME0=" . urlencode($items['name']) . "&L_PAYMENTREQUEST_0_NUMBER0=" . urlencode($n) . "&L_PAYMENTREQUEST_0_DESC0=" . urlencode($items['description']) . "&L_PAYMENTREQUEST_0_AMT0=" . urlencode($items['price']) . "&L_PAYMENTREQUEST_0_QTY0=" . urlencode($items['quantity']) . "&NOSHIPPING=0" . "&PAYMENTREQUEST_0_ITEMAMT=" . urlencode($totalprice) . "&PAYMENTREQUEST_0_TAXAMT=" . urlencode($tax) . "&PAYMENTREQUEST_0_SHIPPINGAMT=" . urlencode($shipcost) . "&PAYMENTREQUEST_0_SHIPDISCAMT=" . urlencode($shipdiscount) . "&PAYMENTREQUEST_0_HANDLINGAMT=" . urlencode($handlingcost) . "&PAYMENTREQUEST_0_INSURANCEAMT=" . urlencode($insurancecost) . "&PAYMENTREQUEST_0_AMT=" . urlencode($grandtotal) . "&PAYMENTREQUEST_0_CURRENCYCODE=" . urlencode($this->PayPalCurrencyCode) . "&LOCALECODE=GB" . "&LOGOIMG=http://intllab.com/v6cake/theme/V6/img/images/logov2longB.png" . "&CARTBORDERCOLOR=FFFFFF" . "&ALLOWNOTE=1"; //debug($ppdata); // exit(1); #write session CakeSession::write('SessionData', array('item_name' => $items['name'], 'item_number' => $n, 'item_description' => $items['description'], 'item_price' => $items['price'], 'item_quantity' => $items['quantity'], 'totalprice' => $totalprice, 'tax' => $tax, 'shipcost' => $shipcost, 'shipdiscount' => $shipdiscount, 'handlingcost' => $handlingcost, 'insurancecost' => $insurancecost, 'grandtotal' => $grandtotal)); #begin api contact,execute httpPost $httpParsedResponseAr = $this->httpPost('SetExpressCheckout', $ppdata, $this->PayPalApiUsername, $this->PayPalApiPassword, $this->PayPalApiSignature, $this->PayPalMode); //Respond according to message we receive from Paypal if ("SUCCESS" == strtoupper($httpParsedResponseAr["ACK"]) || "SUCCESSWITHWARNING" == strtoupper($httpParsedResponseAr["ACK"])) { //Redirect user to PayPal store with Token received. $paypalurl = 'https://www' . $paypalmode . '.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=' . $httpParsedResponseAr["TOKEN"] . ''; header('Location:' . $paypalurl); exit; } else { //Show error message echo '<div style="color:red"><b>Error : </b>' . urldecode($httpParsedResponseAr["L_LONGMESSAGE0"]) . '</div>'; echo '<pre>'; print_r($httpParsedResponseAr); echo '</pre>'; } } } } else { //return false; } }
/** * Wrapper for SessionComponent::del(); * * In your controller: $this->Session->delete('Controller.sessKey'); * * @param string $name the name of the session key you want to delete * @return boolean true is session variable is set and can be deleted, false is variable was not set. * @access public * @link http://book.cakephp.org/view/1316/delete */ function delete($name) { if ($this->__active === true) { $this->__start(); return parent::delete($name); } return false; }
/** * testSetLanguageWithSession method * * @return void */ public function testSetLanguageWithSession() { CakeSession::write('Config.language', 'po'); $singular = $this->_singular(); $this->assertEquals('Po (translated)', $singular); $plurals = $this->_plural(); $this->assertTrue(in_array('0 everything else (po translated)', $plurals)); $this->assertTrue(in_array('1 is 1 (po translated)', $plurals)); $this->assertTrue(in_array('2 is 2-4 (po translated)', $plurals)); $this->assertTrue(in_array('3 is 2-4 (po translated)', $plurals)); $this->assertTrue(in_array('4 is 2-4 (po translated)', $plurals)); $this->assertTrue(in_array('5 everything else (po translated)', $plurals)); $this->assertTrue(in_array('6 everything else (po translated)', $plurals)); $this->assertTrue(in_array('7 everything else (po translated)', $plurals)); $this->assertTrue(in_array('8 everything else (po translated)', $plurals)); $this->assertTrue(in_array('9 everything else (po translated)', $plurals)); $this->assertTrue(in_array('10 everything else (po translated)', $plurals)); $this->assertTrue(in_array('11 everything else (po translated)', $plurals)); $this->assertTrue(in_array('12 everything else (po translated)', $plurals)); $this->assertTrue(in_array('13 everything else (po translated)', $plurals)); $this->assertTrue(in_array('14 everything else (po translated)', $plurals)); $this->assertTrue(in_array('15 everything else (po translated)', $plurals)); $this->assertTrue(in_array('16 everything else (po translated)', $plurals)); $this->assertTrue(in_array('17 everything else (po translated)', $plurals)); $this->assertTrue(in_array('18 everything else (po translated)', $plurals)); $this->assertTrue(in_array('19 everything else (po translated)', $plurals)); $this->assertTrue(in_array('20 everything else (po translated)', $plurals)); $this->assertTrue(in_array('21 everything else (po translated)', $plurals)); $this->assertTrue(in_array('22 everything else (po translated)', $plurals)); $this->assertTrue(in_array('23 everything else (po translated)', $plurals)); $this->assertTrue(in_array('24 everything else (po translated)', $plurals)); $this->assertTrue(in_array('25 everything else (po translated)', $plurals)); CakeSession::delete('Config.language'); }
/** * Wrapper for SessionComponent::del(); * * In your controller: $this->Session->delete('Controller.sessKey'); * * @param string $name the name of the session key you want to delete * @return boolean true is session variable is set and can be deleted, false is variable was not set. * @link http://book.cakephp.org/2.0/en/core-libraries/components/sessions.html#SessionComponent::delete */ public function delete($name) { return CakeSession::delete($name); }
public function Request($group_id, $random_no, $email) { //session $user_id = CakeSession::read('session_id'); $user_name = CakeSession::read('session_name'); $user_email = CakeSession::read('session_email'); $this->loadModel('Invitation'); $condition = array('conditions' => array('and' => array('Invitation.nbr_group_id' => $group_id, 'Invitation.nbr_random_no' => $random_no))); $result3 = $this->Invitation->find('first', $condition); if (!empty($result3)) { $this->loadModel('Request'); $this->Request->save(array('nbr_user_id' => $user_id, 'nbr_group_id' => $group_id, 'txt_status' => 'Accepted')); $this->Invitation->query("DELETE FROM `mst_user_invitation` WHERE nbr_group_id = '{$group_id}' and nbr_random_no = '{$random_no}' "); //delete session values CakeLog::write('info', 'I have joined the group and its group id is : ' . $group_id); CakeSession::delete('group_id'); CakeSession::delete('random_no'); } }
/** * Used to render the message set in Controller::Session::setFlash() * * In your view: $this->Session->flash('somekey'); * Will default to flash if no param is passed * * You can pass additional information into the flash message generation. This allows you * to consolidate all the parameters for a given type of flash message into the view. * * {{{ * echo $this->Session->flash('flash', array('params' => array('class' => 'new-flash'))); * }}} * * The above would generate a flash message with a custom class name. Using $attrs['params'] you * can pass additional data into the element rendering that will be made available as local variables * when the element is rendered: * * {{{ * echo $this->Session->flash('flash', array('params' => array('name' => $user['User']['name']))); * }}} * * This would pass the current user's name into the flash message, so you could create peronsonalized * messages without the controller needing access to that data. * * Lastly you can choose the element that is rendered when creating the flash message. Using * custom elements allows you to fully customize how flash messages are generated. * * {{{ * echo $this->Session->flash('flash', array('element' => 'my_custom_element')); * }}} * * @param string $key The [Message.]key you are rendering in the view. * @return array $attrs Additional attributes to use for the creation of this flash message. * Supports the 'params', and 'element' keys that are used in the helper. * @access public * @link http://book.cakephp.org/view/1466/Methods * @link http://book.cakephp.org/view/1467/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 = 'message'; if (!empty($flash['params']['class'])) { $class = $flash['params']['class']; } $out = '<div id="' . $key . 'Message" class="' . $class . '">' . $message . '</div>'; } elseif ($flash['element'] == '' || $flash['element'] == null) { $out = $message; } else { $tmpVars = $flash['params']; $tmpVars['message'] = $message; $out = $this->_View->element($flash['element'], $tmpVars); } CakeSession::delete('Message.' . $key); } return $out; }