Changeset 5759 in subversion
- Timestamp:
- Jan 12, 2012 8:57:08 AM (17 months ago)
- Location:
- branches/devel-framework/roundcubemail
- Files:
-
- 12 edited
-
index.php (modified) (1 diff)
-
program/include/main.inc (modified) (1 diff)
-
program/include/rcmail.php (modified) (4 diffs)
-
program/include/rcube_imap.php (modified) (60 diffs)
-
program/include/rcube_imap_cache.php (modified) (1 diff)
-
program/include/rcube_storage.php (modified) (3 diffs)
-
program/localization/en_US/messages.inc (modified) (1 diff)
-
program/steps/mail/func.inc (modified) (1 diff)
-
program/steps/settings/edit_folder.inc (modified) (5 diffs)
-
program/steps/settings/folders.inc (modified) (13 diffs)
-
program/steps/settings/func.inc (modified) (4 diffs)
-
program/steps/settings/save_folder.inc (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/devel-framework/roundcubemail/index.php
r5758 r5759 131 131 $error_code = is_object($RCMAIL->storage) ? $RCMAIL->storage->get_error_code() : 1; 132 132 133 $OUTPUT->show_message($error_code < -1 ? ' imaperror' : (!$auth['valid'] ? 'invalidrequest' : 'loginfailed'), 'warning');133 $OUTPUT->show_message($error_code < -1 ? 'storageerror' : (!$auth['valid'] ? 'invalidrequest' : 'loginfailed'), 'warning'); 134 134 $RCMAIL->plugins->exec_hook('login_failed', array( 135 135 'code' => $error_code, 'host' => $auth['host'], 'user' => $auth['user'])); -
branches/devel-framework/roundcubemail/program/include/main.inc
r5758 r5759 1595 1595 $res_code = $RCMAIL->storage->get_response_code(); 1596 1596 1597 if ($res_code == rcube_storage::NOPERM) { 1597 if ($err_code < 0) { 1598 $RCMAIL->output->show_message('storageerror', 'error'); 1599 } 1600 else if ($res_code == rcube_storage::NOPERM) { 1598 1601 $RCMAIL->output->show_message('errornoperm', 'error'); 1599 1602 } -
branches/devel-framework/roundcubemail/program/include/rcmail.php
r5758 r5759 605 605 606 606 $driver = $this->config->get('storage_driver', 'imap'); 607 $driver_class = "rcube_ $driver";607 $driver_class = "rcube_{$driver}"; 608 608 609 609 if (!class_exists($driver_class)) { … … 619 619 620 620 // enable caching of mail data 621 $storage_cache = $this->config->get(" $driver_cache");621 $storage_cache = $this->config->get("{$driver}_cache"); 622 622 $messages_cache = $this->config->get('messages_cache'); 623 623 // for backward compatybility … … 641 641 // set class options 642 642 $options = array( 643 'auth_type' => $this->config->get(" $driver_auth_type", 'check'),644 'auth_cid' => $this->config->get(" $driver_auth_cid"),645 'auth_pw' => $this->config->get(" $driver_auth_pw"),646 'debug' => (bool) $this->config->get(" $driver_debug", 0),647 'force_caps' => (bool) $this->config->get(" $driver_force_caps"),648 'timeout' => (int) $this->config->get(" $driver_timeout", 0),643 'auth_type' => $this->config->get("{$driver}_auth_type", 'check'), 644 'auth_cid' => $this->config->get("{$driver}_auth_cid"), 645 'auth_pw' => $this->config->get("{$driver}_auth_pw"), 646 'debug' => (bool) $this->config->get("{$driver}_debug"), 647 'force_caps' => (bool) $this->config->get("{$driver}_force_caps"), 648 'timeout' => (int) $this->config->get("{$driver}_timeout"), 649 649 'skip_deleted' => (bool) $this->config->get('skip_deleted'), 650 650 ); 651 651 652 $hook = $this->plugins->exec_hook("$driver_init", $options); 652 if (!empty($_SESSION['storage_host'])) { 653 $options['host'] = $_SESSION['storage_host']; 654 $options['user'] = $_SESSION['username']; 655 $options['port'] = $_SESSION['storage_port']; 656 $options['ssl'] = $_SESSION['storage_ssl']; 657 $options['password'] = $this->decrypt($_SESSION['password']); 658 } 659 660 $hook = $this->plugins->exec_hook("{$driver}_init", $options); 653 661 654 662 $this->storage->set_options($options); … … 675 683 if (!$storage->connect($host, $user, $pass, $port, $ssl)) { 676 684 if ($this->output) 677 $this->output->show_message($storage->get_error_code() == -1 ? ' imaperror' : 'sessionerror', 'error');685 $this->output->show_message($storage->get_error_code() == -1 ? 'storageerror' : 'sessionerror', 'error'); 678 686 } 679 687 else { -
branches/devel-framework/roundcubemail/program/include/rcube_imap.php
r5758 r5759 76 76 protected $search_sorted = false; 77 77 protected $options = array('auth_method' => 'check'); 78 protected $host, $user, $pass, $port, $ssl;79 78 protected $caching = false; 80 79 protected $messages_caching = false; … … 124 123 125 124 if ($this->options['debug']) { 126 $this-> conn->setDebug(true, array($this, 'debug_handler'));125 $this->set_debug(true); 127 126 128 127 $this->options['ident'] = array( … … 147 146 } while(!$this->conn->connected() && $data['retry']); 148 147 149 $this->host = $data['host']; 150 $this->user = $data['user']; 151 $this->pass = $pass; 152 $this->port = $port; 153 $this->ssl = $use_ssl; 148 $config = array( 149 'host' => $data['host'], 150 'user' => $data['user'], 151 'password' => $pass, 152 'port' => $port, 153 'ssl' => $use_ssl, 154 ); 155 156 $this->options = array_merge($this->options, $config); 157 $this->connect_done = true; 154 158 155 159 if ($this->conn->connected()) { … … 181 185 { 182 186 $this->conn->closeConnection(); 183 if ($this->mcache) 187 if ($this->mcache) { 184 188 $this->mcache->close(); 189 } 190 } 191 192 193 /** 194 * Check connection state, connect if not connected. 195 */ 196 public function check_connection() 197 { 198 // Establish connection if it wasn't done yet 199 if (!$this->connect_done && !empty($this->options['user'])) { 200 return $this->connect( 201 $this->options['host'], 202 $this->options['user'], 203 $this->options['password'], 204 $this->options['port'], 205 $this->options['ssl'] 206 ); 207 } 208 209 return $this->is_connected(); 185 210 } 186 211 … … 193 218 public function is_connected() 194 219 { 195 return $this->conn && $this->conn->connected();220 return $this->conn->connected(); 196 221 } 197 222 … … 332 357 public function get_capability($cap) 333 358 { 359 if (!$this->check_connection()) { 360 return false; 361 } 362 363 // @TODO: cache capabilities or store in session (?) 334 364 return $this->conn->getCapability(strtoupper($cap)); 335 365 } … … 348 378 $flag = strtoupper($flag); 349 379 $imap_flag = $this->conn->flags[$flag]; 380 381 if ($this->folder !== null) { 382 $this->check_connection(); 383 } 384 // @TODO: cache permanent flags (?) 385 350 386 return (in_array_nocase($imap_flag, $this->conn->data['PERMANENTFLAGS'])); 351 387 } … … 399 435 $imap_delimiter = $config->get('imap_delimiter'); 400 436 401 if (!$this->c onn->connected())437 if (!$this->check_connection()) { 402 438 return; 439 } 403 440 404 441 $ns = $this->conn->getNamespace(); … … 527 564 $this->set_folder_stats($folder, 'maxuid', $msg_count ? $this->id2uid($msg_count, $folder) : 0); 528 565 } 566 } 567 // Need connection here 568 else if (!$this->check_connection()) { 569 return 0; 529 570 } 530 571 // RECENT count is fetched a bit different … … 631 672 // use saved message set 632 673 if ($this->search_string && $folder == $this->folder) { 633 return $this->list_ header_set($folder, $page, $slice);674 return $this->list_search_messages($folder, $page, $slice); 634 675 } 635 676 636 677 if ($this->threading) { 637 return $this->list_thread_ headers($folder, $page, $slice);678 return $this->list_thread_messages($folder, $page, $slice); 638 679 } 639 680 … … 669 710 * 670 711 * @return array Indexed array with message header objects 671 * @see rcube_imap::list_ headers672 */ 673 protected function list_thread_ headers($folder, $page, $slice=0)712 * @see rcube_imap::list_messages 713 */ 714 protected function list_thread_messages($folder, $page, $slice=0) 674 715 { 675 716 // get all threads (not sorted) … … 698 739 699 740 if (empty($this->icache['threads'])) { 741 if (!$this->check_connection()) { 742 return new rcube_result_thread(); 743 } 744 700 745 // get all threads 701 746 $result = $this->conn->thread($folder, $this->threading, … … 789 834 * @return array Indexed array with message header objects 790 835 */ 791 protected function list_ header_set($folder, $page, $slice=0)836 protected function list_search_messages($folder, $page, $slice=0) 792 837 { 793 838 if (!strlen($folder) || empty($this->search_set) || $this->search_set->isEmpty()) { … … 797 842 // use saved messages from searching 798 843 if ($this->threading) { 799 return $this->list_ thread_header_set($folder, $page, $slice);844 return $this->list_search_thread_messages($folder, $page, $slice); 800 845 } 801 846 … … 827 872 828 873 // return empty array if no messages found 829 if ($index->isEmpty()) 874 if ($index->isEmpty()) { 830 875 return array(); 876 } 831 877 } 832 878 } … … 840 886 $index->slice($from, $to-$from); 841 887 842 if ($slice) 888 if ($slice) { 843 889 $index->slice(-$slice, $slice); 890 } 844 891 845 892 // fetch headers … … 860 907 $index->slice($start_msg, min($cnt-$from, $this->page_size)); 861 908 862 if ($slice) 909 if ($slice) { 863 910 $index->slice(-$slice, $slice); 911 } 864 912 865 913 // ...and fetch headers … … 875 923 876 924 // return empty array if no messages found 877 if (!is_array($a_msg_headers) || empty($a_msg_headers)) 925 if (!is_array($a_msg_headers) || empty($a_msg_headers)) { 878 926 return array(); 927 } 928 929 if (!$this->check_connection()) { 930 return array(); 931 } 879 932 880 933 // if not already sorted … … 902 955 * 903 956 * @return array Indexed array with message header objects 904 * @see rcube_imap::list_ header_set()905 */ 906 protected function list_ thread_header_set($folder, $page, $slice=0)957 * @see rcube_imap::list_search_messages() 958 */ 959 protected function list_search_thread_messages($folder, $page, $slice=0) 907 960 { 908 961 // update search_set if previous data was fetched with disabled threading … … 934 987 if (!$force && ($mcache = $this->get_mcache_engine())) { 935 988 $headers = $mcache->get_messages($folder, $msgs); 989 } 990 else if (!$this->check_connection()) { 991 return array(); 936 992 } 937 993 else { … … 1042 1098 public function index($folder = '', $sort_field = NULL, $sort_order = NULL) 1043 1099 { 1044 if ($this->threading) 1100 if ($this->threading) { 1045 1101 return $this->thread_index($folder, $sort_field, $sort_order); 1102 } 1046 1103 1047 1104 $this->set_sort_order($sort_field, $sort_order); … … 1064 1121 $index = $this->search_set; 1065 1122 } 1123 else if (!$this->check_connection()) { 1124 return new rcube_result_index(); 1125 } 1066 1126 else { 1067 1127 $index = $this->conn->index($folder, $this->search_set->get(), … … 1113 1173 $index = $this->icache['undeleted_idx']; 1114 1174 } 1175 else if (!$this->check_connection()) { 1176 return new rcube_result_index(); 1177 } 1115 1178 else { 1116 1179 $index = $this->conn->search($folder, 1117 1180 'ALL' .($this->options['skip_deleted'] ? ' UNDELETED' : ''), true); 1118 1181 } 1182 } 1183 else if (!$this->check_connection()) { 1184 return new rcube_result_index(); 1119 1185 } 1120 1186 // fetch complete message index … … 1245 1311 } 1246 1312 1313 if (!$this->check_connection()) { 1314 return new rcube_result_index(); 1315 } 1316 1247 1317 $index = $this->conn->search($mailbox, $str, true); 1248 1318 … … 1266 1336 $orig_criteria = $criteria; 1267 1337 1268 if ($this->options['skip_deleted'] && !preg_match('/UNDELETED/', $criteria)) 1338 if (!$this->check_connection()) { 1339 if ($this->threading) { 1340 return new rcube_result_thread(); 1341 } 1342 else { 1343 return new rcube_result_index(); 1344 } 1345 } 1346 1347 if ($this->options['skip_deleted'] && !preg_match('/UNDELETED/', $criteria)) { 1269 1348 $criteria = 'UNDELETED '.$criteria; 1349 } 1270 1350 1271 1351 if ($this->threading) { … … 1378 1458 $headers = $mcache->get_message($folder, $uid); 1379 1459 } 1460 else if (!$this->check_connection()) { 1461 $headers = false; 1462 } 1380 1463 else { 1381 1464 $headers = $this->conn->fetchHeader( … … 1416 1499 1417 1500 // structure might be cached 1418 if (!empty($headers->structure)) 1501 if (!empty($headers->structure)) { 1419 1502 return $headers; 1503 } 1420 1504 1421 1505 $this->msg_uid = $uid; 1506 1507 if (!$this->check_connection()) { 1508 return $headers; 1509 } 1422 1510 1423 1511 if (empty($headers->bodystructure)) { … … 1427 1515 $structure = $headers->bodystructure; 1428 1516 1429 if (empty($structure)) 1517 if (empty($structure)) { 1430 1518 return $headers; 1519 } 1431 1520 1432 1521 // set message charset from message headers … … 1823 1912 public function get_message_part($uid, $part=1, $o_part=NULL, $print=NULL, $fp=NULL, $skip_charset_conv=false) 1824 1913 { 1914 if (!$this->check_connection()) { 1915 return null; 1916 } 1917 1825 1918 // get part data if not provided 1826 1919 if (!is_object($o_part)) { … … 1877 1970 public function get_raw_body($uid, $fp=null) 1878 1971 { 1972 if (!$this->check_connection()) { 1973 return null; 1974 } 1975 1879 1976 return $this->conn->handlePartBody($this->folder, $uid, 1880 1977 true, null, null, false, $fp); … … 1891 1988 public function get_raw_headers($uid) 1892 1989 { 1990 if (!$this->check_connection()) { 1991 return null; 1992 } 1993 1893 1994 return $this->conn->fetchPartHeader($this->folder, $uid, true); 1894 1995 } … … 1897 1998 /** 1898 1999 * Sends the whole message source to stdout 1899 *1900 * @param int $uid Message UID1901 2000 */ 1902 2001 public function print_raw_body($uid) 1903 2002 { 2003 if (!$this->check_connection()) { 2004 return; 2005 } 2006 1904 2007 $this->conn->handlePartBody($this->folder, $uid, true, NULL, NULL, true); 1905 2008 } … … 1920 2023 if (!strlen($folder)) { 1921 2024 $folder = $this->folder; 2025 } 2026 2027 if (!$this->check_connection()) { 2028 return false; 1922 2029 } 1923 2030 … … 2009 2116 2010 2117 // exit if no message uids are specified 2011 if (empty($uids)) 2118 if (empty($uids)) { 2012 2119 return false; 2120 } 2121 2122 if (!$this->check_connection()) { 2123 return false; 2124 } 2013 2125 2014 2126 // make sure folder exists … … 2092 2204 } 2093 2205 2206 if (!$this->check_connection()) { 2207 return false; 2208 } 2209 2094 2210 // make sure folder exists 2095 2211 if ($to_mbox != 'INBOX' && !$this->folder_exists($to_mbox)) { … … 2132 2248 2133 2249 // exit if no message uids are specified 2134 if (empty($uids)) 2250 if (empty($uids)) { 2135 2251 return false; 2252 } 2253 2254 if (!$this->check_connection()) { 2255 return false; 2256 } 2136 2257 2137 2258 $deleted = $this->conn->flag($folder, $uids, 'DELETED'); … … 2184 2305 } 2185 2306 2307 if (!$this->check_connection()) { 2308 return false; 2309 } 2310 2186 2311 // force folder selection and check if folder is writeable 2187 2312 // to prevent a situation when CLOSE is executed on closed … … 2191 2316 return false; 2192 2317 } 2318 2193 2319 if (!$this->conn->data['READ-WRITE']) { 2194 2320 $this->conn->setError(rcube_imap_generic::ERROR_READONLY, "Folder is read-only"); … … 2291 2417 $a_folders = $data['folders']; 2292 2418 } 2293 else if (!$this->c onn->connected()) {2419 else if (!$this->check_connection()) { 2294 2420 return null; 2295 2421 } … … 2392 2518 2393 2519 // cache folder attributes 2394 if ($root == '' && $name == '*' && empty($filter) ) {2520 if ($root == '' && $name == '*' && empty($filter) && !empty($this->conn->data)) { 2395 2521 $this->update_cache('mailboxes.attributes', $this->conn->data['LIST']); 2396 2522 } … … 2424 2550 protected function _list_folders($root='', $name='*') 2425 2551 { 2552 if (!$this->check_connection()) { 2553 return null; 2554 } 2555 2426 2556 $result = $this->conn->listMailboxes($root, $name); 2427 2557 … … 2518 2648 public function folder_size($folder) 2519 2649 { 2650 if (!$this->check_connection()) { 2651 return 0; 2652 } 2653 2520 2654 // @TODO: could we try to use QUOTA here? 2521 2655 $result = $this->conn->fetchHeaderIndex($folder, '1:*', 'SIZE', false); … … 2566 2700 public function create_folder($folder, $subscribe=false) 2567 2701 { 2702 if (!$this->check_connection()) { 2703 return false; 2704 } 2705 2568 2706 $result = $this->conn->createFolder($folder); 2569 2707 … … 2592 2730 { 2593 2731 if (!strlen($new_name)) { 2732 return false; 2733 } 2734 2735 if (!$this->check_connection()) { 2594 2736 return false; 2595 2737 } … … 2647 2789 { 2648 2790 $delm = $this->get_hierarchy_delimiter(); 2791 2792 if (!$this->check_connection()) { 2793 return false; 2794 } 2649 2795 2650 2796 // get list of folders … … 2712 2858 if (is_array($this->icache[$key]) && in_array($folder, $this->icache[$key])) 2713 2859 return true; 2860 2861 if (!$this->check_connection()) { 2862 return false; 2863 } 2714 2864 2715 2865 if ($subscription) { … … 2820 2970 2821 2971 if (!is_array($opts)) { 2972 if (!$this->check_connection()) { 2973 return array(); 2974 } 2975 2822 2976 $this->conn->listMailboxes('', $folder); 2823 2977 $opts = $this->conn->data['LIST'][$folder]; … … 2842 2996 2843 2997 if ($this->conn->selected != $folder) { 2998 if (!$this->check_connection()) { 2999 return array(); 3000 } 2844 3001 if ($this->conn->select($folder)) 2845 3002 $this->folder = $folder; … … 2994 3151 public function set_acl($folder, $user, $acl) 2995 3152 { 2996 if ($this->get_capability('ACL')) 2997 return $this->conn->setACL($folder, $user, $acl); 2998 2999 return false; 3153 if (!$this->get_capability('ACL')) { 3154 return false; 3155 } 3156 3157 if (!$this->check_connection()) { 3158 return false; 3159 } 3160 3161 return $this->conn->setACL($folder, $user, $acl); 3000 3162 } 3001 3163 … … 3014 3176 public function delete_acl($folder, $user) 3015 3177 { 3016 if ($this->get_capability('ACL')) 3017 return $this->conn->deleteACL($folder, $user); 3018 3019 return false; 3178 if (!$this->get_capability('ACL')) { 3179 return false; 3180 } 3181 3182 if (!$this->check_connection()) { 3183 return false; 3184 } 3185 3186 return $this->conn->deleteACL($folder, $user); 3020 3187 } 3021 3188 … … 3031 3198 public function get_acl($folder) 3032 3199 { 3033 if ($this->get_capability('ACL')) 3034 return $this->conn->getACL($folder); 3035 3036 return NULL; 3200 if (!$this->get_capability('ACL')) { 3201 return null; 3202 } 3203 3204 if (!$this->check_connection()) { 3205 return null; 3206 } 3207 3208 return $this->conn->getACL($folder); 3037 3209 } 3038 3210 … … 3050 3222 public function list_rights($folder, $user) 3051 3223 { 3052 if ($this->get_capability('ACL')) 3053 return $this->conn->listRights($folder, $user); 3054 3055 return NULL; 3224 if (!$this->get_capability('ACL')) { 3225 return null; 3226 } 3227 3228 if (!$this->check_connection()) { 3229 return null; 3230 } 3231 3232 return $this->conn->listRights($folder, $user); 3056 3233 } 3057 3234 … … 3068 3245 public function my_rights($folder) 3069 3246 { 3070 if ($this->get_capability('ACL')) 3071 return $this->conn->myRights($folder); 3072 3073 return NULL; 3247 if (!$this->get_capability('ACL')) { 3248 return null; 3249 } 3250 3251 if (!$this->check_connection()) { 3252 return null; 3253 } 3254 3255 return $this->conn->myRights($folder); 3074 3256 } 3075 3257 … … 3086 3268 public function set_metadata($folder, $entries) 3087 3269 { 3270 if (!$this->check_connection()) { 3271 return false; 3272 } 3273 3088 3274 if ($this->get_capability('METADATA') || 3089 3275 (!strlen($folder) && $this->get_capability('METADATA-SERVER')) … … 3114 3300 public function delete_metadata($folder, $entries) 3115 3301 { 3302 if (!$this->check_connection()) { 3303 return false; 3304 } 3305 3116 3306 if ($this->get_capability('METADATA') || 3117 3307 (!strlen($folder) && $this->get_capability('METADATA-SERVER')) … … 3143 3333 public function get_metadata($folder, $entries, $options=array()) 3144 3334 { 3145 if ($this->get_capability('METADATA') || 3335 if (!$this->check_connection()) { 3336 return null; 3337 } 3338 3339 if ($this->get_capability('METADATA') || 3146 3340 (!strlen($folder) && $this->get_capability('METADATA-SERVER')) 3147 3341 ) { … … 3166 3360 } 3167 3361 3168 return NULL;3362 return null; 3169 3363 } 3170 3364 … … 3188 3382 3189 3383 // @TODO: log error 3190 return NULL;3384 return null; 3191 3385 } 3192 3386 … … 3419 3613 } 3420 3614 3615 if (!$this->check_connection()) { 3616 return null; 3617 } 3618 3421 3619 $uid = $this->conn->ID2UID($folder, $id); 3422 3620 … … 3435 3633 3436 3634 if (!empty($folders)) { 3635 if (!$this->check_connection()) { 3636 return false; 3637 } 3638 3437 3639 foreach ((array)$folders as $i => $folder) { 3438 3640 $folders[$i] = $folder; -
branches/devel-framework/roundcubemail/program/include/rcube_imap_cache.php
r5758 r5759 889 889 } 890 890 891 if (!$this->imap->check_connection()) { 892 return; 893 } 894 891 895 // NOTE: make sure the mailbox isn't selected, before 892 896 // enabling QRESYNC and invoking SELECT -
branches/devel-framework/roundcubemail/program/include/rcube_storage.php
r5758 r5759 466 466 public function get_body($uid, $part = 1) 467 467 { 468 $headers = $this->get_ headers($uid);468 $headers = $this->get_message_headers($uid); 469 469 return rcube_charset_convert($this->get_message_part($uid, $part, null), 470 470 $headers->charset ? $headers->charset : $this->default_charset); … … 487 487 * 488 488 * @param int $uid Message UID 489 * 489 490 * @return string Message headers string 490 491 */ … … 494 495 /** 495 496 * Sends the whole message source to stdout 496 *497 * @param int $uid Message UID498 497 */ 499 498 abstract function print_raw_body($uid); -
branches/devel-framework/roundcubemail/program/localization/en_US/messages.inc
r5686 r5759 22 22 $messages['cookiesdisabled'] = 'Your browser does not accept cookies.'; 23 23 $messages['sessionerror'] = 'Your session is invalid or expired.'; 24 $messages[' imaperror'] = 'Connection to IMAPserver failed.';24 $messages['storageerror'] = 'Connection to storage server failed.'; 25 25 $messages['servererror'] = 'Server Error!'; 26 26 $messages['servererrormsg'] = 'Server Error: $msg'; -
branches/devel-framework/roundcubemail/program/steps/mail/func.inc
r5758 r5759 29 29 ); 30 30 31 // actions that do not require imap connection here 32 $NOSTORAGE_ACTIONS = array('addcontact', 'autocomplete', 'upload', 'display-attachment', 'remove-attachment', 'get'); 33 34 // always instantiate imap object (but not yet connect to server) 31 // always instantiate storage object (but not connect to server yet) 35 32 $RCMAIL->storage_init(); 36 37 // log in to imap server38 if (!in_array($RCMAIL->action, $NOSTORAGE_ACTIONS) && !$RCMAIL->storage_connect()) {39 $RCMAIL->kill_session();40 41 if ($OUTPUT->ajax_call)42 $OUTPUT->redirect(array(), 2000);43 44 $OUTPUT->set_env('task', 'login');45 $OUTPUT->send('login');46 }47 33 48 34 // set imap properties and session vars -
branches/devel-framework/roundcubemail/program/steps/settings/edit_folder.inc
r5758 r5759 22 22 // WARNING: folder names in UI are encoded with RCMAIL_CHARSET 23 23 24 // init IMAP connection25 $RCMAIL->storage_connect();26 27 24 function rcmail_folder_form($attrib) 28 25 { 29 26 global $RCMAIL; 30 27 28 $storage = $RCMAIL->get_storage(); 29 31 30 // edited folder name (empty in create-folder mode) 32 31 $mbox = trim(get_input_value('_mbox', RCUBE_INPUT_GPC, true)); … … 37 36 $parent_imap = rcube_charset_convert($parent, RCMAIL_CHARSET, 'UTF7-IMAP'); 38 37 39 $threading_supported = $ RCMAIL->storage->get_capability('THREAD');40 $delimiter = $ RCMAIL->storage->get_hierarchy_delimiter();38 $threading_supported = $storage->get_capability('THREAD'); 39 $delimiter = $storage->get_hierarchy_delimiter(); 41 40 42 41 // Get mailbox parameters 43 42 if (strlen($mbox)) { 44 43 $options = rcmail_folder_options($mbox_imap); 45 $namespace = $ RCMAIL->storage->get_namespace();44 $namespace = $storage->get_namespace(); 46 45 47 46 $path = explode($delimiter, $mbox_imap); … … 58 57 // allow creating subfolders of INBOX folder 59 58 if ($path == 'INBOX') { 60 $path = $ RCMAIL->storage->mod_folder($path, 'in');59 $path = $storage->mod_folder($path, 'in'); 61 60 } 62 61 } … … 65 64 if (strlen($path)) { 66 65 $path_id = $path; 67 $path = $ RCMAIL->storage->mod_folder($path.$delimiter);66 $path = $storage->mod_folder($path.$delimiter); 68 67 if ($path[strlen($path)-1] == $delimiter) { 69 68 $path = substr($path, 0, -1); … … 194 193 195 194 if ((!$options['noselect'] && !$options['is_root']) || $mbox_imap == 'INBOX') { 196 $msgcount = $ RCMAIL->storage->count($mbox_imap, 'ALL', true, false);195 $msgcount = $storage->count($mbox_imap, 'ALL', true, false); 197 196 198 197 // Size -
branches/devel-framework/roundcubemail/program/steps/settings/folders.inc
r5758 r5759 24 24 25 25 // init IMAP connection 26 $ RCMAIL->storage_connect();26 $STORAGE = $RCMAIL->get_storage(); 27 27 28 28 // subscribe mailbox … … 31 31 $mbox = get_input_value('_mbox', RCUBE_INPUT_POST, true, 'UTF7-IMAP'); 32 32 if (strlen($mbox)) { 33 $result = $ RCMAIL->storage->subscribe(array($mbox));33 $result = $STORAGE->subscribe(array($mbox)); 34 34 35 35 // Handle virtual (non-existing) folders 36 if (!$result && $ RCMAIL->storage->get_error_code() == -1 &&37 $ RCMAIL->storage->get_response_code() == rcube_storage::TRYCREATE36 if (!$result && $STORAGE->get_error_code() == -1 && 37 $STORAGE->get_response_code() == rcube_storage::TRYCREATE 38 38 ) { 39 $result = $ RCMAIL->storage->create_folder($mbox, true);39 $result = $STORAGE->create_folder($mbox, true); 40 40 if ($result) { 41 41 // @TODO: remove 'virtual' class of folder's row … … 63 63 $mbox = get_input_value('_mbox', RCUBE_INPUT_POST, true, 'UTF7-IMAP'); 64 64 if (strlen($mbox)) { 65 $result = $ RCMAIL->storage->unsubscribe(array($mbox));65 $result = $STORAGE->unsubscribe(array($mbox)); 66 66 if ($result) 67 67 $OUTPUT->show_message('folderunsubscribed', 'confirmation'); … … 81 81 82 82 if (!$plugin['abort']) { 83 $deleted = $ RCMAIL->storage->delete_folder($plugin['name']);83 $deleted = $STORAGE->delete_folder($plugin['name']); 84 84 } 85 85 else { … … 127 127 $mbox_utf8 = get_input_value('_mbox', RCUBE_INPUT_POST, true); 128 128 $mbox = rcube_charset_convert($mbox_utf8, RCMAIL_CHARSET, 'UTF7-IMAP'); 129 $delimiter = $ RCMAIL->storage->get_hierarchy_delimiter();129 $delimiter = $STORAGE->get_hierarchy_delimiter(); 130 130 $trash_regexp = '/^' . preg_quote($CONFIG['trash_mbox'] . $delimiter, '/') . '/'; 131 131 … … 134 134 || preg_match($trash_regexp, $mbox) 135 135 ) { 136 $success = $ RCMAIL->storage->delete_message('*', $mbox);136 $success = $STORAGE->delete_message('*', $mbox); 137 137 $delete = true; 138 138 } 139 139 // copy to Trash 140 140 else { 141 $success = $ RCMAIL->storage->move_message('1:*', $CONFIG['trash_mbox'], $mbox);141 $success = $STORAGE->move_message('1:*', $CONFIG['trash_mbox'], $mbox); 142 142 $delete = false; 143 143 } … … 165 165 $name = trim(get_input_value('_mbox', RCUBE_INPUT_POST, true)); 166 166 167 $size = $ RCMAIL->storage->folder_size($name);167 $size = $STORAGE->folder_size($name); 168 168 169 169 // @TODO: check quota and show percentage usage of specified mailbox? … … 200 200 } 201 201 202 $STORAGE = $RCMAIL->get_storage(); 203 202 204 // get folders from server 203 $ RCMAIL->storage->clear_cache('mailboxes', true);204 205 $a_unsubscribed = $ RCMAIL->storage->list_folders();206 $a_subscribed = $ RCMAIL->storage->list_folders_subscribed('', '*', null, null, true); // unsorted207 $delimiter = $ RCMAIL->storage->get_hierarchy_delimiter();208 $namespace = $ RCMAIL->storage->get_namespace();205 $STORAGE->clear_cache('mailboxes', true); 206 207 $a_unsubscribed = $STORAGE->list_folders(); 208 $a_subscribed = $STORAGE->list_folders_subscribed('', '*', null, null, true); // unsorted 209 $delimiter = $STORAGE->get_hierarchy_delimiter(); 210 $namespace = $STORAGE->get_namespace(); 209 211 $a_js_folders = array(); 210 212 $seen = array(); … … 214 216 foreach ($a_unsubscribed as $i => $folder) { 215 217 $folder_id = $folder; 216 $folder = $ RCMAIL->storage->mod_folder($folder);218 $folder = $STORAGE->mod_folder($folder); 217 219 $foldersplit = explode($delimiter, $folder); 218 220 $name = rcube_charset_convert(array_pop($foldersplit), 'UTF7-IMAP'); … … 284 286 285 287 if (!$protected) { 286 $attrs = $ RCMAIL->storage->folder_attributes($folder['id']);288 $attrs = $STORAGE->folder_attributes($folder['id']); 287 289 $noselect = in_array('\\Noselect', $attrs); 288 290 } … … 368 370 global $RCMAIL; 369 371 370 $delimiter = $RCMAIL->storage->get_hierarchy_delimiter(); 372 $storage = $RCMAIL->get_storage(); 373 $delimiter = $storage->get_hierarchy_delimiter(); 371 374 372 375 $plugin = $RCMAIL->plugins->exec_hook('folder_rename', array( … … 374 377 375 378 if (!$plugin['abort']) { 376 $renamed = $ RCMAIL->storage->rename_folder($oldname, $newname);379 $renamed = $storage->rename_folder($oldname, $newname); 377 380 } 378 381 else { … … 406 409 $OUTPUT->set_pagetitle(rcube_label('folders')); 407 410 $OUTPUT->include_script('list.js'); 408 $OUTPUT->set_env('quota', $ RCMAIL->storage->get_capability('QUOTA'));411 $OUTPUT->set_env('quota', $STORAGE->get_capability('QUOTA')); 409 412 410 413 // add some labels to client -
branches/devel-framework/roundcubemail/program/steps/settings/func.inc
r5758 r5759 318 318 } 319 319 320 $ RCMAIL->storage_connect();321 $threading_supported = $ RCMAIL->storage->get_capability('THREAD');320 $storage = $RCMAIL->get_storage(); 321 $threading_supported = $storage->get_capability('THREAD'); 322 322 323 323 if (!isset($no_override['autoexpand_threads']) && $threading_supported) { … … 683 683 // Configure special folders 684 684 if (!isset($no_override['default_folders'])) { 685 686 $RCMAIL->storage_connect();687 688 685 // load folders list only when needed 689 686 if ($current) { … … 850 847 global $RCMAIL; 851 848 852 $options = $RCMAIL-> storage->folder_info($mailbox);849 $options = $RCMAIL->get_storage()->folder_info($mailbox); 853 850 $options['protected'] = $options['is_root'] || ($options['special'] && $RCMAIL->config->get('protect_default_folders')); 854 851 … … 868 865 global $RCMAIL, $CONFIG, $OUTPUT; 869 866 870 $delimiter = $RCMAIL->storage->get_hierarchy_delimiter(); 867 $storage = $RCMAIL->get_storage(); 868 $delimiter = $storage->get_hierarchy_delimiter(); 871 869 $name_utf8 = rcube_charset_convert($name, 'UTF7-IMAP'); 872 870 $protected = ($CONFIG['protect_default_folders'] == true && in_array($name, $CONFIG['default_folders'])); 873 871 874 $foldersplit = explode($delimiter, $ RCMAIL->storage->mod_folder($name));872 $foldersplit = explode($delimiter, $storage->mod_folder($name)); 875 873 $level = count($foldersplit) - 1; 876 874 $display_name = str_repeat(' ', $level) -
branches/devel-framework/roundcubemail/program/steps/settings/save_folder.inc
r5758 r5759 23 23 24 24 // init IMAP connection 25 $ RCMAIL->storage_connect();25 $STORAGE = $RCMAIL->get_storage(); 26 26 27 27 … … 34 34 // $path is in UTF7-IMAP already 35 35 36 $delimiter = $ RCMAIL->storage->get_hierarchy_delimiter();36 $delimiter = $STORAGE->get_hierarchy_delimiter(); 37 37 $options = strlen($old_imap) ? rcmail_folder_options($old_imap) : array(); 38 38 … … 67 67 } 68 68 else { 69 $name_imap = $ RCMAIL->storage->mod_folder($name_imap, 'in');69 $name_imap = $STORAGE->mod_folder($name_imap, 'in'); 70 70 } 71 71 } … … 73 73 // Check access rights to the parent folder 74 74 if (!$error && strlen($path) && (!strlen($old_imap) || $old_imap != $name_imap)) { 75 $parent_opts = $ RCMAIL->storage->folder_info($path);75 $parent_opts = $STORAGE->folder_info($path); 76 76 if ($parent_opts['namespace'] != 'personal' 77 77 && (empty($parent_opts['rights']) || !preg_match('/[ck]/', implode($parent_opts))) … … 104 104 105 105 if (!$plugin['abort']) { 106 $created = $ RCMAIL->storage->create_folder($folder['name'], $folder['subscribe']);106 $created = $STORAGE->create_folder($folder['name'], $folder['subscribe']); 107 107 } 108 108 else { … … 144 144 if (!$plugin['abort']) { 145 145 if ($rename) { 146 $updated = $ RCMAIL->storage->rename_folder($folder['oldname'], $folder['name']);146 $updated = $STORAGE->rename_folder($folder['oldname'], $folder['name']); 147 147 } 148 148 else {
Note: See TracChangeset
for help on using the changeset viewer.
