function gen_form() { list($form_start, $form_end) = get_form_tags(null, 'plugin.changepasswd_AD.save'); // return the complete form as table $out = $form_start; $table = new html_table(array('cols' => 2)); // show old password field $field_id = 'rcmfd_curpwd'; $input_curpasswd = new html_passwordfield(array('name' => '_curpasswd', 'id' => $field_id)); $table->add('title', html::label($field_id, Q($this->gettext('curpasswd')))); $table->add(null, $input_curpasswd->show()); // show new password field $field_id = 'rcmfd_newpwd'; $input_newpasswd = new html_passwordfield(array('name' => '_newpasswd', 'id' => $field_id)); $table->add('title', html::label($field_id, Q($this->gettext('newpasswd')))); $table->add(null, $input_newpasswd->show()); // show new password confirm field $field_id = 'rcmfd_cnfpwd'; $input_confpasswd = new html_passwordfield(array('name' => '_confpasswd', 'id' => $field_id)); $table->add('title', html::label($field_id, Q($this->gettext('confpasswd')))); $table->add(null, $input_confpasswd->show()); $out .= $table->show(); $out .= $form_end; return $out; }
function gen_form($attrib) { $this->api->output->add_label('sauserprefs.spamaddressexists', 'sauserprefs.spamenteraddress', 'sauserprefs.spamaddresserror', 'sauserprefs.spamaddressdelete', 'sauserprefs.spamaddressdeleteall', 'sauserprefs.enabled', 'sauserprefs.disabled', 'sauserprefs.importingaddresses', 'sauserprefs.usedefaultconfirm', 'sauserprefs.purgebayesconfirm', 'sauserprefs.whitelist_from'); // output global prefs as default in env foreach ($this->global_prefs as $key => $val) { $this->api->output->set_env(str_replace(" ", "_", $key), $val); } unset($attrib['form']); list($form_start, $form_end) = get_form_tags($attrib, 'plugin.sauserprefs.save', null, array('name' => '_section', 'value' => $this->cur_section)); $out = $form_start; $out .= $this->_prefs_block($this->cur_section, $attrib); return $out . $form_end; }
function gen_vacation_form($attrib) { // check for sieve error if ($this->sieve_error) { return $this->gettext('pleaseinitialise') . '<br /><br />'; } $rcmail = rcube::get_instance(); $ext = $this->sieve->get_extensions(); // add some labels to client $rcmail->output->add_label('sieverules.baddateformat', 'sieverules.redirectaddresserror', 'sieverules.vactoexp_err', 'sieverules.vacnoperiod', 'sieverules.vacperiodwrongformat', 'sieverules.vacnomsg', 'editorwarning'); $help_icon = html::img(array('src' => $attrib['helpicon'], 'alt' => $this->gettext('sieverules.messagehelp'), 'border' => 0)); // set default field display $display = array('vacadv' => $this->force_vacto ? '' : 'display: none;', 'vacfrom' => $this->show_vacfrom ? $display['vacadv'] : 'display: none;', 'vachandle' => $this->show_vachandle ? $display['vacadv'] : 'display: none;'); $defaults = array('method' => 'vacation', 'disabled' => 1, 'vacto' => null, 'address' => '', 'period' => '', 'periodtype' => '', 'handle' => '', 'subject' => '', 'origsubject' => '', 'msg' => '', 'charset' => RCUBE_CHARSET); // get user identities $this->identities = $rcmail->user->list_identities(); foreach ($this->identities as $sql_id => $sql_arr) { $this->identities[$sql_id]['from'] = $this->_rcmail_get_identity($sql_arr['identity_id']); } $cur_script = $this->script[$this->vacation_rule_position]; // exec sieverules_init hook, allows for edit of default values $coredefaults = array(); $coredefaults['identities'] = $this->identities; list($iid, $cur_script, $ext, $coredefaults) = array_values($rcmail->plugins->exec_hook('sieverules_init', array('id' => 0, 'script' => $cur_script, 'extensions' => $ext, 'defaults' => $coredefaults))); $this->identities = $coredefaults['identities']; if ($cur_script['name'] == $this->vacation_rule_name) { if (sizeof($cur_script['tests']) == 2) { $defaults['limitperiod'] = 1; $defaults['periodfrom'] = $cur_script['tests'][0]['target']; $defaults['periodto'] = $cur_script['tests'][1]['target']; } $action = $cur_script['actions'][0]; $defaults['disabled'] = empty($cur_script['disabled']) ? 0 : $cur_script['disabled']; if (isset($action['seconds'])) { $defaults['period'] = $action['seconds']; $defaults['periodtype'] = 'seconds'; } else { $defaults['period'] = $action['days']; $defaults['periodtype'] = 'days'; } $defaults['vacfromdefault'] = $defaults['vacfrom']; $defaults['vacfrom'] = $action['from']; $defaults['vacto'] = $action['addresses']; $defaults['handle'] = $action['handle']; $defaults['subject'] = $action['subject']; $defaults['origsubject'] = $action['origsubject']; $defaults['msg'] = $action['msg']; $defaults['htmlmsg'] = $action['htmlmsg'] ? '1' : ''; $defaults['charset'] = $action['charset']; if ($defaults['htmlmsg'] == '1' && $rcmail->config->get('htmleditor') == '0') { $h2t = new rcube_html2text($defaults['msg'], false, true, 0); $defaults['msg'] = $h2t->get_text(); $defaults['htmlmsg'] = ''; } elseif ($defaults['htmlmsg'] == '' && $rcmail->config->get('htmleditor') == '1') { $defaults['msg'] = $defaults['msg']; $defaults['msg'] = nl2br($defaults['msg']); $defaults['htmlmsg'] = '1'; } // check advanced enabled if (!empty($defaults['vacfrom']) && $defaults['vacfrom'] != $defaults['vacfromdefault'] || !empty($defaults['vacto']) || !empty($defaults['handle']) || !empty($defaults['period']) || $defaults['charset'] != RCUBE_CHARSET || $this->force_vacto) { $display['vacadv'] = ''; $display['vacfrom'] = $this->show_vacfrom ? '' : 'display: none;'; $display['vachandle'] = $this->show_vachandle ? '' : 'display: none;'; } } list($form_start, $form_end) = get_form_tags(array('id' => 'sievevacation-form') + $attrib, 'plugin.sieverules.save'); $rcmail->output->add_gui_object('sieveform', 'sievevacation-form'); $input_name = new html_hiddenfield(array('name' => '_name', 'value' => $this->vacation_rule_name)); $enable = $input_name->show(); $input_mode = new html_hiddenfield(array('name' => '_vacation_mode', 'value' => 1)); $enable .= $input_mode->show(); $input_id = new html_hiddenfield(array('name' => '_iid', 'value' => $this->vacation_rule_position)); $enable .= $input_id->show(); $field_id = 'rcmfd_sievevac_disabled'; $input_disabled = new html_hiddenfield(array('name' => '_disable', 'id' => $field_id, 'value' => $defaults['disabled'] === 0 ? '' : 1)); $enable .= $input_disabled->show(); $field_id = 'rcmfd_sievevac_join'; $input_join = new html_hiddenfield(array('name' => '_join', 'id' => $field_id, 'value' => $defaults['limitperiod'] == 1 ? 'allof' : 'any')); $enable .= $input_join->show(); $input_id = new html_hiddenfield(array('name' => '_iid', 'value' => $this->vacation_rule_position)); $enable .= $input_id->show(); $field_id = 'rcmfd_sievevac_enabled'; $input_enabled = new html_checkbox(array('name' => '_enabled', 'id' => $field_id, 'value' => '1')); $enable .= $input_enabled->show($defaults['disabled'] === 0 ? 1 : 0); $enable .= " " . html::label($field_id, rcmail::Q($this->gettext('enableautoreply'))); $input_test = new html_hiddenfield(array('name' => '_test[]', 'value' => 'date')); $input_header = new html_hiddenfield(array('name' => '_header[]', 'value' => 'currentdate')); $enable .= $input_test->show() . $input_header->show(); $enable .= $input_test->show() . $input_header->show(); $input_part = new html_hiddenfield(array('name' => '_datepart[]', 'value' => 'date')); $enable .= $input_part->show(); $enable .= $input_part->show(); $input_operator = new html_hiddenfield(array('name' => '_date_operator[]', 'value' => 'value "ge"')); $enable .= $input_operator->show(); $input_operator = new html_hiddenfield(array('name' => '_date_operator[]', 'value' => 'value "le"')); $enable .= $input_operator->show(); $field_id = 'rcmfd_sievevac_period'; $input_period = new html_checkbox(array('name' => '_limit_period', 'id' => $field_id, 'value' => '1')); $enable .= "<br />" . $input_period->show($defaults['limitperiod']); $enable .= " " . html::label($field_id, rcmail::Q($this->gettext('sendonlyperiod'))); $input_period_from = new html_inputfield(array('name' => '_target[]', 'id' => $field_id . '_from', 'disabled' => 'disabled')); $input_period_to = new html_inputfield(array('name' => '_target[]', 'id' => $field_id . '_to', 'disabled' => 'disabled')); $enable .= " " . html::label($field_id . '_from', rcmail::Q($this->gettext('datefrom'))) . $input_period_from->show($defaults['periodfrom']); $enable .= " " . html::label($field_id . '_to', rcmail::Q($this->gettext('dateto'))) . $input_period_to->show($defaults['periodto']); $input_act = new html_hiddenfield(array('name' => '_act[]', 'value' => 'vacation')); $enable .= $input_act->show(); // return the complete form as table $vacs_table = $this->_vacation_table($ext, 0, $defaults, $display, $help_icon); $out = $vacs_table->show($attrib + array('id' => 'actions-table')); $out = html::tag('fieldset', null, html::tag('legend', null, rcmail::Q($this->gettext('mainoptions'))) . $enable . '<br /><br />' . $out); $out = $form_start . $out . $form_end; // output sigs for vacation messages if (count($this->identities)) { foreach ($this->identities as $sql_arr) { // add signature to array if (!empty($sql_arr['signature'])) { $identity_id = $sql_arr['identity_id']; $a_signatures[$identity_id]['text'] = $sql_arr['signature']; if ($sql_arr['html_signature'] == 1) { $h2t = new rcube_html2text($a_signatures[$identity_id]['text'], false, false); $a_signatures[$identity_id]['text'] = trim($h2t->get_text()); } } } $this->api->output->set_env('signatures', $a_signatures); } return $out; }
function gen_form($attrib) { $rcmail = rcube::get_instance(); $this->include_script('jquery.maskedinput.min.js'); $this->api->output->add_label('sieverules.norulename', 'sieverules.ruleexists', 'sieverules.noheader', 'sieverules.headerbadchars', 'sieverules.noheadervalue', 'sieverules.sizewrongformat', 'sieverules.noredirect', 'sieverules.redirectaddresserror', 'sieverules.noreject', 'sieverules.vacnoperiod', 'sieverules.vacperiodwrongformat', 'sieverules.vacnomsg', 'sieverules.vacmsgone', 'sieverules.notifynomethod', 'sieverules.missingfoldername', 'sieverules.notifynomsg', 'sieverules.ruledeleteconfirm', 'sieverules.actiondeleteconfirm', 'sieverules.notifyinvalidmethod', 'sieverules.nobodycontentpart', 'sieverules.badoperator', 'sieverules.baddateformat', 'sieverules.badtimeformat', 'sieverules.vactoexp_err', 'editorwarning', 'sieverules.eheadernoname', 'sieverules.eheadernoval'); $ext = $this->sieve->get_extensions(); // build conditional options if (in_array('regex', $ext) || in_array('relational', $ext) || in_array('subaddress', $ext)) { $this->operators[] = array('text' => 'filteradvoptions', 'value' => 'advoptions', 'ext' => null); } foreach ($ext as $extension) { if (substr($extension, 0, 11) == 'comparator-' && $extension != 'comparator-i;ascii-casemap' && $extension != 'comparator-i;octet') { $this->comparators[] = array('text' => substr($extension, 11), 'value' => substr($extension, 11), 'ext' => null); } } // define standard ops foreach ($this->operators as $option) { $this->standardops[] = $option['value']; } // get user identities $this->identities = $rcmail->user->list_identities(); foreach ($this->identities as $sql_id => $sql_arr) { $this->identities[$sql_id]['from'] = $this->_rcmail_get_identity($sql_arr['identity_id']); } // get user folders if (empty($this->mailboxes)) { $rcmail->storage_init(); // get mailbox list if ($rcmail->config->get('sieverules_fileinto_options', 0) > 0) { $a_folders = $rcmail->storage->list_folders(); } else { $a_folders = $rcmail->storage->list_folders_subscribed(); } $delimiter = $rcmail->storage->get_hierarchy_delimiter(); $this->mailboxes = array(); foreach ($a_folders as $ifolder) { $rcmail->build_folder_tree($this->mailboxes, $ifolder, $delimiter); } if ($rcmail->config->get('sieverules_fileinto_options', 0) == 2 && in_array('mailbox', $ext)) { array_push($this->mailboxes, array('id' => '@@newfolder', 'name' => $this->gettext('createfolder'), 'virtual' => '', 'folders' => array())); } } $iid = rcube_utils::get_input_value('_iid', rcube_utils::INPUT_GPC); if ($iid == '') { $iid = sizeof($this->script); } // get current script if (substr($iid, 0, 2) == 'ex') { $cur_script = $this->examples[substr($iid, 2)]; $this->api->output->set_env('eid', $iid); $iid = sizeof($this->script); $this->api->output->set_env('iid', $iid); $example = true; } else { $cur_script = $this->script[$iid]; $this->api->output->set_env('iid', $iid); $example = false; if (isset($this->script[$iid])) { $this->api->output->add_script("parent." . rcmail_output::JS_OBJECT_NAME . ".sieverules_ready('" . $iid . "');"); } } // exec sieverules_init hook, allows for edit of default values $defaults = array(); foreach (array('headers', 'bodyparts', 'dateparts', 'operators', 'sizeoperators', 'dateoperators', 'spamoperators', 'sizeunits', 'spamprobability', 'virusprobability', 'advoperators', 'comparators', 'flags', 'identities', 'folders') as $default) { $defaults[$default] = $this->{$default}; } list($iid, $cur_script, $ext, $defaults) = array_values($rcmail->plugins->exec_hook('sieverules_init', array('id' => $iid, 'script' => $cur_script, 'extensions' => $ext, 'defaults' => $defaults))); foreach ($defaults as $name => $content) { $this->{$name} = $content; } // build predefined rules and add to UI if (sizeof($rcmail->config->get('sieverules_predefined_rules')) > 0) { $predefined = array(); foreach ($rcmail->config->get('sieverules_predefined_rules') as $idx => $data) { array_push($predefined, array($data['type'], $data['header'], $data['operator'], $data['extra'], $data['target'])); } $this->api->output->set_env('predefined_rules', $predefined); } list($form_start, $form_end) = get_form_tags($attrib, 'plugin.sieverules.save'); $out = $form_start; $hidden_iid = new html_hiddenfield(array('name' => '_iid', 'value' => $iid)); $out .= $hidden_iid->show(); // 'any' flag if (sizeof($cur_script['tests']) == 1 && $cur_script['tests'][0]['type'] == 'true' && !$cur_script['tests'][0]['not']) { $any = true; } // filter name input $field_id = 'rcmfd_name'; $input_name = new html_inputfield(array('name' => '_name', 'id' => $field_id, 'required' => 'required')); $out .= html::label($field_id, rcmail::Q($this->gettext('filtername'))); $out .= " " . $input_name->show($cur_script['name']); // filter disable $field_id = 'rcmfd_disable'; $input_disable = new html_checkbox(array('name' => '_disable', 'id' => $field_id, 'value' => 1)); $out .= html::span('disableLink', html::label($field_id, rcmail::Q($this->gettext('disablerule'))) . " " . $input_disable->show($cur_script['disabled'])); $out .= "<br /><br />"; // add rule join type to UI if (sizeof($cur_script['tests']) == 1 && $cur_script['tests'][0]['type'] == 'true' && !$cur_script['tests'][0]['not']) { $join_any = true; } $field_id = 'rcmfd_join_all'; $input_join = new html_radiobutton(array('name' => '_join', 'id' => $field_id, 'value' => 'allof', 'onclick' => rcmail_output::JS_OBJECT_NAME . '.sieverules_rule_join_radio(\'allof\')')); $join_type = $input_join->show($cur_script['join'] && !$join_any ? 'allof' : ''); $join_type .= " " . html::label($field_id, rcmail::Q($this->gettext('filterallof'))); $field_id = 'rcmfd_join_anyof'; $input_join = new html_radiobutton(array('name' => '_join', 'id' => $field_id, 'value' => 'anyof', 'onclick' => rcmail_output::JS_OBJECT_NAME . '.sieverules_rule_join_radio(\'anyof\')')); $join_type .= " " . $input_join->show($cur_script['join'] && !$join_any ? '' : 'anyof'); $join_type .= " " . html::label($field_id, rcmail::Q($this->gettext('filteranyof'))); $field_id = 'rcmfd_join_any'; $input_join = new html_radiobutton(array('name' => '_join', 'id' => $field_id, 'value' => 'any', 'onclick' => rcmail_output::JS_OBJECT_NAME . '.sieverules_rule_join_radio(\'any\')')); $join_type .= " " . $input_join->show($join_any ? 'any' : ''); $join_type .= " " . html::label($field_id, rcmail::Q($this->gettext('filterany'))); $rules_table = new html_table(array('id' => 'rules-table', 'class' => 'records-table', 'cellspacing' => '0', 'cols' => 5)); $rules_table = $this->_rule_row($ext, $rules_table, null, $rcmail->config->get('sieverules_predefined_rules'), $attrib); // add rules to UI if (!$join_any) { if (!isset($cur_script)) { $rules_table = $this->_rule_row($ext, $rules_table, array(), $rcmail->config->get('sieverules_predefined_rules'), $attrib); } else { foreach ($cur_script['tests'] as $rules) { $rules_table = $this->_rule_row($ext, $rules_table, $rules, $rcmail->config->get('sieverules_predefined_rules'), $attrib); } } } $this->api->output->set_env('sieverules_rules', $rules_table->size()); $out .= html::tag('fieldset', null, html::tag('legend', null, rcmail::Q($this->gettext('messagesrules'))) . rcmail::Q(!$rcmail->config->get('sieverules_use_elsif', true) ? $this->gettext('sieveruleexp_stop') : $this->gettext('sieveruleexp')) . "<br /><br />" . $join_type . "<br /><br />" . $rules_table->show($attrib)); $actions_table = new html_table(array('id' => 'actions-table', 'class' => 'records-table', 'cellspacing' => '0', 'cols' => 3)); $actions_table = $this->_action_row($ext, $actions_table, 'rowid', null, $attrib, $example); // add actions to UI if (!isset($cur_script)) { $actions_table = $this->_action_row($ext, $actions_table, 0, array(), $attrib, $example); } else { foreach ($cur_script['actions'] as $idx => $actions) { $actions_table = $this->_action_row($ext, $actions_table, $idx, $actions, $attrib, $example); } } $this->api->output->set_env('sieverules_actions', $actions_table->size() - 3); $this->api->output->set_env('sieverules_htmleditor', $rcmail->config->get('htmleditor')); $out .= html::tag('fieldset', null, html::tag('legend', null, rcmail::Q($this->gettext('messagesactions'))) . rcmail::Q($this->gettext('sieveactexp')) . "<br /><br />" . $actions_table->show($attrib)); $out .= $form_end; // output sigs for vacation messages if (count($this->identities)) { foreach ($this->identities as $sql_arr) { // add signature to array if (!empty($sql_arr['signature'])) { $identity_id = $sql_arr['identity_id']; $a_signatures[$identity_id]['text'] = $sql_arr['signature']; if ($sql_arr['html_signature'] == 1) { $h2t = new rcube_html2text($a_signatures[$identity_id]['text'], false, false); $a_signatures[$identity_id]['text'] = trim($h2t->get_text()); } } } $this->api->output->set_env('signatures', $a_signatures); } return $out; }
function gen_form($attrib) { $rcmail = rcmail::get_instance(); $this->include_script('jquery.maskedinput.js'); $this->api->output->add_label('sieverules.norulename', 'sieverules.ruleexists', 'sieverules.noheader', 'sieverules.headerbadchars', 'sieverules.noheadervalue', 'sieverules.sizewrongformat', 'sieverules.noredirect', 'sieverules.redirectaddresserror', 'sieverules.noreject', 'sieverules.vacnodays', 'sieverules.vacdayswrongformat', 'sieverules.vacnomsg', 'sieverules.notifynomethod', 'sieverules.missingfoldername', 'sieverules.notifynomsg', 'sieverules.filterdeleteconfirm', 'sieverules.ruledeleteconfirm', 'sieverules.actiondeleteconfirm', 'sieverules.notifyinvalidmethod', 'sieverules.nobodycontentpart', 'sieverules.badoperator', 'sieverules.baddateformat', 'sieverules.badtimeformat', 'sieverules.vactoexp_err', 'editorwarning'); $ext = $this->sieve->get_extensions(); $iid = get_input_value('_iid', RCUBE_INPUT_GPC); if ($iid == '') { $iid = sizeof($this->script); } if (substr($iid, 0, 2) == 'ex') { $cur_script = $this->examples[substr($iid, 2)]; $this->api->output->set_env('eid', $iid); $iid = sizeof($this->script); $this->api->output->set_env('iid', $iid); $example = true; } else { $cur_script = $this->script[$iid]; $this->api->output->set_env('iid', $iid); $example = false; if (isset($this->script[$iid])) { $this->api->output->add_script("if (parent." . JS_OBJECT_NAME . ".sieverules_examples) parent." . JS_OBJECT_NAME . ".sieverules_examples.clear_selection();"); $this->api->output->add_script("parent." . JS_OBJECT_NAME . ".sieverules_list.highlight_row(" . $iid . ");"); } } if (sizeof($rcmail->config->get('sieverules_predefined_rules')) > 0) { $predefined = array(); foreach ($rcmail->config->get('sieverules_predefined_rules') as $idx => $data) { array_push($predefined, array($data['type'], $data['header'], $data['operator'], $data['extra'], $data['target'])); } $this->api->output->set_env('predefined_rules', $predefined); } list($form_start, $form_end) = get_form_tags($attrib, 'plugin.sieverules.save'); $out = $form_start; $hidden_iid = new html_hiddenfield(array('name' => '_iid', 'value' => $iid)); $out .= $hidden_iid->show(); // 'any' flag if (sizeof($cur_script['tests']) == 1 && $cur_script['tests'][0]['type'] == 'true' && !$cur_script['tests'][0]['not']) { $any = true; } // filter disable $field_id = 'rcmfd_disable'; $input_disable = new html_checkbox(array('name' => '_disable', 'id' => $field_id, 'value' => 1)); $out .= html::span('disableLink', html::label($field_id, Q($this->gettext('disablerule'))) . " " . $input_disable->show($cur_script['disabled'])); // filter name input $field_id = 'rcmfd_name'; $input_name = new html_inputfield(array('name' => '_name', 'id' => $field_id)); $out .= html::label($field_id, Q($this->gettext('filtername'))); $out .= " " . $input_name->show($cur_script['name']); $out .= "<br /><br />"; if (sizeof($cur_script['tests']) == 1 && $cur_script['tests'][0]['type'] == 'true' && !$cur_script['tests'][0]['not']) { $join_any = true; } $field_id = 'rcmfd_join_all'; $input_join = new html_radiobutton(array('name' => '_join', 'id' => $field_id, 'value' => 'allof', 'onclick' => JS_OBJECT_NAME . '.sieverules_rule_join_radio(\'allof\')')); $join_type = $input_join->show($cur_script['join'] && !$join_any ? 'allof' : ''); $join_type .= " " . html::label($field_id, Q($this->gettext('filterallof'))); $field_id = 'rcmfd_join_anyof'; $input_join = new html_radiobutton(array('name' => '_join', 'id' => $field_id, 'value' => 'anyof', 'onclick' => JS_OBJECT_NAME . '.sieverules_rule_join_radio(\'anyof\')')); $join_type .= " " . $input_join->show($cur_script['join'] && !$join_any ? '' : 'anyof'); $join_type .= " " . html::label($field_id, Q($this->gettext('filteranyof'))); $field_id = 'rcmfd_join_any'; $input_join = new html_radiobutton(array('name' => '_join', 'id' => $field_id, 'value' => 'any', 'onclick' => JS_OBJECT_NAME . '.sieverules_rule_join_radio(\'any\')')); $join_type .= " " . $input_join->show($join_any ? 'any' : ''); $join_type .= " " . html::label($field_id, Q($this->gettext('filterany'))); $rules_table = new html_table(array('id' => 'rules-table', 'class' => 'records-table', 'cellspacing' => '0', 'cols' => 5)); $rules_table = $this->_rule_row($ext, $rules_table, null, $rcmail->config->get('sieverules_predefined_rules'), $attrib); if (!$join_any) { if (!isset($cur_script)) { $rules_table = $this->_rule_row($ext, $rules_table, array(), $rcmail->config->get('sieverules_predefined_rules'), $attrib); } else { foreach ($cur_script['tests'] as $rules) { $rules_table = $this->_rule_row($ext, $rules_table, $rules, $rcmail->config->get('sieverules_predefined_rules'), $attrib); } } } $this->api->output->set_env('sieverules_rules', $rules_table->size()); $out .= html::tag('fieldset', null, html::tag('legend', null, Q($this->gettext('messagesrules'))) . Q(!$rcmail->config->get('sieverules_use_elsif', true) ? $this->gettext('sieveruleexp_stop') : $this->gettext('sieveruleexp')) . "<br /><br />" . $join_type . "<br /><br />" . $rules_table->show($attrib)); $rcmail->imap_connect(); $actions_table = new html_table(array('id' => 'actions-table', 'class' => 'records-table', 'cellspacing' => '0', 'cols' => 3)); $actions_table = $this->_action_row($ext, $actions_table, 'rowid', null, $attrib, $example); if (!isset($cur_script)) { $actions_table = $this->_action_row($ext, $actions_table, 0, array(), $attrib, $example); } else { foreach ($cur_script['actions'] as $idx => $actions) { $actions_table = $this->_action_row($ext, $actions_table, $idx, $actions, $attrib, $example); } } $this->api->output->set_env('sieverules_actions', $actions_table->size()); $out .= html::tag('fieldset', null, html::tag('legend', null, Q($this->gettext('messagesactions'))) . Q($this->gettext('sieveactexp')) . "<br /><br />" . $actions_table->show($attrib)); $out .= $form_end; // output sigs for vacation messages $user_identities = $rcmail->user->list_identities(); if (count($user_identities)) { foreach ($user_identities as $sql_arr) { // add signature to array if (!empty($sql_arr['signature'])) { $identity_id = $sql_arr['identity_id']; $a_signatures[$identity_id]['text'] = $sql_arr['signature']; if ($sql_arr['html_signature'] == 1) { $h2t = new html2text($a_signatures[$identity_id]['text'], false, false); $a_signatures[$identity_id]['text'] = trim($h2t->get_text()); } } } $this->api->output->set_env('signatures', $a_signatures); } return $out; }
function gen_form($attrib) { $this->api->output->add_label('sauserprefs.spamaddressexists', 'sauserprefs.spamenteraddress', 'sauserprefs.spamaddresserror', 'sauserprefs.spamaddressdelete', 'sauserprefs.spamaddressdeleteall', 'sauserprefs.enabled', 'sauserprefs.disabled', 'sauserprefs.importingaddresses', 'sauserprefs.usedefaultconfirm', 'sauserprefs.purgebayesconfirm', 'sauserprefs.whitelist_from'); // output table sorting prefs $sorts = rcube::get_instance()->config->get('sauserprefs_sort', array()); if (!array_key_exists('#spam-langs-table', $sorts)) { $sorts['#spam-langs-table'] = array(0, 'true'); } if (!array_key_exists('#address-rules-table', $sorts)) { $sorts['#address-rules-table'] = array(1, 'true'); } $this->api->output->set_env('sauserprefs_sort', $sorts); // output global prefs as default in env foreach ($this->global_prefs as $key => $val) { $this->api->output->set_env(str_replace(" ", "_", $key), $val); } unset($attrib['form']); list($form_start, $form_end) = get_form_tags($attrib, 'plugin.sauserprefs.save', null, array('name' => '_section', 'value' => $this->cur_section)); $out = $form_start; $out .= $this->_prefs_block($this->cur_section, $attrib); return $out . $form_end; }