summaryrefslogtreecommitdiff
path: root/www/admin
diff options
context:
space:
mode:
authorThomas Arendsen Hein <thomas@intevation.de>2007-11-21 18:11:37 (GMT)
committerThomas Arendsen Hein <thomas@intevation.de>2007-11-21 18:11:37 (GMT)
commit688e2dab3f0c1d5bcbf690e9e0ab29f011f39abf (patch)
treeb2cf95b70810cedbd7907a04a4198c2ede720aa2 /www/admin
parenta9001cca6b730db3b66be16467529bdc4426f949 (diff)
downloadkolab-webadmin-688e2dab3f0c1d5bcbf690e9e0ab29f011f39abf.tar.gz
Fix kolab/issue1711 (extra space after first name when editing users or admins)
Diffstat (limited to 'www/admin')
-rw-r--r--www/admin/addressbook/addr.php.in8
-rw-r--r--www/admin/addressbook/index.php.in12
-rw-r--r--www/admin/administrator/admin.php.in8
-rw-r--r--www/admin/administrator/index.php.in4
-rw-r--r--www/admin/domainmaintainer/domainmaintainer.php.in8
-rw-r--r--www/admin/domainmaintainer/index.php.in4
-rw-r--r--www/admin/maintainer/index.php.in4
-rw-r--r--www/admin/maintainer/maintainer.php.in8
-rw-r--r--www/admin/user/index.php.in4
-rw-r--r--www/admin/user/user.php.in8
10 files changed, 14 insertions, 54 deletions
diff --git a/www/admin/addressbook/addr.php.in b/www/admin/addressbook/addr.php.in
index 5d816be..015be50 100644
--- a/www/admin/addressbook/addr.php.in
+++ b/www/admin/addressbook/addr.php.in
@@ -24,13 +24,7 @@ function fill_form_for_modify( &$form, &$ldap_object ) {
else $lastname = $ldap_object['sn'];
if (is_array($ldap_object['cn'])) $cn = $ldap_object['cn'][0];
else $cn = $ldap_object['cn'];
- if ($lastname) {
- $a = strlen($lastname);
- if ($cn) {
- $b = strlen($cn);
- $firstname = trim(substr($cn, 0, $b - $a));
- }
- }
+ $firstname = KolabLDAP::getGivenName($cn, $lastname);
if (is_array($ldap_object['mail'])) $mail_0 = $ldap_object['mail'][0];
else $mail_0 = $ldap_object['mail'];
$form->entries['firstname']['value'] = $firstname;
diff --git a/www/admin/addressbook/index.php.in b/www/admin/addressbook/index.php.in
index 8162f45..861b279 100644
--- a/www/admin/addressbook/index.php.in
+++ b/www/admin/addressbook/index.php.in
@@ -93,18 +93,16 @@ if( !$errors ) {
while( $entry ) {
$attrs = ldap_get_attributes($ldap->connection, $entry);
$dn = ldap_get_dn($ldap->connection,$entry);
- $mail = $attrs['mail'][0];
- $sn = $attrs['sn'][0];
- $cn = $attrs['cn'][0];
- $a = strlen($sn);
- $b = strlen($cn);
- $fn = substr($cn, 0, $b - $a);
+ $mail = $attrs['mail'][0];
+ $sn = $attrs['sn'][0];
+ $cn = $attrs['cn'][0];
+ $fn = KolabLDAP::getGivenName($cn, $sn);
$deleted = array_key_exists('kolabDeleteflag',$attrs)?$attrs['kolabDeleteflag'][0]:"FALSE";
$entries[] = array( 'dn' => $dn,
'sn' => $sn,
'fn' => $fn,
'mail' => $mail,
- 'deleted' => $deleted );
+ 'deleted' => $deleted );
$entry = ldap_next_entry( $ldap->connection,$entry );
}
}
diff --git a/www/admin/administrator/admin.php.in b/www/admin/administrator/admin.php.in
index 232ade3..1c2aced 100644
--- a/www/admin/administrator/admin.php.in
+++ b/www/admin/administrator/admin.php.in
@@ -58,13 +58,7 @@ function fill_form_for_modify( &$form, &$ldap_object ) {
else $lastname = $ldap_object['sn'];
if (is_array($ldap_object['cn'])) $cn = $ldap_object['cn'][0];
else $cn = $ldap_object['cn'];
- if ($lastname) {
- $a = strlen($lastname);
- if ($cn) {
- $b = strlen($cn);
- $firstname = substr($cn, 0, $b - $a);
- }
- }
+ $firstname = KolabLDAP::getGivenName($cn, $lastname);
if (is_array($ldap_object['uid'])) $uid = $ldap_object['uid'][0];
else $uid = $ldap_object['uid'];
$form->entries['firstname']['value'] = $firstname;
diff --git a/www/admin/administrator/index.php.in b/www/admin/administrator/index.php.in
index cec1ca2..725d4f8 100644
--- a/www/admin/administrator/index.php.in
+++ b/www/admin/administrator/index.php.in
@@ -81,9 +81,7 @@ if( !$errors ) {
if( $userid != 'manager' ) {
$sn = $attrs['sn'][0];
$cn = $attrs['cn'][0];
- $a = strlen($sn);
- $b = strlen($cn);
- $fn = substr($cn, 0, $b - $a);
+ $fn = KolabLDAP::getGivenName($cn, $sn);
// skip admins and maintainers
if( array_key_exists( $dn, $maintainers ) ) {
$entries[] = array( 'dn' => $dn,
diff --git a/www/admin/domainmaintainer/domainmaintainer.php.in b/www/admin/domainmaintainer/domainmaintainer.php.in
index 16211a0..a48fb9c 100644
--- a/www/admin/domainmaintainer/domainmaintainer.php.in
+++ b/www/admin/domainmaintainer/domainmaintainer.php.in
@@ -61,13 +61,7 @@ function fill_form_for_modify( &$form, &$ldap_object ) {
else $lastname = $ldap_object['sn'];
if (is_array($ldap_object['cn'])) $cn = $ldap_object['cn'][0];
else $cn = $ldap_object['cn'];
- if ($lastname) {
- $a = strlen($lastname);
- if ($cn) {
- $b = strlen($cn);
- $firstname = substr($cn, 0, $b - $a);
- }
- }
+ $firstname = KolabLDAP::getGivenName($cn, $lastname);
if (is_array($ldap_object['uid'])) $uid = $ldap_object['uid'][0];
else $uid = $ldap_object['uid'];
$form->entries['firstname']['value'] = $firstname;
diff --git a/www/admin/domainmaintainer/index.php.in b/www/admin/domainmaintainer/index.php.in
index 2066bfe..14401e1 100644
--- a/www/admin/domainmaintainer/index.php.in
+++ b/www/admin/domainmaintainer/index.php.in
@@ -79,9 +79,7 @@ if( !$errors ) {
$userid = $attrs['uid'][0];
$sn = $attrs['sn'][0];
$cn = $attrs['cn'][0];
- $a = strlen($sn);
- $b = strlen($cn);
- $fn = substr($cn, 0, $b - $a);
+ $fn = KolabLDAP::getGivenName($cn, $sn);
// skip admins and maintainers
if( array_key_exists( $dn, $maintainers ) ) {
$domains = $ldap->domainsForMaintainerDn($dn);
diff --git a/www/admin/maintainer/index.php.in b/www/admin/maintainer/index.php.in
index c9bf83d..7e248d6 100644
--- a/www/admin/maintainer/index.php.in
+++ b/www/admin/maintainer/index.php.in
@@ -79,9 +79,7 @@ if( !$errors ) {
$userid = $attrs['uid'][0];
$sn = $attrs['sn'][0];
$cn = $attrs['cn'][0];
- $a = strlen($sn);
- $b = strlen($cn);
- $fn = substr($cn, 0, $b - $a);
+ $fn = KolabLDAP::getGivenName($cn, $sn);
// skip admins and maintainers
if( array_key_exists( $dn, $maintainers ) ) {
$entries[] = array( 'dn' => $dn,
diff --git a/www/admin/maintainer/maintainer.php.in b/www/admin/maintainer/maintainer.php.in
index cd76b9e..853962e 100644
--- a/www/admin/maintainer/maintainer.php.in
+++ b/www/admin/maintainer/maintainer.php.in
@@ -59,13 +59,7 @@ function fill_form_for_modify( &$form, &$ldap_object ) {
else $lastname = $ldap_object['sn'];
if (is_array($ldap_object['cn'])) $cn = $ldap_object['cn'][0];
else $cn = $ldap_object['cn'];
- if ($lastname) {
- $a = strlen($lastname);
- if ($cn) {
- $b = strlen($cn);
- $firstname = substr($cn, 0, $b - $a);
- }
- }
+ $firstname = KolabLDAP::getGivenName($cn, $lastname);
if (is_array($ldap_object['uid'])) $uid = $ldap_object['uid'][0];
else $uid = $ldap_object['uid'];
$form->entries['firstname']['value'] = $firstname;
diff --git a/www/admin/user/index.php.in b/www/admin/user/index.php.in
index 0f536d2..20c80b1 100644
--- a/www/admin/user/index.php.in
+++ b/www/admin/user/index.php.in
@@ -144,9 +144,7 @@ if( !$errors ) {
$mail = $attrs['mail'][0];
$sn = $attrs['sn'][0];
$cn = $attrs['cn'][0];
- $a = strlen($sn);
- $b = strlen($cn);
- $fn = substr($cn, 0, $b - $a);
+ $fn = KolabLDAP::getGivenName($cn, $sn);
$dncomp = split( ',', $dn );
if( in_array('cn=groups',$dncomp) ) {
$type = 'G';
diff --git a/www/admin/user/user.php.in b/www/admin/user/user.php.in
index fe87fa8..0c5e575 100644
--- a/www/admin/user/user.php.in
+++ b/www/admin/user/user.php.in
@@ -219,13 +219,7 @@ function fill_form_for_modify( &$form, $dn, &$ldap_object ) {
else $sn = $ldap_object['sn'];
if (is_array($ldap_object['cn'])) $cn = $ldap_object['cn'][0];
else $cn = $ldap_object['cn'];
- if ($sn) {
- $a = strlen($sn);
- if ($cn) {
- $b = strlen($cn);
- $givenname = substr($cn, 0, $b - $a);
- }
- }
+ if ($cn && $sn) $givenname = KolabLDAP::getGivenName($cn, $sn);
if (is_array($ldap_object['mail'])) $mail = $ldap_object['mail'][0];
else $mail = $ldap_object['mail'];
if (is_array($ldap_object['uid'])) $uid = $ldap_object['uid'][0];