From 9be88c0080263b3ac4106b277520705415d74e3f Mon Sep 17 00:00:00 2001 From: Robin Date: Fri, 23 Apr 2010 18:27:36 +0200 Subject: [PATCH] bug fix first run wizzard take 3 --- inc/lib_config.php | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/inc/lib_config.php b/inc/lib_config.php index bf9dd5fd3d8..70de1b96d7e 100755 --- a/inc/lib_config.php +++ b/inc/lib_config.php @@ -26,24 +26,34 @@ class OC_CONFIG{ global $CONFIG_DATEFORMAT; global $CONFIG_DBNAME; global $CONFIG_INSTALLED; - if(OC_USER::ingroup($_SESSION['username'],'admin') or $CONFIG_INSTALLED==false){ + $allow=false; + if(!$CONFIG_INSTALLED){ + $allow=true; + }elseif(OC_USER::isLoggedIn()){ + if(OC_USER::ingroup($_SESSION['username'],'admin')){ + $allow=true; + } + } + if($allow){ require('templates/adminform.php'); } } public static function createuserlisener(){ - if(OC_USER::ingroup($_SESSION['username'],'admin')){ - if(isset($_POST['new_username']) and isset($_POST['new_password'])){ - if(OC_USER::createuser($_POST['new_username'],$_POST['new_password'])){ - return 'user successfully created'; + if(OC_USER::isLoggedIn()){ + if(OC_USER::ingroup($_SESSION['username'],'admin')){ + if(isset($_POST['new_username']) and isset($_POST['new_password'])){ + if(OC_USER::createuser($_POST['new_username'],$_POST['new_password'])){ + return 'user successfully created'; + }else{ + return 'error while trying to create user'; + } }else{ - return 'error while trying to create user'; + return false; } }else{ return false; } - }else{ - return false; } } @@ -107,7 +117,7 @@ class OC_CONFIG{ public static function writeadminlisener(){ global $CONFIG_INSTALLED; $allow=false; - if($CONFIG_INSTALLED==false){ + if(!$CONFIG_INSTALLED){ $allow=true; }elseif(OC_USER::isLoggedIn()){ if(OC_USER::ingroup($_SESSION['username'],'admin')){ -- 2.39.5