function template_object_identityform($args)
 {
     if ($this->rcmail_inst->config->get('identity_limit') === true) {
         $emails = new html_select(array('name' => '_email', 'id' => 'rcmfd_email', 'class' => 'ff_email'));
         try {
             $session_id = $this->soap->login($this->rcmail_inst->config->get('remote_soap_user'), $this->rcmail_inst->config->get('remote_soap_pass'));
             $mail_user = $this->soap->mail_user_get($session_id, array('login' => $this->rcmail_inst->user->data['username']));
             $alias = $this->soap->mail_alias_get($session_id, array('destination' => $mail_user[0]['email'], 'type' => 'alias', 'active' => 'y'));
             $this->soap->logout($session_id);
             $emails->add($mail_user[0]['email'], $mail_user[0]['email']);
             for ($i = 0; $i < count($alias); $i++) {
                 $emails->add($alias[$i]['source'], $alias[$i]['source']);
             }
         } catch (SoapFault $e) {
             $this->rcmail_inst->output->command('display_message', 'Soap Error: ' . $e->getMessage(), 'error');
         }
         if (version_compare(RCMAIL_VERSION, '0.7.0') <= 0) {
             preg_match('/<input type=\\"text\\" size=\\"40\\" id=\\"rcmfd_email\\" name=\\"_email\\" class=\\"ff_email\\" value=\\"(.*)\\" \\/>/', $args['content'], $test);
             $args['content'] = preg_replace('/<input type=\\"text\\" size=\\"40\\" id=\\"rcmfd_email\\" name=\\"_email\\" class=\\"ff_email\\" value=\\"(.*)\\" \\/>/', $emails->show($test[1]), $args['content']);
         } else {
             preg_match('/<input type=\\"text\\" size=\\"40\\" id=\\"rcmfd_email\\" name=\\"_email\\" class=\\"ff_email\\" value=\\"(.*)\\">/', $args['content'], $test);
             $args['content'] = preg_replace('/<input type=\\"text\\" size=\\"40\\" id=\\"rcmfd_email\\" name=\\"_email\\" class=\\"ff_email\\" value=\\"(.*)\\">/', $emails->show($test[1]), $args['content']);
         }
     }
     return $args;
 }
 function prefs_list($args)
 {
     if ($args['section'] == 'mailbox') {
         $RCMAIL = rcmail::get_instance();
         $field_id = 'rcmfd_html5_notifier';
         $select_duration = new html_select(array('name' => '_html5_notifier_duration', 'id' => $field_id));
         $select_duration->add($this->gettext('off'), '0');
         $times = array('3', '5', '8', '10', '12', '15', '20', '25', '30');
         foreach ($times as $time) {
             $select_duration->add($time . ' ' . $this->gettext('seconds'), $time);
         }
         $select_duration->add($this->gettext('durable'), '-1');
         $select_smbox = new html_select(array('name' => '_html5_notifier_smbox', 'id' => $field_id));
         $select_smbox->add($this->gettext('no_mailbox'), '0');
         $select_smbox->add($this->gettext('short_mailbox'), '1');
         $select_smbox->add($this->gettext('full_mailbox'), '2');
         $content = $select_duration->show($RCMAIL->config->get('html5_notifier_duration') . '');
         $content .= $select_smbox->show($RCMAIL->config->get('html5_notifier_smbox') . '');
         $content .= html::a(array('href' => '#', 'id' => 'rcmfd_html5_notifier_browser_conf', 'onclick' => 'rcmail_browser_notifications(); return false;'), $this->gettext('conf_browser')) . ' ';
         $content .= html::a(array('href' => '#', 'onclick' => 'rcmail_browser_notifications_test(); return false;'), $this->gettext('test_browser'));
         $args['blocks']['new_message']['options']['html5_notifier'] = array('title' => html::label($field_id, Q($this->gettext('shownotifies'))), 'content' => $content);
         $check_only_new = new html_checkbox(array('name' => '_html5_notifier_only_new', 'id' => $field_id . '_only_new', 'value' => 1));
         $content = $check_only_new->show($RCMAIL->config->get('html5_notifier_only_new', false));
         $args['blocks']['new_message']['options']['html5_notifier_only_new'] = array('title' => html::label($field_id, Q($this->gettext('onlynew'))), 'content' => $content);
         $field_id .= '_excluded';
         $input_excluded = new html_inputfield(array('name' => '_html5_notifier_excluded_directories', 'id' => $field_id));
         $args['blocks']['new_message']['options']['html5_notifier_excluded_directories'] = array('title' => html::label($field_id, Q($this->gettext('excluded_directories'))), 'content' => $input_excluded->show($RCMAIL->config->get('html5_notifier_excluded_directories') . ''));
         $RCMAIL->output->add_script("\$(document).ready(function(){ rcmail_browser_notifications_colorate(); });");
     }
     return $args;
 }
Exemplo n.º 3
0
 function settings_table($args)
 {
     if ($args['section'] == 'mailbox') {
         $a_list_cols = rcmail::get_instance()->config->get('list_cols');
         $args['blocks']['roworder']['name'] = Q($this->gettext('roworder', 'msglistcols'));
         for ($i = 0; $i < 9; $i++) {
             $field_id = 'rcmfd_list_col' . $i;
             $select_col = new html_select(array('name' => '_list_cols[]', 'id' => $field_id));
             $select_col->add(rcube_label('skip', 'msglistcols'), '');
             $select_col->add(rcube_label('subject'), 'subject');
             $select_col->add(rcube_label('from'), 'from');
             $select_col->add(rcube_label('to'), 'to');
             $select_col->add(rcube_label('cc'), 'cc');
             $select_col->add(rcube_label('replyto'), 'replyto');
             $select_col->add(rcube_label('date'), 'date');
             $select_col->add(rcube_label('size'), 'size');
             $select_col->add(rcube_label('flagged', 'msglistcols'), 'flag');
             $select_col->add(rcube_label('attachment', 'msglistcols'), 'attachment');
             $args['blocks']['roworder']['options']['listcol_' . $i]['title'] = Q($this->gettext('list_col_' . $i, 'msglistcols'));
             if (!empty($a_list_cols[$i])) {
                 $selected = $a_list_cols[$i];
             } else {
                 $selected = "";
             }
             $args['blocks']['roworder']['options']['listcol_' . $i]['content'] = $select_col->show($selected);
             unset($select_col);
         }
     }
     return $args;
 }
Exemplo n.º 4
0
 function show_settings($args)
 {
     if ($args['section'] == 'mailbox') {
         $this->add_texts('localization/');
         $field_id = 'rcmfd_previewpane_layout';
         $select = new html_select(array('name' => '_previewpane_layout', 'id' => $field_id));
         $select->add(rcmail::Q($this->gettext('threecol.none')), 'none');
         $select->add(rcmail::Q($this->gettext('threecol.below')), 'below');
         $select->add(rcmail::Q($this->gettext('threecol.right')), 'right');
         // add new option at the top of the list
         $val = rcube::get_instance()->config->get('preview_pane') ? rcube::get_instance()->config->get('previewpane_layout', 'below') : 'none';
         $args['blocks']['main']['options']['preview_pane']['content'] = $select->show($val);
     }
     return $args;
 }
 function mh_get_form_row($header = 'from', $input = '', $color = '#ffffff', $delete = false)
 {
     // header select box
     $header_select = new html_select(array('name' => '_mh_header[]', 'class' => 'rcmfd_mh_header'));
     $header_select->add(Q($this->gettext('subject')), 'subject');
     $header_select->add(Q($this->gettext('from')), 'from');
     $header_select->add(Q($this->gettext('to')), 'to');
     $header_select->add(Q($this->gettext('cc')), 'cc');
     // input field
     $input = new html_inputfield(array('name' => '_mh_input[]', 'class' => 'rcmfd_mh_input', 'type' => 'text', 'autocomplete' => 'off', 'value' => $input));
     // color box
     $color = html::tag('input', array('id' => uniqid(), 'name' => '_mh_color[]', 'type' => 'color', 'text' => 'hidden', 'class' => 'mh_color_input', 'value' => $color, 'data-hex' => 'true'));
     // delete button
     $button = html::tag('input', array('class' => 'button mh_delete mh_button', 'type' => 'button', 'value' => $this->gettext('mh_delete'), 'title' => $this->gettext('mh_delete_description')));
     // add button
     $add_button = html::tag('input', array('class' => 'button mh_add mh_button', 'type' => 'button', 'value' => $this->gettext('mh_add'), 'title' => $this->gettext('mh_add_description')));
     $content = $header_select->show($header) . html::span('mh_matches', Q($this->gettext('mh_matches'))) . $input->show() . html::span('mh_color', Q($this->gettext('mh_color'))) . $color . $button . $add_button;
     if (rcmail::get_instance()->config->get('request_saver_compress_html', false)) {
         $content = request_saver::html_compress($content);
     }
     return $content;
 }
 function gen_form()
 {
     $policy_name = array();
     $policy_id = array();
     try {
         $session_id = $this->soap->login($this->rcmail_inst->config->get('remote_soap_user'), $this->rcmail_inst->config->get('remote_soap_pass'));
         $mail_user = $this->soap->mail_user_get($session_id, array('login' => $this->rcmail_inst->user->data['username']));
         $spam_user = $this->soap->mail_spamfilter_user_get($session_id, array('email' => $mail_user[0]['email']));
         $policy = $this->soap->mail_policy_get($session_id, array(1 => 1));
         $policy_sel = $this->soap->mail_policy_get($session_id, array("id" => $spam_user[0]['policy_id']));
         $this->soap->logout($session_id);
         for ($i = 0; $i < count($policy); $i++) {
             $policy_name[] = $policy[$i]['policy_name'];
             $policy_id[] = $policy[$i]['id'];
         }
     } catch (SoapFault $e) {
         $this->rcmail_inst->output->command('display_message', 'Soap Error: ' . $e->getMessage(), 'error');
     }
     $enabled = $mail_user[0]['move_junk'];
     if ($enabled == 'y') {
         $enabled = 1;
     } else {
         $enabled = 0;
     }
     $this->rcmail_inst->output->set_env('framed', true);
     $out .= '<fieldset><legend>' . $this->gettext('junk') . '</legend>' . "\n";
     $table = new html_table(array('cols' => 2, 'class' => 'propform'));
     $input_spampolicy_name = new html_select(array('name' => '_spampolicy_name', 'id' => 'spampolicy_name'));
     $input_spampolicy_name->add($policy_name, $policy_id);
     $table->add('title', rep_specialchars_output($this->gettext('policy_name')));
     $table->add('', $input_spampolicy_name->show($policy_sel[0]['policy_name']));
     $input_spammove = new html_checkbox(array('name' => '_spammove', 'id' => 'spammove', 'value' => '1'));
     $table->add('title', rep_specialchars_output($this->gettext('spammove')));
     $table->add('', $input_spammove->show($enabled));
     $out .= $table->show();
     $out .= "</fieldset>\n";
     return $out;
 }
 /**
  * Handler for task/itip-status requests
  */
 public function task_itip_status()
 {
     $data = rcube_utils::get_input_value('data', rcube_utils::INPUT_POST, true);
     // find local copy of the referenced task
     $existing = $this->driver->get_task($data);
     $itip = $this->load_itip();
     $response = $itip->get_itip_status($data, $existing);
     // get a list of writeable lists to save new tasks to
     if (!$existing && $response['action'] == 'rsvp' || $response['action'] == 'import') {
         $lists = $this->driver->get_lists();
         $select = new html_select(array('name' => 'tasklist', 'id' => 'itip-saveto', 'is_escaped' => true));
         $select->add('--', '');
         foreach ($lists as $list) {
             if ($list['editable']) {
                 $select->add($list['name'], $list['id']);
             }
         }
     }
     if ($select) {
         $default_list = $this->get_default_tasklist($data['sensitivity']);
         $response['select'] = html::span('folder-select', $this->gettext('saveintasklist') . '&nbsp;' . $select->show($default_list['id']));
     }
     $this->rc->output->command('plugin.update_itip_object_status', $response);
 }
