SM_PATH only required for CALLED pages, not includes.
[squirrelmail.git] / plugins / administrator / auth.php
CommitLineData
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 11function adm_check_user() {
12
2d977280 13 GLOBAL $username, $PHP_SELF;
7004cc32 14
26cbaf02 15 if ( strpos( 'options.php', $PHP_SELF ) ) {
71bf4974 16 $auth = FALSE;
2d977280 17 } else if ( file_exists( '../plugins/administrator/admins' ) ) {
0bde8324 18 $auths = file( '../plugins/administrator/admins' );
1f9d9ce4 19 $auth = in_array( "$username\n", $auths );
26cbaf02 20 } else if ( file_exists( '../config/admins' ) ) {
21 $auths = file( '../config/admins' );
22 $auth = in_array( "$username\n", $auths );
2d977280 23 } else if ( $adm_id = fileowner('../config/config.php') ) {
7004cc32 24 $adm = posix_getpwuid( $adm_id );
2d977280 25 $auth = ( $username == $adm['name'] );
7004cc32 26 }
a82293f6 27 else {
28 $auth = FALSE;
29 }
7004cc32 30
31 return( $auth );
32
33}
34
26cbaf02 35?>