public function exitSystem()
 {
     session_start();
     session_destroy();
     CakeSession::destroy();
     $this->redirect('/logins/index', null, true);
 }
Exemplo n.º 2
0
 /**
  * tearDown
  *
  * @return void
  */
 public function tearDown()
 {
     parent::tearDown();
     CakeSession::clear();
     CakeSession::destroy();
     ClassRegistry::flush();
 }
Exemplo n.º 3
0
 /**
  * tearDown
  *
  * @return void
  */
 public function tearDown()
 {
     parent::tearDown();
     if (CakeSession::started()) {
         CakeSession::clear();
         CakeSession::destroy();
     }
     ClassRegistry::flush();
 }
 /**
  * SetUp method
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     $this->_admin = Configure::read('Routing.prefixes.0');
     Configure::write('Routing.prefixes.0', 'admin');
     CakeSession::destroy();
     $this->Controller = new TestMenuGathererController(new CakeRequest(), new CakeResponse());
     $this->Controller->constructClasses();
     $this->Controller->startupProcess();
     $this->MenuGatherer = new TestMenuGathererComponent(new ComponentCollection());
 }
 public function index()
 {
     CakeSession::destroy();
 }
Exemplo n.º 6
0
 /**
  * Used to destroy sessions
  *
  * In your controller: $this->Session->destroy();
  *
  * @return void
  * @link http://book.cakephp.org/2.0/en/core-libraries/components/sessions.html#SessionComponent::destroy
  */
 public function destroy()
 {
     return CakeSession::destroy();
 }
Exemplo n.º 7
0
 /**
  * @brief after a test stops
  *
  * unset the model object and clear out the registry
  *
  * @access public
  *
  * @return void
  */
 public function endTest($method)
 {
     if (!is_subclass_of($this, 'AppControllerTestCase')) {
         return;
     }
     list($plugin, $controller) = pluginSplit($this->setup[$this->setup['type']]);
     unset($this->{$controller});
     ClassRegistry::flush();
     if (class_exists('CakeSession')) {
         CakeSession::destroy();
     }
     $this->AppTest->endTest($method);
     echo sprintf('<div style="padding: 8px; background-color: green; color: white;">%s <span style="color:#ffdd00;">[%ss]</span></div>', $this->AppTest->prettyTestMethod($method), $this->data[$method]['total']);
     echo '</div>';
     if ($this->stop === true) {
         debug('Skipping further tests', false, false);
         $this->AppTest->endTest();
         exit;
     }
 }
Exemplo n.º 8
0
 function logout()
 {
     $this->set('title_for_layout', "User::logout");
     CakeLog::write('info', 'cakelog write: logout, uid:' . CakeSession::read('uid'));
     $this->log('logout, uid=' . CakeSession::read('uid'), 'info');
     $this->Session->delete('uid');
     CakeSession::destroy();
     $this->redirect('/');
 }
 /**
  * tearDown method
  *
  * @return void
  */
 public function tearDown()
 {
     parent::tearDown();
     unset($this->View, $this->Flash);
     CakeSession::destroy();
 }
