Validator.php 929 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. namespace Lychee\Modules;
  3. final class Validator {
  4. public static function required($available = false, $function) {
  5. if ($available===false) exit("Error: Missing parameters. Can not execute function $function.");
  6. return true;
  7. }
  8. public static function isNull() {
  9. $args = func_get_args();
  10. for ($i = 0; $i < count($args); $i++) {
  11. if (is_null($args[$i])===true) return true;
  12. }
  13. return false;
  14. }
  15. public static function isAlbumIDs($albumIDs) {
  16. return (preg_match('/^[0-9\,]{1,}$/', $albumIDs)===1 ? true : false);
  17. }
  18. public static function isAlbumID($albumID) {
  19. return (preg_match('/^[0-9sfr]{1,}$/', $albumID)===1 ? true : false);
  20. }
  21. public static function isPhotoIDs($photoIDs) {
  22. return (preg_match('/^[0-9\,]{1,}$/', $photoIDs)===1 ? true : false);
  23. }
  24. public static function isPhotoID($photoID) {
  25. return (preg_match('/^[0-9]{14}$/', $photoID)===1 ? true : false);
  26. }
  27. }
  28. ?>