From 940b089ea5f02ef9bc80b4b82c320c4e9d2dbb34 Mon Sep 17 00:00:00 2001 From: Yorhel Date: Sun, 20 Sep 2015 08:47:07 +0200 Subject: Update usage kv_validate() to upcoming TUWF 1.0 And added new 'page' and 'id' templates for more strict validation. --- util/vndb.pl | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'util') 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'); -- cgit v1.2.3