diff options
Diffstat (limited to 'program')
-rw-r--r-- | program/include/main.inc | 27 | ||||
-rw-r--r-- | program/include/rcube_imap.inc | 8 | ||||
-rw-r--r-- | program/include/rcube_shared.inc | 19 | ||||
-rw-r--r-- | program/js/app.js | 11 | ||||
-rw-r--r-- | program/lib/imap.inc | 4 | ||||
-rw-r--r-- | program/localization/index.inc | 59 |
6 files changed, 117 insertions, 11 deletions
diff --git a/program/include/main.inc b/program/include/main.inc index 1c413bb80..5eabf755d 100644 --- a/program/include/main.inc +++ b/program/include/main.inc @@ -423,6 +423,33 @@ function rcube_remote_response($js_code) } +// read directory program/localization/ and return a list of available languages +function rcube_list_languages() + { + global $CONFIG, $INSTALL_PATH; + static $sa_languages = array(); + + if (!sizeof($sa_languages)) + { + @include_once($INSTLL_PATH.'program/localization/index.inc'); + + if ($dh = @opendir($INSTLL_PATH.'program/localization')) + { + while (($name = readdir($dh)) !== false) + { + if ($name{0}=='.' || !is_dir($INSTLL_PATH.'program/localization/'.$name)) + continue; + + if ($label = $rcube_languages[$name]) + $sa_languages[$name] = $label ? $label : $name; + } + closedir($dh); + } + } + + return $sa_languages; + } + // ************** template parsing and gui functions ************** diff --git a/program/include/rcube_imap.inc b/program/include/rcube_imap.inc index 24cd94a52..4c707e3bb 100644 --- a/program/include/rcube_imap.inc +++ b/program/include/rcube_imap.inc @@ -268,7 +268,7 @@ class rcube_imap else $count = iil_C_CountMessages($this->conn, $mailbox); -//print "/**** get messagecount for $mailbox ($mode): $count ****/\n"; +// print "/**** get messagecount for $mailbox ($mode): $count ****/\n"; if (is_array($a_mailbox_cache[$mailbox])) $a_mailbox_cache[$mailbox] = array(); @@ -312,8 +312,8 @@ class rcube_imap $a_header_index = iil_C_FetchHeaders($this->conn, $mailbox, "1:$max"); $a_msg_headers = array(); foreach ($a_header_index as $i => $headers) - if (!$headers->deleted) - $a_msg_headers[$headers->uid] = $headers; + if (!$headers->deleted) + $a_msg_headers[$headers->uid] = $headers; // print "/**** fetch headers ****/\n"; } @@ -445,7 +445,7 @@ class rcube_imap $cache_key = $this->mailbox.'.msg'; if ($this->caching_enabled && $result && ($a_cached_headers = $this->get_cache($cache_key))) { - // close and re-open connection + // close and re-open connection $this->reconnect(); foreach ($uids as $uid) diff --git a/program/include/rcube_shared.inc b/program/include/rcube_shared.inc index 21c3ae8b4..693a2c860 100644 --- a/program/include/rcube_shared.inc +++ b/program/include/rcube_shared.inc @@ -1109,6 +1109,9 @@ function rcube_label($attrib) if ($text=='') $text = $a_text_item['single']; + // perform utf-8 decoding + //if (function_exists('utf8_decode')) + // $text = utf8_decode($text); // replace vars in text if (is_array($attrib['vars'])) @@ -1414,4 +1417,20 @@ function make_absolute_url($path, $base_url) +function abbrevate_string($str, $maxlength, $place_holder='...') + { + $length = strlen($str); + $first_part_length = floor($maxlength/2) - strlen($place_holder); + + if ($length > $maxlength) + { + $second_starting_location = $length - $maxlength + $first_part_length + 1; + $str = substr($str, 0, $first_part_length) . $place_holder . substr($str, $second_starting_location, $length); + } + + return $str; + } + + + ?>
\ No newline at end of file diff --git a/program/js/app.js b/program/js/app.js index fb0c4556d..18ce6748d 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -1,4 +1,4 @@ -/* +/* +-----------------------------------------------------------------------+ | RoundCube Webmail Client Script | | | @@ -1006,6 +1006,7 @@ function rcube_webmail() if (!page && mbox != this.env.mailbox) { page = 1; + add_url += '&_refresh=1'; this.env.current_page = page; this.clear_selection(); } @@ -1016,14 +1017,14 @@ function rcube_webmail() // load message list remotely if (this.gui_objects.messagelist) { - this.list_mailbox_remote(mbox, page); + this.list_mailbox_remote(mbox, page, add_url); return; } if (this.env.contentframe && window.frames && window.frames[this.env.contentframe]) { target = window.frames[this.env.contentframe]; - add_url = '&_framed=1'; + add_url += '&_framed=1'; } // load message list to target frame/window @@ -1036,7 +1037,7 @@ function rcube_webmail() // send remote request to load message list - this.list_mailbox_remote = function(mbox, page) + this.list_mailbox_remote = function(mbox, page, add_url) { // clear message list var table = this.gui_objects.messagelist; @@ -1050,7 +1051,7 @@ function rcube_webmail() // send request to server var url = '_mbox='+escape(mbox)+(page ? '&_page='+page : ''); this.set_busy(true, 'loading'); - this.http_request('list', url); + this.http_request('list', url+add_url); }; diff --git a/program/lib/imap.inc b/program/lib/imap.inc index 7d225c6f1..22757ba82 100644 --- a/program/lib/imap.inc +++ b/program/lib/imap.inc @@ -325,7 +325,7 @@ function iil_Connect($host, $user, $password){ } //open socket connection - $conn->fp = @fsockopen($host, $ICL_PORT, &$errno, &$errstr, 10); + $conn->fp = @fsockopen($host, $ICL_PORT, $errno, $errstr, 10); if (!$conn->fp){ $iil_error = "Could not connect to $host at port $ICL_PORT: $errstr"; $iil_errornum = -1; @@ -1388,7 +1388,7 @@ function iil_SortHeaders($a, $field, $flag){ $result=array(); reset($index); while (list($key, $val)=each($index)){ - $result[$i]=$a[$key]; + $result[$key]=$a[$key]; $i++; } } diff --git a/program/localization/index.inc b/program/localization/index.inc new file mode 100644 index 000000000..94b07b999 --- /dev/null +++ b/program/localization/index.inc @@ -0,0 +1,59 @@ +<?php + +/* + +-----------------------------------------------------------------------+ + | program/localization/index.inc | + | | + | This file is part of the RoundCube Webmail client | + | Copyright (C) 2005, RoundCube Dev, - Switzerland | + | Licensed under the GNU GPL | + | | + | PURPOSE: | + | Provide centralized location for keeping track of | + | available languages | + | | + +-----------------------------------------------------------------------+ + | Author: Thomas Bruederli <roundcube@gmail.com> | + +-----------------------------------------------------------------------+ + + $Id$ + + */ + + $rcube_languages = array( + 'en' => 'English (US)', + 'en_GB' => 'English (GB)', + 'ar' => 'Arabic', + 'bg' => 'Bulgarian', + 'cat' => 'Catalan', + 'tw' => 'Chinese (BIG5)', + 'cn' => 'Chinese(GB2312)', + 'cz' => 'Czech', + 'ca' => 'Catalan', + 'da' => 'Dansk', + 'de' => 'Deutsch', + 'es' => 'Español', + 'fr' => 'Français', + 'ga' => 'Galician', + 'el' => 'Greek', + 'hu' => 'Hungarian', + 'it' => 'Italiano', + 'jp' => 'Japanese', + 'kr' => 'Korean', + 'lt' => 'Lithuanian', + 'nl' => 'Nederlands', + 'no' => 'Norsk (bokmål)', + 'fa' => 'Persian', + 'pl' => 'Polski', + 'pt' => 'Portuguese (Standard)', + 'pt_BR' => 'Portuguese (Brazilian)', + 'ro' => 'Romanian', + 'ru' => 'Russian', + 'fi' => 'Suomi', + 'se' => 'Svenska', + 'si' => 'Slovenian', + 'tr' => 'Turkish', + 'vn' => 'Vietnamese' +); + +?>
\ No newline at end of file |