steffen: server/kolab-webadmin/kolab-webadmin/www/admin/user deliver.php, 1.2, 1.3 forward.php, 1.12, 1.13 index.php, 1.14, 1.15 user.php, 1.68, 1.69

cvs at intevation.de cvs at intevation.de
Thu Oct 13 03:50:03 CEST 2005


Author: steffen

Update of /kolabrepository/server/kolab-webadmin/kolab-webadmin/www/admin/user
In directory doto:/tmp/cvs-serv29305/kolab-webadmin/www/admin/user

Modified Files:
	deliver.php forward.php index.php user.php 
Log Message:
Fix for issue886 (i18n problem)

Index: deliver.php
===================================================================
RCS file: /kolabrepository/server/kolab-webadmin/kolab-webadmin/www/admin/user/deliver.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- deliver.php	29 Aug 2005 21:28:28 -0000	1.2
+++ deliver.php	13 Oct 2005 01:50:01 -0000	1.3
@@ -71,8 +71,8 @@
 	  }
 
 	  if( !$errors ) {
-		if( $active ) $messages[] = _("Delivery to '$inbox' successfully activated");
-		else $messages[] =  _("Delivery to '$inbox' successfully deactivated");
+		if( $active ) $messages[] = sprintf(_("Delivery to '%s' successfully activated"), $inbox);
+		else $messages[] =  sprintf(_("Delivery to '%s' successfully deactivated"), $inbox);
 	  }	
   }
 

Index: forward.php
===================================================================
RCS file: /kolabrepository/server/kolab-webadmin/kolab-webadmin/www/admin/user/forward.php,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- forward.php	29 Aug 2005 21:28:28 -0000	1.12
+++ forward.php	13 Oct 2005 01:50:01 -0000	1.13
@@ -75,8 +75,8 @@
 	  }
 
 	  if( !$errors ) {
-		if( $active ) $messages[] = _("Forwarding to '$address' successfully activated");
-		else $messages[] =  _("Forwarding to '$address' successfully deactivated");
+		if( $active ) $messages[] = sprintf(_("Forwarding to '%s' successfully activated"), $address);
+		else $messages[] =  sprintf(_("Forwarding to '%s' successfully deactivated"), $address);
 	  }
 	}
   }

Index: index.php
===================================================================
RCS file: /kolabrepository/server/kolab-webadmin/kolab-webadmin/www/admin/user/index.php,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- index.php	12 Sep 2005 20:10:00 -0000	1.14
+++ index.php	13 Oct 2005 01:50:01 -0000	1.15
@@ -103,7 +103,7 @@
 
   if( $result ) {
 	$count = ldap_count_entries($ldap->connection, $result);
-	$title = _("Manage Email User ($count Users)");
+	$title = sprintf(_("Manage Email User (%d Users)"), $count);
 	// if there are more than 2000 entries, split in 26 categories for every letter,
 	// or if more than 50, put in groups, or else just show all.
 	if (false && $count > 2000) {

Index: user.php
===================================================================
RCS file: /kolabrepository/server/kolab-webadmin/kolab-webadmin/www/admin/user/user.php,v
retrieving revision 1.68
retrieving revision 1.69
diff -u -d -r1.68 -r1.69
--- user.php	17 Sep 2005 22:31:17 -0000	1.68
+++ user.php	13 Oct 2005 01:50:01 -0000	1.69
@@ -73,7 +73,7 @@
 	  $ok = true;
 	}
   }
