aboutsummaryrefslogtreecommitdiffstats
path: root/inc/templates
diff options
context:
space:
mode:
authorRobin <robin@Amaya.(none)>2010-04-23 00:05:04 +0200
committerRobin <robin@Amaya.(none)>2010-04-23 00:05:04 +0200
commitb5dae01a8a0e9c1e4f3d60da74eae74dd8a9e007 (patch)
treecdec7b5af6ae8d3e9b1c3b37edd339f179db8362 /inc/templates
parent07a8992a84c252ab10d6047e3de1ce16ac3c6b0b (diff)
downloadnextcloud-server-b5dae01a8a0e9c1e4f3d60da74eae74dd8a9e007.tar.gz
nextcloud-server-b5dae01a8a0e9c1e4f3d60da74eae74dd8a9e007.zip
change the config system to support multi user
Diffstat (limited to 'inc/templates')
-rw-r--r--inc/templates/adminform.php106
-rwxr-xr-xinc/templates/configform.php103
-rwxr-xr-xinc/templates/header.php12
3 files changed, 143 insertions, 78 deletions
diff --git a/inc/templates/adminform.php b/inc/templates/adminform.php
new file mode 100644
index 00000000000..38d2b14a57e
--- /dev/null
+++ b/inc/templates/adminform.php
@@ -0,0 +1,106 @@
+<?php
+global $FIRSTRUN;
+global $CONFIG_ERROR;
+if(!isset($fillDB)) $fillDB=true;
+if(!isset($CONFIG_DBHOST)) $CONFIG_DBHOST='localhost';
+if(!isset($CONFIG_DBUSER)) $CONFIG_DBUSER='owncloud';
+$newuserpassword=OC_USER::generatepassword();
+?>
+<script type="text/javascript">
+function showDBAdmin(){
+ var show=document.getElementById('dbcreate').checked;
+ document.getElementById('dbAdminUser').style.display=(show)?'table-row':'none';
+ document.getElementById('dbAdminPwd').style.display=(show)?'table-row':'none';
+}
+
+function dbtypechange(){
+ var dropdown=action=document.getElementById('dbtype');
+ var type=dropdown.options[dropdown.selectedIndex].value;
+ var inputs=Array('dbhost','dbuser','dbpass','dbpass_retype','dbcreaterow','dbAdminPwd','dbAdminUser');
+ var id,element;
+ if(type=='sqlite'){
+ for(i in inputs){
+ id=inputs[i];
+ element=document.getElementById(id);
+ if(element){
+ element.style.display='none';
+ }
+ }
+ }else if(type=='mysql'){
+ for(i in inputs){
+ id=inputs[i];
+ element=document.getElementById(id);
+ if(element){
+ element.style.display='table-row';
+ }
+ }
+ showDBAdmin()
+ }
+}
+</script>
+<form method="post" enctype="multipart/form-data">
+<table cellpadding="5" cellspacing="5" border="0" class="loginform">
+<?php
+ if(!empty($CONFIG_ERROR) and !$FIRSTRUN){
+ echo "<tr><td colspan='3' class='error'>$CONFIG_ERROR</td></tr>";
+ }
+ if(!$FIRSTRUN){?>
+ <tr><td>current password</td><td><input type="password" name="currentpassword" size="30" class="formstyle"></input></td></tr>
+ <?php
+ }
+if($FIRSTRUN){?>
+<tr><td>admin login:</td><td><input type="text" name="adminlogin" size="30" class="formstyle" value="<?php echo($CONFIG_ADMINLOGIN);?>"></input></td></tr>
+<tr><td>admin password:</td><td><input type="password" name="adminpassword" size="30" class="formstyle"></input></td><td>(leave empty to keep current password)</td></tr>
+<tr><td>retype admin password:</td><td><input type="password" name="adminpassword2" size="30" class="formstyle"></input></td></tr>
+<?php
+}
+?>
+<tr><td>data directory:</td><td><input type="text" name="datadirectory" size="30" class="formstyle" value="<?php echo($CONFIG_DATADIRECTORY);?>"></input></td></tr>
+<tr><td>force ssl:</td><td><input type="checkbox" name="forcessl" size="30" class="formstyle" value='<?php echo($CONFIG_HTTPFORCESSL);?>'></input></td></tr>
+<tr><td>date format:</td><td><input type="text" name="dateformat" size="30" class="formstyle" value='<?php echo($CONFIG_DATEFORMAT);?>'></input></td></tr>
+<tr><td>database type:</td><td>
+<select id='dbtype' name="dbtype" onchange='dbtypechange()'>
+<?php
+global $CONFIG_DBTYPE;
+if($CONFIG_DBTYPE=='sqlite'){
+?>
+<option value="sqlite">SQLite</option>
+<option value="mysql">MySQL</option>
+<?php
+}else{
+?>
+<option value="mysql">MySQL</option>
+<option value="sqlite">SQLite</option>
+<?php
+}
+?>
+</select>
+</td></tr>
+<tr id='dbhost'><td>database host:</td><td><input type="text" name="dbhost" size="30" class="formstyle" value='<?php echo($CONFIG_DBHOST);?>'></input></td></tr>
+<tr><td>database name:</td><td><input type="text" name="dbname" size="30" class="formstyle" value='<?php echo($CONFIG_DBNAME);?>'></input></td></tr>
+<tr id='dbuser'><td>database user:</td><td><input type="text" name="dbuser" size="30" class="formstyle" value='<?php echo($CONFIG_DBUSER);?>'></input></td></tr>
+<tr id='dbpass'><td>database password:</td><td><input type="password" name="dbpassword" size="30" class="formstyle" value=''></input></td><td>(leave empty to keep current password)</td></tr>
+<tr id='dbpass_retype'><td>retype database password:</td><td><input type="password" name="dbpassword2" size="30" class="formstyle" value=''></input></td></tr>
+<tr id='dbcreaterow'><td>create database and user:</td><td><input id='dbcreate' type="checkbox" name="createdatabase" size="30" class="formstyle" value='1' <?php if($FIRSTRUN) echo 'checked'; ?> onchange='showDBAdmin()'></input></td></tr>
+<tr id='dbAdminUser'><td>database administrative user:</td><td><input type="text" name="dbadminuser" size="30" class="formstyle" value='root'></input></td></tr>
+<tr id='dbAdminPwd'><td>database administrative password:</td><td><input type="password" name="dbadminpwd" size="30" class="formstyle" value=''></input></td></tr>
+<tr><td>automaticly fill initial database:</td><td><input type="checkbox" name="filldb" size="30" class="formstyle" value='1' <?php if($FIRSTRUN) echo 'checked'; ?>></input></td></tr>
+<tr><td></td><td><input type="submit" name="set_config" alt="save" value="save" class="formstyle" /></td></tr>
+</table></form><br/>
+<?php
+if(!$FIRSTRUN){?>
+<br/>
+<form method="post" enctype="multipart/form-data">
+<table cellpadding="5" cellspacing="5" border="0" class="loginform">
+<tr><td colspan='2'>Create new user:</td></tr>
+<tr><td>user name</td><td><input type='text' name='new_username' class="formstyle"></input></td></tr>
+<tr><td>password</td><td><input type='text' name='new_password' class="formstyle" autocomplete="off" value='<?php echo($newuserpassword);?>'></input></td></tr>
+<tr><td></td><td><input type='submit' value='create' class="formstyle"></input></td></tr>
+</table>
+</form>
+<?php
+}
+?>
+<script type="text/javascript">
+ dbtypechange()
+</script> \ No newline at end of file
diff --git a/inc/templates/configform.php b/inc/templates/configform.php
index ba946fc67b0..037249a84a2 100755
--- a/inc/templates/configform.php
+++ b/inc/templates/configform.php
@@ -7,92 +7,45 @@ if(!isset($CONFIG_DBUSER)) $CONFIG_DBUSER='owncloud';
$newuserpassword=OC_USER::generatepassword();
?>
<script type="text/javascript">
-function showDBAdmin(){
- var show=document.getElementById('dbcreate').checked;
- document.getElementById('dbAdminUser').style.display=(show)?'table-row':'none';
- document.getElementById('dbAdminPwd').style.display=(show)?'table-row':'none';
-}
-
-function dbtypechange(){
- var dropdown=action=document.getElementById('dbtype');
- var type=dropdown.options[dropdown.selectedIndex].value;
- var inputs=Array('dbhost','dbuser','dbpass','dbpass_retype','dbcreaterow','dbAdminPwd','dbAdminUser');
- var id,element;
- if(type=='sqlite'){
- for(i in inputs){
- id=inputs[i];
- element=document.getElementById(id);
- if(element){
- element.style.display='none';
- }
- }
- }else if(type=='mysql'){
- for(i in inputs){
- id=inputs[i];
- element=document.getElementById(id);
- if(element){
- element.style.display='table-row';
- }
- }
- showDBAdmin()
- }
+changepassset=function(){
+ var change=document.getElementById('changepass').checked;
+ if(!change){
+ document.getElementById('new_password').style.display='none';
+ document.getElementById('new_password_retype').style.display='none';
+ }else{
+ document.getElementById('new_password').style.display='table-row';
+ document.getElementById('new_password_retype').style.display='table-row';
+ }
}
</script>
<form method="post" enctype="multipart/form-data">
+<input type='hidden' name='config' value='1'>
<table cellpadding="5" cellspacing="5" border="0" class="loginform">
<?php
if(!empty($CONFIG_ERROR) and !$FIRSTRUN){
echo "<tr><td colspan='3' class='error'>$CONFIG_ERROR</td></tr>";
}
- if(!$FIRSTRUN){?>
- <tr><td>current password</td><td><input type="password" name="currentpassword" size="30" class="formstyle"></input></td></tr>
- <?php
- }
-?>
-<tr><td>admin login:</td><td><input type="text" name="adminlogin" size="30" class="formstyle" value="<?php echo($CONFIG_ADMINLOGIN);?>"></input></td></tr>
-<tr><td>admin password:</td><td><input type="password" name="adminpassword" size="30" class="formstyle"></input></td><td>(leave empty to keep current password)</td></tr>
-<tr><td>retype admin password:</td><td><input type="password" name="adminpassword2" size="30" class="formstyle"></input></td></tr>
-<tr><td>data directory:</td><td><input type="text" name="datadirectory" size="30" class="formstyle" value="<?php echo($CONFIG_DATADIRECTORY);?>"></input></td></tr>
-<tr><td>force ssl:</td><td><input type="checkbox" name="forcessl" size="30" class="formstyle" value='<?php echo($CONFIG_HTTPFORCESSL);?>'></input></td></tr>
-<tr><td>date format:</td><td><input type="text" name="dateformat" size="30" class="formstyle" value='<?php echo($CONFIG_DATEFORMAT);?>'></input></td></tr>
-<tr><td>database type:</td><td>
-<select id='dbtype' name="dbtype" onchange='dbtypechange()'>
-<?php
-global $CONFIG_DBTYPE;
-if($CONFIG_DBTYPE=='sqlite'){
-?>
-<option value="sqlite">SQLite</option>
-<option value="mysql">MySQL</option>
-<?php
-}else{
?>
-<option value="mysql">MySQL</option>
-<option value="sqlite">SQLite</option>
+<tr><td>enter password</td><td><input type="password" name="currentpassword" size="30" class="formstyle"></input></td></tr>
+<tr><td>change password:</td><td><input onchange='changepassset()' id='changepass' type="checkbox" name="changepass" size="30" class="formstyle" value='1'></input></td></tr>
+<tr style='display:none' id='new_password'><td>new password:</td><td><input type="password" name="password" size="30" class="formstyle"></input></td></tr>
+<tr style='display:none' id='new_password_retype'><td>retype admin password:</td><td><input type="password" name="password2" size="30" class="formstyle"></input></td></tr>
+</table>
+</form>
+Groups:
+<form method="post" enctype="multipart/form-data">
+<input type='hidden' name='creategroup' value='1'>
+<table cellpadding="5" cellspacing="5" border="0" class="loginform">
+<tr><td colspan='2' class='center'>Current groups</td></tr>
<?php
+$groups=OC_USER::getusergroups($_SESSION['username']);
+foreach($groups as $group){
+ ?>
+ <tr><td><?php echo $group;?></td></tr>
+ <?php
}
?>
-</select>
-</td></tr>
-<tr id='dbhost'><td>database host:</td><td><input type="text" name="dbhost" size="30" class="formstyle" value='<?php echo($CONFIG_DBHOST);?>'></input></td></tr>
-<tr><td>database name:</td><td><input type="text" name="dbname" size="30" class="formstyle" value='<?php echo($CONFIG_DBNAME);?>'></input></td></tr>
-<tr id='dbuser'><td>database user:</td><td><input type="text" name="dbuser" size="30" class="formstyle" value='<?php echo($CONFIG_DBUSER);?>'></input></td></tr>
-<tr id='dbpass'><td>database password:</td><td><input type="password" name="dbpassword" size="30" class="formstyle" value=''></input></td><td>(leave empty to keep current password)</td></tr>
-<tr id='dbpass_retype'><td>retype database password:</td><td><input type="password" name="dbpassword2" size="30" class="formstyle" value=''></input></td></tr>
-<tr id='dbcreaterow'><td>create database and user:</td><td><input id='dbcreate' type="checkbox" name="createdatabase" size="30" class="formstyle" value='1' <?php if($FIRSTRUN) echo 'checked'; ?> onchange='showDBAdmin()'></input></td></tr>
-<tr id='dbAdminUser'><td>database administrative user:</td><td><input type="text" name="dbadminuser" size="30" class="formstyle" value='root'></input></td></tr>
-<tr id='dbAdminPwd'><td>database administrative password:</td><td><input type="password" name="dbadminpwd" size="30" class="formstyle" value=''></input></td></tr>
-<tr><td>automaticly fill initial database:</td><td><input type="checkbox" name="filldb" size="30" class="formstyle" value='1' <?php if($FIRSTRUN) echo 'checked'; ?>></input></td></tr>
-<tr><td></td><td><input type="submit" name="set_config" alt="save" value="save" class="formstyle" /></td></tr>
-</table></form><br/>
-<br/>
-<form method="post" enctype="multipart/form-data">
-<table cellpadding="5" cellspacing="5" border="0" class="loginform">
-<tr><td colspan='2'>Create new user:</td></tr>
-<tr><td>user name</td><td><input type='text' name='new_username' class="formstyle"></input></td></tr>
-<tr><td>password</td><td><input type='text' name='new_password' class="formstyle" autocomplete="off" value='<?php echo($newuserpassword);?>'></input></td></tr>
-<tr><td></td><td><input type='submit' value='create' class="formstyle"></input></td></tr>
+<tr><td colspan='2' class='center'>Create new group</td></tr>
+<tr><td><input type='text' name='groupname' class="formstyle"></input></td><td><input type='submit' value='create' class="formstyle"></input></td></tr>
</table>
</form>
-<script type="text/javascript">
- dbtypechange()
-</script> \ No newline at end of file
diff --git a/inc/templates/header.php b/inc/templates/header.php
index 46c64bfd645..51e729cb8e1 100755
--- a/inc/templates/header.php
+++ b/inc/templates/header.php
@@ -32,9 +32,15 @@ echo('<h1><a id="owncloud-logo" href="'.$WEBROOT.'"><span>ownCloud</span></a></h
// check if already configured. otherwise start configuration wizard
- $error=OC_CONFIG::writeconfiglisener();
+ $error=OC_CONFIG::writeadminlisener();
+ if($e=OC_CONFIG::configlisener()){
+ $error.=$e;
+ }
if($e=OC_CONFIG::createuserlisener()){
- $error=$e;
+ $error.=$e;
+ }
+ if($e=OC_CONFIG::creategrouplisener()){
+ $error.=$e;
}
$CONFIG_ERROR=$error;
global $CONFIG_INSTALLED;
@@ -44,7 +50,7 @@ echo('<h1><a id="owncloud-logo" href="'.$WEBROOT.'"><span>ownCloud</span></a></h
echo('<div class="center">');
echo('<p class="errortext">'.$error.'</p>');
echo('<p class="highlighttext">First Run Wizard</p>');
- OC_CONFIG::showconfigform();
+ OC_CONFIG::showadminform();
echo('</div>');
OC_UTIL::showfooter();
exit();