Quota did't work

Profile weren't saved
Started to make code HTML-compliant
This commit is contained in:
katagia 2003-06-05 11:36:54 +00:00
parent cdc7acd409
commit dca6d7def9
5 changed files with 130 additions and 98 deletions

View File

@ -1,5 +1,5 @@
general_group: staff
general_homedir: /home/$user
general_homedir: /home2/$user
general_shell: /bin/bash
unix_pwdwarn: 10
unix_pwdallowlogin: 10

View File

@ -117,7 +117,6 @@ function initvars($type=false,$DN=false) { // This function registers all needes
}
else {
if (session_is_registered("account_old")) session_unregister("account_old");
if ( (($type=='user')||($type=='group')) && ($_SESSION['config']->scriptServer)) $_SESSION['account'] = getquotas($type);
switch ($type) {
case 'user':
$_SESSION['account'] = loadUserProfile('default');
@ -129,6 +128,13 @@ function initvars($type=false,$DN=false) { // This function registers all needes
$_SESSION['account'] = loadHostProfile('default');
break;
}
if ( (($type=='user')||($type=='group')) && ($_SESSION['config']->scriptServer)) {
$values = getquotas($type);
if (is_object($values)) {
while (list($key, $val) = each($values)) // Set only defined values
if ($val) $_SESSION['account']->$key = $val;
}
}
}
}
}
@ -594,6 +600,13 @@ function loaduser($dn) { // Will load all needed values from an existing account
if (substr(str_replace('{CRYPT}', '',$attr['userPassword'][0]),0,1) == '!' ) $return->unix_deactivated=true;
if ($attr['userPassword'][0]) $return->unix_password = $attr['userPassword'][0];
if ($attr['ntPassword'][0]) $return->smb_password = $attr['ntPassword'][0];
if ($_SESSION['config']->scriptServer) {
$values = getquotas('user',$return->general_username);
if (is_object($values)) {
while (list($key, $val) = each($values)) // Set only defined values
if ($val) $return->$key = $val;
}
}
return $return;
}
@ -667,6 +680,13 @@ function loadgroup($dn) { // Will load all needed values from an existing group
if ($attr['memberUid']) $return->general_memberUid = $attr['memberUid'];
if (is_array($return->general_memberUid)) array_shift($return->general_memberUid);
$return->general_dn = $dn;
if ($_SESSION['config']->scriptServer) {
$values = getquotas('group',$return->general_username);
if (is_object($values)) {
while (list($key, $val) = each($values)) // Set only defined values
if ($val) $return->$key = $val;
}
}
return $return;
}
@ -777,7 +797,7 @@ function modifyuser($values,$values_old) { // Will modify the LDAP-Account
// Value stored in shadowExpire, days since 1.1.1970
$date = mktime(10,0,0, $values->unix_pwdexpire_mon, $values->unix_pwdexpire_day, $values->unix_pwdexpire_yea) / 86400 ;
settype($date, 'integer');
$values->general_dn = 'uid=' . $values->general_username . ',' . $values->get_UserSuffix();
$values->general_dn = 'uid=' . $values->general_username . ',' . $_SESSION['config']->get_UserSuffix();
if ($values->general_username != $values_old->general_username) {
$attr['cn'] = $values->general_username; // posixAccount_req shadowAccount_req sambaAccount_may
$attr['uid'] = $values->general_username; // posixAccount_req
@ -876,7 +896,7 @@ function modifyuser($values,$values_old) { // Will modify the LDAP-Account
if ($values->smb_pwdcanchange==0 && $values_old->smb_pwdcanchange==1) $attr_rem['pwdCanChange'] = "1"; else $attr['pwdCanChange'] = "0"; // sambaAccount_may
if ($values->smb_pwdmustchange && $values->smb_pwdmustchange==0) $attr['pwdMustChange'] = "1"; else $attr['pwdMustChange'] = "0"; // sambaAccount_may
if ($values->smb_pwdmustchange==0 && $values->smb_pwdmustchange==1) $attr_rem['pwdMustChange'] = "1"; else $attr['pwdMustChange'] = "0"; // sambaAccount_may
$attr['acctFlags'] = smbflag(); // sambaAccount_may
$attr['acctFlags'] = smbflag($values); // sambaAccount_may
if (($values->smb_smbhome!='') && ($values->smb_smbhome!=$values_old->smb_smbhome)) $attr['smbHome'] = $values->smb_smbhome; // sambaAccount_may
if (($values->smb_smbhome=='') && ($values->smb_smbhome!=$values_old->smb_smbhome)) $attr_rem['smbHome'] = $values_old->smb_smbhome; // sambaAccount_may
if (($values->smb_homedrive!='') && ($values->smb_homedrive!=$values_old->smb_homedrive)) $attr['homeDrive'] = $values->smb_homedrive; // sambaAccount_may

View File

@ -245,20 +245,6 @@ if ( $_POST['create'] ) { // Create-Button was pressed
}
// Write HTML-Header and part of Table
echo '<html><head><title>';
echo _('Create new Account');
echo '</title>
<link rel="stylesheet" type="text/css" href="../style/layout.css">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
</head><body>
<form action="account.php" method="post">';
if ($error != "0") StatusMessage('ERROR', _('Invalid Value!'), $error);
echo '<table rules="all" class="account" width="100%">
<tr><td></td></tr>';
if (!$select_local) $select_local='general';
if ($_POST['createagain']) {
$select_local='general';
@ -272,13 +258,78 @@ if ($_POST['load']) $select_local='load';
if ($_POST['save']) $select_local='save';
// Write HTML-Header and part of Table
echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">';
echo '<html><head><title>';
echo _('Create new Account');
echo '</title>
<link rel="stylesheet" type="text/css" href="../style/layout.css">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">';
switch ($select_local) {
case 'backmain':
if (session_is_registered("shelllist")) session_unregister("shelllist");
if (session_is_registered("account")) session_unregister("account");
if (session_is_registered("account_old")) session_unregister("account_old");
switch ( $_SESSION['type2'] ) {
case 'user' :
if (session_is_registered("type2")) session_unregister("type2");
echo '<meta http-equiv="refresh" content="0; URL=lists/listusers.php">';
break;
case 'group' :
if (session_is_registered("type2")) session_unregister("type2");
echo '<meta http-equiv="refresh" content="0; URL=lists/listgroups.php">';
break;
case 'host' :
if (session_is_registered("type2")) session_unregister("type2");
echo '<meta http-equiv="refresh" content="0; URL=lists/listhosts.php">';
break;
}
break;
case 'load':
switch ( $_SESSION['type2'] ) {
case 'user':
$_SESSION['account'] = loadUserProfile($_POST['f_general_selectprofile']);
break;
case 'host':
$_SESSION['account'] = loadHostProfile($_POST['f_general_selectprofile']);
break;
case 'group':
$_SESSION['account'] = loadGroupProfile($_POST['f_general_selectprofile']);
break;
}
$select_local='general';
break;
case 'save':
switch ( $_SESSION['type2'] ) {
case 'user':
saveUserProfile($_SESSION['account'], $_POST['f_finish_safeProfile']);
break;
case 'host':
saveHostProfile($_SESSION['account'], $_POST['f_finish_safeProfile']);
break;
case 'group':
saveGroupProfile($_SESSION['account'], $_POST['f_finish_safeProfile']);
break;
}
$select_local='final';
break;
}
echo '</head><body>
<form action="account.php" method="post">';
if ($error != "0") StatusMessage('ERROR', _('Invalid Value!'), $error);
echo '<table rules="all" class="account" width="100%">';
switch ($select_local) {
case 'general':
// General Account Settings
$groups = findgroups();
echo '
<input name="select" type="hidden" value="general">
<tr><td>';
echo '<tr><td><input name="select" type="hidden" value="general">';
echo _('General Properties');
echo '</td></tr>';
switch ( $_SESSION['type2'] ) {
@ -309,7 +360,7 @@ switch ($select_local) {
if ($_SESSION['account']->general_group == $group) echo '<option selected>' . $group;
else echo '<option>' . $group;
}
echo '</td></tr><tr><td>';
echo '</select></td></tr><tr><td>';
echo _('Additional Groupmembership');
echo '</td><td><select name="f_general_groupadd[]" size="3" multiple>';
foreach ($groups as $group) {
@ -387,7 +438,7 @@ switch ($select_local) {
if ($_SESSION['account']->general_group == $group) echo '<option selected>' . $group;
else echo '<option>' . $group;
}
echo '</td></tr><tr><td>';
echo '</select></td></tr><tr><td>';
echo _('Additional Groupmembership');
echo '</td><td><select name="f_general_groupadd[]" size="3" multiple>';
foreach ($groups as $group) {
@ -417,8 +468,9 @@ switch ($select_local) {
break;
case 'unix':
// Unix Password Settings
echo '<input name="select" type="hidden" value="unix">';
echo '<tr><td>Unix Properties</td></tr>';
echo '<tr><td><input name="select" type="hidden" value="unix">';
echo _('Unix Properties');
echo '</td></tr>';
switch ( $_SESSION['type2'] ) {
case 'user' :
echo '<tr><td>';
@ -542,8 +594,7 @@ switch ($select_local) {
break;
case 'samba':
// Samba Settings
echo '<input name="select" type="hidden" value="samba">';
echo '<tr><td>'; echo _('Samba Properties'); echo '</td></tr>';
echo '<tr><td><input name="select" type="hidden" value="samba">'; echo _('Samba Properties'); echo '</td></tr>';
switch ( $_SESSION['type2'] ) {
case 'user':
echo '<tr><td>';
@ -665,7 +716,7 @@ switch ($select_local) {
break;
case 'quota':
// Quota Settings
echo '<input name="select" type="hidden" value="quota"><tr><td>';
echo '<tr><td><input name="select" type="hidden" value="quota">';
echo _('Quota Properties');
echo '</td></tr><tr><td>'; echo _('Mointpoint'); echo '</td><td>'; echo _('used blocks'); echo '</td><td>';
echo _('soft block limit'); echo '</td><td>'; echo _('hard block limit'); echo '</td><td>'; echo _('grace block period');
@ -691,8 +742,7 @@ switch ($select_local) {
break;
case 'personal':
// Personal Settings
echo '<input name="select" type="hidden" value="personal">
<tr><td>';
echo '<tr><td><input name="select" type="hidden" value="personal">';
echo _('Personal Properties');
echo '</td></tr><tr><td>';
echo _('Title');
@ -740,8 +790,7 @@ switch ($select_local) {
break;
case 'final':
// Final Settings
echo '<input name="select" type="hidden" value="final">
<tr><td>';
echo '<tr><td><input name="select" type="hidden" value="final">';
if ($_SESSION['account_old']) echo _('Modify');
else echo _('Create');
echo '</td></tr>';
@ -786,12 +835,10 @@ switch ($select_local) {
echo '<tr><td>';
echo '<input name="back" type="submit" value="'; echo _('back'); echo '">
</td><td>';
if (($_SESSION['type2']=='user') || ($_SESSION['type2']=='host')) {
echo '</td><td><input name="f_finish_safeProfile" type="text" size="30" maxlength="30">
<input name="save" type="submit" value="';
echo _('Save Profile');
echo '">';
}
echo '</td><td>
<input name="create" type="submit" value="';
if ($_SESSION['account_old']) echo _('Modify Account');
@ -801,8 +848,7 @@ switch ($select_local) {
break;
case 'finish':
// Final Settings
echo '<input name="select" type="hidden" value="finish">
<tr><td>';
echo '<tr><td><input name="select" type="hidden" value="finish">';
echo _('Success');
echo '</td></tr>';
switch ( $_SESSION['type2'] ) {
@ -848,52 +894,8 @@ switch ($select_local) {
break;
}
break;
case 'backmain':
if (session_is_registered("shelllist")) session_unregister("shelllist");
if (session_is_registered("account")) session_unregister("account");
if (session_is_registered("account_old")) session_unregister("account_old");
switch ( $_SESSION['type2'] ) {
case 'user' :
if (session_is_registered("type2")) session_unregister("type2");
echo '<meta http-equiv="refresh" content="0; URL=lists/listusers.php">';
break;
case 'group' :
if (session_is_registered("type2")) session_unregister("type2");
echo '<meta http-equiv="refresh" content="0; URL=lists/listgroups.php">';
break;
case 'host' :
if (session_is_registered("type2")) session_unregister("type2");
echo '<meta http-equiv="refresh" content="0; URL=lists/listhosts.php">';
break;
}
break;
case 'load':
switch ( $_SESSION['type2'] ) {
case 'user':
$_SESSION['account'] = loadUserProfile($_POST['f_general_selectprofile']);
break;
case 'host':
$_SESSION['account'] = loadHostProfile($_POST['f_general_selectprofile']);
break;
case 'group':
$_SESSION['account'] = loadGroupProfile($_POST['f_general_selectprofile']);
break;
}
echo '<meta http-equiv="refresh" content="0; URL=account.php">';
break;
case 'save':
switch ( $_SESSION['type2'] ) {
case 'user':
saveUserProfile($_SESSION['account'], $f_finish_safeProfile);
break;
case 'host':
saveHostProfile($_SESSION['account'], $f_finish_safeProfile);
break;
}
echo '<meta http-equiv="refresh" content="0; URL=account.php?select=final">';
break;
}
// Print end of HTML-Page
echo '</form></body></html>';
echo '</table></form></body></html>';
?>

View File

@ -28,14 +28,16 @@ include_once('../lib/config.inc');
session_save_path('../sess');
@session_start();
echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">';
echo '<html><head><title>';
echo _('Delete Account');
echo '</title>
</head>
<link rel="stylesheet" type="text/css" href="../style/layout.css">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
</head>
<body>
<form action="delete.php" method="post">
<table rules="all" class="delete" width="100%">
@ -58,7 +60,7 @@ if ($_GET['type']) {
}
echo '</td></tr>';
foreach ($DN2 as $dn) echo '<tr><td>'.$dn.'</td></tr>';
echo '<br><tr><td>
echo '<tr><td><br></td></tr><tr><td>
<input name="delete_yes" type="submit" value="';
echo _('Commit'); echo '"></td><td></td><td>
<input name="delete_no" type="submit" value="';
@ -121,5 +123,5 @@ if ($_POST['delete_yes']) {
if ($_POST['delete_no']) echo _('Nothing was deleted.');
echo '</td></tr>';
echo '</form></body></html>';
echo '</table></form></body></html>';
?>

View File

@ -42,13 +42,24 @@ if (!$select) $select='main';
// Write HTML-Header and part of Table
echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">';
echo '<html><head><title>';
echo _('Create new Accounts');
echo '</title>
<link rel="stylesheet" type="text/css" href="../style/layout.css">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
</head><body>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">';
switch ($select) {
case 'cancel':
if ( session_is_registered("accounts")) session_unregister("accounts");
echo '<meta http-equiv="refresh" content="0; URL=lists/listusers.php">';
break;
}
echo '</head><body>
<form enctype="multipart/form-data" action="masscreate.php" method="post">';
echo '<table rules="all" class="masscreate" width="100%">
<tr><td></td></tr>';
@ -58,8 +69,7 @@ switch ($select) {
if ( session_is_registered("accounts")) session_unregister("accounts");
session_register("accounts");
$profilelist = getUserProfiles();
echo '<input name="select" type="hidden" value="main">';
echo '<tr><td>';
echo '<tr><td><input name="select" type="hidden" value="main">';
echo _('Mass Creation');
echo '</td></tr><tr><td>';
echo _('Please provide a csv-file with the following syntax. Values with * are required:');
@ -112,6 +122,7 @@ switch ($select) {
if (is_object($values)) {
while (list($key, $val) = each($values)) // Set only defined values
if ($val) $_SESSION['accounts'][$row]->$key = $val;
$_SESSION['accounts'][$row]->general_uidNumber="";
}
else $error = $values;
if (!$error) {
@ -170,10 +181,6 @@ switch ($select) {
echo '</td><td><input name="cancel" type="submit" value="'; echo _('Cancel'); echo '">';
echo '</td><td><input name="create" type="submit" value="'; echo _('Create'); echo '">';
break;
case 'cancel':
if ( session_is_registered("accounts")) session_unregister("accounts");
echo '<meta http-equiv="refresh" content="0; URL=lists/listusers.php">';
break;
case 'create':
$row=0;
$stay=true;
@ -185,6 +192,7 @@ switch ($select) {
$group->general_gecos=$_SESSION['accounts'][$row]->general_group;
creategroup($group);
}
$_SESSION['accounts'][$row]->general_uidNumber = checkid($_SESSION['accounts'][$row], 'user');
$error = createuser($_SESSION['accounts'][$row]);
if ($error==1) $row++;
else {
@ -204,5 +212,5 @@ switch ($select) {
}
echo '</form></body></html>';
echo '</table></form></body></html>';
?>