-  if(!$ok) return _("Email address $value not in domains ".join(", ", $domain));
+  if(!$ok) return sprintf(_("Email address %1\$s not in domains %2\$s"), $value, join(", ", $domain));
 
   if( $ldap->countMail( $_SESSION['base_dn'], $value ) > 0 ) {	
 	return _('User, vCard or distribution list with this email address already exists');
@@ -124,7 +124,7 @@
   $str = '';
   foreach( $lst as $delegate ) {
 	if( $ldap->count( $ldap->search( $_SESSION['base_dn'], '(mail='.$ldap->escape($delegate).')' ) ) == 0 ) {
-	  return _("Delegate $delegate does not exist");
+	  return sprintf(_("Delegate %s does not exist"), $delegate);
 	} 
   }
   return '';
@@ -137,7 +137,7 @@
   foreach( $value as $v ) {
 	$v = trim($v);
 	if( !empty($v) && !ereg('^([0-9a-zA-Z._@ ]|-)*$', $v ) ) {
-	  return _("Illegal user or group $v");
+	  return sprintf(_("Illegal user or group %s"), $v);
 	}
   }
   return '';
@@ -405,7 +405,7 @@
 									 'policies' => array('anyone' => 4),
 									 'validation' => 'checkpolicy',
 									 'comment' => _('For automatic invitation handling') . '<br/>' .
-									 _('NOTE: For regular accounts to use this feature, give the \'calendar\' user access to the Calendar folder') ),
+									 _("NOTE: For regular accounts to use this feature, give the 'calendar' user access to the Calendar folder") ),
 		  'title_0' => array( 'name' => _('Title') ) );
 $entries['alias'] = array( 'name' => _('Email Aliases'), 
 						   'type' => 'textarea',
@@ -446,7 +446,7 @@
 if( $dn ) {
   $ldap_object = $ldap->read( $dn );
   if( !$ldap_object ) {
-    array_push($errors, _("LDAP Error: No such dn: $dn: ").ldap_error($ldap->connection));
+    array_push($errors, sprintf(_("LDAP Error: No such dn: %s: %s"), $dn, ldap_error($ldap->connection)));
   }
 }
 
@@ -482,7 +482,8 @@
 		   $pubkeydata=file_get_contents("$kolab_prefix/etc/kolab/res_pub.pem" );		   
 		   $pkey = openssl_pkey_get_public( $pubkeydata );
 		   if( $pkey === false ) {
-			 $sslerr = _("Could not read resource encryption public key file://$kolab_prefix/etc/kolab/res_pub.pem: ");
+			 $sslerr = sprintf(_("Could not read resource encryption public key file://%s/etc/kolab/res_pub.pem: "), 
+							   $kolab_prefix);
 			 while( $msg = openssl_error_string() )
 			   $sslerr .= $msg.' ';
 			 $errors[] = $sslerr;
@@ -583,9 +584,7 @@
 			 unset( $distlists['count'] );
 			 foreach( $distlists as $distlist ) {
 				 $dlcn = $distlist['mail'][0];
-				 $errors[] = _("Account DN could not be modified, distribution list <a href='/admin/distributionlist/list.php?action=modify&dn=")
-				   .urlencode($distlist['dn']).
-				   _("'>'$dlcn'</a> depends on it. To modify this account, first remove it from the distribution list.");
+				 $errors[] = sprintf(_("Account DN could not be modified, distribution list <a href='/admin/distributionlist/list.php?action=modify&dn=%s'>'%s'</a> depends on it. To modify this account, first remove it from the distribution list."), urlencode($distlist['dn']), $dlcn );
 			 }
 
 			 if (($result=ldap_read($ldap->connection,$dn,"(objectclass=*)")) &&
@@ -615,22 +614,23 @@
 			   unset($explodeddn[0]);
 			   $tmpbasedn = join(",",$explodeddn);			   
 			   if ( !$errors && !ldap_rename($ldap->connection,$dn,$tmprdn,$tmpbasedn,false) ) {
-				 array_push($errors, _("LDAP Error: Could not rename $dn to $tmprdn: ")
-							.ldap_error($ldap->connection));				 
+				 array_push($errors, sprintf(_("LDAP Error: Could not rename %1\$s to %2\$s: %3\$s"), $dn, $tmprdn,
+											 ldap_error($ldap->connection)));
 			   }
 			   if ( !$errors && !ldap_add($ldap->connection,$newdn, $ldap_object) ) {
-				 array_push($errors, _("LDAP Error: Could not rename $dn to $newdn: ")
-							.ldap_error($ldap->connection));
+				 array_push($errors, sprintf(_("LDAP Error: Could not rename %1\$s to %2\$s: %3\$s"), $dn, $newdn,
+											 ldap_error($ldap->connection)));
 			   }
 			   if( !$errors ) {
 				 if( !ldap_delete($ldap->connection,$tmprdn.','.$tmpbasedn)) {
-				   array_push($errors, _("LDAP Error: Could not remove old entry $tmprdn,$tmpbasedn: ")
-							  .ldap_error($ldap->connection));
+				   array_push($errors, sprintf(_("LDAP Error: Could not remove old entry %s,%s: %s"), 
+											   $tmprdn, $tmpbasedn,
+											   ldap_error($ldap->connection)));
 				 }
 			   }
 			   $dn = $newdn;
-			 } else array_push($errors,_("LDAP Error: Could not read $dn: ")
-							   .ldap_error($ldap->connection));
+			 } else array_push($errors, sprintf(_("LDAP Error: Could not read %s: %s"), $dn,
+												ldap_error($ldap->connection));
 		   } else {
 			 //$ldap_object = fill_up($ldap_object);
 			 if ($auth->group() == "user") {
@@ -641,8 +641,8 @@
 			   unset($ldap_object['kolabHomeServer']);
 			 }
 			 if (!ldap_modify($ldap->connection, $dn, $ldap_object)) {			   
-			   array_push($errors, _("LDAP Error: Could not modify object $dn: ")
-						  .ldap_error($ldap->connection));
+			   array_push($errors, sprintf(_("LDAP Error: Could not modify object %s: %s"), $dn,
+										   ldap_error($ldap->connection));
 			   debug_var_dump( $ldap_object );
 			 }
 		   }
@@ -654,14 +654,16 @@
 			   $newalias = md5sum( $dn.$alias ).'@'.substr( $alias, 0, strpos( $alias, '@' ) );
 			   $ldap_object['alias'][$i] = $newalias;
 			   if (!ldap_modify($ldap->connection, $dn, $ldap_object)) {
-				 $errors[] = _("LDAP Error: Could not modify object $dn: ").ldap_error($ldap->connection);
+				 $errors[] = sprintf(_("LDAP Error: Could not modify object %s: %s"), $dn, 
+									 ldap_error($ldap->connection));
 			   }
-			   $error[] = _("Mid-air collision detected, alias $alias renamed to $newalias");
+			   $error[] = sprintf(_("Mid-air collision detected, alias %1\$s renamed to %2\$s"), 
+								  $alias, $newalias);
 			 }
 		   }
 		 }
 		 $heading = _('Modify User');
