Changeset 6092 in subversion
- Timestamp:
- Apr 16, 2012 7:59:08 AM (13 months ago)
- Location:
- trunk/roundcubemail/program/include
- Files:
-
- 16 edited
-
rcube.php (modified) (5 diffs)
-
rcube_cache.php (modified) (2 diffs)
-
rcube_config.php (modified) (1 diff)
-
rcube_image.php (modified) (3 diffs)
-
rcube_imap.php (modified) (6 diffs)
-
rcube_ldap.php (modified) (5 diffs)
-
rcube_mdb2.php (modified) (3 diffs)
-
rcube_message.php (modified) (1 diff)
-
rcube_mime.php (modified) (1 diff)
-
rcube_output_html.php (modified) (1 diff)
-
rcube_output_json.php (modified) (1 diff)
-
rcube_plugin.php (modified) (2 diffs)
-
rcube_session.php (modified) (2 diffs)
-
rcube_smtp.php (modified) (5 diffs)
-
rcube_spellchecker.php (modified) (1 diff)
-
rcube_user.php (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/roundcubemail/program/include/rcube.php
r6091 r6092 3 3 /* 4 4 +-----------------------------------------------------------------------+ 5 | program/include/rc mail.php|5 | program/include/rcube.php | 6 6 | | 7 7 | This file is part of the Roundcube Webmail client | … … 37 37 38 38 /** 39 * Singleton instace of rc mail39 * Singleton instace of rcube 40 40 * 41 41 * @var rcmail … … 110 110 * This implements the 'singleton' design pattern 111 111 * 112 * @return rc mailThe one and only instance112 * @return rcube The one and only instance 113 113 */ 114 114 static function get_instance() … … 719 719 /*- 720 720 * Trim PHP's padding and the canary byte; see note in 721 * rc mail::encrypt() and http://php.net/mcrypt_generic#68082721 * rcube::encrypt() and http://php.net/mcrypt_generic#68082 722 722 */ 723 723 $clear = substr(rtrim($clear, "\0"), 0, -1); … … 849 849 $args = func_get_args(); 850 850 851 if (class_exists('rc mail', false)) {851 if (class_exists('rcube', false)) { 852 852 $rcube = self::get_instance(); 853 if (is_object($rcube->plugins)) { 854 $plugin = $rcube->plugins->exec_hook('console', array('args' => $args)); 855 if ($plugin['abort']) { 856 return; 857 } 858 $args = $plugin['args']; 853 $plugin = $rcube->plugins->exec_hook('console', array('args' => $args)); 854 if ($plugin['abort']) { 855 return; 859 856 } 857 $args = $plugin['args']; 860 858 } 861 859 -
trunk/roundcubemail/program/include/rcube_cache.php
r6073 r6092 67 67 function __construct($type, $userid, $prefix='', $ttl=0, $packed=true) 68 68 { 69 $rc mail= rcube::get_instance();70 $type = strtolower($type);69 $rcube = rcube::get_instance(); 70 $type = strtolower($type); 71 71 72 72 if ($type == 'memcache') { 73 73 $this->type = 'memcache'; 74 $this->db = $rc mail->get_memcache();74 $this->db = $rcube->get_memcache(); 75 75 } 76 76 else if ($type == 'apc') { … … 80 80 else { 81 81 $this->type = 'db'; 82 $this->db = $rc mail->get_dbh();82 $this->db = $rcube->get_dbh(); 83 83 } 84 84 -
trunk/roundcubemail/program/include/rcube_config.php
r6091 r6092 187 187 } 188 188 189 $rc mail= rcube::get_instance();189 $rcube = rcube::get_instance(); 190 190 191 191 if ($name == 'timezone' && isset($this->prop['_timezone_value'])) 192 192 $result = $this->prop['_timezone_value']; 193 193 194 if (is_object($rcmail->plugins)) { 195 $plugin = $rcmail->plugins->exec_hook('config_get', array( 196 'name' => $name, 'default' => $def, 'result' => $result)); 197 198 return $plugin['result']; 199 } 200 201 return $result; 194 $plugin = $rcube->plugins->exec_hook('config_get', array( 195 'name' => $name, 'default' => $def, 'result' => $result)); 196 197 return $plugin['result']; 202 198 } 203 199 -
trunk/roundcubemail/program/include/rcube_image.php
r6031 r6092 74 74 public function resize($size, $filename = null) 75 75 { 76 $result = false;77 $rc mail = rcmail::get_instance();78 $convert = $rcmail->config->get('im_convert_path', false);79 $props = $this->props();76 $result = false; 77 $rcube = rcube::get_instance(); 78 $convert = $rcmail->config->get('im_convert_path', false); 79 $props = $this->props(); 80 80 81 81 if (!$filename) { … … 99 99 100 100 if (in_array($type, explode(',', $p['types']))) { // Valid type? 101 $result = rc mail::exec($convert . ' 2>&1 -flatten -auto-orient -colorspace RGB -quality {quality} {-opts} {in} {type}:{out}', $p) === '';101 $result = rcube::exec($convert . ' 2>&1 -flatten -auto-orient -colorspace RGB -quality {quality} {-opts} {in} {type}:{out}', $p) === ''; 102 102 } 103 103 … … 162 162 private function identify() 163 163 { 164 $rc mail = rcmail::get_instance();164 $rcube = rcube::get_instance(); 165 165 166 if ($cmd = $rc mail->config->get('im_identify_path')) {166 if ($cmd = $rcube->config->get('im_identify_path')) { 167 167 $args = array('in' => $this->image_file, 'format' => "%m %[fx:w] %[fx:h]"); 168 $id = rc mail::exec($cmd. ' 2>/dev/null -format {format} {in}', $args);168 $id = rcube::exec($cmd. ' 2>/dev/null -format {format} {in}', $args); 169 169 170 170 if ($id) { -
trunk/roundcubemail/program/include/rcube_imap.php
r6091 r6092 2599 2599 2600 2600 // Give plugins a chance to provide a list of folders 2601 $data = rc mail::get_instance()->plugins->exec_hook('storage_folders',2601 $data = rcube::get_instance()->plugins->exec_hook('storage_folders', 2602 2602 array('root' => $root, 'name' => $name, 'filter' => $filter, 'mode' => 'LIST')); 2603 2603 … … 3509 3509 * Enable or disable indexes caching 3510 3510 * 3511 * @param string $type Cache type (@see rc mail::get_cache)3511 * @param string $type Cache type (@see rcube::get_cache) 3512 3512 */ 3513 3513 public function set_caching($type) … … 3531 3531 { 3532 3532 if ($this->caching && !$this->cache) { 3533 $rc mail= rcube::get_instance();3534 $ttl = $rc mail->config->get('message_cache_lifetime', '10d') - mktime();3535 $this->cache = $rc mail->get_cache('IMAP', $this->caching, $ttl);3533 $rcube = rcube::get_instance(); 3534 $ttl = $rcube->config->get('message_cache_lifetime', '10d') - mktime(); 3535 $this->cache = $rcube->get_cache('IMAP', $this->caching, $ttl); 3536 3536 } 3537 3537 … … 3586 3586 { 3587 3587 if ($this->mcache) { 3588 $ttl = rc mail::get_instance()->config->get('message_cache_lifetime', '10d');3588 $ttl = rcube::get_instance()->config->get('message_cache_lifetime', '10d'); 3589 3589 $this->mcache->expunge($ttl); 3590 3590 } … … 3626 3626 { 3627 3627 if ($this->messages_caching && !$this->mcache) { 3628 $rc mail= rcube::get_instance();3629 if ($dbh = $rc mail->get_dbh()) {3628 $rcube = rcube::get_instance(); 3629 if ($dbh = $rcube->get_dbh()) { 3630 3630 $this->mcache = new rcube_imap_cache( 3631 $dbh, $this, $rc mail->get_user_id(), $this->options['skip_deleted']);3631 $dbh, $this, $rcube->get_user_id(), $this->options['skip_deleted']); 3632 3632 } 3633 3633 } … … 3853 3853 public function debug_handler(&$imap, $message) 3854 3854 { 3855 rc mail::write_log('imap', $message);3855 rcube::write_log('imap', $message); 3856 3856 } 3857 3857 -
trunk/roundcubemail/program/include/rcube_ldap.php
r6091 r6092 164 164 165 165 // initialize cache 166 $rc mail = rcmail::get_instance();167 $this->cache = $rc mail->get_cache('LDAP.' . asciiwords($this->prop['name']), 'db', 600);166 $rcube = rcube::get_instance(); 167 $this->cache = $rcube->get_cache('LDAP.' . asciiwords($this->prop['name']), 'db', 600); 168 168 169 169 $this->_connect(); … … 176 176 private function _connect() 177 177 { 178 $ RCMAIL = rcmail::get_instance();178 $rcube = rcube::get_instance(); 179 179 180 180 if (!function_exists('ldap_connect')) … … 195 195 foreach ($this->prop['hosts'] as $host) 196 196 { 197 $host = idn_to_ascii(rcube_utils::parse_host($host));197 $host = rcube_utils::idn_to_ascii(rcube_utils::parse_host($host)); 198 198 $hostname = $host.($this->prop['port'] ? ':'.$this->prop['port'] : ''); 199 199 … … 244 244 // No password set, use the session password 245 245 if (empty($bind_pass)) { 246 $bind_pass = $ RCMAIL->decrypt($_SESSION['password']);246 $bind_pass = $rcube->decrypt($_SESSION['password']); 247 247 } 248 248 249 249 // Get the pieces needed for variable replacement. 250 if ($fu = $ RCMAIL->get_user_name())250 if ($fu = $rcube->get_user_name()) 251 251 list($u, $d) = explode('@', $fu); 252 252 else … … 1563 1563 { 1564 1564 if ($this->debug) { 1565 rc mail::write_log('ldap', $str);1565 rcube::write_log('ldap', $str); 1566 1566 } 1567 1567 } -
trunk/roundcubemail/program/include/rcube_mdb2.php
r6073 r6092 827 827 $debug_output = sprintf('%s(%d): %s;', 828 828 $scope, $db->db_index, rtrim($message, ';')); 829 rc mail::write_log('sql', $debug_output);829 rcube::write_log('sql', $debug_output); 830 830 } 831 831 } … … 841 841 public function table_name($table) 842 842 { 843 $rc mail= rcube::get_instance();843 $rcube = rcube::get_instance(); 844 844 845 845 // return table name if configured 846 846 $config_key = 'db_table_'.$table; 847 847 848 if ($name = $rc mail->config->get($config_key)) {848 if ($name = $rcube->config->get($config_key)) { 849 849 return $name; 850 850 } … … 864 864 public function sequence_name($sequence) 865 865 { 866 $rc mail= rcube::get_instance();866 $rcube = rcube::get_instance(); 867 867 868 868 // return sequence name if configured 869 869 $config_key = 'db_sequence_'.$sequence; 870 870 871 if ($name = $rc mail->config->get($config_key)) {871 if ($name = $rcube->config->get($config_key)) { 872 872 return $name; 873 873 } -
trunk/roundcubemail/program/include/rcube_message.php
r6074 r6092 34 34 { 35 35 /** 36 * Instace of rcmail.37 * 38 * @var rc mail36 * Instace of framework class. 37 * 38 * @var rcube 39 39 */ 40 40 private $app; -
trunk/roundcubemail/program/include/rcube_mime.php
r6079 r6092 47 47 } 48 48 else { 49 self::$default_charset = rc mail::get_instance()->config->get('default_charset', RCMAIL_CHARSET);49 self::$default_charset = rcube::get_instance()->config->get('default_charset', RCMAIL_CHARSET); 50 50 } 51 51 } -
trunk/roundcubemail/program/include/rcube_output_html.php
r6091 r6092 1207 1207 1208 1208 // trigger hook with final HTML content to be sent 1209 $hook = rcmail::get_instance()->plugins->exec_hook("send_page", array('content' => $output));1209 $hook = $this->app->plugins->exec_hook("send_page", array('content' => $output)); 1210 1210 if (!$hook['abort']) { 1211 1211 if ($this->charset != RCMAIL_CHARSET) { -
trunk/roundcubemail/program/include/rcube_output_json.php
r6091 r6092 171 171 public function redirect($p = array(), $delay = 1) 172 172 { 173 $location = rcmail::get_instance()->url($p);173 $location = $this->app->url($p); 174 174 $this->remote_response(sprintf("window.setTimeout(function(){ %s.redirect('%s',true); }, %d);", 175 175 rcmail::JS_OBJECT_NAME, $location, $delay)); -
trunk/roundcubemail/program/include/rcube_plugin.php
r6073 r6092 111 111 { 112 112 $fpath = $this->home.'/'.$fname; 113 $rc mail= rcube::get_instance();114 if (is_file($fpath) && !$rc mail->config->load_from_file($fpath)) {113 $rcube = rcube::get_instance(); 114 if (is_file($fpath) && !$rcube->config->load_from_file($fpath)) { 115 115 rcube::raise_error(array( 116 116 'code' => 527, 'type' => 'php', … … 178 178 $add[$domain.'.'.$key] = $value; 179 179 180 $rcmail = rc ube::get_instance();180 $rcmail = rcmail::get_instance(); 181 181 $rcmail->load_language($lang, $add); 182 182 -
trunk/roundcubemail/program/include/rcube_session.php
r6091 r6092 66 66 // use memcache backend 67 67 if ($config->get('session_storage', 'db') == 'memcache') { 68 $this->memcache = rc mail::get_instance()->get_memcache();68 $this->memcache = rcube::get_instance()->get_memcache(); 69 69 70 70 // set custom functions for PHP session management if memcache is available … … 633 633 { 634 634 if ($this->logging) 635 rc mail::write_log('session', $line);635 rcube::write_log('session', $line); 636 636 } 637 637 -
trunk/roundcubemail/program/include/rcube_smtp.php
r6091 r6092 53 53 public function connect($host=null, $port=null, $user=null, $pass=null) 54 54 { 55 $ RCMAIL= rcube::get_instance();55 $rcube = rcube::get_instance(); 56 56 57 57 // disconnect/destroy $this->conn … … 62 62 63 63 // let plugins alter smtp connection config 64 $CONFIG = $ RCMAIL->plugins->exec_hook('smtp_connect', array(65 'smtp_server' => $host ? $host : $ RCMAIL->config->get('smtp_server'),66 'smtp_port' => $port ? $port : $ RCMAIL->config->get('smtp_port', 25),67 'smtp_user' => $user ? $user : $ RCMAIL->config->get('smtp_user'),68 'smtp_pass' => $pass ? $pass : $ RCMAIL->config->get('smtp_pass'),69 'smtp_auth_cid' => $ RCMAIL->config->get('smtp_auth_cid'),70 'smtp_auth_pw' => $ RCMAIL->config->get('smtp_auth_pw'),71 'smtp_auth_type' => $ RCMAIL->config->get('smtp_auth_type'),72 'smtp_helo_host' => $ RCMAIL->config->get('smtp_helo_host'),73 'smtp_timeout' => $ RCMAIL->config->get('smtp_timeout'),64 $CONFIG = $rcube->plugins->exec_hook('smtp_connect', array( 65 'smtp_server' => $host ? $host : $rcube->config->get('smtp_server'), 66 'smtp_port' => $port ? $port : $rcube->config->get('smtp_port', 25), 67 'smtp_user' => $user ? $user : $rcube->config->get('smtp_user'), 68 'smtp_pass' => $pass ? $pass : $rcube->config->get('smtp_pass'), 69 'smtp_auth_cid' => $rcube->config->get('smtp_auth_cid'), 70 'smtp_auth_pw' => $rcube->config->get('smtp_auth_pw'), 71 'smtp_auth_type' => $rcube->config->get('smtp_auth_type'), 72 'smtp_helo_host' => $rcube->config->get('smtp_helo_host'), 73 'smtp_timeout' => $rcube->config->get('smtp_timeout'), 74 74 'smtp_auth_callbacks' => array(), 75 75 )); … … 110 110 $this->conn = new Net_SMTP($smtp_host, $smtp_port, $helo_host); 111 111 112 if ($ RCMAIL->config->get('smtp_debug'))112 if ($rcube->config->get('smtp_debug')) 113 113 $this->conn->setDebug(true, array($this, 'debug_handler')); 114 114 … … 139 139 140 140 $smtp_user = str_replace('%u', $_SESSION['username'], $CONFIG['smtp_user']); 141 $smtp_pass = str_replace('%p', $ RCMAIL->decrypt($_SESSION['password']), $CONFIG['smtp_pass']);141 $smtp_pass = str_replace('%p', $rcube->decrypt($_SESSION['password']), $CONFIG['smtp_pass']); 142 142 $smtp_auth_type = empty($CONFIG['smtp_auth_type']) ? NULL : $CONFIG['smtp_auth_type']; 143 143 … … 339 339 public function debug_handler(&$smtp, $message) 340 340 { 341 rc mail::write_log('smtp', preg_replace('/\r\n$/', '', $message));341 rcube::write_log('smtp', preg_replace('/\r\n$/', '', $message)); 342 342 } 343 343 -
trunk/roundcubemail/program/include/rcube_spellchecker.php
r6073 r6092 57 57 function __construct($lang = 'en') 58 58 { 59 $this->rc = rc mail::get_instance();59 $this->rc = rcube::get_instance(); 60 60 $this->engine = $this->rc->config->get('spellcheck_engine', 'googie'); 61 61 $this->lang = $lang ? $lang : 'en'; -
trunk/roundcubemail/program/include/rcube_user.php
r6073 r6092 45 45 46 46 /** 47 * rcmailobject.48 * 49 * @var rc mail47 * Framework object. 48 * 49 * @var rcube 50 50 */ 51 51 private $rc; … … 62 62 function __construct($id = null, $sql_arr = null) 63 63 { 64 $this->rc = rc mail::get_instance();64 $this->rc = rcube::get_instance(); 65 65 $this->db = $this->rc->get_dbh(); 66 66 … … 401 401 static function query($user, $host) 402 402 { 403 $dbh = rc mail::get_instance()->get_dbh();403 $dbh = rcube::get_instance()->get_dbh(); 404 404 405 405 // query for matching user name … … 432 432 $user_name = ''; 433 433 $user_email = ''; 434 $rc mail = rcmail::get_instance();434 $rcube = rcube::get_instance(); 435 435 436 436 // try to resolve user in virtuser table and file … … 439 439 } 440 440 441 $data = $rc mail->plugins->exec_hook('user_create',441 $data = $rcube->plugins->exec_hook('user_create', 442 442 array('user'=>$user, 'user_name'=>$user_name, 'user_email'=>$user_email, 'host'=>$host)); 443 443 … … 449 449 $user_email = $data['user_email']; 450 450 451 $dbh = $rc mail->get_dbh();451 $dbh = $rcube->get_dbh(); 452 452 453 453 $dbh->query( … … 463 463 // create rcube_user instance to make plugin hooks work 464 464 $user_instance = new rcube_user($user_id); 465 $rc mail->user= $user_instance;466 467 $mail_domain = $rc mail->config->mail_domain($host);465 $rcube->user = $user_instance; 466 467 $mail_domain = $rcube->config->mail_domain($host); 468 468 469 469 if ($user_email == '') { … … 477 477 $email_list[] = strip_newlines($user_email); 478 478 // identities_level check 479 else if (count($email_list) > 1 && $rc mail->config->get('identities_level', 0) > 1)479 else if (count($email_list) > 1 && $rcube->config->get('identities_level', 0) > 1) 480 480 $email_list = array($email_list[0]); 481 481 … … 498 498 $record['standard'] = $standard; 499 499 500 $plugin = $rc mail->plugins->exec_hook('identity_create',500 $plugin = $rcube->plugins->exec_hook('identity_create', 501 501 array('login' => true, 'record' => $record)); 502 502 503 503 if (!$plugin['abort'] && $plugin['record']['email']) { 504 $rc mail->user->insert_identity($plugin['record']);504 $rcube->user->insert_identity($plugin['record']); 505 505 } 506 506 $standard = 0; … … 528 528 static function email2user($email) 529 529 { 530 $rc mail = rcmail::get_instance();531 $plugin = $rc mail->plugins->exec_hook('email2user',530 $rcube = rcube::get_instance(); 531 $plugin = $rcube->plugins->exec_hook('email2user', 532 532 array('email' => $email, 'user' => NULL)); 533 533 … … 546 546 static function user2email($user, $first=true, $extended=false) 547 547 { 548 $rc mail = rcmail::get_instance();549 $plugin = $rc mail->plugins->exec_hook('user2email',548 $rcube = rcube::get_instance(); 549 $plugin = $rcube->plugins->exec_hook('user2email', 550 550 array('email' => NULL, 'user' => $user, 551 551 'first' => $first, 'extended' => $extended));
Note: See TracChangeset
for help on using the changeset viewer.
