2003-12-12 00:52:35 +00:00
< ? php
/*
$Id $
2009-10-27 18:47:12 +00:00
This code is part of LDAP Account Manager ( http :// www . ldap - account - manager . org / )
2006-03-03 17:30:35 +00:00
Copyright ( C ) 2003 - 2006 Tilo Lutz
2013-01-13 10:40:47 +00:00
2005 - 2013 Roland Gruber
2003-12-12 00:52:35 +00:00
This program is free software ; you can redistribute it and / or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation ; either version 2 of the License , or
( at your option ) any later version .
This program is distributed in the hope that it will be useful ,
but WITHOUT ANY WARRANTY ; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
GNU General Public License for more details .
You should have received a copy of the GNU General Public License
along with this program ; if not , write to the Free Software
Foundation , Inc . , 59 Temple Place , Suite 330 , Boston , MA 02111 - 1307 USA
*/
2004-07-02 12:09:06 +00:00
/**
* Manages the atrributes of object class inetOrgPerson .
*
* @ package modules
* @ author Tilo Lutz
* @ author Roland Gruber
* @ author Michael Duergner
2003-12-12 00:52:35 +00:00
*/
2004-07-02 12:09:06 +00:00
/**
2007-06-24 17:54:23 +00:00
* This module manages LDAP attributes of the object class inetOrgPerson ( e . g . name and address ) .
2004-07-02 12:09:06 +00:00
*
* @ package modules
2003-12-12 00:52:35 +00:00
*/
2009-10-10 12:47:40 +00:00
class inetOrgPerson extends baseModule implements passwordService {
2007-11-14 13:07:11 +00:00
2010-11-21 14:43:09 +00:00
/** caches the list of possible managers */
private $cachedManagers = null ;
2012-07-15 12:05:47 +00:00
/** clear text password */
2011-05-16 17:32:32 +00:00
private $clearTextPassword = null ;
2013-03-24 15:25:01 +00:00
/** cache for departments */
private $departmentCache = null ;
/** organization cache */
private $oCache = null ;
/** organizational unit cache */
private $ouCache = null ;
/** title cache */
private $titleCache = null ;
/** employee type cache */
private $employeeTypeCache = null ;
/** business category cache */
private $businessCategoryCache = null ;
2010-11-21 14:43:09 +00:00
2013-03-30 14:22:11 +00:00
/** session variable for existing user certificates in self service */
const SESS_CERTIFICATES_LIST = 'inetOrgPerson_certificatesList' ;
2004-06-24 09:51:12 +00:00
/**
2005-08-15 18:36:56 +00:00
* This function fills the message array .
2004-09-26 13:48:52 +00:00
**/
function load_Messages () {
2004-10-28 15:14:54 +00:00
$this -> messages [ 'givenName' ][ 0 ] = array ( 'ERROR' , _ ( 'First name' ), _ ( 'First name contains invalid characters!' ));
2013-04-06 15:01:19 +00:00
$this -> messages [ 'givenName' ][ 1 ] = array ( 'ERROR' , _ ( 'Account %s:' ) . ' inetOrgPerson_firstName' , _ ( 'First name contains invalid characters!' ));
2006-07-23 15:06:49 +00:00
$this -> messages [ 'lastname' ][ 0 ] = array ( 'ERROR' , _ ( 'Last name' ), _ ( 'Last name contains invalid characters or is empty!' ));
2013-04-06 15:01:19 +00:00
$this -> messages [ 'lastname' ][ 1 ] = array ( 'ERROR' , _ ( 'Account %s:' ) . ' inetOrgPerson_lastName' , _ ( 'Last name contains invalid characters or is empty!' ));
2004-09-26 13:48:52 +00:00
$this -> messages [ 'telephoneNumber' ][ 0 ] = array ( 'ERROR' , _ ( 'Telephone number' ), _ ( 'Please enter a valid telephone number!' ));
2004-10-23 11:11:31 +00:00
$this -> messages [ 'telephoneNumber' ][ 1 ] = array ( 'ERROR' , _ ( 'Account %s:' ) . ' inetOrgPerson_telephone' , _ ( 'Please enter a valid telephone number!' ));
2007-06-11 18:19:05 +00:00
$this -> messages [ 'homePhone' ][ 0 ] = array ( 'ERROR' , _ ( 'Home telephone number' ), _ ( 'Please enter a valid telephone number!' ));
$this -> messages [ 'homePhone' ][ 1 ] = array ( 'ERROR' , _ ( 'Account %s:' ) . ' inetOrgPerson_homePhone' , _ ( 'Please enter a valid telephone number!' ));
2004-09-26 13:48:52 +00:00
$this -> messages [ 'mobileTelephone' ][ 0 ] = array ( 'ERROR' , _ ( 'Mobile number' ), _ ( 'Please enter a valid mobile number!' ));
2004-10-23 11:11:31 +00:00
$this -> messages [ 'mobileTelephone' ][ 1 ] = array ( 'ERROR' , _ ( 'Account %s:' ) . " inetOrgPerson_mobile " , _ ( 'Please enter a valid mobile number!' ));
2004-09-26 13:48:52 +00:00
$this -> messages [ 'facsimileNumber' ][ 0 ] = array ( 'ERROR' , _ ( 'Fax number' ), _ ( 'Please enter a valid fax number!' ));
2004-10-23 11:11:31 +00:00
$this -> messages [ 'facsimileNumber' ][ 1 ] = array ( 'ERROR' , _ ( 'Account %s:' ) . ' inetOrgPerson_fax' , _ ( 'Please enter a valid fax number!' ));
2010-04-02 11:39:09 +00:00
$this -> messages [ 'email' ][ 0 ] = array ( 'ERROR' , _ ( 'Email address' ), _ ( 'Please enter a valid email address!' ));
$this -> messages [ 'email' ][ 1 ] = array ( 'ERROR' , _ ( 'Account %s:' ) . ' inetOrgPerson_email' , _ ( 'Please enter a valid email address!' ));
2004-09-26 13:48:52 +00:00
$this -> messages [ 'street' ][ 0 ] = array ( 'ERROR' , _ ( 'Street' ), _ ( 'Please enter a valid street name!' ));
2004-10-23 11:11:31 +00:00
$this -> messages [ 'street' ][ 1 ] = array ( 'ERROR' , _ ( 'Account %s:' ) . ' inetOrgPerson_street' , _ ( 'Please enter a valid street name!' ));
2004-09-26 13:48:52 +00:00
$this -> messages [ 'postalAddress' ][ 0 ] = array ( 'ERROR' , _ ( 'Postal address' ), _ ( 'Please enter a valid postal address!' ));
2004-10-23 11:11:31 +00:00
$this -> messages [ 'postalAddress' ][ 1 ] = array ( 'ERROR' , _ ( 'Account %s:' ) . ' inetOrgPerson_address' , _ ( 'Please enter a valid postal address!' ));
2011-11-03 18:31:33 +00:00
$this -> messages [ 'registeredAddress' ][ 0 ] = array ( 'ERROR' , _ ( 'Registered address' ), _ ( 'Please enter a valid registered address.' ));
$this -> messages [ 'registeredAddress' ][ 1 ] = array ( 'ERROR' , _ ( 'Account %s:' ) . ' inetOrgPerson_registeredAddress' , _ ( 'Please enter a valid registered address.' ));
2004-09-26 13:48:52 +00:00
$this -> messages [ 'postalCode' ][ 0 ] = array ( 'ERROR' , _ ( 'Postal code' ), _ ( 'Please enter a valid postal code!' ));
2004-10-23 11:11:31 +00:00
$this -> messages [ 'postalCode' ][ 1 ] = array ( 'ERROR' , _ ( 'Account %s:' ) . ' inetOrgPerson_postalCode' , _ ( 'Please enter a valid postal code!' ));
2004-11-07 12:56:55 +00:00
$this -> messages [ 'title' ][ 0 ] = array ( 'ERROR' , _ ( 'Job title' ), _ ( 'Please enter a valid job title!' ));
$this -> messages [ 'title' ][ 1 ] = array ( 'ERROR' , _ ( 'Account %s:' ) . ' inetOrgPerson_title' , _ ( 'Please enter a valid job title!' ));
2004-09-26 13:48:52 +00:00
$this -> messages [ 'employeeType' ][ 0 ] = array ( 'ERROR' , _ ( 'Employee type' ), _ ( 'Please enter a valid employee type!' ));
2004-10-23 11:11:31 +00:00
$this -> messages [ 'employeeType' ][ 1 ] = array ( 'ERROR' , _ ( 'Account %s:' ) . ' inetOrgPerson_type' , _ ( 'Please enter a valid employee type!' ));
2005-06-19 09:38:44 +00:00
$this -> messages [ 'cn' ][ 0 ] = array ( 'ERROR' , _ ( 'Common name' ), _ ( 'Please enter a valid common name!' ));
$this -> messages [ 'cn' ][ 1 ] = array ( 'ERROR' , _ ( 'Account %s:' ) . ' inetOrgPerson_cn' , _ ( 'Please enter a valid common name!' ));
$this -> messages [ 'uid' ][ 0 ] = array ( 'ERROR' , _ ( 'User name' ), _ ( 'User name contains invalid characters. Valid characters are: a-z, A-Z, 0-9 and .-_ !' ));
2005-07-02 12:05:33 +00:00
$this -> messages [ 'uid' ][ 1 ] = array ( 'ERROR' , _ ( 'Account %s:' ) . ' inetOrgPerson_userName' , _ ( 'User name contains invalid characters. Valid characters are: a-z, A-Z, 0-9 and .-_ !' ));
$this -> messages [ 'uid' ][ 3 ] = array ( 'ERROR' , _ ( 'Account %s:' ) . ' inetOrgPerson_userName' , _ ( 'User name already exists!' ));
$this -> messages [ 'manager' ][ 0 ] = array ( 'ERROR' , _ ( 'Account %s:' ) . ' inetOrgPerson_manager' , _ ( 'This is not a valid DN!' ));
2013-01-28 21:15:55 +00:00
$this -> messages [ 'file' ][ 0 ] = array ( 'ERROR' , _ ( 'No file selected.' ));
2007-06-11 18:19:05 +00:00
$this -> messages [ 'businessCategory' ][ 0 ] = array ( 'ERROR' , _ ( 'Business category' ), _ ( 'Please enter a valid business category!' ));
$this -> messages [ 'businessCategory' ][ 1 ] = array ( 'ERROR' , _ ( 'Account %s:' ) . ' inetOrgPerson_businessCategory' , _ ( 'Please enter a valid business category!' ));
2013-01-13 10:40:47 +00:00
$this -> messages [ 'userPassword' ][ 0 ] = array ( 'ERROR' , _ ( 'Account %s:' ) . ' posixAccount_password' , _ ( 'Password contains invalid characters. Valid characters are:' ) . ' a-z, A-Z, 0-9 and #*,.;:_-+!%&/|?{[()]}=@$ §°!' );
2013-04-28 10:21:45 +00:00
$this -> messages [ 'sendPasswordMail' ][ 0 ] = array ( 'ERROR' , _ ( 'Account %s:' ) . ' inetOrgPerson_sendPasswordMail' , _ ( 'This value can only be "true" or "false".' ));
2006-08-13 12:58:19 +00:00
}
2004-06-13 19:58:58 +00:00
/**
* Returns meta data that is interpreted by parent class
*
* @ return array array with meta data
2008-02-03 14:28:28 +00:00
*
* @ see baseModule :: get_metaData ()
2004-06-13 19:58:58 +00:00
*/
function get_metaData () {
$return = array ();
2007-11-19 18:42:03 +00:00
// icon
$return [ 'icon' ] = 'uid.png' ;
2004-06-13 19:58:58 +00:00
// manages user accounts
$return [ " account_types " ] = array ( " user " );
2004-06-14 16:05:36 +00:00
// alias name
$return [ " alias " ] = _ ( 'Personal' );
2005-01-10 10:41:38 +00:00
// this is a base module
$return [ " is_base " ] = true ;
2004-10-06 18:17:22 +00:00
// RDN attribute
2007-07-03 15:43:52 +00:00
$return [ " RDN " ] = array ( " cn " => " normal " , 'uid' => 'low' );
2005-06-19 09:38:44 +00:00
// LDAP filter
$return [ " ldap_filter " ] = array ( 'or' => " (objectClass=inetOrgPerson) " );
2004-06-20 17:32:02 +00:00
// module dependencies
2005-06-19 09:38:44 +00:00
$return [ 'dependencies' ] = array ( 'depends' => array (), 'conflicts' => array ());
2006-04-05 15:48:27 +00:00
// managed object classes
$return [ 'objectClasses' ] = array ( 'inetOrgPerson' );
2006-05-01 16:13:10 +00:00
// LDAP aliases
$return [ 'LDAPaliases' ] = array ( 'commonName' => 'cn' , 'surname' => 'sn' , 'streetAddress' => 'street' ,
'fax' => 'facsimileTelephoneNumber' , 'gn' => 'givenName' , 'userid' => 'uid' , 'rfc822Mailbox' => 'mail' ,
2012-10-14 08:32:26 +00:00
'mobileTelephoneNumber' => 'mobile' , 'organizationName' => 'o' , 'organizationalUnitName' => 'ou' );
2006-05-13 08:55:31 +00:00
// managed attributes
$return [ 'attributes' ] = array ( 'uid' , 'cn' , 'employeeType' , 'givenName' , 'jpegPhoto' , 'mail' , 'manager' , 'mobile' ,
2007-12-29 11:02:57 +00:00
'title' , 'telephoneNumber' , 'facsimileTelephoneNumber' , 'street' , 'postOfficeBox' , 'postalCode' , 'postalAddress' ,
2008-02-09 18:01:29 +00:00
'sn' , 'userPassword' , 'description' , 'homePhone' , 'roomNumber' , 'businessCategory' , 'l' , 'st' , 'physicalDeliveryOfficeName' ,
2013-01-28 21:15:55 +00:00
'carLicense' , 'departmentNumber' , 'o' , 'employeeNumber' , 'initials' , 'registeredAddress' , 'labeledURI' , 'ou' , 'userCertificate;binary' );
2006-06-28 15:13:57 +00:00
// self service search attributes
2011-08-20 16:27:53 +00:00
$return [ 'selfServiceSearchAttributes' ] = array ( 'uid' , 'mail' , 'cn' , 'surname' , 'givenName' , 'employeeNumber' );
2006-07-16 17:15:37 +00:00
// self service field settings
$return [ 'selfServiceFieldSettings' ] = array ( 'firstName' => _ ( 'First name' ), 'lastName' => _ ( 'Last name' ),
2010-04-02 11:39:09 +00:00
'mail' => _ ( 'Email address' ), 'telephoneNumber' => _ ( 'Telephone number' ), 'mobile' => _ ( 'Mobile number' ),
2011-11-03 18:31:33 +00:00
'faxNumber' => _ ( 'Fax number' ), 'street' => _ ( 'Street' ), 'postalAddress' => _ ( 'Postal address' ), 'registeredAddress' => _ ( 'Registered address' ),
2007-06-11 18:19:05 +00:00
'postalCode' => _ ( 'Postal code' ), 'postOfficeBox' => _ ( 'Post office box' ), 'jpegPhoto' => _ ( 'Photo' ),
2008-02-09 18:01:29 +00:00
'homePhone' => _ ( 'Home telephone number' ), 'roomNumber' => _ ( 'Room number' ), 'carLicense' => _ ( 'Car license' ),
2009-02-15 12:54:37 +00:00
'location' => _ ( 'Location' ), 'state' => _ ( 'State' ), 'officeName' => _ ( 'Office name' ), 'businessCategory' => _ ( 'Business category' ),
2013-01-28 21:15:55 +00:00
'departmentNumber' => _ ( 'Department' ), 'initials' => _ ( 'Initials' ), 'title' => _ ( 'Job title' ), 'labeledURI' => _ ( 'Web site' ),
'userCertificate' => _ ( 'User certificates' ));
2012-08-18 15:55:43 +00:00
// possible self service read-only fields
$return [ 'selfServiceReadOnlyFields' ] = array ( 'firstName' , 'lastName' , 'mail' , 'telephoneNumber' , 'mobile' , 'faxNumber' , 'street' ,
'postalAddress' , 'registeredAddress' , 'postalCode' , 'postOfficeBox' , 'jpegPhoto' , 'homePhone' , 'roomNumber' , 'carLicense' ,
2013-01-28 21:15:55 +00:00
'location' , 'state' , 'officeName' , 'businessCategory' , 'departmentNumber' , 'initials' , 'title' , 'labeledURI' , 'userCertificate' );
2004-07-01 15:54:33 +00:00
// profile elements
2010-06-12 19:37:51 +00:00
$profileElements = array ();
2012-09-13 15:29:51 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideInitials' )) {
$profileElements [] = new htmlTableExtendedInputField ( _ ( 'Initials' ), 'inetOrgPerson_initials' , null , 'initials' );
}
2012-09-14 10:35:21 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideDescription' )) {
$profileElements [] = new htmlTableExtendedInputField ( _ ( 'Description' ), 'inetOrgPerson_description' , null , 'description' );
}
2011-02-19 15:06:11 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideStreet' )) {
2012-01-06 17:34:39 +00:00
$profileElements [] = new htmlTableExtendedInputField ( _ ( 'Street' ), 'inetOrgPerson_street' , null , 'streetList' );
2011-02-19 15:06:11 +00:00
}
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hidePostOfficeBox' )) {
2012-01-06 17:34:39 +00:00
$profileElements [] = new htmlTableExtendedInputField ( _ ( 'Post office box' ), 'inetOrgPerson_postOfficeBox' , null , 'postOfficeBoxList' );
2011-02-19 15:06:11 +00:00
}
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hidePostalCode' )) {
2012-01-06 17:34:39 +00:00
$profileElements [] = new htmlTableExtendedInputField ( _ ( 'Postal code' ), 'inetOrgPerson_postalCode' , null , 'postalCodeList' );
2011-02-19 15:06:11 +00:00
}
2009-10-03 17:48:37 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideLocation' )) {
2012-01-06 17:34:39 +00:00
$profileElements [] = new htmlTableExtendedInputField ( _ ( 'Location' ), 'inetOrgPerson_l' , null , 'lList' );
2009-10-03 15:46:26 +00:00
}
2009-10-03 17:48:37 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideState' )) {
2012-01-06 17:34:39 +00:00
$profileElements [] = new htmlTableExtendedInputField ( _ ( 'State' ), 'inetOrgPerson_st' , null , 'stList' );
2009-10-03 15:46:26 +00:00
}
2011-02-19 15:06:11 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hidePostalAddress' )) {
$profileElements [] = new htmlTableExtendedInputField ( _ ( 'Postal address' ), 'inetOrgPerson_postalAddress' , null , 'postalAddress' );
}
2011-11-03 18:31:33 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideRegisteredAddress' )) {
$profileElements [] = new htmlTableExtendedInputField ( _ ( 'Registered address' ), 'inetOrgPerson_registeredAddress' , null , 'registeredAddress' );
}
2012-09-13 15:29:51 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideOfficeName' )) {
$profileElements [] = new htmlTableExtendedInputField ( _ ( 'Office name' ), 'inetOrgPerson_physicalDeliveryOfficeName' , null , 'physicalDeliveryOfficeName' );
}
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideRoomNumber' )) {
$profileElements [] = new htmlTableExtendedInputField ( _ ( 'Room number' ), 'inetOrgPerson_roomNumber' , null , 'roomNumber' );
}
2011-02-19 15:06:11 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideTelephoneNumber' )) {
2012-01-06 17:34:39 +00:00
$profileElements [] = new htmlTableExtendedInputField ( _ ( 'Telephone number' ), 'inetOrgPerson_telephoneNumber' , null , 'telephoneNumberList' );
2011-02-19 15:06:11 +00:00
}
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideFaxNumber' )) {
2012-01-06 17:34:39 +00:00
$profileElements [] = new htmlTableExtendedInputField ( _ ( 'Fax number' ), 'inetOrgPerson_facsimileTelephoneNumber' , null , 'facsimileTelephoneNumberList' );
2011-02-19 15:06:11 +00:00
}
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideEMailAddress' )) {
2012-01-06 17:34:39 +00:00
$profileElements [] = new htmlTableExtendedInputField ( _ ( 'Email address' ), 'inetOrgPerson_mail' , null , 'mailList' );
2011-02-19 15:06:11 +00:00
}
2011-12-11 13:36:34 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideLabeledURI' )) {
$profileElements [] = new htmlTableExtendedInputField ( _ ( 'Web site' ), 'inetOrgPerson_labeledURI' , null , 'labeledURIList' );
}
2011-02-19 15:06:11 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideDepartments' )) {
2012-01-06 17:34:39 +00:00
$profileElements [] = new htmlTableExtendedInputField ( _ ( 'Department' ), 'inetOrgPerson_departmentNumber' , null , 'departmentNumberList' );
2011-02-19 15:06:11 +00:00
}
2012-10-14 08:32:26 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideOu' )) {
$profileElements [] = new htmlTableExtendedInputField ( _ ( 'Organisational unit' ), 'inetOrgPerson_ou' , null , 'ouList' );
}
2011-05-01 11:58:34 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideO' )) {
2012-01-06 17:34:39 +00:00
$profileElements [] = new htmlTableExtendedInputField ( _ ( 'Organisation' ), 'inetOrgPerson_o' , null , 'oList' );
2011-05-01 11:58:34 +00:00
}
2009-10-03 17:48:37 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideJobTitle' )) {
2010-06-12 19:37:51 +00:00
$profileElements [] = new htmlTableExtendedInputField ( _ ( 'Job title' ), 'inetOrgPerson_title' , null , 'title' );
2009-10-03 15:46:26 +00:00
}
2009-10-03 17:48:37 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideEmployeeType' )) {
2010-06-12 19:37:51 +00:00
$profileElements [] = new htmlTableExtendedInputField ( _ ( 'Employee type' ), 'inetOrgPerson_employeeType' , null , 'employeeType' );
}
2013-03-04 19:21:16 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideBusinessCategory' )) {
$profileElements [] = new htmlTableExtendedInputField ( _ ( 'Business category' ), 'inetOrgPerson_businessCategory' , null , 'businessCategory' );
}
2010-06-12 19:37:51 +00:00
if ( sizeof ( $profileElements ) > 0 ) {
$profileContainer = new htmlTable ();
for ( $i = 0 ; $i < sizeof ( $profileElements ); $i ++ ) {
$profileContainer -> addElement ( $profileElements [ $i ]);
2010-09-30 18:58:44 +00:00
$profileContainer -> addNewLine ();
2010-06-12 19:37:51 +00:00
}
$return [ 'profile_options' ] = $profileContainer ;
2009-10-03 15:46:26 +00:00
}
2011-02-19 15:06:11 +00:00
// profile checks and mappings
2012-09-13 15:29:51 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideInitials' )) {
$return [ 'profile_mappings' ][ 'inetOrgPerson_initials' ] = 'initials' ;
}
2012-09-14 10:35:21 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideDescription' )) {
$return [ 'profile_mappings' ][ 'inetOrgPerson_description' ] = 'description' ;
}
2009-10-03 18:13:38 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideJobTitle' )) {
$return [ 'profile_checks' ][ 'inetOrgPerson_title' ] = array (
'type' => 'ext_preg' ,
'regex' => 'title' ,
'error_message' => $this -> messages [ 'title' ][ 0 ]);
$return [ 'profile_mappings' ][ 'inetOrgPerson_title' ] = 'title' ;
}
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideEmployeeType' )) {
$return [ 'profile_checks' ][ 'inetOrgPerson_employeeType' ] = array (
'type' => 'ext_preg' ,
'regex' => 'employeeType' ,
'error_message' => $this -> messages [ 'employeeType' ][ 0 ]);
$return [ 'profile_mappings' ][ 'inetOrgPerson_employeeType' ] = 'employeeType' ;
}
2013-03-04 19:21:16 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideBusinessCategory' )) {
$return [ 'profile_checks' ][ 'inetOrgPerson_businessCategory' ] = array (
'type' => 'ext_preg' ,
'regex' => 'businessCategory' ,
'error_message' => $this -> messages [ 'businessCategory' ][ 0 ]);
$return [ 'profile_mappings' ][ 'inetOrgPerson_businessCategory' ] = 'businessCategory' ;
}
2011-02-19 15:06:11 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideStreet' )) {
$return [ 'profile_checks' ][ 'inetOrgPerson_street' ] = array (
'type' => 'ext_preg' ,
'regex' => 'street' ,
'error_message' => $this -> messages [ 'street' ][ 0 ]);
}
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hidePostalCode' )) {
$return [ 'profile_checks' ][ 'inetOrgPerson_postalCode' ] = array (
'type' => 'ext_preg' ,
'regex' => 'postalCode' ,
'error_message' => $this -> messages [ 'postalCode' ][ 0 ]);
}
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hidePostalAddress' )) {
$return [ 'profile_checks' ][ 'inetOrgPerson_postalAddress' ] = array (
'type' => 'ext_preg' ,
'regex' => 'postalAddress' ,
'error_message' => $this -> messages [ 'postalAddress' ][ 0 ]);
$return [ 'profile_mappings' ][ 'inetOrgPerson_postalAddress' ] = 'postalAddress' ;
}
2011-11-03 18:31:33 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideRegisteredAddress' )) {
$return [ 'profile_checks' ][ 'inetOrgPerson_registeredAddress' ] = array (
'type' => 'ext_preg' ,
'regex' => 'postalAddress' ,
'error_message' => $this -> messages [ 'registeredAddress' ][ 0 ]);
$return [ 'profile_mappings' ][ 'inetOrgPerson_registeredAddress' ] = 'registeredAddress' ;
}
2012-09-13 15:29:51 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideOfficeName' )) {
$return [ 'profile_mappings' ][ 'inetOrgPerson_physicalDeliveryOfficeName' ] = 'physicalDeliveryOfficeName' ;
}
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideRoomNumber' )) {
$return [ 'profile_mappings' ][ 'inetOrgPerson_roomNumber' ] = 'roomNumber' ;
}
2009-10-03 15:46:26 +00:00
// configuration settings
2010-06-11 19:41:19 +00:00
$configContainer = new htmlTable ();
2013-05-09 17:27:19 +00:00
if ( isset ( $_SESSION [ 'conf_config' ])) {
// add password hash type if posixAccount is inactive
$confActiveUnixModules = $_SESSION [ 'conf_config' ] -> get_AccountModules ( 'user' );
if ( in_array ( 'host' , $_SESSION [ 'conf_config' ] -> get_ActiveTypes ())) {
$confActiveUnixModules = array_merge ( $confActiveUnixModules , $_SESSION [ 'conf_config' ] -> get_AccountModules ( 'host' ));
}
if ( in_array ( 'group' , $_SESSION [ 'conf_config' ] -> get_ActiveTypes ())) {
$confActiveUnixModules = array_merge ( $confActiveUnixModules , $_SESSION [ 'conf_config' ] -> get_AccountModules ( 'group' ));
}
if ( ! in_array ( 'posixAccount' , $confActiveUnixModules ) && ! in_array ( 'posixGroup' , $confActiveUnixModules )) {
$optionsSelected = array ( 'SSHA' );
$hashOption = new htmlTable ();
$hashOption -> addElement ( new htmlTableExtendedSelect ( 'posixAccount_pwdHash' , getSupportedHashTypes (), $optionsSelected , _ ( " Password hash type " ), 'pwdHash' ));
$configContainer -> addElement ( $hashOption , true );
}
}
2010-06-11 19:41:19 +00:00
$configContainerHead = new htmlTable ();
$configContainerHead -> addElement ( new htmlOutputText ( _ ( 'Hidden options' )));
$configContainerHead -> addElement ( new htmlHelpLink ( 'hiddenOptions' ));
$configContainerOptions = new htmlTable ();
$configContainer -> addElement ( $configContainerHead , true );
$configContainerOptions -> addElement ( new htmlTableExtendedInputCheckbox ( 'inetOrgPerson_hideDescription' , false , _ ( 'Description' ), null , false ));
$configContainerOptions -> addElement ( new htmlOutputText ( ' ' ));
$configContainerOptions -> addElement ( new htmlTableExtendedInputCheckbox ( 'inetOrgPerson_hideStreet' , false , _ ( 'Street' ), null , false ));
$configContainerOptions -> addElement ( new htmlOutputText ( ' ' ));
$configContainerOptions -> addElement ( new htmlTableExtendedInputCheckbox ( 'inetOrgPerson_hidePostOfficeBox' , false , _ ( 'Post office box' ), null , false ));
$configContainerOptions -> addElement ( new htmlOutputText ( ' ' ));
2011-03-26 13:11:39 +00:00
$configContainerOptions -> addElement ( new htmlTableExtendedInputCheckbox ( 'inetOrgPerson_hidePostalCode' , false , _ ( 'Postal code' ), null , false ));
2010-06-11 19:41:19 +00:00
$configContainerOptions -> addElement ( new htmlOutputText ( ' ' ));
2011-12-11 13:36:34 +00:00
$configContainerOptions -> addElement ( new htmlTableExtendedInputCheckbox ( 'inetOrgPerson_hideLocation' , false , _ ( 'Location' ), null , false ));
$configContainerOptions -> addNewLine ();
2010-06-11 19:41:19 +00:00
$configContainerOptions -> addElement ( new htmlTableExtendedInputCheckbox ( 'inetOrgPerson_hideState' , false , _ ( 'State' ), null , false ));
2011-03-26 13:11:39 +00:00
$configContainerOptions -> addElement ( new htmlOutputText ( ' ' ));
2010-06-11 19:41:19 +00:00
$configContainerOptions -> addElement ( new htmlTableExtendedInputCheckbox ( 'inetOrgPerson_hidePostalAddress' , false , _ ( 'Postal address' ), null , false ));
$configContainerOptions -> addElement ( new htmlOutputText ( ' ' ));
2011-11-03 18:31:33 +00:00
$configContainerOptions -> addElement ( new htmlTableExtendedInputCheckbox ( 'inetOrgPerson_hideRegisteredAddress' , false , _ ( 'Registered address' ), null , false ));
2011-12-11 13:36:34 +00:00
$configContainerOptions -> addElement ( new htmlOutputText ( ' ' ));
2011-11-03 18:31:33 +00:00
$configContainerOptions -> addElement ( new htmlTableExtendedInputCheckbox ( 'inetOrgPerson_hideOfficeName' , false , _ ( 'Office name' ), null , false ));
$configContainerOptions -> addElement ( new htmlOutputText ( ' ' ));
2011-03-26 13:11:39 +00:00
$configContainerOptions -> addElement ( new htmlTableExtendedInputCheckbox ( 'inetOrgPerson_hideRoomNumber' , false , _ ( 'Room number' ), null , false ));
2011-12-11 13:36:34 +00:00
$configContainerOptions -> addNewLine ();
2010-06-11 19:41:19 +00:00
$configContainerOptions -> addElement ( new htmlTableExtendedInputCheckbox ( 'inetOrgPerson_hideTelephoneNumber' , false , _ ( 'Telephone number' ), null , false ));
$configContainerOptions -> addElement ( new htmlOutputText ( ' ' ));
$configContainerOptions -> addElement ( new htmlTableExtendedInputCheckbox ( 'inetOrgPerson_hideHomeTelephoneNumber' , false , _ ( 'Home telephone number' ), null , false ));
2011-12-11 13:36:34 +00:00
$configContainerOptions -> addElement ( new htmlOutputText ( ' ' ));
2011-11-03 18:31:33 +00:00
$configContainerOptions -> addElement ( new htmlTableExtendedInputCheckbox ( 'inetOrgPerson_hideMobileNumber' , false , _ ( 'Mobile number' ), null , false ));
$configContainerOptions -> addElement ( new htmlOutputText ( ' ' ));
2010-06-11 19:41:19 +00:00
$configContainerOptions -> addElement ( new htmlTableExtendedInputCheckbox ( 'inetOrgPerson_hideFaxNumber' , false , _ ( 'Fax number' ), null , false ));
$configContainerOptions -> addElement ( new htmlOutputText ( ' ' ));
$configContainerOptions -> addElement ( new htmlTableExtendedInputCheckbox ( 'inetOrgPerson_hideEMailAddress' , false , _ ( 'Email address' ), null , false ));
2011-03-26 13:11:39 +00:00
$configContainerOptions -> addNewLine ();
2011-12-11 13:36:34 +00:00
$configContainerOptions -> addElement ( new htmlTableExtendedInputCheckbox ( 'inetOrgPerson_hideJobTitle' , false , _ ( 'Job title' ), null , false ));
$configContainerOptions -> addElement ( new htmlOutputText ( ' ' ));
2011-11-03 18:31:33 +00:00
$configContainerOptions -> addElement ( new htmlTableExtendedInputCheckbox ( 'inetOrgPerson_hideCarLicense' , false , _ ( 'Car license' ), null , false ));
$configContainerOptions -> addElement ( new htmlOutputText ( ' ' ));
2010-06-11 19:41:19 +00:00
$configContainerOptions -> addElement ( new htmlTableExtendedInputCheckbox ( 'inetOrgPerson_hideEmployeeType' , false , _ ( 'Employee type' ), null , false ));
$configContainerOptions -> addElement ( new htmlOutputText ( ' ' ));
$configContainerOptions -> addElement ( new htmlTableExtendedInputCheckbox ( 'inetOrgPerson_hideBusinessCategory' , false , _ ( 'Business category' ), null , false ));
2011-03-26 13:11:39 +00:00
$configContainerOptions -> addElement ( new htmlOutputText ( ' ' ));
2012-01-06 17:34:39 +00:00
$configContainerOptions -> addElement ( new htmlTableExtendedInputCheckbox ( 'inetOrgPerson_hideDepartments' , false , _ ( 'Department' ), null , false ));
2011-05-01 11:58:34 +00:00
$configContainerOptions -> addNewLine ();
2011-11-03 18:31:33 +00:00
$configContainerOptions -> addElement ( new htmlTableExtendedInputCheckbox ( 'inetOrgPerson_hideManager' , false , _ ( 'Manager' ), null , false ));
$configContainerOptions -> addElement ( new htmlOutputText ( ' ' ));
2012-10-14 08:32:26 +00:00
$configContainerOptions -> addElement ( new htmlTableExtendedInputCheckbox ( 'inetOrgPerson_hideOu' , false , _ ( 'Organisational unit' ), null , false ));
$configContainerOptions -> addElement ( new htmlOutputText ( ' ' ));
2011-05-01 11:58:34 +00:00
$configContainerOptions -> addElement ( new htmlTableExtendedInputCheckbox ( 'inetOrgPerson_hideO' , false , _ ( 'Organisation' ), null , false ));
$configContainerOptions -> addElement ( new htmlOutputText ( ' ' ));
$configContainerOptions -> addElement ( new htmlTableExtendedInputCheckbox ( 'inetOrgPerson_hideEmployeeNumber' , false , _ ( 'Employee number' ), null , false ));
$configContainerOptions -> addElement ( new htmlOutputText ( ' ' ));
$configContainerOptions -> addElement ( new htmlTableExtendedInputCheckbox ( 'inetOrgPerson_hideInitials' , false , _ ( 'Initials' ), null , false ));
2012-10-14 08:32:26 +00:00
$configContainerOptions -> addNewLine ();
2011-12-11 13:36:34 +00:00
$configContainerOptions -> addElement ( new htmlTableExtendedInputCheckbox ( 'inetOrgPerson_hideLabeledURI' , false , _ ( 'Web site' ), null , false ));
2013-01-28 21:15:55 +00:00
$configContainerOptions -> addElement ( new htmlOutputText ( ' ' ));
$configContainerOptions -> addElement ( new htmlTableExtendedInputCheckbox ( 'inetOrgPerson_hideuserCertificate' , false , _ ( 'User certificates' ), null , false ));
2009-11-12 19:48:53 +00:00
if ( isset ( $_SESSION [ 'conf_config' ])) {
2013-03-10 19:53:48 +00:00
$confActiveUnixUserModules = $_SESSION [ 'conf_config' ] -> get_AccountModules ( 'user' );
// option to hide uid
if ( ! in_array ( 'posixAccount' , $confActiveUnixUserModules )) {
$configContainerOptions -> addElement ( new htmlOutputText ( ' ' ));
$configContainerOptions -> addElement ( new htmlTableExtendedInputCheckbox ( 'inetOrgPerson_hideUID' , false , _ ( 'User name' ), null , false ));
}
2009-11-12 19:48:53 +00:00
}
2013-03-10 19:53:48 +00:00
$configContainer -> addElement ( $configContainerOptions , true );
2010-06-11 19:41:19 +00:00
$return [ 'config_options' ][ 'all' ] = $configContainer ;
2005-01-16 12:41:38 +00:00
// upload fields
2004-10-11 18:06:53 +00:00
$return [ 'upload_columns' ] = array (
2009-10-03 15:46:26 +00:00
array (
'name' => 'inetOrgPerson_firstName' ,
'description' => _ ( 'First name' ),
'help' => 'givenName' ,
'example' => _ ( 'Steve' )
),
array (
'name' => 'inetOrgPerson_lastName' ,
'description' => _ ( 'Last name' ),
'help' => 'sn' ,
'example' => _ ( 'Miller' ),
'required' => true
)
2004-10-11 18:06:53 +00:00
);
2011-05-01 11:58:34 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideInitials' )) {
$return [ 'upload_columns' ][] = array (
'name' => 'inetOrgPerson_initials' ,
'description' => _ ( 'Initials' ),
'help' => 'initials' ,
'example' => 'A.B.'
);
}
2009-10-03 17:48:37 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideDescription' )) {
2009-10-03 15:46:26 +00:00
$return [ 'upload_columns' ][] = array (
'name' => 'inetOrgPerson_description' ,
'description' => _ ( 'Description' ),
'help' => 'description' ,
2013-04-14 19:18:25 +00:00
'example' => _ ( 'Temp, contract til December' )
2009-10-03 15:46:26 +00:00
);
}
2009-10-03 17:48:37 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideJobTitle' )) {
2009-10-03 15:46:26 +00:00
$return [ 'upload_columns' ][] = array (
'name' => 'inetOrgPerson_title' ,
'description' => _ ( 'Job title' ),
2013-02-17 19:58:23 +00:00
'help' => 'titleList' ,
2009-10-03 15:46:26 +00:00
'example' => _ ( 'President' )
);
}
2011-05-01 11:58:34 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideEmployeeNumber' )) {
$return [ 'upload_columns' ][] = array (
'name' => 'inetOrgPerson_employeeNumber' ,
'description' => _ ( 'Employee number' ),
'help' => 'employeeNumber' ,
'example' => '123456'
);
}
2009-10-03 17:48:37 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideEmployeeType' )) {
2009-10-03 15:46:26 +00:00
$return [ 'upload_columns' ][] = array (
'name' => 'inetOrgPerson_type' ,
'description' => _ ( 'Employee type' ),
'help' => 'employeeType' ,
'example' => _ ( 'Temp' )
);
}
2009-10-03 17:48:37 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideManager' )) {
2009-10-03 15:46:26 +00:00
$return [ 'upload_columns' ][] = array (
'name' => 'inetOrgPerson_manager' ,
'description' => _ ( 'Manager' ),
2011-12-20 20:40:51 +00:00
'help' => 'managerList' ,
2009-10-03 15:46:26 +00:00
'example' => _ ( 'uid=smiller,ou=People,dc=company,dc=com' )
);
}
2009-10-03 17:48:37 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideBusinessCategory' )) {
2009-10-03 15:46:26 +00:00
$return [ 'upload_columns' ][] = array (
'name' => 'inetOrgPerson_businessCategory' ,
'description' => _ ( 'Business category' ),
2013-02-17 19:58:23 +00:00
'help' => 'businessCategoryList' ,
2009-10-03 15:46:26 +00:00
'example' => _ ( 'Administration' )
);
}
2009-10-03 17:48:37 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideStreet' )) {
2009-10-03 15:46:26 +00:00
$return [ 'upload_columns' ][] = array (
'name' => 'inetOrgPerson_street' ,
'description' => _ ( 'Street' ),
2012-01-06 17:34:39 +00:00
'help' => 'streetList' ,
2009-10-03 15:46:26 +00:00
'example' => _ ( 'Mystreetname 42' )
);
}
2009-10-03 17:48:37 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hidePostalCode' )) {
2009-10-03 15:46:26 +00:00
$return [ 'upload_columns' ][] = array (
'name' => 'inetOrgPerson_postalCode' ,
'description' => _ ( 'Postal code' ),
2012-01-06 17:34:39 +00:00
'help' => 'postalCodeList' ,
2009-10-03 15:46:26 +00:00
'example' => _ ( 'GB-12345' )
);
}
2009-10-03 17:48:37 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hidePostalAddress' )) {
2009-10-03 15:46:26 +00:00
$return [ 'upload_columns' ][] = array (
'name' => 'inetOrgPerson_address' ,
'description' => _ ( 'Postal address' ),
'help' => 'postalAddress' ,
'example' => _ ( 'Mycity' )
);
}
2011-11-03 18:31:33 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideRegisteredAddress' )) {
$return [ 'upload_columns' ][] = array (
'name' => 'inetOrgPerson_registeredAddress' ,
'description' => _ ( 'Registered address' ),
'help' => 'registeredAddress' ,
'example' => _ ( 'Mycity' )
);
}
2009-10-03 17:48:37 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hidePostOfficeBox' )) {
2009-10-03 15:46:26 +00:00
$return [ 'upload_columns' ][] = array (
'name' => 'inetOrgPerson_postOfficeBox' ,
'description' => _ ( 'Post office box' ),
2012-01-06 17:34:39 +00:00
'help' => 'postOfficeBoxList' ,
2009-10-03 15:46:26 +00:00
'example' => _ ( '12345' )
);
}
2009-10-03 17:48:37 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideTelephoneNumber' )) {
2009-10-03 15:46:26 +00:00
$return [ 'upload_columns' ][] = array (
'name' => 'inetOrgPerson_telephone' ,
'description' => _ ( 'Telephone number' ),
2012-01-06 17:34:39 +00:00
'help' => 'telephoneNumberList' ,
2009-10-03 15:46:26 +00:00
'example' => _ ( '123-123-1234' )
);
}
2009-10-03 17:48:37 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideHomeTelephoneNumber' )) {
2009-10-03 15:46:26 +00:00
$return [ 'upload_columns' ][] = array (
'name' => 'inetOrgPerson_homePhone' ,
'description' => _ ( 'Home telephone number' ),
2012-01-06 17:34:39 +00:00
'help' => 'homePhoneList' ,
2009-10-03 15:46:26 +00:00
'example' => _ ( '123-124-1234' )
);
}
2009-10-03 17:48:37 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideMobileNumber' )) {
2009-10-03 15:46:26 +00:00
$return [ 'upload_columns' ][] = array (
'name' => 'inetOrgPerson_mobile' ,
'description' => _ ( 'Mobile number' ),
2012-01-06 17:34:39 +00:00
'help' => 'mobileTelephoneNumberList' ,
2009-10-03 15:46:26 +00:00
'example' => _ ( '123-123-1235' )
);
}
2009-10-03 17:48:37 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideFaxNumber' )) {
2009-10-03 15:46:26 +00:00
$return [ 'upload_columns' ][] = array (
'name' => 'inetOrgPerson_fax' ,
'description' => _ ( 'Fax number' ),
2012-01-06 17:34:39 +00:00
'help' => 'facsimileTelephoneNumberList' ,
2009-10-03 15:46:26 +00:00
'example' => _ ( '123-123-1236' )
);
}
2009-10-03 17:48:37 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideEMailAddress' )) {
2009-10-03 15:46:26 +00:00
$return [ 'upload_columns' ][] = array (
'name' => 'inetOrgPerson_email' ,
2010-04-02 11:39:09 +00:00
'description' => _ ( 'Email address' ),
2012-01-06 17:34:39 +00:00
'help' => 'mailList' ,
2009-10-03 15:46:26 +00:00
'example' => _ ( 'user@company.com' )
);
2013-04-28 10:21:45 +00:00
if ( isLAMProVersion ()) {
$return [ 'upload_columns' ][] = array (
'name' => 'inetOrgPerson_sendPasswordMail' ,
'description' => _ ( 'Send password via mail' ),
'help' => 'mailPassword' ,
'values' => 'true, false' ,
'default' => 'false' ,
'example' => 'false'
);
}
2009-10-03 15:46:26 +00:00
}
2011-12-11 13:36:34 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideLabeledURI' )) {
$return [ 'upload_columns' ][] = array (
'name' => 'inetOrgPerson_labeledURI' ,
'description' => _ ( 'Web site' ),
'help' => 'labeledURIList' ,
'example' => _ ( 'http://www.company.com' )
);
}
2009-10-03 17:48:37 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideRoomNumber' )) {
2009-10-03 15:46:26 +00:00
$return [ 'upload_columns' ][] = array (
'name' => 'inetOrgPerson_roomNumber' ,
'description' => _ ( 'Room number' ),
'help' => 'roomNumber' ,
'example' => 'A 2.24'
);
}
2009-10-03 17:48:37 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideDepartments' )) {
2009-10-03 15:46:26 +00:00
$return [ 'upload_columns' ][] = array (
'name' => 'inetOrgPerson_departmentNumber' ,
2012-01-06 17:34:39 +00:00
'description' => _ ( 'Department' ),
'help' => 'departmentNumberList' ,
2009-10-03 15:46:26 +00:00
'example' => _ ( 'Administration' )
);
}
2012-10-14 08:32:26 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideOu' )) {
$return [ 'upload_columns' ][] = array (
'name' => 'inetOrgPerson_ou' ,
'description' => _ ( 'Organisational unit' ),
'help' => 'ouList' ,
'example' => _ ( 'Administration' )
);
}
2011-05-01 11:58:34 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideO' )) {
$return [ 'upload_columns' ][] = array (
'name' => 'inetOrgPerson_o' ,
'description' => _ ( 'Organisation' ),
2012-01-06 17:34:39 +00:00
'help' => 'oList' ,
2011-05-01 11:58:34 +00:00
'example' => _ ( 'YourCompany' )
);
}
2009-10-03 17:48:37 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideLocation' )) {
2009-10-03 15:46:26 +00:00
$return [ 'upload_columns' ][] = array (
'name' => 'inetOrgPerson_l' ,
'description' => _ ( 'Location' ),
2012-01-06 17:34:39 +00:00
'help' => 'lList' ,
2009-10-03 15:46:26 +00:00
'example' => _ ( 'MyCity' )
);
}
2009-10-03 17:48:37 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideState' )) {
2009-10-03 15:46:26 +00:00
$return [ 'upload_columns' ][] = array (
'name' => 'inetOrgPerson_st' ,
'description' => _ ( 'State' ),
2012-01-06 17:34:39 +00:00
'help' => 'stList' ,
2009-10-03 15:46:26 +00:00
'example' => _ ( 'New York' )
);
}
2009-10-03 17:48:37 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideCarLicense' )) {
2009-10-03 15:46:26 +00:00
$return [ 'upload_columns' ][] = array (
'name' => 'inetOrgPerson_carLicense' ,
'description' => _ ( 'Car license' ),
'help' => 'carLicense' ,
'example' => _ ( 'yes' )
);
}
2009-10-03 17:48:37 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideOfficeName' )) {
2009-10-03 15:46:26 +00:00
$return [ 'upload_columns' ][] = array (
'name' => 'inetOrgPerson_physicalDeliveryOfficeName' ,
'description' => _ ( 'Office name' ),
2012-03-20 20:30:35 +00:00
'help' => 'physicalDeliveryOfficeNameList' ,
'example' => _ ( 'YourCompany' )
2009-10-03 15:46:26 +00:00
);
}
2004-08-17 15:16:17 +00:00
// available PDF fields
2004-10-30 16:46:06 +00:00
$return [ 'PDF_fields' ] = array (
2010-04-05 12:38:23 +00:00
'givenName' => _ ( 'First name' ),
'sn' => _ ( 'Last name' )
2004-10-30 16:46:06 +00:00
);
2009-10-03 17:48:37 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideDescription' )) {
2010-04-05 12:38:23 +00:00
$return [ 'PDF_fields' ][ 'description' ] = _ ( 'Description' );
2009-10-03 15:46:26 +00:00
}
2009-10-03 17:48:37 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideStreet' )) {
2010-04-05 12:38:23 +00:00
$return [ 'PDF_fields' ][ 'street' ] = _ ( 'Street' );
2009-10-03 15:46:26 +00:00
}
2009-10-03 17:48:37 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hidePostOfficeBox' )) {
2010-04-05 12:38:23 +00:00
$return [ 'PDF_fields' ][ 'postOfficeBox' ] = _ ( 'Post office box' );
2009-10-03 15:46:26 +00:00
}
2009-10-03 17:48:37 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hidePostalCode' )) {
2010-04-05 12:38:23 +00:00
$return [ 'PDF_fields' ][ 'postalCode' ] = _ ( 'Postal code' );
2009-10-03 15:46:26 +00:00
}
2009-10-03 17:48:37 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideLocation' )) {
2010-04-05 12:38:23 +00:00
$return [ 'PDF_fields' ][ 'location' ] = _ ( 'Location' );
2009-10-03 15:46:26 +00:00
}
2009-10-03 17:48:37 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideState' )) {
2010-04-05 12:38:23 +00:00
$return [ 'PDF_fields' ][ 'state' ] = _ ( 'State' );
2009-10-03 15:46:26 +00:00
}
2009-10-03 17:48:37 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hidePostalAddress' )) {
2010-04-05 12:38:23 +00:00
$return [ 'PDF_fields' ][ 'postalAddress' ] = _ ( 'Postal address' );
2009-10-03 15:46:26 +00:00
}
2011-11-03 18:31:33 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideRegisteredAddress' )) {
$return [ 'PDF_fields' ][ 'registeredAddress' ] = _ ( 'Registered address' );
}
2009-10-03 17:48:37 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideOfficeName' )) {
2010-04-05 12:38:23 +00:00
$return [ 'PDF_fields' ][ 'officeName' ] = _ ( 'Office name' );
2009-10-03 15:46:26 +00:00
}
2009-10-03 17:48:37 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideRoomNumber' )) {
2010-04-05 12:38:23 +00:00
$return [ 'PDF_fields' ][ 'roomNumber' ] = _ ( 'Room number' );
2009-10-03 15:46:26 +00:00
}
2009-10-03 17:48:37 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideTelephoneNumber' )) {
2010-04-05 12:38:23 +00:00
$return [ 'PDF_fields' ][ 'telephoneNumber' ] = _ ( 'Telephone number' );
2009-10-03 15:46:26 +00:00
}
2009-10-03 17:48:37 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideHomeTelephoneNumber' )) {
2010-04-05 12:38:23 +00:00
$return [ 'PDF_fields' ][ 'homePhone' ] = _ ( 'Home telephone number' );
2009-10-03 15:46:26 +00:00
}
2009-10-03 17:48:37 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideMobileNumber' )) {
2010-04-05 12:38:23 +00:00
$return [ 'PDF_fields' ][ 'mobileTelephoneNumber' ] = _ ( 'Mobile number' );
2009-10-03 15:46:26 +00:00
}
2009-10-03 17:48:37 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideFaxNumber' )) {
2011-01-09 16:20:21 +00:00
$return [ 'PDF_fields' ][ 'facsimileTelephoneNumber' ] = _ ( 'Fax number' );
2009-10-03 15:46:26 +00:00
}
2009-10-03 17:48:37 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideEMailAddress' )) {
2010-04-05 12:38:23 +00:00
$return [ 'PDF_fields' ][ 'mail' ] = _ ( 'Email address' );
2009-10-03 15:46:26 +00:00
}
2011-12-11 13:36:34 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideLabeledURI' )) {
$return [ 'PDF_fields' ][ 'labeledURI' ] = _ ( 'Web site' );
}
2009-10-03 17:48:37 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideJobTitle' )) {
2010-04-05 12:38:23 +00:00
$return [ 'PDF_fields' ][ 'title' ] = _ ( 'Job title' );
2009-10-03 15:46:26 +00:00
}
2009-10-03 17:48:37 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideCarLicense' )) {
2010-04-05 12:38:23 +00:00
$return [ 'PDF_fields' ][ 'carLicense' ] = _ ( 'Car license' );
2009-10-03 15:46:26 +00:00
}
2009-10-03 17:48:37 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideEmployeeType' )) {
2010-04-05 12:38:23 +00:00
$return [ 'PDF_fields' ][ 'employeeType' ] = _ ( 'Employee type' );
2009-10-03 15:46:26 +00:00
}
2009-10-03 17:48:37 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideBusinessCategory' )) {
2010-04-05 12:38:23 +00:00
$return [ 'PDF_fields' ][ 'businessCategory' ] = _ ( 'Business category' );
2009-10-03 15:46:26 +00:00
}
2009-10-03 17:48:37 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideDepartments' )) {
2012-01-06 17:34:39 +00:00
$return [ 'PDF_fields' ][ 'departmentNumber' ] = _ ( 'Department' );
2009-10-03 15:46:26 +00:00
}
2009-10-03 17:48:37 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideManager' )) {
2010-04-05 12:38:23 +00:00
$return [ 'PDF_fields' ][ 'manager' ] = _ ( 'Manager' );
2009-10-03 15:46:26 +00:00
}
2011-05-01 11:58:34 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideO' )) {
$return [ 'PDF_fields' ][ 'o' ] = _ ( 'Organisation' );
}
2012-10-14 08:32:26 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideOu' )) {
$return [ 'PDF_fields' ][ 'ou' ] = _ ( 'Organisational unit' );
}
2011-05-01 11:58:34 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideEmployeeNumber' )) {
$return [ 'PDF_fields' ][ 'employeeNumber' ] = _ ( 'Employee number' );
}
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideInitials' )) {
$return [ 'PDF_fields' ][ 'initials' ] = _ ( 'Initials' );
}
2009-10-03 15:46:26 +00:00
2008-05-15 17:32:59 +00:00
if ( isset ( $_SESSION [ 'loggedIn' ]) && ( $_SESSION [ 'loggedIn' ] === true )) {
2005-06-19 09:38:44 +00:00
$modules = $_SESSION [ 'config' ] -> get_AccountModules ( $this -> get_scope ());
if ( ! in_array ( 'posixAccount' , $modules )) {
2013-03-10 19:53:48 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideUID' )) {
$return [ 'PDF_fields' ][ 'uid' ] = _ ( 'User name' );
}
2010-04-05 12:38:23 +00:00
$return [ 'PDF_fields' ][ 'cn' ] = _ ( 'Common name' );
2005-06-19 09:38:44 +00:00
}
}
2004-09-08 17:39:06 +00:00
// help Entries
2004-10-28 15:14:54 +00:00
$return [ 'help' ] = array (
2009-10-03 15:46:26 +00:00
'description' => array (
2012-01-31 19:32:25 +00:00
" Headline " => _ ( " Description " ), 'attr' => 'description' ,
2009-10-03 15:46:26 +00:00
" Text " => _ ( " User description. If left empty sur- and give name will be used. " )
),
'title' => array (
2012-01-31 19:32:25 +00:00
" Headline " => _ ( " Job title " ), 'attr' => 'title' ,
2009-10-03 15:46:26 +00:00
" Text " => _ ( " Job title of user: President, department manager, ... " )
),
2013-02-17 19:58:23 +00:00
'titleList' => array (
" Headline " => _ ( " Job title " ), 'attr' => 'title' ,
" Text " => _ ( " Job title of user: President, department manager, ... " ) . ' ' . _ ( " Multiple values are separated by semicolon. " )
),
2009-10-03 15:46:26 +00:00
'givenName' => array (
2012-01-31 19:32:25 +00:00
" Headline " => _ ( " First name " ), 'attr' => 'givenName' ,
2009-10-03 15:46:26 +00:00
" Text " => _ ( " First name of user. Only letters, - and spaces are allowed. " )
),
'sn' => array (
2012-01-31 19:32:25 +00:00
" Headline " => _ ( " Last name " ), 'attr' => 'sn' ,
2009-10-03 15:46:26 +00:00
" Text " => _ ( " Last name of user. Only letters, - and spaces are allowed. " )
),
'employeeType' => array (
2012-01-31 19:32:25 +00:00
" Headline " => _ ( " Employee type " ), 'attr' => 'employeeType' ,
2009-10-03 15:46:26 +00:00
" Text " => _ ( " Employee type: Contractor, Employee, Intern, Temp, External, ... " )
),
'manager' => array (
2012-01-31 19:32:25 +00:00
" Headline " => _ ( " Manager " ), 'attr' => 'manager' ,
2009-10-03 15:46:26 +00:00
" Text " => _ ( " This is the LDAP DN of the user's manager. Use this property to represent hierarchies in your company. " )
),
2011-12-20 20:40:51 +00:00
'managerList' => array (
2012-01-31 19:32:25 +00:00
" Headline " => _ ( " Manager " ), 'attr' => 'manager' ,
2011-12-20 20:40:51 +00:00
" Text " => _ ( " This is the LDAP DN of the user's manager. Use this property to represent hierarchies in your company. " ) . ' ' . _ ( " Multiple values are separated by semicolon. " )
),
2009-10-03 15:46:26 +00:00
'street' => array (
2012-01-31 19:32:25 +00:00
" Headline " => _ ( " Street " ), 'attr' => 'street' ,
2012-01-06 17:34:39 +00:00
" Text " => _ ( " The street name of the user's address. " )
),
'streetList' => array (
2012-01-31 19:32:25 +00:00
" Headline " => _ ( " Street " ), 'attr' => 'street' ,
2011-10-08 19:28:38 +00:00
" Text " => _ ( " The street name of the user's address. " ) . ' ' . _ ( " Multiple values are separated by semicolon. " )
2009-10-03 15:46:26 +00:00
),
'postOfficeBox' => array (
2012-01-31 19:32:25 +00:00
" Headline " => _ ( " Post office box " ), 'attr' => 'postOfficeBox' ,
2012-01-06 17:34:39 +00:00
" Text " => _ ( " The post office box of the user's address. " )
),
'postOfficeBoxList' => array (
2012-01-31 19:32:25 +00:00
" Headline " => _ ( " Post office box " ), 'attr' => 'postOfficeBox' ,
2011-10-08 19:28:38 +00:00
" Text " => _ ( " The post office box of the user's address. " ) . ' ' . _ ( " Multiple values are separated by semicolon. " )
2009-10-03 15:46:26 +00:00
),
'postalCode' => array (
2012-01-31 19:32:25 +00:00
" Headline " => _ ( " Postal code " ), 'attr' => 'postalCode' ,
2012-01-06 17:34:39 +00:00
" Text " => _ ( " The postal code of the user's address. " )
),
'postalCodeList' => array (
2012-01-31 19:32:25 +00:00
" Headline " => _ ( " Postal code " ), 'attr' => 'postalCode' ,
2011-10-08 19:28:38 +00:00
" Text " => _ ( " The postal code of the user's address. " ) . ' ' . _ ( " Multiple values are separated by semicolon. " )
2009-10-03 15:46:26 +00:00
),
'postalAddress' => array (
2012-01-31 19:32:25 +00:00
" Headline " => _ ( " Postal address " ), 'attr' => 'postalAddress' ,
2009-10-03 15:46:26 +00:00
" Text " => _ ( " Postal address, city " )
),
2011-11-03 18:31:33 +00:00
'registeredAddress' => array (
2012-01-31 19:32:25 +00:00
" Headline " => _ ( " Registered address " ), 'attr' => 'registeredAddress' ,
2011-11-03 18:31:33 +00:00
" Text " => _ ( " Registered address, city " )
),
2009-10-03 15:46:26 +00:00
'telephoneNumber' => array (
2012-01-31 19:32:25 +00:00
" Headline " => _ ( " Telephone number " ), 'attr' => 'telephoneNumber' ,
2012-01-06 17:34:39 +00:00
" Text " => _ ( " The user's telephone number. " )
),
'telephoneNumberList' => array (
2012-01-31 19:32:25 +00:00
" Headline " => _ ( " Telephone number " ), 'attr' => 'telephoneNumber' ,
2011-04-30 16:50:08 +00:00
" Text " => _ ( " The user's telephone number. " ) . ' ' . _ ( 'Multiple values are separated by semicolon.' )
2009-10-03 15:46:26 +00:00
),
'mobileTelephoneNumber' => array (
2012-01-31 19:32:25 +00:00
" Headline " => _ ( " Mobile number " ), 'attr' => 'mobile' ,
2012-01-06 17:34:39 +00:00
" Text " => _ ( " The user's mobile number. " )
),
'mobileTelephoneNumberList' => array (
2012-01-31 19:32:25 +00:00
" Headline " => _ ( " Mobile number " ), 'attr' => 'mobile' ,
2011-04-30 16:50:08 +00:00
" Text " => _ ( " The user's mobile number. " ) . ' ' . _ ( 'Multiple values are separated by semicolon.' )
2009-10-03 15:46:26 +00:00
),
'facsimileTelephoneNumber' => array (
2012-01-31 19:32:25 +00:00
" Headline " => _ ( " Fax number " ), 'attr' => 'facsimileTelephoneNumber' ,
2012-01-06 17:34:39 +00:00
" Text " => _ ( " The user's fax number. " )
),
'facsimileTelephoneNumberList' => array (
2012-01-31 19:32:25 +00:00
" Headline " => _ ( " Fax number " ), 'attr' => 'facsimileTelephoneNumber' ,
2011-04-30 16:50:08 +00:00
" Text " => _ ( " The user's fax number. " ) . ' ' . _ ( 'Multiple values are separated by semicolon.' )
2009-10-03 15:46:26 +00:00
),
'mail' => array (
2012-01-31 19:32:25 +00:00
" Headline " => _ ( " Email address " ), 'attr' => 'mail' ,
2012-01-06 17:34:39 +00:00
" Text " => _ ( " The user's email address. " )
),
'mailList' => array (
2012-01-31 19:32:25 +00:00
" Headline " => _ ( " Email address " ), 'attr' => 'mail' ,
2011-04-30 16:50:08 +00:00
" Text " => _ ( " The user's email address. " ) . ' ' . _ ( 'Multiple values are separated by semicolon.' )
2009-10-03 15:46:26 +00:00
),
2013-04-28 10:21:45 +00:00
" mailPassword " => array (
" Headline " => _ ( " Send password via mail " ),
" Text " => _ ( " Sends the password to the user via mail. Please edit your LAM server profile to setup the mail settings. " )),
2011-12-11 13:36:34 +00:00
'labeledURI' => array (
2012-01-31 19:32:25 +00:00
" Headline " => _ ( " Web site " ), 'attr' => 'labeledURI' ,
2011-12-12 18:10:54 +00:00
" Text " => _ ( " The user's web site (e.g. http://www.company.com). " )
2011-12-11 13:36:34 +00:00
),
'labeledURIList' => array (
2012-01-31 19:32:25 +00:00
" Headline " => _ ( " Web site " ), 'attr' => 'labeledURI' ,
2011-12-12 18:10:54 +00:00
" Text " => _ ( " The user's web site (e.g. http://www.company.com). " ) . ' ' . _ ( 'Multiple values are separated by semicolon.' )
2011-12-11 13:36:34 +00:00
),
2009-10-03 15:46:26 +00:00
'cn' => array (
2012-01-31 19:32:25 +00:00
" Headline " => _ ( " Common name " ), 'attr' => 'cn' ,
2009-10-03 15:46:26 +00:00
" Text " => _ ( " This is the natural name of the user. If empty, the first and last name is used. " )
),
'uid' => array (
2012-01-31 19:32:25 +00:00
" Headline " => _ ( " User name " ), 'attr' => 'uid' ,
2012-02-18 13:48:08 +00:00
" Text " => _ ( " User name of the user who should be created. Valid characters are: a-z,A-Z,0-9, @.-_. " )
2009-10-03 15:46:26 +00:00
),
'photoUpload' => array (
2012-01-31 19:32:25 +00:00
" Headline " => _ ( " Add photo " ), 'attr' => 'jpegPhoto' ,
2009-10-03 15:46:26 +00:00
" Text " => _ ( " Please select an image file to upload. It must be in JPG format (.jpg/.jpeg). " )
),
'homePhone' => array (
2012-01-31 19:32:25 +00:00
" Headline " => _ ( " Home telephone number " ), 'attr' => 'homePhone' ,
2012-01-06 17:34:39 +00:00
" Text " => _ ( " The user's private telephone number. " )
),
'homePhoneList' => array (
2012-01-31 19:32:25 +00:00
" Headline " => _ ( " Home telephone number " ), 'attr' => 'homePhone' ,
2011-04-30 16:50:08 +00:00
" Text " => _ ( " The user's private telephone number. " ) . ' ' . _ ( 'Multiple values are separated by semicolon.' )
2009-10-03 15:46:26 +00:00
),
'roomNumber' => array (
2012-01-31 19:32:25 +00:00
" Headline " => _ ( " Room number " ), 'attr' => 'roomNumber' ,
2009-10-03 15:46:26 +00:00
" Text " => _ ( " The room number of the employee's office. " )
),
'businessCategory' => array (
2012-01-31 19:32:25 +00:00
" Headline " => _ ( " Business category " ), 'attr' => 'businessCategory' ,
2009-10-03 15:46:26 +00:00
" Text " => _ ( " Business category (e.g. Administration, IT-Services, Manangement, ...) " )
),
2013-02-17 19:58:23 +00:00
'businessCategoryList' => array (
" Headline " => _ ( " Business category " ), 'attr' => 'businessCategory' ,
" Text " => _ ( " Business category (e.g. Administration, IT-Services, Manangement, ...) " ) . '. ' . _ ( " Multiple values are separated by semicolon. " )
),
2009-10-03 15:46:26 +00:00
'l' => array (
2012-01-31 19:32:25 +00:00
" Headline " => _ ( " Location " ), 'attr' => 'l' ,
2012-01-06 17:34:39 +00:00
" Text " => _ ( " This describes the location of the user. " )
),
'lList' => array (
2012-01-31 19:32:25 +00:00
" Headline " => _ ( " Location " ), 'attr' => 'l' ,
2011-10-14 18:37:03 +00:00
" Text " => _ ( " This describes the location of the user. " ) . ' ' . _ ( " Multiple values are separated by semicolon. " )
2009-10-03 15:46:26 +00:00
),
'st' => array (
2012-01-31 19:32:25 +00:00
" Headline " => _ ( " State " ), 'attr' => 'st' ,
2012-01-06 17:34:39 +00:00
" Text " => _ ( " The state where the user resides or works. " )
),
'stList' => array (
2012-01-31 19:32:25 +00:00
" Headline " => _ ( " State " ), 'attr' => 'st' ,
2011-10-14 18:37:03 +00:00
" Text " => _ ( " The state where the user resides or works. " ) . ' ' . _ ( " Multiple values are separated by semicolon. " )
2009-10-03 15:46:26 +00:00
),
'carLicense' => array (
2012-01-31 19:32:25 +00:00
" Headline " => _ ( " Car license " ), 'attr' => 'carLicense' ,
2009-10-03 15:46:26 +00:00
" Text " => _ ( " This can be used to specify if the user has a car license. " )
),
'physicalDeliveryOfficeName' => array (
2012-01-31 19:32:25 +00:00
" Headline " => _ ( " Office name " ), 'attr' => 'physicalDeliveryOfficeName' ,
2009-10-03 15:46:26 +00:00
" Text " => _ ( " The office name of the user (e.g. YourCompany, Human Resources). " )
),
2012-03-20 20:30:35 +00:00
'physicalDeliveryOfficeNameList' => array (
" Headline " => _ ( " Office name " ), 'attr' => 'physicalDeliveryOfficeName' ,
" Text " => _ ( " The office name of the user (e.g. YourCompany, Human Resources). " ) . ' ' . _ ( " Multiple values are separated by semicolon. " )
),
2009-10-03 15:46:26 +00:00
'departmentNumber' => array (
2012-01-31 19:32:25 +00:00
" Headline " => _ ( " Department " ), 'attr' => 'departmentNumber' ,
2012-01-06 17:34:39 +00:00
" Text " => _ ( " Here you can enter the user's department. " )
),
'departmentNumberList' => array (
2012-01-31 19:32:25 +00:00
" Headline " => _ ( " Department " ), 'attr' => 'departmentNumber' ,
2012-01-06 17:34:39 +00:00
" Text " => _ ( " Here you can enter the user's department. " ) . ' ' . _ ( " Multiple values are separated by semicolon. " )
2009-10-03 15:46:26 +00:00
),
'hiddenOptions' => array (
" Headline " => _ ( " Hidden options " ),
" Text " => _ ( " The selected options will not be managed inside LAM. You can use this to reduce the number of displayed input fields. " )
2009-11-12 19:48:53 +00:00
),
'pwdHash' => array (
" Headline " => _ ( " Password hash type " ),
2012-08-26 17:54:31 +00:00
" Text " => _ ( " LAM supports CRYPT, CRYPT-SHA512, SHA, SSHA, MD5 and SMD5 to generate the hash value of passwords. SSHA and CRYPT are the most common but CRYPT does not support passwords greater than 8 letters. We do not recommend to use plain text passwords. " )
2011-05-01 11:58:34 +00:00
),
2012-10-14 08:32:26 +00:00
'ou' => array (
" Headline " => _ ( " Organisational unit " ), 'attr' => 'ou' ,
" Text " => _ ( " The user's organisational unit. " )
),
'ouList' => array (
" Headline " => _ ( " Organisational unit " ), 'attr' => 'ou' ,
" Text " => _ ( " The user's organisational unit. " ) . ' ' . _ ( 'Multiple values are separated by semicolon.' )
),
2011-05-01 11:58:34 +00:00
'o' => array (
2012-01-31 19:32:25 +00:00
" Headline " => _ ( " Organisation " ), 'attr' => 'o' ,
2012-01-06 17:34:39 +00:00
" Text " => _ ( " The user's organisation name. " )
),
'oList' => array (
2012-01-31 19:32:25 +00:00
" Headline " => _ ( " Organisation " ), 'attr' => 'o' ,
2011-05-01 11:58:34 +00:00
" Text " => _ ( " The user's organisation name. " ) . ' ' . _ ( 'Multiple values are separated by semicolon.' )
),
'employeeNumber' => array (
2012-01-31 19:32:25 +00:00
" Headline " => _ ( " Employee number " ), 'attr' => 'employeeNumber' ,
2011-05-01 11:58:34 +00:00
" Text " => _ ( " The user's unique employee number. " )
),
'initials' => array (
2012-01-31 19:32:25 +00:00
" Headline " => _ ( " Initials " ), 'attr' => 'initials' ,
2011-05-01 11:58:34 +00:00
" Text " => _ ( " The initials of the user's first names. " ) . ' ' . _ ( 'Multiple values are separated by semicolon.' )
),
2012-10-07 10:57:51 +00:00
'userPassword' => array (
" Headline " => _ ( " Password " ),
" Text " => _ ( " Please enter the password which you want to set for this account. " )
),
2013-01-28 21:15:55 +00:00
'userCertificate' => array (
" Headline " => _ ( 'User certificates' ),
" Text " => _ ( 'These are the user\'s certificates.' )
),
2004-10-30 16:46:06 +00:00
);
2004-06-13 19:58:58 +00:00
return $return ;
}
2005-08-15 18:36:56 +00:00
/**
* This functions return true if all needed settings are done .
*
* @ return boolean true , if all is ok
2004-02-09 18:11:01 +00:00
*/
function module_complete () {
2007-10-03 18:02:10 +00:00
if ( ! $this -> getAccountContainer () -> isNewAccount ) {
2005-08-26 08:53:16 +00:00
// check if account is based on our object class
2007-10-03 18:02:10 +00:00
$objectClasses = $this -> getAccountContainer () -> attributes_orig [ 'objectClass' ];
2005-08-26 08:53:16 +00:00
if ( is_array ( $objectClasses ) && ! in_array ( 'inetOrgPerson' , $objectClasses )) {
return true ;
}
}
2006-05-01 16:13:10 +00:00
if ( ! isset ( $this -> attributes [ 'sn' ][ 0 ]) || ( $this -> attributes [ 'sn' ][ 0 ] == '' )) return false ;
2011-03-26 12:47:30 +00:00
$modules = $_SESSION [ 'config' ] -> get_AccountModules ( $this -> get_scope ());
if ( ! in_array ( 'posixAccount' , $modules )) {
if (( $this -> getAccountContainer () -> rdn == 'uid' ) && ! isset ( $this -> attributes [ 'uid' ][ 0 ])) {
return false ;
}
}
2004-02-09 18:11:01 +00:00
return true ;
2006-08-13 12:58:19 +00:00
}
2005-08-26 08:53:16 +00:00
/**
* Controls if the module button the account page is visible and activated .
*
* @ return string status ( " enabled " , " disabled " , " hidden " )
*/
function getButtonStatus () {
2007-10-03 18:02:10 +00:00
if ( ! $this -> getAccountContainer () -> isNewAccount ) {
2005-08-26 08:53:16 +00:00
// check if account is based on our object class
2007-10-03 18:02:10 +00:00
$objectClasses = $this -> getAccountContainer () -> attributes_orig [ 'objectClass' ];
2005-08-26 08:53:16 +00:00
if ( is_array ( $objectClasses ) && ! in_array ( 'inetOrgPerson' , $objectClasses )) {
return " disabled " ;
}
}
return " enabled " ;
}
2007-11-03 14:17:19 +00:00
/**
* Returns a list of modifications which have to be made to the LDAP account .
*
* @ return array list of modifications
* < br > This function returns an array with 3 entries :
* < br > array ( DN1 ( 'add' => array ( $attr ), 'remove' => array ( $attr ), 'modify' => array ( $attr )), DN2 .... )
* < br > DN is the DN to change . It may be possible to change several DNs ( e . g . create a new user and add him to some groups via attribute memberUid )
* < br > " add " are attributes which have to be added to LDAP entry
* < br > " remove " are attributes which have to be removed from LDAP entry
* < br > " modify " are attributes which have to been modified in LDAP entry
2011-02-26 13:14:10 +00:00
* < br > " info " are values with informational value ( e . g . to be used later by pre / postModify actions )
2003-12-12 00:52:35 +00:00
*/
function save_attributes () {
2005-08-26 08:53:16 +00:00
// skip saving if account is based on another structural object class
2007-10-03 18:02:10 +00:00
if ( ! $this -> getAccountContainer () -> isNewAccount && ! in_array ( 'inetOrgPerson' , $this -> getAccountContainer () -> attributes_orig [ 'objectClass' ])) {
2005-08-26 08:53:16 +00:00
return array ();
}
2007-10-03 18:02:10 +00:00
$return = $this -> getAccountContainer () -> save_module_attributes ( $this -> attributes , $this -> orig );
2011-11-03 18:31:33 +00:00
// postalAddress, registeredAddress, facsimileTelephoneNumber and jpegPhoto need special removing
2011-10-15 09:46:13 +00:00
if ( isset ( $return [ $this -> getAccountContainer () -> dn_orig ][ 'remove' ][ 'postalAddress' ])) {
$return [ $this -> getAccountContainer () -> dn_orig ][ 'modify' ][ 'postalAddress' ] = $this -> attributes [ 'postalAddress' ];
unset ( $return [ $this -> getAccountContainer () -> dn_orig ][ 'remove' ][ 'postalAddress' ]);
2005-11-12 10:18:54 +00:00
}
2011-11-03 18:31:33 +00:00
if ( isset ( $return [ $this -> getAccountContainer () -> dn_orig ][ 'remove' ][ 'registeredAddress' ])) {
$return [ $this -> getAccountContainer () -> dn_orig ][ 'modify' ][ 'registeredAddress' ] = $this -> attributes [ 'registeredAddress' ];
unset ( $return [ $this -> getAccountContainer () -> dn_orig ][ 'remove' ][ 'registeredAddress' ]);
}
2011-10-15 09:46:13 +00:00
if ( isset ( $return [ $this -> getAccountContainer () -> dn_orig ][ 'remove' ][ 'facsimileTelephoneNumber' ])) {
$return [ $this -> getAccountContainer () -> dn_orig ][ 'modify' ][ 'facsimileTelephoneNumber' ] = $this -> attributes [ 'facsimileTelephoneNumber' ];
unset ( $return [ $this -> getAccountContainer () -> dn_orig ][ 'remove' ][ 'facsimileTelephoneNumber' ]);
2005-11-12 10:18:54 +00:00
}
2012-05-20 09:33:24 +00:00
if ( isset ( $return [ $this -> getAccountContainer () -> dn_orig ][ 'add' ][ 'facsimileTelephoneNumber' ])
&& isset ( $this -> orig [ 'facsimileTelephoneNumber' ]) && ( sizeof ( $this -> orig [ 'facsimileTelephoneNumber' ]) > 0 )) {
$return [ $this -> getAccountContainer () -> dn_orig ][ 'modify' ][ 'facsimileTelephoneNumber' ] = $this -> attributes [ 'facsimileTelephoneNumber' ];
unset ( $return [ $this -> getAccountContainer () -> dn_orig ][ 'add' ][ 'facsimileTelephoneNumber' ]);
}
2011-10-15 09:46:13 +00:00
if ( isset ( $return [ $this -> getAccountContainer () -> dn_orig ][ 'remove' ][ 'jpegPhoto' ])) {
$return [ $this -> getAccountContainer () -> dn_orig ][ 'modify' ][ 'jpegPhoto' ] = array ();
unset ( $return [ $this -> getAccountContainer () -> dn_orig ][ 'remove' ][ 'jpegPhoto' ]);
2005-12-05 14:45:01 +00:00
}
2011-05-16 17:32:32 +00:00
// add information about clear text password
if ( $this -> clearTextPassword != null ) {
2011-10-15 09:46:13 +00:00
$return [ $this -> getAccountContainer () -> dn_orig ][ 'info' ][ 'userPasswordClearText' ][ 0 ] = $this -> clearTextPassword ;
2011-05-16 17:32:32 +00:00
}
2005-08-16 12:04:09 +00:00
return $return ;
2005-08-15 18:36:56 +00:00
}
2003-12-30 15:36:30 +00:00
2005-09-07 12:58:34 +00:00
/**
* Processes user input of the primary module page .
* It checks if all input values are correct and updates the associated LDAP attributes .
*
* @ return array list of info / error messages
*/
2006-08-13 12:58:19 +00:00
function process_attributes () {
2006-05-20 16:32:02 +00:00
$errors = array ();
2007-11-14 09:12:27 +00:00
// add parent object classes
if ( $this -> getAccountContainer () -> isNewAccount ) {
if ( ! in_array ( 'organizationalPerson' , $this -> attributes [ 'objectClass' ])) {
$this -> attributes [ 'objectClass' ][] = 'organizationalPerson' ;
}
if ( ! in_array ( 'person' , $this -> attributes [ 'objectClass' ])) {
$this -> attributes [ 'objectClass' ][] = 'person' ;
}
}
2012-01-03 19:31:29 +00:00
// load and check attributes
// description
2009-10-03 17:48:37 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideDescription' )) {
2012-01-03 19:31:29 +00:00
$descriptionCounter = 0 ;
while ( isset ( $_POST [ 'description' . $descriptionCounter ])) {
$this -> attributes [ 'description' ][ $descriptionCounter ] = $_POST [ 'description' . $descriptionCounter ];
if ( $this -> attributes [ 'description' ][ $descriptionCounter ] == '' ) {
unset ( $this -> attributes [ 'description' ][ $descriptionCounter ]);
}
$descriptionCounter ++ ;
}
if ( isset ( $_POST [ 'addDescription' ])) {
$this -> attributes [ 'description' ][] = '' ;
}
$this -> attributes [ 'description' ] = array_values ( $this -> attributes [ 'description' ]);
2009-10-03 17:29:10 +00:00
}
2013-05-25 12:47:07 +00:00
$this -> attributes [ 'sn' ][ 0 ] = trim ( $_POST [ 'sn' ]);
2011-04-30 16:50:08 +00:00
if ( ! get_preg ( $this -> attributes [ 'sn' ][ 0 ], 'realname' )) $errors [] = $this -> messages [ 'lastname' ][ 0 ];
2013-05-25 12:47:07 +00:00
$this -> attributes [ 'givenName' ][ 0 ] = trim ( $_POST [ 'givenName' ]);
2009-10-03 17:29:10 +00:00
if (( $this -> attributes [ 'givenName' ][ 0 ] != '' ) && ! get_preg ( $this -> attributes [ 'givenName' ][ 0 ], 'realname' )) $errors [] = $this -> messages [ 'givenName' ][ 0 ];
2009-10-03 17:48:37 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideJobTitle' )) {
2013-02-17 19:58:23 +00:00
$titleCounter = 0 ;
while ( isset ( $_POST [ 'title' . $titleCounter ])) {
$this -> attributes [ 'title' ][ $titleCounter ] = $_POST [ 'title' . $titleCounter ];
if ( $this -> attributes [ 'title' ][ $titleCounter ] == '' ) {
unset ( $this -> attributes [ 'title' ][ $titleCounter ]);
}
2013-03-24 10:02:49 +00:00
elseif ( ! get_preg ( $this -> attributes [ 'title' ][ $titleCounter ], 'title' )) {
2013-02-17 19:58:23 +00:00
$errors [] = $this -> messages [ 'title' ][ 0 ];
}
$titleCounter ++ ;
}
if ( isset ( $_POST [ 'addtitle' ])) {
$this -> attributes [ 'title' ][] = '' ;
}
$this -> attributes [ 'title' ] = array_values ( $this -> attributes [ 'title' ]);
2009-10-03 17:29:10 +00:00
}
2009-10-03 17:48:37 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideEMailAddress' )) {
2012-01-06 17:34:39 +00:00
$mailCounter = 0 ;
while ( isset ( $_POST [ 'mail' . $mailCounter ])) {
2013-05-25 12:47:07 +00:00
$this -> attributes [ 'mail' ][ $mailCounter ] = trim ( $_POST [ 'mail' . $mailCounter ]);
2012-01-06 17:34:39 +00:00
if (( $_POST [ 'mail' . $mailCounter ] != '' ) && ! get_preg ( $this -> attributes [ 'mail' ][ $mailCounter ], 'email' )) $errors [] = $this -> messages [ 'email' ][ 0 ];
if ( $this -> attributes [ 'mail' ][ $mailCounter ] == '' ) {
unset ( $this -> attributes [ 'mail' ][ $mailCounter ]);
2011-04-30 16:50:08 +00:00
}
2012-01-06 17:34:39 +00:00
$mailCounter ++ ;
2011-04-30 16:50:08 +00:00
}
2012-01-06 17:34:39 +00:00
if ( isset ( $_POST [ 'addMail' ])) {
$this -> attributes [ 'mail' ][] = '' ;
}
$this -> attributes [ 'mail' ] = array_values ( $this -> attributes [ 'mail' ]);
2009-10-03 17:29:10 +00:00
}
2009-10-03 17:48:37 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideTelephoneNumber' )) {
2012-01-06 17:34:39 +00:00
$telephoneNumberCounter = 0 ;
while ( isset ( $_POST [ 'telephoneNumber' . $telephoneNumberCounter ])) {
2013-05-25 12:47:07 +00:00
$this -> attributes [ 'telephoneNumber' ][ $telephoneNumberCounter ] = trim ( $_POST [ 'telephoneNumber' . $telephoneNumberCounter ]);
2012-01-06 17:34:39 +00:00
if ( ! get_preg ( $this -> attributes [ 'telephoneNumber' ][ $telephoneNumberCounter ], 'telephone' )) $errors [] = $this -> messages [ 'telephoneNumber' ][ 0 ];
if ( $this -> attributes [ 'telephoneNumber' ][ $telephoneNumberCounter ] == '' ) {
unset ( $this -> attributes [ 'telephoneNumber' ][ $telephoneNumberCounter ]);
2011-04-30 16:50:08 +00:00
}
2012-01-06 17:34:39 +00:00
$telephoneNumberCounter ++ ;
}
if ( isset ( $_POST [ 'addTelephoneNumber' ])) {
$this -> attributes [ 'telephoneNumber' ][] = '' ;
2011-04-30 16:50:08 +00:00
}
2012-01-06 17:34:39 +00:00
$this -> attributes [ 'telephoneNumber' ] = array_values ( $this -> attributes [ 'telephoneNumber' ]);
2009-02-15 12:54:37 +00:00
}
2009-10-03 17:48:37 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideMobileNumber' )) {
2012-01-06 17:34:39 +00:00
$mobileCounter = 0 ;
while ( isset ( $_POST [ 'mobile' . $mobileCounter ])) {
2013-05-25 12:47:07 +00:00
$this -> attributes [ 'mobile' ][ $mobileCounter ] = trim ( $_POST [ 'mobile' . $mobileCounter ]);
2012-01-06 17:34:39 +00:00
if ( ! get_preg ( $this -> attributes [ 'mobile' ][ $mobileCounter ], 'telephone' )) $errors [] = $this -> messages [ 'mobileTelephone' ][ 0 ];
if ( $this -> attributes [ 'mobile' ][ $mobileCounter ] == '' ) {
unset ( $this -> attributes [ 'mobile' ][ $mobileCounter ]);
2011-04-30 16:50:08 +00:00
}
2012-01-06 17:34:39 +00:00
$mobileCounter ++ ;
}
if ( isset ( $_POST [ 'addMobile' ])) {
$this -> attributes [ 'mobile' ][] = '' ;
2011-04-30 16:50:08 +00:00
}
2012-01-06 17:34:39 +00:00
$this -> attributes [ 'mobile' ] = array_values ( $this -> attributes [ 'mobile' ]);
2005-07-02 12:05:33 +00:00
}
2009-10-03 17:48:37 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideFaxNumber' )) {
2012-01-06 17:34:39 +00:00
$facsimileTelephoneNumberCounter = 0 ;
while ( isset ( $_POST [ 'facsimileTelephoneNumber' . $facsimileTelephoneNumberCounter ])) {
2013-05-25 12:47:07 +00:00
$this -> attributes [ 'facsimileTelephoneNumber' ][ $facsimileTelephoneNumberCounter ] = trim ( $_POST [ 'facsimileTelephoneNumber' . $facsimileTelephoneNumberCounter ]);
2012-01-06 17:34:39 +00:00
if ( ! get_preg ( $this -> attributes [ 'facsimileTelephoneNumber' ][ $facsimileTelephoneNumberCounter ], 'telephone' )) $errors [] = $this -> messages [ 'facsimileNumber' ][ 0 ];
if ( $this -> attributes [ 'facsimileTelephoneNumber' ][ $facsimileTelephoneNumberCounter ] == '' ) {
unset ( $this -> attributes [ 'facsimileTelephoneNumber' ][ $facsimileTelephoneNumberCounter ]);
2011-04-30 16:50:08 +00:00
}
2012-01-06 17:34:39 +00:00
$facsimileTelephoneNumberCounter ++ ;
}
if ( isset ( $_POST [ 'addFacsimileTelephoneNumber' ])) {
$this -> attributes [ 'facsimileTelephoneNumber' ][] = '' ;
2011-04-30 16:50:08 +00:00
}
2012-01-06 17:34:39 +00:00
$this -> attributes [ 'facsimileTelephoneNumber' ] = array_values ( $this -> attributes [ 'facsimileTelephoneNumber' ]);
2011-04-30 16:50:08 +00:00
}
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideHomeTelephoneNumber' )) {
2012-01-06 17:34:39 +00:00
$homePhoneCounter = 0 ;
while ( isset ( $_POST [ 'homePhone' . $homePhoneCounter ])) {
2013-05-25 12:47:07 +00:00
$this -> attributes [ 'homePhone' ][ $homePhoneCounter ] = trim ( $_POST [ 'homePhone' . $homePhoneCounter ]);
2012-01-06 17:34:39 +00:00
if ( ! get_preg ( $this -> attributes [ 'homePhone' ][ $homePhoneCounter ], 'telephone' )) $errors [] = $this -> messages [ 'homePhone' ][ 0 ];
if ( $this -> attributes [ 'homePhone' ][ $homePhoneCounter ] == '' ) {
unset ( $this -> attributes [ 'homePhone' ][ $homePhoneCounter ]);
2011-04-30 16:50:08 +00:00
}
2012-01-06 17:34:39 +00:00
$homePhoneCounter ++ ;
}
if ( isset ( $_POST [ 'addHomePhone' ])) {
$this -> attributes [ 'homePhone' ][] = '' ;
2011-04-30 16:50:08 +00:00
}
2012-01-06 17:34:39 +00:00
$this -> attributes [ 'homePhone' ] = array_values ( $this -> attributes [ 'homePhone' ]);
2009-10-03 17:29:10 +00:00
}
2009-10-03 17:48:37 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideStreet' )) {
2012-01-06 17:34:39 +00:00
$streetCounter = 0 ;
while ( isset ( $_POST [ 'street' . $streetCounter ])) {
$this -> attributes [ 'street' ][ $streetCounter ] = $_POST [ 'street' . $streetCounter ];
if ( ! get_preg ( $this -> attributes [ 'street' ][ $streetCounter ], 'street' )) $errors [] = $this -> messages [ 'street' ][ 0 ];
if ( $this -> attributes [ 'street' ][ $streetCounter ] == '' ) {
unset ( $this -> attributes [ 'street' ][ $streetCounter ]);
2011-10-08 19:28:38 +00:00
}
2012-01-06 17:34:39 +00:00
$streetCounter ++ ;
2011-10-08 19:28:38 +00:00
}
2012-01-06 17:34:39 +00:00
if ( isset ( $_POST [ 'addStreet' ])) {
$this -> attributes [ 'street' ][] = '' ;
}
$this -> attributes [ 'street' ] = array_values ( $this -> attributes [ 'street' ]);
2009-10-03 17:29:10 +00:00
}
2009-10-03 17:48:37 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hidePostOfficeBox' )) {
2012-01-06 17:34:39 +00:00
$postOfficeBoxCounter = 0 ;
while ( isset ( $_POST [ 'postOfficeBox' . $postOfficeBoxCounter ])) {
$this -> attributes [ 'postOfficeBox' ][ $postOfficeBoxCounter ] = $_POST [ 'postOfficeBox' . $postOfficeBoxCounter ];
if ( $this -> attributes [ 'postOfficeBox' ][ $postOfficeBoxCounter ] == '' ) {
unset ( $this -> attributes [ 'postOfficeBox' ][ $postOfficeBoxCounter ]);
}
$postOfficeBoxCounter ++ ;
}
if ( isset ( $_POST [ 'addPostOfficeBox' ])) {
$this -> attributes [ 'postOfficeBox' ][] = '' ;
}
$this -> attributes [ 'postOfficeBox' ] = array_values ( $this -> attributes [ 'postOfficeBox' ]);
2009-10-03 17:29:10 +00:00
}
2009-10-03 17:48:37 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hidePostalCode' )) {
2012-01-06 17:34:39 +00:00
$postalCodeCounter = 0 ;
while ( isset ( $_POST [ 'postalCode' . $postalCodeCounter ])) {
$this -> attributes [ 'postalCode' ][ $postalCodeCounter ] = $_POST [ 'postalCode' . $postalCodeCounter ];
if ( ! get_preg ( $this -> attributes [ 'postalCode' ][ $postalCodeCounter ], 'postalCode' )) $errors [] = $this -> messages [ 'postalCode' ][ 0 ];
if ( $this -> attributes [ 'postalCode' ][ $postalCodeCounter ] == '' ) {
unset ( $this -> attributes [ 'postalCode' ][ $postalCodeCounter ]);
2011-10-08 19:28:38 +00:00
}
2012-01-06 17:34:39 +00:00
$postalCodeCounter ++ ;
}
if ( isset ( $_POST [ 'addPostalCode' ])) {
$this -> attributes [ 'postalCode' ][] = '' ;
2011-10-08 19:28:38 +00:00
}
2012-01-06 17:34:39 +00:00
$this -> attributes [ 'postalCode' ] = array_values ( $this -> attributes [ 'postalCode' ]);
2009-10-03 17:29:10 +00:00
}
2009-10-03 17:48:37 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hidePostalAddress' )) {
2011-10-14 18:37:03 +00:00
$addressCounter = 0 ;
while ( isset ( $_POST [ 'postalAddress' . $addressCounter ])) {
$this -> attributes [ 'postalAddress' ][ $addressCounter ] = implode ( '$' , preg_split ( '/[\r][\n]/' , $_POST [ 'postalAddress' . $addressCounter ]));
if ( ! get_preg ( $this -> attributes [ 'postalAddress' ][ $addressCounter ], 'postalAddress' )) $errors [] = $this -> messages [ 'postalAddress' ][ 0 ];
if ( $this -> attributes [ 'postalAddress' ][ $addressCounter ] == '' ) {
unset ( $this -> attributes [ 'postalAddress' ][ $addressCounter ]);
}
$addressCounter ++ ;
}
if ( isset ( $_POST [ 'addPostalAddress' ])) {
$this -> attributes [ 'postalAddress' ][] = '' ;
}
$this -> attributes [ 'postalAddress' ] = array_values ( $this -> attributes [ 'postalAddress' ]);
2009-10-03 17:29:10 +00:00
}
2011-12-11 13:36:34 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideLabeledURI' )) {
$labeledURICounter = 0 ;
while ( isset ( $_POST [ 'labeledURI' . $labeledURICounter ])) {
2013-05-25 12:47:07 +00:00
$this -> attributes [ 'labeledURI' ][ $labeledURICounter ] = trim ( $_POST [ 'labeledURI' . $labeledURICounter ]);
2011-12-11 13:36:34 +00:00
if ( $this -> attributes [ 'labeledURI' ][ $labeledURICounter ] == '' ) {
unset ( $this -> attributes [ 'labeledURI' ][ $labeledURICounter ]);
}
$labeledURICounter ++ ;
}
if ( isset ( $_POST [ 'addLabeledURI' ])) {
$this -> attributes [ 'labeledURI' ][] = '' ;
}
$this -> attributes [ 'labeledURI' ] = array_values ( $this -> attributes [ 'labeledURI' ]);
}
2011-11-03 18:31:33 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideRegisteredAddress' )) {
$addressCounter = 0 ;
while ( isset ( $_POST [ 'registeredAddress' . $addressCounter ])) {
$this -> attributes [ 'registeredAddress' ][ $addressCounter ] = implode ( '$' , preg_split ( '/[\r][\n]/' , $_POST [ 'registeredAddress' . $addressCounter ]));
if ( ! get_preg ( $this -> attributes [ 'registeredAddress' ][ $addressCounter ], 'postalAddress' )) $errors [] = $this -> messages [ 'registeredAddress' ][ 0 ];
if ( $this -> attributes [ 'registeredAddress' ][ $addressCounter ] == '' ) {
unset ( $this -> attributes [ 'registeredAddress' ][ $addressCounter ]);
}
$addressCounter ++ ;
}
if ( isset ( $_POST [ 'addRegisteredAddress' ])) {
$this -> attributes [ 'registeredAddress' ][] = '' ;
}
$this -> attributes [ 'registeredAddress' ] = array_values ( $this -> attributes [ 'registeredAddress' ]);
}
2009-10-03 17:48:37 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideEmployeeType' )) {
2009-10-03 17:29:10 +00:00
$this -> attributes [ 'employeeType' ][ 0 ] = $_POST [ 'employeeType' ];
2011-04-30 16:50:08 +00:00
if ( ! get_preg ( $this -> attributes [ 'employeeType' ][ 0 ], 'employeeType' )) $errors [] = $this -> messages [ 'employeeType' ][ 0 ];
2009-10-03 17:29:10 +00:00
}
2009-10-03 17:48:37 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideRoomNumber' )) {
2009-10-03 17:29:10 +00:00
$this -> attributes [ 'roomNumber' ][ 0 ] = $_POST [ 'roomNumber' ];
}
2009-10-03 17:48:37 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideLocation' )) {
2012-01-06 17:34:39 +00:00
$lCounter = 0 ;
while ( isset ( $_POST [ 'l' . $lCounter ])) {
$this -> attributes [ 'l' ][ $lCounter ] = $_POST [ 'l' . $lCounter ];
if ( $this -> attributes [ 'l' ][ $lCounter ] == '' ) {
unset ( $this -> attributes [ 'l' ][ $lCounter ]);
}
$lCounter ++ ;
}
if ( isset ( $_POST [ 'addL' ])) {
$this -> attributes [ 'l' ][] = '' ;
}
$this -> attributes [ 'l' ] = array_values ( $this -> attributes [ 'l' ]);
2009-10-03 17:29:10 +00:00
}
2009-10-03 17:48:37 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideState' )) {
2012-01-06 17:34:39 +00:00
$stCounter = 0 ;
while ( isset ( $_POST [ 'st' . $stCounter ])) {
$this -> attributes [ 'st' ][ $stCounter ] = $_POST [ 'st' . $stCounter ];
if ( $this -> attributes [ 'st' ][ $stCounter ] == '' ) {
unset ( $this -> attributes [ 'st' ][ $stCounter ]);
}
$stCounter ++ ;
}
if ( isset ( $_POST [ 'addSt' ])) {
$this -> attributes [ 'st' ][] = '' ;
}
$this -> attributes [ 'st' ] = array_values ( $this -> attributes [ 'st' ]);
2009-10-03 17:29:10 +00:00
}
2009-10-03 17:48:37 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideCarLicense' )) {
2009-10-03 17:29:10 +00:00
$this -> attributes [ 'carLicense' ][ 0 ] = $_POST [ 'carLicense' ];
}
2009-10-03 17:48:37 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideOfficeName' )) {
2012-03-20 20:30:35 +00:00
$physicalDeliveryOfficeNameCounter = 0 ;
while ( isset ( $_POST [ 'physicalDeliveryOfficeName' . $physicalDeliveryOfficeNameCounter ])) {
$this -> attributes [ 'physicalDeliveryOfficeName' ][ $physicalDeliveryOfficeNameCounter ] = $_POST [ 'physicalDeliveryOfficeName' . $physicalDeliveryOfficeNameCounter ];
if ( $this -> attributes [ 'physicalDeliveryOfficeName' ][ $physicalDeliveryOfficeNameCounter ] == '' ) {
unset ( $this -> attributes [ 'physicalDeliveryOfficeName' ][ $physicalDeliveryOfficeNameCounter ]);
}
$physicalDeliveryOfficeNameCounter ++ ;
}
if ( isset ( $_POST [ 'addPhysicalDeliveryOfficeName' ])) {
$this -> attributes [ 'physicalDeliveryOfficeName' ][] = '' ;
}
$this -> attributes [ 'physicalDeliveryOfficeName' ] = array_values ( $this -> attributes [ 'physicalDeliveryOfficeName' ]);
2009-10-03 17:29:10 +00:00
}
2013-02-17 19:58:23 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideBusinessCategory' )) {
$businessCategoryCounter = 0 ;
while ( isset ( $_POST [ 'businessCategory' . $businessCategoryCounter ])) {
$this -> attributes [ 'businessCategory' ][ $businessCategoryCounter ] = $_POST [ 'businessCategory' . $businessCategoryCounter ];
if ( $this -> attributes [ 'businessCategory' ][ $businessCategoryCounter ] == '' ) {
unset ( $this -> attributes [ 'businessCategory' ][ $businessCategoryCounter ]);
}
2013-03-24 10:02:49 +00:00
elseif ( ! get_preg ( $this -> attributes [ 'businessCategory' ][ $businessCategoryCounter ], 'businessCategory' )) {
2013-02-17 19:58:23 +00:00
$errors [] = $this -> messages [ 'businessCategory' ][ 0 ];
}
$businessCategoryCounter ++ ;
}
if ( isset ( $_POST [ 'addbusinessCategory' ])) {
$this -> attributes [ 'businessCategory' ][] = '' ;
}
$this -> attributes [ 'businessCategory' ] = array_values ( $this -> attributes [ 'businessCategory' ]);
}
2009-10-03 17:48:37 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideDepartments' )) {
2012-01-06 17:34:39 +00:00
$departmentNumberCounter = 0 ;
while ( isset ( $_POST [ 'departmentNumber' . $departmentNumberCounter ])) {
$this -> attributes [ 'departmentNumber' ][ $departmentNumberCounter ] = $_POST [ 'departmentNumber' . $departmentNumberCounter ];
if ( $this -> attributes [ 'departmentNumber' ][ $departmentNumberCounter ] == '' ) {
unset ( $this -> attributes [ 'departmentNumber' ][ $departmentNumberCounter ]);
2009-10-03 17:29:10 +00:00
}
2012-01-06 17:34:39 +00:00
$departmentNumberCounter ++ ;
}
if ( isset ( $_POST [ 'addDepartmentNumber' ])) {
$this -> attributes [ 'departmentNumber' ][] = '' ;
2009-10-03 17:29:10 +00:00
}
2012-01-06 17:34:39 +00:00
$this -> attributes [ 'departmentNumber' ] = array_values ( $this -> attributes [ 'departmentNumber' ]);
2009-10-03 17:29:10 +00:00
}
2011-05-01 11:58:34 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideEmployeeNumber' )) {
$this -> attributes [ 'employeeNumber' ][ 0 ] = $_POST [ 'employeeNumber' ];
}
2012-10-14 08:32:26 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideOu' )) {
$ouCounter = 0 ;
while ( isset ( $_POST [ 'ou' . $ouCounter ])) {
$this -> attributes [ 'ou' ][ $ouCounter ] = $_POST [ 'ou' . $ouCounter ];
if ( $this -> attributes [ 'ou' ][ $ouCounter ] == '' ) {
unset ( $this -> attributes [ 'ou' ][ $ouCounter ]);
}
$ouCounter ++ ;
}
if ( isset ( $_POST [ 'addOu' ])) {
$this -> attributes [ 'ou' ][] = '' ;
}
$this -> attributes [ 'ou' ] = array_values ( $this -> attributes [ 'ou' ]);
}
2011-05-01 11:58:34 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideO' )) {
2012-01-06 17:34:39 +00:00
$oCounter = 0 ;
while ( isset ( $_POST [ 'o' . $oCounter ])) {
$this -> attributes [ 'o' ][ $oCounter ] = $_POST [ 'o' . $oCounter ];
if ( $this -> attributes [ 'o' ][ $oCounter ] == '' ) {
unset ( $this -> attributes [ 'o' ][ $oCounter ]);
}
$oCounter ++ ;
}
if ( isset ( $_POST [ 'addO' ])) {
$this -> attributes [ 'o' ][] = '' ;
}
$this -> attributes [ 'o' ] = array_values ( $this -> attributes [ 'o' ]);
2011-05-01 11:58:34 +00:00
}
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideInitials' )) {
$this -> attributes [ 'initials' ] = preg_split ( '/;[ ]*/' , $_POST [ 'initials' ]);
}
2005-06-19 09:38:44 +00:00
$modules = $_SESSION [ 'config' ] -> get_AccountModules ( $this -> get_scope ());
if ( ! in_array ( 'posixAccount' , $modules )) {
// uid
2013-03-10 19:53:48 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideUID' )) {
if ( isset ( $_POST [ 'userName' ]) && ( $_POST [ 'userName' ] != '' )) {
if ( ! get_preg ( $_POST [ 'userName' ], 'username' )) {
$errors [] = $this -> messages [ 'uid' ][ 0 ];
}
else {
$this -> attributes [ 'uid' ][ 0 ] = $_POST [ 'userName' ];
}
2007-07-21 09:47:48 +00:00
}
2013-03-10 19:53:48 +00:00
elseif ( isset ( $this -> attributes [ 'uid' ][ 0 ])) {
unset ( $this -> attributes [ 'uid' ][ 0 ]);
2007-07-21 09:47:48 +00:00
}
2005-06-19 09:38:44 +00:00
}
// cn
2006-08-13 12:58:19 +00:00
if ( $_POST [ 'cn' ] == '' ) {
if ( $_POST [ 'givenName' ] != '' ) {
$this -> attributes [ 'cn' ][ 0 ] = $_POST [ 'givenName' ] . " " . $_POST [ 'sn' ];
2005-06-19 09:38:44 +00:00
}
else {
2006-08-13 12:58:19 +00:00
$this -> attributes [ 'cn' ][ 0 ] = $_POST [ 'sn' ];
2005-06-19 09:38:44 +00:00
}
}
else {
2006-08-13 12:58:19 +00:00
$this -> attributes [ 'cn' ][ 0 ] = $_POST [ 'cn' ];
2005-06-19 09:38:44 +00:00
}
if ( ! get_preg ( $this -> attributes [ 'cn' ][ 0 ], 'cn' )) {
2006-08-16 17:42:35 +00:00
$errors [] = $this -> messages [ 'cn' ][ 0 ];
2005-06-19 09:38:44 +00:00
}
2011-04-25 17:57:04 +00:00
if ( isset ( $_POST [ 'lockPassword' ])) {
$this -> attributes [ 'userPassword' ][ 0 ] = pwd_disable ( $this -> attributes [ 'userPassword' ][ 0 ]);
}
if ( isset ( $_POST [ 'unlockPassword' ])) {
$this -> attributes [ 'userPassword' ][ 0 ] = pwd_enable ( $this -> attributes [ 'userPassword' ][ 0 ]);
}
if ( isset ( $_POST [ 'removePassword' ])) {
unset ( $this -> attributes [ 'userPassword' ]);
}
2005-06-19 09:38:44 +00:00
}
2011-04-25 17:57:04 +00:00
2008-04-24 18:50:02 +00:00
if ( isset ( $_POST [ 'delPhoto' ])) {
$this -> attributes [ 'jpegPhoto' ] = array ();
}
2003-12-30 15:36:30 +00:00
// Return error-messages
2006-05-20 16:32:02 +00:00
return $errors ;
2006-01-23 19:26:16 +00:00
}
2003-12-12 00:52:35 +00:00
2007-06-24 17:54:23 +00:00
/**
* Returns the HTML meta data for the main account page .
*
* @ return array HTML meta data
*/
2006-08-13 12:58:19 +00:00
function display_html_attributes () {
2013-03-24 15:25:01 +00:00
$this -> initCache ();
2013-03-24 10:02:49 +00:00
$equalWidthElements = array ();
2010-06-12 19:37:51 +00:00
$container = new htmlTable ();
$fieldContainer = new htmlTable ();
$imageContainer = new htmlTable ();
2010-06-13 12:35:19 +00:00
$imageContainer -> alignment = htmlElement :: ALIGN_TOP ;
2010-06-12 19:37:51 +00:00
$container -> addElement ( $fieldContainer );
2010-06-13 12:35:19 +00:00
$container -> addElement ( new htmlSpacer ( '50px' , null ));
$container -> addElement ( $imageContainer , false );
2005-06-19 09:38:44 +00:00
$modules = $_SESSION [ 'config' ] -> get_AccountModules ( $this -> get_scope ());
2013-03-10 19:53:48 +00:00
if ( ! in_array ( 'posixAccount' , $modules ) && ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideUID' )) {
2006-05-01 16:13:10 +00:00
$uid = '' ;
if ( isset ( $this -> attributes [ 'uid' ][ 0 ])) $uid = $this -> attributes [ 'uid' ][ 0 ];
2010-06-12 19:37:51 +00:00
$fieldContainer -> addElement ( new htmlTableExtendedInputField ( _ ( 'User name' ), 'userName' , $uid , 'uid' ), true );
2013-04-01 12:00:09 +00:00
$equalWidthElements [] = 'userName' ;
2005-06-19 09:38:44 +00:00
}
2006-05-01 16:13:10 +00:00
$firstName = '' ;
if ( isset ( $this -> attributes [ 'givenName' ][ 0 ])) $firstName = $this -> attributes [ 'givenName' ][ 0 ];
2010-06-12 19:37:51 +00:00
$fieldContainer -> addElement ( new htmlTableExtendedInputField ( _ ( 'First name' ), 'givenName' , $firstName , 'givenName' ), true );
2013-03-24 10:02:49 +00:00
$equalWidthElements [] = 'givenName' ;
2006-05-01 16:13:10 +00:00
$lastName = '' ;
if ( isset ( $this -> attributes [ 'sn' ][ 0 ])) $lastName = $this -> attributes [ 'sn' ][ 0 ];
2010-06-12 19:37:51 +00:00
$lastNameElement = new htmlTableExtendedInputField ( _ ( 'Last name' ), 'sn' , $lastName , 'sn' );
$lastNameElement -> setRequired ( true );
$fieldContainer -> addElement ( $lastNameElement , true );
2013-03-24 10:02:49 +00:00
$equalWidthElements [] = 'sn' ;
2011-05-01 11:58:34 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideInitials' )) {
$initials = '' ;
if ( isset ( $this -> attributes [ 'initials' ][ 0 ])) $initials = implode ( '; ' , $this -> attributes [ 'initials' ]);
$fieldContainer -> addElement ( new htmlTableExtendedInputField ( _ ( 'Initials' ), 'initials' , $initials , 'initials' ), true );
2013-03-24 10:02:49 +00:00
$equalWidthElements [] = 'initials' ;
2011-05-01 11:58:34 +00:00
}
2005-06-19 09:38:44 +00:00
if ( ! in_array ( 'posixAccount' , $modules )) {
2006-05-01 16:13:10 +00:00
$cn = '' ;
if ( isset ( $this -> attributes [ 'cn' ][ 0 ])) $cn = $this -> attributes [ 'cn' ][ 0 ];
2010-06-12 19:37:51 +00:00
$cnElement = new htmlTableExtendedInputField ( _ ( 'Common name' ), 'cn' , $cn , 'cn' );
$cnElement -> setRequired ( true );
$fieldContainer -> addElement ( $cnElement , true );
2013-03-24 10:02:49 +00:00
$equalWidthElements [] = 'cn' ;
2005-06-19 09:38:44 +00:00
}
2012-01-03 19:31:29 +00:00
// description
2009-10-03 17:48:37 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideDescription' )) {
2012-01-03 19:31:29 +00:00
$descriptions = array ();
if ( isset ( $this -> attributes [ 'description' ][ 0 ])) {
$descriptions = $this -> attributes [ 'description' ];
}
if ( sizeof ( $descriptions ) == 0 ) {
$descriptions [] = '' ;
}
$descriptionLabel = new htmlOutputText ( _ ( 'Description' ));
$descriptionLabel -> alignment = htmlElement :: ALIGN_TOP ;
$fieldContainer -> addElement ( $descriptionLabel );
$descriptionContainer = new htmlGroup ();
for ( $i = 0 ; $i < sizeof ( $descriptions ); $i ++ ) {
$descriptionContainer -> addElement ( new htmlInputField ( 'description' . $i , $descriptions [ $i ]));
2013-03-24 10:02:49 +00:00
$equalWidthElements [] = 'description' . $i ;
2012-01-03 19:31:29 +00:00
if ( $i < ( sizeof ( $descriptions ) - 1 )) {
$descriptionContainer -> addElement ( new htmlOutputText ( '<br>' , false ));
}
else {
$descriptionContainer -> addElement ( new htmlButton ( 'addDescription' , 'add.png' , true ));
}
}
$fieldContainer -> addElement ( $descriptionContainer );
$descriptionHelp = new htmlHelpLink ( 'description' );
$descriptionHelp -> alignment = htmlElement :: ALIGN_TOP ;
$fieldContainer -> addElement ( $descriptionHelp , true );
2009-10-03 17:29:10 +00:00
}
2010-06-12 19:37:51 +00:00
2011-04-30 09:12:32 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideStreet' ) || ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hidePostOfficeBox' )
|| ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hidePostalCode' ) || ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideLocation' )
|| ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideState' ) || ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hidePostalAddress' )
2011-11-03 18:31:33 +00:00
|| ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideOfficeName' ) || ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideRoomNumber' )
|| ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideRegisteredAddress' )) {
2011-04-30 09:12:32 +00:00
$fieldContainer -> addElement ( new htmlSubTitle ( _ ( 'Address' )), true );
}
2010-06-12 19:37:51 +00:00
2009-10-03 17:48:37 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideStreet' )) {
2012-01-06 17:34:39 +00:00
$streets = array ();
if ( isset ( $this -> attributes [ 'street' ][ 0 ])) {
$streets = $this -> attributes [ 'street' ];
}
if ( sizeof ( $streets ) == 0 ) {
$streets [] = '' ;
}
$streetLabel = new htmlOutputText ( _ ( 'Street' ));
$streetLabel -> alignment = htmlElement :: ALIGN_TOP ;
$fieldContainer -> addElement ( $streetLabel );
$streetContainer = new htmlGroup ();
for ( $i = 0 ; $i < sizeof ( $streets ); $i ++ ) {
$streetContainer -> addElement ( new htmlInputField ( 'street' . $i , $streets [ $i ]));
2013-03-24 10:02:49 +00:00
$equalWidthElements [] = 'street' . $i ;
2012-01-06 17:34:39 +00:00
if ( $i < ( sizeof ( $streets ) - 1 )) {
$streetContainer -> addElement ( new htmlOutputText ( '<br>' , false ));
}
else {
$streetContainer -> addElement ( new htmlButton ( 'addStreet' , 'add.png' , true ));
}
}
$fieldContainer -> addElement ( $streetContainer );
$streetHelp = new htmlHelpLink ( 'street' );
$streetHelp -> alignment = htmlElement :: ALIGN_TOP ;
$fieldContainer -> addElement ( $streetHelp , true );
2009-10-03 17:29:10 +00:00
}
2009-10-03 17:48:37 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hidePostOfficeBox' )) {
2012-01-06 17:34:39 +00:00
$postOfficeBoxes = array ();
if ( isset ( $this -> attributes [ 'postOfficeBox' ][ 0 ])) {
$postOfficeBoxes = $this -> attributes [ 'postOfficeBox' ];
}
if ( sizeof ( $postOfficeBoxes ) == 0 ) {
$postOfficeBoxes [] = '' ;
}
$postOfficeBoxLabel = new htmlOutputText ( _ ( 'Post office box' ));
$postOfficeBoxLabel -> alignment = htmlElement :: ALIGN_TOP ;
$fieldContainer -> addElement ( $postOfficeBoxLabel );
$postOfficeBoxContainer = new htmlGroup ();
for ( $i = 0 ; $i < sizeof ( $postOfficeBoxes ); $i ++ ) {
$postOfficeBoxContainer -> addElement ( new htmlInputField ( 'postOfficeBox' . $i , $postOfficeBoxes [ $i ]));
2013-03-24 10:02:49 +00:00
$equalWidthElements [] = 'postOfficeBox' . $i ;
2012-01-06 17:34:39 +00:00
if ( $i < ( sizeof ( $postOfficeBoxes ) - 1 )) {
$postOfficeBoxContainer -> addElement ( new htmlOutputText ( '<br>' , false ));
}
else {
$postOfficeBoxContainer -> addElement ( new htmlButton ( 'addPostOfficeBox' , 'add.png' , true ));
}
}
$fieldContainer -> addElement ( $postOfficeBoxContainer );
$postOfficeBoxHelp = new htmlHelpLink ( 'postOfficeBox' );
$postOfficeBoxHelp -> alignment = htmlElement :: ALIGN_TOP ;
$fieldContainer -> addElement ( $postOfficeBoxHelp , true );
2009-10-03 17:29:10 +00:00
}
2009-10-03 17:48:37 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hidePostalCode' )) {
2012-01-06 17:34:39 +00:00
$postalCodes = array ();
if ( isset ( $this -> attributes [ 'postalCode' ][ 0 ])) {
$postalCodes = $this -> attributes [ 'postalCode' ];
}
if ( sizeof ( $postalCodes ) == 0 ) {
$postalCodes [] = '' ;
}
$postalCodeLabel = new htmlOutputText ( _ ( 'Postal code' ));
$postalCodeLabel -> alignment = htmlElement :: ALIGN_TOP ;
$fieldContainer -> addElement ( $postalCodeLabel );
$postalCodeContainer = new htmlGroup ();
for ( $i = 0 ; $i < sizeof ( $postalCodes ); $i ++ ) {
$postalCodeContainer -> addElement ( new htmlInputField ( 'postalCode' . $i , $postalCodes [ $i ]));
2013-03-24 10:02:49 +00:00
$equalWidthElements [] = 'postalCode' . $i ;
2012-01-06 17:34:39 +00:00
if ( $i < ( sizeof ( $postalCodes ) - 1 )) {
$postalCodeContainer -> addElement ( new htmlOutputText ( '<br>' , false ));
}
else {
$postalCodeContainer -> addElement ( new htmlButton ( 'addPostalCode' , 'add.png' , true ));
}
}
$fieldContainer -> addElement ( $postalCodeContainer );
$postalCodeHelp = new htmlHelpLink ( 'postalCode' );
$postalCodeHelp -> alignment = htmlElement :: ALIGN_TOP ;
$fieldContainer -> addElement ( $postalCodeHelp , true );
2009-10-03 17:29:10 +00:00
}
2009-10-03 17:48:37 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideLocation' )) {
2012-01-06 17:34:39 +00:00
$locations = array ();
if ( isset ( $this -> attributes [ 'l' ][ 0 ])) {
$locations = $this -> attributes [ 'l' ];
}
if ( sizeof ( $locations ) == 0 ) {
$locations [] = '' ;
}
$locationLabel = new htmlOutputText ( _ ( 'Location' ));
$locationLabel -> alignment = htmlElement :: ALIGN_TOP ;
$fieldContainer -> addElement ( $locationLabel );
$locationContainer = new htmlGroup ();
for ( $i = 0 ; $i < sizeof ( $locations ); $i ++ ) {
$locationContainer -> addElement ( new htmlInputField ( 'l' . $i , $locations [ $i ]));
2013-03-24 10:02:49 +00:00
$equalWidthElements [] = 'l' . $i ;
2012-01-06 17:34:39 +00:00
if ( $i < ( sizeof ( $locations ) - 1 )) {
$locationContainer -> addElement ( new htmlOutputText ( '<br>' , false ));
}
else {
$locationContainer -> addElement ( new htmlButton ( 'addL' , 'add.png' , true ));
}
}
$fieldContainer -> addElement ( $locationContainer );
$locationHelp = new htmlHelpLink ( 'l' );
$locationHelp -> alignment = htmlElement :: ALIGN_TOP ;
$fieldContainer -> addElement ( $locationHelp , true );
2009-10-03 17:29:10 +00:00
}
2009-10-03 17:48:37 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideState' )) {
2012-01-06 17:34:39 +00:00
$states = array ();
if ( isset ( $this -> attributes [ 'st' ][ 0 ])) {
$states = $this -> attributes [ 'st' ];
}
if ( sizeof ( $states ) == 0 ) {
$states [] = '' ;
}
$stateLabel = new htmlOutputText ( _ ( 'State' ));
$stateLabel -> alignment = htmlElement :: ALIGN_TOP ;
$fieldContainer -> addElement ( $stateLabel );
$stateContainer = new htmlGroup ();
for ( $i = 0 ; $i < sizeof ( $states ); $i ++ ) {
$stateContainer -> addElement ( new htmlInputField ( 'st' . $i , $states [ $i ]));
2013-03-24 10:02:49 +00:00
$equalWidthElements [] = 'st' . $i ;
2012-01-06 17:34:39 +00:00
if ( $i < ( sizeof ( $states ) - 1 )) {
$stateContainer -> addElement ( new htmlOutputText ( '<br>' , false ));
}
else {
$stateContainer -> addElement ( new htmlButton ( 'addSt' , 'add.png' , true ));
}
}
$fieldContainer -> addElement ( $stateContainer );
$stateHelp = new htmlHelpLink ( 'st' );
$stateHelp -> alignment = htmlElement :: ALIGN_TOP ;
$fieldContainer -> addElement ( $stateHelp , true );
2009-10-03 17:29:10 +00:00
}
2009-10-03 17:48:37 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hidePostalAddress' )) {
2011-10-14 18:37:03 +00:00
$postalAddresses = array ();
2011-05-10 18:23:37 +00:00
if ( isset ( $this -> attributes [ 'postalAddress' ][ 0 ])) {
2011-10-14 18:37:03 +00:00
for ( $i = 0 ; $i < sizeof ( $this -> attributes [ 'postalAddress' ]); $i ++ ) {
$postalAddresses [] = implode ( " \r \n " , explode ( '$' , $this -> attributes [ 'postalAddress' ][ $i ]));
}
2011-05-10 18:23:37 +00:00
}
2011-10-14 18:37:03 +00:00
if ( sizeof ( $postalAddresses ) == 0 ) {
$postalAddresses [] = '' ;
}
$addressLabel = new htmlOutputText ( _ ( 'Postal address' ));
$addressLabel -> alignment = htmlElement :: ALIGN_TOP ;
$fieldContainer -> addElement ( $addressLabel );
$addressContainer = new htmlGroup ();
for ( $i = 0 ; $i < sizeof ( $postalAddresses ); $i ++ ) {
$addressContainer -> addElement ( new htmlInputTextarea ( 'postalAddress' . $i , $postalAddresses [ $i ], 30 , 3 ));
2013-03-24 10:02:49 +00:00
$equalWidthElements [] = 'postalAddress' . $i ;
2011-10-14 18:37:03 +00:00
if ( $i < ( sizeof ( $postalAddresses ) - 1 )) {
$addressContainer -> addElement ( new htmlOutputText ( '<br>' , false ));
}
else {
$addressContainer -> addElement ( new htmlButton ( 'addPostalAddress' , 'add.png' , true ));
}
}
$fieldContainer -> addElement ( $addressContainer );
$addressHelp = new htmlHelpLink ( 'postalAddress' );
$addressHelp -> alignment = htmlElement :: ALIGN_TOP ;
$fieldContainer -> addElement ( $addressHelp , true );
2009-10-03 17:29:10 +00:00
}
2011-11-03 18:31:33 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideRegisteredAddress' )) {
$registeredAddresses = array ();
if ( isset ( $this -> attributes [ 'registeredAddress' ][ 0 ])) {
for ( $i = 0 ; $i < sizeof ( $this -> attributes [ 'registeredAddress' ]); $i ++ ) {
$registeredAddresses [] = implode ( " \r \n " , explode ( '$' , $this -> attributes [ 'registeredAddress' ][ $i ]));
}
}
if ( sizeof ( $registeredAddresses ) == 0 ) {
$registeredAddresses [] = '' ;
}
$registeredAddressLabel = new htmlOutputText ( _ ( 'Registered address' ));
$registeredAddressLabel -> alignment = htmlElement :: ALIGN_TOP ;
$fieldContainer -> addElement ( $registeredAddressLabel );
$registeredAddressContainer = new htmlGroup ();
for ( $i = 0 ; $i < sizeof ( $registeredAddresses ); $i ++ ) {
$registeredAddressContainer -> addElement ( new htmlInputTextarea ( 'registeredAddress' . $i , $registeredAddresses [ $i ], 30 , 3 ));
2013-03-24 10:02:49 +00:00
$equalWidthElements [] = 'registeredAddress' . $i ;
2011-11-03 18:31:33 +00:00
if ( $i < ( sizeof ( $registeredAddresses ) - 1 )) {
$registeredAddressContainer -> addElement ( new htmlOutputText ( '<br>' , false ));
}
else {
$registeredAddressContainer -> addElement ( new htmlButton ( 'addRegisteredAddress' , 'add.png' , true ));
}
}
$fieldContainer -> addElement ( $registeredAddressContainer );
$registeredAddressHelp = new htmlHelpLink ( 'registeredAddress' );
$registeredAddressHelp -> alignment = htmlElement :: ALIGN_TOP ;
$fieldContainer -> addElement ( $registeredAddressHelp , true );
}
2009-10-03 17:48:37 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideOfficeName' )) {
2012-03-20 20:30:35 +00:00
$physicalDeliveryOfficeNames = array ();
if ( isset ( $this -> attributes [ 'physicalDeliveryOfficeName' ][ 0 ])) {
$physicalDeliveryOfficeNames = $this -> attributes [ 'physicalDeliveryOfficeName' ];
}
if ( sizeof ( $physicalDeliveryOfficeNames ) == 0 ) {
$physicalDeliveryOfficeNames [] = '' ;
}
$physicalDeliveryOfficeNameLabel = new htmlOutputText ( _ ( 'Office name' ));
$physicalDeliveryOfficeNameLabel -> alignment = htmlElement :: ALIGN_TOP ;
$fieldContainer -> addElement ( $physicalDeliveryOfficeNameLabel );
$physicalDeliveryOfficeNameContainer = new htmlGroup ();
for ( $i = 0 ; $i < sizeof ( $physicalDeliveryOfficeNames ); $i ++ ) {
$physicalDeliveryOfficeNameContainer -> addElement ( new htmlInputField ( 'physicalDeliveryOfficeName' . $i , $physicalDeliveryOfficeNames [ $i ]));
2013-03-24 10:02:49 +00:00
$equalWidthElements [] = 'physicalDeliveryOfficeName' . $i ;
2012-03-20 20:30:35 +00:00
if ( $i < ( sizeof ( $physicalDeliveryOfficeNames ) - 1 )) {
$physicalDeliveryOfficeNameContainer -> addElement ( new htmlOutputText ( '<br>' , false ));
}
else {
$physicalDeliveryOfficeNameContainer -> addElement ( new htmlButton ( 'addPhysicalDeliveryOfficeName' , 'add.png' , true ));
}
}
$fieldContainer -> addElement ( $physicalDeliveryOfficeNameContainer );
$physicalDeliveryOfficeNameHelp = new htmlHelpLink ( 'physicalDeliveryOfficeName' );
$physicalDeliveryOfficeNameHelp -> alignment = htmlElement :: ALIGN_TOP ;
$fieldContainer -> addElement ( $physicalDeliveryOfficeNameHelp , true );
2009-10-03 17:29:10 +00:00
}
2009-10-03 17:48:37 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideRoomNumber' )) {
2009-10-03 17:29:10 +00:00
$roomNumber = '' ;
if ( isset ( $this -> attributes [ 'roomNumber' ][ 0 ])) $roomNumber = $this -> attributes [ 'roomNumber' ][ 0 ];
2010-06-12 19:37:51 +00:00
$fieldContainer -> addElement ( new htmlTableExtendedInputField ( _ ( 'Room number' ), 'roomNumber' , $roomNumber , 'roomNumber' ), true );
2013-03-24 10:02:49 +00:00
$equalWidthElements [] = 'roomNumber' ;
2009-10-03 17:29:10 +00:00
}
2008-02-09 18:01:29 +00:00
2011-04-30 09:12:32 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideTelephoneNumber' ) || ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideHomeTelephoneNumber' )
|| ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideMobileNumber' ) || ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideFaxNumber' )
2011-12-11 13:36:34 +00:00
|| ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideEMailAddress' ) || ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideLabeledURI' )) {
2011-04-30 09:12:32 +00:00
$fieldContainer -> addElement ( new htmlSubTitle ( _ ( 'Contact data' )), true );
}
2010-06-12 19:37:51 +00:00
2009-10-03 17:48:37 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideTelephoneNumber' )) {
2012-01-06 17:34:39 +00:00
$telephoneNumbers = array ();
if ( isset ( $this -> attributes [ 'telephoneNumber' ][ 0 ])) {
$telephoneNumbers = $this -> attributes [ 'telephoneNumber' ];
}
if ( sizeof ( $telephoneNumbers ) == 0 ) {
$telephoneNumbers [] = '' ;
}
$telephoneNumberLabel = new htmlOutputText ( _ ( 'Telephone number' ));
$telephoneNumberLabel -> alignment = htmlElement :: ALIGN_TOP ;
$fieldContainer -> addElement ( $telephoneNumberLabel );
$telephoneNumberContainer = new htmlGroup ();
for ( $i = 0 ; $i < sizeof ( $telephoneNumbers ); $i ++ ) {
$telephoneNumberContainer -> addElement ( new htmlInputField ( 'telephoneNumber' . $i , $telephoneNumbers [ $i ]));
2013-03-24 10:02:49 +00:00
$equalWidthElements [] = 'telephoneNumber' . $i ;
2012-01-06 17:34:39 +00:00
if ( $i < ( sizeof ( $telephoneNumbers ) - 1 )) {
$telephoneNumberContainer -> addElement ( new htmlOutputText ( '<br>' , false ));
}
else {
$telephoneNumberContainer -> addElement ( new htmlButton ( 'addTelephoneNumber' , 'add.png' , true ));
}
}
$fieldContainer -> addElement ( $telephoneNumberContainer );
$telephoneNumberHelp = new htmlHelpLink ( 'telephoneNumber' );
$telephoneNumberHelp -> alignment = htmlElement :: ALIGN_TOP ;
$fieldContainer -> addElement ( $telephoneNumberHelp , true );
2009-10-03 17:29:10 +00:00
}
2009-10-03 17:48:37 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideHomeTelephoneNumber' )) {
2012-01-06 17:34:39 +00:00
$homePhones = array ();
if ( isset ( $this -> attributes [ 'homePhone' ][ 0 ])) {
$homePhones = $this -> attributes [ 'homePhone' ];
}
if ( sizeof ( $homePhones ) == 0 ) {
$homePhones [] = '' ;
}
$homePhoneLabel = new htmlOutputText ( _ ( 'Home telephone number' ));
$homePhoneLabel -> alignment = htmlElement :: ALIGN_TOP ;
$fieldContainer -> addElement ( $homePhoneLabel );
$homePhoneContainer = new htmlGroup ();
for ( $i = 0 ; $i < sizeof ( $homePhones ); $i ++ ) {
$homePhoneContainer -> addElement ( new htmlInputField ( 'homePhone' . $i , $homePhones [ $i ]));
2013-03-24 10:02:49 +00:00
$equalWidthElements [] = 'homePhone' . $i ;
2012-01-06 17:34:39 +00:00
if ( $i < ( sizeof ( $homePhones ) - 1 )) {
$homePhoneContainer -> addElement ( new htmlOutputText ( '<br>' , false ));
}
else {
$homePhoneContainer -> addElement ( new htmlButton ( 'addHomePhone' , 'add.png' , true ));
}
}
$fieldContainer -> addElement ( $homePhoneContainer );
$homePhoneHelp = new htmlHelpLink ( 'homePhone' );
$homePhoneHelp -> alignment = htmlElement :: ALIGN_TOP ;
$fieldContainer -> addElement ( $homePhoneHelp , true );
2009-10-03 17:29:10 +00:00
}
2009-10-03 17:48:37 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideMobileNumber' )) {
2012-01-06 17:34:39 +00:00
$mobiles = array ();
if ( isset ( $this -> attributes [ 'mobile' ][ 0 ])) {
$mobiles = $this -> attributes [ 'mobile' ];
}
if ( sizeof ( $mobiles ) == 0 ) {
$mobiles [] = '' ;
}
$mobileLabel = new htmlOutputText ( _ ( 'Mobile number' ));
$mobileLabel -> alignment = htmlElement :: ALIGN_TOP ;
$fieldContainer -> addElement ( $mobileLabel );
$mobileContainer = new htmlGroup ();
for ( $i = 0 ; $i < sizeof ( $mobiles ); $i ++ ) {
$mobileContainer -> addElement ( new htmlInputField ( 'mobile' . $i , $mobiles [ $i ]));
2013-03-24 10:02:49 +00:00
$equalWidthElements [] = 'mobile' . $i ;
2012-01-06 17:34:39 +00:00
if ( $i < ( sizeof ( $mobiles ) - 1 )) {
$mobileContainer -> addElement ( new htmlOutputText ( '<br>' , false ));
}
else {
$mobileContainer -> addElement ( new htmlButton ( 'addMobile' , 'add.png' , true ));
}
}
$fieldContainer -> addElement ( $mobileContainer );
$mobileHelp = new htmlHelpLink ( 'mobileTelephoneNumber' );
$mobileHelp -> alignment = htmlElement :: ALIGN_TOP ;
$fieldContainer -> addElement ( $mobileHelp , true );
2009-10-03 17:29:10 +00:00
}
2009-10-03 17:48:37 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideFaxNumber' )) {
2012-01-06 17:34:39 +00:00
$facsimileTelephoneNumbers = array ();
if ( isset ( $this -> attributes [ 'facsimileTelephoneNumber' ][ 0 ])) {
$facsimileTelephoneNumbers = $this -> attributes [ 'facsimileTelephoneNumber' ];
}
if ( sizeof ( $facsimileTelephoneNumbers ) == 0 ) {
$facsimileTelephoneNumbers [] = '' ;
}
$facsimileTelephoneNumberLabel = new htmlOutputText ( _ ( 'Fax number' ));
$facsimileTelephoneNumberLabel -> alignment = htmlElement :: ALIGN_TOP ;
$fieldContainer -> addElement ( $facsimileTelephoneNumberLabel );
$facsimileTelephoneNumberContainer = new htmlGroup ();
for ( $i = 0 ; $i < sizeof ( $facsimileTelephoneNumbers ); $i ++ ) {
$facsimileTelephoneNumberContainer -> addElement ( new htmlInputField ( 'facsimileTelephoneNumber' . $i , $facsimileTelephoneNumbers [ $i ]));
2013-03-24 10:02:49 +00:00
$equalWidthElements [] = 'facsimileTelephoneNumber' . $i ;
2012-01-06 17:34:39 +00:00
if ( $i < ( sizeof ( $facsimileTelephoneNumbers ) - 1 )) {
$facsimileTelephoneNumberContainer -> addElement ( new htmlOutputText ( '<br>' , false ));
}
else {
$facsimileTelephoneNumberContainer -> addElement ( new htmlButton ( 'addFacsimileTelephoneNumber' , 'add.png' , true ));
}
}
$fieldContainer -> addElement ( $facsimileTelephoneNumberContainer );
$facsimileTelephoneNumberHelp = new htmlHelpLink ( 'facsimileTelephoneNumber' );
$facsimileTelephoneNumberHelp -> alignment = htmlElement :: ALIGN_TOP ;
$fieldContainer -> addElement ( $facsimileTelephoneNumberHelp , true );
2009-10-03 17:29:10 +00:00
}
2009-10-03 17:48:37 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideEMailAddress' )) {
2012-01-06 17:34:39 +00:00
$mails = array ();
if ( isset ( $this -> attributes [ 'mail' ][ 0 ])) {
$mails = $this -> attributes [ 'mail' ];
}
if ( sizeof ( $mails ) == 0 ) {
$mails [] = '' ;
}
$mailLabel = new htmlOutputText ( _ ( 'Email address' ));
$mailLabel -> alignment = htmlElement :: ALIGN_TOP ;
$fieldContainer -> addElement ( $mailLabel );
$mailContainer = new htmlGroup ();
for ( $i = 0 ; $i < sizeof ( $mails ); $i ++ ) {
$mailContainer -> addElement ( new htmlInputField ( 'mail' . $i , $mails [ $i ]));
2013-03-24 10:02:49 +00:00
$equalWidthElements [] = 'mail' . $i ;
2012-01-06 17:34:39 +00:00
if ( $i < ( sizeof ( $mails ) - 1 )) {
$mailContainer -> addElement ( new htmlOutputText ( '<br>' , false ));
}
else {
$mailContainer -> addElement ( new htmlButton ( 'addMail' , 'add.png' , true ));
}
}
$fieldContainer -> addElement ( $mailContainer );
$mailHelp = new htmlHelpLink ( 'mail' );
$mailHelp -> alignment = htmlElement :: ALIGN_TOP ;
$fieldContainer -> addElement ( $mailHelp , true );
2009-10-03 17:29:10 +00:00
}
2011-12-11 13:36:34 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideLabeledURI' )) {
$labeledURI = array ();
if ( isset ( $this -> attributes [ 'labeledURI' ][ 0 ])) {
$labeledURI = $this -> attributes [ 'labeledURI' ];
}
if ( sizeof ( $labeledURI ) == 0 ) {
$labeledURI [] = '' ;
}
$labeledURILabel = new htmlOutputText ( _ ( 'Web site' ));
$labeledURILabel -> alignment = htmlElement :: ALIGN_TOP ;
$fieldContainer -> addElement ( $labeledURILabel );
$labeledURIContainer = new htmlGroup ();
for ( $i = 0 ; $i < sizeof ( $labeledURI ); $i ++ ) {
$labeledURIContainer -> addElement ( new htmlInputField ( 'labeledURI' . $i , $labeledURI [ $i ]));
2013-03-24 10:02:49 +00:00
$equalWidthElements [] = 'labeledURI' . $i ;
2011-12-11 13:36:34 +00:00
if ( $i < ( sizeof ( $labeledURI ) - 1 )) {
$labeledURIContainer -> addElement ( new htmlOutputText ( '<br>' , false ));
}
else {
$labeledURIContainer -> addElement ( new htmlButton ( 'addLabeledURI' , 'add.png' , true ));
}
}
$fieldContainer -> addElement ( $labeledURIContainer );
$labeledURIHelp = new htmlHelpLink ( 'labeledURI' );
$labeledURIHelp -> alignment = htmlElement :: ALIGN_TOP ;
$fieldContainer -> addElement ( $labeledURIHelp , true );
}
2011-04-30 09:12:32 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideJobTitle' ) || ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideCarLicense' )
|| ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideEmployeeType' ) || ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideBusinessCategory' )
2013-01-28 21:15:55 +00:00
|| ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideDepartments' ) || ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideManager' )
|| ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideuserCertificate' )) {
2011-04-30 09:12:32 +00:00
$fieldContainer -> addElement ( new htmlSubTitle ( _ ( 'Work details' )), true );
}
2010-06-12 19:37:51 +00:00
2009-10-03 17:48:37 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideJobTitle' )) {
2013-02-17 19:58:23 +00:00
$titles = array ();
if ( isset ( $this -> attributes [ 'title' ][ 0 ])) {
$titles = $this -> attributes [ 'title' ];
}
if ( sizeof ( $titles ) == 0 ) {
$titles [] = '' ;
}
$titleLabel = new htmlOutputText ( _ ( 'Job title' ));
$titleLabel -> alignment = htmlElement :: ALIGN_TOP ;
$fieldContainer -> addElement ( $titleLabel );
$titleContainer = new htmlGroup ();
for ( $i = 0 ; $i < sizeof ( $titles ); $i ++ ) {
2013-03-24 15:25:01 +00:00
$titleInput = new htmlInputField ( 'title' . $i , $titles [ $i ]);
$titleInput -> enableAutocompletion ( $this -> titleCache );
$titleContainer -> addElement ( $titleInput );
2013-03-24 10:02:49 +00:00
$equalWidthElements [] = 'title' . $i ;
2013-02-17 19:58:23 +00:00
if ( $i < ( sizeof ( $titles ) - 1 )) {
$titleContainer -> addElement ( new htmlOutputText ( '<br>' , false ));
}
else {
$titleContainer -> addElement ( new htmlButton ( 'addtitle' , 'add.png' , true ));
}
}
$fieldContainer -> addElement ( $titleContainer );
$titleHelp = new htmlHelpLink ( 'title' );
$titleHelp -> alignment = htmlElement :: ALIGN_TOP ;
$fieldContainer -> addElement ( $titleHelp , true );
2009-10-03 17:29:10 +00:00
}
2009-10-03 17:48:37 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideCarLicense' )) {
2009-10-03 17:29:10 +00:00
$carLicense = '' ;
if ( isset ( $this -> attributes [ 'carLicense' ][ 0 ])) $carLicense = $this -> attributes [ 'carLicense' ][ 0 ];
2010-06-12 19:37:51 +00:00
$fieldContainer -> addElement ( new htmlTableExtendedInputField ( _ ( 'Car license' ), 'carLicense' , $carLicense , 'carLicense' ), true );
2013-03-24 10:02:49 +00:00
$equalWidthElements [] = 'carLicense' ;
2009-10-03 17:29:10 +00:00
}
2011-05-01 11:58:34 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideEmployeeNumber' )) {
$employeeNumber = '' ;
if ( isset ( $this -> attributes [ 'employeeNumber' ][ 0 ])) $employeeNumber = $this -> attributes [ 'employeeNumber' ][ 0 ];
$fieldContainer -> addElement ( new htmlTableExtendedInputField ( _ ( 'Employee number' ), 'employeeNumber' , $employeeNumber , 'employeeNumber' ), true );
2013-03-24 10:02:49 +00:00
$equalWidthElements [] = 'employeeNumber' ;
2011-05-01 11:58:34 +00:00
}
2009-10-03 17:48:37 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideEmployeeType' )) {
2009-10-03 17:29:10 +00:00
$employeeType = '' ;
if ( isset ( $this -> attributes [ 'employeeType' ][ 0 ])) $employeeType = $this -> attributes [ 'employeeType' ][ 0 ];
2013-03-24 15:25:01 +00:00
$employeeTypeInput = new htmlTableExtendedInputField ( _ ( 'Employee type' ), 'employeeType' , $employeeType , 'employeeType' );
$employeeTypeInput -> enableAutocompletion ( $this -> employeeTypeCache );
$fieldContainer -> addElement ( $employeeTypeInput , true );
2013-03-24 10:02:49 +00:00
$equalWidthElements [] = 'employeeType' ;
2009-10-03 17:29:10 +00:00
}
2009-10-03 17:48:37 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideBusinessCategory' )) {
2013-02-17 19:58:23 +00:00
$businessCategories = array ();
if ( isset ( $this -> attributes [ 'businessCategory' ][ 0 ])) {
$businessCategories = $this -> attributes [ 'businessCategory' ];
}
if ( sizeof ( $businessCategories ) == 0 ) {
$businessCategories [] = '' ;
}
$businessCategoryLabel = new htmlOutputText ( _ ( 'Business category' ));
$businessCategoryLabel -> alignment = htmlElement :: ALIGN_TOP ;
$fieldContainer -> addElement ( $businessCategoryLabel );
$businessCategoryContainer = new htmlGroup ();
for ( $i = 0 ; $i < sizeof ( $businessCategories ); $i ++ ) {
2013-03-24 15:25:01 +00:00
$businessCategoryInput = new htmlInputField ( 'businessCategory' . $i , $businessCategories [ $i ]);
$businessCategoryInput -> enableAutocompletion ( $this -> businessCategoryCache );
$businessCategoryContainer -> addElement ( $businessCategoryInput );
2013-03-24 10:02:49 +00:00
$equalWidthElements [] = 'businessCategory' . $i ;
2013-02-17 19:58:23 +00:00
if ( $i < ( sizeof ( $businessCategories ) - 1 )) {
$businessCategoryContainer -> addElement ( new htmlOutputText ( '<br>' , false ));
}
else {
$businessCategoryContainer -> addElement ( new htmlButton ( 'addbusinessCategory' , 'add.png' , true ));
}
}
$fieldContainer -> addElement ( $businessCategoryContainer );
$businessCategoryHelp = new htmlHelpLink ( 'businessCategory' );
$businessCategoryHelp -> alignment = htmlElement :: ALIGN_TOP ;
$fieldContainer -> addElement ( $businessCategoryHelp , true );
2009-10-03 17:29:10 +00:00
}
2009-10-03 17:48:37 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideDepartments' )) {
2012-01-06 17:34:39 +00:00
$departmentNumbers = array ();
if ( isset ( $this -> attributes [ 'departmentNumber' ][ 0 ])) {
$departmentNumbers = $this -> attributes [ 'departmentNumber' ];
}
if ( sizeof ( $departmentNumbers ) == 0 ) {
$departmentNumbers [] = '' ;
}
$departmentNumberLabel = new htmlOutputText ( _ ( 'Department' ));
$departmentNumberLabel -> alignment = htmlElement :: ALIGN_TOP ;
$fieldContainer -> addElement ( $departmentNumberLabel );
$departmentNumberContainer = new htmlGroup ();
for ( $i = 0 ; $i < sizeof ( $departmentNumbers ); $i ++ ) {
2013-03-24 15:25:01 +00:00
$departmentInput = new htmlInputField ( 'departmentNumber' . $i , $departmentNumbers [ $i ]);
$departmentInput -> enableAutocompletion ( $this -> departmentCache );
$departmentNumberContainer -> addElement ( $departmentInput );
2013-03-24 10:02:49 +00:00
$equalWidthElements [] = 'departmentNumber' . $i ;
2012-01-06 17:34:39 +00:00
if ( $i < ( sizeof ( $departmentNumbers ) - 1 )) {
$departmentNumberContainer -> addElement ( new htmlOutputText ( '<br>' , false ));
}
else {
$departmentNumberContainer -> addElement ( new htmlButton ( 'addDepartmentNumber' , 'add.png' , true ));
}
}
$fieldContainer -> addElement ( $departmentNumberContainer );
$departmentNumberHelp = new htmlHelpLink ( 'departmentNumber' );
$departmentNumberHelp -> alignment = htmlElement :: ALIGN_TOP ;
$fieldContainer -> addElement ( $departmentNumberHelp , true );
2009-10-03 17:29:10 +00:00
}
2012-10-14 08:32:26 +00:00
// organisational unit
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideOu' )) {
$ous = array ();
if ( isset ( $this -> attributes [ 'ou' ][ 0 ])) {
$ous = $this -> attributes [ 'ou' ];
}
if ( sizeof ( $ous ) == 0 ) {
$ous [] = '' ;
}
$ouLabel = new htmlOutputText ( _ ( 'Organisational unit' ));
$ouLabel -> alignment = htmlElement :: ALIGN_TOP ;
$fieldContainer -> addElement ( $ouLabel );
$ouContainer = new htmlGroup ();
for ( $i = 0 ; $i < sizeof ( $ous ); $i ++ ) {
2013-03-24 15:25:01 +00:00
$ouInput = new htmlInputField ( 'ou' . $i , $ous [ $i ]);
$ouInput -> enableAutocompletion ( $this -> ouCache );
$ouContainer -> addElement ( $ouInput );
2013-03-24 10:02:49 +00:00
$equalWidthElements [] = 'ou' . $i ;
2012-10-14 08:32:26 +00:00
if ( $i < ( sizeof ( $ous ) - 1 )) {
$ouContainer -> addElement ( new htmlOutputText ( '<br>' , false ));
}
else {
$ouContainer -> addElement ( new htmlButton ( 'addOu' , 'add.png' , true ));
}
}
$fieldContainer -> addElement ( $ouContainer );
$ouHelp = new htmlHelpLink ( 'ou' );
$ouHelp -> alignment = htmlElement :: ALIGN_TOP ;
$fieldContainer -> addElement ( $ouHelp , true );
}
// organisation
2011-05-01 11:58:34 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideO' )) {
2012-01-06 17:34:39 +00:00
$os = array ();
if ( isset ( $this -> attributes [ 'o' ][ 0 ])) {
$os = $this -> attributes [ 'o' ];
}
if ( sizeof ( $os ) == 0 ) {
$os [] = '' ;
}
$oLabel = new htmlOutputText ( _ ( 'Organisation' ));
$oLabel -> alignment = htmlElement :: ALIGN_TOP ;
$fieldContainer -> addElement ( $oLabel );
$oContainer = new htmlGroup ();
for ( $i = 0 ; $i < sizeof ( $os ); $i ++ ) {
2013-03-24 15:25:01 +00:00
$oInput = new htmlInputField ( 'o' . $i , $os [ $i ]);
$oInput -> enableAutocompletion ( $this -> oCache );
$oContainer -> addElement ( $oInput );
2013-03-24 10:02:49 +00:00
$equalWidthElements [] = 'o' . $i ;
2012-01-06 17:34:39 +00:00
if ( $i < ( sizeof ( $os ) - 1 )) {
$oContainer -> addElement ( new htmlOutputText ( '<br>' , false ));
}
else {
$oContainer -> addElement ( new htmlButton ( 'addO' , 'add.png' , true ));
}
}
$fieldContainer -> addElement ( $oContainer );
$oHelp = new htmlHelpLink ( 'o' );
$oHelp -> alignment = htmlElement :: ALIGN_TOP ;
$fieldContainer -> addElement ( $oHelp , true );
2011-05-01 11:58:34 +00:00
}
2013-01-28 21:15:55 +00:00
// user certificates
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideuserCertificate' )) {
$fieldContainer -> addElement ( new htmlOutputText ( _ ( 'User certificates' )));
$userCertificateGroup = new htmlGroup ();
$userCertificateCount = 0 ;
if ( isset ( $this -> attributes [ 'userCertificate;binary' ])) {
$userCertificateCount = sizeof ( $this -> attributes [ 'userCertificate;binary' ]);
}
$userCertificateGroup -> addElement ( new htmlOutputText ( $userCertificateCount ));
$userCertificateGroup -> addElement ( new htmlSpacer ( '10px' , null ));
$userCertificateGroup -> addElement ( new htmlAccountPageButton ( get_class ( $this ), 'userCertificate' , 'manage' , _ ( 'Manage' )));
$fieldContainer -> addElement ( $userCertificateGroup );
$fieldContainer -> addElement ( new htmlHelpLink ( 'userCertificate' ), true );
}
2011-12-20 20:40:51 +00:00
// manager
2009-10-03 17:48:37 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideManager' )) {
2011-12-20 20:40:51 +00:00
$fieldContainer -> addElement ( new htmlOutputText ( _ ( 'Manager' )));
$fieldContainer -> addElement ( new htmlAccountPageButton ( get_class ( $this ), 'manager' , 'change' , _ ( " Change " )));
$fieldContainer -> addElement ( new htmlHelpLink ( 'manager' ), true );
2009-10-03 17:29:10 +00:00
if ( isset ( $this -> attributes [ 'manager' ][ 0 ])) {
2011-12-20 20:40:51 +00:00
$managerList = array ();
for ( $i = 0 ; $i < sizeof ( $this -> attributes [ 'manager' ]); $i ++ ) {
$managerList [] = $this -> attributes [ 'manager' ][ $i ];
}
usort ( $managerList , 'compareDN' );
$managers = new htmlTable ();
2013-03-12 20:06:16 +00:00
$managers -> alignment = htmlElement :: ALIGN_RIGHT ;
$managers -> colspan = 3 ;
2011-12-20 20:40:51 +00:00
for ( $i = 0 ; $i < sizeof ( $managerList ); $i ++ ) {
2013-03-12 20:06:16 +00:00
$manager = new htmlOutputText ( getAbstractDN ( $managerList [ $i ]));
$manager -> alignment = htmlElement :: ALIGN_RIGHT ;
$managers -> addElement ( $manager , true );
2011-12-20 20:40:51 +00:00
}
$fieldContainer -> addElement ( new htmlOutputText ( '' ));
$fieldContainer -> addElement ( $managers , true );
2009-10-03 17:29:10 +00:00
}
2005-07-02 12:05:33 +00:00
}
2011-04-25 17:57:04 +00:00
// password buttons
if ( ! in_array ( 'posixAccount' , $modules ) && checkIfWriteAccessIsAllowed () && isset ( $this -> attributes [ 'userPassword' ][ 0 ])) {
2011-04-30 09:12:32 +00:00
$fieldContainer -> addElement ( new htmlSubTitle ( _ ( 'Password' )), true );
2011-04-25 17:57:04 +00:00
$pwdContainer = new htmlTable ();
if ( pwd_is_enabled ( $this -> attributes [ 'userPassword' ][ 0 ])) {
$pwdContainer -> addElement ( new htmlButton ( 'lockPassword' , _ ( 'Lock password' )));
}
else {
$pwdContainer -> addElement ( new htmlButton ( 'unlockPassword' , _ ( 'Unlock password' )));
}
$pwdContainer -> addElement ( new htmlButton ( 'removePassword' , _ ( 'Remove password' )));
$pwdContainer -> colspan = 2 ;
$fieldContainer -> addElement ( $pwdContainer );
}
2005-12-05 14:45:01 +00:00
// photo
$photoFile = '../../graphics/userDefault.png' ;
$noPhoto = true ;
2006-01-24 14:23:42 +00:00
if ( isset ( $this -> attributes [ 'jpegPhoto' ][ 0 ])) {
2013-07-21 11:34:31 +00:00
$jpeg_filename = 'jpg' . getRandomNumber () . '.jpg' ;
2010-04-01 18:12:07 +00:00
$outjpeg = @ fopen ( dirname ( __FILE__ ) . '/../../tmp/' . $jpeg_filename , " wb " );
2005-12-05 14:45:01 +00:00
fwrite ( $outjpeg , $this -> attributes [ 'jpegPhoto' ][ 0 ]);
fclose ( $outjpeg );
$photoFile = '../../tmp/' . $jpeg_filename ;
$noPhoto = false ;
}
2010-06-12 19:37:51 +00:00
$imageContainer -> addElement ( new htmlImage ( $photoFile ), true );
2005-12-05 14:45:01 +00:00
if ( $noPhoto ) {
2010-06-12 19:37:51 +00:00
$imageContainer -> addElement ( new htmlAccountPageButton ( get_class ( $this ), 'photo' , 'open' , _ ( 'Add photo' )));
2005-12-05 14:45:01 +00:00
}
else {
2010-06-12 19:37:51 +00:00
$imageContainer -> addElement ( new htmlButton ( 'delPhoto' , _ ( 'Delete photo' )));
2005-12-05 14:45:01 +00:00
}
2013-03-24 10:02:49 +00:00
$container -> addElement ( new htmlEqualWidth ( $equalWidthElements ));
2010-06-12 19:37:51 +00:00
return $container ;
2005-08-15 18:36:56 +00:00
}
2004-03-09 12:03:39 +00:00
2005-12-05 14:45:01 +00:00
/**
* Sets a new photo .
*/
2006-08-13 12:58:19 +00:00
function process_photo () {
2011-12-08 19:17:37 +00:00
if ( ! isset ( $_POST [ 'form_subpage_' . get_class ( $this ) . '_attributes_submit' ])) {
return array ();
}
2005-12-05 14:45:01 +00:00
$messages = array ();
if ( $_FILES [ 'photoFile' ] && ( $_FILES [ 'photoFile' ][ 'size' ] > 0 )) {
$handle = fopen ( $_FILES [ 'photoFile' ][ 'tmp_name' ], " r " );
$data = fread ( $handle , 1000000 );
fclose ( $handle );
$this -> attributes [ 'jpegPhoto' ][ 0 ] = $data ;
}
else {
2013-01-28 21:15:55 +00:00
$messages [] = $this -> messages [ 'file' ][ 0 ];
2005-12-05 14:45:01 +00:00
}
return $messages ;
}
/**
* Displays the photo upload page .
*
* @ return array meta HTML code
*/
2006-08-13 12:58:19 +00:00
function display_html_photo () {
2010-06-21 16:23:44 +00:00
$container = new htmlTable ();
$container -> addElement ( new htmlTableExtendedInputFileUpload ( 'photoFile' , _ ( 'Photo file (JPG format)' ), 'photoUpload' ), true );
$buttonContainer = new htmlTable ();
$buttonContainer -> addElement ( new htmlAccountPageButton ( get_class ( $this ), 'attributes' , 'submit' , _ ( 'Add photo' )));
$buttonContainer -> addElement ( new htmlAccountPageButton ( get_class ( $this ), 'attributes' , 'back' , _ ( 'Back' )));
$container -> addElement ( $buttonContainer );
return $container ;
2005-12-05 14:45:01 +00:00
}
2011-12-20 20:40:51 +00:00
/**
* This function will create the meta HTML code to show a page to change the manager attribute .
*
* @ return htmlElement HTML meta data
*/
function display_html_manager () {
$return = new htmlTable ();
if ( ! isset ( $this -> attributes [ 'manager' ])) {
$this -> attributes [ 'manager' ] = array ();
}
// show list of possible new managers
if ( isset ( $_POST [ 'form_subpage_' . get_class ( $this ) . '_manager_select' ])) {
$options = array ();
$filter = get_ldap_filter ( 'user' );
2012-07-22 10:38:24 +00:00
$entries = searchLDAPByFilter ( '(|' . $filter . '(objectclass=organizationalRole))' , array ( 'dn' ), array ( 'user' ));
2011-12-20 20:40:51 +00:00
for ( $i = 0 ; $i < sizeof ( $entries ); $i ++ ) {
$entries [ $i ] = $entries [ $i ][ 'dn' ];
}
// sort by DN
usort ( $entries , 'compareDN' );
for ( $i = 0 ; $i < sizeof ( $entries ); $i ++ ) {
if ( ! isset ( $this -> attributes [ 'manager' ]) || ! in_array ( $entries [ $i ], $this -> attributes [ 'manager' ])) {
$options [ getAbstractDN ( $entries [ $i ])] = $entries [ $i ];
}
}
$size = 20 ;
if ( sizeof ( $options ) < 20 ) $size = sizeof ( $options );
$managerSelect = new htmlSelect ( 'manager' , $options , array (), $size );
$managerSelect -> setHasDescriptiveElements ( true );
$managerSelect -> setMultiSelect ( true );
$managerSelect -> setRightToLeftTextDirection ( true );
$managerSelect -> setSortElements ( false );
$managerSelect -> setTransformSingleSelect ( false );
$return -> addElement ( $managerSelect , true );
$buttonTable = new htmlTable ();
$buttonTable -> addElement ( new htmlAccountPageButton ( get_class ( $this ), 'manager' , 'addManagers' , _ ( 'Add' )));
$buttonTable -> addElement ( new htmlAccountPageButton ( get_class ( $this ), 'manager' , 'cancel' , _ ( 'Cancel' )));
$return -> addElement ( $buttonTable );
return $return ;
}
// show existing managers
$managerTemp = array ();
if ( isset ( $this -> attributes [ 'manager' ])) {
$managerTemp = $this -> attributes [ 'manager' ];
}
// sort by DN
usort ( $managerTemp , 'compareDN' );
$managers = array ();
for ( $i = 0 ; $i < sizeof ( $managerTemp ); $i ++ ) {
$managers [ getAbstractDN ( $managerTemp [ $i ])] = $managerTemp [ $i ];
}
$size = 20 ;
if ( sizeof ( $this -> attributes [ 'manager' ]) < 20 ) {
$size = sizeof ( $this -> attributes [ 'manager' ]);
}
if ( sizeof ( $managers ) > 0 ) {
$managerSelect = new htmlSelect ( 'manager' , $managers , array (), $size );
$managerSelect -> setHasDescriptiveElements ( true );
$managerSelect -> setMultiSelect ( true );
$managerSelect -> setRightToLeftTextDirection ( true );
$managerSelect -> setSortElements ( false );
$managerSelect -> setTransformSingleSelect ( false );
$return -> addElement ( $managerSelect , true );
$removeButton = new htmlAccountPageButton ( get_class ( $this ), 'manager' , 'remove' , _ ( 'Remove selected entries' ));
$removeButton -> colspan = 3 ;
$return -> addElement ( $removeButton , true );
$return -> addElement ( new htmlOutputText ( ' ' , false ), true );
}
$return -> addElement ( new htmlOutputText ( ' ' , false ), true );
$buttonTable = new htmlTable ();
$buttonTable -> addElement ( new htmlAccountPageButton ( get_class ( $this ), 'manager' , 'select' , _ ( 'Add entries' )));
$buttonTable -> addElement ( new htmlAccountPageButton ( get_class ( $this ), 'attributes' , 'managerBack' , _ ( 'Back' )));
$return -> addElement ( $buttonTable );
return $return ;
}
/**
* Processes user input of the manager page .
* It checks if all input values are correct and updates the associated LDAP attributes .
*
* @ return array list of info / error messages
*/
function process_manager () {
$return = array ();
if ( isset ( $_POST [ 'form_subpage_' . get_class ( $this ) . '_manager_remove' ]) && isset ( $_POST [ 'manager' ])) {
$managers = array_flip ( $this -> attributes [ 'manager' ]);
for ( $i = 0 ; $i < sizeof ( $_POST [ 'manager' ]); $i ++ ) {
if ( isset ( $managers [ $_POST [ 'manager' ][ $i ]])) {
unset ( $managers [ $_POST [ 'manager' ][ $i ]]);
}
}
$this -> attributes [ 'manager' ] = array_values ( array_flip ( $managers ));
}
elseif ( isset ( $_POST [ 'form_subpage_' . get_class ( $this ) . '_manager_addManagers' ]) && isset ( $_POST [ 'manager' ])) {
for ( $i = 0 ; $i < sizeof ( $_POST [ 'manager' ]); $i ++ ) {
$this -> attributes [ 'manager' ][] = $_POST [ 'manager' ][ $i ];
$this -> attributes [ 'manager' ] = array_unique ( $this -> attributes [ 'manager' ]);
}
}
return $return ;
}
2005-12-05 14:45:01 +00:00
2013-01-28 21:15:55 +00:00
/**
* Displays the certificate upload page .
*
* @ return array meta HTML code
*/
function display_html_userCertificate () {
$container = new htmlTable ();
if ( isset ( $this -> attributes [ 'userCertificate;binary' ])) {
$table = new htmlTable ();
$table -> colspan = 10 ;
for ( $i = 0 ; $i < sizeof ( $this -> attributes [ 'userCertificate;binary' ]); $i ++ ) {
2013-07-21 11:34:31 +00:00
$filename = 'userCertificate' . getRandomNumber () . '.der' ;
2013-08-10 12:43:01 +00:00
$pathOut = dirname ( __FILE__ ) . '/../../tmp/' . $filename ;
$out = @ fopen ( $pathOut , " wb " );
@ chmod ( $pathOut , 0600 );
2013-01-28 21:15:55 +00:00
fwrite ( $out , $this -> attributes [ 'userCertificate;binary' ][ $i ]);
fclose ( $out );
$path = '../../tmp/' . $filename ;
$link = new htmlLink ( '' , $path , '../../graphics/save.png' );
$link -> setTargetWindow ( '_blank' );
$table -> addElement ( $link );
$deleteButton = new htmlAccountPageButton ( get_class ( $this ), 'userCertificate' , 'delete_' . $i , 'delete.png' , true );
$deleteButton -> setIconClass ( 'deleteButton' );
$table -> addElement ( $deleteButton );
if ( function_exists ( 'openssl_x509_parse' )) {
$pem = @ chunk_split ( @ base64_encode ( $this -> attributes [ 'userCertificate;binary' ][ $i ]), 64 , " \n " );
if ( ! empty ( $pem )) {
$pem = " -----BEGIN CERTIFICATE----- \n " . $pem . " -----END CERTIFICATE----- \n " ;
$pemData = @ openssl_x509_parse ( $pem );
$data = array ();
if ( isset ( $pemData [ 'serialNumber' ])) {
$data [] = $pemData [ 'serialNumber' ];
}
if ( isset ( $pemData [ 'name' ])) {
$data [] = $pemData [ 'name' ];
}
if ( sizeof ( $data ) > 0 ) {
$table -> addElement ( new htmlOutputText ( implode ( ': ' , $data )));
}
}
}
$table -> addNewLine ();
}
$container -> addElement ( $table , true );
$container -> addElement ( new htmlSpacer ( null , '20px' ), true );
}
$newGroup = new htmlGroup ();
$newGroup -> addElement ( new htmlOutputText ( _ ( 'New user certificate' )));
$newGroup -> addElement ( new htmlSpacer ( '1px' , null ));
$newGroup -> addElement ( new htmlInputFileUpload ( 'userCertificateUpload' ));
$newGroup -> addElement ( new htmlSpacer ( '1px' , null ));
$uploadButton = new htmlAccountPageButton ( get_class ( $this ), 'userCertificate' , 'submit' , _ ( 'Upload' ));
$uploadButton -> setIconClass ( 'upButton' );
$newGroup -> addElement ( $uploadButton );
$container -> addElement ( $newGroup , true );
$container -> addElement ( new htmlSpacer ( null , '10px' ), true );
$container -> addElement ( new htmlAccountPageButton ( get_class ( $this ), 'attributes' , 'back' , _ ( 'Back' )));
return $container ;
}
/**
* Sets a new certificate or deletes old ones .
*/
function process_userCertificate () {
$messages = array ();
if ( isset ( $_POST [ 'form_subpage_' . get_class ( $this ) . '_userCertificate_submit' ])) {
if ( $_FILES [ 'userCertificateUpload' ] && ( $_FILES [ 'userCertificateUpload' ][ 'size' ] > 0 )) {
$handle = fopen ( $_FILES [ 'userCertificateUpload' ][ 'tmp_name' ], " r " );
$data = fread ( $handle , 10000000 );
fclose ( $handle );
if ( strpos ( $data , '-----BEGIN CERTIFICATE-----' ) === 0 ) {
$pemData = str_replace ( " \r " , '' , $data );
$pemData = explode ( " \n " , $pemData );
array_shift ( $pemData );
$last = array_pop ( $pemData );
while (( $last != '-----END CERTIFICATE-----' ) && sizeof ( $pemData ) > 2 ) {
$last = array_pop ( $pemData );
}
$pemData = implode ( '' , $pemData );
$data = base64_decode ( $pemData );
}
$this -> attributes [ 'userCertificate;binary' ][] = $data ;
}
else {
$messages [] = $this -> messages [ 'file' ][ 0 ];
}
}
elseif ( isset ( $this -> attributes [ 'userCertificate;binary' ])) {
for ( $i = 0 ; $i < sizeof ( $this -> attributes [ 'userCertificate;binary' ]); $i ++ ) {
if ( isset ( $_POST [ 'form_subpage_' . get_class ( $this ) . '_userCertificate_delete_' . $i ])) {
unset ( $this -> attributes [ 'userCertificate;binary' ][ $i ]);
$this -> attributes [ 'userCertificate;binary' ] = array_values ( $this -> attributes [ 'userCertificate;binary' ]);
break ;
}
}
}
return $messages ;
}
2005-10-09 18:05:32 +00:00
/**
* Returns the PDF entries for this module .
2006-08-13 12:58:19 +00:00
*
2005-10-09 18:05:32 +00:00
* @ return array list of possible PDF entries
*/
function get_pdfEntries () {
2013-05-04 18:22:07 +00:00
$return = array ();
$this -> addSimplePDFField ( $return , 'description' , _ ( 'Description' ));
$this -> addSimplePDFField ( $return , 'title' , _ ( 'Job title' ));
$this -> addSimplePDFField ( $return , 'givenName' , _ ( 'First name' ));
$this -> addSimplePDFField ( $return , 'sn' , _ ( 'Last name' ));
$this -> addSimplePDFField ( $return , 'manager' , _ ( 'Manager' ));
$this -> addSimplePDFField ( $return , 'street' , _ ( 'Street' ));
$this -> addSimplePDFField ( $return , 'postOfficeBox' , _ ( 'Post office box' ));
$this -> addSimplePDFField ( $return , 'postalCode' , _ ( 'Postal code' ));
$this -> addSimplePDFField ( $return , 'postalAddress' , _ ( 'Postal address' ));
$this -> addSimplePDFField ( $return , 'registeredAddress' , _ ( 'Registered address' ));
$this -> addSimplePDFField ( $return , 'telephoneNumber' , _ ( 'Telephone number' ));
$this -> addSimplePDFField ( $return , 'homePhone' , _ ( 'Home telephone number' ));
$this -> addSimplePDFField ( $return , 'mobileTelephoneNumber' , _ ( 'Mobile number' ), 'mobile' );
$this -> addSimplePDFField ( $return , 'mail' , _ ( 'Email address' ));
$this -> addSimplePDFField ( $return , 'cn' , _ ( 'Common name' ));
$this -> addSimplePDFField ( $return , 'facsimileTelephoneNumber' , _ ( 'Fax number' ));
$this -> addSimplePDFField ( $return , 'roomNumber' , _ ( 'Room number' ));
$this -> addSimplePDFField ( $return , 'businessCategory' , _ ( 'Business category' ));
$this -> addSimplePDFField ( $return , 'uid' , _ ( 'User name' ));
$this -> addSimplePDFField ( $return , 'carLicense' , _ ( 'Car license' ));
$this -> addSimplePDFField ( $return , 'state' , _ ( 'State' ), 'st' );
$this -> addSimplePDFField ( $return , 'officeName' , _ ( 'Office name' ), 'physicalDeliveryOfficeName' );
$this -> addSimplePDFField ( $return , 'employeeType' , _ ( 'Employee type' ));
$this -> addSimplePDFField ( $return , 'location' , _ ( 'Location' ), 'l' );
$this -> addSimplePDFField ( $return , 'employeeNumber' , _ ( 'Employee number' ));
$this -> addSimplePDFField ( $return , 'ou' , _ ( 'Organisational unit' ));
$this -> addSimplePDFField ( $return , 'o' , _ ( 'Organisation' ));
$this -> addSimplePDFField ( $return , 'initials' , _ ( 'Initials' ));
$this -> addSimplePDFField ( $return , 'labeledURI' , _ ( 'Web site' ));
$this -> addSimplePDFField ( $return , 'departmentNumber' , _ ( 'Department' ));
2009-02-15 12:54:37 +00:00
return $return ;
}
/**
* Loads the values of an account profile into internal variables .
*
* @ param array $profile hash array with profile values ( identifier => value )
*/
function load_profile ( $profile ) {
// profile mappings in meta data
parent :: load_profile ( $profile );
2009-10-03 18:13:38 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideDepartments' )) {
// departments
if ( isset ( $profile [ 'inetOrgPerson_departmentNumber' ][ 0 ]) && $profile [ 'inetOrgPerson_departmentNumber' ][ 0 ] != '' ) {
$departments = explode ( ';' , $profile [ 'inetOrgPerson_departmentNumber' ][ 0 ]);
// remove extra spaces and set attributes
$this -> attributes [ 'departmentNumber' ] = array_map ( 'trim' , $departments );
}
2009-02-15 12:54:37 +00:00
}
2012-10-14 08:32:26 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideOu' ) && isset ( $profile [ 'inetOrgPerson_ou' ][ 0 ])) {
$oList = preg_split ( '/;[ ]*/' , $profile [ 'inetOrgPerson_ou' ][ 0 ]);
$this -> attributes [ 'ou' ] = $oList ;
}
2011-05-07 08:05:25 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideO' ) && isset ( $profile [ 'inetOrgPerson_o' ][ 0 ])) {
2011-05-01 11:58:34 +00:00
$oList = preg_split ( '/;[ ]*/' , $profile [ 'inetOrgPerson_o' ][ 0 ]);
$this -> attributes [ 'o' ] = $oList ;
}
2011-05-07 08:05:25 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideEMailAddress' ) && isset ( $profile [ 'inetOrgPerson_mail' ][ 0 ])) {
2011-04-30 16:50:08 +00:00
$mailList = preg_split ( '/;[ ]*/' , $profile [ 'inetOrgPerson_mail' ][ 0 ]);
$this -> attributes [ 'mail' ] = $mailList ;
}
2011-12-11 13:36:34 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideLabeledURI' ) && isset ( $profile [ 'inetOrgPerson_labeledURI' ][ 0 ])) {
$labeledURIList = preg_split ( '/;[ ]*/' , $profile [ 'inetOrgPerson_labeledURI' ][ 0 ]);
$this -> attributes [ 'labeledURI' ] = $labeledURIList ;
}
2011-05-07 08:05:25 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideTelephoneNumber' ) && isset ( $profile [ 'inetOrgPerson_telephoneNumber' ][ 0 ])) {
2011-04-30 16:50:08 +00:00
$telephoneNumberList = preg_split ( '/;[ ]*/' , $profile [ 'inetOrgPerson_telephoneNumber' ][ 0 ]);
$this -> attributes [ 'telephoneNumber' ] = $telephoneNumberList ;
}
2011-05-07 08:05:25 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideFaxNumber' ) && isset ( $profile [ 'inetOrgPerson_facsimileTelephoneNumber' ][ 0 ])) {
2011-04-30 16:50:08 +00:00
$facsimileTelephoneNumberList = preg_split ( '/;[ ]*/' , $profile [ 'inetOrgPerson_facsimileTelephoneNumber' ][ 0 ]);
$this -> attributes [ 'facsimileTelephoneNumber' ] = $facsimileTelephoneNumberList ;
}
2011-10-08 19:28:38 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideStreet' ) && isset ( $profile [ 'inetOrgPerson_street' ][ 0 ])) {
$list = preg_split ( '/;[ ]*/' , $profile [ 'inetOrgPerson_street' ][ 0 ]);
$this -> attributes [ 'street' ] = $list ;
}
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hidePostOfficeBox' ) && isset ( $profile [ 'inetOrgPerson_postOfficeBox' ][ 0 ])) {
$list = preg_split ( '/;[ ]*/' , $profile [ 'inetOrgPerson_postOfficeBox' ][ 0 ]);
$this -> attributes [ 'postOfficeBox' ] = $list ;
}
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hidePostalCode' ) && isset ( $profile [ 'inetOrgPerson_postalCode' ][ 0 ])) {
$list = preg_split ( '/;[ ]*/' , $profile [ 'inetOrgPerson_postalCode' ][ 0 ]);
$this -> attributes [ 'postalCode' ] = $list ;
}
2011-10-14 18:37:03 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideLocation' ) && isset ( $profile [ 'inetOrgPerson_l' ][ 0 ])) {
$list = preg_split ( '/;[ ]*/' , $profile [ 'inetOrgPerson_l' ][ 0 ]);
$this -> attributes [ 'l' ] = $list ;
}
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideState' ) && isset ( $profile [ 'inetOrgPerson_st' ][ 0 ])) {
$list = preg_split ( '/;[ ]*/' , $profile [ 'inetOrgPerson_st' ][ 0 ]);
$this -> attributes [ 'st' ] = $list ;
}
2011-04-30 16:50:08 +00:00
}
/**
* Checks input values of account profiles .
*
* @ param array $options a hash array ( name => value ) containing the options
* @ return array list of error messages ( array ( type , title , text )) to generate StatusMessages , if any
*/
function check_profileOptions ( $options ) {
$messages = parent :: check_profileOptions ( $options );
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideTelephoneNumber' )) {
$telephoneNumberList = preg_split ( '/;[ ]*/' , $options [ 'inetOrgPerson_telephoneNumber' ][ 0 ]);
for ( $i = 0 ; $i < sizeof ( $telephoneNumberList ); $i ++ ) {
if ( ! get_preg ( $telephoneNumberList [ $i ], 'telephone' )) {
$messages [] = $this -> messages [ 'telephoneNumber' ][ 0 ];
break ;
}
}
}
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideFaxNumber' )) {
$facsimileTelephoneNumberList = preg_split ( '/;[ ]*/' , $options [ 'inetOrgPerson_facsimileTelephoneNumber' ][ 0 ]);
for ( $i = 0 ; $i < sizeof ( $facsimileTelephoneNumberList ); $i ++ ) {
if ( ! get_preg ( $facsimileTelephoneNumberList [ $i ], 'telephone' )) {
$messages [] = $this -> messages [ 'facsimileNumber' ][ 0 ];
break ;
}
}
}
return $messages ;
2004-05-24 21:39:57 +00:00
}
2004-03-14 17:33:05 +00:00
2010-02-15 20:21:44 +00:00
/**
* Returns an array containing all input columns for the file upload .
*
* Syntax :
* < br > array (
* < br > string : name , // fixed non-translated name which is used as column name (should be of format: <module name>_<column name>)
* < br > string : description , // short descriptive name
* < br > string : help , // help ID
* < br > string : example , // example value
* < br > boolean : required // true, if user must set a value for this column
* < br > )
*
* @ param array $selectedModules list of selected account modules
* @ return array column list
*/
function get_uploadColumns ( $selectedModules ) {
$return = parent :: get_uploadColumns ( $selectedModules );
// cn and uid for upload (only if posixAccount is not selected)
if ( ! in_array ( 'posixAccount' , $selectedModules )) {
$return [] = array (
'name' => 'inetOrgPerson_cn' ,
'description' => _ ( 'Common name' ),
'help' => 'cn' ,
'example' => _ ( 'Steve Miller' ),
2010-12-05 13:29:53 +00:00
'default' => '{inetOrgPerson_firstName} {inetOrgPerson_lastName}'
2010-02-15 20:21:44 +00:00
);
2013-03-10 19:53:48 +00:00
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideUID' )) {
$return [] = array (
'name' => 'inetOrgPerson_userName' ,
'description' => _ ( 'User name' ),
'help' => 'uid' ,
'example' => _ ( 'smiller' ),
'unique' => true ,
'required' => false
);
}
2012-10-07 10:57:51 +00:00
$return [] = array (
'name' => 'inetOrgPerson_userPassword' ,
'description' => _ ( 'Password' ),
'help' => 'userPassword' ,
'example' => _ ( 'secret' ),
);
2010-02-15 20:21:44 +00:00
}
return $return ;
}
2004-10-11 18:06:53 +00:00
/**
* In this function the LDAP account is built up .
*
* @ param array $rawAccounts list of hash arrays ( name => value ) from user input
* @ param array $ids list of IDs for column position ( e . g . " posixAccount_uid " => 5 )
2012-07-15 12:05:47 +00:00
* @ param array $partialAccounts list of hash arrays ( name => value ) which are later added to LDAP
2010-02-15 20:21:44 +00:00
* @ param array $selectedModules list of selected account modules
2004-10-11 18:06:53 +00:00
* @ return array list of error messages if any
*/
2010-02-15 20:21:44 +00:00
function build_uploadAccounts ( $rawAccounts , $ids , & $partialAccounts , $selectedModules ) {
2006-05-20 16:32:02 +00:00
$errors = array ();
2010-08-09 17:38:49 +00:00
// get list of existing users
2011-05-21 10:58:22 +00:00
$existingUsers = searchLDAPByAttribute ( 'uid' , '*' , 'inetOrgPerson' , array ( 'uid' ), array ( 'user' ));
2010-08-09 17:38:49 +00:00
for ( $e = 0 ; $e < sizeof ( $existingUsers ); $e ++ ) {
$existingUsers [ $e ] = $existingUsers [ $e ][ 'uid' ][ 0 ];
}
2004-10-11 18:06:53 +00:00
for ( $i = 0 ; $i < sizeof ( $rawAccounts ); $i ++ ) {
if ( ! in_array ( " inetOrgPerson " , $partialAccounts [ $i ][ 'objectClass' ])) $partialAccounts [ $i ][ 'objectClass' ][] = " inetOrgPerson " ;
// last name
if ( get_preg ( $rawAccounts [ $i ][ $ids [ 'inetOrgPerson_lastName' ]], 'realname' )) {
2013-05-25 12:47:07 +00:00
$partialAccounts [ $i ][ 'sn' ] = trim ( $rawAccounts [ $i ][ $ids [ 'inetOrgPerson_lastName' ]]);
2004-10-11 18:06:53 +00:00
}
else {
2004-10-28 15:14:54 +00:00
$errMsg = $this -> messages [ 'lastname' ][ 1 ];
2004-10-11 18:06:53 +00:00
array_push ( $errMsg , array ( $i ));
2006-05-20 16:32:02 +00:00
$errors [] = $errMsg ;
2004-10-11 18:06:53 +00:00
}
// first name
2005-06-07 18:19:48 +00:00
if ( $rawAccounts [ $i ][ $ids [ 'inetOrgPerson_firstName' ]] != " " ) {
if ( get_preg ( $rawAccounts [ $i ][ $ids [ 'inetOrgPerson_firstName' ]], 'realname' )) {
2013-05-25 12:47:07 +00:00
$partialAccounts [ $i ][ 'givenName' ] = trim ( $rawAccounts [ $i ][ $ids [ 'inetOrgPerson_firstName' ]]);
2005-06-07 18:19:48 +00:00
}
else {
$errMsg = $this -> messages [ 'givenName' ][ 1 ];
array_push ( $errMsg , array ( $i ));
2006-05-20 16:32:02 +00:00
$errors [] = $errMsg ;
2005-06-07 18:19:48 +00:00
}
2004-10-11 18:06:53 +00:00
}
2011-05-01 11:58:34 +00:00
// initials
2012-05-20 13:19:59 +00:00
if ( isset ( $ids [ 'inetOrgPerson_initials' ]) && ( $rawAccounts [ $i ][ $ids [ 'inetOrgPerson_initials' ]] != " " )) {
2011-05-01 11:58:34 +00:00
$partialAccounts [ $i ][ 'initials' ] = preg_split ( '/;[ ]*/' , $rawAccounts [ $i ][ $ids [ 'inetOrgPerson_initials' ]]);
}
2004-10-11 18:06:53 +00:00
// description
2012-05-20 13:19:59 +00:00
if ( isset ( $ids [ 'inetOrgPerson_description' ]) && ( $rawAccounts [ $i ][ $ids [ 'inetOrgPerson_description' ]] != " " )) {
2004-10-11 18:06:53 +00:00
$partialAccounts [ $i ][ 'description' ] = $rawAccounts [ $i ][ $ids [ 'inetOrgPerson_description' ]];
}
// title
2012-05-20 13:19:59 +00:00
if ( isset ( $ids [ 'inetOrgPerson_title' ]) && ( $rawAccounts [ $i ][ $ids [ 'inetOrgPerson_title' ]] != " " )) {
2013-02-17 19:58:23 +00:00
$titleList = preg_split ( '/;[ ]*/' , $rawAccounts [ $i ][ $ids [ 'inetOrgPerson_title' ]]);
$partialAccounts [ $i ][ 'title' ] = $titleList ;
for ( $x = 0 ; $x < sizeof ( $titleList ); $x ++ ) {
if ( ! get_preg ( $titleList [ $x ], 'title' )) {
$errMsg = $this -> messages [ 'title' ][ 1 ];
array_push ( $errMsg , array ( $i ));
$errors [] = $errMsg ;
break ;
}
2005-06-07 18:19:48 +00:00
}
2004-10-11 18:06:53 +00:00
}
2011-05-01 11:58:34 +00:00
// employee number
2012-05-20 13:19:59 +00:00
if ( isset ( $ids [ 'inetOrgPerson_employeeNumber' ]) && ( $rawAccounts [ $i ][ $ids [ 'inetOrgPerson_employeeNumber' ]] != " " )) {
2011-05-01 11:58:34 +00:00
$partialAccounts [ $i ][ 'employeeNumber' ] = $rawAccounts [ $i ][ $ids [ 'inetOrgPerson_employeeNumber' ]];
}
2004-10-11 18:06:53 +00:00
// employee type
2012-05-20 13:19:59 +00:00
if ( isset ( $ids [ 'inetOrgPerson_type' ]) && ( $rawAccounts [ $i ][ $ids [ 'inetOrgPerson_type' ]] != " " )) {
2005-06-07 18:19:48 +00:00
if ( get_preg ( $rawAccounts [ $i ][ $ids [ 'inetOrgPerson_type' ]], 'employeeType' )) {
$partialAccounts [ $i ][ 'employeeType' ] = $rawAccounts [ $i ][ $ids [ 'inetOrgPerson_type' ]];
}
else {
$errMsg = $this -> messages [ 'employeeType' ][ 1 ];
array_push ( $errMsg , array ( $i ));
2006-05-20 16:32:02 +00:00
$errors [] = $errMsg ;
2005-06-07 18:19:48 +00:00
}
2004-10-11 18:06:53 +00:00
}
2007-06-11 18:19:05 +00:00
// business category
2012-05-20 13:19:59 +00:00
if ( isset ( $ids [ 'inetOrgPerson_businessCategory' ]) && ( $rawAccounts [ $i ][ $ids [ 'inetOrgPerson_businessCategory' ]] != " " )) {
2013-02-17 19:58:23 +00:00
$businessCategoryList = preg_split ( '/;[ ]*/' , $rawAccounts [ $i ][ $ids [ 'inetOrgPerson_businessCategory' ]]);
$partialAccounts [ $i ][ 'businessCategory' ] = $businessCategoryList ;
for ( $x = 0 ; $x < sizeof ( $businessCategoryList ); $x ++ ) {
if ( ! get_preg ( $businessCategoryList [ $x ], 'businessCategory' )) {
$errMsg = $this -> messages [ 'businessCategory' ][ 1 ];
array_push ( $errMsg , array ( $i ));
$errors [] = $errMsg ;
break ;
}
2007-06-11 18:19:05 +00:00
}
}
2005-07-02 12:05:33 +00:00
// manager
2012-05-20 13:19:59 +00:00
if ( isset ( $ids [ 'inetOrgPerson_manager' ]) && ( $rawAccounts [ $i ][ $ids [ 'inetOrgPerson_manager' ]] != " " )) {
2011-12-20 20:40:51 +00:00
$managerList = preg_split ( '/;[ ]*/' , $rawAccounts [ $i ][ $ids [ 'inetOrgPerson_manager' ]]);
$partialAccounts [ $i ][ 'manager' ] = $managerList ;
for ( $x = 0 ; $x < sizeof ( $managerList ); $x ++ ) {
if ( ! get_preg ( $managerList [ $x ], 'dn' )) {
$errMsg = $this -> messages [ 'manager' ][ 0 ];
array_push ( $errMsg , array ( $i ));
$errors [] = $errMsg ;
break ;
}
2005-07-02 12:05:33 +00:00
}
}
2004-10-11 18:06:53 +00:00
// street
2012-05-20 13:19:59 +00:00
if ( isset ( $ids [ 'inetOrgPerson_street' ]) && ( $rawAccounts [ $i ][ $ids [ 'inetOrgPerson_street' ]] != " " )) {
2011-10-08 19:28:38 +00:00
$streetList = preg_split ( '/;[ ]*/' , $rawAccounts [ $i ][ $ids [ 'inetOrgPerson_street' ]]);
$partialAccounts [ $i ][ 'street' ] = $streetList ;
for ( $x = 0 ; $x < sizeof ( $streetList ); $x ++ ) {
if ( ! get_preg ( $streetList [ $x ], 'street' )) {
$errMsg = $this -> messages [ 'street' ][ 1 ];
array_push ( $errMsg , array ( $i ));
$errors [] = $errMsg ;
break ;
}
2005-06-07 18:19:48 +00:00
}
2004-10-11 18:06:53 +00:00
}
2005-07-02 12:05:33 +00:00
// post office box
2012-05-20 13:19:59 +00:00
if ( isset ( $ids [ 'inetOrgPerson_postOfficeBox' ]) && ( $rawAccounts [ $i ][ $ids [ 'inetOrgPerson_postOfficeBox' ]] != " " )) {
2011-10-08 19:28:38 +00:00
$partialAccounts [ $i ][ 'postOfficeBox' ] = preg_split ( '/;[ ]*/' , $rawAccounts [ $i ][ $ids [ 'inetOrgPerson_postOfficeBox' ]]);
2005-07-02 12:05:33 +00:00
}
2007-06-11 18:19:05 +00:00
// room number
2012-05-20 13:19:59 +00:00
if ( isset ( $ids [ 'inetOrgPerson_roomNumber' ]) && ( $rawAccounts [ $i ][ $ids [ 'inetOrgPerson_roomNumber' ]] != " " )) {
2007-06-11 18:19:05 +00:00
$partialAccounts [ $i ][ 'roomNumber' ] = $rawAccounts [ $i ][ $ids [ 'inetOrgPerson_roomNumber' ]];
}
2009-02-15 12:54:37 +00:00
// departments
2012-05-20 13:19:59 +00:00
if ( isset ( $ids [ 'inetOrgPerson_departmentNumber' ]) && ( $rawAccounts [ $i ][ $ids [ 'inetOrgPerson_departmentNumber' ]] != " " )) {
2009-02-15 12:54:37 +00:00
$partialAccounts [ $i ][ 'departmentNumber' ] = explode ( ';' , $rawAccounts [ $i ][ $ids [ 'inetOrgPerson_departmentNumber' ]]);
// remove extra spaces
$partialAccounts [ $i ][ 'departmentNumber' ] = array_map ( 'trim' , $partialAccounts [ $i ][ 'departmentNumber' ]);
}
2012-10-14 08:32:26 +00:00
// organisational unit
if ( isset ( $ids [ 'inetOrgPerson_ou' ]) && ( $rawAccounts [ $i ][ $ids [ 'inetOrgPerson_ou' ]] != " " )) {
$partialAccounts [ $i ][ 'ou' ] = preg_split ( '/;[ ]*/' , $rawAccounts [ $i ][ $ids [ 'inetOrgPerson_ou' ]]);
}
2011-05-01 11:58:34 +00:00
// organisation
2012-05-20 13:19:59 +00:00
if ( isset ( $ids [ 'inetOrgPerson_o' ]) && ( $rawAccounts [ $i ][ $ids [ 'inetOrgPerson_o' ]] != " " )) {
2011-05-01 11:58:34 +00:00
$partialAccounts [ $i ][ 'o' ] = preg_split ( '/;[ ]*/' , $rawAccounts [ $i ][ $ids [ 'inetOrgPerson_o' ]]);
}
2008-02-09 18:01:29 +00:00
// location
2012-05-20 13:19:59 +00:00
if ( isset ( $ids [ 'inetOrgPerson_l' ]) && ( $rawAccounts [ $i ][ $ids [ 'inetOrgPerson_l' ]] != " " )) {
2011-10-14 18:37:03 +00:00
$partialAccounts [ $i ][ 'l' ] = preg_split ( '/;[ ]*/' , $rawAccounts [ $i ][ $ids [ 'inetOrgPerson_l' ]]);
2008-02-09 18:01:29 +00:00
}
// state
2012-05-20 13:19:59 +00:00
if ( isset ( $ids [ 'inetOrgPerson_st' ]) && ( $rawAccounts [ $i ][ $ids [ 'inetOrgPerson_st' ]] != " " )) {
2011-10-14 18:37:03 +00:00
$partialAccounts [ $i ][ 'st' ] = preg_split ( '/;[ ]*/' , $rawAccounts [ $i ][ $ids [ 'inetOrgPerson_st' ]]);
2008-02-09 18:01:29 +00:00
}
// physicalDeliveryOfficeName
2012-05-20 13:19:59 +00:00
if ( isset ( $ids [ 'inetOrgPerson_physicalDeliveryOfficeName' ]) && ( $rawAccounts [ $i ][ $ids [ 'inetOrgPerson_physicalDeliveryOfficeName' ]] != " " )) {
2012-03-20 20:30:35 +00:00
$partialAccounts [ $i ][ 'physicalDeliveryOfficeName' ] = preg_split ( '/;[ ]*/' , $rawAccounts [ $i ][ $ids [ 'inetOrgPerson_physicalDeliveryOfficeName' ]]);
2008-02-09 18:01:29 +00:00
}
// carLicense
2012-05-20 13:19:59 +00:00
if ( isset ( $ids [ 'inetOrgPerson_carLicense' ]) && ( $rawAccounts [ $i ][ $ids [ 'inetOrgPerson_carLicense' ]] != " " )) {
2008-02-09 18:01:29 +00:00
$partialAccounts [ $i ][ 'carLicense' ] = $rawAccounts [ $i ][ $ids [ 'inetOrgPerson_carLicense' ]];
}
2004-10-11 18:06:53 +00:00
// postal code
2012-05-20 13:19:59 +00:00
if ( isset ( $ids [ 'inetOrgPerson_postalCode' ]) && ( $rawAccounts [ $i ][ $ids [ 'inetOrgPerson_postalCode' ]] != " " )) {
2011-10-08 19:28:38 +00:00
$postalCodeList = preg_split ( '/;[ ]*/' , $rawAccounts [ $i ][ $ids [ 'inetOrgPerson_postalCode' ]]);
$partialAccounts [ $i ][ 'postalCode' ] = $postalCodeList ;
for ( $x = 0 ; $x < sizeof ( $postalCodeList ); $x ++ ) {
if ( ! get_preg ( $postalCodeList [ $x ], 'postalCode' )) {
$errMsg = $this -> messages [ 'postalCode' ][ 1 ];
array_push ( $errMsg , array ( $i ));
$errors [] = $errMsg ;
break ;
}
2005-06-07 18:19:48 +00:00
}
2004-10-11 18:06:53 +00:00
}
// postal address
2012-05-20 13:19:59 +00:00
if ( isset ( $ids [ 'inetOrgPerson_address' ]) && ( $rawAccounts [ $i ][ $ids [ 'inetOrgPerson_address' ]] != " " )) {
2005-06-07 18:19:48 +00:00
if ( get_preg ( $rawAccounts [ $i ][ $ids [ 'inetOrgPerson_address' ]], 'postalAddress' )) {
$partialAccounts [ $i ][ 'postalAddress' ] = $rawAccounts [ $i ][ $ids [ 'inetOrgPerson_address' ]];
}
else {
$errMsg = $this -> messages [ 'postalAddress' ][ 1 ];
array_push ( $errMsg , array ( $i ));
2006-05-20 16:32:02 +00:00
$errors [] = $errMsg ;
2005-06-07 18:19:48 +00:00
}
2004-10-11 18:06:53 +00:00
}
2011-11-03 18:31:33 +00:00
// registered address
2012-05-20 13:19:59 +00:00
if ( isset ( $ids [ 'inetOrgPerson_registeredAddress' ]) && ( $rawAccounts [ $i ][ $ids [ 'inetOrgPerson_registeredAddress' ]] != " " )) {
2011-11-03 18:31:33 +00:00
if ( get_preg ( $rawAccounts [ $i ][ $ids [ 'inetOrgPerson_registeredAddress' ]], 'postalAddress' )) {
$partialAccounts [ $i ][ 'registeredAddress' ] = $rawAccounts [ $i ][ $ids [ 'inetOrgPerson_registeredAddress' ]];
}
else {
$errMsg = $this -> messages [ 'registeredAddress' ][ 1 ];
array_push ( $errMsg , array ( $i ));
$errors [] = $errMsg ;
}
}
2004-10-11 18:06:53 +00:00
// telephone
2012-05-20 13:19:59 +00:00
if ( isset ( $ids [ 'inetOrgPerson_telephone' ]) && ( $rawAccounts [ $i ][ $ids [ 'inetOrgPerson_telephone' ]] != " " )) {
2013-05-25 12:47:07 +00:00
$telephoneList = preg_split ( '/;[ ]*/' , trim ( $rawAccounts [ $i ][ $ids [ 'inetOrgPerson_telephone' ]]));
2011-04-30 16:50:08 +00:00
$partialAccounts [ $i ][ 'telephoneNumber' ] = $telephoneList ;
for ( $x = 0 ; $x < sizeof ( $telephoneList ); $x ++ ) {
if ( ! get_preg ( $telephoneList [ $x ], 'telephone' )) {
$errMsg = $this -> messages [ 'telephoneNumber' ][ 1 ];
array_push ( $errMsg , array ( $i ));
$errors [] = $errMsg ;
break ;
}
2005-06-07 18:19:48 +00:00
}
2004-10-11 18:06:53 +00:00
}
2007-06-11 18:19:05 +00:00
// home telephone
2012-05-20 13:19:59 +00:00
if ( isset ( $ids [ 'inetOrgPerson_homePhone' ]) && ( $rawAccounts [ $i ][ $ids [ 'inetOrgPerson_homePhone' ]] != " " )) {
2013-05-25 12:47:07 +00:00
$homePhoneList = preg_split ( '/;[ ]*/' , trim ( $rawAccounts [ $i ][ $ids [ 'inetOrgPerson_homePhone' ]]));
2011-04-30 16:50:08 +00:00
$partialAccounts [ $i ][ 'homePhone' ] = $homePhoneList ;
for ( $x = 0 ; $x < sizeof ( $homePhoneList ); $x ++ ) {
if ( ! get_preg ( $homePhoneList [ $x ], 'telephone' )) {
$errMsg = $this -> messages [ 'homePhone' ][ 1 ];
array_push ( $errMsg , array ( $i ));
$errors [] = $errMsg ;
break ;
}
2007-06-11 18:19:05 +00:00
}
}
2004-10-11 18:06:53 +00:00
// mobile
2012-05-20 13:19:59 +00:00
if ( isset ( $ids [ 'inetOrgPerson_mobile' ]) && ( $rawAccounts [ $i ][ $ids [ 'inetOrgPerson_mobile' ]] != " " )) {
2013-05-25 12:47:07 +00:00
$mobileList = preg_split ( '/;[ ]*/' , trim ( $rawAccounts [ $i ][ $ids [ 'inetOrgPerson_mobile' ]]));
2011-04-30 16:50:08 +00:00
$partialAccounts [ $i ][ 'mobile' ] = $mobileList ;
for ( $x = 0 ; $x < sizeof ( $mobileList ); $x ++ ) {
if ( ! get_preg ( $mobileList [ $x ], 'telephone' )) {
$errMsg = $this -> messages [ 'mobileTelephone' ][ 1 ];
array_push ( $errMsg , array ( $i ));
$errors [] = $errMsg ;
break ;
}
2005-06-07 18:19:48 +00:00
}
2004-10-11 18:06:53 +00:00
}
// facsimile
2012-05-20 13:19:59 +00:00
if ( isset ( $ids [ 'inetOrgPerson_fax' ]) && ( $rawAccounts [ $i ][ $ids [ 'inetOrgPerson_fax' ]] != " " )) {
2013-05-25 12:47:07 +00:00
$facsimileTelephoneNumberList = preg_split ( '/;[ ]*/' , trim ( $rawAccounts [ $i ][ $ids [ 'inetOrgPerson_fax' ]]));
2011-04-30 16:50:08 +00:00
$partialAccounts [ $i ][ 'facsimileTelephoneNumber' ] = $facsimileTelephoneNumberList ;
for ( $x = 0 ; $x < sizeof ( $facsimileTelephoneNumberList ); $x ++ ) {
if ( ! get_preg ( $facsimileTelephoneNumberList [ $x ], 'telephone' )) {
$errMsg = $this -> messages [ 'facsimileNumber' ][ 1 ];
array_push ( $errMsg , array ( $i ));
$errors [] = $errMsg ;
break ;
}
2005-06-07 18:19:48 +00:00
}
2004-10-11 18:06:53 +00:00
}
// eMail
2012-05-20 13:19:59 +00:00
if ( isset ( $ids [ 'inetOrgPerson_email' ]) && ( $rawAccounts [ $i ][ $ids [ 'inetOrgPerson_email' ]] != " " )) {
2013-05-25 12:47:07 +00:00
$mailList = preg_split ( '/;[ ]*/' , trim ( $rawAccounts [ $i ][ $ids [ 'inetOrgPerson_email' ]]));
2011-04-30 16:50:08 +00:00
$partialAccounts [ $i ][ 'mail' ] = $mailList ;
for ( $x = 0 ; $x < sizeof ( $mailList ); $x ++ ) {
if ( ! get_preg ( $mailList [ $x ], 'email' )) {
$errMsg = $this -> messages [ 'email' ][ 1 ];
array_push ( $errMsg , array ( $i ));
$errors [] = $errMsg ;
break ;
}
2005-06-07 18:19:48 +00:00
}
2004-10-11 18:06:53 +00:00
}
2013-04-28 10:21:45 +00:00
if ( isLAMProVersion () && isset ( $ids [ 'inetOrgPerson_sendPasswordMail' ]) && ( $rawAccounts [ $i ][ $ids [ 'inetOrgPerson_sendPasswordMail' ]] != " " )) {
if ( ! in_array ( $rawAccounts [ $i ][ $ids [ 'inetOrgPerson_sendPasswordMail' ]], array ( 'true' , 'false' ))) {
$errMsg = $this -> messages [ 'sendPasswordMail' ][ 0 ];
array_push ( $errMsg , array ( $i ));
$errors [] = $errMsg ;
}
}
2011-12-11 13:36:34 +00:00
// labeledURI
2012-05-20 13:19:59 +00:00
if ( isset ( $ids [ 'inetOrgPerson_labeledURI' ]) && ( $rawAccounts [ $i ][ $ids [ 'inetOrgPerson_labeledURI' ]] != " " )) {
2013-05-25 12:47:07 +00:00
$partialAccounts [ $i ][ 'labeledURI' ] = preg_split ( '/;[ ]*/' , trim ( $rawAccounts [ $i ][ $ids [ 'inetOrgPerson_labeledURI' ]]));
2011-12-11 13:36:34 +00:00
}
2010-02-15 20:21:44 +00:00
if ( ! in_array ( 'posixAccount' , $selectedModules )) {
2005-06-19 09:38:44 +00:00
// cn
if ( $rawAccounts [ $i ][ $ids [ 'inetOrgPerson_cn' ]] != " " ) {
if ( get_preg ( $rawAccounts [ $i ][ $ids [ 'inetOrgPerson_cn' ]], 'cn' )) {
$partialAccounts [ $i ][ 'cn' ] = $rawAccounts [ $i ][ $ids [ 'inetOrgPerson_cn' ]];
}
else {
$errMsg = $this -> messages [ 'cn' ][ 1 ];
array_push ( $errMsg , array ( $i ));
2006-05-20 16:32:02 +00:00
$errors [] = $errMsg ;
2005-06-19 09:38:44 +00:00
}
2004-10-11 18:06:53 +00:00
}
else {
2005-06-19 09:38:44 +00:00
if ( $partialAccounts [ $i ][ 'givenName' ] != " " ) {
$partialAccounts [ $i ][ 'cn' ] = $partialAccounts [ $i ][ 'givenName' ] . " " . $partialAccounts [ $i ][ 'sn' ];
}
else {
$partialAccounts [ $i ][ 'cn' ] = $partialAccounts [ $i ][ 'sn' ];
}
2004-10-11 18:06:53 +00:00
}
2005-06-19 09:38:44 +00:00
// uid
2013-03-10 19:53:48 +00:00
if ( isset ( $ids [ 'inetOrgPerson_userName' ]) && ! empty ( $rawAccounts [ $i ][ $ids [ 'inetOrgPerson_userName' ]])) {
if ( in_array ( $rawAccounts [ $i ][ $ids [ 'inetOrgPerson_userName' ]], $existingUsers )) {
$errMsg = $this -> messages [ 'uid' ][ 3 ];
array_push ( $errMsg , array ( $i ));
$errors [] = $errMsg ;
}
elseif ( get_preg ( $rawAccounts [ $i ][ $ids [ 'inetOrgPerson_userName' ]], 'username' )) {
$partialAccounts [ $i ][ 'uid' ] = $rawAccounts [ $i ][ $ids [ 'inetOrgPerson_userName' ]];
}
else {
$errMsg = $this -> messages [ 'uid' ][ 1 ];
array_push ( $errMsg , array ( $i ));
$errors [] = $errMsg ;
}
2005-06-06 19:24:48 +00:00
}
2012-10-07 10:57:51 +00:00
// password
if (( $rawAccounts [ $i ][ $ids [ 'inetOrgPerson_userPassword' ]] != " " ) && ( get_preg ( $rawAccounts [ $i ][ $ids [ 'inetOrgPerson_userPassword' ]], 'password' ))) {
$partialAccounts [ $i ][ 'userPassword' ] = pwd_hash ( $rawAccounts [ $i ][ $ids [ 'inetOrgPerson_userPassword' ]], true , $this -> moduleSettings [ 'posixAccount_pwdHash' ][ 0 ]);
$partialAccounts [ $i ][ 'INFO.userPasswordClearText' ] = $rawAccounts [ $i ][ $ids [ 'inetOrgPerson_userPassword' ]]; // for custom scripts etc.
}
elseif ( $rawAccounts [ $i ][ $ids [ 'inetOrgPerson_userPassword' ]] != " " ) {
$errMsg = $this -> messages [ 'userPassword' ][ 0 ];
$errMsg [ 2 ] = str_replace ( '%' , '%%' , $errMsg [ 2 ]); // double "%" because of later sprintf
array_push ( $errMsg , array ( $i ));
$errors [] = $errMsg ;
}
2005-06-06 19:24:48 +00:00
}
2004-10-11 18:06:53 +00:00
}
2006-05-20 16:32:02 +00:00
return $errors ;
2004-10-11 18:06:53 +00:00
}
2013-04-28 10:21:45 +00:00
/**
* This function executes one post upload action .
*
* @ param array $data array containing one account in each element
* @ param array $ids array ( < column_name > => < column number > )
* @ param array $failed list of accounts which were not created successfully
* @ param array $temp variable to store temporary data between two post actions
* @ param array $accounts list of LDAP entries
* @ return array current status
* < br > array (
* < br > 'status' => 'finished' | 'inProgress'
* < br > 'progress' => 0. . 100
* < br > 'errors' => array ( < array of parameters for StatusMessage > )
* < br > )
*/
function doUploadPostActions ( & $data , $ids , $failed , & $temp , & $accounts ) {
if ( ! checkIfWriteAccessIsAllowed ()) {
die ();
}
// mail sending is LAM Pro only
if ( ! isLAMProVersion ()) {
return array (
'status' => 'finished' ,
'progress' => 100 ,
'errors' => array ()
);
}
if ( ! isset ( $temp [ 'counter' ])) {
$temp [ 'counter' ] = 0 ;
}
$errors = array ();
if ( ! in_array ( $temp [ 'counter' ], $failed ) && isset ( $ids [ 'inetOrgPerson_email' ]) && ( $data [ $temp [ 'counter' ]][ $ids [ 'inetOrgPerson_email' ]] != " " )) {
if ( isset ( $ids [ 'inetOrgPerson_sendPasswordMail' ]) && ( $data [ $temp [ 'counter' ]][ $ids [ 'inetOrgPerson_sendPasswordMail' ]] == " true " )
&& isset ( $accounts [ $temp [ 'counter' ]][ 'INFO.userPasswordClearText' ])) {
$mailMessages = sendPasswordMail ( $accounts [ $temp [ 'counter' ]][ 'INFO.userPasswordClearText' ], $accounts [ $temp [ 'counter' ]]);
for ( $i = 0 ; $i < sizeof ( $mailMessages ); $i ++ ) {
if ( $mailMessages [ $i ][ 0 ] == 'ERROR' ) {
$errors [] = $mailMessages [ $i ];
}
}
}
}
$temp [ 'counter' ] ++ ;
if ( $temp [ 'counter' ] < ( sizeof ( $data ) - 1 )) {
return array (
'status' => 'inProgress' ,
'progress' => ( $temp [ 'counter' ] * 100 ) / sizeof ( $data ),
'errors' => $errors
);
}
else {
return array (
'status' => 'finished' ,
'progress' => 100 ,
'errors' => $errors
);
}
}
2006-07-23 15:06:49 +00:00
/**
* Returns the meta HTML code for each input field .
* format : array ( < field1 > => array ( < META HTML > ), ... )
* It is not possible to display help links .
*
* @ param array $fields list of active fields
2011-08-20 17:59:36 +00:00
* @ param array $attributes attributes of LDAP account
2012-02-08 17:55:00 +00:00
* @ param boolean $passwordChangeOnly indicates that the user is only allowed to change his password and no LDAP content is readable
2012-08-18 15:55:43 +00:00
* @ param array $readOnlyFields list of read - only fields
2012-05-10 19:29:51 +00:00
* @ return array list of meta HTML elements ( field name => htmlTableRow )
2006-07-23 15:06:49 +00:00
*/
2012-08-18 15:55:43 +00:00
function getSelfServiceOptions ( $fields , $attributes , $passwordChangeOnly , $readOnlyFields ) {
2006-07-23 15:06:49 +00:00
$return = array ();
2012-02-08 17:55:00 +00:00
if ( $passwordChangeOnly ) {
return $return ; // no fields as long no LDAP content can be read
}
2006-07-23 15:06:49 +00:00
if ( in_array ( 'firstName' , $fields )) {
$firstName = '' ;
if ( isset ( $attributes [ 'givenName' ][ 0 ])) $firstName = $attributes [ 'givenName' ][ 0 ];
2012-08-18 15:55:43 +00:00
$firstNameField = new htmlInputField ( 'inetOrgPerson_firstName' , $firstName );
if ( in_array ( 'firstName' , $readOnlyFields )) {
$firstNameField = new htmlOutputText ( $firstName );
}
2010-06-21 16:23:44 +00:00
$return [ 'firstName' ] = new htmlTableRow ( array (
2012-08-18 15:55:43 +00:00
new htmlOutputText ( _ ( 'First name' )), $firstNameField
2010-06-21 16:23:44 +00:00
));
2006-07-23 15:06:49 +00:00
}
if ( in_array ( 'lastName' , $fields )) {
$lastName = '' ;
if ( isset ( $attributes [ 'sn' ][ 0 ])) $lastName = $attributes [ 'sn' ][ 0 ];
2012-08-18 15:55:43 +00:00
$lastNameField = new htmlInputField ( 'inetOrgPerson_lastName' , $lastName );
if ( in_array ( 'lastName' , $readOnlyFields )) {
$lastNameField = new htmlOutputText ( $lastName );
}
2010-07-03 12:31:55 +00:00
$return [ 'lastName' ] = new htmlTableRow ( array (
2012-08-18 15:55:43 +00:00
new htmlOutputText ( _ ( 'Last name' )), $lastNameField
2010-07-03 12:31:55 +00:00
));
2006-07-23 15:06:49 +00:00
}
if ( in_array ( 'mail' , $fields )) {
$mail = '' ;
if ( isset ( $attributes [ 'mail' ][ 0 ])) $mail = $attributes [ 'mail' ][ 0 ];
2012-08-18 15:55:43 +00:00
$mailField = new htmlInputField ( 'inetOrgPerson_mail' , $mail );
if ( in_array ( 'mail' , $readOnlyFields )) {
$mailField = new htmlOutputText ( $mail );
}
2010-07-03 12:31:55 +00:00
$return [ 'mail' ] = new htmlTableRow ( array (
2012-08-18 15:55:43 +00:00
new htmlOutputText ( _ ( 'Email address' )), $mailField
2010-07-03 12:31:55 +00:00
));
2006-07-23 15:06:49 +00:00
}
2011-12-11 13:36:34 +00:00
if ( in_array ( 'labeledURI' , $fields )) {
$labeledURI = '' ;
if ( isset ( $attributes [ 'labeledURI' ][ 0 ])) $labeledURI = implode ( '; ' , $attributes [ 'labeledURI' ]);
2012-08-18 15:55:43 +00:00
$labeledURIField = new htmlInputField ( 'inetOrgPerson_labeledURI' , $labeledURI );
if ( in_array ( 'labeledURI' , $readOnlyFields )) {
$labeledURIField = new htmlOutputText ( $labeledURI );
}
2011-12-11 13:36:34 +00:00
$return [ 'labeledURI' ] = new htmlTableRow ( array (
2012-08-18 15:55:43 +00:00
new htmlOutputText ( _ ( 'Web site' )), $labeledURIField
2011-12-11 13:36:34 +00:00
));
}
2006-07-23 15:06:49 +00:00
if ( in_array ( 'telephoneNumber' , $fields )) {
$telephoneNumber = '' ;
if ( isset ( $attributes [ 'telephoneNumber' ][ 0 ])) $telephoneNumber = $attributes [ 'telephoneNumber' ][ 0 ];
2012-08-18 15:55:43 +00:00
$telephoneNumberField = new htmlInputField ( 'inetOrgPerson_telephoneNumber' , $telephoneNumber );
if ( in_array ( 'telephoneNumber' , $readOnlyFields )) {
$telephoneNumberField = new htmlOutputText ( $telephoneNumber );
}
2010-07-03 12:31:55 +00:00
$return [ 'telephoneNumber' ] = new htmlTableRow ( array (
2012-08-18 15:55:43 +00:00
new htmlOutputText ( _ ( 'Telephone number' )), $telephoneNumberField
2010-07-03 12:31:55 +00:00
));
2006-07-23 15:06:49 +00:00
}
2007-06-11 18:19:05 +00:00
if ( in_array ( 'homePhone' , $fields )) {
$homePhone = '' ;
if ( isset ( $attributes [ 'homePhone' ][ 0 ])) $homePhone = $attributes [ 'homePhone' ][ 0 ];
2012-08-18 15:55:43 +00:00
$homePhoneField = new htmlInputField ( 'inetOrgPerson_homePhone' , $homePhone );
if ( in_array ( 'homePhone' , $readOnlyFields )) {
$homePhoneField = new htmlOutputText ( $homePhone );
}
2010-07-03 12:31:55 +00:00
$return [ 'homePhone' ] = new htmlTableRow ( array (
2012-08-18 15:55:43 +00:00
new htmlOutputText ( _ ( 'Home telephone number' )), $homePhoneField
2010-07-03 12:31:55 +00:00
));
2007-06-11 18:19:05 +00:00
}
2006-07-23 15:06:49 +00:00
if ( in_array ( 'mobile' , $fields )) {
$mobile = '' ;
if ( isset ( $attributes [ 'mobile' ][ 0 ])) $mobile = $attributes [ 'mobile' ][ 0 ];
2012-08-18 15:55:43 +00:00
$mobileField = new htmlInputField ( 'inetOrgPerson_mobile' , $mobile );
if ( in_array ( 'mobile' , $readOnlyFields )) {
$mobileField = new htmlOutputText ( $mobile );
}
2010-07-03 12:31:55 +00:00
$return [ 'mobile' ] = new htmlTableRow ( array (
2012-08-18 15:55:43 +00:00
new htmlOutputText ( _ ( 'Mobile telephone number' )), $mobileField
2010-07-03 12:31:55 +00:00
));
2006-07-23 15:06:49 +00:00
}
if ( in_array ( 'faxNumber' , $fields )) {
$faxNumber = '' ;
if ( isset ( $attributes [ 'facsimileTelephoneNumber' ][ 0 ])) $faxNumber = $attributes [ 'facsimileTelephoneNumber' ][ 0 ];
2012-08-18 15:55:43 +00:00
$faxNumberField = new htmlInputField ( 'inetOrgPerson_faxNumber' , $faxNumber );
if ( in_array ( 'faxNumber' , $readOnlyFields )) {
$faxNumberField = new htmlOutputText ( $faxNumber );
}
2010-07-03 12:31:55 +00:00
$return [ 'faxNumber' ] = new htmlTableRow ( array (
2012-08-18 15:55:43 +00:00
new htmlOutputText ( _ ( 'Fax number' )), $faxNumberField
2010-07-03 12:31:55 +00:00
));
2006-07-23 15:06:49 +00:00
}
if ( in_array ( 'street' , $fields )) {
$street = '' ;
if ( isset ( $attributes [ 'street' ][ 0 ])) $street = $attributes [ 'street' ][ 0 ];
2012-08-18 15:55:43 +00:00
$streetField = new htmlInputField ( 'inetOrgPerson_street' , $street );
if ( in_array ( 'street' , $readOnlyFields )) {
$streetField = new htmlOutputText ( $street );
}
2010-07-03 12:31:55 +00:00
$return [ 'street' ] = new htmlTableRow ( array (
2012-08-18 15:55:43 +00:00
new htmlOutputText ( _ ( 'Street' )), $streetField
2010-07-03 12:31:55 +00:00
));
2006-07-23 15:06:49 +00:00
}
if ( in_array ( 'postalAddress' , $fields )) {
$postalAddress = '' ;
if ( isset ( $attributes [ 'postalAddress' ][ 0 ])) $postalAddress = $attributes [ 'postalAddress' ][ 0 ];
2012-08-18 15:55:43 +00:00
$postalAddressField = new htmlInputField ( 'inetOrgPerson_postalAddress' , $postalAddress );
if ( in_array ( 'postalAddress' , $readOnlyFields )) {
$postalAddressField = new htmlOutputText ( $postalAddress );
}
2010-07-03 12:31:55 +00:00
$return [ 'postalAddress' ] = new htmlTableRow ( array (
2012-08-18 15:55:43 +00:00
new htmlOutputText ( _ ( 'Postal address' )), $postalAddressField
2010-07-03 12:31:55 +00:00
));
2006-07-23 15:06:49 +00:00
}
2011-11-03 18:31:33 +00:00
if ( in_array ( 'registeredAddress' , $fields )) {
$registeredAddress = '' ;
if ( isset ( $attributes [ 'registeredAddress' ][ 0 ])) $registeredAddress = $attributes [ 'registeredAddress' ][ 0 ];
2012-08-18 15:55:43 +00:00
$registeredAddressField = new htmlInputField ( 'inetOrgPerson_registeredAddress' , $registeredAddress );
if ( in_array ( 'registeredAddress' , $readOnlyFields )) {
$registeredAddressField = new htmlOutputText ( $registeredAddress );
}
2011-11-03 18:31:33 +00:00
$return [ 'registeredAddress' ] = new htmlTableRow ( array (
2012-08-18 15:55:43 +00:00
new htmlOutputText ( _ ( 'Registered address' )), $registeredAddressField
2011-11-03 18:31:33 +00:00
));
}
2006-07-23 15:06:49 +00:00
if ( in_array ( 'postalCode' , $fields )) {
$postalCode = '' ;
if ( isset ( $attributes [ 'postalCode' ][ 0 ])) $postalCode = $attributes [ 'postalCode' ][ 0 ];
2012-08-18 15:55:43 +00:00
$postalCodeField = new htmlInputField ( 'inetOrgPerson_postalCode' , $postalCode );
if ( in_array ( 'postalCode' , $readOnlyFields )) {
$postalCodeField = new htmlOutputText ( $postalCode );
}
2010-07-03 12:31:55 +00:00
$return [ 'postalCode' ] = new htmlTableRow ( array (
2012-08-18 15:55:43 +00:00
new htmlOutputText ( _ ( 'Postal code' )), $postalCodeField
2010-07-03 12:31:55 +00:00
));
2006-07-23 15:06:49 +00:00
}
if ( in_array ( 'postOfficeBox' , $fields )) {
$postOfficeBox = '' ;
if ( isset ( $attributes [ 'postOfficeBox' ][ 0 ])) $postOfficeBox = $attributes [ 'postOfficeBox' ][ 0 ];
2012-08-18 15:55:43 +00:00
$postOfficeBoxField = new htmlInputField ( 'inetOrgPerson_postOfficeBox' , $postOfficeBox );
if ( in_array ( 'postOfficeBox' , $readOnlyFields )) {
$postOfficeBoxField = new htmlOutputText ( $postOfficeBox );
}
2010-07-03 12:31:55 +00:00
$return [ 'postOfficeBox' ] = new htmlTableRow ( array (
2012-08-18 15:55:43 +00:00
new htmlOutputText ( _ ( 'Post office box' )), $postOfficeBoxField
2010-07-03 12:31:55 +00:00
));
2006-07-23 15:06:49 +00:00
}
2007-06-11 18:19:05 +00:00
if ( in_array ( 'roomNumber' , $fields )) {
$roomNumber = '' ;
if ( isset ( $attributes [ 'roomNumber' ][ 0 ])) $roomNumber = $attributes [ 'roomNumber' ][ 0 ];
2012-08-18 15:55:43 +00:00
$roomNumberField = new htmlInputField ( 'inetOrgPerson_roomNumber' , $roomNumber );
if ( in_array ( 'roomNumber' , $readOnlyFields )) {
$roomNumberField = new htmlOutputText ( $roomNumber );
}
2010-07-03 12:31:55 +00:00
$return [ 'roomNumber' ] = new htmlTableRow ( array (
2012-08-18 15:55:43 +00:00
new htmlOutputText ( _ ( 'Room number' )), $roomNumberField
2010-07-03 12:31:55 +00:00
));
2007-06-11 18:19:05 +00:00
}
2008-02-09 18:01:29 +00:00
if ( in_array ( 'location' , $fields )) {
$l = '' ;
if ( isset ( $attributes [ 'l' ][ 0 ])) $l = $attributes [ 'l' ][ 0 ];
2012-08-18 15:55:43 +00:00
$lField = new htmlInputField ( 'inetOrgPerson_location' , $l );
if ( in_array ( 'location' , $readOnlyFields )) {
$lField = new htmlOutputText ( $l );
}
2010-07-03 12:31:55 +00:00
$return [ 'location' ] = new htmlTableRow ( array (
2012-08-18 15:55:43 +00:00
new htmlOutputText ( _ ( 'Location' )), $lField
2010-07-03 12:31:55 +00:00
));
2008-02-09 18:01:29 +00:00
}
if ( in_array ( 'state' , $fields )) {
$st = '' ;
if ( isset ( $attributes [ 'st' ][ 0 ])) $st = $attributes [ 'st' ][ 0 ];
2012-08-18 15:55:43 +00:00
$stField = new htmlInputField ( 'inetOrgPerson_state' , $st );
if ( in_array ( 'state' , $readOnlyFields )) {
$stField = new htmlOutputText ( $st );
}
2010-07-03 12:31:55 +00:00
$return [ 'state' ] = new htmlTableRow ( array (
2012-08-18 15:55:43 +00:00
new htmlOutputText ( _ ( 'State' )), $stField
2010-07-03 12:31:55 +00:00
));
2008-02-09 18:01:29 +00:00
}
if ( in_array ( 'carLicense' , $fields )) {
$carLicense = '' ;
if ( isset ( $attributes [ 'carLicense' ][ 0 ])) $carLicense = $attributes [ 'carLicense' ][ 0 ];
2012-08-18 15:55:43 +00:00
$carLicenseField = new htmlInputField ( 'inetOrgPerson_carLicense' , $carLicense );
if ( in_array ( 'carLicense' , $readOnlyFields )) {
$carLicenseField = new htmlOutputText ( $carLicense );
}
2010-07-03 12:31:55 +00:00
$return [ 'carLicense' ] = new htmlTableRow ( array (
2012-08-18 15:55:43 +00:00
new htmlOutputText ( _ ( 'Car license' )), $carLicenseField
2010-07-03 12:31:55 +00:00
));
2008-02-09 18:01:29 +00:00
}
if ( in_array ( 'officeName' , $fields )) {
$physicalDeliveryOfficeName = '' ;
if ( isset ( $attributes [ 'physicalDeliveryOfficeName' ][ 0 ])) $physicalDeliveryOfficeName = $attributes [ 'physicalDeliveryOfficeName' ][ 0 ];
2012-08-18 15:55:43 +00:00
$physicalDeliveryOfficeNameField = new htmlInputField ( 'inetOrgPerson_officeName' , $physicalDeliveryOfficeName );
if ( in_array ( 'officeName' , $readOnlyFields )) {
$physicalDeliveryOfficeNameField = new htmlOutputText ( $physicalDeliveryOfficeName );
}
2010-07-03 12:31:55 +00:00
$return [ 'officeName' ] = new htmlTableRow ( array (
2012-08-18 15:55:43 +00:00
new htmlOutputText ( _ ( 'Office name' )), $physicalDeliveryOfficeNameField
2010-07-03 12:31:55 +00:00
));
2008-02-09 18:01:29 +00:00
}
2009-02-08 18:15:21 +00:00
if ( in_array ( 'businessCategory' , $fields )) {
$businessCategory = '' ;
if ( isset ( $attributes [ 'businessCategory' ][ 0 ])) $businessCategory = $attributes [ 'businessCategory' ][ 0 ];
2012-08-18 15:55:43 +00:00
$businessCategoryField = new htmlInputField ( 'inetOrgPerson_businessCategory' , $businessCategory );
if ( in_array ( 'businessCategory' , $readOnlyFields )) {
$businessCategoryField = new htmlOutputText ( $businessCategory );
}
2010-07-03 12:31:55 +00:00
$return [ 'businessCategory' ] = new htmlTableRow ( array (
2012-08-18 15:55:43 +00:00
new htmlOutputText ( _ ( 'Business category' )), $businessCategoryField
2010-07-03 12:31:55 +00:00
));
2009-02-08 18:15:21 +00:00
}
2007-02-18 18:37:15 +00:00
if ( in_array ( 'jpegPhoto' , $fields )) {
if ( isset ( $attributes [ 'jpegPhoto' ][ 0 ])) {
$jpeg_filename = 'jpegPhoto' . session_id () . '.jpg' ;
$outjpeg = fopen ( realpath ( '../../' ) . '/tmp/' . $jpeg_filename , " wb " );
fwrite ( $outjpeg , $attributes [ 'jpegPhoto' ][ 0 ]);
fclose ( $outjpeg );
$photoFile = '../../tmp/' . $jpeg_filename ;
2010-07-03 12:31:55 +00:00
$photoSub = new htmlTable ();
$photoSub -> addElement ( new htmlImage ( $photoFile ), true );
2012-08-18 15:55:43 +00:00
if ( ! in_array ( 'jpegPhoto' , $readOnlyFields )) {
$photoSubSub = new htmlTable ();
$photoSubSub -> addElement ( new htmlTableExtendedInputCheckbox ( 'removeReplacePhoto' , false , _ ( 'Remove/replace photo' ), null , false ));
$photoSubSub -> addElement ( new htmlInputFileUpload ( 'replacePhotoFile' ));
$photoSub -> addElement ( $photoSubSub );
}
2010-07-03 12:31:55 +00:00
$photoRowCells = array ( new htmlOutputText ( _ ( 'Photo' )), $photoSub );
$photoRow = new htmlTableRow ( $photoRowCells );
$return [ 'jpegPhoto' ] = $photoRow ;
2007-02-18 18:37:15 +00:00
}
2012-08-18 15:55:43 +00:00
elseif ( ! in_array ( 'jpegPhoto' , $readOnlyFields )) {
2010-07-03 12:31:55 +00:00
$photoSub = new htmlTable ();
$photoSub -> addElement ( new htmlTableExtendedInputFileUpload ( 'photoFile' , _ ( 'Add photo' )));
$photoRowCells = array ( new htmlOutputText ( _ ( 'Photo' )), $photoSub );
$photoRow = new htmlTableRow ( $photoRowCells );
$return [ 'jpegPhoto' ] = $photoRow ;
2007-02-18 18:37:15 +00:00
}
}
2009-02-15 12:54:37 +00:00
if ( in_array ( 'departmentNumber' , $fields )) {
$departmentNumber = '' ;
2011-05-01 11:58:34 +00:00
if ( isset ( $attributes [ 'departmentNumber' ][ 0 ])) $departmentNumber = implode ( '; ' , $attributes [ 'departmentNumber' ]);
2012-08-18 15:55:43 +00:00
$departmentNumberField = new htmlInputField ( 'inetOrgPerson_departmentNumber' , $departmentNumber );
if ( in_array ( 'departmentNumber' , $readOnlyFields )) {
$departmentNumberField = new htmlOutputText ( $departmentNumber );
}
2010-07-03 12:31:55 +00:00
$return [ 'departmentNumber' ] = new htmlTableRow ( array (
2012-08-18 15:55:43 +00:00
new htmlOutputText ( _ ( 'Department' )), $departmentNumberField
2010-07-03 12:31:55 +00:00
));
2009-02-15 12:54:37 +00:00
}
2011-05-01 11:58:34 +00:00
if ( in_array ( 'initials' , $fields )) {
$initials = '' ;
if ( isset ( $attributes [ 'initials' ][ 0 ])) $initials = implode ( '; ' , $attributes [ 'initials' ]);
2012-08-18 15:55:43 +00:00
$initialsField = new htmlInputField ( 'inetOrgPerson_initials' , $initials );
if ( in_array ( 'initials' , $readOnlyFields )) {
$initialsField = new htmlOutputText ( $initials );
}
2011-05-01 11:58:34 +00:00
$return [ 'initials' ] = new htmlTableRow ( array (
2012-08-18 15:55:43 +00:00
new htmlOutputText ( _ ( 'Initials' )), $initialsField
2011-05-01 11:58:34 +00:00
));
}
2011-05-22 14:22:00 +00:00
if ( in_array ( 'title' , $fields )) {
$title = '' ;
if ( isset ( $attributes [ 'title' ][ 0 ])) $title = $attributes [ 'title' ][ 0 ];
2012-08-18 15:55:43 +00:00
$titleField = new htmlInputField ( 'inetOrgPerson_title' , $title );
if ( in_array ( 'title' , $readOnlyFields )) {
$titleField = new htmlOutputText ( $title );
}
2011-05-22 14:22:00 +00:00
$return [ 'title' ] = new htmlTableRow ( array (
2012-08-18 15:55:43 +00:00
new htmlOutputText ( _ ( 'Job title' )), $titleField
2011-05-22 14:22:00 +00:00
));
}
2013-03-30 14:22:11 +00:00
if ( in_array ( 'userCertificate' , $fields )) {
$userCertificates = array ();
if ( isset ( $attributes [ 'userCertificate' ][ 0 ])) {
$userCertificates = $attributes [ 'userCertificate' ];
}
elseif ( isset ( $attributes [ 'userCertificate;binary' ][ 0 ])) {
$userCertificates = $attributes [ 'userCertificate;binary' ];
}
$_SESSION [ self :: SESS_CERTIFICATES_LIST ] = $userCertificates ;
$certTable = new htmlTable ();
$certTable -> addElement ( new htmlDiv ( 'userCertificateDiv' , $this -> getSelfServiceUserCertificates ()), true );
// JavaScript functions
$certTable -> addElement ( $this -> getSelfServiceUserCertificatesJSBlock (), true );
// upload button
$uploadButtons = new htmlGroup ();
$uploadButtons -> addElement ( new htmlDiv ( 'inetOrgPersonCertUploadId' , new htmlOutputText ( '' )), true );
$certUpload = new htmlJavaScript ( 'inetOrgPersonUploadCert(\'inetOrgPersonCertUploadId\');' );
$uploadButtons -> addElement ( $certUpload );
$certTable -> addElement ( $uploadButtons , true );
// upload status
$uploadStatus = new htmlDiv ( 'inetOrgPerson_upload_status_cert' , new htmlOutputText ( '' ));
$uploadStatus -> setCSSClasses ( array ( 'qq-upload-list' ));
$uploadStatus -> colspan = 7 ;
$certTable -> addElement ( $uploadStatus , true );
$certLabel = new htmlOutputText ( _ ( 'User certificates' ));
$certLabel -> alignment = htmlElement :: ALIGN_TOP ;
$userCertificatesCells = array ( $certLabel , $certTable );
$userCertificatesRow = new htmlTableRow ( $userCertificatesCells );
$return [ 'userCertificate' ] = $userCertificatesRow ;
}
2006-07-23 15:06:49 +00:00
return $return ;
}
2013-03-30 14:22:11 +00:00
/**
* Returns the meta HTML code to display the certificate area .
* This also includes the file upload .
*
* @ return htmlTable certificate content
*/
2013-08-15 19:06:10 +00:00
private function getSelfServiceUserCertificates () {
2013-03-30 14:22:11 +00:00
$userCertificates = $_SESSION [ self :: SESS_CERTIFICATES_LIST ];
$content = new htmlTable ();
if ( sizeof ( $userCertificates ) > 0 ) {
$certTable = new htmlTable ();
for ( $i = 0 ; $i < sizeof ( $userCertificates ); $i ++ ) {
2013-07-21 11:34:31 +00:00
$filename = 'userCertificate' . getRandomNumber () . '.der' ;
2013-03-30 14:22:11 +00:00
$out = @ fopen ( dirname ( __FILE__ ) . '/../../tmp/' . $filename , " wb " );
fwrite ( $out , $userCertificates [ $i ]);
fclose ( $out );
$path = '../../tmp/' . $filename ;
$saveLink = new htmlLink ( '' , $path , '../../graphics/save.png' );
$saveLink -> setTitle ( _ ( 'Save' ));
$saveLink -> setTargetWindow ( '_blank' );
$certTable -> addElement ( $saveLink );
$delLink = new htmlLink ( '' , '#' , '../../graphics/del.png' );
$delLink -> setTitle ( _ ( 'Delete' ));
2013-08-15 19:06:10 +00:00
$delLink -> setOnClick ( 'inetOrgPersonDeleteCertificate(' . $i . '); return false;' );
2013-03-30 14:22:11 +00:00
$certTable -> addElement ( $delLink );
if ( function_exists ( 'openssl_x509_parse' )) {
$pem = @ chunk_split ( @ base64_encode ( $userCertificates [ $i ]), 64 , " \n " );
if ( ! empty ( $pem )) {
$pem = " -----BEGIN CERTIFICATE----- \n " . $pem . " -----END CERTIFICATE----- \n " ;
$pemData = @ openssl_x509_parse ( $pem );
$data = array ();
if ( isset ( $pemData [ 'serialNumber' ])) {
$data [] = $pemData [ 'serialNumber' ];
}
if ( isset ( $pemData [ 'name' ])) {
$data [] = $pemData [ 'name' ];
}
if ( sizeof ( $data ) > 0 ) {
$certTable -> addElement ( new htmlOutputText ( implode ( ': ' , $data )));
}
}
}
$certTable -> addNewLine ();
}
$content -> addElement ( $certTable , true );
}
return $content ;
}
/**
* Returns the Java Script functions to manage the certificates .
*
* @ return htmlJavaScript JS block
*/
private static function getSelfServiceUserCertificatesJSBlock () {
$content = '
function inetOrgPersonDeleteCertificate ( id ) {
var actionJSON = {
" action " : " delete " ,
" id " : id
};
jQuery . post ( \ ' ../ misc / ajax . php ? selfservice = 1 & module = inetOrgPerson & scope = user\ ' , { jsonInput : actionJSON }, function ( data ) { inetOrgPersonDeleteCertificateHandleReply ( data );}, \ ' json\ ' );
}
function inetOrgPersonDeleteCertificateHandleReply ( data ) {
if ( data . errorsOccured == " false " ) {
jQuery ( \ ' #userCertificateDiv\').html(data.html);
}
else {
alert ( data . errormessage );
}
}
function inetOrgPersonUploadCert ( elementID ) {
var uploadStatus = document . getElementById ( \ ' inetOrgPerson_upload_status_cert\ ' );
var uploader = new qq . FineUploader ({
element : document . getElementById ( elementID ),
listElement : uploadStatus ,
request : {
endpoint : \ ' ../ misc / ajax . php ? selfservice = 1 & module = inetOrgPerson & scope = user\ ' ,
forceMultipart : true ,
params : {
action : \ ' ajaxCertUpload\ '
}
},
multiple : false ,
callbacks : {
onComplete : function ( id , fileName , data ) {
if ( data . success ) {
if ( data . html ) {
jQuery ( \ ' #userCertificateDiv\').html(data.html);
}
}
else {
alert ( data . error );
}
}
}
});
}
' ;
return new htmlJavaScript ( $content );
}
2006-07-23 15:06:49 +00:00
/**
2011-02-26 13:14:10 +00:00
* Checks if all input values are correct and returns the LDAP attributes which should be changed .
* < br > Return values :
* < br > messages : array of parameters to create status messages
* < br > add : array of attributes to add
* < br > del : array of attributes to remove
* < br > mod : array of attributes to modify
* < br > info : array of values with informational value ( e . g . to be used later by pre / postModify actions )
*
* Calling this method does not require the existence of an enclosing { @ link accountContainer } .
2006-07-23 15:06:49 +00:00
*
* @ param string $fields input fields
* @ param array $attributes LDAP attributes
2012-02-08 17:55:00 +00:00
* @ param boolean $passwordChangeOnly indicates that the user is only allowed to change his password and no LDAP content is readable
2012-08-18 15:55:43 +00:00
* @ param array $readOnlyFields list of read - only fields
2011-02-26 13:14:10 +00:00
* @ return array messages and attributes ( array ( 'messages' => array (), 'add' => array ( 'mail' => array ( 'test@test.com' )), 'del' => array (), 'mod' => array (), 'info' => array ()))
2006-07-23 15:06:49 +00:00
*/
2012-08-18 15:55:43 +00:00
function checkSelfServiceOptions ( $fields , $attributes , $passwordChangeOnly , $readOnlyFields ) {
2011-02-26 13:14:10 +00:00
$return = array ( 'messages' => array (), 'add' => array (), 'del' => array (), 'mod' => array (), 'info' => array ());
2012-02-08 17:55:00 +00:00
if ( $passwordChangeOnly ) {
return $return ; // skip processing if only a password change is done
}
2006-07-23 15:06:49 +00:00
$attributeNames = array (); // list of attributes which should be checked for modification
$attributesNew = $attributes ;
// first name
2012-08-18 15:55:43 +00:00
if ( in_array ( 'firstName' , $fields ) && ! in_array ( 'firstName' , $readOnlyFields )) {
2006-07-23 15:06:49 +00:00
$attributeNames [] = 'givenName' ;
if ( isset ( $_POST [ 'inetOrgPerson_firstName' ]) && ( $_POST [ 'inetOrgPerson_firstName' ] != '' )) {
if ( ! get_preg ( $_POST [ 'inetOrgPerson_firstName' ], 'realname' )) $return [ 'messages' ][] = $this -> messages [ 'givenName' ][ 0 ];
else $attributesNew [ 'givenName' ][ 0 ] = $_POST [ 'inetOrgPerson_firstName' ];
}
elseif ( isset ( $attributes [ 'givenName' ])) unset ( $attributesNew [ 'givenName' ]);
}
// last name
2012-08-18 15:55:43 +00:00
if ( in_array ( 'lastName' , $fields ) && ! in_array ( 'lastName' , $readOnlyFields )) {
2006-07-23 15:06:49 +00:00
$attributeNames [] = 'sn' ;
if ( isset ( $_POST [ 'inetOrgPerson_lastName' ]) && ( $_POST [ 'inetOrgPerson_lastName' ] != '' )) {
if ( ! get_preg ( $_POST [ 'inetOrgPerson_lastName' ], 'realname' )) $return [ 'messages' ][] = $this -> messages [ 'lastname' ][ 0 ];
else $attributesNew [ 'sn' ][ 0 ] = $_POST [ 'inetOrgPerson_lastName' ];
}
else {
// last name is required attribute
$return [ 'messages' ][] = $this -> messages [ 'lastname' ][ 0 ];
}
}
// email
2012-08-18 15:55:43 +00:00
if ( in_array ( 'mail' , $fields ) && ! in_array ( 'mail' , $readOnlyFields )) {
2006-07-23 15:06:49 +00:00
$attributeNames [] = 'mail' ;
if ( isset ( $_POST [ 'inetOrgPerson_mail' ]) && ( $_POST [ 'inetOrgPerson_mail' ] != '' )) {
if ( ! get_preg ( $_POST [ 'inetOrgPerson_mail' ], 'email' )) $return [ 'messages' ][] = $this -> messages [ 'email' ][ 0 ];
else $attributesNew [ 'mail' ][ 0 ] = $_POST [ 'inetOrgPerson_mail' ];
}
elseif ( isset ( $attributes [ 'mail' ])) unset ( $attributesNew [ 'mail' ]);
}
2011-12-11 13:36:34 +00:00
// labeledURI
2012-08-18 15:55:43 +00:00
if ( in_array ( 'labeledURI' , $fields ) && ! in_array ( 'labeledURI' , $readOnlyFields )) {
2011-12-11 13:36:34 +00:00
$attributeNames [] = 'labeledURI' ;
if ( isset ( $_POST [ 'inetOrgPerson_labeledURI' ]) && ( $_POST [ 'inetOrgPerson_labeledURI' ] != '' )) {
$attributesNew [ 'labeledURI' ] = preg_split ( '/;[ ]*/' , $_POST [ 'inetOrgPerson_labeledURI' ]);
}
elseif ( isset ( $attributes [ 'labeledURI' ])) unset ( $attributesNew [ 'labeledURI' ]);
}
2006-07-23 15:06:49 +00:00
// telephone number
2012-08-18 15:55:43 +00:00
if ( in_array ( 'telephoneNumber' , $fields ) && ! in_array ( 'telephoneNumber' , $readOnlyFields )) {
2006-07-23 15:06:49 +00:00
$attributeNames [] = 'telephoneNumber' ;
if ( isset ( $_POST [ 'inetOrgPerson_telephoneNumber' ]) && ( $_POST [ 'inetOrgPerson_telephoneNumber' ] != '' )) {
if ( ! get_preg ( $_POST [ 'inetOrgPerson_telephoneNumber' ], 'telephone' )) $return [ 'messages' ][] = $this -> messages [ 'telephoneNumber' ][ 0 ];
else $attributesNew [ 'telephoneNumber' ][ 0 ] = $_POST [ 'inetOrgPerson_telephoneNumber' ];
}
elseif ( isset ( $attributes [ 'telephoneNumber' ])) unset ( $attributesNew [ 'telephoneNumber' ]);
}
2007-06-11 18:19:05 +00:00
// home telephone number
2012-08-18 15:55:43 +00:00
if ( in_array ( 'homePhone' , $fields ) && ! in_array ( 'homePhone' , $readOnlyFields )) {
2007-06-11 18:19:05 +00:00
$attributeNames [] = 'homePhone' ;
if ( isset ( $_POST [ 'inetOrgPerson_homePhone' ]) && ( $_POST [ 'inetOrgPerson_homePhone' ] != '' )) {
if ( ! get_preg ( $_POST [ 'inetOrgPerson_homePhone' ], 'telephone' )) $return [ 'messages' ][] = $this -> messages [ 'homePhone' ][ 0 ];
else $attributesNew [ 'homePhone' ][ 0 ] = $_POST [ 'inetOrgPerson_homePhone' ];
}
elseif ( isset ( $attributes [ 'homePhone' ])) unset ( $attributesNew [ 'homePhone' ]);
}
2006-07-23 15:06:49 +00:00
// fax number
2012-08-18 15:55:43 +00:00
if ( in_array ( 'faxNumber' , $fields ) && ! in_array ( 'faxNumber' , $readOnlyFields )) {
2006-07-23 15:06:49 +00:00
$attributeNames [] = 'facsimileTelephoneNumber' ;
if ( isset ( $_POST [ 'inetOrgPerson_faxNumber' ]) && ( $_POST [ 'inetOrgPerson_faxNumber' ] != '' )) {
if ( ! get_preg ( $_POST [ 'inetOrgPerson_faxNumber' ], 'telephone' )) $return [ 'messages' ][] = $this -> messages [ 'facsimileNumber' ][ 0 ];
else $attributesNew [ 'facsimileTelephoneNumber' ][ 0 ] = $_POST [ 'inetOrgPerson_faxNumber' ];
}
elseif ( isset ( $attributes [ 'facsimileTelephoneNumber' ])) $attributesNew [ 'facsimileTelephoneNumber' ] = array ();
}
// mobile telephone number
2012-08-18 15:55:43 +00:00
if ( in_array ( 'mobile' , $fields ) && ! in_array ( 'mobile' , $readOnlyFields )) {
2006-07-23 15:06:49 +00:00
$attributeNames [] = 'mobile' ;
if ( isset ( $_POST [ 'inetOrgPerson_mobile' ]) && ( $_POST [ 'inetOrgPerson_mobile' ] != '' )) {
if ( ! get_preg ( $_POST [ 'inetOrgPerson_mobile' ], 'telephone' )) $return [ 'messages' ][] = $this -> messages [ 'mobileTelephone' ][ 0 ];
else $attributesNew [ 'mobile' ][ 0 ] = $_POST [ 'inetOrgPerson_mobile' ];
}
elseif ( isset ( $attributes [ 'mobile' ])) unset ( $attributesNew [ 'mobile' ]);
}
// street
2012-08-18 15:55:43 +00:00
if ( in_array ( 'street' , $fields ) && ! in_array ( 'street' , $readOnlyFields )) {
2006-07-23 15:06:49 +00:00
$attributeNames [] = 'street' ;
if ( isset ( $_POST [ 'inetOrgPerson_street' ]) && ( $_POST [ 'inetOrgPerson_street' ] != '' )) {
if ( ! get_preg ( $_POST [ 'inetOrgPerson_street' ], 'street' )) $return [ 'messages' ][] = $this -> messages [ 'street' ][ 0 ];
else $attributesNew [ 'street' ][ 0 ] = $_POST [ 'inetOrgPerson_street' ];
}
elseif ( isset ( $attributes [ 'street' ])) unset ( $attributesNew [ 'street' ]);
}
// postal address
2012-08-18 15:55:43 +00:00
if ( in_array ( 'postalAddress' , $fields ) && ! in_array ( 'postalAddress' , $readOnlyFields )) {
2006-07-23 15:06:49 +00:00
$attributeNames [] = 'postalAddress' ;
if ( isset ( $_POST [ 'inetOrgPerson_postalAddress' ]) && ( $_POST [ 'inetOrgPerson_postalAddress' ] != '' )) {
if ( ! get_preg ( $_POST [ 'inetOrgPerson_postalAddress' ], 'postalAddress' )) $return [ 'messages' ][] = $this -> messages [ 'postalAddress' ][ 0 ];
else $attributesNew [ 'postalAddress' ][ 0 ] = $_POST [ 'inetOrgPerson_postalAddress' ];
}
elseif ( isset ( $attributes [ 'postalAddress' ])) $attributesNew [ 'postalAddress' ] = array ();
}
2011-11-03 18:31:33 +00:00
// registered address
2012-08-18 15:55:43 +00:00
if ( in_array ( 'registeredAddress' , $fields ) && ! in_array ( 'registeredAddress' , $readOnlyFields )) {
2011-11-03 18:31:33 +00:00
$attributeNames [] = 'registeredAddress' ;
if ( isset ( $_POST [ 'inetOrgPerson_registeredAddress' ]) && ( $_POST [ 'inetOrgPerson_registeredAddress' ] != '' )) {
if ( ! get_preg ( $_POST [ 'inetOrgPerson_registeredAddress' ], 'postalAddress' )) $return [ 'messages' ][] = $this -> messages [ 'registeredAddress' ][ 0 ];
else $attributesNew [ 'registeredAddress' ][ 0 ] = $_POST [ 'inetOrgPerson_registeredAddress' ];
}
elseif ( isset ( $attributes [ 'registeredAddress' ])) $attributesNew [ 'registeredAddress' ] = array ();
}
2006-07-23 15:06:49 +00:00
// postal code
2012-08-18 15:55:43 +00:00
if ( in_array ( 'postalCode' , $fields ) && ! in_array ( 'postalCode' , $readOnlyFields )) {
2006-07-23 15:06:49 +00:00
$attributeNames [] = 'postalCode' ;
if ( isset ( $_POST [ 'inetOrgPerson_postalCode' ]) && ( $_POST [ 'inetOrgPerson_postalCode' ] != '' )) {
if ( ! get_preg ( $_POST [ 'inetOrgPerson_postalCode' ], 'postalCode' )) $return [ 'messages' ][] = $this -> messages [ 'postalCode' ][ 0 ];
else $attributesNew [ 'postalCode' ][ 0 ] = $_POST [ 'inetOrgPerson_postalCode' ];
}
elseif ( isset ( $attributes [ 'postalCode' ])) unset ( $attributesNew [ 'postalCode' ]);
}
// post office box
2012-08-18 15:55:43 +00:00
if ( in_array ( 'postOfficeBox' , $fields ) && ! in_array ( 'postOfficeBox' , $readOnlyFields )) {
2006-07-23 15:06:49 +00:00
$attributeNames [] = 'postOfficeBox' ;
if ( isset ( $_POST [ 'inetOrgPerson_postOfficeBox' ]) && ( $_POST [ 'inetOrgPerson_postOfficeBox' ] != '' )) {
$attributesNew [ 'postOfficeBox' ][ 0 ] = $_POST [ 'inetOrgPerson_postOfficeBox' ];
}
elseif ( isset ( $attributes [ 'postOfficeBox' ])) unset ( $attributesNew [ 'postOfficeBox' ]);
}
2007-06-11 18:19:05 +00:00
// room number
2012-08-18 15:55:43 +00:00
if ( in_array ( 'roomNumber' , $fields ) && ! in_array ( 'roomNumber' , $readOnlyFields )) {
2007-06-11 18:19:05 +00:00
$attributeNames [] = 'roomNumber' ;
if ( isset ( $_POST [ 'inetOrgPerson_roomNumber' ]) && ( $_POST [ 'inetOrgPerson_roomNumber' ] != '' )) {
$attributesNew [ 'roomNumber' ][ 0 ] = $_POST [ 'inetOrgPerson_roomNumber' ];
}
elseif ( isset ( $attributes [ 'roomNumber' ])) unset ( $attributesNew [ 'roomNumber' ]);
}
2008-02-09 18:01:29 +00:00
// l
2012-08-18 15:55:43 +00:00
if ( in_array ( 'location' , $fields ) && ! in_array ( 'location' , $readOnlyFields )) {
2008-02-09 18:01:29 +00:00
$attributeNames [] = 'l' ;
if ( isset ( $_POST [ 'inetOrgPerson_location' ]) && ( $_POST [ 'inetOrgPerson_location' ] != '' )) {
$attributesNew [ 'l' ][ 0 ] = $_POST [ 'inetOrgPerson_location' ];
}
elseif ( isset ( $attributes [ 'l' ])) unset ( $attributesNew [ 'l' ]);
}
// st
2012-08-18 15:55:43 +00:00
if ( in_array ( 'state' , $fields ) && ! in_array ( 'state' , $readOnlyFields )) {
2008-02-09 18:01:29 +00:00
$attributeNames [] = 'st' ;
if ( isset ( $_POST [ 'inetOrgPerson_state' ]) && ( $_POST [ 'inetOrgPerson_state' ] != '' )) {
$attributesNew [ 'st' ][ 0 ] = $_POST [ 'inetOrgPerson_state' ];
}
elseif ( isset ( $attributes [ 'st' ])) unset ( $attributesNew [ 'st' ]);
}
// car license
2012-08-18 15:55:43 +00:00
if ( in_array ( 'carLicense' , $fields ) && ! in_array ( 'carLicense' , $readOnlyFields )) {
2008-02-09 18:01:29 +00:00
$attributeNames [] = 'carLicense' ;
if ( isset ( $_POST [ 'inetOrgPerson_carLicense' ]) && ( $_POST [ 'inetOrgPerson_carLicense' ] != '' )) {
$attributesNew [ 'carLicense' ][ 0 ] = $_POST [ 'inetOrgPerson_carLicense' ];
}
elseif ( isset ( $attributes [ 'carLicense' ])) unset ( $attributesNew [ 'carLicense' ]);
}
// office name
2012-08-18 15:55:43 +00:00
if ( in_array ( 'officeName' , $fields ) && ! in_array ( 'officeName' , $readOnlyFields )) {
2008-02-09 18:01:29 +00:00
$attributeNames [] = 'physicalDeliveryOfficeName' ;
if ( isset ( $_POST [ 'inetOrgPerson_officeName' ]) && ( $_POST [ 'inetOrgPerson_officeName' ] != '' )) {
$attributesNew [ 'physicalDeliveryOfficeName' ][ 0 ] = $_POST [ 'inetOrgPerson_officeName' ];
}
elseif ( isset ( $attributes [ 'physicalDeliveryOfficeName' ])) unset ( $attributesNew [ 'physicalDeliveryOfficeName' ]);
}
2009-02-08 18:15:21 +00:00
// business category
2012-08-18 15:55:43 +00:00
if ( in_array ( 'businessCategory' , $fields ) && ! in_array ( 'businessCategory' , $readOnlyFields )) {
2009-02-08 18:15:21 +00:00
$attributeNames [] = 'businessCategory' ;
if ( isset ( $_POST [ 'inetOrgPerson_businessCategory' ]) && ( $_POST [ 'inetOrgPerson_businessCategory' ] != '' )) {
if ( ! get_preg ( $_POST [ 'inetOrgPerson_businessCategory' ], 'businessCategory' )) {
$return [ 'messages' ][] = $this -> messages [ 'businessCategory' ][ 0 ];
}
else {
$attributesNew [ 'businessCategory' ][ 0 ] = $_POST [ 'inetOrgPerson_businessCategory' ];
}
}
elseif ( isset ( $attributes [ 'businessCategory' ])) unset ( $attributesNew [ 'businessCategory' ]);
}
2007-02-18 18:37:15 +00:00
// photo
2012-08-18 15:55:43 +00:00
if ( in_array ( 'jpegPhoto' , $fields ) && ! in_array ( 'jpegPhoto' , $readOnlyFields )) {
2010-07-03 12:31:55 +00:00
if ( isset ( $_FILES [ 'photoFile' ]) && ( $_FILES [ 'photoFile' ][ 'size' ] > 0 )) {
2007-02-18 18:37:15 +00:00
$handle = fopen ( $_FILES [ 'photoFile' ][ 'tmp_name' ], " r " );
$data = fread ( $handle , 1000000 );
fclose ( $handle );
$return [ 'add' ][ 'jpegPhoto' ][ 0 ] = $data ;
}
2008-05-15 17:32:59 +00:00
if ( isset ( $_POST [ 'removeReplacePhoto' ]) && ( $_POST [ 'removeReplacePhoto' ] == 'on' )) {
2007-02-18 18:37:15 +00:00
if ( $_FILES [ 'replacePhotoFile' ] && ( $_FILES [ 'replacePhotoFile' ][ 'size' ] > 0 )) {
$handle = fopen ( $_FILES [ 'replacePhotoFile' ][ 'tmp_name' ], " r " );
$data = fread ( $handle , 1000000 );
fclose ( $handle );
$return [ 'mod' ][ 'jpegPhoto' ][ 0 ] = $data ;
}
else {
$return [ 'mod' ][ 'jpegPhoto' ] = array ();
}
}
}
2009-02-15 12:54:37 +00:00
// departments
2012-08-18 15:55:43 +00:00
if ( in_array ( 'departmentNumber' , $fields ) && ! in_array ( 'departmentNumber' , $readOnlyFields )) {
2009-02-15 12:54:37 +00:00
$attributeNames [] = 'departmentNumber' ;
if ( isset ( $_POST [ 'inetOrgPerson_departmentNumber' ]) && ( $_POST [ 'inetOrgPerson_departmentNumber' ] != '' )) {
2011-05-01 11:58:34 +00:00
$attributesNew [ 'departmentNumber' ] = preg_split ( '/;[ ]*/' , $_POST [ 'inetOrgPerson_departmentNumber' ]);
2009-02-15 12:54:37 +00:00
}
elseif ( isset ( $attributes [ 'departmentNumber' ])) unset ( $attributesNew [ 'departmentNumber' ]);
}
2011-05-01 11:58:34 +00:00
// initials
2012-08-18 15:55:43 +00:00
if ( in_array ( 'initials' , $fields ) && ! in_array ( 'initials' , $readOnlyFields )) {
2011-05-01 11:58:34 +00:00
$attributeNames [] = 'initials' ;
if ( isset ( $_POST [ 'inetOrgPerson_initials' ]) && ( $_POST [ 'inetOrgPerson_initials' ] != '' )) {
$attributesNew [ 'initials' ] = preg_split ( '/;[ ]*/' , $_POST [ 'inetOrgPerson_initials' ]);
}
elseif ( isset ( $attributes [ 'initials' ])) unset ( $attributesNew [ 'initials' ]);
}
2011-05-22 14:22:00 +00:00
// title
2012-08-18 15:55:43 +00:00
if ( in_array ( 'title' , $fields ) && ! in_array ( 'title' , $readOnlyFields )) {
2011-05-22 14:22:00 +00:00
$attributeNames [] = 'title' ;
if ( isset ( $_POST [ 'inetOrgPerson_title' ]) && ( $_POST [ 'inetOrgPerson_title' ] != '' )) {
if ( ! get_preg ( $_POST [ 'inetOrgPerson_title' ], 'title' )) $return [ 'messages' ][] = $this -> messages [ 'title' ][ 0 ];
else $attributesNew [ 'title' ][ 0 ] = $_POST [ 'inetOrgPerson_title' ];
}
elseif ( isset ( $attributes [ 'title' ])) unset ( $attributesNew [ 'title' ]);
}
2013-03-30 14:22:11 +00:00
// user certificates
if ( in_array ( 'userCertificate' , $fields )) {
$userCertificates = $_SESSION [ inetOrgPerson :: SESS_CERTIFICATES_LIST ];
$userCertificatesAttrName = 'userCertificate;binary' ;
if ( isset ( $attributes [ 'userCertificate' ])) {
$userCertificatesAttrName = 'userCertificate' ;
}
$attributeNames [] = $userCertificatesAttrName ;
if ( sizeof ( $userCertificates ) > 0 ) {
$attributesNew [ $userCertificatesAttrName ] = $userCertificates ;
}
elseif ( isset ( $attributesNew [ $userCertificatesAttrName ])) {
unset ( $attributesNew [ $userCertificatesAttrName ]);
}
}
2006-07-23 15:06:49 +00:00
// find differences
for ( $i = 0 ; $i < sizeof ( $attributeNames ); $i ++ ) {
$attrName = $attributeNames [ $i ];
if ( isset ( $attributes [ $attrName ]) && ! isset ( $attributesNew [ $attrName ])) $return [ 'del' ][ $attrName ] = $attributes [ $attrName ];
elseif ( ! isset ( $attributes [ $attrName ]) && isset ( $attributesNew [ $attrName ])) $return [ 'add' ][ $attrName ] = $attributesNew [ $attrName ];
else {
2010-06-16 17:22:47 +00:00
if ( isset ( $attributes [ $attrName ])) {
for ( $a = 0 ; $a < sizeof ( $attributes [ $attrName ]); $a ++ ) {
if ( ! in_array ( $attributes [ $attrName ][ $a ], $attributesNew [ $attrName ])) {
$return [ 'mod' ][ $attrName ] = $attributesNew [ $attrName ];
break ;
}
2006-07-23 15:06:49 +00:00
}
}
2010-06-16 17:22:47 +00:00
if ( isset ( $attributesNew [ $attrName ])) {
for ( $a = 0 ; $a < sizeof ( $attributesNew [ $attrName ]); $a ++ ) {
if ( ! in_array ( $attributesNew [ $attrName ][ $a ], $attributes [ $attrName ])) {
$return [ 'mod' ][ $attrName ] = $attributesNew [ $attrName ];
break ;
}
2009-02-15 12:54:37 +00:00
}
}
2006-07-23 15:06:49 +00:00
}
}
return $return ;
}
2009-10-03 15:46:26 +00:00
2013-03-30 14:22:11 +00:00
/**
* Manages AJAX requests .
* This function may be called with or without an account container .
*/
public function handleAjaxRequest () {
// AJAX uploads are non-JSON
if ( isset ( $_GET [ 'action' ]) && ( $_GET [ 'action' ] == 'ajaxCertUpload' )) {
$this -> ajaxUpload ();
return ;
}
$jsonInput = $_POST [ 'jsonInput' ];
$jsonReturn = self :: invalidAjaxRequest ();
if ( isset ( $jsonInput [ 'action' ])) {
if ( $jsonInput [ 'action' ] == 'delete' ) {
$jsonReturn = $this -> ajaxDeleteSelfServiceUserCertificate ( $jsonInput );
}
}
echo json_encode ( $jsonReturn );
}
/**
* Handles an AJAX file upload and prints the JSON result .
*/
private function ajaxUpload () {
$result = array ( 'success' => true );
if ( ! isset ( $_FILES [ 'qqfile' ]) || ( $_FILES [ 'qqfile' ][ 'size' ] < 100 )) {
$result = array ( 'error' => _ ( 'No file received.' ));
}
else {
$handle = fopen ( $_FILES [ 'qqfile' ][ 'tmp_name' ], " r " );
$data = fread ( $handle , 100000000 );
fclose ( $handle );
if ( strpos ( $data , '-----BEGIN CERTIFICATE-----' ) === 0 ) {
$pemData = str_replace ( " \r " , '' , $data );
$pemData = explode ( " \n " , $pemData );
array_shift ( $pemData );
$last = array_pop ( $pemData );
while (( $last != '-----END CERTIFICATE-----' ) && sizeof ( $pemData ) > 2 ) {
$last = array_pop ( $pemData );
}
$pemData = implode ( '' , $pemData );
$data = base64_decode ( $pemData );
}
$_SESSION [ inetOrgPerson :: SESS_CERTIFICATES_LIST ][] = $data ;
ob_start ();
$contentElement = $this -> getSelfServiceUserCertificates ();
ob_end_clean ();
ob_start ();
$tabindex = 999 ;
parseHtml ( null , $contentElement , array (), true , $tabindex , $this -> get_scope ());
$content = ob_get_contents ();
ob_end_clean ();
$result [ 'html' ] = $content ;
}
echo json_encode ( $result );
}
/**
* Manages the deletion of a certificate .
*
* @ param array $data JSON data
*/
private function ajaxDeleteSelfServiceUserCertificate ( $data ) {
if ( ! isset ( $data [ 'id' ])) {
return self :: invalidAjaxRequest ();
}
$index = $data [ 'id' ];
if ( array_key_exists ( $index , $_SESSION [ inetOrgPerson :: SESS_CERTIFICATES_LIST ])) {
unset ( $_SESSION [ inetOrgPerson :: SESS_CERTIFICATES_LIST ][ $index ]);
$_SESSION [ inetOrgPerson :: SESS_CERTIFICATES_LIST ] = array_values ( $_SESSION [ inetOrgPerson :: SESS_CERTIFICATES_LIST ]);
}
ob_start ();
$contentElement = $this -> getSelfServiceUserCertificates ();
ob_end_clean ();
ob_start ();
$tabindex = 999 ;
parseHtml ( null , $contentElement , array (), true , $tabindex , $this -> get_scope ());
$content = ob_get_contents ();
ob_end_clean ();
return array (
'errorsOccured' => 'false' ,
'html' => $content ,
);
}
/**
* Invalid AJAX request received .
*
* @ param String $message error message
*/
public static function invalidAjaxRequest ( $message = null ) {
if ( $message == null ) {
$message = _ ( 'Invalid request' );
}
return array ( 'errorsOccured' => 'true' , 'errormessage' => $message );
}
2009-10-10 12:47:40 +00:00
/**
* This method specifies if a module manages password attributes .
* @ see passwordService :: managesPasswordAttributes
*
* @ return boolean true if this module manages password attributes
*/
public function managesPasswordAttributes () {
$modules = $_SESSION [ 'config' ] -> get_AccountModules ( $this -> get_scope ());
if ( ! in_array ( 'posixAccount' , $modules )) {
return true ;
}
return false ;
}
2012-01-15 19:34:14 +00:00
/**
* Specifies if this module supports to force that a user must change his password on next login .
*
* @ return boolean force password change supported
*/
public function supportsForcePasswordChange () {
return false ;
}
2009-10-10 12:47:40 +00:00
/**
* This function is called whenever the password should be changed . Account modules
* must change their password attributes only if the modules list contains their module name .
*
* @ param String $password new password
* @ param $modules list of modules for which the password should be changed
2012-01-15 19:34:14 +00:00
* @ param boolean $forcePasswordChange force the user to change his password at next login
2009-10-10 12:47:40 +00:00
* @ return array list of error messages if any as parameter array for StatusMessage
* e . g . return arrray ( array ( 'ERROR' , 'Password change failed.' ))
* @ see passwordService :: passwordChangeRequested
*/
2012-01-15 19:34:14 +00:00
public function passwordChangeRequested ( $password , $modules , $forcePasswordChange ) {
2009-10-10 12:47:40 +00:00
if ( ! in_array ( get_class ( $this ), $modules )) {
return array ();
}
2011-05-16 17:32:32 +00:00
$this -> clearTextPassword = $password ;
2009-11-12 19:48:53 +00:00
$this -> attributes [ 'userPassword' ][ 0 ] = pwd_hash ( $password , true , $this -> moduleSettings [ 'posixAccount_pwdHash' ][ 0 ]);
2009-10-10 12:47:40 +00:00
return array ();
}
2010-11-21 14:43:09 +00:00
/**
* Returns a list of possible managers .
*
* @ return array list of format array ( abstract DN => DN )
*/
private function getManagers () {
if ( $this -> cachedManagers != null ) {
return $this -> cachedManagers ;
}
$dnUsers = searchLDAPByAttribute ( null , null , 'inetOrgPerson' , array ( 'dn' ), array ( 'user' ));
for ( $i = 0 ; $i < sizeof ( $dnUsers ); $i ++ ) {
$dnUsers [ $i ] = $dnUsers [ $i ][ 'dn' ];
}
2011-04-25 17:57:04 +00:00
usort ( $dnUsers , 'compareDN' );
2010-11-21 14:43:09 +00:00
array_unshift ( $dnUsers , '-' );
$this -> cachedManagers = array ();
for ( $i = 0 ; $i < sizeof ( $dnUsers ); $i ++ ) {
$this -> cachedManagers [ getAbstractDN ( $dnUsers [ $i ])] = $dnUsers [ $i ];
}
return $this -> cachedManagers ;
}
2013-03-24 15:25:01 +00:00
/**
* Loads cached data from LDAP such as departmets etc .
*/
private function initCache () {
if ( $this -> departmentCache != null ) {
return ;
}
$attrs = array ();
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideDepartments' )) {
$attrs [] = 'departmentNumber' ;
}
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideOu' )) {
$attrs [] = 'ou' ;
}
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideO' )) {
$attrs [] = 'o' ;
}
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideJobTitle' )) {
$attrs [] = 'title' ;
}
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideEmployeeType' )) {
$attrs [] = 'employeeType' ;
}
if ( ! $this -> isBooleanConfigOptionSet ( 'inetOrgPerson_hideBusinessCategory' )) {
$attrs [] = 'businessCategory' ;
}
$departments = array ();
$ous = array ();
$os = array ();
$titles = array ();
$employeeTypes = array ();
$businessCategories = array ();
if ( sizeof ( $attrs ) > 0 ) {
$result = searchLDAPByFilter ( '(objectClass=inetOrgPerson)' , $attrs , array ( $this -> get_scope ()));
foreach ( $result as $attributes ) {
if ( isset ( $attributes [ 'departmentnumber' ])) {
$departments = array_merge ( $departments , $attributes [ 'departmentnumber' ]);
}
if ( isset ( $attributes [ 'ou' ])) {
$ous = array_merge ( $ous , $attributes [ 'ou' ]);
}
if ( isset ( $attributes [ 'o' ])) {
$os = array_merge ( $os , $attributes [ 'o' ]);
}
if ( isset ( $attributes [ 'title' ])) {
$titles = array_merge ( $titles , $attributes [ 'title' ]);
}
if ( isset ( $attributes [ 'employeetype' ])) {
$employeeTypes = array_merge ( $employeeTypes , $attributes [ 'employeetype' ]);
}
if ( isset ( $attributes [ 'businesscategory' ])) {
$businessCategories = array_merge ( $businessCategories , $attributes [ 'businesscategory' ]);
}
}
}
$this -> departmentCache = array_values ( array_unique ( $departments ));
$this -> oCache = array_values ( array_unique ( $os ));
$this -> ouCache = array_values ( array_unique ( $ous ));
$this -> titleCache = array_values ( array_unique ( $titles ));
$this -> employeeTypeCache = array_values ( array_unique ( $employeeTypes ));
$this -> businessCategoryCache = array_values ( array_unique ( $businessCategories ));
}
2009-10-10 12:47:40 +00:00
2004-03-09 12:03:39 +00:00
}
2003-12-12 00:52:35 +00:00
?>