Remove deprecated functions (from bc.php file) usage in plugins
| | |
| | | */ |
| | | function acl_actions() |
| | | { |
| | | $action = trim(get_input_value('_act', RCUBE_INPUT_GPC)); |
| | | $action = trim(rcube_utils::get_input_value('_act', rcube_utils::INPUT_GPC)); |
| | | |
| | | // Connect to IMAP |
| | | $this->rc->storage_init(); |
| | |
| | | { |
| | | $this->load_config(); |
| | | |
| | | $search = get_input_value('_search', RCUBE_INPUT_GPC, true); |
| | | $sid = get_input_value('_id', RCUBE_INPUT_GPC); |
| | | $search = rcube_utils::get_input_value('_search', rcube_utils::INPUT_GPC, true); |
| | | $sid = rcube_utils::get_input_value('_id', rcube_utils::INPUT_GPC); |
| | | $users = array(); |
| | | |
| | | if ($this->init_ldap()) { |
| | |
| | | // add Info fieldset if it doesn't exist |
| | | if (!isset($args['form']['props']['fieldsets']['info'])) |
| | | $args['form']['props']['fieldsets']['info'] = array( |
| | | 'name' => rcube_label('info'), |
| | | 'name' => $this->rc->gettext('info'), |
| | | 'content' => array()); |
| | | |
| | | // Display folder rights to 'Info' fieldset |
| | | $args['form']['props']['fieldsets']['info']['content']['myrights'] = array( |
| | | 'label' => Q($this->gettext('myrights')), |
| | | 'label' => rcube::Q($this->gettext('myrights')), |
| | | 'value' => $this->acl2text($myrights) |
| | | ); |
| | | |
| | |
| | | $this->rc->output->add_label('autocompletechars', 'autocompletemore'); |
| | | |
| | | $args['form']['sharing'] = array( |
| | | 'name' => Q($this->gettext('sharing')), |
| | | 'name' => rcube::Q($this->gettext('sharing')), |
| | | 'content' => $this->rc->output->parse('acl.table', false, false), |
| | | ); |
| | | |
| | |
| | | |
| | | // filter out virtual rights (c or d) the server may return |
| | | $userrights = array_intersect($rights, $supported); |
| | | $userid = html_identifier($user); |
| | | $userid = rcube_utils::html_identifier($user); |
| | | |
| | | if (!empty($this->specials) && in_array($user, $this->specials)) { |
| | | $user = $this->gettext($user); |
| | | } |
| | | |
| | | $table->add_row(array('id' => 'rcmrow'.$userid)); |
| | | $table->add('user', Q($user)); |
| | | $table->add('user', rcube::Q($user)); |
| | | |
| | | foreach ($items as $key => $right) { |
| | | $in = $this->acl_compare($userrights, $right); |
| | |
| | | */ |
| | | private function action_save() |
| | | { |
| | | $mbox = trim(get_input_value('_mbox', RCUBE_INPUT_GPC, true)); // UTF7-IMAP |
| | | $user = trim(get_input_value('_user', RCUBE_INPUT_GPC)); |
| | | $acl = trim(get_input_value('_acl', RCUBE_INPUT_GPC)); |
| | | $oldid = trim(get_input_value('_old', RCUBE_INPUT_GPC)); |
| | | $mbox = trim(rcube_utils::get_input_value('_mbox', rcube_utils::INPUT_GPC, true)); // UTF7-IMAP |
| | | $user = trim(rcube_utils::get_input_value('_user', rcube_utils::INPUT_GPC)); |
| | | $acl = trim(rcube_utils::get_input_value('_acl', rcube_utils::INPUT_GPC)); |
| | | $oldid = trim(rcube_utils::get_input_value('_old', rcube_utils::INPUT_GPC)); |
| | | |
| | | $acl = array_intersect(str_split($acl), $this->rights_supported()); |
| | | $users = $oldid ? array($user) : explode(',', $user); |
| | |
| | | } |
| | | else { |
| | | if (!strpos($user, '@') && ($realm = $this->get_realm())) { |
| | | $user .= '@' . rcube_idn_to_ascii(preg_replace('/^@/', '', $realm)); |
| | | $user .= '@' . rcube_utils::idn_to_ascii(preg_replace('/^@/', '', $realm)); |
| | | } |
| | | $username = $user; |
| | | } |
| | |
| | | |
| | | if ($user != $_SESSION['username'] && $username != $_SESSION['username']) { |
| | | if ($this->rc->storage->set_acl($mbox, $user, $acl)) { |
| | | $ret = array('id' => html_identifier($user), |
| | | $ret = array('id' => rcube_utils::html_identifier($user), |
| | | 'username' => $username, 'acl' => implode($acl), 'old' => $oldid); |
| | | $this->rc->output->command('acl_update', $ret); |
| | | $result++; |
| | |
| | | */ |
| | | private function action_delete() |
| | | { |
| | | $mbox = trim(get_input_value('_mbox', RCUBE_INPUT_GPC, true)); //UTF7-IMAP |
| | | $user = trim(get_input_value('_user', RCUBE_INPUT_GPC)); |
| | | $mbox = trim(rcube_utils::get_input_value('_mbox', rcube_utils::INPUT_GPC, true)); //UTF7-IMAP |
| | | $user = trim(rcube_utils::get_input_value('_user', rcube_utils::INPUT_GPC)); |
| | | |
| | | $user = explode(',', $user); |
| | | |
| | | foreach ($user as $u) { |
| | | $u = trim($u); |
| | | if ($this->rc->storage->delete_acl($mbox, $u)) { |
| | | $this->rc->output->command('acl_remove_row', html_identifier($u)); |
| | | $this->rc->output->command('acl_remove_row', rcube_utils::html_identifier($u)); |
| | | } |
| | | else { |
| | | $error = true; |
| | |
| | | return; |
| | | } |
| | | |
| | | $this->mbox = trim(get_input_value('_mbox', RCUBE_INPUT_GPC, true)); // UTF7-IMAP |
| | | $advanced = trim(get_input_value('_mode', RCUBE_INPUT_GPC)); |
| | | $this->mbox = trim(rcube_utils::get_input_value('_mbox', rcube_utils::INPUT_GPC, true)); // UTF7-IMAP |
| | | $advanced = trim(rcube_utils::get_input_value('_mode', rcube_utils::INPUT_GPC)); |
| | | $advanced = $advanced == 'advanced' ? true : false; |
| | | |
| | | // Save state in user preferences |
| | |
| | | |
| | | foreach ($supported as $right) { |
| | | if (in_array($right, $rights)) { |
| | | $list[] = html::tag('li', null, Q($this->gettext('acl' . $right))); |
| | | $list[] = html::tag('li', null, rcube::Q($this->gettext('acl' . $right))); |
| | | } |
| | | } |
| | | |
| | | if (count($list) == count($supported)) |
| | | return Q($this->gettext('aclfull')); |
| | | return rcube::Q($this->gettext('aclfull')); |
| | | |
| | | return html::tag('ul', $attrib, implode("\n", $list)); |
| | | } |
| | |
| | | |
| | | // load folders list when needed |
| | | if ($CURR_SECTION) |
| | | $select = rcmail_mailbox_select(array('noselection' => '---', 'realnames' => true, |
| | | $select = $rcmail->folder_selector(array('noselection' => '---', 'realnames' => true, |
| | | 'maxlength' => 30, 'exceptions' => array('INBOX'), 'folder_filter' => 'mail', 'folder_rights' => 'w')); |
| | | else |
| | | $select = new html_select(); |
| | |
| | | function save_prefs($args) |
| | | { |
| | | if ($args['section'] == 'folders') { |
| | | $args['prefs']['archive_mbox'] = get_input_value('_archive_mbox', RCUBE_INPUT_POST); |
| | | $args['prefs']['archive_mbox'] = rcube_utils::get_input_value('_archive_mbox', rcube_utils::INPUT_POST); |
| | | return $args; |
| | | } |
| | | } |
| | |
| | | $data = base64_encode($data); |
| | | |
| | | $status = $rcmail->db->query( |
| | | "INSERT INTO ".get_table_name('cache') |
| | | "INSERT INTO ".$rcmail->db->table_name('cache') |
| | | ." (created, user_id, cache_key, data)" |
| | | ." VALUES (".$rcmail->db->now().", ?, ?, ?)", |
| | | $_SESSION['user_id'], |
| | |
| | | $data = base64_encode($args['data']); |
| | | |
| | | $status = $rcmail->db->query( |
| | | "INSERT INTO ".get_table_name('cache') |
| | | "INSERT INTO ".$rcmail->db->table_name('cache') |
| | | ." (created, user_id, cache_key, data)" |
| | | ." VALUES (".$rcmail->db->now().", ?, ?, ?)", |
| | | $_SESSION['user_id'], |
| | |
| | | $args['status'] = false; |
| | | $rcmail = rcmail::get_instance(); |
| | | $status = $rcmail->db->query( |
| | | "DELETE FROM ".get_table_name('cache') |
| | | "DELETE FROM ".$rcmail->db->table_name('cache') |
| | | ." WHERE user_id = ?" |
| | | ." AND cache_key = ?", |
| | | $_SESSION['user_id'], |
| | |
| | | |
| | | $sql_result = $rcmail->db->query( |
| | | "SELECT data" |
| | | ." FROM ".get_table_name('cache') |
| | | ." FROM ".$rcmail->db->table_name('cache') |
| | | ." WHERE user_id=?" |
| | | ." AND cache_key=?", |
| | | $_SESSION['user_id'], |
| | |
| | | $prefix = $this->cache_prefix . $args['group']; |
| | | $rcmail = rcmail::get_instance(); |
| | | $rcmail->db->query( |
| | | "DELETE FROM ".get_table_name('cache') |
| | | "DELETE FROM ".$rcmail->db->table_name('cache') |
| | | ." WHERE user_id = ?" |
| | | ." AND cache_key LIKE '{$prefix}%'", |
| | | $_SESSION['user_id']); |
| | |
| | | $this->register_action('plugin.enigma', array($this, 'preferences_ui')); |
| | | |
| | | // grab keys/certs management iframe requests |
| | | $section = get_input_value('_section', RCUBE_INPUT_GET); |
| | | $section = rcube_utils::get_input_value('_section', rcube_utils::INPUT_GET); |
| | | if ($this->rc->action == 'edit-prefs' && preg_match('/^enigma(certs|keys)/', $section)) { |
| | | $this->load_ui(); |
| | | $this->ui->init($section); |
| | |
| | | { |
| | | if ($p['section'] == 'enigmasettings') { |
| | | $a['prefs'] = array( |
| | | // 'dummy' => get_input_value('_dummy', RCUBE_INPUT_POST), |
| | | // 'dummy' => rcube_utils::get_input_value('_dummy', rcube_utils::INPUT_POST), |
| | | ); |
| | | } |
| | | |
| | |
| | | $attrib['class'] = 'enigmaerror'; |
| | | $code = $status->getCode(); |
| | | if ($code == enigma_error::E_KEYNOTFOUND) |
| | | $msg = Q(str_replace('$keyid', enigma_key::format_id($status->getData('id')), |
| | | $msg = rcube::Q(str_replace('$keyid', enigma_key::format_id($status->getData('id')), |
| | | $this->gettext('decryptnokey'))); |
| | | else if ($code == enigma_error::E_BADPASS) |
| | | $msg = Q($this->gettext('decryptbadpass')); |
| | | $msg = rcube::Q($this->gettext('decryptbadpass')); |
| | | else |
| | | $msg = Q($this->gettext('decrypterror')); |
| | | $msg = rcube::Q($this->gettext('decrypterror')); |
| | | } |
| | | else { |
| | | $attrib['class'] = 'enigmanotice'; |
| | | $msg = Q($this->gettext('decryptok')); |
| | | $msg = rcube::Q($this->gettext('decryptok')); |
| | | } |
| | | |
| | | $p['prefix'] .= html::div($attrib, $msg); |
| | |
| | | if ($sig->valid) { |
| | | $attrib['class'] = 'enigmanotice'; |
| | | $sender = ($sig->name ? $sig->name . ' ' : '') . '<' . $sig->email . '>'; |
| | | $msg = Q(str_replace('$sender', $sender, $this->gettext('sigvalid'))); |
| | | $msg = rcube::Q(str_replace('$sender', $sender, $this->gettext('sigvalid'))); |
| | | } |
| | | else { |
| | | $attrib['class'] = 'enigmawarning'; |
| | | $sender = ($sig->name ? $sig->name . ' ' : '') . '<' . $sig->email . '>'; |
| | | $msg = Q(str_replace('$sender', $sender, $this->gettext('siginvalid'))); |
| | | $msg = rcube::Q(str_replace('$sender', $sender, $this->gettext('siginvalid'))); |
| | | } |
| | | } |
| | | else if ($sig->getCode() == enigma_error::E_KEYNOTFOUND) { |
| | | $attrib['class'] = 'enigmawarning'; |
| | | $msg = Q(str_replace('$keyid', enigma_key::format_id($sig->getData('id')), |
| | | $msg = rcube::Q(str_replace('$keyid', enigma_key::format_id($sig->getData('id')), |
| | | $this->gettext('signokey'))); |
| | | } |
| | | else { |
| | | $attrib['class'] = 'enigmaerror'; |
| | | $msg = Q($this->gettext('sigerror')); |
| | | $msg = rcube::Q($this->gettext('sigerror')); |
| | | } |
| | | /* |
| | | $msg .= ' ' . html::a(array('href' => "#sigdetails", |
| | | 'onclick' => JS_OBJECT_NAME.".command('enigma-sig-details')"), |
| | | Q($this->gettext('showdetails'))); |
| | | 'onclick' => rcmail_output::JS_OBJECT_NAME.".command('enigma-sig-details')"), |
| | | rcube::Q($this->gettext('showdetails'))); |
| | | */ |
| | | // test |
| | | // $msg .= '<br /><pre>'.$sig->body.'</pre>'; |
| | |
| | | $p['content'] .= html::p(array('style' => $style), |
| | | html::a(array( |
| | | 'href' => "#", |
| | | 'onclick' => "return ".JS_OBJECT_NAME.".enigma_import_attachment('".JQ($part)."')", |
| | | 'onclick' => "return ".rcmail_output::JS_OBJECT_NAME.".enigma_import_attachment('".rcube::JQ($part)."')", |
| | | 'title' => $this->gettext('keyattimport')), |
| | | html::img(array('src' => $this->url('skins/classic/key_add.png'), 'style' => "vertical-align:middle"))) |
| | | . ' ' . html::span(null, $this->gettext('keyattfound'))); |
| | |
| | | $this->pgp_driver = new $driver($username); |
| | | |
| | | if (!$this->pgp_driver) { |
| | | raise_error(array( |
| | | rcube::raise_error(array( |
| | | 'code' => 600, 'type' => 'php', |
| | | 'file' => __FILE__, 'line' => __LINE__, |
| | | 'message' => "Enigma plugin: Unable to load PGP driver: $driver" |
| | |
| | | $result = $this->pgp_driver->init(); |
| | | |
| | | if ($result instanceof enigma_error) { |
| | | raise_error(array( |
| | | rcube::raise_error(array( |
| | | 'code' => 600, 'type' => 'php', |
| | | 'file' => __FILE__, 'line' => __LINE__, |
| | | 'message' => "Enigma plugin: ".$result->getMessage() |
| | |
| | | $this->smime_driver = new $driver($username); |
| | | |
| | | if (!$this->smime_driver) { |
| | | raise_error(array( |
| | | rcube::raise_error(array( |
| | | 'code' => 600, 'type' => 'php', |
| | | 'file' => __FILE__, 'line' => __LINE__, |
| | | 'message' => "Enigma plugin: Unable to load S/MIME driver: $driver" |
| | |
| | | $result = $this->smime_driver->init(); |
| | | |
| | | if ($result instanceof enigma_error) { |
| | | raise_error(array( |
| | | rcube::raise_error(array( |
| | | 'code' => 600, 'type' => 'php', |
| | | 'file' => __FILE__, 'line' => __LINE__, |
| | | 'message' => "Enigma plugin: ".$result->getMessage() |
| | |
| | | $sig = $this->pgp_driver->verify($msg_body, $sig_body); |
| | | |
| | | if (($sig instanceof enigma_error) && $sig->getCode() != enigma_error::E_KEYNOTFOUND) |
| | | raise_error(array( |
| | | rcube::raise_error(array( |
| | | 'code' => 600, 'type' => 'php', |
| | | 'file' => __FILE__, 'line' => __LINE__, |
| | | 'message' => "Enigma plugin: " . $error->getMessage() |
| | |
| | | if ($result instanceof enigma_error) { |
| | | $err_code = $result->getCode(); |
| | | if (!in_array($err_code, array(enigma_error::E_KEYNOTFOUND, enigma_error::E_BADPASS))) |
| | | raise_error(array( |
| | | rcube::raise_error(array( |
| | | 'code' => 600, 'type' => 'php', |
| | | 'file' => __FILE__, 'line' => __LINE__, |
| | | 'message' => "Enigma plugin: " . $result->getMessage() |
| | |
| | | $result = $this->pgp_driver->list_keys($pattern); |
| | | |
| | | if ($result instanceof enigma_error) { |
| | | raise_error(array( |
| | | rcube::raise_error(array( |
| | | 'code' => 600, 'type' => 'php', |
| | | 'file' => __FILE__, 'line' => __LINE__, |
| | | 'message' => "Enigma plugin: " . $result->getMessage() |
| | |
| | | $result = $this->pgp_driver->get_key($keyid); |
| | | |
| | | if ($result instanceof enigma_error) { |
| | | raise_error(array( |
| | | rcube::raise_error(array( |
| | | 'code' => 600, 'type' => 'php', |
| | | 'file' => __FILE__, 'line' => __LINE__, |
| | | 'message' => "Enigma plugin: " . $result->getMessage() |
| | |
| | | $result = $this->pgp_driver->import($content, $isfile); |
| | | |
| | | if ($result instanceof enigma_error) { |
| | | raise_error(array( |
| | | rcube::raise_error(array( |
| | | 'code' => 600, 'type' => 'php', |
| | | 'file' => __FILE__, 'line' => __LINE__, |
| | | 'message' => "Enigma plugin: " . $result->getMessage() |
| | |
| | | */ |
| | | function import_file() |
| | | { |
| | | $uid = get_input_value('_uid', RCUBE_INPUT_POST); |
| | | $mbox = get_input_value('_mbox', RCUBE_INPUT_POST); |
| | | $mime_id = get_input_value('_part', RCUBE_INPUT_POST); |
| | | $uid = rcube_utils::get_input_value('_uid', rcube_utils::INPUT_POST); |
| | | $mbox = rcube_utils::get_input_value('_mbox', rcube_utils::INPUT_POST); |
| | | $mime_id = rcube_utils::get_input_value('_part', rcube_utils::INPUT_POST); |
| | | |
| | | if ($uid && $mime_id) { |
| | | $part = $this->rc->storage->get_message_part($uid, $mime_id); |
| | |
| | | |
| | | // Enigma actions |
| | | if ($this->rc->action == 'plugin.enigma') { |
| | | $action = get_input_value('_a', RCUBE_INPUT_GPC); |
| | | $action = rcube_utils::get_input_value('_a', rcube_utils::INPUT_GPC); |
| | | |
| | | switch ($action) { |
| | | case 'keyedit': |
| | |
| | | $a_show_cols = array('name'); |
| | | |
| | | // create XHTML table |
| | | $out = rcube_table_output($attrib, array(), $a_show_cols, 'id'); |
| | | $out = $this->rc->table_output($attrib, array(), $a_show_cols, 'id'); |
| | | |
| | | // set client env |
| | | $this->rc->output->add_gui_object('keyslist', $attrib['id']); |
| | |
| | | $this->enigma->load_engine(); |
| | | |
| | | $pagesize = $this->rc->config->get('pagesize', 100); |
| | | $page = max(intval(get_input_value('_p', RCUBE_INPUT_GPC)), 1); |
| | | $search = get_input_value('_q', RCUBE_INPUT_GPC); |
| | | $page = max(intval(rcube_utils::get_input_value('_p', rcube_utils::INPUT_GPC)), 1); |
| | | $search = rcube_utils::get_input_value('_q', rcube_utils::INPUT_GPC); |
| | | |
| | | // define list of cols to be displayed |
| | | $a_show_cols = array('name'); |
| | |
| | | // Add rows |
| | | foreach($list as $idx => $key) { |
| | | $this->rc->output->command('enigma_add_list_row', |
| | | array('name' => Q($key->name), 'id' => $key->id)); |
| | | array('name' => rcube::Q($key->name), 'id' => $key->id)); |
| | | } |
| | | } |
| | | } |
| | |
| | | */ |
| | | private function key_info() |
| | | { |
| | | $id = get_input_value('_id', RCUBE_INPUT_GET); |
| | | $id = rcube_utils::get_input_value('_id', rcube_utils::INPUT_GET); |
| | | |
| | | $this->enigma->load_engine(); |
| | | $res = $this->enigma->engine->get_key($id); |
| | |
| | | */ |
| | | function tpl_key_name($attrib) |
| | | { |
| | | return Q($this->data->name); |
| | | return rcube::Q($this->data->name); |
| | | } |
| | | |
| | | /** |
| | |
| | | |
| | | // Key user ID |
| | | $table->add('title', $this->enigma->gettext('keyuserid')); |
| | | $table->add(null, Q($this->data->name)); |
| | | $table->add(null, rcube::Q($this->data->name)); |
| | | // Key ID |
| | | $table->add('title', $this->enigma->gettext('keyid')); |
| | | $table->add(null, $this->data->subkeys[0]->get_short_id()); |
| | |
| | | else if ($err = $_FILES['_file']['error']) { |
| | | if ($err == UPLOAD_ERR_INI_SIZE || $err == UPLOAD_ERR_FORM_SIZE) { |
| | | $this->rc->output->show_message('filesizeerror', 'error', |
| | | array('size' => show_bytes(parse_bytes(ini_get('upload_max_filesize'))))); |
| | | array('size' => $this->rc->show_bytes(parse_bytes(ini_get('upload_max_filesize'))))); |
| | | } else { |
| | | $this->rc->output->show_message('fileuploaderror', 'error'); |
| | | } |
| | |
| | | 'id' => 'rcmimportfile', 'size' => 30)); |
| | | |
| | | $form = html::p(null, |
| | | Q($this->enigma->gettext('keyimporttext'), 'show') |
| | | rcube::Q($this->enigma->gettext('keyimporttext'), 'show') |
| | | . html::br() . html::br() . $upload->show() |
| | | ); |
| | | |
| | |
| | | $chbox = new html_checkbox(array('value' => 1)); |
| | | |
| | | $menu->add(null, html::label(array('for' => 'enigmadefaultopt'), |
| | | Q($this->enigma->gettext('identdefault')))); |
| | | rcube::Q($this->enigma->gettext('identdefault')))); |
| | | $menu->add(null, $chbox->show(1, array('name' => '_enigma_default', 'id' => 'enigmadefaultopt'))); |
| | | |
| | | $menu->add(null, html::label(array('for' => 'enigmasignopt'), |
| | | Q($this->enigma->gettext('signmsg')))); |
| | | rcube::Q($this->enigma->gettext('signmsg')))); |
| | | $menu->add(null, $chbox->show(1, array('name' => '_enigma_sign', 'id' => 'enigmasignopt'))); |
| | | |
| | | $menu->add(null, html::label(array('for' => 'enigmacryptopt'), |
| | | Q($this->enigma->gettext('encryptmsg')))); |
| | | rcube::Q($this->enigma->gettext('encryptmsg')))); |
| | | $menu->add(null, $chbox->show(1, array('name' => '_enigma_crypt', 'id' => 'enigmacryptopt'))); |
| | | |
| | | $menu = html::div(array('id' => 'enigmamenu', 'class' => 'popupmenu'), |
| | |
| | | function save_prefs($args) |
| | | { |
| | | if ($args['section'] == 'mailview') { |
| | | $args['prefs']['hide_blockquote_limit'] = (int) get_input_value('_hide_blockquote_limit', RCUBE_INPUT_POST); |
| | | $args['prefs']['hide_blockquote_limit'] = (int) rcube_utils::get_input_value('_hide_blockquote_limit', rcube_utils::INPUT_POST); |
| | | } |
| | | |
| | | return $args; |
| | |
| | | |
| | | $host = rcmail::get_instance()->config->get('http_authentication_host'); |
| | | if (is_string($host) && trim($host) !== '') |
| | | $args['host'] = rcube_idn_to_ascii(rcube_parse_host($host)); |
| | | $args['host'] = rcube_utils::idn_to_ascii(rcube_utils::parse_host($host)); |
| | | |
| | | // Allow entering other user data in login form, |
| | | // e.g. after log out (#1487953) |
| | |
| | | - Support tls:// prefix in managesieve_host option |
| | | - Removed depracated functions usage |
| | | |
| | | * version 6.1 [2012-12-21] |
| | | ----------------------------------------------------------- |
| | |
| | | */ |
| | | public function debug_handler(&$sieve, $message) |
| | | { |
| | | write_log('sieve', preg_replace('/\r\n$/', '', $message)); |
| | | rcube::write_log('sieve', preg_replace('/\r\n$/', '', $message)); |
| | | } |
| | | } |
| | |
| | | $port = $this->rc->config->get('managesieve_port'); |
| | | $tls = $this->rc->config->get('managesieve_usetls', false); |
| | | |
| | | $host = rcube_parse_host($host); |
| | | $host = rcube_idn_to_ascii($host); |
| | | $host = rcube_utils::parse_host($host); |
| | | $host = rcube_utils::idn_to_ascii($host); |
| | | |
| | | // remove tls:// prefix, set TLS flag |
| | | if (($host = preg_replace('|^tls://|i', '', $host, 1, $cnt)) && $cnt) { |
| | |
| | | $list = $this->list_scripts(); |
| | | |
| | | if (!empty($_GET['_set']) || !empty($_POST['_set'])) { |
| | | $script_name = get_input_value('_set', RCUBE_INPUT_GPC, true); |
| | | $script_name = rcube_utils::get_input_value('_set', rcube_utils::INPUT_GPC, true); |
| | | } |
| | | else if (!empty($_SESSION['managesieve_current'])) { |
| | | $script_name = $_SESSION['managesieve_current']; |
| | |
| | | break; |
| | | } |
| | | |
| | | raise_error(array('code' => 403, 'type' => 'php', |
| | | rcube::raise_error(array('code' => 403, 'type' => 'php', |
| | | 'file' => __FILE__, 'line' => __LINE__, |
| | | 'message' => "Unable to connect to managesieve on $host:$port"), true, false); |
| | | |
| | |
| | | $error = $this->managesieve_start(); |
| | | |
| | | // Handle user requests |
| | | if ($action = get_input_value('_act', RCUBE_INPUT_GPC)) { |
| | | $fid = (int) get_input_value('_fid', RCUBE_INPUT_POST); |
| | | if ($action = rcube_utils::get_input_value('_act', rcube_utils::INPUT_GPC)) { |
| | | $fid = (int) rcube_utils::get_input_value('_fid', rcube_utils::INPUT_POST); |
| | | |
| | | if ($action == 'delete' && !$error) { |
| | | if (isset($this->script[$fid])) { |
| | |
| | | } |
| | | else if ($action == 'move' && !$error) { |
| | | if (isset($this->script[$fid])) { |
| | | $to = (int) get_input_value('_to', RCUBE_INPUT_POST); |
| | | $to = (int) rcube_utils::get_input_value('_to', rcube_utils::INPUT_POST); |
| | | $rule = $this->script[$fid]; |
| | | |
| | | // remove rule |
| | |
| | | } |
| | | } |
| | | else if ($action == 'setact' && !$error) { |
| | | $script_name = get_input_value('_set', RCUBE_INPUT_GPC, true); |
| | | $script_name = rcube_utils::get_input_value('_set', rcube_utils::INPUT_GPC, true); |
| | | $result = $this->activate_script($script_name); |
| | | $kep14 = $this->rc->config->get('managesieve_kolab_master'); |
| | | |
| | |
| | | } |
| | | } |
| | | else if ($action == 'deact' && !$error) { |
| | | $script_name = get_input_value('_set', RCUBE_INPUT_GPC, true); |
| | | $script_name = rcube_utils::get_input_value('_set', rcube_utils::INPUT_GPC, true); |
| | | $result = $this->deactivate_script($script_name); |
| | | |
| | | if ($result === true) { |
| | |
| | | } |
| | | } |
| | | else if ($action == 'setdel' && !$error) { |
| | | $script_name = get_input_value('_set', RCUBE_INPUT_GPC, true); |
| | | $script_name = rcube_utils::get_input_value('_set', rcube_utils::INPUT_GPC, true); |
| | | $result = $this->remove_script($script_name); |
| | | |
| | | if ($result === true) { |
| | |
| | | } |
| | | } |
| | | else if ($action == 'setget') { |
| | | $script_name = get_input_value('_set', RCUBE_INPUT_GPC, true); |
| | | $script_name = rcube_utils::get_input_value('_set', rcube_utils::INPUT_GPC, true); |
| | | $script = $this->sieve->get_script($script_name); |
| | | |
| | | if (PEAR::isError($script)) |
| | |
| | | $this->rc->output->command('managesieve_updatelist', 'list', array('list' => $result)); |
| | | } |
| | | else if ($action == 'ruleadd') { |
| | | $rid = get_input_value('_rid', RCUBE_INPUT_GPC); |
| | | $rid = rcube_utils::get_input_value('_rid', rcube_utils::INPUT_GPC); |
| | | $id = $this->genid(); |
| | | $content = $this->rule_div($fid, $id, false); |
| | | |
| | | $this->rc->output->command('managesieve_rulefill', $content, $id, $rid); |
| | | } |
| | | else if ($action == 'actionadd') { |
| | | $aid = get_input_value('_aid', RCUBE_INPUT_GPC); |
| | | $aid = rcube_utils::get_input_value('_aid', rcube_utils::INPUT_GPC); |
| | | $id = $this->genid(); |
| | | $content = $this->action_div($fid, $id, false); |
| | | |
| | |
| | | } |
| | | else if ($this->rc->task == 'mail') { |
| | | // Initialize the form |
| | | $rules = get_input_value('r', RCUBE_INPUT_GET); |
| | | $rules = rcube_utils::get_input_value('r', rcube_utils::INPUT_GET); |
| | | if (!empty($rules)) { |
| | | $i = 0; |
| | | foreach ($rules as $rule) { |
| | |
| | | } |
| | | // filters set add action |
| | | else if (!empty($_POST['_newset'])) { |
| | | $name = get_input_value('_name', RCUBE_INPUT_POST, true); |
| | | $copy = get_input_value('_copy', RCUBE_INPUT_POST, true); |
| | | $from = get_input_value('_from', RCUBE_INPUT_POST); |
| | | $name = rcube_utils::get_input_value('_name', rcube_utils::INPUT_POST, true); |
| | | $copy = rcube_utils::get_input_value('_copy', rcube_utils::INPUT_POST, true); |
| | | $from = rcube_utils::get_input_value('_from', rcube_utils::INPUT_POST); |
| | | $exceptions = $this->rc->config->get('managesieve_filename_exceptions'); |
| | | $kolab = $this->rc->config->get('managesieve_kolab_master'); |
| | | $name_uc = mb_strtolower($name); |
| | |
| | | $err = $_FILES['_file']['error']; |
| | | |
| | | if ($err == UPLOAD_ERR_INI_SIZE || $err == UPLOAD_ERR_FORM_SIZE) { |
| | | $msg = rcube_label(array('name' => 'filesizeerror', |
| | | $msg = $this->rc->gettext(array('name' => 'filesizeerror', |
| | | 'vars' => array('size' => |
| | | show_bytes(parse_bytes(ini_get('upload_max_filesize')))))); |
| | | $this->rc->show_bytes(parse_bytes(ini_get('upload_max_filesize')))))); |
| | | } |
| | | else { |
| | | $this->errors['file'] = $this->gettext('fileuploaderror'); |
| | |
| | | } |
| | | // filter add/edit action |
| | | else if (isset($_POST['_name'])) { |
| | | $name = trim(get_input_value('_name', RCUBE_INPUT_POST, true)); |
| | | $fid = trim(get_input_value('_fid', RCUBE_INPUT_POST)); |
| | | $join = trim(get_input_value('_join', RCUBE_INPUT_POST)); |
| | | $name = trim(rcube_utils::get_input_value('_name', rcube_utils::INPUT_POST, true)); |
| | | $fid = trim(rcube_utils::get_input_value('_fid', rcube_utils::INPUT_POST)); |
| | | $join = trim(rcube_utils::get_input_value('_join', rcube_utils::INPUT_POST)); |
| | | |
| | | // and arrays |
| | | $headers = get_input_value('_header', RCUBE_INPUT_POST); |
| | | $cust_headers = get_input_value('_custom_header', RCUBE_INPUT_POST); |
| | | $ops = get_input_value('_rule_op', RCUBE_INPUT_POST); |
| | | $sizeops = get_input_value('_rule_size_op', RCUBE_INPUT_POST); |
| | | $sizeitems = get_input_value('_rule_size_item', RCUBE_INPUT_POST); |
| | | $sizetargets = get_input_value('_rule_size_target', RCUBE_INPUT_POST); |
| | | $targets = get_input_value('_rule_target', RCUBE_INPUT_POST, true); |
| | | $mods = get_input_value('_rule_mod', RCUBE_INPUT_POST); |
| | | $mod_types = get_input_value('_rule_mod_type', RCUBE_INPUT_POST); |
| | | $body_trans = get_input_value('_rule_trans', RCUBE_INPUT_POST); |
| | | $body_types = get_input_value('_rule_trans_type', RCUBE_INPUT_POST, true); |
| | | $comparators = get_input_value('_rule_comp', RCUBE_INPUT_POST); |
| | | $act_types = get_input_value('_action_type', RCUBE_INPUT_POST, true); |
| | | $mailboxes = get_input_value('_action_mailbox', RCUBE_INPUT_POST, true); |
| | | $act_targets = get_input_value('_action_target', RCUBE_INPUT_POST, true); |
| | | $area_targets = get_input_value('_action_target_area', RCUBE_INPUT_POST, true); |
| | | $reasons = get_input_value('_action_reason', RCUBE_INPUT_POST, true); |
| | | $addresses = get_input_value('_action_addresses', RCUBE_INPUT_POST, true); |
| | | $days = get_input_value('_action_days', RCUBE_INPUT_POST); |
| | | $subject = get_input_value('_action_subject', RCUBE_INPUT_POST, true); |
| | | $flags = get_input_value('_action_flags', RCUBE_INPUT_POST); |
| | | $varnames = get_input_value('_action_varname', RCUBE_INPUT_POST); |
| | | $varvalues = get_input_value('_action_varvalue', RCUBE_INPUT_POST); |
| | | $varmods = get_input_value('_action_varmods', RCUBE_INPUT_POST); |
| | | $notifyaddrs = get_input_value('_action_notifyaddress', RCUBE_INPUT_POST); |
| | | $notifybodies = get_input_value('_action_notifybody', RCUBE_INPUT_POST); |
| | | $notifymessages = get_input_value('_action_notifymessage', RCUBE_INPUT_POST); |
| | | $notifyfrom = get_input_value('_action_notifyfrom', RCUBE_INPUT_POST); |
| | | $notifyimp = get_input_value('_action_notifyimportance', RCUBE_INPUT_POST); |
| | | $headers = rcube_utils::get_input_value('_header', rcube_utils::INPUT_POST); |
| | | $cust_headers = rcube_utils::get_input_value('_custom_header', rcube_utils::INPUT_POST); |
| | | $ops = rcube_utils::get_input_value('_rule_op', rcube_utils::INPUT_POST); |
| | | $sizeops = rcube_utils::get_input_value('_rule_size_op', rcube_utils::INPUT_POST); |
| | | $sizeitems = rcube_utils::get_input_value('_rule_size_item', rcube_utils::INPUT_POST); |
| | | $sizetargets = rcube_utils::get_input_value('_rule_size_target', rcube_utils::INPUT_POST); |
| | | $targets = rcube_utils::get_input_value('_rule_target', rcube_utils::INPUT_POST, true); |
| | | $mods = rcube_utils::get_input_value('_rule_mod', rcube_utils::INPUT_POST); |
| | | $mod_types = rcube_utils::get_input_value('_rule_mod_type', rcube_utils::INPUT_POST); |
| | | $body_trans = rcube_utils::get_input_value('_rule_trans', rcube_utils::INPUT_POST); |
| | | $body_types = rcube_utils::get_input_value('_rule_trans_type', rcube_utils::INPUT_POST, true); |
| | | $comparators = rcube_utils::get_input_value('_rule_comp', rcube_utils::INPUT_POST); |
| | | $act_types = rcube_utils::get_input_value('_action_type', rcube_utils::INPUT_POST, true); |
| | | $mailboxes = rcube_utils::get_input_value('_action_mailbox', rcube_utils::INPUT_POST, true); |
| | | $act_targets = rcube_utils::get_input_value('_action_target', rcube_utils::INPUT_POST, true); |
| | | $area_targets = rcube_utils::get_input_value('_action_target_area', rcube_utils::INPUT_POST, true); |
| | | $reasons = rcube_utils::get_input_value('_action_reason', rcube_utils::INPUT_POST, true); |
| | | $addresses = rcube_utils::get_input_value('_action_addresses', rcube_utils::INPUT_POST, true); |
| | | $days = rcube_utils::get_input_value('_action_days', rcube_utils::INPUT_POST); |
| | | $subject = rcube_utils::get_input_value('_action_subject', rcube_utils::INPUT_POST, true); |
| | | $flags = rcube_utils::get_input_value('_action_flags', rcube_utils::INPUT_POST); |
| | | $varnames = rcube_utils::get_input_value('_action_varname', rcube_utils::INPUT_POST); |
| | | $varvalues = rcube_utils::get_input_value('_action_varvalue', rcube_utils::INPUT_POST); |
| | | $varmods = rcube_utils::get_input_value('_action_varmods', rcube_utils::INPUT_POST); |
| | | $notifyaddrs = rcube_utils::get_input_value('_action_notifyaddress', rcube_utils::INPUT_POST); |
| | | $notifybodies = rcube_utils::get_input_value('_action_notifybody', rcube_utils::INPUT_POST); |
| | | $notifymessages = rcube_utils::get_input_value('_action_notifymessage', rcube_utils::INPUT_POST); |
| | | $notifyfrom = rcube_utils::get_input_value('_action_notifyfrom', rcube_utils::INPUT_POST); |
| | | $notifyimp = rcube_utils::get_input_value('_action_notifyimportance', rcube_utils::INPUT_POST); |
| | | |
| | | // we need a "hack" for radiobuttons |
| | | foreach ($sizeitems as $item) |
| | |
| | | |
| | | if ($this->form['actions'][$i]['target'] == '') |
| | | $this->errors['actions'][$i]['target'] = $this->gettext('cannotbeempty'); |
| | | else if (!check_email($this->form['actions'][$i]['target'])) |
| | | else if (!rcube_utils::check_email($this->form['actions'][$i]['target'])) |
| | | $this->errors['actions'][$i]['target'] = $this->gettext('noemailwarning'); |
| | | |
| | | if ($type == 'redirect_copy') { |
| | |
| | | $address = trim($address); |
| | | if (!$address) |
| | | unset($this->form['actions'][$i]['addresses'][$aidx]); |
| | | else if(!check_email($address)) { |
| | | else if(!rcube_utils::check_email($address)) { |
| | | $this->errors['actions'][$i]['addresses'] = $this->gettext('noemailwarning'); |
| | | break; |
| | | } else |
| | |
| | | if (empty($notifyaddrs[$idx])) { |
| | | $this->errors['actions'][$i]['address'] = $this->gettext('cannotbeempty'); |
| | | } |
| | | else if (!check_email($notifyaddrs[$idx])) { |
| | | else if (!rcube_utils::check_email($notifyaddrs[$idx])) { |
| | | $this->errors['actions'][$i]['address'] = $this->gettext('noemailwarning'); |
| | | } |
| | | if (!empty($notifyfrom[$idx]) && !check_email($notifyfrom[$idx])) { |
| | | if (!empty($notifyfrom[$idx]) && !rcube_utils::check_email($notifyfrom[$idx])) { |
| | | $this->errors['actions'][$i]['from'] = $this->gettext('noemailwarning'); |
| | | } |
| | | $this->form['actions'][$i]['address'] = $notifyaddrs[$idx]; |
| | |
| | | $this->rc->output->command('parent.managesieve_updatelist', |
| | | isset($new) ? 'add' : 'update', |
| | | array( |
| | | 'name' => Q($this->form['name']), |
| | | 'name' => rcube::Q($this->form['name']), |
| | | 'id' => $fid, |
| | | 'disabled' => $this->form['disabled'] |
| | | )); |
| | |
| | | $result = $this->list_rules(); |
| | | |
| | | // create XHTML table |
| | | $out = rcube_table_output($attrib, $result, $a_show_cols, 'id'); |
| | | $out = $this->rc->table_output($attrib, $result, $a_show_cols, 'id'); |
| | | |
| | | // set client env |
| | | $this->rc->output->add_gui_object('filterslist', $attrib['id']); |
| | |
| | | foreach ($list as $idx => $set) { |
| | | $scripts['S'.$idx] = $set; |
| | | $result[] = array( |
| | | 'name' => Q($set), |
| | | 'name' => rcube::Q($set), |
| | | 'id' => 'S'.$idx, |
| | | 'class' => !in_array($set, $this->active) ? 'disabled' : '', |
| | | ); |
| | |
| | | } |
| | | |
| | | // create XHTML table |
| | | $out = rcube_table_output($attrib, $result, $a_show_cols, 'id'); |
| | | $out = $this->rc->table_output($attrib, $result, $a_show_cols, 'id'); |
| | | |
| | | $this->rc->output->set_env('filtersets', $scripts); |
| | | $this->rc->output->include_script('list.js'); |
| | |
| | | |
| | | $out .= $hiddenfields->show(); |
| | | |
| | | $name = get_input_value('_name', RCUBE_INPUT_POST); |
| | | $copy = get_input_value('_copy', RCUBE_INPUT_POST); |
| | | $selected = get_input_value('_from', RCUBE_INPUT_POST); |
| | | $name = rcube_utils::get_input_value('_name', rcube_utils::INPUT_POST); |
| | | $copy = rcube_utils::get_input_value('_copy', rcube_utils::INPUT_POST); |
| | | $selected = rcube_utils::get_input_value('_from', rcube_utils::INPUT_POST); |
| | | |
| | | // filter set name input |
| | | $input_name = new html_inputfield(array('name' => '_name', 'id' => '_name', 'size' => 30, |
| | | 'class' => ($this->errors['name'] ? 'error' : ''))); |
| | | |
| | | $out .= sprintf('<label for="%s"><b>%s:</b></label> %s<br /><br />', |
| | | '_name', Q($this->gettext('filtersetname')), $input_name->show($name)); |
| | | '_name', rcube::Q($this->gettext('filtersetname')), $input_name->show($name)); |
| | | |
| | | $out .="\n<fieldset class=\"itemlist\"><legend>" . $this->gettext('filters') . ":</legend>\n"; |
| | | $out .= '<input type="radio" id="from_none" name="_from" value="none"' |
| | | .(!$selected || $selected=='none' ? ' checked="checked"' : '').'></input>'; |
| | | $out .= sprintf('<label for="%s">%s</label> ', 'from_none', Q($this->gettext('none'))); |
| | | $out .= sprintf('<label for="%s">%s</label> ', 'from_none', rcube::Q($this->gettext('none'))); |
| | | |
| | | // filters set list |
| | | $list = $this->list_scripts(); |
| | |
| | | |
| | | $out .= '<br /><input type="radio" id="from_set" name="_from" value="set"' |
| | | .($selected=='set' ? ' checked="checked"' : '').'></input>'; |
| | | $out .= sprintf('<label for="%s">%s:</label> ', 'from_set', Q($this->gettext('fromset'))); |
| | | $out .= sprintf('<label for="%s">%s:</label> ', 'from_set', rcube::Q($this->gettext('fromset'))); |
| | | $out .= $select->show($copy); |
| | | } |
| | | |
| | |
| | | |
| | | $out .= '<br /><input type="radio" id="from_file" name="_from" value="file"' |
| | | .($selected=='file' ? ' checked="checked"' : '').'></input>'; |
| | | $out .= sprintf('<label for="%s">%s:</label> ', 'from_file', Q($this->gettext('fromfile'))); |
| | | $out .= sprintf('<label for="%s">%s:</label> ', 'from_file', rcube::Q($this->gettext('fromfile'))); |
| | | $out .= $upload->show(); |
| | | $out .= '</fieldset>'; |
| | | |
| | |
| | | if (!$attrib['id']) |
| | | $attrib['id'] = 'rcmfilterform'; |
| | | |
| | | $fid = get_input_value('_fid', RCUBE_INPUT_GPC); |
| | | $fid = rcube_utils::get_input_value('_fid', rcube_utils::INPUT_GPC); |
| | | $scr = isset($this->form) ? $this->form : $this->script[$fid]; |
| | | |
| | | $hiddenfields = new html_hiddenfield(array('name' => '_task', 'value' => $this->rc->task)); |
| | |
| | | $input_name = $input_name->show(); |
| | | |
| | | $out .= sprintf("\n<label for=\"%s\"><b>%s:</b></label> %s\n", |
| | | $field_id, Q($this->gettext('filtername')), $input_name); |
| | | $field_id, rcube::Q($this->gettext('filtername')), $input_name); |
| | | |
| | | // filter set selector |
| | | if ($this->rc->task == 'mail') { |
| | | $out .= sprintf("\n <label for=\"%s\"><b>%s:</b></label> %s\n", |
| | | $field_id, Q($this->gettext('filterset')), |
| | | $field_id, rcube::Q($this->gettext('filterset')), |
| | | $this->filtersets_list(array('id' => 'sievescriptname'), true)); |
| | | } |
| | | |
| | | $out .= '<br /><br /><fieldset><legend>' . Q($this->gettext('messagesrules')) . "</legend>\n"; |
| | | $out .= '<br /><br /><fieldset><legend>' . rcube::Q($this->gettext('messagesrules')) . "</legend>\n"; |
| | | |
| | | // any, allof, anyof radio buttons |
| | | $field_id = '_allof'; |
| | |
| | | $input_join = $input_join->show(); |
| | | |
| | | $out .= sprintf("%s<label for=\"%s\">%s</label> \n", |
| | | $input_join, $field_id, Q($this->gettext('filterallof'))); |
| | | $input_join, $field_id, rcube::Q($this->gettext('filterallof'))); |
| | | |
| | | $field_id = '_anyof'; |
| | | $input_join = new html_radiobutton(array('name' => '_join', 'id' => $field_id, 'value' => 'anyof', |
| | |
| | | $input_join = $input_join->show('anyof'); // default |
| | | |
| | | $out .= sprintf("%s<label for=\"%s\">%s</label>\n", |
| | | $input_join, $field_id, Q($this->gettext('filteranyof'))); |
| | | $input_join, $field_id, rcube::Q($this->gettext('filteranyof'))); |
| | | |
| | | $field_id = '_any'; |
| | | $input_join = new html_radiobutton(array('name' => '_join', 'id' => $field_id, 'value' => 'any', |
| | |
| | | $input_join = $input_join->show($any ? 'any' : ''); |
| | | |
| | | $out .= sprintf("%s<label for=\"%s\">%s</label>\n", |
| | | $input_join, $field_id, Q($this->gettext('filterany'))); |
| | | $input_join, $field_id, rcube::Q($this->gettext('filterany'))); |
| | | |
| | | $rows_num = isset($scr) ? sizeof($scr['tests']) : 1; |
| | | |
| | |
| | | $out .= "</fieldset>\n"; |
| | | |
| | | // actions |
| | | $out .= '<fieldset><legend>' . Q($this->gettext('messagesactions')) . "</legend>\n"; |
| | | $out .= '<fieldset><legend>' . rcube::Q($this->gettext('messagesactions')) . "</legend>\n"; |
| | | |
| | | $rows_num = isset($scr) ? sizeof($scr['actions']) : 1; |
| | | |
| | |
| | | $select_header = new html_select(array('name' => "_header[]", 'id' => 'header'.$id, |
| | | 'onchange' => 'rule_header_select(' .$id .')')); |
| | | foreach($this->headers as $name => $val) |
| | | $select_header->add(Q($this->gettext($name)), Q($val)); |
| | | $select_header->add(rcube::Q($this->gettext($name)), Q($val)); |
| | | if (in_array('body', $this->exts)) |
| | | $select_header->add(Q($this->gettext('body')), 'body'); |
| | | $select_header->add(Q($this->gettext('size')), 'size'); |
| | | $select_header->add(Q($this->gettext('...')), '...'); |
| | | $select_header->add(rcube::Q($this->gettext('body')), 'body'); |
| | | $select_header->add(rcube::Q($this->gettext('size')), 'size'); |
| | | $select_header->add(rcube::Q($this->gettext('...')), '...'); |
| | | |
| | | // TODO: list arguments |
| | | $aout = ''; |
| | |
| | | $tout = '<div id="custom_header' .$id. '" style="display:' .(isset($custom) ? 'inline' : 'none'). '"> |
| | | <input type="text" name="_custom_header[]" id="custom_header_i'.$id.'" ' |
| | | . $this->error_class($id, 'test', 'header', 'custom_header_i') |
| | | .' value="' .Q($custom). '" size="15" /> </div>' . "\n"; |
| | | .' value="' .rcube::Q($custom). '" size="15" /> </div>' . "\n"; |
| | | |
| | | // matching type select (operator) |
| | | $select_op = new html_select(array('name' => "_rule_op[]", 'id' => 'rule_op'.$id, |
| | | 'style' => 'display:' .($rule['test']!='size' ? 'inline' : 'none'), |
| | | 'class' => 'operator_selector', |
| | | 'onchange' => 'rule_op_select('.$id.')')); |
| | | $select_op->add(Q($this->gettext('filtercontains')), 'contains'); |
| | | $select_op->add(Q($this->gettext('filternotcontains')), 'notcontains'); |
| | | $select_op->add(Q($this->gettext('filteris')), 'is'); |
| | | $select_op->add(Q($this->gettext('filterisnot')), 'notis'); |
| | | $select_op->add(Q($this->gettext('filterexists')), 'exists'); |
| | | $select_op->add(Q($this->gettext('filternotexists')), 'notexists'); |
| | | $select_op->add(Q($this->gettext('filtermatches')), 'matches'); |
| | | $select_op->add(Q($this->gettext('filternotmatches')), 'notmatches'); |
| | | $select_op->add(rcube::Q($this->gettext('filtercontains')), 'contains'); |
| | | $select_op->add(rcube::Q($this->gettext('filternotcontains')), 'notcontains'); |
| | | $select_op->add(rcube::Q($this->gettext('filteris')), 'is'); |
| | | $select_op->add(rcube::Q($this->gettext('filterisnot')), 'notis'); |
| | | $select_op->add(rcube::Q($this->gettext('filterexists')), 'exists'); |
| | | $select_op->add(rcube::Q($this->gettext('filternotexists')), 'notexists'); |
| | | $select_op->add(rcube::Q($this->gettext('filtermatches')), 'matches'); |
| | | $select_op->add(rcube::Q($this->gettext('filternotmatches')), 'notmatches'); |
| | | if (in_array('regex', $this->exts)) { |
| | | $select_op->add(Q($this->gettext('filterregex')), 'regex'); |
| | | $select_op->add(Q($this->gettext('filternotregex')), 'notregex'); |
| | | $select_op->add(rcube::Q($this->gettext('filterregex')), 'regex'); |
| | | $select_op->add(rcube::Q($this->gettext('filternotregex')), 'notregex'); |
| | | } |
| | | if (in_array('relational', $this->exts)) { |
| | | $select_op->add(Q($this->gettext('countisgreaterthan')), 'count-gt'); |
| | | $select_op->add(Q($this->gettext('countisgreaterthanequal')), 'count-ge'); |
| | | $select_op->add(Q($this->gettext('countislessthan')), 'count-lt'); |
| | | $select_op->add(Q($this->gettext('countislessthanequal')), 'count-le'); |
| | | $select_op->add(Q($this->gettext('countequals')), 'count-eq'); |
| | | $select_op->add(Q($this->gettext('countnotequals')), 'count-ne'); |
| | | $select_op->add(Q($this->gettext('valueisgreaterthan')), 'value-gt'); |
| | | $select_op->add(Q($this->gettext('valueisgreaterthanequal')), 'value-ge'); |
| | | $select_op->add(Q($this->gettext('valueislessthan')), 'value-lt'); |
| | | $select_op->add(Q($this->gettext('valueislessthanequal')), 'value-le'); |
| | | $select_op->add(Q($this->gettext('valueequals')), 'value-eq'); |
| | | $select_op->add(Q($this->gettext('valuenotequals')), 'value-ne'); |
| | | $select_op->add(rcube::Q($this->gettext('countisgreaterthan')), 'count-gt'); |
| | | $select_op->add(rcube::Q($this->gettext('countisgreaterthanequal')), 'count-ge'); |
| | | $select_op->add(rcube::Q($this->gettext('countislessthan')), 'count-lt'); |
| | | $select_op->add(rcube::Q($this->gettext('countislessthanequal')), 'count-le'); |
| | | $select_op->add(rcube::Q($this->gettext('countequals')), 'count-eq'); |
| | | $select_op->add(rcube::Q($this->gettext('countnotequals')), 'count-ne'); |
| | | $select_op->add(rcube::Q($this->gettext('valueisgreaterthan')), 'value-gt'); |
| | | $select_op->add(rcube::Q($this->gettext('valueisgreaterthanequal')), 'value-ge'); |
| | | $select_op->add(rcube::Q($this->gettext('valueislessthan')), 'value-lt'); |
| | | $select_op->add(rcube::Q($this->gettext('valueislessthanequal')), 'value-le'); |
| | | $select_op->add(rcube::Q($this->gettext('valueequals')), 'value-eq'); |
| | | $select_op->add(rcube::Q($this->gettext('valuenotequals')), 'value-ne'); |
| | | } |
| | | |
| | | // target input (TODO: lists) |
| | |
| | | |
| | | $tout .= $select_op->show($test); |
| | | $tout .= '<input type="text" name="_rule_target[]" id="rule_target' .$id. '" |
| | | value="' .Q($target). '" size="20" ' . $this->error_class($id, 'test', 'target', 'rule_target') |
| | | value="' .rcube::Q($target). '" size="20" ' . $this->error_class($id, 'test', 'target', 'rule_target') |
| | | . ' style="display:' . ($rule['test']!='size' && $rule['test'] != 'exists' ? 'inline' : 'none') . '" />'."\n"; |
| | | |
| | | $select_size_op = new html_select(array('name' => "_rule_size_op[]", 'id' => 'rule_size_op'.$id)); |
| | | $select_size_op->add(Q($this->gettext('filterover')), 'over'); |
| | | $select_size_op->add(Q($this->gettext('filterunder')), 'under'); |
| | | $select_size_op->add(rcube::Q($this->gettext('filterover')), 'over'); |
| | | $select_size_op->add(rcube::Q($this->gettext('filterunder')), 'under'); |
| | | |
| | | $tout .= '<div id="rule_size' .$id. '" style="display:' . ($rule['test']=='size' ? 'inline' : 'none') .'">'; |
| | | $tout .= $select_size_op->show($rule['test']=='size' ? $rule['type'] : ''); |
| | | $tout .= '<input type="text" name="_rule_size_target[]" id="rule_size_i'.$id.'" value="'.$sizetarget.'" size="10" ' |
| | | . $this->error_class($id, 'test', 'sizetarget', 'rule_size_i') .' /> |
| | | <input type="radio" name="_rule_size_item['.$id.']" value=""' |
| | | . (!$sizeitem ? ' checked="checked"' : '') .' class="radio" />'.rcube_label('B').' |
| | | . (!$sizeitem ? ' checked="checked"' : '') .' class="radio" />'.$this->rc->gettext('B').' |
| | | <input type="radio" name="_rule_size_item['.$id.']" value="K"' |
| | | . ($sizeitem=='K' ? ' checked="checked"' : '') .' class="radio" />'.rcube_label('KB').' |
| | | . ($sizeitem=='K' ? ' checked="checked"' : '') .' class="radio" />'.$this->rc->gettext('KB').' |
| | | <input type="radio" name="_rule_size_item['.$id.']" value="M"' |
| | | . ($sizeitem=='M' ? ' checked="checked"' : '') .' class="radio" />'.rcube_label('MB').' |
| | | . ($sizeitem=='M' ? ' checked="checked"' : '') .' class="radio" />'.$this->rc->gettext('MB').' |
| | | <input type="radio" name="_rule_size_item['.$id.']" value="G"' |
| | | . ($sizeitem=='G' ? ' checked="checked"' : '') .' class="radio" />'.rcube_label('GB'); |
| | | . ($sizeitem=='G' ? ' checked="checked"' : '') .' class="radio" />'.$this->rc->gettext('GB'); |
| | | $tout .= '</div>'; |
| | | |
| | | // Advanced modifiers (address, envelope) |
| | | $select_mod = new html_select(array('name' => "_rule_mod[]", 'id' => 'rule_mod_op'.$id, |
| | | 'onchange' => 'rule_mod_select(' .$id .')')); |
| | | $select_mod->add(Q($this->gettext('none')), ''); |
| | | $select_mod->add(Q($this->gettext('address')), 'address'); |
| | | $select_mod->add(rcube::Q($this->gettext('none')), ''); |
| | | $select_mod->add(rcube::Q($this->gettext('address')), 'address'); |
| | | if (in_array('envelope', $this->exts)) |
| | | $select_mod->add(Q($this->gettext('envelope')), 'envelope'); |
| | | $select_mod->add(rcube::Q($this->gettext('envelope')), 'envelope'); |
| | | |
| | | $select_type = new html_select(array('name' => "_rule_mod_type[]", 'id' => 'rule_mod_type'.$id)); |
| | | $select_type->add(Q($this->gettext('allparts')), 'all'); |
| | | $select_type->add(Q($this->gettext('domain')), 'domain'); |
| | | $select_type->add(Q($this->gettext('localpart')), 'localpart'); |
| | | $select_type->add(rcube::Q($this->gettext('allparts')), 'all'); |
| | | $select_type->add(rcube::Q($this->gettext('domain')), 'domain'); |
| | | $select_type->add(rcube::Q($this->gettext('localpart')), 'localpart'); |
| | | if (in_array('subaddress', $this->exts)) { |
| | | $select_type->add(Q($this->gettext('user')), 'user'); |
| | | $select_type->add(Q($this->gettext('detail')), 'detail'); |
| | | $select_type->add(rcube::Q($this->gettext('user')), 'user'); |
| | | $select_type->add(rcube::Q($this->gettext('detail')), 'detail'); |
| | | } |
| | | |
| | | $need_mod = $rule['test'] != 'size' && $rule['test'] != 'body'; |
| | | $mout = '<div id="rule_mod' .$id. '" class="adv" style="display:' . ($need_mod ? 'block' : 'none') .'">'; |
| | | $mout .= ' <span>'; |
| | | $mout .= Q($this->gettext('modifier')) . ' '; |
| | | $mout .= rcube::Q($this->gettext('modifier')) . ' '; |
| | | $mout .= $select_mod->show($rule['test']); |
| | | $mout .= '</span>'; |
| | | $mout .= ' <span id="rule_mod_type' . $id . '"'; |
| | | $mout .= ' style="display:' . (in_array($rule['test'], array('address', 'envelope')) ? 'inline' : 'none') .'">'; |
| | | $mout .= Q($this->gettext('modtype')) . ' '; |
| | | $mout .= rcube::Q($this->gettext('modtype')) . ' '; |
| | | $mout .= $select_type->show($rule['part']); |
| | | $mout .= '</span>'; |
| | | $mout .= '</div>'; |
| | |
| | | // Advanced modifiers (body transformations) |
| | | $select_mod = new html_select(array('name' => "_rule_trans[]", 'id' => 'rule_trans_op'.$id, |
| | | 'onchange' => 'rule_trans_select(' .$id .')')); |
| | | $select_mod->add(Q($this->gettext('text')), 'text'); |
| | | $select_mod->add(Q($this->gettext('undecoded')), 'raw'); |
| | | $select_mod->add(Q($this->gettext('contenttype')), 'content'); |
| | | $select_mod->add(rcube::Q($this->gettext('text')), 'text'); |
| | | $select_mod->add(rcube::Q($this->gettext('undecoded')), 'raw'); |
| | | $select_mod->add(rcube::Q($this->gettext('contenttype')), 'content'); |
| | | |
| | | $mout .= '<div id="rule_trans' .$id. '" class="adv" style="display:' . ($rule['test'] == 'body' ? 'block' : 'none') .'">'; |
| | | $mout .= ' <span>'; |
| | | $mout .= Q($this->gettext('modifier')) . ' '; |
| | | $mout .= rcube::Q($this->gettext('modifier')) . ' '; |
| | | $mout .= $select_mod->show($rule['part']); |
| | | $mout .= '<input type="text" name="_rule_trans_type[]" id="rule_trans_type'.$id |
| | | . '" value="'.(is_array($rule['content']) ? implode(',', $rule['content']) : $rule['content']) |
| | |
| | | |
| | | // Advanced modifiers (body transformations) |
| | | $select_comp = new html_select(array('name' => "_rule_comp[]", 'id' => 'rule_comp_op'.$id)); |
| | | $select_comp->add(Q($this->gettext('default')), ''); |
| | | $select_comp->add(Q($this->gettext('octet')), 'i;octet'); |
| | | $select_comp->add(Q($this->gettext('asciicasemap')), 'i;ascii-casemap'); |
| | | $select_comp->add(rcube::Q($this->gettext('default')), ''); |
| | | $select_comp->add(rcube::Q($this->gettext('octet')), 'i;octet'); |
| | | $select_comp->add(rcube::Q($this->gettext('asciicasemap')), 'i;ascii-casemap'); |
| | | if (in_array('comparator-i;ascii-numeric', $this->exts)) { |
| | | $select_comp->add(Q($this->gettext('asciinumeric')), 'i;ascii-numeric'); |
| | | $select_comp->add(rcube::Q($this->gettext('asciinumeric')), 'i;ascii-numeric'); |
| | | } |
| | | |
| | | $mout .= '<div id="rule_comp' .$id. '" class="adv" style="display:' . ($rule['test'] != 'size' ? 'block' : 'none') .'">'; |
| | | $mout .= ' <span>'; |
| | | $mout .= Q($this->gettext('comparator')) . ' '; |
| | | $mout .= rcube::Q($this->gettext('comparator')) . ' '; |
| | | $mout .= $select_comp->show($rule['comparator']); |
| | | $mout .= '</span>'; |
| | | $mout .= '</div>'; |
| | |
| | | $out = $div ? '<div class="rulerow" id="rulerow' .$id .'">'."\n" : ''; |
| | | $out .= '<table><tr>'; |
| | | $out .= '<td class="advbutton">'; |
| | | $out .= '<a href="#" id="ruleadv' . $id .'" title="'. Q($this->gettext('advancedopts')). '" |
| | | $out .= '<a href="#" id="ruleadv' . $id .'" title="'. rcube::Q($this->gettext('advancedopts')). '" |
| | | onclick="rule_adv_switch(' . $id .', this)" class="show"> </a>'; |
| | | $out .= '</td>'; |
| | | $out .= '<td class="rowactions">' . $aout . '</td>'; |
| | |
| | | |
| | | // add/del buttons |
| | | $out .= '<td class="rowbuttons">'; |
| | | $out .= '<a href="#" id="ruleadd' . $id .'" title="'. Q($this->gettext('add')). '" |
| | | $out .= '<a href="#" id="ruleadd' . $id .'" title="'. rcube::Q($this->gettext('add')). '" |
| | | onclick="rcmail.managesieve_ruleadd(' . $id .')" class="button add"></a>'; |
| | | $out .= '<a href="#" id="ruledel' . $id .'" title="'. Q($this->gettext('del')). '" |
| | | $out .= '<a href="#" id="ruledel' . $id .'" title="'. rcube::Q($this->gettext('del')). '" |
| | | onclick="rcmail.managesieve_ruledel(' . $id .')" class="button del' . ($rows_num<2 ? ' disabled' : '') .'"></a>'; |
| | | $out .= '</td>'; |
| | | $out .= '</tr></table>'; |
| | |
| | | $select_action = new html_select(array('name' => "_action_type[$id]", 'id' => 'action_type'.$id, |
| | | 'onchange' => 'action_type_select(' .$id .')')); |
| | | if (in_array('fileinto', $this->exts)) |
| | | $select_action->add(Q($this->gettext('messagemoveto')), 'fileinto'); |
| | | $select_action->add(rcube::Q($this->gettext('messagemoveto')), 'fileinto'); |
| | | if (in_array('fileinto', $this->exts) && in_array('copy', $this->exts)) |
| | | $select_action->add(Q($this->gettext('messagecopyto')), 'fileinto_copy'); |
| | | $select_action->add(Q($this->gettext('messageredirect')), 'redirect'); |
| | | $select_action->add(rcube::Q($this->gettext('messagecopyto')), 'fileinto_copy'); |
| | | $select_action->add(rcube::Q($this->gettext('messageredirect')), 'redirect'); |
| | | if (in_array('copy', $this->exts)) |
| | | $select_action->add(Q($this->gettext('messagesendcopy')), 'redirect_copy'); |
| | | $select_action->add(rcube::Q($this->gettext('messagesendcopy')), 'redirect_copy'); |
| | | if (in_array('reject', $this->exts)) |
| | | $select_action->add(Q($this->gettext('messagediscard')), 'reject'); |
| | | $select_action->add(rcube::Q($this->gettext('messagediscard')), 'reject'); |
| | | else if (in_array('ereject', $this->exts)) |
| | | $select_action->add(Q($this->gettext('messagediscard')), 'ereject'); |
| | | $select_action->add(rcube::Q($this->gettext('messagediscard')), 'ereject'); |
| | | if (in_array('vacation', $this->exts)) |
| | | $select_action->add(Q($this->gettext('messagereply')), 'vacation'); |
| | | $select_action->add(Q($this->gettext('messagedelete')), 'discard'); |
| | | $select_action->add(rcube::Q($this->gettext('messagereply')), 'vacation'); |
| | | $select_action->add(rcube::Q($this->gettext('messagedelete')), 'discard'); |
| | | if (in_array('imapflags', $this->exts) || in_array('imap4flags', $this->exts)) { |
| | | $select_action->add(Q($this->gettext('setflags')), 'setflag'); |
| | | $select_action->add(Q($this->gettext('addflags')), 'addflag'); |
| | | $select_action->add(Q($this->gettext('removeflags')), 'removeflag'); |
| | | $select_action->add(rcube::Q($this->gettext('setflags')), 'setflag'); |
| | | $select_action->add(rcube::Q($this->gettext('addflags')), 'addflag'); |
| | | $select_action->add(rcube::Q($this->gettext('removeflags')), 'removeflag'); |
| | | } |
| | | if (in_array('variables', $this->exts)) { |
| | | $select_action->add(Q($this->gettext('setvariable')), 'set'); |
| | | $select_action->add(rcube::Q($this->gettext('setvariable')), 'set'); |
| | | } |
| | | if (in_array('enotify', $this->exts) || in_array('notify', $this->exts)) { |
| | | $select_action->add(Q($this->gettext('notify')), 'notify'); |
| | | $select_action->add(rcube::Q($this->gettext('notify')), 'notify'); |
| | | } |
| | | $select_action->add(Q($this->gettext('rulestop')), 'stop'); |
| | | $select_action->add(rcube::Q($this->gettext('rulestop')), 'stop'); |
| | | |
| | | $select_type = $action['type']; |
| | | if (in_array($action['type'], array('fileinto', 'redirect')) && $action['copy']) { |
| | |
| | | $out .= '<td class="rowtargets">'; |
| | | // shared targets |
| | | $out .= '<input type="text" name="_action_target['.$id.']" id="action_target' .$id. '" ' |
| | | .'value="' .($action['type']=='redirect' ? Q($action['target'], 'strict', false) : ''). '" size="35" ' |
| | | .'value="' .($action['type']=='redirect' ? rcube::Q($action['target'], 'strict', false) : ''). '" size="35" ' |
| | | .'style="display:' .($action['type']=='redirect' ? 'inline' : 'none') .'" ' |
| | | . $this->error_class($id, 'action', 'target', 'action_target') .' />'; |
| | | $out .= '<textarea name="_action_target_area['.$id.']" id="action_target_area' .$id. '" ' |
| | | .'rows="3" cols="35" '. $this->error_class($id, 'action', 'targetarea', 'action_target_area') |
| | | .'style="display:' .(in_array($action['type'], array('reject', 'ereject')) ? 'inline' : 'none') .'">' |
| | | . (in_array($action['type'], array('reject', 'ereject')) ? Q($action['target'], 'strict', false) : '') |
| | | . (in_array($action['type'], array('reject', 'ereject')) ? rcube::Q($action['target'], 'strict', false) : '') |
| | | . "</textarea>\n"; |
| | | |
| | | // vacation |
| | | $out .= '<div id="action_vacation' .$id.'" style="display:' .($action['type']=='vacation' ? 'inline' : 'none') .'">'; |
| | | $out .= '<span class="label">'. Q($this->gettext('vacationreason')) .'</span><br />' |
| | | $out .= '<span class="label">'. rcube::Q($this->gettext('vacationreason')) .'</span><br />' |
| | | .'<textarea name="_action_reason['.$id.']" id="action_reason' .$id. '" ' |
| | | .'rows="3" cols="35" '. $this->error_class($id, 'action', 'reason', 'action_reason') . '>' |
| | | . Q($action['reason'], 'strict', false) . "</textarea>\n"; |
| | | $out .= '<br /><span class="label">' .Q($this->gettext('vacationsubject')) . '</span><br />' |
| | | $out .= '<br /><span class="label">' .rcube::Q($this->gettext('vacationsubject')) . '</span><br />' |
| | | .'<input type="text" name="_action_subject['.$id.']" id="action_subject'.$id.'" ' |
| | | .'value="' . (is_array($action['subject']) ? Q(implode(', ', $action['subject']), 'strict', false) : $action['subject']) . '" size="35" ' |
| | | .'value="' . (is_array($action['subject']) ? rcube::Q(implode(', ', $action['subject']), 'strict', false) : $action['subject']) . '" size="35" ' |
| | | . $this->error_class($id, 'action', 'subject', 'action_subject') .' />'; |
| | | $out .= '<br /><span class="label">' .Q($this->gettext('vacationaddresses')) . '</span><br />' |
| | | $out .= '<br /><span class="label">' .rcube::Q($this->gettext('vacationaddresses')) . '</span><br />' |
| | | .'<input type="text" name="_action_addresses['.$id.']" id="action_addr'.$id.'" ' |
| | | .'value="' . (is_array($action['addresses']) ? Q(implode(', ', $action['addresses']), 'strict', false) : $action['addresses']) . '" size="35" ' |
| | | .'value="' . (is_array($action['addresses']) ? rcube::Q(implode(', ', $action['addresses']), 'strict', false) : $action['addresses']) . '" size="35" ' |
| | | . $this->error_class($id, 'action', 'addresses', 'action_addr') .' />'; |
| | | $out .= '<br /><span class="label">' . Q($this->gettext('vacationdays')) . '</span><br />' |
| | | $out .= '<br /><span class="label">' . rcube::Q($this->gettext('vacationdays')) . '</span><br />' |
| | | .'<input type="text" name="_action_days['.$id.']" id="action_days'.$id.'" ' |
| | | .'value="' .Q($action['days'], 'strict', false) . '" size="2" ' |
| | | .'value="' .rcube::Q($action['days'], 'strict', false) . '" size="2" ' |
| | | . $this->error_class($id, 'action', 'days', 'action_days') .' />'; |
| | | $out .= '</div>'; |
| | | |
| | |
| | | foreach ($flags as $fidx => $flag) { |
| | | $out .= '<input type="checkbox" name="_action_flags[' .$id .'][]" value="' . $flag . '"' |
| | | . (in_array_nocase($flag, $flags_target) ? 'checked="checked"' : '') . ' />' |
| | | . Q($this->gettext('flag'.$fidx)) .'<br>'; |
| | | . rcube::Q($this->gettext('flag'.$fidx)) .'<br>'; |
| | | } |
| | | $out .= '</div>'; |
| | | |
| | |
| | | ); |
| | | |
| | | $out .= '<div id="action_set' .$id.'" style="display:' .($action['type']=='set' ? 'inline' : 'none') .'">'; |
| | | $out .= '<span class="label">' .Q($this->gettext('setvarname')) . '</span><br />' |
| | | $out .= '<span class="label">' .rcube::Q($this->gettext('setvarname')) . '</span><br />' |
| | | .'<input type="text" name="_action_varname['.$id.']" id="action_varname'.$id.'" ' |
| | | .'value="' . Q($action['name']) . '" size="35" ' |
| | | .'value="' . rcube::Q($action['name']) . '" size="35" ' |
| | | . $this->error_class($id, 'action', 'name', 'action_varname') .' />'; |
| | | $out .= '<br /><span class="label">' .Q($this->gettext('setvarvalue')) . '</span><br />' |
| | | $out .= '<br /><span class="label">' .rcube::Q($this->gettext('setvarvalue')) . '</span><br />' |
| | | .'<input type="text" name="_action_varvalue['.$id.']" id="action_varvalue'.$id.'" ' |
| | | .'value="' . Q($action['value']) . '" size="35" ' |
| | | .'value="' . rcube::Q($action['value']) . '" size="35" ' |
| | | . $this->error_class($id, 'action', 'value', 'action_varvalue') .' />'; |
| | | $out .= '<br /><span class="label">' .Q($this->gettext('setvarmodifiers')) . '</span><br />'; |
| | | $out .= '<br /><span class="label">' .rcube::Q($this->gettext('setvarmodifiers')) . '</span><br />'; |
| | | foreach ($set_modifiers as $j => $s_m) { |
| | | $s_m_id = 'action_varmods' . $id . $s_m; |
| | | $out .= sprintf('<input type="checkbox" name="_action_varmods[%s][]" value="%s" id="%s"%s />%s<br>', |
| | | $id, $s_m, $s_m_id, |
| | | (array_key_exists($s_m, (array)$action) && $action[$s_m] ? ' checked="checked"' : ''), |
| | | Q($this->gettext('var' . $s_m))); |
| | | rcube::Q($this->gettext('var' . $s_m))); |
| | | } |
| | | $out .= '</div>'; |
| | | |
| | | // notify |
| | | // skip :options tag - not used by the mailto method |
| | | $out .= '<div id="action_notify' .$id.'" style="display:' .($action['type']=='notify' ? 'inline' : 'none') .'">'; |
| | | $out .= '<span class="label">' .Q($this->gettext('notifyaddress')) . '</span><br />' |
| | | $out .= '<span class="label">' .rcube::Q($this->gettext('notifyaddress')) . '</span><br />' |
| | | .'<input type="text" name="_action_notifyaddress['.$id.']" id="action_notifyaddress'.$id.'" ' |
| | | .'value="' . Q($action['address']) . '" size="35" ' |
| | | .'value="' . rcube::Q($action['address']) . '" size="35" ' |
| | | . $this->error_class($id, 'action', 'address', 'action_notifyaddress') .' />'; |
| | | $out .= '<br /><span class="label">'. Q($this->gettext('notifybody')) .'</span><br />' |
| | | $out .= '<br /><span class="label">'. rcube::Q($this->gettext('notifybody')) .'</span><br />' |
| | | .'<textarea name="_action_notifybody['.$id.']" id="action_notifybody' .$id. '" ' |
| | | .'rows="3" cols="35" '. $this->error_class($id, 'action', 'method', 'action_notifybody') . '>' |
| | | . Q($action['body'], 'strict', false) . "</textarea>\n"; |
| | | $out .= '<br /><span class="label">' .Q($this->gettext('notifysubject')) . '</span><br />' |
| | | . rcube::Q($action['body'], 'strict', false) . "</textarea>\n"; |
| | | $out .= '<br /><span class="label">' .rcube::Q($this->gettext('notifysubject')) . '</span><br />' |
| | | .'<input type="text" name="_action_notifymessage['.$id.']" id="action_notifymessage'.$id.'" ' |
| | | .'value="' . Q($action['message']) . '" size="35" ' |
| | | .'value="' . rcube::Q($action['message']) . '" size="35" ' |
| | | . $this->error_class($id, 'action', 'message', 'action_notifymessage') .' />'; |
| | | $out .= '<br /><span class="label">' .Q($this->gettext('notifyfrom')) . '</span><br />' |
| | | $out .= '<br /><span class="label">' .rcube::Q($this->gettext('notifyfrom')) . '</span><br />' |
| | | .'<input type="text" name="_action_notifyfrom['.$id.']" id="action_notifyfrom'.$id.'" ' |
| | | .'value="' . Q($action['from']) . '" size="35" ' |
| | | .'value="' . rcube::Q($action['from']) . '" size="35" ' |
| | | . $this->error_class($id, 'action', 'from', 'action_notifyfrom') .' />'; |
| | | $importance_options = array( |
| | | 3 => 'notifyimportancelow', |
| | |
| | | 'id' => '_action_notifyimportance' . $id, |
| | | 'class' => $this->error_class($id, 'action', 'importance', 'action_notifyimportance'))); |
| | | foreach ($importance_options as $io_v => $io_n) { |
| | | $select_importance->add(Q($this->gettext($io_n)), $io_v); |
| | | $select_importance->add(rcube::Q($this->gettext($io_n)), $io_v); |
| | | } |
| | | $out .= '<br /><span class="label">' . Q($this->gettext('notifyimportance')) . '</span><br />'; |
| | | $out .= '<br /><span class="label">' . rcube::Q($this->gettext('notifyimportance')) . '</span><br />'; |
| | | $out .= $select_importance->show($action['importance'] ? $action['importance'] : 2); |
| | | $out .= '</div>'; |
| | | |
| | |
| | | else |
| | | $mailbox = ''; |
| | | |
| | | $select = rcmail_mailbox_select(array( |
| | | $select = $this->rc->folder_selector(array( |
| | | 'realnames' => false, |
| | | 'maxlength' => 100, |
| | | 'id' => 'action_mailbox' . $id, |
| | |
| | | |
| | | // add/del buttons |
| | | $out .= '<td class="rowbuttons">'; |
| | | $out .= '<a href="#" id="actionadd' . $id .'" title="'. Q($this->gettext('add')). '" |
| | | $out .= '<a href="#" id="actionadd' . $id .'" title="'. rcube::Q($this->gettext('add')). '" |
| | | onclick="rcmail.managesieve_actionadd(' . $id .')" class="button add"></a>'; |
| | | $out .= '<a href="#" id="actiondel' . $id .'" title="'. Q($this->gettext('del')). '" |
| | | $out .= '<a href="#" id="actiondel' . $id .'" title="'. rcube::Q($this->gettext('del')). '" |
| | | onclick="rcmail.managesieve_actiondel(' . $id .')" class="button del' . ($rows_num<2 ? ' disabled' : '') .'"></a>'; |
| | | $out .= '</td>'; |
| | | |
| | |
| | | if (empty($this->tips)) |
| | | return; |
| | | |
| | | $script = JS_OBJECT_NAME.'.managesieve_tip_register('.json_encode($this->tips).');'; |
| | | $script = rcmail_output::JS_OBJECT_NAME.'.managesieve_tip_register('.json_encode($this->tips).');'; |
| | | $this->rc->output->add_script($script, 'foot'); |
| | | } |
| | | |
| | |
| | | $mbox_encoding = $this->rc->config->get('managesieve_mbox_encoding', 'UTF7-IMAP'); |
| | | |
| | | if ($mode == 'out') { |
| | | $mailbox = rcube_charset_convert($mailbox, $mbox_encoding, 'UTF7-IMAP'); |
| | | $mailbox = rcube_charset::convert($mailbox, $mbox_encoding, 'UTF7-IMAP'); |
| | | if ($replace_delimiter && $replace_delimiter != $delimiter) |
| | | $mailbox = str_replace($replace_delimiter, $delimiter, $mailbox); |
| | | } |
| | | else { |
| | | $mailbox = rcube_charset_convert($mailbox, 'UTF7-IMAP', $mbox_encoding); |
| | | $mailbox = rcube_charset::convert($mailbox, 'UTF7-IMAP', $mbox_encoding); |
| | | if ($replace_delimiter && $replace_delimiter != $delimiter) |
| | | $mailbox = str_replace($delimiter, $replace_delimiter, $mailbox); |
| | | } |
| | |
| | | $fname = $filter['name'] ? $filter['name'] : "#$i"; |
| | | $result[] = array( |
| | | 'id' => $idx, |
| | | 'name' => Q($fname), |
| | | 'name' => rcube::Q($fname), |
| | | 'class' => $filter['disabled'] ? 'disabled' : '', |
| | | ); |
| | | $i++; |
| | |
| | | $GLOBALS['IMAP_FLAGS']['JUNK'] = 'Junk'; |
| | | $GLOBALS['IMAP_FLAGS']['NONJUNK'] = 'NonJunk'; |
| | | |
| | | $uids = get_input_value('_uid', RCUBE_INPUT_POST); |
| | | $mbox = get_input_value('_mbox', RCUBE_INPUT_POST); |
| | | $uids = rcube_utils::get_input_value('_uid', rcube_utils::INPUT_POST); |
| | | $mbox = rcube_utils::get_input_value('_mbox', rcube_utils::INPUT_POST); |
| | | |
| | | $rcmail = rcmail::get_instance(); |
| | | $rcmail->storage->unset_flag($uids, 'NONJUNK'); |
| | |
| | | $table->add(null, html::tag('input', array( |
| | | 'type' => 'text', |
| | | 'name' => '_email', |
| | | 'value' => rcube_idn_to_utf8($identity['email']), |
| | | 'value' => rcube_utils::idn_to_utf8($identity['email']), |
| | | 'disabled' => ($identities_level == 1 || $identities_level == 3) |
| | | ))); |
| | | |
| | |
| | | 'id' => 'newuserdialog', |
| | | 'action' => $rcmail->url('plugin.newusersave'), |
| | | 'method' => 'post'), |
| | | html::tag('h3', null, Q($this->gettext('identitydialogtitle'))) . |
| | | html::p('hint', Q($this->gettext('identitydialoghint'))) . |
| | | html::tag('h3', null, rcube::Q($this->gettext('identitydialogtitle'))) . |
| | | html::p('hint', rcube::Q($this->gettext('identitydialoghint'))) . |
| | | $table->show() . |
| | | html::p(array('class' => 'formbuttons'), |
| | | html::tag('input', array('type' => 'submit', |
| | |
| | | $identities_level = intval($rcmail->config->get('identities_level', 0)); |
| | | |
| | | $save_data = array( |
| | | 'name' => get_input_value('_name', RCUBE_INPUT_POST), |
| | | 'email' => get_input_value('_email', RCUBE_INPUT_POST), |
| | | 'organization' => get_input_value('_organization', RCUBE_INPUT_POST), |
| | | 'signature' => get_input_value('_signature', RCUBE_INPUT_POST), |
| | | 'name' => rcube_utils::get_input_value('_name', rcube_utils::INPUT_POST), |
| | | 'email' => rcube_utils::get_input_value('_email', rcube_utils::INPUT_POST), |
| | | 'organization' => rcube_utils::get_input_value('_organization', rcube_utils::INPUT_POST), |
| | | 'signature' => rcube_utils::get_input_value('_signature', rcube_utils::INPUT_POST), |
| | | ); |
| | | |
| | | // don't let the user alter the e-mail address if disabled by config |
| | | if ($identities_level == 1 || $identities_level == 3) |
| | | $save_data['email'] = $identity['email']; |
| | | else |
| | | $save_data['email'] = rcube_idn_to_ascii($save_data['email']); |
| | | $save_data['email'] = rcube_utils::idn_to_ascii($save_data['email']); |
| | | |
| | | // save data if not empty |
| | | if (!empty($save_data['name']) && !empty($save_data['email'])) { |
| | |
| | | |
| | | $args['user_name'] = $user_name; |
| | | if (!$args['user_email'] && strpos($user_email, '@')) { |
| | | $args['user_email'] = rcube_idn_to_ascii($user_email); |
| | | $args['user_email'] = rcube_utils::idn_to_ascii($user_email); |
| | | } |
| | | } |
| | | } |
| | |
| | | $this->gettext('test')); |
| | | |
| | | $args['blocks']['new_message']['options'][$key] = array( |
| | | 'title' => html::label($field_id, Q($this->gettext($type))), |
| | | 'title' => html::label($field_id, rcube::Q($this->gettext($type))), |
| | | 'content' => $content |
| | | ); |
| | | } |
| | |
| | | foreach (array('basic', 'desktop', 'sound') as $type) { |
| | | $key = 'newmail_notifier_' . $type; |
| | | if (!in_array($key, $dont_override)) { |
| | | $args['prefs'][$key] = get_input_value('_'.$key, RCUBE_INPUT_POST) ? true : false; |
| | | $args['prefs'][$key] = rcube_utils::get_input_value('_'.$key, rcube_utils::INPUT_POST) ? true : false; |
| | | } |
| | | } |
| | | |
| | |
| | | return PASSWORD_SUCCESS; |
| | | } |
| | | else { |
| | | raise_error(array( |
| | | rcube::raise_error(array( |
| | | 'code' => 600, |
| | | 'type' => 'php', |
| | | 'file' => __FILE__, 'line' => __LINE__, |
| | |
| | | return PASSWORD_SUCCESS; |
| | | } |
| | | else { |
| | | raise_error(array( |
| | | rcube::raise_error(array( |
| | | 'code' => 600, |
| | | 'type' => 'php', |
| | | 'file' => __FILE__, 'line' => __LINE__, |
| | |
| | | $response = $Socket->fetch_parsed_body(); |
| | | |
| | | //DEBUG |
| | | //console("Password Plugin: [USER: $da_user] [HOST: $da_host] - Response: [SOCKET: ".$Socket->result_status_code."] [DA ERROR: ".strip_tags($response['error'])."] [TEXT: ".$response[text]."]"); |
| | | //rcube::console("Password Plugin: [USER: $da_user] [HOST: $da_host] - Response: [SOCKET: ".$Socket->result_status_code."] [DA ERROR: ".strip_tags($response['error'])."] [TEXT: ".$response[text]."]"); |
| | | |
| | | if($Socket->result_status_code != 200) |
| | | return array('code' => PASSWORD_CONNECT_ERROR, 'message' => $Socket->error[0]); |
| | |
| | | return PASSWORD_SUCCESS; |
| | | } |
| | | else { |
| | | raise_error(array( |
| | | rcube::raise_error(array( |
| | | 'code' => 600, |
| | | 'type' => 'php', |
| | | 'file' => __FILE__, 'line' => __LINE__, |
| | |
| | | $obApp = new COM("hMailServer.Application"); |
| | | } |
| | | catch (Exception $e) { |
| | | write_log('errors', "Plugin password (hmail driver): " . trim(strip_tags($e->getMessage()))); |
| | | write_log('errors', "Plugin password (hmail driver): This problem is often caused by DCOM permissions not being set."); |
| | | rcube::write_log('errors', "Plugin password (hmail driver): " . trim(strip_tags($e->getMessage()))); |
| | | rcube::write_log('errors', "Plugin password (hmail driver): This problem is often caused by DCOM permissions not being set."); |
| | | return PASSWORD_ERROR; |
| | | } |
| | | |
| | |
| | | else { |
| | | $domain = $rcmail->config->get('username_domain',false); |
| | | if (!$domain) { |
| | | write_log('errors','Plugin password (hmail driver): $rcmail_config[\'username_domain\'] is not defined.'); |
| | | write_log('errors','Plugin password (hmail driver): Hint: Use hmail_login plugin (http://myroundcube.googlecode.com'); |
| | | rcube::write_log('errors','Plugin password (hmail driver): $rcmail_config[\'username_domain\'] is not defined.'); |
| | | rcube::write_log('errors','Plugin password (hmail driver): Hint: Use hmail_login plugin (http://myroundcube.googlecode.com'); |
| | | return PASSWORD_ERROR; |
| | | } |
| | | $username = $username . "@" . $domain; |
| | |
| | | return PASSWORD_SUCCESS; |
| | | } |
| | | catch (Exception $e) { |
| | | write_log('errors', "Plugin password (hmail driver): " . trim(strip_tags($e->getMessage()))); |
| | | write_log('errors', "Plugin password (hmail driver): This problem is often caused by DCOM permissions not being set."); |
| | | rcube::write_log('errors', "Plugin password (hmail driver): " . trim(strip_tags($e->getMessage()))); |
| | | rcube::write_log('errors', "Plugin password (hmail driver): This problem is often caused by DCOM permissions not being set."); |
| | | return PASSWORD_ERROR; |
| | | } |
| | | } |
| | |
| | | |
| | | case 'samba': |
| | | if (function_exists('hash')) { |
| | | $cryptedPassword = hash('md4', rcube_charset_convert($passwordClear, RCMAIL_CHARSET, 'UTF-16LE')); |
| | | $cryptedPassword = hash('md4', rcube_charset::convert($passwordClear, RCUBE_CHARSET, 'UTF-16LE')); |
| | | $cryptedPassword = strtoupper($cryptedPassword); |
| | | } else { |
| | | /* Your PHP install does not have the hash() function */ |
| | |
| | | break; |
| | | case 'samba': |
| | | if (function_exists('hash')) { |
| | | $crypted_password = hash('md4', rcube_charset_convert($password_clear, RCMAIL_CHARSET, 'UTF-16LE')); |
| | | $crypted_password = hash('md4', rcube_charset::convert($password_clear, RCUBE_CHARSET, 'UTF-16LE')); |
| | | $crypted_password = strtoupper($crypted_password); |
| | | } else { |
| | | /* Your PHP install does not have the hash() function */ |
| | |
| | | } |
| | | } |
| | | else { |
| | | raise_error(array( |
| | | rcube::raise_error(array( |
| | | 'code' => 600, |
| | | 'type' => 'php', |
| | | 'file' => __FILE__, 'line' => __LINE__, |
| | |
| | | } |
| | | } |
| | | else { |
| | | raise_error(array( |
| | | rcube::raise_error(array( |
| | | 'code' => 600, |
| | | 'type' => 'php', |
| | | 'file' => __FILE__, 'line' => __LINE__, |
| | |
| | | return PASSWORD_SUCCESS; |
| | | } |
| | | else { |
| | | raise_error(array( |
| | | rcube::raise_error(array( |
| | | 'code' => 600, |
| | | 'type' => 'php', |
| | | 'file' => __FILE__, 'line' => __LINE__, |
| | |
| | | return PASSWORD_SUCCESS; |
| | | } |
| | | else { |
| | | raise_error(array( |
| | | rcube::raise_error(array( |
| | | 'code' => 600, |
| | | 'type' => 'php', |
| | | 'file' => __FILE__, 'line' => __LINE__, |
| | |
| | | return PASSWORD_SUCCESS; |
| | | } |
| | | else { |
| | | raise_error(array( |
| | | rcube::raise_error(array( |
| | | 'code' => 600, |
| | | 'type' => 'php', |
| | | 'file' => __FILE__, 'line' => __LINE__, |
| | |
| | | // hashed passwords |
| | | if (preg_match('/%[n|q]/', $sql)) { |
| | | if (!extension_loaded('hash')) { |
| | | raise_error(array( |
| | | rcube::raise_error(array( |
| | | 'code' => 600, |
| | | 'type' => 'php', |
| | | 'file' => __FILE__, 'line' => __LINE__, |
| | |
| | | |
| | | // convert domains to/from punnycode |
| | | if ($rcmail->config->get('password_idn_ascii')) { |
| | | $domain_part = rcube_idn_to_ascii($domain_part); |
| | | $username = rcube_idn_to_ascii($username); |
| | | $host = rcube_idn_to_ascii($host); |
| | | $domain_part = rcube_utils::idn_to_ascii($domain_part); |
| | | $username = rcube_utils::idn_to_ascii($username); |
| | | $host = rcube_utils::idn_to_ascii($host); |
| | | } |
| | | else { |
| | | $domain_part = rcube_idn_to_utf8($domain_part); |
| | | $username = rcube_idn_to_utf8($username); |
| | | $host = rcube_idn_to_utf8($host); |
| | | $domain_part = rcube_utils::idn_to_utf8($domain_part); |
| | | $username = rcube_utils::idn_to_utf8($username); |
| | | $host = rcube_utils::idn_to_utf8($host); |
| | | } |
| | | |
| | | // at least we should always have the local part |
| | |
| | | return PASSWORD_SUCCESS; |
| | | } |
| | | else { |
| | | raise_error(array( |
| | | rcube::raise_error(array( |
| | | 'code' => 600, |
| | | 'type' => 'php', |
| | | 'file' => __FILE__, 'line' => __LINE__, |
| | |
| | | $xmail->port = $rcmail->config->get('xmail_port'); |
| | | |
| | | if (!$xmail->connect()) { |
| | | raise_error(array( |
| | | rcube::raise_error(array( |
| | | 'code' => 600, |
| | | 'type' => 'php', |
| | | 'file' => __FILE__, 'line' => __LINE__, |
| | |
| | | } |
| | | else if (!$xmail->send("userpasswd\t".$domain."\t".$user."\t".$newpass."\n")) { |
| | | $xmail->close(); |
| | | raise_error(array( |
| | | rcube::raise_error(array( |
| | | 'code' => 600, |
| | | 'type' => 'php', |
| | | 'file' => __FILE__, 'line' => __LINE__, |
| | |
| | | $rc_charset = strtoupper($rcmail->output->get_charset()); |
| | | |
| | | $sespwd = $rcmail->decrypt($_SESSION['password']); |
| | | $curpwd = $confirm ? get_input_value('_curpasswd', RCUBE_INPUT_POST, true, $charset) : $sespwd; |
| | | $newpwd = get_input_value('_newpasswd', RCUBE_INPUT_POST, true); |
| | | $conpwd = get_input_value('_confpasswd', RCUBE_INPUT_POST, true); |
| | | $curpwd = $confirm ? rcube_utils::get_input_value('_curpasswd', rcube_utils::INPUT_POST, true, $charset) : $sespwd; |
| | | $newpwd = rcube_utils::get_input_value('_newpasswd', rcube_utils::INPUT_POST, true); |
| | | $conpwd = rcube_utils::get_input_value('_confpasswd', rcube_utils::INPUT_POST, true); |
| | | |
| | | // check allowed characters according to the configured 'password_charset' option |
| | | // by converting the password entered by the user to this charset and back to UTF-8 |
| | | $orig_pwd = $newpwd; |
| | | $chk_pwd = rcube_charset_convert($orig_pwd, $rc_charset, $charset); |
| | | $chk_pwd = rcube_charset_convert($chk_pwd, $charset, $rc_charset); |
| | | $chk_pwd = rcube_charset::convert($orig_pwd, $rc_charset, $charset); |
| | | $chk_pwd = rcube_charset::convert($chk_pwd, $charset, $rc_charset); |
| | | |
| | | // WARNING: Default password_charset is ISO-8859-1, so conversion will |
| | | // change national characters. This may disable possibility of using |
| | | // the same password in other MUA's. |
| | | // We're doing this for consistence with Roundcube core |
| | | $newpwd = rcube_charset_convert($newpwd, $rc_charset, $charset); |
| | | $conpwd = rcube_charset_convert($conpwd, $rc_charset, $charset); |
| | | $newpwd = rcube_charset::convert($newpwd, $rc_charset, $charset); |
| | | $conpwd = rcube_charset::convert($conpwd, $rc_charset, $charset); |
| | | |
| | | if ($chk_pwd != $orig_pwd) { |
| | | $rcmail->output->command('display_message', $this->gettext('passwordforbidden'), 'error'); |
| | |
| | | |
| | | // Log password change |
| | | if ($rcmail->config->get('password_log')) { |
| | | write_log('password', sprintf('Password changed for user %s (ID: %d) from %s', |
| | | $rcmail->get_user_name(), $rcmail->user->ID, rcmail_remote_ip())); |
| | | rcube::write_log('password', sprintf('Password changed for user %s (ID: %d) from %s', |
| | | $rcmail->get_user_name(), $rcmail->user->ID, rcube_utils::remote_ip())); |
| | | } |
| | | } |
| | | else { |
| | |
| | | } |
| | | } |
| | | |
| | | rcmail_overwrite_action('plugin.password'); |
| | | $rcmail->overwrite_action('plugin.password'); |
| | | $rcmail->output->send('plugin'); |
| | | } |
| | | |
| | |
| | | $input_curpasswd = new html_passwordfield(array('name' => '_curpasswd', 'id' => $field_id, |
| | | 'size' => 20, 'autocomplete' => 'off')); |
| | | |
| | | $table->add('title', html::label($field_id, Q($this->gettext('curpasswd')))); |
| | | $table->add('title', html::label($field_id, rcube::Q($this->gettext('curpasswd')))); |
| | | $table->add(null, $input_curpasswd->show()); |
| | | } |
| | | |
| | |
| | | $input_newpasswd = new html_passwordfield(array('name' => '_newpasswd', 'id' => $field_id, |
| | | 'size' => 20, 'autocomplete' => 'off')); |
| | | |
| | | $table->add('title', html::label($field_id, Q($this->gettext('newpasswd')))); |
| | | $table->add('title', html::label($field_id, rcube::Q($this->gettext('newpasswd')))); |
| | | $table->add(null, $input_newpasswd->show()); |
| | | |
| | | // show confirm password selection |
| | |
| | | $input_confpasswd = new html_passwordfield(array('name' => '_confpasswd', 'id' => $field_id, |
| | | 'size' => 20, 'autocomplete' => 'off')); |
| | | |
| | | $table->add('title', html::label($field_id, Q($this->gettext('confpasswd')))); |
| | | $table->add('title', html::label($field_id, rcube::Q($this->gettext('confpasswd')))); |
| | | $table->add(null, $input_confpasswd->show()); |
| | | |
| | | $out = html::div(array('class' => 'box'), |
| | |
| | | $file = $this->home . "/drivers/$driver.php"; |
| | | |
| | | if (!file_exists($file)) { |
| | | raise_error(array( |
| | | rcube::raise_error(array( |
| | | 'code' => 600, |
| | | 'type' => 'php', |
| | | 'file' => __FILE__, 'line' => __LINE__, |
| | |
| | | include_once $file; |
| | | |
| | | if (!class_exists($class, false) || !method_exists($class, 'save')) { |
| | | raise_error(array( |
| | | rcube::raise_error(array( |
| | | 'code' => 600, |
| | | 'type' => 'php', |
| | | 'file' => __FILE__, 'line' => __LINE__, |
| | |
| | | foreach ($this->abook as $rec) { |
| | | // #1487096 handle multi-address and/or too long items |
| | | $rec['email'] = array_shift(explode(';', $rec['email'])); |
| | | if (check_email(rcube_idn_to_ascii($rec['email']))) { |
| | | $rec['email'] = rcube_idn_to_utf8($rec['email']); |
| | | if (rcube_utils::check_email(rcube_utils::idn_to_ascii($rec['email']))) { |
| | | $rec['email'] = rcube_utils::idn_to_utf8($rec['email']); |
| | | $contacts->insert($rec, true); |
| | | } |
| | | } |
| | |
| | | $sql_result = $db->query('SELECT * FROM '.$userprefs_table.' WHERE user=?', $uname); // ? is replaced with emailaddress |
| | | |
| | | while ($sql_array = $db->fetch_assoc($sql_result) ) { // fetch one row from result |
| | | $this->prefs[$sql_array['prefkey']] = rcube_charset_convert(rtrim($sql_array['prefval']), $db_charset); |
| | | $this->prefs[$sql_array['prefkey']] = rcube_charset::convert(rtrim($sql_array['prefval']), $db_charset); |
| | | } |
| | | |
| | | /* retrieve address table data */ |
| | |
| | | |
| | | // parse addres book |
| | | while ($sql_array = $db->fetch_assoc($sql_result) ) { // fetch one row from result |
| | | $rec['name'] = rcube_charset_convert(rtrim($sql_array['nickname']), $db_charset); |
| | | $rec['firstname'] = rcube_charset_convert(rtrim($sql_array['firstname']), $db_charset); |
| | | $rec['surname'] = rcube_charset_convert(rtrim($sql_array['lastname']), $db_charset); |
| | | $rec['email'] = rcube_charset_convert(rtrim($sql_array['email']), $db_charset); |
| | | $rec['notes'] = rcube_charset_convert(rtrim($sql_array['label']), $db_charset); |
| | | $rec['name'] = rcube_charset::convert(rtrim($sql_array['nickname']), $db_charset); |
| | | $rec['firstname'] = rcube_charset::convert(rtrim($sql_array['firstname']), $db_charset); |
| | | $rec['surname'] = rcube_charset::convert(rtrim($sql_array['lastname']), $db_charset); |
| | | $rec['email'] = rcube_charset::convert(rtrim($sql_array['email']), $db_charset); |
| | | $rec['notes'] = rcube_charset::convert(rtrim($sql_array['label']), $db_charset); |
| | | |
| | | if ($rec['name'] && $rec['email']) |
| | | $this->abook[] = $rec; |
| | |
| | | $checkbox = new html_checkbox(array('name' => '_use_subscriptions', 'id' => $field_id, 'value' => 1)); |
| | | |
| | | $args['blocks']['main']['options']['use_subscriptions'] = array( |
| | | 'title' => html::label($field_id, Q($this->gettext('useimapsubscriptions'))), |
| | | 'title' => html::label($field_id, rcube::Q($this->gettext('useimapsubscriptions'))), |
| | | 'content' => $checkbox->show($use_subscriptions?1:0), |
| | | ); |
| | | } |
| | |
| | | $table = new html_table(array('cols' => 2, 'cellpadding' => 3)); |
| | | |
| | | $table->add('title', 'ID'); |
| | | $table->add('', Q($user->ID)); |
| | | $table->add('', rcube::Q($user->ID)); |
| | | |
| | | $table->add('title', Q($this->gettext('username'))); |
| | | $table->add('', Q($user->data['username'])); |
| | | $table->add('title', rcube::Q($this->gettext('username'))); |
| | | $table->add('', rcube::Q($user->data['username'])); |
| | | |
| | | $table->add('title', Q($this->gettext('server'))); |
| | | $table->add('', Q($user->data['mail_host'])); |
| | | $table->add('title', rcube::Q($this->gettext('server'))); |
| | | $table->add('', rcube::Q($user->data['mail_host'])); |
| | | |
| | | $table->add('title', Q($this->gettext('created'))); |
| | | $table->add('', Q($user->data['created'])); |
| | | $table->add('title', rcube::Q($this->gettext('created'))); |
| | | $table->add('', rcube::Q($user->data['created'])); |
| | | |
| | | $table->add('title', Q($this->gettext('lastlogin'))); |
| | | $table->add('', Q($user->data['last_login'])); |
| | | $table->add('title', rcube::Q($this->gettext('lastlogin'))); |
| | | $table->add('', rcube::Q($user->data['last_login'])); |
| | | |
| | | $identity = $user->get_identity(); |
| | | $table->add('title', Q($this->gettext('defaultidentity'))); |
| | | $table->add('', Q($identity['name'] . ' <' . $identity['email'] . '>')); |
| | | $table->add('title', rcube::Q($this->gettext('defaultidentity'))); |
| | | $table->add('', rcube::Q($identity['name'] . ' <' . $identity['email'] . '>')); |
| | | |
| | | return html::tag('h4', null, Q('Infos for ' . $user->get_username())) . $table->show(); |
| | | return html::tag('h4', null, rcube::Q('Infos for ' . $user->get_username())) . $table->show(); |
| | | } |
| | | |
| | | } |
| | |
| | | $p['content'] .= html::p(array('class' => 'vcardattachment'), |
| | | html::a(array( |
| | | 'href' => "#", |
| | | 'onclick' => "return plugin_vcard_save_contact('" . JQ($part.':'.$idx) . "')", |
| | | 'onclick' => "return plugin_vcard_save_contact('" . rcube::JQ($part.':'.$idx) . "')", |
| | | 'title' => $this->gettext('addvcardmsg'), |
| | | ), |
| | | html::span(null, Q($display))) |
| | | html::span(null, rcube::Q($display))) |
| | | ); |
| | | } |
| | | |
| | |
| | | { |
| | | $this->add_texts('localization', true); |
| | | |
| | | $uid = get_input_value('_uid', RCUBE_INPUT_POST); |
| | | $mbox = get_input_value('_mbox', RCUBE_INPUT_POST); |
| | | $mime_id = get_input_value('_part', RCUBE_INPUT_POST); |
| | | $uid = rcube_utils::get_input_value('_uid', rcube_utils::INPUT_POST); |
| | | $mbox = rcube_utils::get_input_value('_mbox', rcube_utils::INPUT_POST); |
| | | $mime_id = rcube_utils::get_input_value('_part', rcube_utils::INPUT_POST); |
| | | |
| | | $rcmail = rcmail::get_instance(); |
| | | $storage = $rcmail->get_storage(); |
| | |
| | | } |
| | | else { |
| | | // We're using UTF8 internally |
| | | $email = rcube_idn_to_utf8($email); |
| | | $email = rcube_utils::idn_to_utf8($email); |
| | | |
| | | // compare e-mail address |
| | | $existing = $CONTACTS->search('email', $email, 1, false); |
| | |
| | | $arr = preg_split('/\s+/', $r[$i]); |
| | | |
| | | if (count($arr) > 0 && strpos($arr[0], '@')) { |
| | | $result[] = rcube_idn_to_ascii(trim(str_replace('\\@', '@', $arr[0]))); |
| | | $result[] = rcube_utils::idn_to_ascii(trim(str_replace('\\@', '@', $arr[0]))); |
| | | |
| | | if ($p['first']) { |
| | | $p['email'] = $result[0]; |
| | |
| | | if (strpos($sql_arr[0], '@')) { |
| | | if ($p['extended'] && count($sql_arr) > 1) { |
| | | $result[] = array( |
| | | 'email' => rcube_idn_to_ascii($sql_arr[0]), |
| | | 'email' => rcube_utils::idn_to_ascii($sql_arr[0]), |
| | | 'name' => $sql_arr[1], |
| | | 'organization' => $sql_arr[2], |
| | | 'reply-to' => rcube_idn_to_ascii($sql_arr[3]), |
| | | 'bcc' => rcube_idn_to_ascii($sql_arr[4]), |
| | | 'reply-to' => rcube_utils::idn_to_ascii($sql_arr[3]), |
| | | 'bcc' => rcube_utils::idn_to_ascii($sql_arr[4]), |
| | | 'signature' => $sql_arr[5], |
| | | 'html_signature' => (int)$sql_arr[6], |
| | | ); |
| | |
| | | } |
| | | |
| | | $rcmail = rcmail::get_instance(); |
| | | $this->charset = $rcmail->config->get('zipdownload_charset', RCMAIL_CHARSET); |
| | | $this->charset = $rcmail->config->get('zipdownload_charset', RCUBE_CHARSET); |
| | | |
| | | $this->load_config(); |
| | | $this->add_texts('localization'); |
| | |
| | | |
| | | // only show the link if there is more than the configured number of attachments |
| | | if (substr_count($p['content'], '<li') > $rcmail->config->get('zipdownload_attachments', 1)) { |
| | | $link = html::a(array( |
| | | 'href' => rcmail_url('plugin.zipdownload.zip_attachments', array('_mbox' => $rcmail->output->env['mailbox'], '_uid' => $rcmail->output->env['uid'])), |
| | | 'class' => 'button zipdownload', |
| | | ), |
| | | Q($this->gettext('downloadall')) |
| | | $href = $rcmail->url(array( |
| | | '_action' => 'plugin.zipdownload.zip_attachments', |
| | | '_mbox' => $rcmail->output->env['mailbox'], |
| | | '_uid' => $rcmail->output->env['uid'], |
| | | )); |
| | | |
| | | $link = html::a(array('href' => $href, 'class' => 'button zipdownload'), |
| | | rcube::Q($this->gettext('downloadall')) |
| | | ); |
| | | |
| | | // append link to attachments list, slightly different in some skins |
| | |
| | | $temp_dir = $rcmail->config->get('temp_dir'); |
| | | $tmpfname = tempnam($temp_dir, 'zipdownload'); |
| | | $tempfiles = array($tmpfname); |
| | | $message = new rcube_message(get_input_value('_uid', RCUBE_INPUT_GET)); |
| | | $message = new rcube_message(rcube_utils::get_input_value('_uid', rcube_utils::INPUT_GET)); |
| | | |
| | | // open zip file |
| | | $zip = new ZipArchive(); |
| | |
| | | public function download_selection() |
| | | { |
| | | if (isset($_REQUEST['_uid'])) { |
| | | $uids = explode(",", get_input_value('_uid', RCUBE_INPUT_GPC)); |
| | | $uids = explode(",", rcube_utils::get_input_value('_uid', rcube_utils::INPUT_GPC)); |
| | | |
| | | if (sizeof($uids) > 0) |
| | | $this->_download_messages($uids); |
| | |
| | | |
| | | // initialize searching result if search_filter is used |
| | | if ($_SESSION['search_filter'] && $_SESSION['search_filter'] != 'ALL') { |
| | | $imap->search($mbox_name, $_SESSION['search_filter'], RCMAIL_CHARSET); |
| | | $imap->search($mbox_name, $_SESSION['search_filter'], RCUBE_CHARSET); |
| | | } |
| | | |
| | | // fetch message headers for all pages |
| | |
| | | private function _deliver_zipfile($tmpfname, $filename) |
| | | { |
| | | $browser = new rcube_browser; |
| | | send_nocacheing_headers(); |
| | | $rcmail = rcmail::get_instance(); |
| | | |
| | | $rcmail->output->nocacheing_headers(); |
| | | |
| | | if ($browser->ie && $browser->ver < 7) |
| | | $filename = rawurlencode(abbreviate_string($filename, 55)); |
| | |
| | | /** |
| | | * Helper function to convert filenames to the configured charset |
| | | */ |
| | | private function _convert_filename($str, $from = RCMAIL_CHARSET) |
| | | private function _convert_filename($str, $from = RCUBE_CHARSET) |
| | | { |
| | | return strtr(rcube_charset_convert($str, $from, $this->charset), array(':'=>'', '/'=>'-')); |
| | | return strtr(rcube_charset::convert($str, $from, $this->charset), array(':'=>'', '/'=>'-')); |
| | | } |
| | | } |
| | | |
| | |
| | | $count = count($path); |
| | | |
| | | if ($count > 1) { |
| | | for ($i = 1; $i < $count; $i++) { |
| | | for ($i = 0; $i < $count; $i++) { |
| | | $folder = implode($delimiter, array_slice($path, 0, -$i)); |
| | | if ($folder_class = $this->folder_classname($folder)) { |
| | | $name = implode($delimiter, array_slice($path, $count - $i)); |