[Tickets #7489] _prefs_hook_fullname charset problem

bugs at horde.org bugs at horde.org
Mon Oct 13 10:15:39 UTC 2008


DO NOT REPLY TO THIS MESSAGE. THIS EMAIL ADDRESS IS NOT MONITORED.

Ticket URL: http://bugs.horde.org/ticket/7489
------------------------------------------------------------------------------
  Ticket             | 7489
  Created By         | frank.richter at hrz.tu-chemnitz.de
  Summary            | _prefs_hook_fullname charset problem
  Queue              | Horde Framework Packages
  Version            | FRAMEWORK_3
  Type               | Bug
  State              | Unconfirmed
  Priority           | 2. Medium
  Milestone          |
  Patch              |
  Owners             |
------------------------------------------------------------------------------


frank.richter at hrz.tu-chemnitz.de (2008-10-13 06:15) wrote:

Hi,
I'm migrating from Horde 3.1/IMP 4.1 to 3.3/4.3. We defined a hook for  
fullname in horde/config/hooks.php (taken from the example):
   if (!function_exists('_prefs_hook_fullname')) {
      function _prefs_hook_fullname($user = null)
      {
          $ldapServer = 'ldap.tu-chemnitz.de';
          $ldapPort = '389';
          $searchBase = 'dc=tu-chemnitz, dc=de';
          $ldapcharset = 'UTF-8';
          $outputcharset = NLS::getCharset();

          $ds = @ldap_connect($ldapServer, $ldapPort);

          if (is_null($user)) {
              $user = Auth::getAuth();
              if ($user === false)
                 return '';
          }
          $searchResult = @ldap_search($ds, $searchBase, 'uid=' . $user);
          $information = @ldap_get_entries($ds, $searchResult);
          if ($information === false || $information["count"] < 1) return '';
          if ($information[0]['displayname'][0] != '') {
              $name = $information[0]['displayname'][0];
          } else {
              $name = $information[0]['cn'][0];
          }
          ldap_close($ds);

          $name = String::convertCharset($name, $ldapcharset, $outputcharset);
          Horde::logMessage("fullname: $name, $ldapcharset,  
$outputcharset", __FILE__, __LINE__, LOG_DEBUG);
          return ($name);
          # return (empty($name) ? $user : $name);
      }
  }

There are problem with names containing umlauts - from the Logfile:

Oct 13 11:48:12 HORDE [debug] [imp] fullname: Ottö Tcshtester, UTF-8,  
UTF-8 [pid 15336 on line 192 of "/var/www/html/horde/config/hooks.php"]
Oct 13 11:48:12 HORDE [debug] [imp] fullname: Ottö Tcshtester, UTF-8,  
UTF-8 [pid 15336 on line 192 of "/var/www/html/horde/config/hooks.php"]
Oct 13 11:48:12 HORDE [debug] [imp] SQL Query by Prefs_sql::store():  
INSERT INTO horde_prefs (pref_uid, pref_scope, pref_name, pref_value)  
VALUES(?, ?, ?, ?), values: tcot, horde, identities,  
a:1:{i:0;a:5:{s:2:"id";s:17:"Standardidentit&#65533;t";s:8:"fullname";s:12:"Ott?shtester";s:9:"from_addr";s:34:"otto.tcshtester at hrz.tu-chemnitz.de";s:10:"alias_addr";a:1:{i:0;s:23:"tcot at hrz.tu-chemnitz.de";}s:10:"default_id";s:1:"0";}} [pid 15336 on line 244 of  
"/var/www/html/horde/lib/Horde/Prefs/sql.php"]

The full name doesn't contain the umlaut. Setting the name via the  
Webbrowser is ok - umlauts are correctly
This function works in Horde 3.1 Do you have any idea?

Thanks in advance,
Frank






More information about the bugs mailing list