Example #1
0
 /**
  * Creates ACL rights table
  *
  * @param array $attrib Template object attributes
  *
  * @return string HTML Content
  */
 private function list_rights($attrib = array())
 {
     // Get ACL for the folder
     $acl = $this->rc->storage->get_acl($this->mbox);
     if (!is_array($acl)) {
         $acl = array();
     }
     // Keep special entries (anyone/anonymous) on top of the list
     if (!empty($this->specials) && !empty($acl)) {
         foreach ($this->specials as $key) {
             if (isset($acl[$key])) {
                 $acl_special[$key] = $acl[$key];
                 unset($acl[$key]);
             }
         }
     }
     // Sort the list by username
     uksort($acl, 'strnatcasecmp');
     if (!empty($acl_special)) {
         $acl = array_merge($acl_special, $acl);
     }
     // Get supported rights and build column names
     $supported = $this->rights_supported();
     // depending on server capability either use 'te' or 'd' for deleting msgs
     $deleteright = implode(array_intersect(str_split('ted'), $supported));
     // Use advanced or simple (grouped) rights
     $advanced = $this->rc->config->get('acl_advanced_mode');
     if ($advanced) {
         $items = array();
         foreach ($supported as $sup) {
             $items[$sup] = $sup;
         }
     } else {
         $items = array('read' => 'lrs', 'write' => 'wi', 'delete' => $deleteright, 'other' => preg_replace('/[lrswi' . $deleteright . ']/', '', implode($supported)));
     }
     // Create the table
     $attrib['noheader'] = true;
     $table = new html_table($attrib);
     // Create table header
     $table->add_header('user', $this->gettext('identifier'));
     foreach (array_keys($items) as $key) {
         $label = $this->gettext('shortacl' . $key);
         $table->add_header(array('class' => 'acl' . $key, 'title' => $label), $label);
     }
     $js_table = array();
     foreach ($acl as $user => $rights) {
         if ($this->rc->storage->conn->user == $user) {
             continue;
         }
         // filter out virtual rights (c or d) the server may return
         $userrights = array_intersect($rights, $supported);
         $userid = rcube_utils::html_identifier($user);
         if (!empty($this->specials) && in_array($user, $this->specials)) {
             $user = $this->gettext($user);
         }
         $table->add_row(array('id' => 'rcmrow' . $userid));
         $table->add('user', rcube::Q($user));
         foreach ($items as $key => $right) {
             $in = $this->acl_compare($userrights, $right);
             switch ($in) {
                 case 2:
                     $class = 'enabled';
                     break;
                 case 1:
                     $class = 'partial';
                     break;
                 default:
                     $class = 'disabled';
                     break;
             }
             $table->add('acl' . $key . ' ' . $class, '');
         }
         $js_table[$userid] = implode($userrights);
     }
     $this->rc->output->set_env('acl', $js_table);
     $this->rc->output->set_env('acl_advanced', $advanced);
     $out = $table->show();
     return $out;
 }
 function gen_table($attrib)
 {
     $this->rcmail_inst->output->set_env('framed', true);
     $out = '<fieldset><legend>' . $this->gettext('policy_entries') . '</legend>' . "\n";
     $spam_table = new html_table(array('id' => 'spam-table', 'class' => 'records-table', 'cellspacing' => '0', 'cols' => 4));
     $spam_table->add_header(array('width' => '220px'), $this->gettext('policy_entries'));
     $spam_table->add_header(array('class' => 'value', 'width' => '150px'), $this->gettext('policy_tag'));
     $spam_table->add_header(array('class' => 'value', 'width' => '150px'), $this->gettext('policy_tag2'));
     $spam_table->add_header(array('class' => 'value', 'width' => '130px'), $this->gettext('policy_kill'));
     try {
         $session_id = $this->soap->login($this->rcmail_inst->config->get('remote_soap_user'), $this->rcmail_inst->config->get('remote_soap_pass'));
         $mail_user = $this->soap->mail_user_get($session_id, array('login' => $this->rcmail_inst->user->data['username']));
         $spam_user = $this->soap->mail_spamfilter_user_get($session_id, array('email' => $mail_user[0]['email']));
         $policies = $this->soap->mail_policy_get($session_id, array(1 => 1));
         for ($i = 0; $i < count($policies); $i++) {
             $class = $class == 'odd' ? 'even' : 'odd';
             if ($policies[$i]['id'] == $spam_user[0]['policy_id']) {
                 $class = 'selected';
             }
             $spam_table->set_row_attribs(array('class' => $class));
             $this->_spam_row($spam_table, $policies[$i]['policy_name'], $policies[$i]['spam_tag_level'], $policies[$i]['spam_tag2_level'], $policies[$i]['spam_kill_level'], $attrib);
         }
         $this->soap->logout($session_id);
     } catch (SoapFault $e) {
         $this->rcmail_inst->output->command('display_message', 'Soap Error: ' . $e->getMessage(), 'error');
     }
     if (count($policies) == 0) {
         $spam_table->add(array('colspan' => '4'), rep_specialchars_output($this->gettext('spamnopolicies')));
         $spam_table->set_row_attribs(array('class' => 'odd'));
         $spam_table->add_row();
     }
     $out .= "<div id=\"spam-cont\">" . $spam_table->show() . "</div>\n";
     $out .= "</fieldset>\n";
     return $out;
 }
