diff --git a/lam/lib/account.inc b/lam/lib/account.inc index 9aa7a0be..be9fdca6 100644 --- a/lam/lib/account.inc +++ b/lam/lib/account.inc @@ -54,7 +54,7 @@ class cache { } $scopes = array_keys($attributes); foreach ($scopes as $scope) { - if (!@in_array($scope, $allowed_types)) trigger_error(sprintf(_('Invalid scope. Valid scopes are $s.'), implode(" ", $allowed_types)), E_USER_ERROR); + if (!@in_array($scope, $allowed_types)) trigger_error(sprintf(_('Invalid scope. Valid scopes are %s.'), implode(" ", $allowed_types)), E_USER_ERROR); } // Everything seems to be OK, start processing data foreach ($scopes as $scope) { @@ -76,7 +76,7 @@ class cache { if (strpos($_SESSION['ldap']->objectClasses[$i], "NAME '$objectClass'")) $line = $i; } // Return error if objectClass isn't found - if ($line==-1) trigger_error (_("objectClass $objectClass required but not defined in ldap."), E_USER_WARNING); + if ($line==-1) trigger_error (sprintf(_("objectClass %s required but not defined in ldap."), $objectClass), E_USER_WARNING); // Everything seems to be OK, start processing data $this->refresh_cache(); if ($singlescope == '*') $scopes = $allowed_types; @@ -231,7 +231,7 @@ class accountContainer { var $type; var $lampath; // reference to lampath from Session var $ldap; // This is a reference to the ldap class in session - var $modules; // This is an array with all module objects + var $module; // This is an array with all module objects /* Get the type of account. Valid * types are: user, group, host @@ -249,7 +249,7 @@ class accountContainer { if (strpos($this->ldap->objectClasses[$i], "NAME '$objectClass'")) $line = $i; } // Return error if objectClass isn't found - if ($line==-1) trigger_error (_("objectClass objectClass required but not defined in ldap."), E_USER_WARNING); + if ($line==-1) trigger_error (sprintf(_("objectClass %s required but not defined in ldap."), $objectClass), E_USER_WARNING); // create array with must-attributes // Get startposition in string if (strpos($this->ldap->objectClasses[$line], 'MUST (')) { @@ -288,7 +288,7 @@ class accountContainer { if (strpos($this->ldap->objectClasses[$i], "NAME '$subclass'")) $line = $i; } // Return error if objectClass isn't found - if ($line==-1) trigger_error (_("objectClass objectClass required but not defined in ldap."), E_USER_WARNING); + if ($line==-1) trigger_error (sprintf(_("objectClass %s required but not defined in ldap."), $objectClass), E_USER_WARNING); // create array with must-attributes // Get startposition in string @@ -348,12 +348,12 @@ class accountContainer { if (strpos($_SESSION['ldap']->objectClasses[$i], "NAME '$objectClass'")) $line = $i; } // Return error if objectClass isn't found - if ($line==-1) trigger_error (_("objectClass objectClass required but not defined in ldap."), E_USER_WARNING); + if ($line==-1) trigger_error (_("objectClass $objectClass required but not defined in ldap."), E_USER_WARNING); else { // Add module if it exists if (filetype($this->lampath."/lib/modules/".$objectClass.".inc") == 'file') { include_once ($this->lampath."/lib/modules/".$objectClass.".inc"); - $this->modules[] = new $objectClass($this); + $this->module[$objectClass] = new $objectClass($this); } } return 0; diff --git a/lam/lib/modules/inetOrgPerson.inc b/lam/lib/modules/inetOrgPerson.inc index 407164c5..f3fac012 100644 --- a/lam/lib/modules/inetOrgPerson.inc +++ b/lam/lib/modules/inetOrgPerson.inc @@ -28,7 +28,7 @@ $Id$ * dn_orig: old DN if account was loaded with uid= or cn= * External functions which are used -* account.inc: array_delete +* account.inc: */ @@ -131,7 +131,7 @@ class inetOrgPerson { } } } - $this->attributes = $this->orig; + $this->orig = $this->attributes ; $this->alias = _('inetOrgPerson'); } @@ -140,7 +140,11 @@ class inetOrgPerson { var $alias; // reference to base-array so we can read other classes in basearray var $base; - // This variable contains all inetOrgPerson Attributes + // Use a unix password? + var $userPassword_no; + // Lock account? + var $userPassword_lock; + // This variable contains all inetOrgPerson attributes var $attributes; /* If an account was loaded all attributes are kept in this array * to compare it with new changed attributes @@ -149,7 +153,31 @@ class inetOrgPerson { /* $attribute['password'] can't accessed directly because it's enrcypted * To read / write password function userPassword is needed */ - + /* This function will return the unencrypted password when + * called without a variable + * If it's called with a new password, the + * new password will be stored encrypted + */ + function userPassword($newpassword=false) { + // Read existing password if set + if (!$newpassword) { + if ($this->attributes['userPassword'][0]!='') { + $iv = base64_decode($_COOKIE["IV"]); + $key = base64_decode($_COOKIE["Key"]); + $password = mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $key, base64_decode($this->attributes['userPassword'][0]), MCRYPT_MODE_ECB, $iv); + $password = str_replace(chr(00), '', $password); + return $password; + } + else return ''; + } + // Write new password + else { + $iv = base64_decode($_COOKIE["IV"]); + $key = base64_decode($_COOKIE["Key"]); + $this->attributes['userPassword'][0] = base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $key, $newpassword, MCRYPT_MODE_ECB, $iv)); + return 0; + } + } /* This function returns a list with all required modules */ @@ -162,16 +190,45 @@ class inetOrgPerson { */ function proccess_attributes() { // Load attributes + if (($this->attributes['uid'] != $_POST['form_inetOrgPerson_uid']) && ereg('[A-Z]$', $_POST['form_inetOrgPerson_uid'])) + $errors[] = array('WARN', _('Username'), _('You are using a capital letters. This can cause problems because windows isn\'t case-sensitive.')); $this->attributes['uid'] = $_POST['form_inetOrgPerson_uid']; - $this->attributes['cn'] &= $this->attributes['cn']; + $this->attributes['cn'] &= $this->attributes['uid']; + $this->attributes['description'] = $_POST['form_inetOrgPerson_description']; + $this->attributes['sn'] = $_POST['form_inetOrgPerson_sn']; + $this->attributes['givenName'] = $_POST['form_inetOrgPerson_givenName']; + $this->attributes['title'] = $_POST['form_inetOrgPerson_title']; + $this->attributes['mail'] = $_POST['form_inetOrgPerson_mail']; + $this->attributes['telephoneNumber'] = $_POST['form_inetOrgPerson_telephoneNumber']; + $this->attributes['mobileTelephoneNumber'] = $_POST['form_inetOrgPerson_mobileTelephoneNumber']; + $this->attributes['facsimileTelephoneNumber'] = $_POST['form_inetOrgPerson_facsimileTelephoneNumber']; + $this->attributes['street'] = $_POST['form_inetOrgPerson_street']; + $this->attributes['postalCode'] = $_POST['form_inetOrgPerson_postalCode']; + $this->attributes['postalAddress'] = $_POST['form_inetOrgPerson_postalAddress']; + $this->attributes['employeeType'] = $_POST['form_inetOrgPerson_employeeType']; + if ($_POST['form_inetOrgPerson_userPassword_no']; $this->userPassword_no=true; + else $this->userPassword_no=false; + if ($_POST['form_inetOrgPerson_userPassword_lock']; $this->userPassword_lock=true; + else $this->userPassword_lock=false; + if (isset($_POST['form_inetOrgPerson_userPassword'])) { + if ($_POST['form_inetOrgPerson_userPassword'] != $_POST['form_inetOrgPerson_userPassword2']) { + $errors[] = array('ERROR', _('Password'), _('Please enter the same password in both password-fields.')); + unset ($_POST['form_inetOrgPerson_userPassword2']); + } + else $this->userPassword($_POST['form_inetOrgPerson_userPassword']); + } + if ($_POST['form_inetOrgPerson_genpass']) $this->userPassword(genpasswd()); + + // Check if givenname is valid + if ( !ereg('^([a-z]|[A-Z]|[-]|[ ]|[ä]|[Ä]|[ö]|[Ö]|[ü]|[Ü]|[ß])+$', $this->attributes['givenName'])) $errors[] = array('ERROR', _('Given name'), _('Given name contains invalid characters')); + // Check if surname is valid + if ( !ereg('^([a-z]|[A-Z]|[-]|[ ]|[ä]|[Ä]|[ö]|[Ö]|[ü]|[Ü]|[ß])+$', $this->attributes['sn'])) $errors[] = array('ERROR', _('Surname'), _('Surname contains invalid characters')); // Check if Username contains only valid characters if ( !ereg('^([a-z]|[A-Z]|[0-9]|[.]|[-]|[_])*$', $this->attributes['uid'])) $errors[] = array('ERROR', _('Username'), _('Username contains invalid characters. Valid characters are: a-z, A-Z, 0-9 and .-_ !')); - // Create automatic useraccount with number if original user already exists // Reset name to original name if new name is in use - // *** fixme make incache modularized. Incache will return the found attribute // Set username back to original name if new username is in use if (incache($this->attributes['uid'],'uid', '*')!=$this->orig['uid'] && ($this->orig['uid']!='')) $this->attributes['uid'] = $this->orig['uid']; // Change uid to a new uid until a free uid is found @@ -207,8 +264,18 @@ class inetOrgPerson { } // Show warning if lam has changed username if ($this->attributes['uid'] != $_POST['form_inetOrgPerson_uid']) $errors[] = array('WARN', _('Username'), _('Username in use. Selected next free username.')); + if (!ereg('^([a-z]|[A-Z]|[0-9]|[\|]|[\#]|[\*]|[\,]|[\.]|[\;]|[\:]|[\_]|[\-]|[\+]|[\!]|[\%]|[\&]|[\/]|[\?]|[\{]|[\[]|[\(]|[\)]|[\]]|[\}])*$', $this->userPassword())) + $errors[] = array('ERROR', _('Password'), _('Password contains invalid characters. Valid characters are: a-z, A-Z, 0-9 and #*,.;:_-+!$%&/|?{[()]}= !')); - + if ( !ereg('^(\+)*([0-9]|[ ]|[.]|[(]|[)]|[/]|[-])*$', $this->attributes['telephoneNumber'])) $errors[] = array('ERROR', _('Telephone number'), _('Please enter a valid telephone number!')); + if ( !ereg('^(\+)*([0-9]|[ ]|[.]|[(]|[)]|[/]|[-])*$', $this->attributes['mobileTelephoneNumber'])) $errors[] = array('ERROR', _('Mobile number'), _('Please enter a valid mobile number!')); + if ( !ereg('^(\+)*([0-9]|[ ]|[.]|[(]|[)]|[/]|[-])*$', $this->attributes['facsimileTelephoneNumber'])) $errors[] = array('ERROR', _('Fax number'), _('Please enter a valid fax number!')); + if ( !ereg('^(([0-9]|[A-Z]|[a-z]|[.]|[-]|[_])+[@]([0-9]|[A-Z]|[a-z]|[-])+([.]([0-9]|[A-Z]|[a-z]|[-])+)*)*$', $this->attributes['mail'])) $errors[] = array('ERROR', _('eMail address'), _('Please enter a valid eMail address!')); + if ( !ereg('^([0-9]|[A-Z]|[a-z]|[-]|[ ]|[.]|[Ä]|[ä]|[Ö]|[ö]|[Ü]|[ü]|[ß])*$', $this->attributes['street'])) $errors[] = array('ERROR', _('Street'), _('Please enter a valid street name!')); + if ( !ereg('^([0-9]|[A-Z]|[a-z]|[ ]|[.]|[Ä]|[ä]|[Ö]|[ö]|[Ü]|[ü]|[ß])*$', $this->attributes['postalAddress'])) $errors[] = array('ERROR', _('Postal address'), _('Please enter a valid postal address!')); + if ( !ereg('^([0-9]|[A-Z]|[a-z]|[-]|[ ]|[.]|[Ä]|[ä]|[Ö]|[ö]|[Ü]|[ü]|[ß])*$', $this->attributes['title'])) $errors[] = array('ERROR', _('Title'), _('Please enter a valid title!')); + if ( !ereg('^([0-9]|[A-Z]|[a-z]|[ ]|[.]|[Ä]|[ä]|[Ö]|[ö]|[Ü]|[ü]|[ß])*$', $this->attributes['employeeType'])) $errors[] = array('ERROR', _('Employee type'), _('Please enter a valid employee type!')); + if ( !ereg('^([0-9]|[A-Z]|[a-z])*$', $this->attributes['personal_postalCode'])) $errors[] = array('ERROR', _('Postal code'), _('Please enter a valid postal code!')); // Return error-messages if (is_array($errors)) return $errors; return 0; @@ -219,7 +286,24 @@ class inetOrgPerson { */ function load_attributes($attr) { // Load attributes which are displayed + // unset count entries + unset ($attr['count']); + $attributes = array_keys($attr); + foreach ($attributes as $attribute) unset ($attr[$attribute]['count']); + // unset double entries + for ($i=0; $iattributes[$attribute])) { + // decode as unicode + for ($i=0; $iattributes[$attribute]); $i++) $this->attributes[$attribute][$i] = utf8_decode ($this->attributes[$attribute][$i]); + $this->attributes[$attribute] = $attr[$attribute]; + } + } // Values are kept as copy so we can compare old attributes with new attributes + $this->orig = $this->attributes; + $this->userPassword(''); // Remove old password so it won't displayed as hash + return 0; } @@ -230,80 +314,74 @@ class inetOrgPerson { * e.g. create a new user and add him to some groups via attribute memberUid * add are attributes which have to be added to ldap entry * remove are attributes which have to be removed from ldap entry - * modify are attributes which have to been modified in ldap entry */ function save_attributes() { - /* Exmaples - * Add new attribute - * if ($this->cn!='' && $this->orig['cn']=='') $return[$this->base['dn']]['add']['cn'] = $this->cn; - * Modify existing attribute - * if ($this->cn!='' && $this->orig['cn']!='') $return[$this->base['dn']]['modify']['cn'] = $this->cn; - * Remove existing attribute - * if ($this->cn=='' && $this->orig['cn']!='') $return[$this->base['dn']]['remove']['cn'] = $this->cn; - */ - // Get list off all attributes $attributes = $this->orig; // Remove attributes which are not as easy to set - unset ($attributes['enc_userPassword']); - unset ($attributes['groups']); + unset ($attributes['userPassword']); // Get list of all "easy" attributes $attr_names = array_keys($attributes); foreach ($attr_names as $attr_name) { - if ($this->$attr_name!='' && $this->orig[$attr_name]=='') $return[$this->base['dn']]['add'][$attr_name] = $this->cn; - if ($this->$attr_name!='' && $this->orig[$attr_name]!='') $return[$this->base['dn']]['modify'][$attr_name] = $this->cn; - if ($this->$attr_name=='' && $this->orig[$attr_name]!='') $return[$this->base['dn']]['remove'][$attr_name] = $this->cn; + // *** fixme, encode as unicode + if (count($this->attributes[$attr_name])!=0 && count($this->orig[$attr_name])==0) $return[$this->base['dn']]['add'][$attr_name] = $this->attributes[$attr_name]; + if (count($this->attributes[$attr_name])!=0 && count($this->orig[$attr_name])!=0) { + // We have to check every single attribute + // Get attributes which should be added + $attributes = ldap_delete($this->orig[$attr_name], $this->attributes[$attr_name]); + // Encode as unicode + for ($i=0; $ibase['dn']]['add'][$attr_name] = $attributes; + // Get attributes which should be removed + $attributes = ldap_delete($this->attributes[$attr_name], $this->orig[$attr_name]); + // Encode as unicode + for ($i=0; $ibase['dn']]['remove'][$attr_name] = $attributes; + } + if (count($this->attributes[$attr_name])==0 && count($this->orig[$attr_name])!=0) $return[$this->base['dn']]['remove'][$attr_name] = $this->orig[$attr_name]; } // Set unix password - if ($this->orig['enc_userPassword']=='') { + if (count($this->orig['userPassword'])==0) { // New user or no old password set - if ($this->userPassword_no) $return[$this->base['dn']]['modify']['userPassword'] = pwd_hash ('', !$this->userPassword_lock); - else $return[$this->base['dn']]['modify']['userPassword'] = pwd_hash ($this->userPassword(), !$this->userPassword_lock); + if ($this->userPassword_no) { + $return[$this->base['dn']]['add']['userPassword'][0] = pwd_hash ('', !$this->userPassword_lock); + } + else $return[$this->base['dn']]['add']['userPassword'][0] = utf8_encode(pwd_hash ($this->userPassword(), !$this->userPassword_lock)); } else { if ($this->userPassword()!='' || $this->userPassword_no) { // Write new password - if ($this->userPassword_no) $return[$this->base['dn']]['modify']['userPassword'] = pwd_hash ('', !$this->userPassword_lock); - else $return[$this->base['dn']]['modify']['userPassword'] = pwd_hash ($this->userPassword(), !$this->userPassword_lock); + $return[$this->base['dn']]['remove']['userPassword'] = utf8_encode($this->orig['userPassword']); + if ($this->userPassword_no) $return[$this->base['dn']]['modify']['userPassword'][0] = pwd_hash ('', !$this->userPassword_lock); + else $return[$this->base['dn']]['modify']['userPassword'][0] = utf8_encode(pwd_hash ($this->userPassword(), !$this->userPassword_lock)); } else { // No new password but old password // (un)lock password - if ($this->userPassword_lock == pwd_is_enabled($this->orig['enc_userPassword'])) { + if ($this->userPassword_lock == pwd_is_enabled($this->orig['userPassword'])) { // Split old password hash in {CRYPT} and password-hash $i = 0; - while ($this->orig['enc_userPassword']{$i} != '}') $i++; - $passwd = substr($this->orig['enc_userPassword'], $i+1 ); - $crypt = substr($this->orig['enc_userPassword'], 0, $i+1 ); + while ($this->orig['userPassword']{$i} != '}') $i++; + $passwd = substr($this->orig['userPassword'], $i+1 ); + $crypt = substr($this->orig['userPassword'], 0, $i+1 ); // remove trailing ! from password hash if ($passwd{0} == '!') $passwd = substr($passwd, 1); // Write new password - if ($this->userPassword_lock) $return[$this->base['dn']]['modify']['userPassword'] = "$crypt!$passwd"; - else $return[$this->base['dn']]['modify']['userPassword'] = "$crypt$passwd"; + $return[$this->base['dn']]['remove']['userPassword'] = utf8_encode($this->orig['userPassword']); + if ($this->userPassword_lock) $return[$this->base['dn']]['modify']['userPassword'][0] = utf8_encode("$crypt!$passwd"); + else $return[$this->base['dn']]['modify']['userPassword'][0] = utf8_encode("$crypt$passwd"); } } } } /* This function returns all ldap attributes - * which are part of posixAccount and returns + * which are part of inetOrgPerson and returns * also their values. */ function get_attributes() { - if ($userPassword_no) $return['userPassword'] = ''; - else $return['userPassword'] = $this->userPassword(); - $return['cn'] = $this->cn; - $return['uid'] = $this->uid; - $return['uidNumber'] = $this->uidNumber; - $return['gidNumber'] = $this->gidNumber; - $return['homeDirectory'] = $this->homeDirectory; - $return['loginShell'] = $this->loginShell; - $return['gecos'] = $this->gecos; - $return['description'] = $this->description; - // Not really ldap attributes but return values may be required - $return['groups'] = $this->groups; - if ($userPassword_lock) $return['userPasswordLocked'] = true; - else $return['userPasswordLocked'] = false; + $return = $this->attributes; + $return['userPassword'] = $this->userPassword(); return $return; } @@ -312,141 +390,103 @@ class inetOrgPerson { * It will output a complete html-table */ function display_html_attributes() { - $groups = findgroups(); // list of all groupnames - $shelllist = getshells(); // list of all valid shells echo "\n\n"; echo '\n"; - echo "\n"; + echo "\n"; echo "\n"; echo "\n"; echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - if ($this->base['type']=='user') { - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - } - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; echo "\n"; - echo "\n"; + echo "\n"; echo "\n"; echo "\n"; - if ($this->base['type']=='user') { - if (count($shelllist)!=0) { - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - } - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - } + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n" ; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; echo "
' . _('Username') . "*uid\">attributes['uid'][0]."\">" . _('Help') . "
" . _('UID number') . "uidNumber\">" . _('Help') . "
" . _('Primary group') . "*" . _('Help') . "
" . _('Additional groups') . "" . _('Help') . "
" . _('Home directory') . "*homeDirectory\">" . _('Help') . "
" . _('Gecos') . "gecos\">" . _('Help') . "
" . _('Description') . "description\">attributes['description'][0]."\">" . _('Help') . "
" . _('Login shell') . "*" . _('Help') . "
" . _('Password') . "userPassword()\">
" . _('Repeat password') . "userPassword(); - echo "\">
" . _('Use no password') . "userPassword_no) echo " checked "; - echo ">" . _('Help') . "
" . _('Password') . "userPassword()."\">
" . _('Repeat password') . "userPassword(); + echo "\">
" . _('Use no password') . "userPassword_no) echo " checked "; + echo ">" . _('Help') . "
" . _('Lock password') . "userPassword_no) echo " checked "; + echo ">" . _('Help') . "
" . _('Title') . "attributes['title'][0]."\">" . _('Help') . "
" . _('First name') . "*attributes['givenName'][0]."\">" . _('Help') . "
" . _('Last name') . "*attributes['sn'][0]."\">" . _('Help') . "
" . _('Employee type') . "attributes['employeeType'][0]."\">" . _('Help') . "
" . _('Street') . "attributes['street'][0]."\">" . _('Help') . "
" . _('Postal code') . "attributes['postalCode'][0]."\">" . _('Help') . "
" . _('Postal address') . "attributes['postalAddress'][0]."\">" . _('Help') . "
" . _('Telephone number') . "attributes['telephoneNumber'][0]."\">" . _('Help') . "
" . _('Mobile number') . "attributes['mobileTelephoneNumber'][0]."\">" . _('Help') . "
" . _('Fax number') . "attributes['facsimileTelephoneNumber'][0]."\">" . _('Help') . "
" . _('eMail address') . "attributes['mail'][0]."\">" . _('Help') . "
\n"; return 0; } - function display_html_group() { - // load list with all groups - $dn_groups = getcache('uidNumber', 'posixGroup', 'group'); - foreach ($dn_groups as $group) $groups[] = $group[0]; - // sort groups - sort($groups, SORT_STRING); - // remove groups the user is member of from grouplist - $groups = array_delete($this->groups, $groups); - // *** fixme primary group mut also be removed if it has changed after setting additional groups - // Remove primary group from grouplist - $groups = array_flip($groups); - if (isset($groups[getgrnam($this->gidNumber)])) unset ($groups[getgrnam($this->gidNumber)]); - $groups = array_flip($groups); - - echo "\n\n"; - echo "
"; - echo "" . _("Additional groups") . "\n"; - echo "\n\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "
"; - echo "
"; - echo "" . _("Selected groups") . "\n"; - // Show all groups the user is additional member of - if (count($this->groups)!=0) { - echo "\n"; - } - echo "
"; - echo " "; - echo "\">

"; - echo ""._('Help')."
\n"; - echo "
"; - echo "" . _('Available groups') . "\n"; - // show all groups expect these the user is member of - if (count($groups)!=0) { - echo "\n"; - } - echo "
\n"; - echo "\n"; - echo "
\n"; - echo "
\n"; - return 0; - } - }