public function message_body_prefix($arg) { if ($this->encrypted_part) { $arg['prefix'] = html::p(array('class' => 'hint', 'style' => 'margin-bottom:1em'), $this->gettext("show_pgp_mime_body_prefix")); } return $arg; }
/** * 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; }
/** * 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; }
/** * Callback function when HTML page is rendered * We'll add an overlay box here. */ function render_page($p) { if ($_SESSION['plugin.newuserdialog'] && $p['template'] == 'mail') { $this->add_texts('localization'); $rcmail = rcmail::get_instance(); $identity = $rcmail->user->get_identity(); $identities_level = intval($rcmail->config->get('identities_level', 0)); // compose user-identity dialog $table = new html_table(array('cols' => 2)); $table->add('title', $this->gettext('name')); $table->add(null, html::tag('input', array('type' => 'text', 'name' => '_name', 'value' => $identity['name'], 'disabled' => $identities_level == 4))); $table->add('title', $this->gettext('email')); $table->add(null, html::tag('input', array('type' => 'text', 'name' => '_email', 'value' => rcube_utils::idn_to_utf8($identity['email']), 'disabled' => in_array($identities_level, array(1, 3, 4))))); $table->add('title', $this->gettext('organization')); $table->add(null, html::tag('input', array('type' => 'text', 'name' => '_organization', 'value' => $identity['organization'], 'disabled' => $identities_level == 4))); $table->add('title', $this->gettext('signature')); $table->add(null, html::tag('textarea', array('name' => '_signature', 'rows' => '3'), $identity['signature'])); // add overlay input box to html page $rcmail->output->add_footer(html::tag('form', array('id' => 'newuserdialog', 'action' => $rcmail->url('plugin.newusersave'), 'method' => 'post'), html::p('hint', rcube::Q($this->gettext('identitydialoghint'))) . $table->show() . html::p(array('class' => 'formbuttons'), html::tag('input', array('type' => 'submit', 'class' => 'button mainaction', 'value' => $this->gettext('save')))))); $title = rcube::JQ($this->gettext('identitydialogtitle')); $script = "\n\$('#newuserdialog').show()\n .dialog({modal:true, resizable:false, closeOnEscape:false, width:450, title:'{$title}'})\n .submit(function() {\n var i, request = {}, form = \$(this).serializeArray();\n for (i in form)\n request[form[i].name] = form[i].value;\n\n rcmail.http_post('plugin.newusersave', request, true);\n return false;\n });\n\n\$('input[name=_name]').focus();\nrcube_webmail.prototype.new_user_dialog_close = function() { \$('#newuserdialog').dialog('close'); }\n"; // disable keyboard events for messages list (#1486726) $rcmail->output->add_script($script, 'docready'); $this->include_stylesheet('newuserdialog.css'); } }
public function forward_form() { $table = new html_table(array('cols' => 2)); $field_id = 'forwardforwards'; $text_forwardforwards = new html_textarea(array('name' => '_forwardforwards', 'id' => $field_id, 'spellcheck' => 1, 'rows' => 6, 'cols' => 40)); $table->add('title', html::label($field_id, Q($this->gettext('forwardforwards')))); $table->add(null, $text_forwardforwards->show($this->obj->get_forward_forwards())); $field_id = 'forwardkeepcopies'; $input_forwardkeepcopies = new html_checkbox(array('name' => '_forwardkeepcopies', 'id' => $field_id, 'value' => 1)); $table->add('title', html::label($field_id, Q($this->gettext('forwardkeepcopies')))); $table->add(null, $input_forwardkeepcopies->show($this->obj->is_forward_keepcopies() === true || $this->obj->is_forward_keepcopies() == "1" || $this->obj->is_forward_keepcopies() == "t" || $this->obj->is_forward_keepcopies() == "y" || $this->obj->is_forward_keepcopies() == "yes" ? 1 : 0)); $out = html::div(array('class' => "box"), html::div(array('id' => "prefs-title", 'class' => 'boxtitle'), $this->gettext('forward')) . html::div(array('class' => "boxcontent"), $table->show() . html::p(null, $this->rc->output->button(array('command' => 'plugin.forward-save', 'type' => 'input', 'class' => 'button mainaction', 'label' => 'save'))))); $this->rc->output->add_gui_object('forwardform', 'forward-form'); return $this->rc->output->form_tag(array('id' => 'forward-form', 'name' => 'forward-form', 'method' => 'post', 'action' => './?_task=settings&_action=plugin.forward-save'), $out); }
/** * 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; }
/** * 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; }
/** * Callback function when HTML page is rendered * We'll add an overlay box here. */ function render_page($p) { if ($_SESSION['plugin.newuserdialog']) { $this->add_texts('localization'); $rcmail = rcmail::get_instance(); $identity = $rcmail->user->get_identity(); $identities_level = intval($rcmail->config->get('identities_level', 0)); // compose user-identity dialog $table = new html_table(array('cols' => 2)); $table->add('title', $this->gettext('name')); $table->add(null, html::tag('input', array('type' => "text", 'name' => "_name", 'value' => $identity['name']))); $table->add('title', $this->gettext('email')); $table->add(null, html::tag('input', array('type' => "text", 'name' => "_email", 'value' => $identity['email'], 'disabled' => $identities_level == 1 || $identities_level == 3))); // add overlay input box to html page $rcmail->output->add_footer(html::div(array('id' => "newuseroverlay"), html::tag('form', array('action' => $rcmail->url('plugin.newusersave'), 'method' => "post"), html::tag('h3', null, Q($this->gettext('identitydialogtitle'))) . html::p('hint', Q($this->gettext('identitydialoghint'))) . $table->show() . html::p(array('class' => "formbuttons"), html::tag('input', array('type' => "submit", 'class' => "button mainaction", 'value' => $this->gettext('save'))))))); $this->include_stylesheet('newuserdialog.css'); } }
/** * Callback function when HTML page is rendered * We'll add an overlay box here. */ function render_page($p) { if ($_SESSION['plugin.newuserdialog'] && $p['template'] == 'mail') { $this->add_texts('localization'); $rcmail = rcmail::get_instance(); $identity = $rcmail->user->get_identity(); $identities_level = intval($rcmail->config->get('identities_level', 0)); // compose user-identity dialog $table = new html_table(array('cols' => 2)); $table->add('title', $this->gettext('name')); $table->add(null, html::tag('input', array('type' => 'text', 'name' => '_name', 'value' => $identity['name']))); $table->add('title', $this->gettext('email')); $table->add(null, html::tag('input', array('type' => 'text', 'name' => '_email', 'value' => idn_to_utf8($identity['email']), 'disabled' => $identities_level == 1 || $identities_level == 3))); // add overlay input box to html page $rcmail->output->add_footer(html::div(array('id' => 'newuseroverlay'), html::tag('form', array('action' => $rcmail->url('plugin.newusersave'), 'method' => 'post'), html::tag('h3', null, Q($this->gettext('identitydialogtitle'))) . html::p('hint', Q($this->gettext('identitydialoghint'))) . $table->show() . html::p(array('class' => 'formbuttons'), html::tag('input', array('type' => 'submit', 'class' => 'button mainaction', 'value' => $this->gettext('save'))))))); // disable keyboard events for messages list (#1486726) $rcmail->output->add_script("\$(document).ready(function () {\n rcmail.message_list.key_press = function(){};\n rcmail.message_list.key_down = function(){};\n \$('input[name=_name]').focus();\n });", 'foot'); $this->include_stylesheet('newuserdialog.css'); } }
if ($session_error || $_REQUEST['_err'] == 'session') { $OUTPUT->show_message('sessionerror', 'error', null, true, -1); } if ($OUTPUT->ajax_call || $OUTPUT->get_env('framed')) { $OUTPUT->command('session_error', $RCMAIL->url(array('_err' => 'session'))); $OUTPUT->send('iframe'); } // check if installer is still active if ($RCMAIL->config->get('enable_installer') && is_readable('./installer/index.php')) { $OUTPUT->add_footer(html::div(array('style' => "background:#ef9398; border:2px solid #dc5757; padding:0.5em; margin:2em auto; width:50em"), html::tag('h2', array('style' => "margin-top:0.2em"), "Installer script is still accessible") . html::p(null, "The install script of your Roundcube installation is still stored in its default location!") . html::p(null, "Please <b>remove</b> the whole <tt>installer</tt> folder from the Roundcube directory because . these files may expose sensitive configuration data like server passwords and encryption keys to the public. Make sure you cannot access the <a href=\"./installer/\">installer script</a> from your browser.") )); } $plugin = $RCMAIL->plugins->exec_hook('unauthenticated', array('task' => 'login', 'error' => $session_error)); $RCMAIL->set_task($plugin['task']); $OUTPUT->send($plugin['task']); } // CSRF prevention else { // don't check for valid request tokens in these actions $request_check_whitelist = array('login'=>1, 'spell'=>1, 'spell_html'=>1);
/** * 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 attendees_form($attrib = array()) { $input = new html_inputfield(array('name' => 'participant', 'id' => 'edit-attendee-name', 'size' => 30)); $textarea = new html_textarea(array('name' => 'comment', 'id' => 'edit-attendees-comment', 'rows' => 4, 'cols' => 55, 'title' => $this->cal->gettext('itipcommenttitle'))); return html::div($attrib, html::div(null, $input->show() . " " . html::tag('input', array('type' => 'button', 'class' => 'button', 'id' => 'edit-attendee-add', 'value' => $this->cal->gettext('addattendee'))) . " " . html::tag('input', array('type' => 'button', 'class' => 'button', 'id' => 'edit-attendee-schedule', 'value' => $this->cal->gettext('scheduletime') . '...'))) . html::p('attendees-commentbox', html::label(null, $this->cal->gettext('itipcomment') . $textarea->show()))); }
public function test_p_with_attributes_and_empty_string_args() { $attributes = array('class' => 'test', 'data' => '0101'); $actual = html::p($attributes, ''); $expected = '<p class=test data=0101></p>'; $this->assertSame($expected, $actual); }
/** * GUI object 'loginform' * Returns code for the webmail login form * * @param array Named parameters * @return string HTML code for the gui object */ protected function login_form($attrib) { $default_host = $this->config->get('default_host'); $autocomplete = (int) $this->config->get('login_autocomplete'); $_SESSION['temp'] = true; // save original url $url = rcube_utils::get_input_value('_url', rcube_utils::INPUT_POST); if (empty($url) && !preg_match('/_(task|action)=logout/', $_SERVER['QUERY_STRING'])) { $url = $_SERVER['QUERY_STRING']; } // Disable autocapitalization on iPad/iPhone (#1488609) $attrib['autocapitalize'] = 'off'; // set atocomplete attribute $user_attrib = $autocomplete > 0 ? array() : array('autocomplete' => 'off'); $host_attrib = $autocomplete > 0 ? array() : array('autocomplete' => 'off'); $pass_attrib = $autocomplete > 1 ? array() : array('autocomplete' => 'off'); $input_task = new html_hiddenfield(array('name' => '_task', 'value' => 'login')); $input_action = new html_hiddenfield(array('name' => '_action', 'value' => 'login')); $input_tzone = new html_hiddenfield(array('name' => '_timezone', 'id' => 'rcmlogintz', 'value' => '_default_')); $input_url = new html_hiddenfield(array('name' => '_url', 'id' => 'rcmloginurl', 'value' => $url)); $input_user = new html_inputfield(array('name' => '_user', 'id' => 'rcmloginuser', 'required' => 'required') + $attrib + $user_attrib); $input_pass = new html_passwordfield(array('name' => '_pass', 'id' => 'rcmloginpwd', 'required' => 'required') + $attrib + $pass_attrib); $input_host = null; if (is_array($default_host) && count($default_host) > 1) { $input_host = new html_select(array('name' => '_host', 'id' => 'rcmloginhost')); foreach ($default_host as $key => $value) { if (!is_array($value)) { $input_host->add($value, is_numeric($key) ? $value : $key); } else { $input_host = null; break; } } } else { if (is_array($default_host) && ($host = key($default_host)) !== null) { $hide_host = true; $input_host = new html_hiddenfield(array('name' => '_host', 'id' => 'rcmloginhost', 'value' => is_numeric($host) ? $default_host[$host] : $host) + $attrib); } else { if (empty($default_host)) { $input_host = new html_inputfield(array('name' => '_host', 'id' => 'rcmloginhost') + $attrib + $host_attrib); } } } $form_name = !empty($attrib['form']) ? $attrib['form'] : 'form'; $this->add_gui_object('loginform', $form_name); // create HTML table with two cols $table = new html_table(array('cols' => 2)); $table->add('title', html::label('rcmloginuser', html::quote($this->app->gettext('username')))); $table->add('input', $input_user->show('mail@box')); $table->add('title', html::label('rcmloginpwd', html::quote($this->app->gettext('password')))); $table->add('input', $input_pass->show()); // add host selection row if (is_object($input_host) && !$hide_host) { $table->add('title', html::label('rcmloginhost', html::quote($this->app->gettext('server')))); $table->add('input', $input_host->show(rcube_utils::get_input_value('_host', rcube_utils::INPUT_GPC))); } $out = $input_task->show(); $out .= $input_action->show(); $out .= $input_tzone->show(); $out .= $input_url->show(); $out .= $table->show(); if ($hide_host) { $out .= $input_host->show(); } if (rcube_utils::get_boolean($attrib['submit'])) { $submit = new html_inputfield(array('type' => 'submit', 'id' => 'rcmloginsubmit', 'class' => 'button mainaction', 'value' => $this->app->gettext('login'))); $out .= html::p('formbuttons', $submit->show()); } // surround html output with a form tag if (empty($attrib['form'])) { $out = $this->form_tag(array('name' => $form_name, 'method' => 'post'), $out); } // include script for timezone detection $this->include_script('jstz.min.js'); return $out; }
public function twofactor_gauthenticator_form() { $rcmail = rcmail::get_instance(); $this->add_texts('localization/', true); $rcmail->output->set_env('product_name', $rcmail->config->get('product_name')); $data = self::__get2FAconfig(); // Fields will be positioned inside of a table $table = new html_table(array('cols' => 2)); // Activate/deactivate $field_id = '2FA_activate'; $checkbox_activate = new html_checkbox(array('name' => $field_id, 'id' => $field_id, 'type' => 'checkbox')); $table->add('title', html::label($field_id, Q($this->gettext('activate')))); $checked = $data['activate'] ? null : 1; // :-? $table->add(null, $checkbox_activate->show($checked)); // secret $field_id = '2FA_secret'; $input_descsecret = new html_inputfield(array('name' => $field_id, 'id' => $field_id, 'size' => 60, 'type' => 'password', 'value' => $data['secret'])); $table->add('title', html::label($field_id, Q($this->gettext('secret')))); $html_secret = $input_descsecret->show(); if ($data['secret']) { $html_secret .= '<input type="button" class="button mainaction" id="2FA_change_secret" value="' . $this->gettext('show_secret') . '">'; } else { $html_secret .= '<input type="button" class="button mainaction" id="2FA_create_secret" value="' . $this->gettext('create_secret') . '">'; } $table->add(null, $html_secret); // recovery codes $table->add('title', $this->gettext('recovery_codes')); $html_recovery_codes = ''; $i = 0; for ($i = 0; $i < $this->_number_recovery_codes; $i++) { $value = isset($data['recovery_codes'][$i]) ? $data['recovery_codes'][$i] : ''; $html_recovery_codes .= ' <input type="password" name="2FA_recovery_codes[]" value="' . $value . '" maxlength="10"> '; } $html_recovery_codes .= '<input type="button" class="button mainaction" id="2FA_show_recovery_codes" value="' . $this->gettext('show_recovery_codes') . '">'; $table->add(null, $html_recovery_codes); // qr-code if ($data['secret']) { $table->add('title', $this->gettext('qr_code')); $table->add(null, '<input type="button" class="button mainaction" id="2FA_change_qr_code" value="' . $this->gettext('show_qr_code') . '"> <div id="2FA_qr_code" style="display: none; margin-top: 10px;"></div>'); // new JS qr-code, without call to Google $this->include_script('2FA_qr_code.js'); } // infor $table->add(null, '<td><br>' . $this->gettext('msg_infor') . '</td>'); // button to setup all fields if doesn't exists secret $html_setup_all_fields = ''; if (!$data['secret']) { $html_setup_all_fields = '<input type="button" class="button mainaction" id="2FA_setup_fields" value="' . $this->gettext('setup_all_fields') . '">'; } $html_check_code = '<br /><br /><input type="button" class="button mainaction" id="2FA_check_code" value="' . $this->gettext('check_code') . '"> <input type="text" id="2FA_code_to_check" maxlength="10">'; // Build the table with the divs around it $out = html::div(array('class' => 'settingsbox', 'style' => 'margin: 0;'), html::div(array('id' => 'prefs-title', 'class' => 'boxtitle'), $this->gettext('twofactor_gauthenticator') . ' - ' . $rcmail->user->data['username']) . html::div(array('class' => 'boxcontent'), $table->show() . html::p(null, $rcmail->output->button(array('command' => 'plugin.twofactor_gauthenticator-save', 'type' => 'input', 'class' => 'button mainaction', 'label' => 'save')) . $html_setup_all_fields . $html_check_code))); // Construct the form $rcmail->output->add_gui_object('twofactor_gauthenticatorform', 'twofactor_gauthenticator-form'); $out = $rcmail->output->form_tag(array('id' => 'twofactor_gauthenticator-form', 'name' => 'twofactor_gauthenticator-form', 'method' => 'post', 'action' => './?_task=settings&_action=plugin.twofactor_gauthenticator-save'), $out); return $out; }
/** * */ function attendees_form($attrib = array()) { if (strpos($this->rc->data['username'], '@') !== false) { $domain = end(explode('@', $this->rc->data['username'])); } else { $domain = 'domain.com'; } $input = new html_inputfield(array('name' => 'participant', 'id' => 'edit-attendee-name', 'size' => 40, 'placeholder' => sprintf($this->cal->gettext('attendeeplaceholder'), $domain))); $checkbox = new html_checkbox(array('name' => 'invite', 'id' => 'edit-attendees-invite', 'value' => 1)); return html::div($attrib, html::div(null, $input->show() . " " . html::tag('input', array('type' => 'button', 'class' => 'button', 'id' => 'edit-attendee-add', 'value' => $this->cal->gettext('addattendee'))) . " " . html::tag('input', array('type' => 'button', 'class' => 'button', 'id' => 'edit-attendee-schedule', 'value' => $this->cal->gettext('scheduletime') . '...'))) . html::p('attendees-invitebox', html::label(null, $checkbox->show(1) . $this->cal->gettext('sendinvitations')))); }
function password_form() { $rcmail = rcmail::get_instance(); $this->load_config(); // add some labels to client $rcmail->output->add_label('password.nopassword', 'password.nocurpassword', 'password.passwordinconsistency'); $rcmail->output->set_env('product_name', $rcmail->config->get('product_name')); $table = new html_table(array('cols' => 2)); if ($rcmail->config->get('password_confirm_current')) { // show current password selection $field_id = 'curpasswd'; $input_curpasswd = new html_passwordfield(array('name' => '_curpasswd', 'id' => $field_id, 'size' => 20, 'autocomplete' => 'off')); $table->add('title', html::label($field_id, Q($this->gettext('curpasswd')))); $table->add(null, $input_curpasswd->show()); } // show new password selection $field_id = 'newpasswd'; $input_newpasswd = new html_passwordfield(array('name' => '_newpasswd', 'id' => $field_id, 'size' => 20, 'autocomplete' => 'off')); $table->add('title', html::label($field_id, Q($this->gettext('newpasswd')))); $table->add(null, $input_newpasswd->show()); // show confirm password selection $field_id = 'confpasswd'; $input_confpasswd = new html_passwordfield(array('name' => '_confpasswd', 'id' => $field_id, 'size' => 20, 'autocomplete' => 'off')); $table->add('title', html::label($field_id, Q($this->gettext('confpasswd')))); $table->add(null, $input_confpasswd->show()); $out = html::div(array('class' => 'box'), html::div(array('id' => 'prefs-title', 'class' => 'boxtitle'), $this->gettext('changepasswd')) . html::div(array('class' => 'boxcontent'), $table->show() . html::p(null, $rcmail->output->button(array('command' => 'plugin.password-save', 'type' => 'input', 'class' => 'button mainaction', 'label' => 'save'))))); $rcmail->output->add_gui_object('passform', 'password-form'); return $rcmail->output->form_tag(array('id' => 'password-form', 'name' => 'password-form', 'method' => 'post', 'action' => './?_task=settings&_action=plugin.password-save'), $out); }
function gen_rulelist($attrib) { // generate ruleset list (used when multiple rulesets enabled) $this->api->output->add_label('sieverules.delrulesetconf', 'sieverules.rulesetexists', 'sieverules.norulesetname'); // get all the rulesets on the server $rulesets = array(); foreach ($this->sieve->list as $ruleset) { $args = rcube::get_instance()->plugins->exec_hook('sieverules_list_rulesets', array('ruleset' => $ruleset)); if ($args['abort'] === true) { continue; } array_push($rulesets, $ruleset); } sort($rulesets); // find the currently active ruleset $activeruleset = $this->sieve->get_active(); // define "next ruleset" loaded after current ruleset is deleted $next_ruleset = ''; for ($i = 0; $i < sizeof($rulesets); $i++) { if ($rulesets[$i] == $this->current_ruleset) { $i++; if ($i == sizeof($rulesets)) { $i = sizeof($rulesets) - 2; } $next_ruleset = $rulesets[$i]; break; } } // pass ruleset info to UI $this->api->output->set_env('ruleset_total', sizeof($rulesets)); $this->api->output->set_env('ruleset_active', $this->current_ruleset == $activeruleset ? True : False); $this->api->output->set_env('ruleset_next', $next_ruleset); // new/rename ruleset dialog $out = ''; $table = new html_table(array('cols' => 2, 'class' => 'propform')); $table->set_row_attribs(array('id' => 'sieverulesrsdialog_input')); $table->add('title', html::label('sieverulesrsdialog_name', rcmail::Q($this->gettext('name')))); $table->add(null, html::tag('input', array('type' => 'text', 'id' => 'sieverulesrsdialog_name', 'name' => '_name', 'value' => '', 'required' => 'required'))); $select_ruleset = new html_select(array('id' => 'sieverulesrsdialog_ruleset')); if (sizeof($this->sieve->list) == 1) { $select_ruleset->add($this->gettext('nosieverulesets'), ''); } else { foreach ($rulesets as $ruleset) { if ($ruleset !== $this->current_ruleset) { $select_ruleset->add($ruleset, $ruleset); } } } $table->set_row_attribs(array('id' => 'sieverulesrsdialog_select')); $table->add('title', html::label('sieverulesrsdialog_ruleset', rcmail::Q($this->gettext('selectruleset')))); $table->add(null, $select_ruleset->show()); $buttons = html::tag('input', array('type' => 'hidden', 'id' => 'sieverulesrsdialog_action', 'value' => '')); $buttons .= html::tag('input', array('type' => 'button', 'class' => 'button mainaction', 'value' => $this->gettext('save'), 'onclick' => rcmail_output::JS_OBJECT_NAME . '.sieverulesdialog_submit();')) . ' '; // create new/rename ruleset UI $out .= html::tag('h3', array('id' => 'sieverulesrsdialog_add'), rcmail::Q($this->gettext('newruleset'))); $out .= html::tag('h3', array('id' => 'sieverulesrsdialog_edit', 'style' => 'display: none;'), rcmail::Q($this->gettext('renameruleset'))); $out .= html::tag('h3', array('id' => 'sieverulesrsdialog_copyto', 'style' => 'display: none;'), rcmail::Q($this->gettext('copytoruleset'))); $out .= html::tag('h3', array('id' => 'sieverulesrsdialog_copyfrom', 'style' => 'display: none;'), rcmail::Q($this->gettext('copyfromruleset'))); $out .= $table->show(); $out .= html::p(array('class' => 'formbuttons'), $buttons); $out = html::tag('form', array(), $out); $out = html::div(array('id' => 'sieverulesrsdialog', 'style' => 'display: none;'), $out); // add overlay to main UI $this->api->output->add_footer($out); // build ruleset list for UI $action = $this->action == 'plugin.sieverules.advanced' ? 'plugin.sieverules.advanced' : 'plugin.sieverules'; if ($attrib['type'] == 'link') { $lis = ''; if (sizeof($this->sieve->list) == 0) { $href = html::a(array('href' => "#", 'class' => 'active', 'onclick' => 'return false;', 'role' => 'button', 'tabindex' => '0', 'aria-disabled' => 'false'), rcmail::Q($this->gettext('nosieverulesets'))); $lis .= html::tag('li', array('role' => 'menuitem'), $href); } else { foreach ($rulesets as $ruleset) { $class = 'active'; if ($ruleset === $this->current_ruleset) { $class .= ' selected'; } $ruleset_text = $ruleset; if ($ruleset === $activeruleset) { $ruleset_text = str_replace('%s', $ruleset, $this->gettext('activeruleset')); } $href = html::a(array('href' => "#", 'class' => $class, 'onclick' => rcmail_output::JS_OBJECT_NAME . '.sieverules_select_ruleset(\'' . $ruleset . '\', \'' . $action . '\');', 'role' => 'button', 'tabindex' => '0', 'aria-disabled' => 'false'), rcmail::Q($ruleset_text)); $lis .= html::tag('li', array('role' => 'menuitem'), $href); } } return $lis; } elseif ($attrib['type'] == 'select') { $select_ruleset = new html_select(array('id' => 'rulelist', 'onchange' => rcmail_output::JS_OBJECT_NAME . '.sieverules_select_ruleset(this, \'' . $action . '\');')); if (sizeof($this->sieve->list) == 0) { $select_ruleset->add($this->gettext('nosieverulesets'), ''); } else { foreach ($rulesets as $ruleset) { if ($ruleset === $activeruleset) { $ruleset = str_replace('%s', $ruleset, $this->gettext('activeruleset')); } $select_ruleset->add($ruleset, $ruleset); } } return html::label('rulelist', rcmail::Q($this->gettext('selectruleset'))) . $select_ruleset->show(rcmail::Q($this->current_ruleset)); } }
function gen_rulelist($attrib) { $this->api->output->add_label('sieverules.delrulesetconf', 'sieverules.rulesetexists'); $rulesets = array(); foreach ($this->sieve->list as $ruleset) { array_push($rulesets, $ruleset); } sort($rulesets); $activeruleset = $this->sieve->get_active(); // new/rename ruleset dialog $out = ''; $table = new html_table(array('cols' => 2)); $table->set_row_attribs(array('id' => 'sieverulesrsdialog_input')); $table->add('title', html::label('sieverulesrsdialog_name', Q($this->gettext('name')))); $table->add(null, html::tag('input', array('type' => 'text', 'id' => 'sieverulesrsdialog_name', 'name' => '_name', 'value' => ''))); $select_ruleset = new html_select(array('id' => 'sieverulesrsdialog_ruleset')); if (sizeof($this->sieve->list) == 1) { $select_ruleset->add(Q($this->gettext('nosieverulesets')), ''); } else { foreach ($rulesets as $ruleset) { if ($ruleset !== $this->current_ruleset) { $select_ruleset->add(Q($ruleset), Q($ruleset)); } } } $table->set_row_attribs(array('id' => 'sieverulesrsdialog_select')); $table->add('title', html::label('sieverulesrsdialog_ruleset', Q($this->gettext('selectruleset')))); $table->add(null, $select_ruleset->show()); $buttons = html::tag('input', array('type' => 'hidden', 'id' => 'sieverulesrsdialog_action', 'value' => '')); $buttons .= html::tag('input', array('type' => 'button', 'class' => 'button mainaction', 'value' => $this->gettext('save'), 'onclick' => JS_OBJECT_NAME . '.sieverulesdialog_submit();')) . ' '; $buttons .= html::tag('input', array('type' => 'button', 'class' => 'button', 'value' => $this->gettext('cancel'), 'onclick' => 'rcube_find_object(\'sieverulesrsdialog\').style.display = \'none\';')); $out .= html::tag('h3', array('id' => 'sieverulesrsdialog_add'), Q($this->gettext('newruleset'))); $out .= html::tag('h3', array('id' => 'sieverulesrsdialog_edit', 'style' => 'display: none;'), Q($this->gettext('renameruleset'))); $out .= html::tag('h3', array('id' => 'sieverulesrsdialog_copyto', 'style' => 'display: none;'), Q($this->gettext('copytoruleset'))); $out .= html::tag('h3', array('id' => 'sieverulesrsdialog_copyfrom', 'style' => 'display: none;'), Q($this->gettext('copyfromruleset'))); $out .= $table->show(); $out .= html::p(array('class' => 'formbuttons'), $buttons); $out = html::tag('form', array(), $out); $out = html::div(array('id' => 'sieverulesrsdialog', 'style' => 'display: none;'), $out); // add overlay input box to html page $this->api->output->add_footer($out); $action = $this->action == 'plugin.sieverules.advanced' ? 'plugin.sieverules.advanced' : 'plugin.sieverules'; $select_ruleset = new html_select(array('id' => 'rulelist', 'onchange' => JS_OBJECT_NAME . '.sieverules_select_ruleset(this, \'' . $action . '\');')); if (sizeof($this->sieve->list) == 0) { $select_ruleset->add(Q($this->gettext('nosieverulesets')), ''); } else { foreach ($rulesets as $ruleset) { if ($ruleset === $activeruleset) { $select_ruleset->add(Q(str_replace('%s', $ruleset, $this->gettext('activeruleset'))), Q($ruleset)); } else { $select_ruleset->add(Q($ruleset), Q($ruleset)); } } } return html::label('rulelist', Q($this->gettext('selectruleset'))) . $select_ruleset->show($this->current_ruleset); }
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'), ' '); $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; }
public function vacation_sieve_form() { try { $table = new html_table(array('cols' => 2, 'class' => 'propform')); $format = $this->app->config->get('date_format'); # Options $table->add(array('colspan' => 2, 'class' => 'section-first'), Q($this->gettext('options'))); $table->add_row(); $field_id = 'vacation_enable'; $input_vacationenable = new html_checkbox(array('name' => '_vacation_enable', 'id' => $field_id, 'value' => 1)); $table->add('title', html::label($field_id, Q($this->gettext('vacationenable')))); $table->add(null, $input_vacationenable->show($this->obj->is_vacation_enable() ? 1 : 0)); $field_id = 'vacation_start'; $input_vacationstart = new html_inputfield(array('name' => '_vacation_start', 'id' => $field_id, 'size' => 10)); $table->add('title', html::label($field_id, Q($this->gettext('period')))); $vacStart = $this->obj->get_vacation_start(); $hour_text = array(); $hour_value = array(); $wholeDay = Q($this->gettext('wholeday')); $hour_value[$wholeDay] = ''; $hour_text[$wholeDay] = $wholeDay; $minHour = $this->config['working_hours'][0]; $maxHour = $this->config['working_hours'][1]; foreach (range($minHour, $maxHour) as $tmp_hour) { $hour_text[$tmp_hour] = sprintf("%02d:00", $tmp_hour); $hour_value[$tmp_hour] = $tmp_hour; } unset($tmp_hour); $field_id = 'vacation_starttime'; $input_vacationstarttime = new html_select(array('name' => '_vacation_starttime')); $input_vacationstarttime->add($hour_text, $hour_value); $field_id = 'vacation_endtime'; $input_vacationendtime = new html_select(array('name' => '_vacation_endtime')); $input_vacationendtime->add($hour_text, $hour_value); $field_id = 'vacation_end'; $input_vacationend = new html_inputfield(array('name' => '_vacation_end', 'id' => $field_id, 'size' => 10)); $vacEnd = $this->obj->get_vacation_end(); $periodFields = $this->gettext('vacationfrom') . ' ' . $input_vacationstart->show(date($format, $vacStart)) . ' ' . $input_vacationstarttime->show($hour_text[$this->obj->get_vacation_starttime()]) . ' ' . $this->gettext('vacationto') . ' ' . $input_vacationend->show(date($format, $vacEnd)) . ' ' . $input_vacationendtime->show($hour_text[$this->obj->get_vacation_endtime()]); $table->add(null, $periodFields); $table->add_row(); $field_id = 'every'; $input_every = new html_inputfield(array('name' => '_every', 'id' => $field_id, 'size' => 5)); $table->add('title', html::label($field_id, Q($this->gettext('frequency')))); $table->add(null, $this->gettext('answer_no_more_than_every') . ' ' . $input_every->show($this->obj->get_every()) . ' ' . $this->gettext('vacationdays')); $table->add_row(); $identities = $this->get_identities(); $default_identity = key($identities); $field_id = 'addressed_to'; $input_addressed_to = new html_select(array('name' => '_addressed_to[]', 'id' => $field_id, 'multiple' => true)); $input_addressed_to->add($identities); $addressedTo = $this->obj->get_addressed_to(); $table->add('title', html::label($field_id, Q($this->gettext('addressed_to')))); $table->add(null, $input_addressed_to->show($addressedTo ? $addressedTo : $default_identity)); # Subject field $table->add(array('colspan' => 2, 'class' => 'section'), Q($this->gettext('subject'))); $table->add_row(); $field_id = 'vacation_subject'; $input_vacationsubject = new html_inputfield(array('name' => '_vacation_subject', 'id' => $field_id, 'size' => 40)); $table->add('title', html::label($field_id, Q($this->gettext('vacationsubject')))); $table->add(null, $input_vacationsubject->show($this->obj->get_vacation_subject())); $table->add_row(); $field_id = '_append_subject'; $input_appendsubject = new html_checkbox(array('name' => '_append_subject', 'id' => $field_id, 'value' => 1)); $table->add('title', html::label($field_id, Q($this->gettext('append_subject')))); $table->add(null, $input_appendsubject->show($this->obj->get_append_subject() ? 1 : 0)); # Message $table->add(array('colspan' => 2, 'class' => 'section'), Q($this->gettext('vacationmessage'))); $table->add_row(); $field_id = 'send_from'; $input_sendfrom = new html_select(array('name' => '_send_from', 'id' => $field_id)); $input_sendfrom->add($identities); $sendFrom = $this->obj->get_send_from(); $table->add('title', html::label($field_id, Q($this->gettext('send_from')))); $table->add(null, $input_sendfrom->show($sendFrom ? $sendFrom : $default_identity)); # Add the HTML Row $table->add_row(); $field_id = 'vacation_message'; if ($this->config['msg_format'] == 'html') { $this->app->output->add_label('converting', 'editorwarning'); rcube_html_editor('identity'); $text_vacationmessage = new html_textarea(array('name' => '_vacation_message', 'id' => $field_id, 'spellcheck' => 1, 'rows' => 6, 'cols' => 40, 'class' => 'mce_editor')); } else { $text_vacationmessage = new html_textarea(array('name' => '_vacation_message', 'id' => $field_id, 'spellcheck' => 1, 'rows' => 6, 'cols' => 40)); } # $table->add('top title', html::label($field_id, Q($this->gettext('vacationmessage')))); $table->add(null, $text_vacationmessage->show($this->obj->get_vacation_message())); # Get the HTML $tableHtml = $table->show(); $submitLine = html::p(null, $this->app->output->button(array('command' => 'plugin.vacation_sieve-save', 'type' => 'input', 'class' => 'button mainaction', 'label' => 'save'))); # First line $boxTitle = html::div(array('id' => "prefs-title", 'class' => 'boxtitle'), $this->gettext('vacation')); $out = html::div(array('class' => 'box'), $boxTitle . html::div(array('class' => "boxcontent"), $tableHtml . $submitLine)); $this->app->output->add_gui_object('vacationsieveform', 'vacation_sieve_form'); return $this->app->output->form_tag(array('id' => 'vacation_sieve_form', 'name' => 'vacation_sieve_form', 'method' => 'post', 'action' => './?_task=settings&_action=plugin.vacation_sieve-save'), $out); } catch (Exception $exc) { $this->log_error('Fail to build form: ' . $exc->getMessage()); } }
function gen_rulelist($attrib) { $this->api->output->add_label('sieverules.delrulesetconf', 'sieverules.rulesetexists'); $rulesets = array(); foreach ($this->sieve->list as $ruleset) { array_push($rulesets, $ruleset); } sort($rulesets); $activeruleset = $this->sieve->get_active(); $next_ruleset = ''; for ($i = 0; $i < sizeof($rulesets); $i++) { if ($rulesets[$i] == $this->current_ruleset) { $i++; if ($i == sizeof($rulesets)) { $i = sizeof($rulesets) - 2; } $next_ruleset = $rulesets[$i]; break; } } $this->api->output->set_env('ruleset_total', sizeof($rulesets)); $this->api->output->set_env('ruleset_active', $this->current_ruleset == $activeruleset ? True : False); $this->api->output->set_env('ruleset_next', $next_ruleset); // new/rename ruleset dialog $out = ''; $table = new html_table(array('cols' => 2)); $table->set_row_attribs(array('id' => 'sieverulesrsdialog_input')); $table->add('title', html::label('sieverulesrsdialog_name', Q($this->gettext('name')))); $table->add(null, html::tag('input', array('type' => 'text', 'id' => 'sieverulesrsdialog_name', 'name' => '_name', 'value' => ''))); $select_ruleset = new html_select(array('id' => 'sieverulesrsdialog_ruleset')); if (sizeof($this->sieve->list) == 1) { $select_ruleset->add(Q($this->gettext('nosieverulesets')), ''); } else { foreach ($rulesets as $ruleset) { if ($ruleset !== $this->current_ruleset) { $select_ruleset->add(Q($ruleset), Q($ruleset)); } } } $table->set_row_attribs(array('id' => 'sieverulesrsdialog_select')); $table->add('title', html::label('sieverulesrsdialog_ruleset', Q($this->gettext('selectruleset')))); $table->add(null, $select_ruleset->show()); $buttons = html::tag('input', array('type' => 'hidden', 'id' => 'sieverulesrsdialog_action', 'value' => '')); $buttons .= html::tag('input', array('type' => 'button', 'class' => 'button mainaction', 'value' => $this->gettext('save'), 'onclick' => JS_OBJECT_NAME . '.sieverulesdialog_submit();')) . ' '; $out .= html::tag('h3', array('id' => 'sieverulesrsdialog_add'), Q($this->gettext('newruleset'))); $out .= html::tag('h3', array('id' => 'sieverulesrsdialog_edit', 'style' => 'display: none;'), Q($this->gettext('renameruleset'))); $out .= html::tag('h3', array('id' => 'sieverulesrsdialog_copyto', 'style' => 'display: none;'), Q($this->gettext('copytoruleset'))); $out .= html::tag('h3', array('id' => 'sieverulesrsdialog_copyfrom', 'style' => 'display: none;'), Q($this->gettext('copyfromruleset'))); $out .= $table->show(); $out .= html::p(array('class' => 'formbuttons'), $buttons); $out = html::tag('form', array(), $out); $out = html::div(array('id' => 'sieverulesrsdialog', 'style' => 'display: none;'), $out); // add overlay input box to html page $this->api->output->add_footer($out); $action = $this->action == 'plugin.sieverules.advanced' ? 'plugin.sieverules.advanced' : 'plugin.sieverules'; if ($attrib['type'] == 'link') { $lis = ''; if (sizeof($this->sieve->list) == 0) { $href = html::a(array('href' => "#", 'class' => 'active', 'onclick' => 'return false;'), Q($this->gettext('nosieverulesets'))); $lis .= html::tag('li', $href); } else { foreach ($rulesets as $ruleset) { $class = 'active'; if ($ruleset === $this->current_ruleset) { $class .= ' selected'; } $ruleset_text = $ruleset; if ($ruleset === $activeruleset) { $ruleset_text = str_replace('%s', $ruleset, $this->gettext('activeruleset')); } $href = html::a(array('href' => "#", 'class' => $class, 'onclick' => JS_OBJECT_NAME . '.sieverules_select_ruleset(\'' . $ruleset . '\', \'' . $action . '\');'), Q($ruleset_text)); $lis .= html::tag('li', null, $href); } } return $lis; } elseif ($attrib['type'] == 'select') { $select_ruleset = new html_select(array('id' => 'rulelist', 'onchange' => JS_OBJECT_NAME . '.sieverules_select_ruleset(this, \'' . $action . '\');')); if (sizeof($this->sieve->list) == 0) { $select_ruleset->add(Q($this->gettext('nosieverulesets')), ''); } else { foreach ($rulesets as $ruleset) { if ($ruleset === $activeruleset) { $ruleset = str_replace('%s', $ruleset, $this->gettext('activeruleset')); } $select_ruleset->add(Q($ruleset), Q($ruleset)); } } return html::label('rulelist', Q($this->gettext('selectruleset'))) . $select_ruleset->show(Q($this->current_ruleset)); } }
<?php /** * ====== COPYRIGHT ====== * Suicide MVC, A Simple RAD Framework * Copyright (c) Devin Ireland, http://devinireland.com * * Licensed under The Microsoft Public License * See LICENSE-SMVC.txt in the root folder of this source code. * Redistributions of files must retain this copyright notice. * ======================= * * ----- File Description ----- * */ if (isset($flashMessage)) { if (!isset($flashStatus)) { $flashStatus = STATUS_OK; // neutral message } if ($flashStatus > STATUS_OK) { echo html::p(html::notice_success($flashMessage)); } else { if ($flashStatus < STATUS_OK) { echo html::error_p($flashMessage); } else { echo html::p(html::notice($flashMessage)); } } }
/** * Template object for key import (upload) form */ function tpl_key_import_form($attrib) { $attrib += array('id' => 'rcmKeyImportForm'); $upload = new html_inputfield(array('type' => 'file', 'name' => '_file', 'id' => 'rcmimportfile', 'size' => 30)); $form = html::p(null, rcube::Q($this->enigma->gettext('keyimporttext'), 'show') . html::br() . html::br() . $upload->show()); $this->rc->output->add_label('selectimportfile', 'importwait'); $this->rc->output->add_gui_object('importform', $attrib['id']); $out = $this->rc->output->form_tag(array('action' => $this->rc->url(array('action' => 'plugin.enigma', 'a' => 'keyimport')), 'method' => 'post', 'enctype' => 'multipart/form-data') + $attrib, $form); return $out; }
/** * Display the upgrade page that lists all the plugins that require attention. * @param plugin_manager $pluginman provides information about the plugins. * @param available_update_checker $checker provides information about available updates. * @param int $version the version of the Moodle code from version.php. * @param bool $showallplugins * @param moodle_url $reloadurl * @param moodle_url $continueurl * @return string HTML to output. */ public function upgrade_plugin_check_page(plugin_manager $pluginman, available_update_checker $checker, $version, $showallplugins, $reloadurl, $continueurl) { global $CFG; $output = $this->header(); $output .= html::p(get_string('pluginchecknotice', 'core_plugin')); if (empty($CFG->disableupdatenotifications)) { $output .= $this->single_button(new moodle_url($reloadurl, array('fetchupdates' => 1)), get_string('checkforupdates', 'core_plugin')); if ($timefetched = $checker->get_last_timefetched()) { $output .= get_string('checkforupdateslast', 'core_plugin', userdate($timefetched, get_string('strftimedatetime', 'core_langconfig'))); } } $output .= $this->plugins_check_table($pluginman, $version, array('full' => $showallplugins)); $output .= $this->upgrade_reload($reloadurl); if ($pluginman->some_plugins_updatable()) { $output .= bootstrap::alert_info($this->help_icon('upgradepluginsinfo', 'core_admin', get_string('upgradepluginsfirst', 'core_admin'))); } $button = new single_button($continueurl, get_string('upgradestart', 'admin'), 'get'); $button->class = 'btn btn-primary'; $output .= $this->render($button); $output .= $this->footer(); return $output; }
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', " "); $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') . ": " . $select_all . " " . $select_invert . " " . $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', ' '); } $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 = " " . 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', ' '); $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']) . " " . 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, " "); $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 . " " . $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', ' '); $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; }
// log session failures $task = rcube_utils::get_input_value('_task', rcube_utils::INPUT_GPC); if ($task && !in_array($task, array('login', 'logout')) && !$session_error && ($sess_id = $_COOKIE[ini_get('session.name')])) { $RCMAIL->session->log("Aborted session {$sess_id}; no valid session data found"); $session_error = true; } if ($session_error || $_REQUEST['_err'] == 'session') { $OUTPUT->show_message('sessionerror', 'error', null, true, -1); } if ($OUTPUT->ajax_call || !empty($_REQUEST['_framed'])) { $OUTPUT->command('session_error', $RCMAIL->url(array('_err' => 'session'))); $OUTPUT->send('iframe'); } // check if installer is still active if ($RCMAIL->config->get('enable_installer') && is_readable('./installer/index.php')) { $OUTPUT->add_footer(html::div(array('style' => "background:#ef9398; border:2px solid #dc5757; padding:0.5em; margin:2em auto; width:50em"), html::tag('h2', array('style' => "margin-top:0.2em"), "Installer script is still accessible") . html::p(null, "The install script of your Roundcube installation is still stored in its default location!") . html::p(null, "Please <b>remove</b> the whole <tt>installer</tt> folder from the Roundcube directory because .\r\n these files may expose sensitive configuration data like server passwords and encryption keys\r\n to the public. Make sure you cannot access the <a href=\"./installer/\">installer script</a> from your browser."))); } $plugin = $RCMAIL->plugins->exec_hook('unauthenticated', array('task' => 'login', 'error' => $session_error)); $RCMAIL->set_task($plugin['task']); $OUTPUT->send($plugin['task']); } else { // don't check for valid request tokens in these actions $request_check_whitelist = array('login' => 1, 'spell' => 1, 'spell_html' => 1); if (!$request_check_whitelist[$RCMAIL->action]) { // check client X-header to verify request origin if ($OUTPUT->ajax_call) { if (rcube_utils::request_header('X-Roundcube-Request') != $RCMAIL->get_request_token()) { header('HTTP/1.1 403 Forbidden'); die("Invalid Request"); } } else {
/** * 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; }
function password_form() { $rcmail = rcmail::get_instance(); // add some labels to client $rcmail->output->add_label('password.nopassword', 'password.nocurpassword', 'password.passwordinconsistency'); $rcmail->output->set_env('product_name', $rcmail->config->get('product_name')); $table = new html_table(array('cols' => 2)); if ($rcmail->config->get('password_confirm_current')) { // show current password selection $field_id = 'curpasswd'; $input_curpasswd = new html_passwordfield(array('name' => '_curpasswd', 'id' => $field_id, 'size' => 20, 'autocomplete' => 'off')); $table->add('title', html::label($field_id, rcube::Q($this->gettext('curpasswd')))); $table->add(null, $input_curpasswd->show()); } // show new password selection $field_id = 'newpasswd'; $input_newpasswd = new html_passwordfield(array('name' => '_newpasswd', 'id' => $field_id, 'size' => 20, 'autocomplete' => 'off')); $table->add('title', html::label($field_id, rcube::Q($this->gettext('newpasswd')))); $table->add(null, $input_newpasswd->show()); // show confirm password selection $field_id = 'confpasswd'; $input_confpasswd = new html_passwordfield(array('name' => '_confpasswd', 'id' => $field_id, 'size' => 20, 'autocomplete' => 'off')); $table->add('title', html::label($field_id, rcube::Q($this->gettext('confpasswd')))); $table->add(null, $input_confpasswd->show()); $rules = ''; $required_length = intval($rcmail->config->get('password_minimum_length')); if ($required_length > 0) { $rules .= html::tag('li', array('id' => 'required-length'), $this->gettext(array('name' => 'passwordshort', 'vars' => array('length' => $required_length)))); } if ($rcmail->config->get('password_require_nonalpha')) { $rules .= html::tag('li', array('id' => 'require-nonalpha'), $this->gettext('passwordweak')); } if (!empty($rules)) { $rules = html::tag('ul', array('id' => 'ruleslist'), $rules); } $out = html::div(array('class' => 'box'), html::div(array('id' => 'prefs-title', 'class' => 'boxtitle'), $this->gettext('changepasswd')) . html::div(array('class' => 'boxcontent'), $table->show() . $rules . html::p(null, $rcmail->output->button(array('command' => 'plugin.password-save', 'type' => 'input', 'class' => 'button mainaction', 'label' => 'save'))))); $rcmail->output->add_gui_object('passform', 'password-form'); return $rcmail->output->form_tag(array('id' => 'password-form', 'name' => 'password-form', 'method' => 'post', 'action' => './?_task=settings&_action=plugin.password-save'), $out); }
public function vacation_form() { $table = new html_table(array('cols' => 2)); $field_id = 'vacationenable'; $input_vacationenable = new html_checkbox(array('name' => '_vacationenable', 'id' => $field_id, 'value' => 1)); $table->add('title', html::label($field_id, Q($this->gettext('vacationenable')))); $table->add(null, $input_vacationenable->show($this->obj->is_vacation_enable() === true || $this->obj->is_vacation_enable() == "1" || $this->obj->is_vacation_enable() == "t" || $this->obj->is_vacation_enable() == "y" || $this->obj->is_vacation_enable() == "yes" ? 1 : 0)); if ($this->rc->config->get('vacation_gui_vacationdate', FALSE)) { $format = $this->rc->config->get('vacation_dateformat', 'm/d/Y'); $this->add_date_field($table, 'vacationstart', $this->obj->get_vacation_start(), $format); $this->add_date_field($table, 'vacationend', $this->obj->get_vacation_end(), $format); } if ($this->rc->config->get('vacation_gui_vacationsubject', FALSE)) { $field_id = 'vacationsubject'; $input_vacationsubject = new html_inputfield(array('name' => '_vacationsubject', 'id' => $field_id, 'size' => 95)); $table->add('title', html::label($field_id, Q($this->gettext('vacationsubject')))); $table->add(null, $input_vacationsubject->show($this->obj->get_vacation_subject())); } $field_id = 'vacationmessage'; if ($this->rc->config->get('vacation_gui_vacationmessage_html', FALSE)) { $this->rc->output->add_label('converting', 'editorwarning'); // FIX: use identity mode for minimal functions rcube_html_editor('identity'); $text_vacationmessage = new html_textarea(array('name' => '_vacationmessage', 'id' => $field_id, 'spellcheck' => 1, 'rows' => 12, 'cols' => 70, 'class' => 'mce_editor')); } else { $text_vacationmessage = new html_textarea(array('name' => '_vacationmessage', 'id' => $field_id, 'spellcheck' => 1, 'rows' => 12, 'cols' => 70)); } $table->add('title', html::label($field_id, Q($this->gettext('vacationmessage')))); $table->add(null, $text_vacationmessage->show($this->obj->get_vacation_message())); if ($this->rc->config->get('vacation_gui_vacationkeepcopyininbox', FALSE)) { $field_id = 'keepcopyininbox'; $input_vacationkeepcopyininbox = new html_checkbox(array('name' => '_vacationkeepcopyininbox', 'id' => $field_id, 'value' => 1)); $table->add('title', html::label($field_id, Q($this->gettext('vacationkeepcopyininbox')))); $table->add(null, $input_vacationkeepcopyininbox->show($this->obj->is_vacation_keep_copy_in_inbox() ? 1 : 0)); } if ($this->rc->config->get('vacation_gui_vacationforwarder', FALSE)) { $field_id = 'vacationforwarder'; $input_vacationforwarder = new html_inputfield(array('name' => '_vacationforwarder', 'id' => $field_id, 'size' => 95)); $table->add('title', html::label($field_id, Q($this->gettext('vacationforwarder')))); $table->add(null, $input_vacationforwarder->show($this->obj->get_vacation_forwarder())); } $out = html::div(array('class' => "box"), html::div(array('id' => "prefs-title", 'class' => 'boxtitle'), $this->gettext('vacation')) . html::div(array('class' => "boxcontent scroller"), $table->show() . html::p(null, $this->rc->output->button(array('command' => 'plugin.vacation-save', 'type' => 'input', 'class' => 'button mainaction', 'label' => 'save'))))); $this->rc->output->add_gui_object('vacationform', 'vacation-form'); return $this->rc->output->form_tag(array('id' => 'vacation-form', 'name' => 'vacation-form', 'method' => 'post', 'action' => './?_task=settings&_action=plugin.vacation-save'), $out); }