|
Cookbook /
OpenPassSummary:Set a global password which is openly displayed to reduce spam
Version: 2008-08-24
Prerequisites:
Status: Alpha
Maintainer: Peter Bowers
Questions answered by this recipe
DescriptionSet a global "edit" password to prevent spambots but make sure human authors know the password. NotesThe purpose of this recipe is to display a message in the AuthForm so that users can see the open password if that is the password which is active for this page. But if the page is protected by a page-level or group-level password (i.e., not the "public" or "open" site-level password) then we don't want the message to display. Installation
(:if equal {$editpass} "site" :)%red%(If you don't know a password for this page, try entering "myopenpass"
(without the quotes).%% This is an '''open''' password to prevent spamming by robots but still allow
you [as a human who can read the page and follow instructions] to make changes.)(:ifend:)
if ($action == 'edit') {
$FmtPV['$editpass'] = 'MyPasswdVar($pagename,"edit")';
}
function MyPasswdVar($pagename, $level) {
global $PCache, $PasswdVarAuth, $FmtV;
$page = $PCache[$pagename];
if (!isset($page['=passwd'][$level])) {
$page = RetrieveAuthPage($pagename, 'ALWAYS', false, READPAGE_CURRENT);
if ($page) PCache($pagename, $page);
}
$pwsource = $page['=pwsource'][$level];
if (strncmp($pwsource, 'cascade:', 8) == 0)
return( substr($pwsource, 8));
return ($pwsource);
}
Release Notes
See AlsoContributorsFunction based off of PasswdVar from pmwiki.php, thus credit to PM. Comments |