コード例 #1
0
 /**
  * __construct
  *
  * Provide a uid, and parse message structure.
  *
  * @param string $uid    The message UID.
  * @param string $folder Folder name
  *
  * @see self::$app, self::$storage, self::$opt, self::$parts
  */
 function __construct($uid, $folder = null)
 {
     // decode combined UID-folder identifier
     if (preg_match('/^\\d+-.+/', $uid)) {
         list($uid, $folder) = explode('-', $uid, 2);
     }
     $this->uid = $uid;
     $this->app = rcube::get_instance();
     $this->storage = $this->app->get_storage();
     $this->folder = strlen($folder) ? $folder : $this->storage->get_folder();
     $this->storage->set_options(array('all_headers' => true));
     // Set current folder
     $this->storage->set_folder($this->folder);
     $this->headers = $this->storage->get_message($uid);
     if (!$this->headers) {
         return;
     }
     $this->mime = new rcube_mime($this->headers->charset);
     $this->subject = $this->headers->get('subject');
     list(, $this->sender) = each($this->mime->decode_address_list($this->headers->from, 1));
     $this->set_safe(intval($_GET['_safe']) || $_SESSION['safe_messages'][$this->folder . ':' . $uid]);
     $this->opt = array('safe' => $this->is_safe, 'prefer_html' => $this->app->config->get('prefer_html'), 'get_url' => $this->app->url(array('action' => 'get', 'mbox' => $this->storage->get_folder(), 'uid' => $uid)));
     if (!empty($this->headers->structure)) {
         $this->get_mime_numbers($this->headers->structure);
         $this->parse_structure($this->headers->structure);
     } else {
         $this->body = $this->storage->get_body($uid);
     }
     // notify plugins and let them analyze this structured message object
     $this->app->plugins->exec_hook('message_load', array('object' => $this));
 }
コード例 #2
0
ファイル: rcube.php プロジェクト: neynah/roundcubemail
 /**
  * Initialize storage object
  */
 public function storage_init()
 {
     // already initialized
     if (is_object($this->storage)) {
         return;
     }
     $driver = $this->config->get('storage_driver', 'imap');
     $driver_class = "rcube_{$driver}";
     if (!class_exists($driver_class)) {
         self::raise_error(array('code' => 700, 'type' => 'php', 'file' => __FILE__, 'line' => __LINE__, 'message' => "Storage driver class ({$driver}) not found!"), true, true);
     }
     // Initialize storage object
     $this->storage = new $driver_class();
     // for backward compat. (deprecated, will be removed)
     $this->imap = $this->storage;
     // set class options
     $options = array('auth_type' => $this->config->get("{$driver}_auth_type", 'check'), 'auth_cid' => $this->config->get("{$driver}_auth_cid"), 'auth_pw' => $this->config->get("{$driver}_auth_pw"), 'debug' => (bool) $this->config->get("{$driver}_debug"), 'force_caps' => (bool) $this->config->get("{$driver}_force_caps"), 'disabled_caps' => $this->config->get("{$driver}_disabled_caps"), 'socket_options' => $this->config->get("{$driver}_conn_options"), 'timeout' => (int) $this->config->get("{$driver}_timeout"), 'skip_deleted' => (bool) $this->config->get('skip_deleted'), 'driver' => $driver);
     if (!empty($_SESSION['storage_host'])) {
         $options['host'] = $_SESSION['storage_host'];
         $options['user'] = $_SESSION['username'];
         $options['port'] = $_SESSION['storage_port'];
         $options['ssl'] = $_SESSION['storage_ssl'];
         $options['password'] = $this->decrypt($_SESSION['password']);
         $_SESSION[$driver . '_host'] = $_SESSION['storage_host'];
     }
     $options = $this->plugins->exec_hook("storage_init", $options);
     // for backward compat. (deprecated, to be removed)
     $options = $this->plugins->exec_hook("imap_init", $options);
     $this->storage->set_options($options);
     $this->set_storage_prop();
     // subscribe to 'storage_connected' hook for session logging
     if ($this->config->get('imap_log_session', false)) {
         $this->plugins->register_hook('storage_connected', array($this, 'storage_log_session'));
     }
 }
