/**
  * Callback function when HTML page is rendered
  * We'll add an overlay box here.
  */
 function render_page($p)
 {
     if ($_SESSION['plugin.newuserdialog'] && $p['template'] == 'mail') {
         $this->add_texts('localization');
         $rcmail = rcmail::get_instance();
         $identity = $rcmail->user->get_identity();
         $identities_level = intval($rcmail->config->get('identities_level', 0));
         // compose user-identity dialog
         $table = new html_table(array('cols' => 2));
         $table->add('title', $this->gettext('name'));
         $table->add(null, html::tag('input', array('type' => 'text', 'name' => '_name', 'value' => $identity['name'], 'disabled' => $identities_level == 4)));
         $table->add('title', $this->gettext('email'));
         $table->add(null, html::tag('input', array('type' => 'text', 'name' => '_email', 'value' => rcube_utils::idn_to_utf8($identity['email']), 'disabled' => in_array($identities_level, array(1, 3, 4)))));
         $table->add('title', $this->gettext('organization'));
         $table->add(null, html::tag('input', array('type' => 'text', 'name' => '_organization', 'value' => $identity['organization'], 'disabled' => $identities_level == 4)));
         $table->add('title', $this->gettext('signature'));
         $table->add(null, html::tag('textarea', array('name' => '_signature', 'rows' => '3'), $identity['signature']));
         // add overlay input box to html page
         $rcmail->output->add_footer(html::tag('form', array('id' => 'newuserdialog', 'action' => $rcmail->url('plugin.newusersave'), 'method' => 'post'), html::p('hint', rcube::Q($this->gettext('identitydialoghint'))) . $table->show() . html::p(array('class' => 'formbuttons'), html::tag('input', array('type' => 'submit', 'class' => 'button mainaction', 'value' => $this->gettext('save'))))));
         $title = rcube::JQ($this->gettext('identitydialogtitle'));
         $script = "\n\$('#newuserdialog').show()\n  .dialog({modal:true, resizable:false, closeOnEscape:false, width:450, title:'{$title}'})\n  .submit(function() {\n    var i, request = {}, form = \$(this).serializeArray();\n    for (i in form)\n      request[form[i].name] = form[i].value;\n\n      rcmail.http_post('plugin.newusersave', request, true);\n      return false;\n  });\n\n\$('input[name=_name]').focus();\nrcube_webmail.prototype.new_user_dialog_close = function() { \$('#newuserdialog').dialog('close'); }\n";
         // disable keyboard events for messages list (#1486726)
         $rcmail->output->add_script($script, 'docready');
         $this->include_stylesheet('newuserdialog.css');
     }
 }
示例#2
0
 public function forward_form()
 {
     $table = new html_table(array('cols' => 2));
     $field_id = 'forwardforwards';
     $text_forwardforwards = new html_textarea(array('name' => '_forwardforwards', 'id' => $field_id, 'spellcheck' => 1, 'rows' => 6, 'cols' => 40));
     $table->add('title', html::label($field_id, Q($this->gettext('forwardforwards'))));
     $table->add(null, $text_forwardforwards->show($this->obj->get_forward_forwards()));
     $field_id = 'forwardkeepcopies';
     $input_forwardkeepcopies = new html_checkbox(array('name' => '_forwardkeepcopies', 'id' => $field_id, 'value' => 1));
     $table->add('title', html::label($field_id, Q($this->gettext('forwardkeepcopies'))));
     $table->add(null, $input_forwardkeepcopies->show($this->obj->is_forward_keepcopies() === true || $this->obj->is_forward_keepcopies() == "1" || $this->obj->is_forward_keepcopies() == "t" || $this->obj->is_forward_keepcopies() == "y" || $this->obj->is_forward_keepcopies() == "yes" ? 1 : 0));
     $out = html::div(array('class' => "box"), html::div(array('id' => "prefs-title", 'class' => 'boxtitle'), $this->gettext('forward')) . html::div(array('class' => "boxcontent"), $table->show() . html::p(null, $this->rc->output->button(array('command' => 'plugin.forward-save', 'type' => 'input', 'class' => 'button mainaction', 'label' => 'save')))));
     $this->rc->output->add_gui_object('forwardform', 'forward-form');
     return $this->rc->output->form_tag(array('id' => 'forward-form', 'name' => 'forward-form', 'method' => 'post', 'action' => './?_task=settings&_action=plugin.forward-save'), $out);
 }
示例#3
0
 /**
  * Callback function when HTML page is rendered
  * We'll add an overlay box here.
  */
 function render_page($p)
 {
     if ($_SESSION['plugin.newuserdialog']) {
         $this->add_texts('localization');
         $rcmail = rcmail::get_instance();
         $identity = $rcmail->user->get_identity();
         $identities_level = intval($rcmail->config->get('identities_level', 0));
         // compose user-identity dialog
         $table = new html_table(array('cols' => 2));
         $table->add('title', $this->gettext('name'));
         $table->add(null, html::tag('input', array('type' => "text", 'name' => "_name", 'value' => $identity['name'])));
         $table->add('title', $this->gettext('email'));
         $table->add(null, html::tag('input', array('type' => "text", 'name' => "_email", 'value' => $identity['email'], 'disabled' => $identities_level == 1 || $identities_level == 3)));
         // add overlay input box to html page
         $rcmail->output->add_footer(html::div(array('id' => "newuseroverlay"), html::tag('form', array('action' => $rcmail->url('plugin.newusersave'), 'method' => "post"), html::tag('h3', null, Q($this->gettext('identitydialogtitle'))) . html::p('hint', Q($this->gettext('identitydialoghint'))) . $table->show() . html::p(array('class' => "formbuttons"), html::tag('input', array('type' => "submit", 'class' => "button mainaction", 'value' => $this->gettext('save')))))));
         $this->include_stylesheet('newuserdialog.css');
     }
 }
示例#4
0
 /**
  * Callback function when HTML page is rendered
  * We'll add an overlay box here.
  */
 function render_page($p)
 {
     if ($_SESSION['plugin.newuserdialog'] && $p['template'] == 'mail') {
         $this->add_texts('localization');
         $rcmail = rcmail::get_instance();
         $identity = $rcmail->user->get_identity();
         $identities_level = intval($rcmail->config->get('identities_level', 0));
         // compose user-identity dialog
         $table = new html_table(array('cols' => 2));
         $table->add('title', $this->gettext('name'));
         $table->add(null, html::tag('input', array('type' => 'text', 'name' => '_name', 'value' => $identity['name'])));
         $table->add('title', $this->gettext('email'));
         $table->add(null, html::tag('input', array('type' => 'text', 'name' => '_email', 'value' => idn_to_utf8($identity['email']), 'disabled' => $identities_level == 1 || $identities_level == 3)));
         // add overlay input box to html page
         $rcmail->output->add_footer(html::div(array('id' => 'newuseroverlay'), html::tag('form', array('action' => $rcmail->url('plugin.newusersave'), 'method' => 'post'), html::tag('h3', null, Q($this->gettext('identitydialogtitle'))) . html::p('hint', Q($this->gettext('identitydialoghint'))) . $table->show() . html::p(array('class' => 'formbuttons'), html::tag('input', array('type' => 'submit', 'class' => 'button mainaction', 'value' => $this->gettext('save')))))));
         // disable keyboard events for messages list (#1486726)
         $rcmail->output->add_script("\$(document).ready(function () {\n          rcmail.message_list.key_press = function(){};\n          rcmail.message_list.key_down = function(){};\n          \$('input[name=_name]').focus();\n          });", 'foot');
         $this->include_stylesheet('newuserdialog.css');
     }
 }
示例#5
0
 function gen_form()
 {
     $user = $this->rcmail_inst->user->get_prefs();
     $this->rcmail_inst->output->add_label('ispconfig3_forward.invalidaddress', 'ispconfig3_forward.forwardingempty');
     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']));
         $this->soap->logout($session_id);
     } catch (SoapFault $e) {
         $this->rcmail_inst->output->command('display_message', 'Soap Error: ' . $e->getMessage(), 'error');
     }
     $this->rcmail_inst->output->set_env('framed', TRUE);
     $out .= '<fieldset><legend>' . $this->gettext('acc_forward') . '</legend>' . "\n";
     $table = new html_table(array('cols' => 2, 'class' => 'propform'));
     $input_forwardingaddress = new html_inputfield(array('name' => '_forwardingaddress', 'id' => 'forwardingaddress', 'value' => $forward[1], 'maxlength' => 320, 'size' => 40));
     $table->add('title', rep_specialchars_output($this->gettext('forwardingaddress')));
     $table->add('', $input_forwardingaddress->show($mail_user[0]['cc']));
     $out .= $table->show();
     $out .= "</fieldset>\n";
     return $out;
 }
 function gen_form()
 {
     list($form_start, $form_end) = get_form_tags(null, 'plugin.changepasswd_AD.save');
     // return the complete form as table
     $out = $form_start;
     $table = new html_table(array('cols' => 2));
     // show old password field
     $field_id = 'rcmfd_curpwd';
     $input_curpasswd = new html_passwordfield(array('name' => '_curpasswd', 'id' => $field_id));
     $table->add('title', html::label($field_id, Q($this->gettext('curpasswd'))));
     $table->add(null, $input_curpasswd->show());
     // show new password field
     $field_id = 'rcmfd_newpwd';
     $input_newpasswd = new html_passwordfield(array('name' => '_newpasswd', 'id' => $field_id));
     $table->add('title', html::label($field_id, Q($this->gettext('newpasswd'))));
     $table->add(null, $input_newpasswd->show());
     // show new password confirm field
     $field_id = 'rcmfd_cnfpwd';
     $input_confpasswd = new html_passwordfield(array('name' => '_confpasswd', 'id' => $field_id));
     $table->add('title', html::label($field_id, Q($this->gettext('confpasswd'))));
     $table->add(null, $input_confpasswd->show());
     $out .= $table->show();
     $out .= $form_end;
     return $out;
 }
 function gen_form()
 {
     $user = $this->rcmail_inst->user->get_prefs();
     $this->rcmail_inst->output->add_label('ispconfig3_forward.invalidaddress', 'ispconfig3_forward.forwardingempty');
     $this->rcmail_inst->output->set_env('framed', true);
     $out .= '<fieldset><legend>' . $this->gettext('acc_forward') . '</legend>' . "\n";
     $table = new html_table(array('cols' => 2, 'class' => 'propform'));
     $input_forwardingaddress = new html_inputfield(array('name' => '_forwardingaddress', 'id' => 'forwardingaddress', 'value' => '', 'maxlength' => 320, 'size' => 40));
     $table->add('title', rep_specialchars_output($this->gettext('forwardingaddress')));
     $table->add('', $input_forwardingaddress->show());
     $out .= $table->show();
     $out .= "</fieldset>\n";
     return $out;
 }
