summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2015-09-20 08:47:07 +0200
committerYorhel <git@yorhel.nl>2015-09-20 08:47:07 +0200
commit940b089ea5f02ef9bc80b4b82c320c4e9d2dbb34 (patch)
tree4c9be57fb3a07e8e04b5714623e6f7a40fb06a5a /util
parentcf8e093eace0f3a86fc42726b09e4f2c9979f40e (diff)
Update usage kv_validate() to upcoming TUWF 1.0
And added new 'page' and 'id' templates for more strict validation.
Diffstat (limited to 'util')
-rwxr-xr-xutil/vndb.pl9
1 files changed, 3 insertions, 6 deletions
diff --git a/util/vndb.pl b/util/vndb.pl
index 7a37df04..88281da9 100755
--- a/util/vndb.pl
+++ b/util/vndb.pl
@@ -47,13 +47,10 @@ TUWF::set(
pre_request_handler => \&reqinit,
error_404_handler => \&handle404,
log_format => \&logformat,
- # for compatibility with YAWF
validate_templates => {
- mail => { regex => qr/^[^@<>\s\(\),]+@[^@.<>\s\(\),]+(?:\.[^@.<>\s\(\),]+)+$/ },
- url => { regex => qr/^(http|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:\/~\+\*#]*[\w\-\@?^=%&\/~\+#\*])?$/ },
- asciiprint => { regex => qr/^[\x20-\x7E]*$/ },
- int => { regex => qr/^-?[0-9]+$/ },
- pname => { regex => qr/^[a-z0-9-]*$/ },
+ id => { template => 'uint', min => 1, max => 1<<40 },
+ page => { template => 'uint', max => 1000 },
+ uname => { regex => qr/^[a-z0-9-]*$/, minlength => 2, maxlength => 15 },
},
);
TUWF::load_recursive('VNDB::Util', 'VNDB::DB', 'VNDB::Handler');