summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xinc/lib_config.php28
1 files 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')){