/**
  * This callback function adds a box below the message content
  * if there is a vcard attachment available
  */
 function html_output($p)
 {
     $attach_script = false;
     foreach ($this->vcard_parts as $part) {
         $vcards = rcube_vcard::import($this->message->get_part_content($part, null, true));
         // successfully parsed vcards?
         if (empty($vcards)) {
             continue;
         }
         // remove part's body
         if (in_array($part, $this->vcard_bodies)) {
             $p['content'] = '';
         }
         foreach ($vcards as $idx => $vcard) {
             // skip invalid vCards
             if (empty($vcard->email) || empty($vcard->email[0])) {
                 continue;
             }
             $display = $vcard->displayname . ' <' . $vcard->email[0] . '>';
             // add box below message body
             $p['content'] .= html::p(array('class' => 'vcardattachment'), html::a(array('href' => "#", 'onclick' => "return plugin_vcard_save_contact('" . rcube::JQ($part . ':' . $idx) . "')", 'title' => $this->gettext('addvcardmsg')), html::span(null, rcube::Q($display))));
         }
         $attach_script = true;
     }
     if ($attach_script) {
         $this->include_script('vcardattach.js');
         $this->include_stylesheet($this->local_skin_path() . '/style.css');
     }
     return $p;
 }
Example #2
0
 /**
  * This callback function adds a box below the message content
  * if there is a vcard attachment available
  */
 function html_output($p)
 {
     $attach_script = false;
     $icon = 'plugins/vcard_attachments/' . $this->local_skin_path() . '/vcard_add_contact.png';
     foreach ($this->vcard_parts as $part) {
         $vcards = rcube_vcard::import($this->message->get_part_content($part));
         // successfully parsed vcards?
         if (empty($vcards)) {
             continue;
         }
         // remove part's body
         if (in_array($part, $this->vcard_bodies)) {
             $p['content'] = '';
         }
         $style = 'margin:0.5em 1em; padding:0.2em 0.5em; border:1px solid #999; ' . 'border-radius:4px; -moz-border-radius:4px; -webkit-border-radius:4px; width: auto';
         foreach ($vcards as $idx => $vcard) {
             $display = $vcard->displayname;
             if ($vcard->email[0]) {
                 $display .= ' <' . $vcard->email[0] . '>';
             }
             // add box below messsage body
             $p['content'] .= html::p(array('style' => $style), html::a(array('href' => "#", 'onclick' => "return plugin_vcard_save_contact('" . JQ($part . ':' . $idx) . "')", 'title' => $this->gettext('addvcardmsg')), html::img(array('src' => $icon, 'style' => "vertical-align:middle"))) . ' ' . html::span(null, Q($display)));
         }
         $attach_script = true;
     }
     if ($attach_script) {
         $this->include_script('vcardattach.js');
     }
     return $p;
 }
 public function test_span_with_attributes_and_empty_string_args()
 {
     $attributes = array('class' => 'test', 'data' => '0101');
     $actual = html::span($attributes, '');
     $expected = '<span class=test data=0101></span>';
     $this->assertSame($expected, $actual);
 }
 public static function row($label, $control, $help = null)
 {
     if (!empty($help)) {
         $help = html::span('help-block', $help);
     } else {
         $help = '';
     }
     return html::div('control-group', html::label('control-label', $label) . html::div('controls', $control . $help));
 }
Example #5
0
 /**
  * Plugin initialization.
  */
 function init()
 {
     $this->version_detect();
     $this->rc = rcube::get_instance();
     $this->rm = rcmail::get_instance();
     $this->add_hook('user_create', array($this, 'user_create'));
     $this->register_action('plugin.pks_search', array($this, 'hkp_search'));
     $this->register_action('plugin.hkp_add', array($this, 'hkp_add'));
     $this->register_action('plugin.pubkey_save', array($this, 'pubkey_save'));
     if ($this->rc->task == 'mail') {
         $this->add_hook('render_page', array($this, 'render_page'));
         // make localization available on the client
         $this->add_texts('localization/', true);
         // load js
         $this->include_script('js/openpgp.min.js');
         $this->include_script('js/rc_openpgpjs.crypto.js');
         $this->include_script('js/rc_openpgpjs.js');
         if (isset($_SESSION["rc_openpgpjs_outdated"])) {
             $this->include_script('js/outdated.js');
         }
         // load css
         $this->include_stylesheet($this->local_skin_path() . '/rc_openpgpjs.css');
         // add public key attachment related hooks
         $this->add_hook('message_compose', array($this, 'message_compose'));
         $this->add_hook('message_sent', array($this, 'unlink_pubkey'));
         if ($this->api->output->type == 'html') {
             // add key manager item to message menu
             $opts = array("command" => "open-key-manager", "label" => "rc_openpgpjs.key_manager", "type" => "link", "classact" => "icon active", "class" => "icon", "innerclass" => "icon key_manager");
             $this->api->add_content(html::tag('li', null, $this->api->output->button($opts)), "messagemenu");
             if ($this->rc->action == 'compose') {
                 // add key manager button to compose toolbar
                 $opts = array("command" => "open-key-manager", "label" => "rc_openpgpjs.key_manager", "type" => "link", "classact" => "button active key_manager", "class" => "button key_manager");
                 $this->api->add_content($this->api->output->button($opts), "toolbar");
                 // add encrypt and sign checkboxes to composeoptions
                 $encrypt_opts = array('id' => 'openpgpjs_encrypt', 'type' => 'checkbox');
                 if ($this->rc->config->get('encrypt', false)) {
                     $encrypt_opts['checked'] = 'checked';
                 }
                 $encrypt = new html_inputfield($encrypt_opts);
                 $this->api->add_content(html::span('composeoption', html::label(null, $encrypt->show() . $this->gettext('encrypt'))), "composeoptions");
                 $sign_opts = array('id' => 'openpgpjs_sign', 'type' => 'checkbox');
                 if ($this->rc->config->get('sign', false)) {
                     $sign_opts['checked'] = 'checked';
                 }
                 $sign = new html_inputfield($sign_opts);
                 $this->api->add_content(html::span('composeoption', html::label(null, $sign->show() . $this->gettext('sign'))), "composeoptions");
             }
         }
     } elseif ($this->rc->task == 'settings') {
         // load localization
         $this->add_texts('localization/', false);
         // add hooks for OpenPGP settings
         $this->add_hook('preferences_list', array($this, 'preferences_list'));
         $this->add_hook('preferences_save', array($this, 'preferences_save'));
     }
 }
 public function progress_bar(array $items)
 {
     foreach ($items as $step) {
         if ($step['class'] == 'backup_stage backup_stage_current') {
             $steps[] = html::span(label::inverse($step['text']));
         } else {
             $steps[] = html::span($step['text']);
         }
     }
     return html::ul('breadcrumb', '<li>' . implode('&nbsp;>&nbsp;</li><li>', $steps) . '</li>');
     //TODO: there's better bootstrap wizard progress out there, but this'll do for now
 }
Example #7
0
 /**
  * see html::calendar()
  */
 public static function calendar($options = [])
 {
     // include js & css files
     if (empty($options['readonly'])) {
         layout::add_js('/numbers/media_submodules/numbers_frontend_components_calendar_numbers_media_js_base.js');
         layout::add_css('/numbers/media_submodules/numbers_frontend_components_calendar_numbers_media_css_base.css');
     }
     // font awesome icons
     library::add('fontawesome');
     // widget parameters
     $type = $options['calendar_type'] ?? $options['type'] ?? 'date';
     $widget_options = ['id' => $options['id'], 'type' => $type, 'format' => $options['calendar_format'] ?? format::get_date_format($type), 'date_week_start_day' => $options['calendar_date_week_start_day'] ?? 1, 'date_disable_week_days' => $options['calendar_date_disable_week_days'] ?? null, 'master_id' => $options['calendar_master_id'] ?? null, 'slave_id' => $options['calendar_slave_id'] ?? null];
     $options['type'] = 'text';
     // determine input size
     $placeholder = format::get_date_placeholder($widget_options['format']);
     $options['size'] = strlen($placeholder);
     // set placeholder
     if (!empty($options['placeholder']) && $options['placeholder'] == 'format::get_date_placeholder') {
         $options['placeholder'] = $placeholder;
         $options['title'] = ($options['title'] ?? '') . ' (' . $placeholder . ')';
     }
     if (isset($options['calendar_icon']) && ($options['calendar_icon'] == 'left' || $options['calendar_icon'] == 'right')) {
         $position = $options['calendar_icon'];
         if (i18n::rtl()) {
             if ($position == 'left') {
                 $position = 'right';
             } else {
                 $position = 'left';
             }
         }
         $icon_type = $type == 'time' ? 'clock-o' : 'calendar';
         unset($options['calendar_icon']);
         if (empty($options['readonly'])) {
             $icon_onclick = 'numbers_calendar_var_' . $options['id'] . '.show();';
         } else {
             $icon_onclick = null;
         }
         $icon_value = html::span(['onclick' => $icon_onclick, 'class' => 'numbers_calendar_icon numbers_prevent_selection', 'value' => html::icon(['type' => $icon_type])]);
         $result = html::input_group(['value' => html::input($options), $position => $icon_value, 'dir' => 'ltr']);
         $div_id = $options['id'] . '_div_holder';
         $result .= html::div(['id' => $div_id, 'class' => 'numbers_calendar_div_holder']);
         $widget_options['holder_div_id'] = $div_id;
     } else {
         $result = html::input($options);
     }
     // we do not render a widget if readonly
     if (empty($options['readonly'])) {
         layout::onload('numbers_calendar(' . json_encode($widget_options) . ');');
     }
     return $result;
 }
 /**
  * This callback function adds a box below the message content
  * if there is a vcard attachment available
  */
 function html_output($p)
 {
     if ($this->vcard_part) {
         $vcard = new rcube_vcard($this->message->get_part_content($this->vcard_part));
         // successfully parsed vcard
         if ($vcard->displayname) {
             $display = $vcard->displayname;
             if ($vcard->email[0]) {
                 $display .= ' <' . $vcard->email[0] . '>';
             }
             // add box below messsage body
             $p['content'] .= html::p(array('style' => "margin:1em; padding:0.5em; border:1px solid #999; border-radius:4px; -moz-border-radius:4px; -webkit-border-radius:4px; width: auto;"), html::a(array('href' => "#", 'onclick' => "return plugin_vcard_save_contact('" . JQ($this->vcard_part) . "')", 'title' => $this->gettext('addvardmsg')), html::img(array('src' => $this->url('vcard_add_contact.png'), 'align' => "middle"))) . ' ' . html::span(null, Q($display)));
             $this->include_script('vcardattach.js');
         }
     }
     return $p;
 }
