function gen_form() { $confirm = $this->rcmail_inst->config->get('password_confirm_current'); $pwl = $this->rcmail_inst->config->get('password_min_length'); if (!empty($pwl)) { $pwl = max(6, $pwl); } else { $pwl = 6; } $this->rcmail_inst->output->add_label('ispconfig3_pass.nopassword', 'ispconfig3_pass.nocurpassword', 'ispconfig3_pass.passwordinconsistency', 'ispconfig3_pass.changepasswd', 'ispconfig3_pass.passwordminlength'); $this->rcmail_inst->output->add_script('var pw_min_length =' . $pwl . ';'); $this->rcmail_inst->output->set_env('framed', true); $out .= '<fieldset><legend>' . $this->gettext('password') . '</legend>' . "\n"; $table = new html_table(array('cols' => 2, 'class' => 'propform')); if ($confirm) { $input_newpasswd = new html_passwordfield(array('name' => '_curpasswd', 'id' => 'curpasswd', 'size' => 20)); $table->add('title', rcube_utils::rep_specialchars_output($this->gettext('curpasswd'))); $table->add('', $input_newpasswd->show()); } $input_newpasswd = new html_passwordfield(array('name' => '_newpasswd', 'id' => 'newpasswd', 'size' => 20)); $table->add('title', rcube_utils::rep_specialchars_output($this->gettext('newpasswd'))); $table->add('', $input_newpasswd->show() . '<div id="pass-check">'); $input_confpasswd = new html_passwordfield(array('name' => '_confpasswd', 'id' => 'confpasswd', 'size' => 20)); $table->add('title', rcube_utils::rep_specialchars_output($this->gettext('confpasswd'))); $table->add('', $input_confpasswd->show()); $out .= $table->show(); $out .= "</fieldset>\n"; return $out; }
/** * Quote a given string for javascript output. * Shortcut function for rcube_utils::rep_specialchars_output() * * @return string JS-quoted string */ public static function JQ($str) { return rcube_utils::rep_specialchars_output($str, 'js'); }
/** * Test for rep_specialchars_output * @dataProvider data_rep_specialchars_output */ function test_rep_specialchars_output($type, $mode, $str, $res) { $result = rcube_utils::rep_specialchars_output($str, $type ? $type : 'html', $mode ? $mode : 'strict'); $this->assertEquals($result, $res); }
function gen_js_list() { // create JS version of rule list for updating UI via AJAX $this->_startup(); if (sizeof($this->script) == 0) { // no rules exist, clear rule list $this->api->output->command('sieverules_update_list', 'add-first', -1, rcube_utils::rep_specialchars_output($this->gettext('nosieverules'))); } else { foreach ($this->script as $idx => $filter) { $args = rcube::get_instance()->plugins->exec_hook('sieverules_list_rules', array('idx' => $idx, 'name' => $filter['name'])); // skip the vacation and aborted rules if ($args['abort'] || $this->vacation_ui && $idx == $this->vacation_rule_position && $filter['name'] == $this->vacation_rule_name) { $this->api->output->command('sieverules_update_list', $idx == 0 ? 'add-first' : 'add', 'rcmrow' . $idx, '', '', true); } else { $parts = $this->_rule_list_parts($idx, $filter); $parts['control'] = str_replace("'", "\\'", $parts['control']); // send rule to UI $this->api->output->command('sieverules_update_list', $idx == 0 ? 'add-first' : 'add', 'rcmrow' . $idx, rcmail::JQ($parts['name']), $parts['control'], $args['abort']); } } } $this->api->output->send(); }
private function _address_row($address_table, $field, $value, $attrib) { if (!isset($field)) { $address_table->set_row_attribs(array('style' => 'display: none;')); } $hidden_action = new html_hiddenfield(array('name' => '_address_rule_act[]', 'value' => '')); $hidden_field = new html_hiddenfield(array('name' => '_address_rule_field[]', 'value' => $field)); $hidden_text = new html_hiddenfield(array('name' => '_address_rule_value[]', 'value' => $value)); switch ($field) { case "whitelist_from": $fieldtxt = rcube_utils::rep_specialchars_output($this->gettext('whitelist_from')); break; case "blacklist_from": $fieldtxt = rcube_utils::rep_specialchars_output($this->gettext('blacklist_from')); break; case "whitelist_to": $fieldtxt = rcube_utils::rep_specialchars_output($this->gettext('whitelist_to')); break; } $address_table->add(array('class' => $field), $fieldtxt); $address_table->add(array('class' => 'email'), $value); $del_button = $this->api->output->button(array('command' => 'plugin.sauserprefs.addressrule_del', 'type' => 'link', 'class' => 'delete', 'label' => 'delete', 'content' => ' ')); $address_table->add('control', $del_button . $hidden_action->show() . $hidden_field->show() . $hidden_text->show()); return $address_table; }
function gen_table($attrib) { $this->rcmail_inst->output->set_env('framed', true); $out = '<fieldset><legend>' . $this->gettext('wblistentries') . '</legend>' . "\n"; $rule_table = new html_table(array('id' => 'rule-table', 'class' => 'records-table', 'cellspacing' => '0', 'cols' => 4)); $rule_table->add_header("", $this->gettext('wblistentries')); $rule_table->add_header(array('width' => '16px'), ''); $rule_table->add_header(array('width' => '20px'), ''); $rule_table->add_header(array('width' => '16px'), ''); try { $session_id = $this->soap->login($this->rcmail_inst->config->get('remote_soap_user'), $this->rcmail_inst->config->get('remote_soap_pass')); $mail_user = $this->soap->mail_user_get($session_id, array('login' => $this->rcmail_inst->user->data['username'])); $spam_user = $this->soap->mail_spamfilter_user_get($session_id, array('email' => $mail_user[0]['email'])); $wblist = $this->soap->mail_spamfilter_whitelist_get($session_id, array('rid' => $spam_user[0]['id'])); //$blist = $this->soap->mail_spamfilter_blacklist_get($session_id, array('rid' => $spam_user[0]['id'])); //$wblist = array_merge($wlist, $blist); $this->soap->logout($session_id); for ($i = 0; $i < count($wblist); $i++) { $class = $class == 'odd' ? 'even' : 'odd'; if ($wblist[$i]['wblist_id'] == rcube_utils::get_input_value('_id', RCUBE_INPUT_GET)) { $class = 'selected'; } $rule_table->set_row_attribs(array('class' => $class, 'id' => 'rule_' . $wblist[$i]['wblist_id'])); $this->_rule_row($rule_table, $wblist[$i]['email'], $wblist[$i]['wb'], $wblist[$i]['active'], $wblist[$i]['wblist_id'], $attrib); } } catch (SoapFault $e) { $this->rcmail_inst->output->command('display_message', 'Soap Error: ' . $e->getMessage(), 'error'); } if (count($wblist) == 0) { $rule_table->add(array('colspan' => '4'), rcube_utils::rep_specialchars_output($this->gettext('wblistnorules'))); $rule_table->set_row_attribs(array('class' => 'odd')); $rule_table->add_row(); } $out .= "<div id=\"rule-cont\">" . $rule_table->show() . "</div>\n"; $out .= "</fieldset>\n"; return $out; }
function gen_table($attrib) { $this->rcmail_inst->output->set_env('framed', true); $out = '<fieldset><legend>' . $this->gettext('fetchmail_entries') . '</legend>' . "\n"; $fetch_table = new html_table(array('id' => 'fetch-table', 'class' => 'records-table', 'cellspacing' => '0', 'cols' => 3)); $fetch_table->add_header("", $this->gettext('fetchmailserver')); $fetch_table->add_header(array('width' => '20px'), ''); $fetch_table->add_header(array('width' => '16px'), ''); try { $session_id = $this->soap->login($this->rcmail_inst->config->get('remote_soap_user'), $this->rcmail_inst->config->get('remote_soap_pass')); $mail_user = $this->soap->mail_user_get($session_id, array('login' => $this->rcmail_inst->user->data['username'])); $fetchmail = $this->soap->mail_fetchmail_get($session_id, array('destination' => $mail_user[0]['email'])); $this->soap->logout($session_id); for ($i = 0; $i < count($fetchmail); $i++) { $class = $class == 'odd' ? 'even' : 'odd'; if ($fetchmail[$i]['mailget_id'] == rcube_utils::get_input_value('_id', RCUBE_INPUT_GET)) { $class = 'selected'; } $fetch_table->set_row_attribs(array('class' => $class, 'id' => 'fetch_' . $fetchmail[$i]['mailget_id'])); $this->_fetch_row($fetch_table, $fetchmail[$i]['source_username'] . '@' . $fetchmail[$i]['source_server'], $fetchmail[$i]['active'], $fetchmail[$i]['mailget_id'], $attrib); } } catch (SoapFault $e) { $this->rcmail_inst->output->command('display_message', 'Soap Error: ' . $e->getMessage(), 'error'); } if (count($fetchmail) == 0) { $fetch_table->add(array('colspan' => '3'), rcube_utils::rep_specialchars_output($this->gettext('nofetch'))); $fetch_table->set_row_attribs(array('class' => 'odd')); $fetch_table->add_row(); } $out .= "<div id=\"fetch-cont\">" . $fetch_table->show() . "</div>\n"; $out .= "</fieldset>\n"; return $out; }
function gen_js_list() { // create JS version of rule list for updating UI via AJAX $this->_startup(); if (sizeof($this->script) == 0) { // no rules exist, clear rule list $this->api->output->command('sieverules_update_list', 'add-first', -1, rcube_utils::rep_specialchars_output($this->gettext('nosieverules'))); } else { foreach ($this->script as $idx => $filter) { $parts = $this->_rule_list_parts($idx, $filter); $parts['control'] = str_replace("'", "\\'", $parts['control']); // send rule to UI $this->api->output->command('sieverules_update_list', $idx == 0 ? 'add-first' : 'add', 'rcmrow' . $idx, rcmail::JQ($parts['name']), $parts['control']); } } $this->api->output->send(); }
function gen_form() { try { $session_id = $this->soap->login($this->rcmail_inst->config->get('remote_soap_user'), $this->rcmail_inst->config->get('remote_soap_pass')); $mail_user = $this->soap->mail_user_get($session_id, array('login' => $this->rcmail_inst->user->data['username'])); $this->soap->logout($session_id); } catch (SoapFault $e) { $this->rcmail_inst->output->command('display_message', 'Soap Error: ' . $e->getMessage(), 'error'); } $enabled = $mail_user[0]['autoresponder']; if ($enabled == 'y') { $enabled = 1; } else { $enabled = 0; } if ($mail_user[0]['autoresponder_start_date'] == '0000-00-00 00:00:00') { $dt = new DateTime('@' . time()); $dt->setTimeZone(new DateTimeZone($this->rcmail_inst->config->get('timezone'))); $mail_user[0]['autoresponder_start_date'] = $dt->format('Y-m-d H:i'); } else { $mail_user[0]['autoresponder_start_date'] = strtotime($mail_user[0]['autoresponder_start_date']); $dt = new DateTime('@' . $mail_user[0]['autoresponder_start_date']); $dt->setTimeZone(new DateTimeZone($this->rcmail_inst->config->get('timezone'))); $mail_user[0]['autoresponder_start_date'] = $dt->format('Y-m-d H:i'); } if ($mail_user[0]['autoresponder_end_date'] == '0000-00-00 00:00:00') { $dt = new DateTime('@' . (time() + 86400)); $dt->setTimeZone(new DateTimeZone($this->rcmail_inst->config->get('timezone'))); $mail_user[0]['autoresponder_end_date'] = $dt->format('Y-m-d H:i'); } else { $mail_user[0]['autoresponder_end_date'] = strtotime($mail_user[0]['autoresponder_end_date']); $dt = new DateTime('@' . $mail_user[0]['autoresponder_end_date']); $dt->setTimeZone(new DateTimeZone($this->rcmail_inst->config->get('timezone'))); $mail_user[0]['autoresponder_end_date'] = $dt->format('Y-m-d H:i'); } $this->rcmail_inst->output->set_env('framed', true); $out = '<fieldset><legend>' . $this->gettext('acc_autoreply') . '</legend>' . "\n"; $table = new html_table(array('cols' => 2, 'class' => 'propform')); $input_autoreplysubject = new html_inputfield(array('name' => '_autoreplysubject', 'id' => 'autoreplysubject', 'size' => 40)); $table->add('title', rcube_utils::rep_specialchars_output($this->gettext('subject'))); $table->add('', $input_autoreplysubject->show($mail_user[0]['autoresponder_subject'])); $input_autoreplybody = new html_textarea(array('name' => '_autoreplybody', 'id' => 'autoreplybody', 'cols' => 48, 'rows' => 15)); $table->add('title', rcube_utils::rep_specialchars_output($this->gettext('autoreplymessage'))); $table->add('', $input_autoreplybody->show($mail_user[0]['autoresponder_text'])); $input_autoreplystarton = new html_inputfield(array('name' => '_autoreplystarton', 'id' => 'autoreplystarton', 'size' => 20)); $table->add('title', rcube_utils::rep_specialchars_output($this->gettext('autoreplystarton'))); $table->add('', $input_autoreplystarton->show($mail_user[0]['autoresponder_start_date'])); $input_autoreplyendby = new html_inputfield(array('name' => '_autoreplyendby', 'id' => 'autoreplyendby', 'size' => 20)); $table->add('title', rcube_utils::rep_specialchars_output($this->gettext('autoreplyendby'))); $table->add('', $input_autoreplyendby->show($mail_user[0]['autoresponder_end_date'])); $input_autoreplyenabled = new html_checkbox(array('name' => '_autoreplyenabled', 'id' => 'autoreplyenabled', 'value' => 1)); $table->add('title', rcube_utils::rep_specialchars_output($this->gettext('autoreplyenabled'))); $table->add('', $input_autoreplyenabled->show($enabled)); $out .= $table->show(); $out .= "</fieldset>\n"; return $out; }
function JQ($str) { _deprecation_warning(__FUNCTION__); return rcube_utils::rep_specialchars_output($str, 'js'); }
function gen_js_list() { $this->_startup(); if (sizeof($this->script) == 0) { $this->api->output->command('sieverules_update_list', 'add-first', -1, rcube_utils::rep_specialchars_output($this->gettext('nosieverules'))); } else { foreach ($this->script as $idx => $filter) { if ($filter['disabled'] == 1) { $filter_name = $filter['name'] . ' (' . $this->gettext('disabled') . ')'; } else { $filter_name = $filter['name']; } $tmp_output = new rcube_output_html('settings'); $dst = $idx - 1; $up_link = $tmp_output->button(array('command' => 'plugin.sieverules.move', 'prop' => $dst, 'type' => 'link', 'class' => 'up_arrow', 'title' => 'sieverules.moveup', 'content' => ' ')); $up_link = str_replace("'", "\\'", $up_link); $dst = $idx + 2; $down_link = $tmp_output->button(array('command' => 'plugin.sieverules.move', 'prop' => $dst, 'type' => 'link', 'class' => 'down_arrow', 'title' => 'sieverules.movedown', 'content' => ' ')); $down_link = str_replace("'", "\\'", $down_link); $this->api->output->command('sieverules_update_list', $idx == 0 ? 'add-first' : 'add', 'rcmrow' . $idx, rcmail::JQ($filter_name), $down_link, $up_link); } } $this->api->output->send(); }
function gen_table($attrib) { $this->rcmail_inst->output->set_env('framed', true); $out = '<fieldset><legend>' . $this->gettext('forward_entries') . '</legend>' . "\n"; $rule_table = new html_table(array('id' => 'rule-table', 'class' => 'records-table', 'cellspacing' => '0', 'cols' => 2)); $rule_table->add_header("", $this->gettext('forward_entries')); $rule_table->add_header(array('width' => '16px'), ''); try { $session_id = $this->soap->login($this->rcmail_inst->config->get('remote_soap_user'), $this->rcmail_inst->config->get('remote_soap_pass')); $mail_user = $this->soap->mail_user_get($session_id, array('login' => $this->rcmail_inst->user->data['username'])); $this->soap->logout($session_id); $forward = explode(",", $mail_user[0]['cc']); if (!empty($forward[0])) { for ($i = 0; $i < count($forward); $i++) { $class = $class == 'odd' ? 'even' : 'odd'; if ($forward[$i] == rcube_utils::get_input_value('_forwardingaddress', RCUBE_INPUT_GET)) { $class = 'selected'; } $rule_table->set_row_attribs(array('class' => $class, 'id' => 'rule_' . $forward[$i])); $this->_rule_row($rule_table, $forward[$i], $attrib); } } else { $rule_table->add(array('colspan' => '2'), rcube_utils::rep_specialchars_output($this->gettext('forwardnomails'))); $rule_table->set_row_attribs(array('class' => 'odd')); $rule_table->add_row(); } } catch (SoapFault $e) { $this->rcmail_inst->output->command('display_message', 'Soap Error: ' . $e->getMessage(), 'error'); } $out .= "<div id=\"rule-cont\">" . $rule_table->show() . "</div>\n"; $out .= "</fieldset>\n"; return $out; }