common function to upload multi-value attributes
This commit is contained in:
parent
15570725e2
commit
224c4ede8d
|
@ -959,18 +959,37 @@ abstract class baseModule {
|
||||||
* @param String $regexID for get_preg() (e.g. 'ascii')
|
* @param String $regexID for get_preg() (e.g. 'ascii')
|
||||||
* @param array $message error message to add if regex does not match
|
* @param array $message error message to add if regex does not match
|
||||||
* @param array $errors list of error messages if any
|
* @param array $errors list of error messages if any
|
||||||
|
* @param String $regexSplit multiple values are separated and can be split with this preg_split expression (e.g. "/;[ ]?/")
|
||||||
*/
|
*/
|
||||||
protected function mapSimpleUploadField(&$rawAccounts, &$ids, &$partialAccounts, $position, $colName, $attrName, $regex = null, &$message = array(), &$errors = array()) {
|
protected function mapSimpleUploadField(&$rawAccounts, &$ids, &$partialAccounts, $position, $colName, $attrName, $regex = null, &$message = array(), &$errors = array(), $regexSplit = null) {
|
||||||
if (!isset($ids[$colName])) {
|
if (!isset($ids[$colName])) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!empty($rawAccounts[$position][$ids[$colName]])) {
|
if (!empty($rawAccounts[$position][$ids[$colName]])) {
|
||||||
if (!empty($regex) && !get_preg($rawAccounts[$position][$ids[$colName]], $regex)) {
|
// single value
|
||||||
$errMsg = $message;
|
if ($regexSplit == null) {
|
||||||
array_push($errMsg, array($position));
|
if (!empty($regex) && !get_preg($rawAccounts[$position][$ids[$colName]], $regex)) {
|
||||||
$errors[] = $errMsg;
|
$errMsg = $message;
|
||||||
|
array_push($errMsg, array($position));
|
||||||
|
$errors[] = $errMsg;
|
||||||
|
}
|
||||||
|
$partialAccounts[$position][$attrName] = $rawAccounts[$position][$ids[$colName]];
|
||||||
|
}
|
||||||
|
// multi-value
|
||||||
|
else {
|
||||||
|
$list = preg_split($regexSplit, trim($rawAccounts[$position][$ids[$colName]]));
|
||||||
|
$partialAccounts[$position][$attrName] = $list;
|
||||||
|
if (!empty($regex)) {
|
||||||
|
for ($x = 0; $x < sizeof($list); $x++) {
|
||||||
|
if (!get_preg($list[$x], $regex)) {
|
||||||
|
$errMsg = $message;
|
||||||
|
array_push($errMsg, array($position));
|
||||||
|
$errors[] = $errMsg;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$partialAccounts[$position][$attrName] = $rawAccounts[$position][$ids[$colName]];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ $Id$
|
||||||
* @package modules
|
* @package modules
|
||||||
*/
|
*/
|
||||||
class inetOrgPerson extends baseModule implements passwordService {
|
class inetOrgPerson extends baseModule implements passwordService {
|
||||||
|
|
||||||
/** caches the list of possible managers */
|
/** caches the list of possible managers */
|
||||||
private $cachedManagers = null;
|
private $cachedManagers = null;
|
||||||
/** clear text password */
|
/** clear text password */
|
||||||
|
@ -55,10 +55,10 @@ class inetOrgPerson extends baseModule implements passwordService {
|
||||||
private $businessCategoryCache = null;
|
private $businessCategoryCache = null;
|
||||||
/** cache for email duplication checks */
|
/** cache for email duplication checks */
|
||||||
private $emailCheckCache = array();
|
private $emailCheckCache = array();
|
||||||
|
|
||||||
/** session variable for existing user certificates in self service */
|
/** session variable for existing user certificates in self service */
|
||||||
const SESS_CERTIFICATES_LIST = 'inetOrgPerson_certificatesList';
|
const SESS_CERTIFICATES_LIST = 'inetOrgPerson_certificatesList';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function fills the message array.
|
* This function fills the message array.
|
||||||
**/
|
**/
|
||||||
|
@ -110,7 +110,7 @@ class inetOrgPerson extends baseModule implements passwordService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if this module can manage accounts of the current type, otherwise false.
|
* Returns true if this module can manage accounts of the current type, otherwise false.
|
||||||
*
|
*
|
||||||
* @return boolean true if module fits
|
* @return boolean true if module fits
|
||||||
*/
|
*/
|
||||||
public function can_manage() {
|
public function can_manage() {
|
||||||
|
@ -121,7 +121,7 @@ class inetOrgPerson extends baseModule implements passwordService {
|
||||||
* Returns meta data that is interpreted by parent class
|
* Returns meta data that is interpreted by parent class
|
||||||
*
|
*
|
||||||
* @return array array with meta data
|
* @return array array with meta data
|
||||||
*
|
*
|
||||||
* @see baseModule::get_metaData()
|
* @see baseModule::get_metaData()
|
||||||
*/
|
*/
|
||||||
function get_metaData() {
|
function get_metaData() {
|
||||||
|
@ -630,7 +630,7 @@ class inetOrgPerson extends baseModule implements passwordService {
|
||||||
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideInitials')) {
|
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideInitials')) {
|
||||||
$return['PDF_fields']['initials'] = _('Initials');
|
$return['PDF_fields']['initials'] = _('Initials');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isLoggedIn()) {
|
if (isLoggedIn()) {
|
||||||
$modules = $_SESSION['config']->get_AccountModules($this->get_scope());
|
$modules = $_SESSION['config']->get_AccountModules($this->get_scope());
|
||||||
if (!in_array('posixAccount', $modules)) {
|
if (!in_array('posixAccount', $modules)) {
|
||||||
|
@ -979,10 +979,10 @@ class inetOrgPerson extends baseModule implements passwordService {
|
||||||
}
|
}
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Runs the postmodify actions.
|
* Runs the postmodify actions.
|
||||||
*
|
*
|
||||||
* @see baseModule::postModifyActions()
|
* @see baseModule::postModifyActions()
|
||||||
*
|
*
|
||||||
* @param boolean $newAccount
|
* @param boolean $newAccount
|
||||||
|
@ -1068,7 +1068,7 @@ class inetOrgPerson extends baseModule implements passwordService {
|
||||||
$errors[] = $msg;
|
$errors[] = $msg;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideTelephoneNumber') && !$this->isAdminReadOnly('telephoneNumber')) {
|
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideTelephoneNumber') && !$this->isAdminReadOnly('telephoneNumber')) {
|
||||||
|
@ -1165,7 +1165,7 @@ class inetOrgPerson extends baseModule implements passwordService {
|
||||||
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideInitials') && !$this->isAdminReadOnly('initials')) {
|
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideInitials') && !$this->isAdminReadOnly('initials')) {
|
||||||
$this->attributes['initials'] = preg_split('/;[ ]*/', $_POST['initials']);
|
$this->attributes['initials'] = preg_split('/;[ ]*/', $_POST['initials']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$this->isUnixActive()) {
|
if (!$this->isUnixActive()) {
|
||||||
// uid
|
// uid
|
||||||
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideUID') && !$this->isAdminReadOnly('uid')) {
|
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideUID') && !$this->isAdminReadOnly('uid')) {
|
||||||
|
@ -1211,7 +1211,7 @@ class inetOrgPerson extends baseModule implements passwordService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hidejpegPhoto') && isset($_POST['delPhoto']) && !$this->isAdminReadOnly('jpegPhoto')) {
|
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hidejpegPhoto') && isset($_POST['delPhoto']) && !$this->isAdminReadOnly('jpegPhoto')) {
|
||||||
$this->attributes['jpegPhoto'] = array();
|
$this->attributes['jpegPhoto'] = array();
|
||||||
}
|
}
|
||||||
|
@ -1221,7 +1221,7 @@ class inetOrgPerson extends baseModule implements passwordService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the HTML meta data for the main account page.
|
* Returns the HTML meta data for the main account page.
|
||||||
*
|
*
|
||||||
* @return array HTML meta data
|
* @return array HTML meta data
|
||||||
*/
|
*/
|
||||||
function display_html_attributes() {
|
function display_html_attributes() {
|
||||||
|
@ -1451,7 +1451,7 @@ class inetOrgPerson extends baseModule implements passwordService {
|
||||||
|| !$this->isBooleanConfigOptionSet('inetOrgPerson_hideEMailAddress') || !$this->isBooleanConfigOptionSet('inetOrgPerson_hideLabeledURI')) {
|
|| !$this->isBooleanConfigOptionSet('inetOrgPerson_hideEMailAddress') || !$this->isBooleanConfigOptionSet('inetOrgPerson_hideLabeledURI')) {
|
||||||
$fieldContainer->addElement(new htmlSubTitle(_('Contact data')), true);
|
$fieldContainer->addElement(new htmlSubTitle(_('Contact data')), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideTelephoneNumber')) {
|
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideTelephoneNumber')) {
|
||||||
if ($this->isAdminReadOnly('telephoneNumber')) {
|
if ($this->isAdminReadOnly('telephoneNumber')) {
|
||||||
$this->addSimpleReadOnlyField($fieldContainer, 'telephoneNumber', _('Telephone number'));
|
$this->addSimpleReadOnlyField($fieldContainer, 'telephoneNumber', _('Telephone number'));
|
||||||
|
@ -1508,14 +1508,14 @@ class inetOrgPerson extends baseModule implements passwordService {
|
||||||
$this->addMultiValueInputTextField($fieldContainer, 'labeledURI', _('Web site'), false, null, false, null, null, $equalWidthElements);
|
$this->addMultiValueInputTextField($fieldContainer, 'labeledURI', _('Web site'), false, null, false, null, null, $equalWidthElements);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideJobTitle') || !$this->isBooleanConfigOptionSet('inetOrgPerson_hideCarLicense')
|
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideJobTitle') || !$this->isBooleanConfigOptionSet('inetOrgPerson_hideCarLicense')
|
||||||
|| !$this->isBooleanConfigOptionSet('inetOrgPerson_hideEmployeeType') || !$this->isBooleanConfigOptionSet('inetOrgPerson_hideBusinessCategory')
|
|| !$this->isBooleanConfigOptionSet('inetOrgPerson_hideEmployeeType') || !$this->isBooleanConfigOptionSet('inetOrgPerson_hideBusinessCategory')
|
||||||
|| !$this->isBooleanConfigOptionSet('inetOrgPerson_hideDepartments') || !$this->isBooleanConfigOptionSet('inetOrgPerson_hideManager')
|
|| !$this->isBooleanConfigOptionSet('inetOrgPerson_hideDepartments') || !$this->isBooleanConfigOptionSet('inetOrgPerson_hideManager')
|
||||||
|| !$this->isBooleanConfigOptionSet('inetOrgPerson_hideuserCertificate')) {
|
|| !$this->isBooleanConfigOptionSet('inetOrgPerson_hideuserCertificate')) {
|
||||||
$fieldContainer->addElement(new htmlSubTitle(_('Work details')), true);
|
$fieldContainer->addElement(new htmlSubTitle(_('Work details')), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideJobTitle')) {
|
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideJobTitle')) {
|
||||||
if ($this->isAdminReadOnly('title')) {
|
if ($this->isAdminReadOnly('title')) {
|
||||||
$this->addSimpleReadOnlyField($fieldContainer, 'title', _('Job title'));
|
$this->addSimpleReadOnlyField($fieldContainer, 'title', _('Job title'));
|
||||||
|
@ -1677,7 +1677,7 @@ class inetOrgPerson extends baseModule implements passwordService {
|
||||||
$container->addElement($imageContainer, false);
|
$container->addElement($imageContainer, false);
|
||||||
}
|
}
|
||||||
$container->addElement(new htmlEqualWidth($equalWidthElements));
|
$container->addElement(new htmlEqualWidth($equalWidthElements));
|
||||||
return $container;
|
return $container;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1755,10 +1755,10 @@ class inetOrgPerson extends baseModule implements passwordService {
|
||||||
$container->addElement($buttonContainer);
|
$container->addElement($buttonContainer);
|
||||||
return $container;
|
return $container;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function will create the meta HTML code to show a page to change the manager attribute.
|
* This function will create the meta HTML code to show a page to change the manager attribute.
|
||||||
*
|
*
|
||||||
* @return htmlElement HTML meta data
|
* @return htmlElement HTML meta data
|
||||||
*/
|
*/
|
||||||
function display_html_manager() {
|
function display_html_manager() {
|
||||||
|
@ -1920,7 +1920,7 @@ class inetOrgPerson extends baseModule implements passwordService {
|
||||||
$container->addElement(new htmlAccountPageButton(get_class($this), 'attributes', 'back', _('Back')));
|
$container->addElement(new htmlAccountPageButton(get_class($this), 'attributes', 'back', _('Back')));
|
||||||
return $container;
|
return $container;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets a new certificate or deletes old ones.
|
* Sets a new certificate or deletes old ones.
|
||||||
*
|
*
|
||||||
|
@ -2006,7 +2006,7 @@ class inetOrgPerson extends baseModule implements passwordService {
|
||||||
$this->addSimplePDFField($return, 'departmentNumber', _('Department'));
|
$this->addSimplePDFField($return, 'departmentNumber', _('Department'));
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads the values of an account profile into internal variables.
|
* Loads the values of an account profile into internal variables.
|
||||||
*
|
*
|
||||||
|
@ -2068,7 +2068,7 @@ class inetOrgPerson extends baseModule implements passwordService {
|
||||||
$this->attributes['st'] = $list;
|
$this->attributes['st'] = $list;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks input values of account profiles.
|
* Checks input values of account profiles.
|
||||||
*
|
*
|
||||||
|
@ -2143,7 +2143,7 @@ class inetOrgPerson extends baseModule implements passwordService {
|
||||||
}
|
}
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* In this function the LDAP account is built up.
|
* In this function the LDAP account is built up.
|
||||||
*
|
*
|
||||||
|
@ -2211,62 +2211,18 @@ class inetOrgPerson extends baseModule implements passwordService {
|
||||||
// description
|
// description
|
||||||
$this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'inetOrgPerson_description', 'description');
|
$this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'inetOrgPerson_description', 'description');
|
||||||
// title
|
// title
|
||||||
if (isset($ids['inetOrgPerson_title']) && ($rawAccounts[$i][$ids['inetOrgPerson_title']] != "")) {
|
$this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'inetOrgPerson_title', 'title', 'title', $this->messages['title'][1], $errors, '/;[ ]*/');
|
||||||
$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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// employee number
|
// employee number
|
||||||
$this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'inetOrgPerson_employeeNumber', 'employeeNumber');
|
$this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'inetOrgPerson_employeeNumber', 'employeeNumber');
|
||||||
// employee type
|
// employee type
|
||||||
$this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'inetOrgPerson_type', 'employeeType',
|
$this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'inetOrgPerson_type', 'employeeType',
|
||||||
'employeeType', $this->messages['employeeType'][1], $errors);
|
'employeeType', $this->messages['employeeType'][1], $errors);
|
||||||
// business category
|
// business category
|
||||||
if (isset($ids['inetOrgPerson_businessCategory']) && ($rawAccounts[$i][$ids['inetOrgPerson_businessCategory']] != "")) {
|
$this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'inetOrgPerson_businessCategory', 'businessCategory', 'businessCategory', $this->messages['businessCategory'][1], $errors, '/;[ ]*/');
|
||||||
$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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// manager
|
// manager
|
||||||
if (isset($ids['inetOrgPerson_manager']) && ($rawAccounts[$i][$ids['inetOrgPerson_manager']] != "")) {
|
$this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'inetOrgPerson_manager', 'manager', 'dn', $this->messages['manager'][0], $errors, '/;[ ]*/');
|
||||||
$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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// street
|
// street
|
||||||
if (isset($ids['inetOrgPerson_street']) && ($rawAccounts[$i][$ids['inetOrgPerson_street']] != "")) {
|
$this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'inetOrgPerson_street', 'street', 'street', $this->messages['street'][1], $errors, '/;[ ]*/');
|
||||||
$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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// post office box
|
// post office box
|
||||||
if (isset($ids['inetOrgPerson_postOfficeBox']) && ($rawAccounts[$i][$ids['inetOrgPerson_postOfficeBox']] != "")) {
|
if (isset($ids['inetOrgPerson_postOfficeBox']) && ($rawAccounts[$i][$ids['inetOrgPerson_postOfficeBox']] != "")) {
|
||||||
$partialAccounts[$i]['postOfficeBox'] = preg_split('/;[ ]*/', $rawAccounts[$i][$ids['inetOrgPerson_postOfficeBox']]);
|
$partialAccounts[$i]['postOfficeBox'] = preg_split('/;[ ]*/', $rawAccounts[$i][$ids['inetOrgPerson_postOfficeBox']]);
|
||||||
|
@ -2302,18 +2258,7 @@ class inetOrgPerson extends baseModule implements passwordService {
|
||||||
// carLicense
|
// carLicense
|
||||||
$this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'inetOrgPerson_carLicense', 'carLicense');
|
$this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'inetOrgPerson_carLicense', 'carLicense');
|
||||||
// postal code
|
// postal code
|
||||||
if (isset($ids['inetOrgPerson_postalCode']) && ($rawAccounts[$i][$ids['inetOrgPerson_postalCode']] != "")) {
|
$this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'inetOrgPerson_postalCode', 'postalCode', 'postalCode', $this->messages['postalCode'][1], $errors, '/;[ ]*/');
|
||||||
$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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// postal address
|
// postal address
|
||||||
$this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'inetOrgPerson_address', 'postalAddress',
|
$this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'inetOrgPerson_address', 'postalAddress',
|
||||||
'postalAddress',$this->messages['postalAddress'][1] , $errors);
|
'postalAddress',$this->messages['postalAddress'][1] , $errors);
|
||||||
|
@ -2321,70 +2266,15 @@ class inetOrgPerson extends baseModule implements passwordService {
|
||||||
$this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'inetOrgPerson_registeredAddress', 'registeredAddress',
|
$this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'inetOrgPerson_registeredAddress', 'registeredAddress',
|
||||||
'postalAddress',$this->messages['registeredAddress'][1] , $errors);
|
'postalAddress',$this->messages['registeredAddress'][1] , $errors);
|
||||||
// telephone
|
// telephone
|
||||||
if (isset($ids['inetOrgPerson_telephone']) && ($rawAccounts[$i][$ids['inetOrgPerson_telephone']] != "")) {
|
$this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'inetOrgPerson_telephone', 'telephoneNumber', 'telephone', $this->messages['telephoneNumber'][1], $errors, '/;[ ]*/');
|
||||||
$telephoneList = preg_split('/;[ ]*/', trim($rawAccounts[$i][$ids['inetOrgPerson_telephone']]));
|
|
||||||
$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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// home telephone
|
// home telephone
|
||||||
if (isset($ids['inetOrgPerson_homePhone']) && ($rawAccounts[$i][$ids['inetOrgPerson_homePhone']] != "")) {
|
$this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'inetOrgPerson_homePhone', 'homePhone', 'telephone', $this->messages['homePhone'][1], $errors, '/;[ ]*/');
|
||||||
$homePhoneList = preg_split('/;[ ]*/', trim($rawAccounts[$i][$ids['inetOrgPerson_homePhone']]));
|
|
||||||
$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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// mobile
|
// mobile
|
||||||
if (isset($ids['inetOrgPerson_mobile']) && ($rawAccounts[$i][$ids['inetOrgPerson_mobile']] != "")) {
|
$this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'inetOrgPerson_mobile', 'mobile', 'telephone', $this->messages['mobileTelephone'][1], $errors, '/;[ ]*/');
|
||||||
$mobileList = preg_split('/;[ ]*/', trim($rawAccounts[$i][$ids['inetOrgPerson_mobile']]));
|
|
||||||
$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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// facsimile
|
// facsimile
|
||||||
if (isset($ids['inetOrgPerson_fax']) && ($rawAccounts[$i][$ids['inetOrgPerson_fax']] != "")) {
|
$this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'inetOrgPerson_fax', 'facsimileTelephoneNumber', 'telephone', $this->messages['facsimileNumber'][1], $errors, '/;[ ]*/');
|
||||||
$facsimileTelephoneNumberList = preg_split('/;[ ]*/', trim($rawAccounts[$i][$ids['inetOrgPerson_fax']]));
|
|
||||||
$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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// pager
|
// pager
|
||||||
if (isset($ids['inetOrgPerson_pager']) && ($rawAccounts[$i][$ids['inetOrgPerson_pager']] != "")) {
|
$this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'inetOrgPerson_pager', 'pager', 'telephone', $this->messages['pager'][1], $errors, '/;[ ]*/');
|
||||||
$pagerList = preg_split('/;[ ]*/', trim($rawAccounts[$i][$ids['inetOrgPerson_pager']]));
|
|
||||||
$partialAccounts[$i]['pager'] = $pagerList;
|
|
||||||
for ($x = 0; $x < sizeof($pagerList); $x++) {
|
|
||||||
if (!get_preg($pagerList[$x], 'telephone')) {
|
|
||||||
$errMsg = $this->messages['pager'][1];
|
|
||||||
array_push($errMsg, array($i));
|
|
||||||
$errors[] = $errMsg;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// eMail
|
// eMail
|
||||||
if (isset($ids['inetOrgPerson_email']) && ($rawAccounts[$i][$ids['inetOrgPerson_email']] != "")) {
|
if (isset($ids['inetOrgPerson_email']) && ($rawAccounts[$i][$ids['inetOrgPerson_email']] != "")) {
|
||||||
foreach ($replacements as $wildcard => $value) {
|
foreach ($replacements as $wildcard => $value) {
|
||||||
|
@ -2527,9 +2417,9 @@ class inetOrgPerson extends baseModule implements passwordService {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a list of self service configuration settings.
|
* Returns a list of self service configuration settings.
|
||||||
*
|
*
|
||||||
|
@ -2551,10 +2441,10 @@ class inetOrgPerson extends baseModule implements passwordService {
|
||||||
$container->addElement($photoTable, true);
|
$container->addElement($photoTable, true);
|
||||||
return $container;
|
return $container;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if the self service settings are valid.
|
* Checks if the self service settings are valid.
|
||||||
*
|
*
|
||||||
* If the input data is invalid the return value is an array that contains arrays
|
* If the input data is invalid the return value is an array that contains arrays
|
||||||
* to build StatusMessages (message type, message head, message text). If no errors
|
* to build StatusMessages (message type, message head, message text). If no errors
|
||||||
* occured the function returns an empty array.
|
* occured the function returns an empty array.
|
||||||
|
@ -2963,11 +2853,11 @@ class inetOrgPerson extends baseModule implements passwordService {
|
||||||
}
|
}
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the meta HTML code to display the certificate area.
|
* Returns the meta HTML code to display the certificate area.
|
||||||
* This also includes the file upload.
|
* This also includes the file upload.
|
||||||
*
|
*
|
||||||
* @return htmlTable certificate content
|
* @return htmlTable certificate content
|
||||||
*/
|
*/
|
||||||
private function getSelfServiceUserCertificates() {
|
private function getSelfServiceUserCertificates() {
|
||||||
|
@ -3012,10 +2902,10 @@ class inetOrgPerson extends baseModule implements passwordService {
|
||||||
}
|
}
|
||||||
return $content;
|
return $content;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the Java Script functions to manage the certificates.
|
* Returns the Java Script functions to manage the certificates.
|
||||||
*
|
*
|
||||||
* @return htmlJavaScript JS block
|
* @return htmlJavaScript JS block
|
||||||
*/
|
*/
|
||||||
private static function getSelfServiceUserCertificatesJSBlock() {
|
private static function getSelfServiceUserCertificatesJSBlock() {
|
||||||
|
@ -3029,7 +2919,7 @@ class inetOrgPerson extends baseModule implements passwordService {
|
||||||
. '&' . getSecurityTokenName() . '=' . getSecurityTokenValue()
|
. '&' . getSecurityTokenName() . '=' . getSecurityTokenValue()
|
||||||
. '\', {jsonInput: actionJSON}, function(data) {inetOrgPersonDeleteCertificateHandleReply(data);}, \'json\');
|
. '\', {jsonInput: actionJSON}, function(data) {inetOrgPersonDeleteCertificateHandleReply(data);}, \'json\');
|
||||||
}
|
}
|
||||||
|
|
||||||
function inetOrgPersonDeleteCertificateHandleReply(data) {
|
function inetOrgPersonDeleteCertificateHandleReply(data) {
|
||||||
if (data.errorsOccured == "false") {
|
if (data.errorsOccured == "false") {
|
||||||
jQuery(\'#userCertificateDiv\').html(data.html);
|
jQuery(\'#userCertificateDiv\').html(data.html);
|
||||||
|
@ -3038,7 +2928,7 @@ class inetOrgPerson extends baseModule implements passwordService {
|
||||||
alert(data.errormessage);
|
alert(data.errormessage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function inetOrgPersonUploadCert(elementID) {
|
function inetOrgPersonUploadCert(elementID) {
|
||||||
var uploadStatus = document.getElementById(\'inetOrgPerson_upload_status_cert\');
|
var uploadStatus = document.getElementById(\'inetOrgPerson_upload_status_cert\');
|
||||||
var uploader = new qq.FineUploader({
|
var uploader = new qq.FineUploader({
|
||||||
|
@ -3065,9 +2955,9 @@ class inetOrgPerson extends baseModule implements passwordService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
';
|
';
|
||||||
return new htmlJavaScript($content);
|
return new htmlJavaScript($content);
|
||||||
}
|
}
|
||||||
|
@ -3080,7 +2970,7 @@ class inetOrgPerson extends baseModule implements passwordService {
|
||||||
* <br>del: array of attributes to remove
|
* <br>del: array of attributes to remove
|
||||||
* <br>mod: array of attributes to modify
|
* <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)
|
* <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}.
|
* Calling this method does not require the existence of an enclosing {@link accountContainer}.
|
||||||
*
|
*
|
||||||
* @param string $fields input fields
|
* @param string $fields input fields
|
||||||
|
@ -3406,10 +3296,10 @@ class inetOrgPerson extends baseModule implements passwordService {
|
||||||
}
|
}
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resizes the given image data to the settings provided.
|
* Resizes the given image data to the settings provided.
|
||||||
*
|
*
|
||||||
* @param array $data binary image data
|
* @param array $data binary image data
|
||||||
* @param array $settings settings
|
* @param array $settings settings
|
||||||
* @return array binary image data
|
* @return array binary image data
|
||||||
|
@ -3431,7 +3321,7 @@ class inetOrgPerson extends baseModule implements passwordService {
|
||||||
}
|
}
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Manages AJAX requests.
|
* Manages AJAX requests.
|
||||||
* This function may be called with or without an account container.
|
* This function may be called with or without an account container.
|
||||||
|
@ -3451,7 +3341,7 @@ class inetOrgPerson extends baseModule implements passwordService {
|
||||||
}
|
}
|
||||||
echo json_encode($jsonReturn);
|
echo json_encode($jsonReturn);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles an AJAX file upload and prints the JSON result.
|
* Handles an AJAX file upload and prints the JSON result.
|
||||||
*/
|
*/
|
||||||
|
@ -3491,7 +3381,7 @@ class inetOrgPerson extends baseModule implements passwordService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Manages the deletion of a certificate.
|
* Manages the deletion of a certificate.
|
||||||
*
|
*
|
||||||
* @param array $data JSON data
|
* @param array $data JSON data
|
||||||
*/
|
*/
|
||||||
private function ajaxDeleteSelfServiceUserCertificate($data) {
|
private function ajaxDeleteSelfServiceUserCertificate($data) {
|
||||||
|
@ -3516,10 +3406,10 @@ class inetOrgPerson extends baseModule implements passwordService {
|
||||||
'html' => $content,
|
'html' => $content,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Invalid AJAX request received.
|
* Invalid AJAX request received.
|
||||||
*
|
*
|
||||||
* @param String $message error message
|
* @param String $message error message
|
||||||
*/
|
*/
|
||||||
public static function invalidAjaxRequest($message = null) {
|
public static function invalidAjaxRequest($message = null) {
|
||||||
|
@ -3545,13 +3435,13 @@ class inetOrgPerson extends baseModule implements passwordService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Specifies if this module supports to force that a user must change his password on next login.
|
* Specifies if this module supports to force that a user must change his password on next login.
|
||||||
*
|
*
|
||||||
* @return boolean force password change supported
|
* @return boolean force password change supported
|
||||||
*/
|
*/
|
||||||
public function supportsForcePasswordChange() {
|
public function supportsForcePasswordChange() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function is called whenever the password should be changed. Account modules
|
* 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.
|
* must change their password attributes only if the modules list contains their module name.
|
||||||
|
@ -3593,7 +3483,7 @@ class inetOrgPerson extends baseModule implements passwordService {
|
||||||
}
|
}
|
||||||
return array();
|
return array();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a list of possible managers.
|
* Returns a list of possible managers.
|
||||||
*
|
*
|
||||||
|
@ -3613,9 +3503,9 @@ class inetOrgPerson extends baseModule implements passwordService {
|
||||||
for ($i = 0; $i < sizeof($dnUsers); $i++) {
|
for ($i = 0; $i < sizeof($dnUsers); $i++) {
|
||||||
$this->cachedManagers[getAbstractDN($dnUsers[$i])] = $dnUsers[$i];
|
$this->cachedManagers[getAbstractDN($dnUsers[$i])] = $dnUsers[$i];
|
||||||
}
|
}
|
||||||
return $this->cachedManagers;
|
return $this->cachedManagers;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads cached data from LDAP such as departmets etc.
|
* Loads cached data from LDAP such as departmets etc.
|
||||||
*/
|
*/
|
||||||
|
@ -3690,10 +3580,10 @@ class inetOrgPerson extends baseModule implements passwordService {
|
||||||
$this->employeeTypeCache = array_values(array_unique($employeeTypes));
|
$this->employeeTypeCache = array_values(array_unique($employeeTypes));
|
||||||
$this->businessCategoryCache = array_values(array_unique($businessCategories));
|
$this->businessCategoryCache = array_values(array_unique($businessCategories));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns if the attribute is read-only in admin interface.
|
* Returns if the attribute is read-only in admin interface.
|
||||||
*
|
*
|
||||||
* @param String $attrName attribute name
|
* @param String $attrName attribute name
|
||||||
* @return boolean attribute is read-only
|
* @return boolean attribute is read-only
|
||||||
*/
|
*/
|
||||||
|
@ -3704,10 +3594,10 @@ class inetOrgPerson extends baseModule implements passwordService {
|
||||||
}
|
}
|
||||||
return $this->isBooleanConfigOptionSet('inetOrgPerson_readOnly_' . $attrName);
|
return $this->isBooleanConfigOptionSet('inetOrgPerson_readOnly_' . $attrName);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a simple read-only field to the given container.
|
* Adds a simple read-only field to the given container.
|
||||||
*
|
*
|
||||||
* @param htmlTable $container parent container
|
* @param htmlTable $container parent container
|
||||||
* @param String $attrName attribute name
|
* @param String $attrName attribute name
|
||||||
* @param String $label field label
|
* @param String $label field label
|
||||||
|
@ -3726,10 +3616,10 @@ class inetOrgPerson extends baseModule implements passwordService {
|
||||||
$container->addElement($labelBox);
|
$container->addElement($labelBox);
|
||||||
$container->addElement(new htmlOutputText($val, false), true);
|
$container->addElement(new htmlOutputText($val, false), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a list of configuration options.
|
* Returns a list of configuration options.
|
||||||
*
|
*
|
||||||
* Calling this method does not require the existence of an enclosing {@link accountContainer}.<br>
|
* Calling this method does not require the existence of an enclosing {@link accountContainer}.<br>
|
||||||
* <br>
|
* <br>
|
||||||
* The field names are used as keywords to load and save settings.
|
* The field names are used as keywords to load and save settings.
|
||||||
|
@ -3738,7 +3628,7 @@ class inetOrgPerson extends baseModule implements passwordService {
|
||||||
* @param array $scopes account types (user, group, host)
|
* @param array $scopes account types (user, group, host)
|
||||||
* @param array $allScopes list of all active account modules and their scopes (module => array(scopes))
|
* @param array $allScopes list of all active account modules and their scopes (module => array(scopes))
|
||||||
* @return mixed htmlElement or array of htmlElement
|
* @return mixed htmlElement or array of htmlElement
|
||||||
*
|
*
|
||||||
* @see htmlElement
|
* @see htmlElement
|
||||||
*/
|
*/
|
||||||
public function get_configOptions($scopes, $allScopes) {
|
public function get_configOptions($scopes, $allScopes) {
|
||||||
|
@ -3890,7 +3780,7 @@ class inetOrgPerson extends baseModule implements passwordService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if the given email address already exists in LDAP.
|
* Checks if the given email address already exists in LDAP.
|
||||||
*
|
*
|
||||||
* @param String $mail email address
|
* @param String $mail email address
|
||||||
* @return boolean true if already exists
|
* @return boolean true if already exists
|
||||||
*/
|
*/
|
||||||
|
@ -3905,10 +3795,10 @@ class inetOrgPerson extends baseModule implements passwordService {
|
||||||
$this->emailCheckCache[$mail] = (sizeof($result) > 0);
|
$this->emailCheckCache[$mail] = (sizeof($result) > 0);
|
||||||
return $this->emailCheckCache[$mail];
|
return $this->emailCheckCache[$mail];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns if the Unix module is also active.
|
* Returns if the Unix module is also active.
|
||||||
*
|
*
|
||||||
* @return boolean Unix is active
|
* @return boolean Unix is active
|
||||||
*/
|
*/
|
||||||
private function isUnixActive() {
|
private function isUnixActive() {
|
||||||
|
@ -3918,7 +3808,7 @@ class inetOrgPerson extends baseModule implements passwordService {
|
||||||
$modules = $_SESSION['config']->get_AccountModules($this->get_scope());
|
$modules = $_SESSION['config']->get_AccountModules($this->get_scope());
|
||||||
return in_array('posixAccount', $modules);
|
return in_array('posixAccount', $modules);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
Loading…
Reference in New Issue