]> git.sur5r.net Git - contagged/commitdiff
UTF-8 in interface
authorAndreas Gohr <gohr@cosmocode.de>
Tue, 17 Jan 2006 11:49:34 +0000 (12:49 +0100)
committerAndreas Gohr <gohr@cosmocode.de>
Tue, 17 Jan 2006 11:49:34 +0000 (12:49 +0100)
Now everything is UTF-8. LDAPab used to convert from and to latin1 for no
reason. LDAP always stores it's data in UTF-8 anyway. Be sure to save your
language files in UTF-8 and also make sure not to use a Byteordermark (BOM)
or you may breakthe PHP engine parser.

darcs-hash:20060117114934-6e07b-3943428770b93f663536981a9d6f1fa0771cf948.gz

19 files changed:
README
TODO [deleted file]
config.php
entry.php
functions.php
help.php
index.php
lang/de.php
login.php
orgs.php
template.php
templates/entry_edit.tpl
templates/header.tpl
templates/import.tpl
templates/importVCF.tpl
templates/importVCF_entry.tpl
templates/import_entry.tpl
templates/list_filter.tpl
templates/login.tpl

diff --git a/README b/README
index 60af64cc04ff82e0a1ff2cf00512a4805b31a7ab..000ab5783037e02bc764694fc957680b4a33becf 100644 (file)
--- a/README
+++ b/README
@@ -81,7 +81,8 @@ but we can't promise to answer, to fix bugs or include feature wishes. However
 don't hesitate to contact us but understand that our core business has priority
 over this project.
 
-To contact us send a mail to ldapab@cosmocode.de
+To contact us send a mail to ldapab@cosmocode.de or visit our homepage at
+http://www.cosmocode.de
 
 === KNOWN BUGS ===
 
@@ -91,7 +92,7 @@ LDAP Servers.
 === LICENSE ===
 
 LDAPab - An LDAP based Company Address Book
-Copyright 2004 - CosmoCode GmbH
+Copyright 2004 - 2006 - CosmoCode GmbH
 
 This program is free software; you can redistribute it and/or
 modify it under the terms of the GNU General Public License as
diff --git a/TODO b/TODO
deleted file mode 100644 (file)
index 10730a1..0000000
--- a/TODO
+++ /dev/null
@@ -1,4 +0,0 @@
-
-Photoupload
-
-marker
index d269fe752f493469b24c3ee83478fef11aa41e9d..a73186a11bd62518926323424089650073779d92 100644 (file)
 
   // Should the additional schema ldapab.schema be used? (0|1)
   // Note: openxchange and extended are currently exclusive, do not use both at the same time!
-  $conf[extended]    = 0;
+  $conf[extended]    = 1;
   
   // Should we use some parts of the openxchange.schema? (0|1)
   // Note: openxchange and extended are currently exclusive, do not use both at the same time!
-  $conf[openxchange] = 1;
+  $conf[openxchange] = 0;
  
   // Should we try to login using the username and password provided by httpd? (0|1)
   $conf[httpd_auth]  = 1;
index 594e1eb2b95fb54d8b9e1474eb4e3749413816ee..b597b4f8446ca85057869ef65eb3f5689d6ff0ca 100644 (file)
--- a/entry.php
+++ b/entry.php
     $entry = $smarty->get_template_vars('entry');
     $filename = $entry[givenname].'_'.$entry[name].'.vcf';
     header("Content-Disposition: attachment; filename=\"$filename\"");
-    header("Content-type: text/x-vcard; name=\"$filename\"");
+    header("Content-type: text/x-vcard; name=\"$filename\"; charset=utf-8");
     $smarty->display($template);
   }else{
+    header('Content-Type: text/html; charset=utf-8');
     $smarty->display('header.tpl');
     $smarty->display($template);
     $smarty->display('footer.tpl');
index 2c74c1f606e1089b0997b569b34c049383207c70..c517e8407a25a3481f8b594e3643803b85337f8e 100644 (file)
@@ -210,8 +210,6 @@ function prepare_ldap_entry($in){
     $out[objectclass][] = 'OXUserObject';
   }
 
-  utf8_encode_array($out);
-
   return clear_array($out);
 }
 
