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;
 }
Exemplo n.º 2
0
 function preferences_list($args)
 {
     if ($args['section'] == 'jabber') {
         $jabber_username = $this->rc->config->get('jabber_username');
         $jabber_domain = $this->rc->config->get('jabber_domain', 'jappix.com');
         $jabber_enc = $this->rc->config->get('jabber_enc');
         if ((!$jabber_username || !$jabber_enc || !$jabber_domain) && $this->rc->config->get('jappix_register_url')) {
             $field_id = 'rcmfd_register';
             $args['blocks']['jabber']['options']['jappix_register'] = array('title' => html::label($field_id, @$this->gettext('requirement')), 'content' => html::tag('a', array('href' => $this->rc->config->get('jappix_register_url'), 'target' => '_blank'), $this->gettext('clickhere')) . ' ' . $this->gettext('registeraccount'));
         }
         $jappix_enabled = $this->rc->config->get('jappix_enabled', 0);
         $field_id = 'rcmfd_enabled';
         $checkbox = new html_checkbox(array('name' => '_jappix_enabled', 'value' => 1, 'id' => $field_id, 'onclick' => "if(\$(this).prop('checked') == false || \$('input[name=\\'_jabber_username\\']').val() != ''){ \$('.mainaction').hide(); document.forms.form.submit(); };"));
         $args['blocks']['jabber']['options']['jappix_enabled'] = array('title' => html::label($field_id, Q($this->gettext('enabled'))), 'content' => $checkbox->show($jappix_enabled ? 1 : 0));
         $field_id_user = '******';
         $input_user = new html_inputfield(array('name' => '_jabber_username', 'id' => $field_id_user, 'size' => 25));
         if ($jabber_domain == '%d') {
             $jabber_domain = end(explode('@', $this->rc->user->data['username']));
         }
         $field_id_domain = 'rcmfd_domain';
         $input_domain = new html_inputfield(array('name' => '_jabber_domain', 'id' => $field_id_domain, 'size' => 25));
         $args['blocks']['jabber']['options']['jabber_username'] = array('title' => html::label($field_id, Q($this->gettext('jappixUsername'))), 'content' => $input_user->show($jabber_username) . ' @ ' . $input_domain->show($jabber_domain));
         $field_id = 'rcmfd_enc';
         $input = new html_passwordfield(array('name' => '_jabber_password', 'id' => $field_id, 'size' => 25, 'placeholder' => $jabber_enc ? $this->gettext('passwordisset') : $this->gettext('pleaseenterpassword')));
         $args['blocks']['jabber']['options']['jabber_password'] = array('title' => html::label($field_id, Q($this->gettext('jappixPassword'))), 'content' => $input->show());
         $jappix_full = $this->rc->config->get('jappix_full', 1);
         $field_id = 'rcmfd_use_full';
         $checkbox = new html_checkbox(array('name' => '_jappix_full', 'value' => 1, 'id' => $field_id, 'onclick' => "if(this.checked){ parent.\$('.button-jappix4roundcube').show(); } else { parent.\$('.button-jappix4roundcube').hide(); }; \$('.mainaction').hide(); document.forms.form.submit();"));
         $args['blocks']['jabber']['options']['jappix_full'] = array('title' => html::label($field_id, Q($this->gettext('usefulljappix'))), 'content' => $checkbox->show($jappix_full ? 1 : 0));
         $jappix_mini = $this->rc->config->get('jappix_mini', 1);
         $field_id = 'rcmfd_use_mini';
         $checkbox = new html_checkbox(array('name' => '_jappix_mini', 'value' => 1, 'id' => $field_id, 'onclick' => "if(this.checked){ parent.parent.\$('.jm_position').show(); } else { parent.parent.\$('.jm_position').hide(); }; \$('.mainaction').hide(); document.forms.form.submit();"));
         $args['blocks']['jabber']['options']['jappix_mini'] = array('title' => html::label($field_id, Q($this->gettext('useminijappix'))), 'content' => $checkbox->show($jappix_mini ? 1 : 0));
         $jappix_mini_autologon = $this->rc->config->get('jappix_mini_autologon', 1);
         $field_id = 'rcmfd_use_mini_autologon';
         $checkbox = new html_checkbox(array('name' => '_jappix_mini_autologon', 'value' => 1, 'id' => $field_id, 'onclick' => "if(this.checked){ parent.parent.\$('.jm_pane').trigger('click'); } else { if(parent.parent.JappixMini) parent.parent.JappixMini.disconnect(); }; \$('.mainaction').hide(); document.forms.form.submit();"));
         $args['blocks']['jabber']['options']['jappix_mini_autologon'] = array('title' => html::label($field_id, Q($this->gettext('minijappixautologon'))), 'content' => $checkbox->show($jappix_mini_autologon ? 1 : 0));
         /*
         $field_id = 'rcmfd_use_manager';
         $args['blocks']['jabber']['options']['jabber_manager'] = array(
           'title' => html::label($field_id, Q($this->gettext('manager'))),
           'content' => '<a target=\'_blank\' href=\''.$this->rc->config->get('jappix_url').'/?m=manager\'>'.Q($this->gettext('manager')).'</a>',
         );
         */
     }
     return $args;
 }
 /**
  * GUI object 'loginform'
  * Returns code for the webmail login form
  *
  * @param array Named parameters
  * @return string HTML code for the gui object
  */
 protected function login_form($attrib)
 {
     $default_host = $this->config->get('default_host');
     $autocomplete = (int) $this->config->get('login_autocomplete');
     $_SESSION['temp'] = true;
     // save original url
     $url = rcube_utils::get_input_value('_url', rcube_utils::INPUT_POST);
     if (empty($url) && !preg_match('/_(task|action)=logout/', $_SERVER['QUERY_STRING'])) {
         $url = $_SERVER['QUERY_STRING'];
     }
     // Disable autocapitalization on iPad/iPhone (#1488609)
     $attrib['autocapitalize'] = 'off';
     // set atocomplete attribute
     $user_attrib = $autocomplete > 0 ? array() : array('autocomplete' => 'off');
     $host_attrib = $autocomplete > 0 ? array() : array('autocomplete' => 'off');
     $pass_attrib = $autocomplete > 1 ? array() : array('autocomplete' => 'off');
     $input_task = new html_hiddenfield(array('name' => '_task', 'value' => 'login'));
     $input_action = new html_hiddenfield(array('name' => '_action', 'value' => 'login'));
     $input_tzone = new html_hiddenfield(array('name' => '_timezone', 'id' => 'rcmlogintz', 'value' => '_default_'));
     $input_url = new html_hiddenfield(array('name' => '_url', 'id' => 'rcmloginurl', 'value' => $url));
     $input_user = new html_inputfield(array('name' => '_user', 'id' => 'rcmloginuser', 'required' => 'required') + $attrib + $user_attrib);
     $input_pass = new html_passwordfield(array('name' => '_pass', 'id' => 'rcmloginpwd', 'required' => 'required') + $attrib + $pass_attrib);
     $input_host = null;
     if (is_array($default_host) && count($default_host) > 1) {
         $input_host = new html_select(array('name' => '_host', 'id' => 'rcmloginhost'));
         foreach ($default_host as $key => $value) {
             if (!is_array($value)) {
                 $input_host->add($value, is_numeric($key) ? $value : $key);
             } else {
                 $input_host = null;
                 break;
             }
         }
     } else {
         if (is_array($default_host) && ($host = key($default_host)) !== null) {
             $hide_host = true;
             $input_host = new html_hiddenfield(array('name' => '_host', 'id' => 'rcmloginhost', 'value' => is_numeric($host) ? $default_host[$host] : $host) + $attrib);
         } else {
             if (empty($default_host)) {
                 $input_host = new html_inputfield(array('name' => '_host', 'id' => 'rcmloginhost') + $attrib + $host_attrib);
             }
         }
     }
     $form_name = !empty($attrib['form']) ? $attrib['form'] : 'form';
     $this->add_gui_object('loginform', $form_name);
     // create HTML table with two cols
     $table = new html_table(array('cols' => 2));
     $table->add('title', html::label('rcmloginuser', html::quote($this->app->gettext('username'))));
     $table->add('input', $input_user->show('mail@box'));
     $table->add('title', html::label('rcmloginpwd', html::quote($this->app->gettext('password'))));
     $table->add('input', $input_pass->show());
     // add host selection row
     if (is_object($input_host) && !$hide_host) {
         $table->add('title', html::label('rcmloginhost', html::quote($this->app->gettext('server'))));
         $table->add('input', $input_host->show(rcube_utils::get_input_value('_host', rcube_utils::INPUT_GPC)));
     }
     $out = $input_task->show();
     $out .= $input_action->show();
     $out .= $input_tzone->show();
     $out .= $input_url->show();
     $out .= $table->show();
     if ($hide_host) {
         $out .= $input_host->show();
     }
     if (rcube_utils::get_boolean($attrib['submit'])) {
         $submit = new html_inputfield(array('type' => 'submit', 'id' => 'rcmloginsubmit', 'class' => 'button mainaction', 'value' => $this->app->gettext('login')));
         $out .= html::p('formbuttons', $submit->show());
     }
     // surround html output with a form tag
     if (empty($attrib['form'])) {
         $out = $this->form_tag(array('name' => $form_name, 'method' => 'post'), $out);
     }
     // include script for timezone detection
     $this->include_script('jstz.min.js');
     return $out;
 }
Exemplo n.º 4
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);
 }
