관리자 인증 연동 정리
This commit is contained in:
@@ -675,9 +675,38 @@ function signed_in(): bool
|
||||
return true;
|
||||
}
|
||||
|
||||
if (control_admin_session_from_rhymix_or_custom()) {
|
||||
$_SESSION['control_login'] = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
return auto_login_from_cookie();
|
||||
}
|
||||
|
||||
function control_admin_session_from_rhymix_or_custom(): bool
|
||||
{
|
||||
static $checked = null;
|
||||
if ($checked !== null) {
|
||||
return $checked;
|
||||
}
|
||||
|
||||
$checked = false;
|
||||
$commonAuth = '/mnt/synology-web/custom/common/auth.php';
|
||||
if (!is_file($commonAuth) || !is_readable($commonAuth)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
require_once $commonAuth;
|
||||
$checked = (function_exists('custom_auth_cookie_is_admin') && custom_auth_cookie_is_admin())
|
||||
|| (function_exists('custom_is_site_admin') && custom_is_site_admin());
|
||||
} catch (Throwable) {
|
||||
$checked = false;
|
||||
}
|
||||
|
||||
return $checked;
|
||||
}
|
||||
|
||||
function require_login(): void
|
||||
{
|
||||
if (!signed_in()) {
|
||||
|
||||
Reference in New Issue
Block a user