diff --git a/lam/index.html b/lam/index.html index 12a79d8d..0d6cfa0f 100644 --- a/lam/index.html +++ b/lam/index.html @@ -1,7 +1,7 @@ LDAP Account Manager -'; + diff --git a/lam/lib/account.inc b/lam/lib/account.inc index acefbaef..49c2fcde 100644 --- a/lam/lib/account.inc +++ b/lam/lib/account.inc @@ -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; $iscriptServer ." ".$_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 diff --git a/lam/templates/account/groupedit.php b/lam/templates/account/groupedit.php index eeeb6fc4..8e84cdf0 100644 --- a/lam/templates/account/groupedit.php +++ b/lam/templates/account/groupedit.php @@ -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; $jquota); $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 ""; echo _("Create new Account"); echo "\n". - "\n". + "\n". "\n". "\n"; @@ -266,7 +287,7 @@ do { // X-Or, only one if() can be true } if ($_POST['backmain']) { $select_local='backmain'; - echo "\n"; + echo "\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; $jquota); $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 ""; echo " "; echo "\">

"; - echo ""._('Help')."\n"; + echo ""._('Help')."\n"; echo "
"; echo _('Available users'); echo "\n"; @@ -407,14 +456,14 @@ switch ($select_local) { // Select which part of page will be loaded echo _("Groupname")."*"; echo "\n". "general_username."\">". - "\n"._('Help')."\n\n\n"; + "\n"._('Help')."\n\n\n"; echo _('GID number'); echo "\ngeneral_uidNumber."\">". - "\n"._('Help'). + "\n"._('Help'). "\n\n\n"; echo _('Description'); echo "\ngeneral_gecos."\">\n". - ""._('Help')."\n\n\n"; + ""._('Help')."\n\n\n"; echo _('Suffix'); echo "\n\n"._('Help'). + echo "\n"._('Help'). "\n\n"; echo _('Values with * are required'); echo "
\n"; @@ -437,7 +486,7 @@ switch ($select_local) { // Select which part of page will be loaded foreach ($profilelist as $profile) echo " \n"; echo "\n". ""; + echo "\">"; echo _('Help')."\n\n\n\n"; } echo "\n\n\n"; @@ -471,7 +520,7 @@ switch ($select_local) { // Select which part of page will be loaded echo _("Display name"); echo "\n". "smb_displayName."\">". - "\n"._('Help')."\n\n\n"; + "\n"._('Help')."\n\n\n"; echo _('Windows groupname'); echo "\n\n". - ''._('Help').''. + ''._('Help').''. ''."\n".''; echo _('Domain'); echo ''."\n".''._('Help').''."\n"; + echo ''."\n".''._('Help').''."\n"; echo "\n\n\n\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 ''."\n".''; echo _('Hard block limit'); echo ''."\n".''; echo _('Grace block period'); echo ''."\n".''; echo _('Used inodes'); echo ''."\n".''; echo _('Soft inode limit'); echo ''."\n".''; echo _('Hard inode limit'); echo ''."\n".''; echo _('Grace inode period'); echo ''."\n"; - echo ''._('Help').''."\n".''._('Help').''."\n".''. - ''._('Help').''."\n".''._('Help').''."\n".''. - ''._('Help').''."\n".''._('Help').''."\n".''. - ''._('Help').''."\n".''._('Help').''."\n".''. - ''._('Help').''."\n"; + echo ''._('Help').''."\n".''._('Help').''."\n".''. + ''._('Help').''."\n".''._('Help').''."\n".''. + ''._('Help').''."\n".''._('Help').''."\n".''. + ''._('Help').''."\n".''._('Help').''."\n".''. + ''._('Help').''."\n"; $i=0; while ($_SESSION['account']->quota[$i][0]) { echo ''.$_SESSION['account']->quota[$i][0].''.$_SESSION['account']->quota[$i][1].''; // 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 ''; echo "\n"; echo "\n\n\n
"; @@ -682,7 +718,7 @@ switch ($select_local) { // Select which part of page will be loaded echo ''; echo "'._('Help'); + echo '">'._('Help'); echo "
\n\n\n\n"; echo "
"; 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 ''; + echo ''; echo _('Please press here if meta-refresh didn\'t work.'); echo "\n"; if (isset($_SESSION['shelllist'])) unset($_SESSION['shelllist']); diff --git a/lam/templates/account/hostedit.php b/lam/templates/account/hostedit.php index 88005b52..aa66d61e 100644 --- a/lam/templates/account/hostedit.php +++ b/lam/templates/account/hostedit.php @@ -182,7 +182,7 @@ echo $_SESSION['header']; echo ""; echo _("Create new Account"); echo "\n". - "\n". + "\n". "\n". "\n"; @@ -249,7 +249,7 @@ do { // X-Or, only one if() can be true break; } if ($_POST['backmain']) { - echo "\n"; + echo "\n"; $select_local='backmain'; break; } @@ -310,13 +310,13 @@ switch ($select_local) { // Select which part of page will be loaded echo ''."\n".''. ''. ''. - ''._('Help').''. + ''._('Help').''. ''."\n".''; echo _('UID number'); echo ''."\n".''. ''. ''."\n".''. - ''._('Help').''. + ''._('Help').''. ''."\n".''; echo _('Primary group').'*'; echo ''."\n".''. - ''._('Help').''. + ''._('Help').''. ''."\n".''; echo _('Gecos'); echo ''. ''."\n".''. - ''._('Help').''. + ''._('Help').''. ''; echo _('Suffix'); echo ''._('Help').''. + echo ''._('Help').''. "\n\n"; echo _('Values with * are required'); echo "
\n"; @@ -353,7 +353,7 @@ switch ($select_local) { // Select which part of page will be loaded foreach ($profilelist as $profile) echo " \n"; echo "\n". ""; + echo "\">"; echo _('Help')."\n\n\n\n"; } echo "\n\n\n"; @@ -385,7 +385,7 @@ switch ($select_local) { // Select which part of page will be loaded echo _("Display name"); echo "\n". "smb_displayName."\">". - "\n"._('Help')."\n\n\n"; + "\n"._('Help')."\n\n\n"; echo _('Password'); echo ''; if (isset($_SESSION['account_old'])) { @@ -397,7 +397,7 @@ switch ($select_local) { // Select which part of page will be loaded echo ''."\n".'smb_flagsD) echo ' checked '; echo '>'. - ''._('Help').''. + ''._('Help').''. ''."\n".''; echo ''."\n".''; echo _('Domain'); @@ -416,7 +416,7 @@ switch ($select_local) { // Select which part of page will be loaded else { echo ''."\n".''; } - echo ''."\n".''._('Help').''."\n"; + echo ''."\n".''._('Help').''."\n"; echo "\n\n\n\n"; break; @@ -446,7 +446,7 @@ switch ($select_local) { // Select which part of page will be loaded echo ''; echo ''._('Help'); + echo '">'._('Help'); echo "\n\n\n\n\n\n"; echo "
"; 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 ''; + echo ''; echo _('Please press here if meta-refresh didn\'t work.'); echo "\n"; if (isset($_SESSION['shelllist'])) unset($_SESSION['shelllist']); diff --git a/lam/templates/account/useredit.php b/lam/templates/account/useredit.php index 01ab6bc8..b160e809 100644 --- a/lam/templates/account/useredit.php +++ b/lam/templates/account/useredit.php @@ -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 + + 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; $jquota); $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 ""; echo _("Create new Account"); echo "\n". - "\n". + "\n". "\n". "\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; $jquota); $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 "\n"; + echo "\n"; $select_local='backmain'; break; } @@ -598,7 +648,7 @@ switch ($select_local) { // Select which part of page will be loaded echo ""; echo " "; echo "\">

"; - echo ""._('Help-XX')."\n"; + echo ""._('Help-XX')."\n"; echo "
"; echo _('Available workstations'); echo "\n"; @@ -653,25 +703,25 @@ switch ($select_local) { // Select which part of page will be loaded echo "\n". ''. ''. - ''._('Help').''. + ''._('Help').''. ''."\n".''; echo _('UID number'); echo ''."\n".''. ''. ''."\n".''. - ''._('Help').''. + ''._('Help').''. ''."\n".''; echo _('Given name').'*'; echo ''."\n".''. ''. ''."\n".''. - ''._('Help').''. + ''._('Help').''. ''."\n".''."\n".''; echo _('Surname').'*'; echo ''."\n".''. ''. ''. - ''._('Help').''. + ''._('Help').''. ''."\n".''; echo _('Primary group').'*'; echo ''."\n".''. - ''._('Help').''. + ''._('Help').''. ''."\n".''; echo _('Additional groups'); echo ''."\n".''."\n".''. - ''._('Help').''. + ''._('Help').''. ''."\n".''; echo _('Home directory').'*'; echo ''."\n".''. ''."\n".''. - ''._('Help').''. + ''._('Help').''. ''."\n".''; echo _('Gecos'); echo ''."\n".''. ''."\n".''. - ''._('Help').''. + ''._('Help').''. ''."\n".''; echo _('Login shell').'*'; echo ''."\n".''."\n".''. - ''._('Help').''. + ''._('Help').''. ''."\n".''; echo _('Suffix'); echo ''._('Help'). + echo ''._('Help'). "\n\n"; echo _('Values with * are required'); echo "
\n"; @@ -736,7 +786,7 @@ switch ($select_local) { // Select which part of page will be loaded foreach ($profilelist as $profile) echo " \n"; echo "\n". ""; + echo "\">"; echo _('Help')."\n\n\n
\n"; } echo "\n\n\n"; @@ -786,27 +836,27 @@ switch ($select_local) { // Select which part of page will be loaded echo ''."\n".'unix_password_no) echo ' checked '; echo '>'."\n".''. - ''._('Help').''. + ''._('Help').''. ''."\n".''; echo _('Password warn'); echo ''."\n".''. ''."\n".''. - ''._('Help').''. + ''._('Help').''. ''."\n".''; echo _('Password expire'); echo ''."\n".''. ''."\n".''. - ''._('Help').''. + ''._('Help').''. ''."\n".''; echo _('Maximum password age'); echo ''."\n".''. ''."\n".''. - ''._('Help').''. + ''._('Help').''. ''."\n".''; echo _('Minimum password age'); echo ''."\n".''. ''."\n".''. - ''._('Help').''. + ''._('Help').''. ''."\n".''; echo _('Expire date'); echo ''."\n".''."\n".''. - ''._('Help').''. + ''._('Help').''. ''."\n".''; echo _('Account deactivated'); echo ''."\n".'unix_deactivated) echo ' checked '; echo '>'."\n".''. - ''._('Help').''. + ''._('Help').''. ''."\n".''; echo _('Unix workstations'); echo ''."\n".''. ''."\n".''. - ''._('Help'). + ''._('Help'). "\n\n"; echo _('Values with * are required'); echo "\n\n\n"; @@ -890,7 +940,7 @@ switch ($select_local) { // Select which part of page will be loaded echo _("Display name"); echo "\n". "smb_displayName."\">". - "\n"._('Help')."\n\n\n"; + "\n"._('Help')."\n\n\n"; echo _('Samba password'); echo ''."\n".''. ''."\n".''; @@ -898,19 +948,19 @@ switch ($select_local) { // Select which part of page will be loaded echo 'smb_useunixpwd) echo ' checked '; echo '>'."\n".''. - ''._('Help').''; + ''._('Help').''; echo ''."\n".''; echo _('Use no password'); echo ''."\n".'smb_password_no) echo ' checked '; echo '>'."\n".''. - ''._('Help').''. + ''._('Help').''. ''."\n".''; echo _('Password does not expire'); echo ''."\n".'smb_flagsX) echo ' checked '; echo '>'."\n".''. - ''._('Help').''. + ''._('Help').''. ''."\n".''; echo _('User can change password'); echo ''."\n".''."\n".''; - echo ''._('Help').''. + echo ''._('Help').''. ''."\n".''; echo _('User must change password'); echo ''."\n".''."\n".''; - echo ''._('Help').''. + echo ''._('Help').''. ''."\n".''; echo _('Account is deactivated'); echo ''."\n".'smb_flagsD) echo ' checked '; echo '>'."\n".''. - ''._('Help').''. + ''._('Help').''. ''."\n".''; echo _('Home drive'); echo ''."\n".''."\n".''. - ''._('Help').''. + ''._('Help').''. ''."\n".''; echo _('Home path'); echo ''."\n".''. ''."\n".''. - ''._('Help').''. + ''._('Help').''. ''."\n".''; echo _('Profile path'); echo ''."\n".''. ''."\n".''. - ''._('Help').''. + ''._('Help').''. ''."\n".''; echo _('Script path'); echo ''."\n".''. ''."\n".''. - ''._('Help').''. + ''._('Help').''. ''."\n".''; echo _('Samba workstations'); echo ''."\n".''. ''."\n".''. - ''._('Help').''. + ''._('Help').''. ''."\n".''; echo _('Windows groupname'); echo ''."\n".''."\n".''. - ''._('Help').''. + ''._('Help').''. ''."\n".''; echo _('Domain'); if ($_SESSION['config']->is_samba3()) { @@ -1081,13 +1131,13 @@ switch ($select_local) { // Select which part of page will be loaded else { echo ''."\n".''; } - echo ''."\n".''._('Help').''."\n"; + echo ''."\n".''._('Help').''."\n"; echo "\n\n\n\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 ''."\n".''; echo _('Hard block limit'); echo ''."\n".''; echo _('Grace block period'); echo ''."\n".''; echo _('Used inodes'); echo ''."\n".''; echo _('Soft inode limit'); echo ''."\n".''; echo _('Hard inode limit'); echo ''."\n".''; echo _('Grace inode period'); echo ''."\n"; - echo ''._('Help').''."\n".''._('Help').''."\n".''. - ''._('Help').''."\n".''._('Help').''."\n".''. - ''._('Help').''."\n".''._('Help').''."\n".''. - ''._('Help').''."\n".''._('Help').''."\n".''. - ''._('Help').''."\n"; + echo ''._('Help').''."\n".''._('Help').''."\n".''. + ''._('Help').''."\n".''._('Help').''."\n".''. + ''._('Help').''."\n".''._('Help').''."\n".''. + ''._('Help').''."\n".''._('Help').''."\n".''. + ''._('Help').''."\n"; $i=0; while ($_SESSION['account']->quota[$i][0]) { echo ''.$_SESSION['account']->quota[$i][0].''.$_SESSION['account']->quota[$i][1].''; // used blocks @@ -1172,55 +1222,55 @@ switch ($select_local) { // Select which part of page will be loaded echo ''."\n".''. ' '; echo $_SESSION['account']->general_surname . ' ' . $_SESSION['account']->general_givenname . ''. - ''._('Help').''. + ''._('Help').''. ''."\n".''; echo _('Employee type'); echo ''."\n".''. ''. ''. - ''._('Help').''. + ''._('Help').''. ''."\n".''; echo _('Street'); echo ''."\n".''. ''. ''. - ''._('Help').''. + ''._('Help').''. ''."\n".''; echo _('Postal code'); echo ''."\n".''. ''. ''. - ''._('Help').''. + ''._('Help').''. ''."\n".''; echo _('Postal address'); echo ''."\n".''. ''. ''. - ''._('Help').''. + ''._('Help').''. ''."\n".''; echo _('Telephone number'); echo ''."\n".''. ''. ''. - ''._('Help').''. + ''._('Help').''. ''."\n".''; echo _('Mobile number'); echo ''."\n".''. ''. ''. - ''._('Help').''. + ''._('Help').''. ''."\n".''; echo _('Fax number'); echo ''."\n".''. ''. ''. - ''._('Help').''. + ''._('Help').''. ''."\n".''; echo _('eMail address'); echo ''."\n".''. ''. ''. - ''._('Help').''."\n"; + ''._('Help').''."\n"; echo "\n\n\n\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 ''; echo "\n\n\n"; if (isset($_SESSION['shelllist'])) unset($_SESSION['shelllist']); diff --git a/lam/templates/delete.php b/lam/templates/delete.php index 03999cfb..e8d3dd84 100644 --- a/lam/templates/delete.php +++ b/lam/templates/delete.php @@ -1,4 +1,4 @@ -'; echo _('Delete Account'); echo ''."\n". - ''."\n". + ''."\n". ''."\n". ''."\n"; diff --git a/lam/templates/masscreate.php b/lam/templates/masscreate.php index aefb5a6e..8957e5ef 100644 --- a/lam/templates/masscreate.php +++ b/lam/templates/masscreate.php @@ -58,7 +58,7 @@ if ($select!='pdf') { echo ''; echo _('Create new Accounts'); echo ''."\n". - ''."\n". + ''."\n". ''."\n". ''."\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') { ''; echo _('Please press here if meta-refresh didn\'t work.'); echo "\n"; + echo ''; + echo ''; + } else { //echo ''."\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 "
"; echo "\n\n
"; @@ -1272,7 +1309,7 @@ switch ($select_local) { // Select which part of page will be loaded echo ''; echo "
'._('Help'); + echo '">'._('Help'); echo "
\n\n
\n"; echo "
"; 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 '
'; + echo '
'; echo _('Please press here if meta-refresh didn\'t work.'); echo "
\n". - "
"; + echo "\n"; + //print_r($_SESSION['accounts']); + echo "
"; echo _('Confirm List'); echo "\n\n"; echo ''."\n".''."\n".''."\n".''."\n".''."\n".'
'._('row').''. _('Surname'). ''. _('Given name'). ''. _('User name'). ''. _('Primary group'). ''. @@ -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 ''."\n". '
'."\n". "
"; @@ -275,18 +297,33 @@ if ($select!='pdf') { echo _('Select settings'); echo "\n". '\n\n\n'."\n".''."\n".'\n\n\n'."\n".'\n\n\n'."\n". ''."\n".'\n'."\n".''."\n".'
'."\n"; - echo _('Select Profile:'); + echo _('Select user profile:'); echo ''; echo ""; echo _('Help')."
"; - echo _('Suffix'); echo ''._('Help').''. - '
'."\n". - ''; + '
'."\n"; + echo _("Expand suffix with primary groupname"); + echo ''; + echo ""; + echo _('Help-XX')."
"; + echo _('Group suffix'); echo ''._('Help-XX').''. + '
'."\n"; + echo _('Select group profile:'); + echo ''; + echo ""; + echo _('Help-XX')."
"; + echo ''; echo _('Select file:'); 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; $jquota); $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"; if ($row2<401) { for ($i=$row2+1; $igeneral_username == $_SESSION['accounts'][$i]->general_username) { // Found user with same name - print $row2."-".$i."
"; - print $_SESSION['accounts'][$row2]->general_username ."-". $_SESSION['accounts'][$i]->general_username ."
"; // 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 ."
"; // 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; $igeneral_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!')); diff --git a/lam/templates/massdetail.php b/lam/templates/massdetail.php index f401f76e..27253501 100644 --- a/lam/templates/massdetail.php +++ b/lam/templates/massdetail.php @@ -36,7 +36,7 @@ session_save_path('../sess'); echo ''; echo _('Create new accounts'); echo ''. - ''. + ''. ''. ''. ''. @@ -174,12 +174,6 @@ switch ($select) { '
'. ''._('Help').''. '
'; - echo _('Primary group').'*'; - echo "". - ''. - ''. - ''._('Help').''. - '
'; echo _('Title'); echo ''. ' ';