X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=plugins%2Fadministrator%2Fauth.php;h=edfca36fcdcd8b9b1d2972287246c6398a4e6ce4;hb=d1d2eafdd109779da1f64dd7c132639c5d399163;hp=1f8826b437c7189a168e089bc1c5acfbbc396250;hpb=71bf4974159d140aa474621f0ad4f154b6000088;p=squirrelmail.git diff --git a/plugins/administrator/auth.php b/plugins/administrator/auth.php index 1f8826b4..edfca36f 100644 --- a/plugins/administrator/auth.php +++ b/plugins/administrator/auth.php @@ -1,29 +1,67 @@ 'options.php' ) { + /* This needs to be first, for all non_options pages */ + //if (!defined('PAGE_NAME') || strpos(PAGE_NAME, 'options') === FALSE) { + if (!defined('PAGE_NAME') + || (PAGE_NAME != 'administrator_options' && PAGE_NAME != 'options')) { $auth = FALSE; - } else if ( file_exists( '../plugins/administrator/admins' ) ) { - $auths = file( '../plugins/administrator/admins' ); - $auth = in_array( "$username\n", $auths ); - } else if ( $adm_id = fileowner('../config/config.php') ) { + } else if (file_exists(SM_PATH . 'plugins/administrator/admins')) { + $auths = file(SM_PATH . 'plugins/administrator/admins'); + array_walk($auths, 'adm_array_trim'); + $auth = in_array($username, $auths); + } else if (file_exists(SM_PATH . 'config/admins')) { + $auths = file(SM_PATH . 'config/admins'); + array_walk($auths, 'adm_array_trim'); + $auth = in_array($username, $auths); + } else if (($adm_id = fileowner(SM_PATH . 'config/config.php')) && + function_exists('posix_getpwuid')) { $adm = posix_getpwuid( $adm_id ); - $auth = ( $username == $adm['name'] ); + $auth = ($username == $adm['name']); + } else { + $auth = FALSE; } - return( $auth ); - + return ($auth); } -?> \ No newline at end of file +/** + * Removes whitespace from array values + * @param string $value array value that has to be trimmed + * @param string $key array key + * @since 1.5.1 and 1.4.5 + * @access private + */ +function adm_array_trim(&$value,$key) { + $value=trim($value); +}