1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-08 07:47:00 +02:00

Merge branch 'fix-input-url-path' of https://github.com/adrianbj/processwire into adrianbj-fix-input-url-path

This commit is contained in:
Ryan Cramer
2017-01-03 05:14:16 -05:00

View File

@@ -489,12 +489,15 @@ class WireInput extends Wire {
} else if(isset($_SERVER['REQUEST_URI'])) {
// page not yet available, attempt to pull URL from request uri
$parts = explode('/', $_SERVER['REQUEST_URI']);
$charset = $config->pageNameCharset;
foreach($parts as $part) {
$url .= "/" . ($charset === 'UTF8' ? $sanitizer->pageNameUTF8($part) : $sanitizer->pageName($part, false));
}
$info = parse_url($_SERVER['REQUEST_URI']);
$parts = explode('/', $info['path']);
$charset = $config->pageNameCharset;
$i = 0;
foreach($parts as $part) {
if($i > 0) $url .= "/";
$url .= ($charset === 'UTF8' ? $sanitizer->pageNameUTF8($part) : $sanitizer->pageName($part, false));
$i++;
}
if(!empty($info['path']) && substr($info['path'], -1) == '/') {
$url = rtrim($url, '/') . '/'; // trailing slash
}