From db1a87cd6c506f2afbd1a37c64cb56ae11120b49 Mon Sep 17 00:00:00 2001
From: thomascube <thomas@roundcube.net>
Date: Fri, 17 Dec 2010 10:07:04 -0500
Subject: [PATCH] Update branch for 0.5-rc release

---
 program/include/rcube_template.php |   20 ++++++++++++++------
 1 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/program/include/rcube_template.php b/program/include/rcube_template.php
index 8a9eff4..d6ea3dc 100755
--- a/program/include/rcube_template.php
+++ b/program/include/rcube_template.php
@@ -1045,7 +1045,7 @@
     private function login_form($attrib)
     {
         $default_host = $this->config['default_host'];
-        $attrib['autocomplete'] = $this->config['login_autocomplete'] ? null : 'off';
+        $autocomplete = (int) $this->config['login_autocomplete'];
 
         $_SESSION['temp'] = true;
 
@@ -1054,11 +1054,18 @@
         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);
+        // 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_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')
+            + $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) {
@@ -1080,7 +1087,8 @@
                 'name' => '_host', 'id' => 'rcmloginhost', 'value' => $host) + $attrib);
         }
         else if (empty($default_host)) {
-            $input_host = new html_inputfield(array('name' => '_host', 'id' => 'rcmloginhost') + $attrib);
+            $input_host = new html_inputfield(array('name' => '_host', 'id' => 'rcmloginhost')
+                + $attrib + $host_attrib);
         }
 
         $form_name  = !empty($attrib['form']) ? $attrib['form'] : 'form';
@@ -1090,7 +1098,7 @@
         $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(null, $input_user->show(get_input_value('_user', RCUBE_INPUT_GPC)));
 
         $table->add('title', html::label('rcmloginpwd', Q(rcube_label('password'))));
         $table->add(null, $input_pass->show());
@@ -1098,7 +1106,7 @@
         // add host selection row
         if (is_object($input_host) && !$hide_host) {
             $table->add('title', html::label('rcmloginhost', Q(rcube_label('server'))));
-            $table->add(null, $input_host->show(get_input_value('_host', RCUBE_INPUT_POST)));
+            $table->add(null, $input_host->show(get_input_value('_host', RCUBE_INPUT_GPC)));
         }
 
         $out = $input_action->show();

--
Gitblit v1.9.1