From 21d6b5c5c6395e31aded8fafc2a7cba50a8736e6 Mon Sep 17 00:00:00 2001 From: katagia Date: Sun, 19 Oct 2003 17:06:16 +0000 Subject: [PATCH] added many comments and removed some smaller bugs --- lam/config/shells | 1 - lam/templates/account/groupedit.php | 29 ++++++++++++++++------------- lam/templates/account/hostedit.php | 6 +++--- lam/templates/account/useredit.php | 6 +++--- lam/templates/delete.php | 1 + lam/templates/masscreate.php | 12 ++++++------ lam/templates/massdetail.php | 2 +- 7 files changed, 30 insertions(+), 27 deletions(-) diff --git a/lam/config/shells b/lam/config/shells index 590d9c89..7105372f 100644 --- a/lam/config/shells +++ b/lam/config/shells @@ -15,4 +15,3 @@ /usr/bin/rbash /usr/bin/tcsh /usr/bin/zsh -# test diff --git a/lam/templates/account/groupedit.php b/lam/templates/account/groupedit.php index 987d6ad8..7471d8a3 100644 --- a/lam/templates/account/groupedit.php +++ b/lam/templates/account/groupedit.php @@ -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 "\n"; echo "\n'."\n".''."\n".''."\n"; + echo "\n\n"; echo "
"; @@ -468,7 +467,7 @@ switch ($select_local) { // Select which part of page will be loaded echo "
"; echo _('Available users'); echo "\n"; - if (count($users)!=0) { + if ((count($users)!=0) && is_array($users)) { echo "
'; echo _('Domain'); - echo ''; + if (count($samba3domains)!=0) { + echo ''; } - echo ''._('Help').'
"._('Help')."
\n\n\n\n"; break; diff --git a/lam/templates/account/hostedit.php b/lam/templates/account/hostedit.php index 0c8fa334..aeb98c2f 100644 --- a/lam/templates/account/hostedit.php +++ b/lam/templates/account/hostedit.php @@ -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; diff --git a/lam/templates/account/useredit.php b/lam/templates/account/useredit.php index 31e6b13a..7133cff1 100644 --- a/lam/templates/account/useredit.php +++ b/lam/templates/account/useredit.php @@ -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; diff --git a/lam/templates/delete.php b/lam/templates/delete.php index 67468d61..785b05a1 100644 --- a/lam/templates/delete.php +++ b/lam/templates/delete.php @@ -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 "$dn ". _('deleted').".\n"; else echo "$error\n"; } diff --git a/lam/templates/masscreate.php b/lam/templates/masscreate.php index f70b5d9c..f47ec7aa 100644 --- a/lam/templates/masscreate.php +++ b/lam/templates/masscreate.php @@ -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 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 diff --git a/lam/templates/massdetail.php b/lam/templates/massdetail.php index c7ad163c..b6df9a1c 100644 --- a/lam/templates/massdetail.php +++ b/lam/templates/massdetail.php @@ -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