public static function sign_up_sign_in($url)
 {
     // TODO: add sign in as guest.
     $dropdown_content = array('class' => 'dropdown-menu', 'style' => 'padding: 15px; padding-bottom: 0px;');
     $form = array('method' => 'post', 'action' => $url, 'accept-charset' => 'UTF-8');
     $username = array('type' => 'text', 'placeholder' => 'Username', 'id' => 'username', 'name' => 'username');
     $password = array('type' => 'password', 'placeholder' => 'Password', 'id' => 'password', 'name' => 'password');
     $submit = array('value' => 'Sign In', 'class' => 'btn btn-primary btn-block', 'id' => 'sign-in');
     return html::ul('nav pull-right', html::li(html::a(new moodle_url('/login/signup.php'), 'Sign Up')) . bootstrap::list_divider() . bootstrap::dropdown('Sign In', html::div($dropdown_content, html::form($form, html::input($username) . html::input($password) . html::checkbox('rememberusername', 'Remember username') . html::submit($submit)))));
 }
Beispiel #2
0
 public function addition_folder_options()
 {
     $this->add_texts('localization/');
     $li = '';
     $li .= html::tag('li', null, $this->api->output->button(array('command' => 'plugin.contextmenu.readfolder', 'type' => 'link', 'class' => 'readfolder', 'label' => 'contextmenu.markreadfolder')));
     $li .= html::tag('li', null, $this->api->output->button(array('command' => 'plugin.contextmenu.collapseall', 'type' => 'link', 'class' => 'collapseall rcmglobal', 'label' => 'contextmenu.collapseall')));
     $li .= html::tag('li', null, $this->api->output->button(array('command' => 'plugin.contextmenu.expandall', 'type' => 'link', 'class' => 'expandall rcmglobal', 'label' => 'contextmenu.expandall')));
     $li .= html::tag('li', null, $this->api->output->button(array('command' => 'plugin.contextmenu.openfolder', 'type' => 'link', 'class' => 'openfolder rcmglobal', 'label' => 'openinextwin')));
     $out = html::tag('ul', array('id' => 'rcmFolderMenu'), $li);
     $this->api->output->add_footer(html::div(array('style' => 'display: none;'), $out));
 }
Beispiel #3
0
function errorHandler($eNro, $eStr, $eFile, $eLine)
{
    $estr = array('1' => 'E_ERROR', '2' => 'E_WARNING', '4' => 'E_PARSE', '8' => 'E_NOTICE', '16' => 'E_CORE_ERROR', '32' => 'E_CORE_WARNING', '64' => 'E_COMPILE_ERROR', '128' => 'E_COMPILE_WARNING', '256' => 'E_USER_ERROR', '512' => 'E_USER_WARNING', '1024' => 'E_USER_NOTICE', '2048' => 'E_STRICT', '4096' => 'E_RECOVERABLE_ERROR', '8192' => 'E_ALL');
    // Requerir clases.
    require_once basePath . '/lib/class.html.php';
    require_once basePath . '/lib/module.main.php';
    require_once basePath . '/lib/module.backend.php';
    // Instaciar clases principales.
    $class = new \docuprensa\backend\authenticate();
    $tag = new \html();
    $html = null;
    if (eReporing == 'E_ALL') {
        $html .= $tag->div('Número de error: ' . $eNro . ' (' . $estr[$eNro] . ')', 'msgError');
        $html .= $tag->div('Mensaje de error: ' . $eStr, 'msgError');
        $html .= $tag->div('Archivo de error: ' . $eFile, 'msgError');
        $html .= $tag->div('Línea del error: ' . $eLine, 'msgError');
    }
    $html .= $class->form_login();
    echo $html;
    die;
}
Beispiel #4
0
 public function addition_addressbook_options()
 {
     $this->add_texts('localization/');
     $li = '';
     $li .= html::tag('li', array('role' => 'menuitem'), $this->api->output->button(array('command' => 'plugin.contextmenu.assigngroup', 'type' => 'link', 'class' => 'assigngroup disabled', 'classact' => 'assigngroup active', 'label' => 'contextmenu.assigngroup', 'tabindex' => '-1', 'aria-disabled' => 'true')));
     if (count(rcube::get_instance()->get_address_sources(true)) > 1) {
         // only show the move option if there are sources to move between
         $li .= html::tag('li', array('role' => 'menuitem'), $this->api->output->button(array('command' => 'move', 'type' => 'link', 'class' => 'movecontact disabled', 'classact' => 'movecontact active', 'label' => 'moveto', 'tabindex' => '-1', 'aria-disabled' => 'true')));
         $li .= html::tag('li', array('role' => 'menuitem'), $this->api->output->button(array('command' => 'copy', 'type' => 'link', 'class' => 'copycontact disabled', 'classact' => 'copycontact active', 'label' => 'copyto', 'tabindex' => '-1', 'aria-disabled' => 'true')));
     }
     $out = html::tag('ul', array('id' => 'rcmAddressBookMenu', 'role' => 'menu'), $li);
     $this->api->output->add_footer(html::div(array('style' => 'display: none;', 'aria-hidden' => 'true'), $out));
 }
Beispiel #5
0
 /**
  * see html::calendar()
  */
 public static function calendar($options = [])
 {
     // include js & css files
     if (empty($options['readonly'])) {
         layout::add_js('/numbers/media_submodules/numbers_frontend_components_calendar_numbers_media_js_base.js');
         layout::add_css('/numbers/media_submodules/numbers_frontend_components_calendar_numbers_media_css_base.css');
     }
     // font awesome icons
     library::add('fontawesome');
     // widget parameters
     $type = $options['calendar_type'] ?? $options['type'] ?? 'date';
     $widget_options = ['id' => $options['id'], 'type' => $type, 'format' => $options['calendar_format'] ?? format::get_date_format($type), 'date_week_start_day' => $options['calendar_date_week_start_day'] ?? 1, 'date_disable_week_days' => $options['calendar_date_disable_week_days'] ?? null, 'master_id' => $options['calendar_master_id'] ?? null, 'slave_id' => $options['calendar_slave_id'] ?? null];
     $options['type'] = 'text';
     // determine input size
     $placeholder = format::get_date_placeholder($widget_options['format']);
     $options['size'] = strlen($placeholder);
     // set placeholder
     if (!empty($options['placeholder']) && $options['placeholder'] == 'format::get_date_placeholder') {
         $options['placeholder'] = $placeholder;
         $options['title'] = ($options['title'] ?? '') . ' (' . $placeholder . ')';
     }
     if (isset($options['calendar_icon']) && ($options['calendar_icon'] == 'left' || $options['calendar_icon'] == 'right')) {
         $position = $options['calendar_icon'];
         if (i18n::rtl()) {
             if ($position == 'left') {
                 $position = 'right';
             } else {
                 $position = 'left';
             }
         }
         $icon_type = $type == 'time' ? 'clock-o' : 'calendar';
         unset($options['calendar_icon']);
         if (empty($options['readonly'])) {
             $icon_onclick = 'numbers_calendar_var_' . $options['id'] . '.show();';
         } else {
             $icon_onclick = null;
         }
         $icon_value = html::span(['onclick' => $icon_onclick, 'class' => 'numbers_calendar_icon numbers_prevent_selection', 'value' => html::icon(['type' => $icon_type])]);
         $result = html::input_group(['value' => html::input($options), $position => $icon_value, 'dir' => 'ltr']);
         $div_id = $options['id'] . '_div_holder';
         $result .= html::div(['id' => $div_id, 'class' => 'numbers_calendar_div_holder']);
         $widget_options['holder_div_id'] = $div_id;
     } else {
         $result = html::input($options);
     }
     // we do not render a widget if readonly
     if (empty($options['readonly'])) {
         layout::onload('numbers_calendar(' . json_encode($widget_options) . ');');
     }
     return $result;
 }
 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);
 }
 /**
  * Adds download options menu to the page
  */
 public function download_menu()
 {
     $this->include_script('zipdownload.js');
     $this->add_label('download');
     $rcmail = rcmail::get_instance();
     $menu = array();
     $ul_attr = array('role' => 'menu', 'aria-labelledby' => 'aria-label-zipdownloadmenu');
     if ($rcmail->config->get('skin') != 'classic') {
         $ul_attr['class'] = 'toolbarmenu';
     }
     foreach (array('eml', 'mbox', 'maildir') as $type) {
         $menu[] = html::tag('li', null, $rcmail->output->button(array('command' => "download-{$type}", 'label' => "zipdownload.download{$type}", 'classact' => 'active')));
     }
     $rcmail->output->add_footer(html::div(array('id' => 'zipdownload-menu', 'class' => 'popupmenu', 'aria-hidden' => 'true'), html::tag('h2', array('class' => 'voice', 'id' => 'aria-label-zipdownloadmenu'), "Message Download Options Menu") . html::tag('ul', $ul_attr, implode('', $menu))));
 }