Example #9
0
 /**
  * This callback function adds a box below the message content
  * if there is a vcard attachment available
  */
 function html_output($p)
 {
     $attach_script = false;
     foreach ($this->ics_parts as $part) {
         $icscontent = $this->message->get_part_content($part['part'], null, true);
         $file_name = $part['uid'];
         $file = '../../../cache/import/' . $file_name . '.ics';
         file_put_contents($file, $icscontent);
         // add box below message body
         $p['content'] .= html::p(array('class' => 'icalattachments'), html::a(array('href' => "#", 'class' => rcube::JQ($file_name), 'title' => $this->gettext('addicalinvitemsg')), html::span(null, rcube::Q($this->gettext('addicalinvitemsg')))));
         $attach_script = true;
     }
     if ($attach_script) {
         $this->include_stylesheet($this->local_skin_path() . '/style.css');
     }
     return $p;
 }
 function preferences_list($params)
 {
     $rcmail = rcmail::get_instance();
     if ($params['section'] == 'addressbook') {
         $params['blocks'][$this->id]['name'] = $this->abook_name;
         $field_id = 'rc_use_plugin';
         $checkbox = new html_checkbox(array('name' => $field_id, 'id' => $field_id, 'value' => 1));
         $params['blocks'][$this->id]['options'][$field_id] = array('title' => html::label($field_id, $this->gettext('use') . $this->abook_name), 'content' => $checkbox->show($rcmail->config->get(google_func::$settings_key_use_plugin)));
         $field_id = 'rc_google_autosync';
         $checkbox = new html_checkbox(array('name' => $field_id, 'id' => $field_id, 'value' => 1));
         $params['blocks'][$this->id]['options'][$field_id] = array('title' => html::label($field_id, $this->gettext('autosync')), 'content' => $checkbox->show($rcmail->config->get(google_func::$settings_key_auto_sync)));
         $field_id = 'rc_google_authcode';
         $input_auth = new html_inputfield(array('name' => $field_id, 'id' => $field_id, 'size' => 45));
         $params['blocks'][$this->id]['options'][$field_id] = array('title' => html::label($field_id, $this->gettext('authcode')), 'content' => $input_auth->show($rcmail->config->get(google_func::$settings_key_auth_code)));
         $params['blocks'][$this->id]['options']['link'] = array('title' => html::span('', ''), 'content' => html::a(array('href' => google_func::get_client()->createAuthUrl(), 'target' => '_blank'), $this->gettext('authcodelink')));
     }
     return $params;
 }
Example #11
0
 /**
  * @see html::input_group()
  */
 public static function input_group($options = [])
 {
     $temp = [];
     foreach (['left', 'center', 'right'] as $k0) {
         if ($k0 == 'center') {
             $temp[] = $options['value'];
         } else {
             if (!empty($options[$k0])) {
                 if (!is_array($options[$k0])) {
                     $options[$k0] = [$options[$k0]];
                 }
                 foreach ($options[$k0] as $k => $v) {
                     $temp[] = html::span(['value' => $v, 'class' => 'input-group-addon']);
                 }
             }
         }
     }
     unset($options['left'], $options['right']);
     $options['value'] = implode('', $temp);
     $options['class'] = 'input-group';
     return html::div($options);
 }
Example #12
0
<?php

/**************************************************
  Coppermine 1.5.x Plugin - forum
  *************************************************
  Copyright (c) 2010 foulu (Le Hoai Phuong), eenemeenemuu
  *************************************************
  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 3 of the License, or
  (at your option) any later version.
  ********************************************
  $HeadURL$
  $Revision$
  $LastChangedBy$
  $Date$
  **************************************************/
