From 5e199953f8f0dfb86624905ebf237d99e2f6bb67 Mon Sep 17 00:00:00 2001
From: matthiasgrimm <matthiasgrimm@users.sourceforge.net>
Date: Mon, 9 May 2005 22:44:23 +0200
Subject: [PATCH] fixing user registration from admin page

This patch fixes the user registration from the admin page.
It removes the 'register' filter in act_clean() and enables
act_permcheck() to handle permissions to 'register'
differentially.

darcs-hash:20050509204423-7ef76-eeb3681e364b85690c342f8eabeb65d326cb0637.gz
---
 inc/actions.php | 14 +++++++-------
 inc/html.php    |  2 +-
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/inc/actions.php b/inc/actions.php
index fc68ef173..441a85d3c 100644
--- a/inc/actions.php
+++ b/inc/actions.php
@@ -64,8 +64,6 @@ function act_dispatch(){
 		if($_REQUEST['page'] == 'acl'){
 			require_once(DOKU_INC.'inc/admin_acl.php');
 			admin_acl_handler();
-		} elseif ($_REQUEST['page'] == 'register') {
-      $ACT = 'register';
     }
   }
 
@@ -85,7 +83,6 @@ function act_dispatch(){
  */
 function act_clean($act){
   global $lang;
-  global $conf;
 
   //handle localized buttons
   if($act == $lang['btn_save']) $act = 'save';
@@ -96,9 +93,6 @@ function act_clean($act){
   $act = strtolower($act);
   $act = preg_replace('/[^a-z_]+/','',$act);
 
-  if($act == 'register' && !$conf['openregister'])
-    return 'show';
-
   if($act == 'export_html') $act = 'export_xhtml';
 
   if(array_search($act,array('login','logout','register','save','edit',
@@ -118,6 +112,7 @@ function act_clean($act){
  */
 function act_permcheck($act){
   global $INFO;
+  global $conf;
 
   if(in_array($act,array('save','preview','edit'))){
     if($INFO['exists']){
@@ -125,8 +120,13 @@ function act_permcheck($act){
     }else{
       $permneed = AUTH_CREATE;
     }
-  }elseif(in_array($act,array('login','register','search','recent'))){
+  }elseif(in_array($act,array('login','search','recent'))){
     $permneed = AUTH_NONE;
+  }elseif($act == 'register'){
+    if ($conf['openregister'])
+      $permneed = AUTH_NONE;
+    else
+      $permneed = AUTH_AUTH;
   }elseif($act == 'admin'){
     $permneed = AUTH_ADMIN;
   }else{
diff --git a/inc/html.php b/inc/html.php
index cb076b76d..e6cf77ab0 100644
--- a/inc/html.php
+++ b/inc/html.php
@@ -994,7 +994,7 @@ function html_admin(){
   // currently ACL only - more to come
   ptln('<li><a href="'.wl($ID,'do=admin&amp;page=acl').'">'.$lang['admin_acl'].'</a></li>');
   if (!$conf['openregister']){
-    ptln('<li><a href="'.wl($ID,'do=admin&amp;page=register').'">'.$lang['admin_register'].'</a></li>');
+    ptln('<li><a href="'.wl($ID,'do=register').'">'.$lang['admin_register'].'</a></li>');
   }
   
   ptln('</ul>');
-- 
GitLab