Beispiel #8
0
    private function buildTable($data)
    {
        $id = uniqid('table');
        $tvpag = <<<EOT
function table_setpage(tableid,page) {
    alert('Set page ' + page);
}
EOT;
        App::document()->addInlineScript($tvpag, 'text/javascript', 'tableview-pagination');
        $hc = empty($this->options['header-columns']) ? 0 : $this->options['header-columns'];
        $hr = empty($this->options['header-rows']) ? 0 : $this->options['header-rows'];
        $rows = [];
        $ri = 0;
        $ipp = $this->options['items-per-page'];
        foreach ($data as $row) {
            $ri++;
            $ci = 0;
            $cols = [];
            foreach ($row as $col) {
                $ci++;
                if ($ci <= $hc || $ri <= $hr) {
                    $cols[] = html::th($col);
                } else {
                    $cols[] = html::td($col);
                }
            }
            $rows[] = html::tr(join($cols));
            if ($ipp && $ri > $ipp) {
                break;
            }
        }
        $table = html::table(join($rows), ['class' => $this->options['table-class'], 'style' => 'width:100%;']);
        if ($ipp) {
            $page = 0;
            $numpages = floor((count($data) - 1) / $ipp) + 1;
            $pagelinks = html::a(' &laquo; First ', ['href' => 'javascript:return false;']);
            $pagelinks .= html::a(' &lsaquo; Prev ', ['href' => 'javascript:return false;']);
            for ($n = 1; $n <= $numpages; $n++) {
                $pagelinks .= html::a(' {page} ', ['href' => 'javascript:return false;'], ['page' => $n]);
            }
            $pagelinks .= html::a(' Next &rsaquo; ', ['href' => 'javascript:return false;']);
            $pagelinks .= html::a(' Last &raquo; ', ['href' => 'javascript:return false;']);
            $table .= html::div('Page {page} of {pages} ({items} items) {links}', ['class' => $this->options['footer-class']], ['page' => $page + 1, 'pages' => $numpages, 'items' => count($data), 'links' => $pagelinks]);
        }
        return html::div($table, ['style' => 'width:99%']);
    }
 /**
  * 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');
     }
 }
Beispiel #10
0
 /**
  * Callback function when HTML page is rendered
  * We'll add an overlay box here.
  */
 function render_page($p)
 {
     if ($_SESSION['plugin.newuserdialog'] && $p['template'] == 'mail') {
         $this->add_texts('localization');
         $rcmail = rcmail::get_instance();
         $identity = $rcmail->user->get_identity();
         $identities_level = intval($rcmail->config->get('identities_level', 0));
         // compose user-identity dialog
         $table = new html_table(array('cols' => 2));
         $table->add('title', $this->gettext('name'));
         $table->add(null, html::tag('input', array('type' => 'text', 'name' => '_name', 'value' => $identity['name'])));
         $table->add('title', $this->gettext('email'));
         $table->add(null, html::tag('input', array('type' => 'text', 'name' => '_email', 'value' => idn_to_utf8($identity['email']), 'disabled' => $identities_level == 1 || $identities_level == 3)));
         // add overlay input box to html page
         $rcmail->output->add_footer(html::div(array('id' => 'newuseroverlay'), html::tag('form', array('action' => $rcmail->url('plugin.newusersave'), 'method' => 'post'), html::tag('h3', null, Q($this->gettext('identitydialogtitle'))) . html::p('hint', Q($this->gettext('identitydialoghint'))) . $table->show() . html::p(array('class' => 'formbuttons'), html::tag('input', array('type' => 'submit', 'class' => 'button mainaction', 'value' => $this->gettext('save')))))));
         // disable keyboard events for messages list (#1486726)
         $rcmail->output->add_script("\$(document).ready(function () {\n          rcmail.message_list.key_press = function(){};\n          rcmail.message_list.key_down = function(){};\n          \$('input[name=_name]').focus();\n          });", 'foot');
         $this->include_stylesheet('newuserdialog.css');
     }
 }
Beispiel #11
0
 /**
  * @see html::input_group()
  */
 public static function input_group($options = [])
 {
     $temp = [];
     foreach (['left', 'center', 'right'] as $k0) {
         if ($k0 == 'center') {
             $temp[] = $options['value'];
         } else {
             if (!empty($options[$k0])) {
                 if (!is_array($options[$k0])) {
                     $options[$k0] = [$options[$k0]];
                 }
                 foreach ($options[$k0] as $k => $v) {
                     $temp[] = html::span(['value' => $v, 'class' => 'input-group-addon']);
                 }
             }
         }
     }
     unset($options['left'], $options['right']);
     $options['value'] = implode('', $temp);
     $options['class'] = 'input-group';
     return html::div($options);
 }
 /**
  * Generate the form for recurrence settings
  */
 public function recurrence_form($attrib = array())
 {
     switch ($attrib['part']) {
         // frequency selector
         case 'frequency':
             $select = new html_select(array('name' => 'frequency', 'id' => 'edit-recurrence-frequency'));
             $select->add($this->gettext('never'), '');
             $select->add($this->gettext('daily'), 'DAILY');
             $select->add($this->gettext('weekly'), 'WEEKLY');
             $select->add($this->gettext('monthly'), 'MONTHLY');
             $select->add($this->gettext('yearly'), 'YEARLY');
             $select->add($this->gettext('rdate'), 'RDATE');
             $html = html::label('edit-recurrence-frequency', $this->gettext('frequency')) . $select->show('');
             break;
             // daily recurrence
         // daily recurrence
         case 'daily':
             $select = $this->interval_selector(array('name' => 'interval', 'class' => 'edit-recurrence-interval', 'id' => 'edit-recurrence-interval-daily'));
             $html = html::div($attrib, html::label('edit-recurrence-interval-daily', $this->gettext('every')) . $select->show(1) . html::span('label-after', $this->gettext('days')));
             break;
             // weekly recurrence form
         // weekly recurrence form
         case 'weekly':
             $select = $this->interval_selector(array('name' => 'interval', 'class' => 'edit-recurrence-interval', 'id' => 'edit-recurrence-interval-weekly'));
             $html = html::div($attrib, html::label('edit-recurrence-interval-weekly', $this->gettext('every')) . $select->show(1) . html::span('label-after', $this->gettext('weeks')));
             // weekday selection
             $daymap = array('sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat');
             $checkbox = new html_checkbox(array('name' => 'byday', 'class' => 'edit-recurrence-weekly-byday'));
             $first = $this->rc->config->get('calendar_first_day', 1);
             for ($weekdays = '', $j = $first; $j <= $first + 6; $j++) {
                 $d = $j % 7;
                 $weekdays .= html::label(array('class' => 'weekday'), $checkbox->show('', array('value' => strtoupper(substr($daymap[$d], 0, 2)))) . $this->gettext($daymap[$d])) . ' ';
             }
             $html .= html::div($attrib, html::label(null, $this->gettext('bydays')) . $weekdays);
             break;
             // monthly recurrence form
         // monthly recurrence form
         case 'monthly':
             $select = $this->interval_selector(array('name' => 'interval', 'class' => 'edit-recurrence-interval', 'id' => 'edit-recurrence-interval-monthly'));
             $html = html::div($attrib, html::label('edit-recurrence-interval-monthly', $this->gettext('every')) . $select->show(1) . html::span('label-after', $this->gettext('months')));
             $checkbox = new html_checkbox(array('name' => 'bymonthday', 'class' => 'edit-recurrence-monthly-bymonthday'));
             for ($monthdays = '', $d = 1; $d <= 31; $d++) {
                 $monthdays .= html::label(array('class' => 'monthday'), $checkbox->show('', array('value' => $d)) . $d);
                 $monthdays .= $d % 7 ? ' ' : html::br();
             }
             // rule selectors
             $radio = new html_radiobutton(array('name' => 'repeatmode', 'class' => 'edit-recurrence-monthly-mode'));
             $table = new html_table(array('cols' => 2, 'border' => 0, 'cellpadding' => 0, 'class' => 'formtable'));
             $table->add('label', html::label(null, $radio->show('BYMONTHDAY', array('value' => 'BYMONTHDAY')) . ' ' . $this->gettext('each')));
             $table->add(null, $monthdays);
             $table->add('label', html::label(null, $radio->show('', array('value' => 'BYDAY')) . ' ' . $this->gettext('onevery')));
             $table->add(null, $this->rrule_selectors($attrib['part']));
             $html .= html::div($attrib, $table->show());
             break;
             // annually recurrence form
         // annually recurrence form
         case 'yearly':
             $select = $this->interval_selector(array('name' => 'interval', 'class' => 'edit-recurrence-interval', 'id' => 'edit-recurrence-interval-yearly'));
             $html = html::div($attrib, html::label('edit-recurrence-interval-yearly', $this->gettext('every')) . $select->show(1) . html::span('label-after', $this->gettext('years')));
             // month selector
             $monthmap = array('', 'jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec');
             $checkbox = new html_checkbox(array('name' => 'bymonth', 'class' => 'edit-recurrence-yearly-bymonth'));
             for ($months = '', $m = 1; $m <= 12; $m++) {
                 $months .= html::label(array('class' => 'month'), $checkbox->show(null, array('value' => $m)) . $this->gettext($monthmap[$m]));
                 $months .= $m % 4 ? ' ' : html::br();
             }
             $html .= html::div($attrib + array('id' => 'edit-recurrence-yearly-bymonthblock'), $months);
             // day rule selection
             $html .= html::div($attrib, html::label(null, $this->gettext('onevery')) . $this->rrule_selectors($attrib['part'], '---'));
             break;
             // end of recurrence form
         // end of recurrence form
         case 'until':
             $radio = new html_radiobutton(array('name' => 'repeat', 'class' => 'edit-recurrence-until'));
             $select = $this->interval_selector(array('name' => 'times', 'id' => 'edit-recurrence-repeat-times'));
             $input = new html_inputfield(array('name' => 'untildate', 'id' => 'edit-recurrence-enddate', 'size' => "10"));
             $html = html::div('line first', html::label(null, $radio->show('', array('value' => '', 'id' => 'edit-recurrence-repeat-forever')) . ' ' . $this->gettext('forever')));
             $forntimes = $this->gettext(array('name' => 'forntimes', 'vars' => array('nr' => '%s')));
             $html .= html::div('line', $radio->show('', array('value' => 'count', 'id' => 'edit-recurrence-repeat-count', 'aria-label' => sprintf($forntimes, 'N'))) . ' ' . sprintf($forntimes, $select->show(1)));
             $html .= html::div('line', $radio->show('', array('value' => 'until', 'id' => 'edit-recurrence-repeat-until', 'aria-label' => $this->gettext('untilenddate'))) . ' ' . $this->gettext('untildate') . ' ' . $input->show('', array('aria-label' => $this->gettext('untilenddate'))));
             $html = html::div($attrib, html::label(null, ucfirst($this->gettext('recurrencend'))) . $html);
             break;
         case 'rdate':
             $ul = html::tag('ul', array('id' => 'edit-recurrence-rdates'), '');
             $input = new html_inputfield(array('name' => 'rdate', 'id' => 'edit-recurrence-rdate-input', 'size' => "10"));
             $button = new html_inputfield(array('type' => 'button', 'class' => 'button add', 'value' => $this->gettext('addrdate')));
             $html .= html::div($attrib, $ul . html::div('inputform', $input->show() . $button->show()));
             break;
     }
     return $html;
 }