Exemplo n.º 5
0
 /**
  * GUI object 'loginform'
  * Returns code for the webmail login form
  *
  * @param array Named parameters
  * @return string HTML code for the gui object
  */
 protected function login_form($attrib)
 {
     $default_host = $this->config->get('default_host');
     $autocomplete = (int) $this->config->get('login_autocomplete');
     $_SESSION['temp'] = true;
     // save original url
     $url = rcube_utils::get_input_value('_url', rcube_utils::INPUT_POST);
     if (empty($url) && !preg_match('/_(task|action)=logout/', $_SERVER['QUERY_STRING'])) {
         $url = $_SERVER['QUERY_STRING'];
     }
     // set atocomplete attribute
     $user_attrib = $autocomplete > 0 ? array() : array('autocomplete' => 'off');
     $host_attrib = $autocomplete > 0 ? array() : array('autocomplete' => 'off');
     $pass_attrib = $autocomplete > 1 ? array() : array('autocomplete' => 'off');
     $input_task = new html_hiddenfield(array('name' => '_task', 'value' => 'login'));
     $input_action = new html_hiddenfield(array('name' => '_action', 'value' => 'login'));
     $input_tzone = new html_hiddenfield(array('name' => '_timezone', 'id' => 'rcmlogintz', 'value' => '_default_'));
     $input_dst = new html_hiddenfield(array('name' => '_dstactive', 'id' => 'rcmlogindst', 'value' => '_default_'));
     $input_url = new html_hiddenfield(array('name' => '_url', 'id' => 'rcmloginurl', 'value' => $url));
     $input_user = new html_inputfield(array('name' => '_user', 'id' => 'rcmloginuser') + $attrib + $user_attrib);
     $input_pass = new html_passwordfield(array('name' => '_pass', 'id' => 'rcmloginpwd') + $attrib + $pass_attrib);
     $input_host = null;
     if (is_array($default_host) && count($default_host) > 1) {
         $input_host = new html_select(array('name' => '_host', 'id' => 'rcmloginhost'));
         foreach ($default_host as $key => $value) {
             if (!is_array($value)) {
                 $input_host->add($value, is_numeric($key) ? $value : $key);
             } else {
                 $input_host = null;
                 break;
             }
         }
     } else {
         if (is_array($default_host) && ($host = array_pop($default_host))) {
             $hide_host = true;
             $input_host = new html_hiddenfield(array('name' => '_host', 'id' => 'rcmloginhost', 'value' => $host) + $attrib);
         } else {
             if (empty($default_host)) {
                 $input_host = new html_inputfield(array('name' => '_host', 'id' => 'rcmloginhost') + $attrib + $host_attrib);
             }
         }
     }
     $form_name = !empty($attrib['form']) ? $attrib['form'] : 'form';
     $this->add_gui_object('loginform', $form_name);
     // create HTML table with two cols
     $table = new html_table(array('cols' => 2));
     $table->add('title', html::label('rcmloginuser', html::quote($this->app->gettext('username'))));
     $table->add('input', $input_user->show(rcube_utils::get_input_value('_user', rcube_utils::INPUT_GPC)));
     $table->add('title', html::label('rcmloginpwd', html::quote($this->app->gettext('password'))));
     $table->add('input', $input_pass->show());
     // add host selection row
     if (is_object($input_host) && !$hide_host) {
         $table->add('title', html::label('rcmloginhost', html::quote($this->app->gettext('server'))));
         $table->add('input', $input_host->show(rcube_utils::get_input_value('_host', rcube_utils::INPUT_GPC)));
     }
     $out = $input_task->show();
     $out .= $input_action->show();
     $out .= $input_tzone->show();
     $out .= $input_dst->show();
     $out .= $input_url->show();
     $out .= $table->show();
     if ($hide_host) {
         $out .= $input_host->show();
     }
     // surround html output with a form tag
     if (empty($attrib['form'])) {
         $out = $this->form_tag(array('name' => $form_name, 'method' => 'post'), $out);
     }
     return $out;
 }
Exemplo n.º 6
0
</dd>

<dt class="propname">smtp_port</dt>
<dd>
<?php 
$text_smtpport = new html_inputfield(array('name' => '_smtp_port', 'size' => 6, 'id' => "cfgsmtpport"));
echo $text_smtpport->show($RCI->getprop('smtp_port'));
?>
<div>SMTP port (default is 25; 465 for SSL; 587 for submission)</div>
</dd>