Exemplo n.º 8
0
 /**
  * Create an edit field for inclusion on a form
  *
  * @param string col field name
  * @param string value field value
  * @param array attrib HTML element attributes for field
  * @param string type HTML element type (default 'text')
  *
  * @return string HTML field definition
  */
 public static function get_edit_field($col, $value, $attrib, $type = 'text')
 {
     static $colcounts = array();
     $fname = '_' . $col;
     $attrib['name'] = $fname . ($attrib['array'] ? '[]' : '');
     $attrib['class'] = trim($attrib['class'] . ' ff_' . $col);
     if ($type == 'checkbox') {
         $attrib['value'] = '1';
         $input = new html_checkbox($attrib);
     } else {
         if ($type == 'textarea') {
             $attrib['cols'] = $attrib['size'];
             $input = new html_textarea($attrib);
         } else {
             if ($type == 'select') {
                 $input = new html_select($attrib);
                 $input->add('---', '');
                 $input->add(array_values($attrib['options']), array_keys($attrib['options']));
             } else {
                 if ($attrib['type'] == 'password') {
                     $input = new html_passwordfield($attrib);
                 } else {
                     if ($attrib['type'] != 'text' && $attrib['type'] != 'hidden') {
                         $attrib['type'] = 'text';
                     }
                     $input = new html_inputfield($attrib);
                 }
             }
         }
     }
     // use value from post
     if (isset($_POST[$fname])) {
         $postvalue = self::get_input_value($fname, self::INPUT_POST, true);
         $value = $attrib['array'] ? $postvalue[intval($colcounts[$col]++)] : $postvalue;
     }
     $out = $input->show($value);
     return $out;
 }
 /**
  * GUI object 'charsetselector'
  *
  * @param array Named parameters for the select tag
  * @return string HTML code for the gui object
  */
 public function charset_selector($attrib)
 {
     // pass the following attributes to the form class
     $field_attrib = array('name' => '_charset');
     foreach ($attrib as $attr => $value) {
         if (in_array($attr, array('id', 'name', 'class', 'style', 'size', 'tabindex'))) {
             $field_attrib[$attr] = $value;
         }
     }
     $charsets = array('UTF-8' => 'UTF-8 (' . $this->app->gettext('unicode') . ')', 'US-ASCII' => 'ASCII (' . $this->app->gettext('english') . ')', 'ISO-8859-1' => 'ISO-8859-1 (' . $this->app->gettext('westerneuropean') . ')', 'ISO-8859-2' => 'ISO-8859-2 (' . $this->app->gettext('easterneuropean') . ')', 'ISO-8859-4' => 'ISO-8859-4 (' . $this->app->gettext('baltic') . ')', 'ISO-8859-5' => 'ISO-8859-5 (' . $this->app->gettext('cyrillic') . ')', 'ISO-8859-6' => 'ISO-8859-6 (' . $this->app->gettext('arabic') . ')', 'ISO-8859-7' => 'ISO-8859-7 (' . $this->app->gettext('greek') . ')', 'ISO-8859-8' => 'ISO-8859-8 (' . $this->app->gettext('hebrew') . ')', 'ISO-8859-9' => 'ISO-8859-9 (' . $this->app->gettext('turkish') . ')', 'ISO-8859-10' => 'ISO-8859-10 (' . $this->app->gettext('nordic') . ')', 'ISO-8859-11' => 'ISO-8859-11 (' . $this->app->gettext('thai') . ')', 'ISO-8859-13' => 'ISO-8859-13 (' . $this->app->gettext('baltic') . ')', 'ISO-8859-14' => 'ISO-8859-14 (' . $this->app->gettext('celtic') . ')', 'ISO-8859-15' => 'ISO-8859-15 (' . $this->app->gettext('westerneuropean') . ')', 'ISO-8859-16' => 'ISO-8859-16 (' . $this->app->gettext('southeasterneuropean') . ')', 'WINDOWS-1250' => 'Windows-1250 (' . $this->app->gettext('easterneuropean') . ')', 'WINDOWS-1251' => 'Windows-1251 (' . $this->app->gettext('cyrillic') . ')', 'WINDOWS-1252' => 'Windows-1252 (' . $this->app->gettext('westerneuropean') . ')', 'WINDOWS-1253' => 'Windows-1253 (' . $this->app->gettext('greek') . ')', 'WINDOWS-1254' => 'Windows-1254 (' . $this->app->gettext('turkish') . ')', 'WINDOWS-1255' => 'Windows-1255 (' . $this->app->gettext('hebrew') . ')', 'WINDOWS-1256' => 'Windows-1256 (' . $this->app->gettext('arabic') . ')', 'WINDOWS-1257' => 'Windows-1257 (' . $this->app->gettext('baltic') . ')', 'WINDOWS-1258' => 'Windows-1258 (' . $this->app->gettext('vietnamese') . ')', 'ISO-2022-JP' => 'ISO-2022-JP (' . $this->app->gettext('japanese') . ')', 'ISO-2022-KR' => 'ISO-2022-KR (' . $this->app->gettext('korean') . ')', 'ISO-2022-CN' => 'ISO-2022-CN (' . $this->app->gettext('chinese') . ')', 'EUC-JP' => 'EUC-JP (' . $this->app->gettext('japanese') . ')', 'EUC-KR' => 'EUC-KR (' . $this->app->gettext('korean') . ')', 'EUC-CN' => 'EUC-CN (' . $this->app->gettext('chinese') . ')', 'BIG5' => 'BIG5 (' . $this->app->gettext('chinese') . ')', 'GB2312' => 'GB2312 (' . $this->app->gettext('chinese') . ')');
     if (!empty($_POST['_charset'])) {
         $set = $_POST['_charset'];
     } else {
         if (!empty($attrib['selected'])) {
             $set = $attrib['selected'];
         } else {
             $set = $this->get_charset();
         }
     }
     $set = strtoupper($set);
     if (!isset($charsets[$set])) {
         $charsets[$set] = $set;
     }
     $select = new html_select($field_attrib);
     $select->add(array_values($charsets), array_keys($charsets));
     return $select->show($set);
 }
Exemplo n.º 10
0
 function action_div($fid, $id, $div = true)
 {
     $action = isset($this->form) ? $this->form['actions'][$id] : $this->script[$fid]['actions'][$id];
     $rows_num = isset($this->form) ? sizeof($this->form['actions']) : sizeof($this->script[$fid]['actions']);
     $out = $div ? '<div class="actionrow" id="actionrow' . $id . '">' . "\n" : '';
     $out .= '<table><tr><td class="rowactions">';
     // action select
     $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(rcube::Q($this->plugin->gettext('messagemoveto')), 'fileinto');
     }
     if (in_array('fileinto', $this->exts) && in_array('copy', $this->exts)) {
         $select_action->add(rcube::Q($this->plugin->gettext('messagecopyto')), 'fileinto_copy');
     }
     $select_action->add(rcube::Q($this->plugin->gettext('messageredirect')), 'redirect');
     if (in_array('copy', $this->exts)) {
         $select_action->add(rcube::Q($this->plugin->gettext('messagesendcopy')), 'redirect_copy');
     }
     if (in_array('reject', $this->exts)) {
         $select_action->add(rcube::Q($this->plugin->gettext('messagediscard')), 'reject');
     } else {
         if (in_array('ereject', $this->exts)) {
             $select_action->add(rcube::Q($this->plugin->gettext('messagediscard')), 'ereject');
         }
     }
     if (in_array('vacation', $this->exts)) {
         $select_action->add(rcube::Q($this->plugin->gettext('messagereply')), 'vacation');
     }
     $select_action->add(rcube::Q($this->plugin->gettext('messagedelete')), 'discard');
     if (in_array('imapflags', $this->exts) || in_array('imap4flags', $this->exts)) {
         $select_action->add(rcube::Q($this->plugin->gettext('setflags')), 'setflag');
         $select_action->add(rcube::Q($this->plugin->gettext('addflags')), 'addflag');
         $select_action->add(rcube::Q($this->plugin->gettext('removeflags')), 'removeflag');
     }
     if (in_array('variables', $this->exts)) {
         $select_action->add(rcube::Q($this->plugin->gettext('setvariable')), 'set');
     }
     if (in_array('enotify', $this->exts) || in_array('notify', $this->exts)) {
         $select_action->add(rcube::Q($this->plugin->gettext('notify')), 'notify');
     }
     $select_action->add(rcube::Q($this->plugin->gettext('messagekeep')), 'keep');
     $select_action->add(rcube::Q($this->plugin->gettext('rulestop')), 'stop');
     $select_type = $action['type'];
     if (in_array($action['type'], array('fileinto', 'redirect')) && $action['copy']) {
         $select_type .= '_copy';
     }
     $out .= $select_action->show($select_type);
     $out .= '</td>';
     // actions target inputs
     $out .= '<td class="rowtargets">';
     // force domain selection in redirect email input
     $domains = (array) $this->rc->config->get('managesieve_domains');
     if (!empty($domains)) {
         sort($domains);
         $domain_select = new html_select(array('name' => "_action_target_domain[{$id}]", 'id' => 'action_target_domain' . $id));
         $domain_select->add(array_combine($domains, $domains));
         if ($action['type'] == 'redirect') {
             $parts = explode('@', $action['target']);
             if (!empty($parts)) {
                 $action['domain'] = array_pop($parts);
                 $action['target'] = implode('@', $parts);
             }
         }
     }
     // redirect target
     $out .= '<span id="redirect_target' . $id . '" style="white-space:nowrap;' . ' display:' . ($action['type'] == 'redirect' ? 'inline' : 'none') . '">' . '<input type="text" name="_action_target[' . $id . ']" id="action_target' . $id . '"' . ' value="' . ($action['type'] == 'redirect' ? rcube::Q($action['target'], 'strict', false) : '') . '"' . (!empty($domains) ? ' size="20"' : ' size="35"') . $this->error_class($id, 'action', 'target', 'action_target') . ' />' . (!empty($domains) ? ' @ ' . $domain_select->show($action['domain']) : '') . '</span>';
     // (e)reject 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')) ? rcube::Q($action['target'], 'strict', false) : '') . "</textarea>\n";
     // vacation
     $vsec = in_array('vacation-seconds', $this->exts);
     $out .= '<div id="action_vacation' . $id . '" style="display:' . ($action['type'] == 'vacation' ? 'inline' : 'none') . '">';
     $out .= '<span class="label">' . rcube::Q($this->plugin->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">' . rcube::Q($this->plugin->gettext('vacationsubject')) . '</span><br />' . '<input type="text" name="_action_subject[' . $id . ']" id="action_subject' . $id . '" ' . '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">' . rcube::Q($this->plugin->gettext('vacationaddr')) . '</span><br />' . $this->list_input($id, 'action_addresses', $action['addresses'], true, $this->error_class($id, 'action', 'addresses', 'action_addresses'), 30);
     $out .= '<br /><span class="label">' . rcube::Q($this->plugin->gettext($vsec ? 'vacationinterval' : 'vacationdays')) . '</span><br />' . '<input type="text" name="_action_interval[' . $id . ']" id="action_interval' . $id . '" ' . 'value="' . rcube::Q(isset($action['seconds']) ? $action['seconds'] : $action['days'], 'strict', false) . '" size="2" ' . $this->error_class($id, 'action', 'interval', 'action_interval') . ' />';
     if ($vsec) {
         $out .= '&nbsp;<label><input type="radio" name="_action_interval_type[' . $id . ']" value="days"' . (!isset($action['seconds']) ? ' checked="checked"' : '') . ' class="radio" />' . $this->plugin->gettext('days') . '</label>' . '&nbsp;<label><input type="radio" name="_action_interval_type[' . $id . ']" value="seconds"' . (isset($action['seconds']) ? ' checked="checked"' : '') . ' class="radio" />' . $this->plugin->gettext('seconds') . '</label>';
     }
     $out .= '</div>';
     // flags
     $flags = array('read' => '\\Seen', 'answered' => '\\Answered', 'flagged' => '\\Flagged', 'deleted' => '\\Deleted', 'draft' => '\\Draft');
     $flags_target = (array) $action['target'];
     $out .= '<div id="action_flags' . $id . '" style="display:' . (preg_match('/^(set|add|remove)flag$/', $action['type']) ? 'inline' : 'none') . '"' . $this->error_class($id, 'action', 'flags', 'action_flags') . '>';
     foreach ($flags as $fidx => $flag) {
         $out .= '<input type="checkbox" name="_action_flags[' . $id . '][]" value="' . $flag . '"' . (in_array_nocase($flag, $flags_target) ? 'checked="checked"' : '') . ' />' . rcube::Q($this->plugin->gettext('flag' . $fidx)) . '<br>';
     }
     $out .= '</div>';
     // set variable
     $set_modifiers = array('lower', 'upper', 'lowerfirst', 'upperfirst', 'quotewildcard', 'length');
     $out .= '<div id="action_set' . $id . '" style="display:' . ($action['type'] == 'set' ? 'inline' : 'none') . '">';
     $out .= '<span class="label">' . rcube::Q($this->plugin->gettext('setvarname')) . '</span><br />' . '<input type="text" name="_action_varname[' . $id . ']" id="action_varname' . $id . '" ' . 'value="' . rcube::Q($action['name']) . '" size="35" ' . $this->error_class($id, 'action', 'name', 'action_varname') . ' />';
     $out .= '<br /><span class="label">' . rcube::Q($this->plugin->gettext('setvarvalue')) . '</span><br />' . '<input type="text" name="_action_varvalue[' . $id . ']" id="action_varvalue' . $id . '" ' . 'value="' . rcube::Q($action['value']) . '" size="35" ' . $this->error_class($id, 'action', 'value', 'action_varvalue') . ' />';
     $out .= '<br /><span class="label">' . rcube::Q($this->plugin->gettext('setvarmodifiers')) . '</span><br />';
     foreach ($set_modifiers as $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"' : '', rcube::Q($this->plugin->gettext('var' . $s_m)));
     }
     $out .= '</div>';
     // notify
     $notify_methods = (array) $this->rc->config->get('managesieve_notify_methods');
     $importance_options = $this->notify_importance_options;
     if (empty($notify_methods)) {
         $notify_methods = $this->notify_methods;
     }
     list($method, $target) = explode(':', $action['method'], 2);
     $method = strtolower($method);
     if ($method && !in_array($method, $notify_methods)) {
         $notify_methods[] = $method;
     }
     $select_method = new html_select(array('name' => "_action_notifymethod[{$id}]", 'id' => "_action_notifymethod{$id}", 'class' => $this->error_class($id, 'action', 'method', 'action_notifymethod')));
     foreach ($notify_methods as $m_n) {
         $select_method->add(rcube::Q($this->rc->text_exists('managesieve.notifymethod' . $m_n) ? $this->plugin->gettext('managesieve.notifymethod' . $m_n) : $m_n), $m_n);
     }
     $select_importance = new html_select(array('name' => "_action_notifyimportance[{$id}]", 'id' => "_action_notifyimportance{$id}", 'class' => $this->error_class($id, 'action', 'importance', 'action_notifyimportance')));
     foreach ($importance_options as $io_v => $io_n) {
         $select_importance->add(rcube::Q($this->plugin->gettext($io_n)), $io_v);
     }
     // @TODO: nice UI for mailto: (other methods too) URI parameters
     $out .= '<div id="action_notify' . $id . '" style="display:' . ($action['type'] == 'notify' ? 'inline' : 'none') . '">';
     $out .= '<span class="label">' . rcube::Q($this->plugin->gettext('notifytarget')) . '</span><br />' . $select_method->show($method) . '<input type="text" name="_action_notifytarget[' . $id . ']" id="action_notifytarget' . $id . '" ' . 'value="' . rcube::Q($target) . '" size="25" ' . $this->error_class($id, 'action', 'target', 'action_notifytarget') . ' />';
     $out .= '<br /><span class="label">' . rcube::Q($this->plugin->gettext('notifymessage')) . '</span><br />' . '<textarea name="_action_notifymessage[' . $id . ']" id="action_notifymessage' . $id . '" ' . 'rows="3" cols="35" ' . $this->error_class($id, 'action', 'message', 'action_notifymessage') . '>' . rcube::Q($action['message'], 'strict', false) . "</textarea>\n";
     if (in_array('enotify', $this->exts)) {
         $out .= '<br /><span class="label">' . rcube::Q($this->plugin->gettext('notifyfrom')) . '</span><br />' . '<input type="text" name="_action_notifyfrom[' . $id . ']" id="action_notifyfrom' . $id . '" ' . 'value="' . rcube::Q($action['from']) . '" size="35" ' . $this->error_class($id, 'action', 'from', 'action_notifyfrom') . ' />';
     }
     $out .= '<br /><span class="label">' . rcube::Q($this->plugin->gettext('notifyimportance')) . '</span><br />';
     $out .= $select_importance->show($action['importance'] ? (int) $action['importance'] : 2);
     $out .= '<div id="action_notifyoption_div' . $id . '">' . '<span class="label">' . rcube::Q($this->plugin->gettext('notifyoptions')) . '</span><br />' . $this->list_input($id, 'action_notifyoption', (array) $action['options'], true, $this->error_class($id, 'action', 'options', 'action_notifyoption'), 30) . '</div>';
     $out .= '</div>';
     // mailbox select
     if ($action['type'] == 'fileinto') {
         $mailbox = $this->mod_mailbox($action['target'], 'out');
     } else {
         $mailbox = '';
     }
     $select = $this->rc->folder_selector(array('realnames' => false, 'maxlength' => 100, 'id' => 'action_mailbox' . $id, 'name' => "_action_mailbox[{$id}]", 'style' => 'display:' . (empty($action['type']) || $action['type'] == 'fileinto' ? 'inline' : 'none')));
     $out .= $select->show($mailbox);
     $out .= '</td>';
     // add/del buttons
     $out .= '<td class="rowbuttons">';
     $out .= '<a href="#" id="actionadd' . $id . '" title="' . rcube::Q($this->plugin->gettext('add')) . '"
         onclick="rcmail.managesieve_actionadd(' . $id . ')" class="button add"></a>';
     $out .= '<a href="#" id="actiondel' . $id . '" title="' . rcube::Q($this->plugin->gettext('del')) . '"
         onclick="rcmail.managesieve_actiondel(' . $id . ')" class="button del' . ($rows_num < 2 ? ' disabled' : '') . '"></a>';
     $out .= '</td>';
     $out .= '</tr></table>';
     $out .= $div ? "</div>\n" : '';
     return $out;
 }
