[pmwiki-devel] function InputDefault

Hans design5 at softflow.co.uk
Mon Jul 14 17:08:49 CDT 2008


Monday, July 14, 2008, 3:57:48 PM, Patrick wrote:

> Let me think about it for a day and if I haven't
> come up with a reason for it to stay I'll take it out.
> (Remind me in a few days if I forget.)

While you look at that function, could you please consider also
to expand the 'if (@$args['request'])' routine so it can handle
single-depth array input from GET or POST? Input forms elements can
be part in an array. This is especially common for select input.

I brought this up before, but never had an answer on this.

The RequestArgs() function has a similar shortcoming. I don't think
it is used at all so far, but it would be quite useful if it could
handle single-layered arrays as well.

For InputDefault section 'if (@$args['request'])' I suggest something
like this, which works well:

  if (@$args['request']) {
    $req = array_merge($_GET, $_POST);
      foreach($req as $k => $v) {
        if (is_array($v)) {
          foreach($v as $kk => $vv)
            if (!isset($InputValues[$k][$kk]))
              $InputValues[$k][$kk] = htmlspecialchars(stripmagic($vv), ENT_NOQUOTES);
        }
        else if (!isset($InputValues[$k]))
             $InputValues[$k] = htmlspecialchars(stripmagic($v), ENT_NOQUOTES);
     }
  }


For  RequestArgs() I propose similar code.


Hans




More information about the pmwiki-devel mailing list