示例#8
0
 function password_form()
 {
     $rcmail = rcmail::get_instance();
     // add some labels to client
     $rcmail->output->add_label('password.nopassword', 'password.nocurpassword', 'password.passwordinconsistency');
     $rcmail->output->set_env('product_name', $rcmail->config->get('product_name'));
     $table = new html_table(array('cols' => 2));
     if ($rcmail->config->get('password_confirm_current')) {
         // show current password selection
         $field_id = 'curpasswd';
         $input_curpasswd = new html_passwordfield(array('name' => '_curpasswd', 'id' => $field_id, 'size' => 20, 'autocomplete' => 'off'));
         $table->add('title', html::label($field_id, rcube::Q($this->gettext('curpasswd'))));
         $table->add(null, $input_curpasswd->show());
     }
     // show new password selection
     $field_id = 'newpasswd';
     $input_newpasswd = new html_passwordfield(array('name' => '_newpasswd', 'id' => $field_id, 'size' => 20, 'autocomplete' => 'off'));
     $table->add('title', html::label($field_id, rcube::Q($this->gettext('newpasswd'))));
     $table->add(null, $input_newpasswd->show());
     // show confirm password selection
     $field_id = 'confpasswd';
     $input_confpasswd = new html_passwordfield(array('name' => '_confpasswd', 'id' => $field_id, 'size' => 20, 'autocomplete' => 'off'));
     $table->add('title', html::label($field_id, rcube::Q($this->gettext('confpasswd'))));
     $table->add(null, $input_confpasswd->show());
     $rules = '';
     $required_length = intval($rcmail->config->get('password_minimum_length'));
     if ($required_length > 0) {
         $rules .= html::tag('li', array('id' => 'required-length'), $this->gettext(array('name' => 'passwordshort', 'vars' => array('length' => $required_length))));
     }
     if ($rcmail->config->get('password_require_nonalpha')) {
         $rules .= html::tag('li', array('id' => 'require-nonalpha'), $this->gettext('passwordweak'));
     }
     if (!empty($rules)) {
         $rules = html::tag('ul', array('id' => 'ruleslist'), $rules);
     }
     $out = html::div(array('class' => 'box'), html::div(array('id' => 'prefs-title', 'class' => 'boxtitle'), $this->gettext('changepasswd')) . html::div(array('class' => 'boxcontent'), $table->show() . $rules . html::p(null, $rcmail->output->button(array('command' => 'plugin.password-save', 'type' => 'input', 'class' => 'button mainaction', 'label' => 'save')))));
     $rcmail->output->add_gui_object('passform', 'password-form');
     return $rcmail->output->form_tag(array('id' => 'password-form', 'name' => 'password-form', 'method' => 'post', 'action' => './?_task=settings&_action=plugin.password-save'), $out);
 }
 /**
  * GUI object 'loginform'
  * Returns code for the webmail login form
  *
  * @param array Named parameters
  * @return string HTML code for the gui object
  */
 protected function login_form($attrib)
 {
     $default_host = $this->config->get('default_host');
     $autocomplete = (int) $this->config->get('login_autocomplete');
     $_SESSION['temp'] = true;
     // save original url
     $url = rcube_utils::get_input_value('_url', rcube_utils::INPUT_POST);
     if (empty($url) && !preg_match('/_(task|action)=logout/', $_SERVER['QUERY_STRING'])) {
         $url = $_SERVER['QUERY_STRING'];
     }
     // Disable autocapitalization on iPad/iPhone (#1488609)
     $attrib['autocapitalize'] = 'off';
     // set atocomplete attribute
     $user_attrib = $autocomplete > 0 ? array() : array('autocomplete' => 'off');
     $host_attrib = $autocomplete > 0 ? array() : array('autocomplete' => 'off');
     $pass_attrib = $autocomplete > 1 ? array() : array('autocomplete' => 'off');
     $input_task = new html_hiddenfield(array('name' => '_task', 'value' => 'login'));
     $input_action = new html_hiddenfield(array('name' => '_action', 'value' => 'login'));
     $input_tzone = new html_hiddenfield(array('name' => '_timezone', 'id' => 'rcmlogintz', 'value' => '_default_'));
     $input_url = new html_hiddenfield(array('name' => '_url', 'id' => 'rcmloginurl', 'value' => $url));
     $input_user = new html_inputfield(array('name' => '_user', 'id' => 'rcmloginuser', 'required' => 'required') + $attrib + $user_attrib);
     $input_pass = new html_passwordfield(array('name' => '_pass', 'id' => 'rcmloginpwd', 'required' => 'required') + $attrib + $pass_attrib);
     $input_host = null;
     if (is_array($default_host) && count($default_host) > 1) {
         $input_host = new html_select(array('name' => '_host', 'id' => 'rcmloginhost'));
         foreach ($default_host as $key => $value) {
             if (!is_array($value)) {
                 $input_host->add($value, is_numeric($key) ? $value : $key);
             } else {
                 $input_host = null;
                 break;
             }
         }
     } else {
         if (is_array($default_host) && ($host = key($default_host)) !== null) {
             $hide_host = true;
             $input_host = new html_hiddenfield(array('name' => '_host', 'id' => 'rcmloginhost', 'value' => is_numeric($host) ? $default_host[$host] : $host) + $attrib);
         } else {
             if (empty($default_host)) {
                 $input_host = new html_inputfield(array('name' => '_host', 'id' => 'rcmloginhost') + $attrib + $host_attrib);
             }
         }
     }
     $form_name = !empty($attrib['form']) ? $attrib['form'] : 'form';
     $this->add_gui_object('loginform', $form_name);
     // create HTML table with two cols
     $table = new html_table(array('cols' => 2));
     $table->add('title', html::label('rcmloginuser', html::quote($this->app->gettext('username'))));
     $table->add('input', $input_user->show('mail@box'));
     $table->add('title', html::label('rcmloginpwd', html::quote($this->app->gettext('password'))));
     $table->add('input', $input_pass->show());
     // add host selection row
     if (is_object($input_host) && !$hide_host) {
         $table->add('title', html::label('rcmloginhost', html::quote($this->app->gettext('server'))));
         $table->add('input', $input_host->show(rcube_utils::get_input_value('_host', rcube_utils::INPUT_GPC)));
     }
     $out = $input_task->show();
     $out .= $input_action->show();
     $out .= $input_tzone->show();
     $out .= $input_url->show();
     $out .= $table->show();
     if ($hide_host) {
         $out .= $input_host->show();
     }
     if (rcube_utils::get_boolean($attrib['submit'])) {
         $submit = new html_inputfield(array('type' => 'submit', 'id' => 'rcmloginsubmit', 'class' => 'button mainaction', 'value' => $this->app->gettext('login')));
         $out .= html::p('formbuttons', $submit->show());
     }
     // surround html output with a form tag
     if (empty($attrib['form'])) {
         $out = $this->form_tag(array('name' => $form_name, 'method' => 'post'), $out);
     }
     // include script for timezone detection
     $this->include_script('jstz.min.js');
     return $out;
 }
示例#10
0
 /**
  *
  */
 public function attachment_header($attrib = array())
 {
     $rcmail = rcmail::get_instance();
     $dl_link = strtolower($attrib['downloadlink']) == 'true';
     $dl_url = $this->rc->url(array('_frame' => null, '_download' => 1) + $_GET);
     $table = new html_table(array('cols' => $dl_link ? 3 : 2));
     if (!empty($this->attachment['name'])) {
         $table->add('title', rcube::Q($this->rc->gettext('filename')));
         $table->add('header', rcube::Q($this->attachment['name']));
         if ($dl_link) {
             $table->add('download-link', html::a($dl_url, rcube::Q($this->rc->gettext('download'))));
         }
     }
     if (!empty($this->attachment['mimetype'])) {
         $table->add('title', rcube::Q($this->rc->gettext('type')));
         $table->add('header', rcube::Q($this->attachment['mimetype']));
     }
     if (!empty($this->attachment['size'])) {
         $table->add('title', rcube::Q($this->rc->gettext('filesize')));
         $table->add('header', rcube::Q($this->rc->show_bytes($this->attachment['size'])));
     }
     $this->rc->output->set_env('attachment_download_url', $dl_url);
     return $table->show($attrib);
 }
