Exemple #1
0
 /**
  * Connect to IMAP server with stored session data
  *
  * @return bool True on success, false on error
  */
 public function imap_connect()
 {
     if (!$this->imap) {
         $this->imap_init();
     }
     if ($_SESSION['imap_host'] && !$this->imap->conn->connected()) {
         if (!$this->imap->connect($_SESSION['imap_host'], $_SESSION['username'], $this->decrypt($_SESSION['password']), $_SESSION['imap_port'], $_SESSION['imap_ssl'])) {
             if ($this->output) {
                 $this->output->show_message($this->imap->get_error_code() == -1 ? 'imaperror' : 'sessionerror', 'error');
             }
         } else {
             $this->set_imap_prop();
             return $this->imap->conn;
         }
     }
     return false;
 }
 function gen_js_list()
 {
     $this->_startup();
     if (sizeof($this->script) == 0) {
         $this->api->output->command('sieverules_update_list', 'add-first', -1, rep_specialchars_output($this->gettext('nosieverules')));
     } else {
         foreach ($this->script as $idx => $filter) {
             if ($filter['disabled'] == 1) {
                 $filter_name = $filter['name'] . ' (' . $this->gettext('disabled') . ')';
             } else {
                 $filter_name = $filter['name'];
             }
             $tmp_output = new rcube_template('settings');
             $dst = $idx - 1;
             $up_link = $tmp_output->button(array('command' => 'plugin.sieverules.move', 'prop' => $dst, 'type' => 'link', 'class' => 'up_arrow', 'title' => 'sieverules.moveup', 'content' => ' '));
             $up_link = str_replace("'", "\\'", $up_link);
             $dst = $idx + 2;
             $down_link = $tmp_output->button(array('command' => 'plugin.sieverules.move', 'prop' => $dst, 'type' => 'link', 'class' => 'down_arrow', 'title' => 'sieverules.movedown', 'content' => ' '));
             $down_link = str_replace("'", "\\'", $down_link);
             $this->api->output->command('sieverules_update_list', $idx == 0 ? 'add-first' : 'add', 'rcmrow' . $idx, Q($filter_name), $down_link, $up_link);
         }
     }
     $this->api->output->send();
 }
Exemple #3
0
 /**
  * Connect to the mail storage server with stored session data
  *
  * @return bool True on success, False on error
  */
 public function storage_connect()
 {
     $storage = $this->get_storage();
     if ($_SESSION['storage_host'] && !$storage->is_connected()) {
         $host = $_SESSION['storage_host'];
         $user = $_SESSION['username'];
         $port = $_SESSION['storage_port'];
         $ssl = $_SESSION['storage_ssl'];
         $pass = $this->decrypt($_SESSION['password']);
         if (!$storage->connect($host, $user, $pass, $port, $ssl)) {
             if ($this->output) {
                 $this->output->show_message($storage->get_error_code() == -1 ? 'storageerror' : 'sessionerror', 'error');
             }
         } else {
             $this->set_storage_prop();
         }
     }
     return $storage->is_connected();
 }