Beispiel #13
0
 /**
  * Add UI element to copy event invitations or updates to the calendar
  */
 public function mail_messagebody_html($p)
 {
     // load iCalendar functions (if necessary)
     if (!empty($this->lib->ical_parts)) {
         $this->get_ical();
         $this->load_itip();
     }
     $html = '';
     $has_events = false;
     $ical_objects = $this->lib->get_mail_ical_objects();
     // show a box for every event in the file
     foreach ($ical_objects as $idx => $event) {
         if ($event['_type'] != 'event') {
             // skip non-event objects (#2928)
             continue;
         }
         $has_events = true;
         // get prepared inline UI for this event object
         if ($ical_objects->method) {
             $append = '';
             // prepare a small agenda preview to be filled with actual event data on async request
             if ($ical_objects->method == 'REQUEST') {
                 $append = html::div('calendar-agenda-preview', html::tag('h3', 'preview-title', $this->gettext('agenda') . ' ' . html::span('date', $this->rc->format_date($event['start'], $this->rc->config->get('date_format')))) . '%before%' . $this->mail_agenda_event_row($event, 'current') . '%after%');
             }
             $html .= html::div('calendar-invitebox', $this->itip->mail_itip_inline_ui($event, $ical_objects->method, $ical_objects->mime_id . ':' . $idx, 'calendar', rcube_utils::anytodatetime($ical_objects->message_date), $this->rc->url(array('task' => 'calendar')) . '&view=agendaDay&date=' . $event['start']->format('U')) . $append);
         }
         // limit listing
         if ($idx >= 3) {
             break;
         }
     }
     // prepend event boxes to message body
     if ($html) {
         $this->ui->init();
         $p['content'] = $html . $p['content'];
         $this->rc->output->add_label('calendar.savingdata', 'calendar.deleteventconfirm', 'calendar.declinedeleteconfirm');
     }
     // add "Save to calendar" button into attachment menu
     if ($has_events) {
         $this->add_button(array('id' => 'attachmentsavecal', 'name' => 'attachmentsavecal', 'type' => 'link', 'wrapper' => 'li', 'command' => 'attachment-save-calendar', 'class' => 'icon calendarlink', 'classact' => 'icon calendarlink active', 'innerclass' => 'icon calendar', 'label' => 'calendar.savetocalendar'), 'attachmentmenu');
     }
     return $p;
 }
Beispiel #14
0
 /**
  * Handler for message_body_prefix hook.
  * Called for every displayed (content) part of the message.
  * Adds infobox about signature verification and/or decryption
  * status above the body.
  *
  * @param array Original parameters
  *
  * @return array Modified parameters
  */
 function status_message($p)
 {
     // skip: not a message part
     if ($p['part'] instanceof rcube_message) {
         return $p;
     }
     // skip: message has no signed/encoded content
     if (!$this->enigma->engine) {
         return $p;
     }
     $engine = $this->enigma->engine;
     $part_id = $p['part']->mime_id;
     $parent_id = preg_replace('/\\.[0-9]+$/', '', $part_id);
     // Decryption status
     if (($status = $engine->decryptions[$part_id]) || $parent_id !== '' && ($status = $engine->decryptions[$parent_id])) {
         $attach_scripts = true;
         // show the message only once
         unset($engine->decryptions[$part_id]);
         if ($parent_id !== '') {
             unset($engine->decryptions[$parent_id]);
         }
         // display status info
         $attrib['id'] = 'enigma-message';
         if ($status instanceof enigma_error) {
             $attrib['class'] = 'enigmaerror';
             $code = $status->getCode();
             if ($code == enigma_error::KEYNOTFOUND) {
                 $msg = rcube::Q(str_replace('$keyid', enigma_key::format_id($status->getData('id')), $this->enigma->gettext('decryptnokey')));
             } else {
                 if ($code == enigma_error::BADPASS) {
                     $msg = rcube::Q($this->enigma->gettext('decryptbadpass'));
                     $this->password_prompt($status);
                 } else {
                     $msg = rcube::Q($this->enigma->gettext('decrypterror'));
                 }
             }
         } else {
             $attrib['class'] = 'enigmanotice';
             $msg = rcube::Q($this->enigma->gettext('decryptok'));
         }
         $p['prefix'] .= html::div($attrib, $msg);
     }
     // Signature verification status
     if (isset($engine->signed_parts[$part_id]) && ($sig = $engine->signatures[$engine->signed_parts[$part_id]])) {
         $attach_scripts = true;
         // display status info
         $attrib['id'] = 'enigma-message';
         if ($sig instanceof enigma_signature) {
             $sender = ($sig->name ? $sig->name . ' ' : '') . '<' . $sig->email . '>';
             if ($sig->valid === enigma_error::UNVERIFIED) {
                 $attrib['class'] = 'enigmawarning';
                 $msg = str_replace('$sender', $sender, $this->enigma->gettext('sigunverified'));
                 $msg = str_replace('$keyid', $sig->id, $msg);
                 $msg = rcube::Q($msg);
             } else {
                 if ($sig->valid) {
                     $attrib['class'] = 'enigmanotice';
                     $msg = rcube::Q(str_replace('$sender', $sender, $this->enigma->gettext('sigvalid')));
                 } else {
                     $attrib['class'] = 'enigmawarning';
                     $msg = rcube::Q(str_replace('$sender', $sender, $this->enigma->gettext('siginvalid')));
                 }
             }
         } else {
             if ($sig && $sig->getCode() == enigma_error::KEYNOTFOUND) {
                 $attrib['class'] = 'enigmawarning';
                 $msg = rcube::Q(str_replace('$keyid', enigma_key::format_id($sig->getData('id')), $this->enigma->gettext('signokey')));
             } else {
                 $attrib['class'] = 'enigmaerror';
                 $msg = rcube::Q($this->enigma->gettext('sigerror'));
             }
         }
         /*
                     $msg .= '&nbsp;' . html::a(array('href' => "#sigdetails",
                         'onclick' => rcmail_output::JS_OBJECT_NAME.".command('enigma-sig-details')"),
                         rcube::Q($this->enigma->gettext('showdetails')));
         */
         // test
         //            $msg .= '<br /><pre>'.$sig->body.'</pre>';
         $p['prefix'] .= html::div($attrib, $msg);
         // Display each signature message only once
         unset($engine->signatures[$engine->signed_parts[$part_id]]);
     }
     if ($attach_scripts) {
         // add css and js script
         $this->add_css();
         $this->add_js();
     }
     return $p;
 }
 public function show_tb_label_contextmenu($args)
 {
     #$this->api->output->add_label('copymessage.copyingmessage');
     $li = html::tag('li', array('class' => 'submenu'), '<span>' . Q($this->gettext('tb_label_contextmenu_title')) . '</span>' . $this->_gen_label_submenu($args, 'tb_label_ctxm_submenu'));
     $out .= html::tag('ul', array('id' => 'tb_label_ctxm_mainmenu'), $li);
     $this->api->output->add_footer(html::div(array('style' => 'display: none;'), $out));
 }
 /**
  * Add key manager and key selector to html output
  *
  * @param array Original parameters
  * @return array Modified parameters
  */
 function render_page($params)
 {
     $template_path = $this->home . '/' . $this->local_skin_path();
     $this->rc->output->add_footer($this->rc->output->just_parse(file_get_contents($template_path . '/templates/key_manager.html') . file_get_contents($template_path . '/templates/key_search.html') . file_get_contents($template_path . '/templates/key_select.html')));
     $this->rc->output->add_footer(html::div(array('style' => "visibility: hidden;", 'id' => "openpgpjs_identities"), json_encode($this->rm->user->list_identities())));
     return $params;
 }
Beispiel #17
0
 /**
  * Handler for ACL form template object
  */
 public function calendar_acl_form()
 {
     $calid = rcube_utils::get_input_value('_id', rcube_utils::INPUT_GPC);
     if ($calid && ($cal = $this->get_calendar($calid))) {
         $folder = $cal->get_realname();
         // UTF7
         $color = $cal->get_color();
     } else {
         $folder = '';
         $color = '';
     }
     $storage = $this->rc->get_storage();
     $delim = $storage->get_hierarchy_delimiter();
     $form = array();
     if (strlen($folder)) {
         $path_imap = explode($delim, $folder);
         array_pop($path_imap);
         // pop off name part
         $path_imap = implode($path_imap, $delim);
         $options = $storage->folder_info($folder);
         // Allow plugins to modify the form content (e.g. with ACL form)
         $plugin = $this->rc->plugins->exec_hook('calendar_form_kolab', array('form' => $form, 'options' => $options, 'name' => $folder));
     }
     if (!$plugin['form']['sharing']['content']) {
         $plugin['form']['sharing']['content'] = html::div('hint', $this->cal->gettext('aclnorights'));
     }
     return $plugin['form']['sharing']['content'];
 }
 /**
  *
  */
 function event_invitebox($attrib = array())
 {
     if ($this->cal->event) {
         return html::div($attrib, $this->cal->itip->itip_object_details_table($this->cal->event, $this->cal->itip->gettext('itipinvitation')) . $this->cal->invitestatus);
     }
     return '';
 }