Exemplo n.º 10
0
 public function save_workout_complete()
 {
     $workoutData = CakeSession::read('custom_workout');
     $templateData = $this->request->data;
     $redirect = true;
     $userID = $_COOKIE['UID'];
     $this->loadModel('Member');
     $findUser = $this->Member->find('all', array('conditions' => array('id' => $userID)));
     $this->loadModel('Workout');
     $this->loadModel('WorkoutAttribute');
     $this->loadModel('WorkoutTemplate');
     $this->loadModel('WorkoutAttributeDetail');
     $this->loadModel('WorkoutTemplateDetail');
     if (CakeSession::read('saved_workout')) {
         $workD['Workout']['id'] = CakeSession::read('saved_workout');
     }
     $workD['Workout']['member_id'] = $findUser[0]['Member']['id'];
     $workD['Workout']['type'] = $workoutData['exercise_type'];
     if ($this->Workout->save($workD)) {
         $workoutID = $this->Workout->id;
         CakeSession::write('saved_workout', $workoutID);
         if (CakeSession::read('saved_workout_template_id')) {
             $workoutTemplateData['WorkoutTemplate']['id'] = CakeSession::read('saved_workout_template_id');
         }
         $workoutTemplateData['WorkoutTemplate']['workout_id'] = $workoutID;
         $workoutTemplateData['WorkoutTemplate']['template_name'] = $workoutData['template_name'];
         if ($this->WorkoutTemplate->save($workoutTemplateData)) {
             $workoutTemplateID = $this->WorkoutTemplate->id;
             CakeSession::write('saved_workout_template_id', $workoutTemplateID);
             foreach ($templateData['template_details'] as $tempData) {
                 $this->WorkoutTemplateDetail->create();
                 $workoutTemplateDetailsData['WorkoutTemplateDetail']['workout_template_id'] = $workoutTemplateID;
                 $workoutTemplateDetailsData['WorkoutTemplateDetail']['name'] = $tempData['name'];
                 $workoutTemplateDetailsData['WorkoutTemplateDetail']['value'] = $tempData['value'];
                 $this->WorkoutTemplateDetail->save($workoutTemplateDetailsData);
             }
         } else {
             $redirect = false;
         }
         foreach ($workoutData['attributes'] as $attributes) {
             $attributeData['WorkoutAttribute']['workout_id'] = $workoutID;
             $attributeData['WorkoutAttribute']['name'] = $attributes['name'];
             $this->WorkoutAttribute->create();
             if ($this->WorkoutAttribute->save($attributeData)) {
                 $workoutAttributeID = $this->WorkoutAttribute->id;
                 foreach ($attributes['attribute'] as $a) {
                     $this->WorkoutAttributeDetail->create();
                     $aData['WorkoutAttributeDetail']['workout_attribute_id'] = $workoutAttributeID;
                     $aData['WorkoutAttributeDetail']['name'] = $a['name'];
                     $aData['WorkoutAttributeDetail']['value'] = $a['value'];
                     $this->WorkoutAttributeDetail->save($aData);
                 }
             } else {
                 $redirect = false;
             }
         }
     } else {
         $redirect = false;
     }
     CakeSession::destroy('custom_workout');
     CakeSession::destroy('saved_workout_template_id');
     CakeSession::destroy('saved_workout');
     echo json_encode($redirect);
     die;
 }
