PmWiki | Cookbook / EncodePost (original) (raw)

Summary: Base64 encode/decode fields in posted forms as a workaround for mod_security

Version: 20230504

Prerequisites: PmWiki.UTF-8, PmWiki 2.3.24, recent browser with JavaScript enabled

Status: experimental

License: GPL

Description

Base64 encode/decode fields in posted forms.

This recipe was written as a workaround for Troubleshooting#mod_security.

While some hosting providers allow you to disable mod_security, it is probably best to leave it enabled, especially if you have software other than PmWiki on your website.

This recipe will cause the browser to encode to Base64 the page text in the edit form before submitting it, and will decode it upon arrival to PmWiki.

Installation

Note that this requires PmWiki:UTF-8 to be enabled. The current version also requires either the nightly version after PmWiki 2.3.23, or PmWiki 2.3.24 or newer.

  1. Get encodepost.zipΔ and place
    • encodepost.php in pmwiki/cookbook/
    • encodepost.js in pmwiki/pub/
  2. Add near the top of local/config.php:

if($action == 'edit' || $action == 'encodedpost') { include_once("$FarmD/cookbook/encodepost.php"); }

Configuration

N/A

Usage

Just edit, save, or preview the page as usual. See Notes below.

The recipe is enabled on this page, you can try it here (hit Preview).

Notes

To do / some day / maybe

Change log / Release notes

See also

Contributors

Comments

See discussion at EncodePost-Talk

User notes : If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.