Quotas and profiles should work now

fixed little typo in index.html
still working at upload ....
This commit is contained in:
katagia 2003-09-28 13:30:31 +00:00
parent b1b4458c03
commit 37e8bbb095
8 changed files with 320 additions and 239 deletions

View File

@ -1,7 +1,7 @@
<html>
<head>
<title>LDAP Account Manager</title>
<meta http-equiv="refresh" content="0; URL=templates/login.php">';
<meta http-equiv="refresh" content="0; URL=templates/login.php">
</head>
<body>
</body>

View File

@ -86,7 +86,7 @@ class account { // This class keeps all needed values for any account
function getshells() { // Return a list of all shells listed in ../config/shells
$shells = file('../../config/shells');
$shells = file($_SESSION['lampath'].'config/shells');
$i=0;
while ($shells[$i]) {
chop($shells[$i]);
@ -178,7 +178,7 @@ function getquotas($type,$user='+') { // Whis function will return the quotas fr
$towrite = $ldap_q[0].' '.$ldap_q[1].' '.$user.' quota get ';
if ($type=='user') $towrite = $towrite.'u';
else $towrite = $towrite.'g';
exec("perl ../../lib/lamdaemon.pl ".$_SESSION['config']->scriptServer ." ".$_SESSION['config']->scriptPath." ".$towrite, $vals, $status);
exec("perl ".$_SESSION['lampath']."lib/lamdaemon.pl ".$_SESSION['config']->scriptServer ." ".$_SESSION['config']->scriptPath." ".$towrite, $vals, $status);
$vals = explode(':', $vals[0]);
for ($i=0; $i<sizeof($vals); $i++) {
$vals2 = explode(',', $vals[$i]);
@ -210,7 +210,7 @@ function setquotas($values,$type,$values_old=false) { // Whis function will set
}
$i++;
}
if ($i!=0) exec("perl ../../lib/lamdaemon.pl ".$_SESSION['config']->scriptServer ." ".$_SESSION['config']->scriptPath." ".$towrite, $vals);
if ($i!=0) exec("perl ".$_SESSION['lampath']."lib/lamdaemon.pl ".$_SESSION['config']->scriptServer ." ".$_SESSION['config']->scriptPath." ".$towrite, $vals);
}
function remquotas($user, $type) { // Whis function will remove the quotas from the specified user.
@ -221,7 +221,7 @@ function remquotas($user, $type) { // Whis function will remove the quotas from
if ($type=='user') $towrite = $towrite.'u ';
else $towrite = $towrite.'g ';
exec("perl ../../lib/lamdaemon.pl ".$_SESSION['config']->scriptServer ." ".$_SESSION['config']->scriptPath." ".$towrite, $vals);
exec("perl ".$_SESSION['lampath']."lib/lamdaemon.pl ".$_SESSION['config']->scriptServer ." ".$_SESSION['config']->scriptPath." ".$towrite, $vals);
}
@ -230,7 +230,7 @@ function addhomedir($user) { // Create Homedirectory
// all other needed vars are taken from remotesystem getusrnam
$ldap_q = $_SESSION['ldap']->decrypt();
$towrite = $ldap_q[0].' '.$ldap_q[1].' '.$user.' home add';
exec("perl ../../lib/lamdaemon.pl ".$_SESSION['config']->scriptServer ." ".$_SESSION['config']->scriptPath." ".$towrite, $vals);
exec("perl ".$_SESSION['lampath']."lib/lamdaemon.pl ".$_SESSION['config']->scriptServer ." ".$_SESSION['config']->scriptPath." ".$towrite, $vals);
}
function remhomedir($user) { // Remove Homedirectory
@ -238,7 +238,7 @@ function remhomedir($user) { // Remove Homedirectory
// all other needed vars are taken from remotesystem getusrnam
$ldap_q = $_SESSION['ldap']->decrypt();
$towrite = $ldap_q[0].' '.$ldap_q[1].' '.$user.' home rem';
exec("perl ../lib/lamdaemon.pl ".$_SESSION['config']->scriptServer ." ".$_SESSION['config']->scriptPath." ".$towrite, $vals);
exec("perl ".$_SESSION['lampath']."lib/lamdaemon.pl ".$_SESSION['config']->scriptServer ." ".$_SESSION['config']->scriptPath." ".$towrite, $vals);
}
function ldapreload($type) { // This function will load an array th cache ldap-requests
@ -761,13 +761,9 @@ function createuser($values) { // Will create the LDAP-Account
$attr['sambaPwdLastSet'] = time(); // sambaAccount_may
}
else {
if (file_exists('../../lib/createntlm.pl')) { // masscreate.php is at a different relative path
$attr['sambaNTPassword'] = exec('../../lib/createntlm.pl nt ' . $values->smb_password);
$attr['sambaLMPassword'] = exec('../../lib/createntlm.pl lm ' . $values->smb_password);
}
else {
$attr['sambaNTPassword'] = exec('../lib/createntlm.pl nt ' . $values->smb_password);
$attr['sambaLMPassword'] = exec('../lib/createntlm.pl lm ' . $values->smb_password);
if (file_exists($_SESSION['lampath'].'lib/createntlm.pl')) { // masscreate.php is at a different relative path
$attr['sambaNTPassword'] = exec($_SESSION['lampath'].'lib/createntlm.pl nt ' . $values->smb_password);
$attr['sambaLMPassword'] = exec($_SESSION['lampath'].'lib/createntlm.pl lm ' . $values->smb_password);
}
$attr['sambaPwdLastSet'] = time(); // sambaAccount_may
}
@ -794,8 +790,8 @@ function createuser($values) { // Will create the LDAP-Account
$attr['pwdLastSet'] = time(); // sambaAccount_may
}
else {
$attr['ntPassword'] = exec('../../lib/createntlm.pl nt ' . $values->smb_password);
$attr['lmPassword'] = exec('../../lib/createntlm.pl lm ' . $values->smb_password);
$attr['ntPassword'] = exec($_SESSION['lampath'].'lib/createntlm.pl nt ' . $values->smb_password);
$attr['lmPassword'] = exec($_SESSION['lampath'].'lib/createntlm.pl lm ' . $values->smb_password);
$attr['pwdLastSet'] = time(); // sambaAccount_may
}
$attr['rid'] = (2 * $values->general_uidNumber + 1000); // sambaAccount_may
@ -995,8 +991,8 @@ function modifyuser($values,$values_old) { // Will modify the LDAP-Account
}
else
if ($values->smb_password!='') {
$attr['sambaNTPassword'] = exec('../../lib/createntlm.pl nt ' . $values->smb_password);
$attr['sambaLMPassword'] = exec('../../lib/createntlm.pl lm ' . $values->smb_password);
$attr['sambaNTPassword'] = exec($_SESSION['lampath'].'lib/createntlm.pl nt ' . $values->smb_password);
$attr['sambaLMPassword'] = exec($_SESSION['lampath'].'lib/createntlm.pl lm ' . $values->smb_password);
$attr['sambaPwdLastSet'] = time(); // sambaAccount_may
}
if ($values->smb_pwdcanchange != $values_old->smb_pwdcanchange) $attr['sambaPwdCanChange'] = $values->smb_pwdcanchange; // sambaAccount_may
@ -1026,8 +1022,8 @@ function modifyuser($values,$values_old) { // Will modify the LDAP-Account
}
else
if ($values->smb_password!='') {
$attr['ntPassword'] = exec('../../lib/createntlm.pl nt ' . $values->smb_password);
$attr['lmPassword'] = exec('../../lib/createntlm.pl lm ' . $values->smb_password);
$attr['ntPassword'] = exec($_SESSION['lampath'].'lib/createntlm.pl nt ' . $values->smb_password);
$attr['lmPassword'] = exec($_SESSION['lampath'].'lib/createntlm.pl lm ' . $values->smb_password);
$attr['pwdLastSet'] = time(); // sambaAccount_may
}
if ($values->smb_pwdcanchange != $values_old->smb_pwdcanchange) $attr['pwdCanChange'] = $values->smb_pwdcanchange; // sambaAccount_may

View File

@ -42,15 +42,36 @@ if (isset($_GET['DN'])) {
$_SESSION['account']->general_dn = substr($_SESSION['account']->general_dn, strpos($_SESSION['account']->general_dn, ',')+1);
$_SESSION['final_changegids'] = '';
}
else {
$_SESSION['account'] = loadGroupProfile('default');
$_SESSION['account'] ->type = 'group';
if (isset($_SESSION['account_old'])) unset($_SESSION['account_old']);
}
}
else if (count($_POST)==0) { // Startcondition. groupedit.php was called from outside
$_SESSION['account'] = loadGroupProfile('default');
$_SESSION['account'] ->type = 'group';
// load quotas from profile and check if they are valid
$values = getquotas('group');
if (isset($_SESSION['account']->quota[0])) { // check quotas from profile
$i=0;
// check quota settings
while (isset($_SESSION['account']->quota[$i])) {
$found = (-1);
for ($j=0; $j<count($values->quota); $j++)
if ($values->quota[$j][0]==$_SESSION['account']->quota[$i][0]) $found = $j;
if ($found==-1) unset($_SESSION['account']->quota[$i]);
else {
$_SESSION['account']->quota[$i][1] = $values->quota[$found][1];
$_SESSION['account']->quota[$i][5] = $values->quota[$found][5];
$_SESSION['account']->quota[$i][4] = $values->quota[$found][4];
$_SESSION['account']->quota[$i][8] = $values->quota[$found][8];
$i++;
}
}
$_SESSION['account']->quota = array_values($_SESSION['account']->quota);
}
else { // No quotas saved in profile
if (is_object($values)) {
while (list($key, $val) = each($values)) // Set only defined values
if (isset($val)) $_SESSION['account']->$key = $val;
}
}
if (isset($_SESSION['account_old'])) unset($_SESSION['account_old']);
}
@ -210,7 +231,7 @@ echo $_SESSION['header'];
echo "<html><head><title>";
echo _("Create new Account");
echo "</title>\n".
"<link rel=\"stylesheet\" type=\"text/css\" href=\"../../style/layout.css\">\n".
"<link rel=\"stylesheet\" type=\"text/css\" href=\"".$_SESSION['lamurl']."style/layout.css\">\n".
"<meta http-equiv=\"pragma\" content=\"no-cache\">\n".
"<meta http-equiv=\"cache-control\" content=\"no-cache\">\n";
@ -266,7 +287,7 @@ do { // X-Or, only one if() can be true
}
if ($_POST['backmain']) {
$select_local='backmain';
echo "<meta http-equiv=\"refresh\" content=\"2; URL=../lists/listgroups.php\">\n";
echo "<meta http-equiv=\"refresh\" content=\"2; URL=".$_SESSION['lamurl']."templates/lists/listgroups.php\">\n";
break;
}
if ($_POST['load']) {
@ -280,6 +301,34 @@ do { // X-Or, only one if() can be true
while (list($key, $val) = each($values)) // Set only defined values
if (isset($val)) $_SESSION['account']->$key = $val;
}
// load quotas from profile and check if they are valid
$values = getquotas('group', $_SESSION['account_old']->general_username);
if (isset($_SESSION['account']->quota[0])) { // check quotas from profile
$i=0;
// check quota settings
while (isset($_SESSION['account']->quota[$i])) {
$found = (-1);
for ($j=0; $j<count($values->quota); $j++)
if ($values->quota[$j][0]==$_SESSION['account']->quota[$i][0]) $found = $j;
if ($found==-1) unset($_SESSION['account']->quota[$i]);
else {
$_SESSION['account']->quota[$i][1] = $values->quota[$found][1];
$_SESSION['account']->quota[$i][5] = $values->quota[$found][5];
$_SESSION['account']->quota[$i][4] = $values->quota[$found][4];
$_SESSION['account']->quota[$i][8] = $values->quota[$found][8];
$i++;
}
}
$_SESSION['account']->quota = array_values($_SESSION['account']->quota);
}
else { // No quotas saved in profile
if (is_object($values)) {
while (list($key, $val) = each($values)) // Set only defined values
if (isset($val)) $_SESSION['account']->$key = $val;
}
}
// select general page after group has been loaded
$select_local='general';
break;
@ -358,7 +407,7 @@ switch ($select_local) { // Select which part of page will be loaded
echo "<td align=\"center\" width=\"10%\"><input type=\"submit\" name=\"add\" value=\"<=\">";
echo " ";
echo "<input type=\"submit\" name=\"remove\" value=\"=>\"><br><br>";
echo "<a href=\"../help.php?HelpNumber=419\" target=\"lamhelp\">"._('Help')."</a></td>\n";
echo "<a href=\"".$_SESSION['lamurl']."templates/help.php?HelpNumber=419\" target=\"lamhelp\">"._('Help')."</a></td>\n";
echo "<td valign=\"top\"><fieldset class=\"groupedit-middle\"><legend class=\"groupedit-bright\">";
echo _('Available users');
echo "</legend>\n";
@ -407,14 +456,14 @@ switch ($select_local) { // Select which part of page will be loaded
echo _("Groupname")."*";
echo "</td>\n<td>".
"<input name=\"f_general_username\" type=\"text\" size=\"30\" maxlength=\"20\" value=\"".$_SESSION['account']->general_username."\">".
"</td>\n<td><a href=\"../help.php?HelpNumber=407\" target=\"lamhelp\">"._('Help')."</a></td>\n</tr>\n<tr>\n<td>";
"</td>\n<td><a href=\"".$_SESSION['lamurl']."templates/help.php?HelpNumber=407\" target=\"lamhelp\">"._('Help')."</a></td>\n</tr>\n<tr>\n<td>";
echo _('GID number');
echo "</td>\n<td><input name=\"f_general_uidNumber\" type=\"text\" size=\"30\" maxlength=\"6\" value=\"".$_SESSION['account']->general_uidNumber."\">".
"</td>\n<td><a href=\"../help.php?HelpNumber=408\" target=\"lamhelp\">"._('Help').
"</td>\n<td><a href=\"".$_SESSION['lamurl']."templates/help.php?HelpNumber=408\" target=\"lamhelp\">"._('Help').
"</a></td>\n</tr>\n<tr>\n<td>";
echo _('Description');
echo "</td>\n<td><input name=\"f_general_gecos\" type=\"text\" size=\"30\" value=\"".$_SESSION['account']->general_gecos."\"></td>\n".
"<td><a href=\"../help.php?HelpNumber=409\" target=\"lamhelp\">"._('Help')."</a></td>\n</tr>\n<tr>\n<td>";
"<td><a href=\"".$_SESSION['lamurl']."templates/help.php?HelpNumber=409\" target=\"lamhelp\">"._('Help')."</a></td>\n</tr>\n<tr>\n<td>";
echo _('Suffix'); echo "</td>\n<td><select name=\"f_general_suffix\">";
foreach ($_SESSION['ldap']->search_units($_SESSION['config']->get_GroupSuffix()) as $suffix) {
@ -425,7 +474,7 @@ switch ($select_local) { // Select which part of page will be loaded
}
else echo " <option>$suffix</option>\n";
}
echo "</select></td>\n<td><a href=\"../help.php?HelpNumber=462\" target=\"lamhelp\">"._('Help').
echo "</select></td>\n<td><a href=\"".$_SESSION['lamurl']."templates/help.php?HelpNumber=462\" target=\"lamhelp\">"._('Help').
"</a></td>\n</tr>\n</table>";
echo _('Values with * are required');
echo "</fieldset>\n</td></tr><tr><td>";
@ -437,7 +486,7 @@ switch ($select_local) { // Select which part of page will be loaded
foreach ($profilelist as $profile) echo " <option>$profile</option>\n";
echo "</select>\n".
"<input name=\"load\" type=\"submit\" value=\""; echo _('Load Profile');
echo "\"></td><td><a href=\"../help.php?HelpNumber=421\" target=\"lamhelp\">";
echo "\"></td><td><a href=\"".$_SESSION['lamurl']."templates/help.php?HelpNumber=421\" target=\"lamhelp\">";
echo _('Help')."</a></td>\n</tr>\n</table>\n</fieldset>\n";
}
echo "</td></tr>\n</table>\n</td></tr></table>\n";
@ -471,7 +520,7 @@ switch ($select_local) { // Select which part of page will be loaded
echo _("Display name");
echo "</td>\n<td>".
"<input name=\"f_smb_displayName\" type=\"text\" size=\"30\" maxlength=\"50\" value=\"".$_SESSION['account']->smb_displayName."\">".
"</td>\n<td><a href=\"../help.php?HelpNumber=420\" target=\"lamhelp\">"._('Help')."</a></td>\n</tr>\n<tr>\n<td>";
"</td>\n<td><a href=\"".$_SESSION['lamurl']."templates/help.php?HelpNumber=420\" target=\"lamhelp\">"._('Help')."</a></td>\n</tr>\n<tr>\n<td>";
echo _('Windows groupname');
echo "</td>\n<td><select name=\"f_smb_mapgroup\">";
if ($_SESSION['config']->samba3=='yes') {
@ -552,7 +601,7 @@ switch ($select_local) { // Select which part of page will be loaded
}
}
echo "</select></td>\n<td>".
'<a href="../help.php?HelpNumber=464" target="lamhelp">'._('Help').'</a>'.
'<a href="'.$_SESSION['lamurl'].'templates/help.php?HelpNumber=464" target="lamhelp">'._('Help').'</a>'.
'</td></tr>'."\n".'<tr><td>';
echo _('Domain');
echo '</td><td><select name="f_smb_domain">';
@ -564,13 +613,13 @@ switch ($select_local) { // Select which part of page will be loaded
}
else echo '<option>' . $samba3domains[$i]->name. '</option>';
}
echo '</select></td>'."\n".'<td><a href="../help.php?HelpNumber=467" target="lamhelp">'._('Help').'</a></td></tr>'."\n";
echo '</select></td>'."\n".'<td><a href="'.$_SESSION['lamurl'].'templates/help.php?HelpNumber=467" target="lamhelp">'._('Help').'</a></td></tr>'."\n";
echo "</table>\n</fieldset>\n</td></tr></table></td></tr>\n</table>\n";
break;
case 'quota':
// Quota Settings
if (!isset($_SESSION['account']->quota[0]) || (!isset($_SESSION['account']->quota[0][1])) && isset($_SESSION['account_old']) ) { // load quotas
if (!isset($_SESSION['account']->quota[0]) ) { // load quotas
$values = getquotas('group', $_SESSION['account']->general_username);
if (is_object($values)) {
while (list($key, $val) = each($values)) // Set only defined values
@ -610,11 +659,11 @@ switch ($select_local) { // Select which part of page will be loaded
echo _('Soft block limit'); echo '</td>'."\n".'<td>'; echo _('Hard block limit'); echo '</td>'."\n".'<td>'; echo _('Grace block period');
echo '</td>'."\n".'<td>'; echo _('Used inodes'); echo '</td>'."\n".'<td>'; echo _('Soft inode limit'); echo '</td>'."\n".'<td>';
echo _('Hard inode limit'); echo '</td>'."\n".'<td>'; echo _('Grace inode period'); echo '</td></tr>'."\n";
echo '<tr><td><a href="../help.php?HelpNumber=439" target="lamhelp">'._('Help').'</a></td>'."\n".'<td><a href="../help.php?HelpNumber=440" target="lamhelp">'._('Help').'</a></td>'."\n".'<td>'.
'<a href="../help.php?HelpNumber=441" target="lamhelp">'._('Help').'</a></td>'."\n".'<td><a href="../help.php?HelpNumber=442" target="lamhelp">'._('Help').'</a></td>'."\n".'<td>'.
'<a href="../help.php?HelpNumber=443" target="lamhelp">'._('Help').'</a></td>'."\n".'<td><a href="../help.php?HelpNumber=444" target="lamhelp">'._('Help').'</a></td>'."\n".'<td>'.
'<a href="../help.php?HelpNumber=445" target="lamhelp">'._('Help').'</a></td>'."\n".'<td><a href="../help.php?HelpNumber=446" target="lamhelp">'._('Help').'</a></td>'."\n".'<td>'.
'<a href="../help.php?HelpNumber=447" target="lamhelp">'._('Help').'</a></td></tr>'."\n";
echo '<tr><td><a href="'.$_SESSION['lamurl'].'templates/help.php?HelpNumber=439" target="lamhelp">'._('Help').'</a></td>'."\n".'<td><a href="'.$_SESSION['lamurl'].'templates/help.php?HelpNumber=440" target="lamhelp">'._('Help').'</a></td>'."\n".'<td>'.
'<a href="'.$_SESSION['lamurl'].'templates/help.php?HelpNumber=441" target="lamhelp">'._('Help').'</a></td>'."\n".'<td><a href="'.$_SESSION['lamurl'].'templates/help.php?HelpNumber=442" target="lamhelp">'._('Help').'</a></td>'."\n".'<td>'.
'<a href="'.$_SESSION['lamurl'].'templates/help.php?HelpNumber=443" target="lamhelp">'._('Help').'</a></td>'."\n".'<td><a href="'.$_SESSION['lamurl'].'templates/help.php?HelpNumber=444" target="lamhelp">'._('Help').'</a></td>'."\n".'<td>'.
'<a href="'.$_SESSION['lamurl'].'templates/help.php?HelpNumber=445" target="lamhelp">'._('Help').'</a></td>'."\n".'<td><a href="'.$_SESSION['lamurl'].'templates/help.php?HelpNumber=446" target="lamhelp">'._('Help').'</a></td>'."\n".'<td>'.
'<a href="'.$_SESSION['lamurl'].'templates/help.php?HelpNumber=447" target="lamhelp">'._('Help').'</a></td></tr>'."\n";
$i=0;
while ($_SESSION['account']->quota[$i][0]) {
echo '<tr><td>'.$_SESSION['account']->quota[$i][0].'</td><td>'.$_SESSION['account']->quota[$i][1].'</td>'; // used blocks
@ -639,19 +688,6 @@ switch ($select_local) { // Select which part of page will be loaded
}
}
if (!isset($_SESSION['account']->quota[0]) || (!isset($_SESSION['account']->quota[0][1])) && isset($_SESSION['account_old']) ) { // load quotas
$values = getquotas('group', $_SESSION['account']->general_username);
if (is_object($values)) {
while (list($key, $val) = each($values)) // Set only defined values
if (isset($val)) $_SESSION['account']->$key = $val;
}
if (is_object($values) && isset($_SESSION['account_old'])) {
while (list($key, $val) = each($values)) // Set only defined values
if (isset($val)) $_SESSION['account_old']->$key = $val;
}
}
echo '<input name="select" type="hidden" value="final">';
echo "<input name=\"select\" type=\"hidden\" value=\"final\">\n";
echo "<table border=0 width=\"100%\">\n<tr><td valign=\"top\" width=\"15%\" >";
@ -682,7 +718,7 @@ switch ($select_local) { // Select which part of page will be loaded
echo '<input name="f_finish_safeProfile" type="text" size="30" maxlength="50">';
echo "</td><td><input name=\"save\" type=\"submit\" $disabled value=\"";
echo _('Save profile');
echo '"></td><td><a href="../help.php?HelpNumber=457" target="lamhelp">'._('Help');
echo '"></td><td><a href="'.$_SESSION['lamurl'].'templates/help.php?HelpNumber=457" target="lamhelp">'._('Help');
echo "</a></td>\n</tr>\n</table>\n</fieldset>\n</td></tr>\n<tr><td>\n";
echo "<fieldset class=\"groupedit-bright\"><legend class=\"groupedit-bright\"><b>";
if ($_SESSION['account_old']) echo _('Modify');
@ -747,7 +783,7 @@ switch ($select_local) { // Select which part of page will be loaded
case 'backmain':
// unregister sessionvar and select which list should be shown
echo '<a href="../lists/listgroups.php">';
echo '<a href="'.$_SESSION['lamurl'].'templates/lists/listgroups.php">';
echo _('Please press here if meta-refresh didn\'t work.');
echo "</a>\n";
if (isset($_SESSION['shelllist'])) unset($_SESSION['shelllist']);

View File

@ -182,7 +182,7 @@ echo $_SESSION['header'];
echo "<html><head><title>";
echo _("Create new Account");
echo "</title>\n".
"<link rel=\"stylesheet\" type=\"text/css\" href=\"../../style/layout.css\">\n".
"<link rel=\"stylesheet\" type=\"text/css\" href=\"".$_SESSION['lamurl']."style/layout.css\">\n".
"<meta http-equiv=\"pragma\" content=\"no-cache\">\n".
"<meta http-equiv=\"cache-control\" content=\"no-cache\">\n";
@ -249,7 +249,7 @@ do { // X-Or, only one if() can be true
break;
}
if ($_POST['backmain']) {
echo "<meta http-equiv=\"refresh\" content=\"2; URL=../lists/listhosts.php\">\n";
echo "<meta http-equiv=\"refresh\" content=\"2; URL=".$_SESSION['lamurl']."templates/lists/listhosts.php\">\n";
$select_local='backmain';
break;
}
@ -310,13 +310,13 @@ switch ($select_local) { // Select which part of page will be loaded
echo '</td>'."\n".'<td>'.
'<input name="f_general_username" type="text" size="20" maxlength="20" value="' . $_SESSION['account']->general_username . '">'.
'</td><td>'.
'<a href="../help.php?HelpNumber=410" target="lamhelp">'._('Help').'</a>'.
'<a href="'.$_SESSION['lamurl'].'templates/help.php?HelpNumber=410" target="lamhelp">'._('Help').'</a>'.
'</td></tr>'."\n".'<tr><td>';
echo _('UID number');
echo '</td>'."\n".'<td>'.
'<input name="f_general_uidNumber" type="text" size="6" maxlength="6" value="' . $_SESSION['account']->general_uidNumber . '">'.
'</td>'."\n".'<td>'.
'<a href="../help.php?HelpNumber=411" target="lamhelp">'._('Help').'</a>'.
'<a href="'.$_SESSION['lamurl'].'templates/help.php?HelpNumber=411" target="lamhelp">'._('Help').'</a>'.
'</td></tr>'."\n".'<tr><td>';
echo _('Primary group').'*';
echo '</td>'."\n".'<td><select name="f_general_group">';
@ -325,12 +325,12 @@ switch ($select_local) { // Select which part of page will be loaded
else echo '<option>' . $group. '</option>';
}
echo '</select></td><td>'.
'<a href="../help.php?HelpNumber=412" target="lamhelp">'._('Help').'</a>'.
'<a href="'.$_SESSION['lamurl'].'templates/help.php?HelpNumber=412" target="lamhelp">'._('Help').'</a>'.
'</td></tr>'."\n".'<tr><td>';
echo _('Gecos');
echo '</td><td><input name="f_general_gecos" type="text" size="30" value="' . $_SESSION['account']->general_gecos . '">'.
'</td>'."\n".'<td>'.
'<a href="../help.php?HelpNumber=413" target="lamhelp">'._('Help').'</a>'.
'<a href="'.$_SESSION['lamurl'].'templates/help.php?HelpNumber=413" target="lamhelp">'._('Help').'</a>'.
'</td></tr><tr><td>';
echo _('Suffix'); echo '</td><td><select name="f_general_suffix">';
foreach ($_SESSION['ldap']->search_units($_SESSION['config']->get_HostSuffix()) as $suffix) {
@ -341,7 +341,7 @@ switch ($select_local) { // Select which part of page will be loaded
}
else echo '<option>' . $suffix. '</option>';
}
echo '</select></td><td><a href="../help.php?HelpNumber=463" target="lamhelp">'._('Help').'</a>'.
echo '</select></td><td><a href="'.$_SESSION['lamurl'].'templates/help.php?HelpNumber=463" target="lamhelp">'._('Help').'</a>'.
"</td>\n</tr>\n</table>";
echo _('Values with * are required');
echo "</fieldset>\n</td></tr><tr><td>";
@ -353,7 +353,7 @@ switch ($select_local) { // Select which part of page will be loaded
foreach ($profilelist as $profile) echo " <option>$profile</option>\n";
echo "</select></td><td>\n".
"<input name=\"load\" type=\"submit\" value=\""; echo _('Load Profile');
echo "\"></td><td><a href=\"../help.php?HelpNumber=421\" target=\"lamhelp\">";
echo "\"></td><td><a href=\"".$_SESSION['lamurl']."templates/help.php?HelpNumber=421\" target=\"lamhelp\">";
echo _('Help')."</a></td>\n</tr>\n</table>\n</fieldset>\n";
}
echo "</td></tr></table>\n</td></tr>\n</table>\n";
@ -385,7 +385,7 @@ switch ($select_local) { // Select which part of page will be loaded
echo _("Display name");
echo "</td>\n<td>".
"<input name=\"f_smb_displayName\" type=\"text\" size=\"30\" maxlength=\"50\" value=\"".$_SESSION['account']->smb_displayName."\">".
"</td>\n<td><a href=\"../help.php?HelpNumber=420\" target=\"lamhelp\">"._('Help')."</a></td>\n</tr>\n<tr>\n<td>";
"</td>\n<td><a href=\"".$_SESSION['lamurl']."templates/help.php?HelpNumber=420\" target=\"lamhelp\">"._('Help')."</a></td>\n</tr>\n<tr>\n<td>";
echo _('Password');
echo '</td><td>';
if (isset($_SESSION['account_old'])) {
@ -397,7 +397,7 @@ switch ($select_local) { // Select which part of page will be loaded
echo '</td>'."\n".'<td><input name="f_smb_flagsD" type="checkbox"';
if ($_SESSION['account']->smb_flagsD) echo ' checked ';
echo '></td><td>'.
'<a href="../help.php?HelpNumber=432" target="lamhelp">'._('Help').'</a>'.
'<a href="'.$_SESSION['lamurl'].'templates/help.php?HelpNumber=432" target="lamhelp">'._('Help').'</a>'.
'</td></tr>'."\n".'<tr><td>';
echo '</td></tr>'."\n".'<tr><td>';
echo _('Domain');
@ -416,7 +416,7 @@ switch ($select_local) { // Select which part of page will be loaded
else {
echo '</td>'."\n".'<td><input name="f_smb_domain" type="text" size="20" maxlength="80" value="' . $_SESSION['account']->smb_domain . '">';
}
echo '</td>'."\n".'<td><a href="../help.php?HelpNumber=460" target="lamhelp">'._('Help').'</a></td></tr>'."\n";
echo '</td>'."\n".'<td><a href="'.$_SESSION['lamurl'].'templates/help.php?HelpNumber=460" target="lamhelp">'._('Help').'</a></td></tr>'."\n";
echo "</table>\n</fieldset>\n</td></tr></table></td></tr>\n</table>\n";
break;
@ -446,7 +446,7 @@ switch ($select_local) { // Select which part of page will be loaded
echo '<input name="f_finish_safeProfile" type="text" size="30" maxlength="50">';
echo '</td><td><input name="save" type="submit" value="';
echo _('Save profile');
echo '"></td><td><a href="../help.php?HelpNumber=457" target="lamhelp">'._('Help');
echo '"></td><td><a href="'.$_SESSION['lamurl'].'templates/help.php?HelpNumber=457" target="lamhelp">'._('Help');
echo "</a></td>\n</tr>\n</table>\n</fieldset>\n</td></tr>\n<tr><td>\n";
echo "<fieldset class=\"hostedit-bright\"><legend class=\"hostedit-bright\"><b>";
if ($_SESSION['account_old']) echo _('Modify');
@ -502,7 +502,7 @@ switch ($select_local) { // Select which part of page will be loaded
break;
case 'backmain':
// unregister sessionvar and select which list should be shown
echo '<a href="../lists/listhosts.php">';
echo '<a href="'.$_SESSION['lamurl'].'templates/lists/listhosts.php">';
echo _('Please press here if meta-refresh didn\'t work.');
echo "</a>\n";
if (isset($_SESSION['shelllist'])) unset($_SESSION['shelllist']);

View File

@ -47,17 +47,38 @@ if (isset($_GET['DN'])) {
$_SESSION['account']->general_dn = substr($_SESSION['account']->general_dn, strpos($_SESSION['account']->general_dn, ',')+1);
$_SESSION['final_changegids'] = '';
}
else {
$_SESSION['account'] = loadUserProfile('default');
$_SESSION['account'] ->type = 'user';
$_SESSION['account']->smb_flagsW = 0;
if (isset($_SESSION['account_old'])) unset($_SESSION['account_old']);
}
}
else if (count($_POST)==0) { // Startcondition. useredit.php was called from outside
$_SESSION['account'] = loadUserProfile('default');
$_SESSION['account'] ->type = 'user';
$_SESSION['account']->smb_flagsW = 0;
// load quotas from profile and check if they are valid
$values = getquotas('user');
if (isset($_SESSION['account']->quota[0])) { // check quotas from profile
$i=0;
// check quota settings
while (isset($_SESSION['account']->quota[$i])) {
$found = (-1);
for ($j=0; $j<count($values->quota); $j++)
if ($values->quota[$j][0]==$_SESSION['account']->quota[$i][0]) $found = $j;
if ($found==-1) unset($_SESSION['account']->quota[$i]);
else {
$_SESSION['account']->quota[$i][1] = $values->quota[$found][1];
$_SESSION['account']->quota[$i][5] = $values->quota[$found][5];
$_SESSION['account']->quota[$i][4] = $values->quota[$found][4];
$_SESSION['account']->quota[$i][8] = $values->quota[$found][8];
$i++;
}
}
$_SESSION['account']->quota = array_values($_SESSION['account']->quota);
}
else { // No quotas saved in profile
if (is_object($values)) {
while (list($key, $val) = each($values)) // Set only defined values
if (isset($val)) $_SESSION['account']->$key = $val;
}
}
if (isset($_SESSION['account_old'])) unset($_SESSION['account_old']);
}
@ -410,7 +431,7 @@ if ($select_local != 'pdf') {
echo "<html><head><title>";
echo _("Create new Account");
echo "</title>\n".
"<link rel=\"stylesheet\" type=\"text/css\" href=\"../../style/layout.css\">\n".
"<link rel=\"stylesheet\" type=\"text/css\" href=\"".$_SESSION['lamurl']."style/layout.css\">\n".
"<meta http-equiv=\"pragma\" content=\"no-cache\">\n".
"<meta http-equiv=\"cache-control\" content=\"no-cache\">\n";
}
@ -510,6 +531,35 @@ do { // X-Or, only one if() can be true
if ($_SESSION['account']->general_username != '')
$_SESSION['account']->smb_smbhome = str_replace('$user', $_SESSION['account']->general_username, $_SESSION['account']->smb_smbhome);
// load quotas from profile and check if they are valid
$values = getquotas('user', $_SESSION['account_old']->general_username);
if (isset($_SESSION['account']->quota[0])) { // check quotas from profile
$i=0;
// check quota settings
while (isset($_SESSION['account']->quota[$i])) {
$found = (-1);
for ($j=0; $j<count($values->quota); $j++)
if ($values->quota[$j][0]==$_SESSION['account']->quota[$i][0]) $found = $j;
if ($found==-1) unset($_SESSION['account']->quota[$i]);
else {
$_SESSION['account']->quota[$i][1] = $values->quota[$found][1];
$_SESSION['account']->quota[$i][5] = $values->quota[$found][5];
$_SESSION['account']->quota[$i][4] = $values->quota[$found][4];
$_SESSION['account']->quota[$i][8] = $values->quota[$found][8];
$i++;
}
}
$_SESSION['account']->quota = array_values($_SESSION['account']->quota);
}
else { // No quotas saved in profile
if (is_object($values)) {
while (list($key, $val) = each($values)) // Set only defined values
if (isset($val)) $_SESSION['account']->$key = $val;
}
}
$_SESSION['account_old']->quota = $values->quota;
// select general page after group has been loaded
$select_local='general';
break;
@ -522,7 +572,7 @@ do { // X-Or, only one if() can be true
break;
}
if ($_POST['backmain']) {
echo "<meta http-equiv=\"refresh\" content=\"2; URL=../lists/listusers.php\">\n";
echo "<meta http-equiv=\"refresh\" content=\"2; URL=".$_SESSION['lamurl']."templates/lists/listusers.php\">\n";
$select_local='backmain';
break;
}
@ -598,7 +648,7 @@ switch ($select_local) { // Select which part of page will be loaded
echo "<td align=\"center\" width=\"10%\"><input type=\"submit\" name=\"add\" value=\"<=\">";
echo " ";
echo "<input type=\"submit\" name=\"remove\" value=\"=>\"><br><br>";
echo "<a href=\"../help.php?HelpNumber=XXX\" target=\"lamhelp\">"._('Help-XX')."</a></td>\n";
echo "<a href=\"".$_SESSION['lamurl']."templates/help.php?HelpNumber=XXX\" target=\"lamhelp\">"._('Help-XX')."</a></td>\n";
echo "<td valign=\"top\"><fieldset class=\"useredit-bright\"><legend class=\"useredit-bright\">";
echo _('Available workstations');
echo "</legend>\n";
@ -653,25 +703,25 @@ switch ($select_local) { // Select which part of page will be loaded
echo "</td>\n<td>".
'<input name="f_general_username" type="text" size="20" maxlength="20" value="' . $_SESSION['account']->general_username . '">'.
'</td><td>'.
'<a href="../help.php?HelpNumber=400" target="lamhelp">'._('Help').'</a>'.
'<a href="'.$_SESSION['lamurl'].'templates/help.php?HelpNumber=400" target="lamhelp">'._('Help').'</a>'.
'</td></tr>'."\n".'<tr><td>';
echo _('UID number');
echo '</td>'."\n".'<td>'.
'<input name="f_general_uidNumber" type="text" size="6" maxlength="6" value="' . $_SESSION['account']->general_uidNumber . '">'.
'</td>'."\n".'<td>'.
'<a href="../help.php?HelpNumber=401" target="lamhelp">'._('Help').'</a>'.
'<a href="'.$_SESSION['lamurl'].'templates/help.php?HelpNumber=401" target="lamhelp">'._('Help').'</a>'.
'</td></tr>'."\n".'<tr><td>';
echo _('Given name').'*';
echo '</td>'."\n".'<td>'.
'<input name="f_general_givenname" type="text" size="20" maxlength="20" value="' . $_SESSION['account']->general_givenname . '">'.
'</td>'."\n".'<td>'.
'<a href="../help.php?HelpNumber=425" target="lamhelp">'._('Help').'</a>'.
'<a href="'.$_SESSION['lamurl'].'templates/help.php?HelpNumber=425" target="lamhelp">'._('Help').'</a>'.
'</td>'."\n".'</tr>'."\n".'<tr><td>';
echo _('Surname').'*';
echo '</td>'."\n".'<td>'.
'<input name="f_general_surname" type="text" size="20" maxlength="20" value="' . $_SESSION['account']->general_surname . '">'.
'</td><td>'.
'<a href="../help.php?HelpNumber=424" target="lamhelp">'._('Help').'</a>'.
'<a href="'.$_SESSION['lamurl'].'templates/help.php?HelpNumber=424" target="lamhelp">'._('Help').'</a>'.
'</td></tr>'."\n".'<tr><td>';
echo _('Primary group').'*';
echo '</td>'."\n".'<td><select name="f_general_group">';
@ -681,7 +731,7 @@ switch ($select_local) { // Select which part of page will be loaded
else echo '<option>' . $group. '</option>';
}
echo '</select></td><td>'.
'<a href="../help.php?HelpNumber=406" target="lamhelp">'._('Help').'</a>'.
'<a href="'.$_SESSION['lamurl'].'templates/help.php?HelpNumber=406" target="lamhelp">'._('Help').'</a>'.
'</td></tr>'."\n".'<tr><td>';
echo _('Additional groups');
echo '</td>'."\n".'<td><select name="f_general_groupadd[]" size="3" multiple>';
@ -694,17 +744,17 @@ switch ($select_local) { // Select which part of page will be loaded
else echo '<option>'.$group. '</option>';
}
echo '</select></td>'."\n".'<td>'.
'<a href="../help.php?HelpNumber=402" target="lamhelp">'._('Help').'</a>'.
'<a href="'.$_SESSION['lamurl'].'templates/help.php?HelpNumber=402" target="lamhelp">'._('Help').'</a>'.
'</td></tr>'."\n".'<tr><td>';
echo _('Home directory').'*';
echo '</td>'."\n".'<td><input name="f_general_homedir" type="text" size="30" value="' . $_SESSION['account']->general_homedir . '">'.
'</td>'."\n".'<td>'.
'<a href="../help.php?HelpNumber=403" target="lamhelp">'._('Help').'</a>'.
'<a href="'.$_SESSION['lamurl'].'templates/help.php?HelpNumber=403" target="lamhelp">'._('Help').'</a>'.
'</td></tr>'."\n".'<tr><td>';
echo _('Gecos');
echo '</td>'."\n".'<td><input name="f_general_gecos" type="text" size="30" value="' . $_SESSION['account']->general_gecos . '">'.
'</td>'."\n".'<td>'.
'<a href="../help.php?HelpNumber=404" target="lamhelp">'._('Help').'</a>'.
'<a href="'.$_SESSION['lamurl'].'templates/help.php?HelpNumber=404" target="lamhelp">'._('Help').'</a>'.
'</td></tr>'."\n".'<tr><td>';
echo _('Login shell').'*';
echo '</td>'."\n".'<td><select name="f_general_shell" >';
@ -713,7 +763,7 @@ switch ($select_local) { // Select which part of page will be loaded
if ($_SESSION['account']->general_shell==trim($shell)) echo '<option selected>'.$shell. '</option>';
else echo '<option>'.$shell. '</option>';
echo '</select></td>'."\n".'<td>'.
'<a href="../help.php?HelpNumber=405" target="lamhelp">'._('Help').'</a>'.
'<a href="'.$_SESSION['lamurl'].'templates/help.php?HelpNumber=405" target="lamhelp">'._('Help').'</a>'.
'</td></tr>'."\n".'<tr><td>';
echo _('Suffix'); echo '</td><td><select name="f_general_suffix">';
foreach ($_SESSION['ldap']->search_units($_SESSION['config']->get_UserSuffix()) as $suffix) {
@ -724,7 +774,7 @@ switch ($select_local) { // Select which part of page will be loaded
}
else echo '<option>' . $suffix. '</option>';
}
echo '</select></td><td><a href="../help.php?HelpNumber=461" target="lamhelp">'._('Help').
echo '</select></td><td><a href="'.$_SESSION['lamurl'].'templates/help.php?HelpNumber=461" target="lamhelp">'._('Help').
"</a></td>\n</tr>\n</table>";
echo _('Values with * are required');
echo "</fieldset>\n</td></tr><tr><td>";
@ -736,7 +786,7 @@ switch ($select_local) { // Select which part of page will be loaded
foreach ($profilelist as $profile) echo " <option>$profile</option>\n";
echo "</select>\n".
"<input name=\"load\" type=\"submit\" value=\""; echo _('Load Profile');
echo "\"></td><td><a href=\"../help.php?HelpNumber=421\" target=\"lamhelp\">";
echo "\"></td><td><a href=\"".$_SESSION['lamurl']."templates/help.php?HelpNumber=421\" target=\"lamhelp\">";
echo _('Help')."</a></td>\n</tr>\n</table>\n</fieldset>\n";
}
echo "</td></tr>\n</table>\n</td></tr></table>\n";
@ -786,27 +836,27 @@ switch ($select_local) { // Select which part of page will be loaded
echo '</td>'."\n".'<td><input name="f_unix_password_no" type="checkbox"';
if ($_SESSION['account']->unix_password_no) echo ' checked ';
echo '></td>'."\n".'<td>'.
'<a href="../help.php?HelpNumber=426" target="lamhelp">'._('Help').'</a>'.
'<a href="'.$_SESSION['lamurl'].'templates/help.php?HelpNumber=426" target="lamhelp">'._('Help').'</a>'.
'</td></tr>'."\n".'<tr><td>';
echo _('Password warn');
echo '</td>'."\n".'<td><input name="f_unix_pwdwarn" type="text" size="4" maxlength="4" value="' . $_SESSION['account']->unix_pwdwarn . '">'.
'</td>'."\n".'<td>'.
'<a href="../help.php?HelpNumber=414" target="lamhelp">'._('Help').'</a>'.
'<a href="'.$_SESSION['lamurl'].'templates/help.php?HelpNumber=414" target="lamhelp">'._('Help').'</a>'.
'</td></tr>'."\n".'<tr><td>';
echo _('Password expire');
echo '</td>'."\n".'<td><input name="f_unix_pwdallowlogin" type="text" size="4" maxlength="4" value="' . $_SESSION['account']->unix_pwdallowlogin . '">'.
'</td>'."\n".'<td>'.
'<a href="../help.php?HelpNumber=415" target="lamhelp">'._('Help').'</a>'.
'<a href="'.$_SESSION['lamurl'].'templates/help.php?HelpNumber=415" target="lamhelp">'._('Help').'</a>'.
'</td></tr>'."\n".'<tr><td>';
echo _('Maximum password age');
echo '</td>'."\n".'<td><input name="f_unix_pwdmaxage" type="text" size="5" maxlength="5" value="' . $_SESSION['account']->unix_pwdmaxage . '">'.
'</td>'."\n".'<td>'.
'<a href="../help.php?HelpNumber=416" target="lamhelp">'._('Help').'</a>'.
'<a href="'.$_SESSION['lamurl'].'templates/help.php?HelpNumber=416" target="lamhelp">'._('Help').'</a>'.
'</td></tr>'."\n".'<tr><td>';
echo _('Minimum password age');
echo '</td>'."\n".'<td><input name="f_unix_pwdminage" type="text" size="4" maxlength="4" value="' . $_SESSION['account']->unix_pwdminage . '">'.
'</td>'."\n".'<td>'.
'<a href="../help.php?HelpNumber=417" target="lamhelp">'._('Help').'</a>'.
'<a href="'.$_SESSION['lamurl'].'templates/help.php?HelpNumber=417" target="lamhelp">'._('Help').'</a>'.
'</td></tr>'."\n".'<tr><td>';
echo _('Expire date');
echo '</td>'."\n".'<td><select name="f_unix_pwdexpire_day">';
@ -825,18 +875,18 @@ switch ($select_local) { // Select which part of page will be loaded
else echo "<option> $i". '</option>';
}
echo '</select></td>'."\n".'<td>'.
'<a href="../help.php?HelpNumber=418" target="lamhelp">'._('Help').'</a>'.
'<a href="'.$_SESSION['lamurl'].'templates/help.php?HelpNumber=418" target="lamhelp">'._('Help').'</a>'.
'</td></tr>'."\n".'<tr><td>';
echo _('Account deactivated');
echo '</td>'."\n".'<td><input name="f_unix_deactivated" type="checkbox"';
if ($_SESSION['account']->unix_deactivated) echo ' checked ';
echo '></td>'."\n".'<td>'.
'<a href="../help.php?HelpNumber=427" target="lamhelp">'._('Help').'</a>'.
'<a href="'.$_SESSION['lamurl'].'templates/help.php?HelpNumber=427" target="lamhelp">'._('Help').'</a>'.
'</td></tr>'."\n".'<tr><td>';
echo _('Unix workstations');
echo '</td>'."\n".'<td><input name="f_unix_host" type="text" size="20" maxlength="80" value="' . $_SESSION['account']->unix_host . '">'.
'</td>'."\n".'<td>'.
'<a href="../help.php?HelpNumber=466" target="lamhelp">'._('Help').
'<a href="'.$_SESSION['lamurl'].'templates/help.php?HelpNumber=466" target="lamhelp">'._('Help').
"</a></td>\n</tr>\n</table>";
echo _('Values with * are required');
echo "</fieldset>\n</td></tr></table></td></tr>\n</table>\n";
@ -890,7 +940,7 @@ switch ($select_local) { // Select which part of page will be loaded
echo _("Display name");
echo "</td>\n<td>".
"<input name=\"f_smb_displayName\" type=\"text\" size=\"30\" maxlength=\"50\" value=\"".$_SESSION['account']->smb_displayName."\">".
"</td>\n<td><a href=\"../help.php?HelpNumber=420\" target=\"lamhelp\">"._('Help')."</a></td>\n</tr>\n<tr>\n<td>";
"</td>\n<td><a href=\"".$_SESSION['lamurl']."templates/help.php?HelpNumber=420\" target=\"lamhelp\">"._('Help')."</a></td>\n</tr>\n<tr>\n<td>";
echo _('Samba password');
echo '</td>'."\n".'<td><input name="f_smb_password" type="text" size="20" maxlength="20" value="' . $password . '">'.
'</td></tr>'."\n".'<tr><td>';
@ -898,19 +948,19 @@ switch ($select_local) { // Select which part of page will be loaded
echo '</td><td><input name="f_smb_useunixpwd" type="checkbox"';
if ($_SESSION['account']->smb_useunixpwd) echo ' checked ';
echo '></td>'."\n".'<td>'.
'<a href="../help.php?HelpNumber=428" target="lamhelp">'._('Help').'</a>';
'<a href="'.$_SESSION['lamurl'].'templates/help.php?HelpNumber=428" target="lamhelp">'._('Help').'</a>';
echo '</td></tr>'."\n".'<tr><td>';
echo _('Use no password');
echo '</td>'."\n".'<td><input name="f_smb_password_no" type="checkbox"';
if ($_SESSION['account']->smb_password_no) echo ' checked ';
echo '></td>'."\n".'<td>'.
'<a href="../help.php?HelpNumber=426" target="lamhelp">'._('Help').'</a>'.
'<a href="'.$_SESSION['lamurl'].'templates/help.php?HelpNumber=426" target="lamhelp">'._('Help').'</a>'.
'</td></tr>'."\n".'<tr><td>';
echo _('Password does not expire');
echo '</td>'."\n".'<td><input name="f_smb_flagsX" type="checkbox"';
if ($_SESSION['account']->smb_flagsX) echo ' checked ';
echo '></td>'."\n".'<td>'.
'<a href="../help.php?HelpNumber=429" target="lamhelp">'._('Help').'</a>'.
'<a href="'.$_SESSION['lamurl'].'templates/help.php?HelpNumber=429" target="lamhelp">'._('Help').'</a>'.
'</td></tr>'."\n".'<tr><td>';
echo _('User can change password');
echo '</td>'."\n".'<td><select name="f_smb_pwdcanchange_day">';
@ -929,7 +979,7 @@ switch ($select_local) { // Select which part of page will be loaded
else echo "<option> $i". '</option>';
}
echo '</select></td>'."\n".'<td>';
echo '<a href="../help.php?HelpNumber=430" target="lamhelp">'._('Help').'</a>'.
echo '<a href="'.$_SESSION['lamurl'].'templates/help.php?HelpNumber=430" target="lamhelp">'._('Help').'</a>'.
'</td></tr>'."\n".'<tr><td>';
echo _('User must change password');
echo '</td>'."\n".'<td><select name="f_smb_pwdmustchange_day">';
@ -948,40 +998,40 @@ switch ($select_local) { // Select which part of page will be loaded
else echo "<option> $i". '</option>';
}
echo '</select></td>'."\n".'<td>';
echo '<a href="../help.php?HelpNumber=431" target="lamhelp">'._('Help').'</a>'.
echo '<a href="'.$_SESSION['lamurl'].'templates/help.php?HelpNumber=431" target="lamhelp">'._('Help').'</a>'.
'</td></tr>'."\n".'<tr><td>';
echo _('Account is deactivated');
echo '</td>'."\n".'<td><input name="f_smb_flagsD" type="checkbox"';
if ($_SESSION['account']->smb_flagsD) echo ' checked ';
echo '></td>'."\n".'<td>'.
'<a href="../help.php?HelpNumber=432" target="lamhelp">'._('Help').'</a>'.
'<a href="'.$_SESSION['lamurl'].'templates/help.php?HelpNumber=432" target="lamhelp">'._('Help').'</a>'.
'</td></tr>'."\n".'<tr><td>';
echo _('Home drive');
echo '</td>'."\n".'<td><select name="f_smb_homedrive" >';
for ($i=68; $i<91; $i++)
if ($_SESSION['account']->smb_homedrive== chr($i).':') echo '<option selected> '.chr($i).':</option>'; else echo '<option> '.chr($i).':</option>';
echo '</select></td>'."\n".'<td>'.
'<a href="../help.php?HelpNumber=433" target="lamhelp">'._('Help').'</a>'.
'<a href="'.$_SESSION['lamurl'].'templates/help.php?HelpNumber=433" target="lamhelp">'._('Help').'</a>'.
'</td></tr>'."\n".'<tr><td>';
echo _('Home path');
echo '</td>'."\n".'<td><input name="f_smb_smbhome" type="text" size="20" maxlength="80" value="' . $_SESSION['account']->smb_smbhome . '">'.
'</td>'."\n".'<td>'.
'<a href="../help.php?HelpNumber=437" target="lamhelp">'._('Help').'</a>'.
'<a href="'.$_SESSION['lamurl'].'templates/help.php?HelpNumber=437" target="lamhelp">'._('Help').'</a>'.
'</td></tr>'."\n".'<tr><td>';
echo _('Profile path');
echo '</td>'."\n".'<td><input name="f_smb_profilePath" type="text" size="20" maxlength="80" value="' . $_SESSION['account']->smb_profilePath . '">'.
'</td>'."\n".'<td>'.
'<a href="../help.php?HelpNumber=435" target="lamhelp">'._('Help').'</a>'.
'<a href="'.$_SESSION['lamurl'].'templates/help.php?HelpNumber=435" target="lamhelp">'._('Help').'</a>'.
'</td></tr>'."\n".'<tr><td>';
echo _('Script path');
echo '</td>'."\n".'<td><input name="f_smb_scriptpath" type="text" size="20" maxlength="80" value="' . $_SESSION['account']->smb_scriptPath . '">'.
'</td>'."\n".'<td>'.
'<a href="../help.php?HelpNumber=434" target="lamhelp">'._('Help').'</a>'.
'<a href="'.$_SESSION['lamurl'].'templates/help.php?HelpNumber=434" target="lamhelp">'._('Help').'</a>'.
'</td></tr>'."\n".'<tr><td>';
echo _('Samba workstations');
echo '</td>'."\n".'<td><input name="next_workstations" type="submit" value="'. _('Edit workstations') . '">'.
'</td>'."\n".'<td>'.
'<a href="../help.php?HelpNumber=436" target="lamhelp">'._('Help').'</a>'.
'<a href="'.$_SESSION['lamurl'].'templates/help.php?HelpNumber=436" target="lamhelp">'._('Help').'</a>'.
'</td></tr>'."\n".'<tr><td>';
echo _('Windows groupname');
echo '</td>'."\n".'<td><select name="f_smb_mapgroup" >';
@ -1063,7 +1113,7 @@ switch ($select_local) { // Select which part of page will be loaded
}
}
echo '</select></td>'."\n".'<td>'.
'<a href="../help.php?HelpNumber=464" target="lamhelp">'._('Help').'</a>'.
'<a href="'.$_SESSION['lamurl'].'templates/help.php?HelpNumber=464" target="lamhelp">'._('Help').'</a>'.
'</td></tr>'."\n".'<tr><td>';
echo _('Domain');
if ($_SESSION['config']->is_samba3()) {
@ -1081,13 +1131,13 @@ switch ($select_local) { // Select which part of page will be loaded
else {
echo '</td>'."\n".'<td><input name="f_smb_domain" type="text" size="20" maxlength="80" value="' . $_SESSION['account']->smb_domain . '">';
}
echo '</td>'."\n".'<td><a href="../help.php?HelpNumber=438" target="lamhelp">'._('Help').'</a></td></tr>'."\n";
echo '</td>'."\n".'<td><a href="'.$_SESSION['lamurl'].'templates/help.php?HelpNumber=438" target="lamhelp">'._('Help').'</a></td></tr>'."\n";
echo "</table>\n</fieldset>\n</td></tr></table></td></tr>\n</table>\n";
break;
case 'quota':
// Quota Settings
if (!isset($_SESSION['account']->quota[0]) || (!isset($_SESSION['account']->quota[0][1])) && isset($_SESSION['account_old']) ) { // load quotas
$values = getquotas('user', $_SESSION['account']->general_username);
if (!isset($_SESSION['account']->quota[0])) { // load quotas
$values = getquotas('user', $_SESSION['account_old']->general_username);
if (is_object($values)) {
while (list($key, $val) = each($values)) // Set only defined values
if (isset($val)) $_SESSION['account']->$key = $val;
@ -1123,11 +1173,11 @@ switch ($select_local) { // Select which part of page will be loaded
echo _('Soft block limit'); echo '</td>'."\n".'<td>'; echo _('Hard block limit'); echo '</td>'."\n".'<td>'; echo _('Grace block period');
echo '</td>'."\n".'<td>'; echo _('Used inodes'); echo '</td>'."\n".'<td>'; echo _('Soft inode limit'); echo '</td>'."\n".'<td>';
echo _('Hard inode limit'); echo '</td>'."\n".'<td>'; echo _('Grace inode period'); echo '</td></tr>'."\n";
echo '<tr><td><a href="../help.php?HelpNumber=439" target="lamhelp">'._('Help').'</a></td>'."\n".'<td><a href="../help.php?HelpNumber=440" target="lamhelp">'._('Help').'</a></td>'."\n".'<td>'.
'<a href="../help.php?HelpNumber=441" target="lamhelp">'._('Help').'</a></td>'."\n".'<td><a href="../help.php?HelpNumber=442" target="lamhelp">'._('Help').'</a></td>'."\n".'<td>'.
'<a href="../help.php?HelpNumber=443" target="lamhelp">'._('Help').'</a></td>'."\n".'<td><a href="../help.php?HelpNumber=444" target="lamhelp">'._('Help').'</a></td>'."\n".'<td>'.
'<a href="../help.php?HelpNumber=445" target="lamhelp">'._('Help').'</a></td>'."\n".'<td><a href="../help.php?HelpNumber=446" target="lamhelp">'._('Help').'</a></td>'."\n".'<td>'.
'<a href="../help.php?HelpNumber=447" target="lamhelp">'._('Help').'</a></td></tr>'."\n";
echo '<tr><td><a href="'.$_SESSION['lamurl'].'templates/help.php?HelpNumber=439" target="lamhelp">'._('Help').'</a></td>'."\n".'<td><a href="'.$_SESSION['lamurl'].'templates/help.php?HelpNumber=440" target="lamhelp">'._('Help').'</a></td>'."\n".'<td>'.
'<a href="'.$_SESSION['lamurl'].'templates/help.php?HelpNumber=441" target="lamhelp">'._('Help').'</a></td>'."\n".'<td><a href="'.$_SESSION['lamurl'].'templates/help.php?HelpNumber=442" target="lamhelp">'._('Help').'</a></td>'."\n".'<td>'.
'<a href="'.$_SESSION['lamurl'].'templates/help.php?HelpNumber=443" target="lamhelp">'._('Help').'</a></td>'."\n".'<td><a href="'.$_SESSION['lamurl'].'templates/help.php?HelpNumber=444" target="lamhelp">'._('Help').'</a></td>'."\n".'<td>'.
'<a href="'.$_SESSION['lamurl'].'templates/help.php?HelpNumber=445" target="lamhelp">'._('Help').'</a></td>'."\n".'<td><a href="'.$_SESSION['lamurl'].'templates/help.php?HelpNumber=446" target="lamhelp">'._('Help').'</a></td>'."\n".'<td>'.
'<a href="'.$_SESSION['lamurl'].'templates/help.php?HelpNumber=447" target="lamhelp">'._('Help').'</a></td></tr>'."\n";
$i=0;
while ($_SESSION['account']->quota[$i][0]) {
echo '<tr><td>'.$_SESSION['account']->quota[$i][0].'</td><td>'.$_SESSION['account']->quota[$i][1].'</td>'; // used blocks
@ -1172,55 +1222,55 @@ switch ($select_local) { // Select which part of page will be loaded
echo '</td>'."\n".'<td>'.
'<input name="f_personal_title" type="text" size="10" maxlength="10" value="' . $_SESSION['account']->personal_title . '"> ';
echo $_SESSION['account']->general_surname . ' ' . $_SESSION['account']->general_givenname . '</td><td>'.
'<a href="../help.php?HelpNumber=448" target="lamhelp">'._('Help').'</a>'.
'<a href="'.$_SESSION['lamurl'].'templates/help.php?HelpNumber=448" target="lamhelp">'._('Help').'</a>'.
'</td></tr>'."\n".'<tr><td>';
echo _('Employee type');
echo '</td>'."\n".'<td>'.
'<input name="f_personal_employeeType" type="text" size="30" maxlength="30" value="' . $_SESSION['account']->personal_employeeType . '">'.
'</td><td>'.
'<a href="../help.php?HelpNumber=449" target="lamhelp">'._('Help').'</a>'.
'<a href="'.$_SESSION['lamurl'].'templates/help.php?HelpNumber=449" target="lamhelp">'._('Help').'</a>'.
'</td></tr>'."\n".'<tr><td>';
echo _('Street');
echo '</td>'."\n".'<td>'.
'<input name="f_personal_street" type="text" size="30" maxlength="30" value="' . $_SESSION['account']->personal_street . '">'.
'</td><td>'.
'<a href="../help.php?HelpNumber=450" target="lamhelp">'._('Help').'</a>'.
'<a href="'.$_SESSION['lamurl'].'templates/help.php?HelpNumber=450" target="lamhelp">'._('Help').'</a>'.
'</td></tr>'."\n".'<tr><td>';
echo _('Postal code');
echo '</td>'."\n".'<td>'.
'<input name="f_personal_postalCode" type="text" size="5" maxlength="5" value="' . $_SESSION['account']->personal_postalCode . '">'.
'</td><td>'.
'<a href="../help.php?HelpNumber=451" target="lamhelp">'._('Help').'</a>'.
'<a href="'.$_SESSION['lamurl'].'templates/help.php?HelpNumber=451" target="lamhelp">'._('Help').'</a>'.
'</td></tr>'."\n".'<tr><td>';
echo _('Postal address');
echo '</td>'."\n".'<td>'.
'<input name="f_personal_postalAddress" type="text" size="30" maxlength="80" value="' . $_SESSION['account']->personal_postalAddress . '">'.
'</td><td>'.
'<a href="../help.php?HelpNumber=452" target="lamhelp">'._('Help').'</a>'.
'<a href="'.$_SESSION['lamurl'].'templates/help.php?HelpNumber=452" target="lamhelp">'._('Help').'</a>'.
'</td></tr>'."\n".'<tr><td>';
echo _('Telephone number');
echo '</td>'."\n".'<td>'.
'<input name="f_personal_telephoneNumber" type="text" size="30" maxlength="30" value="' . $_SESSION['account']->personal_telephoneNumber . '">'.
'</td><td>'.
'<a href="../help.php?HelpNumber=453" target="lamhelp">'._('Help').'</a>'.
'<a href="'.$_SESSION['lamurl'].'templates/help.php?HelpNumber=453" target="lamhelp">'._('Help').'</a>'.
'</td></tr>'."\n".'<tr><td>';
echo _('Mobile number');
echo '</td>'."\n".'<td>'.
'<input name="f_personal_mobileTelephoneNumber" type="text" size="30" maxlength="30" value="' . $_SESSION['account']->personal_mobileTelephoneNumber . '">'.
'</td><td>'.
'<a href="../help.php?HelpNumber=454" target="lamhelp">'._('Help').'</a>'.
'<a href="'.$_SESSION['lamurl'].'templates/help.php?HelpNumber=454" target="lamhelp">'._('Help').'</a>'.
'</td></tr>'."\n".'<tr><td>';
echo _('Fax number');
echo '</td>'."\n".'<td>'.
'<input name="f_personal_facsimileTelephoneNumber" type="text" size="30" maxlength="30" value="' . $_SESSION['account']->personal_facsimileTelephoneNumber . '">'.
'</td><td>'.
'<a href="../help.php?HelpNumber=455" target="lamhelp">'._('Help').'</a>'.
'<a href="'.$_SESSION['lamurl'].'templates/help.php?HelpNumber=455" target="lamhelp">'._('Help').'</a>'.
'</td></tr>'."\n".'<tr><td>';
echo _('eMail address');
echo '</td>'."\n".'<td>'.
'<input name="f_personal_mail" type="text" size="30" maxlength="80" value="' . $_SESSION['account']->personal_mail . '">'.
'</td><td>'.
'<a href="../help.php?HelpNumber=456" target="lamhelp">'._('Help').'</a></td></tr>'."\n";
'<a href="'.$_SESSION['lamurl'].'templates/help.php?HelpNumber=456" target="lamhelp">'._('Help').'</a></td></tr>'."\n";
echo "</table>\n</fieldset>\n</td></tr></table></td></tr>\n</table>\n";
break;
case 'final':
@ -1231,19 +1281,6 @@ switch ($select_local) { // Select which part of page will be loaded
$disabled = "disabled";
}
}
if (!isset($_SESSION['account']->quota[0]) || (!isset($_SESSION['account']->quota[0][1])) && isset($_SESSION['account_old']) ) { // load quotas
$values = getquotas('user', $_SESSION['account']->general_username);
if (is_object($values)) {
while (list($key, $val) = each($values)) // Set only defined values
if (isset($val)) $_SESSION['account']->$key = $val;
}
if (is_object($values) && isset($_SESSION['account_old'])) {
while (list($key, $val) = each($values)) // Set only defined values
if (isset($val)) $_SESSION['account_old']->$key = $val;
}
}
echo '<input name="select" type="hidden" value="final">';
echo "<table border=0 width=\"100%\">\n<tr><td valign=\"top\" width=\"15%\" >";
echo "<table><tr><td><fieldset class=\"useredit-dark\"><legend class=\"useredit-bright\"><b>";
@ -1272,7 +1309,7 @@ switch ($select_local) { // Select which part of page will be loaded
echo '<input name="f_finish_safeProfile" type="text" size="30" maxlength="50">';
echo "</td><td><input name=\"save\" type=\"submit\" $disabled value=\"";
echo _('Save profile');
echo '"></td><td><a href="../help.php?HelpNumber=457" target="lamhelp">'._('Help');
echo '"></td><td><a href="'.$_SESSION['lamurl'].'templates/help.php?HelpNumber=457" target="lamhelp">'._('Help');
echo "</a></td>\n</tr>\n</table>\n</fieldset>\n</td></tr>\n<tr><td>\n";
echo "<fieldset class=\"useredit-bright\"><legend class=\"useredit-bright\"><b>";
if ($_SESSION['account_old']) echo _('Modify');
@ -1375,7 +1412,7 @@ switch ($select_local) { // Select which part of page will be loaded
break;
case 'backmain':
// unregister sessionvar and select which list should be shown
echo '<tr><td><a href="../lists/listusers.php">';
echo '<tr><td><a href="'.$_SESSION['lamurl'].'templates/lists/listusers.php">';
echo _('Please press here if meta-refresh didn\'t work.');
echo "</a></td></tr>\n";
if (isset($_SESSION['shelllist'])) unset($_SESSION['shelllist']);

View File

@ -1,4 +1,4 @@
<?
<?php
/*
$Id$
@ -33,7 +33,7 @@ echo $_SESSION['header'];
echo '<html><head><title>';
echo _('Delete Account');
echo '</title>'."\n".
'<link rel="stylesheet" type="text/css" href="../style/layout.css">'."\n".
'<link rel="stylesheet" type="text/css" href="'.$_SESSION['lamurl'].'style/layout.css">'."\n".
'<meta http-equiv="pragma" content="no-cache">'."\n".
'<meta http-equiv="cache-control" content="no-cache">'."\n";

View File

@ -58,7 +58,7 @@ if ($select!='pdf') {
echo '<html><head><title>';
echo _('Create new Accounts');
echo '</title>'."\n".
'<link rel="stylesheet" type="text/css" href="../style/layout.css">'."\n".
'<link rel="stylesheet" type="text/css" href="'.$_SESSION['lamurl'].'style/layout.css">'."\n".
'<meta http-equiv="pragma" content="no-cache">'."\n".
'<meta http-equiv="cache-control" content="no-cache">'."\n";
switch ($select) {
@ -86,6 +86,25 @@ if ($select!='pdf') {
$stay=true;
while (($_SESSION['pointer'] < sizeof($_SESSION['accounts'])) && $stay) {
if ($_SESSION['accounts'][$_SESSION['pointer']]->general_username!='') {
// Check if Homedir is valid
$_SESSION['accounts'][$_SESSION['pointer']]->general_homedir = str_replace('$group', $_SESSION['accounts'][$_SESSION['pointer']]->general_group, $_SESSION['accounts'][$_SESSION['pointer']]->general_homedir);
if ($_SESSION['accounts'][$_SESSION['pointer']]->general_username != '')
$_SESSION['accounts'][$_SESSION['pointer']]->general_homedir = str_replace('$user', $_SESSION['accounts'][$_SESSION['pointer']]->general_username, $_SESSION['accounts'][$_SESSION['pointer']]->general_homedir);
// Set uid number
$_SESSION['accounts'][$_SESSION['pointer']]->general_uidNumber = checkid($_SESSION['accounts'][$_SESSION['pointer']], 'user');
$_SESSION['accounts'][$_SESSION['pointer']]->smb_scriptPath = str_replace('$user', $_SESSION['accounts'][$_SESSION['pointer']]->general_username, $_SESSION['accounts'][$_SESSION['pointer']]->smb_scriptPath);
$_SESSION['accounts'][$_SESSION['pointer']]->smb_scriptPath = str_replace('$group', $_SESSION['accounts'][$_SESSION['pointer']]->general_group, $_SESSION['accounts'][$_SESSION['pointer']]->smb_scriptPath);
$_SESSION['accounts'][$_SESSION['pointer']]->smb_profilePath = str_replace('$user', $_SESSION['accounts'][$_SESSION['pointer']]->general_username, $_SESSION['accounts'][$_SESSION['pointer']]->smb_profilePath);
$_SESSION['accounts'][$_SESSION['pointer']]->smb_profilePath = str_replace('$group', $_SESSION['accounts'][$_SESSION['pointer']]->general_group, $_SESSION['accounts'][$_SESSION['pointer']]->smb_profilePath);
$_SESSION['accounts'][$_SESSION['pointer']]->smb_smbhome = str_replace('$user', $_SESSION['accounts'][$_SESSION['pointer']]->general_username, $_SESSION['accounts'][$_SESSION['pointer']]->smb_smbhome);
$_SESSION['accounts'][$_SESSION['pointer']]->smb_smbhome = str_replace('$group', $_SESSION['accounts'][$_SESSION['pointer']]->general_group, $_SESSION['accounts'][$_SESSION['pointer']]->smb_smbhome);
if (getgid($_SESSION['accounts'][$_SESSION['pointer']]->general_group)==-1) {
$group = new account();
$group->general_username=$_SESSION['accounts'][$_SESSION['pointer']]->general_group;
@ -146,6 +165,9 @@ if ($select!='pdf') {
'<a href="masscreate.php?list2">';
echo _('Please press here if meta-refresh didn\'t work.');
echo "</a>\n";
echo '<input name="f_group_suffix" type="hidden" value="'.$_POST['f_group_suffix'].'">';
echo '<input name="f_selectgroupprofile" type="hidden" value="'.$_POST['f_selectgroupprofile'].'">';
}
else {
//echo '<meta http-equiv="refresh" content="2; URL=masscreate.php?list2">'."\n".
@ -170,8 +192,9 @@ if ($select!='pdf') {
if ($_SESSION['accounts'][$i]->general_group!='')
StatusMessage('INFO', _('Group').' '.
$_SESSION['accounts'][$i]->general_group.' '._('not found!'), _('It will be created.'));
echo "</table>\n".
"<fieldset class=\"useredit-bright\"><legend class=\"useredit-bright\"><b>";
echo "</table>\n";
//print_r($_SESSION['accounts']);
echo "<fieldset class=\"useredit-bright\"><legend class=\"useredit-bright\"><b>";
echo _('Confirm List');
echo "</b></legend>\n<table border=0 width=\"100%\">\n";
echo '<tr><td>'._('row').'</td>'."\n".'<td>'. _('Surname'). '</td>'."\n".'<td>'. _('Given name'). '</td>'."\n".'<td>'. _('User name'). '</td>'."\n".'<td>'. _('Primary group'). '</td>'."\n".'<td>'.
@ -229,7 +252,6 @@ if ($select!='pdf') {
if ( isset($_SESSION['pointer'])) unset($_SESSION['pointer']);
if ( isset($_SESSION['errors'])) unset($_SESSION['errors']);
$_SESSION['pointer']=0;
$profilelist = getUserProfiles();
echo '</head><body>'."\n".
'<form enctype="multipart/form-data" action="masscreate.php" method="post">'."\n".
"<fieldset class=\"useredit-bright\"><legend class=\"useredit-bright\"><b>";
@ -275,18 +297,33 @@ if ($select!='pdf') {
echo _('Select settings');
echo "</b></legend>\n<table class=\"masscreate\" width=\"100%\">".
'<tr><td>'."\n";
echo _('Select Profile:');
echo _('Select user profile:');
echo '</td><td><select name="f_selectprofile">'."\n";
foreach ($profilelist as $profile) echo '<option>' . $profile;
foreach (getUserProfiles() as $profile) echo '<option>' . $profile;
echo '</select>';
echo "</td>\n<td><a href=\"help.php?HelpNumber=421\" target=\"lamhelp\">";
echo _('Help')."</a></td>\n</tr>\n<tr><td>";
echo _('Suffix'); echo '</td><td><select name="f_general_suffix">';
echo _('User suffix'); echo '</td><td><select name="f_general_suffix">';
foreach ($_SESSION['ldap']->search_units($_SESSION['config']->get_UserSuffix()) as $suffix)
echo '<option>' . $suffix. '</option>';
echo '</select></td>'."\n".'<td><a href="help.php?HelpNumber=461" target="lamhelp">'._('Help').'</a>'.
'</td></tr><tr><td>'."\n".
'<input type="hidden" name="MAX_FILE_SIZE" value="100000">';
'</td></tr><tr><td>'."\n";
echo _("Expand suffix with primary groupname");
echo '</td>'."\n".'<td><input name="f_ou_expand" type="checkbox">';
echo "</td>\n<td><a href=\"help.php?HelpNumber=XXX\" target=\"lamhelp\">";
echo _('Help-XX')."</a></td>\n</tr>\n<tr><td>";
echo _('Group suffix'); echo '</td><td><select name="f_group_suffix">';
foreach ($_SESSION['ldap']->search_units($_SESSION['config']->get_GroupSuffix()) as $suffix)
echo '<option>' . $suffix. '</option>';
echo '</select></td>'."\n".'<td><a href="help.php?HelpNumber=XXX" target="lamhelp">'._('Help-XX').'</a>'.
'</td></tr><tr><td>'."\n";
echo _('Select group profile:');
echo '</td><td><select name="f_selectgroupprofile">'."\n";
foreach (getGroupProfiles() as $profile) echo '<option>' . $profile;
echo '</select>';
echo "</td>\n<td><a href=\"help.php?HelpNumber=XXX\" target=\"lamhelp\">";
echo _('Help-XX')."</a></td>\n</tr>\n<tr><td>";
echo '<input type="hidden" name="MAX_FILE_SIZE" value="100000">';
echo _('Select file:');
echo '</td><td><input name="userfile" type="file"></td></tr>'."\n".
'<tr><td></td><td><input name="tolist" type="submit" value="'; echo _('Next'); echo '">'."\n".
@ -300,40 +337,80 @@ if ($select!='pdf') {
function loadfile() {
if ($_FILES['userfile']['size']>0) {
$OUs = array();
$handle = fopen($_FILES['userfile']['tmp_name'], 'r');
$profile = loadUserProfile($_POST['f_selectprofile']) ;
// load quotas from profile and check if they are valid
$values = getquotas('user');
if (isset($profile->quota[0])) { // check quotas from profile
$i=0;
// check quota settings
while (isset($profile->quota[$i])) {
$found = (-1);
for ($j=0; $j<count($values->quota); $j++)
if ($values->quota[$j][0]==$profile->quota[$i][0]) $found = $j;
if ($found==-1) unset($profile->quota[$i]);
else {
$profile->quota[$i][1] = $values->quota[$found][1];
$profile->quota[$i][5] = $values->quota[$found][5];
$profile->quota[$i][4] = $values->quota[$found][4];
$profile->quota[$i][8] = $values->quota[$found][8];
$i++;
}
}
$profile->quota = array_values($profile->quota);
}
else { // No quotas saved in profile
if (is_object($values)) {
while (list($key, $val) = each($values)) // Set only defined values
if (isset($val)) $profile->$key = $val;
}
}
print_r($profile);
for ($row=0; $line_array=fgetcsv($handle,2048); $row++) { // loops for every row
$iv = base64_decode($_COOKIE["IV"]);
$key = base64_decode($_COOKIE["Key"]);
$_SESSION['accounts'][$row] = $profile;
$_SESSION['accounts'][$row]->general_dn = $_POST['f_general_suffix'];
if ($line_array[0]) $_SESSION['accounts'][$row]->general_surname = $line_array[0];
if ($line_array[1]) $_SESSION['accounts'][$row]->general_givenname = $line_array[1];
if ($line_array[2]) $_SESSION['accounts'][$row]->general_username = $line_array[2];
if ($line_array[3]) $_SESSION['accounts'][$row]->general_group = $line_array[3];
if ($line_array[4]) $_SESSION['accounts'][$row]->personal_title = $line_array[4];
if ($line_array[5]) $_SESSION['accounts'][$row]->personal_mail = $line_array[5];
if ($line_array[6]) $_SESSION['accounts'][$row]->personal_telephoneNumber = $line_array[6];
if ($line_array[7]) $_SESSION['accounts'][$row]->personal_mobileTelephoneNumber = $line_array[7];
if ($line_array[8]) $_SESSION['accounts'][$row]->personal_facsimileTelephoneNumber = $line_array[8];
if ($line_array[9]) $_SESSION['accounts'][$row]->personal_street = $line_array[9];
if ($line_array[10]) $_SESSION['accounts'][$row]->personal_postalCode = $line_array[10];
if ($line_array[11]) $_SESSION['accounts'][$row]->personal_postalAddress = $line_array[11];
if ($line_array[12]) $_SESSION['accounts'][$row]->personal_employeeType = $line_array[12];
$_SESSION['accounts'][$row]->type = 'user';
if (isset($line_array[0])) $_SESSION['accounts'][$row]->general_surname = $line_array[0];
if (isset($line_array[1])) $_SESSION['accounts'][$row]->general_givenname = $line_array[1];
if (isset($line_array[2])) $_SESSION['accounts'][$row]->general_username = $line_array[2];
if (isset($line_array[3])) $_SESSION['accounts'][$row]->general_group = $line_array[3];
if (isset($line_array[4])) $_SESSION['accounts'][$row]->personal_title = $line_array[4];
if (isset($line_array[5])) $_SESSION['accounts'][$row]->personal_mail = $line_array[5];
if (isset($line_array[6])) $_SESSION['accounts'][$row]->personal_telephoneNumber = $line_array[6];
if (isset($line_array[7])) $_SESSION['accounts'][$row]->personal_mobileTelephoneNumber = $line_array[7];
if (isset($line_array[8])) $_SESSION['accounts'][$row]->personal_facsimileTelephoneNumber = $line_array[8];
if (isset($line_array[9])) $_SESSION['accounts'][$row]->personal_street = $line_array[9];
if (isset($line_array[10])) $_SESSION['accounts'][$row]->personal_postalCode = $line_array[10];
if (isset($line_array[11])) $_SESSION['accounts'][$row]->personal_postalAddress = $line_array[11];
if (isset($line_array[12])) $_SESSION['accounts'][$row]->personal_employeeType = $line_array[12];
if ($_POST['f_ou_expand']) {
$_SESSION['accounts'][$row]->general_dn = "ou=".$_SESSION['accounts'][$row]->general_group .','. $_POST['f_general_suffix'];
// Create OUs if needed
if (!in_array($_SESSION['accounts'][$row]->general_group, $OUs)) {
$attr['objectClass']= 'organizationalUnit';
$attr['ou'] = $_SESSION['accounts'][$row]->general_group;
$success = @ldap_add($_SESSION['ldap']->server(), $_SESSION['accounts'][$row]->general_dn, $attr);
if ($success) $OUs[] = $_SESSION['accounts'][$row]->general_group;
}
}
else $_SESSION['accounts'][$row]->general_dn = $_POST['f_general_suffix'];
$_SESSION['accounts'][$row]->unix_password = base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256,
$key, genpasswd(), MCRYPT_MODE_ECB, $iv));
$_SESSION['accounts'][$row]->smb_password=$_SESSION['accounts'][$row]->unix_password;
}
}
for ($row2=0; $row2<sizeof($_SESSION['accounts']); $row2++) { // loops for every row
// Check for double entries in $_SESSION['accounts']
print $row2."<br>";
if ($row2<401) {
for ($i=$row2+1; $i<sizeof($_SESSION['accounts']); $i++ ) {
if ($_SESSION['accounts'][$row2]->general_username == $_SESSION['accounts'][$i]->general_username) { // Found user with same name
print $row2."-".$i."<br>";
print $_SESSION['accounts'][$row2]->general_username ."-". $_SESSION['accounts'][$i]->general_username ."<br>"; // Found user with same name
// get last character of username
if (!is_numeric($_SESSION['accounts'][$i]->general_username{strlen($_SESSION['accounts'][$i]->general_username)-1}))
$_SESSION['accounts'][$i]->general_username = $_SESSION['accounts'][$i]->general_username . '2';
@ -356,16 +433,9 @@ function loadfile() {
$_SESSION['accounts'][$i]->general_username = $first . $second;
}
}
print $_SESSION['accounts'][$row2]->general_username ."-". $_SESSION['accounts'][$i]->general_username ."<br>"; // Found user with same name
}
if ($values->general_username != $return->general_username) $error[] = array('WARN', _('Username'), _('Username in use. Selected next free username.'));
$_SESSION['errors'][$row2] = array_merge($_SESSION['errors'][$row2], $error);
// Check if Homedir is valid
$_SESSION['accounts'][$row2]->general_homedir = str_replace('$group', $_SESSION['accounts'][$row2]->general_group, $_SESSION['accounts'][$row2]->general_homedir);
if ($_SESSION['accounts'][$row2]->general_username != '')
$_SESSION['accounts'][$row2]->general_homedir = str_replace('$user', $_SESSION['accounts'][$row2]->general_username, $_SESSION['accounts'][$row2]->general_homedir);
if ( !ereg('^[/]([a-z]|[A-Z])([a-z]|[A-Z]|[0-9]|[.]|[-]|[_])*([/]([a-z]|[A-Z])([a-z]|[A-Z]|[0-9]|[.]|[-]|[_])*)*$', $_SESSION['accounts'][$row2]->general_homedir ))
$errors[] = array('ERROR', _('Home directory'), _('Homedirectory contains invalid characters.'));
// Check if givenname is valid
if ( !ereg('^([a-z]|[A-Z]|[-]|[ ]|[ä]|[Ä]|[ö]|[Ö]|[ü]|[Ü]|[ß])+$', $_SESSION['accounts'][$row2]->general_givenname)) $errors[] = array('ERROR', _('Given name'), _('Given name contains invalid characters'));
// Check if surname is valid
@ -378,14 +448,7 @@ function loadfile() {
// Check if Username contains only valid characters
if ( !ereg('^([a-z]|[0-9]|[.]|[-]|[_])*$', $_SESSION['accounts'][$row2]->general_username))
$errors[] = array('ERROR', _('Username'), _('Username contains invalid characters. Valid characters are: a-z, 0-9 and .-_ !'));
// Check if user already exists
if (isset($_SESSION['accounts'][$row2]->general_groupadd) && in_array($_SESSION['accounts'][$row2]->general_group, $_SESSION['accounts'][$row2]->general_groupadd)) {
for ($i=0; $i<count($_SESSION['accounts'][$row2]->general_groupadd); $i++ )
if ($_SESSION['accounts'][$row2]->general_groupadd[$i] == $_SESSION['accounts'][$row2]->general_group) {
unset ($_SESSION['accounts'][$row2]->general_groupadd[$i]);
$_SESSION['accounts'][$row2]->general_groupadd = array_values($_SESSION['accounts'][$row2]->general_groupadd);
}
}
// Create automatic useraccount with number if original user already exists
// Reset name to original name if new name is in use
while ($temp = ldapexists($_SESSION['accounts'][$row2], 'user')) {
@ -408,16 +471,6 @@ function loadfile() {
}
}
// Check if UID is valid. If none value was entered, the next useable value will be inserted
//$_SESSION['accounts'][$row2]->general_uidNumber = '';
if (is_object($_SESSION['accounts'][$row2-1])) $_SESSION['accounts'][$row2]->general_uidNumber = $_SESSION['accounts'][$row2-1]->general_uidNumber+1;
$_SESSION['accounts'][$row2]->general_uidNumber = checkid($_SESSION['accounts'][$row2], 'user');
while (is_string($_SESSION['accounts'][$row2]->general_uidNumber)) { // true if checkid has returned an error
$_SESSION['accounts'][$row2]->general_uidNumber = $_SESSION['accounts'][$row2]->general_uidNumber+1;
unset($_SESSION['accounts'][$row2]->general_uidNumber);
$_SESSION['accounts'][$row2]->general_uidNumber = checkid($_SESSION['accounts'][$row2], 'user');
}
// Check if Name-length is OK. minLength=3, maxLength=20
if ( !ereg('.{3,20}', $_SESSION['accounts'][$row2]->general_username)) $errors[] = array('ERROR', _('Name'), _('Name must contain between 3 and 20 characters.'));
// Check if Name starts with letter
@ -426,43 +479,8 @@ function loadfile() {
$_SESSION['errors'][$row2] = array_merge($_SESSION['errors'][$row2], $errors);
if (isset($errors)) unset ($errors);
if ($_SESSION['accounts'][$row2]->unix_password != '') {
$iv = base64_decode($_COOKIE["IV"]);
$key = base64_decode($_COOKIE["Key"]);
$password = mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $key, base64_decode($_SESSION['accounts'][$row2]->unix_password), MCRYPT_MODE_ECB, $iv);
$password = str_replace(chr(00), '', $password);
}
if (!ereg('^([a-z]|[A-Z]|[0-9]|[\|]|[\#]|[\*]|[\,]|[\.]|[\;]|[\:]|[\_]|[\-]|[\+]|[\!]|[\%]|[\&]|[\/]|[\?]|[\{]|[\[]|[\(]|[\)]|[\]]|[\}])*$', $password))
$errors[] = array('ERROR', _('Password'), _('Password contains invalid characters. Valid characters are: a-z, A-Z, 0-9 and #*,.;:_-+!$%&/|?{[()]}= !'));
if ( !ereg('^([0-9])*$', $_SESSION['accounts'][$row2]->unix_pwdminage)) $errors[] = array('ERROR', _('Password minage'), _('Password minage must be are natural number.'));
if ( $_SESSION['accounts'][$row2]->unix_pwdminage > $_SESSION['accounts'][$row2]->unix_pwdmaxage ) $errors[] = array('ERROR', _('Password maxage'), _('Password maxage must bigger as Password Minage.'));
if ( !ereg('^([0-9]*)$', $_SESSION['accounts'][$row2]->unix_pwdmaxage)) $errors[] = array('ERROR', _('Password maxage'), _('Password maxage must be are natural number.'));
if ( !ereg('^(([-][1])|([0-9]*))$', $_SESSION['accounts'][$row2]->unix_pwdallowlogin))
$errors[] = array('ERROR', _('Password Expire'), _('Password expire must be are natural number or -1.'));
if ( !ereg('^([0-9]*)$', $_SESSION['accounts'][$row2]->unix_pwdwarn)) $errors[] = array('ERROR', _('Password warn'), _('Password warn must be are natural number.'));
if ((!$_SESSION['accounts'][$row2]->unix_host=='') && !ereg('^([a-z]|[A-Z]|[0-9]|[.]|[-])+(([,])+([ ])*([a-z]|[A-Z]|[0-9]|[.]|[-])+)*$', $_SESSION['accounts']->unix_host))
$errors[] = array('ERROR', _('Unix workstations'), _('Unix workstations is invalid.'));
$_SESSION['errors'][$row2] = array_merge($_SESSION['errors'][$row2], $errors);
if (isset($errors)) unset ($errors);
$_SESSION['accounts'][$row2]->smb_displayName = $_SESSION['accounts'][$row2]->general_gecos;
$i=0;
while ($_SESSION['accounts'][$row2]->quota[$i][0]) {
// Check if values are OK and set automatic values. if not error-variable will be set
if (!ereg('^([0-9])*$', $_SESSION['accounts'][$row2]->quota[$i][2]))
$errors[] = array('ERROR', _('Block soft quota'), _('Block soft quota contains invalid characters. Only natural numbers are allowed'));
if (!ereg('^([0-9])*$', $_SESSION['accounts'][$row2]->quota[$i][3]))
$errors[] = array('ERROR', _('Block hard quota'), _('Block hard quota contains invalid characters. Only natural numbers are allowed'));
if (!ereg('^([0-9])*$', $_SESSION['accounts'][$row2]->quota[$i][6]))
$errors[] = array('ERROR', _('Inode soft quota'), _('Inode soft quota contains invalid characters. Only natural numbers are allowed'));
if (!ereg('^([0-9])*$', $_SESSION['accounts'][$row2]->quota[$i][7]))
$errors[] = array('ERROR', _('Inode hard quota'), _('Inode hard quota contains invalid characters. Only natural numbers are allowed'));
$i++;
}
$_SESSION['errors'][$row2] = array_merge($_SESSION['errors'][$row2], $errors);
if (isset($errors)) unset ($errors);
if ( !ereg('^(\+)*([0-9]|[ ]|[.]|[(]|[)]|[/])*$', $_SESSION['accounts'][$row2]->personal_telephoneNumber)) $errors[] = array('ERROR', _('Telephone number'), _('Please enter a valid telephone number!'));
if ( !ereg('^(\+)*([0-9]|[ ]|[.]|[(]|[)]|[/])*$', $_SESSION['accounts'][$row2]->personal_mobileTelephoneNumber)) $errors[] = array('ERROR', _('Mobile number'), _('Please enter a valid mobile number!'));
if ( !ereg('^(\+)*([0-9]|[ ]|[.]|[(]|[)]|[/])*$', $_SESSION['accounts'][$row2]->personal_facsimileTelephoneNumber)) $errors[] = array('ERROR', _('Fax number'), _('Please enter a valid fax number!'));

View File

@ -36,7 +36,7 @@ session_save_path('../sess');
echo '<html><head><title>';
echo _('Create new accounts');
echo '</title>'.
'<link rel="stylesheet" type="text/css" href="../style/layout.css">'.
'<link rel="stylesheet" type="text/css" href="'.$_SESSION['lamurl'].'style/layout.css">'.
'<meta http-equiv="pragma" content="no-cache">'.
'<meta http-equiv="cache-control" content="no-cache">'.
'</head><body>'.
@ -174,12 +174,6 @@ switch ($select) {
'</td><td>'.
'<a href="help.php?HelpNumber=400" target="lamhelp">'._('Help').'</a>'.
'</td></tr>'."\n".'<tr><td>';
echo _('Primary group').'*';
echo "</td>\n<td>".
'<input name="f_general_group" type="text" size="20" maxlength="20" value="' . $_SESSION['accounts'][$row]->general_group . '">'.
'</td><td>'.
'<a href="help.php?HelpNumber=406" target="lamhelp">'._('Help').'</a>'.
'</td></tr>'."\n".'<tr><td>';
echo _('Title');
echo '</td>'."\n".'<td>'.
'<input name="f_personal_title" type="text" size="10" maxlength="10" value="' . $_SESSION['accounts'][$row]->personal_title . '"> ';