lib/kolab_recipient_policy.php

Aleksander Machniak machniak at kolabsys.com
Sun Apr 7 17:43:03 CEST 2013


 lib/kolab_recipient_policy.php |   22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

New commits:
commit 97fdcc8f69e76afb149092c655fcf004d573eccf
Author: Aleksander Machniak <alec at alec.pl>
Date:   Sun Apr 7 17:42:34 2013 +0200

    Fix transliterate/cleanup related issues

diff --git a/lib/kolab_recipient_policy.php b/lib/kolab_recipient_policy.php
index e04ab8a..a59903f 100644
--- a/lib/kolab_recipient_policy.php
+++ b/lib/kolab_recipient_policy.php
@@ -59,10 +59,10 @@ class kolab_recipient_policy {
                 $result = iconv('UTF-8', 'ASCII//TRANSLIT', $groupdata[$key]);
 
                 if (strpos($result, '?')) {
-                    $groupdata[$key] = self::transliterate($groupdata[$key], $locale);
-                } else {
-                    $groupdata[$key] = preg_replace('/[^a-z0-9-_]/i', '', $result);
+                    $result = self::transliterate($groupdata[$key], $locale);
                 }
+
+                $groupdata[$key] = preg_replace('/[^a-z0-9-_]/i', '', $result);
             }
         }
 
@@ -105,11 +105,11 @@ class kolab_recipient_policy {
 
                 $result = iconv('UTF-8', 'ASCII//TRANSLIT', $userdata[$key]);
 
-                if (!strstr($result, '?') && !empty($result)) {
-                    $userdata[$_key] = preg_replace('/[^a-z0-9-_]/i', '', $result);
-                } else {
-                    $userdata[$_key] = self::transliterate($userdata[$key], $locale);
+                if (strstr($result, '?')) {
+                    $result = self::transliterate($userdata[$key], $locale);
                 }
+
+                $userdata[$_key] = preg_replace('/[^a-z0-9-_]/i', '', $result);
             }
         }
 
@@ -360,11 +360,11 @@ class kolab_recipient_policy {
                     ),
             );
 
-        $translit = $translit_map[$locale_translit_map[$locale]];
-
-        $result = strtr($mystring, $translit);
+        if ($translit = $translit_map[$locale_translit_map[$locale]]) {
+            $mystring = strtr($mystring, $translit);
+        }
 
-        return $result;
+        return $mystring;
     }
 
     static public function uid($userdata) {





More information about the commits mailing list