관리자 인증 연동 정리

This commit is contained in:
seo
2026-07-02 19:05:21 +09:00
parent c5ab60a6e6
commit d000b25648
2 changed files with 46 additions and 15 deletions
+29
View File
@@ -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()) {