Exemplo n.º 11
0
 /**
  *
  */
 public function order()
 {
     $countries = array("Afghanistan", "Aland Islands", "Albania", "Algeria", "American Samoa", "Andorra", "Angola", "Anguilla", "Antarctica", "Antigua", "Argentina", "Armenia", "Aruba", "Australia", "Austria", "Azerbaijan", "Bahamas", "Bahrain", "Bangladesh", "Barbados", "Barbuda", "Belarus", "Belgium", "Belize", "Benin", "Bermuda", "Bhutan", "Bolivia", "Bosnia", "Botswana", "Bouvet Island", "Brazil", "British Indian Ocean Trty.", "Brunei Darussalam", "Bulgaria", "Burkina Faso", "Burundi", "Caicos Islands", "Cambodia", "Cameroon", "Canada", "Cape Verde", "Cayman Islands", "Central African Republic", "Chad", "Chile", "China", "Christmas Island", "Cocos (Keeling) Islands", "Colombia", "Comoros", "Congo", "Congo, Democratic Republic of the", "Cook Islands", "Costa Rica", "Cote d'Ivoire", "Croatia", "Cuba", "Cyprus", "Czech Republic", "Denmark", "Djibouti", "Dominica", "Dominican Republic", "Ecuador", "Egypt", "El Salvador", "Equatorial Guinea", "Eritrea", "Estonia", "Ethiopia", "Falkland Islands (Malvinas)", "Faroe Islands", "Fiji", "Finland", "France", "French Guiana", "French Polynesia", "French Southern Territories", "Futuna Islands", "Gabon", "Gambia", "Georgia", "Germany", "Ghana", "Gibraltar", "Greece", "Greenland", "Grenada", "Guadeloupe", "Guam", "Guatemala", "Guernsey", "Guinea", "Guinea-Bissau", "Guyana", "Haiti", "Heard", "Herzegovina", "Holy See", "Honduras", "Hong Kong", "Hungary", "Iceland", "India", "Indonesia", "Iran (Islamic Republic of)", "Iraq", "Ireland", "Isle of Man", "Israel", "Italy", "Jamaica", "Jan Mayen Islands", "Japan", "Jersey", "Jordan", "Kazakhstan", "Kenya", "Kiribati", "Korea", "Korea (Democratic)", "Kuwait", "Kyrgyzstan", "Lao", "Latvia", "Lebanon", "Lesotho", "Liberia", "Libyan Arab Jamahiriya", "Liechtenstein", "Lithuania", "Luxembourg", "Macao", "Macedonia", "Madagascar", "Malawi", "Malaysia", "Maldives", "Mali", "Malta", "Marshall Islands", "Martinique", "Mauritania", "Mauritius", "Mayotte", "McDonald Islands", "Mexico", "Micronesia", "Miquelon", "Moldova", "Monaco", "Mongolia", "Montenegro", "Montserrat", "Morocco", "Mozambique", "Myanmar", "Namibia", "Nauru", "Nepal", "Netherlands", "Netherlands Antilles", "Nevis", "New Caledonia", "New Zealand", "Nicaragua", "Niger", "Nigeria", "Niue", "Norfolk Island", "Northern Mariana Islands", "Norway", "Oman", "Pakistan", "Palau", "Palestinian Territory, Occupied", "Panama", "Papua New Guinea", "Paraguay", "Peru", "Philippines", "Pitcairn", "Poland", "Portugal", "Principe", "Puerto Rico", "Qatar", "Reunion", "Romania", "Russian Federation", "Rwanda", "Saint Barthelemy", "Saint Helena", "Saint Kitts", "Saint Lucia", "Saint Martin (French part)", "Saint Pierre", "Saint Vincent", "Samoa", "San Marino", "Sao Tome", "Saudi Arabia", "Senegal", "Serbia", "Seychelles", "Sierra Leone", "Singapore", "Slovakia", "Slovenia", "Solomon Islands", "Somalia", "South Africa", "South Georgia", "South Sandwich Islands", "Spain", "Sri Lanka", "Sudan", "Suriname", "Svalbard", "Swaziland", "Sweden", "Switzerland", "Syrian Arab Republic", "Taiwan", "Tajikistan", "Tanzania", "Thailand", "The Grenadines", "Timor-Leste", "Tobago", "Togo", "Tokelau", "Tonga", "Trinidad", "Tunisia", "Turkey", "Turkmenistan", "Turks Islands", "Tuvalu", "Uganda", "Ukraine", "United Arab Emirates", "United Kingdom", "United States", "Uruguay", "US Minor Outlying Islands", "Uzbekistan", "Vanuatu", "Vatican City State", "Venezuela", "Vietnam", "Virgin Islands (British)", "Virgin Islands (US)", "Wallis", "Western Sahara", "Yemen", "Zambia", "Zimbabwe");
     $captcha = $this->Session->read('captcha_code');
     if ($this->request->is('post')) {
         if (!empty($this->request->data['Order'])) {
             if ($captcha == $this->request->data['Order']['captcha']) {
                 $order_details = $this->request->data['Order'];
                 $order_details['order_item_count'] = $this->Cart->getCount();
                 $order_details['total'] = CakeSession::read('total');
                 $order_details['user_id'] = $this->Auth->user('id');
                 $order_details['country'] = $countries[$order_details['country']];
                 if (!$this->Order->save($order_details)) {
                     $this->Session->setFlash('Something went wrong, please try again!');
                 }
                 $foreign_key = $this->Order->getLastInsertID();
                 $this->OrderItem->updateAll(array('OrderItem.order_id' => $foreign_key), array('OrderItem.session_id' => CakeSession::id()));
                 $order = $this->OrderItem->find('all', array('conditions' => array('OrderItem.session_id' => CakeSession::id())));
                 $this->Session->write('order', $order);
                 $filename = date('Y-m-d H.i.s');
                 $this->createPdf($filename);
                 $email = $order_details['email'];
                 $this->sendBill($order, $email, $filename);
                 //ez töröl mindent, de nekem csak a kosarat kell, a user cuccokat nem (ne jelentkeztessen ki)
                 CakeSession::destroy();
                 $this->view = 'success';
             } else {
                 $this->Session->setFlash(__('Captcha code does not match'));
                 $this->redirect(array('action' => 'checkOut'));
             }
         }
     }
 }
Exemplo n.º 12
0
 /**
  * @brief after a test stops
  *
  * unset the model object and clear out the registry
  *
  * @access public
  *
  * @return void
  */
 public function endTest($method)
 {
     list($plugin, $behavior) = pluginSplit($this->setup[$this->setup['type']]);
     $behaviorClass = $behavior . 'Behavior';
     unset($this->{$behaviorClass});
     foreach ($this->setup['models'] as $modelToLoad) {
         list($plugin, $model) = pluginSplit($modelToLoad);
         unset($this->{$model});
     }
     ClassRegistry::flush();
     if (class_exists('CakeSession')) {
         $CakeSession = new CakeSession();
         $CakeSession->destroy();
     }
     $this->AppTest->endTest($method);
     return true;
     echo sprintf('<div style="padding: 8px; background-color: green; color: white;">%s <span style="color:#ffdd00;">[%ss]</span></div>', $this->AppTest->prettyTestMethod($method), $this->data[$method]['total']);
     echo '</div>';
     if ($this->stop === true) {
         debug('Skipping further tests', false, false);
         $this->AppTest->endTest();
         exit;
     }
 }
