mirror of
https://github.com/myronblair/novacpx
synced 2026-06-30 17:50:41 -05:00
fix: hardcode panel ports in CORS check — PORT_USER etc undefined before Core.php loads
Using PORT_USER ?? 8880 threw Error in PHP 8 since the constant isn't defined until Core.php is require_once'd later in the file. Every API request was hitting the exception handler and returning 'An internal error occurred.', breaking all logins and API calls.
This commit is contained in:
+1
-1
@@ -33,7 +33,7 @@ $_allowedHosts = ['novacpx.orbishosting.com', 'admin.novacpx.orbishosting.com',
|
||||
'web.orbishosting.com'];
|
||||
$_originHost = parse_url($origin, PHP_URL_HOST) ?? '';
|
||||
$_originPort = (int)(parse_url($origin, PHP_URL_PORT) ?? 0);
|
||||
$_panelPorts = [PORT_USER ?? 8880, PORT_RESELLER ?? 8881, PORT_ADMIN ?? 8882, PORT_WEBMAIL ?? 8883];
|
||||
$_panelPorts = [8880, 8881, 8882, 8883]; // hardcoded — Core.php not loaded yet
|
||||
if ($origin && (
|
||||
in_array($_originHost, $_allowedHosts, true) ||
|
||||
(in_array($_originPort, $_panelPorts, true) && filter_var($_originHost, FILTER_VALIDATE_IP))
|
||||
|
||||
Reference in New Issue
Block a user