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(); ...@@ -39,17 +39,18 @@ $priv_list = $acl->getLegacyPrivList();
function cmp_page_matches($page, & $matches, $fullwc = true) { function cmp_page_matches($page, & $matches, $fullwc = true) {
if (!is_array($matches)) if (!is_array($matches)) {
return false; return false;
}
/* skip any leading fwdslash */ /* skip any leading fwdslash */
$test = strpos($page, "/"); $test = strpos($page, "/");
if ($test !== false && $test == 0) if ($test !== false && $test == 0) {
$page = substr($page, 1); $page = substr($page, 1);
}
/* look for a match */ /* look for a match */
foreach ($matches as $match) { foreach ($matches as $match) {
/* possibly ignore full wildcard match */ /* possibly ignore full wildcard match */
if (!$fullwc && !strcmp($match ,"*")) if (!$fullwc && !strcmp($match ,"*"))
continue; continue;
...@@ -58,9 +59,10 @@ function cmp_page_matches($page, & $matches, $fullwc = true) { ...@@ -58,9 +59,10 @@ function cmp_page_matches($page, & $matches, $fullwc = true) {
$match = str_replace(array(".", "*","?"), array("\.", ".*","\?"), $match); $match = str_replace(array(".", "*","?"), array("\.", ".*","\?"), $match);
$result = preg_match("@^/{$match}$@", "/{$page}"); $result = preg_match("@^/{$match}$@", "/{$page}");
if ($result) if ($result) {
return true; return true;
} }
}
return false; return false;
} }
...@@ -95,21 +97,26 @@ function isAllowedPage($page) ...@@ -95,21 +97,26 @@ function isAllowedPage($page)
function getPrivPages(& $entry, & $allowed_pages) { function getPrivPages(& $entry, & $allowed_pages) {
global $priv_list; global $priv_list;
if (!isset($entry['priv']) || !is_array($entry['priv'])) if (!isset($entry['priv']) || !is_array($entry['priv'])) {
return; return;
}
foreach ($entry['priv'] as $pname) { foreach ($entry['priv'] as $pname) {
if (strncmp($pname, "page-", 5)) if (strncmp($pname, "page-", 5)) {
continue; continue;
}
$priv = &$priv_list[$pname]; $priv = &$priv_list[$pname];
if (!is_array($priv)) if (!is_array($priv)) {
continue; continue;
}
$matches = &$priv['match']; $matches = &$priv['match'];
if (!is_array($matches)) if (!is_array($matches)) {
continue; continue;
foreach ($matches as $match) }
foreach ($matches as $match) {
$allowed_pages[] = $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