Commit 40b6e7a9 authored by Ad Schellevis's avatar Ad Schellevis

some style fixes (mvc)

parent d84b293b
...@@ -39,7 +39,7 @@ class IntegerValidator extends Validator implements ValidatorInterface ...@@ -39,7 +39,7 @@ class IntegerValidator extends Validator implements ValidatorInterface
/** /**
* Executes Integer validation * Executes Integer validation
* *
* @param Phalcon\Validation $validator * @param \Phalcon\Validation $validator
* @param string $attribute * @param string $attribute
* @return boolean * @return boolean
*/ */
......
...@@ -38,7 +38,7 @@ class MinMaxValidator extends Validator implements ValidatorInterface ...@@ -38,7 +38,7 @@ class MinMaxValidator extends Validator implements ValidatorInterface
/** /**
* Executes MinMax validation * Executes MinMax validation
* *
* @param Phalcon\Validation $validator * @param \Phalcon\Validation $validator
* @param string $attribute * @param string $attribute
* @return boolean * @return boolean
*/ */
......
...@@ -114,6 +114,23 @@ class ACL ...@@ -114,6 +114,23 @@ class ACL
} }
} }
/**
* check url against regex mask
* @param $url url to match
* @param $urlmask regex mask
* @return bool url matches mask
*/
private function urlMatch($url, $urlmask)
{
$match = str_replace(array(".", "*","?"), array("\.", ".*","\?"), $urlmask);
$result = preg_match("@^/{$match}$@", "{$url}");
if ($result) {
return true;
} else {
return false;
}
}
/** /**
* legacy functionality to check if a page is accessible for the specified user. * legacy functionality to check if a page is accessible for the specified user.
* @param $username user name * @param $username user name
...@@ -126,9 +143,7 @@ class ACL ...@@ -126,9 +143,7 @@ class ACL
// search user privs // search user privs
foreach ($this->legacyUsers[$username]["priv"] as $privset) { foreach ($this->legacyUsers[$username]["priv"] as $privset) {
foreach ($privset as $urlmask) { foreach ($privset as $urlmask) {
$match = str_replace(array(".", "*","?"), array("\.", ".*","\?"), $urlmask); if ($this->urlMatch($url, $urlmask)) {
$result = preg_match("@^/{$match}$@", "{$url}");
if ($result) {
return true; return true;
} }
} }
...@@ -138,9 +153,7 @@ class ACL ...@@ -138,9 +153,7 @@ class ACL
if (array_key_exists($group, $this->legacyGroupPrivs)) { if (array_key_exists($group, $this->legacyGroupPrivs)) {
foreach ($this->legacyGroupPrivs[$group] as $privset) { foreach ($this->legacyGroupPrivs[$group] as $privset) {
foreach ($privset as $urlmask) { foreach ($privset as $urlmask) {
$match = str_replace(array(".", "*","?"), array("\.", ".*","\?"), $urlmask); if ($this->urlMatch($url, $urlmask)) {
$result = preg_match("@^/{$match}$@", "{$url}");
if ($result) {
return true; return true;
} }
} }
......
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