示例#11
0
 /**
  * Init compose UI (add task button and the menu)
  */
 private function compose_ui()
 {
     $this->add_css();
     // Options menu button
     $this->enigma->add_button(array('type' => 'link', 'command' => 'plugin.enigma', 'onclick' => "rcmail.command('menu-open', 'enigmamenu', event.target, event)", 'class' => 'button enigma', 'title' => 'encryptionoptions', 'label' => 'encryption', 'domain' => $this->enigma->ID, 'width' => 32, 'height' => 32), 'toolbar');
     $menu = new html_table(array('cols' => 2));
     $chbox = new html_checkbox(array('value' => 1));
     $menu->add(null, html::label(array('for' => 'enigmasignopt'), rcube::Q($this->enigma->gettext('signmsg'))));
     $menu->add(null, $chbox->show($this->rc->config->get('enigma_sign_all') ? 1 : 0, array('name' => '_enigma_sign', 'id' => 'enigmasignopt')));
     $menu->add(null, html::label(array('for' => 'enigmaencryptopt'), rcube::Q($this->enigma->gettext('encryptmsg'))));
     $menu->add(null, $chbox->show($this->rc->config->get('enigma_encrypt_all') ? 1 : 0, array('name' => '_enigma_encrypt', 'id' => 'enigmaencryptopt')));
     $menu = html::div(array('id' => 'enigmamenu', 'class' => 'popupmenu'), $menu->show());
     // Options menu contents
     $this->rc->output->add_footer($menu);
 }
示例#12
0
 /**
  * Create a HTML table based on the given data
  *
  * @param  array  Named table attributes
  * @param  mixed  Table row data. Either a two-dimensional array or a valid SQL result set
  * @param  array  List of cols to show
  * @param  string Name of the identifier col
  *
  * @return string HTML table code
  */
 public function table_output($attrib, $table_data, $a_show_cols, $id_col)
 {
     $table = new html_table();
     // add table header
     if (!$attrib['noheader']) {
         foreach ($a_show_cols as $col) {
             $table->add_header($col, $this->Q($this->gettext($col)));
         }
     }
     if (!is_array($table_data)) {
         $db = $this->get_dbh();
         while ($table_data && ($sql_arr = $db->fetch_assoc($table_data))) {
             $table->add_row(array('id' => 'rcmrow' . rcube_utils::html_identifier($sql_arr[$id_col])));
             // format each col
             foreach ($a_show_cols as $col) {
                 $table->add($col, $this->Q($sql_arr[$col]));
             }
         }
     } else {
         foreach ($table_data as $row_data) {
             $class = !empty($row_data['class']) ? $row_data['class'] : '';
             $rowid = 'rcmrow' . rcube_utils::html_identifier($row_data[$id_col]);
             $table->add_row(array('id' => $rowid, 'class' => $class));
             // format each col
             foreach ($a_show_cols as $col) {
                 $table->add($col, $this->Q(is_array($row_data[$col]) ? $row_data[$col][0] : $row_data[$col]));
             }
         }
     }
     return $table->show($attrib);
 }
