fix: blog url
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Baoshuo Ren 2022-09-20 15:30:23 +08:00
parent a932b51629
commit 29371d550e
Signed by: baoshuo
GPG Key ID: 00CB9680AB29F51A

View File

@ -54,7 +54,7 @@ class HTML {
break; break;
case 3: case 3:
$port = ((UOJConfig::$data['web']['main']['protocol'] === "http" && UOJConfig::$data['web']['main']['port'] == 80) || (UOJConfig::$data['web']['main']['protocol'] === "https" && UOJConfig::$data['web']['main']['port'] == 443)) ? '' : (':'.UOJConfig::$data['web']['main']['port']); $port = ((UOJConfig::$data['web']['main']['protocol'] === "http" && UOJConfig::$data['web']['main']['port'] == 80) || (UOJConfig::$data['web']['main']['protocol'] === "https" && UOJConfig::$data['web']['main']['port'] == 443)) ? '' : (':'.UOJConfig::$data['web']['main']['port']);
$url = UOJConfig::$data['web']['main']['protocol'].'://'.UOJConfig::$data['web']['main']['host'].$port.'/blog/'.blog_name_encode($username); $url = '/blog/'.blog_name_encode($username);
break; break;
} }
$url .= $uri; $url .= $uri;
@ -70,7 +70,7 @@ class HTML {
break; break;
case 3: case 3:
$port = ((UOJConfig::$data['web']['main']['protocol'] === "http" && UOJConfig::$data['web']['main']['port'] == 80) || (UOJConfig::$data['web']['main']['protocol'] === "https" && UOJConfig::$data['web']['main']['port'] == 443)) ? '' : (':'.UOJConfig::$data['web']['main']['port']); $port = ((UOJConfig::$data['web']['main']['protocol'] === "http" && UOJConfig::$data['web']['main']['port'] == 80) || (UOJConfig::$data['web']['main']['protocol'] === "https" && UOJConfig::$data['web']['main']['port'] == 443)) ? '' : (':'.UOJConfig::$data['web']['main']['port']);
$url = UOJConfig::$data['web']['main']['protocol'].'://'.UOJConfig::$data['web']['main']['host'].$port.'/blogs'; $url = '/blogs';
break; break;
} }
return HTML::escape(rtrim($url, '/')); return HTML::escape(rtrim($url, '/'));
@ -97,7 +97,7 @@ class HTML {
// } // }
if ($param) { if ($param) {
$url .= $path.'?'.HTML::query_string_encode($param); $url .= $path.'?'.HTML::query_string_encode($param);
} else { } else if ($url != '/') {
$url .= rtrim($path, '/'); $url .= rtrim($path, '/');
} }
return HTML::escape($url); return HTML::escape($url);