Example #3
0
 /**
  * Create a HTML table based on the given data
  *
  * @param  array  Named table attributes
  * @param  mixed  Table row data. Either a two-dimensional array or a valid SQL result set
  * @param  array  List of cols to show
  * @param  string Name of the identifier col
  *
  * @return string HTML table code
  */
 public function table_output($attrib, $table_data, $a_show_cols, $id_col)
 {
     $table = new html_table();
     // add table header
     if (!$attrib['noheader']) {
         foreach ($a_show_cols as $col) {
             $table->add_header($col, $this->Q($this->gettext($col)));
         }
     }
     if (!is_array($table_data)) {
         $db = $this->get_dbh();
         while ($table_data && ($sql_arr = $db->fetch_assoc($table_data))) {
             $table->add_row(array('id' => 'rcmrow' . rcube_utils::html_identifier($sql_arr[$id_col])));
             // format each col
             foreach ($a_show_cols as $col) {
                 $table->add($col, $this->Q($sql_arr[$col]));
             }
         }
     } else {
         foreach ($table_data as $row_data) {
             $class = !empty($row_data['class']) ? $row_data['class'] : '';
             $rowid = 'rcmrow' . rcube_utils::html_identifier($row_data[$id_col]);
             $table->add_row(array('id' => $rowid, 'class' => $class));
             // format each col
             foreach ($a_show_cols as $col) {
                 $table->add($col, $this->Q(is_array($row_data[$col]) ? $row_data[$col][0] : $row_data[$col]));
             }
         }
     }
     return $table->show($attrib);
 }
 /**
  * Table oultine for event changelog display
  */
 function event_changelog_table($attrib = array())
 {
     $table = new html_table(array('cols' => 5, 'border' => 0, 'cellspacing' => 0));
     $table->add_header('diff', '');
     $table->add_header('revision', $this->cal->gettext('revision'));
     $table->add_header('date', $this->cal->gettext('date'));
     $table->add_header('user', $this->cal->gettext('user'));
     $table->add_header('operation', $this->cal->gettext('operation'));
     $table->add_header('actions', '&nbsp;');
     return $table->show($attrib);
 }
 function gen_table($attrib)
 {
     $this->rcmail_inst->output->set_env('framed', true);
     $out = '<fieldset><legend>' . $this->gettext('forward_entries') . '</legend>' . "\n";
     $rule_table = new html_table(array('id' => 'rule-table', 'class' => 'records-table', 'cellspacing' => '0', 'cols' => 2));
     $rule_table->add_header("", $this->gettext('forward_entries'));
     $rule_table->add_header(array('width' => '16px'), '');
     try {
         $session_id = $this->soap->login($this->rcmail_inst->config->get('remote_soap_user'), $this->rcmail_inst->config->get('remote_soap_pass'));
         $mail_user = $this->soap->mail_user_get($session_id, array('login' => $this->rcmail_inst->user->data['username']));
         $this->soap->logout($session_id);
         $forward = explode(",", $mail_user[0]['cc']);
         if (!empty($forward[0])) {
             for ($i = 0; $i < count($forward); $i++) {
                 $class = $class == 'odd' ? 'even' : 'odd';
                 if ($forward[$i] == get_input_value('_forwardingaddress', RCUBE_INPUT_GET)) {
                     $class = 'selected';
                 }
                 $rule_table->set_row_attribs(array('class' => $class, 'id' => 'rule_' . $forward[$i]));
                 $this->_rule_row($rule_table, $forward[$i], $attrib);
             }
         } else {
             $rule_table->add(array('colspan' => '2'), rep_specialchars_output($this->gettext('forwardnomails')));
             $rule_table->set_row_attribs(array('class' => 'odd'));
             $rule_table->add_row();
         }
     } catch (SoapFault $e) {
         $this->rcmail_inst->output->command('display_message', 'Soap Error: ' . $e->getMessage(), 'error');
     }
     $out .= "<div id=\"rule-cont\">" . $rule_table->show() . "</div>\n";
     $out .= "</fieldset>\n";
     return $out;
 }
