Commit 507aabeb authored by Leigh B Stoller's avatar Leigh B Stoller
Browse files

Add PAGEARG_UUID for checking.

parent 9c1c3093
...@@ -68,6 +68,7 @@ define("PAGEARG_NUMERIC", "numeric"); ...@@ -68,6 +68,7 @@ define("PAGEARG_NUMERIC", "numeric");
define("PAGEARG_ARRAY", "array"); define("PAGEARG_ARRAY", "array");
define("PAGEARG_ANYTHING", "anything"); define("PAGEARG_ANYTHING", "anything");
define("PAGEARG_ALPHALIST", "alphalist"); define("PAGEARG_ALPHALIST", "alphalist");
define("PAGEARG_UUID", "uuid");
define("URL_USER", "user"); define("URL_USER", "user");
define("URL_PROJECT", "project"); define("URL_PROJECT", "project");
...@@ -578,6 +579,9 @@ function VerifyPageArguments($argspec, $required) ...@@ -578,6 +579,9 @@ function VerifyPageArguments($argspec, $required)
if (ValidateArgument($name, PAGEARG_IMAGE, $imageid)) { if (ValidateArgument($name, PAGEARG_IMAGE, $imageid)) {
$object = Image::Lookup($imageid, $version); $object = Image::Lookup($imageid, $version);
} }
elseif (ValidateArgument($name, PAGEARG_UUID, $imageid)) {
$object = Image::LookupByUUID($imageid);
}
} }
elseif (isset($_REQUEST[$name]) && $_REQUEST[$name] != "") { elseif (isset($_REQUEST[$name]) && $_REQUEST[$name] != "") {
$imageid = $_REQUEST[$name]; $imageid = $_REQUEST[$name];
...@@ -628,6 +632,7 @@ function VerifyPageArguments($argspec, $required) ...@@ -628,6 +632,7 @@ function VerifyPageArguments($argspec, $required)
case PAGEARG_INTEGER: case PAGEARG_INTEGER:
case PAGEARG_NUMERIC: case PAGEARG_NUMERIC:
case PAGEARG_ARRAY: case PAGEARG_ARRAY:
case PAGEARG_UUID:
if (isset($_REQUEST[$name]) && $_REQUEST[$name] != "") { if (isset($_REQUEST[$name]) && $_REQUEST[$name] != "") {
$object = $_REQUEST[$name]; $object = $_REQUEST[$name];
$yep = 1; $yep = 1;
...@@ -772,6 +777,12 @@ function ValidateArgument($name, $type, $arg) ...@@ -772,6 +777,12 @@ function ValidateArgument($name, $type, $arg)
} }
break; break;
case PAGEARG_UUID:
if (preg_match("/^\w+\-\w+\-\w+\-\w+\-\w+$/", "$arg")) {
return 1;
}
break;
case PAGEARG_ARRAY: case PAGEARG_ARRAY:
if (is_array($arg)) { if (is_array($arg)) {
return 1; return 1;
......
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