Exemplo n.º 13
0
 public function __construct(ControllerTestCase $controllerTestCase)
 {
     $this->controllerTestCase = $controllerTestCase;
     $this->controllerName = substr(get_class($this->controllerTestCase), 0, -strlen('ControllerTest'));
     CakeSession::destroy();
 }
Exemplo n.º 14
0
 /**
  * @brief after a test stops
  *
  * unset the model object and clear out the registry
  *
  * @access public
  *
  * @return void
  */
 public function endTest($method)
 {
     list($plugin, $helper) = pluginSplit($this->setup[$this->setup['type']]);
     $helperClass = $helper . 'Helper';
     unset($this->{$helper});
     foreach ($this->setup['models'] as $modelToLoad) {
         list($plugin, $model) = pluginSplit($modelToLoad);
         unset($this->{$model});
     }
     ClassRegistry::flush();
     if (class_exists('CakeSession')) {
         CakeSession::destroy();
     }
     $this->AppTest->endTest($method);
     echo sprintf('<div style="padding: 8px; background-color: green; color: white;">%s <span style="color:#ffdd00;">[%ss]</span></div>', $this->AppTest->prettyTestMethod($method), $this->data[$method]['total']);
     echo '</div>';
     if ($this->stop === true) {
         echo '<pre class="cake-debug">Skipping further tests</pre>';
         $this->AppTest->endTest();
         exit;
     }
 }
Exemplo n.º 15
0
 /**
  * testAfterFind method
  *
  * @return void
  */
 public function testAfterFind()
 {
     $article = array('Article' => array('title' => 'Lorem ipsum', 'body' => 'Lorem ipsum', 'published' => 1), 'User' => array(array('id' => 838239), array('id' => 38989128)));
     $this->Model->save($article);
     $articleId = $this->Model->id;
     CakeSession::write('Auth.User.id', 7);
     // set user id
     $result = $this->Model->find('all', array('conditions' => array('Article.id' => $articleId)));
     $this->assertTrue(empty($result));
     // test that result is empty because our user id is not 838239, or 38989128
     CakeSession::write('Auth.User.id', 838239);
     // set user id
     $result = $this->Model->find('all', array('conditions' => array('Article.id' => $articleId)));
     $this->assertTrue(!empty($result));
     // should now be filled because the user id is now set
     $this->assertTrue(!empty($result[0]['Article']['__used']));
     // test that the __used field exists and is filled
     CakeSession::write('Auth.User.id', 38989128);
     // set user id
     $result = $this->Model->find('first', array('conditions' => array('Article.id' => $articleId)));
     $this->assertGreaterThan(1, $result['Article']['__used']);
     // test that it works with single records as well
     CakeSession::destroy();
 }
 /**
  * tearDown method
  *
  * @return void
  */
 public function tearDown()
 {
     parent::tearDown();
     CakeSession::destroy();
 }
Exemplo n.º 17
0
 /**
  * Used to destroy sessions
  *
  * In your controller: $this->Session->destroy();
  *
  * @return void
  * @access public
  */
 function destroy()
 {
     if ($this->__active === true) {
         $this->__start();
         parent::destroy();
     }
 }
Exemplo n.º 18
0
 /**
  * HTTPSによるSession設定テスト
  *
  * @param int $expects 予測値
  * @param string $siteUrl BcEnv.siteUrlの値
  * @param string $sslUrl BcEnv.sslUrlの値
  * @return void
  *
  * @dataProvider sessionConfigureUrlDataProvider
  */
 public function testSessionConfigureUrl($expects, $siteUrl, $sslUrl)
 {
     if (CakeSession::started()) {
         CakeSession::destroy();
     }
     //		p(CakeSession::started());
     ini_set('session.cookie_secure', 0);
     Configure::write('BcEnv.siteUrl', $siteUrl);
     Configure::write('BcEnv.sslUrl', $sslUrl);
     require APP . 'Config' . DS . 'session.php';
     CakeSession::start();
     $this->assertEquals($expects, intval(ini_get('session.cookie_secure')));
 }