pageheader($fr_title ? $fr_title : Config::item('fr_title'));
print html::spacer();
print table::open(0);
print table::tds(array(array('text' => $fr_title ? $fr_title : Config::item('fr_title')), array('align' => 'right', 'text' => ($authorizer->is_user() ? html::button('forum.php?c=profile', Lang::item('home.fr_profile')) : '') . NBSP . html::button('forum.php?c=search', Lang::item('home.search')))));
print table::close();
print html::spacer();
print table::open();
print form::hidden('c', 'search');
print table::tds(array(array('class' => 'tableb', 'text' => html::span(forum::nagavitor($nagavitor)))));
print table::close();
print html::spacer();
print $fr_contents;
pagefooter();
 /**
  * Generate the form for recurrence settings
  */
 public function recurrence_form($attrib = array())
 {
     switch ($attrib['part']) {
         // frequency selector
         case 'frequency':
             $select = new html_select(array('name' => 'frequency', 'id' => 'edit-recurrence-frequency'));
             $select->add($this->gettext('never'), '');
             $select->add($this->gettext('daily'), 'DAILY');
             $select->add($this->gettext('weekly'), 'WEEKLY');
             $select->add($this->gettext('monthly'), 'MONTHLY');
             $select->add($this->gettext('yearly'), 'YEARLY');
             $select->add($this->gettext('rdate'), 'RDATE');
             $html = html::label('edit-recurrence-frequency', $this->gettext('frequency')) . $select->show('');
             break;
             // daily recurrence
         // daily recurrence
         case 'daily':
             $select = $this->interval_selector(array('name' => 'interval', 'class' => 'edit-recurrence-interval', 'id' => 'edit-recurrence-interval-daily'));
             $html = html::div($attrib, html::label('edit-recurrence-interval-daily', $this->gettext('every')) . $select->show(1) . html::span('label-after', $this->gettext('days')));
             break;
             // weekly recurrence form
         // weekly recurrence form
         case 'weekly':
             $select = $this->interval_selector(array('name' => 'interval', 'class' => 'edit-recurrence-interval', 'id' => 'edit-recurrence-interval-weekly'));
             $html = html::div($attrib, html::label('edit-recurrence-interval-weekly', $this->gettext('every')) . $select->show(1) . html::span('label-after', $this->gettext('weeks')));
             // weekday selection
             $daymap = array('sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat');
             $checkbox = new html_checkbox(array('name' => 'byday', 'class' => 'edit-recurrence-weekly-byday'));
             $first = $this->rc->config->get('calendar_first_day', 1);
             for ($weekdays = '', $j = $first; $j <= $first + 6; $j++) {
                 $d = $j % 7;
                 $weekdays .= html::label(array('class' => 'weekday'), $checkbox->show('', array('value' => strtoupper(substr($daymap[$d], 0, 2)))) . $this->gettext($daymap[$d])) . ' ';
             }
             $html .= html::div($attrib, html::label(null, $this->gettext('bydays')) . $weekdays);
             break;
             // monthly recurrence form
         // monthly recurrence form
         case 'monthly':
             $select = $this->interval_selector(array('name' => 'interval', 'class' => 'edit-recurrence-interval', 'id' => 'edit-recurrence-interval-monthly'));
             $html = html::div($attrib, html::label('edit-recurrence-interval-monthly', $this->gettext('every')) . $select->show(1) . html::span('label-after', $this->gettext('months')));
             $checkbox = new html_checkbox(array('name' => 'bymonthday', 'class' => 'edit-recurrence-monthly-bymonthday'));
             for ($monthdays = '', $d = 1; $d <= 31; $d++) {
                 $monthdays .= html::label(array('class' => 'monthday'), $checkbox->show('', array('value' => $d)) . $d);
                 $monthdays .= $d % 7 ? ' ' : html::br();
             }
             // rule selectors
             $radio = new html_radiobutton(array('name' => 'repeatmode', 'class' => 'edit-recurrence-monthly-mode'));
             $table = new html_table(array('cols' => 2, 'border' => 0, 'cellpadding' => 0, 'class' => 'formtable'));
             $table->add('label', html::label(null, $radio->show('BYMONTHDAY', array('value' => 'BYMONTHDAY')) . ' ' . $this->gettext('each')));
             $table->add(null, $monthdays);
             $table->add('label', html::label(null, $radio->show('', array('value' => 'BYDAY')) . ' ' . $this->gettext('onevery')));
             $table->add(null, $this->rrule_selectors($attrib['part']));
             $html .= html::div($attrib, $table->show());
             break;
             // annually recurrence form
         // annually recurrence form
         case 'yearly':
             $select = $this->interval_selector(array('name' => 'interval', 'class' => 'edit-recurrence-interval', 'id' => 'edit-recurrence-interval-yearly'));
             $html = html::div($attrib, html::label('edit-recurrence-interval-yearly', $this->gettext('every')) . $select->show(1) . html::span('label-after', $this->gettext('years')));
             // month selector
             $monthmap = array('', 'jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec');
             $checkbox = new html_checkbox(array('name' => 'bymonth', 'class' => 'edit-recurrence-yearly-bymonth'));
             for ($months = '', $m = 1; $m <= 12; $m++) {
                 $months .= html::label(array('class' => 'month'), $checkbox->show(null, array('value' => $m)) . $this->gettext($monthmap[$m]));
                 $months .= $m % 4 ? ' ' : html::br();
             }
             $html .= html::div($attrib + array('id' => 'edit-recurrence-yearly-bymonthblock'), $months);
             // day rule selection
             $html .= html::div($attrib, html::label(null, $this->gettext('onevery')) . $this->rrule_selectors($attrib['part'], '---'));
             break;
             // end of recurrence form
         // end of recurrence form
         case 'until':
             $radio = new html_radiobutton(array('name' => 'repeat', 'class' => 'edit-recurrence-until'));
             $select = $this->interval_selector(array('name' => 'times', 'id' => 'edit-recurrence-repeat-times'));
             $input = new html_inputfield(array('name' => 'untildate', 'id' => 'edit-recurrence-enddate', 'size' => "10"));
             $html = html::div('line first', html::label(null, $radio->show('', array('value' => '', 'id' => 'edit-recurrence-repeat-forever')) . ' ' . $this->gettext('forever')));
             $forntimes = $this->gettext(array('name' => 'forntimes', 'vars' => array('nr' => '%s')));
             $html .= html::div('line', $radio->show('', array('value' => 'count', 'id' => 'edit-recurrence-repeat-count', 'aria-label' => sprintf($forntimes, 'N'))) . ' ' . sprintf($forntimes, $select->show(1)));
             $html .= html::div('line', $radio->show('', array('value' => 'until', 'id' => 'edit-recurrence-repeat-until', 'aria-label' => $this->gettext('untilenddate'))) . ' ' . $this->gettext('untildate') . ' ' . $input->show('', array('aria-label' => $this->gettext('untilenddate'))));
             $html = html::div($attrib, html::label(null, ucfirst($this->gettext('recurrencend'))) . $html);
             break;
         case 'rdate':
             $ul = html::tag('ul', array('id' => 'edit-recurrence-rdates'), '');
             $input = new html_inputfield(array('name' => 'rdate', 'id' => 'edit-recurrence-rdate-input', 'size' => "10"));
             $button = new html_inputfield(array('type' => 'button', 'class' => 'button add', 'value' => $this->gettext('addrdate')));
             $html .= html::div($attrib, $ul . html::div('inputform', $input->show() . $button->show()));
             break;
     }
     return $html;
 }
 private function _action_row($ext, $actions_table, $rowid, $action, $attrib, $example)
 {
     $rcmail = rcube::get_instance();
     $help_icon = html::img(array('src' => $attrib['helpicon'], 'alt' => $this->gettext('messagehelp'), 'border' => 0));
     // set default field display
     $display = array('vacadv' => $action['type'] == 'vacation' && $this->force_vacto ? '' : 'display: none;', 'vacfrom' => $this->show_vacfrom ? $display['vacadv'] : 'display: none;', 'vachandle' => $this->show_vachandle ? $display['vacadv'] : 'display: none;', 'noteadv' => 'display: none;', 'eheadadv' => 'display: none;');
     // setup allowed actions
     $allowed_actions = array();
     $config_actions = $rcmail->config->get('sieverules_allowed_actions', array());
     if (in_array('fileinto', $ext) && ($config_actions['fileinto'] || $action['type'] == 'fileinto')) {
         $allowed_actions['fileinto'] = $this->gettext('messagemoveto');
     }
     if (in_array('fileinto', $ext) && in_array('copy', $ext) && ($config_actions['fileinto'] || $action['type'] == 'fileinto')) {
         $allowed_actions['fileinto_copy'] = $this->gettext('messagecopyto');
     }
     if (in_array('vacation', $ext) && ($config_actions['vacation'] || $action['type'] == 'vacation')) {
         $allowed_actions['vacation'] = $this->gettext('messagevacation');
     }
     if (in_array('reject', $ext) && ($config_actions['reject'] || $action['type'] == 'reject')) {
         $allowed_actions['reject'] = $this->gettext('messagereject');
     } elseif (in_array('ereject', $ext) && ($config_actions['reject'] || $action['type'] == 'ereject')) {
         $allowed_actions['ereject'] = $this->gettext('messagereject');
     }
     if (in_array('imap4flags', $ext) && ($config_actions['imapflags'] || $action['type'] == 'imap4flags')) {
         $allowed_actions['imap4flags'] = $this->gettext('messageimapflags');
     } elseif (in_array('imapflags', $ext) && ($config_actions['imapflags'] || $action['type'] == 'imapflags')) {
         $allowed_actions['imapflags'] = $this->gettext('messageimapflags');
     }
     if (in_array('notify', $ext) && ($config_actions['notify'] || $action['type'] == 'notify')) {
         $allowed_actions['notify'] = $this->gettext('messagenotify');
     } elseif (in_array('enotify', $ext) && ($config_actions['notify'] || $action['type'] == 'enotify')) {
         $allowed_actions['enotify'] = $this->gettext('messagenotify');
     }
     if (in_array('editheader', $ext) && ($config_actions['editheaderadd'] || $action['type'] == 'editheaderadd')) {
         $allowed_actions['editheaderadd'] = $this->gettext('addheader');
     }
     if (in_array('editheader', $ext) && ($config_actions['editheaderrem'] || $action['type'] == 'editheaderrem')) {
         $allowed_actions['editheaderrem'] = $this->gettext('removeheader');
     }
     if ($config_actions['redirect'] || $action['type'] == 'redirect') {
         $allowed_actions['redirect'] = $this->gettext('messageredirect');
     }
     if (in_array('copy', $ext) && ($config_actions['redirect'] || $action['type'] == 'redirect_copy')) {
         $allowed_actions['redirect_copy'] = $this->gettext('messageredirectcopy');
     }
     if ($config_actions['keep'] || $action['type'] == 'keep') {
         $allowed_actions['keep'] = $this->gettext('messagekeep');
     }
     if ($config_actions['discard'] || $action['type'] == 'discard') {
         $allowed_actions['discard'] = $this->gettext('messagediscard');
     }
     if ($config_actions['stop'] || $action['type'] == 'stop') {
         $allowed_actions['stop'] = $this->gettext('messagestop');
     }
     // set the default values
     reset($allowed_actions);
     $defaults = array('method' => key($allowed_actions), 'folder' => 'INBOX', 'reject' => '', 'vacto' => null, 'address' => '', 'period' => '', 'periodtype' => '', 'handle' => '', 'subject' => '', 'origsubject' => '', 'msg' => '', 'charset' => RCUBE_CHARSET, 'flags' => '', 'nfrom' => '', 'nimpt' => '', 'nmethod' => '', 'noptions' => '', 'nmsg' => '');
     // set default identity for use in vacation action
     $identity = $rcmail->user->get_identity();
     if ($this->show_vacfrom) {
         $defaults['vacfrom'] = in_array('variables', $ext) ? 'auto' : $identity['email'];
     } else {
         $defaults['vacfrom'] = null;
     }
     // apply current action values
     if ($action['type'] == 'fileinto' || $action['type'] == 'fileinto_copy') {
         $defaults['method'] = $action['type'];
         $defaults['folder'] = $action['target'];
         if ($encoding = $rcmail->config->get('sieverules_folder_encoding')) {
             $defaults['folder'] = rcube_charset::convert($defaults['folder'], $encoding, 'UTF7-IMAP');
         }
         if ($delim = $rcmail->config->get('sieverules_folder_delimiter')) {
             $defaults['folder'] = str_replace($delim, $rcmail->storage->get_hierarchy_delimiter(), $defaults['folder']);
         }
         $defaults['folder'] = $rcmail->config->get('sieverules_include_imap_root', true) ? $defaults['folder'] : $rcmail->storage->mod_folder($defaults['folder'], 'IN');
     } elseif ($action['type'] == 'reject' || $action['type'] == 'ereject') {
         $defaults['method'] = $action['type'];
         $defaults['reject'] = $action['target'];
     } elseif ($action['type'] == 'vacation') {
         $defaults['method'] = 'vacation';
         if (isset($action['seconds'])) {
             $defaults['period'] = $action['seconds'];
             $defaults['periodtype'] = 'seconds';
         } else {
             $defaults['period'] = $action['days'];
             $defaults['periodtype'] = 'days';
         }
         $defaults['vacfromdefault'] = $defaults['vacfrom'];
         $defaults['vacfrom'] = $action['from'];
         $defaults['vacto'] = $action['addresses'];
         $defaults['handle'] = $action['handle'];
         $defaults['subject'] = $action['subject'];
         $defaults['origsubject'] = $action['origsubject'];
         $defaults['msg'] = $action['msg'];
         $defaults['htmlmsg'] = $action['htmlmsg'] ? '1' : '';
         $defaults['charset'] = $action['charset'];
         if ($defaults['htmlmsg'] == '1' && $rcmail->config->get('htmleditor') == '0') {
             $h2t = new rcube_html2text($defaults['msg'], false, true, 0);
             $defaults['msg'] = $h2t->get_text();
             $defaults['htmlmsg'] = '';
         } elseif ($defaults['htmlmsg'] == '' && $rcmail->config->get('htmleditor') == '1') {
             $defaults['msg'] = $defaults['msg'];
             $defaults['msg'] = nl2br($defaults['msg']);
             $defaults['htmlmsg'] = '1';
         }
         if (!$example) {
             $this->force_vacto = false;
         }
         // check advanced enabled
         if (!empty($defaults['vacfrom']) && $defaults['vacfrom'] != $defaults['vacfromdefault'] || !empty($defaults['vacto']) || !empty($defaults['handle']) || !empty($defaults['period']) || $defaults['charset'] != RCUBE_CHARSET || $this->force_vacto) {
             $display['vacadv'] = '';
             $display['vacfrom'] = $this->show_vacfrom ? '' : 'display: none;';
             $display['vachandle'] = $this->show_vachandle ? '' : 'display: none;';
         }
     } elseif ($action['type'] == 'redirect' || $action['type'] == 'redirect_copy') {
         $defaults['method'] = $action['type'];
         $defaults['address'] = $action['target'];
     } elseif ($action['type'] == 'imapflags' || $action['type'] == 'imap4flags') {
         $defaults['method'] = $action['type'];
         $defaults['flags'] = $action['target'];
     } elseif ($action['type'] == 'notify' || $action['type'] == 'enotify') {
         $defaults['method'] = $action['type'];
         $defaults['nfrom'] = $action['from'];
         $defaults['nimpt'] = $action['importance'];
         $defaults['nmethod'] = $action['method'];
         $defaults['noptions'] = $action['options'];
         $defaults['nmsg'] = $action['msg'];
         // check advanced enabled
         if (!empty($defaults['nfrom']) || !empty($defaults['nimpt'])) {
             $display['noteadv'] = '';
         }
     } elseif ($action['type'] == 'editheaderadd' || $action['type'] == 'editheaderrem') {
         $defaults['method'] = $action['type'];
         $defaults['headername'] = $action['name'];
         $defaults['headerval'] = $action['value'];
         $defaults['headerindex'] = $action['index'];
         $defaults['headerop'] = $action['operator'];
         if ($action['type'] == 'editheaderrem' && (!empty($defaults['headerindex']) || !empty($defaults['headerval']))) {
             $display['eheadadv'] = '';
         }
     } elseif ($action['type'] == 'discard' || $action['type'] == 'keep' || $action['type'] == 'stop') {
         $defaults['method'] = $action['type'];
     }
     // hide the "template" row
     if (!isset($action)) {
         $actions_table->set_row_attribs(array('style' => 'display: none;'));
     }
     // action type select box
     $select_action = new html_select(array('name' => "_act[]", 'onchange' => rcmail_output::JS_OBJECT_NAME . '.sieverules_action_select(this)'));
     foreach ($allowed_actions as $value => $text) {
         $select_action->add($text, $value);
     }
     // add action type to UI
     $actions_table->add('action', $select_action->show($defaults['method']));
     $vacs_table = $this->_vacation_table($ext, $rowid, $defaults, $display, $help_icon);
     // begin notify action
     $notify_table = new html_table(array('class' => 'records-table', 'cellspacing' => '0', 'cols' => 3, 'style' => $defaults['method'] == 'notify' || $defaults['method'] == 'enotify' ? '' : 'display: none;'));
     if (count($this->identities)) {
         $field_id = 'rcmfd_sievenotifyfrom_' . $rowid;
         $select_id = new html_select(array('id' => $field_id, 'name' => "_nfrom[]"));
         $select_id->add($this->gettext('autodetect'), "");
         foreach ($this->identities as $sql_arr) {
             // find currently selected from address
             if ($defaults['nfrom'] != '' && $defaults['nfrom'] == rcmail::Q($sql_arr['from']['string'])) {
                 $defaults['nfrom'] = $sql_arr['identity_id'];
             } elseif ($defaults['nfrom'] != '' && $defaults['nfrom'] == $sql_arr['from']['mailto']) {
                 $defaults['nfrom'] = $sql_arr['identity_id'];
             }
             $select_id->add($sql_arr['from']['disp_string'], $sql_arr['identity_id']);
         }
         $notify_table->set_row_attribs(array('class' => 'advanced', 'style' => $display['noteadv']));
         $notify_table->add(null, html::label($field_id, rcmail::Q($this->gettext('sievefrom'))));
         $notify_table->add(array('colspan' => 2), $select_id->show($defaults['nfrom']));
     }
     $field_id = 'rcmfd_nmethod_' . $rowid;
     $input_method = new html_inputfield(array('id' => $field_id, 'name' => '_nmethod[]'));
     $notify_table->add(null, html::label($field_id, rcmail::Q($this->gettext('method'))));
     $notify_table->add(array('colspan' => 2), $input_method->show($defaults['nmethod']));
     $field_id = 'rcmfd_noption_' . $rowid;
     $input_method = new html_inputfield(array('id' => $field_id, 'name' => '_noption[]'));
     $notify_table->add(null, html::label($field_id, rcmail::Q($this->gettext('options'))));
     $notify_table->add(array('colspan' => 2), $input_method->show($defaults['noptions']));
     $notify_table->set_row_attribs(array('style' => 'display: none;'));
     $notify_table->add(array('colspan' => 3, 'class' => 'helpmsg'), $this->gettext('nmethodexp'));
     $field_id = 'rcmfd_nimpt_' . $rowid;
     $input_importance = new html_radiobutton(array('id' => $field_id . '_none', 'name' => '_notify_radio_' . $rowid, 'value' => 'none', 'onclick' => rcmail_output::JS_OBJECT_NAME . '.sieverules_notify_impt(this, ' . $rowid . ')', 'class' => 'radio'));
     $importance_show = $input_importance->show($defaults['nimpt']) . "&nbsp;" . html::label($field_id . '_none', rcmail::Q($this->gettext('importancen')));
     $input_importance = new html_radiobutton(array('id' => $field_id . '_1', 'name' => '_notify_radio_' . $rowid, 'value' => '1', 'onclick' => rcmail_output::JS_OBJECT_NAME . '.sieverules_notify_impt(this, ' . $rowid . ')', 'class' => 'radio'));
     $importance_show .= '&nbsp;&nbsp;' . $input_importance->show($defaults['nimpt']) . "&nbsp;" . html::label($field_id . '_1', rcmail::Q($this->gettext('importance1')));
     $input_importance = new html_radiobutton(array('id' => $field_id . '_2', 'name' => '_notify_radio_' . $rowid, 'value' => '2', 'onclick' => rcmail_output::JS_OBJECT_NAME . '.sieverules_notify_impt(this, ' . $rowid . ')', 'class' => 'radio'));
     $importance_show .= '&nbsp;&nbsp;' . $input_importance->show($defaults['nimpt']) . "&nbsp;" . html::label($field_id . '_2', rcmail::Q($this->gettext('importance2')));
     $input_importance = new html_radiobutton(array('id' => $field_id . '_3', 'name' => '_notify_radio_' . $rowid, 'value' => '3', 'onclick' => rcmail_output::JS_OBJECT_NAME . '.sieverules_notify_impt(this, ' . $rowid . ')', 'class' => 'radio'));
     $importance_show .= '&nbsp;&nbsp;' . $input_importance->show($defaults['nimpt']) . "&nbsp;" . html::label($field_id . '_3', rcmail::Q($this->gettext('importance3')));
     $input_importance = new html_hiddenfield(array('id' => 'rcmfd_sievenimpt_' . $rowid, 'name' => '_nimpt[]'));
     $notify_table->set_row_attribs(array('class' => 'advanced', 'style' => $display['noteadv']));
     $notify_table->add(null, rcmail::Q($this->gettext('flag')));
     $notify_table->add(array('colspan' => 2), $importance_show . $input_importance->show($defaults['nimpt']));
     $field_id = 'rcmfd_nmsg_' . $rowid;
     $input_msg = new html_inputfield(array('id' => $field_id, 'name' => '_nmsg[]'));
     $notify_table->add(null, html::label($field_id, rcmail::Q($this->gettext('message'))));
     $notify_table->add(array('colspan' => 2), $input_msg->show($defaults['nmsg']));
     if (in_array('enotify', $ext)) {
         $input_advopts = new html_checkbox(array('id' => 'nadvopts' . $rowid, 'name' => '_nadv_opts[]', 'onclick' => rcmail_output::JS_OBJECT_NAME . '.sieverules_show_adv(this);', 'value' => '1', 'class' => 'checkbox'));
         $notify_table->add(array('colspan' => '3', 'style' => 'text-align: right'), html::label('nadvopts' . $rowid, rcmail::Q($this->gettext('advancedoptions'))) . $input_advopts->show($display['noteadv'] == '' ? 1 : 0));
     }
     // begin editheader action
     $headers_table = new html_table(array('class' => 'records-table', 'cellspacing' => '0', 'cols' => 2, 'style' => $defaults['method'] == 'editheaderadd' || $defaults['method'] == 'editheaderrem' ? '' : 'display: none;'));
     $field_id = 'rcmfd_eheadname_' . $rowid;
     $input_header = new html_inputfield(array('id' => $field_id, 'name' => '_eheadname[]'));
     $headers_table->add(null, html::label($field_id, rcmail::Q($this->gettext('headername'))));
     $headers_table->add(null, $input_header->show($defaults['headername']));
     $field_id = 'rcmfd_eheadindex_' . $rowid;
     $select_index = new html_select(array('id' => $field_id, 'name' => "_eheadindex[]"));
     $select_index->add($this->gettext('headerdelall'), "");
     $select_index->add("1", "1");
     $select_index->add("2", "2");
     $select_index->add("3", "3");
     $select_index->add("4", "4");
     $select_index->add("5", "5");
     $select_index->add($this->gettext('last'), "last");
     $headers_table->set_row_attribs(array('class' => 'advanced', 'style' => $display['eheadadv']));
     $headers_table->add(null, html::label($field_id, rcmail::Q($this->gettext('headerindex'))));
     $headers_table->add(null, $select_index->show($defaults['headerindex']));
     $field_id = 'rcmfd_eheadopp_' . $rowid;
     $select_match = new html_select(array('id' => $field_id, 'name' => "_eheadopp[]"));
     $select_match->add($this->gettext('filteris'), "");
     $select_match->add($this->gettext('filtercontains'), "contains");
     $headers_table->set_row_attribs(array('class' => 'advanced', 'style' => $display['eheadadv']));
     $headers_table->add(null, html::label($field_id, rcmail::Q($this->gettext('operator'))));
     $headers_table->add(null, $select_match->show($defaults['headerop']));
     $field_id = 'rcmfd_eheadval_' . $rowid;
     $input_header = new html_inputfield(array('id' => $field_id, 'name' => '_eheadval[]'));
     if ($defaults['method'] == 'editheaderrem') {
         $headers_table->set_row_attribs(array('class' => 'advanced', 'style' => $display['eheadadv']));
     }
     $headers_table->add(null, html::label($field_id, rcmail::Q($this->gettext('headervalue'))));
     $headers_table->add(null, $input_header->show($defaults['headerval']));
     if ($defaults['method'] == 'editheaderrem') {
         $headers_table->set_row_attribs(array('style' => 'display: none;'));
     }
     $field_id = 'rcmfd_eheadaddlast_' . $rowid;
     $input_index = new html_checkbox(array('id' => $field_id, 'value' => 'last', 'onclick' => rcmail_output::JS_OBJECT_NAME . '.sieverules_toggle_eheadlast(this);', 'name' => '_eheadaddlast[]', 'class' => 'checkbox'));
     $headers_table->add(null, '&nbsp;');
     $headers_table->add(null, $input_index->show($defaults['headerindex']) . "&nbsp;" . html::label($field_id, rcmail::Q($this->gettext('headerappend'))));
     if ($defaults['method'] == 'editheaderadd') {
         $headers_table->set_row_attribs(array('style' => 'display: none;'));
     }
     $input_advopts = new html_checkbox(array('id' => 'hadvopts' . $rowid, 'name' => '_hadv_opts[]', 'onclick' => rcmail_output::JS_OBJECT_NAME . '.sieverules_show_adv(this);', 'value' => '1', 'class' => 'checkbox'));
     $headers_table->add(array('colspan' => '3', 'style' => 'text-align: right'), html::label('nadvopts' . $rowid, rcmail::Q($this->gettext('advancedoptions'))) . $input_advopts->show($display['eheadadv'] == '' ? 1 : 0));
     // begin fileinto action
     $mbox_name = $rcmail->storage->get_folder();
     $input_folderlist = new html_select(array('name' => '_folder[]', 'onchange' => rcmail_output::JS_OBJECT_NAME . '.sieverules_select_folder(this);', 'style' => $defaults['method'] == 'fileinto' || $defaults['method'] == 'fileinto_copy' ? '' : 'display: none;', 'is_escaped' => true));
     $rcmail->render_folder_tree_select($this->mailboxes, $mbox_name, 100, $input_folderlist, false);
     $show_customfolder = 'display: none;';
     if ($rcmail->config->get('sieverules_fileinto_options', 0) == 2 && !$rcmail->storage->folder_exists($defaults['folder'])) {
         $customfolder = rcube_charset::convert($rcmail->storage->mod_folder($defaults['folder']), 'UTF7-IMAP');
         $defaults['folder'] = '@@newfolder';
         $show_customfolder = '';
     }
     $input_customfolder = new html_inputfield(array('name' => '_customfolder[]'));
     $otherfolders = html::span(array('id' => 'customfolder_rowid', 'style' => $show_customfolder), '<br />' . $input_customfolder->show($customfolder));
     // begin redirect action
     $input_address = new html_inputfield(array('name' => '_redirect[]', 'style' => $defaults['method'] == 'redirect' || $defaults['method'] == 'redirect_copy' ? '' : 'display: none;'));
     // begin reject action
     $input_reject = new html_textarea(array('name' => '_reject[]', 'rows' => '5', 'cols' => '40', 'style' => $defaults['method'] == 'reject' || $defaults['method'] == 'ereject' ? '' : 'display: none;'));
     // begin imapflags action
     $input_imapflags = new html_select(array('name' => '_imapflags[]', 'style' => $defaults['method'] == 'imapflags' || $defaults['method'] == 'imap4flags' ? '' : 'display: none;'));
     foreach ($this->flags as $name => $val) {
         $input_imapflags->add($this->gettext($name), $val);
     }
     // add actions to UI
     $actions_table->add('folder', $input_folderlist->show($defaults['folder']) . $otherfolders . $input_address->show($defaults['address']) . $vacs_table->show() . $notify_table->show() . $input_imapflags->show($defaults['flags']) . $input_reject->show($defaults['reject']) . $headers_table->show());
     // add add/delete buttons to UI (if enabled)
     $add_button = $this->api->output->button(array('command' => 'plugin.sieverules.add_action', 'type' => 'link', 'class' => 'add', 'title' => 'sieverules.addsieveact', 'content' => ' '));
     $delete_button = $this->api->output->button(array('command' => 'plugin.sieverules.del_action', 'type' => 'link', 'class' => 'delete', 'classact' => 'delete_act', 'title' => 'sieverules.deletesieveact', 'content' => ' '));
     if ($rcmail->config->get('sieverules_multiple_actions')) {
         $actions_table->add('control', $add_button . $delete_button);
     } else {
         $actions_table->add('control', "&nbsp;");
     }
     return $actions_table;
 }
 public static function breadcrumb($items)
 {
     $divider = html::span('divider', ' / ');
     return html::ul('breadcrumb', '<li>' . implode("{$divider}</li><li>", $items) . '</li>');
 }