Beispiel #19
0
 /**
  * Return html for a structured list &lt;ul&gt; for the mailbox tree
  */
 public function render_folder_tree_html(&$arrFolders, &$mbox_name, &$jslist, $attrib, $nestLevel = 0)
 {
     $maxlength = intval($attrib['maxlength']);
     $realnames = (bool) $attrib['realnames'];
     $msgcounts = $this->storage->get_cache('messagecount');
     $collapsed = $this->config->get('collapsed_folders');
     $realnames = $this->config->get('show_real_foldernames');
     $out = '';
     foreach ($arrFolders as $folder) {
         $title = null;
         $folder_class = $this->folder_classname($folder['id']);
         $is_collapsed = strpos($collapsed, '&' . rawurlencode($folder['id']) . '&') !== false;
         $unread = $msgcounts ? intval($msgcounts[$folder['id']]['UNSEEN']) : 0;
         if ($folder_class && !$realnames) {
             $foldername = $this->gettext($folder_class);
         } else {
             $foldername = $folder['name'];
             // shorten the folder name to a given length
             if ($maxlength && $maxlength > 1) {
                 $fname = abbreviate_string($foldername, $maxlength);
                 if ($fname != $foldername) {
                     $title = $foldername;
                 }
                 $foldername = $fname;
             }
         }
         // make folder name safe for ids and class names
         $folder_id = rcube_utils::html_identifier($folder['id'], true);
         $classes = array('mailbox');
         // set special class for Sent, Drafts, Trash and Junk
         if ($folder_class) {
             $classes[] = $folder_class;
         }
         if ($folder['id'] == $mbox_name) {
             $classes[] = 'selected';
         }
         if ($folder['virtual']) {
             $classes[] = 'virtual';
         } else {
             if ($unread) {
                 $classes[] = 'unread';
             }
         }
         $js_name = $this->JQ($folder['id']);
         $html_name = $this->Q($foldername) . ($unread ? html::span('unreadcount', sprintf($attrib['unreadwrap'], $unread)) : '');
         $link_attrib = $folder['virtual'] ? array() : array('href' => $this->url(array('_mbox' => $folder['id'])), 'onclick' => sprintf("return %s.command('list','%s',this,event)", rcmail_output::JS_OBJECT_NAME, $js_name), 'rel' => $folder['id'], 'title' => $title);
         $out .= html::tag('li', array('id' => "rcmli" . $folder_id, 'class' => join(' ', $classes), 'noclose' => true), html::a($link_attrib, $html_name));
         if (!empty($folder['folders'])) {
             $out .= html::div('treetoggle ' . ($is_collapsed ? 'collapsed' : 'expanded'), '&nbsp;');
         }
         $jslist[$folder['id']] = array('id' => $folder['id'], 'name' => $foldername, 'virtual' => $folder['virtual']);
         if (!empty($folder_class)) {
             $jslist[$folder['id']]['class'] = $folder_class;
         }
         if (!empty($folder['folders'])) {
             $out .= html::tag('ul', array('style' => $is_collapsed ? "display:none;" : null), $this->render_folder_tree_html($folder['folders'], $mbox_name, $jslist, $attrib, $nestLevel + 1));
         }
         $out .= "</li>\n";
     }
     return $out;
 }
 /**
  * Shows an option in prefrences section to enable or disable the plugin.
  *
  * @param array $args Default hook arguments.
  *
  * @return array
  */
 public function prefs_content($args)
 {
     // ensure we are in the right section
     if ($args['section'] == 'recipienttocontact') {
         $field_id = 'rcmfd_use_recipienttocontact';
         // current status: plugin can be enabled or disabled
         $use_recipienttocontact = $this->rcmail->config->get('use_recipienttocontact');
         // checkbox element to change the status of the plugin
         $checkbox = new html_checkbox(array('name' => '_use_recipienttocontact', 'id' => $field_id, 'value' => 1, 'style' => 'margin-left: -300px'));
         $args['blocks']['recipienttocontact']['name'] = rcube::Q($this->gettext('prefs_title'));
         $args['blocks']['recipienttocontact']['options']['use_subscriptions'] = array('title' => html::label($field_id, rcube::Q($this->gettext('prefs_option'))), 'content' => $checkbox->show($use_recipienttocontact ? 1 : 0));
         $args['blocks']['recipienttocontact']['options']['description'] = array('title' => html::div(null, rcube::Q($this->gettext('prefs_descr'))) . html::br(), 'content' => '');
     }
     return $args;
 }
