|
|
@ -655,17 +655,19 @@ Class Common { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$allowed = true; |
|
|
|
$allowed = true; |
|
|
|
$authDirs = Common::getPwdAuthDirsFromSession(); |
|
|
|
$authDirs = self::getPwdAuthDirsFromSession(); |
|
|
|
if (!empty($authConfig['alldirs']) && empty($authConfig['nonebutdirs'][$dir]) && empty($authDirs['alldirs'])) { |
|
|
|
if (!empty($authConfig['default']) && empty($authConfig['allow'][$dir]) && !in_array('default', $authDirs)) { |
|
|
|
|
|
|
|
//所有目录都需要授权 |
|
|
|
$allowed = false; |
|
|
|
$allowed = false; |
|
|
|
}else if (!empty($authConfig['nonebutdirs'][$dir]) && empty($authDirs[$dir])) { |
|
|
|
}else if (empty($authConfig['default']) && !empty($authConfig['allow'][$dir]) && !in_array($dir, $authDirs)) { |
|
|
|
|
|
|
|
//只有部分目录需要授权 |
|
|
|
$allowed = false; |
|
|
|
$allowed = false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return $allowed; |
|
|
|
return $allowed; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//密码授权检查 |
|
|
|
//密码授权检查,如果密码正确,则增加目录到已授权列表 |
|
|
|
public static function pwdAuthToDir($dir, $userPassword) { |
|
|
|
public static function pwdAuthToDir($dir, $userPassword) { |
|
|
|
if( empty(FSC::$app['config']['password_auth']) ) { |
|
|
|
if( empty(FSC::$app['config']['password_auth']) ) { |
|
|
|
return true; |
|
|
|
return true; |
|
|
@ -676,15 +678,17 @@ Class Common { |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$allowed = true; |
|
|
|
$authed = false; |
|
|
|
$authDirs = Common::getPwdAuthDirsFromSession(); |
|
|
|
$authDirs = self::getPwdAuthDirsFromSession(); |
|
|
|
if (!empty($authConfig['alldirs']) && empty($authConfig['nonebutdirs'][$dir]) && empty($authDirs['alldirs'])) { |
|
|
|
if (!empty($authConfig['default']) && empty($authConfig['allow'][$dir]) && $userPassword == $authConfig['default']) { |
|
|
|
$allowed = false; |
|
|
|
self::savePwdAuthDirToSession($dir); |
|
|
|
}else if (!empty($authConfig['nonebutdirs'][$dir]) && empty($authDirs[$dir])) { |
|
|
|
$authed = true; |
|
|
|
$allowed = false; |
|
|
|
}else if (empty($authConfig['default']) && !empty($authConfig['allow'][$dir]) && $authConfig['allow'][$dir] == $userPassword) { |
|
|
|
|
|
|
|
self::savePwdAuthDirToSession($dir); |
|
|
|
|
|
|
|
$authed = true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return $allowed; |
|
|
|
return $authed; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |