7004cc32 |
1 | <?php |
2 | |
2d977280 |
3 | /* |
4 | * This function tell other modules what users have access |
5 | * to the plugin. |
6 | * |
7 | * Philippe Mingo |
8 | * |
9 | * $Id$ |
10 | */ |
7004cc32 |
11 | |
52a6105d |
12 | function adm_check_user() { |
2d977280 |
13 | GLOBAL $username, $PHP_SELF; |
7004cc32 |
14 | |
52a6105d |
15 | if (strpos('options.php', $PHP_SELF)) { |
71bf4974 |
16 | $auth = FALSE; |
52a6105d |
17 | } else if (file_exists(SM_PATH . 'plugins/administrator/admins')) { |
18 | $auths = file(SM_PATH . 'plugins/administrator/admins'); |
19 | $auth = in_array("$username\n", $auths); |
20 | } else if (file_exists(SM_PATH . 'config/admins')) { |
21 | $auths = file(SM_PATH . 'config/admins'); |
22 | $auth = in_array("$username\n", $auths); |
23 | } else if ($adm_id = fileowner(SM_PATH . 'config/config.php')) { |
7004cc32 |
24 | $adm = posix_getpwuid( $adm_id ); |
52a6105d |
25 | $auth = ($username == $adm['name']); |
26 | } else { |
a82293f6 |
27 | $auth = FALSE; |
28 | } |
7004cc32 |
29 | |
52a6105d |
30 | return ($auth); |
7004cc32 |
31 | } |
32 | |
26cbaf02 |
33 | ?> |