Exemplo n.º 11
0
 /**
  * Add UI element to copy event invitations or updates to the calendar
  */
 public function mail_messagebody_html($p)
 {
     // load iCalendar functions (if necessary)
     if (!empty($this->ics_parts)) {
         $this->get_ical();
     }
     $html = '';
     foreach ($this->ics_parts as $mime_id) {
         $part = $this->message->mime_parts[$mime_id];
         $charset = $part->ctype_parameters['charset'] ? $part->ctype_parameters['charset'] : RCMAIL_CHARSET;
         $events = $this->ical->import($this->message->get_part_content($mime_id), $charset);
         $title = $this->gettext('title');
         $date = rcube_utils::anytodatetime($this->message->headers->date);
         // successfully parsed events?
         if (empty($events)) {
             continue;
         }
         // show a box for every event in the file
         foreach ($events as $idx => $event) {
             // Begin mod by Rosali (Google sends the ics inline and attached -> avoid duplicates with same UID - https://issues.kolab.org/show_bug.cgi?id=3585)
             $uid = $event['uid'] ? $event['uid'] : md5(serialize($event));
             if (isset($this->ics_parts_filtered[$uid])) {
                 continue;
             }
             $this->ics_parts_filtered[$uid] = 1;
             // End mod by Rosali
             if ($event['_type'] != 'event' && $event['_type'] != 'task') {
                 // skip non-event objects (#2928) // Mod by Rosali (don't skip tasks)
                 continue;
             }
             // define buttons according to method
             if ($this->ical->method == 'REPLY') {
                 $driver = $this->get_default_driver();
                 $existing = $driver->get_event($event['uid']);
                 $calendar_saveto = new html_hiddenfield(array('class' => 'calendar-saveto', 'value' => $existing['calendar']));
                 // Mod by Rosali (always pass calendar to GUI)
                 if ($calendar_saveto) {
                     $title = $this->gettext('itipreply');
                     $buttons = html::tag('input', array('type' => 'button', 'class' => 'button', 'onclick' => "rcube_calendar.add_event_from_mail('" . JQ($mime_id . ':' . $idx) . "', this)", 'value' => $this->gettext('updateattendeestatus'))) . $calendar_saveto->show();
                 }
             } else {
                 if ($this->ical->method == 'REQUEST') {
                     $emails = $this->get_user_emails();
                     $title = $event['sequence'] > 0 ? $this->gettext('itipupdate') : $this->gettext('itipinvitation');
                     // add (hidden) buttons and activate them from asyncronous request
                     foreach (array('accepted', 'tentative', 'declined') as $method) {
                         $rsvp_buttons .= html::tag('input', array('type' => 'button', 'class' => "button {$method}", 'onclick' => "rcube_calendar.add_event_from_mail('" . JQ($mime_id . ':' . $idx) . "', this, '{$method}')", 'value' => $this->gettext('itip' . $method)));
                     }
                     $import_button = html::tag('input', array('type' => 'button', 'class' => 'button', 'onclick' => "rcube_calendar.add_event_from_mail('" . JQ($mime_id . ':' . $idx) . "', this)", 'value' => $this->gettext('importtocalendar')));
                     // check my status
                     $status = 'unknown';
                     foreach ($event['attendees'] as $attendee) {
                         if ($attendee['email'] && in_array(strtolower($attendee['email']), $emails)) {
                             $status = !empty($attendee['status']) ? strtoupper($attendee['status']) : 'NEEDS-ACTION';
                             break;
                         }
                     }
                     $dom_id = asciiwords($event['uid'], true);
                     $buttons = html::div(array('id' => 'rsvp-' . $dom_id, 'style' => 'display:none'), $rsvp_buttons);
                     $buttons .= html::div(array('id' => 'import-' . $dom_id, 'style' => 'display:none'), $import_button);
                     $buttons_pre = html::div(array('id' => 'loading-' . $dom_id, 'class' => 'rsvp-status loading'), $this->gettext('loading'));
                     $changed = is_object($event['changed']) ? $event['changed'] : $date;
                     $script = json_serialize(array('uid' => $event['uid'], 'changed' => $changed ? $changed->format('U') : 0, 'sequence' => intval($event['sequence']), 'fallback' => $status));
                     $this->rc->output->add_script("rcube_calendar.fetch_event_rsvp_status({$script})", 'docready');
                 } else {
                     if ($this->ical->method == 'CANCEL') {
                         $title = $this->gettext('itipcancellation');
                         // create buttons to be activated from async request checking existence of this event in local calendars
                         $button_import = html::tag('input', array('type' => 'button', 'class' => 'button', 'onclick' => "rcube_calendar.add_event_from_mail('" . JQ($mime_id . ':' . $idx) . "', this)", 'value' => $this->gettext('importtocalendar')));
                         $button_remove = html::tag('input', array('type' => 'button', 'class' => 'button', 'onclick' => "rcube_calendar.remove_event_from_mail('" . JQ($event['uid']) . "', '" . JQ($event['title']) . "')", 'value' => $this->gettext('removefromcalendar')));
                         $dom_id = asciiwords($event['uid'], true);
                         $buttons = html::div(array('id' => 'rsvp-' . $dom_id, 'style' => 'display:none'), $button_remove);
                         $buttons .= html::div(array('id' => 'import-' . $dom_id, 'style' => 'display:none'), $button_import);
                         $buttons_pre = html::div(array('id' => 'loading-' . $dom_id, 'class' => 'rsvp-status loading'), $this->gettext('loading'));
                         $changed = is_object($event['changed']) ? $event['changed'] : $date;
                         $script = json_serialize(array('uid' => $event['uid'], 'changed' => $changed ? $changed->format('U') : 0, 'sequence' => intval($event['sequence']), 'fallback' => 'CANCELLED'));
                         $this->rc->output->add_script("rcube_calendar.fetch_event_rsvp_status({$script})", 'docready');
                     } else {
                         // get a list of writeable calendars
                         // Begin mod by Rosali (https://gitlab.awesome-it.de/kolab/roundcube-plugins/issues/33)
                         $driver = $this->get_default_driver();
                         $calendars = $driver->list_calendars(false, true);
                         $calendar_select = new html_select(array('name' => 'calendar', 'class' => 'calendar-saveto', 'is_escaped' => true));
                         // Mod by Rosali (calendar selector can exist multiple times - can't be referenced by ID)
                         $numcals = 0;
                         foreach ($calendars as $calendar) {
                             $driver = $this->get_driver_by_cal($calendar['calendar_id']);
                             if ($driver->readonly !== true) {
                                 $calendar_select->add($calendar['name'], $calendar['id']);
                                 $numcals++;
                             }
                         }
                     }
                 }
             }
             if ($numcals > 0) {
                 $buttons = html::tag('input', array('type' => 'button', 'class' => 'button', 'onclick' => "rcube_calendar.add_event_from_mail('" . JQ($mime_id . ':' . $idx) . "', this)", 'value' => $this->gettext('importtocalendar'))) . $calendar_select->show($this->rc->config->get('calendar_default_calendar'));
             }
             // show event details with buttons
             if ($buttons) {
                 $html .= html::div('calendar-invitebox', $this->ui->event_details_table($event, $title) . $buttons_pre . html::div('rsvp-buttons', $buttons));
             }
             // Emd mod by Rosli
             // limit listing
             if ($idx >= 3) {
                 break;
             }
         }
     }
     // prepend event boxes to message body
     if ($html) {
         $this->ui->init();
         $p['content'] = $html . $p['content'];
         $this->rc->output->add_label('calendar.savingdata', 'calendar.deleteventconfirm', 'calendar.declinedeleteconfirm');
     }
     return $p;
 }
Exemplo n.º 12
0
 /**
  * Return folders list as html_select object
  *
  * @param array $p  Named parameters
  *
  * @return html_select HTML drop-down object
  */
 public function folder_selector($p = array())
 {
     $p += array('maxlength' => 100, 'realnames' => false, 'is_escaped' => true);
     $a_mailboxes = array();
     $storage = $this->get_storage();
     if (empty($p['folder_name'])) {
         $p['folder_name'] = '*';
     }
     if ($p['unsubscribed']) {
         $list = $storage->list_folders('', $p['folder_name'], $p['folder_filter'], $p['folder_rights']);
     } else {
         $list = $storage->list_folders_subscribed('', $p['folder_name'], $p['folder_filter'], $p['folder_rights']);
     }
     $delimiter = $storage->get_hierarchy_delimiter();
     foreach ($list as $folder) {
         if (empty($p['exceptions']) || !in_array($folder, $p['exceptions'])) {
             $this->build_folder_tree($a_mailboxes, $folder, $delimiter);
         }
     }
     $select = new html_select($p);
     if ($p['noselection']) {
         $select->add(html::quote($p['noselection']), '');
     }
     $this->render_folder_tree_select($a_mailboxes, $mbox, $p['maxlength'], $select, $p['realnames'], 0, $p);
     return $select;
 }
