forked from leonardoxc/leonardoxc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CL_auth.php
74 lines (60 loc) · 1.91 KB
/
CL_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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<?
//************************************************************************
// Leonardo XC Server, http://www.leonardoxc.net
//
// Copyright (c) 2004-2010 by Andreadakis Manolis
//
// This program is free software. You can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License.
//
// $Id: CL_auth.php,v 1.9 2012/10/25 18:39:52 manolis Exp $
//
//************************************************************************
class L_auth {
function auth() {
}
function isAdmin($userID){
global $admin_users;
if (@in_array($userID,$admin_users)) return 1;
else return 0;
}
function isModerator($userID){
global $admin_users,$mod_users;
if (@in_array($userID,$admin_users) || in_array($userID,$mod_users) ) return 1;
else return 0;
}
function isClubAdmin($userID,$clubID) {
global $clubsList;
if ($userID == 0 ) return 0;
if (is_array($clubsList[$clubID]['adminID'])) {
if ( @in_array($userID ,$clubsList[$clubID]['adminID']) ) return 1;
else return 0;
}
if ($clubsList[$clubID]['adminID']==$userID ) return 1;
else return 0;
}
function canDownloadIGC($ip) {
global $CONF;
if ( @in_array($ip,$CONF['auth']['download_igc']['allowed_ips']) ) {
return true;
} else {
return false;
}
}
static function airspaceVisible($userID,$flightUserID,$flightUserserverID) {
global $CONF,$CONF_airspaceChecks,$CONF_server_id ;;
if ( $CONF_airspaceChecks &&
( L_auth::isAdmin($userID) || $CONF['airspace']['view']=='public' ||
( $CONF['airspace']['view']=='registered' && $userID >0 ) ||
( $CONF['airspace']['view']=='own' && $userID == $flightUserID
&& ($flightUserserverID==0 || $flightUserserverID==$CONF_server_id ) )
)
) {
return 1;
} else {
return 0;
}
}
}
?>