Example #6
0
 function quarantine_display($ajax = false)
 {
     $ajax = $ajax === true ? true : false;
     // Include quarantine class
     include_once 'AmavisQuarantine.php';
     $this->amacube->quarantine = new AmavisQuarantine($this->rc->config->get('amacube_db_dsn'), $this->rc->config->get('amacube_amavis_host'), $this->rc->config->get('amacube_amavis_port'));
     // Parse form
     if (get_input_value('_token', RCUBE_INPUT_POST, false)) {
         $this->quarantine_post();
     }
     $pagination = array();
     if (!$ajax) {
         $output = '';
         // Get all quarantines (0:0)
         // Used to calculate pagination based on total amount of quarantined messages
         $pagination['start'] = 0;
         $pagination['size'] = 0;
     } else {
         $output = array();
         // Get paged quarantines
         $pagination['current'] = get_input_value('page', RCUBE_INPUT_POST, false) ?: 1;
         $pagination['total'] = get_input_value('msgcount', RCUBE_INPUT_POST, false);
         if (!$pagination['current'] || !$pagination['total']) {
             return;
         }
         $pagination['current'] = (int) $pagination['current'];
         $pagination['total'] = (int) $pagination['total'];
         $pagination['size'] = $this->rc->config->get('mail_pagesize');
         $pagination['count'] = ceil($pagination['total'] / $pagination['size']);
         $pagination['start'] = $pagination['current'] * $pagination['size'] - $pagination['size'];
         $pagination['stop'] = $pagination['start'] + $pagination['size'];
     }
     $quarantines = $this->amacube->quarantine->list_quarantines($pagination['start'], $pagination['size']);
     if (!is_array($quarantines)) {
         // Send feedback
         $this->feedback();
         // Return on error
         return;
     }
     if (count($quarantines) == 0) {
         $this->amacube->feedback[] = array('type' => 'notice', 'message' => 'quarantine_no_result');
     }
     if (!$ajax) {
         $pagination['current'] = 1;
         $pagination['size'] = $this->rc->config->get('mail_pagesize');
         $pagination['count'] = ceil(count($quarantines) / $pagination['size']);
         $pagination['start'] = $pagination['current'] * $pagination['size'] - $pagination['size'];
         $pagination['stop'] = $pagination['start'] + $pagination['size'];
         $pagination['total'] = count($quarantines);
     }
     // Pagination string
     $pagination['begin'] = $pagination['start'] + 1;
     $pagination['end'] = $pagination['total'] <= $pagination['size'] ? $pagination['total'] : ($pagination['stop'] > $pagination['total'] ? $pagination['total'] : $pagination['stop']);
     if (count($quarantines) == 0) {
         $string = Q($this->gettext('quarantine_no_result'));
     } else {
         $string = Q($this->gettext('messages')) . ' ' . $pagination['begin'] . ' ' . Q($this->gettext('to')) . ' ' . $pagination['end'] . ' ' . Q($this->gettext('of')) . ' ' . $pagination['total'];
     }
     if (!$ajax) {
         // Store locally for template use (js include not loaded yet; command unavailable)
         $this->rc->amacube->pagecount_string = $string;
     } else {
         $this->rc->output->command('amacube.messagecount', $string);
     }
     // Pagination env
     $this->rc->output->set_env('page', $pagination['current']);
     $this->rc->output->set_env('pagecount', $pagination['count']);
     $this->rc->output->set_env('msgcount', $pagination['total']);
     // Create output
     if (!$ajax) {
         // Create output : header table
         $messages_table = new html_table(array('cols' => 7, 'id' => 'messagelist', 'class' => 'records-table messagelist sortheader fixedheader quarantine-messagelist'));
         // Create output : table : headers
         $messages_table->add_header('release', Q($this->gettext('release')));
         $messages_table->add_header('delete', Q($this->gettext('delete')));
         $messages_table->add_header('received', Q($this->gettext('received')));
         $messages_table->add_header('subject', Q($this->gettext('subject')));
         $messages_table->add_header('sender', Q($this->gettext('sender')));
         $messages_table->add_header('type', Q($this->gettext('mailtype')));
         $messages_table->add_header('level', Q($this->gettext('spamlevel')));
     }
     // Create output : table : rows
     foreach ($quarantines as $key => $value) {
         if (!$ajax) {
             if ($key >= $pagination['start'] && $key < $pagination['stop']) {
                 $messages_table->add('release', $this->_show_radio('rel_' . $quarantines[$key]['id'], $quarantines[$key]['id'], '_rel_' . $quarantines[$key]['id']));
                 $messages_table->add('delete', $this->_show_radio('del_' . $quarantines[$key]['id'], $quarantines[$key]['id'], '_del_' . $quarantines[$key]['id']));
                 $messages_table->add('date', Q(date('Y-m-d H:i:s', $quarantines[$key]['received'])));
                 $messages_table->add('subject', Q($quarantines[$key]['subject']));
                 $messages_table->add('sender', Q($quarantines[$key]['sender']));
                 $messages_table->add('type', Q($this->gettext('content_decode_' . $quarantines[$key]['content'])));
                 $messages_table->add('level', Q($quarantines[$key]['level']));
             }
         } else {
             $string = '<tr>';
             $string .= '<td class="release">' . $this->_show_radio('rel_' . $quarantines[$key]['id'], $quarantines[$key]['id'], '_rel_' . $quarantines[$key]['id']) . '</td>';
             $string .= '<td class="delete">' . $this->_show_radio('del_' . $quarantines[$key]['id'], $quarantines[$key]['id'], '_del_' . $quarantines[$key]['id']) . '</td>';
             $string .= '<td class="date">' . Q(date('Y-m-d H:i:s', $quarantines[$key]['received'])) . '</td>';
             $string .= '<td class="subject">' . Q($quarantines[$key]['subject']) . '</td>';
             $string .= '<td class="sender">' . Q($quarantines[$key]['sender']) . '</td>';
             $string .= '<td class="type">' . Q($this->gettext('content_decode_' . $quarantines[$key]['content'])) . '</td>';
             $string .= '<td class="level">' . Q($quarantines[$key]['level']) . '</td>';
             $string .= '</tr>';
             $output[] = $string;
         }
     }
     if (!$ajax) {
         // Create output : table form
         $output_table_form = $this->rc->output->form_tag(array('id' => 'quarantineform', 'name' => 'quarantineform', 'method' => 'post', 'action' => './?_task=quarantine&_action=amacube-quarantine'), $messages_table->show());
         // Add table container form to output
         $output .= $output_table_form;
         // Add form to client
         $this->rc->output->add_gui_object('quarantineform', 'quarantineform');
     } else {
         // Send list command
         $this->rc->output->command('amacube.messagelist', array('messages' => $output));
         // Send page commands
         if ($pagination['current'] > 1) {
             // Enable first & previous
             $this->rc->output->command('amacube.page', 'first', 'enabled');
             $this->rc->output->command('amacube.page', 'previous', 'enabled');
         } else {
             // Disable first & previous
             $this->rc->output->command('amacube.page', 'first', 'disabled');
             $this->rc->output->command('amacube.page', 'previous', 'disabled');
         }
         if ($pagination['current'] < $pagination['count']) {
             // Enable next & last
             $this->rc->output->command('amacube.page', 'next', 'enabled');
             $this->rc->output->command('amacube.page', 'last', 'enabled');
         } else {
             // Disable next & last
             $this->rc->output->command('amacube.page', 'next', 'disabled');
             $this->rc->output->command('amacube.page', 'last', 'disabled');
         }
         // Set output to nothing because client commands were used
         $output = '';
     }
     // Feedback
     $this->feedback();
     return $output;
 }
 function gen_form()
 {
     $this->rcmail_inst->output->set_env('framed', true);
     $out = '<form class="propform"><fieldset><legend>' . $this->gettext('acc_general') . '</legend>' . "\n";
     $table = new html_table(array('cols' => 2, 'cellpadding' => 3, 'class' => 'propform'));
     $table->add('title', rcube::Q($this->gettext('username')));
     $table->add('', rcube::Q($this->rcmail_inst->user->data['username']));
     $table->add('title', rcube::Q($this->gettext('server')));
     $table->add('', rcube::Q($this->rcmail_inst->user->data['mail_host']));
     $table->add('title', rcube::Q($this->gettext('acc_lastlogin')));
     $table->add('', rcube::Q($this->rcmail_inst->user->data['last_login']));
     $identity = $this->rcmail_inst->user->get_identity();
     $table->add('title', rcube::Q($this->gettext('acc_defaultidentity')));
     $table->add('', rcube::Q($identity['name'] . ' <' . $identity['email'] . '>'));
     $out .= $table->show();
     $out .= "</fieldset>\n";
     $out .= '<fieldset><legend>' . $this->gettext('acc_alias') . '</legend>' . "\n";
     $alias_table = new html_table(array('id' => 'alias-table', 'class' => 'records-table', 'cellspacing' => '0', 'cols' => 1));
     $alias_table->add_header(array('width' => '100%'), $this->gettext('mail'));
     try {
         $session_id = $this->soap->login($this->rcmail_inst->config->get('remote_soap_user'), $this->rcmail_inst->config->get('remote_soap_pass'));
         $mail_user = $this->soap->mail_user_get($session_id, array('login' => $this->rcmail_inst->user->data['username']));
         $alias = $this->soap->mail_alias_get($session_id, array('destination' => $mail_user[0]['email'], 'type' => 'alias', 'active' => 'y'));
         $this->soap->logout($session_id);
         $class = $class == 'odd' ? 'even' : 'odd';
         $alias_table->set_row_attribs(array('class' => $class));
         $alias_table->add('', $mail_user[0]['email']);
         for ($i = 0; $i < count($alias); $i++) {
             $class = $class == 'odd' ? 'even' : 'odd';
             $alias_table->set_row_attribs(array('class' => $class));
             $alias_table->add('', $alias[$i]['source']);
         }
     } catch (SoapFault $e) {
         $this->rcmail_inst->output->command('display_message', 'Soap Error: ' . $e->getMessage(), 'error');
     }
     $out .= "<div id=\"alias-cont\">" . $alias_table->show() . "</div>\n";
     $out .= "</fieldset></form>\n";
     return $out;
 }
 /**
  *
  */
 function attendees_list($attrib = array())
 {
     $table = new html_table(array('cols' => 5, 'border' => 0, 'cellpadding' => 0, 'class' => 'rectable'));
     $table->add_header('role', $this->cal->gettext('role'));
     $table->add_header('name', $this->cal->gettext('attendee'));
     $table->add_header('availability', $this->cal->gettext('availability'));
     $table->add_header('confirmstate', $this->cal->gettext('confirmstate'));
     $table->add_header('options', '');
     return $table->show($attrib);
 }
