[pmwiki-users] Uninstalling EProtect
Joachim Durchholz
jo at durchholz.org
Wed Apr 13 17:02:40 CDT 2005
Patrick R. Michaud wrote:
> 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 do I.
However, I think it would be better if the links were converted to
hidden-email: links when loading from the page store, and converted by
to mailto: links when saving.
What's the best way to hook that up? (eProtect munges the $EditFunctions
array - is that the right place?)
>> 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".
Needed anyway :-)
> 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.
Ctrl-click works with any Gecko-based browsers, so it's both Mozilla and
Firefox on any OS that supports them :-)
> 4. Save the page. The $ROSPattern will automatically convert the
> link upon saving.
>
> Here's an $ROSPattern that might work (it's untested):
The pattern as given won't work right out of the box since eProtect
accommodates alternate link texts in two syntactic variants, but I can
manage :-)
> $ROSPattern['/hidden-email:(\\S+)/e'] = "'mailto:'.str_rot13('$1')";
Er... what's a $ROSPattern?
> 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...)
They'll see hidden-email: links anyway, but I don't think they'll write
them: they's have to manually rot13 them to make it work.
Besides, I'm working on a new version of eProtect where the wiki admin
can specify arbitrary encodings, so even a browser with a rot13 facility
won't be of much help anymore :-))
Regards,
Jo
More information about the pmwiki-users
mailing list