From d8806f3cae4e64729e16fd7d146407603a76b3e6 Mon Sep 17 00:00:00 2001 From: Roland Gruber Date: Sun, 9 Jan 2011 16:20:21 +0000 Subject: [PATCH] fixed PHP notices --- lam/lib/modules/hostObject.inc | 2 +- lam/lib/modules/inetLocalMailRecipient.inc | 4 +- lam/lib/modules/inetOrgPerson.inc | 112 +++++++++++++++++---- lam/lib/modules/kolabUser.inc | 16 +-- lam/lib/modules/shadowAccount.inc | 36 +++++-- 5 files changed, 133 insertions(+), 37 deletions(-) diff --git a/lam/lib/modules/hostObject.inc b/lam/lib/modules/hostObject.inc index a7ce7ea6..7d84999c 100644 --- a/lam/lib/modules/hostObject.inc +++ b/lam/lib/modules/hostObject.inc @@ -251,7 +251,7 @@ class hostObject extends baseModule { */ function get_pdfEntries() { $return = array(); - if (sizeof($this->attributes['host']) > 0) { + if (isset($this->attributes['host'][0])) { $return['hostObject_hosts'][0] = '' . _('Host list') . '' . implode(', ', $this->attributes['host']) . ''; } return $return; diff --git a/lam/lib/modules/inetLocalMailRecipient.inc b/lam/lib/modules/inetLocalMailRecipient.inc index c30ae225..e3e70915 100644 --- a/lam/lib/modules/inetLocalMailRecipient.inc +++ b/lam/lib/modules/inetLocalMailRecipient.inc @@ -3,7 +3,7 @@ $Id$ This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/) - Copyright (C) 2004 - 2010 Roland Gruber + Copyright (C) 2004 - 2011 Roland Gruber 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 @@ -299,7 +299,7 @@ class inetLocalMailRecipient extends baseModule { if (isset($this->attributes['mailRoutingAddress'][0])) { $return['inetLocalMailRecipient_routingAdr'][0] = '' . _('Routing address') . '' . $this->attributes['mailRoutingAddress'][0] . ''; } - if (sizeof($this->attributes['mailLocalAddress']) > 0) { + if (isset($this->attributes['mailLocalAddress'][0])) { $return['inetLocalMailRecipient_localAdr'][0] = '' . _('Local address list') . '' . implode(', ', $this->attributes['mailLocalAddress']) . ''; } if (isset($this->attributes['mailHost'][0])) { diff --git a/lam/lib/modules/inetOrgPerson.inc b/lam/lib/modules/inetOrgPerson.inc index 1719823a..5c036761 100644 --- a/lam/lib/modules/inetOrgPerson.inc +++ b/lam/lib/modules/inetOrgPerson.inc @@ -4,7 +4,7 @@ $Id$ This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/) Copyright (C) 2003 - 2006 Tilo Lutz - 2005 - 2010 Roland Gruber + 2005 - 2011 Roland Gruber 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 @@ -446,7 +446,7 @@ class inetOrgPerson extends baseModule implements passwordService { $return['PDF_fields']['mobileTelephoneNumber'] = _('Mobile number'); } if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideFaxNumber')) { - $return['PDF_fields']['facimilieTelephoneNumber'] = _('Fax number'); + $return['PDF_fields']['facsimileTelephoneNumber'] = _('Fax number'); } if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideEMailAddress')) { $return['PDF_fields']['mail'] = _('Email address'); @@ -1019,6 +1019,78 @@ class inetOrgPerson extends baseModule implements passwordService { if (isset($this->attributes['title'][0])) $title = $this->attributes['title'][0]; $givenName = ''; if (isset($this->attributes['givenName'][0])) $givenName = $this->attributes['givenName'][0]; + $lastName = ''; + if (isset($this->attributes['sn'][0])) { + $lastName = $this->attributes['sn'][0]; + } + $manager = ''; + if (isset($this->attributes['manager'][0])) { + $manager = $this->attributes['manager'][0]; + } + $street = ''; + if (isset($this->attributes['street'][0])) { + $street = $this->attributes['street'][0]; + } + $postOfficeBox = ''; + if (isset($this->attributes['postOfficeBox'][0])) { + $postOfficeBox = $this->attributes['postOfficeBox'][0]; + } + $postalCode = ''; + if (isset($this->attributes['postalCode'][0])) { + $postalCode = $this->attributes['postalCode'][0]; + } + $postalAddress = ''; + if (isset($this->attributes['postalAddress'][0])) { + $postalAddress = $this->attributes['postalAddress'][0]; + } + $telephoneNumber = ''; + if (isset($this->attributes['telephoneNumber'][0])) { + $telephoneNumber = $this->attributes['telephoneNumber'][0]; + } + $homePhone = ''; + if (isset($this->attributes['homePhone'][0])) { + $homePhone = $this->attributes['homePhone'][0]; + } + $mobile = ''; + if (isset($this->attributes['mobile'][0])) { + $mobile = $this->attributes['mobile'][0]; + } + $mail = ''; + if (isset($this->attributes['mail'][0])) { + $mail = $this->attributes['mail'][0]; + } + $cn = ''; + if (isset($this->attributes['cn'][0])) { + $cn = $this->attributes['cn'][0]; + } + $roomNumber = ''; + if (isset($this->attributes['roomNumber'][0])) { + $roomNumber = $this->attributes['roomNumber'][0]; + } + $facsimileTelephoneNumber = ''; + if (isset($this->attributes['facsimileTelephoneNumber'][0])) { + $facsimileTelephoneNumber = $this->attributes['facsimileTelephoneNumber'][0]; + } + $businessCategory = ''; + if (isset($this->attributes['businessCategory'][0])) { + $businessCategory = $this->attributes['businessCategory'][0]; + } + $uid = ''; + if (isset($this->attributes['uid'][0])) { + $uid = $this->attributes['uid'][0]; + } + $carLicense = ''; + if (isset($this->attributes['carLicense'][0])) { + $carLicense = $this->attributes['carLicense'][0]; + } + $st = ''; + if (isset($this->attributes['st'][0])) { + $st = $this->attributes['st'][0]; + } + $physicalDeliveryOfficeName = ''; + if (isset($this->attributes['physicalDeliveryOfficeName'][0])) { + $physicalDeliveryOfficeName = $this->attributes['physicalDeliveryOfficeName'][0]; + } $employeeType = ''; if (isset($this->attributes['employeeType'][0])) $employeeType = $this->attributes['employeeType'][0]; $l = ''; @@ -1028,26 +1100,26 @@ class inetOrgPerson extends baseModule implements passwordService { get_class($this) . '_description' => array('' . _('Description') . '' . $description . ''), get_class($this) . '_title' => array('' . _('Job title') . '' . $title . ''), get_class($this) . '_givenName' => array('' . _('First name') . '' . $givenName . ''), - get_class($this) . '_sn' => array('' . _('Last name') . '' . $this->attributes['sn'][0] . ''), + get_class($this) . '_sn' => array('' . _('Last name') . '' . $lastName . ''), get_class($this) . '_employeeType' => array('' . _('Employee type') . '' . $employeeType . ''), - get_class($this) . '_manager' => array('' . _('Manager') . '' . $this->attributes['manager'][0] . ''), - get_class($this) . '_street' => array('' . _('Street') . '' . $this->attributes['street'][0] . ''), - get_class($this) . '_postOfficeBox' => array('' . _('Post office box') . '' . $this->attributes['postOfficeBox'][0] . ''), - get_class($this) . '_postalCode' => array('' . _('Postal code') . '' . $this->attributes['postalCode'][0] . ''), - get_class($this) . '_postalAddress' => array('' . _('Postal address') . '' . $this->attributes['postalAddress'][0] . ''), - get_class($this) . '_telephoneNumber' => array('' . _('Telephone number') . '' . $this->attributes['telephoneNumber'][0] . ''), - get_class($this) . '_homePhone' => array('' . _('Home telephone number') . '' . $this->attributes['homePhone'][0] . ''), - get_class($this) . '_mobileTelephoneNumber' => array('' . _('Mobile number') . '' . $this->attributes['mobile'][0] . ''), - get_class($this) . '_facimileTelephoneNumber' => array('' . _('Fax number') . '' . $this->attributes['facsimileTelephoneNumber'][0] . ''), - get_class($this) . '_mail' => array('' . _('Email address') . '' . $this->attributes['mail'][0] . ''), - get_class($this) . '_cn' => array('' . _('Common name') . '' . $this->attributes['cn'][0] . ''), - get_class($this) . '_roomNumber' => array('' . _('Room number') . '' . $this->attributes['roomNumber'][0] . ''), - get_class($this) . '_businessCategory' => array('' . _('Business category') . '' . $this->attributes['businessCategory'][0] . ''), - get_class($this) . '_uid' => array('' . _('User name') . '' . $this->attributes['uid'][0] . ''), - get_class($this) . '_carLicense' => array('' . _('Car license') . '' . $this->attributes['carLicense'][0] . ''), + get_class($this) . '_manager' => array('' . _('Manager') . '' . $manager . ''), + get_class($this) . '_street' => array('' . _('Street') . '' . $street . ''), + get_class($this) . '_postOfficeBox' => array('' . _('Post office box') . '' . $postOfficeBox . ''), + get_class($this) . '_postalCode' => array('' . _('Postal code') . '' . $postalCode . ''), + get_class($this) . '_postalAddress' => array('' . _('Postal address') . '' . $postalAddress . ''), + get_class($this) . '_telephoneNumber' => array('' . _('Telephone number') . '' . $telephoneNumber . ''), + get_class($this) . '_homePhone' => array('' . _('Home telephone number') . '' . $homePhone . ''), + get_class($this) . '_mobileTelephoneNumber' => array('' . _('Mobile number') . '' . $mobile . ''), + get_class($this) . '_facsimileTelephoneNumber' => array('' . _('Fax number') . '' . $facsimileTelephoneNumber . ''), + get_class($this) . '_mail' => array('' . _('Email address') . '' . $mail . ''), + get_class($this) . '_cn' => array('' . _('Common name') . '' . $cn . ''), + get_class($this) . '_roomNumber' => array('' . _('Room number') . '' . $roomNumber . ''), + get_class($this) . '_businessCategory' => array('' . _('Business category') . '' . $businessCategory . ''), + get_class($this) . '_uid' => array('' . _('User name') . '' . $uid . ''), + get_class($this) . '_carLicense' => array('' . _('Car license') . '' . $carLicense . ''), get_class($this) . '_location' => array('' . _('Location') . '' . $l . ''), - get_class($this) . '_state' => array('' . _('State') . '' . $this->attributes['st'][0] . ''), - get_class($this) . '_officeName' => array('' . _('Office name') . '' . $this->attributes['physicalDeliveryOfficeName'][0] . '') + get_class($this) . '_state' => array('' . _('State') . '' . $st . ''), + get_class($this) . '_officeName' => array('' . _('Office name') . '' . $physicalDeliveryOfficeName . '') ); if (isset($this->attributes['departmentNumber'])) { $return[get_class($this) . '_departmentNumber'] = array('' . _('Department(s)') . '' . implode(', ', $this->attributes['departmentNumber']) . ''); diff --git a/lam/lib/modules/kolabUser.inc b/lam/lib/modules/kolabUser.inc index 6ed3f0e5..c878476e 100644 --- a/lam/lib/modules/kolabUser.inc +++ b/lam/lib/modules/kolabUser.inc @@ -3,7 +3,7 @@ $Id$ This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/) - Copyright (C) 2004 - 2010 Roland Gruber + Copyright (C) 2004 - 2011 Roland Gruber 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 @@ -762,23 +762,23 @@ class kolabUser extends baseModule { function get_pdfEntries() { $return = array(); // country - if (sizeof($this->attributes['c']) > 0) { + if (isset($this->attributes['c'][0])) { $return['kolabUser_country'][0] = '' . _('Country') . '' . $this->attributes['c'][0] . ''; } // mail server - if (sizeof($this->attributes['kolabHomeServer']) > 0) { + if (isset($this->attributes['kolabHomeServer'][0])) { $return['kolabUser_homeServer'][0] = '' . _('Mailbox home server') . '' . $this->attributes['kolabHomeServer'][0] . ''; } // mail quota - if (sizeof($this->attributes['cyrus-userquota']) > 0) { + if (isset($this->attributes['cyrus-userquota'][0])) { $return['kolabUser_quota'][0] = '' . _('Mail quota') . '' . $this->attributes['cyrus-userquota'][0] . ''; } // free/busy - if (sizeof($this->attributes['kolabFreeBusyFuture']) > 0) { + if (isset($this->attributes['kolabFreeBusyFuture'][0])) { $return['kolabUser_freeBusy'][0] = '' . _('Free/Busy interval') . '' . $this->attributes['kolabFreeBusyFuture'][0] . ''; } // invitation policies - if (sizeof($this->attributes['kolabInvitationPolicy']) > 0) { + if (isset($this->attributes['kolabInvitationPolicy'][0])) { // find default policy $default = ""; for ($i = 0; $i < sizeof($this->attributes['kolabInvitationPolicy']); $i++) { @@ -796,11 +796,11 @@ class kolabUser extends baseModule { } } // email aliases - if (sizeof($this->attributes['alias']) > 0) { + if (isset($this->attributes['alias'][0])) { $return['kolabUser_aliases'][0] = '' . _('Email aliases') . '' . implode(", ", $this->attributes['alias']) . ''; } // delegates - if (sizeof($this->attributes['kolabDelegate']) > 0) { + if (isset($this->attributes['kolabDelegate'][0])) { $return['kolabUser_delegate'][0] = '' . _('Delegates') . '' . implode(", ", $this->attributes['kolabDelegate']) . ''; } return $return; diff --git a/lam/lib/modules/shadowAccount.inc b/lam/lib/modules/shadowAccount.inc index 2d53f232..658929c7 100644 --- a/lam/lib/modules/shadowAccount.inc +++ b/lam/lib/modules/shadowAccount.inc @@ -425,12 +425,36 @@ class shadowAccount extends baseModule implements passwordService { * @return array list of possible PDF entries */ function get_pdfEntries() { - return array('shadowAccount_shadowLastChange' => array('' . _('Last password change') . '' . date('d. m. Y',$this->attributes['shadowLastChange'][0]*24*3600) . ''), - 'shadowAccount_shadowWarning' => array('' . _('Password warning') . '' . $this->attributes['shadowWarn'][0] . ''), - 'shadowAccount_shadowInactive' => array('' . _('Password expiration') . '' . $this->attributes['shadowInactive'][0] . ''), - 'shadowAccount_shadowExpire' => array('' . _('Account expiration date') . '' . date('d. m. Y',$this->attributes['shadowExpire'][0]*24*3600) . ''), - 'shadowAccount_shadowMinAge' => array('' . _('Minimum password age') . '' . $this->attributes['shadowMin'][0] . ''), - 'shadowAccount_shadowMaxAge' => array('' . _('Maximum password age') . '' . $this->attributes['shadowMax'][0] . ''), + $shadowLastChange = ''; + if (isset($this->attributes['shadowLastChange'][0])) { + $shadowLastChange = date('d. m. Y',$this->attributes['shadowLastChange'][0]*24*3600); + } + $shadowWarn = ''; + if (isset($this->attributes['shadowWarn'][0])) { + $shadowWarn = $this->attributes['shadowWarn'][0]; + } + $shadowInactive = ''; + if (isset($this->attributes['shadowInactive'][0])) { + $shadowInactive = $this->attributes['shadowInactive'][0]; + } + $shadowExpire = ''; + if (isset($this->attributes['shadowExpire'][0])) { + $shadowExpire = date('d. m. Y',$this->attributes['shadowExpire'][0]*24*3600); + } + $shadowMin = ''; + if (isset($this->attributes['shadowMin'][0])) { + $shadowMin = $this->attributes['shadowMin'][0]; + } + $shadowMax = ''; + if (isset($this->attributes['shadowMax'][0])) { + $shadowMax = $this->attributes['shadowMax'][0]; + } + return array('shadowAccount_shadowLastChange' => array('' . _('Last password change') . '' . $shadowLastChange . ''), + 'shadowAccount_shadowWarning' => array('' . _('Password warning') . '' . $shadowWarn . ''), + 'shadowAccount_shadowInactive' => array('' . _('Password expiration') . '' . $shadowInactive . ''), + 'shadowAccount_shadowExpire' => array('' . _('Account expiration date') . '' . $shadowExpire . ''), + 'shadowAccount_shadowMinAge' => array('' . _('Minimum password age') . '' . $shadowMin . ''), + 'shadowAccount_shadowMaxAge' => array('' . _('Maximum password age') . '' . $shadowMax . ''), ); }