Example #9
0
 function gen_table($attrib)
 {
     $this->rcmail_inst->output->set_env('framed', TRUE);
     $out = '<fieldset><legend>' . $this->gettext('wblistentries') . '</legend>' . "\n";
     $rule_table = new html_table(array('id' => 'rule-table', 'class' => 'records-table', 'cellspacing' => '0', 'cols' => 4));
     $rule_table->add_header("", $this->gettext('wblistentries'));
     $rule_table->add_header(array('width' => '16px'), '');
     $rule_table->add_header(array('width' => '20px'), '');
     $rule_table->add_header(array('width' => '16px'), '');
     try {
         $session_id = $this->soap->login($this->rcmail_inst->config->get('remote_soap_user'), $this->rcmail_inst->config->get('remote_soap_pass'));
         $mail_user = $this->soap->mail_user_get($session_id, array('login' => $this->rcmail_inst->user->data['username']));
         $spam_user = $this->soap->mail_spamfilter_user_get($session_id, array('email' => $mail_user[0]['email']));
         $wblist = $this->soap->mail_spamfilter_whitelist_get($session_id, array('rid' => $spam_user[0]['id']));
         //$blist = $this->soap->mail_spamfilter_blacklist_get($session_id, array('rid' => $spam_user[0]['id']));
         //$wblist = array_merge($wlist, $blist);
         $this->soap->logout($session_id);
         for ($i = 0; $i < count($wblist); $i++) {
             $class = $class == 'odd' ? 'even' : 'odd';
             if ($wblist[$i]['wblist_id'] == get_input_value('_id', RCUBE_INPUT_GET)) {
                 $class = 'selected';
             }
             $rule_table->set_row_attribs(array('class' => $class, 'id' => 'rule_' . $wblist[$i]['wblist_id']));
             $this->_rule_row($rule_table, $wblist[$i]['email'], $wblist[$i]['wb'], $wblist[$i]['active'], $wblist[$i]['wblist_id'], $attrib);
         }
     } catch (SoapFault $e) {
         $this->rcmail_inst->output->command('display_message', 'Soap Error: ' . $e->getMessage(), 'error');
     }
     if (count($wblist) == 0) {
         $rule_table->add(array('colspan' => '4'), rep_specialchars_output($this->gettext('wblistnorules')));
         $rule_table->set_row_attribs(array('class' => 'odd'));
         $rule_table->add_row();
     }
     $out .= "<div id=\"rule-cont\">" . $rule_table->show() . "</div>\n";
     $out .= "</fieldset>\n";
     return $out;
 }
 function veximaccountadmin_form()
 {
     $rcmail = rcmail::get_instance();
     $this->_load_config();
     // add labels to client - to be used in JS alerts
     $rcmail->output->add_label('veximaccountadmin.enterallpassfields', 'veximaccountadmin.passwordinconsistency', 'veximaccountadmin.autoresponderlong', 'veximaccountadmin.autoresponderlongnum', 'veximaccountadmin.autoresponderlongmax', 'veximaccountadmin.headerblockdelete', 'veximaccountadmin.headerblockdeleteall', 'veximaccountadmin.headerblockexists', 'veximaccountadmin.headerblockentervalue');
     $rcmail->output->set_env('product_name', $rcmail->config->get('product_name'));
     $settings = $this->_get_configuration();
     $on_avscan = $settings['on_avscan'];
     $on_spamassassin = $settings['on_spamassassin'];
     $sa_tag = $settings['sa_tag'];
     $sa_refuse = $settings['sa_refuse'];
     $spam_drop = $settings['spam_drop'];
     $on_vacation = $settings['on_vacation'];
     $vacation = $settings['vacation'];
     $on_forward = $settings['on_forward'];
     $forward = $settings['forward'];
     $unseen = $settings['unseen'];
     $maxmsgsize = $settings['maxmsgsize'];
     $user_id = $settings['user_id'];
     $domain_id = $settings['domain_id'];
     $domain_settings = $this->_get_domain_configuration($domain_id);
     $default_sa_tag = $domain_settings['sa_tag'];
     $default_sa_refuse = $domain_settings['sa_refuse'];
     $default_maxmsgsize = $domain_settings['maxmsgsize'];
     $active_domain = $domain_settings['domain'];
     $rcmail->output->set_env('vacation_maxlength', $this->config['vexim_vacation_maxlength']);
     $out .= '<p class="introtext">' . $this->gettext('introtext') . '</p>' . "\n";
     if ($this->config['show_admin_link'] == true and $settings['admin'] == true) {
         $out .= '<p class="adminlink">';
         $out .= sprintf($this->gettext('adminlinktext'), '<a href="' . $this->config['vexim_url'] . '" target="_blank">', '</a>');
         $out .= "</p>\n";
     }
     // =====================================================================================================
     // Password
     $out .= '<fieldset><legend>' . $this->gettext('password') . '</legend>' . "\n";
     $out .= '<div class="fieldset-content">';
     $out .= '<p>' . $this->gettext('passwordcurrentexplanation') . '</p>';
     $out .= '<table class="vexim-settings" cellpadding="0" cellspacing="0">';
     $field_id = 'curpasswd';
     $input_passwordcurrent = new html_passwordfield(array('name' => '_curpasswd', 'id' => $field_id, 'class' => 'text-long', 'autocomplete' => 'off'));
     $out .= sprintf("<tr><th><label for=\"%s\">%s</label>:</th><td>%s%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('passwordcurrent')), $input_passwordcurrent->show(), '');
     $field_id = 'newpasswd';
     $input_passwordnew = new html_passwordfield(array('name' => '_newpasswd', 'id' => $field_id, 'class' => 'text-long', 'autocomplete' => 'off'));
     $out .= sprintf("<tr><th><label for=\"%s\">%s</label>:</th><td>%s%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('passwordnew')), $input_passwordnew->show(), '');
     $field_id = 'confpasswd';
     $input_passwordconf = new html_passwordfield(array('name' => '_confpasswd', 'id' => $field_id, 'class' => 'text-long', 'autocomplete' => 'off'));
     $out .= sprintf("<tr><th><label for=\"%s\">%s</label>:</th><td>%s%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('passwordconfirm')), $input_passwordconf->show(), '');
     $out .= '</table>';
     $out .= '</div></fieldset>' . "\n\n";
     // =====================================================================================================
     // Spam/Virus
     $out .= '<fieldset><legend>' . $this->gettext('spamvirus') . '</legend>' . "\n";
     $out .= '<div class="fieldset-content">';
     $out .= '<table class="vexim-settings" cellpadding="0" cellspacing="0">';
     $field_id = 'on_avscan';
     $input_virusenabled = new html_checkbox(array('name' => 'on_avscan', 'id' => $field_id, 'value' => 1));
     $out .= sprintf("<tr><th><label for=\"%s\">%s</label>:</th><td>%s%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('virusenabled')), $input_virusenabled->show($on_avscan ? 1 : 0), '<br /><span class="vexim-explanation">' . $this->gettext('virusenabledexplanation') . '</span>');
     $field_id = 'on_spamassassin';
     $input_spamenabled = new html_checkbox(array('name' => 'on_spamassassin', 'id' => $field_id, 'value' => 1));
     $out .= sprintf("<tr><th><label for=\"%s\">%s</label>:</th><td>%s%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('spamenabled')), $input_spamenabled->show($on_spamassassin ? 1 : 0), '<br /><span class="vexim-explanation">' . $this->gettext('spamenabledexplanation') . '</span>');
     $field_id = 'sa_tag';
     $input_spamscoretag = new html_select(array('name' => 'sa_tag', 'id' => $field_id, 'class' => 'select'));
     $decPlaces = 0;
     $found_number = false;
     for ($i = 1; $i <= 20; $i = $i + 1) {
         $i = number_format($i, $decPlaces);
         $input_spamscoretag->add($i, $i);
         if ($sa_tag == $i) {
             $found_number = true;
         }
     }
     for ($i = 25; $i <= 100; $i = $i + 5) {
         $i = number_format($i, $decPlaces);
         $input_spamscoretag->add($i, $i);
         if ($sa_tag == $i) {
             $found_number = true;
         }
     }
     // If the value from database cannot be choosed among the list we present,
     // add it to the end of the list. This may happen because Vexim lets the
     // user write in a number in a textbox.
     if (!$found_number) {
         $input_spamscoretag->add($sa_tag, $sa_tag);
     }
     $out .= sprintf("<tr><th><label for=\"%s\">%s</label>:</th><td>%s%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('spamscoretag')), $input_spamscoretag->show($sa_tag), '<br /><span class="vexim-explanation">' . $this->gettext('spamscoretagexplanation') . '. <span class="sameline">' . $this->gettext('domaindefault') . ': ' . $default_sa_tag . '.</span></span>');
     $field_id = 'sa_refuse';
     $input_spamscorerefuse = new html_select(array('name' => 'sa_refuse', 'id' => $field_id, 'class' => 'select'));
     $found_number = false;
     for ($i = 1; $i <= 20; $i = $i + 1) {
         $i = number_format($i, $decPlaces);
         $input_spamscorerefuse->add($i, $i);
         if ($sa_refuse == $i) {
             $found_number = true;
         }
     }
     for ($i = 25; $i <= 200; $i = $i + 5) {
         $i = number_format($i, $decPlaces);
         $input_spamscorerefuse->add($i, $i);
         if ($sa_refuse == $i) {
             $found_number = true;
         }
     }
     for ($i = 300; $i <= 900; $i = $i + 100) {
         $i = number_format($i, $decPlaces);
         $input_spamscorerefuse->add($i, $i);
         if ($sa_refuse == $i) {
             $found_number = true;
         }
     }
     $i = number_format(999, $decPlaces);
     $input_spamscorerefuse->add($i, $i);
     if ($sa_refuse == $i) {
         $found_number = true;
     }
     // If the value from database cannot be choosed among the list we present,
     // add it to the end of the list. This may happen because Vexim lets the
     // user write in a number in a textbox.
     if (!$found_number) {
         $input_spamscorerefuse->add($sa_refuse, $sa_refuse);
     }
     $out .= sprintf("<tr><th><label for=\"%s\">%s</label>:</th><td>%s%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('spamscorerefuse')), $input_spamscorerefuse->show($sa_refuse), '<br /><span class="vexim-explanation">' . $this->gettext('spamscorerefuseexplanation') . '. <span class="sameline">' . $this->gettext('domaindefault') . ': ' . $default_sa_refuse . '.</span></span>');
     $spammoveexplanation = '<br /><span class="vexim-explanation">' . str_replace("%italicstart", "<i>", str_replace("%italicend", "</i>", $this->gettext('spammoveexplanation_part1')));
     if ($this->config['parsefolders_script']) {
         $spammoveexplanation .= ' ' . $this->gettext('spammoveexplanation_part2');
     }
     $spammoveexplanation .= ' ' . $this->gettext('spammoveexplanation_part3');
     $field_id = 'spam_drop';
     $input_spammove = new html_checkbox(array('name' => 'spam_drop', 'id' => $field_id, 'value' => 1));
     $out .= sprintf("<tr><th><label for=\"%s\">%s</label>:</th><td>%s%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('spammove')), $input_spammove->show($spam_drop ? 1 : 0), $spammoveexplanation);
     $out .= '</table>';
     if ($this->config['parsefolders_script'] and $this->config['parsefolders_script_show_tip']) {
         $out .= '<p class="vexim-explanation">' . str_replace('%italicstart', '<i>', str_replace('%italicend', '</i>', $this->gettext('spamtip'))) . '</p>';
     }
     $out .= '</div></fieldset>' . "\n\n";
     // =====================================================================================================
     // Autoresponder
     $out .= '<fieldset><legend>' . $this->gettext('autoresponder') . '</legend>' . "\n";
     $out .= '<div class="fieldset-content">';
     $out .= '<table class="vexim-settings" cellpadding="0" cellspacing="0">';
     $field_id = 'on_vacation';
     $input_autoresponderenabled = new html_checkbox(array('name' => 'on_vacation', 'id' => $field_id, 'value' => 1));
     $out .= sprintf("<tr><th><label for=\"%s\">%s</label>:</th><td>%s%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('autoresponderenabled')), $input_autoresponderenabled->show($on_vacation ? 1 : 0), '');
     $field_id = 'vacation';
     $input_autorespondermessage = new html_textarea(array('name' => 'vacation', 'id' => $field_id, 'class' => 'textarea'));
     $out .= sprintf("<tr><th><label for=\"%s\">%s</label>:</th><td>%s%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('autorespondermessage')), $input_autorespondermessage->show($vacation), '<br /><span class="vexim-explanation">' . $this->gettext('autorespondermessageexplanation') . '</span>');
     $out .= '</table>';
     $out .= '</div></fieldset>' . "\n\n";
     // =====================================================================================================
     // Forward
     $out .= '<fieldset><legend>' . $this->gettext('forwarding') . '</legend>' . "\n";
     $out .= '<div class="fieldset-content">';
     $out .= '<table class="vexim-settings" cellpadding="0" cellspacing="0">';
     $field_id = 'on_forward';
     $input_forwardingenabled = new html_checkbox(array('name' => 'on_forward', 'id' => $field_id, 'value' => 1));
     $out .= sprintf("<tr><th><label for=\"%s\">%s</label>:</th><td>%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('forwardingenabled')), $input_forwardingenabled->show($on_forward ? 1 : 0));
     $field_id = 'forward';
     $input_forwardingaddress = new html_inputfield(array('name' => 'forward', 'id' => $field_id, 'maxlength' => 255, 'class' => 'text-long'));
     $out .= sprintf("<tr><th><label for=\"%s\">%s</label>:</th><td>%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('forwardingaddress')), $input_forwardingaddress->show($forward));
     $field_id = 'unseen';
     $input_forwardinglocal = new html_checkbox(array('name' => 'unseen', 'id' => $field_id, 'value' => 1));
     $out .= sprintf("<tr><th><label for=\"%s\">%s</label>:</th><td>%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('forwardinglocal')), $input_forwardinglocal->show($unseen ? 1 : 0));
     $out .= '</table>';
     $out .= '</div></fieldset>' . "\n\n";
     // =====================================================================================================
     // Header blocks (based on code from Philip Weir's sauserprefs plugin
     //                http://roundcube.net/plugins/sauserprefs)
     $out .= '<fieldset><legend>' . $this->gettext('blockbyheader') . '</legend>' . "\n";
     $out .= '<div class="fieldset-content">';
     $out .= '<p>' . $this->gettext('blockbyheaderexplanation') . '</p>';
     $table = new html_table(array('class' => 'headerblockprefstable', 'cols' => 3));
     $field_id = 'rcmfd_headerblockrule';
     $input_headerblockrule = new html_select(array('name' => '_headerblockrule', 'id' => $field_id));
     $input_headerblockrule->add($this->gettext('headerfrom'), 'From');
     $input_headerblockrule->add($this->gettext('headerto'), 'To');
     $input_headerblockrule->add($this->gettext('headersubject'), 'Subject');
     $input_headerblockrule->add($this->gettext('headerxmailer'), 'X-Mailer');
     $field_id = 'rcmfd_headerblockvalue';
     $input_headerblockvalue = new html_inputfield(array('name' => '_headerblockvalue', 'id' => $field_id, 'style' => 'width:270px;'));
     $field_id = 'rcmbtn_add_address';
     $button_addaddress = $this->api->output->button(array('command' => 'plugin.veximaccountadmin.headerblock_add', 'type' => 'input', 'class' => 'button', 'label' => 'veximaccountadmin.addrule', 'style' => 'width: 130px;'));
     $table->add(null, $input_headerblockrule->show());
     $table->add(null, $input_headerblockvalue->show());
     $table->add(array('align' => 'right'), $button_addaddress);
     $delete_all = $this->api->output->button(array('command' => 'plugin.veximaccountadmin.headerblock_delete_all', 'type' => 'link', 'label' => 'veximaccountadmin.deleteall'));
     $table->add(array('colspan' => 3, 'id' => 'listcontrols'), $delete_all);
     $table->add_row();
     $address_table = new html_table(array('id' => 'headerblock-rules-table', 'class' => 'records-table', 'cellspacing' => '0', 'cols' => 3));
     $address_table->add_header(array('width' => '120px'), $this->gettext('field'));
     $address_table->add_header(null, $this->gettext('value'));
     $address_table->add_header(array('width' => '40px'), '&nbsp;');
     $this->_address_row($address_table, null, null, $attrib);
     // Get the header rules from DB. Should probably be put in a function.
     $this->_load_config();
     $this->_db_connect('r');
     $sql_result = $this->db->query("SELECT blockhdr, blockval \r\n\t\t   FROM   blocklists\r\n\t\t   WHERE  user_id = '{$user_id}'\r\n\t\t   AND    domain_id = '{$domain_id}'\r\n\t\t   ORDER BY block_id;");
     if ($sql_result && $this->db->num_rows($sql_result) > 0) {
         $norules = 'display: none;';
     }
     $address_table->set_row_attribs(array('style' => $norules));
     $address_table->add(array('colspan' => '3'), rep_specialchars_output($this->gettext('noaddressrules')));
     $address_table->add_row();
     $this->api->output->set_env('address_rule_count', $this->db->num_rows());
     while ($sql_result && ($sql_arr = $this->db->fetch_assoc($sql_result))) {
         $field = $sql_arr['blockhdr'];
         $value = $sql_arr['blockval'];
         $this->_address_row($address_table, $field, $value, $attrib);
     }
     $table->add(array('colspan' => 3), html::div(array('id' => 'headerblock-rules-cont'), $address_table->show()));
     $table->add_row();
     if ($table->size()) {
         $out .= $table->show();
     }
     $out .= '</div></fieldset>' . "\n\n";
     // =====================================================================================================
     // Parameters
     $out .= '<fieldset><legend>' . $this->gettext('parameters') . '</legend>' . "\n";
     $out .= '<div class="fieldset-content">';
     $out .= '<table class="vexim-settings" cellpadding="0" cellspacing="0">';
     $field_id = 'maxmsgsize';
     $input_messagesize = new html_inputfield(array('name' => 'maxmsgsize', 'id' => $field_id, 'maxlength' => 3, 'size' => 4));
     if ($default_maxmsgsize == 0) {
         $default_maxmsgsize = $this->gettext('unlimited');
     } else {
         $default_maxmsgsize = $default_maxmsgsize . ' kb';
     }
     $out .= sprintf("<tr><th><label for=\"%s\">%s</label>:</th><td>%s%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('messagesize')), $input_messagesize->show($maxmsgsize), '<br /><span class="vexim-explanation">' . str_replace('%d', $active_domain, str_replace('%m', $default_maxmsgsize, $this->gettext('messagesizeexplanation'))) . '</span>');
     $out .= '</table>';
     $out .= '</div></fieldset>' . "\n\n";
     // =====================================================================================================
     $out .= html::p(null, $rcmail->output->button(array('command' => 'plugin.veximaccountadmin-save', 'type' => 'input', 'class' => 'button mainaction', 'label' => 'save')));
     $rcmail->output->add_gui_object('veximform', 'veximaccountadminform');
     $out = $rcmail->output->form_tag(array('id' => 'veximaccountadminform', 'name' => 'veximaccountadminform', 'method' => 'post', 'action' => './?_task=settings&_action=plugin.veximaccountadmin-save'), $out);
     $out = html::div(array('class' => 'settingsbox', 'style' => 'margin:0 0 15px 0;'), html::div(array('class' => 'boxtitle'), $this->gettext('accountadministration')) . html::div(array('style' => 'padding:15px'), $outtop . "\n" . $out . "\n" . $outbottom));
     return $out;
 }
 function gen_examples($attrib)
 {
     // create list of example rules
     if (sizeof($this->examples) > 0) {
         $this->api->output->add_gui_object('sieverules_examples', 'sieverules-examples');
         $examples = new html_table($attrib + array('cols' => 1));
         if (!$attrib['noheader']) {
             $examples->add_header(null, $this->gettext('examplefilters'));
         }
         foreach ($this->examples as $idx => $filter) {
             $examples->set_row_attribs(array('id' => 'rcmrowex' . $idx));
             $examples->add(null, rcmail::Q($filter['name']));
         }
         return html::tag('div', array('id' => 'sieverules-list-examples'), $examples->show($attrib));
     } else {
         return '';
     }
 }
 function gen_table($attrib)
 {
     $this->rcmail_inst->output->set_env('framed', true);
     $out = '<fieldset><legend>' . $this->gettext('fetchmail_entries') . '</legend>' . "\n";
     $fetch_table = new html_table(array('id' => 'fetch-table', 'class' => 'records-table', 'cellspacing' => '0', 'cols' => 3));
     $fetch_table->add_header("", $this->gettext('fetchmailserver'));
     $fetch_table->add_header(array('width' => '20px'), '');
     $fetch_table->add_header(array('width' => '16px'), '');
     try {
         $session_id = $this->soap->login($this->rcmail_inst->config->get('remote_soap_user'), $this->rcmail_inst->config->get('remote_soap_pass'));
         $mail_user = $this->soap->mail_user_get($session_id, array('login' => $this->rcmail_inst->user->data['username']));
         $fetchmail = $this->soap->mail_fetchmail_get($session_id, array('destination' => $mail_user[0]['email']));
         $this->soap->logout($session_id);
         for ($i = 0; $i < count($fetchmail); $i++) {
             $class = $class == 'odd' ? 'even' : 'odd';
             if ($fetchmail[$i]['mailget_id'] == rcube_utils::get_input_value('_id', RCUBE_INPUT_GET)) {
                 $class = 'selected';
             }
             $fetch_table->set_row_attribs(array('class' => $class, 'id' => 'fetch_' . $fetchmail[$i]['mailget_id']));
             $this->_fetch_row($fetch_table, $fetchmail[$i]['source_username'] . '@' . $fetchmail[$i]['source_server'], $fetchmail[$i]['active'], $fetchmail[$i]['mailget_id'], $attrib);
         }
     } catch (SoapFault $e) {
         $this->rcmail_inst->output->command('display_message', 'Soap Error: ' . $e->getMessage(), 'error');
     }
     if (count($fetchmail) == 0) {
         $fetch_table->add(array('colspan' => '3'), rcube_utils::rep_specialchars_output($this->gettext('nofetch')));
         $fetch_table->set_row_attribs(array('class' => 'odd'));
         $fetch_table->add_row();
     }
     $out .= "<div id=\"fetch-cont\">" . $fetch_table->show() . "</div>\n";
     $out .= "</fieldset>\n";
     return $out;
 }
Example #13
0
 /**
  *
  */
 function attendees_list($attrib = array())
 {
     // add "noreply" checkbox to attendees table only
     $invitations = strpos($attrib['id'], 'attend') !== false;
     $invite = new html_checkbox(array('value' => 1, 'id' => 'edit-attendees-invite'));
     $table = new html_table(array('cols' => 5 + intval($invitations), 'border' => 0, 'cellpadding' => 0, 'class' => 'rectable'));
     $table->add_header('role', $this->cal->gettext('role'));
     $table->add_header('name', $this->cal->gettext($attrib['coltitle'] ?: 'attendee'));
     $table->add_header('availability', $this->cal->gettext('availability'));
     $table->add_header('confirmstate', $this->cal->gettext('confirmstate'));
     if ($invitations) {
         $table->add_header(array('class' => 'invite', 'title' => $this->cal->gettext('sendinvitations')), $invite->show(1) . html::label('edit-attendees-invite', $this->cal->gettext('sendinvitations')));
     }
     $table->add_header('options', '');
     // hide invite column if disabled by config
     $itip_notify = (int) $this->rc->config->get('calendar_itip_send_option', $this->cal->defaults['calendar_itip_send_option']);
     if ($invitations && !($itip_notify & 2)) {
         $css = sprintf('#%s td.invite, #%s th.invite { display:none !important }', $attrib['id'], $attrib['id']);
         $this->rc->output->add_footer(html::tag('style', array('type' => 'text/css'), $css));
     }
     return $table->show($attrib);
 }
 function gen_examples($attrib)
 {
     if (sizeof($this->examples) > 0) {
         $this->api->output->add_gui_object('sieverules_examples', 'sieverules-examples');
         $examples = new html_table(array('id' => 'sieverules-examples', 'class' => 'records-table', 'cellspacing' => '0', 'cols' => 1));
         $examples->add_header(null, $this->gettext('examplefilters'));
         foreach ($this->examples as $idx => $filter) {
             $examples->set_row_attribs(array('id' => 'rcmrowex' . $idx));
             $examples->add(null, Q($filter['name']));
         }
         return html::tag('div', array('id' => 'sieverules-list-examples'), $examples->show($attrib));
     } else {
         return '';
     }
 }
Example #15
0
 /**
  * Template object for key information page content
  */
 function tpl_key_data($attrib)
 {
     $out = '';
     $table = new html_table(array('cols' => 2));
     // Key user ID
     $table->add('title', $this->enigma->gettext('keyuserid'));
     $table->add(null, rcube::Q($this->data->name));
     // Key ID
     $table->add('title', $this->enigma->gettext('keyid'));
     $table->add(null, $this->data->subkeys[0]->get_short_id());
     // Key type
     $keytype = $this->data->get_type();
     if ($keytype == enigma_key::TYPE_KEYPAIR) {
         $type = $this->enigma->gettext('typekeypair');
     } else {
         if ($keytype == enigma_key::TYPE_PUBLIC) {
             $type = $this->enigma->gettext('typepublickey');
         }
     }
     $table->add('title', $this->enigma->gettext('keytype'));
     $table->add(null, $type);
     // Key fingerprint
     $table->add('title', $this->enigma->gettext('fingerprint'));
     $table->add(null, $this->data->subkeys[0]->get_fingerprint());
     $out .= html::tag('fieldset', null, html::tag('legend', null, $this->enigma->gettext('basicinfo')) . $table->show($attrib));
     // Subkeys
     $table = new html_table(array('cols' => 5, 'id' => 'enigmasubkeytable', 'class' => 'records-table'));
     $table->add_header('id', $this->enigma->gettext('subkeyid'));
     $table->add_header('algo', $this->enigma->gettext('subkeyalgo'));
     $table->add_header('created', $this->enigma->gettext('subkeycreated'));
     $table->add_header('expires', $this->enigma->gettext('subkeyexpires'));
     $table->add_header('usage', $this->enigma->gettext('subkeyusage'));
     $now = time();
     $date_format = $this->rc->config->get('date_format', 'Y-m-d');
     $usage_map = array(enigma_key::CAN_ENCRYPT => $this->enigma->gettext('typeencrypt'), enigma_key::CAN_SIGN => $this->enigma->gettext('typesign'), enigma_key::CAN_CERTIFY => $this->enigma->gettext('typecert'), enigma_key::CAN_AUTHENTICATE => $this->enigma->gettext('typeauth'));
     foreach ($this->data->subkeys as $subkey) {
         $algo = $subkey->get_algorithm();
         if ($algo && $subkey->length) {
             $algo .= ' (' . $subkey->length . ')';
         }
         $usage = array();
         foreach ($usage_map as $key => $text) {
             if ($subkey->usage & $key) {
                 $usage[] = $text;
             }
         }
         $table->add('id', $subkey->get_short_id());
         $table->add('algo', $algo);
         $table->add('created', $subkey->created ? $this->rc->format_date($subkey->created, $date_format, false) : '');
         $table->add('expires', $subkey->expires ? $this->rc->format_date($subkey->expires, $date_format, false) : $this->enigma->gettext('expiresnever'));
         $table->add('usage', implode(',', $usage));
         $table->set_row_attribs($subkey->revoked || $subkey->expires && $subkey->expires < $now ? 'deleted' : '');
     }
     $out .= html::tag('fieldset', null, html::tag('legend', null, $this->enigma->gettext('subkeys')) . $table->show());
     // Additional user IDs
     $table = new html_table(array('cols' => 2, 'id' => 'enigmausertable', 'class' => 'records-table'));
     $table->add_header('id', $this->enigma->gettext('userid'));
     $table->add_header('valid', $this->enigma->gettext('uservalid'));
     foreach ($this->data->users as $user) {
         $username = $user->name;
         if ($user->comment) {
             $username .= ' (' . $user->comment . ')';
         }
         $username .= ' <' . $user->email . '>';
         $table->add('id', rcube::Q(trim($username)));
         $table->add('valid', $this->enigma->gettext($user->valid ? 'valid' : 'unknown'));
         $table->set_row_attribs($user->revoked || !$user->valid ? 'deleted' : '');
     }
     $out .= html::tag('fieldset', null, html::tag('legend', null, $this->enigma->gettext('userids')) . $table->show());
     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 #17
0
 public function quota_content($attrib = null, $folder = null)
 {
     $quota = $this->storage->get_quota($folder);
     $quota = $this->plugins->exec_hook('quota', $quota);
     $quota_result = (array) $quota;
     $quota_result['type'] = isset($_SESSION['quota_display']) ? $_SESSION['quota_display'] : '';
     $quota_result['folder'] = $folder !== null && $folder !== '' ? $folder : 'INBOX';
     if ($quota['total'] > 0) {
         if (!isset($quota['percent'])) {
             $quota_result['percent'] = min(100, round($quota['used'] / max(1, $quota['total']) * 100));
         }
         $title = sprintf('%s / %s (%.0f%%)', $this->show_bytes($quota['used'] * 1024), $this->show_bytes($quota['total'] * 1024), $quota_result['percent']);
         $quota_result['title'] = $title;
         if ($attrib['width']) {
             $quota_result['width'] = $attrib['width'];
         }
         if ($attrib['height']) {
             $quota_result['height'] = $attrib['height'];
         }
         // build a table of quota types/roots info
         if (($root_cnt = count($quota_result['all'])) > 1 || count($quota_result['all'][key($quota_result['all'])]) > 1) {
             $table = new html_table(array('cols' => 3, 'class' => 'quota-info'));
             $table->add_header(null, self::Q($this->gettext('quotatype')));
             $table->add_header(null, self::Q($this->gettext('quotatotal')));
             $table->add_header(null, self::Q($this->gettext('quotaused')));
             foreach ($quota_result['all'] as $root => $data) {
                 if ($root_cnt > 1 && $root) {
                     $table->add(array('colspan' => 3, 'class' => 'root'), self::Q($root));
                 }
                 if ($storage = $data['storage']) {
                     $percent = min(100, round($storage['used'] / max(1, $storage['total']) * 100));
                     $table->add('name', self::Q($this->gettext('quotastorage')));
                     $table->add(null, $this->show_bytes($storage['total'] * 1024));
                     $table->add(null, sprintf('%s (%.0f%%)', $this->show_bytes($storage['used'] * 1024), $percent));
                 }
                 if ($message = $data['message']) {
                     $percent = min(100, round($message['used'] / max(1, $message['total']) * 100));
                     $table->add('name', self::Q($this->gettext('quotamessage')));
                     $table->add(null, intval($message['total']));
                     $table->add(null, sprintf('%d (%.0f%%)', $message['used'], $percent));
                 }
             }
             $quota_result['table'] = $table->show();
         }
     } else {
         $unlimited = $this->config->get('quota_zero_as_unlimited');
         $quota_result['title'] = $this->gettext($unlimited ? 'unlimited' : 'unknown');
         $quota_result['percent'] = 0;
     }
     // cleanup
     unset($quota_result['abort']);
     if (empty($quota_result['table'])) {
         unset($quota_result['all']);
     }
     return $quota_result;
 }
 /**
  * Generate the html of the account lists
  * @param type $attrib
  * @return type
  */
 function show_accounts_list($attrib)
 {
     $table = new html_table(array('id' => 'fetchmail-rc-table', 'class' => 'records-table', 'cellspacing' => '0', 'cols' => 1));
     $table->add_header(array('colspan' => 2), $this->gettext('accounts'));
     $accounts_list = $this->accounts_get_sorted_list();
     if (count($accounts_list) == 0) {
         $table->add(array('colspan' => '2'), rep_specialchars_output($this->gettext('noaccounts')));
     } else {
         foreach ($accounts_list as $account) {
             $idx = $account['fetchmail_rc_id'];
             $table->set_row_attribs(array('id' => 'rcmrow' . $idx));
             if ($account['mail_enabled'] == 0) {
                 $table->add(null, Q($account['mail_host']) . ' (' . $this->gettext('disabled') . ')');
             } else {
                 $table->add(null, Q($account['mail_host']) . ($account['count_error'] > 0 ? ' (' . $this->gettext('short_mail_error') . ')' : ''));
             }
         }
     }
     return html::tag('div', array('id' => 'fetchmail_rc-list-filters'), $table->show($attrib));
 }