Changeset 4d4264c in github
- Timestamp:
- Aug 10, 2006 3:07:43 AM (7 years ago)
- Branches:
- master, HEAD, courier-fix, dev-browser-capabilities, pdo, release-0.6, release-0.7, release-0.8
- Children:
- a06be98
- Parents:
- c0e9128
- Files:
-
- 7 edited
-
CHANGELOG (modified) (1 diff)
-
program/include/main.inc (modified) (2 diffs)
-
program/include/rcube_imap.inc (modified) (8 diffs)
-
program/js/app.js (modified) (32 diffs)
-
program/js/common.js (modified) (1 diff)
-
program/steps/mail/search.inc (modified) (1 diff)
-
program/steps/settings/manage_folders.inc (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
CHANGELOG
rfa4cd20 r4d4264c 1 1 CHANGELOG RoundCube Webmail 2 2 --------------------------- 3 4 2006/08/10 (thomasb) 5 ---------- 6 - Fixed charset problems with folder renaming 7 3 8 4 9 2006/08/04 (thomasb) -
program/include/main.inc
raade7b9 r4d4264c 910 910 if ($from=='UTF-7') 911 911 $str = rcube_charset_convert(UTF7DecodeString($str), 'ISO-8859-1'); 912 else if ( $from=='ISO-8859-1'&& function_exists('utf8_encode'))912 else if (($from=='ISO-8859-1') && function_exists('utf8_encode')) 913 913 $str = utf8_encode($str); 914 914 else if ($from!='UTF-8') … … 920 920 // encode string for output 921 921 if ($to=='UTF-7') 922 return UTF7EncodeString( $str);922 return UTF7EncodeString(rcube_charset_convert($str, 'UTF-8', 'ISO-8859-1')); 923 923 else if ($to=='ISO-8859-1' && function_exists('utf8_decode')) 924 924 return utf8_decode($str); -
program/include/rcube_imap.inc
r42000a5 r4d4264c 27 27 require_once('lib/imap.inc'); 28 28 require_once('lib/mime.inc'); 29 require_once('lib/utf7.inc');30 29 31 30 … … 836 835 $results = $this->_search_index($mailbox, $search); 837 836 838 // try search with out charset (probably notsupported by server)839 if (empty($results) )840 $results = $this-> _search_index($mailbox, "$criteria $str");837 // try search with ISO charset (should be supported by server) 838 if (empty($results) && !empty($charset) && $charset!='ISO-8859-1') 839 $results = $this->search($mbox_name, $criteria, rcube_charset_convert($str, $charset, 'ISO-8859-1'), 'ISO-8859-1'); 841 840 842 841 return $results; … … 1232 1231 1233 1232 /** 1234 * create a new mailbox on the server and register it in local cache 1233 * Create a new mailbox on the server and register it in local cache 1234 * 1235 * @param string New mailbox name (as utf-7 string) 1236 * @param boolean True if the new mailbox should be subscribed 1237 * @param string Name of the created mailbox, false on error 1235 1238 */ 1236 1239 function create_mailbox($name, $subscribe=FALSE) … … 1241 1244 $name = preg_replace('/[\\\]+/', '-', $name); 1242 1245 1243 $name_enc = UTF7EncodeString($name);1244 1245 1246 // reduce mailbox name to 100 chars 1246 $name _enc = substr($name_enc, 0, 100);1247 1248 $abs_name = $this->_mod_mailbox($name _enc);1247 $name = substr($name, 0, 100); 1248 1249 $abs_name = $this->_mod_mailbox($name); 1249 1250 $a_mailbox_cache = $this->get_cache('mailboxes'); 1250 1251 … … 1254 1255 // try to subscribe it 1255 1256 if ($subscribe) 1256 $this->subscribe($name _enc);1257 $this->subscribe($name); 1257 1258 1258 1259 return $result ? $name : FALSE; … … 1261 1262 1262 1263 /** 1263 * set a new name to an existing mailbox 1264 * Set a new name to an existing mailbox 1265 * 1266 * @param string Mailbox to rename (as utf-7 string) 1267 * @param string New mailbox name (as utf-7 string) 1268 * @param string Name of the renames mailbox, false on error 1264 1269 */ 1265 1270 function rename_mailbox($mbox_name, $new_name) … … 1271 1276 1272 1277 // encode mailbox name and reduce it to 100 chars 1273 $name _enc = substr(UTF7EncodeString($new_name), 0, 100);1278 $name = substr($new_name, 0, 100); 1274 1279 1275 1280 // make absolute path 1276 1281 $mailbox = $this->_mod_mailbox($mbox_name); 1277 $abs_name = $this->_mod_mailbox($name _enc);1278 1282 $abs_name = $this->_mod_mailbox($name); 1283 1279 1284 if (strlen($abs_name)) 1280 1285 $result = iil_C_RenameFolder($this->conn, $mailbox, $abs_name); 1281 1286 1282 1287 // clear cache 1283 1288 if ($result) … … 1286 1291 $this->clear_cache('mailboxes'); 1287 1292 } 1293 1294 // try to subscribe it 1295 $this->subscribe($name); 1288 1296 1289 1297 return $result ? $name : FALSE; -
program/js/app.js
raade7b9 r4d4264c 712 712 { 713 713 this.set_busy(true); 714 location.href = this.env.comm_path+'&_action=compose&_draft_uid='+uid+'&_mbox='+ escape(this.env.mailbox);714 location.href = this.env.comm_path+'&_action=compose&_draft_uid='+uid+'&_mbox='+urlencode(this.env.mailbox); 715 715 } 716 716 else … … 881 881 var uid; 882 882 if (uid = this.get_single_uid()) 883 url += '&_draft_uid='+uid+'&_mbox='+ escape(this.env.mailbox);883 url += '&_draft_uid='+uid+'&_mbox='+urlencode(this.env.mailbox); 884 884 } 885 885 // modify url if we're in addressbook … … 993 993 { 994 994 this.set_busy(true); 995 location.href = this.env.comm_path+'&_action=compose&_reply_uid='+uid+'&_mbox='+ escape(this.env.mailbox)+(command=='reply-all' ? '&_all=1' : '');995 location.href = this.env.comm_path+'&_action=compose&_reply_uid='+uid+'&_mbox='+urlencode(this.env.mailbox)+(command=='reply-all' ? '&_all=1' : ''); 996 996 } 997 997 break; … … 1002 1002 { 1003 1003 this.set_busy(true); 1004 location.href = this.env.comm_path+'&_action=compose&_forward_uid='+uid+'&_mbox='+ escape(this.env.mailbox);1004 location.href = this.env.comm_path+'&_action=compose&_forward_uid='+uid+'&_mbox='+urlencode(this.env.mailbox); 1005 1005 } 1006 1006 break; … … 1010 1010 if (uid = this.get_single_uid()) 1011 1011 { 1012 this.printwin = window.open(this.env.comm_path+'&_action=print&_uid='+uid+'&_mbox='+ escape(this.env.mailbox)+(this.env.safemode ? '&_safe=1' : ''));1012 this.printwin = window.open(this.env.comm_path+'&_action=print&_uid='+uid+'&_mbox='+urlencode(this.env.mailbox)+(this.env.safemode ? '&_safe=1' : '')); 1013 1013 if (this.printwin) 1014 1014 setTimeout(this.ref+'.printwin.focus()', 20); … … 1020 1020 if (uid = this.get_single_uid()) 1021 1021 { 1022 this.sourcewin = window.open(this.env.comm_path+'&_action=viewsource&_uid='+this.env.uid+'&_mbox='+ escape(this.env.mailbox));1022 this.sourcewin = window.open(this.env.comm_path+'&_action=viewsource&_uid='+this.env.uid+'&_mbox='+urlencode(this.env.mailbox)); 1023 1023 if (this.sourcewin) 1024 1024 setTimeout(this.ref+'.sourcewin.focus()', 20); … … 1035 1035 props = this.gui_objects.qsearchbox.value; 1036 1036 if (props) 1037 this.qsearch( escape(props), this.env.mailbox);1037 this.qsearch(urlencode(props), this.env.mailbox); 1038 1038 break; 1039 1039 … … 1262 1262 { 1263 1263 this.set_busy(true); 1264 location.href = this.env.comm_path+'&_action=compose&_draft_uid='+id+'&_mbox='+ escape(this.env.mailbox);1264 location.href = this.env.comm_path+'&_action=compose&_draft_uid='+id+'&_mbox='+urlencode(this.env.mailbox); 1265 1265 } 1266 1266 else … … 1522 1522 { 1523 1523 this.set_busy(true, 'loading'); 1524 target.location.href = this.env.comm_path+'&_action=show&_uid='+id+'&_mbox='+ escape(this.env.mailbox)+add_url;1524 target.location.href = this.env.comm_path+'&_action=show&_uid='+id+'&_mbox='+urlencode(this.env.mailbox)+add_url; 1525 1525 } 1526 1526 }; … … 1594 1594 { 1595 1595 this.set_busy(true, 'loading'); 1596 target.location.href = this.env.comm_path+'&_mbox='+ escape(mbox)+(page ? '&_page='+page : '')+add_url;1596 target.location.href = this.env.comm_path+'&_mbox='+urlencode(mbox)+(page ? '&_page='+page : '')+add_url; 1597 1597 } 1598 1598 }; … … 1606 1606 1607 1607 // send request to server 1608 var url = '_mbox='+ escape(mbox)+(page ? '&_page='+page : '');1608 var url = '_mbox='+urlencode(mbox)+(page ? '&_page='+page : ''); 1609 1609 this.set_busy(true, 'loading'); 1610 1610 this.http_request('list', url+add_url, true); … … 1658 1658 1659 1659 // send request to server 1660 var url = '_mbox='+ escape(mbox);1660 var url = '_mbox='+urlencode(mbox); 1661 1661 this.http_request('expunge', url+add_url, lock); 1662 1662 }; … … 1680 1680 1681 1681 // send request to server 1682 var url = '_mbox='+ escape(mbox);1682 var url = '_mbox='+urlencode(mbox); 1683 1683 this.http_request('purge', url+add_url, lock); 1684 1684 return true; … … 1737 1737 } 1738 1738 // send request to server 1739 this.http_request('moveto', '_uid='+a_uids.join(',')+'&_mbox='+ escape(this.env.mailbox)+'&_target_mbox='+escape(mbox)+'&_from='+(this.env.action ? this.env.action : ''), lock);1739 this.http_request('moveto', '_uid='+a_uids.join(',')+'&_mbox='+urlencode(this.env.mailbox)+'&_target_mbox='+urlencode(mbox)+'&_from='+(this.env.action ? this.env.action : ''), lock); 1740 1740 }; 1741 1741 … … 1768 1768 1769 1769 // send request to server 1770 this.http_request('delete', '_uid='+a_uids.join(',')+'&_mbox='+ escape(this.env.mailbox)+'&_from='+(this.env.action ? this.env.action : ''));1770 this.http_request('delete', '_uid='+a_uids.join(',')+'&_mbox='+urlencode(this.env.mailbox)+'&_from='+(this.env.action ? this.env.action : '')); 1771 1771 } 1772 1772 … … 2210 2210 { 2211 2211 if (name) 2212 this.http_request('remove-attachment', '_file='+ escape(name));2212 this.http_request('remove-attachment', '_file='+urlencode(name)); 2213 2213 2214 2214 return true; … … 2723 2723 2724 2724 if (name) 2725 this.http_request('create-folder', '_name='+ escape(name), true);2725 this.http_request('create-folder', '_name='+urlencode(name), true); 2726 2726 else if (form.elements['_folder_name']) 2727 2727 form.elements['_folder_name'].focus(); … … 2746 2746 2747 2747 if (oldname && newname) 2748 this.http_request('rename-folder', '_folder_oldname='+ escape(oldname)+'&_folder_newname='+escape(newname));2748 this.http_request('rename-folder', '_folder_oldname='+urlencode(oldname)+'&_folder_newname='+urlencode(newname)); 2749 2749 }; 2750 2750 … … 2768 2768 { 2769 2769 this.name_input = document.createElement('INPUT'); 2770 this.name_input.value = this.env.subscriptionrows[id] ;2770 this.name_input.value = this.env.subscriptionrows[id][1]; 2771 2771 this.name_input.style.width = '100%'; 2772 2772 this.name_input.onkeypress = function(e){ rcmail.name_input_keypress(e); }; … … 2787 2787 var cell = this.name_input ? this.name_input.parentNode : null; 2788 2788 if (cell && this.edit_folder) 2789 cell.innerHTML = this.env.subscriptionrows[this.edit_folder] ;2789 cell.innerHTML = this.env.subscriptionrows[this.edit_folder][1]; 2790 2790 2791 2791 this.edit_folder = null; … … 2803 2803 var newname = this.name_input ? this.name_input.value : null; 2804 2804 if (this.edit_folder && newname) 2805 this.http_request('rename-folder', '_folder_oldname='+ escape(this.env.subscriptionrows[this.edit_folder])+'&_folder_newname='+escape(newname));2805 this.http_request('rename-folder', '_folder_oldname='+urlencode(this.env.subscriptionrows[this.edit_folder][0])+'&_folder_newname='+urlencode(newname)); 2806 2806 } 2807 2807 // escape … … 2818 2818 2819 2819 if (folder) 2820 this.http_request('delete-folder', '_mboxes='+ escape(folder));2820 this.http_request('delete-folder', '_mboxes='+urlencode(folder)); 2821 2821 }; 2822 2822 2823 2823 2824 2824 // add a new folder to the subscription list by cloning a folder row 2825 this.add_folder_row = function(name, replace)2825 this.add_folder_row = function(name, display_name, replace) 2826 2826 { 2827 2827 name = name.replace('\\',""); … … 2854 2854 2855 2855 // add to folder/row-ID map 2856 this.env.subscriptionrows[row.id] = name;2856 this.env.subscriptionrows[row.id] = [name, display_name]; 2857 2857 2858 2858 // set folder name 2859 row.cells[0].innerHTML = name;2859 row.cells[0].innerHTML = display_name; 2860 2860 if (row.cells[1] && row.cells[1].firstChild.tagName=='INPUT') 2861 2861 { … … 2882 2882 2883 2883 // replace an existing table row with a new folder line 2884 this.replace_folder_row = function( newfolder, oldfolder)2884 this.replace_folder_row = function(oldfolder, newfolder, display_name) 2885 2885 { 2886 2886 var id = this.get_folder_row_id(oldfolder); … … 2888 2888 2889 2889 // replace an existing table row (if found) 2890 this.add_folder_row(newfolder, row);2890 this.add_folder_row(newfolder, display_name, row); 2891 2891 this.env.subscriptionrows[id] = null; 2892 2892 … … 2899 2899 if (elm.options[i].value == oldfolder) 2900 2900 { 2901 elm.options[i].text = newfolder;2901 elm.options[i].text = display_name; 2902 2902 elm.options[i].value = newfolder; 2903 2903 break; … … 2944 2944 this.change_subscription('_unsubscribed', '_subscribed', 'subscribe'); 2945 2945 else if (folder) 2946 this.http_request('subscribe', '_mboxes='+ escape(folder));2946 this.http_request('subscribe', '_mboxes='+urlencode(folder)); 2947 2947 }; 2948 2948 … … 2954 2954 this.change_subscription('_subscribed', '_unsubscribed', 'unsubscribe'); 2955 2955 else if (folder) 2956 this.http_request('unsubscribe', '_mboxes='+ escape(folder));2956 this.http_request('unsubscribe', '_mboxes='+urlencode(folder)); 2957 2957 }; 2958 2958 … … 2988 2988 } 2989 2989 2990 this.http_request(action, '_mboxes='+ escape(a_folders.join(',')));2990 this.http_request(action, '_mboxes='+urlencode(a_folders.join(','))); 2991 2991 } 2992 2992 } … … 2998 2998 { 2999 2999 for (var id in this.env.subscriptionrows) 3000 if (this.env.subscriptionrows[id] ==folder)3000 if (this.env.subscriptionrows[id] && this.env.subscriptionrows[id][0] == folder) 3001 3001 break; 3002 3002 … … 3523 3523 if (request_obj) 3524 3524 { 3525 // prompt('request', this.env.comm_path+'&_action='+ escape(action)+'&'+querystring);3526 console('HTTP request: '+this.env.comm_path+'&_action='+ escape(action)+'&'+querystring);3525 // prompt('request', this.env.comm_path+'&_action='+urlencode(action)+'&'+querystring); 3526 console('HTTP request: '+this.env.comm_path+'&_action='+action+'&'+querystring); 3527 3527 3528 3528 if (lock) … … 3533 3533 request_obj.onerror = function(o){ rcube_webmail_client.http_error(o); }; 3534 3534 request_obj.oncomplete = function(o){ rcube_webmail_client.http_response(o); }; 3535 request_obj.GET(this.env.comm_path+'&_action='+ escape(action)+'&'+querystring);3535 request_obj.GET(this.env.comm_path+'&_action='+action+'&'+querystring); 3536 3536 } 3537 3537 }; -
program/js/common.js
r2c57622 r4d4264c 344 344 345 345 346 // make a string URL safe 347 function urlencode(str) 348 { 349 return window.encodeURI ? encodeURI(str).replace(/&/g, '%26') : escape(str); 350 } 351 352 346 353 // get any type of html objects by id/name 347 354 function rcube_find_object(id, d) -
program/steps/mail/search.inc
r42000a5 r4d4264c 20 20 $_SESSION['page'] = 1; 21 21 22 // search query comes in with ISO encoding because javascript escape()23 // uses ISO-8859-1. Better handling for that will follow.24 $imap_charset = ' ISO-8859-1';22 // using encodeURI with javascript "should" give us 23 // a correctly UTF-8 encoded query string 24 $imap_charset = 'UTF-8'; 25 25 26 26 // get search string -
program/steps/settings/manage_folders.inc
rf9c107a r4d4264c 48 48 { 49 49 if (!empty($_GET['_name'])) 50 $create = $IMAP->create_mailbox(trim(get_input_value('_name', RCUBE_INPUT_GET )), TRUE);50 $create = $IMAP->create_mailbox(trim(get_input_value('_name', RCUBE_INPUT_GET, FALSE, 'UTF-7')), TRUE); 51 51 52 52 if ($create && $REMOTE_REQUEST) 53 53 { 54 $commands = sprintf("this.add_folder_row('%s')", rep_specialchars_output($create, 'js')); 54 $commands = sprintf("this.add_folder_row('%s','%s')", 55 rep_specialchars_output($create, 'js'), 56 rep_specialchars_output(rcube_charset_convert($create, 'UTF-7'), 'js')); 55 57 rcube_remote_response($commands); 56 58 } … … 68 70 { 69 71 if (!empty($_GET['_folder_oldname']) && !empty($_GET['_folder_newname'])) 70 $rename = $IMAP->rename_mailbox(get_input_value('_folder_oldname', RCUBE_INPUT_GET), trim(get_input_value('_folder_newname', RCUBE_INPUT_GET )));71 72 $rename = $IMAP->rename_mailbox(get_input_value('_folder_oldname', RCUBE_INPUT_GET), trim(get_input_value('_folder_newname', RCUBE_INPUT_GET, FALSE, 'UTF-7'))); 73 72 74 if ($rename && $REMOTE_REQUEST) 73 75 { 74 $commands = sprintf("this.replace_folder_row('%s','%s');", 75 addslashes(rep_specialchars_output($rename, 'js')), 76 rep_specialchars_output($_GET['_folder_oldname'], 'js')); 76 $commands = sprintf("this.replace_folder_row('%s','%s','%s');", 77 rep_specialchars_output($_GET['_folder_oldname'], 'js'), 78 rep_specialchars_output($rename, 'js'), 79 rep_specialchars_output(rcube_charset_convert($rename, 'UTF-7'), 'js')); 80 77 81 rcube_remote_response($commands); 78 82 } … … 136 140 137 141 // get folders from server 142 $IMAP->clear_cache('mailboxes'); 143 138 144 $a_unsubscribed = $IMAP->list_unsubscribed(); 139 145 $a_subscribed = $IMAP->list_mailboxes(); … … 155 161 foreach ($a_unsubscribed as $i => $folder) 156 162 { 163 $subscribed = in_array($folder, $a_subscribed); 157 164 $protected = ($CONFIG['protect_default_folders'] == TRUE && in_array($folder,$CONFIG['default_imap_folders'])); 158 165 $zebra_class = $i%2 ? 'even' : 'odd'; 159 166 $folder_js = rep_specialchars_output($folder, 'js'); 167 $folder_js_enc = rep_specialchars_output(rcube_charset_convert($folder, 'UTF-7'), 'js'); 160 168 161 169 if (!$protected) 162 $a_js_folders['rcmrow'.($i+1)] = $folder_js;163 164 $out .= sprintf('<tr id="rcmrow%d" class="%s"><td>%s</td> <td>%s</td>',170 $a_js_folders['rcmrow'.($i+1)] = array($folder_js, $folder_js_enc); 171 172 $out .= sprintf('<tr id="rcmrow%d" class="%s"><td>%s</td>', 165 173 $i+1, 166 174 $zebra_class, 167 rep_specialchars_output(rcube_charset_convert($folder, 'UTF-7', 'UTF-8'), 'html', 'all'), 168 $checkbox_subscribe->show(in_array($folder, $a_subscribed)?$folder:'', array('value' => $folder, 'disabled' => $protected))); 175 rep_specialchars_output(rcube_charset_convert($folder, 'UTF-7'), 'html', 'all')); 176 177 if ($protected) 178 $out .= '<td> '.($subscribed ? '•' : '-').'</td>'; 179 else 180 $out .= '<td>'.$checkbox_subscribe->show($subscribed?$folder:'', array('value' => $folder)).'</td>'; 169 181 170 182 // add rename and delete buttons
Note: See TracChangeset
for help on using the changeset viewer.
