Re: [Postfixadmin-devel] safeget etc
Brought to you by:
christian_boltz,
gingerdog
From: Christian B. <pos...@cb...> - 2007-10-23 12:08:34
|
Hello, Am Dienstag, 23. Oktober 2007 schrieb David Goodwin: > > Note 1: > > Feel free to use the safeget/safepost/safeserver functions at other > > places too ;-) [...] > 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. Hmm, I'm using this function names in some other projects and homepages=20 I'm involved in, and you are the first one who complains about the=20 name ;-) "safeget" because you won't get any "undefined index" warnings and you=20 have a sane dafault as fallback. (We could also think about including=20 stripslashes if magic_quotes are on.) Anyhow: If you know better names for these functions, just tell me ;-) > 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? I usually do this using $var =3D (int) safeget('var'); Doing it inside safeget would make things more difficult - it would need=20 some if or case switching. And you never know which types you need and=20 will have to add another type every now and then. (I'm not even talking=20 about values that must validate against a regex etc.) > > Note 2: > > $fm_struct in fetchmail.php is a really useful array once you > > understand how to use it. We should consider to use similar arrays > > for the other tables (something for after the 2.2 release). > > Guess I'll have to read the code sometime then :) Yes ;-) Hint: read the comments around the array definition, and then read the=20 template file. Or simply play a bit with the values and reload the=20 fetchmail page in your browser... > (Sorry I've not done much lately, I'll pull my finger out one day > soon) No problem. As long as nobody pays you, nobody can/will force you to do=20 lots of work ;-) Regards, Christian Boltz =2D-=20 > > Wow consensus in less than 24 hours....imagine if it always > > worked that way....:-) > Something smells fishy here ;-) Do you have the solution(tm) for the "Kanzlerfrage"? :) [>> Peter Flodin, > Andreas J=E4ger und Christoph Thiel in opensuse] |