Changeset 6092 in subversion


Ignore:
Timestamp:
Apr 16, 2012 7:59:08 AM (13 months ago)
Author:
alec
Message:
  • Replace some references to rcmail with rcube
Location:
trunk/roundcubemail/program/include
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • trunk/roundcubemail/program/include/rcube.php

    r6091 r6092  
    33/* 
    44 +-----------------------------------------------------------------------+ 
    5  | program/include/rcmail.php                                            | 
     5 | program/include/rcube.php                                             | 
    66 |                                                                       | 
    77 | This file is part of the Roundcube Webmail client                     | 
     
    3737 
    3838  /** 
    39    * Singleton instace of rcmail 
     39   * Singleton instace of rcube 
    4040   * 
    4141   * @var rcmail 
     
    110110   * This implements the 'singleton' design pattern 
    111111   * 
    112    * @return rcmail The one and only instance 
     112   * @return rcube The one and only instance 
    113113   */ 
    114114  static function get_instance() 
     
    719719    /*- 
    720720     * Trim PHP's padding and the canary byte; see note in 
    721      * rcmail::encrypt() and http://php.net/mcrypt_generic#68082 
     721     * rcube::encrypt() and http://php.net/mcrypt_generic#68082 
    722722     */ 
    723723    $clear = substr(rtrim($clear, "\0"), 0, -1); 
     
    849849        $args = func_get_args(); 
    850850 
    851         if (class_exists('rcmail', false)) { 
     851        if (class_exists('rcube', false)) { 
    852852            $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; 
    859856            } 
     857           $args = $plugin['args']; 
    860858        } 
    861859 
  • trunk/roundcubemail/program/include/rcube_cache.php

    r6073 r6092  
    6767    function __construct($type, $userid, $prefix='', $ttl=0, $packed=true) 
    6868    { 
    69         $rcmail = rcube::get_instance(); 
    70         $type   = strtolower($type); 
     69        $rcube = rcube::get_instance(); 
     70        $type  = strtolower($type); 
    7171 
    7272        if ($type == 'memcache') { 
    7373            $this->type = 'memcache'; 
    74             $this->db   = $rcmail->get_memcache(); 
     74            $this->db   = $rcube->get_memcache(); 
    7575        } 
    7676        else if ($type == 'apc') { 
     
    8080        else { 
    8181            $this->type = 'db'; 
    82             $this->db   = $rcmail->get_dbh(); 
     82            $this->db   = $rcube->get_dbh(); 
    8383        } 
    8484 
  • trunk/roundcubemail/program/include/rcube_config.php

    r6091 r6092  
    187187        } 
    188188 
    189         $rcmail = rcube::get_instance(); 
     189        $rcube = rcube::get_instance(); 
    190190 
    191191        if ($name == 'timezone' && isset($this->prop['_timezone_value'])) 
    192192            $result = $this->prop['_timezone_value']; 
    193193 
    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']; 
    202198    } 
    203199 
  • trunk/roundcubemail/program/include/rcube_image.php

    r6031 r6092  
    7474    public function resize($size, $filename = null) 
    7575    { 
    76         $result   = false; 
    77         $rcmail   = 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(); 
    8080 
    8181        if (!$filename) { 
     
    9999 
    100100            if (in_array($type, explode(',', $p['types']))) { // Valid type? 
    101                 $result = rcmail::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) === ''; 
    102102            } 
    103103 
     
    162162    private function identify() 
    163163    { 
    164         $rcmail = rcmail::get_instance(); 
     164        $rcube = rcube::get_instance(); 
    165165 
    166         if ($cmd = $rcmail->config->get('im_identify_path')) { 
     166        if ($cmd = $rcube->config->get('im_identify_path')) { 
    167167            $args = array('in' => $this->image_file, 'format' => "%m %[fx:w] %[fx:h]"); 
    168             $id   = rcmail::exec($cmd. ' 2>/dev/null -format {format} {in}', $args); 
     168            $id   = rcube::exec($cmd. ' 2>/dev/null -format {format} {in}', $args); 
    169169 
    170170            if ($id) { 
  • trunk/roundcubemail/program/include/rcube_imap.php

    r6091 r6092  
    25992599 
    26002600        // Give plugins a chance to provide a list of folders 
    2601         $data = rcmail::get_instance()->plugins->exec_hook('storage_folders', 
     2601        $data = rcube::get_instance()->plugins->exec_hook('storage_folders', 
    26022602            array('root' => $root, 'name' => $name, 'filter' => $filter, 'mode' => 'LIST')); 
    26032603 
     
    35093509     * Enable or disable indexes caching 
    35103510     * 
    3511      * @param string $type Cache type (@see rcmail::get_cache) 
     3511     * @param string $type Cache type (@see rcube::get_cache) 
    35123512     */ 
    35133513    public function set_caching($type) 
     
    35313531    { 
    35323532        if ($this->caching && !$this->cache) { 
    3533             $rcmail = rcube::get_instance(); 
    3534             $ttl = $rcmail->config->get('message_cache_lifetime', '10d') - mktime(); 
    3535             $this->cache = $rcmail->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); 
    35363536        } 
    35373537 
     
    35863586    { 
    35873587        if ($this->mcache) { 
    3588             $ttl = rcmail::get_instance()->config->get('message_cache_lifetime', '10d'); 
     3588            $ttl = rcube::get_instance()->config->get('message_cache_lifetime', '10d'); 
    35893589            $this->mcache->expunge($ttl); 
    35903590        } 
     
    36263626    { 
    36273627        if ($this->messages_caching && !$this->mcache) { 
    3628             $rcmail = rcube::get_instance(); 
    3629             if ($dbh = $rcmail->get_dbh()) { 
     3628            $rcube = rcube::get_instance(); 
     3629            if ($dbh = $rcube->get_dbh()) { 
    36303630                $this->mcache = new rcube_imap_cache( 
    3631                     $dbh, $this, $rcmail->get_user_id(), $this->options['skip_deleted']); 
     3631                    $dbh, $this, $rcube->get_user_id(), $this->options['skip_deleted']); 
    36323632            } 
    36333633        } 
     
    38533853    public function debug_handler(&$imap, $message) 
    38543854    { 
    3855         rcmail::write_log('imap', $message); 
     3855        rcube::write_log('imap', $message); 
    38563856    } 
    38573857 
  • trunk/roundcubemail/program/include/rcube_ldap.php

    r6091 r6092  
    164164 
    165165        // initialize cache 
    166         $rcmail = rcmail::get_instance(); 
    167         $this->cache = $rcmail->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); 
    168168 
    169169        $this->_connect(); 
     
    176176    private function _connect() 
    177177    { 
    178         $RCMAIL = rcmail::get_instance(); 
     178        $rcube = rcube::get_instance(); 
    179179 
    180180        if (!function_exists('ldap_connect')) 
     
    195195        foreach ($this->prop['hosts'] as $host) 
    196196        { 
    197             $host     = idn_to_ascii(rcube_utils::parse_host($host)); 
     197            $host     = rcube_utils::idn_to_ascii(rcube_utils::parse_host($host)); 
    198198            $hostname = $host.($this->prop['port'] ? ':'.$this->prop['port'] : ''); 
    199199 
     
    244244            // No password set, use the session password 
    245245            if (empty($bind_pass)) { 
    246                 $bind_pass = $RCMAIL->decrypt($_SESSION['password']); 
     246                $bind_pass = $rcube->decrypt($_SESSION['password']); 
    247247            } 
    248248 
    249249            // Get the pieces needed for variable replacement. 
    250             if ($fu = $RCMAIL->get_user_name()) 
     250            if ($fu = $rcube->get_user_name()) 
    251251                list($u, $d) = explode('@', $fu); 
    252252            else 
     
    15631563    { 
    15641564        if ($this->debug) { 
    1565             rcmail::write_log('ldap', $str); 
     1565            rcube::write_log('ldap', $str); 
    15661566        } 
    15671567    } 
  • trunk/roundcubemail/program/include/rcube_mdb2.php

    r6073 r6092  
    827827            $debug_output = sprintf('%s(%d): %s;', 
    828828                $scope, $db->db_index, rtrim($message, ';')); 
    829             rcmail::write_log('sql', $debug_output); 
     829            rcube::write_log('sql', $debug_output); 
    830830        } 
    831831    } 
     
    841841    public function table_name($table) 
    842842    { 
    843         $rcmail = rcube::get_instance(); 
     843        $rcube = rcube::get_instance(); 
    844844 
    845845        // return table name if configured 
    846846        $config_key = 'db_table_'.$table; 
    847847 
    848         if ($name = $rcmail->config->get($config_key)) { 
     848        if ($name = $rcube->config->get($config_key)) { 
    849849            return $name; 
    850850        } 
     
    864864    public function sequence_name($sequence) 
    865865    { 
    866         $rcmail = rcube::get_instance(); 
     866        $rcube = rcube::get_instance(); 
    867867 
    868868        // return sequence name if configured 
    869869        $config_key = 'db_sequence_'.$sequence; 
    870870 
    871         if ($name = $rcmail->config->get($config_key)) { 
     871        if ($name = $rcube->config->get($config_key)) { 
    872872            return $name; 
    873873        } 
  • trunk/roundcubemail/program/include/rcube_message.php

    r6074 r6092  
    3434{ 
    3535    /** 
    36      * Instace of rcmail. 
    37      * 
    38      * @var rcmail 
     36     * Instace of framework class. 
     37     * 
     38     * @var rcube 
    3939     */ 
    4040    private $app; 
  • trunk/roundcubemail/program/include/rcube_mime.php

    r6079 r6092  
    4747        } 
    4848        else { 
    49             self::$default_charset = rcmail::get_instance()->config->get('default_charset', RCMAIL_CHARSET); 
     49            self::$default_charset = rcube::get_instance()->config->get('default_charset', RCMAIL_CHARSET); 
    5050        } 
    5151    } 
  • trunk/roundcubemail/program/include/rcube_output_html.php

    r6091 r6092  
    12071207 
    12081208        // 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)); 
    12101210        if (!$hook['abort']) { 
    12111211            if ($this->charset != RCMAIL_CHARSET) { 
  • trunk/roundcubemail/program/include/rcube_output_json.php

    r6091 r6092  
    171171    public function redirect($p = array(), $delay = 1) 
    172172    { 
    173         $location = rcmail::get_instance()->url($p); 
     173        $location = $this->app->url($p); 
    174174        $this->remote_response(sprintf("window.setTimeout(function(){ %s.redirect('%s',true); }, %d);", 
    175175            rcmail::JS_OBJECT_NAME, $location, $delay)); 
  • trunk/roundcubemail/program/include/rcube_plugin.php

    r6073 r6092  
    111111  { 
    112112    $fpath = $this->home.'/'.$fname; 
    113     $rcmail = rcube::get_instance(); 
    114     if (is_file($fpath) && !$rcmail->config->load_from_file($fpath)) { 
     113    $rcube = rcube::get_instance(); 
     114    if (is_file($fpath) && !$rcube->config->load_from_file($fpath)) { 
    115115      rcube::raise_error(array( 
    116116        'code' => 527, 'type' => 'php', 
     
    178178        $add[$domain.'.'.$key] = $value; 
    179179 
    180       $rcmail = rcube::get_instance(); 
     180      $rcmail = rcmail::get_instance(); 
    181181      $rcmail->load_language($lang, $add); 
    182182 
  • trunk/roundcubemail/program/include/rcube_session.php

    r6091 r6092  
    6666    // use memcache backend 
    6767    if ($config->get('session_storage', 'db') == 'memcache') { 
    68       $this->memcache = rcmail::get_instance()->get_memcache(); 
     68      $this->memcache = rcube::get_instance()->get_memcache(); 
    6969 
    7070      // set custom functions for PHP session management if memcache is available 
     
    633633  { 
    634634    if ($this->logging) 
    635       rcmail::write_log('session', $line); 
     635      rcube::write_log('session', $line); 
    636636  } 
    637637 
  • trunk/roundcubemail/program/include/rcube_smtp.php

    r6091 r6092  
    5353  public function connect($host=null, $port=null, $user=null, $pass=null) 
    5454  { 
    55     $RCMAIL = rcube::get_instance(); 
     55    $rcube = rcube::get_instance(); 
    5656 
    5757    // disconnect/destroy $this->conn 
     
    6262 
    6363    // 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'), 
    7474      'smtp_auth_callbacks' => array(), 
    7575    )); 
     
    110110    $this->conn = new Net_SMTP($smtp_host, $smtp_port, $helo_host); 
    111111 
    112     if ($RCMAIL->config->get('smtp_debug')) 
     112    if ($rcube->config->get('smtp_debug')) 
    113113      $this->conn->setDebug(true, array($this, 'debug_handler')); 
    114114 
     
    139139 
    140140    $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']); 
    142142    $smtp_auth_type = empty($CONFIG['smtp_auth_type']) ? NULL : $CONFIG['smtp_auth_type']; 
    143143 
     
    339339  public function debug_handler(&$smtp, $message) 
    340340  { 
    341     rcmail::write_log('smtp', preg_replace('/\r\n$/', '', $message)); 
     341    rcube::write_log('smtp', preg_replace('/\r\n$/', '', $message)); 
    342342  } 
    343343 
  • trunk/roundcubemail/program/include/rcube_spellchecker.php

    r6073 r6092  
    5757    function __construct($lang = 'en') 
    5858    { 
    59         $this->rc     = rcmail::get_instance(); 
     59        $this->rc     = rcube::get_instance(); 
    6060        $this->engine = $this->rc->config->get('spellcheck_engine', 'googie'); 
    6161        $this->lang   = $lang ? $lang : 'en'; 
  • trunk/roundcubemail/program/include/rcube_user.php

    r6073 r6092  
    4545 
    4646    /** 
    47      * rcmail object. 
    48      * 
    49      * @var rcmail 
     47     * Framework object. 
     48     * 
     49     * @var rcube 
    5050     */ 
    5151    private $rc; 
     
    6262    function __construct($id = null, $sql_arr = null) 
    6363    { 
    64         $this->rc = rcmail::get_instance(); 
     64        $this->rc = rcube::get_instance(); 
    6565        $this->db = $this->rc->get_dbh(); 
    6666 
     
    401401    static function query($user, $host) 
    402402    { 
    403         $dbh = rcmail::get_instance()->get_dbh(); 
     403        $dbh = rcube::get_instance()->get_dbh(); 
    404404 
    405405        // query for matching user name 
     
    432432        $user_name  = ''; 
    433433        $user_email = ''; 
    434         $rcmail = rcmail::get_instance(); 
     434        $rcube = rcube::get_instance(); 
    435435 
    436436        // try to resolve user in virtuser table and file 
     
    439439        } 
    440440 
    441         $data = $rcmail->plugins->exec_hook('user_create', 
     441        $data = $rcube->plugins->exec_hook('user_create', 
    442442                array('user'=>$user, 'user_name'=>$user_name, 'user_email'=>$user_email, 'host'=>$host)); 
    443443 
     
    449449        $user_email = $data['user_email']; 
    450450 
    451         $dbh = $rcmail->get_dbh(); 
     451        $dbh = $rcube->get_dbh(); 
    452452 
    453453        $dbh->query( 
     
    463463            // create rcube_user instance to make plugin hooks work 
    464464            $user_instance = new rcube_user($user_id); 
    465             $rcmail->user  = $user_instance; 
    466  
    467             $mail_domain = $rcmail->config->mail_domain($host); 
     465            $rcube->user   = $user_instance; 
     466 
     467            $mail_domain = $rcube->config->mail_domain($host); 
    468468 
    469469            if ($user_email == '') { 
     
    477477                $email_list[] = strip_newlines($user_email); 
    478478            // identities_level check 
    479             else if (count($email_list) > 1 && $rcmail->config->get('identities_level', 0) > 1) 
     479            else if (count($email_list) > 1 && $rcube->config->get('identities_level', 0) > 1) 
    480480                $email_list = array($email_list[0]); 
    481481 
     
    498498                $record['standard'] = $standard; 
    499499 
    500                 $plugin = $rcmail->plugins->exec_hook('identity_create', 
     500                $plugin = $rcube->plugins->exec_hook('identity_create', 
    501501                        array('login' => true, 'record' => $record)); 
    502502 
    503503                if (!$plugin['abort'] && $plugin['record']['email']) { 
    504                     $rcmail->user->insert_identity($plugin['record']); 
     504                    $rcube->user->insert_identity($plugin['record']); 
    505505                } 
    506506                $standard = 0; 
     
    528528    static function email2user($email) 
    529529    { 
    530         $rcmail = rcmail::get_instance(); 
    531         $plugin = $rcmail->plugins->exec_hook('email2user', 
     530        $rcube = rcube::get_instance(); 
     531        $plugin = $rcube->plugins->exec_hook('email2user', 
    532532            array('email' => $email, 'user' => NULL)); 
    533533 
     
    546546    static function user2email($user, $first=true, $extended=false) 
    547547    { 
    548         $rcmail = rcmail::get_instance(); 
    549         $plugin = $rcmail->plugins->exec_hook('user2email', 
     548        $rcube = rcube::get_instance(); 
     549        $plugin = $rcube->plugins->exec_hook('user2email', 
    550550            array('email' => NULL, 'user' => $user, 
    551551                'first' => $first, 'extended' => $extended)); 
Note: See TracChangeset for help on using the changeset viewer.