summaryrefslogtreecommitdiff
path: root/program/include/rcmail.php
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2010-02-13 17:33:25 +0000
committeralecpl <alec@alec.pl>2010-02-13 17:33:25 +0000
commit48bc52e835bd5485f7443d54399e4fb0d36732d7 (patch)
tree52a6be2f0aa273a9d0ea24c0b38c969147161671 /program/include/rcmail.php
parent9194996a28b6c8a45905e48ed937cc8e2aa5b92e (diff)
- Fix imap_init hook broken in r3258 (#1486493)
Diffstat (limited to 'program/include/rcmail.php')
-rw-r--r--program/include/rcmail.php25
1 files changed, 20 insertions, 5 deletions
diff --git a/program/include/rcmail.php b/program/include/rcmail.php
index cd6187281..68ab5004c 100644
--- a/program/include/rcmail.php
+++ b/program/include/rcmail.php
@@ -130,12 +130,17 @@ class rcmail
// set current task to session
$_SESSION['task'] = $this->task;
- // create IMAP object
- if ($this->task == 'login')
- $this->imap_init();
-
+ // init output class
+ if (!empty($_REQUEST['_remote']))
+ $GLOBALS['OUTPUT'] = $this->init_json();
+ else
+ $GLOBALS['OUTPUT'] = $this->load_gui(!empty($_REQUEST['_framed']));
+
// create plugin API and load plugins
$this->plugins = rcube_plugin_api::get_instance();
+
+ // init plugins
+ $this->plugins->init();
}
@@ -395,7 +400,11 @@ class rcmail
// set global object for backward compatibility
$GLOBALS['IMAP'] = $this->imap;
-
+
+ $hook = $this->plugins->exec_hook('imap_init', array('fetch_headers' => $this->imap->fetch_add_headers));
+ if ($hook['fetch_headers'])
+ $this->imap->fetch_add_headers = $hook['fetch_headers'];
+
if ($connect)
$this->imap_connect();
}
@@ -409,6 +418,9 @@ class rcmail
public function imap_connect()
{
$conn = false;
+
+ if (!$this->imap)
+ $this->imap_init();
if ($_SESSION['imap_host'] && !$this->imap->conn) {
if (!($conn = $this->imap->connect($_SESSION['imap_host'], $_SESSION['username'], $this->decrypt($_SESSION['password']), $_SESSION['imap_port'], $_SESSION['imap_ssl']))) {
@@ -494,6 +506,9 @@ class rcmail
if ($user = rcube_user::query($username, $host))
$username = $user->data['username'];
+ if (!$this->imap)
+ $this->imap_init();
+
// exit if IMAP login failed
if (!($imap_login = $this->imap->connect($host, $username, $pass, $imap_port, $imap_ssl)))
return false;