Commit daebae4f authored by Ad Schellevis's avatar Ad Schellevis

(legacy) curly braces and spaces in authgui.inc

parent d101b28e
......@@ -39,17 +39,18 @@ $priv_list = $acl->getLegacyPrivList();
function cmp_page_matches($page, & $matches, $fullwc = true) {
if (!is_array($matches))
if (!is_array($matches)) {
return false;
}
/* skip any leading fwdslash */
$test = strpos($page, "/");
if ($test !== false && $test == 0)
if ($test !== false && $test == 0) {
$page = substr($page, 1);
}
/* look for a match */
foreach ($matches as $match) {
/* possibly ignore full wildcard match */
if (!$fullwc && !strcmp($match ,"*"))
continue;
......@@ -58,9 +59,10 @@ function cmp_page_matches($page, & $matches, $fullwc = true) {
$match = str_replace(array(".", "*","?"), array("\.", ".*","\?"), $match);
$result = preg_match("@^/{$match}$@", "/{$page}");
if ($result)
if ($result) {
return true;
}
}
return false;
}
......@@ -95,21 +97,26 @@ function isAllowedPage($page)
function getPrivPages(& $entry, & $allowed_pages) {
global $priv_list;
if (!isset($entry['priv']) || !is_array($entry['priv']))
if (!isset($entry['priv']) || !is_array($entry['priv'])) {
return;
}
foreach ($entry['priv'] as $pname) {
if (strncmp($pname, "page-", 5))
if (strncmp($pname, "page-", 5)) {
continue;
}
$priv = &$priv_list[$pname];
if (!is_array($priv))
if (!is_array($priv)) {
continue;
}
$matches = &$priv['match'];
if (!is_array($matches))
if (!is_array($matches)) {
continue;
foreach ($matches as $match)
}
foreach ($matches as $match) {
$allowed_pages[] = $match;
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment