*** empty log message ***

This commit is contained in:
Roland Gruber 2009-10-03 17:29:10 +00:00
parent 44a8e8f082
commit 7487459885
1 changed files with 278 additions and 199 deletions

View File

@ -774,27 +774,77 @@ class inetOrgPerson extends baseModule {
$this->attributes['objectClass'][] = 'person';
}
}
// Load attributes
// Load and check attributes
if (!$this->configOptionSet('inetOrgPerson_hideDescription')) {
$this->attributes['description'][0] = $_POST['description'];
}
$this->attributes['sn'][0] = $_POST['sn'];
if ( !get_preg($this->attributes['sn'][0], 'realname')) $errors[] = $this->messages['lastname'][0];
$this->attributes['givenName'][0] = $_POST['givenName'];
if (($this->attributes['givenName'][0] != '') && !get_preg($this->attributes['givenName'][0], 'realname')) $errors[] = $this->messages['givenName'][0];
if (!$this->configOptionSet('inetOrgPerson_hideJobTitle')) {
$this->attributes['title'][0] = $_POST['title'];
if ( !get_preg($this->attributes['title'][0], 'title')) $errors[] = $this->messages['title'][0];
}
if (!$this->configOptionSet('inetOrgPerson_hideEMailAddress')) {
$this->attributes['mail'][0] = $_POST['mail'];
if (($this->attributes['mail'][0] != '') && !get_preg($this->attributes['mail'][0], 'email')) $errors[] = $this->messages['email'][0];
}
if (!$this->configOptionSet('inetOrgPerson_hideTelephoneNumber')) {
$this->attributes['telephoneNumber'][0] = $_POST['telephoneNumber'];
if ( !get_preg($this->attributes['telephoneNumber'][0], 'telephone')) $errors[] = $this->messages['telephoneNumber'][0];
}
if (!$this->configOptionSet('inetOrgPerson_hideMobileNumber')) {
$this->attributes['mobile'][0] = $_POST['mobileTelephoneNumber'];
if ( !get_preg($this->attributes['mobile'][0], 'telephone')) $errors[] = $this->messages['mobileTelephone'][0];
}
if (!$this->configOptionSet('inetOrgPerson_hideFaxNumber')) {
$this->attributes['facsimileTelephoneNumber'][0] = $_POST['facsimileTelephoneNumber'];
if ( !get_preg($this->attributes['facsimileTelephoneNumber'][0], 'telephone')) $errors[] = $this->messages['facsimileNumber'][0];
}
if (!$this->configOptionSet('inetOrgPerson_hideStreet')) {
$this->attributes['street'][0] = $_POST['street'];
if ( !get_preg($this->attributes['street'][0], 'street')) $errors[] = $this->messages['street'][0];
}
if (!$this->configOptionSet('inetOrgPerson_hidePostOfficeBox')) {
$this->attributes['postOfficeBox'][0] = $_POST['postOfficeBox'];
}
if (!$this->configOptionSet('inetOrgPerson_hidePostalCode')) {
$this->attributes['postalCode'][0] = $_POST['postalCode'];
if ( !get_preg($this->attributes['postalCode'][0], 'postalCode')) $errors[] = $this->messages['postalCode'][0];
}
if (!$this->configOptionSet('inetOrgPerson_hidePostalAddress')) {
$this->attributes['postalAddress'][0] = $_POST['postalAddress'];
if ( !get_preg($this->attributes['postalAddress'][0], 'postalAddress')) $errors[] = $this->messages['postalAddress'][0];
}
if (!$this->configOptionSet('inetOrgPerson_hideEmployeeType')) {
$this->attributes['employeeType'][0] = $_POST['employeeType'];
if ( !get_preg($this->attributes['employeeType'][0], 'employeeType')) $errors[] = $this->messages['employeeType'][0];
}
if (!$this->configOptionSet('inetOrgPerson_hideHomeTelephoneNumber')) {
$this->attributes['homePhone'][0] = $_POST['homePhone'];
if ( !get_preg($this->attributes['homePhone'][0], 'telephone')) $errors[] = $this->messages['homePhone'][0];
}
if (!$this->configOptionSet('inetOrgPerson_hideRoomNumber')) {
$this->attributes['roomNumber'][0] = $_POST['roomNumber'];
}
if (!$this->configOptionSet('inetOrgPerson_hideBusinessCategory')) {
$this->attributes['businessCategory'][0] = $_POST['businessCategory'];
if ( !get_preg($this->attributes['businessCategory'][0], 'businessCategory')) $errors[] = $this->messages['businessCategory'][0];
}
if (!$this->configOptionSet('inetOrgPerson_hideLocation')) {
$this->attributes['l'][0] = $_POST['l'];
}
if (!$this->configOptionSet('inetOrgPerson_hideState')) {
$this->attributes['st'][0] = $_POST['st'];
}
if (!$this->configOptionSet('inetOrgPerson_hideCarLicense')) {
$this->attributes['carLicense'][0] = $_POST['carLicense'];
}
if (!$this->configOptionSet('inetOrgPerson_hideOfficeName')) {
$this->attributes['physicalDeliveryOfficeName'][0] = $_POST['physicalDeliveryOfficeName'];
}
if (!$this->configOptionSet('inetOrgPerson_hideDepartments')) {
if (isset($_POST['departmentNumber'])) {
$this->attributes['departmentNumber'] = explode(';', $_POST['departmentNumber']);
// remove extra spaces
@ -805,12 +855,15 @@ class inetOrgPerson extends baseModule {
unset($this->attributes['departmentNumber']);
}
}
}
if (!$this->configOptionSet('inetOrgPerson_hideManager')) {
if ($_POST['manager'] != '-') {
$this->attributes['manager'][0] = $_POST['manager'];
}
else {
unset($this->attributes['manager'][0]);
}
}
$modules = $_SESSION['config']->get_AccountModules($this->get_scope());
if (!in_array('posixAccount', $modules)) {
@ -854,20 +907,7 @@ class inetOrgPerson extends baseModule {
}
}
}
// Do some regex-checks and return error if attributes are set to wrong values
if (($this->attributes['givenName'][0] != '') && !get_preg($this->attributes['givenName'][0], 'realname')) $errors[] = $this->messages['givenName'][0];
if ( !get_preg($this->attributes['sn'][0], 'realname')) $errors[] = $this->messages['lastname'][0];
if ( !get_preg($this->attributes['telephoneNumber'][0], 'telephone')) $errors[] = $this->messages['telephoneNumber'][0];
if ( !get_preg($this->attributes['homePhone'][0], 'telephone')) $errors[] = $this->messages['homePhone'][0];
if ( !get_preg($this->attributes['mobile'][0], 'telephone')) $errors[] = $this->messages['mobileTelephone'][0];
if ( !get_preg($this->attributes['facsimileTelephoneNumber'][0], 'telephone')) $errors[] = $this->messages['facsimileNumber'][0];
if (($this->attributes['mail'][0] != '') && !get_preg($this->attributes['mail'][0], 'email')) $errors[] = $this->messages['email'][0];
if ( !get_preg($this->attributes['street'][0], 'street')) $errors[] = $this->messages['street'][0];
if ( !get_preg($this->attributes['postalAddress'][0], 'postalAddress')) $errors[] = $this->messages['postalAddress'][0];
if ( !get_preg($this->attributes['postalCode'][0], 'postalCode')) $errors[] = $this->messages['postalCode'][0];
if ( !get_preg($this->attributes['title'][0], 'title')) $errors[] = $this->messages['title'][0];
if ( !get_preg($this->attributes['employeeType'][0], 'employeeType')) $errors[] = $this->messages['employeeType'][0];
if ( !get_preg($this->attributes['businessCategory'][0], 'businessCategory')) $errors[] = $this->messages['businessCategory'][0];
// check password
if (isset($_POST['userPassword']) && ($_POST['userPassword'] != '')) {
if ($_POST['userPassword'] != $_POST['userPassword2']) {
$errors[] = $this->messages['userPassword'][0];
@ -932,6 +972,7 @@ class inetOrgPerson extends baseModule {
'maxlength' => '255', 'value' => $cn),
array('kind' => 'help', 'value' => 'cn'));
}
if (!$this->configOptionSet('inetOrgPerson_hideDescription')) {
$description = '';
if (isset($this->attributes['description'][0])) $description = $this->attributes['description'][0];
$return[] = array (
@ -940,8 +981,8 @@ class inetOrgPerson extends baseModule {
'maxlength' => '255', 'value' => $description),
array('kind' => 'help', 'value' => 'description'));
}
$return[] = array(array('kind' => 'text', 'td' => array('colspan' => 3)));
// password
if (!in_array('posixAccount', $modules)) {
// new account, show input fields
@ -965,6 +1006,7 @@ class inetOrgPerson extends baseModule {
$return[] = array(array('kind' => 'text', 'td' => array('colspan' => 3)));
}
if (!$this->configOptionSet('inetOrgPerson_hideStreet')) {
$street = '';
if (isset($this->attributes['street'][0])) $street = $this->attributes['street'][0];
$return[] = array(
@ -972,6 +1014,8 @@ class inetOrgPerson extends baseModule {
array('kind' => 'input', 'name' => 'street', 'type' => 'text', 'size' => '30',
'maxlength' => '255', 'value' => $street),
array('kind' => 'help', 'value' => 'street'));
}
if (!$this->configOptionSet('inetOrgPerson_hidePostOfficeBox')) {
$postOffice = '';
if (isset($this->attributes['postOfficeBox'][0])) $postOffice = $this->attributes['postOfficeBox'][0];
$return[] = array(
@ -979,6 +1023,8 @@ class inetOrgPerson extends baseModule {
array('kind' => 'input', 'name' => 'postOfficeBox', 'type' => 'text', 'size' => '30',
'maxlength' => '255', 'value' => $postOffice),
array('kind' => 'help', 'value' => 'postOfficeBox'));
}
if (!$this->configOptionSet('inetOrgPerson_hidePostalCode')) {
$postalCode = '';
if (isset($this->attributes['postalCode'][0])) $postalCode = $this->attributes['postalCode'][0];
$return[] = array(
@ -986,6 +1032,8 @@ class inetOrgPerson extends baseModule {
array('kind' => 'input', 'name' => 'postalCode', 'type' => 'text', 'size' => '30',
'maxlength' => '255', 'value' => $postalCode),
array('kind' => 'help', 'value' => 'postalCode'));
}
if (!$this->configOptionSet('inetOrgPerson_hideLocation')) {
$l = '';
if (isset($this->attributes['l'][0])) $l = $this->attributes['l'][0];
$return[] = array(
@ -993,6 +1041,8 @@ class inetOrgPerson extends baseModule {
array('kind' => 'input', 'name' => 'l', 'type' => 'text', 'size' => '30',
'maxlength' => '255', 'value' => $l),
array('kind' => 'help', 'value' => 'l'));
}
if (!$this->configOptionSet('inetOrgPerson_hideState')) {
$st = '';
if (isset($this->attributes['st'][0])) $st = $this->attributes['st'][0];
$return[] = array(
@ -1000,6 +1050,8 @@ class inetOrgPerson extends baseModule {
array('kind' => 'input', 'name' => 'st', 'type' => 'text', 'size' => '30',
'maxlength' => '255', 'value' => $st),
array('kind' => 'help', 'value' => 'st'));
}
if (!$this->configOptionSet('inetOrgPerson_hidePostalAddress')) {
$postalAddress = '';
if (isset($this->attributes['postalAddress'][0])) $postalAddress = $this->attributes['postalAddress'][0];
$return[] = array(
@ -1007,6 +1059,8 @@ class inetOrgPerson extends baseModule {
array('kind' => 'input', 'name' => 'postalAddress', 'type' => 'text', 'size' => '30',
'maxlength' => '255', 'value' => $postalAddress),
array('kind' => 'help', 'value' => 'postalAddress'));
}
if (!$this->configOptionSet('inetOrgPerson_hideOfficeName')) {
$physicalDeliveryOfficeName = '';
if (isset($this->attributes['physicalDeliveryOfficeName'][0])) $physicalDeliveryOfficeName = $this->attributes['physicalDeliveryOfficeName'][0];
$return[] = array(
@ -1014,6 +1068,8 @@ class inetOrgPerson extends baseModule {
array('kind' => 'input', 'name' => 'physicalDeliveryOfficeName', 'type' => 'text', 'size' => '30',
'maxlength' => '255', 'value' => $physicalDeliveryOfficeName),
array('kind' => 'help', 'value' => 'physicalDeliveryOfficeName'));
}
if (!$this->configOptionSet('inetOrgPerson_hideRoomNumber')) {
$roomNumber = '';
if (isset($this->attributes['roomNumber'][0])) $roomNumber = $this->attributes['roomNumber'][0];
$return[] = array(
@ -1021,9 +1077,11 @@ class inetOrgPerson extends baseModule {
array('kind' => 'input', 'name' => 'roomNumber', 'type' => 'text', 'size' => '30',
'maxlength' => '255', 'value' => $roomNumber),
array('kind' => 'help', 'value' => 'roomNumber'));
}
$return[] = array(array('kind' => 'text', 'td' => array('colspan' => 3)));
if (!$this->configOptionSet('inetOrgPerson_hideTelephoneNumber')) {
$telephone = '';
if (isset($this->attributes['telephoneNumber'][0])) $telephone = $this->attributes['telephoneNumber'][0];
$return[] = array(
@ -1031,6 +1089,8 @@ class inetOrgPerson extends baseModule {
array('kind' => 'input', 'name' => 'telephoneNumber', 'type' => 'text', 'size' => '30',
'maxlength' => '255', 'value' => $telephone),
array('kind' => 'help', 'value' => 'telephoneNumber'));
}
if (!$this->configOptionSet('inetOrgPerson_hideHomeTelephoneNumber')) {
$homePhone = '';
if (isset($this->attributes['homePhone'][0])) $homePhone = $this->attributes['homePhone'][0];
$return[] = array(
@ -1038,6 +1098,8 @@ class inetOrgPerson extends baseModule {
array('kind' => 'input', 'name' => 'homePhone', 'type' => 'text', 'size' => '30',
'maxlength' => '255', 'value' => $homePhone),
array('kind' => 'help', 'value' => 'homePhone'));
}
if (!$this->configOptionSet('inetOrgPerson_hideMobileNumber')) {
$mobile = '';
if (isset($this->attributes['mobile'][0])) $mobile = $this->attributes['mobile'][0];
$return[] = array(
@ -1045,6 +1107,8 @@ class inetOrgPerson extends baseModule {
array('kind' => 'input', 'name' => 'mobileTelephoneNumber', 'type' => 'text', 'size' => '30',
'maxlength' => '255', 'value' => $mobile),
array('kind' => 'help', 'value' => 'mobileTelephoneNumber'));
}
if (!$this->configOptionSet('inetOrgPerson_hideFaxNumber')) {
$fax = '';
if (isset($this->attributes['facsimileTelephoneNumber'][0])) $fax = $this->attributes['facsimileTelephoneNumber'][0];
$return[] = array(
@ -1052,6 +1116,8 @@ class inetOrgPerson extends baseModule {
array('kind' => 'input', 'name' => 'facsimileTelephoneNumber', 'type' => 'text', 'size' => '30',
'maxlength' => '255', 'value' => $fax),
array('kind' => 'help', 'value' => 'facsimileTelephoneNumber'));
}
if (!$this->configOptionSet('inetOrgPerson_hideEMailAddress')) {
$email = '';
if (isset($this->attributes['mail'][0])) $email = $this->attributes['mail'][0];
$return[] = array(
@ -1059,9 +1125,11 @@ class inetOrgPerson extends baseModule {
array('kind' => 'input', 'name' => 'mail', 'type' => 'text', 'size' => '30',
'maxlength' => '255', 'value' => $email),
array('kind' => 'help', 'value' => 'mail'));
}
$return[] = array(array('kind' => 'text', 'td' => array('colspan' => 3)));
if (!$this->configOptionSet('inetOrgPerson_hideJobTitle')) {
$title = '';
if (isset($this->attributes['title'][0])) $title = $this->attributes['title'][0];
$return[] = array(
@ -1069,6 +1137,8 @@ class inetOrgPerson extends baseModule {
array('kind' => 'input', 'name' => 'title', 'type' => 'text', 'size' => '30',
'value' => $title),
array('kind' => 'help', 'value' => 'title'));
}
if (!$this->configOptionSet('inetOrgPerson_hideCarLicense')) {
$carLicense = '';
if (isset($this->attributes['carLicense'][0])) $carLicense = $this->attributes['carLicense'][0];
$return[] = array(
@ -1076,6 +1146,8 @@ class inetOrgPerson extends baseModule {
array('kind' => 'input', 'name' => 'carLicense', 'type' => 'text', 'size' => '30',
'value' => $carLicense),
array('kind' => 'help', 'value' => 'carLicense'));
}
if (!$this->configOptionSet('inetOrgPerson_hideEmployeeType')) {
$employeeType = '';
if (isset($this->attributes['employeeType'][0])) $employeeType = $this->attributes['employeeType'][0];
$return[] = array(
@ -1083,6 +1155,8 @@ class inetOrgPerson extends baseModule {
array('kind' => 'input', 'name' => 'employeeType', 'type' => 'text', 'size' => '30',
'maxlength' => '255', 'value' => $employeeType),
array('kind' => 'help', 'value' => 'employeeType'));
}
if (!$this->configOptionSet('inetOrgPerson_hideBusinessCategory')) {
$businessCategory = '';
if (isset($this->attributes['businessCategory'][0])) $businessCategory = $this->attributes['businessCategory'][0];
$return[] = array(
@ -1090,6 +1164,8 @@ class inetOrgPerson extends baseModule {
array('kind' => 'input', 'name' => 'businessCategory', 'type' => 'text', 'size' => '30',
'maxlength' => '255', 'value' => $businessCategory),
array('kind' => 'help', 'value' => 'businessCategory'));
}
if (!$this->configOptionSet('inetOrgPerson_hideDepartments')) {
$departmentNumber = '';
if (isset($this->attributes['departmentNumber'][0])) $departmentNumber = implode(';', $this->attributes['departmentNumber']);
$return[] = array(
@ -1097,6 +1173,7 @@ class inetOrgPerson extends baseModule {
array('kind' => 'input', 'name' => 'departmentNumber', 'type' => 'text', 'size' => '30',
'maxlength' => '255', 'value' => $departmentNumber),
array('kind' => 'help', 'value' => 'departmentNumber'));
}
if ($this->supportUnixHosts()) {
$hostvalue = "";
if (isset($this->attributes['host']) && is_array($this->attributes['host'])) {
@ -1108,6 +1185,7 @@ class inetOrgPerson extends baseModule {
'maxlength' => '255', 'value' => $hostvalue ),
array('kind' => 'help', 'value' => 'workstations'));
}
if (!$this->configOptionSet('inetOrgPerson_hideManager')) {
// get list of existing users for manager attribute
$dnUsers = $_SESSION['cache']->get_cache('uid', 'inetOrgPerson', 'user');
if (!is_array($dnUsers)) $dnUsers = array();
@ -1126,6 +1204,7 @@ class inetOrgPerson extends baseModule {
array('kind' => 'select', 'name' => 'manager', 'size' => '1',
'options' => $dnUsers, 'options_selected' => $optionsSelected),
array('kind' => 'help', 'value' => 'manager'));
}
// photo
$photoFile = '../../graphics/userDefault.png';
$noPhoto = true;