<dt class="propname">smtp_user/smtp_pass</dt>
<dd>
<?php 
$text_smtpuser = new html_inputfield(array('name' => '_smtp_user', 'size' => 20, 'id' => "cfgsmtpuser"));
$text_smtppass = new html_passwordfield(array('name' => '_smtp_pass', 'size' => 20, 'id' => "cfgsmtppass"));
echo $text_smtpuser->show($RCI->getprop('smtp_user'));
echo $text_smtppass->show($RCI->getprop('smtp_pass'));
?>
<div>SMTP username and password (if required)</div>
<p>
<?php 
$check_smtpuser = new html_checkbox(array('name' => '_smtp_user_u', 'id' => "cfgsmtpuseru"));
echo $check_smtpuser->show($RCI->getprop('smtp_user') == '%u' || $_POST['_smtp_user_u'] ? 1 : 0, array('value' => 1));
?>
<label for="cfgsmtpuseru">Use the current IMAP username and password for SMTP authentication</label>
</p>
</dd>
<!--
<dt class="propname">smtp_auth_type</dt>
<dd>
Exemplo n.º 7
0
 function accounts_form_content($email = "", $username = "", $password = "", $server = "", $port = "", $useSSL = 'none', $leave_a_copy = true, $provider = "", $default_folder = "", $show_import_old_messages_option = true)
 {
     $rcmail = rcmail::get_instance();
     $this->include_script('pop3fetcher_providers.js');
     // allow the following attributes to be added to the <table> tag
     $attrib_str = create_attrib_string($attrib, array('style', 'class', 'id', 'cellpadding', 'cellspacing', 'border', 'summary'));
     // return the complete edit form as table
     $user = $rcmail->user->data['username'];
     if ($_SESSION['global_alias']) {
         $user = $_SESSION['global_alias'];
     }
     if ($email != "") {
         $out .= '<fieldset><legend>' . $email . ' ::: ' . $user . '</legend>' . "\n";
     } else {
         $out .= '<fieldset>' . "\n";
     }
     $out .= '<br />' . "\n";
     $out .= '<table' . $attrib_str . ">\n";
     //<script type=\"text/javascript\">console.log(providers['gmail.com']);</script>
     $field_id = 'pop3fetcher_email';
     $input_pop3fetcher_email = new html_inputfield(array('autocomplete' => 'off', 'name' => '_pop3fetcher_email', 'id' => $field_id, 'size' => 30));
     $out .= sprintf("<tr><td valign=\"middle\" class=\"title\"><label for=\"%s\">%s</label>:</td><td colspan=\"3\">%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('account_email')), $input_pop3fetcher_email->show($email));
     $field_id = 'pop3fetcher_username';
     $input_pop3fetcher_username = new html_inputfield(array('autocomplete' => 'off', 'name' => '_pop3fetcher_username', 'id' => $field_id, 'size' => 30));
     $out .= sprintf("<tr><td valign=\"middle\" class=\"title\"><label for=\"%s\">%s</label>:</td><td colspan=\"3\">%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('account_username')), $input_pop3fetcher_username->show($username));
     $field_id = 'pop3fetcher_password';
     $input_pop3fetcher_password = new html_passwordfield(array('autocomplete' => 'off', 'name' => '_pop3fetcher_password', 'id' => $field_id, 'size' => 30));
     $out .= sprintf("<tr><td valign=\"middle\" class=\"title\"><label for=\"%s\">%s</label>:</td><td colspan=\"3\">%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('account_password')), $input_pop3fetcher_password->show($password));
     $field_id = 'pop3fetcher_provider';
     $input_pop3fetcher_provider = new html_select(array('name' => '_pop3fetcher_provider', 'id' => $field_id));
     $out .= sprintf("<tr><td valign=\"middle\" class=\"title\"><label for=\"%s\">%s</label>:</td><td colspan=\"3\">%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('account_provider')), $input_pop3fetcher_provider->show());
     $field_id = 'pop3fetcher_serveraddress';
     $input_pop3fetcher_serveraddress = new html_inputfield(array('autocomplete' => 'off', 'name' => '_pop3fetcher_serveraddress', 'id' => $field_id, 'size' => 30));
     $out .= sprintf("<tr><td valign=\"middle\" class=\"title\"><label for=\"%s\">%s</label>:</td><td colspan=\"3\">%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('account_serveraddress')), $input_pop3fetcher_serveraddress->show($server));
     $field_id = 'pop3fetcher_serverport';
     $input_pop3fetcher_serverport = new html_inputfield(array('autocomplete' => 'off', 'name' => '_pop3fetcher_serverport', 'id' => $field_id, 'size' => 10));
     $field_id2 = 'pop3fetcher_ssl';
     $input_pop3fetcher_ssl = new html_select(array('name' => '_pop3fetcher_ssl', 'id' => $field_id2));
     $input_pop3fetcher_ssl->add('none', '');
     $input_pop3fetcher_ssl->add('tls', 'tls');
     $input_pop3fetcher_ssl->add('ssl', 'ssl');
     $input_pop3fetcher_ssl->add('sslv2', 'sslv2');
     $input_pop3fetcher_ssl->add('sslv3', 'sslv3');
     $out .= sprintf("<tr><td valign=\"middle\" class=\"title\"><label for=\"%s\">%s</label>:</td><td>%s</td><td valign=\"middle\" class=\"title\"><label for=\"%s\">%s</label>:</td><td>%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('account_serverport')), $input_pop3fetcher_serverport->show($port), $field_id2, rep_specialchars_output($this->gettext('account_usessl')), $input_pop3fetcher_ssl->show($useSSL));
     $field_id = 'pop3fetcher_leaveacopy';
     $input_pop3fetcher_leaveacopy = new html_checkbox(array('name' => '_pop3fetcher_leaveacopy', 'id' => $field_id));
     $out .= sprintf("<tr><td valign=\"middle\" colspan=\"3\" class=\"title\"><label for=\"%s\">%s</label>:</td><td>%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('account_leaveacopy')), $input_pop3fetcher_leaveacopy->show($leave_a_copy ? false : true));
     // QUESTA COSA E' STRANA MA FUNZIONA...
     // SET TARGET DEFAULT FOLDER
     $field_id = 'pop3fetcher_defaultfolder';
     $this->rcmail->imap_connect();
     // get mailbox list
     $a_folders = $rcmail->imap->list_folders();
     $delimiter = $rcmail->imap->get_hierarchy_delimiter();
     $a_mailboxes = array();
     $custom_folder_name = $this->config["root_folder_path"] . $delimiter . str_replace($delimiter, "_", $email);
     $found = false;
     foreach ($a_folders as $ifolder) {
         if ($ifolder == $custom_folder_name) {
             $found = true;
         }
         rcmail_build_folder_tree($a_mailboxes, $ifolder, $delimiter);
     }
     $input_folderlist = new html_select(array('name' => '_pop3fetcher_defaultfolder', 'id' => $field_id));
     rcmail_render_folder_tree_select($a_mailboxes, $field_id, 100, $input_folderlist, false);
     if (!$found && $default_folder != "" && $default_folder != $custom_folder_name) {
         $input_folderlist->add(str_replace($delimiter, "_", $email), "#AUTO_FOLDER#");
     }
     //$input_folderlist->add('create new folder', 'create_new_folder');
     $out .= sprintf("<tr><td valign=\"middle\" class=\"title\"><label for=\"%s\">%s</label>:</td><td colspan=\"3\">%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('account_default_folder')), $input_folderlist->show($default_folder));
     $field_id = 'pop3fetcher_testconnection';
     $input_pop3fetcher_testconnection = new html_checkbox(array('name' => '_pop3fetcher_testconnection', 'id' => $field_id));
     $out .= sprintf("<tr><td valign=\"middle\" colspan=\"3\" class=\"title\"><label for=\"%s\">%s</label>:</td><td>%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('test_connection_on_save')), $input_pop3fetcher_testconnection->show(false));
     // QUESTA COSA E' STRANA MA FUNZIONA...
     if ($show_import_old_messages_option) {
         $field_id = 'pop3fetcher_import_old_messages';
         $input_pop3fetcher_import_old_messages = new html_checkbox(array('name' => '_pop3fetcher_import_old_messages', 'id' => $field_id));
         $out .= sprintf("<tr><td valign=\"middle\" colspan=\"3\" class=\"title\"><label for=\"%s\">%s</label>:</td><td>%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('account_import_old_messages')), $input_pop3fetcher_import_old_messages->show(true));
         // QUESTA COSA E' STRANA MA FUNZIONA...
     }
     $out .= "\n</table>";
     $out .= '<br />' . "\n";
     $out .= "</fieldset>\n";
     $out .= "<script type='text/javascript'>\n\t\t\t\tvar delimiter = '" . $delimiter . "';\n\t\t\t\tvar root_folder_path = '" . $this->config["root_folder_path"] . "';\n\t\t\t\tload_pop3_providers('" . $provider . "');\n\t\t\t\t\$('#pop3fetcher_email').keyup(\n\t\t\t\t\tfunction(){update_default_folder_name(\$(this).val());}\n\t\t\t\t);\n\t\t\t</script>";
     return $out;
 }
Exemplo n.º 8
0
<p><input type="submit" name="sendmail" value="Send test mail" /></p>


<h3>Test IMAP config</h3>

<?php 
$default_hosts = $RCI->get_hostlist();
if (!empty($default_hosts)) {
    $host_field = new html_select(array('name' => '_host', 'id' => 'imaphost'));
    $host_field->add($default_hosts);
} else {
    $host_field = new html_inputfield(array('name' => '_host', 'id' => 'imaphost'));
}
$user_field = new html_inputfield(array('name' => '_user', 'id' => 'imapuser'));
$pass_field = new html_passwordfield(array('name' => '_pass', 'id' => 'imappass'));
?>

<table>
<tbody>
  <tr>
    <td><label for="imaphost">Server</label></td>
    <td><?php 
echo $host_field->show($_POST['_host']);
?>
</td>
  </tr>
  <tr>
    <td>Port</td>
    <td><?php 
echo $RCI->getprop('default_port');
 function vboxadm_form()
 {
     $rcmail = rcmail::get_instance();
     $this->_load_config();
     // add labels to client - to be used in JS alerts
     $rcmail->output->add_label('vboxadm.enterallpassfields', 'vboxadm.passwordinconsistency', 'vboxadm.autoresponderlong', 'vboxadm.autoresponderlongnum', 'vboxadm.autoresponderlongmax');
     $rcmail->output->set_env('product_name', $rcmail->config->get('product_name'));
     $settings = $this->_get_configuration();
     $sa_active = $settings['sa_active'];
     $sa_kill_score = $settings['sa_kill_score'];
     $is_on_vacation = $settings['is_on_vacation'];
     $vacation_subj = $settings['vacation_subj'];
     $vacation_msg = $settings['vacation_msg'];
     $vacation_start = $settings['vacation_start'];
     $vacation_end = $settings['vacation_end'];
     $max_msg_size_mb = $settings['max_msg_size'] / (1024 * 1024);
     $user_id = $settings['id'];
     $domain_id = $settings['domain_id'];
     $alias_active = $settings['alias_active'];
     $alias_goto = $settings['alias_goto'];
     $domain_settings = $this->_get_domain_configuration($domain_id);
     $active_domain = $domain_settings['name'];
     $rcmail->output->set_env('vacation_maxlength', $this->config['vboxadm_vacation_maxlength']);
     $out .= '<p class="introtext">' . $this->gettext('introtext') . '</p>' . "\n";
     if ($this->config['show_admin_link'] == true && ($settings['is_domainadmin'] == true || $settings['is_siteadmin'])) {
         $out .= '<p class="adminlink">';
         $out .= sprintf($this->gettext('adminlinktext'), '<a href="' . $this->config['vboxadm_url'] . '" target="_blank">', '</a>');
         $out .= "</p>\n";
     }
     // =====================================================================================================
     // SpamAssassin
     $out .= '<fieldset><legend>' . $this->gettext('spam') . '</legend>' . "\n";
     $out .= '<div class="fieldset-content">';
     $out .= '<table class="vboxadm-settings" cellpadding="0" cellspacing="0">';
     $field_id = 'sa_active';
     $input_spamenabled = new html_checkbox(array('name' => 'sa_active', 'id' => $field_id, 'value' => 1));
     //		$out .= sprintf("<tr><th><label for=\"%s\">%s</label>:</th><td>%s%s</td></tr>\n",
     $out .= sprintf("<tr><th><label for=\"%s\">%s</label>:</th><td>%s%s</td>\n", $field_id, rep_specialchars_output($this->gettext('spamenabled')), $input_spamenabled->show($sa_active ? 1 : 0), '<br /><span class="vboxadm-explanation">' . $this->gettext('spamenabledexplanation') . '</span>');
     $field_id = 'sa_kill_score';
     $input_spamscorerefuse = new html_inputfield(array('name' => 'sa_kill_score', 'id' => $field_id, 'maxlength' => 8, 'size' => 8));
     //		$out .= sprintf("<tr><th><label for=\"%s\">%s</label>:</th><td>%s%s</td></tr>\n",
     $out .= sprintf("<th><label for=\"%s\">%s</label>:</th><td>%s%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('spamscorerefuse')), $input_spamscorerefuse->show($sa_kill_score), '<br /><span class="vboxadm-explanation">' . $this->gettext('spamscorerefuseexplanation') . '. <span class="sameline">' . $this->gettext('domaindefault') . ': ' . $default_sa_refuse . '.</span></span>');
     $out .= '</table>';
     $out .= '</div></fieldset>' . "\n\n";
     // =====================================================================================================
     // Autoresponder
     $out .= '<fieldset><legend>' . $this->gettext('autoresponder') . '</legend>' . "\n";
     $out .= '<div class="fieldset-content">';
     $out .= '<table><tr><td>';
     $out .= '<table class="vboxadm-settings" cellpadding="0" cellspacing="0">';
     $field_id = 'is_on_vacation';
     $input_autoresponderenabled = new html_checkbox(array('name' => 'is_on_vacation', 'id' => $field_id, 'value' => 1));
     $out .= sprintf("<tr><th><label for=\"%s\">%s</label>:</th><td>%s%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('autoresponderenabled')), $input_autoresponderenabled->show($is_on_vacation ? 1 : 0), '');
     $field_id = 'vacation_start';
     $input_vacation_start = new html_inputfield(array('name' => 'vacation_start', 'id' => $field_id, 'maxlength' => 10, 'class' => 'text-long'));
     if ($vacation_start == '0000-00-00') {
         $vacation_start = '';
     } else {
         $vacation_start = preg_replace('/^(\\d\\d\\d\\d)-(\\d\\d)-(\\d\\d)$/', '$3.$2.$1', $vacation_start);
     }
     $out .= sprintf("<tr><th><label for=\"%s\">%s</label>:</th><td>%s%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('autoresponderstartdate')), $input_vacation_start->show($vacation_start), '');
     $field_id = 'vacation_end';
     $input_vacation_end = new html_inputfield(array('name' => 'vacation_end', 'id' => $field_id, 'maxlength' => 10, 'class' => 'text-long'));
     if ($vacation_end == '0000-00-00') {
         $vacation_end = '';
     } else {
         $vacation_end = preg_replace('/^(\\d\\d\\d\\d)-(\\d\\d)-(\\d\\d)$/', '$3.$2.$1', $vacation_end);
     }
     $out .= sprintf("<tr><th><label for=\"%s\">%s</label>:</th><td>%s%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('autoresponderenddate')), $input_vacation_end->show($vacation_end), '');
     $field_id = 'vacation_subj';
     $input_vacation_subj = new html_inputfield(array('name' => 'vacation_subj', 'id' => $field_id, 'maxlength' => 255, 'class' => 'text-long'));
     $out .= sprintf("<tr><th><label for=\"%s\">%s</label>:</th><td>%s%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('autorespondersubject')), $input_vacation_subj->show($vacation_subj), '<br /><span class="vboxadm-explanation">' . $this->gettext('autorespondersubjectexplanation') . '.</span>');
     $out .= '</table></td>';
     $out .= '<td><table class="vboxadm-settings" cellpadding="0" cellspacing="0">';
     $field_id = 'vacation_msg';
     $input_vacation_msg = new html_textarea(array('name' => 'vacation_msg', 'id' => $field_id, 'class' => 'textarea'));
     $out .= sprintf("<tr><th><label for=\"%s\">%s</label>:</th><td>%s%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('autorespondermessage')), $input_vacation_msg->show($vacation_msg), '<br /><span class="vboxadm-explanation">' . $this->gettext('autorespondermessageexplanation') . '</span>');
     $out .= '</table></td></tr></table>';
     $out .= '</div></fieldset>' . "\n\n";
     // ============================================================
     // Parameters
     $out .= '<table><tr><td>';
     $out .= '<fieldset><legend>' . $this->gettext('parameters') . '</legend>' . "\n";
     $out .= '<div class="fieldset-content">';
     $out .= '<table class="vboxadm-settings" cellpadding="0" cellspacing="0">';
     $field_id = 'max_msg_size';
     $input_messagesize = new html_inputfield(array('name' => 'max_msg_size', 'id' => $field_id, 'maxlength' => 16, 'class' => 'text-long'));
     if ($default_maxmsgsize == 0) {
         $default_maxmsgsize = $this->gettext('unlimited');
     } else {
         $default_maxmsgsize = $default_maxmsgsize . ' MB';
     }
     $out .= sprintf("<tr><th><label for=\"%s\">%s</label>:</th><td>%s%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('messagesize')), $input_messagesize->show($max_msg_size_mb), '<br /><span class="vboxadm-explanation">' . str_replace('%d', $active_domain, str_replace('%m', $default_maxmsgsize, $this->gettext('messagesizeexplanation'))) . '</span>');
     $out .= '</table>';
     $out .= '</div></fieldset>' . "\n\n";
     // ============================================================
     // Aliases
     if ($this->config['user_managed_aliases']) {
         // user can edit aliases for his mail address
         $out .= '<fieldset><legend>' . $this->gettext('aliases') . '</legend>' . "\n";
         $out .= '<div class="fieldset-content">';
         $out .= '<span class="vboxadm-explanation">' . $this->gettext('aliasesexplanation') . '</span>';
         $out .= '<table class="vboxadm-settings" cellpadding="0" cellspacing="0">';
         $field_id = 'alias_active';
         $input_alias_active = new html_checkbox(array('name' => 'alias_active', 'id' => $field_id, 'value' => 1));
         $out .= sprintf("<tr><th><label for=\"%s\">%s</label>:</th><td>%s%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('aliasesenabled')), $input_alias_active->show($alias_active ? 1 : 0), '');
         $field_id = 'alias_goto';
         $input_alias_goto = new html_inputfield(array('name' => 'alias_goto', 'id' => $field_id, 'maxlength' => 255, 'class' => 'text-long'));
         $out .= sprintf("<tr><th><label for=\"%s\">%s</label>:</th><td>%s%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('aliasaddresses')), $input_alias_goto->show($alias_goto), '');
         $out .= '</table>';
         $out .= '</div></fieldset>' . "\n\n";
     }
     // ============================================================
     $out .= '</td><td>';
     // =====================================================================================================
     // Password change
     $out .= '<fieldset><legend>' . $this->gettext('passwordchange') . '</legend>' . "\n";
     $out .= '<div class="fieldset-content">';
     $out .= '<p>' . $this->gettext('passwordcurrentexplanation') . '</p>';
     $out .= '<table class="vboxadm-settings" cellpadding="0" cellspacing="0">';
     $field_id = 'newpasswd';
     $input_passwordnew = new html_passwordfield(array('name' => '_newpasswd', 'id' => $field_id, 'class' => 'text-long', 'autocomplete' => 'off'));
     $out .= sprintf("<tr><th><label for=\"%s\">%s</label>:</th><td>%s%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('passwordnew')), $input_passwordnew->show(), '');
     $field_id = 'confpasswd';
     $input_passwordconf = new html_passwordfield(array('name' => '_confpasswd', 'id' => $field_id, 'class' => 'text-long', 'autocomplete' => 'off'));
     $out .= sprintf("<tr><th><label for=\"%s\">%s</label>:</th><td>%s%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('passwordconfirm')), $input_passwordconf->show(), '');
     $out .= '</table>';
     $out .= '</div></fieldset>' . "\n\n";
     // ============================================================
     $out .= '</td></tr></table>';
     // =====================================================================================================
     // Password
     $out .= '<fieldset><legend>' . $this->gettext('password') . '</legend>' . "\n";
     $out .= '<div class="fieldset-content">';
     $out .= '<p>' . $this->gettext('passwordexplanation') . '</p>';
     $out .= '<table class="vboxadm-settings" cellpadding="0" cellspacing="0">';
     $field_id = 'curpasswd';
     $input_passwordcurrent = new html_passwordfield(array('name' => '_curpasswd', 'id' => $field_id, 'class' => 'text-long', 'autocomplete' => 'off'));
     $out .= sprintf("<tr><th><label for=\"%s\">%s</label>:</th><td>%s%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('passwordcurrent')), $input_passwordcurrent->show(), '');
     $out .= '</table>';
     $out .= '</div></fieldset>' . "\n\n";
     // ============================================================
     $out .= html::p(null, $rcmail->output->button(array('command' => 'plugin.vboxadm-save', 'type' => 'input', 'class' => 'button mainaction', 'label' => 'save')));
     $rcmail->output->add_gui_object('vboxadmform', 'vboxadmform');
     $out = $rcmail->output->form_tag(array('id' => 'vboxadmform', 'class' => 'scroller', 'name' => 'vboxadmform', 'method' => 'post', 'action' => './?_task=settings&_action=plugin.vboxadm-save'), $out);
     $out = html::div(array('class' => 'settingsbox', 'style' => 'margin:0 0 15px 0;'), html::div(array('class' => 'boxtitle'), $this->gettext('accountadministration')) . html::div(array('style' => 'padding:15px'), $outtop . "\n" . $out . "\n" . $outbottom));
     return $out;
 }
 function gen_form()
 {
     $id = rcube_utils::get_input_value('_id', RCUBE_INPUT_GET);
     $this->rcmail_inst->output->add_label('ispconfig3_fetchmail.fetchmaildelconfirm');
     if ($id != '' || $id != 0) {
         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']));
             $mail_fetchmail = $this->soap->mail_fetchmail_get($session_id, $id);
             $this->soap->logout($session_id);
         } catch (SoapFault $e) {
             $this->rcmail_inst->output->command('display_message', 'Soap Error: ' . $e->getMessage(), 'error');
         }
         $enabled = $mail_fetchmail['active'];
         $delete = $mail_fetchmail['source_delete'];
         if ($mail_fetchmail['destination'] != $mail_user[0]['email']) {
             $this->rcmail_inst->output->command('display_message', 'Error: ' . $this->gettext('opnotpermitted'), 'error');
             $enabled = 'n';
             $delete = 'n';
             $mail_fetchmail['mailget_id'] = '';
             $mail_fetchmail['server_id'] = '';
             $mail_fetchmail['type'] = '';
             $mail_fetchmail['source_server'] = '';
             $mail_fetchmail['source_username'] = '';
             $mail_fetchmail['source_delete'] = '';
         }
     }
     if ($delete == 'y') {
         $delete = 1;
     } else {
         $delete = 0;
     }
     if ($enabled == 'y') {
         $enabled = 1;
     } else {
         $enabled = 0;
     }
     $this->rcmail_inst->output->set_env('framed', true);
     $out .= '<fieldset><legend>' . $this->gettext('acc_fetchmail') . '</legend>' . "\n";
     $hidden_id = new html_hiddenfield(array('name' => '_id', 'value' => $mail_fetchmail['mailget_id']));
     $out .= $hidden_id->show();
     $table = new html_table(array('cols' => 2, 'class' => 'propform'));
     $input_fetchmailtyp = new html_select(array('name' => '_fetchmailtyp', 'id' => 'fetchmailtyp'));
     $input_fetchmailtyp->add(array('POP3', 'IMAP', 'POP3 SSL', 'IMAP SSL'), array('pop3', 'imap', 'pop3ssl', 'imapssl'));
     $table->add('title', rcube_utils::rep_specialchars_output($this->gettext('fetchmailtyp')));
     $table->add('', $input_fetchmailtyp->show($mail_fetchmail['type']));
     $input_fetchmailserver = new html_inputfield(array('name' => '_fetchmailserver', 'id' => 'fetchmailserver', 'maxlength' => 320, 'size' => 40));
     $table->add('title', rcube_utils::rep_specialchars_output($this->gettext('fetchmailserver')));
     $table->add('', $input_fetchmailserver->show($mail_fetchmail['source_server']));
     $input_fetchmailuser = new html_inputfield(array('name' => '_fetchmailuser', 'id' => 'fetchmailuser', 'maxlength' => 320, 'size' => 40));
     $table->add('title', rcube_utils::rep_specialchars_output($this->gettext('username')));
     $table->add('', $input_fetchmailuser->show($mail_fetchmail['source_username']));
     $input_fetchmailpass = new html_passwordfield(array('name' => '_fetchmailpass', 'id' => 'fetchmailpass', 'maxlength' => 320, 'size' => 40, 'autocomplete' => 'off'));
     $table->add('title', rcube_utils::rep_specialchars_output($this->gettext('password')));
     $table->add('', $input_fetchmailpass->show($mail_fetchmail['source_password']));
     $input_fetchmaildelete = new html_checkbox(array('name' => '_fetchmaildelete', 'id' => 'fetchmaildelete', 'value' => '1'));
     $table->add('title', rcube_utils::rep_specialchars_output($this->gettext('fetchmaildelete')));
     $table->add('', $input_fetchmaildelete->show($delete));
     $input_fetchmailenabled = new html_checkbox(array('name' => '_fetchmailenabled', 'id' => 'fetchmailenabled', 'value' => '1'));
     $table->add('title', rcube_utils::rep_specialchars_output($this->gettext('fetchmailenabled')));
     $table->add('', $input_fetchmailenabled->show($enabled));
     $out .= $table->show();
     $out .= "</fieldset>\n";
     return $out;
 }
Exemplo n.º 11
0
 /**
  * GUI object 'loginform'
  * Returns code for the webmail login form
  *
  * @param array Named parameters
  * @return string HTML code for the gui object
  */
 private function login_form($attrib)
 {
     $default_host = $this->config['default_host'];
     $_SESSION['temp'] = true;
     // save original url
     $url = get_input_value('_url', RCUBE_INPUT_POST);
     if (empty($url) && !preg_match('/_(task|action)=logout/', $_SERVER['QUERY_STRING'])) {
         $url = $_SERVER['QUERY_STRING'];
     }
     $input_user = new html_inputfield(array('name' => '_user', 'id' => 'rcmloginuser') + $attrib);
     $input_pass = new html_passwordfield(array('name' => '_pass', 'id' => 'rcmloginpwd') + $attrib);
     $input_action = new html_hiddenfield(array('name' => '_action', 'value' => 'login'));
     $input_tzone = new html_hiddenfield(array('name' => '_timezone', 'id' => 'rcmlogintz', 'value' => '_default_'));
     $input_url = new html_hiddenfield(array('name' => '_url', 'id' => 'rcmloginurl', 'value' => $url));
     $input_host = null;
     if (is_array($default_host)) {
         $input_host = new html_select(array('name' => '_host', 'id' => 'rcmloginhost'));
         foreach ($default_host as $key => $value) {
             if (!is_array($value)) {
                 $input_host->add($value, is_numeric($key) ? $value : $key);
             } else {
                 $input_host = null;
                 break;
             }
         }
     } else {
         if (empty($default_host)) {
             $input_host = new html_inputfield(array('name' => '_host', 'id' => 'rcmloginhost') + $attrib);
         }
     }
     $form_name = !empty($attrib['form']) ? $attrib['form'] : 'form';
     $this->add_gui_object('loginform', $form_name);
     // create HTML table with two cols
     $table = new html_table(array('cols' => 2));
     $table->add('title', html::label('rcmloginuser', Q(rcube_label('username'))));
     $table->add(null, $input_user->show(get_input_value('_user', RCUBE_INPUT_POST)));
     $table->add('title', html::label('rcmloginpwd', Q(rcube_label('password'))));
     $table->add(null, $input_pass->show());
     // add host selection row
     if (is_object($input_host)) {
         $table->add('title', html::label('rcmloginhost', Q(rcube_label('server'))));
         $table->add(null, $input_host->show(get_input_value('_host', RCUBE_INPUT_POST)));
     }
     $out = $input_action->show();
     $out .= $input_tzone->show();
     $out .= $input_url->show();
     $out .= $table->show();
     // surround html output with a form tag
     if (empty($attrib['form'])) {
         $out = $this->form_tag(array('name' => $form_name, 'method' => "post"), $out);
     }
     return $out;
 }
Exemplo n.º 12
0
 /**
  * Callback function to produce driver-specific calendar create/edit form
  *
  * @param string Request action 'form-edit|form-new'
  * @param array  Calendar properties (e.g. id, color)
  * @param array  Edit form fields
  *
  * @return string HTML content of the form
  */
 public function calendar_form($action, $calendar, $formfields)
 {
     $cal_id = $calendar["id"];
     $props = $this->_get_ical_props($cal_id, self::OBJ_TYPE_ICAL);
     $protected = array();
     $preinstalled_calendars = $this->rc->config->get('calendar_preinstalled_calendars', array());
     foreach ($preinstalled_calendars as $idx => $properties) {
         if ($properties['driver'] == 'ical') {
             $url = str_replace('@', urlencode('@'), str_replace('%u', $this->rc->get_user_name(), $properties['ical_url']));
             if (stripos($props['url'], $url) === 0) {
                 $protected = $properties['protected'];
                 break;
             }
         }
     }
     if ($protected['name']) {
         $formfields['name'] = str_replace('<input ', '<input readonly="readonly" ', $formfields['name']);
     }
     if ($protected['color']) {
         unset($formfields['color']);
     }
     if ($protected['showalarms']) {
         $formfields['showalarms'] = str_replace('<input ', '<input disabled="disabled" ', $formfields['showalarms']);
     }
     if ($this->freebusy) {
         $enabled = $action == 'form-new' ? true : $this->calendars[$cal_id]['freebusy'];
         $readonly = array();
         if ($protected['freebusy']) {
             $readonly = array('disabled' => 'disabled');
         }
         $input_freebusy = new html_checkbox(array_merge(array("name" => "freebusy", "title" => $this->cal->gettext("allowfreebusy"), "id" => "chbox_freebusy", "value" => 1), $readonly));
         $formfields['freebusy'] = array("label" => $this->cal->gettext('freebusy'), "value" => $input_freebusy->show($enabled ? 1 : 0), "id" => "freebusy");
     }
     if (!$this->rc->config->get('calendar_disable_tasks', false)) {
         $enabled = $action == 'form-new' ? true : $this->calendars[$cal_id]['tasks'];
         $readonly = array();
         if ($protected['tasks']) {
             $readonly = array('disabled' => 'disabled');
         }
         $input_tasks = new html_checkbox(array_merge(array("name" => "tasks", "id" => "chbox_tasks", "value" => 1), $readonly));
         $formfields["tasks"] = array("label" => $this->cal->gettext("tasks"), "value" => $input_tasks->show($enabled ? 1 : 0), "id" => "tasks");
     }
     if ($protected['ical_url']) {
         $readonly = array('readonly' => 'readonly');
     } else {
         $readonly = array();
     }
     $input_ical_url = new html_inputfield(array_merge(array("name" => "ical_url", "id" => "ical_url_input", "size" => 45, "placeholder" => "http://dav.mydomain.tld/calendars/john.doh@mydomain.tld"), $readonly));
     $formfields["ical_url"] = array("label" => $this->cal->gettext("url"), "value" => $input_ical_url->show($props["url"]), "id" => "ical_url");
     $readonly = array();
     if ($protected['ical_user']) {
         $readonly = array('readonly' => 'readonly');
     }
     $input_ical_user = new html_inputfield(array_merge(array("name" => "ical_user", "id" => "ical_user_input", "size" => 30, "placeholder" => "*****@*****.**"), $readonly));
     $formfields["ical_user"] = array("label" => $this->cal->gettext("username"), "value" => $input_ical_user->show($props["user"]), "id" => "ical_user");
     $readonly = array();
     if ($protected['ical_pass']) {
         $readonly = array('readonly' => 'readonly');
     }
     $input_ical_pass = new html_passwordfield(array_merge(array("name" => "ical_pass", "id" => "ical_pass_input", "size" => 30, "placeholder" => "******"), $readonly));
     $formfields["ical_pass"] = array("label" => $this->cal->gettext("password"), "value" => $input_ical_pass->show(null), "id" => "ical_pass");
     $readonly = array();
     if ($protected['sync']) {
         $readonly = array('disabled' => 'disabled');
     }
     $field_id = 'sync_interval_select';
     $select = new html_select(array_merge(array('name' => 'sync', 'id' => $field_id), $readonly));
     $intervals = array(5 => 5, 10 => 10, 15 => 15, 30 => 30, 45 => 45, 60 => 60, 90 => 90, 120 => 120, 1800 => 1800, 3600 => 3600);
     foreach ($intervals as $interval => $text) {
         $select->add($text, $interval);
     }
     $formfields["sync_interval"] = array("label" => $this->cal->gettext("sync_interval"), "value" => $select->show((int) ($props["sync"] ? $props['sync'] : 60)) . '&nbsp;' . $this->cal->gettext('minute_s'), "id" => "sync_interval");
     return parent::calendar_form($action, $calendar, $formfields);
 }
Exemplo n.º 13
0
 /**
  * Hook: prepare the new sections HTML for the settings page.
  */
 function user_preferences($args)
 {
     $RCMAIL = rcmail::get_instance();
     if ($args['section'] == 'vacation' && $RCMAIL->config->get('qmailadmin_allow_vacation')) {
         $config = $RCMAIL->config->all();
         $blocks = array('main' => array('name' => Q(rcube_label('mainoptions'))));
         // Vacation enabled?
         $field_id = 'vacation_enabled';
         $input_vacation_enabled = new html_checkbox(array('name' => '_vacation_enabled', 'id' => $field_id, 'value' => 1));
         $blocks['main']['options']['vacation_enabled'] = array('title' => html::label($field_id, rcube::Q($this->gettext('autoresponderenabled'))), 'content' => $input_vacation_enabled->show($config['vacation_enabled'] ? 1 : 0));
         // Vacation message subject
         $field_id = 'vacation_subject';
         $input_vacation_subject = new html_inputfield(array('name' => '_vacation_subject', 'id' => $field_id, 'size' => '80'));
         $blocks['main']['options']['vacation_subject'] = array('title' => html::label($field_id, rcube::Q($this->gettext('subject'))), 'content' => $input_vacation_subject->show($config['vacation_subject']));
         // Vacation message
         $field_id = 'vacation_message';
         $input_vacation_message = new html_textarea(array('name' => '_vacation_message', 'id' => $field_id, 'cols' => 80, 'rows' => 15));
         $blocks['main']['options']['vacation_message'] = array('title' => html::label($field_id, rcube::Q($this->gettext('message'))), 'content' => $input_vacation_message->show($config['vacation_message']));
         $args['blocks'] = $blocks;
     } else {
         if ($args['section'] == 'password' && $RCMAIL->config->get('qmailadmin_allow_password')) {
             $blocks = array('main' => array('name' => Q(rcube_label('mainoptions'))), 'explanation' => array('name' => Q($this->gettext('qmail_password_explanation'))));
             // Old password
             $field_id = 'password_old';
             $input_password_old = new html_passwordfield(array('name' => '_password_old', 'id' => $field_id, 'size' => '20'));
             $blocks['main']['options']['password_old'] = array('title' => html::label($field_id, rcube::Q($this->gettext('oldpassword'))), 'content' => $input_password_old->show());
             // New password 1
             $field_id = 'password_new1';
             $input_password_new1 = new html_passwordfield(array('name' => '_password_new1', 'id' => $field_id, 'size' => '20'));
             $blocks['main']['options']['password_new1'] = array('title' => html::label($field_id, rcube::Q($this->gettext('newpassword'))), 'content' => $input_password_new1->show());
             // New password 2
             $field_id = 'password_new2';
             $input_password_new2 = new html_passwordfield(array('name' => '_password_new2', 'id' => $field_id, 'size' => '20'));
             $blocks['main']['options']['password_new2'] = array('title' => html::label($field_id, rcube::Q($this->gettext('newpassword2'))), 'content' => $input_password_new2->show());
             // Password requisites explanation
             $blocks['explanation']['options']['password_explanation1'] = array('title' => html::label('password_explanation1', rcube::Q($this->gettext('password_explanation1a')) . ' ' . $RCMAIL->config->get('qmailadmin_password_min_length') . ' ' . rcube::Q($this->gettext('password_explanation1b')) . ' ' . $RCMAIL->config->get('qmailadmin_password_max_length') . ' ' . rcube::Q($this->gettext('password_explanation1c') . '. ')), 'content' => '');
             if ($RCMAIL->config->get('qmailadmin_password_lower_need') || $RCMAIL->config->get('qmailadmin_password_upper_need') || $RCMAIL->config->get('qmailadmin_password_number_need') || $RCMAIL->config->get('qmailadmin_password_special_need')) {
                 $blocks['explanation']['options']['password_explanation2'] = array('title' => html::label('password_explanation2', rcube::Q($this->gettext('password_explanation2'))), 'content' => '');
             }
             if (!$RCMAIL->config->get('qmailadmin_password_lower_need') && !$RCMAIL->config->get('qmailadmin_password_upper_need')) {
                 $blocks['explanation']['options']['password_explanation3'] = array('title' => html::label('password_explanation3', '* ' . rcube::Q($this->gettext('password_explanation3')) . '; '), 'content' => '');
             }
             if ($RCMAIL->config->get('qmailadmin_password_lower_need')) {
                 $blocks['explanation']['options']['password_explanation4'] = array('title' => html::label('password_explanation4', '* ' . rcube::Q($this->gettext('password_explanation4')) . '; '), 'content' => '');
             }
             if ($RCMAIL->config->get('qmailadmin_password_upper_need')) {
                 $blocks['explanation']['options']['password_explanation5'] = array('title' => html::label('password_explanation5', '* ' . rcube::Q($this->gettext('password_explanation5')) . '; '), 'content' => '');
             }
             if ($RCMAIL->config->get('qmailadmin_password_number_need')) {
                 $blocks['explanation']['options']['password_explanation6'] = array('title' => html::label('password_explanation6', '* ' . rcube::Q($this->gettext('password_explanation6')) . '; '), 'content' => '');
             }
             if ($RCMAIL->config->get('qmailadmin_password_special_need')) {
                 $blocks['explanation']['options']['password_explanation7'] = array('title' => html::label('password_explanation7', '* ' . rcube::Q($this->gettext('password_explanation7')) . ' "' . $RCMAIL->config->get('qmailadmin_password_special_chars') . '"; '), 'content' => '');
             }
             $args['blocks'] = $blocks;
         }
     }
     return $args;
 }
Exemplo n.º 14
0
 /**
  * Callback function to produce driver-specific calendar create/edit form
  *
  * @param string Request action 'form-edit|form-new'
  * @param array  Calendar properties (e.g. id, color)
  * @param array  Edit form fields
  *
  * @return string HTML content of the form
  */
 public function calendar_form($action, $calendar, $formfields)
 {
     $cal_id = $calendar['id'];
     $props = $this->_get_caldav_props($cal_id, self::OBJ_TYPE_VCAL);
     $protected = array();
     $preinstalled_calendars = $this->rc->config->get('calendar_preinstalled_calendars', array());
     foreach ($preinstalled_calendars as $idx => $properties) {
         if ($properties['driver'] == 'caldav') {
             $url = str_replace('@', urlencode('@'), str_replace('%u', $this->rc->get_user_name(), $properties['caldav_url']));
             if (stripos($props['url'], $url) === 0) {
                 $protected = $properties['protected'];
                 break;
             }
         }
     }
     if ($protected['name']) {
         $formfields['name'] = str_replace('<input ', '<input readonly="readonly" ', $formfields['name']);
     }
     if ($protected['color']) {
         unset($formfields['color']);
     }
     if ($protected['showalarms']) {
         $formfields['showalarms'] = str_replace('<input ', '<input disabled="disabled" ', $formfields['showalarms']);
     }
     if ($this->freebusy) {
         $enabled = $action == 'form-new' ? true : $this->calendars[$cal_id]['freebusy'];
         $readonly = array();
         if ($protected['freebusy']) {
             $readonly = array('disabled' => 'disabled');
         }
         $input_freebusy = new html_checkbox(array_merge(array("name" => "freebusy", "title" => $this->cal->gettext("allowfreebusy"), "id" => "chbox_freebusy", "value" => 1), $readonly));
         $formfields['freebusy'] = array("label" => $this->cal->gettext('freebusy'), "value" => $input_freebusy->show($enabled ? 1 : 0), "id" => "freebusy");
     }
     $enabled = $action == 'form-new' ? true : $this->calendars[$cal_id]['evts'];
     $readonly = array();
     if ($protected['events']) {
         $readonly = array('disabled' => 'disabled');
     }
     $input_events = new html_checkbox(array_merge(array("name" => "events", "id" => "chbox_events", "value" => 1), $readonly));
     $formfields["events"] = array("label" => $this->cal->gettext('events'), "value" => $input_events->show($enabled ? 1 : 0), "id" => "events");
     if (!$this->rc->config->get('calendar_disable_tasks', false)) {
         $enabled = $action == 'form-new' ? true : $this->calendars[$cal_id]['tasks'];
         $readonly = array();
         if ($protected['tasks']) {
             $readonly = array('disabled' => 'disabled');
         }
         $input_tasks = new html_checkbox(array_merge(array("name" => "tasks", "id" => "chbox_tasks", "value" => 1), $readonly));
         $formfields["tasks"] = array("label" => $this->cal->gettext("tasks"), "value" => $input_tasks->show($enabled ? 1 : 0), "id" => "tasks");
     }
     if (!isset($formfields['caldav_url'])) {
         $readonly = array();
         if (stripos($props['url'], 'https://apidata.googleusercontent.com/caldav/v2/') === 0 || $protected['caldav_url']) {
             $readonly = array('readonly' => 'readonly');
         }
         $input_caldav_url = new html_inputfield(array_merge(array("name" => "caldav_url", "id" => "caldav_url_input", "size" => 45, "placeholder" => "http://dav.mydomain.tld/calendars/john.doh@mydomain.tld"), $readonly));
         $formfields["caldav_url"] = array("label" => $this->cal->gettext("url"), "value" => $input_caldav_url->show($props["url"]), "id" => "caldav_url");
     }
     if (!isset($formfields['caldav_user'])) {
         $readonly = array();
         if (stripos($props['url'], 'https://apidata.googleusercontent.com/caldav/v2/') === 0 || $protected['caldav_user']) {
             $readonly = array('readonly' => 'readonly');
         }
         $input_caldav_user = new html_inputfield(array_merge(array("name" => "caldav_user", "id" => "caldav_user_input", "size" => 30, "placeholder" => "*****@*****.**"), $readonly));
         $formfields["caldav_user"] = array("label" => $this->cal->gettext("username"), "value" => $input_caldav_user->show($props["user"]), "id" => "caldav_user");
     }
     if (!isset($formfields['caldav_pass'])) {
         $readonly = array();
         if (stripos($props['url'], 'https://apidata.googleusercontent.com/caldav/v2/') === 0 || $protected['caldav_pass']) {
             $readonly = array('readonly' => 'readonly');
         }
         $input_caldav_pass = new html_passwordfield(array_merge(array("name" => "caldav_pass", "id" => "caldav_pass_input", "size" => 30, "placeholder" => "******"), $readonly));
         $formfields["caldav_pass"] = array("label" => $this->cal->gettext("password"), "value" => $input_caldav_pass->show(null), "id" => "caldav_pass");
     }
     if (!isset($formfields['authtype'])) {
         $readonly = array();
         if (stripos($props['url'], 'https://apidata.googleusercontent.com/caldav/v2/') === 0 || $protected['authtype']) {
             $readonly = array('disabled' => 'disabled');
         }
         $field_id = 'authtype_select';
         $select = new html_select(array_merge(array('name' => 'authtype', 'id' => $field_id), $readonly));
         $types = array('detect' => 'detect', 'basic' => 'basic', 'digest' => 'digest');
         foreach ($types as $type => $text) {
             $select->add($this->cal->gettext('libgpl.' . $text), $type);
         }
         $formfields['authtype'] = array('label' => $this->cal->gettext('libgpl.authtype'), 'value' => $select->show($props['authtype'] ? $props['authtype'] : 'detect'), 'id' => 'sync_interval');
     }
     if (!isset($formfields['sync_interval'])) {
         $readonly = array();
         if ($protected['sync']) {
             $readonly = array('disabled' => 'disabled');
         }
         $field_id = 'sync_interval_select';
         $select = new html_select(array_merge(array('name' => 'sync', 'id' => $field_id), $readonly));
         $intervals = array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 10 => 10, 15 => 15, 30 => 30, 45 => 45, 60 => 60);
         foreach ($intervals as $interval => $text) {
             $select->add($text, $interval);
         }
         $formfields['sync_interval'] = array('label' => $this->cal->gettext('sync_interval'), 'value' => $select->show((int) ($props['sync'] ? $props['sync'] : 5)) . '&nbsp;' . $this->cal->gettext('minute_s'), 'id' => 'sync_interval');
     }
     foreach ($formfields as $key => $val) {
         if (empty($val)) {
             unset($formfields[$key]);
         }
     }
     return parent::calendar_form($action, $calendar, $formfields);
 }
 /**
  * Generate the add / edit account form
  * @param type $attrib
  * @return string html of the form
  */
 function gen_form($attrib)
 {
     require_once dirname(__FILE__) . '/includes/fetchMailRc.php';
     $fetchmail_rc_id = get_input_value('_fetchmail_rc_id', RCUBE_INPUT_GET);
     $fetchmailDatas = new fetchMailRc($fetchmail_rc_id);
     // Show hidden input with the id
     $hidden_id = new html_hiddenfield(array("id" => "_fetchmail_rc_id", "name" => "_fetchmail_rc_id", "value" => $fetchmail_rc_id));
     $formToReturn .= '<form action="" id="fetchmail_rc_form" class="propform"><fieldset><legend>' . $this->gettext("configuration") . '</legend>' . ($formToReturn .= $hidden_id->show());
     $formToReturn .= '<table class="propform">';
     // Mail host
     $field_name = "_mail_host";
     $formToReturn .= '<tr><td class="title">' . html::label($field_name, Q($this->gettext('mail_host'))) . ' <span class="required">*</span></td><td>';
     $input_name = new html_inputfield(array('name' => $field_name, 'id' => $field_name, 'value' => $fetchmailDatas->get_mail_host()));
     $formToReturn .= $input_name->show() . "</td></tr>";
     // Mail host
     $field_name = "_mail_ssl";
     $formToReturn .= '<tr><td class="title">' . html::label($field_name, Q($this->gettext('mail_ssl'))) . '</td><td>';
     $input_ssl = new html_checkbox(array('name' => $field_name, 'id' => $field_name, "value" => 1));
     $formToReturn .= $input_ssl->show($fetchmailDatas->get_mail_ssl()) . "</td></tr>";
     // Mail Login
     $field_name = "_mail_username";
     $formToReturn .= '<tr><td class="title">' . html::label($field_name, Q($this->gettext('mail_username'))) . ' <span class="required">*</span></td><td>';
     $input_username = new html_inputfield(array('name' => $field_name, 'id' => $field_name, 'value' => $fetchmailDatas->get_mail_username()));
     $formToReturn .= $input_username->show() . "</td></tr>";
     // Mail password
     $field_name = "_mail_password";
     $formToReturn .= '<tr><td class="title">' . html::label($field_name, Q($this->gettext('mail_password'))) . ' <span class="required">*</span></td><td>';
     $input_password = new html_passwordfield(array('name' => $field_name, 'id' => $field_name));
     $formToReturn .= $input_password->show() . "</td></tr>";
     // Mail arguments
     $field_name = "_mail_arguments";
     $formToReturn .= '<tr><td class="title">' . html::label($field_name, Q($this->gettext('mail_arguments'))) . '</td><td>';
     $input_arguments = new html_inputfield(array('name' => $field_name, 'id' => $field_name, 'value' => $fetchmailDatas->get_mail_arguments()));
     $formToReturn .= $input_arguments->show() . "</td></tr>";
     // Mail protocol
     $field_name = "_mail_protocol";
     $formToReturn .= '<tr><td class="title">' . html::label($field_name, Q($this->gettext('mail_protocol'))) . ' <span class="required">*</span></td><td>';
     $input_protocol = new html_select(array('name' => $field_name, 'id' => $field_name));
     $input_protocol->add(fetchMailRc::PROTOCOL_AUTO, fetchMailRc::PROTOCOL_AUTO);
     $input_protocol->add(fetchMailRc::PROTOCOL_IMAP, fetchMailRc::PROTOCOL_IMAP);
     $input_protocol->add(fetchMailRc::PROTOCOL_POP2, fetchMailRc::PROTOCOL_POP2);
     $input_protocol->add(fetchMailRc::PROTOCOL_POP3, fetchMailRc::PROTOCOL_POP3);
     $formToReturn .= $input_protocol->show($fetchmailDatas->get_mail_protocol()) . "</td></tr>";
     // Mail disabled
     $field_name = "_mail_disabled";
     $formToReturn .= '<tr><td class="title">' . html::label($field_name, Q($this->gettext('mail_disabled'))) . '</td><td>';
     $input_enabled = new html_checkbox(array('name' => $field_name, 'id' => $field_name, "value" => 1));
     if ($fetchmail_rc_id) {
         $formToReturn .= $input_enabled->show(!$fetchmailDatas->get_enabled()) . "</td></tr>";
     } else {
         $formToReturn .= $input_enabled->show(0) . "</td></tr>";
     }
     $formToReturn .= "</table></fieldset>";
     // Show the test and debug block
     $formToReturn .= "<fieldset>";
     $formToReturn .= "<legend>" . $this->gettext("accountstatus") . "</legend>";
     $formToReturn .= '<table class="propform">';
     $formToReturn .= '<tr>';
     $formToReturn .= '<td class="title">' . $this->gettext("lastimport") . "</td>";
     $formToReturn .= "<td>" . $fetchmailDatas->get_date_last_retrieve() . "</td>";
     $formToReturn .= "</tr>";
     $formToReturn .= '<tr>';
     $formToReturn .= '<td class="title">' . $this->gettext("status") . "</td>";
     $statusMessage = $this->gettext("status_successful");
     if ($fetchmailDatas->get_count_errors() > 0) {
         $statusMessage = "<b>" . $this->gettext("errorlabel") . "</b> : " . $fetchmailDatas->get_last_error() . "<br />";
         $statusMessage .= "<b>" . $this->gettext("nbconsecutiveserrors") . "</b> : " . $fetchmailDatas->get_count_errors();
     }
     $formToReturn .= "<td>" . ($fetchmailDatas->get_date_last_retrieve() == "0000-00-00 00:00:00" ? $this->gettext("notalreadyautoimported") : $statusMessage) . "</td>";
     $formToReturn .= "</tr>";
     $formToReturn .= '<tr>';
     $formToReturn .= '<td class="title">' . $this->gettext("testaccount") . '</td>';
     $formToReturn .= '<td><a href="javascript:;" onclick="return rcmail.command(\'plugin.fetchmail_rc.test_account\',\'\',this)">' . $this->gettext("testaccount") . '</a></td>';
     $formToReturn .= '</tr>';
     $formToReturn .= '<tr>';
     $formToReturn .= '<td class="title">' . $this->gettext("forceretrieve") . '</td>';
     $formToReturn .= '<td><a href="javascript:;" onclick="return rcmail.command(\'plugin.fetchmail_rc.forceretrieve\',\'\',this)">' . $this->gettext("forceretrieve") . '</a></td>';
     $formToReturn .= '</tr>';
     $formToReturn .= "</table>";
     $formToReturn .= "</fieldset>";
     $formToReturn .= "</form>";
     return $formToReturn;
 }
Exemplo n.º 16
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);
 }
 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;
 }
Exemplo n.º 18
0
 function veximaccountadmin_form()
 {
     $rcmail = rcmail::get_instance();
     $this->_load_config();
     // add labels to client - to be used in JS alerts
     $rcmail->output->add_label('veximaccountadmin.enterallpassfields', 'veximaccountadmin.passwordinconsistency', 'veximaccountadmin.autoresponderlong', 'veximaccountadmin.autoresponderlongnum', 'veximaccountadmin.autoresponderlongmax', 'veximaccountadmin.headerblockdelete', 'veximaccountadmin.headerblockdeleteall', 'veximaccountadmin.headerblockexists', 'veximaccountadmin.headerblockentervalue');
     $rcmail->output->set_env('product_name', $rcmail->config->get('product_name'));
     $settings = $this->_get_configuration();
     $on_avscan = $settings['on_avscan'];
     $on_spamassassin = $settings['on_spamassassin'];
     $sa_tag = $settings['sa_tag'];
     $sa_refuse = $settings['sa_refuse'];
     $spam_drop = $settings['spam_drop'];
     $on_vacation = $settings['on_vacation'];
     $vacation = $settings['vacation'];
     $on_forward = $settings['on_forward'];
     $forward = $settings['forward'];
     $unseen = $settings['unseen'];
     $maxmsgsize = $settings['maxmsgsize'];
     $user_id = $settings['user_id'];
     $domain_id = $settings['domain_id'];
     $domain_settings = $this->_get_domain_configuration($domain_id);
     $default_sa_tag = $domain_settings['sa_tag'];
     $default_sa_refuse = $domain_settings['sa_refuse'];
     $default_maxmsgsize = $domain_settings['maxmsgsize'];
     $active_domain = $domain_settings['domain'];
     $rcmail->output->set_env('vacation_maxlength', $this->config['vexim_vacation_maxlength']);
     $out .= '<p class="introtext">' . $this->gettext('introtext') . '</p>' . "\n";
     if ($this->config['show_admin_link'] == true and $settings['admin'] == true) {
         $out .= '<p class="adminlink">';
         $out .= sprintf($this->gettext('adminlinktext'), '<a href="' . $this->config['vexim_url'] . '" target="_blank">', '</a>');
         $out .= "</p>\n";
     }
     // =====================================================================================================
     // Password
     $out .= '<fieldset><legend>' . $this->gettext('password') . '</legend>' . "\n";
     $out .= '<div class="fieldset-content">';
     $out .= '<p>' . $this->gettext('passwordcurrentexplanation') . '</p>';
     $out .= '<table class="vexim-settings" cellpadding="0" cellspacing="0">';
     $field_id = 'curpasswd';
     $input_passwordcurrent = new html_passwordfield(array('name' => '_curpasswd', 'id' => $field_id, 'class' => 'text-long', 'autocomplete' => 'off'));
     $out .= sprintf("<tr><th><label for=\"%s\">%s</label>:</th><td>%s%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('passwordcurrent')), $input_passwordcurrent->show(), '');
     $field_id = 'newpasswd';
     $input_passwordnew = new html_passwordfield(array('name' => '_newpasswd', 'id' => $field_id, 'class' => 'text-long', 'autocomplete' => 'off'));
     $out .= sprintf("<tr><th><label for=\"%s\">%s</label>:</th><td>%s%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('passwordnew')), $input_passwordnew->show(), '');
     $field_id = 'confpasswd';
     $input_passwordconf = new html_passwordfield(array('name' => '_confpasswd', 'id' => $field_id, 'class' => 'text-long', 'autocomplete' => 'off'));
     $out .= sprintf("<tr><th><label for=\"%s\">%s</label>:</th><td>%s%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('passwordconfirm')), $input_passwordconf->show(), '');
     $out .= '</table>';
     $out .= '</div></fieldset>' . "\n\n";
     // =====================================================================================================
     // Spam/Virus
     $out .= '<fieldset><legend>' . $this->gettext('spamvirus') . '</legend>' . "\n";
     $out .= '<div class="fieldset-content">';
     $out .= '<table class="vexim-settings" cellpadding="0" cellspacing="0">';
     $field_id = 'on_avscan';
     $input_virusenabled = new html_checkbox(array('name' => 'on_avscan', 'id' => $field_id, 'value' => 1));
     $out .= sprintf("<tr><th><label for=\"%s\">%s</label>:</th><td>%s%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('virusenabled')), $input_virusenabled->show($on_avscan ? 1 : 0), '<br /><span class="vexim-explanation">' . $this->gettext('virusenabledexplanation') . '</span>');
     $field_id = 'on_spamassassin';
     $input_spamenabled = new html_checkbox(array('name' => 'on_spamassassin', 'id' => $field_id, 'value' => 1));
     $out .= sprintf("<tr><th><label for=\"%s\">%s</label>:</th><td>%s%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('spamenabled')), $input_spamenabled->show($on_spamassassin ? 1 : 0), '<br /><span class="vexim-explanation">' . $this->gettext('spamenabledexplanation') . '</span>');
     $field_id = 'sa_tag';
     $input_spamscoretag = new html_select(array('name' => 'sa_tag', 'id' => $field_id, 'class' => 'select'));
     $decPlaces = 0;
     $found_number = false;
     for ($i = 1; $i <= 20; $i = $i + 1) {
         $i = number_format($i, $decPlaces);
         $input_spamscoretag->add($i, $i);
         if ($sa_tag == $i) {
             $found_number = true;
         }
     }
     for ($i = 25; $i <= 100; $i = $i + 5) {
         $i = number_format($i, $decPlaces);
         $input_spamscoretag->add($i, $i);
         if ($sa_tag == $i) {
             $found_number = true;
         }
     }
     // If the value from database cannot be choosed among the list we present,
     // add it to the end of the list. This may happen because Vexim lets the
     // user write in a number in a textbox.
     if (!$found_number) {
         $input_spamscoretag->add($sa_tag, $sa_tag);
     }
     $out .= sprintf("<tr><th><label for=\"%s\">%s</label>:</th><td>%s%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('spamscoretag')), $input_spamscoretag->show($sa_tag), '<br /><span class="vexim-explanation">' . $this->gettext('spamscoretagexplanation') . '. <span class="sameline">' . $this->gettext('domaindefault') . ': ' . $default_sa_tag . '.</span></span>');
     $field_id = 'sa_refuse';
     $input_spamscorerefuse = new html_select(array('name' => 'sa_refuse', 'id' => $field_id, 'class' => 'select'));
     $found_number = false;
     for ($i = 1; $i <= 20; $i = $i + 1) {
         $i = number_format($i, $decPlaces);
         $input_spamscorerefuse->add($i, $i);
         if ($sa_refuse == $i) {
             $found_number = true;
         }
     }
     for ($i = 25; $i <= 200; $i = $i + 5) {
         $i = number_format($i, $decPlaces);
         $input_spamscorerefuse->add($i, $i);
         if ($sa_refuse == $i) {
             $found_number = true;
         }
     }
     for ($i = 300; $i <= 900; $i = $i + 100) {
         $i = number_format($i, $decPlaces);
         $input_spamscorerefuse->add($i, $i);
         if ($sa_refuse == $i) {
             $found_number = true;
         }
     }
     $i = number_format(999, $decPlaces);
     $input_spamscorerefuse->add($i, $i);
     if ($sa_refuse == $i) {
         $found_number = true;
     }
     // If the value from database cannot be choosed among the list we present,
     // add it to the end of the list. This may happen because Vexim lets the
     // user write in a number in a textbox.
     if (!$found_number) {
         $input_spamscorerefuse->add($sa_refuse, $sa_refuse);
     }
     $out .= sprintf("<tr><th><label for=\"%s\">%s</label>:</th><td>%s%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('spamscorerefuse')), $input_spamscorerefuse->show($sa_refuse), '<br /><span class="vexim-explanation">' . $this->gettext('spamscorerefuseexplanation') . '. <span class="sameline">' . $this->gettext('domaindefault') . ': ' . $default_sa_refuse . '.</span></span>');
     $spammoveexplanation = '<br /><span class="vexim-explanation">' . str_replace("%italicstart", "<i>", str_replace("%italicend", "</i>", $this->gettext('spammoveexplanation_part1')));
     if ($this->config['parsefolders_script']) {
         $spammoveexplanation .= ' ' . $this->gettext('spammoveexplanation_part2');
     }
     $spammoveexplanation .= ' ' . $this->gettext('spammoveexplanation_part3');
     $field_id = 'spam_drop';
     $input_spammove = new html_checkbox(array('name' => 'spam_drop', 'id' => $field_id, 'value' => 1));
     $out .= sprintf("<tr><th><label for=\"%s\">%s</label>:</th><td>%s%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('spammove')), $input_spammove->show($spam_drop ? 1 : 0), $spammoveexplanation);
     $out .= '</table>';
     if ($this->config['parsefolders_script'] and $this->config['parsefolders_script_show_tip']) {
         $out .= '<p class="vexim-explanation">' . str_replace('%italicstart', '<i>', str_replace('%italicend', '</i>', $this->gettext('spamtip'))) . '</p>';
     }
     $out .= '</div></fieldset>' . "\n\n";
     // =====================================================================================================
     // Autoresponder
     $out .= '<fieldset><legend>' . $this->gettext('autoresponder') . '</legend>' . "\n";
     $out .= '<div class="fieldset-content">';
     $out .= '<table class="vexim-settings" cellpadding="0" cellspacing="0">';
     $field_id = 'on_vacation';
     $input_autoresponderenabled = new html_checkbox(array('name' => 'on_vacation', 'id' => $field_id, 'value' => 1));
     $out .= sprintf("<tr><th><label for=\"%s\">%s</label>:</th><td>%s%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('autoresponderenabled')), $input_autoresponderenabled->show($on_vacation ? 1 : 0), '');
     $field_id = 'vacation';
     $input_autorespondermessage = new html_textarea(array('name' => 'vacation', 'id' => $field_id, 'class' => 'textarea'));
     $out .= sprintf("<tr><th><label for=\"%s\">%s</label>:</th><td>%s%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('autorespondermessage')), $input_autorespondermessage->show($vacation), '<br /><span class="vexim-explanation">' . $this->gettext('autorespondermessageexplanation') . '</span>');
     $out .= '</table>';
     $out .= '</div></fieldset>' . "\n\n";
     // =====================================================================================================
     // Forward
     $out .= '<fieldset><legend>' . $this->gettext('forwarding') . '</legend>' . "\n";
     $out .= '<div class="fieldset-content">';
     $out .= '<table class="vexim-settings" cellpadding="0" cellspacing="0">';
     $field_id = 'on_forward';
     $input_forwardingenabled = new html_checkbox(array('name' => 'on_forward', 'id' => $field_id, 'value' => 1));
     $out .= sprintf("<tr><th><label for=\"%s\">%s</label>:</th><td>%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('forwardingenabled')), $input_forwardingenabled->show($on_forward ? 1 : 0));
     $field_id = 'forward';
     $input_forwardingaddress = new html_inputfield(array('name' => 'forward', 'id' => $field_id, 'maxlength' => 255, 'class' => 'text-long'));
     $out .= sprintf("<tr><th><label for=\"%s\">%s</label>:</th><td>%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('forwardingaddress')), $input_forwardingaddress->show($forward));
     $field_id = 'unseen';
     $input_forwardinglocal = new html_checkbox(array('name' => 'unseen', 'id' => $field_id, 'value' => 1));
     $out .= sprintf("<tr><th><label for=\"%s\">%s</label>:</th><td>%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('forwardinglocal')), $input_forwardinglocal->show($unseen ? 1 : 0));
     $out .= '</table>';
     $out .= '</div></fieldset>' . "\n\n";
     // =====================================================================================================
     // Header blocks (based on code from Philip Weir's sauserprefs plugin
     //                http://roundcube.net/plugins/sauserprefs)
     $out .= '<fieldset><legend>' . $this->gettext('blockbyheader') . '</legend>' . "\n";
     $out .= '<div class="fieldset-content">';
     $out .= '<p>' . $this->gettext('blockbyheaderexplanation') . '</p>';
     $table = new html_table(array('class' => 'headerblockprefstable', 'cols' => 3));
     $field_id = 'rcmfd_headerblockrule';
     $input_headerblockrule = new html_select(array('name' => '_headerblockrule', 'id' => $field_id));
     $input_headerblockrule->add($this->gettext('headerfrom'), 'From');
     $input_headerblockrule->add($this->gettext('headerto'), 'To');
     $input_headerblockrule->add($this->gettext('headersubject'), 'Subject');
     $input_headerblockrule->add($this->gettext('headerxmailer'), 'X-Mailer');
     $field_id = 'rcmfd_headerblockvalue';
     $input_headerblockvalue = new html_inputfield(array('name' => '_headerblockvalue', 'id' => $field_id, 'style' => 'width:270px;'));
     $field_id = 'rcmbtn_add_address';
     $button_addaddress = $this->api->output->button(array('command' => 'plugin.veximaccountadmin.headerblock_add', 'type' => 'input', 'class' => 'button', 'label' => 'veximaccountadmin.addrule', 'style' => 'width: 130px;'));
     $table->add(null, $input_headerblockrule->show());
     $table->add(null, $input_headerblockvalue->show());
     $table->add(array('align' => 'right'), $button_addaddress);
     $delete_all = $this->api->output->button(array('command' => 'plugin.veximaccountadmin.headerblock_delete_all', 'type' => 'link', 'label' => 'veximaccountadmin.deleteall'));
     $table->add(array('colspan' => 3, 'id' => 'listcontrols'), $delete_all);
     $table->add_row();
     $address_table = new html_table(array('id' => 'headerblock-rules-table', 'class' => 'records-table', 'cellspacing' => '0', 'cols' => 3));
     $address_table->add_header(array('width' => '120px'), $this->gettext('field'));
     $address_table->add_header(null, $this->gettext('value'));
     $address_table->add_header(array('width' => '40px'), '&nbsp;');
     $this->_address_row($address_table, null, null, $attrib);
     // Get the header rules from DB. Should probably be put in a function.
     $this->_load_config();
     $this->_db_connect('r');
     $sql_result = $this->db->query("SELECT blockhdr, blockval \r\n\t\t   FROM   blocklists\r\n\t\t   WHERE  user_id = '{$user_id}'\r\n\t\t   AND    domain_id = '{$domain_id}'\r\n\t\t   ORDER BY block_id;");
     if ($sql_result && $this->db->num_rows($sql_result) > 0) {
         $norules = 'display: none;';
     }
     $address_table->set_row_attribs(array('style' => $norules));
     $address_table->add(array('colspan' => '3'), rep_specialchars_output($this->gettext('noaddressrules')));
     $address_table->add_row();
     $this->api->output->set_env('address_rule_count', $this->db->num_rows());
     while ($sql_result && ($sql_arr = $this->db->fetch_assoc($sql_result))) {
         $field = $sql_arr['blockhdr'];
         $value = $sql_arr['blockval'];
         $this->_address_row($address_table, $field, $value, $attrib);
     }
     $table->add(array('colspan' => 3), html::div(array('id' => 'headerblock-rules-cont'), $address_table->show()));
     $table->add_row();
     if ($table->size()) {
         $out .= $table->show();
     }
     $out .= '</div></fieldset>' . "\n\n";
     // =====================================================================================================
     // Parameters
     $out .= '<fieldset><legend>' . $this->gettext('parameters') . '</legend>' . "\n";
     $out .= '<div class="fieldset-content">';
     $out .= '<table class="vexim-settings" cellpadding="0" cellspacing="0">';
     $field_id = 'maxmsgsize';
     $input_messagesize = new html_inputfield(array('name' => 'maxmsgsize', 'id' => $field_id, 'maxlength' => 3, 'size' => 4));
     if ($default_maxmsgsize == 0) {
         $default_maxmsgsize = $this->gettext('unlimited');
     } else {
         $default_maxmsgsize = $default_maxmsgsize . ' kb';
     }
     $out .= sprintf("<tr><th><label for=\"%s\">%s</label>:</th><td>%s%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('messagesize')), $input_messagesize->show($maxmsgsize), '<br /><span class="vexim-explanation">' . str_replace('%d', $active_domain, str_replace('%m', $default_maxmsgsize, $this->gettext('messagesizeexplanation'))) . '</span>');
     $out .= '</table>';
     $out .= '</div></fieldset>' . "\n\n";
     // =====================================================================================================
     $out .= html::p(null, $rcmail->output->button(array('command' => 'plugin.veximaccountadmin-save', 'type' => 'input', 'class' => 'button mainaction', 'label' => 'save')));
     $rcmail->output->add_gui_object('veximform', 'veximaccountadminform');
     $out = $rcmail->output->form_tag(array('id' => 'veximaccountadminform', 'name' => 'veximaccountadminform', 'method' => 'post', 'action' => './?_task=settings&_action=plugin.veximaccountadmin-save'), $out);
     $out = html::div(array('class' => 'settingsbox', 'style' => 'margin:0 0 15px 0;'), html::div(array('class' => 'boxtitle'), $this->gettext('accountadministration')) . html::div(array('style' => 'padding:15px'), $outtop . "\n" . $out . "\n" . $outbottom));
     return $out;
 }