# HG changeset patch # User Matti Hamalainen # Date 1417075526 -7200 # Node ID affd8bd8c9104edb5e0265bb952b68a0f5d11f30 # Parent 0fe53c3ddcfb44f8630393c6e2cc52aeaf3cb013 Add new check type(s) CHK_ARRAY_KEY and CHK_ARRAY_VAL, remove CHK_ARRAY as we need to be specific. diff -r 0fe53c3ddcfb -r affd8bd8c910 admajax.php --- a/admajax.php Thu Nov 27 09:59:53 2014 +0200 +++ b/admajax.php Thu Nov 27 10:05:26 2014 +0200 @@ -46,7 +46,7 @@ stChkRequestItemFail("preview_type", $fake, $res, array(CHK_TYPE, VT_INT, "Invalid data."), - array(CHK_ARRAY, $previewTypeList, "Invalid preview type value.")); + array(CHK_ARRAY_KEY, $previewTypeList, "Invalid preview type value.")); stChkRequestItemFail("cpath", $fake, $res, array(CHK_LTEQ, VT_STR, SET_LEN_COMPO_PATH, "Compo file path too long (%1 chars, must be less than %2).")); diff -r 0fe53c3ddcfb -r affd8bd8c910 msite.inc.php --- a/msite.inc.php Thu Nov 27 09:59:53 2014 +0200 +++ b/msite.inc.php Thu Nov 27 10:05:26 2014 +0200 @@ -1141,7 +1141,7 @@ // Check basics if (!stChkRequestItem("type", $uploadType, array(CHK_TYPE, VT_STR, "Invalid upload type."), - array(CHK_ARRAY, array("entry", "preview"), "Invalid upload type.")) + array(CHK_ARRAY_VAL, array("entry", "preview"), "Invalid upload type class.")) || !stChkRequestItem("entry_id", $entryID, array(CHK_TYPE, VT_INT, "Invalid entry ID."))) diff -r 0fe53c3ddcfb -r affd8bd8c910 msitegen.inc.php --- a/msitegen.inc.php Thu Nov 27 09:59:53 2014 +0200 +++ b/msitegen.inc.php Thu Nov 27 10:05:26 2014 +0200 @@ -26,7 +26,8 @@ define("CHK_LTEQ", 6); define("CHK_RANGE", 7); define("CHK_CUSTOM", 8); -define("CHK_ARRAY", 9); +define("CHK_ARRAY_KEY", 9); +define("CHK_ARRAY_VAL", 9); function stDebug($msg) @@ -475,11 +476,16 @@ } break; - case CHK_ARRAY: + case CHK_ARRAY_KEY: if (!isset($check[1][$data])) return stErrorStrF($check[2], $data); break; + case CHK_ARRAY_VAL: + if (!in_array($data, $check[1], TRUE)) + return stErrorStrF($check[2], $data); + break; + case CHK_CUSTOM: // Call a custom function (or closure) $func = $check[1];