From 84114716db5ce9d8a736783f446ae0156dc7fb40 Mon Sep 17 00:00:00 2001 From: katagia Date: Sun, 8 Jun 2003 10:33:37 +0000 Subject: [PATCH] Help-Entries for account.php are now complete but helptext is missing very often. Fixed smaller problem when no Additional groups were active --- lam/help/help.inc | 90 ++---------------------------- lam/lib/account.inc | 30 +++++----- lam/templates/account.php | 112 ++++++++++++++++++++------------------ 3 files changed, 81 insertions(+), 151 deletions(-) diff --git a/lam/help/help.inc b/lam/help/help.inc index 0b5b73d4..64c1a2d0 100644 --- a/lam/help/help.inc +++ b/lam/help/help.inc @@ -272,90 +272,12 @@ $helpArray = array ( "Text" => _("eMail Address")), "457" => array ("ext" => "FALSE", "Headline" => _("Save Profile"), "Text" => _("Save Profile")), - "458" => array ("ext" => "FALSE", "Headline" => _(""), - "Text" => _("")), - "459" => array ("ext" => "FALSE", "Headline" => _(""), - "Text" => _("")), - "460" => array ("ext" => "FALSE", "Headline" => _(""), - "Text" => _("")), - "461" => array ("ext" => "FALSE", "Headline" => _(""), - "Text" => _("")), - "462" => array ("ext" => "FALSE", "Headline" => _(""), - "Text" => _("")), - "463" => array ("ext" => "FALSE", "Headline" => _(""), - "Text" => _("")), - "464" => array ("ext" => "FALSE", "Headline" => _(""), - "Text" => _("")), - "465" => array ("ext" => "FALSE", "Headline" => _(""), - "Text" => _("")), - "466" => array ("ext" => "FALSE", "Headline" => _(""), - "Text" => _("")), - "467" => array ("ext" => "FALSE", "Headline" => _(""), - "Text" => _("")), - "468" => array ("ext" => "FALSE", "Headline" => _(""), - "Text" => _("")), - "469" => array ("ext" => "FALSE", "Headline" => _(""), - "Text" => _("")), - "470" => array ("ext" => "FALSE", "Headline" => _(""), - "Text" => _("")), - "471" => array ("ext" => "FALSE", "Headline" => _(""), - "Text" => _("")), - "472" => array ("ext" => "FALSE", "Headline" => _(""), - "Text" => _("")), - "473" => array ("ext" => "FALSE", "Headline" => _(""), - "Text" => _("")), - "474" => array ("ext" => "FALSE", "Headline" => _(""), - "Text" => _("")), - "475" => array ("ext" => "FALSE", "Headline" => _(""), - "Text" => _("")), - "476" => array ("ext" => "FALSE", "Headline" => _(""), - "Text" => _("")), - "477" => array ("ext" => "FALSE", "Headline" => _(""), - "Text" => _("")), - "478" => array ("ext" => "FALSE", "Headline" => _(""), - "Text" => _("")), - "479" => array ("ext" => "FALSE", "Headline" => _(""), - "Text" => _("")), - "480" => array ("ext" => "FALSE", "Headline" => _(""), - "Text" => _("")), - "481" => array ("ext" => "FALSE", "Headline" => _(""), - "Text" => _("")), - "482" => array ("ext" => "FALSE", "Headline" => _(""), - "Text" => _("")), - "483" => array ("ext" => "FALSE", "Headline" => _(""), - "Text" => _("")), - "484" => array ("ext" => "FALSE", "Headline" => _(""), - "Text" => _("")), - "485" => array ("ext" => "FALSE", "Headline" => _(""), - "Text" => _("")), - "486" => array ("ext" => "FALSE", "Headline" => _(""), - "Text" => _("")), - "487" => array ("ext" => "FALSE", "Headline" => _(""), - "Text" => _("")), - "488" => array ("ext" => "FALSE", "Headline" => _(""), - "Text" => _("")), - "489" => array ("ext" => "FALSE", "Headline" => _(""), - "Text" => _("")), - "490" => array ("ext" => "FALSE", "Headline" => _(""), - "Text" => _("")), - "491" => array ("ext" => "FALSE", "Headline" => _(""), - "Text" => _("")), - "492" => array ("ext" => "FALSE", "Headline" => _(""), - "Text" => _("")), - "493" => array ("ext" => "FALSE", "Headline" => _(""), - "Text" => _("")), - "494" => array ("ext" => "FALSE", "Headline" => _(""), - "Text" => _("")), - "495" => array ("ext" => "FALSE", "Headline" => _(""), - "Text" => _("")), - "496" => array ("ext" => "FALSE", "Headline" => _(""), - "Text" => _("")), - "497" => array ("ext" => "FALSE", "Headline" => _(""), - "Text" => _("")), - "498" => array ("ext" => "FALSE", "Headline" => _(""), - "Text" => _("")), - "499" => array ("ext" => "FALSE", "Headline" => _(""), - "Text" => _("")) + "458" => array ("ext" => "FALSE", "Headline" => _("Host can change Password"), + "Text" => _("Host can change Password")), + "459" => array ("ext" => "FALSE", "Headline" => _("Host must change Password"), + "Text" => _("Host must change Password")), + "460" => array ("ext" => "FALSE", "Headline" => _("Windows Domain"), + "Text" => _("Windows Domain of host. Can be left empty.")) /* This is a sample help entry. Just copy this line an modify the vakues between the [] brackets. Help text is located in the array: "[Helpnumber]" => array ("ext" => "FALSE", "Headline" => _("[Headline]"), "Text" => _("[Text]"), "SeeAlso" => "[SeeAlso link]"), diff --git a/lam/lib/account.inc b/lam/lib/account.inc index 67f0a5f7..5f558498 100644 --- a/lam/lib/account.inc +++ b/lam/lib/account.inc @@ -1031,7 +1031,7 @@ function modifyhost($values,$values_old) { // Will modify the LDAP-Account // Value stored in shadowExpire, days since 1.1.1970 $date = mktime(10,0,0, $values->unix_pwdexpire_mon, $values->unix_pwdexpire_day, $values->unix_pwdexpire_yea) / 86400 ; settype($date, 'integer'); - $values->general_dn = 'uid=' . $values->general_username . ',' . $_SESSION['config']->get_UserSuffix(); + $values->general_dn = 'uid=' . $values->general_username . ',' . $_SESSION['config']->get_HostSuffix(); if ($values->general_username != $values_old->general_username) { $attr['cn'] = $values->general_username; // posixAccount_req shadowAccount_req sambaAccount_may $attr['uid'] = $values->general_username; // posixAccount_req @@ -1094,7 +1094,7 @@ function modifyhost($values,$values_old) { // Will modify the LDAP-Account if ($values->smb_pwdcanchange==0 && $values_old->smb_pwdcanchange==1) $attr_rem['pwdCanChange'] = "1"; else $attr['pwdCanChange'] = "0"; // sambaAccount_may if ($values->smb_pwdmustchange && $values->smb_pwdmustchange==0) $attr['pwdMustChange'] = "1"; else $attr['pwdMustChange'] = "0"; // sambaAccount_may if ($values->smb_pwdmustchange==0 && $values->smb_pwdmustchange==1) $attr_rem['pwdMustChange'] = "1"; else $attr['pwdMustChange'] = "0"; // sambaAccount_may - $attr['acctFlags'] = smbflag(); // sambaAccount_may + $attr['acctFlags'] = smbflag($values); // sambaAccount_may if (($values->smb_domain!='') && ($values->smb_domain!=$values_old->smb_domain)) $attr['domain'] = $values->smb_domain; // sambaAccount_may if (($values->smb_domain=='') && ($values->smb_domain!=$values_old->smb_domain)) $attr_rem['domain'] = $values_old->smb_domain; // sambaAccount_may @@ -1102,18 +1102,18 @@ function modifyhost($values,$values_old) { // Will modify the LDAP-Account $success = ldap_mod_del($_SESSION['ldap']->server(),$values->general_dn, $attr_rem); if (!$success) return 5; } - if ($values->general_username == $values_old->general_username) // Username hasn't changed + if ($values->general_username == $values_old->general_username) // Hostname hasn't changed $success = ldap_modify($_SESSION['ldap']->server(),$values->general_dn, $attr); - else { - $result = ldap_search($_SESSION['ldap']->server(), $dn, "objectclass=PosixAccount"); - $entry = ldap_first_entry($_SESSION['ldap']->server(), $result); - $attr_old = ldap_get_attributes($_SESSION['ldap']->server(), $entry); - $success = ldap_add($_SESSION['ldap']->server(),$values->general_dn, $attr_old); - if ($success) $success = ldap_delete($_SESSION['ldap']->server(),$values_old->general_dn); - if ($success) $success = ldap_mod_replace($_SESSION['ldap']->server(),$values->general_dn, $attr); - } + else { + $result = ldap_search($_SESSION['ldap']->server(), $dn, "objectclass=PosixAccount"); + $entry = ldap_first_entry($_SESSION['ldap']->server(), $result); + $attr_old = ldap_get_attributes($_SESSION['ldap']->server(), $entry); + $success = ldap_add($_SESSION['ldap']->server(),$values->general_dn, $attr_old); + if ($success) $success = ldap_delete($_SESSION['ldap']->server(),$values_old->general_dn); + if ($success) $success = ldap_mod_replace($_SESSION['ldap']->server(),$values->general_dn, $attr); + } if (!$success) return 5; - $result = ldap_search($_SESSION['ldap']->server(), $_SESSION['config']->get_GroupSuffix(), 'objectClass=PosixGroup'); + $result = ldap_search($_SESSION['ldap']->server(), $_SESSION['config']->get_GroupSuffix(), 'objectClass=PosixGroup', array('memberUid', 'cn')); $entry = ldap_first_entry($_SESSION['ldap']->server(), $result); while ($entry) { $modifygroup=0; @@ -1121,13 +1121,13 @@ function modifyhost($values,$values_old) { // Will modify the LDAP-Account if ($attr2['memberUid']) { array_shift($attr2['memberUid']); foreach ($attr2['memberUid'] as $nam) { - if ( ($nam==$values->general_username) && !in_array($nam, $values->general_groupadd)) { + if ( ($nam==$values->general_username) && !in_array($attr2['cn'][0], $values->general_groupadd)) { $todelete['memberUid'] = $nam; $success = ldap_mod_del($_SESSION['ldap']->server(), ldap_get_dn($_SESSION['ldap']->server(), $entry) ,$todelete); if (!$success) return 5; } } - if (!in_array($values->general_username, $attr2['memberUid']) && in_array($attr2['cn'][0], $values->general_groupadd)) { + if (!in_array($values->general_username, $attr2['memberUid']) && in_array($attr2['cn'][0], $values->general_groupadd) && ($attr2['cn'][0]!=$values->general_group)) { $toadd['memberUid'] = $attr2['memberUid']; $toadd['memberUid'][] = $values->general_username; $success = ldap_mod_replace($_SESSION['ldap']->server(), ldap_get_dn($_SESSION['ldap']->server(), $entry), $toadd); @@ -1135,7 +1135,7 @@ function modifyhost($values,$values_old) { // Will modify the LDAP-Account } } else { - if (in_array($attr2['cn'][0], $values->general_groupadd)) { + if (in_array($attr2['cn'][0], $values->general_groupadd) && ($attr2['cn'][0]!=$values->general_group)) { $toadd['memberUid'] = $values->general_username; $success = ldap_mod_add($_SESSION['ldap']->server(), ldap_get_dn($_SESSION['ldap']->server(), $entry), $toadd); if (!$success) return 5; diff --git a/lam/templates/account.php b/lam/templates/account.php index 6a8e10f1..c87fcad2 100644 --- a/lam/templates/account.php +++ b/lam/templates/account.php @@ -55,7 +55,7 @@ switch ($_POST['select']) { // Select which part of page should be loaded and ch else $_SESSION['account']->general_uidNumber = ""; if ($_POST['f_general_group']) $_SESSION['account']->general_group = $_POST['f_general_group']; if ($_POST['f_general_groupadd']) $_SESSION['account']->general_groupadd = $_POST['f_general_groupadd']; - else $_SESSION['account']->general_groupadd = ''; + else $_SESSION['account']->general_groupadd = array(''); if ($_POST['f_general_homedir']) $_SESSION['account']->general_homedir = $_POST['f_general_homedir']; else $_SESSION['account']->general_homedir = ""; if ($_POST['f_general_shell']) $_SESSION['account']->general_shell = $_POST['f_general_shell']; @@ -655,7 +655,9 @@ switch ($select_local) { // Select which part of page will be loaded echo _('Account deactivated'); echo ''."\n".'unix_deactivated) echo ' checked '; - echo '>'."\n"; + echo '> + '._('Help').' + '."\n"; break; } echo ' @@ -764,38 +766,44 @@ switch ($select_local) { // Select which part of page will be loaded '."\n"; break; case 'host': - echo ''; - echo ''; - echo _('Password doesn\'t expire.'); - echo 'smb_flagsX) echo ' checked '; - echo '>'; - echo _('Host can change Password'); - echo 'smb_pwdcanchange) echo ' checked '; - echo '>'; - echo _('Host must change Password'); - echo 'smb_pwdmustchange) echo ' checked '; - echo '>'; - echo _('Accout is deactivated'); - echo 'smb_flagsD) echo ' checked '; - echo '>'; + // set smb_flgasW true because account is host $_SESSION['account']->smb_flagsW = 1; - echo ''; + echo ''; + echo _('Password doesn\'t expire.'); + echo ''."\n".'smb_flagsX) echo ' checked '; + echo '> + '._('Help').' + '."\n".''; + echo _('Host can change Password'); + echo ''."\n".'smb_pwdcanchange) echo ' checked '; + echo '> + '._('Help').' + '."\n".''; + echo _('Host must change Password'); + echo ''."\n".'smb_pwdmustchange) echo ' checked '; + echo '> + '._('Help').' + '."\n".''; + echo _('Accout is deactivated'); + echo ''."\n".'smb_flagsD) echo ' checked '; + echo '> + '._('Help').' + '."\n".''; + echo ''."\n".''; echo _('Domain'); - echo ' - '; - echo _('Windows-Domain of user. Can be left empty.'); - echo ''; + echo ''."\n".' + + '._('Help').' + '."\n"; break; } - echo ' - - - - '; + echo ''."\n"; break; case 'quota': // Quota Settings @@ -897,20 +905,20 @@ switch ($select_local) { // Select which part of page will be loaded echo ''; if ($_SESSION['account_old']) echo _('Modify'); else echo _('Create'); - echo ''; + echo ''."\n"; switch ( $_SESSION['type2'] ) { case 'user' : if (($_SESSION['account_old']) && ($_SESSION['account']->general_uidNumber != $_SESSION['account_old']->general_uidNumber)) { echo ''; StatusMessage ('INFO', _('UID-number has changed. You have to run the following command as root in order to change existing file-permissions:'), 'find / -gid ' . $_SESSION['account_old' ]->general_uidNumber . ' -exec chown ' . $_SESSION['account']->general_uidNumber . ' {} \;'); - echo ''; + echo ''."\n"; } if (($_SESSION['account_old']) && ($_SESSION['account']->general_homedir != $_SESSION['account_old']->general_homedir)) { echo ''; StatusMessage ('INFO', _('Home Directory has changed. You have to run the following command as root in order to change the existing homedirectory:'), 'mv ' . $_SESSION['account_old' ]->general_homedir . ' ' . $_SESSION['account']->general_homedir); - echo ''; + echo ''."\n"; } break; case 'group' : @@ -918,13 +926,13 @@ switch ($select_local) { // Select which part of page will be loaded echo ''; StatusMessage ('INFO', _('GID-number has changed. You have to run the following command as root in order to change existing file-permissions:'), 'find / -gid ' . $_SESSION['account_old' ]->general_uidNumber . ' -exec chgrp ' . $_SESSION['account']->general_uidNumber . ' {} \;'); - echo ''; + echo ''."\n"; echo ''; echo ''; echo _('Change GID-Number of all users in group to new value'); - echo ''; + echo ''."\n"; } break; case 'host': @@ -932,29 +940,29 @@ switch ($select_local) { // Select which part of page will be loaded echo ''; StatusMessage ('INFO', _('UID-number has changed. You have to run the following command as root in order to change existing file-permissions:'), 'find / -gid ' . $_SESSION['account_old' ]->general_uidNumber . ' -exec chown ' . $_SESSION['account']->general_uidNumber . ' {} \;'); - echo ''; + echo ''."\n"; } break; } echo ' - - + '."\n".' + '."\n".' '._('Help').' - + '."\n".' - '; + '."\n"; break; case 'finish': // Final Settings echo ''; echo _('Success'); - echo ''; + echo ''."\n"; switch ( $_SESSION['type2'] ) { case 'user' : echo ''; @@ -964,11 +972,11 @@ switch ($select_local) { // Select which part of page will be loaded else echo _(' has been created. '); if (!$_SESSION['account_old']) { echo ''; } - echo ' + echo ''."\n".' - - - '; + '."\n".' + + '."\n"; break; case 'group' : echo ''; @@ -976,12 +984,12 @@ switch ($select_local) { // Select which part of page will be loaded echo $_SESSION['account']->general_username; if ($_SESSION['account_old']) echo _(' has been modified. '); else echo _(' has been created. '); - echo ''; + echo ''."\n".''; if (!$_SESSION['account_old']) { echo' '; } echo ' - - '; + + '."\n"; break; case 'host' : echo ''; @@ -989,12 +997,12 @@ switch ($select_local) { // Select which part of page will be loaded echo $_SESSION['account']->general_username; if ($_SESSION['account_old']) echo _(' has been modified. '); else echo _(' has been created. '); - echo ''; + echo ''."\n".''; if (!$_SESSION['account_old']) { echo ''; } - echo ' - - '; + echo ''."\n".' + + '."\n"; break; } break;