コード例 #3
0
ファイル: rcube.php プロジェクト: npk/roundcubemail
 /**
  * Initialize storage object
  */
 public function storage_init()
 {
     // already initialized
     if (is_object($this->storage)) {
         return;
     }
     $driver = $this->config->get('storage_driver', 'imap');
     $driver_class = "rcube_{$driver}";
     if (!class_exists($driver_class)) {
         self::raise_error(array('code' => 700, 'type' => 'php', 'file' => __FILE__, 'line' => __LINE__, 'message' => "Storage driver class ({$driver}) not found!"), true, true);
     }
     // Initialize storage object
     $this->storage = new $driver_class();
     // for backward compat. (deprecated, will be removed)
     $this->imap = $this->storage;
     // enable caching of mail data
     $storage_cache = $this->config->get("{$driver}_cache");
     $messages_cache = $this->config->get('messages_cache');
     // for backward compatybility
     if ($storage_cache === null && $messages_cache === null && $this->config->get('enable_caching')) {
         $storage_cache = 'db';
         $messages_cache = true;
     }
     if ($storage_cache) {
         $this->storage->set_caching($storage_cache);
     }
     if ($messages_cache) {
         $this->storage->set_messages_caching(true);
     }
     // set pagesize from config
     $pagesize = $this->config->get('mail_pagesize');
     if (!$pagesize) {
         $pagesize = $this->config->get('pagesize', 50);
     }
     $this->storage->set_pagesize($pagesize);
     // set class options
     $options = array('auth_type' => $this->config->get("{$driver}_auth_type", 'check'), 'auth_cid' => $this->config->get("{$driver}_auth_cid"), 'auth_pw' => $this->config->get("{$driver}_auth_pw"), 'debug' => (bool) $this->config->get("{$driver}_debug"), 'force_caps' => (bool) $this->config->get("{$driver}_force_caps"), 'timeout' => (int) $this->config->get("{$driver}_timeout"), 'skip_deleted' => (bool) $this->config->get('skip_deleted'), 'driver' => $driver);
     if (!empty($_SESSION['storage_host'])) {
         $options['host'] = $_SESSION['storage_host'];
         $options['user'] = $_SESSION['username'];
         $options['port'] = $_SESSION['storage_port'];
         $options['ssl'] = $_SESSION['storage_ssl'];
         $options['password'] = $this->decrypt($_SESSION['password']);
         $_SESSION[$driver . '_host'] = $_SESSION['storage_host'];
     }
     $options = $this->plugins->exec_hook("storage_init", $options);
     // for backward compat. (deprecated, to be removed)
     $options = $this->plugins->exec_hook("imap_init", $options);
     $this->storage->set_options($options);
     $this->set_storage_prop();
 }
コード例 #4
0
ファイル: rcube_message.php プロジェクト: npk/roundcubemail
 /**
  * __construct
  *
  * Provide a uid, and parse message structure.
  *
  * @param string $uid The message UID.
  *
  * @see self::$app, self::$storage, self::$opt, self::$parts
  */
 function __construct($uid)
 {
     $this->uid = $uid;
     $this->app = rcube::get_instance();
     $this->storage = $this->app->get_storage();
     $this->storage->set_options(array('all_headers' => true));
     $this->headers = $this->storage->get_message($uid);
     if (!$this->headers) {
         return;
     }
     $this->mime = new rcube_mime($this->headers->charset);
     $this->subject = $this->mime->decode_mime_string($this->headers->subject);
     list(, $this->sender) = each($this->mime->decode_address_list($this->headers->from, 1));
     $this->set_safe(intval($_GET['_safe']) || $_SESSION['safe_messages'][$uid]);
     $this->opt = array('safe' => $this->is_safe, 'prefer_html' => $this->app->config->get('prefer_html'), 'get_url' => $this->app->url(array('action' => 'get', 'mbox' => $this->storage->get_folder(), 'uid' => $uid)));
     if (!empty($this->headers->structure)) {
         $this->get_mime_numbers($this->headers->structure);
         $this->parse_structure($this->headers->structure);
     } else {
         $this->body = $this->storage->get_body($uid);
     }
     // notify plugins and let them analyze this structured message object
     $this->app->plugins->exec_hook('message_load', array('object' => $this));
 }