Example #16
0
        echo '<p class="hint">You still have some obsolete or inexistent properties set. This isn\'t a problem but should be noticed.</p>';
        echo '<ul class="configwarings">';
        foreach ($messages['obsolete'] as $msg) {
            echo html::tag('li', null, html::span('propname', $msg['prop']) . ($msg['name'] ? ':&nbsp;' . $msg['name'] : ''));
        }
        echo '</ul>';
    }
    echo '<p class="suggestion">OK, lazy people can download the updated config file here: ';
    echo html::a(array('href' => './?_mergeconfig=1'), 'config.inc.php') . ' &nbsp;';
    echo "</p>";
    if (is_array($messages['dependencies'])) {
        echo '<h3 class="warning">Dependency check failed</h3>';
        echo '<p class="hint">Some of your configuration settings require other options to be configured or additional PHP modules to be installed</p>';
        echo '<ul class="configwarings">';
        foreach ($messages['dependencies'] as $msg) {
            echo html::tag('li', null, html::span('propname', $msg['prop']) . ': ' . $msg['explain']);
        }
        echo '</ul>';
    }
}
?>

<h3>Check if directories are writable</h3>
<p>Roundcube may need to write/save files into these directories</p>
<?php 
$dirs[] = $RCI->config['temp_dir'] ? $RCI->config['temp_dir'] : 'temp';
if ($RCI->config['log_driver'] != 'syslog') {
    $dirs[] = $RCI->config['log_dir'] ? $RCI->config['log_dir'] : 'logs';
}
foreach ($dirs as $dir) {
    $dirpath = rcube_utils::is_absolute_path($dir) ? $dir : INSTALL_PATH . $dir;
 public function block(block_contents $bc, $region)
 {
     $bc->attributes['class'] = classes::replace($bc->attributes['class'], array('invisible' => 'muted'));
     $bc = clone $bc;
     if (empty($bc->blockinstanceid) || !strip_tags($bc->title)) {
         $bc->collapsible = block_contents::NOT_HIDEABLE;
     }
     if ($bc->collapsible == block_contents::HIDDEN) {
         $bc->add_class('hidden');
     }
     if (!empty($bc->controls)) {
         $bc->add_class('block_with_controls');
     }
     $bc->add_class('well');
     // Bootstrap style.
     // Bit strange of bootstrap to hard code the style below but that's what the example does.
     $bc->attributes['style'] = 'padding: 8px 0;';
     $skiptitle = strip_tags($bc->title);
     if (empty($skiptitle)) {
         $output = '';
         $skipdest = '';
     } else {
         $output = html::a(array('href' => '#sb-' . $bc->skipid, 'class' => 'skip-block'), get_string('skipa', 'access', $skiptitle));
         $skipdest = html::span(array('id' => 'sb-' . $bc->skipid, 'class' => 'skip-block-to'));
     }
     $output .= html::div($bc->attributes, $this->block_header($bc) . $this->block_content($bc));
     $output .= $this->block_annotation($bc);
     $output .= $skipdest;
     $this->init_block_hider_js($bc);
     return $output;
 }
 /**
  * Handler for task/itip-status requests
  */
 public function task_itip_status()
 {
     $data = rcube_utils::get_input_value('data', rcube_utils::INPUT_POST, true);
     // find local copy of the referenced task
     $existing = $this->driver->get_task($data);
     $itip = $this->load_itip();
     $response = $itip->get_itip_status($data, $existing);
     // get a list of writeable lists to save new tasks to
     if (!$existing && $response['action'] == 'rsvp' || $response['action'] == 'import') {
         $lists = $this->driver->get_lists();
         $select = new html_select(array('name' => 'tasklist', 'id' => 'itip-saveto', 'is_escaped' => true));
         $select->add('--', '');
         foreach ($lists as $list) {
             if ($list['editable']) {
                 $select->add($list['name'], $list['id']);
             }
         }
     }
     if ($select) {
         $default_list = $this->get_default_tasklist($data['sensitivity']);
         $response['select'] = html::span('folder-select', $this->gettext('saveintasklist') . '&nbsp;' . $select->show($default_list['id']));
     }
     $this->rc->output->command('plugin.update_itip_object_status', $response);
 }
 /**
  * Form to select options for exporting events
  */
 function events_export_form($attrib = array())
 {
     if (!$attrib['id']) {
         $attrib['id'] = 'rcmExportForm';
     }
     $html .= html::div('form-section', html::label('event-export-calendar', $this->cal->gettext('calendar')) . $this->calendar_select(array('name' => 'calendar', 'id' => 'event-export-calendar')));
     $select = new html_select(array('name' => 'range', 'id' => 'event-export-range'));
     $select->add(array($this->cal->gettext('all'), $this->cal->gettext('onemonthback'), $this->cal->gettext(array('name' => 'nmonthsback', 'vars' => array('nr' => 2))), $this->cal->gettext(array('name' => 'nmonthsback', 'vars' => array('nr' => 3))), $this->cal->gettext(array('name' => 'nmonthsback', 'vars' => array('nr' => 6))), $this->cal->gettext(array('name' => 'nmonthsback', 'vars' => array('nr' => 12))), $this->cal->gettext('customdate')), array(0, '1', '2', '3', '6', '12', 'custom'));
     $startdate = new html_inputfield(array('name' => 'start', 'size' => 11, 'id' => 'event-export-startdate'));
     $html .= html::div('form-section', html::label('event-export-range', $this->cal->gettext('exportrange')) . $select->show(0) . html::span(array('style' => 'display:none'), $startdate->show()));
     $checkbox = new html_checkbox(array('name' => 'attachments', 'id' => 'event-export-attachments', 'value' => 1));
     $html .= html::div('form-section', html::label('event-export-range', $this->cal->gettext('exportattachments')) . $checkbox->show(1));
     $this->rc->output->add_gui_object('exportform', $attrib['id']);
     return html::tag('form', array('action' => $this->rc->url(array('task' => 'calendar', 'action' => 'export_events')), 'method' => "post", 'id' => $attrib['id']), $html);
 }
Example #20
0
 /**
  * Dispatcher for event actions initiated by the client
  */
 function event_action()
 {
     $action = get_input_value('action', RCUBE_INPUT_GPC);
     $event = get_input_value('e', RCUBE_INPUT_POST, true);
     $success = $reload = $got_msg = false;
     $driver = null;
     if ($event['calendar']) {
         $driver = $this->get_driver_by_cal($event['calendar']);
     }
     // This can happen if creating a new event outside the calendar e.g. from an ical file attached to an email.
     if (!$driver) {
         $driver = $this->get_default_driver();
     }
     // don't notify if modifying a recurring instance (really?)
     if ($event['_savemode'] && $event['_savemode'] != 'all' && $event['_notify']) {
         unset($event['_notify']);
     }
     // read old event data in order to find changes
     if (($event['_notify'] || $event['decline']) && $action != 'new') {
         $old = $driver->get_event($event);
     }
     switch ($action) {
         case "new":
             // create UID for new event
             $event['uid'] = $this->generate_uid();
             $this->prepare_event($event, $action);
             if ($success = $driver->new_event($event)) {
                 $new_event = $driver->get_event($event['uid']);
                 $event['event_id'] = $new_event['calendar'] . ':' . $new_event['id'];
                 $event['id'] = $event['uid'];
                 $this->cleanup_event($event);
             }
             $reload = $success && ($event['recurrence'] || $event['tzname'] != $this->timezone->getName()) ? 2 : 1;
             break;
         case "edit":
             // Begin mod by Rosali (cross driver editing - https://gitlab.awesome-it.de/kolab/roundcube-plugins/issues/32)
             $source = $event['_fromcalendar'];
             $destination = $event['calendar'];
             if ($source && $source != $destination) {
                 $olddriver = $this->get_driver_by_cal($event['_fromcalendar']);
                 $event['calendar'] = $source;
                 if ($success = $olddriver->remove_event($event)) {
                     $this->prepare_event($event, 'new');
                     $newdriver = $this->get_driver_by_cal($destination);
                     $event['uid'] = $this->generate_uid();
                     $event['calendar'] = $destination;
                     if ($success = $newdriver->new_event($event)) {
                         $event['id'] = $event['uid'];
                         $this->cleanup_event($event);
                     }
                 }
             } else {
                 $this->prepare_event($event, $action);
                 if ($success = $driver->edit_event($event)) {
                     $this->cleanup_event($event);
                 }
             }
             // End mod by Rosali
             $reload = $success && ($event['recurrence'] || $event['recurrence_id'] || $event['tzname'] != $this->timezone->getName() || $event['_savemode'] || $event['_fromcalendar']) ? 2 : 1;
             // Mod by Rosali (trigger complete reload if there is a recurrence_id)
             break;
         case "resize":
             $this->prepare_event($event, $action);
             $success = $driver->resize_event($event);
             $reload = $event['_savemode'] ? 2 : 1;
             break;
         case "move":
             $this->prepare_event($event, $action);
             $success = $driver->move_event($event);
             $reload = $success && $event['_savemode'] ? 2 : 1;
             break;
         case "remove":
             // remove previous deletes
             $undo_time = $driver->undelete ? $this->rc->config->get('undo_timeout', 0) : 0;
             $this->rc->session->remove('calendar_event_undo');
             // search for event if only UID is given
             if (!isset($event['calendar']) && $event['uid']) {
                 if (!($event = $driver->get_event($event, true))) {
                     break;
                 }
                 $undo_time = 0;
             }
             $success = $driver->remove_event($event, $undo_time < 1);
             $reload = !$success || $event['_savemode'] || $event['exception'] ? 2 : 1;
             // Mod by Rosali (trigger refetch if a RECURRENCE-ID event is removed
             if ($undo_time > 0 && $success) {
                 $_SESSION['calendar_event_undo'] = array('ts' => time(), 'data' => $event);
                 // display message with Undo link.
                 $msg = html::span(null, $this->gettext('successremoval')) . ' ' . html::a(array('onclick' => sprintf("%s.http_request('event', 'action=undo', %s.display_message('', 'loading'))", JS_OBJECT_NAME, JS_OBJECT_NAME)), rcube_label('undo'));
                 $this->rc->output->show_message($msg, 'confirmation', null, true, $undo_time);
                 $got_msg = true;
             } else {
                 if ($success) {
                     $this->rc->output->show_message('calendar.successremoval', 'confirmation');
                     $got_msg = true;
                 }
             }
             // send iTIP reply that participant has declined the event
             if ($success && $event['decline']) {
                 $emails = $this->get_user_emails();
                 foreach ($old['attendees'] as $i => $attendee) {
                     if ($attendee['role'] == 'ORGANIZER') {
                         $organizer = $attendee;
                     } else {
                         if ($attendee['email'] && in_array(strtolower($attendee['email']), $emails)) {
                             $old['attendees'][$i]['status'] = 'DECLINED';
                             $reply_sender = $attendee['email'];
                         }
                     }
                 }
                 $itip = $this->load_itip();
                 $itip->set_sender_email($reply_sender);
                 if ($organizer && $itip->send_itip_message($old, 'REPLY', $organizer, 'itipsubjectdeclined', 'itipmailbodydeclined')) {
                     $this->rc->output->command('display_message', $this->gettext(array('name' => 'sentresponseto', 'vars' => array('mailto' => $organizer['name'] ? $organizer['name'] : $organizer['email']))), 'confirmation');
                 } else {
                     $this->rc->output->command('display_message', $this->gettext('itipresponseerror'), 'error');
                 }
             }
             break;
         case "undo":
             // Restore deleted event
             $event = $_SESSION['calendar_event_undo']['data'];
             if ($event) {
                 $success = $driver->restore_event($event);
             }
             if ($success) {
                 $this->rc->session->remove('calendar_event_undo');
                 $this->rc->output->show_message('calendar.successrestore', 'confirmation');
                 $got_msg = true;
                 $reload = 2;
             }
             break;
         case "rsvp-status":
             $action = 'rsvp';
             $status = $event['fallback'];
             $latest = false;
             $html = html::div('rsvp-status', $status != 'CANCELLED' ? $this->gettext('acceptinvitation') : '');
             if (is_numeric($event['changed'])) {
                 $event['changed'] = new DateTime('@' . $event['changed']);
             }
             if ($existing = $driver->get_event($event, true, false, true)) {
                 $latest = $event['sequence'] && $existing['sequence'] == $event['sequence'] || !$event['sequence'] && $existing['changed'] && $existing['changed'] >= $event['changed'];
                 $emails = $this->get_user_emails();
                 foreach ($existing['attendees'] as $i => $attendee) {
                     if ($attendee['email'] && in_array(strtolower($attendee['email']), $emails)) {
                         $status = $attendee['status'];
                         break;
                     }
                 }
             } else {
                 // get a list of writeable calendars
                 $calendars = $driver->list_calendars(false, true);
                 $calendar_select = new html_select(array('name' => 'calendar', 'class' => 'calendar-saveto', 'is_escaped' => true));
                 // Mod by Rosali (calendar selector can exist multiple times - can't be referenced by ID)
                 $numcals = 0;
                 foreach ($calendars as $calendar) {
                     // Begin mod by Rosali (https://gitlab.awesome-it.de/kolab/roundcube-plugins/issues/33)
                     $driver = $this->get_driver_by_cal($calendar['calendar_id']);
                     if ($driver->readonly !== true) {
                         // End mod by Rosali
                         $calendar_select->add($calendar['name'], $calendar['id']);
                         $numcals++;
                     }
                 }
                 if ($numcals <= 1) {
                     $calendar_select = null;
                 }
             }
             if ($status == 'unknown') {
                 $html = html::div('rsvp-status', $this->gettext('notanattendee'));
                 $action = 'import';
             } else {
                 if (in_array($status, array('ACCEPTED', 'TENTATIVE', 'DECLINED'))) {
                     $html = html::div('rsvp-status ' . strtolower($status), $this->gettext('youhave' . strtolower($status)));
                     if ($existing['sequence'] > $event['sequence'] || !$event['sequence'] && $existing['changed'] && $existing['changed'] > $event['changed']) {
                         $action = '';
                         // nothing to do here, outdated invitation
                     }
                 }
             }
             $default_calendar = $calendar_select ? $this->get_default_calendar(true) : null;
             $calendar_saveto = new html_hiddenfield(array('class' => 'calendar-saveto', 'value' => $existing['calendar']));
             // Mod by Rosali (always pass calendar to GUI)
             // Mod by Rosali (calendar selector can exist multiple times - can't be referenced by ID)
             $this->rc->output->command('plugin.update_event_rsvp_status', array('uid' => $event['uid'], 'id' => asciiwords($event['uid'], true), 'saved' => $existing ? true : false, 'latest' => $latest, 'status' => $status, 'action' => $action ? $action : 'rsvp', 'html' => $html, 'select' => $calendar_select ? html::tag('span', null, $this->gettext('saveincalendar') . '&nbsp;') . html::span('calendar-select', $calendar_select->show($this->rc->config->get('calendar_default_calendar', $default_calendar['id']))) : $calendar_saveto->show()));
             return;
         case "rsvp":
             $ev = $driver->get_event($event);
             $ev['attendees'] = $event['attendees'];
             $event = $ev;
             if ($success = $driver->edit_event($event)) {
                 $status = get_input_value('status', RCUBE_INPUT_GPC);
                 $organizer = null;
                 foreach ($event['attendees'] as $i => $attendee) {
                     if ($attendee['role'] == 'ORGANIZER') {
                         $organizer = $attendee;
                         break;
                     }
                 }
                 $itip = $this->load_itip();
                 if ($organizer && $itip->send_itip_message($event, 'REPLY', $organizer, 'itipsubject' . $status, 'itipmailbody' . $status)) {
                     $this->rc->output->command('display_message', $this->gettext(array('name' => 'sentresponseto', 'vars' => array('mailto' => $organizer['name'] ? $organizer['name'] : $organizer['email']))), 'confirmation');
                 } else {
                     $this->rc->output->command('display_message', $this->gettext('itipresponseerror'), 'error');
                 }
             }
             break;
         case "dismiss":
             $event['ids'] = explode(',', $event['id']);
             $plugin = $this->rc->plugins->exec_hook('dismiss_alarms', $event);
             $success = $plugin['success'];
             foreach ($event['ids'] as $id) {
                 if (strpos($id, 'cal:') === 0) {
                     $success |= $driver->dismiss_alarm(substr($id, 4), $event['snooze']);
                 }
             }
             break;
     }
     // show confirmation/error message
     if (!$got_msg) {
         if ($success) {
             $this->rc->output->show_message('successfullysaved', 'confirmation');
         } else {
             $this->rc->output->show_message('calendar.errorsaving', 'error');
         }
     }
     // send out notifications
     if ($success && $event['_notify'] && ($event['attendees'] || $old['attendees'])) {
         // make sure we have the complete record
         $event = $action == 'remove' ? $old : $driver->get_event($event);
         // only notify if data really changed (TODO: do diff check on client already)
         if (!$old || $action == 'remove' || self::event_diff($event, $old)) {
             $sent = $this->notify_attendees($event, $old, $action);
             if ($sent > 0) {
                 $this->rc->output->show_message('calendar.itipsendsuccess', 'confirmation');
             } else {
                 if ($sent < 0) {
                     $this->rc->output->show_message('calendar.errornotifying', 'error');
                 }
             }
         }
     }
     // unlock client
     $this->rc->output->command('plugin.unlock_saving');
     // Begin mod by Rosali (make the event accessible by GUI)
     $this->rc->output->command('plugin.event_callback', array('task' => $this->rc->task, 'action' => $this->rc->action, 'evt' => $action != 'remove' ? $this->_client_event($event) : null));
     // End mod by Rosali
     // update event object on the client or trigger a complete refretch if too complicated
     if ($reload) {
         $args = array('source' => $event['calendar']);
         if ($reload > 1) {
             $args['refetch'] = true;
         } else {
             if ($action != 'remove') {
                 $args['update'] = $this->_client_event($driver->get_event($event));
             }
         }
         $this->rc->output->command('plugin.refresh_calendar', $args);
     }
 }
Example #21
0
 /**
  * Handler for template_object_messagebody hook.
  * This callback function adds a box below the message content
  * if there is a key/cert attachment available
  */
 function message_output($p)
 {
     foreach ($this->keys_parts as $part) {
         // remove part's body
         if (in_array($part, $this->keys_bodies)) {
             $p['content'] = '';
         }
         // add box below message body
         $p['content'] .= html::p(array('class' => 'enigmaattachment'), html::a(array('href' => "#", 'onclick' => "return " . rcmail_output::JS_OBJECT_NAME . ".enigma_import_attachment('" . rcube::JQ($part) . "')", 'title' => $this->enigma->gettext('keyattimport')), html::span(null, $this->enigma->gettext('keyattfound'))));
         $attach_scripts = true;
     }
     if ($attach_scripts) {
         // add css and js script
         $this->add_css();
         $this->add_js();
     }
     return $p;
 }
 function mh_get_form_row($header = 'from', $input = '', $color = '#ffffff', $delete = false)
 {
     // header select box
     $header_select = new html_select(array('name' => '_mh_header[]', 'class' => 'rcmfd_mh_header'));
     $header_select->add(Q($this->gettext('subject')), 'subject');
     $header_select->add(Q($this->gettext('from')), 'from');
     $header_select->add(Q($this->gettext('to')), 'to');
     $header_select->add(Q($this->gettext('cc')), 'cc');
     // input field
     $input = new html_inputfield(array('name' => '_mh_input[]', 'class' => 'rcmfd_mh_input', 'type' => 'text', 'autocomplete' => 'off', 'value' => $input));
     // color box
     $color = html::tag('input', array('id' => uniqid(), 'name' => '_mh_color[]', 'type' => 'color', 'text' => 'hidden', 'class' => 'mh_color_input', 'value' => $color, 'data-hex' => 'true'));
     // delete button
     $button = html::tag('input', array('class' => 'button mh_delete mh_button', 'type' => 'button', 'value' => $this->gettext('mh_delete'), 'title' => $this->gettext('mh_delete_description')));
     // add button
     $add_button = html::tag('input', array('class' => 'button mh_add mh_button', 'type' => 'button', 'value' => $this->gettext('mh_add'), 'title' => $this->gettext('mh_add_description')));
     $content = $header_select->show($header) . html::span('mh_matches', Q($this->gettext('mh_matches'))) . $input->show() . html::span('mh_color', Q($this->gettext('mh_color'))) . $color . $button . $add_button;
     if (rcmail::get_instance()->config->get('request_saver_compress_html', false)) {
         $content = request_saver::html_compress($content);
     }
     return $content;
 }
Example #23
0
 /**
  * Add UI element to copy event invitations or updates to the calendar
  */
 public function mail_messagebody_html($p)
 {
     // load iCalendar functions (if necessary)
     if (!empty($this->lib->ical_parts)) {
         $this->get_ical();
         $this->load_itip();
     }
     $html = '';
     $has_events = false;
     $ical_objects = $this->lib->get_mail_ical_objects();
     // show a box for every event in the file
     foreach ($ical_objects as $idx => $event) {
         if ($event['_type'] != 'event') {
             // skip non-event objects (#2928)
             continue;
         }
         $has_events = true;
         // get prepared inline UI for this event object
         if ($ical_objects->method) {
             $append = '';
             // prepare a small agenda preview to be filled with actual event data on async request
             if ($ical_objects->method == 'REQUEST') {
                 $append = html::div('calendar-agenda-preview', html::tag('h3', 'preview-title', $this->gettext('agenda') . ' ' . html::span('date', $this->rc->format_date($event['start'], $this->rc->config->get('date_format')))) . '%before%' . $this->mail_agenda_event_row($event, 'current') . '%after%');
             }
             $html .= html::div('calendar-invitebox', $this->itip->mail_itip_inline_ui($event, $ical_objects->method, $ical_objects->mime_id . ':' . $idx, 'calendar', rcube_utils::anytodatetime($ical_objects->message_date), $this->rc->url(array('task' => 'calendar')) . '&view=agendaDay&date=' . $event['start']->format('U')) . $append);
         }
         // limit listing
         if ($idx >= 3) {
             break;
         }
     }
     // prepend event boxes to message body
     if ($html) {
         $this->ui->init();
         $p['content'] = $html . $p['content'];
         $this->rc->output->add_label('calendar.savingdata', 'calendar.deleteventconfirm', 'calendar.declinedeleteconfirm');
     }
     // add "Save to calendar" button into attachment menu
     if ($has_events) {
         $this->add_button(array('id' => 'attachmentsavecal', 'name' => 'attachmentsavecal', 'type' => 'link', 'wrapper' => 'li', 'command' => 'attachment-save-calendar', 'class' => 'icon calendarlink', 'classact' => 'icon calendarlink active', 'innerclass' => 'icon calendar', 'label' => 'calendar.savetocalendar'), 'attachmentmenu');
     }
     return $p;
 }
Example #24
0
 /**
  * Template object for list records counter.
  *
  * @param array Object attributes
  *
  * @return string HTML output
  */
 function tpl_keys_rowcount($attrib)
 {
     if (!$attrib['id']) {
         $attrib['id'] = 'rcmcountdisplay';
     }
     $this->rc->output->add_gui_object('countdisplay', $attrib['id']);
     return html::span($attrib, $this->get_rowcount_text());
 }
 protected function add_tip($id, $str, $error = false)
 {
     if ($error) {
         $str = html::span('sieve error', $str);
     }
     $this->tips[] = array($id, $str);
 }
 /**
  *
  */
 function tasklists($attrib = array())
 {
     $lists = $this->plugin->driver->get_lists();
     $li = '';
     foreach ((array) $lists as $id => $prop) {
         if ($attrib['activeonly'] && !$prop['active']) {
             continue;
         }
         unset($prop['user_id']);
         $prop['alarms'] = $this->plugin->driver->alarms;
         $prop['undelete'] = $this->plugin->driver->undelete;
         $prop['sortable'] = $this->plugin->driver->sortable;
         $prop['attachments'] = $this->plugin->driver->attachments;
         $jsenv[$id] = $prop;
         $html_id = html_identifier($id);
         $class = 'tasks-' . asciiwords($id, true);
         if (!$prop['editable']) {
             $class .= ' readonly';
         }
         if ($prop['class_name']) {
             $class .= ' ' . $prop['class_name'];
         }
         $li .= html::tag('li', array('id' => 'rcmlitasklist' . $html_id, 'class' => $class), html::tag('input', array('type' => 'checkbox', 'name' => '_list[]', 'value' => $id, 'checked' => $prop['active'])) . html::span('handle', '&nbsp;') . html::span('listname', $prop['name']));
     }
     $this->rc->output->set_env('tasklists', $jsenv);
     $this->rc->output->add_gui_object('folderlist', $attrib['id']);
     return html::tag('ul', $attrib, $li, html::$common_attrib);
 }
 /**
  * Create and register a button
  *
  * @param  array Named button attributes
  * @return string HTML button
  * @todo   Remove all inline JS calls and use jQuery instead.
  * @todo   Remove all sprintf()'s - they are pretty, but also slow.
  */
 public function button($attrib)
 {
     static $s_button_count = 100;
     // these commands can be called directly via url
     $a_static_commands = array('compose', 'list', 'preferences', 'folders', 'identities');
     if (!($attrib['command'] || $attrib['name'] || $attrib['href'])) {
         return '';
     }
     // try to find out the button type
     if ($attrib['type']) {
         $attrib['type'] = strtolower($attrib['type']);
     } else {
         $attrib['type'] = $attrib['image'] || $attrib['imagepas'] || $attrib['imageact'] ? 'image' : 'link';
     }
     $command = $attrib['command'];
     if ($attrib['task']) {
         $command = $attrib['task'] . '.' . $command;
     }
     if (!$attrib['image']) {
         $attrib['image'] = $attrib['imagepas'] ? $attrib['imagepas'] : $attrib['imageact'];
     }
     if (!$attrib['id']) {
         $attrib['id'] = sprintf('rcmbtn%d', $s_button_count++);
     }
     // get localized text for labels and titles
     if ($attrib['title']) {
         $attrib['title'] = html::quote($this->app->gettext($attrib['title'], $attrib['domain']));
     }
     if ($attrib['label']) {
         $attrib['label'] = html::quote($this->app->gettext($attrib['label'], $attrib['domain']));
     }
     if ($attrib['alt']) {
         $attrib['alt'] = html::quote($this->app->gettext($attrib['alt'], $attrib['domain']));
     }
     // set title to alt attribute for IE browsers
     if ($this->browser->ie && !$attrib['title'] && $attrib['alt']) {
         $attrib['title'] = $attrib['alt'];
     }
     // add empty alt attribute for XHTML compatibility
     if (!isset($attrib['alt'])) {
         $attrib['alt'] = '';
     }
     // register button in the system
     if ($attrib['command']) {
         $this->add_script(sprintf("%s.register_button('%s', '%s', '%s', '%s', '%s', '%s');", self::JS_OBJECT_NAME, $command, $attrib['id'], $attrib['type'], $attrib['imageact'] ? $this->abs_url($attrib['imageact']) : $attrib['classact'], $attrib['imagesel'] ? $this->abs_url($attrib['imagesel']) : $attrib['classsel'], $attrib['imageover'] ? $this->abs_url($attrib['imageover']) : ''));
         // make valid href to specific buttons
         if (in_array($attrib['command'], rcmail::$main_tasks)) {
             $attrib['href'] = $this->app->url(array('task' => $attrib['command']));
             $attrib['onclick'] = sprintf("return %s.command('switch-task','%s',this,event)", self::JS_OBJECT_NAME, $attrib['command']);
         } else {
             if ($attrib['task'] && in_array($attrib['task'], rcmail::$main_tasks)) {
                 $attrib['href'] = $this->app->url(array('action' => $attrib['command'], 'task' => $attrib['task']));
             } else {
                 if (in_array($attrib['command'], $a_static_commands)) {
                     $attrib['href'] = $this->app->url(array('action' => $attrib['command']));
                 } else {
                     if (($attrib['command'] == 'permaurl' || $attrib['command'] == 'extwin') && !empty($this->env['permaurl'])) {
                         $attrib['href'] = $this->env['permaurl'];
                     }
                 }
             }
         }
     }
     // overwrite attributes
     if (!$attrib['href']) {
         $attrib['href'] = '#';
     }
     if ($attrib['task']) {
         if ($attrib['classact']) {
             $attrib['class'] = $attrib['classact'];
         }
     } else {
         if ($command && !$attrib['onclick']) {
             $attrib['onclick'] = sprintf("return %s.command('%s','%s',this,event)", self::JS_OBJECT_NAME, $command, $attrib['prop']);
         }
     }
     $out = '';
     // generate image tag
     if ($attrib['type'] == 'image') {
         $attrib_str = html::attrib_string($attrib, array('style', 'class', 'id', 'width', 'height', 'border', 'hspace', 'vspace', 'align', 'alt', 'tabindex', 'title'));
         $btn_content = sprintf('<img src="%s"%s />', $this->abs_url($attrib['image']), $attrib_str);
         if ($attrib['label']) {
             $btn_content .= ' ' . $attrib['label'];
         }
         $link_attrib = array('href', 'onclick', 'onmouseover', 'onmouseout', 'onmousedown', 'onmouseup', 'target');
     } else {
         if ($attrib['type'] == 'link') {
             $btn_content = isset($attrib['content']) ? $attrib['content'] : ($attrib['label'] ? $attrib['label'] : $attrib['command']);
             $link_attrib = array_merge(html::$common_attrib, array('href', 'onclick', 'tabindex', 'target'));
             if ($attrib['innerclass']) {
                 $btn_content = html::span($attrib['innerclass'], $btn_content);
             }
         } else {
             if ($attrib['type'] == 'input') {
                 $attrib['type'] = 'button';
                 if ($attrib['label']) {
                     $attrib['value'] = $attrib['label'];
                 }
                 if ($attrib['command']) {
                     $attrib['disabled'] = 'disabled';
                 }
                 $out = html::tag('input', $attrib, null, array('type', 'value', 'onclick', 'id', 'class', 'style', 'tabindex', 'disabled'));
             }
         }
     }
     // generate html code for button
     if ($btn_content) {
         $attrib_str = html::attrib_string($attrib, array_merge($link_attrib, array('data-*')));
         $out = sprintf('<a%s>%s</a>', $attrib_str, $btn_content);
     }
     if ($attrib['wrapper']) {
         $out = html::tag($attrib['wrapper'], null, $out);
     }
     return $out;
 }
 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;
 }