-		 if( !$errors ) $messages[] = _("User '$dn' successfully modified");
+		 if( !$errors ) $messages[] = sprintf(_("User '%s' successfully modified"), $dn);
 		 $form->setValues();
 		 $form->entries['mail']['attrs'] = 'readonly';
 		 $form->entries['kolabhomeserver']['attrs'] = 'readonly';
@@ -679,7 +681,8 @@
 		   }
 		   debug("Calling ldap_add with dn=$dn");
 		   if ($dn && !ldap_add($ldap->connection, $dn, $ldap_object)) 
-			 array_push($errors, _("LDAP Error: could not add object $dn: ").ldap_error($ldap->connection));
+			 array_push($errors, sprintf(_("LDAP Error: could not add object %s: %s"), $dn,
+										 ldap_error($ldap->connection)));
 
 		   // Check for mid-air collisions on mail
 		   if( $ldap->countMail( $_SESSION['base_dn'], $ldap_object['mail'], $dn ) > 0 ) {
@@ -688,9 +691,11 @@
 			 $newmail = md5sum( $dn.$mail ).'@'.substr( $mail, 0, strpos( $mail, '@' ) );
 			 $ldap_object['uid'] = $ldap_object['mail'] = $newmail;
 			 if (!ldap_modify($ldap->connection, $dn, $ldap_object)) {
-			   $errors[] = _("LDAP Error: Could not modify object $dn: ").ldap_error($ldap->connection);
+			   $errors[] = sprintf(_("LDAP Error: Could not modify object %s: %s"), $dn, 
+								   ldap_error($ldap->connection));
 			 }
-			 $error[] = _("Mid-air collision detected, email address $mail renamed to $newmail");
+			 $error[] = sprintf(_("Mid-air collision detected, email address %1\$s renamed to %2\$s"), 
+								$mail, $newmail);
 		   }
 
 		   // Check for collisions on alias
@@ -701,9 +706,11 @@
 			   $newalias = md5sum( $dn.$alias ).'@'.substr( $alias, 0, strpos( $alias, '@' ) );
 			   $ldap_object['alias'][$i] = $newalias;
 			   if (!ldap_modify($ldap->connection, $dn, $ldap_object)) {
-				 $errors[] = _("LDAP Error: Could not modify object $dn: ").ldap_error($ldap->connection);
+				 $errors[] = sprintf(_("LDAP Error: Could not modify object %s: %s"), $dn,
+									 ldap_error($ldap->connection));
 			   }
-			   $error[] = _("Mid-air collision detected, alias $alias renamed to $newalias");
+			   $error[] = sprintf(_("Mid-air collision detected, alias %1\$s renamed to %2\$s"), 
+								  $alias, $newalias);
 			 }
 		   }
 
@@ -753,7 +760,7 @@
    $content = $form->outputForm();
    break;
  case 'kill':
-   if (!$dn) array_push($errors, _("Error: need dn for delete operation"));
+   if (!$dn) array_push($errors, _("Error: need DN for delete operation"));
    elseif ($auth->group() != "maintainer" && $auth->group() != "admin") 
      array_push($errors, _("Error: you need administrative permissions to delete users"));
 
@@ -767,12 +774,13 @@
 	 $dlmail = $distlist['mail'][0];
 	 if( !$dlmail ) $dlmail = $distlist['cn'][0]; # Compatibility with old stuff
 	 if( $distlist['member']['count'] == 1 ) {
-	   $errors[] = _("Account could not be deleted, distribution list '$dlmail' depends on it.");
+	   $errors[] = sprintf(_("Account could not be deleted, distribution list '%s' depends on it."), $dlmail);
 	 } else {
 	   if( ldap_mod_del( $ldap->connection, $distlist['dn'], array('member' => $dn ) ) ) {
-		 $messages[] = _("Account removed from distribution list '$dlmail'.");
+		 $messages[] = sprintf(_("Account removed from distribution list '%s'."), $dlmail);
 	   } else {
-		 $errors[] = _("Failure to remove account from distribution list '$dlmail', account will not be deleted.");
+		 $errors[] = sprintf(_("Failure to remove account from distribution list '', account will not be deleted."),
+							 $dlmail);
 		 break;
 	   }
 	 }
@@ -780,7 +788,8 @@
 
    if( !$errors ) {
 	 if (!$ldap->deleteObject($dn)) {
-	   array_push($errors, _("LDAP Error: could not mark '$dn' for deletion: ").$ldap->error());
+	   array_push($errors, sprintf(_("LDAP Error: could not mark '%s' for deletion: %s"), $dn, 
+								   $ldap->error()));
 	 } else {
 	   $heading = _("User Deleted");
 	   $contenttemplate = 'userdeleted.tpl';





More information about the commits mailing list