Using php build-in validation

5 views
Skip to first unread message

Alexander Obuhovich

unread,
Oct 23, 2012, 6:59:57 AM10/23/12
to Development In-Portal
There is nice filter_var function (http://php.net/manual/en/function.filter-var.php), that can be used to do user input validation/sanitize.

For example these validating are already there and there is no need to do them manually each time:
  • IP address
  • url
  • e-mail
  • regexp
To benefit from these filters I'm proposing to add 2 optional options to field definition:
  • filter_type - contant, that represents build-in filter
  • filter_options - extra options (if any), that used filter type accepts

And maybe we need to move regexp validation to later stage (when whole validation routing takes place).
I know I talked about this before, but don't remember was there any progress in doing that or not.

--
Best Regards,

http://www.in-portal.com
http://www.alex-time.com

Phil

unread,
Oct 23, 2012, 12:27:45 PM10/23/12
to in-por...@googlegroups.com
would these options would be accessible from admin/tpl?


Envoyé avec Sparrow

Alexander Obuhovich

unread,
Oct 23, 2012, 4:08:30 PM10/23/12
to in-por...@googlegroups.com
Nope. Only from PHP, like current field validation options.

Phil

unread,
Oct 24, 2012, 4:37:11 AM10/24/12
to in-por...@googlegroups.com
ok.


Envoyé avec Sparrow

Dmitry A.

unread,
Nov 12, 2012, 1:47:25 AM11/12/12
to in-por...@googlegroups.com
Hi Alex,


I like the idea of what you are proposing here.

Would please also search and find that older discussion about "moving regexp validation to later stage"?


DA

Alexander Obuhovich

unread,
Nov 18, 2012, 4:14:46 PM11/18/12
to Development In-Portal
This is it: https://groups.google.com/d/topic/in-portal-bugs/uWeBloFOzio/discussion

Interesting fact, that in corresponding task in that discussion we made false assumptions about why we shouldn't fix that :)

Dmitry A.

unread,
Dec 24, 2012, 1:18:35 AM12/24/12
to in-por...@googlegroups.com
Okay so what's next step here, task in 5.3.0?

Alex, would you please create one

PS. I have also noticed that there is more than just validation types - it also can sanitize - http://php.net/manual/en/filter.filters.php

DA

Alexander Obuhovich

unread,
Dec 24, 2012, 7:03:43 AM12/24/12
to Development In-Portal
I know that, but most of sanitization is about removing not allowed symbols. Right now functions is_numeric and preg_match, that we're using  provide pretty good protection against that kind of stuff.

Dmitry A.

unread,
Dec 27, 2012, 12:21:48 AM12/27/12
to in-por...@googlegroups.com
Thanks for your explanation Alex.

Please move forward with creating new task than.


Cheers!

DA
Reply all
Reply to author
Forward
0 new messages