mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-16 01:24:38 +00:00
system: deal with ACL trailing slash wildcards
This commit is contained in:
parent
c383d0ae61
commit
c66f241df7
@ -183,7 +183,13 @@ class ACL
|
||||
*/
|
||||
private function urlMatch($url, $urlmask)
|
||||
{
|
||||
$match = str_replace(array(".", "*","?"), array("\.", ".*","\?"), $urlmask);
|
||||
/* "." and "?" have no effect on match, but "*" is a wildcard */
|
||||
$match = str_replace(array('.', '*','?'), array('\.', '.*','\?'), $urlmask);
|
||||
/* if pattern ends with '/.*' optionally match for flat URL mask */
|
||||
$match = preg_replace('@/\.\*$@', '(/.*)?', $match);
|
||||
/* remove client side pattern from given URL */
|
||||
$url = preg_replace('@#.*$@', '', $url);
|
||||
|
||||
$result = preg_match("@^/{$match}$@", "{$url}");
|
||||
if ($result) {
|
||||
return true;
|
||||
@ -285,7 +291,8 @@ class ACL
|
||||
if ($pattern == "*") {
|
||||
return "index.php";
|
||||
} elseif (!empty($pattern)) {
|
||||
return str_replace('*', '', $pattern);
|
||||
/* remove wildcard and optional trailing slashes */
|
||||
return preg_replace('@/?\*$@', '', $pattern);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user