Skip to content

Commit 8b5af3b

Browse files
committed
Fixed subdir install url path
1 parent 1ffa2f6 commit 8b5af3b

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

system/routes.php

+7-2
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ public static function init() {
111111
}
112112

113113
self :: $init = true;
114+
114115
return true;
115116
}
116117

@@ -139,6 +140,10 @@ public static function get($route) {
139140
return self :: $routes[$route] ?? [];
140141
}
141142

143+
public static function getRoutes() {
144+
return self :: $routes ?? [];
145+
}
146+
142147
public static function varReplace($url, $parameters) {
143148
return preg_replace_callback('/' . self :: stringRegex . '|' . self :: numericRegex . '/',
144149
function ($matches) use ($parameters) {
@@ -228,9 +233,9 @@ function ($matches) use ($parameters, &$missing) {
228233
}, $pattern);
229234

230235
if ($missing) {
231-
return (V_SUBDIR_INSTALL ? V_SUBDIR_INSTALL : '') . '/?route=' . $route . '&' . (is_array($parameters) ? http_build_query($parameters) : '');
236+
return '/?route=' . $route . '&' . (is_array($parameters) ? http_build_query($parameters) : '');
232237
} else {
233-
return (V_SUBDIR_INSTALL ? V_SUBDIR_INSTALL : '') . $url;
238+
return $url;
234239
}
235240
}
236241
}

system/sites.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,8 @@ public static function url($url, $host = null) {
164164
return $matches['prefix'] .
165165
$subdomain . ($subdomain ? '.' : '') .
166166
$domain . ($tld ? '.' : '') . $tld .
167-
($matches['path'] ?? '');
167+
($matches['path'] ?? '') .
168+
(V_SUBDIR_INSTALL ? V_SUBDIR_INSTALL : '');
168169
}
169170

170171
//if host is ip number, localhost or does not have tld remove tld and subdomain
@@ -177,7 +178,8 @@ public static function url($url, $host = null) {
177178
(! empty($matches['subdomain']) ? $matches['subdomain'] . '.' : '') .
178179
($matches['domain'] ?? '') .
179180
(! empty($matches['tld']) ? '.' . $matches['tld'] : '') .
180-
($matches['path'] ?? '');
181+
($matches['path'] ?? '') .
182+
(V_SUBDIR_INSTALL ? V_SUBDIR_INSTALL : '');
181183
}
182184

183185
return $url;
@@ -238,8 +240,6 @@ public static function setSiteData($site, $name, $value) {
238240
} else {
239241
return self :: setSiteDataByKey($site, $name, $value);
240242
}
241-
242-
return false;
243243
}
244244

245245
public static function getHost() {
@@ -254,7 +254,7 @@ public static function getSiteData($site_url = false) {
254254
}
255255

256256
if (! $site_url) {
257-
$host =$_SERVER['HTTP_HOST'] ?? 'localhost';
257+
$host = $_SERVER['HTTP_HOST'] ?? 'localhost';
258258
}
259259

260260
$host = self :: siteKey($host);

0 commit comments

Comments
 (0)