Beispiel #21
0
 function password_form()
 {
     $rcmail = rcmail::get_instance();
     $this->load_config();
     // add some labels to client
     $rcmail->output->add_label('password.nopassword', 'password.nocurpassword', 'password.passwordinconsistency');
     $rcmail->output->set_env('product_name', $rcmail->config->get('product_name'));
     $table = new html_table(array('cols' => 2));
     if ($rcmail->config->get('password_confirm_current')) {
         // show current password selection
         $field_id = 'curpasswd';
         $input_curpasswd = new html_passwordfield(array('name' => '_curpasswd', 'id' => $field_id, 'size' => 20, 'autocomplete' => 'off'));
         $table->add('title', html::label($field_id, Q($this->gettext('curpasswd'))));
         $table->add(null, $input_curpasswd->show());
     }
     // show new password selection
     $field_id = 'newpasswd';
     $input_newpasswd = new html_passwordfield(array('name' => '_newpasswd', 'id' => $field_id, 'size' => 20, 'autocomplete' => 'off'));
     $table->add('title', html::label($field_id, Q($this->gettext('newpasswd'))));
     $table->add(null, $input_newpasswd->show());
     // show confirm password selection
     $field_id = 'confpasswd';
     $input_confpasswd = new html_passwordfield(array('name' => '_confpasswd', 'id' => $field_id, 'size' => 20, 'autocomplete' => 'off'));
     $table->add('title', html::label($field_id, Q($this->gettext('confpasswd'))));
     $table->add(null, $input_confpasswd->show());
     $out = html::div(array('class' => 'box'), html::div(array('id' => 'prefs-title', 'class' => 'boxtitle'), $this->gettext('changepasswd')) . html::div(array('class' => 'boxcontent'), $table->show() . html::p(null, $rcmail->output->button(array('command' => 'plugin.password-save', 'type' => 'input', 'class' => 'button mainaction', 'label' => 'save')))));
     $rcmail->output->add_gui_object('passform', 'password-form');
     return $rcmail->output->form_tag(array('id' => 'password-form', 'name' => 'password-form', 'method' => 'post', 'action' => './?_task=settings&_action=plugin.password-save'), $out);
 }
 private function _prefs_block($part, $attrib)
 {
     $rcmail = rcube::get_instance();
     $no_override = array_flip($rcmail->config->get('sauserprefs_dont_override'));
     $locale_info = localeconv();
     switch ($part) {
         // General tests
         case 'general':
             $out = '';
             $data = '';
             $table = new html_table(array('class' => 'generalprefstable', 'cols' => 2));
             if (!isset($no_override['required_hits'])) {
                 $field_id = 'rcmfd_spamthres';
                 $input_spamthres = new html_select(array('name' => '_spamthres', 'id' => $field_id));
                 $input_spamthres->add($this->gettext('defaultscore'), '');
                 $decPlaces = 0;
                 if ($rcmail->config->get('sauserprefs_score_inc') - (int) $rcmail->config->get('sauserprefs_score_inc') > 0) {
                     $decPlaces = strlen($rcmail->config->get('sauserprefs_score_inc') - (int) $rcmail->config->get('sauserprefs_score_inc')) - 2;
                 }
                 $score_found = false;
                 for ($i = 1; $i <= 10; $i = $i + $rcmail->config->get('sauserprefs_score_inc')) {
                     $input_spamthres->add(number_format($i, $decPlaces, $locale_info['decimal_point'], ''), number_format($i, $decPlaces, '.', ''));
                     if (!$score_found && $this->user_prefs['required_hits'] && (double) $this->user_prefs['required_hits'] == (double) $i) {
                         $score_found = true;
                     }
                 }
                 if (!$score_found && $this->user_prefs['required_hits']) {
                     $input_spamthres->add(str_replace('%s', $this->user_prefs['required_hits'], $this->gettext('otherscore')), (double) $this->user_prefs['required_hits']);
                 }
                 $table->add('title', html::label($field_id, rcmail::Q($this->gettext('spamthres'))));
                 $table->add(null, $input_spamthres->show(number_format($this->user_prefs['required_hits'], $decPlaces, '.', '')));
                 $table->add(array('colspan' => 2), rcmail::Q($this->gettext('spamthresexp')));
             }
             if (!isset($no_override['rewrite_header Subject'])) {
                 $field_id = 'rcmfd_spamsubject';
                 $input_spamsubject = new html_inputfield(array('name' => '_spamsubject', 'id' => $field_id, 'value' => $this->user_prefs['rewrite_header Subject'], 'style' => 'width:200px;'));
                 $table->add('title', html::label($field_id, rcmail::Q($this->gettext('spamsubject'))));
                 $table->add(null, $input_spamsubject->show());
                 $table->add('title', "&nbsp;");
                 $table->add(null, rcmail::Q($this->gettext('spamsubjectblank')));
             }
             if ($table->size() > 0) {
                 $out .= html::tag('fieldset', null, html::tag('legend', null, rcmail::Q($this->gettext('mainoptions'))) . $table->show());
             }
             if (!isset($no_override['ok_languages']) || !isset($no_override['ok_locales'])) {
                 $data = html::p(null, rcmail::Q($this->gettext('spamlangexp')));
                 $table = new html_table(array('class' => 'langprefstable', 'cols' => 1));
                 $select_all = $this->api->output->button(array('command' => 'plugin.sauserprefs.select_all_langs', 'type' => 'link', 'label' => 'all'));
                 $select_none = $this->api->output->button(array('command' => 'plugin.sauserprefs.select_no_langs', 'type' => 'link', 'label' => 'none'));
                 $select_invert = $this->api->output->button(array('command' => 'plugin.sauserprefs.select_invert_langs', 'type' => 'link', 'label' => 'invert'));
                 $table->add(array('id' => 'listcontrols'), $this->gettext('select') . ":&nbsp;&nbsp;" . $select_all . "&nbsp;&nbsp;" . $select_invert . "&nbsp;&nbsp;" . $select_none);
                 $lang_table = new html_table(array('id' => 'spam-langs-table', 'class' => 'records-table', 'cellspacing' => '0', 'cols' => 2));
                 $lang_table->add_header(array('colspan' => 2), $this->gettext('language'));
                 if (!isset($no_override['ok_locales'])) {
                     if ($this->user_prefs['ok_locales'] == "all") {
                         $ok_locales = $this->sa_locales;
                     } else {
                         $ok_locales = explode(" ", $this->user_prefs['ok_locales']);
                     }
                 } else {
                     $ok_locales = array();
                 }
                 if (!isset($no_override['ok_languages'])) {
                     if ($this->user_prefs['ok_languages'] == "all") {
                         $ok_languages = array_keys($rcmail->config->get('sauserprefs_languages'));
                     } else {
                         $ok_languages = explode(" ", $this->user_prefs['ok_languages']);
                     }
                 } else {
                     $tmp_array = $rcmail->config->get('sauserprefs_languages');
                     $rcmail->config->set('sauserprefs_languages', array_intersect_key($tmp_array, array_flip($this->sa_locales)));
                     $ok_languages = array();
                 }
                 $i = 0;
                 $locales_langs = array_merge($ok_locales, $ok_languages);
                 foreach ($rcmail->config->get('sauserprefs_languages') as $lang_code => $name) {
                     if (in_array($lang_code, $locales_langs)) {
                         $button = $this->api->output->button(array('command' => 'plugin.sauserprefs.message_lang', 'prop' => $lang_code, 'type' => 'link', 'class' => 'enabled', 'id' => 'spam_lang_' . $i, 'title' => 'sauserprefs.enabled', 'content' => ' '));
                     } else {
                         $button = $this->api->output->button(array('command' => 'plugin.sauserprefs.message_lang', 'prop' => $lang_code, 'type' => 'link', 'class' => 'disabled', 'id' => 'spam_lang_' . $i, 'title' => 'sauserprefs.disabled', 'content' => ' '));
                     }
                     $input_spamlang = new html_checkbox(array('style' => 'display: none;', 'name' => '_spamlang[]', 'value' => $lang_code));
                     $lang_table->add('lang', $name);
                     $lang_table->add('tick', $button . $input_spamlang->show(in_array($lang_code, $locales_langs) ? $lang_code : ''));
                     $i++;
                 }
                 $table->add('scroller', html::div(array('id' => 'spam-langs-cont'), $lang_table->show()));
                 $out .= html::tag('fieldset', null, html::tag('legend', null, rcmail::Q($this->gettext('langoptions'))) . $data . $table->show());
             }
             break;
             // Header settings
         // Header settings
         case 'headers':
             $data = html::p(null, rcmail::Q($this->gettext('headersexp')));
             $table = new html_table(array('class' => 'headersprefstable', 'cols' => 3));
             if (!isset($no_override['fold_headers'])) {
                 $help_button = html::img(array('class' => $imgclass, 'src' => $attrib['helpicon'], 'alt' => $this->gettext('sieveruleheaders'), 'border' => 0, 'style' => 'margin-left: 4px;'));
                 $help_button = html::a(array('name' => '_headerhlp', 'href' => "#", 'onclick' => 'return ' . rcmail_output::JS_OBJECT_NAME . '.sauserprefs_help("fold_help");', 'title' => $this->gettext('help')), $help_button);
                 $field_id = 'rcmfd_spamfoldheaders';
                 $input_spamreport = new html_checkbox(array('name' => '_spamfoldheaders', 'id' => $field_id, 'value' => '1'));
                 $table->add('title', html::label($field_id, rcmail::Q($this->gettext('foldheaders'))));
                 $table->add(null, $input_spamreport->show($this->user_prefs['fold_headers']));
                 $table->add('help', $help_button);
                 $table->set_row_attribs(array('id' => 'fold_help', 'style' => 'display: none;'));
                 $table->add(array('colspan' => '3'), rcmail::Q($this->gettext('foldhelp')));
             }
             if (!isset($no_override['add_header all Level'])) {
                 $help_button = html::img(array('class' => $imgclass, 'src' => $attrib['helpicon'], 'alt' => $this->gettext('sieveruleheaders'), 'border' => 0, 'style' => 'margin-left: 4px;'));
                 $help_button = html::a(array('name' => '_headerhlp', 'href' => "#", 'onclick' => 'return ' . rcmail_output::JS_OBJECT_NAME . '.sauserprefs_help("level_help");', 'title' => $this->gettext('help')), $help_button);
                 if ($this->user_prefs['remove_header all'] != 'Level') {
                     $enabled = "1";
                     $char = $this->user_prefs['add_header all Level'];
                     $char = substr($char, 7, 1);
                 } else {
                     $enabled = "0";
                     $char = "*";
                 }
                 $field_id = 'rcmfd_spamlevelstars';
                 $input_spamreport = new html_checkbox(array('name' => '_spamlevelstars', 'id' => $field_id, 'value' => '1', 'onchange' => rcmail_output::JS_OBJECT_NAME . '.sauserprefs_toggle_level_char(this)'));
                 $table->add('title', html::label($field_id, rcmail::Q($this->gettext('spamlevelstars'))));
                 $table->add(null, $input_spamreport->show($enabled));
                 $table->add('help', $help_button);
                 $table->set_row_attribs(array('id' => 'level_help', 'style' => 'display: none;'));
                 $table->add(array('colspan' => '3'), rcmail::Q($this->gettext('levelhelp')));
                 $field_id = 'rcmfd_spamlevelchar';
                 $input_spamsubject = new html_inputfield(array('name' => '_spamlevelchar', 'id' => $field_id, 'value' => $char, 'style' => 'width:20px;', 'disabled' => $enabled ? 0 : 1));
                 $table->add('title', html::label($field_id, rcmail::Q($this->gettext('spamlevelchar'))));
                 $table->add(null, $input_spamsubject->show());
                 $table->add('help', '&nbsp;');
             }
             $out = html::tag('fieldset', null, html::tag('legend', null, rcmail::Q($this->gettext('mainoptions'))) . $data . $table->show());
             break;
             // Test settings
         // Test settings
         case 'tests':
             $data = html::p(null, rcmail::Q($this->gettext('spamtestssexp')));
             $table = new html_table(array('class' => 'testsprefstable', 'cols' => 3));
             if (!isset($no_override['use_razor1'])) {
                 $help_button = html::img(array('class' => $imgclass, 'src' => $attrib['helpicon'], 'alt' => $this->gettext('sieveruleheaders'), 'border' => 0, 'style' => 'margin-left: 4px;'));
                 $help_button = html::a(array('name' => '_headerhlp', 'href' => "#", 'onclick' => 'return ' . rcmail_output::JS_OBJECT_NAME . '.sauserprefs_help("raz1_help");', 'title' => $this->gettext('help')), $help_button);
                 $field_id = 'rcmfd_spamuserazor1';
                 $input_spamtest = new html_checkbox(array('name' => '_spamuserazor1', 'id' => $field_id, 'value' => '1'));
                 $table->add('title', html::label($field_id, rcmail::Q($this->gettext('userazor1'))));
                 $table->add(null, $input_spamtest->show($this->user_prefs['use_razor1']));
                 $table->add('help', $help_button);
                 $table->set_row_attribs(array('id' => 'raz1_help', 'style' => 'display: none;'));
                 $table->add(array('colspan' => '3'), rcmail::Q($this->gettext('raz1help')));
             }
             if (!isset($no_override['use_razor2'])) {
                 $help_button = html::img(array('class' => $imgclass, 'src' => $attrib['helpicon'], 'alt' => $this->gettext('sieveruleheaders'), 'border' => 0, 'style' => 'margin-left: 4px;'));
                 $help_button = html::a(array('name' => '_headerhlp', 'href' => "#", 'onclick' => 'return ' . rcmail_output::JS_OBJECT_NAME . '.sauserprefs_help("raz2_help");', 'title' => $this->gettext('help')), $help_button);
                 $field_id = 'rcmfd_spamuserazor2';
                 $input_spamtest = new html_checkbox(array('name' => '_spamuserazor2', 'id' => $field_id, 'value' => '1'));
                 $table->add('title', html::label($field_id, rcmail::Q($this->gettext('userazor2'))));
                 $table->add(null, $input_spamtest->show($this->user_prefs['use_razor2']));
                 $table->add('help', $help_button);
                 $table->set_row_attribs(array('id' => 'raz2_help', 'style' => 'display: none;'));
                 $table->add(array('colspan' => '3'), rcmail::Q($this->gettext('raz2help')));
             }
             if (!isset($no_override['use_pyzor'])) {
                 $help_button = html::img(array('class' => $imgclass, 'src' => $attrib['helpicon'], 'alt' => $this->gettext('sieveruleheaders'), 'border' => 0, 'style' => 'margin-left: 4px;'));
                 $help_button = html::a(array('name' => '_headerhlp', 'href' => "#", 'onclick' => 'return ' . rcmail_output::JS_OBJECT_NAME . '.sauserprefs_help("pyz_help");', 'title' => $this->gettext('help')), $help_button);
                 $field_id = 'rcmfd_spamusepyzor';
                 $input_spamtest = new html_checkbox(array('name' => '_spamusepyzor', 'id' => $field_id, 'value' => '1'));
                 $table->add('title', html::label($field_id, rcmail::Q($this->gettext('usepyzor'))));
                 $table->add(null, $input_spamtest->show($this->user_prefs['use_pyzor']));
                 $table->add('help', $help_button);
                 $table->set_row_attribs(array('id' => 'pyz_help', 'style' => 'display: none;'));
                 $table->add(array('colspan' => '3'), rcmail::Q($this->gettext('pyzhelp')));
             }
             if (!isset($no_override['use_dcc'])) {
                 $help_button = html::img(array('class' => $imgclass, 'src' => $attrib['helpicon'], 'alt' => $this->gettext('sieveruleheaders'), 'border' => 0, 'style' => 'margin-left: 4px;'));
                 $help_button = html::a(array('name' => '_headerhlp', 'href' => "#", 'onclick' => 'return ' . rcmail_output::JS_OBJECT_NAME . '.sauserprefs_help("dcc_help");', 'title' => $this->gettext('help')), $help_button);
                 $field_id = 'rcmfd_spamusedcc';
                 $input_spamtest = new html_checkbox(array('name' => '_spamusedcc', 'id' => $field_id, 'value' => '1'));
                 $table->add('title', html::label($field_id, rcmail::Q($this->gettext('usedcc'))));
                 $table->add(null, $input_spamtest->show($this->user_prefs['use_dcc']));
                 $table->add('help', $help_button);
                 $table->set_row_attribs(array('id' => 'dcc_help', 'style' => 'display: none;'));
                 $table->add(array('colspan' => '3'), rcmail::Q($this->gettext('dcchelp')));
             }
             if (!isset($no_override['skip_rbl_checks'])) {
                 $help_button = html::img(array('class' => $imgclass, 'src' => $attrib['helpicon'], 'alt' => $this->gettext('sieveruleheaders'), 'border' => 0, 'style' => 'margin-left: 4px;'));
                 $help_button = html::a(array('name' => '_headerhlp', 'href' => "#", 'onclick' => 'return ' . rcmail_output::JS_OBJECT_NAME . '.sauserprefs_help("rbl_help");', 'title' => $this->gettext('help')), $help_button);
                 $field_id = 'rcmfd_spamskiprblchecks';
                 $enabled = $this->user_prefs['skip_rbl_checks'] == "1" ? "0" : "1";
                 $input_spamtest = new html_checkbox(array('name' => '_spamskiprblchecks', 'id' => $field_id, 'value' => '1'));
                 $table->add('title', html::label($field_id, rcmail::Q($this->gettext('skiprblchecks'))));
                 $table->add(null, $input_spamtest->show($enabled));
                 $table->add('help', $help_button);
                 $table->set_row_attribs(array('id' => 'rbl_help', 'style' => 'display: none;'));
                 $table->add(array('colspan' => '3'), rcmail::Q($this->gettext('rblhelp')));
             }
             $out = html::tag('fieldset', null, html::tag('legend', null, rcmail::Q($this->gettext('mainoptions'))) . $data . $table->show());
             break;
             // Bayes settings
         // Bayes settings
         case 'bayes':
             $data = html::p(null, rcmail::Q($this->gettext('bayeshelp')));
             $table = new html_table(array('class' => 'bayesprefstable', 'cols' => 3));
             if (!isset($no_override['use_bayes'])) {
                 $help_button = html::img(array('class' => $imgclass, 'src' => $attrib['helpicon'], 'alt' => $this->gettext('sieveruleheaders'), 'border' => 0, 'style' => 'margin-left: 4px;'));
                 $help_button = html::a(array('name' => '_headerhlp', 'href' => "#", 'onclick' => 'return ' . rcmail_output::JS_OBJECT_NAME . '.sauserprefs_help("bayes_help");', 'title' => $this->gettext('help')), $help_button);
                 $field_id = 'rcmfd_spamusebayes';
                 $input_spamtest = new html_checkbox(array('name' => '_spamusebayes', 'id' => $field_id, 'value' => '1', 'onchange' => rcmail_output::JS_OBJECT_NAME . '.sauserprefs_toggle_bayes(this)'));
                 if ($rcmail->config->get('sauserprefs_bayes_delete', false)) {
                     $delete_link = "&nbsp;&nbsp;&nbsp;" . html::span(array('id' => 'listcontrols'), $this->api->output->button(array('command' => 'plugin.sauserprefs.purge_bayes', 'type' => 'link', 'label' => 'sauserprefs.purgebayes', 'title' => 'sauserprefs.purgebayesexp')));
                 }
                 $table->add('title', html::label($field_id, rcmail::Q($this->gettext('usebayes'))));
                 $table->add(null, $input_spamtest->show($this->user_prefs['use_bayes']) . $delete_link);
                 $table->add('help', '&nbsp;');
                 $table->set_row_attribs(array('id' => 'bayes_help', 'style' => 'display: none;'));
                 $table->add(array('colspan' => '3'), rcmail::Q($this->gettext('bayeshelp')));
             }
             if (!isset($no_override['use_bayes_rules'])) {
                 $help_button = html::img(array('class' => $imgclass, 'src' => $attrib['helpicon'], 'alt' => $this->gettext('sieveruleheaders'), 'border' => 0, 'style' => 'margin-left: 4px;'));
                 $help_button = html::a(array('name' => '_headerhlp', 'href' => "#", 'onclick' => 'return ' . rcmail_output::JS_OBJECT_NAME . '.sauserprefs_help("bayesrules_help");', 'title' => $this->gettext('help')), $help_button);
                 $field_id = 'rcmfd_spambayesrules';
                 $input_spamtest = new html_checkbox(array('name' => '_spambayesrules', 'id' => $field_id, 'value' => '1', 'disabled' => $this->user_prefs['use_bayes'] ? 0 : 1));
                 $table->add('title', html::label($field_id, rcmail::Q($this->gettext('bayesrules'))));
                 $table->add(null, $input_spamtest->show($this->user_prefs['use_bayes_rules']));
                 $table->add('help', $help_button);
                 $table->set_row_attribs(array('id' => 'bayesrules_help', 'style' => 'display: none;'));
                 $table->add(array('colspan' => '3'), rcmail::Q($this->gettext('bayesruleshlp')));
             }
             if (!isset($no_override['bayes_auto_learn'])) {
                 $help_button = html::img(array('class' => $imgclass, 'src' => $attrib['helpicon'], 'alt' => $this->gettext('sieveruleheaders'), 'border' => 0, 'style' => 'margin-left: 4px;'));
                 $help_button = html::a(array('name' => '_headerhlp', 'href' => "#", 'onclick' => 'return ' . rcmail_output::JS_OBJECT_NAME . '.sauserprefs_help("bayesauto_help");', 'title' => $this->gettext('help')), $help_button);
                 $field_id = 'rcmfd_spambayesautolearn';
                 $input_spamtest = new html_checkbox(array('name' => '_spambayesautolearn', 'id' => $field_id, 'value' => '1', 'onchange' => rcmail_output::JS_OBJECT_NAME . '.sauserprefs_toggle_bayes_auto(this)', 'disabled' => $this->user_prefs['use_bayes'] ? 0 : 1));
                 $table->add('title', html::label($field_id, rcmail::Q($this->gettext('bayesautolearn'))));
                 $table->add(null, $input_spamtest->show($this->user_prefs['bayes_auto_learn']));
                 $table->add('help', $help_button);
                 $table->set_row_attribs(array('id' => 'bayesauto_help', 'style' => 'display: none;'));
                 $table->add(array('colspan' => '3'), rcmail::Q($this->gettext('bayesautohelp')));
             }
             if ($table->size() > 0) {
                 $out = html::tag('fieldset', null, html::tag('legend', null, rcmail::Q($this->gettext('mainoptions'))) . $table->show());
             }
             $table = new html_table(array('class' => 'bayesprefstable', 'cols' => 2));
             $data = "";
             if (!isset($no_override['bayes_auto_learn_threshold_nonspam'])) {
                 $field_id = 'rcmfd_bayesnonspam';
                 $input_bayesnthres = new html_select(array('name' => '_bayesnonspam', 'id' => $field_id, 'disabled' => !$this->user_prefs['bayes_auto_learn'] || !$this->user_prefs['use_bayes'] ? 1 : 0));
                 $input_bayesnthres->add($this->gettext('defaultscore'), '');
                 $decPlaces = 1;
                 //if ($rcmail->config->get('sauserprefs_score_inc') - (int)$rcmail->config->get('sauserprefs_score_inc') > 0)
                 //	$decPlaces = strlen($rcmail->config->get('sauserprefs_score_inc') - (int)$rcmail->config->get('sauserprefs_score_inc')) - 2;
                 $score_found = false;
                 for ($i = -1; $i <= 1; $i = $i + 0.1) {
                     $input_bayesnthres->add(number_format($i, $decPlaces, $locale_info['decimal_point'], ''), number_format($i, $decPlaces, '.', ''));
                     if (!$score_found && $this->user_prefs['bayes_auto_learn_threshold_nonspam'] && (double) $this->user_prefs['bayes_auto_learn_threshold_nonspam'] == (double) $i) {
                         $score_found = true;
                     }
                 }
                 if (!$score_found && $this->user_prefs['bayes_auto_learn_threshold_nonspam']) {
                     $input_bayesnthres->add(str_replace('%s', $this->user_prefs['bayes_auto_learn_threshold_nonspam'], $this->gettext('otherscore')), (double) $this->user_prefs['bayes_auto_learn_threshold_nonspam']);
                 }
                 $table->add('title', html::label($field_id, rcmail::Q($this->gettext('bayesnonspam'))));
                 $table->add(null, $input_bayesnthres->show(number_format($this->user_prefs['bayes_auto_learn_threshold_nonspam'], $decPlaces, '.', '')));
                 $table->add(array('colspan' => '2'), rcmail::Q($this->gettext('bayesnonspamexp')));
             }
             if (!isset($no_override['bayes_auto_learn_threshold_spam'])) {
                 $field_id = 'rcmfd_bayesspam';
                 $input_bayesthres = new html_select(array('name' => '_bayesspam', 'id' => $field_id, 'disabled' => !$this->user_prefs['bayes_auto_learn'] || !$this->user_prefs['use_bayes'] ? 1 : 0));
                 $input_bayesthres->add($this->gettext('defaultscore'), '');
                 $decPlaces = 0;
                 if ($rcmail->config->get('sauserprefs_score_inc') - (int) $rcmail->config->get('sauserprefs_score_inc') > 0) {
                     $decPlaces = strlen($rcmail->config->get('sauserprefs_score_inc') - (int) $rcmail->config->get('sauserprefs_score_inc')) - 2;
                 }
                 $score_found = false;
                 for ($i = 1; $i <= 20; $i = $i + $rcmail->config->get('sauserprefs_score_inc')) {
                     $input_bayesthres->add(number_format($i, $decPlaces, $locale_info['decimal_point'], ''), number_format($i, $decPlaces, '.', ''));
                     if (!$score_found && $this->user_prefs['bayes_auto_learn_threshold_spam'] && (double) $this->user_prefs['bayes_auto_learn_threshold_spam'] == (double) $i) {
                         $score_found = true;
                     }
                 }
                 if (!$score_found && $this->user_prefs['required_hits']) {
                     $input_bayesthres->add(str_replace('%s', $this->user_prefs['bayes_auto_learn_threshold_spam'], $this->gettext('otherscore')), (double) $this->user_prefs['bayes_auto_learn_threshold_spam']);
                 }
                 $table->add('title', html::label($field_id, rcmail::Q($this->gettext('bayesspam'))));
                 $table->add(null, $input_bayesthres->show(number_format($this->user_prefs['bayes_auto_learn_threshold_spam'], $decPlaces, '.', '')));
                 $table->add(array('colspan' => '2'), rcmail::Q($this->gettext('bayesspamexp')));
             }
             if ($table->size() > 0) {
                 $out .= html::tag('fieldset', null, html::tag('legend', null, rcmail::Q($this->gettext('bayesautooptions'))) . $table->show());
             }
             break;
             // Report settings
         // Report settings
         case 'report':
             $data = html::p(null, rcmail::Q($this->gettext('spamreport')));
             $table = new html_table(array('class' => 'reportprefstable', 'cols' => 2));
             if (!isset($no_override['report_safe'])) {
                 $field_id = 'rcmfd_spamreport';
                 $input_spamreport0 = new html_radiobutton(array('name' => '_spamreport', 'id' => $field_id . '_0', 'value' => '0'));
                 $table->add('title', html::label($field_id . '_0', rcmail::Q($this->gettext('spamreport0'))));
                 $table->add(null, $input_spamreport0->show($this->user_prefs['report_safe']));
                 $input_spamreport1 = new html_radiobutton(array('name' => '_spamreport', 'id' => $field_id . '_1', 'value' => '1'));
                 $table->add('title', html::label($field_id . '_1', rcmail::Q($this->gettext('spamreport1'))));
                 $table->add(null, $input_spamreport1->show($this->user_prefs['report_safe']));
                 $data .= $input_spamreport1->show($this->user_prefs['report_safe']) . "&nbsp;" . html::label($field_id . '_1', rcmail::Q($this->gettext('spamreport1'))) . "<br />";
                 $input_spamreport2 = new html_radiobutton(array('name' => '_spamreport', 'id' => $field_id . '_2', 'value' => '2'));
                 $table->add('title', html::label($field_id . '_2', rcmail::Q($this->gettext('spamreport2'))));
                 $table->add(null, $input_spamreport2->show($this->user_prefs['report_safe']));
             }
             $out = html::tag('fieldset', null, html::tag('legend', null, rcmail::Q($this->gettext('mainoptions'))) . $table->show());
             break;
             // Address settings
         // Address settings
         case 'addresses':
             $data = html::p(null, rcmail::Q($this->gettext('whitelistexp')));
             if ($rcmail->config->get('sauserprefs_whitelist_sync')) {
                 $data .= rcmail::Q($this->gettext('autowhitelist')) . "<br /><br />";
             }
             $table = new html_table(array('class' => 'addressprefstable', 'cols' => 4));
             $field_id = 'rcmfd_spamaddressrule';
             $input_spamaddressrule = new html_select(array('name' => '_spamaddressrule', 'id' => $field_id));
             $input_spamaddressrule->add($this->gettext('whitelist_from'), 'whitelist_from');
             $input_spamaddressrule->add($this->gettext('blacklist_from'), 'blacklist_from');
             $input_spamaddressrule->add($this->gettext('whitelist_to'), 'whitelist_to');
             $field_id = 'rcmfd_spamaddress';
             $input_spamaddress = new html_inputfield(array('name' => '_spamaddress', 'id' => $field_id, 'style' => 'width:200px;'));
             $field_id = 'rcmbtn_add_address';
             $button_addaddress = $this->api->output->button(array('command' => 'plugin.sauserprefs.addressrule_add', 'type' => 'input', 'class' => 'button', 'label' => 'sauserprefs.addrule'));
             $table->add('ruletype', $input_spamaddressrule->show());
             $table->add('address', $input_spamaddress->show());
             $table->add('action', $button_addaddress);
             $table->add(null, "&nbsp;");
             $import = $this->api->output->button(array('command' => 'plugin.sauserprefs.import_whitelist', 'type' => 'link', 'label' => 'import', 'title' => 'sauserprefs.importfromaddressbook'));
             $delete_all = $this->api->output->button(array('command' => 'plugin.sauserprefs.whitelist_delete_all', 'type' => 'link', 'label' => 'sauserprefs.deleteall'));
             $table->add(array('colspan' => 4, 'id' => 'listcontrols'), $import . "&nbsp;&nbsp;" . $delete_all);
             $address_table = new html_table(array('id' => 'address-rules-table', 'class' => 'records-table', 'cellspacing' => '0', 'cols' => 3));
             $address_table->add_header('rule', $this->gettext('rule'));
             $address_table->add_header('email', $this->gettext('email'));
             $address_table->add_header('control', '&nbsp;');
             $this->_address_row($address_table, null, null, $attrib);
             if (sizeof($this->user_prefs['addresses']) > 0) {
                 $norules = 'display: none;';
             }
             $address_table->set_row_attribs(array('style' => $norules));
             $address_table->add(array('colspan' => '3'), rcube_utils::rep_specialchars_output($this->gettext('noaddressrules')));
             $this->api->output->set_env('address_rule_count', sizeof($this->user_prefs['addresses']));
             foreach ($this->user_prefs['addresses'] as $address) {
                 $this->_address_row($address_table, $address['field'], $address['value'], $attrib);
             }
             $table->add(array('colspan' => 4, 'class' => 'scroller'), html::div(array('id' => 'address-rules-cont'), $address_table->show()));
             if ($table->size()) {
                 $out = html::tag('fieldset', null, html::tag('legend', null, rcmail::Q($this->gettext('mainoptions'))) . $data . $table->show());
             }
             break;
         default:
             $out = '';
     }
     return $out;
 }
 /**
  * Generate the form for event attachments upload
  */
 function attachments_form($attrib = array())
 {
     // add ID if not given
     if (!$attrib['id']) {
         $attrib['id'] = 'rcmtaskuploadform';
     }
     // Get max filesize, enable upload progress bar
     $max_filesize = rcube_upload_init();
     $button = new html_inputfield(array('type' => 'button'));
     $input = new html_inputfield(array('type' => 'file', 'name' => '_attachments[]', 'multiple' => 'multiple', 'size' => $attrib['attachmentfieldsize']));
     return html::div($attrib, html::div(null, $input->show()) . html::div('formbuttons', $button->show(rcube_label('upload'), array('class' => 'button mainaction', 'onclick' => JS_OBJECT_NAME . ".upload_file(this.form)"))) . html::div('hint', rcube_label(array('name' => 'maxuploadsize', 'vars' => array('size' => $max_filesize)))));
 }
