forked from vknyvz/gym-Tracker-App
/
Auth.php
executable file
·59 lines (55 loc) · 1.22 KB
/
Auth.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
/**
* vkNgine3 Admin System
*
* NOTICE OF LICENSE
*
* This source file is subject to the new BSD license.
*
* @category core
* @package vkNgine3
* @copyright Copyright (c) 2011 Volkan Yavuz (http://www.vknyvz.com)
*/
class vkNgine_Auth
{
/**
* Returns true if session is authenticated (an identity exists).
*
* @return bool
*/
static function isAuthenticated()
{
return Zend_Auth::getInstance()->hasIdentity();
}
/**
* gets an identity
*/
static function getIdentity()
{
return Zend_Auth::getInstance()->getIdentity();
}
/**
* Clears the session data and logs out the current user.
*
* @return void
*/
public function logout()
{
return Zend_Auth::getInstance()->clearIdentity();
}
/**
* revalidates the given user
*
* @return bool
*/
public static function revalidate() {
$user = vkNgine_Auth::getIdentity();
if ($user['type'] == 'STANDARD') {
return vkNgine_Public_Auth::revalidate();
} else if ($user['type'] == 'ADMIN') {
return vkNgine_Admin_Auth::revalidate();
} else {
return false;
}
}
}