| 
...
 | 
...
 | 
@@ -2342,28 +2342,49 @@ EOF; | 
| 
 | 
 | 
         $input_host   = null;
 | 
| 
 | 
 | 
         $hide_host    = false;
 | 
| 
 | 
 | 
 
 | 
| 
 | 
 | 
         if (is_array($default_host) && count($default_host) > 1) {
 | 
| 
 | 
 | 
             $input_host = new html_select(['name' => '_host', 'id' => 'rcmloginhost', 'class' => 'custom-select']);
 | 
| 
 | 
 | 
 
 | 
| 
 | 
 | 
             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([
 | 
| 
 | 
 | 
                 'name' => '_host', 'id' => 'rcmloginhost', 'value' => is_numeric($host) ? $default_host[$host] : $host] + $attrib);
 | 
| 
 | 
 | 
         }
 | 
| 
 | 
 | 
         else if (empty($default_host)) {
 | 
| 
 | 
 | 
         // 调整为手动输入模式
 | 
| 
 | 
 | 
 //        if (is_array($default_host) && count($default_host) > 1) {
 | 
| 
 | 
 | 
 //            $input_host = new html_select(['name' => '_host', 'id' => 'rcmloginhost', 'class' => 'custom-select']);
 | 
| 
 | 
 | 
 //
 | 
| 
 | 
 | 
 //            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([
 | 
| 
 | 
 | 
 //                'name' => '_host', 'id' => 'rcmloginhost', 'value' => is_numeric($host) ? $default_host[$host] : $host] + $attrib);
 | 
| 
 | 
 | 
 //        }
 | 
| 
 | 
 | 
 //        else if (empty($default_host)) {
 | 
| 
 | 
 | 
             $input_host = new html_inputfield(['name' => '_host', 'id' => 'rcmloginhost', 'class' => 'form-control']
 | 
| 
 | 
 | 
                 + $attrib + $host_attrib);
 | 
| 
 | 
 | 
 //        }
 | 
| 
 | 
 | 
         // 加入js来控制
 | 
| 
 | 
 | 
         $js_default_host = rcube_email_server_address::getKeyValue();
 | 
| 
 | 
 | 
         $_script = "<script>
 | 
| 
 | 
 | 
 var _default_hosts = ".json_encode($js_default_host,JSON_UNESCAPED_UNICODE).";
 | 
| 
 | 
 | 
 $(\"#rcmloginuser\").change(function() {
 | 
| 
 | 
 | 
   auto_host($(this).val());
 | 
| 
 | 
 | 
 });
 | 
| 
 | 
 | 
 $(\"#rcmloginuser\").keyup(function() {
 | 
| 
 | 
 | 
   auto_host($(this).val());
 | 
| 
 | 
 | 
 });
 | 
| 
 | 
 | 
 function auto_host(_user){
 | 
| 
 | 
 | 
     _user = _user.split('@');
 | 
| 
 | 
 | 
     if(_user[1]){
 | 
| 
 | 
 | 
         if(_default_hosts[_user[1]]){
 | 
| 
 | 
 | 
             $(\"#rcmloginhost\").val(_default_hosts[_user[1]]);
 | 
| 
 | 
 | 
         }
 | 
| 
 | 
 | 
     }
 | 
| 
 | 
 | 
 }
 | 
| 
 | 
 | 
 </script>";
 | 
| 
 | 
 | 
         $this->add_script(mb_substr($_script,8,-9),'foot');
 | 
| 
 | 
 | 
 
 | 
| 
 | 
 | 
         $this->add_gui_object('loginform', $form_name);
 | 
| 
 | 
 | 
 
 | 
| 
...
 | 
...
 | 
@@ -2378,7 +2399,7 @@ EOF; | 
| 
 | 
 | 
 
 | 
| 
 | 
 | 
         // 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('title', html::label('rcmloginhost', html::quote('imap '.$this->app->gettext('server'))));
 | 
| 
 | 
 | 
             $table->add('input', $input_host->show(rcube_utils::get_input_value('_host', rcube_utils::INPUT_GPC)));
 | 
| 
 | 
 | 
         }
 | 
| 
 | 
 | 
 
 | 
...
 | 
...
 | 
 |