This repository has been archived by the owner on Sep 28, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app_controller.php
executable file
·59 lines (52 loc) · 1.92 KB
/
app_controller.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?php
/**
* Application level Controller
*
* This file is application-wide controller file. You can put all
* application-wide controller-related methods here.
*
* PHP versions 4 and 5
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake
* @subpackage cake.app
* @since CakePHP(tm) v 0.2.9
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
/**
* Application Controller
*
* Add your application-wide methods in the class below, your controllers
* will inherit them.
*
* @package cake
* @subpackage cake.app
*/
class AppController extends Controller {
var $helpers = array('Time', 'Htmlbis','Menu');
var $components = array('DebugKit.Toolbar','Session','Authake');
function __makePassword($password1, $password2) {
if ($password1 != $password2) {
$this->Session->setFlash(__('The two passwords do not match!', true), 'error');
return false;
}
return md5($password1);
}
function beforeFilter() { //pr($this);
if ($this->Authake->isLogged()){ // Checking for the SESSION - Proceed only if MEMBER/USER is logged in.
$this->loadModel('User'); // Loading MEMBER Model
// UPDATE MEMBER VISIT TIME
$last_visit = date('Y-m-d H:i:s', time());
$this->User->updateAll(array('User.lastvisit' => '"'.$last_visit.'"'), array('User.id' => $this->Authake->getUserId()));
}
$this->Authake->beforeFilter($this);
return true;
} // end beforeFilter()
}