Beispiel #24
0
 function compose_menu($p)
 {
     $menu = new html_table(array('cols' => 2));
     $chbox = new html_checkbox(array('value' => 1));
     $menu->add(null, html::label(array('for' => 'enigmadefaultopt'), rcube::Q($this->enigma->gettext('identdefault'))));
     $menu->add(null, $chbox->show(1, array('name' => '_enigma_default', 'id' => 'enigmadefaultopt')));
     $menu->add(null, html::label(array('for' => 'enigmasignopt'), rcube::Q($this->enigma->gettext('signmsg'))));
     $menu->add(null, $chbox->show(1, array('name' => '_enigma_sign', 'id' => 'enigmasignopt')));
     $menu->add(null, html::label(array('for' => 'enigmacryptopt'), rcube::Q($this->enigma->gettext('encryptmsg'))));
     $menu->add(null, $chbox->show(1, array('name' => '_enigma_crypt', 'id' => 'enigmacryptopt')));
     $menu = html::div(array('id' => 'enigmamenu', 'class' => 'popupmenu'), $menu->show());
     $p['content'] = preg_replace('/(<form name="form"[^>]+>)/i', '\\1' . "\n{$menu}", $p['content']);
     return $p;
 }
Beispiel #25
0
    // 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 {
Beispiel #26
0
 /**
  * Handler for message_body_prefix hook.
  * Called for every displayed (content) part of the message.
  * Adds infobox about signature verification and/or decryption
  * status above the body.
  *
  * @param array Original parameters
  *
  * @return array Modified parameters
  */
 function status_message($p)
 {
     // skip: not a message part
     if ($p['part'] instanceof rcube_message) {
         return $p;
     }
     // skip: message has no signed/encoded content
     if (!$this->enigma->engine) {
         return $p;
     }
     $engine = $this->enigma->engine;
     $part_id = $p['part']->mime_id;
     $messages = array();
     // Decryption status
     if (($found = $this->find_part_id($part_id, $engine->decryptions)) !== null && ($status = $engine->decryptions[$found])) {
         $attach_scripts = true;
         // show the message only once
         unset($engine->decryptions[$found]);
         // display status info
         $attrib['id'] = 'enigma-message';
         if ($status instanceof enigma_error) {
             $attrib['class'] = 'enigmaerror';
             $code = $status->getCode();
             if ($code == enigma_error::KEYNOTFOUND) {
                 $msg = rcube::Q(str_replace('$keyid', enigma_key::format_id($status->getData('id')), $this->enigma->gettext('decryptnokey')));
             } else {
                 if ($code == enigma_error::BADPASS) {
                     $missing = $status->getData('missing');
                     $label = 'decrypt' . (!empty($missing) ? 'no' : 'bad') . 'pass';
                     $msg = rcube::Q($this->enigma->gettext($label));
                     $this->password_prompt($status);
                 } else {
                     $msg = rcube::Q($this->enigma->gettext('decrypterror'));
                 }
             }
         } else {
             if ($status === enigma_engine::ENCRYPTED_PARTIALLY) {
                 $attrib['class'] = 'enigmawarning';
                 $msg = rcube::Q($this->enigma->gettext('decryptpartial'));
             } else {
                 $attrib['class'] = 'enigmanotice';
                 $msg = rcube::Q($this->enigma->gettext('decryptok'));
             }
         }
         $attrib['msg'] = $msg;
         $messages[] = $attrib;
     }
     // Signature verification status
     if (($found = $this->find_part_id($part_id, $engine->signatures)) !== null && ($sig = $engine->signatures[$found])) {
         $attach_scripts = true;
         // show the message only once
         unset($engine->signatures[$found]);
         // display status info
         $attrib['id'] = 'enigma-message';
         if ($sig instanceof enigma_signature) {
             $sender = ($sig->name ? $sig->name . ' ' : '') . '<' . $sig->email . '>';
             if ($sig->valid === enigma_error::UNVERIFIED) {
                 $attrib['class'] = 'enigmawarning';
                 $msg = str_replace('$sender', $sender, $this->enigma->gettext('sigunverified'));
                 $msg = str_replace('$keyid', $sig->id, $msg);
                 $msg = rcube::Q($msg);
             } else {
                 if ($sig->valid) {
                     $attrib['class'] = $sig->partial ? 'enigmawarning' : 'enigmanotice';
                     $label = 'sigvalid' . ($sig->partial ? 'partial' : '');
                     $msg = rcube::Q(str_replace('$sender', $sender, $this->enigma->gettext($label)));
                 } else {
                     $attrib['class'] = 'enigmawarning';
                     $msg = rcube::Q(str_replace('$sender', $sender, $this->enigma->gettext('siginvalid')));
                 }
             }
         } else {
             if ($sig && $sig->getCode() == enigma_error::KEYNOTFOUND) {
                 $attrib['class'] = 'enigmawarning';
                 $msg = rcube::Q(str_replace('$keyid', enigma_key::format_id($sig->getData('id')), $this->enigma->gettext('signokey')));
             } else {
                 $attrib['class'] = 'enigmaerror';
                 $msg = rcube::Q($this->enigma->gettext('sigerror'));
             }
         }
         /*
                     $msg .= '&nbsp;' . html::a(array('href' => "#sigdetails",
                         'onclick' => rcmail_output::JS_OBJECT_NAME.".command('enigma-sig-details')"),
                         rcube::Q($this->enigma->gettext('showdetails')));
         */
         // test
         //            $msg .= '<br /><pre>'.$sig->body.'</pre>';
         $attrib['msg'] = $msg;
         $messages[] = $attrib;
     }
     if ($count = count($messages)) {
         if ($count == 2 && $messages[0]['class'] == $messages[1]['class']) {
             $p['prefix'] .= html::div($messages[0], $messages[0]['msg'] . ' ' . $messages[1]['msg']);
         } else {
             foreach ($messages as $msg) {
                 $p['prefix'] .= html::div($msg, $msg['msg']);
             }
         }
     }
     if ($attach_scripts) {
         // add css and js script
         $this->add_css();
         $this->add_js();
     }
     return $p;
 }
 /**
  * Builder for GUI object 'message'
  *
  * @param array Named tag parameters
  * @return string HTML code for the gui object
  */
 protected function message_container($attrib)
 {
     if (isset($attrib['id']) === false) {
         $attrib['id'] = 'rcmMessageContainer';
     }
     $this->add_gui_object('message', $attrib['id']);
     return html::div($attrib, '');
 }
