Browse Source

"Marc Groot Koerkamp" <marc@its-projects.nl> patch for greek enconding.

philippe_mingo 23 years ago
parent
commit
76b37919d6
4 changed files with 25 additions and 34 deletions
  1. 4 13
      functions/i18n.php
  2. 5 5
      functions/imap_messages.php
  3. 2 2
      functions/imap_search.php
  4. 14 14
      functions/mailbox_display.php

+ 4 - 13
functions/i18n.php

@@ -435,11 +435,8 @@ function charset_decode_iso_8859_7 ($string) {
      * ISO-8859-7 characters from 11/04 (0xB4) to 11/06 (0xB6)
      * These are Unicode 900-902
      */
-    while (ereg("([\264-\266])", $string, $res)) {
-        $replace = '&#' . (ord($res[1])+720) . ';';
-        $string = str_replace($res[1], $replace, $string);
-    }
-
+    $string = preg_replace("/([\264-\266])/","'&#' . (ord(\\1)+720)",$string);
+    
     /* 11/07 (0xB7) Middle dot is the same in iso-8859-1 */
     $string = str_replace("\267", '&#183;', $string);
 
@@ -447,10 +444,7 @@ function charset_decode_iso_8859_7 ($string) {
      * ISO-8859-7 characters from 11/08 (0xB8) to 11/10 (0xBA)
      * These are Unicode 900-902
      */
-    while (ereg("([\270-\272])", $string, $res)) {
-        $replace = '&#' . (ord($res[1])+720) . ";";
-        $string = str_replace($res[1], $replace, $string);
-    }
+    $string = preg_replace("/([\270-\272])/","'&#' . (ord(\\1)+720)",$string);
 
     /*
      * 11/11 (0xBB) Right angle quotation mark is the same as in
@@ -459,10 +453,7 @@ function charset_decode_iso_8859_7 ($string) {
     $string = str_replace("\273", '&#187;', $string);
 
     /* And now the rest of the charset */
-    while (ereg("([\274-\376])", $string, $res)) {
-        $replace = '&#' . (ord($res[1])+720) . ';';
-        $string = str_replace($res[1], $replace, $string);
-    }
+    $string = preg_replace("/([\274-\376])/","'&#' . (ord(\\1)+720)",$string);
 
     return $string;
 }

+ 5 - 5
functions/imap_messages.php

@@ -264,11 +264,11 @@ function sqimap_get_flags_list ($imap_stream, $msg_list) {
             $result_flags[$id2index[$regs[1]]] = explode(" ", trim(ereg_replace('[\\(\\)\\\\]', '', $regs[2])));
         } else {
             set_up_language($squirrelmail_language);
-            echo "<br><b><font color=$color[2]>\n";
-            echo _("ERROR : Could not complete request.");
-            echo "</b><br>\n";
-            echo _("Unknown response from IMAP server: ");
-            echo $result_list[$i][0] . "</font><br>\n";
+            echo "<br><b><font color=$color[2]>\n" .
+                 _("ERROR : Could not complete request.") .
+                 "</b><br>\n" .
+                 _("Unknown response from IMAP server: ") .
+                 $result_list[$i][0] . "</font><br>\n";
             exit;
         }
     }

+ 2 - 2
functions/imap_search.php

@@ -19,8 +19,8 @@ require_once('../functions/mime.php');
 
 function sqimap_search($imapConnection,$search_where,$search_what,$mailbox,$color, $search_position = '', $search_all, $count_all) {
 
-    global $msgs, $message_highlight_list, $squirrelmail_language, $languages, $index_order;
-    global $pos;
+    global $msgs, $message_highlight_list, $squirrelmail_language, $languages, $index_order,
+           $pos;
 
     $pos = $search_position;
 

+ 14 - 14
functions/mailbox_display.php

@@ -194,13 +194,12 @@ function printMessageInfo($imapConnection, $t, $i, $key, $mailbox, $sort, $start
  * This function loops through a group of messages in the mailbox
  * and shows them to the user.
  */
-function showMessagesForMailbox
-($imapConnection, $mailbox, $num_msgs, $start_msg, $sort,
- $color, $show_num, $use_cache) {
-    global $msgs, $msort;
-    global $sent_folder, $draft_folder;
-    global $message_highlight_list;
-    global $auto_expunge;
+function showMessagesForMailbox($imapConnection, $mailbox, $num_msgs, $start_msg, $sort,
+                                $color, $show_num, $use_cache) {
+    global $msgs, $msort,
+           $sent_folder, $draft_folder,
+           $message_highlight_list,
+           $auto_expunge;
 
     /* If autoexpunge is turned on, then do it now. */
     if ($auto_expunge == true) {
@@ -347,21 +346,22 @@ function showMessagesForMailbox
         ** 2 = Name (up)
         ** 3 = Name (dn)
         **/
-        session_unregister("msgs");
-        if (($sort == 0) || ($sort == 1))
+        session_unregister('msgs');
+        if (($sort == 0) || ($sort == 1)) {
             $msort = array_cleave ($msgs, 'TIME_STAMP');
-        elseif (($sort == 2) || ($sort == 3))
+        } elseif (($sort == 2) || ($sort == 3)) {
             $msort = array_cleave ($msgs, 'FROM-SORT');
-        elseif (($sort == 4) || ($sort == 5))
+        } elseif (($sort == 4) || ($sort == 5)) {
             $msort = array_cleave ($msgs, 'SUBJECT-SORT');
-        else // ($sort == 6)
+        } else // ($sort == 6) {
             $msort = $msgs;
+        }
 
         if ($sort < 6) {
             if ($sort % 2) {
-            asort($msort);
+                asort($msort);
             } else {
-            arsort($msort);
+                arsort($msort);
             }
         }
         session_register('msort');