4 "Anonymous" login (like in FTP). Users can login using their email
5 address as password. In this implementation we do not depend upon
6 the username being "anonymous" (any string will do).
8 This plugin itself implements a partial ["auth_query"] plugin, which
9 evaluates the HTTP From: request header (see RFC2616 section 14.22),
10 which however isn't supported by the mainstream browsers. The value
11 of this header is already evealuated by the ewiki core script and
12 stored into the {author} field - if you use this plugin or not. The
13 only difference is, that the From: header now grants edit/ permission
14 in EWIKI_PROTECTED_MODE.
17 $ewiki_config["login_notice"] = "Anonymous login (use your email address as password).";
18 $ewiki_config["http_auth_add"] = "ANONYMOUS";
21 define("EWIKI_AUTH_ANONYMOUS_RING", 2); // permission ring level
22 define("EWIKI_AUTH_ANONYMOUS_VERIFY", 0); // verify given email address
25 $ewiki_plugins["auth_userdb"][] = "ewiki_auth_userdb_anonymous";
29 function ewiki_auth_userdb_anonymous($username, $password) {
34 if (!$name = $username) {
37 if (strpos($password, "@")) {
38 $email = trim($password);
40 elseif (strpos($username, "@")) {
41 $email = trim($username);
48 #-- HTTP header field "From: joe@example.com"
50 $email = trim($_SERVER["HTTP_FROM"]);
53 #-- check for valid address (the-non-4000-chars-regex-check)
55 if ($email && preg_match("/^[-!%&~+.$c]+@([-$c]{2,}\.)+[-$c]{2,9}$/i", $email)) {
57 return(array($password, EWIKI_AUTH_ANONYMOUS_RING, $ewiki_author="anonymous|$email"));