Beispiel #28
0
 function render_box($p)
 {
     $this->add_texts('localization');
     $rcmail = rcmail::get_instance();
     if (!$attrib['id']) {
         $attrib['id'] = 'bounce-box';
         $attrib['class'] = 'popupmenu';
     }
     $button = new html_inputfield(array('type' => 'button'));
     $submit = new html_inputfield(array('type' => 'submit'));
     $table = new html_table(array('cols' => 2, 'id' => 'form'));
     $table->add('title', html::label('_to', Q(rcube_label('to'))));
     $table->add('editfield', html::tag('textarea', array('spellcheck' => 'false', 'id' => '_to', 'name' => '_to', 'cols' => '50', 'rows' => '2', 'tabindex' => '2', 'class' => 'editfield', 'onclick' => 'select_field(this)')));
     $table->set_row_attribs(array('id' => 'compose-cc'));
     $table->add('title', html::a(array('href' => '#cc', 'onclick' => 'return rcmail_ui.hide_header_form(\'cc\')'), html::img(array('src' => $rcmail->config->get('skin_path') . '/images/icons/minus.gif', 'title' => rcube_label('delete'), 'alt' => rcube_label('delete')))) . '&nbsp;' . html::label('_cc', Q(rcube_label('cc'))));
     $table->add(null, html::tag('textarea', array('spellcheck' => 'false', 'id' => '_cc', 'name' => '_cc', 'cols' => '50', 'rows' => '2', 'value' => '', 'class' => 'editfield', 'onclick' => 'select_field(this)')));
     $table->set_row_attribs(array('id' => 'compose-bcc'));
     $table->add('title', html::a(array('href' => '#bcc', 'onclick' => 'return rcmail_ui.hide_header_form(\'bcc\')'), html::img(array('src' => $rcmail->config->get('skin_path') . '/images/icons/minus.gif', 'title' => rcube_label('delete'), 'alt' => rcube_label('delete')))) . '&nbsp;' . html::label('_bcc', Q(rcube_label('bcc'))));
     $table->add(null, html::tag('textarea', array('spellcheck' => 'false', 'id' => '_bcc', 'cols' => '50', 'name' => '_bcc', 'rows' => '2', 'value' => '', 'class' => 'editfield', 'onclick' => 'select_field(this)')));
     $table->add(null, null);
     $table->add(formlinks, html::a(array('href' => '#cc', 'onclick' => 'return rcmail_ui.show_header_form(\'cc\')', 'id' => 'cc-link'), Q(rcube_label('addcc'))) . '<span class="separator">|</span>' . html::a(array('href' => '#bcc', 'onclick' => 'return rcmail_ui.show_header_form(\'bcc\')', 'id' => 'bcc-link'), Q(rcube_label('addbcc'))));
     $target_url = $_SERVER['REQUEST_URI'];
     $rcmail->output->add_footer(html::div($attrib, $rcmail->output->form_tag(array('name' => 'bounceform', 'method' => 'post', 'action' => './', 'enctype' => 'multipart/form-data'), html::tag('input', array('type' => "hidden", 'name' => '_action', 'value' => 'bounce')) . html::div('bounce-title', Q($this->gettext('bouncemessage'))) . html::div('bounce-body', $table->show() . html::div('buttons', $button->show(rcube_label('close'), array('class' => 'button', 'onclick' => "\$('#{$attrib['id']}').hide()")) . ' ' . $button->show(Q($this->gettext('bounce')), array('class' => 'button mainaction', 'onclick' => JS_OBJECT_NAME . ".command('plugin.bounce.send', this.bounceform)")))))));
     $rcmail->output->add_label('norecipientwarning');
     $rcmail->output->add_gui_object('bouncebox', $attrib['id']);
     $rcmail->output->add_gui_object('bounceform', 'bounceform');
     $this->include_stylesheet('bounce.css');
     $rcmail->output->set_env('autocomplete_min_length', $rcmail->config->get('autocomplete_min_length'));
     $rcmail->output->add_gui_object('messageform', 'bounceform');
 }