Example #29
0
 public static function quota_display($attrib)
 {
     $rcmail = rcmail::get_instance();
     if (!$attrib['id']) {
         $attrib['id'] = 'rcmquotadisplay';
     }
     $_SESSION['quota_display'] = !empty($attrib['display']) ? $attrib['display'] : 'text';
     $rcmail->output->add_gui_object('quotadisplay', $attrib['id']);
     $quota = $rcmail->quota_content($attrib);
     $rcmail->output->add_script('rcmail.set_quota(' . rcube_output::json_serialize($quota) . ');', 'docready');
     return html::span($attrib, '&nbsp;');
 }
Example #30
0
 /**
  * Handler for template_object_messagebody hook.
  * This callback function adds a box below the message content
  * if there is a key/cert attachment available
  */
 function message_output($p)
 {
     $attach_script = false;
     foreach ($this->keys_parts as $part) {
         // remove part's body
         if (in_array($part, $this->keys_bodies)) {
             $p['content'] = '';
         }
         $style = "margin:0 1em; padding:0.2em 0.5em; border:1px solid #999; width: auto" . " border-radius:4px; -moz-border-radius:4px; -webkit-border-radius:4px";
         // add box below message body
         $p['content'] .= html::p(array('style' => $style), html::a(array('href' => "#", 'onclick' => "return " . rcmail_output::JS_OBJECT_NAME . ".enigma_import_attachment('" . rcube::JQ($part) . "')", 'title' => $this->gettext('keyattimport')), html::img(array('src' => $this->url('skins/classic/key_add.png'), 'style' => "vertical-align:middle"))) . ' ' . html::span(null, $this->gettext('keyattfound')));
         $attach_script = true;
     }
     if ($attach_script) {
         $this->include_script('enigma.js');
     }
     return $p;
 }