From 4ff06aede19d45a0bf6444c94a63842287d23d84 Mon Sep 17 00:00:00 2001 From: rurban Date: Thu, 1 Apr 2004 08:05:52 +0000 Subject: [PATCH] Enabled Admin "Email Verification" git-svn-id: svn://svn.code.sf.net/p/phpwiki/code/trunk@3237 96ab9672-09ca-45d6-a79d-3d69d39ca109 --- lib/plugin/WikiAdminUtils.php | 83 +++++++++++++++++++++++++++++++++-- pgsrc/PhpWikiAdministration | 23 +++++++++- 2 files changed, 100 insertions(+), 6 deletions(-) diff --git a/lib/plugin/WikiAdminUtils.php b/lib/plugin/WikiAdminUtils.php index 23dd1a4a2..fb9ae0695 100644 --- a/lib/plugin/WikiAdminUtils.php +++ b/lib/plugin/WikiAdminUtils.php @@ -1,5 +1,5 @@ error("Bad action"); $message = call_user_func(array(&$this, $method), $request, $args); + // display as seperate page or as alert? $alert = new Alert(_("WikiAdminUtils says:"), $message, array(_("Okay") => $args['return_url'])); - $alert->show(); // noreturn } @@ -139,8 +139,83 @@ extends WikiPlugin count($badpages)), $list); } + + //TODO + function _do_access_restrictions(&$request, &$args) { + return _("Sorry. Access Restrictions not yet implemented"); + } + + // pagelist with enable/disable button + function _do_email_verification(&$request, &$args) { + $dbi = $request->getDbh(); + $pagelist = new PageList('pagename',0,$args); + //$args['return_url'] = 'action=email-verification-verified'; + $email = new _PageList_Column_email('email',_("E-Mail"),'left'); + $emailVerified = new _PageList_Column_emailVerified('emailVerified',_("Verification Status"),'center'); + $pagelist->_columns[] = $email; + $pagelist->_columns[] = $emailVerified; + $group = WikiGroup::getGroup($request); + foreach ($group->_allUsers() as $username) { + if (ENABLE_USER_NEW) + $user = WikiUser($username); + else + $user = new WikiUser(&$request,$username); + $prefs = $user->getPreferences(); + if ($prefs->get('email')) { + $group = (int)(count($pagelist->_rows) / $pagelist->_group_rows); + $class = ($group % 2) ? 'oddrow' : 'evenrow'; + $row = HTML::tr(array('class' => $class)); + $page_handle = $dbi->getPage($username); + $row->pushContent($pagelist->_columns[0]->format($pagelist, $page_handle, $page_handle)); + $row->pushContent($email->format($pagelist, &$prefs, $page_handle)); + if (!empty($args['verified'])) { + $prefs->set('emailVerified',empty($args['user'][$username]) ? 0 : 2); + } + $row->pushContent($emailVerified->format($pagelist, &$prefs, $args['verified'])); + $pagelist->_rows[] = $row; + } + } + if (!empty($args['verified'])) { + return HTML($pagelist->_generateTable(false)); + } else { + $args['verified'] = 1; + $args['return_url'] = $request->getURLtoSelf(); + return HTML::form(array('action' => $request->getPostURL(), + 'method' => 'post'), + HiddenInputs($args, 'wikiadminutils'), + HiddenInputs(array('require_authority_for_post' => + WIKIAUTH_ADMIN)), + HiddenInputs($request->getArgs()), + $pagelist->_generateTable(false), + HTML::p(Button('submit:', _("Change Verification Status"), 'wikiadmin')) + ); + } + } }; +class _PageList_Column_email +extends _PageList_Column { + function _getValue ($prefs, $dummy) { + return $prefs->get('email'); + } +} + +class _PageList_Column_emailVerified +extends _PageList_Column { + function _getValue ($prefs, $status) { + $name = $prefs->get('userid'); + $input = HTML::input(array('type' => 'checkbox', + 'name' => 'wikiadminutils[user]['.$name.']', + 'value' => 1)); + if ($prefs->get('emailVerified')) + $input->setAttr('checked','1'); + if ($status) + $input->setAttr('disabled','1'); + return $input; + } +} + + // For emacs users // Local Variables: // mode: php diff --git a/pgsrc/PhpWikiAdministration b/pgsrc/PhpWikiAdministration index 3fefd5723..52af3133a 100644 --- a/pgsrc/PhpWikiAdministration +++ b/pgsrc/PhpWikiAdministration @@ -1,9 +1,9 @@ Date: Wed, 26 Nov 2003 18:34:06 +0100 Mime-Version: 1.0 (Produced by PhpWiki 1.3.7pre) -X-Rcs-Id: $Id: PhpWikiAdministration,v 1.26 2004-03-14 16:34:22 rurban Exp $ +X-Rcs-Id: $Id: PhpWikiAdministration,v 1.27 2004-04-01 08:05:52 rurban Exp $ Content-Type: application/x-phpwiki; pagename=PhpWikiAdministration; - pgsrc_version="2 $Revision: 1.26 $"; + pgsrc_version="2 $Revision: 1.27 $"; flags=PAGE_LOCKED; markup=2; charset=iso-8859-1 @@ -30,6 +30,25 @@ or call the available ~WikiAdmin actions directly: [/SetAcl] | [/Chmod] +---- +!!! User Management + +PhpWiki:EmailVerification is currently non-strict leaving some possible holes, which can be administrated below. + + This button will show a list of all users with registered emails and buttons to set the verification status manually. + + + +To prevent from robots eating all possible ressources in a short time, blocking from certain IP's or not-well-behaving user agents can be defined below. See PhpWiki:HowToBlockRobots and MeatBall:SurgeProtector. _Note: Not yet enabled._ + + + ---- !!! Cleanup -- 2.45.0