TPAC: Teach mkurl() to discard POST params
authorDan Scott <dscott@laurentian.ca>
Sat, 10 Mar 2012 17:36:08 +0000 (12:36 -0500)
committerThomas Berezansky <tsbere@mvlc.org>
Sat, 10 Mar 2012 17:48:34 +0000 (12:48 -0500)
Unless we explicitly ask for POST params with the "params" argument to
mkurl(), prevent them from propagating. (Can't think of situations when
we would want to propagate a POST param, but we err on the side of
flexibility so...)

Thanks to Thomas Berezansky for suggesting the CGI url_param() method of
filtering POST params.

Signed-off-by: Dan Scott <dscott@laurentian.ca>
Signed-off-by: Thomas Berezansky <tsbere@mvlc.org>
Open-ILS/src/templates/opac/parts/header.tt2

index 30dbd6d..5db8139 100644 (file)
         FOR p IN cgi.param;
             val = cgi.param(p);
             IF val == ''; cgi.delete(p); END;
+
+            # Delete POST vars unless we asked for them
+            UNLESS CGI.url_param(p) OR params.defined(p);
+                cgi.delete(p);
+            END;
         END;
 
         IF page;