added many comments and removed some smaller bugs

This commit is contained in:
katagia 2003-10-19 17:06:16 +00:00
parent 708dc678c7
commit 21d6b5c5c6
7 changed files with 30 additions and 27 deletions

View File

@ -15,4 +15,3 @@
/usr/bin/rbash
/usr/bin/tcsh
/usr/bin/zsh
# test

View File

@ -151,9 +151,9 @@ switch ($select) { // Select which part of page should be loaded and check value
}
// Create automatic groupaccount with number if original group already exists
// Reset name to original name if new name is in use
if (ldapexists($account_new, 'group', $account_old) && is_object($account_old))
if (ldapexists($account_new, $account_old) && is_object($account_old))
$account_new->general_username = $account_old->general_username;
while ($temp = ldapexists($account_new, 'group', $account_old)) {
while ($temp = ldapexists($account_new, $account_old)) {
// get last character of username
$lastchar = substr($account_new->general_username, strlen($account_new->general_username)-1, 1);
// Last character is no number
@ -175,7 +175,7 @@ switch ($select) { // Select which part of page should be loaded and check value
if ($account_new->general_username != $_POST['f_general_username']) $errors[] = array('WARN', _('Groupname'), _('Groupname already in use. Selected next free groupname.'));
// Check if UID is valid. If none value was entered, the next useable value will be inserted
$account_new->general_uidNumber = checkid($account_new, 'group', $account_old);
$account_new->general_uidNumber = checkid($account_new, $account_old);
if (is_string($account_new->general_uidNumber)) { // true if checkid has returned an error
$errors[] = array('ERROR', _('ID-Number'), $account_new->general_uidNumber);
if (isset($account_old)) $account_new->general_uidNumber = $account_old->general_uidNumber;
@ -410,7 +410,6 @@ if (is_array($errors)) {
}
// print_r($account_old);
switch ($select_local) { // Select which part of page will be loaded
// general = startpage, general account paramters
// unix = page with all shadow-options and password
@ -425,7 +424,7 @@ switch ($select_local) { // Select which part of page will be loaded
$temp2 = $userDN_intern;
unset($temp2[0]);
foreach ($temp2 as $temp) $users[] = $temp['cn'];
sort($users, SORT_STRING);
if (is_array($users)) sort($users, SORT_STRING);
$users = array_delete($account_new->unix_memberUid, $users);
echo "<input name=\"select\" type=\"hidden\" value=\"groupmembers\">\n";
echo "<table border=0 width=\"100%\">\n<tr><td valign=\"top\" width=\"15%\" >";
@ -468,7 +467,7 @@ switch ($select_local) { // Select which part of page will be loaded
echo "<td valign=\"top\"><fieldset class=\"groupedit-middle\"><legend class=\"groupedit-bright\">";
echo _('Available users');
echo "</legend>\n";
if (count($users)!=0) {
if ((count($users)!=0) && is_array($users)) {
echo "<select name=\"users[]\" size=15 multiple class=\"groupedit-bright\">\n";
foreach ($users as $temp)
echo " <option>$temp</option>\n";
@ -659,7 +658,9 @@ switch ($select_local) { // Select which part of page will be loaded
'<a href="../help.php?HelpNumber=464" target="lamhelp">'._('Help').'</a>'.
'</td></tr>'."\n".'<tr><td>';
echo _('Domain');
echo '</td><td><select name="f_smb_domain">';
echo '</td><td>';
if (count($samba3domains)!=0) {
echo '<select name="f_smb_domain">';
for ($i=0; $i<sizeof($samba3domains); $i++) {
if ($account_new->smb_domain->name) {
if ($account_new->smb_domain->name == $samba3domains[$i]->name)
@ -668,7 +669,9 @@ 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>';
}
echo "</td>\n<td><a href=\"../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;

View File

@ -111,9 +111,9 @@ switch ($_POST['select']) { // Select which part of page should be loaded and ch
}
// Create automatic Hostname with number if original user already exists
// Reset name to original name if new name is in use
if (ldapexists($account_new, 'host', $account_old) && is_object($account_old))
if (ldapexists($account_new, $account_old) && is_object($account_old))
$account_new->general_username = $account_old->general_username;
while ($temp = ldapexists($account_new, 'host', $account_old)) {
while ($temp = ldapexists($account_new, $account_old)) {
// get last character of username
$account_new->general_username = substr($account_new->general_username, 0, $account_new->general_username-1);
$lastchar = substr($account_new->general_username, strlen($account_new->general_username)-2, 1);
@ -138,7 +138,7 @@ switch ($_POST['select']) { // Select which part of page should be loaded and ch
$errors[] = array('WARN', _('Host name'), _('Hostname already in use. Selected next free hostname.'));
// Check if UID is valid. If none value was entered, the next useable value will be inserted
$account_new->general_uidNumber = checkid($account_new, 'host', $account_old);
$account_new->general_uidNumber = checkid($account_new, $account_old);
if (is_string($account_new->general_uidNumber)) { // true if checkid has returned an error
$errors[] = array('ERROR', _('ID-Number'), $account_new->general_uidNumber);
if (isset($account_old)) $account_new->general_uidNumber = $account_old->general_uidNumber;

View File

@ -227,9 +227,9 @@ switch ($_POST['select']) { // Select which part of page should be loaded and ch
}
// Create automatic useraccount with number if original user already exists
// Reset name to original name if new name is in use
if (ldapexists($account_new, 'user', $account_old) && is_object($account_old))
if (ldapexists($account_new, $account_old) && is_object($account_old))
$account_new->general_username = $account_old->general_username;
while ($temp = ldapexists($account_new, 'user', $account_old)) {
while ($temp = ldapexists($account_new, $account_old)) {
// get last character of username
$lastchar = substr($account_new->general_username, strlen($account_new->general_username)-1, 1);
// Last character is no number
@ -251,7 +251,7 @@ switch ($_POST['select']) { // Select which part of page should be loaded and ch
if ($account_new->general_username != $_POST['f_general_username']) $errors[] = array('WARN', _('Username'), _('Username in use. Selected next free username.'));
// Check if UID is valid. If none value was entered, the next useable value will be inserted
$account_new->general_uidNumber = checkid($account_new, 'user', $account_old);
$account_new->general_uidNumber = checkid($account_new, $account_old);
if (is_string($account_new->general_uidNumber)) { // true if checkid has returned an error
$errors[] = array('ERROR', _('ID-Number'), $account_new->general_uidNumber);
if (isset($account_old)) $account_new->general_uidNumber = $account_old->general_uidNumber;

View File

@ -169,6 +169,7 @@ if ($_POST['delete_yes'] && !$_POST['backmain']) {
}
break;
}
if ($success && isset($_SESSION[$_POST['type5'].'DN'][$dn])) unset($_SESSION[$_POST['type5'].'DN'][$dn]);
if (!$error) echo "<tr><td><b>$dn ". _('deleted').".</b></td></tr>\n";
else echo "<tr><td><b>$error</b></td></tr>\n";
}

View File

@ -119,7 +119,7 @@ if ($select!='pdf') {
$_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']]->general_uidNumber = checkid($_SESSION['accounts'][$_SESSION['pointer']]);
$_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);
@ -163,7 +163,7 @@ if ($select!='pdf') {
}
$group->general_username=$_SESSION['accounts'][$_SESSION['pointer']]->general_group;
$group->general_uidNumber=checkid($_SESSION['accounts'][$_SESSION['pointer']], 'group');
$group->general_uidNumber=checkid($_SESSION['accounts'][$_SESSION['pointer']]);
$group->general_gecos=$_SESSION['accounts'][$_SESSION['pointer']]->general_group;
$group->general_dn=$_SESSION['group_suffix'];
$error = creategroup($group);
@ -179,7 +179,7 @@ if ($select!='pdf') {
}
}
$_SESSION['accounts'][$_SESSION['pointer']]->general_uidNumber = checkid($_SESSION['accounts'][$_SESSION['pointer']], 'user');
$_SESSION['accounts'][$_SESSION['pointer']]->general_uidNumber = checkid($_SESSION['accounts'][$_SESSION['pointer']]);
$iv = base64_decode($_COOKIE["IV"]);
$key = base64_decode($_COOKIE["Key"]);
$_SESSION['accounts'][$_SESSION['pointer']]->unix_password = base64_encode(mcrypt_encrypt(
@ -446,7 +446,7 @@ function loadfile() {
// check if account allready exists
for ($i=0; $i<sizeof($_SESSION['accounts']); $i++) { // loops for every row
while ($temp = ldapexists($_SESSION['accounts'][$i], 'user')) {
while ($temp = ldapexists($_SESSION['accounts'][$i])) {
// Get interger-end of string hello456 -> hello + 456
$start = strlen($_SESSION['accounts'][$i]->general_username)-1;
while (is_numeric(substr($_SESSION['accounts'][$i]->general_username, $start))) $start--;
@ -475,7 +475,7 @@ function loadfile() {
$second = intval(substr($_SESSION['accounts'][$i]->general_username, $start+1))+1;
$_SESSION['accounts'][$i]->general_username = $first . $second;
}
while ($temp = ldapexists($_SESSION['accounts'][$i], 'user')) {
while ($temp = ldapexists($_SESSION['accounts'][$i])) {
// Get interger-end of string hello456 -> hello + 456
$start = strlen($_SESSION['accounts'][$i]->general_username)-1;
while (is_numeric(substr($_SESSION['accounts'][$i]->general_username, $start))) $start--;
@ -503,7 +503,7 @@ function loadfile() {
// 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')) {
while ($temp = ldapexists($_SESSION['accounts'][$row2])) {
// get last character of username
$lastchar = substr($_SESSION['accounts'][$row2]->general_username, strlen($_SESSION['accounts'][$row2]->general_username)-1, 1);
// Last character is no number

View File

@ -78,7 +78,7 @@ if ($_POST['apply']) {
}
// 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'][$row], 'user')) {
while ($temp = ldapexists($_SESSION['accounts'][$row])) {
// get last character of username
$lastchar = substr($_SESSION['accounts'][$row]->general_username, strlen($_SESSION['accounts'][$row]->general_username)-1, 1);
// Last character is no number