Mercurial > hg > fapweb
comparison msitegen.inc.php @ 810:2a23243a6cc4
Add new check type for stChkRequestItem*(), CHK_ARRAY.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Mon, 24 Nov 2014 16:26:23 +0200 |
parents | ddb30c989b47 |
children | b3dce4dcca9f |
comparison
equal
deleted
inserted
replaced
809:a165d2e101f9 | 810:2a23243a6cc4 |
---|---|
24 define("CHK_ISEQ", 4); | 24 define("CHK_ISEQ", 4); |
25 define("CHK_GTEQ", 5); | 25 define("CHK_GTEQ", 5); |
26 define("CHK_LTEQ", 6); | 26 define("CHK_LTEQ", 6); |
27 define("CHK_RANGE", 7); | 27 define("CHK_RANGE", 7); |
28 define("CHK_CUSTOM", 8); | 28 define("CHK_CUSTOM", 8); |
29 define("CHK_ARRAY", 9); | |
29 | 30 |
30 | 31 |
31 function stDebug($msg) | 32 function stDebug($msg) |
32 { | 33 { |
33 if (stGetSetting("debug")) | 34 if (stGetSetting("debug")) |
437 } | 438 } |
438 break; | 439 break; |
439 | 440 |
440 case CHK_ISLT: case CHK_ISGT: case CHK_ISEQ: | 441 case CHK_ISLT: case CHK_ISGT: case CHK_ISEQ: |
441 case CHK_GTEQ: case CHK_LTEQ: case CHK_RANGE: | 442 case CHK_GTEQ: case CHK_LTEQ: case CHK_RANGE: |
443 case CHK_ARRAY: | |
442 // Check length or value of the data | 444 // Check length or value of the data |
443 switch ($check[1]) | 445 switch ($check[1]) |
444 { | 446 { |
445 case VT_STR: | 447 case VT_STR: |
446 case VT_TEXT: | 448 case VT_TEXT: |
454 // Integer values checked against .. value | 456 // Integer values checked against .. value |
455 if (!stChkRequestDataItem($check[0], intval($data), $check[2])) | 457 if (!stChkRequestDataItem($check[0], intval($data), $check[2])) |
456 return stErrorStrF($check[3], intval($data), $check[2]); | 458 return stErrorStrF($check[3], intval($data), $check[2]); |
457 break; | 459 break; |
458 } | 460 } |
461 break; | |
462 | |
463 case CHK_ARRAY: | |
464 if (!in_array($data, $check[1], TRUE)) | |
465 return stErrorStrF($check[2], $data); | |
459 break; | 466 break; |
460 | 467 |
461 case CHK_CUSTOM: | 468 case CHK_CUSTOM: |
462 // Call a custom function (or closure) | 469 // Call a custom function (or closure) |
463 $func = $check[1]; | 470 $func = $check[1]; |