Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Several bugfixes; see CHANGELOG for details

  • Loading branch information...
commit fa4cd20fb14c087c80e6a9cde11df17d46e07566 1 parent c4e7e4f
Thomas B. thomascube authored
9 CHANGELOG
... ... @@ -1,6 +1,15 @@
1 1 CHANGELOG RoundCube Webmail
2 2 ---------------------------
3 3
  4 +2006/08/04 (thomasb)
  5 +----------
  6 +- Fixed Bug in saving identities (Ticket #1483915)
  7 +- Set folder name in window title (Bug #1483919)
  8 +- Don't add imap_root to INBOX path (Bug #1483816)
  9 +- Attempt to create default folders only after login
  10 +- Avoid usage of $CONFIG in rcube_imap class
  11 +
  12 +
4 13 2006/07/30 (thomasb)
5 14 ----------
6 15 - Alter links in HTML messages (Bug #1326402)
3  config/main.inc.php.dist
@@ -137,7 +137,8 @@ $rcmail_config['sent_mbox'] = 'Sent';
137 137 // leave blank if they should be deleted directly
138 138 $rcmail_config['trash_mbox'] = 'Trash';
139 139
140   -// display these folders separately in the mailbox list
  140 +// display these folders separately in the mailbox list.
  141 +// these folders will automatically be created if they do not exist
141 142 $rcmail_config['default_imap_folders'] = array('INBOX', 'Drafts', 'Sent', 'Junk', 'Trash');
142 143
143 144 // protect the default folders from renames, deletes, and subscription changes
10 program/include/main.inc
@@ -205,9 +205,6 @@ function rcmail_imap_init($connect=FALSE)
205 205 if ($CONFIG['enable_caching']===TRUE)
206 206 $IMAP->set_caching(TRUE);
207 207
208   - if (is_array($CONFIG['default_imap_folders']))
209   - $IMAP->set_default_mailboxes($CONFIG['default_imap_folders']);
210   -
211 208 // set pagesize from config
212 209 if (isset($CONFIG['pagesize']))
213 210 $IMAP->set_pagesize($CONFIG['pagesize']);
@@ -224,6 +221,9 @@ function rcmail_set_imap_prop()
224 221 if (!empty($CONFIG['imap_root']))
225 222 $IMAP->set_rootdir($CONFIG['imap_root']);
226 223
  224 + if (is_array($CONFIG['default_imap_folders']))
  225 + $IMAP->set_default_mailboxes($CONFIG['default_imap_folders']);
  226 +
227 227 if (!empty($_SESSION['mbox']))
228 228 $IMAP->set_mailbox($_SESSION['mbox']);
229 229 if (isset($_SESSION['page']))
@@ -510,8 +510,10 @@ function rcmail_login($user, $pass, $host=NULL)
510 510 $_SESSION['user_lang'] = $sess_user_lang;
511 511 $_SESSION['password'] = encrypt_passwd($pass);
512 512
513   - // force reloading complete list of subscribed mailboxes
  513 + // force reloading complete list of subscribed mailboxes
  514 + rcmail_set_imap_prop();
514 515 $IMAP->clear_cache('mailboxes');
  516 + $IMAP->create_default_folders();
515 517
516 518 return TRUE;
517 519 }
105 program/include/rcube_imap.inc
@@ -36,7 +36,7 @@ require_once('lib/utf7.inc');
36 36 *
37 37 * @package RoundCube Webmail
38 38 * @author Thomas Bruederli <roundcube@gmail.com>
39   - * @version 1.30
  39 + * @version 1.31
40 40 * @link http://ilohamail.org
41 41 */
42 42 class rcube_imap
@@ -52,7 +52,8 @@ class rcube_imap
52 52 var $sort_order = 'DESC';
53 53 var $delimiter = NULL;
54 54 var $caching_enabled = FALSE;
55   - var $default_folders = array('inbox', 'drafts', 'sent', 'junk', 'trash');
  55 + var $default_folders = array('INBOX');
  56 + var $default_folders_lc = array('inbox');
56 57 var $cache = array();
57 58 var $cache_keys = array();
58 59 var $cache_changes = array();
@@ -208,15 +209,16 @@ class rcube_imap
208 209 {
209 210 if (is_array($arr))
210 211 {
211   - $this->default_folders = array();
212   -
213   - // add mailbox names lower case
214   - foreach ($arr as $mbox_row)
215   - $this->default_folders[] = strtolower($mbox_row);
216   -
  212 + $this->default_folders = $arr;
  213 + $this->default_folders_lc = array();
  214 +
217 215 // add inbox if not included
218   - if (!in_array('inbox', $this->default_folders))
219   - array_unshift($arr, 'inbox');
  216 + if (!in_array_nocase('INBOX', $this->default_folders))
  217 + array_unshift($this->default_folders, 'INBOX');
  218 +
  219 + // create a second list with lower cased names
  220 + foreach ($this->default_folders as $mbox)
  221 + $this->default_folders_lc[] = strtolower($mbox);
220 222 }
221 223 }
222 224
@@ -333,6 +335,10 @@ class rcube_imap
333 335 $a_out[] = $name;
334 336 }
335 337
  338 + // INBOX should always be available
  339 + if (!in_array_nocase('INBOX', $a_out))
  340 + array_unshift($a_out, 'INBOX');
  341 +
336 342 // sort mailboxes
337 343 $a_out = $this->_sort_mailbox_list($a_out);
338 344
@@ -362,20 +368,6 @@ class rcube_imap
362 368 if (!is_array($a_folders) || !sizeof($a_folders))
363 369 $a_folders = array();
364 370
365   - // create Default folders if they do not exist
366   - global $CONFIG;
367   - foreach ($CONFIG['default_imap_folders'] as $folder)
368   - {
369   - if (!in_array_nocase($folder, $a_folders))
370   - {
371   - $this->create_mailbox($folder, TRUE);
372   - $this->subscribe($folder);
373   - }
374   - }
375   -
376   - $a_folders = iil_C_ListSubscribed($this->conn, $this->_mod_mailbox($root), $filter);
377   - $a_mailbox_cache = array();
378   -
379 371 // write mailboxlist to cache
380 372 $this->update_cache('mailboxes', $a_folders);
381 373
@@ -1155,7 +1147,12 @@ class rcube_imap
1155 1147 * --------------------------------*/
1156 1148
1157 1149
1158   - // return an array with all folders available in IMAP server
  1150 + /**
  1151 + * Get a list of all folders available on the IMAP server
  1152 + *
  1153 + * @param string IMAP root dir
  1154 + * @return array Inbdexed array with folder names
  1155 + */
1159 1156 function list_unsubscribed($root='')
1160 1157 {
1161 1158 static $sa_unsubscribed;
@@ -1197,7 +1194,9 @@ class rcube_imap
1197 1194 }
1198 1195
1199 1196
1200   - // subscribe to a specific mailbox(es)
  1197 + /**
  1198 + * subscribe to a specific mailbox(es)
  1199 + */
1201 1200 function subscribe($mbox_name, $mode='subscribe')
1202 1201 {
1203 1202 if (is_array($mbox_name))
@@ -1210,7 +1209,9 @@ class rcube_imap
1210 1209 }
1211 1210
1212 1211
1213   - // unsubscribe mailboxes
  1212 + /**
  1213 + * unsubscribe mailboxes
  1214 + */
1214 1215 function unsubscribe($mbox_name)
1215 1216 {
1216 1217 if (is_array($mbox_name))
@@ -1223,7 +1224,9 @@ class rcube_imap
1223 1224 }
1224 1225
1225 1226
1226   - // create a new mailbox on the server and register it in local cache
  1227 + /**
  1228 + * create a new mailbox on the server and register it in local cache
  1229 + */
1227 1230 function create_mailbox($name, $subscribe=FALSE)
1228 1231 {
1229 1232 $result = FALSE;
@@ -1238,19 +1241,21 @@ class rcube_imap
1238 1241
1239 1242 $abs_name = $this->_mod_mailbox($name_enc);
1240 1243 $a_mailbox_cache = $this->get_cache('mailboxes');
1241   -
1242   - if (strlen($abs_name) && (!is_array($a_mailbox_cache) || !in_array($abs_name, $a_mailbox_cache)))
  1244 +
  1245 + if (strlen($abs_name) && (!is_array($a_mailbox_cache) || !in_array_nocase($abs_name, $a_mailbox_cache)))
1243 1246 $result = iil_C_CreateFolder($this->conn, $abs_name);
1244 1247
1245   - // update mailboxlist cache
1246   - if ($result && $subscribe)
  1248 + // try to subscribe it
  1249 + if ($subscribe)
1247 1250 $this->subscribe($name_enc);
1248 1251
1249 1252 return $result ? $name : FALSE;
1250 1253 }
1251 1254
1252 1255
1253   - // set a new name to an existing mailbox
  1256 + /**
  1257 + * set a new name to an existing mailbox
  1258 + */
1254 1259 function rename_mailbox($mbox_name, $new_name)
1255 1260 {
1256 1261 $result = FALSE;
@@ -1279,7 +1284,9 @@ class rcube_imap
1279 1284 }
1280 1285
1281 1286
1282   - // remove mailboxes from server
  1287 + /**
  1288 + * remove mailboxes from server
  1289 + */
1283 1290 function delete_mailbox($mbox_name)
1284 1291 {
1285 1292 $deleted = FALSE;
@@ -1296,7 +1303,7 @@ class rcube_imap
1296 1303
1297 1304 // unsubscribe mailbox before deleting
1298 1305 iil_C_UnSubscribe($this->conn, $mailbox);
1299   -
  1306 +
1300 1307 // send delete command to server
1301 1308 $result = iil_C_DeleteFolder($this->conn, $mailbox);
1302 1309 if ($result>=0)
@@ -1314,6 +1321,28 @@ class rcube_imap
1314 1321 }
1315 1322
1316 1323
  1324 + /**
  1325 + * Create all folders specified as default
  1326 + */
  1327 + function create_default_folders()
  1328 + {
  1329 + $a_folders = iil_C_ListMailboxes($this->conn, $this->_mod_mailbox(''), '*');
  1330 + $a_subscribed = iil_C_ListSubscribed($this->conn, $this->_mod_mailbox(''), '*');
  1331 +
  1332 + // create default folders if they do not exist
  1333 + foreach ($this->default_folders as $folder)
  1334 + {
  1335 + $abs_name = $this->_mod_mailbox($folder);
  1336 + if (!in_array_nocase($abs_name, $a_subscribed))
  1337 + {
  1338 + if (!in_array_nocase($abs_name, $a_folders))
  1339 + $this->create_mailbox($folder, TRUE);
  1340 + else
  1341 + $this->subscribe($folder);
  1342 + }
  1343 + }
  1344 + }
  1345 +
1317 1346
1318 1347
1319 1348 /* --------------------------------
@@ -1830,7 +1859,7 @@ class rcube_imap
1830 1859
1831 1860 function _mod_mailbox($mbox_name, $mode='in')
1832 1861 {
1833   - if ((!empty($this->root_ns) && $this->root_ns == $mbox_name) || ($mbox_name == 'INBOX' && $mode == 'in'))
  1862 + if ((!empty($this->root_ns) && $this->root_ns == $mbox_name) || $mbox_name == 'INBOX')
1834 1863 return $mbox_name;
1835 1864
1836 1865 if (!empty($this->root_dir) && $mode=='in')
@@ -1852,8 +1881,8 @@ class rcube_imap
1852 1881 {
1853 1882 if ($folder{0}=='.')
1854 1883 continue;
1855   -
1856   - if (($p = array_search(strtolower($folder), $this->default_folders))!==FALSE)
  1884 +
  1885 + if (($p = array_search(strtolower($folder), $this->default_folders_lc))!==FALSE)
1857 1886 $a_defaults[$p] = $folder;
1858 1887 else
1859 1888 $a_out[] = $folder;
9 program/js/app.js
@@ -3212,6 +3212,15 @@ function rcube_webmail()
3212 3212 this.set_classname(mbox_li, 'selected', true);
3213 3213 }
3214 3214 }
  3215 +
  3216 + // also update mailbox name in window title
  3217 + if (document.title)
  3218 + {
  3219 + var doc_title = String(document.title);
  3220 + var reg = new RegExp(this.env.mailbox.toLowerCase(), 'i');
  3221 + if (this.env.mailbox && doc_title.match(reg))
  3222 + document.title = doc_title.replace(reg, mbox).replace(/^\([0-9]+\)\s+/i, '');
  3223 + }
3215 3224
3216 3225 this.env.mailbox = mbox;
3217 3226 };
2  program/steps/settings/save_identity.inc
@@ -61,7 +61,7 @@ if ($_POST['_iid'])
61 61 $updated = $DB->affected_rows();
62 62 }
63 63
64   - if ($updated)
  64 + if ($updated && !empty($_POST['_standard']))
65 65 {
66 66 show_message('successfullysaved', 'confirmation');
67 67

0 comments on commit fa4cd20

Please sign in to comment.
Something went wrong with that request. Please try again.