From 3dcc26f728beaeee605bad5e641759c74d83732e Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Tue, 17 Jan 2006 12:49:34 +0100 Subject: [PATCH] UTF-8 in interface 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 --- README | 5 +++-- TODO | 4 ---- config.php | 4 ++-- entry.php | 3 ++- functions.php | 6 ++++-- help.php | 1 + index.php | 7 ++----- lang/de.php | 20 ++++++++++---------- login.php | 1 + orgs.php | 1 + template.php | 8 -------- templates/entry_edit.tpl | 2 +- templates/header.tpl | 1 + templates/import.tpl | 2 +- templates/importVCF.tpl | 2 +- templates/importVCF_entry.tpl | 2 +- templates/import_entry.tpl | 2 +- templates/list_filter.tpl | 2 +- templates/login.tpl | 2 +- 19 files changed, 34 insertions(+), 41 deletions(-) delete mode 100644 TODO diff --git a/README b/README index 60af64c..000ab57 100644 --- 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 index 10730a1..0000000 --- a/TODO +++ /dev/null @@ -1,4 +0,0 @@ - -Photoupload - -marker diff --git a/config.php b/config.php index d269fe7..a73186a 100644 --- a/config.php +++ b/config.php @@ -30,11 +30,11 @@ // 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; diff --git a/entry.php b/entry.php index 594e1eb..b597b4f 100644 --- a/entry.php +++ b/entry.php @@ -49,9 +49,10 @@ $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'); diff --git a/functions.php b/functions.php index 2c74c1f..c517e84 100644 --- a/functions.php +++ b/functions.php @@ -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; diff --git a/help.php b/help.php index eaa5817..8aaa8f8 100644 --- 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'); diff --git a/index.php b/index.php index f797e5e..607d41e 100644 --- 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'); @@ -92,22 +94,18 @@ 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=''; @@ -118,7 +116,6 @@ }elseif($filter=='*'){ $ldapfilter = "(objectClass=inetOrgPerson)"; }else{ - $filter = utf8_encode($filter); $ldapfilter = "(&(objectClass=inetOrgPerson)(sn=$filter*))"; } return $ldapfilter; diff --git a/lang/de.php b/lang/de.php index 4c96e01..f483ffa 100644 --- a/lang/de.php +++ b/lang/de.php @@ -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'; ?> diff --git a/login.php b/login.php index f7ad08e..a2d0a12 100644 --- 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'); diff --git a/orgs.php b/orgs.php index 272c972..a5fba03 100644 --- 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'); diff --git a/template.php b/template.php index dbe4b5e..17ed0ce 100644 --- a/template.php +++ b/template.php @@ -63,9 +63,6 @@ function tpl_entry($in){ $out['categories'] = $in['OXUserCategories']; } - //decode array - utf8_decode_array($out); - /*print '
';
 print_r($out);
 print '
';*/ @@ -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); } diff --git a/templates/entry_edit.tpl b/templates/entry_edit.tpl index be8f3a9..18f83e2 100644 --- a/templates/entry_edit.tpl +++ b/templates/entry_edit.tpl @@ -5,7 +5,7 @@ {$entry.givenname} {$entry.name} -
+ diff --git a/templates/header.tpl b/templates/header.tpl index 9467e8a..27fc804 100644 --- a/templates/header.tpl +++ b/templates/header.tpl @@ -2,6 +2,7 @@ LDAPab - {$lang.ldapab} + diff --git a/templates/import.tpl b/templates/import.tpl index f1dd5f5..3ec11e6 100644 --- a/templates/import.tpl +++ b/templates/import.tpl @@ -1,7 +1,7 @@
- + {$lang.msg_uploadvcf}: diff --git a/templates/importVCF.tpl b/templates/importVCF.tpl index 1e13444..d4b1294 100644 --- a/templates/importVCF.tpl +++ b/templates/importVCF.tpl @@ -1,7 +1,7 @@ - + diff --git a/templates/import_entry.tpl b/templates/import_entry.tpl index fd4854b..63a0c25 100644 --- a/templates/import_entry.tpl +++ b/templates/import_entry.tpl @@ -1,5 +1,5 @@ - + diff --git a/templates/list_filter.tpl b/templates/list_filter.tpl index e5c2ab5..7f2d1c6 100644 --- a/templates/list_filter.tpl +++ b/templates/list_filter.tpl @@ -53,7 +53,7 @@ {/if}
-
+ {$lang.msg_uploadvcf}:
diff --git a/templates/importVCF_entry.tpl b/templates/importVCF_entry.tpl index b2361ad..69f763a 100644 --- a/templates/importVCF_entry.tpl +++ b/templates/importVCF_entry.tpl @@ -1,5 +1,5 @@
{$entry.name}, {$entry.givenname}
{$entry.name}, {$entry.givenname} - + diff --git a/templates/login.tpl b/templates/login.tpl index d4196f6..3875971 100644 --- a/templates/login.tpl +++ b/templates/login.tpl @@ -1,6 +1,6 @@


-
+ -- 2.39.5
{$msg}