[pmwiki-users] Uninstalling EProtect

Patrick R. Michaud pmichaud at pobox.com
Wed Apr 13 16:35:55 CDT 2005


On Wed, Apr 13, 2005 at 06:00:49PM +0200, Joachim Durchholz wrote:
> Hi all,
> 
> I have the task of uninstalling EProtect from a PmWiki site.
> 
> To my dismay, I found that EProtect would munge the mail addresses when 
> storing to the page storage. 

Ouch.  I suspect that was so that bots couldn't simply get the
mail addresses from ?action=edit or ?action=source .

> So removing the 
> include_once('eprotect.php') line from config.php leaves me with lots of 
> [[hidden-email:hfre at qbznva.arg]] pages - I know it's ROT13 and easily 
> removed, but it's a lot of pages and I'd like to write a script that 
> does this.
> 
> I could go for the quick&dirty method of running sed or awk (Unix 
> horribilities, for those who don't know them) over the wiki.d directory, 
> but is there a way to have PmWiki load the pages, hand them over to me 
> for modification, then store them back?

How about this...

1.  Write a quick $ROSPattern expression that will convert
    "hidden-email:rot13" into "mailto:cleartext".  

2.  Do a wiki search to find any pages containing the text "hidden-email".

3.  Open each such page for editing.  In Firefox (WinXP) I find it's 
    very handy to hold down the CTRL while clicking each link, so that
    the page(s) appear in their own tabs.

4.  Save the page.  The $ROSPattern will automatically convert the
    link upon saving.

Here's an $ROSPattern that might work (it's untested):

    $ROSPattern['/hidden-email:(\\S+)/e'] = "'mailto:'.str_rot13('$1')";

This is often quickest for 100 pages or less that need editing, if it
gets to be a lot more than that then you'll probably want another solution.

Here's another idea, in combination with the $ROSPattern one:

   Markup('hidden-email', '<mailto', 
    '/hidden-email:(\\S+)/e',
    "'mailto:'.str_rot13('$1')";

This causes all of your pages to appear correctly immediately, and
coupled with $ROSPatterns they'll slowly be converted to mailto: links
as they're saved.  (It also helps if any of your authors have become
used to writing "hidden-email:" links...)

Pm



More information about the pmwiki-users mailing list