fix: billing cleanup, PayPal guard, docs nav prefix, coupon dark theme, XML guide link
Agent-Logs-Url: https://github.com/GameServerPanel/GSP/sessions/52e5015e-f5cf-42e2-bc32-b1c77193a13f Co-authored-by: iaretechnician <2749183+iaretechnician@users.noreply.github.com>
This commit is contained in:
parent
a45d102845
commit
9944b59332
6 changed files with 158 additions and 37 deletions
|
|
@ -16,6 +16,7 @@ $nav_prefix = '';
|
|||
$scriptName = $_SERVER['SCRIPT_NAME'] ?? '';
|
||||
if (is_string($scriptName) && $scriptName !== '') {
|
||||
if (preg_match('#/modules/billing/(.*)$#', $scriptName, $match)) {
|
||||
// Panel-embedded or non-root deployment: depth relative to modules/billing/
|
||||
$subPath = $match[1];
|
||||
if ($subPath !== '') {
|
||||
$depth = substr_count($subPath, '/');
|
||||
|
|
@ -23,6 +24,17 @@ if (is_string($scriptName) && $scriptName !== '') {
|
|||
$nav_prefix = str_repeat('../', $depth);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Root deployment: compute prefix from the script's directory depth so that
|
||||
// links such as index.php correctly resolve to /index.php even when the
|
||||
// current page lives in a subdirectory like /docs/.
|
||||
$dir = dirname($scriptName);
|
||||
if ($dir !== '/' && $dir !== '' && $dir !== '.') {
|
||||
$segments = array_filter(explode('/', $dir), static function ($s) { return $s !== ''; });
|
||||
if (!empty($segments)) {
|
||||
$nav_prefix = str_repeat('../', count($segments));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$nav_prefix = $nav_prefix ?: '';
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue