Re: [Postfixadmin-devel] safeget etc
Brought to you by:
christian_boltz,
gingerdog
|
From: David G. <da...@co...> - 2007-10-23 06:09:12
|
<snip>
> Note 1:
> Feel free to use the safeget/safepost/safeserver functions at other=20
> places too ;-)
>=20
> $var =3D safeget('var');
> is easier to use than
> $var =3D "";
> if (isset($_GET['var'])) $var =3D $_GET['var'];
>=20
> Optionally you can specify a default value which will be returned if the=
=20
> $_GET variable is not set:
> $var =3D safeget('var', 'default');
It's name (safeget) implies (to me) that it will return something
safe.... and probably doesn't need to have escape_string applied on it.
I know this isn't the case.
Would it be more useful to do something like Zend_Filter - namely
ensuring that a field matches a given type as well.
function safeget($name, $type, $default =3D null)
or something; so you could ensure you had e.g. an int back?
>=20
> Note 2:
> $fm_struct in fetchmail.php is a really useful array once you understand=
=20
> how to use it. We should consider to use similar arrays for the other=20
> tables (something for after the 2.2 release).
Guess I'll have to read the code sometime then :)
(Sorry I've not done much lately, I'll pull my finger out one day soon)
Thanks
David.
--=20
David Goodwin=20
[ david at codepoets dot co dot uk ]
[ http://www.codepoets.co.uk ]
|