| 1 | <?php |
| 2 | |
| 3 | /* |
| 4 | * This function tell other modules what users have access |
| 5 | * to the plugin. |
| 6 | * |
| 7 | * Philippe Mingo |
| 8 | * |
| 9 | * $Id$ |
| 10 | */ |
| 11 | |
| 12 | function adm_check_user() { |
| 13 | GLOBAL $username, $PHP_SELF; |
| 14 | |
| 15 | if (strpos('options.php', $PHP_SELF)) { |
| 16 | $auth = FALSE; |
| 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')) { |
| 24 | $adm = posix_getpwuid( $adm_id ); |
| 25 | $auth = ($username == $adm['name']); |
| 26 | } else { |
| 27 | $auth = FALSE; |
| 28 | } |
| 29 | |
| 30 | return ($auth); |
| 31 | } |
| 32 | |
| 33 | ?> |