From fb6d86b9ad851ee72e79b5031fcaace71dfbe997 Mon Sep 17 00:00:00 2001 From: alecpl <alec@alec.pl> Date: Wed, 23 Nov 2011 13:05:38 -0500 Subject: [PATCH] - Fixed bug where similiar folder names were highlighted wrong (#1487860) --- program/include/main.inc | 25 +++++++++++++++---------- 1 files changed, 15 insertions(+), 10 deletions(-) diff --git a/program/include/main.inc b/program/include/main.inc index c84e5ad..0025018 100644 --- a/program/include/main.inc +++ b/program/include/main.inc @@ -730,12 +730,14 @@ /** * Convert the given string into a valid HTML identifier - * Same functionality as done in app.js with this.identifier_expr - * + * Same functionality as done in app.js with rcube_webmail.html_identifier() */ -function html_identifier($str) +function html_identifier($str, $encode=false) { - return asciiwords($str, true, '_'); + if ($encode) + return rtrim(strtr(base64_encode($str), '+/', '-_'), '='); + else + return asciiwords($str, true, '_'); } /** @@ -1331,7 +1333,7 @@ } // make folder name safe for ids and class names - $folder_id = html_identifier($folder['id']); + $folder_id = html_identifier($folder['id'], true); $classes = array('mailbox'); // set special class for Sent, Drafts, Trash and Junk @@ -1589,7 +1591,7 @@ */ function rcube_html_editor($mode='') { - global $RCMAIL, $CONFIG; + global $RCMAIL; $hook = $RCMAIL->plugins->exec_hook('html_editor', array('mode' => $mode)); @@ -1598,8 +1600,11 @@ $lang = strtolower($_SESSION['language']); - // TinyMCE uses 'tw' for zh_TW (which is wrong, because tw is a code of Twi language) - $lang = ($lang == 'zh_tw') ? 'tw' : substr($lang, 0, 2); + // TinyMCE uses two-letter lang codes, with exception of Chinese + if (strpos($lang, 'zh_') === 0) + $lang = str_replace('_', '-', $lang); + else + $lang = substr($lang, 0, 2); if (!file_exists(INSTALL_PATH . 'program/js/tiny_mce/langs/'.$lang.'.js')) $lang = 'en'; @@ -1611,8 +1616,8 @@ 'mode' => $mode, 'skin_path' => '$__skin_path', 'lang' => $lang, - 'spellcheck' => intval($CONFIG['enable_spellcheck']), - 'spelldict' => intval($CONFIG['spellcheck_dictionary']), + 'spellcheck' => intval($RCMAIL->config->get('enable_spellcheck')), + 'spelldict' => intval($RCMAIL->config->get('spellcheck_dictionary')), ))), 'foot'); } -- Gitblit v1.9.1