Exemplo n.º 13
0
 function action_div($fid, $id, $div = true)
 {
     $action = isset($this->form) ? $this->form['actions'][$id] : $this->script[$fid]['actions'][$id];
     $rows_num = isset($this->form) ? sizeof($this->form['actions']) : sizeof($this->script[$fid]['actions']);
     $out = $div ? '<div class="actionrow" id="actionrow' . $id . '">' . "\n" : '';
     $out .= '<table><tr><td class="rowactions">';
     // action select
     $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');
     }
     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');
     if (in_array('copy', $this->exts)) {
         $select_action->add(Q($this->gettext('messagesendcopy')), 'redirect_copy');
     }
     if (in_array('reject', $this->exts)) {
         $select_action->add(Q($this->gettext('messagediscard')), 'reject');
     } else {
         if (in_array('ereject', $this->exts)) {
             $select_action->add(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');
     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(Q($this->gettext('rulestop')), 'stop');
     $select_type = $action['type'];
     if (in_array($action['type'], array('fileinto', 'redirect')) && $action['copy']) {
         $select_type .= '_copy';
     }
     $out .= $select_action->show($select_type);
     $out .= '</td>';
     // actions target inputs
     $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" ' . '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) : '') . "</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 />' . '<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 />' . '<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" ' . $this->error_class($id, 'action', 'subject', 'action_subject') . ' />';
     $out .= '<br /><span class="label">' . 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" ' . $this->error_class($id, 'action', 'addresses', 'action_addr') . ' />';
     $out .= '<br /><span class="label">' . 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" ' . $this->error_class($id, 'action', 'days', 'action_days') . ' />';
     $out .= '</div>';
     // flags
     $flags = array('read' => '\\Seen', 'answered' => '\\Answered', 'flagged' => '\\Flagged', 'deleted' => '\\Deleted', 'draft' => '\\Draft');
     $flags_target = (array) $action['target'];
     $out .= '<div id="action_flags' . $id . '" style="display:' . (preg_match('/^(set|add|remove)flag$/', $action['type']) ? 'inline' : 'none') . '"' . $this->error_class($id, 'action', 'flags', 'action_flags') . '>';
     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>';
     }
     $out .= '</div>';
     // mailbox select
     if ($action['type'] == 'fileinto') {
         $mailbox = $this->mod_mailbox($action['target'], 'out');
     } else {
         $mailbox = '';
     }
     $select = rcmail_mailbox_select(array('realnames' => false, 'maxlength' => 100, 'id' => 'action_mailbox' . $id, 'name' => "_action_mailbox[{$id}]", 'style' => 'display:' . (!isset($action) || $action['type'] == 'fileinto' ? 'inline' : 'none')));
     $out .= $select->show($mailbox);
     $out .= '</td>';
     // add/del buttons
     $out .= '<td class="rowbuttons">';
     $out .= '<a href="#" id="actionadd' . $id . '" title="' . Q($this->gettext('add')) . '"
         onclick="rcmail.managesieve_actionadd(' . $id . ')" class="button add"></a>';
     $out .= '<a href="#" id="actiondel' . $id . '" title="' . Q($this->gettext('del')) . '"
         onclick="rcmail.managesieve_actiondel(' . $id . ')" class="button del' . ($rows_num < 2 ? ' disabled' : '') . '"></a>';
     $out .= '</td>';
     $out .= '</tr></table>';
     $out .= $div ? "</div>\n" : '';
     return $out;
 }
Exemplo n.º 14
0
?>
</td>
  </tr>
</tbody>
</table>

<p><input type="submit" name="sendmail" value="Send test mail" /></p>


<h3>Test IMAP config</h3>

<?php 
$default_hosts = $RCI->get_hostlist();
if (!empty($default_hosts)) {
    $host_field = new html_select(array('name' => '_host', 'id' => 'imaphost'));
    $host_field->add($default_hosts);
} else {
    $host_field = new html_inputfield(array('name' => '_host', 'id' => 'imaphost'));
}
$user_field = new html_inputfield(array('name' => '_user', 'id' => 'imapuser'));
$pass_field = new html_passwordfield(array('name' => '_pass', 'id' => 'imappass'));
?>

<table>
<tbody>
  <tr>
    <td><label for="imaphost">Server</label></td>
    <td><?php 
echo $host_field->show($_POST['_host']);
?>
</td>
Exemplo n.º 15
0
 private function _prefs_block($part, $attrib)
 {
     $rcmail = rcube::get_instance();
     $no_override = array_flip($rcmail->config->get('sauserprefs_dont_override'));
     $locale_info = localeconv();
     switch ($part) {
         // General tests
         case 'general':
             $out = '';
             $data = '';
             $table = new html_table(array('class' => 'generalprefstable', 'cols' => 2));
             if (!isset($no_override['required_hits'])) {
                 $field_id = 'rcmfd_spamthres';
                 $input_spamthres = new html_select(array('name' => '_spamthres', 'id' => $field_id));
                 $input_spamthres->add($this->gettext('defaultscore'), '');
                 $decPlaces = 0;
                 if ($rcmail->config->get('sauserprefs_score_inc') - (int) $rcmail->config->get('sauserprefs_score_inc') > 0) {
                     $decPlaces = strlen($rcmail->config->get('sauserprefs_score_inc') - (int) $rcmail->config->get('sauserprefs_score_inc')) - 2;
                 }
                 $score_found = false;
                 for ($i = 1; $i <= 10; $i = $i + $rcmail->config->get('sauserprefs_score_inc')) {
                     $input_spamthres->add(number_format($i, $decPlaces, $locale_info['decimal_point'], ''), number_format($i, $decPlaces, '.', ''));
                     if (!$score_found && $this->user_prefs['required_hits'] && (double) $this->user_prefs['required_hits'] == (double) $i) {
                         $score_found = true;
                     }
                 }
                 if (!$score_found && $this->user_prefs['required_hits']) {
                     $input_spamthres->add(str_replace('%s', $this->user_prefs['required_hits'], $this->gettext('otherscore')), (double) $this->user_prefs['required_hits']);
                 }
                 $table->add('title', html::label($field_id, rcmail::Q($this->gettext('spamthres'))));
                 $table->add(null, $input_spamthres->show(number_format($this->user_prefs['required_hits'], $decPlaces, '.', '')));
                 $table->add(array('colspan' => 2), rcmail::Q($this->gettext('spamthresexp')));
             }
             if (!isset($no_override['rewrite_header Subject'])) {
                 $field_id = 'rcmfd_spamsubject';
                 $input_spamsubject = new html_inputfield(array('name' => '_spamsubject', 'id' => $field_id, 'value' => $this->user_prefs['rewrite_header Subject'], 'style' => 'width:200px;'));
                 $table->add('title', html::label($field_id, rcmail::Q($this->gettext('spamsubject'))));
                 $table->add(null, $input_spamsubject->show());
                 $table->add('title', "&nbsp;");
                 $table->add(null, rcmail::Q($this->gettext('spamsubjectblank')));
             }
             if ($table->size() > 0) {
                 $out .= html::tag('fieldset', null, html::tag('legend', null, rcmail::Q($this->gettext('mainoptions'))) . $table->show());
             }
             if (!isset($no_override['ok_languages']) || !isset($no_override['ok_locales'])) {
                 $data = html::p(null, rcmail::Q($this->gettext('spamlangexp')));
                 $table = new html_table(array('class' => 'langprefstable', 'cols' => 1));
                 $select_all = $this->api->output->button(array('command' => 'plugin.sauserprefs.select_all_langs', 'type' => 'link', 'label' => 'all'));
                 $select_none = $this->api->output->button(array('command' => 'plugin.sauserprefs.select_no_langs', 'type' => 'link', 'label' => 'none'));
                 $select_invert = $this->api->output->button(array('command' => 'plugin.sauserprefs.select_invert_langs', 'type' => 'link', 'label' => 'invert'));
                 $table->add(array('id' => 'listcontrols'), $this->gettext('select') . ":&nbsp;&nbsp;" . $select_all . "&nbsp;&nbsp;" . $select_invert . "&nbsp;&nbsp;" . $select_none);
                 $lang_table = new html_table(array('id' => 'spam-langs-table', 'class' => 'records-table', 'cellspacing' => '0', 'cols' => 2));
                 $lang_table->add_header(array('colspan' => 2), $this->gettext('language'));
                 if (!isset($no_override['ok_locales'])) {
                     if ($this->user_prefs['ok_locales'] == "all") {
                         $ok_locales = $this->sa_locales;
                     } else {
                         $ok_locales = explode(" ", $this->user_prefs['ok_locales']);
                     }
                 } else {
                     $ok_locales = array();
                 }
                 if (!isset($no_override['ok_languages'])) {
                     if ($this->user_prefs['ok_languages'] == "all") {
                         $ok_languages = array_keys($rcmail->config->get('sauserprefs_languages'));
                     } else {
                         $ok_languages = explode(" ", $this->user_prefs['ok_languages']);
                     }
                 } else {
                     $tmp_array = $rcmail->config->get('sauserprefs_languages');
                     $rcmail->config->set('sauserprefs_languages', array_intersect_key($tmp_array, array_flip($this->sa_locales)));
                     $ok_languages = array();
                 }
                 $i = 0;
                 $locales_langs = array_merge($ok_locales, $ok_languages);
                 foreach ($rcmail->config->get('sauserprefs_languages') as $lang_code => $name) {
                     if (in_array($lang_code, $locales_langs)) {
                         $button = $this->api->output->button(array('command' => 'plugin.sauserprefs.message_lang', 'prop' => $lang_code, 'type' => 'link', 'class' => 'enabled', 'id' => 'spam_lang_' . $i, 'title' => 'sauserprefs.enabled', 'content' => ' '));
                     } else {
                         $button = $this->api->output->button(array('command' => 'plugin.sauserprefs.message_lang', 'prop' => $lang_code, 'type' => 'link', 'class' => 'disabled', 'id' => 'spam_lang_' . $i, 'title' => 'sauserprefs.disabled', 'content' => ' '));
                     }
                     $input_spamlang = new html_checkbox(array('style' => 'display: none;', 'name' => '_spamlang[]', 'value' => $lang_code));
                     $lang_table->add('lang', $name);
                     $lang_table->add('tick', $button . $input_spamlang->show(in_array($lang_code, $locales_langs) ? $lang_code : ''));
                     $i++;
                 }
                 $table->add('scroller', html::div(array('id' => 'spam-langs-cont'), $lang_table->show()));
                 $out .= html::tag('fieldset', null, html::tag('legend', null, rcmail::Q($this->gettext('langoptions'))) . $data . $table->show());
             }
             break;
             // Header settings
         // Header settings
         case 'headers':
             $data = html::p(null, rcmail::Q($this->gettext('headersexp')));
             $table = new html_table(array('class' => 'headersprefstable', 'cols' => 3));
             if (!isset($no_override['fold_headers'])) {
                 $help_button = html::img(array('class' => $imgclass, 'src' => $attrib['helpicon'], 'alt' => $this->gettext('sieveruleheaders'), 'border' => 0, 'style' => 'margin-left: 4px;'));
                 $help_button = html::a(array('name' => '_headerhlp', 'href' => "#", 'onclick' => 'return ' . rcmail_output::JS_OBJECT_NAME . '.sauserprefs_help("fold_help");', 'title' => $this->gettext('help')), $help_button);
                 $field_id = 'rcmfd_spamfoldheaders';
                 $input_spamreport = new html_checkbox(array('name' => '_spamfoldheaders', 'id' => $field_id, 'value' => '1'));
                 $table->add('title', html::label($field_id, rcmail::Q($this->gettext('foldheaders'))));
                 $table->add(null, $input_spamreport->show($this->user_prefs['fold_headers']));
                 $table->add('help', $help_button);
                 $table->set_row_attribs(array('id' => 'fold_help', 'style' => 'display: none;'));
                 $table->add(array('colspan' => '3'), rcmail::Q($this->gettext('foldhelp')));
             }
             if (!isset($no_override['add_header all Level'])) {
                 $help_button = html::img(array('class' => $imgclass, 'src' => $attrib['helpicon'], 'alt' => $this->gettext('sieveruleheaders'), 'border' => 0, 'style' => 'margin-left: 4px;'));
                 $help_button = html::a(array('name' => '_headerhlp', 'href' => "#", 'onclick' => 'return ' . rcmail_output::JS_OBJECT_NAME . '.sauserprefs_help("level_help");', 'title' => $this->gettext('help')), $help_button);
                 if ($this->user_prefs['remove_header all'] != 'Level') {
                     $enabled = "1";
                     $char = $this->user_prefs['add_header all Level'];
                     $char = substr($char, 7, 1);
                 } else {
                     $enabled = "0";
                     $char = "*";
                 }
                 $field_id = 'rcmfd_spamlevelstars';
                 $input_spamreport = new html_checkbox(array('name' => '_spamlevelstars', 'id' => $field_id, 'value' => '1', 'onchange' => rcmail_output::JS_OBJECT_NAME . '.sauserprefs_toggle_level_char(this)'));
                 $table->add('title', html::label($field_id, rcmail::Q($this->gettext('spamlevelstars'))));
                 $table->add(null, $input_spamreport->show($enabled));
                 $table->add('help', $help_button);
                 $table->set_row_attribs(array('id' => 'level_help', 'style' => 'display: none;'));
                 $table->add(array('colspan' => '3'), rcmail::Q($this->gettext('levelhelp')));
                 $field_id = 'rcmfd_spamlevelchar';
                 $input_spamsubject = new html_inputfield(array('name' => '_spamlevelchar', 'id' => $field_id, 'value' => $char, 'style' => 'width:20px;', 'disabled' => $enabled ? 0 : 1));
                 $table->add('title', html::label($field_id, rcmail::Q($this->gettext('spamlevelchar'))));
                 $table->add(null, $input_spamsubject->show());
                 $table->add('help', '&nbsp;');
             }
             $out = html::tag('fieldset', null, html::tag('legend', null, rcmail::Q($this->gettext('mainoptions'))) . $data . $table->show());
             break;
             // Test settings
         // Test settings
         case 'tests':
             $data = html::p(null, rcmail::Q($this->gettext('spamtestssexp')));
             $table = new html_table(array('class' => 'testsprefstable', 'cols' => 3));
             if (!isset($no_override['use_razor1'])) {
                 $help_button = html::img(array('class' => $imgclass, 'src' => $attrib['helpicon'], 'alt' => $this->gettext('sieveruleheaders'), 'border' => 0, 'style' => 'margin-left: 4px;'));
                 $help_button = html::a(array('name' => '_headerhlp', 'href' => "#", 'onclick' => 'return ' . rcmail_output::JS_OBJECT_NAME . '.sauserprefs_help("raz1_help");', 'title' => $this->gettext('help')), $help_button);
                 $field_id = 'rcmfd_spamuserazor1';
                 $input_spamtest = new html_checkbox(array('name' => '_spamuserazor1', 'id' => $field_id, 'value' => '1'));
                 $table->add('title', html::label($field_id, rcmail::Q($this->gettext('userazor1'))));
                 $table->add(null, $input_spamtest->show($this->user_prefs['use_razor1']));
                 $table->add('help', $help_button);
                 $table->set_row_attribs(array('id' => 'raz1_help', 'style' => 'display: none;'));
                 $table->add(array('colspan' => '3'), rcmail::Q($this->gettext('raz1help')));
             }
             if (!isset($no_override['use_razor2'])) {
                 $help_button = html::img(array('class' => $imgclass, 'src' => $attrib['helpicon'], 'alt' => $this->gettext('sieveruleheaders'), 'border' => 0, 'style' => 'margin-left: 4px;'));
                 $help_button = html::a(array('name' => '_headerhlp', 'href' => "#", 'onclick' => 'return ' . rcmail_output::JS_OBJECT_NAME . '.sauserprefs_help("raz2_help");', 'title' => $this->gettext('help')), $help_button);
                 $field_id = 'rcmfd_spamuserazor2';
                 $input_spamtest = new html_checkbox(array('name' => '_spamuserazor2', 'id' => $field_id, 'value' => '1'));
                 $table->add('title', html::label($field_id, rcmail::Q($this->gettext('userazor2'))));
                 $table->add(null, $input_spamtest->show($this->user_prefs['use_razor2']));
                 $table->add('help', $help_button);
                 $table->set_row_attribs(array('id' => 'raz2_help', 'style' => 'display: none;'));
                 $table->add(array('colspan' => '3'), rcmail::Q($this->gettext('raz2help')));
             }
             if (!isset($no_override['use_pyzor'])) {
                 $help_button = html::img(array('class' => $imgclass, 'src' => $attrib['helpicon'], 'alt' => $this->gettext('sieveruleheaders'), 'border' => 0, 'style' => 'margin-left: 4px;'));
                 $help_button = html::a(array('name' => '_headerhlp', 'href' => "#", 'onclick' => 'return ' . rcmail_output::JS_OBJECT_NAME . '.sauserprefs_help("pyz_help");', 'title' => $this->gettext('help')), $help_button);
                 $field_id = 'rcmfd_spamusepyzor';
                 $input_spamtest = new html_checkbox(array('name' => '_spamusepyzor', 'id' => $field_id, 'value' => '1'));
                 $table->add('title', html::label($field_id, rcmail::Q($this->gettext('usepyzor'))));
                 $table->add(null, $input_spamtest->show($this->user_prefs['use_pyzor']));
                 $table->add('help', $help_button);
                 $table->set_row_attribs(array('id' => 'pyz_help', 'style' => 'display: none;'));
                 $table->add(array('colspan' => '3'), rcmail::Q($this->gettext('pyzhelp')));
             }
             if (!isset($no_override['use_dcc'])) {
                 $help_button = html::img(array('class' => $imgclass, 'src' => $attrib['helpicon'], 'alt' => $this->gettext('sieveruleheaders'), 'border' => 0, 'style' => 'margin-left: 4px;'));
                 $help_button = html::a(array('name' => '_headerhlp', 'href' => "#", 'onclick' => 'return ' . rcmail_output::JS_OBJECT_NAME . '.sauserprefs_help("dcc_help");', 'title' => $this->gettext('help')), $help_button);
                 $field_id = 'rcmfd_spamusedcc';
                 $input_spamtest = new html_checkbox(array('name' => '_spamusedcc', 'id' => $field_id, 'value' => '1'));
                 $table->add('title', html::label($field_id, rcmail::Q($this->gettext('usedcc'))));
                 $table->add(null, $input_spamtest->show($this->user_prefs['use_dcc']));
                 $table->add('help', $help_button);
                 $table->set_row_attribs(array('id' => 'dcc_help', 'style' => 'display: none;'));
                 $table->add(array('colspan' => '3'), rcmail::Q($this->gettext('dcchelp')));
             }
             if (!isset($no_override['skip_rbl_checks'])) {
                 $help_button = html::img(array('class' => $imgclass, 'src' => $attrib['helpicon'], 'alt' => $this->gettext('sieveruleheaders'), 'border' => 0, 'style' => 'margin-left: 4px;'));
                 $help_button = html::a(array('name' => '_headerhlp', 'href' => "#", 'onclick' => 'return ' . rcmail_output::JS_OBJECT_NAME . '.sauserprefs_help("rbl_help");', 'title' => $this->gettext('help')), $help_button);
                 $field_id = 'rcmfd_spamskiprblchecks';
                 $enabled = $this->user_prefs['skip_rbl_checks'] == "1" ? "0" : "1";
                 $input_spamtest = new html_checkbox(array('name' => '_spamskiprblchecks', 'id' => $field_id, 'value' => '1'));
                 $table->add('title', html::label($field_id, rcmail::Q($this->gettext('skiprblchecks'))));
                 $table->add(null, $input_spamtest->show($enabled));
                 $table->add('help', $help_button);
                 $table->set_row_attribs(array('id' => 'rbl_help', 'style' => 'display: none;'));
                 $table->add(array('colspan' => '3'), rcmail::Q($this->gettext('rblhelp')));
             }
             $out = html::tag('fieldset', null, html::tag('legend', null, rcmail::Q($this->gettext('mainoptions'))) . $data . $table->show());
             break;
             // Bayes settings
         // Bayes settings
         case 'bayes':
             $data = html::p(null, rcmail::Q($this->gettext('bayeshelp')));
             $table = new html_table(array('class' => 'bayesprefstable', 'cols' => 3));
             if (!isset($no_override['use_bayes'])) {
                 $help_button = html::img(array('class' => $imgclass, 'src' => $attrib['helpicon'], 'alt' => $this->gettext('sieveruleheaders'), 'border' => 0, 'style' => 'margin-left: 4px;'));
                 $help_button = html::a(array('name' => '_headerhlp', 'href' => "#", 'onclick' => 'return ' . rcmail_output::JS_OBJECT_NAME . '.sauserprefs_help("bayes_help");', 'title' => $this->gettext('help')), $help_button);
                 $field_id = 'rcmfd_spamusebayes';
                 $input_spamtest = new html_checkbox(array('name' => '_spamusebayes', 'id' => $field_id, 'value' => '1', 'onchange' => rcmail_output::JS_OBJECT_NAME . '.sauserprefs_toggle_bayes(this)'));
                 if ($rcmail->config->get('sauserprefs_bayes_delete', false)) {
                     $delete_link = "&nbsp;&nbsp;&nbsp;" . html::span(array('id' => 'listcontrols'), $this->api->output->button(array('command' => 'plugin.sauserprefs.purge_bayes', 'type' => 'link', 'label' => 'sauserprefs.purgebayes', 'title' => 'sauserprefs.purgebayesexp')));
                 }
                 $table->add('title', html::label($field_id, rcmail::Q($this->gettext('usebayes'))));
                 $table->add(null, $input_spamtest->show($this->user_prefs['use_bayes']) . $delete_link);
                 $table->add('help', '&nbsp;');
                 $table->set_row_attribs(array('id' => 'bayes_help', 'style' => 'display: none;'));
                 $table->add(array('colspan' => '3'), rcmail::Q($this->gettext('bayeshelp')));
             }
             if (!isset($no_override['use_bayes_rules'])) {
                 $help_button = html::img(array('class' => $imgclass, 'src' => $attrib['helpicon'], 'alt' => $this->gettext('sieveruleheaders'), 'border' => 0, 'style' => 'margin-left: 4px;'));
                 $help_button = html::a(array('name' => '_headerhlp', 'href' => "#", 'onclick' => 'return ' . rcmail_output::JS_OBJECT_NAME . '.sauserprefs_help("bayesrules_help");', 'title' => $this->gettext('help')), $help_button);
                 $field_id = 'rcmfd_spambayesrules';
                 $input_spamtest = new html_checkbox(array('name' => '_spambayesrules', 'id' => $field_id, 'value' => '1', 'disabled' => $this->user_prefs['use_bayes'] ? 0 : 1));
                 $table->add('title', html::label($field_id, rcmail::Q($this->gettext('bayesrules'))));
                 $table->add(null, $input_spamtest->show($this->user_prefs['use_bayes_rules']));
                 $table->add('help', $help_button);
                 $table->set_row_attribs(array('id' => 'bayesrules_help', 'style' => 'display: none;'));
                 $table->add(array('colspan' => '3'), rcmail::Q($this->gettext('bayesruleshlp')));
             }
             if (!isset($no_override['bayes_auto_learn'])) {
                 $help_button = html::img(array('class' => $imgclass, 'src' => $attrib['helpicon'], 'alt' => $this->gettext('sieveruleheaders'), 'border' => 0, 'style' => 'margin-left: 4px;'));
                 $help_button = html::a(array('name' => '_headerhlp', 'href' => "#", 'onclick' => 'return ' . rcmail_output::JS_OBJECT_NAME . '.sauserprefs_help("bayesauto_help");', 'title' => $this->gettext('help')), $help_button);
                 $field_id = 'rcmfd_spambayesautolearn';
                 $input_spamtest = new html_checkbox(array('name' => '_spambayesautolearn', 'id' => $field_id, 'value' => '1', 'onchange' => rcmail_output::JS_OBJECT_NAME . '.sauserprefs_toggle_bayes_auto(this)', 'disabled' => $this->user_prefs['use_bayes'] ? 0 : 1));
                 $table->add('title', html::label($field_id, rcmail::Q($this->gettext('bayesautolearn'))));
                 $table->add(null, $input_spamtest->show($this->user_prefs['bayes_auto_learn']));
                 $table->add('help', $help_button);
                 $table->set_row_attribs(array('id' => 'bayesauto_help', 'style' => 'display: none;'));
                 $table->add(array('colspan' => '3'), rcmail::Q($this->gettext('bayesautohelp')));
             }
             if ($table->size() > 0) {
                 $out = html::tag('fieldset', null, html::tag('legend', null, rcmail::Q($this->gettext('mainoptions'))) . $table->show());
             }
             $table = new html_table(array('class' => 'bayesprefstable', 'cols' => 2));
             $data = "";
             if (!isset($no_override['bayes_auto_learn_threshold_nonspam'])) {
                 $field_id = 'rcmfd_bayesnonspam';
                 $input_bayesnthres = new html_select(array('name' => '_bayesnonspam', 'id' => $field_id, 'disabled' => !$this->user_prefs['bayes_auto_learn'] || !$this->user_prefs['use_bayes'] ? 1 : 0));
                 $input_bayesnthres->add($this->gettext('defaultscore'), '');
                 $decPlaces = 1;
                 //if ($rcmail->config->get('sauserprefs_score_inc') - (int)$rcmail->config->get('sauserprefs_score_inc') > 0)
                 //	$decPlaces = strlen($rcmail->config->get('sauserprefs_score_inc') - (int)$rcmail->config->get('sauserprefs_score_inc')) - 2;
                 $score_found = false;
                 for ($i = -1; $i <= 1; $i = $i + 0.1) {
                     $input_bayesnthres->add(number_format($i, $decPlaces, $locale_info['decimal_point'], ''), number_format($i, $decPlaces, '.', ''));
                     if (!$score_found && $this->user_prefs['bayes_auto_learn_threshold_nonspam'] && (double) $this->user_prefs['bayes_auto_learn_threshold_nonspam'] == (double) $i) {
                         $score_found = true;
                     }
                 }
                 if (!$score_found && $this->user_prefs['bayes_auto_learn_threshold_nonspam']) {
                     $input_bayesnthres->add(str_replace('%s', $this->user_prefs['bayes_auto_learn_threshold_nonspam'], $this->gettext('otherscore')), (double) $this->user_prefs['bayes_auto_learn_threshold_nonspam']);
                 }
                 $table->add('title', html::label($field_id, rcmail::Q($this->gettext('bayesnonspam'))));
                 $table->add(null, $input_bayesnthres->show(number_format($this->user_prefs['bayes_auto_learn_threshold_nonspam'], $decPlaces, '.', '')));
                 $table->add(array('colspan' => '2'), rcmail::Q($this->gettext('bayesnonspamexp')));
             }
             if (!isset($no_override['bayes_auto_learn_threshold_spam'])) {
                 $field_id = 'rcmfd_bayesspam';
                 $input_bayesthres = new html_select(array('name' => '_bayesspam', 'id' => $field_id, 'disabled' => !$this->user_prefs['bayes_auto_learn'] || !$this->user_prefs['use_bayes'] ? 1 : 0));
                 $input_bayesthres->add($this->gettext('defaultscore'), '');
                 $decPlaces = 0;
                 if ($rcmail->config->get('sauserprefs_score_inc') - (int) $rcmail->config->get('sauserprefs_score_inc') > 0) {
                     $decPlaces = strlen($rcmail->config->get('sauserprefs_score_inc') - (int) $rcmail->config->get('sauserprefs_score_inc')) - 2;
                 }
                 $score_found = false;
                 for ($i = 1; $i <= 20; $i = $i + $rcmail->config->get('sauserprefs_score_inc')) {
                     $input_bayesthres->add(number_format($i, $decPlaces, $locale_info['decimal_point'], ''), number_format($i, $decPlaces, '.', ''));
                     if (!$score_found && $this->user_prefs['bayes_auto_learn_threshold_spam'] && (double) $this->user_prefs['bayes_auto_learn_threshold_spam'] == (double) $i) {
                         $score_found = true;
                     }
                 }
                 if (!$score_found && $this->user_prefs['required_hits']) {
                     $input_bayesthres->add(str_replace('%s', $this->user_prefs['bayes_auto_learn_threshold_spam'], $this->gettext('otherscore')), (double) $this->user_prefs['bayes_auto_learn_threshold_spam']);
                 }
                 $table->add('title', html::label($field_id, rcmail::Q($this->gettext('bayesspam'))));
                 $table->add(null, $input_bayesthres->show(number_format($this->user_prefs['bayes_auto_learn_threshold_spam'], $decPlaces, '.', '')));
                 $table->add(array('colspan' => '2'), rcmail::Q($this->gettext('bayesspamexp')));
             }
             if ($table->size() > 0) {
                 $out .= html::tag('fieldset', null, html::tag('legend', null, rcmail::Q($this->gettext('bayesautooptions'))) . $table->show());
             }
             break;
             // Report settings
         // Report settings
         case 'report':
             $data = html::p(null, rcmail::Q($this->gettext('spamreport')));
             $table = new html_table(array('class' => 'reportprefstable', 'cols' => 2));
             if (!isset($no_override['report_safe'])) {
                 $field_id = 'rcmfd_spamreport';
                 $input_spamreport0 = new html_radiobutton(array('name' => '_spamreport', 'id' => $field_id . '_0', 'value' => '0'));
                 $table->add('title', html::label($field_id . '_0', rcmail::Q($this->gettext('spamreport0'))));
                 $table->add(null, $input_spamreport0->show($this->user_prefs['report_safe']));
                 $input_spamreport1 = new html_radiobutton(array('name' => '_spamreport', 'id' => $field_id . '_1', 'value' => '1'));
                 $table->add('title', html::label($field_id . '_1', rcmail::Q($this->gettext('spamreport1'))));
                 $table->add(null, $input_spamreport1->show($this->user_prefs['report_safe']));
                 $data .= $input_spamreport1->show($this->user_prefs['report_safe']) . "&nbsp;" . html::label($field_id . '_1', rcmail::Q($this->gettext('spamreport1'))) . "<br />";
                 $input_spamreport2 = new html_radiobutton(array('name' => '_spamreport', 'id' => $field_id . '_2', 'value' => '2'));
                 $table->add('title', html::label($field_id . '_2', rcmail::Q($this->gettext('spamreport2'))));
                 $table->add(null, $input_spamreport2->show($this->user_prefs['report_safe']));
             }
             $out = html::tag('fieldset', null, html::tag('legend', null, rcmail::Q($this->gettext('mainoptions'))) . $table->show());
             break;
             // Address settings
         // Address settings
         case 'addresses':
             $data = html::p(null, rcmail::Q($this->gettext('whitelistexp')));
             if ($rcmail->config->get('sauserprefs_whitelist_sync')) {
                 $data .= rcmail::Q($this->gettext('autowhitelist')) . "<br /><br />";
             }
             $table = new html_table(array('class' => 'addressprefstable', 'cols' => 4));
             $field_id = 'rcmfd_spamaddressrule';
             $input_spamaddressrule = new html_select(array('name' => '_spamaddressrule', 'id' => $field_id));
             $input_spamaddressrule->add($this->gettext('whitelist_from'), 'whitelist_from');
             $input_spamaddressrule->add($this->gettext('blacklist_from'), 'blacklist_from');
             $input_spamaddressrule->add($this->gettext('whitelist_to'), 'whitelist_to');
             $field_id = 'rcmfd_spamaddress';
             $input_spamaddress = new html_inputfield(array('name' => '_spamaddress', 'id' => $field_id, 'style' => 'width:200px;'));
             $field_id = 'rcmbtn_add_address';
             $button_addaddress = $this->api->output->button(array('command' => 'plugin.sauserprefs.addressrule_add', 'type' => 'input', 'class' => 'button', 'label' => 'sauserprefs.addrule'));
             $table->add('ruletype', $input_spamaddressrule->show());
             $table->add('address', $input_spamaddress->show());
             $table->add('action', $button_addaddress);
             $table->add(null, "&nbsp;");
             $import = $this->api->output->button(array('command' => 'plugin.sauserprefs.import_whitelist', 'type' => 'link', 'label' => 'import', 'title' => 'sauserprefs.importfromaddressbook'));
             $delete_all = $this->api->output->button(array('command' => 'plugin.sauserprefs.whitelist_delete_all', 'type' => 'link', 'label' => 'sauserprefs.deleteall'));
             $table->add(array('colspan' => 4, 'id' => 'listcontrols'), $import . "&nbsp;&nbsp;" . $delete_all);
             $address_table = new html_table(array('id' => 'address-rules-table', 'class' => 'records-table', 'cellspacing' => '0', 'cols' => 3));
             $address_table->add_header('rule', $this->gettext('rule'));
             $address_table->add_header('email', $this->gettext('email'));
             $address_table->add_header('control', '&nbsp;');
             $this->_address_row($address_table, null, null, $attrib);
             if (sizeof($this->user_prefs['addresses']) > 0) {
                 $norules = 'display: none;';
             }
             $address_table->set_row_attribs(array('style' => $norules));
             $address_table->add(array('colspan' => '3'), rcube_utils::rep_specialchars_output($this->gettext('noaddressrules')));
             $this->api->output->set_env('address_rule_count', sizeof($this->user_prefs['addresses']));
             foreach ($this->user_prefs['addresses'] as $address) {
                 $this->_address_row($address_table, $address['field'], $address['value'], $attrib);
             }
             $table->add(array('colspan' => 4, 'class' => 'scroller'), html::div(array('id' => 'address-rules-cont'), $address_table->show()));
             if ($table->size()) {
                 $out = html::tag('fieldset', null, html::tag('legend', null, rcmail::Q($this->gettext('mainoptions'))) . $data . $table->show());
             }
             break;
         default:
             $out = '';
     }
     return $out;
 }
Exemplo n.º 16
0
 /**
  * Render a HTML select box for list selection
  */
 function tasklist_select($attrib = array())
 {
     $attrib['name'] = 'list';
     $attrib['is_escaped'] = true;
     $select = new html_select($attrib);
     foreach ((array) $this->plugin->driver->get_lists() as $id => $prop) {
         if ($prop['editable']) {
             $select->add($prop['name'], $id);
         }
     }
     return $select->show(null);
 }
Exemplo n.º 17
0
 function gen_form()
 {
     $id = get_input_value('_id', RCUBE_INPUT_GET);
     $this->rcmail_inst->output->add_label('ispconfig3_wblist.wblistdelconfirm');
     if ($id != '' || $id != 0) {
         try {
             $session_id = $this->soap->login($this->rcmail_inst->config->get('remote_soap_user'), $this->rcmail_inst->config->get('remote_soap_pass'));
             $mail_user = $this->soap->mail_user_get($session_id, array('login' => $this->rcmail_inst->user->data['username']));
             $spam_user = $this->soap->mail_spamfilter_user_get($session_id, array('email' => $mail_user[0]['email']));
             if (get_input_value('_type', RCUBE_INPUT_GET) == "W") {
                 $wblist = $this->soap->mail_spamfilter_whitelist_get($session_id, array('wblist_id' => $id));
                 $type = "W";
             } else {
                 $wblist = $this->soap->mail_spamfilter_blacklist_get($session_id, array('wblist_id' => $id));
                 $type = "B";
             }
             $this->soap->logout($session_id);
         } catch (SoapFault $e) {
             $this->rcmail_inst->output->command('display_message', 'Soap Error: ' . $e->getMessage(), 'error');
         }
         $enabled = $wblist[0]['active'];
         if ($wblist[0]['rid'] != $spam_user[0]['id']) {
             $this->rcmail_inst->output->command('display_message', 'Error: ' . $this->gettext('opnotpermitted'), 'error');
             $enabled = 'n';
             $wblist[0]['email'] = '';
             $wblist[0]['priority'] = '';
         }
     } else {
         $wblist[0]['priority'] = '5';
     }
     if ($enabled == 'y') {
         $enabled = 1;
     } else {
         $enabled = 0;
     }
     $this->rcmail_inst->output->set_env('framed', TRUE);
     $out .= '<fieldset><legend>' . $this->gettext('acc_wblist') . '</legend>' . "\n";
     $hidden_id = new html_hiddenfield(array('name' => '_id', 'value' => $wblist[0]['wblist_id']));
     $out .= $hidden_id->show();
     $table = new html_table(array('cols' => 2, 'class' => 'propform'));
     $input_wblistemail = new html_inputfield(array('name' => '_wblistemail', 'id' => 'wblistaddress', 'size' => 70));
     $table->add('title', rep_specialchars_output($this->gettext('email')));
     $table->add('', $input_wblistemail->show($wblist[0]['email']));
     $input_wblistwb = new html_select(array('name' => '_wblistwb', 'id' => 'wblistwb'));
     $input_wblistwb->add(array($this->gettext('wblistwhitelist'), $this->gettext('wblistblacklist')), array('W', 'B'));
     $table->add('title', rep_specialchars_output($this->gettext('wblisttype')));
     $table->add('', $input_wblistwb->show($type));
     $input_wblistpriority = new html_select(array('name' => '_wblistpriority', 'id' => 'wblistpriority'));
     $input_wblistpriority->add(array("1", "2", "3", "4", "5", "6", "7", "8", "9", "10"));
     $table->add('title', rep_specialchars_output($this->gettext('wblistpriority')));
     $table->add('', $input_wblistpriority->show($wblist[0]['priority']));
     $input_wblistenabled = new html_checkbox(array('name' => '_wblistenabled', 'id' => 'wblistenabled', 'value' => '1'));
     $table->add('title', rep_specialchars_output($this->gettext('wblistenabled')));
     $table->add('', $input_wblistenabled->show($enabled));
     $out .= $table->show();
     $out .= "</fieldset>\n";
     return $out;
 }
Exemplo n.º 18
0
 /**
  * Template object for key generation form
  */
 function tpl_key_create_form($attrib)
 {
     $attrib += array('id' => 'rcmKeyCreateForm');
     $table = new html_table(array('cols' => 2));
     // get user's identities
     $identities = $this->rc->user->list_identities(null, true);
     // Identity
     $select = new html_select(array('name' => 'identity', 'id' => 'key-ident'));
     foreach ((array) $identities as $idx => $ident) {
         $name = empty($ident['name']) ? '<' . $ident['email'] . '>' : $ident['ident'];
         $select->add($name, $idx);
     }
     $table->add('title', html::label('key-name', rcube::Q($this->enigma->gettext('newkeyident'))));
     $table->add(null, $select->show(0));
     // Key size
     $select = new html_select(array('name' => 'size', 'id' => 'key-size'));
     $select->add($this->enigma->gettext('key2048'), '2048');
     $select->add($this->enigma->gettext('key4096'), '4096');
     $table->add('title', html::label('key-size', rcube::Q($this->enigma->gettext('newkeysize'))));
     $table->add(null, $select->show());
     // Password and confirm password
     $table->add('title', html::label('key-pass', rcube::Q($this->enigma->gettext('newkeypass'))));
     $table->add(null, rcube_output::get_edit_field('password', '', array('id' => 'key-pass', 'size' => $attrib['size'], 'required' => true), 'password'));
     $table->add('title', html::label('key-pass-confirm', rcube::Q($this->enigma->gettext('newkeypassconfirm'))));
     $table->add(null, rcube_output::get_edit_field('password-confirm', '', array('id' => 'key-pass-confirm', 'size' => $attrib['size'], 'required' => true), 'password'));
     $this->rc->output->add_gui_object('keyform', $attrib['id']);
     $this->rc->output->add_label('enigma.keygenerating', 'enigma.formerror', 'enigma.passwordsdiffer', 'enigma.keygenerateerror', 'enigma.nonameident', 'enigma.keygennosupport');
     return $this->rc->output->form_tag(array(), $table->show($attrib));
 }
Exemplo n.º 19
0
<dt class="propname">mdn_requests <span class="userconf">*</span></dt>
<dd>
<?php 
$mdn_opts = array(0 => 'ask the user', 1 => 'send automatically', 3 => 'send receipt to user contacts, otherwise ask the user', 4 => 'send receipt to user contacts, otherwise ignore', 2 => 'ignore');
$select_mdnreq = new html_select(array('name' => '_mdn_requests', 'id' => "cfgmdnreq"));
$select_mdnreq->add(array_values($mdn_opts), array_keys($mdn_opts));
echo $select_mdnreq->show(intval($RCI->getprop('mdn_requests')));
?>
<div>Behavior if a received message requests a message delivery notification (read receipt)</div>
</dd>

<dt class="propname">mime_param_folding <span class="userconf">*</span></dt>
<dd>
<?php 
$select_param_folding = new html_select(array('name' => '_mime_param_folding', 'id' => "cfgmimeparamfolding"));
$select_param_folding->add('Full RFC 2231 (Roundcube, Thunderbird)', '0');
$select_param_folding->add('RFC 2047/2231 (MS Outlook, OE)', '1');
$select_param_folding->add('Full RFC 2047 (deprecated)', '2');
echo $select_param_folding->show(strval($RCI->getprop('mime_param_folding')));
?>
<div>How to encode attachment long/non-ascii names</div>
</dd>

</dl>

<p class="hint"><span class="userconf">*</span>&nbsp; These settings are defaults for the user preferences</p>
</fieldset>


<fieldset>
<legend>Plugins</legend>
 /**
  * Handler for preferences_list hook.
  *
  * @param array Original parameters
  * @return array Modified parameters
  */
 function preferences_list($p)
 {
     if ($p['section'] != 'general') {
         return $p;
     }
     $rcmail = rcube::get_instance();
     $no_override = array_flip((array) $rcmail->config->get('dont_override'));
     if (!isset($no_override['converse_prebind'])) {
         $p['blocks']['converse'] = array('name' => $this->gettext('prefstitle'));
         $default = 2;
         $field_id = 'rcmfd_converse_prebind';
         $select = new html_select(array('name' => '_converse_prebind', 'id' => $field_id));
         $select->add($this->gettext('never'), 0);
         if ($this->_config_get('converse_xmpp_bosh_prebind_url', array())) {
             $select->add($this->gettext('auto'), 1);
             $default = 1;
         }
         if ($this->_config_get('converse_xmpp_enable_always', array(), false)) {
             $select->add($this->gettext('manual'), 2);
         }
         $p['blocks']['converse']['options']['converse_enable'] = array('title' => html::label($field_id, Q($this->gettext('enableprebind'))), 'content' => $select->show($rcmail->config->get('converse_prebind', $default)));
     }
     return $p;
 }
Exemplo n.º 21
0
 public function prefs_list($args)
 {
     if ($args['section'] != 'thunderbird_labels') {
         return $args;
     }
     $this->load_config();
     $dont_override = (array) $this->rc->config->get('dont_override', array());
     $args['blocks']['tb_label'] = array();
     $args['blocks']['tb_label']['name'] = $this->gettext('tb_label_options');
     $key = 'tb_label_enable';
     if (!in_array($key, $dont_override)) {
         $input = new html_checkbox(array('name' => $key, 'id' => $key, 'value' => 1));
         $content = $input->show($this->rc->config->get($key));
         $args['blocks']['tb_label']['options'][$key] = array('title' => $this->gettext('tb_label_enable_option'), 'content' => $content);
     }
     $key = 'tb_label_enable_shortcuts';
     if (!in_array($key, $dont_override)) {
         $input = new html_checkbox(array('name' => $key, 'id' => $key, 'value' => 1));
         $content = $input->show($this->rc->config->get($key));
         $args['blocks']['tb_label']['options'][$key] = array('title' => $this->gettext('tb_label_enable_shortcuts_option'), 'content' => $content);
     }
     $key = 'tb_label_style';
     if (!in_array($key, $dont_override)) {
         $select = new html_select(array('name' => $key, 'id' => $key));
         $select->add(array($this->gettext('thunderbird'), $this->gettext('bullets')), array('thunderbird', 'bullets'));
         $content = $select->show($this->rc->config->get($key));
         $args['blocks']['tb_label']['options'][$key] = array('title' => $this->gettext('tb_label_style_option'), 'content' => $content);
     }
     $key = 'tb_label_custom_labels';
     if (!in_array($key, $dont_override) && $this->rc->config->get('tb_label_modify_labels')) {
         $old = $this->rc->config->get($key);
         for ($i = 1; $i <= 5; $i++) {
             $input = new html_inputfield(array('name' => $key . $i, 'id' => $key . $i, 'type' => 'text', 'autocomplete' => 'off', 'value' => $old[$i]));
             $args['blocks']['tb_label']['options'][$key . $i] = array('title' => $this->gettext('tb_label_label') . " " . $i, 'content' => $input->show());
         }
     }
     return $args;
 }
Exemplo n.º 22
0
 /**
  * Form to select options for exporting events
  */
 function events_export_form($attrib = array())
 {
     if (!$attrib['id']) {
         $attrib['id'] = 'rcmExportForm';
     }
     $html .= html::div('form-section', html::label('event-export-calendar', $this->cal->gettext('calendar')) . $this->calendar_select(array('name' => 'calendar', 'id' => 'event-export-calendar')));
     $select = new html_select(array('name' => 'range', 'id' => 'event-export-range'));
     $select->add(array($this->cal->gettext('all'), $this->cal->gettext('onemonthback'), $this->cal->gettext(array('name' => 'nmonthsback', 'vars' => array('nr' => 2))), $this->cal->gettext(array('name' => 'nmonthsback', 'vars' => array('nr' => 3))), $this->cal->gettext(array('name' => 'nmonthsback', 'vars' => array('nr' => 6))), $this->cal->gettext(array('name' => 'nmonthsback', 'vars' => array('nr' => 12))), $this->cal->gettext('customdate')), array(0, '1', '2', '3', '6', '12', 'custom'));
     $startdate = new html_inputfield(array('name' => 'start', 'size' => 11, 'id' => 'event-export-startdate'));
     $html .= html::div('form-section', html::label('event-export-range', $this->cal->gettext('exportrange')) . $select->show(0) . html::span(array('style' => 'display:none'), $startdate->show()));
     $checkbox = new html_checkbox(array('name' => 'attachments', 'id' => 'event-export-attachments', 'value' => 1));
     $html .= html::div('form-section', html::label('event-export-range', $this->cal->gettext('exportattachments')) . $checkbox->show(1));
     $this->rc->output->add_gui_object('exportform', $attrib['id']);
     return html::tag('form', array('action' => $this->rc->url(array('task' => 'calendar', 'action' => 'export_events')), 'method' => "post", 'id' => $attrib['id']), $html);
 }
Exemplo n.º 23
0
 /**
  * Handler for calendar/itip-status requests
  */
 function event_itip_status()
 {
     $data = rcube_utils::get_input_value('data', rcube_utils::INPUT_POST, true);
     // find local copy of the referenced event
     $this->load_driver();
     $existing = $this->driver->get_event($data, calendar_driver::FILTER_WRITEABLE | calendar_driver::FILTER_PERSONAL);
     $itip = $this->load_itip();
     $response = $itip->get_itip_status($data, $existing);
     // get a list of writeable calendars to save new events to
     if (!$existing && !$data['nosave'] && $response['action'] == 'rsvp' || $response['action'] == 'import') {
         $calendars = $this->driver->list_calendars(calendar_driver::FILTER_PERSONAL);
         $calendar_select = new html_select(array('name' => 'calendar', 'id' => 'itip-saveto', 'is_escaped' => true));
         $calendar_select->add('--', '');
         $numcals = 0;
         foreach ($calendars as $calendar) {
             if ($calendar['editable']) {
                 $calendar_select->add($calendar['name'], $calendar['id']);
                 $numcals++;
             }
         }
         if ($numcals <= 1) {
             $calendar_select = null;
         }
     }
     if ($calendar_select) {
         $default_calendar = $this->get_default_calendar($data['sensitivity']);
         $response['select'] = html::span('folder-select', $this->gettext('saveincalendar') . '&nbsp;' . $calendar_select->show($default_calendar['id']));
     } else {
         if ($data['nosave']) {
             $response['select'] = html::tag('input', array('type' => 'hidden', 'name' => 'calendar', 'id' => 'itip-saveto', 'value' => ''));
         }
     }
     // render small agenda view for the respective day
     if ($data['method'] == 'REQUEST' && !empty($data['date']) && $response['action'] == 'rsvp') {
         $event_start = rcube_utils::anytodatetime($data['date']);
         $day_start = new Datetime(gmdate('Y-m-d 00:00', $data['date']), $this->lib->timezone);
         $day_end = new Datetime(gmdate('Y-m-d 23:59', $data['date']), $this->lib->timezone);
         // get events on that day from the user's personal calendars
         $calendars = $this->driver->list_calendars(calendar_driver::FILTER_PERSONAL);
         $events = $this->driver->load_events($day_start->format('U'), $day_end->format('U'), null, array_keys($calendars));
         usort($events, function ($a, $b) {
             return $a['start'] > $b['start'] ? 1 : -1;
         });
         $before = $after = array();
         foreach ($events as $event) {
             // TODO: skip events with free_busy == 'free' ?
             if ($event['uid'] == $data['uid'] || $event['end'] < $day_start || $event['start'] > $day_end) {
                 continue;
             } else {
                 if ($event['start'] < $event_start) {
                     $before[] = $this->mail_agenda_event_row($event);
                 } else {
                     $after[] = $this->mail_agenda_event_row($event);
                 }
             }
         }
         $response['append'] = array('selector' => '.calendar-agenda-preview', 'replacements' => array('%before%' => !empty($before) ? join("\n", array_slice($before, -3)) : html::div('event-row no-event', $this->gettext('noearlierevents')), '%after%' => !empty($after) ? join("\n", array_slice($after, 0, 3)) : html::div('event-row no-event', $this->gettext('nolaterevents'))));
     }
     $this->rc->output->command('plugin.update_itip_object_status', $response);
 }
Exemplo n.º 24
0
 function accounts_form_content($email = "", $username = "", $password = "", $server = "", $port = "", $useSSL = 'none', $leave_a_copy = true, $provider = "", $default_folder = "", $show_import_old_messages_option = true)
 {
     $rcmail = rcmail::get_instance();
     $this->include_script('pop3fetcher_providers.js');
     // allow the following attributes to be added to the <table> tag
     $attrib_str = create_attrib_string($attrib, array('style', 'class', 'id', 'cellpadding', 'cellspacing', 'border', 'summary'));
     // return the complete edit form as table
     $user = $rcmail->user->data['username'];
     if ($_SESSION['global_alias']) {
         $user = $_SESSION['global_alias'];
     }
     if ($email != "") {
         $out .= '<fieldset><legend>' . $email . ' ::: ' . $user . '</legend>' . "\n";
     } else {
         $out .= '<fieldset>' . "\n";
     }
     $out .= '<br />' . "\n";
     $out .= '<table' . $attrib_str . ">\n";
     //<script type=\"text/javascript\">console.log(providers['gmail.com']);</script>
     $field_id = 'pop3fetcher_email';
     $input_pop3fetcher_email = new html_inputfield(array('autocomplete' => 'off', 'name' => '_pop3fetcher_email', 'id' => $field_id, 'size' => 30));
     $out .= sprintf("<tr><td valign=\"middle\" class=\"title\"><label for=\"%s\">%s</label>:</td><td colspan=\"3\">%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('account_email')), $input_pop3fetcher_email->show($email));
     $field_id = 'pop3fetcher_username';
     $input_pop3fetcher_username = new html_inputfield(array('autocomplete' => 'off', 'name' => '_pop3fetcher_username', 'id' => $field_id, 'size' => 30));
     $out .= sprintf("<tr><td valign=\"middle\" class=\"title\"><label for=\"%s\">%s</label>:</td><td colspan=\"3\">%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('account_username')), $input_pop3fetcher_username->show($username));
     $field_id = 'pop3fetcher_password';
     $input_pop3fetcher_password = new html_passwordfield(array('autocomplete' => 'off', 'name' => '_pop3fetcher_password', 'id' => $field_id, 'size' => 30));
     $out .= sprintf("<tr><td valign=\"middle\" class=\"title\"><label for=\"%s\">%s</label>:</td><td colspan=\"3\">%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('account_password')), $input_pop3fetcher_password->show($password));
     $field_id = 'pop3fetcher_provider';
     $input_pop3fetcher_provider = new html_select(array('name' => '_pop3fetcher_provider', 'id' => $field_id));
     $out .= sprintf("<tr><td valign=\"middle\" class=\"title\"><label for=\"%s\">%s</label>:</td><td colspan=\"3\">%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('account_provider')), $input_pop3fetcher_provider->show());
     $field_id = 'pop3fetcher_serveraddress';
     $input_pop3fetcher_serveraddress = new html_inputfield(array('autocomplete' => 'off', 'name' => '_pop3fetcher_serveraddress', 'id' => $field_id, 'size' => 30));
     $out .= sprintf("<tr><td valign=\"middle\" class=\"title\"><label for=\"%s\">%s</label>:</td><td colspan=\"3\">%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('account_serveraddress')), $input_pop3fetcher_serveraddress->show($server));
     $field_id = 'pop3fetcher_serverport';
     $input_pop3fetcher_serverport = new html_inputfield(array('autocomplete' => 'off', 'name' => '_pop3fetcher_serverport', 'id' => $field_id, 'size' => 10));
     $field_id2 = 'pop3fetcher_ssl';
     $input_pop3fetcher_ssl = new html_select(array('name' => '_pop3fetcher_ssl', 'id' => $field_id2));
     $input_pop3fetcher_ssl->add('none', '');
     $input_pop3fetcher_ssl->add('tls', 'tls');
     $input_pop3fetcher_ssl->add('ssl', 'ssl');
     $input_pop3fetcher_ssl->add('sslv2', 'sslv2');
     $input_pop3fetcher_ssl->add('sslv3', 'sslv3');
     $out .= sprintf("<tr><td valign=\"middle\" class=\"title\"><label for=\"%s\">%s</label>:</td><td>%s</td><td valign=\"middle\" class=\"title\"><label for=\"%s\">%s</label>:</td><td>%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('account_serverport')), $input_pop3fetcher_serverport->show($port), $field_id2, rep_specialchars_output($this->gettext('account_usessl')), $input_pop3fetcher_ssl->show($useSSL));
     $field_id = 'pop3fetcher_leaveacopy';
     $input_pop3fetcher_leaveacopy = new html_checkbox(array('name' => '_pop3fetcher_leaveacopy', 'id' => $field_id));
     $out .= sprintf("<tr><td valign=\"middle\" colspan=\"3\" class=\"title\"><label for=\"%s\">%s</label>:</td><td>%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('account_leaveacopy')), $input_pop3fetcher_leaveacopy->show($leave_a_copy ? false : true));
     // QUESTA COSA E' STRANA MA FUNZIONA...
     // SET TARGET DEFAULT FOLDER
     $field_id = 'pop3fetcher_defaultfolder';
     $this->rcmail->imap_connect();
     // get mailbox list
     $a_folders = $rcmail->imap->list_folders();
     $delimiter = $rcmail->imap->get_hierarchy_delimiter();
     $a_mailboxes = array();
     $custom_folder_name = $this->config["root_folder_path"] . $delimiter . str_replace($delimiter, "_", $email);
     $found = false;
     foreach ($a_folders as $ifolder) {
         if ($ifolder == $custom_folder_name) {
             $found = true;
         }
         rcmail_build_folder_tree($a_mailboxes, $ifolder, $delimiter);
     }
     $input_folderlist = new html_select(array('name' => '_pop3fetcher_defaultfolder', 'id' => $field_id));
     rcmail_render_folder_tree_select($a_mailboxes, $field_id, 100, $input_folderlist, false);
     if (!$found && $default_folder != "" && $default_folder != $custom_folder_name) {
         $input_folderlist->add(str_replace($delimiter, "_", $email), "#AUTO_FOLDER#");
     }
     //$input_folderlist->add('create new folder', 'create_new_folder');
     $out .= sprintf("<tr><td valign=\"middle\" class=\"title\"><label for=\"%s\">%s</label>:</td><td colspan=\"3\">%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('account_default_folder')), $input_folderlist->show($default_folder));
     $field_id = 'pop3fetcher_testconnection';
     $input_pop3fetcher_testconnection = new html_checkbox(array('name' => '_pop3fetcher_testconnection', 'id' => $field_id));
     $out .= sprintf("<tr><td valign=\"middle\" colspan=\"3\" class=\"title\"><label for=\"%s\">%s</label>:</td><td>%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('test_connection_on_save')), $input_pop3fetcher_testconnection->show(false));
     // QUESTA COSA E' STRANA MA FUNZIONA...
     if ($show_import_old_messages_option) {
         $field_id = 'pop3fetcher_import_old_messages';
         $input_pop3fetcher_import_old_messages = new html_checkbox(array('name' => '_pop3fetcher_import_old_messages', 'id' => $field_id));
         $out .= sprintf("<tr><td valign=\"middle\" colspan=\"3\" class=\"title\"><label for=\"%s\">%s</label>:</td><td>%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('account_import_old_messages')), $input_pop3fetcher_import_old_messages->show(true));
         // QUESTA COSA E' STRANA MA FUNZIONA...
     }
     $out .= "\n</table>";
     $out .= '<br />' . "\n";
     $out .= "</fieldset>\n";
     $out .= "<script type='text/javascript'>\n\t\t\t\tvar delimiter = '" . $delimiter . "';\n\t\t\t\tvar root_folder_path = '" . $this->config["root_folder_path"] . "';\n\t\t\t\tload_pop3_providers('" . $provider . "');\n\t\t\t\t\$('#pop3fetcher_email').keyup(\n\t\t\t\t\tfunction(){update_default_folder_name(\$(this).val());}\n\t\t\t\t);\n\t\t\t</script>";
     return $out;
 }
Exemplo n.º 25
0
 /**
  * Drop-down menus for recurrence rules like "each last sunday of"
  */
 private function rrule_selectors($part, $noselect = null)
 {
     // rule selectors
     $select_prefix = new html_select(array('name' => 'bydayprefix', 'id' => "edit-recurrence-{$part}-prefix"));
     if ($noselect) {
         $select_prefix->add($noselect, '');
     }
     $select_prefix->add(array($this->gettext('first'), $this->gettext('second'), $this->gettext('third'), $this->gettext('fourth'), $this->gettext('last')), array(1, 2, 3, 4, -1));
     $select_wday = new html_select(array('name' => 'byday', 'id' => "edit-recurrence-{$part}-byday"));
     if ($noselect) {
         $select_wday->add($noselect, '');
     }
     $daymap = array('sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday');
     $first = $this->rc->config->get('calendar_first_day', 1);
     for ($j = $first; $j <= $first + 6; $j++) {
         $d = $j % 7;
         $select_wday->add($this->gettext($daymap[$d]), strtoupper(substr($daymap[$d], 0, 2)));
     }
     return $select_prefix->show() . '&nbsp;' . $select_wday->show();
 }
Exemplo n.º 26
0
 /**
  * Handler for user preferences form (preferences_list hook)
  */
 function prefs_list($args)
 {
     if ($args['section'] != 'mailbox') {
         return $args;
     }
     // Load configuration
     $this->load_config();
     // Load localization and configuration
     $this->add_texts('localization/');
     if (!empty($_REQUEST['_framed'])) {
         $this->rc->output->add_label('newmail_notifier.title', 'newmail_notifier.testbody', 'newmail_notifier.desktopunsupported', 'newmail_notifier.desktopenabled', 'newmail_notifier.desktopdisabled');
         $this->include_script('newmail_notifier.js');
     }
     // Check that configuration is not disabled
     $dont_override = (array) $this->rc->config->get('dont_override', array());
     foreach (array('basic', 'desktop', 'sound') as $type) {
         $key = 'newmail_notifier_' . $type;
         if (!in_array($key, $dont_override)) {
             $field_id = '_' . $key;
             $input = new html_checkbox(array('name' => $field_id, 'id' => $field_id, 'value' => 1));
             $content = $input->show($this->rc->config->get($key)) . ' ' . html::a(array('href' => '#', 'onclick' => 'newmail_notifier_test_' . $type . '()'), $this->gettext('test'));
             $args['blocks']['new_message']['options'][$key] = array('title' => html::label($field_id, rcube::Q($this->gettext($type))), 'content' => $content);
         }
     }
     $type = 'desktop_timeout';
     $key = 'newmail_notifier_' . $type;
     if (!in_array($key, $dont_override)) {
         $field_id = '_' . $key;
         $select = new html_select(array('name' => $field_id, 'id' => $field_id));
         foreach (array(5, 10, 15, 30, 45, 60) as $sec) {
             $label = $this->rc->gettext(array('name' => 'afternseconds', 'vars' => array('n' => $sec)));
             $select->add($label, $sec);
         }
         $args['blocks']['new_message']['options'][$key] = array('title' => html::label($field_id, rcube::Q($this->gettext('desktoptimeout'))), 'content' => $select->show((int) $this->rc->config->get($key)));
     }
     return $args;
 }
Exemplo n.º 27
0
 /**
  * Return folders list as html_select object
  *
  * @param array $p  Named parameters
  *
  * @return html_select HTML drop-down object
  */
 public function folder_selector($p = array())
 {
     $realnames = $this->config->get('show_real_foldernames');
     $p += array('maxlength' => 100, 'realnames' => $realnames, 'is_escaped' => true);
     $a_mailboxes = array();
     $storage = $this->get_storage();
     if (empty($p['folder_name'])) {
         $p['folder_name'] = '*';
     }
     if ($p['unsubscribed']) {
         $list = $storage->list_folders('', $p['folder_name'], $p['folder_filter'], $p['folder_rights']);
     } else {
         $list = $storage->list_folders_subscribed('', $p['folder_name'], $p['folder_filter'], $p['folder_rights']);
     }
     $delimiter = $storage->get_hierarchy_delimiter();
     if (!empty($p['exceptions'])) {
         $list = array_diff($list, (array) $p['exceptions']);
     }
     if (!empty($p['additional'])) {
         foreach ($p['additional'] as $add_folder) {
             $add_items = explode($delimiter, $add_folder);
             $folder = '';
             while (count($add_items)) {
                 $folder .= array_shift($add_items);
                 // @TODO: sorting
                 if (!in_array($folder, $list)) {
                     $list[] = $folder;
                 }
                 $folder .= $delimiter;
             }
         }
     }
     foreach ($list as $folder) {
         $this->build_folder_tree($a_mailboxes, $folder, $delimiter);
     }
     $select = new html_select($p);
     if ($p['noselection']) {
         $select->add(html::quote($p['noselection']), '');
     }
     $this->render_folder_tree_select($a_mailboxes, $mbox, $p['maxlength'], $select, $p['realnames'], 0, $p);
     return $select;
 }
Exemplo n.º 28
0
 /**
  * Independent vacation form
  */
 public function vacation_form($attrib)
 {
     // check supported extensions
     $date_extension = in_array('date', $this->exts);
     $regex_extension = in_array('regex', $this->exts);
     $seconds_extension = in_array('vacation-seconds', $this->exts);
     // build FORM tag
     $form_id = $attrib['id'] ?: 'form';
     $out = $this->rc->output->request_form(array('id' => $form_id, 'name' => $form_id, 'method' => 'post', 'task' => 'settings', 'action' => 'plugin.managesieve-vacation', 'noclose' => true) + $attrib);
     $from_addr = $this->rc->config->get('managesieve_vacation_from_init');
     $auto_addr = $this->rc->config->get('managesieve_vacation_addresses_init');
     if (count($this->vacation) < 2) {
         if ($auto_addr) {
             $this->vacation['addresses'] = $this->user_emails();
         }
         if ($from_addr) {
             $default_identity = $this->rc->user->list_emails(true);
             $this->vacation['from'] = $default_identity['email'];
         }
     }
     // form elements
     $from = new html_inputfield(array('name' => 'vacation_from', 'id' => 'vacation_from', 'size' => 50));
     $subject = new html_inputfield(array('name' => 'vacation_subject', 'id' => 'vacation_subject', 'size' => 50));
     $reason = new html_textarea(array('name' => 'vacation_reason', 'id' => 'vacation_reason', 'cols' => 60, 'rows' => 8));
     $interval = new html_inputfield(array('name' => 'vacation_interval', 'id' => 'vacation_interval', 'size' => 5));
     $addresses = '<textarea name="vacation_addresses" id="vacation_addresses" data-type="list" data-size="30" style="display: none">' . rcube::Q(implode("\n", (array) $this->vacation['addresses']), 'strict', false) . '</textarea>';
     $status = new html_select(array('name' => 'vacation_status', 'id' => 'vacation_status'));
     $action = new html_select(array('name' => 'vacation_action', 'id' => 'vacation_action', 'onchange' => 'vacation_action_select()'));
     $addresses_link = new html_inputfield(array('type' => 'button', 'href' => '#', 'class' => 'button', 'onclick' => rcmail_output::JS_OBJECT_NAME . '.managesieve_vacation_addresses()'));
     $status->add($this->plugin->gettext('vacation.on'), 'on');
     $status->add($this->plugin->gettext('vacation.off'), 'off');
     $action->add($this->plugin->gettext('vacation.keep'), 'keep');
     $action->add($this->plugin->gettext('vacation.discard'), 'discard');
     $action->add($this->plugin->gettext('vacation.redirect'), 'redirect');
     if (in_array('copy', $this->exts)) {
         $action->add($this->plugin->gettext('vacation.copy'), 'copy');
     }
     if ($this->rc->config->get('managesieve_vacation') != 2 && count($this->vacation['list'])) {
         $after = new html_select(array('name' => 'vacation_after', 'id' => 'vacation_after'));
         $after->add('', '');
         foreach ($this->vacation['list'] as $idx => $rule) {
             $after->add($rule, $idx);
         }
     }
     $interval_txt = $interval->show(self::vacation_interval($this->vacation));
     if ($seconds_extension) {
         $interval_select = new html_select(array('name' => 'vacation_interval_type'));
         $interval_select->add($this->plugin->gettext('days'), 'days');
         $interval_select->add($this->plugin->gettext('seconds'), 'seconds');
         $interval_txt .= '&nbsp;' . $interval_select->show(isset($this->vacation['seconds']) ? 'seconds' : 'days');
     } else {
         $interval_txt .= '&nbsp;' . $this->plugin->gettext('days');
     }
     if ($date_extension || $regex_extension) {
         $date_from = new html_inputfield(array('name' => 'vacation_datefrom', 'id' => 'vacation_datefrom', 'class' => 'datepicker', 'size' => 12));
         $date_to = new html_inputfield(array('name' => 'vacation_dateto', 'id' => 'vacation_dateto', 'class' => 'datepicker', 'size' => 12));
         $date_format = $this->rc->config->get('date_format', 'Y-m-d');
     }
     if ($date_extension) {
         $time_from = new html_inputfield(array('name' => 'vacation_timefrom', 'id' => 'vacation_timefrom', 'size' => 6));
         $time_to = new html_inputfield(array('name' => 'vacation_timeto', 'id' => 'vacation_timeto', 'size' => 6));
         $time_format = $this->rc->config->get('time_format', 'H:i');
         $date_value = array();
         foreach ((array) $this->vacation['tests'] as $test) {
             if ($test['test'] == 'currentdate') {
                 $idx = $test['type'] == 'value-ge' ? 'from' : 'to';
                 if ($test['part'] == 'date') {
                     $date_value[$idx]['date'] = $test['arg'];
                 } else {
                     if ($test['part'] == 'iso8601') {
                         $date_value[$idx]['datetime'] = $test['arg'];
                     }
                 }
             }
         }
         foreach ($date_value as $idx => $value) {
             $date = $value['datetime'] ?: $value['date'];
             $date_value[$idx] = $this->rc->format_date($date, $date_format, false);
             if (!empty($value['datetime'])) {
                 $date_value['time_' . $idx] = $this->rc->format_date($date, $time_format, true);
             }
         }
     } else {
         if ($regex_extension) {
             // Sieve 'date' extension not available, read start/end from RegEx based rules instead
             if ($date_tests = self::parse_regexp_tests($this->vacation['tests'])) {
                 $date_value['from'] = $this->rc->format_date($date_tests['from'], $date_format, false);
                 $date_value['to'] = $this->rc->format_date($date_tests['to'], $date_format, false);
             }
         }
     }
     // force domain selection in redirect email input
     $domains = (array) $this->rc->config->get('managesieve_domains');
     $redirect = $this->vacation['action'] == 'redirect' || $this->vacation['action'] == 'copy';
     if (!empty($domains)) {
         sort($domains);
         $domain_select = new html_select(array('name' => 'action_domain', 'id' => 'action_domain'));
         $domain_select->add(array_combine($domains, $domains));
         if ($redirect && $this->vacation['target']) {
             $parts = explode('@', $this->vacation['target']);
             if (!empty($parts)) {
                 $this->vacation['domain'] = array_pop($parts);
                 $this->vacation['target'] = implode('@', $parts);
             }
         }
     }
     // redirect target
     $action_target = ' <span id="action_target_span" style="display:' . ($redirect ? 'inline' : 'none') . '">' . '<input type="text" name="action_target" id="action_target"' . ' value="' . ($redirect ? rcube::Q($this->vacation['target'], 'strict', false) : '') . '"' . (!empty($domains) ? ' size="20"' : ' size="35"') . '/>' . (!empty($domains) ? ' @ ' . $domain_select->show($this->vacation['domain']) : '') . '</span>';
     // Message tab
     $table = new html_table(array('cols' => 2));
     $table->add('title', html::label('vacation_subject', $this->plugin->gettext('vacation.subject')));
     $table->add(null, $subject->show($this->vacation['subject']));
     $table->add('title', html::label('vacation_reason', $this->plugin->gettext('vacation.body')));
     $table->add(null, $reason->show($this->vacation['reason']));
     if ($date_extension || $regex_extension) {
         $table->add('title', html::label('vacation_datefrom', $this->plugin->gettext('vacation.start')));
         $table->add(null, $date_from->show($date_value['from']) . ($time_from ? ' ' . $time_from->show($date_value['time_from']) : ''));
         $table->add('title', html::label('vacation_dateto', $this->plugin->gettext('vacation.end')));
         $table->add(null, $date_to->show($date_value['to']) . ($time_to ? ' ' . $time_to->show($date_value['time_to']) : ''));
     }
     $table->add('title', html::label('vacation_status', $this->plugin->gettext('vacation.status')));
     $table->add(null, $status->show(!isset($this->vacation['disabled']) || $this->vacation['disabled'] ? 'off' : 'on'));
     $out .= html::tag('fieldset', $class, html::tag('legend', null, $this->plugin->gettext('vacation.reply')) . $table->show($attrib));
     // Advanced tab
     $table = new html_table(array('cols' => 2));
     $table->add('title', html::label('vacation_from', $this->plugin->gettext('vacation.from')));
     $table->add(null, $from->show($this->vacation['from']));
     $table->add('title', html::label('vacation_addresses', $this->plugin->gettext('vacation.addresses')));
     $table->add(null, $addresses . $addresses_link->show($this->plugin->gettext('filladdresses')));
     $table->add('title', html::label('vacation_interval', $this->plugin->gettext('vacation.interval')));
     $table->add(null, $interval_txt);
     if ($after) {
         $table->add('title', html::label('vacation_after', $this->plugin->gettext('vacation.after')));
         $table->add(null, $after->show($this->vacation['idx'] - 1));
     }
     $table->add('title', html::label('vacation_action', $this->plugin->gettext('vacation.action')));
     $table->add('vacation', $action->show($this->vacation['action']) . $action_target);
     $out .= html::tag('fieldset', $class, html::tag('legend', null, $this->plugin->gettext('vacation.advanced')) . $table->show($attrib));
     $out .= '</form>';
     $this->rc->output->add_gui_object('sieveform', $form_id);
     if ($time_format) {
         $this->rc->output->set_env('time_format', $time_format);
     }
     return $out;
 }
Exemplo n.º 29
0
 /**
  * Create a HTML dropdown to select a previous version of Roundcube
  */
 function versions_select($attrib = array())
 {
     $select = new html_select($attrib);
     $select->add(array('0.1-stable', '0.1.1', '0.2-alpha', '0.2-beta', '0.2-stable', '0.3-stable', '0.3.1', '0.4-beta', '0.4.2', '0.5-beta', '0.5', '0.5.1', '0.5.2', '0.5.3', '0.5.4', '0.6-beta', '0.6', '0.7-beta', '0.7', '0.7.1', '0.7.2', '0.7.3', '0.7.4', '0.8-beta', '0.8-rc', '0.8.0', '0.8.1', '0.8.2', '0.8.3', '0.8.4', '0.8.5', '0.8.6', '0.9-beta', '0.9-rc', '0.9-rc2'));
     return $select;
 }
Exemplo n.º 30
0
 /**
  * Handler for preferences_list hook.
  * Adds options blocks into Enigma settings sections in Preferences.
  *
  * @param array Original parameters
  *
  * @return array Modified parameters
  */
 function preferences_list($p)
 {
     if ($p['section'] != 'enigma') {
         return $p;
     }
     $no_override = array_flip((array) $this->rc->config->get('dont_override'));
     $p['blocks']['main']['name'] = $this->gettext('mainoptions');
     if (!isset($no_override['enigma_encryption'])) {
         if (!$p['current']) {
             $p['blocks']['main']['content'] = true;
             return $p;
         }
         $field_id = 'rcmfd_enigma_encryption';
         $input = new html_checkbox(array('name' => '_enigma_encryption', 'id' => $field_id, 'value' => 1));
         $p['blocks']['main']['options']['enigma_encryption'] = array('title' => html::label($field_id, $this->gettext('supportencryption')), 'content' => $input->show(intval($this->rc->config->get('enigma_encryption'))));
     }
     if (!isset($no_override['enigma_signatures'])) {
         if (!$p['current']) {
             $p['blocks']['main']['content'] = true;
             return $p;
         }
         $field_id = 'rcmfd_enigma_signatures';
         $input = new html_checkbox(array('name' => '_enigma_signatures', 'id' => $field_id, 'value' => 1));
         $p['blocks']['main']['options']['enigma_signatures'] = array('title' => html::label($field_id, $this->gettext('supportsignatures')), 'content' => $input->show(intval($this->rc->config->get('enigma_signatures'))));
     }
     if (!isset($no_override['enigma_decryption'])) {
         if (!$p['current']) {
             $p['blocks']['main']['content'] = true;
             return $p;
         }
         $field_id = 'rcmfd_enigma_decryption';
         $input = new html_checkbox(array('name' => '_enigma_decryption', 'id' => $field_id, 'value' => 1));
         $p['blocks']['main']['options']['enigma_decryption'] = array('title' => html::label($field_id, $this->gettext('supportdecryption')), 'content' => $input->show(intval($this->rc->config->get('enigma_decryption'))));
     }
     if (!isset($no_override['enigma_sign_all'])) {
         if (!$p['current']) {
             $p['blocks']['main']['content'] = true;
             return $p;
         }
         $field_id = 'rcmfd_enigma_sign_all';
         $input = new html_checkbox(array('name' => '_enigma_sign_all', 'id' => $field_id, 'value' => 1));
         $p['blocks']['main']['options']['enigma_sign_all'] = array('title' => html::label($field_id, $this->gettext('signdefault')), 'content' => $input->show($this->rc->config->get('enigma_sign_all') ? 1 : 0));
     }
     if (!isset($no_override['enigma_encrypt_all'])) {
         if (!$p['current']) {
             $p['blocks']['main']['content'] = true;
             return $p;
         }
         $field_id = 'rcmfd_enigma_encrypt_all';
         $input = new html_checkbox(array('name' => '_enigma_encrypt_all', 'id' => $field_id, 'value' => 1));
         $p['blocks']['main']['options']['enigma_encrypt_all'] = array('title' => html::label($field_id, $this->gettext('encryptdefault')), 'content' => $input->show($this->rc->config->get('enigma_encrypt_all') ? 1 : 0));
     }
     if (!isset($no_override['enigma_password_time'])) {
         if (!$p['current']) {
             $p['blocks']['main']['content'] = true;
             return $p;
         }
         $field_id = 'rcmfd_enigma_password_time';
         $select = new html_select(array('name' => '_enigma_password_time', 'id' => $field_id));
         foreach (array(1, 5, 10, 15, 30) as $m) {
             $label = $this->gettext(array('name' => 'nminutes', 'vars' => array('m' => $m)));
             $select->add($label, $m);
         }
         $select->add($this->gettext('wholesession'), 0);
         $p['blocks']['main']['options']['enigma_password_time'] = array('title' => html::label($field_id, $this->gettext('passwordtime')), 'content' => $select->show(intval($this->rc->config->get('enigma_password_time'))));
     }
     return $p;
 }