@@ -335,6 +333,8 @@ function array_unique_renumber($somearray){
  * Decodes UTF8 recursivly for the given array
  */
 function utf8_decode_array(&$array) {
+  trigger_error('deprecated utf8_decode_array called',E_USER_WARNING);
+
   foreach (array_keys($array) as $key) {
     if($key === 'dn') continue;
     if($key === 'jpegPhoto') continue;
@@ -350,6 +350,8 @@ function utf8_decode_array(&$array) {
  * Encodes the given array to UTF8 recursively
  */
 function utf8_encode_array(&$array) {
+  trigger_error('deprecated utf8_encode_array called',E_USER_WARNING);
+
   foreach (array_keys($array) as $key) {
     if($key === 'dn') continue;
     if($key === 'jpegPhoto') continue;
index eaa581754e394a4b898bcebe76ed01f9e8cc71ef..8aaa8f8e963553a9a7717c87e74e0ee73dc65110 100644 (file)
--- a/help.php
+++ b/help.php
@@ -5,6 +5,7 @@
   //prepare templates
   tpl_std();
   //display templates
+  header('Content-Type: text/html; charset=utf-8');
   $smarty->display('header.tpl');
   $smarty->display('help.tpl');
   $smarty->display('footer.tpl');
index f797e5e0637952272bb77ffe56f1260fc8c85073..607d41eec15329b6a71373b70c519a0857c7863b 100644 (file)
--- a/index.php
+++ b/index.php
@@ -57,6 +57,8 @@
   }else{
     //save location in session
     $_SESSION[ldapab][lastlocation]=$_SERVER["REQUEST_URI"];
+
+    header('Content-Type: text/html; charset=utf-8');
     $smarty->display('header.tpl');
     $smarty->display('list_filter.tpl');
     $smarty->display('list.tpl');
     if(empty($filter)) $filter='a';
 
     if(!empty($marker)){
-      $marker = utf8_encode($marker);
       $ldapfilter = "(&(objectClass=contactPerson)(marker=$marker))";
     }elseif(!empty($categories)){
-      $categories = utf8_encode($categories);
       $ldapfilter = "(&(objectClass=OXUserObject)(OXUserCategories=$categories))";
     }elseif(!empty($search)){
       $search = trim($search);
       $words=preg_split('/\s+/',$search);
       $filter='';
       foreach($words as $word){
-        $word = utf8_encode($word);
         $filter .= "(|(|(sn=*$word*)(givenName=*$word*))(o=*$word*))";
       }
       $ldapfilter = "(&(objectClass=inetOrgPerson)$filter)";
     }elseif(!empty($org)){
-      $org = utf8_encode($org);
       $ldapfilter = "(&(objectClass=inetOrgPerson)(o=$org))";
     }elseif($filter=='other'){
       $other='';
     }elseif($filter=='*'){
       $ldapfilter = "(objectClass=inetOrgPerson)";
     }else{
-      $filter = utf8_encode($filter);
       $ldapfilter = "(&(objectClass=inetOrgPerson)(sn=$filter*))";
     }
     return $ldapfilter;
index 4c96e01af1b7f19524aa9497fcaa0593239bf064..f483ffa7d00309cedca5cd2fa80236289cfefdb8 100644 (file)
@@ -7,7 +7,7 @@ $lang[givenname]      = 'Vorname';
 $lang[title]          = 'Titel';
 $lang[organization]   = 'Firma';
 $lang[office]         = 'Abteilung';
-$lang[street]         = 'Straße, Nr.';
+$lang[street]         = 'Straße, Nr.';
 $lang[zip]            = 'Postleitzahl';
 $lang[location]       = 'Ort';
 $lang[phone]          = 'Telefon';
@@ -25,11 +25,11 @@ $lang[manager]        = 'Key Account';
 $lang[anniversary]    = 'Geburtstag';
 $lang[marker]         = 'Kategorie';
 
-$lang[business]       = 'Geschäftlich';
+$lang[business]       = 'Geschäftlich';
 $lang[private]        = 'Privat';
-$lang[extended]       = 'Zusätzliche Infos';
+$lang[extended]       = 'Zusätzliche Infos';
 
-$lang[delphoto]       = 'Vorhandenes Foto löschen';
+$lang[delphoto]       = 'Vorhandenes Foto löschen';
 
 $lang[notloggedin]    = 'Nicht angemeldet';
 $lang[loggedinas]     = 'Angemeldet als';
@@ -38,7 +38,7 @@ $lang[logout]         = 'Abmelden';
 $lang[edit]           = 'Bearbeiten';
 $lang[show]           = 'Anzeigen';
 $lang['new']          = 'Neu';
-$lang['delete']       = 'Löschen';
+$lang['delete']       = 'Löschen';
 $lang['copy']         = 'Kopieren';
 $lang[csvexport]      = 'CSV';
 $lang[vcfexport]      = 'VCard';
@@ -46,11 +46,11 @@ $lang[vcfimport]                    = 'Import';
 $lang[search]         = 'Suchen';
 $lang[submit]         = 'Absenden';
 $lang[help]           = 'Hilfe';
-$lang[select]         = 'Auswählen';
+$lang[select]         = 'Auswählen';
 $lang[orgs]           = 'Firmen';
 $lang[upload]         = 'Hochladen';
 
-$lang[publicbook]     = 'Öffentliches Adressbuch';
+$lang[publicbook]     = 'Öffentliches Adressbuch';
 $lang[privatebook]    = 'Privates Adressbuch';
 
 
@@ -59,12 +59,12 @@ $lang[password]       = 'Passwort';
 
 $lang[msg_login]      = 'Bitte melden sie sich an!';
 $lang[msg_loginfail]  = 'Anmeldung fehlgeschlagen!';
-$lang[msg_reallydel]  = 'Eintrag wirklich löschen?';
-$lang[msg_addto]      = 'Zu welchem Adressbuch soll der Eintrag hinzugefügt werden?';
+$lang[msg_reallydel]  = 'Eintrag wirklich löschen?';
+$lang[msg_addto]      = 'Zu welchem Adressbuch soll der Eintrag hinzugefügt werden?';
 $lang[msg_jpegonly]   = 'Nur JPEG';
 $lang[msg_dateformat] = 'JJJJ-MM-TT';
 $lang[msg_uploadvcf]  = 'Upload VCard File';
 
-$lang[err_noentries]  = 'Keine Einträge';
+$lang[err_noentries]  = 'Keine Einträge';
 $lang[err_ldap]       = 'Der LDAP Server lieferte folgende Fehlermeldungen';
 ?>
index f7ad08ec1d02c16886ba4aa109bfe49b7123a866..a2d0a124f9c5676166531acf0a111371cb42f247 100644 (file)
--- a/login.php
+++ b/login.php
@@ -20,6 +20,7 @@
   tpl_std();
   $smarty->assign('msg',$msg);
   //display templates
+  header('Content-Type: text/html; charset=utf-8');
   $smarty->display('header.tpl');
   $smarty->display('login.tpl');
   $smarty->display('footer.tpl');
index 272c9725b52144e5533ece7718546b4aca4e0669..a5fba034906fde8eb6ec826da2210593b6b2255f 100644 (file)
--- a/orgs.php
+++ b/orgs.php
@@ -6,6 +6,7 @@
   tpl_std();
   tpl_orgs();
   //display templates
+  header('Content-Type: text/html; charset=utf-8');
   $smarty->display('header.tpl');
   $smarty->display('orgs.tpl');
   $smarty->display('footer.tpl');
index dbe4b5ec5fa0e66d72be17804137dde849e8b2c7..17ed0ce95e112868c4ad1ac06d0c9cd412c72901 100644 (file)
@@ -63,9 +63,6 @@ function tpl_entry($in){
     $out['categories'] = $in['OXUserCategories'];
   }
 
-  //decode array
-  utf8_decode_array($out);
-
 /*print '<pre>';
 print_r($out);
 print '</pre>';*/
@@ -126,7 +123,6 @@ function tpl_markers(){
   $markers = array_unique($markers);
   sort($markers,SORT_STRING);
  
-  utf8_decode_array($markers);
   $smarty->assign('markers',$markers);
 }
 
@@ -160,7 +156,6 @@ function tpl_orgs(){
   }
   $orgs = array_unique($orgs);
   sort($orgs,SORT_STRING);
-  utf8_decode_array($orgs);
   $smarty->assign('orgs',$orgs);
 }
 
@@ -199,7 +194,6 @@ function tpl_categories(){
   $categories = array_unique($categories);
   sort($categories,SORT_STRING);
  
-  utf8_decode_array($categories);
   $smarty->assign('categories',$categories);
 }
 
@@ -238,7 +232,6 @@ function tpl_timezone(){
   $timezone = array_unique($timezone);
   sort($timezone,SORT_STRING);
  
-  utf8_decode_array($timezone);
   $smarty->assign('timezone',$timezone);
 }
 
@@ -277,7 +270,6 @@ function tpl_country(){
   $country = array_unique($country);
   sort($country,SORT_STRING);
  
-  utf8_decode_array($country);
   $smarty->assign('country',$country);
 }
 
index be8f3a90603f0599a30b1481e48dfbd73954d00f..18f83e21e9466a7104f78ba2719eebe11a79cfdb 100644 (file)
@@ -5,7 +5,7 @@
   {$entry.givenname} {$entry.name}
 </h1>
 
-<form action="entry.php" method="post" enctype="multipart/form-data">
+<form action="entry.php" method="post" enctype="multipart/form-data" accept-charset="utf-8">
 <input type="hidden" name="MAX_FILE_SIZE" value="2000000" />
 <input type="hidden" name="dn" value="{$entry.dn|escape}" />
 <input type="hidden" name="save" value="1" />
index 9467e8a141944bc4f2a8771d5e5a4397076c665b..27fc804fe5b96019b0245a3f598fa3e552027e25 100644 (file)
@@ -2,6 +2,7 @@
 <head>
   <title>LDAPab - {$lang.ldapab}</title>
   <link rel="stylesheet" type="text/css" href="templates/style.css" />
+  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 </head>
 <body>
 
index f1dd5f56e103dd43d75710ca9ec3bdbd09985441..3ec11e6cc5f73109bced87cf6627b95d50d6d95e 100644 (file)
@@ -1,7 +1,7 @@
 <table cellspacing="0" cellpadding="0" width="100%">
 <tr>
 <td class="filterrow">
-  <form action="import.php" method="post" enctype="multipart/form-data">
+  <form action="import.php" method="post" enctype="multipart/form-data" accept-charset="utf-8">
     {$lang.msg_uploadvcf}: <input name="userfile" type="file" class="upload" />
     <input type="submit" value="{$lang.upload}" class="searchbutton"/>
   </form>
index 1e13444099c79baf76b65b015e4bfcf0780b72ea..d4b1294fc5dcb497dc166f2b67c49d88482e754d 100644 (file)
@@ -1,7 +1,7 @@
 <table cellspacing="0" cellpadding="0" width="100%">
 <tr>
 <td class="filterrow">
-  <form action="importVCF.php" method="post" enctype="multipart/form-data">
+  <form action="importVCF.php" method="post" enctype="multipart/form-data" accept-charset="utf-8">
     {$lang.msg_uploadvcf}: <input name="userfile" type="file" class="upload" />
     <input type="submit" value="{$lang.upload}" class="searchbutton"/>
   </form>
index b2361ad180fdcf00f601981f3be4ef6593431e37..69f763a904856362db197ecb947ab8400e6b211f 100644 (file)
@@ -1,5 +1,5 @@
 <tr>
-       <form action="entry.php" method="post" target="_blank">
+       <form action="entry.php" method="post" target="_blank" accept-charset="utf-8">
   <td class="result">
     <b>{$entry.name}, {$entry.givenname}</b>
   </td>
index fd4854bed910014c16f0501d767e71cb2864b173..63a0c2582faefca33bbb5c852d3407b6e79939de 100644 (file)
@@ -1,5 +1,5 @@
 <tr>
-       <form action="entry.php" method="post" target="_import_">
+       <form action="entry.php" method="post" target="_import_" accept-charset="utf-8">
   <td class="result">
     <b>{$entry.name}, {$entry.givenname}</b>
   </td>
index e5c2ab57a47c2954e2872a583ddbad55a7905910..7f2d1c645f4172593302bf7aa1f53bde76bbef89 100644 (file)
@@ -53,7 +53,7 @@
 </td>
 {/if}
 <td class="filterrow" align="right">
-  <form method="get" action="index.php" style="display:inline">
+  <form method="get" action="index.php" style="display:inline" accept-charset="utf-8">
     <input type="text" name="search" class="searchfield" value="{$smarty.request.search}">
     <input type="submit" value="{$lang.search}" class="searchbutton">
   </form>
index d4196f66e081f2213eaf11eddfad330bd4502331..387597143875ffba64a7dfd16d3ed0e227cab23c 100644 (file)
@@ -1,6 +1,6 @@
 
   <br /><br /><br />
-  <form action="login.php" method="post">
+  <form action="login.php" method="post" accept-charset="utf-8">
   <table class="tableborder" align="center">
     <tr>
       <td colspan="2" align="center">{$msg}<br /><br /></td>