[pmwiki-users] Suggestion: $PostTargetUrl-Variable

Nils Knappmeier nk at knappi.org
Thu Sep 21 10:04:06 CDT 2006


Hi Patrick,

the latest bugfix of the AddDeleteLine-recipe made me think, if it 
wouldn't be good to have something like a $PostTargetUrl-Variable. This 
should contain the target URL to be used for POST-forms. Usually the 
contents should be the same as $ScriptUrl, but if cleanurls are used, 
especially with mod_rewrite, it should contain the real URL of 
pmwiki.php, which is not subject to redirection.

The reason is simple: A lot of recipes (at least my AddDeleteLine and 
MailForm) use POST-requests, then process the data and perform a 
redirect back to  the BrowseHandler of the page. When you use CleanUrls, 
it does not work, e.g. on pmwiki.org, to do a
  <form target='http://pmwiki.org/wiki' method='post'>...</form>
because the rewrite engine will redirect the request to something like 
http://pmwiki.org/wiki/pmwiki.php, which results in the loss of all 
POST-variables.
In AddDeleteLine, I solved the problem by creating a 
$PostTargetUrl-Variable:

$urlcomp = parse_url($ScriptUrl);
$PostTargetUrl = 
$urlcomp['scheme'].'://'.$urlcomp['host'].$_SERVER['SCRIPT_NAME'];

Since such a variable might be of use for a number of recipes, I would 
suggest adding it to the core of PmWiki.

Nils

PS: Or did I miss something and such a variable already exists?


-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3318 bytes
Desc: S/MIME Cryptographic Signature
Url : /pipermail/pmwiki-users/attachments/20060921/0c162799/attachment.bin 


More information about the pmwiki-users mailing list