Beispiel #29
0
 function password_form()
 {
     $rcmail = rcmail::get_instance();
     // add some labels to client
     $rcmail->output->add_label('password.nopassword', 'password.nocurpassword', 'password.passwordinconsistency');
     $rcmail->output->set_env('product_name', $rcmail->config->get('product_name'));
     $table = new html_table(array('cols' => 2));
     if ($rcmail->config->get('password_confirm_current')) {
         // show current password selection
         $field_id = 'curpasswd';
         $input_curpasswd = new html_passwordfield(array('name' => '_curpasswd', 'id' => $field_id, 'size' => 20, 'autocomplete' => 'off'));
         $table->add('title', html::label($field_id, rcube::Q($this->gettext('curpasswd'))));
         $table->add(null, $input_curpasswd->show());
     }
     // show new password selection
     $field_id = 'newpasswd';
     $input_newpasswd = new html_passwordfield(array('name' => '_newpasswd', 'id' => $field_id, 'size' => 20, 'autocomplete' => 'off'));
     $table->add('title', html::label($field_id, rcube::Q($this->gettext('newpasswd'))));
     $table->add(null, $input_newpasswd->show());
     // show confirm password selection
     $field_id = 'confpasswd';
     $input_confpasswd = new html_passwordfield(array('name' => '_confpasswd', 'id' => $field_id, 'size' => 20, 'autocomplete' => 'off'));
     $table->add('title', html::label($field_id, rcube::Q($this->gettext('confpasswd'))));
     $table->add(null, $input_confpasswd->show());
     $rules = '';
     $required_length = intval($rcmail->config->get('password_minimum_length'));
     if ($required_length > 0) {
         $rules .= html::tag('li', array('id' => 'required-length'), $this->gettext(array('name' => 'passwordshort', 'vars' => array('length' => $required_length))));
     }
     if ($rcmail->config->get('password_require_nonalpha')) {
         $rules .= html::tag('li', array('id' => 'require-nonalpha'), $this->gettext('passwordweak'));
     }
     if (!empty($rules)) {
         $rules = html::tag('ul', array('id' => 'ruleslist'), $rules);
     }
     $out = html::div(array('class' => 'box'), html::div(array('id' => 'prefs-title', 'class' => 'boxtitle'), $this->gettext('changepasswd')) . html::div(array('class' => 'boxcontent'), $table->show() . $rules . html::p(null, $rcmail->output->button(array('command' => 'plugin.password-save', 'type' => 'input', 'class' => 'button mainaction', 'label' => 'save')))));
     $rcmail->output->add_gui_object('passform', 'password-form');
     return $rcmail->output->form_tag(array('id' => 'password-form', 'name' => 'password-form', 'method' => 'post', 'action' => './?_task=settings&_action=plugin.password-save'), $out);
 }
 protected function render_single_select(single_select $select)
 {
     $select = clone $select;
     if (empty($select->formid)) {
         $select->formid = html_writer::random_id('single_select_f');
     }
     $params = $select->url->params();
     if ($select->method === 'post') {
         $params['sesskey'] = sesskey();
     }
     $output = html::hidden_inputs($params);
     if (empty($select->attributes['id'])) {
         $select->attributes['id'] = html_writer::random_id('single_select');
     }
     if ($select->disabled) {
         $select->attributes['disabled'] = 'disabled';
     }
     if ($select->tooltip) {
         $select->attributes['title'] = $select->tooltip;
     }
     if ($select->label) {
         $attributes = $select->labelattributes;
         $attributes['for'] = $select->attributes['id'];
         $output .= html::label($attributes, $select->label);
     }
     if ($select->helpicon instanceof help_icon) {
         $output .= $this->render($select->helpicon);
     } else {
         if ($select->helpicon instanceof old_help_icon) {
             $output .= $this->render($select->helpicon);
         }
     }
     $output .= html_writer::select($select->options, $select->name, $select->selected, $select->nothing, $select->attributes);
     $go = html::submit(get_string('go'));
     $output .= '<noscript>' . html::div(array('style' => 'inline'), $go) . '</noscript>';
     $nothing = empty($select->nothing) ? false : key($select->nothing);
     $this->page->requires->js_init_call('M.util.init_select_autosubmit', array($select->formid, $select->attributes['id'], $nothing));
     $output = html::div($output);
     if ($select->method === 'get') {
         $url = $select->url->out_omit_querystring(true);
         // url without params, the anchor part allowed
     } else {
         $url = $select->url->out_omit_querystring();
         // url without params, the anchor part not allowed
     }
     $form_attributes = array('method' => $select->method, 'class' => 'form-inline', 'action' => $url, 'id' => $select->formid);
     $output = html::form($form_attributes, $output);
     return html::div($select->class, $output);
 }