示例#13
0
 /**
  * Render event details in a table
  */
 function event_details_table($event, $title)
 {
     $table = new html_table(array('cols' => 2, 'border' => 0, 'class' => 'calendar-eventdetails'));
     $table->add('ititle', $title);
     $table->add('title', Q($event['title']));
     $table->add('label', $this->cal->gettext('date'));
     $table->add('location', Q($this->cal->lib->event_date_text($event)));
     if ($event['location']) {
         $table->add('label', $this->cal->gettext('location'));
         $table->add('location', Q($event['location']));
     }
     return $table->show();
 }
 protected function _vacation_table($ext, $rowid, $defaults, $display, $help_icon)
 {
     $rcmail = rcube::get_instance();
     // begin vacation action
     $vacs_table = new html_table(array('class' => 'records-table', 'cellspacing' => '0', 'cols' => 3, 'style' => $defaults['method'] == 'vacation' ? '' : 'display: none;'));
     $to_addresses = "";
     $vacto_arr = explode(",", $defaults['vacto']);
     $field_id_vacfrom = 'rcmfd_sievevacfrom_' . $rowid;
     $field_id_vacto = 'rcmfd_sievevacto_' . $rowid;
     if (count($this->identities)) {
         $select_id = new html_select(array('id' => $field_id_vacfrom, 'name' => "_vacfrom[]", 'class' => 'short', 'onchange' => rcmail_output::JS_OBJECT_NAME . '.enable_sig(this);'));
         if ($this->show_vacfrom && in_array('variables', $ext)) {
             $select_id->add($this->gettext('autodetect'), "auto");
         } elseif (!$this->show_vacfrom) {
             $select_id->add($this->gettext('autodetect'), "");
         }
         foreach ($this->identities as $sql_arr) {
             // find currently selected from address
             if ($defaults['vacfrom'] != '' && $defaults['vacfrom'] == rcmail::Q($sql_arr['from']['string'])) {
                 $defaults['vacfrom'] = $sql_arr['identity_id'];
             } elseif ($defaults['vacfrom'] != '' && $defaults['vacfrom'] == $sql_arr['from']['mailto']) {
                 $defaults['vacfrom'] = $sql_arr['identity_id'];
             }
             $select_id->add($sql_arr['from']['disp_string'], $sql_arr['identity_id']);
             $ffield_id = 'rcmfd_vac_' . $rowid . '_' . $sql_arr['identity_id'];
             if ($this->force_vacto) {
                 $curaddress = $sql_arr['email'];
                 $defaults['vacto'] .= (!empty($defaults['vacto']) ? ',' : '') . $sql_arr['email'];
             } else {
                 $curaddress = in_array($sql_arr['email'], $vacto_arr) ? $sql_arr['email'] : "";
             }
             $input_address = new html_checkbox(array('id' => $ffield_id, 'name' => '_vacto_check_' . $rowid . '[]', 'value' => $sql_arr['email'], 'onclick' => rcmail_output::JS_OBJECT_NAME . '.sieverules_toggle_vac_to(this, ' . $rowid . ')', 'class' => 'checkbox'));
             $to_addresses .= $input_address->show($curaddress) . "&nbsp;" . html::label($ffield_id, rcmail::Q($sql_arr['email'])) . "<br />";
         }
     }
     // deduplicate vacto list
     $tmparr = explode(",", $defaults['vacto']);
     $tmparr = array_unique($tmparr);
     $defaults['vacto'] = implode(",", $tmparr);
     if ($rcmail->config->get('sieverules_limit_vacto', true) && strlen($to_addresses) > 0) {
         $vacfrom_input = $select_id->show($defaults['vacfrom']);
         $input_vacto = new html_hiddenfield(array('id' => $field_id_vacto, 'name' => '_vacto[]', 'value' => $defaults['vacto']));
         $vacto_input = $to_addresses . $input_vacto->show();
         $vac_help = $this->gettext('vactoexp');
     } else {
         $input_vacfrom = new html_inputfield(array('id' => $field_id_vacfrom, 'name' => '_vacfrom[]'));
         $vacfrom_input = $input_vacfrom->show($defaults['vacfrom']);
         $input_vacto = new html_inputfield(array('id' => $field_id_vacto, 'name' => '_vacto[]', 'class' => 'short'));
         $vacto_input = $input_vacto->show($defaults['vacto']);
         $vac_help = $this->gettext('vactoexp') . '<br /><br />' . $this->gettext('vactoexp_adv');
     }
     // from param
     $vacs_table->set_row_attribs(array('class' => $this->show_vacfrom ? 'advanced' : 'disabled', 'style' => $display['vacfrom']));
     $vacs_table->add(null, html::label($field_id_vacfrom, rcmail::Q($this->gettext('from'))));
     $vacs_table->add(null, $vacfrom_input);
     $sig_button = $this->api->output->button(array('command' => 'plugin.sieverules.vacation_sig', 'prop' => $rowid, 'type' => 'link', 'class' => 'vacsig', 'classact' => 'vacsig_act', 'title' => 'insertsignature', 'content' => ' '));
     $vacs_table->add(null, $sig_button);
     // to param
     $vacs_table->set_row_attribs(array('class' => 'advanced', 'style' => $display['vacadv']));
     $vacs_table->add(array('style' => 'vertical-align: top;'), html::label($field_id_vacto, rcmail::Q($this->gettext('sieveto'))));
     $vacs_table->add(null, $vacto_input);
     $help_button = html::a(array('href' => "#", 'onclick' => 'return ' . rcmail_output::JS_OBJECT_NAME . '.sieverules_help(this, ' . $vacs_table->size() . ');', 'title' => $this->gettext('messagehelp')), $help_icon);
     $vacs_table->add(array('style' => 'vertical-align: top;'), $help_button);
     $vacs_table->set_row_attribs(array('class' => 'advhelp', 'style' => 'display: none;'));
     $vacs_table->add(array('colspan' => 3, 'class' => 'helpmsg'), $vac_help);
     $field_id = 'rcmfd_sievevacperiod_' . $rowid;
     $input_period = new html_inputfield(array('id' => $field_id, 'name' => '_period[]', 'class' => 'short'));
     $vacs_table->set_row_attribs(array('class' => 'advanced', 'style' => $display['vacadv']));
     $vacs_table->add(null, html::label($field_id, rcmail::Q($this->gettext('period'))));
     $vacs_table->add(null, $input_period->show($defaults['period']));
     $help_button = html::a(array('href' => "#", 'onclick' => 'return ' . rcmail_output::JS_OBJECT_NAME . '.sieverules_help(this, ' . (in_array('vacation-seconds', $ext) ? $vacs_table->size() + 1 : $vacs_table->size()) . ');', 'title' => $this->gettext('messagehelp')), $help_icon);
     $vacs_table->add(null, $help_button);
     if (in_array('vacation-seconds', $ext)) {
         $input_periodtype = new html_radiobutton(array('id' => $field_id . '_days', 'name' => '_period_radio_' . $rowid, 'value' => 'days', 'onclick' => rcmail_output::JS_OBJECT_NAME . '.sieverules_period_type(this, ' . $rowid . ')', 'class' => 'radio'));
         $period_type_show = $input_periodtype->show($defaults['periodtype']) . "&nbsp;" . html::label($field_id . '_days', rcmail::Q($this->gettext('days')));
         $input_periodtype = new html_radiobutton(array('id' => $field_id . '_seconds', 'name' => '_period_radio_' . $rowid, 'value' => 'seconds', 'onclick' => rcmail_output::JS_OBJECT_NAME . '.sieverules_period_type(this, ' . $rowid . ')', 'class' => 'radio'));
         $period_type_show .= '&nbsp;&nbsp;' . $input_periodtype->show($defaults['periodtype']) . "&nbsp;" . html::label($field_id . '_seconds', rcmail::Q($this->gettext('seconds')));
         $input_periodtype = new html_hiddenfield(array('id' => 'rcmfd_sievevacperiodtype_' . $rowid, 'name' => '_periodtype[]'));
         $vacs_table->set_row_attribs(array('class' => 'advanced', 'style' => $display['vacadv']));
         $vacs_table->add(null, '&nbsp;');
         $vacs_table->add(null, $period_type_show . $input_periodtype->show($defaults['periodtype']));
         $vacs_table->add(null, '&nbsp;');
     }
     $vacs_table->set_row_attribs(array('style' => 'display: none;'));
     $vacs_table->add(array('colspan' => 3, 'class' => 'helpmsg'), $this->gettext('vacperiodexp'));
     $field_id = 'rcmfd_sievevachandle_' . $rowid;
     $input_handle = new html_inputfield(array('id' => $field_id, 'name' => '_handle[]', 'class' => 'short'));
     $vacs_table->set_row_attribs(array('class' => $this->show_vachandle ? 'advanced' : 'disabled', 'style' => $display['vachandle']));
     $vacs_table->add(null, html::label($field_id, rcmail::Q($this->gettext('sievevachandle'))));
     $vacs_table->add(null, $input_handle->show($defaults['handle']));
     $help_button = html::a(array('href' => "#", 'onclick' => 'return ' . rcmail_output::JS_OBJECT_NAME . '.sieverules_help(this, ' . $vacs_table->size() . ');', 'title' => $this->gettext('messagehelp')), $help_icon);
     $vacs_table->add(null, $help_button);
     $vacs_table->set_row_attribs(array('class' => 'advhelp', 'style' => 'display: none;'));
     $vacs_table->add(array('colspan' => 3, 'class' => 'helpmsg'), $this->gettext('vachandleexp'));
     $field_id = 'rcmfd_sievevacsubject_' . $rowid;
     $input_subject = new html_inputfield(array('id' => $field_id, 'name' => '_subject[]'));
     $vacs_table->add(null, html::label($field_id, rcmail::Q($this->gettext('subject'))));
     $vacs_table->add(array('colspan' => 2), $input_subject->show($defaults['subject']));
     if (in_array('variables', $ext)) {
         $field_id = 'rcmfd_sievevacsubject_orig_' . $rowid;
         $input_origsubject = new html_checkbox(array('id' => $field_id, 'value' => '1', 'onclick' => rcmail_output::JS_OBJECT_NAME . '.sieverules_toggle_vac_osubj(this, ' . $rowid . ')', 'class' => 'checkbox'));
         $input_vacosubj = new html_hiddenfield(array('id' => 'rcmfd_sievevactoh_' . $rowid, 'name' => '_orig_subject[]', 'value' => $defaults['origsubject']));
         $vacs_table->add(null, '&nbsp;');
         $vacs_table->add(array('colspan' => 2), $input_origsubject->show($defaults['origsubject']) . "&nbsp;" . html::label($field_id, rcmail::Q($this->gettext('sieveorigsubj'))) . $input_vacosubj->show());
     }
     $field_id = 'rcmfd_sievevacmag_' . $rowid;
     $input_msg = new html_textarea(array('id' => $field_id, 'name' => '_msg[]', 'rows' => '8', 'cols' => '40', 'class' => $defaults['htmlmsg'] == 1 ? 'mce_editor' : '', 'is_escaped' => $defaults['htmlmsg'] == 1 ? true : null));
     $input_html = new html_checkbox(array('id' => 'rcmfd_sievevachtmlcb_' . $rowid, 'onclick' => rcmail_output::JS_OBJECT_NAME . '.sieverules_toggle_vac_html(this, ' . $rowid . ', \'' . $field_id . '\');', 'value' => '1', 'class' => 'checkbox'));
     $input_htmlhd = new html_hiddenfield(array('id' => 'rcmfd_sievevachtmlhd_' . $rowid, 'name' => '_htmlmsg[]', 'value' => $defaults['htmlmsg']));
     $vacs_table->add('msg', html::label($field_id, rcmail::Q($this->gettext('message'))));
     $vacs_table->add(array('colspan' => 2), $input_msg->show($defaults['msg']) . html::tag('div', in_array('htmleditor', $rcmail->config->get('dont_override')) ? array('style' => 'display: none;') : null, $input_html->show($defaults['htmlmsg']) . "&nbsp;" . html::label('rcmfd_sievevachtmlcb_' . $rowid, rcmail::Q($this->gettext('htmlmessage')))) . $input_htmlhd->show());
     $field_id = 'rcmfd_sievecharset_' . $rowid;
     $vacs_table->set_row_attribs(array('class' => 'advanced', 'style' => $display['vacadv']));
     $vacs_table->add(null, html::label($field_id, rcmail::Q($this->gettext('charset'))));
     $vacs_table->add(array('colspan' => 2), $rcmail->output->charset_selector(array('id' => $field_id, 'name' => '_vaccharset[]', 'selected' => $defaults['charset'])));
     $input_advopts = new html_checkbox(array('id' => 'vadvopts' . $rowid, 'name' => '_vadv_opts[]', 'onclick' => rcmail_output::JS_OBJECT_NAME . '.sieverules_show_adv(this);', 'value' => '1', 'class' => 'checkbox'));
     $vacs_table->add(array('colspan' => '3', 'style' => 'text-align: right'), html::label('vadvopts' . $rowid, rcmail::Q($this->gettext('advancedoptions'))) . $input_advopts->show($display['vacadv'] == '' ? 1 : 0));
     return $vacs_table;
 }
 function veximaccountadmin_form()
 {
     $rcmail = rcmail::get_instance();
     $this->_load_config();
     // add labels to client - to be used in JS alerts
     $rcmail->output->add_label('veximaccountadmin.enterallpassfields', 'veximaccountadmin.passwordinconsistency', 'veximaccountadmin.autoresponderlong', 'veximaccountadmin.autoresponderlongnum', 'veximaccountadmin.autoresponderlongmax', 'veximaccountadmin.headerblockdelete', 'veximaccountadmin.headerblockdeleteall', 'veximaccountadmin.headerblockexists', 'veximaccountadmin.headerblockentervalue');
     $rcmail->output->set_env('product_name', $rcmail->config->get('product_name'));
     $settings = $this->_get_configuration();
     $on_avscan = $settings['on_avscan'];
     $on_spamassassin = $settings['on_spamassassin'];
     $sa_tag = $settings['sa_tag'];
     $sa_refuse = $settings['sa_refuse'];
     $spam_drop = $settings['spam_drop'];
     $on_vacation = $settings['on_vacation'];
     $vacation = $settings['vacation'];
     $on_forward = $settings['on_forward'];
     $forward = $settings['forward'];
     $unseen = $settings['unseen'];
     $maxmsgsize = $settings['maxmsgsize'];
     $user_id = $settings['user_id'];
     $domain_id = $settings['domain_id'];
     $domain_settings = $this->_get_domain_configuration($domain_id);
     $default_sa_tag = $domain_settings['sa_tag'];
     $default_sa_refuse = $domain_settings['sa_refuse'];
     $default_maxmsgsize = $domain_settings['maxmsgsize'];
     $active_domain = $domain_settings['domain'];
     $rcmail->output->set_env('vacation_maxlength', $this->config['vexim_vacation_maxlength']);
     $out .= '<p class="introtext">' . $this->gettext('introtext') . '</p>' . "\n";
     if ($this->config['show_admin_link'] == true and $settings['admin'] == true) {
         $out .= '<p class="adminlink">';
         $out .= sprintf($this->gettext('adminlinktext'), '<a href="' . $this->config['vexim_url'] . '" target="_blank">', '</a>');
         $out .= "</p>\n";
     }
     // =====================================================================================================
     // Password
     $out .= '<fieldset><legend>' . $this->gettext('password') . '</legend>' . "\n";
     $out .= '<div class="fieldset-content">';
     $out .= '<p>' . $this->gettext('passwordcurrentexplanation') . '</p>';
     $out .= '<table class="vexim-settings" cellpadding="0" cellspacing="0">';
     $field_id = 'curpasswd';
     $input_passwordcurrent = new html_passwordfield(array('name' => '_curpasswd', 'id' => $field_id, 'class' => 'text-long', 'autocomplete' => 'off'));
     $out .= sprintf("<tr><th><label for=\"%s\">%s</label>:</th><td>%s%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('passwordcurrent')), $input_passwordcurrent->show(), '');
     $field_id = 'newpasswd';
     $input_passwordnew = new html_passwordfield(array('name' => '_newpasswd', 'id' => $field_id, 'class' => 'text-long', 'autocomplete' => 'off'));
     $out .= sprintf("<tr><th><label for=\"%s\">%s</label>:</th><td>%s%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('passwordnew')), $input_passwordnew->show(), '');
     $field_id = 'confpasswd';
     $input_passwordconf = new html_passwordfield(array('name' => '_confpasswd', 'id' => $field_id, 'class' => 'text-long', 'autocomplete' => 'off'));
     $out .= sprintf("<tr><th><label for=\"%s\">%s</label>:</th><td>%s%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('passwordconfirm')), $input_passwordconf->show(), '');
     $out .= '</table>';
     $out .= '</div></fieldset>' . "\n\n";
     // =====================================================================================================
     // Spam/Virus
     $out .= '<fieldset><legend>' . $this->gettext('spamvirus') . '</legend>' . "\n";
     $out .= '<div class="fieldset-content">';
     $out .= '<table class="vexim-settings" cellpadding="0" cellspacing="0">';
     $field_id = 'on_avscan';
     $input_virusenabled = new html_checkbox(array('name' => 'on_avscan', 'id' => $field_id, 'value' => 1));
     $out .= sprintf("<tr><th><label for=\"%s\">%s</label>:</th><td>%s%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('virusenabled')), $input_virusenabled->show($on_avscan ? 1 : 0), '<br /><span class="vexim-explanation">' . $this->gettext('virusenabledexplanation') . '</span>');
     $field_id = 'on_spamassassin';
     $input_spamenabled = new html_checkbox(array('name' => 'on_spamassassin', 'id' => $field_id, 'value' => 1));
     $out .= sprintf("<tr><th><label for=\"%s\">%s</label>:</th><td>%s%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('spamenabled')), $input_spamenabled->show($on_spamassassin ? 1 : 0), '<br /><span class="vexim-explanation">' . $this->gettext('spamenabledexplanation') . '</span>');
     $field_id = 'sa_tag';
     $input_spamscoretag = new html_select(array('name' => 'sa_tag', 'id' => $field_id, 'class' => 'select'));
     $decPlaces = 0;
     $found_number = false;
     for ($i = 1; $i <= 20; $i = $i + 1) {
         $i = number_format($i, $decPlaces);
         $input_spamscoretag->add($i, $i);
         if ($sa_tag == $i) {
             $found_number = true;
         }
     }
     for ($i = 25; $i <= 100; $i = $i + 5) {
         $i = number_format($i, $decPlaces);
         $input_spamscoretag->add($i, $i);
         if ($sa_tag == $i) {
             $found_number = true;
         }
     }
     // If the value from database cannot be choosed among the list we present,
     // add it to the end of the list. This may happen because Vexim lets the
     // user write in a number in a textbox.
     if (!$found_number) {
         $input_spamscoretag->add($sa_tag, $sa_tag);
     }
     $out .= sprintf("<tr><th><label for=\"%s\">%s</label>:</th><td>%s%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('spamscoretag')), $input_spamscoretag->show($sa_tag), '<br /><span class="vexim-explanation">' . $this->gettext('spamscoretagexplanation') . '. <span class="sameline">' . $this->gettext('domaindefault') . ': ' . $default_sa_tag . '.</span></span>');
     $field_id = 'sa_refuse';
     $input_spamscorerefuse = new html_select(array('name' => 'sa_refuse', 'id' => $field_id, 'class' => 'select'));
     $found_number = false;
     for ($i = 1; $i <= 20; $i = $i + 1) {
         $i = number_format($i, $decPlaces);
         $input_spamscorerefuse->add($i, $i);
         if ($sa_refuse == $i) {
             $found_number = true;
         }
     }
     for ($i = 25; $i <= 200; $i = $i + 5) {
         $i = number_format($i, $decPlaces);
         $input_spamscorerefuse->add($i, $i);
         if ($sa_refuse == $i) {
             $found_number = true;
         }
     }
     for ($i = 300; $i <= 900; $i = $i + 100) {
         $i = number_format($i, $decPlaces);
         $input_spamscorerefuse->add($i, $i);
         if ($sa_refuse == $i) {
             $found_number = true;
         }
     }
     $i = number_format(999, $decPlaces);
     $input_spamscorerefuse->add($i, $i);
     if ($sa_refuse == $i) {
         $found_number = true;
     }
     // If the value from database cannot be choosed among the list we present,
     // add it to the end of the list. This may happen because Vexim lets the
     // user write in a number in a textbox.
     if (!$found_number) {
         $input_spamscorerefuse->add($sa_refuse, $sa_refuse);
     }
     $out .= sprintf("<tr><th><label for=\"%s\">%s</label>:</th><td>%s%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('spamscorerefuse')), $input_spamscorerefuse->show($sa_refuse), '<br /><span class="vexim-explanation">' . $this->gettext('spamscorerefuseexplanation') . '. <span class="sameline">' . $this->gettext('domaindefault') . ': ' . $default_sa_refuse . '.</span></span>');
     $spammoveexplanation = '<br /><span class="vexim-explanation">' . str_replace("%italicstart", "<i>", str_replace("%italicend", "</i>", $this->gettext('spammoveexplanation_part1')));
     if ($this->config['parsefolders_script']) {
         $spammoveexplanation .= ' ' . $this->gettext('spammoveexplanation_part2');
     }
     $spammoveexplanation .= ' ' . $this->gettext('spammoveexplanation_part3');
     $field_id = 'spam_drop';
     $input_spammove = new html_checkbox(array('name' => 'spam_drop', 'id' => $field_id, 'value' => 1));
     $out .= sprintf("<tr><th><label for=\"%s\">%s</label>:</th><td>%s%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('spammove')), $input_spammove->show($spam_drop ? 1 : 0), $spammoveexplanation);
     $out .= '</table>';
     if ($this->config['parsefolders_script'] and $this->config['parsefolders_script_show_tip']) {
         $out .= '<p class="vexim-explanation">' . str_replace('%italicstart', '<i>', str_replace('%italicend', '</i>', $this->gettext('spamtip'))) . '</p>';
     }
     $out .= '</div></fieldset>' . "\n\n";
     // =====================================================================================================
     // Autoresponder
     $out .= '<fieldset><legend>' . $this->gettext('autoresponder') . '</legend>' . "\n";
     $out .= '<div class="fieldset-content">';
     $out .= '<table class="vexim-settings" cellpadding="0" cellspacing="0">';
     $field_id = 'on_vacation';
     $input_autoresponderenabled = new html_checkbox(array('name' => 'on_vacation', 'id' => $field_id, 'value' => 1));
     $out .= sprintf("<tr><th><label for=\"%s\">%s</label>:</th><td>%s%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('autoresponderenabled')), $input_autoresponderenabled->show($on_vacation ? 1 : 0), '');
     $field_id = 'vacation';
     $input_autorespondermessage = new html_textarea(array('name' => 'vacation', 'id' => $field_id, 'class' => 'textarea'));
     $out .= sprintf("<tr><th><label for=\"%s\">%s</label>:</th><td>%s%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('autorespondermessage')), $input_autorespondermessage->show($vacation), '<br /><span class="vexim-explanation">' . $this->gettext('autorespondermessageexplanation') . '</span>');
     $out .= '</table>';
     $out .= '</div></fieldset>' . "\n\n";
     // =====================================================================================================
     // Forward
     $out .= '<fieldset><legend>' . $this->gettext('forwarding') . '</legend>' . "\n";
     $out .= '<div class="fieldset-content">';
     $out .= '<table class="vexim-settings" cellpadding="0" cellspacing="0">';
     $field_id = 'on_forward';
     $input_forwardingenabled = new html_checkbox(array('name' => 'on_forward', 'id' => $field_id, 'value' => 1));
     $out .= sprintf("<tr><th><label for=\"%s\">%s</label>:</th><td>%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('forwardingenabled')), $input_forwardingenabled->show($on_forward ? 1 : 0));
     $field_id = 'forward';
     $input_forwardingaddress = new html_inputfield(array('name' => 'forward', 'id' => $field_id, 'maxlength' => 255, 'class' => 'text-long'));
     $out .= sprintf("<tr><th><label for=\"%s\">%s</label>:</th><td>%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('forwardingaddress')), $input_forwardingaddress->show($forward));
     $field_id = 'unseen';
     $input_forwardinglocal = new html_checkbox(array('name' => 'unseen', 'id' => $field_id, 'value' => 1));
     $out .= sprintf("<tr><th><label for=\"%s\">%s</label>:</th><td>%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('forwardinglocal')), $input_forwardinglocal->show($unseen ? 1 : 0));
     $out .= '</table>';
     $out .= '</div></fieldset>' . "\n\n";
     // =====================================================================================================
     // Header blocks (based on code from Philip Weir's sauserprefs plugin
     //                http://roundcube.net/plugins/sauserprefs)
     $out .= '<fieldset><legend>' . $this->gettext('blockbyheader') . '</legend>' . "\n";
     $out .= '<div class="fieldset-content">';
     $out .= '<p>' . $this->gettext('blockbyheaderexplanation') . '</p>';
     $table = new html_table(array('class' => 'headerblockprefstable', 'cols' => 3));
     $field_id = 'rcmfd_headerblockrule';
     $input_headerblockrule = new html_select(array('name' => '_headerblockrule', 'id' => $field_id));
     $input_headerblockrule->add($this->gettext('headerfrom'), 'From');
     $input_headerblockrule->add($this->gettext('headerto'), 'To');
     $input_headerblockrule->add($this->gettext('headersubject'), 'Subject');
     $input_headerblockrule->add($this->gettext('headerxmailer'), 'X-Mailer');
     $field_id = 'rcmfd_headerblockvalue';
     $input_headerblockvalue = new html_inputfield(array('name' => '_headerblockvalue', 'id' => $field_id, 'style' => 'width:270px;'));
     $field_id = 'rcmbtn_add_address';
     $button_addaddress = $this->api->output->button(array('command' => 'plugin.veximaccountadmin.headerblock_add', 'type' => 'input', 'class' => 'button', 'label' => 'veximaccountadmin.addrule', 'style' => 'width: 130px;'));
     $table->add(null, $input_headerblockrule->show());
     $table->add(null, $input_headerblockvalue->show());
     $table->add(array('align' => 'right'), $button_addaddress);
     $delete_all = $this->api->output->button(array('command' => 'plugin.veximaccountadmin.headerblock_delete_all', 'type' => 'link', 'label' => 'veximaccountadmin.deleteall'));
     $table->add(array('colspan' => 3, 'id' => 'listcontrols'), $delete_all);
     $table->add_row();
     $address_table = new html_table(array('id' => 'headerblock-rules-table', 'class' => 'records-table', 'cellspacing' => '0', 'cols' => 3));
     $address_table->add_header(array('width' => '120px'), $this->gettext('field'));
     $address_table->add_header(null, $this->gettext('value'));
     $address_table->add_header(array('width' => '40px'), '&nbsp;');
     $this->_address_row($address_table, null, null, $attrib);
     // Get the header rules from DB. Should probably be put in a function.
     $this->_load_config();
     $this->_db_connect('r');
     $sql_result = $this->db->query("SELECT blockhdr, blockval \r\n\t\t   FROM   blocklists\r\n\t\t   WHERE  user_id = '{$user_id}'\r\n\t\t   AND    domain_id = '{$domain_id}'\r\n\t\t   ORDER BY block_id;");
     if ($sql_result && $this->db->num_rows($sql_result) > 0) {
         $norules = 'display: none;';
     }
     $address_table->set_row_attribs(array('style' => $norules));
     $address_table->add(array('colspan' => '3'), rep_specialchars_output($this->gettext('noaddressrules')));
     $address_table->add_row();
     $this->api->output->set_env('address_rule_count', $this->db->num_rows());
     while ($sql_result && ($sql_arr = $this->db->fetch_assoc($sql_result))) {
         $field = $sql_arr['blockhdr'];
         $value = $sql_arr['blockval'];
         $this->_address_row($address_table, $field, $value, $attrib);
     }
     $table->add(array('colspan' => 3), html::div(array('id' => 'headerblock-rules-cont'), $address_table->show()));
     $table->add_row();
     if ($table->size()) {
         $out .= $table->show();
     }
     $out .= '</div></fieldset>' . "\n\n";
     // =====================================================================================================
     // Parameters
     $out .= '<fieldset><legend>' . $this->gettext('parameters') . '</legend>' . "\n";
     $out .= '<div class="fieldset-content">';
     $out .= '<table class="vexim-settings" cellpadding="0" cellspacing="0">';
     $field_id = 'maxmsgsize';
     $input_messagesize = new html_inputfield(array('name' => 'maxmsgsize', 'id' => $field_id, 'maxlength' => 3, 'size' => 4));
     if ($default_maxmsgsize == 0) {
         $default_maxmsgsize = $this->gettext('unlimited');
     } else {
         $default_maxmsgsize = $default_maxmsgsize . ' kb';
     }
     $out .= sprintf("<tr><th><label for=\"%s\">%s</label>:</th><td>%s%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('messagesize')), $input_messagesize->show($maxmsgsize), '<br /><span class="vexim-explanation">' . str_replace('%d', $active_domain, str_replace('%m', $default_maxmsgsize, $this->gettext('messagesizeexplanation'))) . '</span>');
     $out .= '</table>';
     $out .= '</div></fieldset>' . "\n\n";
     // =====================================================================================================
     $out .= html::p(null, $rcmail->output->button(array('command' => 'plugin.veximaccountadmin-save', 'type' => 'input', 'class' => 'button mainaction', 'label' => 'save')));
     $rcmail->output->add_gui_object('veximform', 'veximaccountadminform');
     $out = $rcmail->output->form_tag(array('id' => 'veximaccountadminform', 'name' => 'veximaccountadminform', 'method' => 'post', 'action' => './?_task=settings&_action=plugin.veximaccountadmin-save'), $out);
     $out = html::div(array('class' => 'settingsbox', 'style' => 'margin:0 0 15px 0;'), html::div(array('class' => 'boxtitle'), $this->gettext('accountadministration')) . html::div(array('style' => 'padding:15px'), $outtop . "\n" . $out . "\n" . $outbottom));
     return $out;
 }
 /**
  * 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;
 }
示例#17
0
 function infohtml()
 {
     $rcmail = rcmail::get_instance();
     $user = $rcmail->user;
     $table = new html_table(array('cols' => 2, 'cellpadding' => 3));
     $table->add('title', 'ID');
     $table->add('', Q($user->ID));
     $table->add('title', Q($this->gettext('username')));
     $table->add('', Q($user->data['username']));
     $table->add('title', Q($this->gettext('server')));
     $table->add('', Q($user->data['mail_host']));
     $table->add('title', Q($this->gettext('created')));
     $table->add('', Q($user->data['created']));
     $table->add('title', Q($this->gettext('lastlogin')));
     $table->add('', Q($user->data['last_login']));
     $identity = $user->get_identity();
     $table->add('title', Q($this->gettext('defaultidentity')));
     $table->add('', Q($identity['name'] . ' <' . $identity['email'] . '>'));
     return html::tag('h4', null, Q('Infos for ' . $user->get_username())) . $table->show();
 }
示例#18
0
 function compose_menu($p)
 {
     $menu = new html_table(array('cols' => 2));
     $chbox = new html_checkbox(array('value' => 1));
     $menu->add(null, html::label(array('for' => 'enigmadefaultopt'), rcube::Q($this->enigma->gettext('identdefault'))));
     $menu->add(null, $chbox->show(1, array('name' => '_enigma_default', 'id' => 'enigmadefaultopt')));
     $menu->add(null, html::label(array('for' => 'enigmasignopt'), rcube::Q($this->enigma->gettext('signmsg'))));
     $menu->add(null, $chbox->show(1, array('name' => '_enigma_sign', 'id' => 'enigmasignopt')));
     $menu->add(null, html::label(array('for' => 'enigmacryptopt'), rcube::Q($this->enigma->gettext('encryptmsg'))));
     $menu->add(null, $chbox->show(1, array('name' => '_enigma_crypt', 'id' => 'enigmacryptopt')));
     $menu = html::div(array('id' => 'enigmamenu', 'class' => 'popupmenu'), $menu->show());
     $p['content'] = preg_replace('/(<form name="form"[^>]+>)/i', '\\1' . "\n{$menu}", $p['content']);
     return $p;
 }
 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;
 }
示例#20
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;
 }
示例#21
0
文件: acl.php 项目: BIGGANI/zpanelx
 /**
  * Creates ACL rights table
  *
  * @param array $attrib Template object attributes
  *
  * @return string HTML Content
  */
 private function list_rights($attrib = array())
 {
     // Get ACL for the folder
     $acl = $this->rc->storage->get_acl($this->mbox);
     if (!is_array($acl)) {
         $acl = array();
     }
     // Keep special entries (anyone/anonymous) on top of the list
     if (!empty($this->specials) && !empty($acl)) {
         foreach ($this->specials as $key) {
             if (isset($acl[$key])) {
                 $acl_special[$key] = $acl[$key];
                 unset($acl[$key]);
             }
         }
     }
     // Sort the list by username
     uksort($acl, 'strnatcasecmp');
     if (!empty($acl_special)) {
         $acl = array_merge($acl_special, $acl);
     }
     // Get supported rights and build column names
     $supported = $this->rights_supported();
     // depending on server capability either use 'te' or 'd' for deleting msgs
     $deleteright = implode(array_intersect(str_split('ted'), $supported));
     // Use advanced or simple (grouped) rights
     $advanced = $this->rc->config->get('acl_advanced_mode');
     if ($advanced) {
         $items = array();
         foreach ($supported as $sup) {
             $items[$sup] = $sup;
         }
     } else {
         $items = array('read' => 'lrs', 'write' => 'wi', 'delete' => $deleteright, 'other' => preg_replace('/[lrswi' . $deleteright . ']/', '', implode($supported)));
     }
     // Create the table
     $attrib['noheader'] = true;
     $table = new html_table($attrib);
     // Create table header
     $table->add_header('user', $this->gettext('identifier'));
     foreach (array_keys($items) as $key) {
         $label = $this->gettext('shortacl' . $key);
         $table->add_header(array('class' => 'acl' . $key, 'title' => $label), $label);
     }
     $js_table = array();
     foreach ($acl as $user => $rights) {
         if ($this->rc->storage->conn->user == $user) {
             continue;
         }
         // filter out virtual rights (c or d) the server may return
         $userrights = array_intersect($rights, $supported);
         $userid = rcube_utils::html_identifier($user);
         if (!empty($this->specials) && in_array($user, $this->specials)) {
             $user = $this->gettext($user);
         }
         $table->add_row(array('id' => 'rcmrow' . $userid));
         $table->add('user', rcube::Q($user));
         foreach ($items as $key => $right) {
             $in = $this->acl_compare($userrights, $right);
             switch ($in) {
                 case 2:
                     $class = 'enabled';
                     break;
                 case 1:
                     $class = 'partial';
                     break;
                 default:
                     $class = 'disabled';
                     break;
             }
             $table->add('acl' . $key . ' ' . $class, '');
         }
         $js_table[$userid] = implode($userrights);
     }
     $this->rc->output->set_env('acl', $js_table);
     $this->rc->output->set_env('acl_advanced', $advanced);
     $out = $table->show();
     return $out;
 }
示例#22
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;
 }
示例#23
0
 /**
  * GUI object 'loginform'
  * Returns code for the webmail login form
  *
  * @param array Named parameters
  * @return string HTML code for the gui object
  */
 protected function login_form($attrib)
 {
     $default_host = $this->config->get('default_host');
     $autocomplete = (int) $this->config->get('login_autocomplete');
     $_SESSION['temp'] = true;
     // save original url
     $url = rcube_utils::get_input_value('_url', rcube_utils::INPUT_POST);
     if (empty($url) && !preg_match('/_(task|action)=logout/', $_SERVER['QUERY_STRING'])) {
         $url = $_SERVER['QUERY_STRING'];
     }
     // set atocomplete attribute
     $user_attrib = $autocomplete > 0 ? array() : array('autocomplete' => 'off');
     $host_attrib = $autocomplete > 0 ? array() : array('autocomplete' => 'off');
     $pass_attrib = $autocomplete > 1 ? array() : array('autocomplete' => 'off');
     $input_task = new html_hiddenfield(array('name' => '_task', 'value' => 'login'));
     $input_action = new html_hiddenfield(array('name' => '_action', 'value' => 'login'));
     $input_tzone = new html_hiddenfield(array('name' => '_timezone', 'id' => 'rcmlogintz', 'value' => '_default_'));
     $input_dst = new html_hiddenfield(array('name' => '_dstactive', 'id' => 'rcmlogindst', 'value' => '_default_'));
     $input_url = new html_hiddenfield(array('name' => '_url', 'id' => 'rcmloginurl', 'value' => $url));
     $input_user = new html_inputfield(array('name' => '_user', 'id' => 'rcmloginuser') + $attrib + $user_attrib);
     $input_pass = new html_passwordfield(array('name' => '_pass', 'id' => 'rcmloginpwd') + $attrib + $pass_attrib);
     $input_host = null;
     if (is_array($default_host) && count($default_host) > 1) {
         $input_host = new html_select(array('name' => '_host', 'id' => 'rcmloginhost'));
         foreach ($default_host as $key => $value) {
             if (!is_array($value)) {
                 $input_host->add($value, is_numeric($key) ? $value : $key);
             } else {
                 $input_host = null;
                 break;
             }
         }
     } else {
         if (is_array($default_host) && ($host = array_pop($default_host))) {
             $hide_host = true;
             $input_host = new html_hiddenfield(array('name' => '_host', 'id' => 'rcmloginhost', 'value' => $host) + $attrib);
         } else {
             if (empty($default_host)) {
                 $input_host = new html_inputfield(array('name' => '_host', 'id' => 'rcmloginhost') + $attrib + $host_attrib);
             }
         }
     }
     $form_name = !empty($attrib['form']) ? $attrib['form'] : 'form';
     $this->add_gui_object('loginform', $form_name);
     // create HTML table with two cols
     $table = new html_table(array('cols' => 2));
     $table->add('title', html::label('rcmloginuser', html::quote($this->app->gettext('username'))));
     $table->add('input', $input_user->show(rcube_utils::get_input_value('_user', rcube_utils::INPUT_GPC)));
     $table->add('title', html::label('rcmloginpwd', html::quote($this->app->gettext('password'))));
     $table->add('input', $input_pass->show());
     // add host selection row
     if (is_object($input_host) && !$hide_host) {
         $table->add('title', html::label('rcmloginhost', html::quote($this->app->gettext('server'))));
         $table->add('input', $input_host->show(rcube_utils::get_input_value('_host', rcube_utils::INPUT_GPC)));
     }
     $out = $input_task->show();
     $out .= $input_action->show();
     $out .= $input_tzone->show();
     $out .= $input_dst->show();
     $out .= $input_url->show();
     $out .= $table->show();
     if ($hide_host) {
         $out .= $input_host->show();
     }
     // surround html output with a form tag
     if (empty($attrib['form'])) {
         $out = $this->form_tag(array('name' => $form_name, 'method' => 'post'), $out);
     }
     return $out;
 }
 function gen_form()
 {
     $this->rcmail_inst->output->set_env('framed', true);
     $out = '<form class="propform"><fieldset><legend>' . $this->gettext('acc_general') . '</legend>' . "\n";
     $table = new html_table(array('cols' => 2, 'cellpadding' => 3, 'class' => 'propform'));
     $table->add('title', rcube::Q($this->gettext('username')));
     $table->add('', rcube::Q($this->rcmail_inst->user->data['username']));
     $table->add('title', rcube::Q($this->gettext('server')));
     $table->add('', rcube::Q($this->rcmail_inst->user->data['mail_host']));
     $table->add('title', rcube::Q($this->gettext('acc_lastlogin')));
     $table->add('', rcube::Q($this->rcmail_inst->user->data['last_login']));
     $identity = $this->rcmail_inst->user->get_identity();
     $table->add('title', rcube::Q($this->gettext('acc_defaultidentity')));
     $table->add('', rcube::Q($identity['name'] . ' <' . $identity['email'] . '>'));
     $out .= $table->show();
     $out .= "</fieldset>\n";
     $out .= '<fieldset><legend>' . $this->gettext('acc_alias') . '</legend>' . "\n";
     $alias_table = new html_table(array('id' => 'alias-table', 'class' => 'records-table', 'cellspacing' => '0', 'cols' => 1));
     $alias_table->add_header(array('width' => '100%'), $this->gettext('mail'));
     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);
         $class = $class == 'odd' ? 'even' : 'odd';
         $alias_table->set_row_attribs(array('class' => $class));
         $alias_table->add('', $mail_user[0]['email']);
         for ($i = 0; $i < count($alias); $i++) {
             $class = $class == 'odd' ? 'even' : 'odd';
             $alias_table->set_row_attribs(array('class' => $class));
             $alias_table->add('', $alias[$i]['source']);
         }
     } catch (SoapFault $e) {
         $this->rcmail_inst->output->command('display_message', 'Soap Error: ' . $e->getMessage(), 'error');
     }
     $out .= "<div id=\"alias-cont\">" . $alias_table->show() . "</div>\n";
     $out .= "</fieldset></form>\n";
     return $out;
 }
示例#25
0
 function password_form()
 {
     $rcmail = rcmail::get_instance();
     $this->load_config();
     // add some labels to client
     $rcmail->output->add_label('password.nopassword', 'password.nocurpassword', 'password.passwordinconsistency');
     $rcmail->output->set_env('product_name', $rcmail->config->get('product_name'));
     $table = new html_table(array('cols' => 2));
     if ($rcmail->config->get('password_confirm_current')) {
         // show current password selection
         $field_id = 'curpasswd';
         $input_curpasswd = new html_passwordfield(array('name' => '_curpasswd', 'id' => $field_id, 'size' => 20, 'autocomplete' => 'off'));
         $table->add('title', html::label($field_id, Q($this->gettext('curpasswd'))));
         $table->add(null, $input_curpasswd->show());
     }
     // show new password selection
     $field_id = 'newpasswd';
     $input_newpasswd = new html_passwordfield(array('name' => '_newpasswd', 'id' => $field_id, 'size' => 20, 'autocomplete' => 'off'));
     $table->add('title', html::label($field_id, Q($this->gettext('newpasswd'))));
     $table->add(null, $input_newpasswd->show());
     // show confirm password selection
     $field_id = 'confpasswd';
     $input_confpasswd = new html_passwordfield(array('name' => '_confpasswd', 'id' => $field_id, 'size' => 20, 'autocomplete' => 'off'));
     $table->add('title', html::label($field_id, Q($this->gettext('confpasswd'))));
     $table->add(null, $input_confpasswd->show());
     $out = html::div(array('class' => 'box'), html::div(array('id' => 'prefs-title', 'class' => 'boxtitle'), $this->gettext('changepasswd')) . html::div(array('class' => 'boxcontent'), $table->show() . html::p(null, $rcmail->output->button(array('command' => 'plugin.password-save', 'type' => 'input', 'class' => 'button mainaction', 'label' => 'save')))));
     $rcmail->output->add_gui_object('passform', 'password-form');
     return $rcmail->output->form_tag(array('id' => 'password-form', 'name' => 'password-form', 'method' => 'post', 'action' => './?_task=settings&_action=plugin.password-save'), $out);
 }
示例#26
0
 function render_box($p)
 {
     $this->add_texts('localization');
     $rcmail = rcmail::get_instance();
     if (!$attrib['id']) {
         $attrib['id'] = 'bounce-box';
         $attrib['class'] = 'popupmenu';
     }
     $button = new html_inputfield(array('type' => 'button'));
     $submit = new html_inputfield(array('type' => 'submit'));
     $table = new html_table(array('cols' => 2, 'id' => 'form'));
     $table->add('title', html::label('_to', Q(rcube_label('to'))));
     $table->add('editfield', html::tag('textarea', array('spellcheck' => 'false', 'id' => '_to', 'name' => '_to', 'cols' => '50', 'rows' => '2', 'tabindex' => '2', 'class' => 'editfield', 'onclick' => 'select_field(this)')));
     $table->set_row_attribs(array('id' => 'compose-cc'));
     $table->add('title', html::a(array('href' => '#cc', 'onclick' => 'return rcmail_ui.hide_header_form(\'cc\')'), html::img(array('src' => $rcmail->config->get('skin_path') . '/images/icons/minus.gif', 'title' => rcube_label('delete'), 'alt' => rcube_label('delete')))) . '&nbsp;' . html::label('_cc', Q(rcube_label('cc'))));
     $table->add(null, html::tag('textarea', array('spellcheck' => 'false', 'id' => '_cc', 'name' => '_cc', 'cols' => '50', 'rows' => '2', 'value' => '', 'class' => 'editfield', 'onclick' => 'select_field(this)')));
     $table->set_row_attribs(array('id' => 'compose-bcc'));
     $table->add('title', html::a(array('href' => '#bcc', 'onclick' => 'return rcmail_ui.hide_header_form(\'bcc\')'), html::img(array('src' => $rcmail->config->get('skin_path') . '/images/icons/minus.gif', 'title' => rcube_label('delete'), 'alt' => rcube_label('delete')))) . '&nbsp;' . html::label('_bcc', Q(rcube_label('bcc'))));
     $table->add(null, html::tag('textarea', array('spellcheck' => 'false', 'id' => '_bcc', 'cols' => '50', 'name' => '_bcc', 'rows' => '2', 'value' => '', 'class' => 'editfield', 'onclick' => 'select_field(this)')));
     $table->add(null, null);
     $table->add(formlinks, html::a(array('href' => '#cc', 'onclick' => 'return rcmail_ui.show_header_form(\'cc\')', 'id' => 'cc-link'), Q(rcube_label('addcc'))) . '<span class="separator">|</span>' . html::a(array('href' => '#bcc', 'onclick' => 'return rcmail_ui.show_header_form(\'bcc\')', 'id' => 'bcc-link'), Q(rcube_label('addbcc'))));
     $target_url = $_SERVER['REQUEST_URI'];
     $rcmail->output->add_footer(html::div($attrib, $rcmail->output->form_tag(array('name' => 'bounceform', 'method' => 'post', 'action' => './', 'enctype' => 'multipart/form-data'), html::tag('input', array('type' => "hidden", 'name' => '_action', 'value' => 'bounce')) . html::div('bounce-title', Q($this->gettext('bouncemessage'))) . html::div('bounce-body', $table->show() . html::div('buttons', $button->show(rcube_label('close'), array('class' => 'button', 'onclick' => "\$('#{$attrib['id']}').hide()")) . ' ' . $button->show(Q($this->gettext('bounce')), array('class' => 'button mainaction', 'onclick' => JS_OBJECT_NAME . ".command('plugin.bounce.send', this.bounceform)")))))));
     $rcmail->output->add_label('norecipientwarning');
     $rcmail->output->add_gui_object('bouncebox', $attrib['id']);
     $rcmail->output->add_gui_object('bounceform', 'bounceform');
     $this->include_stylesheet('bounce.css');
     $rcmail->output->set_env('autocomplete_min_length', $rcmail->config->get('autocomplete_min_length'));
     $rcmail->output->add_gui_object('messageform', 'bounceform');
 }
示例#27
0
 public function quota_content($attrib = null, $folder = null)
 {
     $quota = $this->storage->get_quota($folder);
     $quota = $this->plugins->exec_hook('quota', $quota);
     $quota_result = (array) $quota;
     $quota_result['type'] = isset($_SESSION['quota_display']) ? $_SESSION['quota_display'] : '';
     $quota_result['folder'] = $folder !== null && $folder !== '' ? $folder : 'INBOX';
     if ($quota['total'] > 0) {
         if (!isset($quota['percent'])) {
             $quota_result['percent'] = min(100, round($quota['used'] / max(1, $quota['total']) * 100));
         }
         $title = sprintf('%s / %s (%.0f%%)', $this->show_bytes($quota['used'] * 1024), $this->show_bytes($quota['total'] * 1024), $quota_result['percent']);
         $quota_result['title'] = $title;
         if ($attrib['width']) {
             $quota_result['width'] = $attrib['width'];
         }
         if ($attrib['height']) {
             $quota_result['height'] = $attrib['height'];
         }
         // build a table of quota types/roots info
         if (($root_cnt = count($quota_result['all'])) > 1 || count($quota_result['all'][key($quota_result['all'])]) > 1) {
             $table = new html_table(array('cols' => 3, 'class' => 'quota-info'));
             $table->add_header(null, self::Q($this->gettext('quotatype')));
             $table->add_header(null, self::Q($this->gettext('quotatotal')));
             $table->add_header(null, self::Q($this->gettext('quotaused')));
             foreach ($quota_result['all'] as $root => $data) {
                 if ($root_cnt > 1 && $root) {
                     $table->add(array('colspan' => 3, 'class' => 'root'), self::Q($root));
                 }
                 if ($storage = $data['storage']) {
                     $percent = min(100, round($storage['used'] / max(1, $storage['total']) * 100));
                     $table->add('name', self::Q($this->gettext('quotastorage')));
                     $table->add(null, $this->show_bytes($storage['total'] * 1024));
                     $table->add(null, sprintf('%s (%.0f%%)', $this->show_bytes($storage['used'] * 1024), $percent));
                 }
                 if ($message = $data['message']) {
                     $percent = min(100, round($message['used'] / max(1, $message['total']) * 100));
                     $table->add('name', self::Q($this->gettext('quotamessage')));
                     $table->add(null, intval($message['total']));
                     $table->add(null, sprintf('%d (%.0f%%)', $message['used'], $percent));
                 }
             }
             $quota_result['table'] = $table->show();
         }
     } else {
         $unlimited = $this->config->get('quota_zero_as_unlimited');
         $quota_result['title'] = $this->gettext($unlimited ? 'unlimited' : 'unknown');
         $quota_result['percent'] = 0;
     }
     // cleanup
     unset($quota_result['abort']);
     if (empty($quota_result['table'])) {
         unset($quota_result['all']);
     }
     return $quota_result;
 }
示例#28
0
 /**
  *
  */
 function attendees_freebusy_table($attrib = array())
 {
     $table = new html_table(array('cols' => 2, 'border' => 0, 'cellspacing' => 0));
     $table->add('attendees', html::tag('h3', 'boxtitle', $this->cal->gettext('tabattendees')) . html::div('timesheader', '&nbsp;') . html::div(array('id' => 'schedule-attendees-list', 'class' => 'attendees-list'), ''));
     $table->add('times', html::div('scroll', html::tag('table', array('id' => 'schedule-freebusy-times', 'border' => 0, 'cellspacing' => 0), html::tag('thead') . html::tag('tbody')) . html::div(array('id' => 'schedule-event-time', 'style' => 'display:none'), '&nbsp;')));
     return $table->show($attrib);
 }
 function gen_form()
 {
     $confirm = $this->rcmail_inst->config->get('password_confirm_current');
     $pwl = $this->rcmail_inst->config->get('password_min_length');
     if (!empty($pwl)) {
         $pwl = max(6, $pwl);
     } else {
         $pwl = 6;
     }
     $this->rcmail_inst->output->add_label('ispconfig3_pass.nopassword', 'ispconfig3_pass.nocurpassword', 'ispconfig3_pass.passwordinconsistency', 'ispconfig3_pass.changepasswd', 'ispconfig3_pass.passwordminlength');
     $this->rcmail_inst->output->add_script('var pw_min_length =' . $pwl . ';');
     $this->rcmail_inst->output->set_env('framed', true);
     $out .= '<fieldset><legend>' . $this->gettext('password') . '</legend>' . "\n";
     $table = new html_table(array('cols' => 2, 'class' => 'propform'));
     if ($confirm) {
         $input_newpasswd = new html_passwordfield(array('name' => '_curpasswd', 'id' => 'curpasswd', 'size' => 20));
         $table->add('title', rcube_utils::rep_specialchars_output($this->gettext('curpasswd')));
         $table->add('', $input_newpasswd->show());
     }
     $input_newpasswd = new html_passwordfield(array('name' => '_newpasswd', 'id' => 'newpasswd', 'size' => 20));
     $table->add('title', rcube_utils::rep_specialchars_output($this->gettext('newpasswd')));
     $table->add('', $input_newpasswd->show() . '<div id="pass-check">');
     $input_confpasswd = new html_passwordfield(array('name' => '_confpasswd', 'id' => 'confpasswd', 'size' => 20));
     $table->add('title', rcube_utils::rep_specialchars_output($this->gettext('confpasswd')));
     $table->add('', $input_confpasswd->show());
     $out .= $table->show();
     $out .= "</fieldset>\n";
     return $out;
 }
示例#30
0
 /**
  * Helper function used in calendar_form_content(). Creates a part of the form.
  */
 private function get_form_part($form)
 {
     $content = '';
     if (is_array($form['content']) && !empty($form['content'])) {
         $table = new html_table(array('cols' => 2));
         foreach ($form['content'] as $col => $colprop) {
             $label = !empty($colprop['label']) ? $colprop['label'] : $this->cal->gettext($col);
             $table->add('title', html::label($colprop['id'], rcube::Q($label)));
             $table->add(null, $colprop['value']);
         }
         $content = $table->show();
     } else {
         $content = $form['content'];
     }
     return $content;
 }