|
107 | 107 | } |
108 | 108 | $app->tpl->setVar("client_group_id", $client_select); |
109 | 109 |
|
| 110 | + //* Fill the mail server select field |
| 111 | + $sql = "SELECT server_id, server_name FROM server WHERE mail_server = 1 and mirror_server_id = 0"; |
| 112 | + $mail_servers = $app->db->queryAllRecords($sql); |
| 113 | + $mail_server_select = ""; |
| 114 | + if(is_array($mail_servers)) { |
| 115 | + foreach( $mail_servers as $m_server) { |
| 116 | + $selected = @($m_server['server_id'] == $_POST['local_server_id'])?'SELECTED':''; |
| 117 | + $mail_server_select .= "<option value='$m_server[server_id]' $selected>$m_server[server_name]</option>\r\n"; |
| 118 | + } |
| 119 | + } |
| 120 | + $app->tpl->setVar("local_server_id", $mail_server_select); |
110 | 121 |
|
111 | 122 | try { |
112 | 123 | //* Allow connections to self signed SSL certs |
|
161 | 172 | $app->tpl->setVar('remote_session_id', $remote_session_id); |
162 | 173 | $app->tpl->setVar('msg', $msg); |
163 | 174 | $app->tpl->setVar('error', $error); |
| 175 | +$app->tpl->setVar('local_server_id', $_POST['local_server_id'], true); |
164 | 176 |
|
165 | 177 | //* SET csrf token |
166 | 178 | $csrf_token = $app->auth->csrf_token_get('ispconfig_import'); |
@@ -188,7 +200,10 @@ function start_domain_import($mail_domain) { |
188 | 200 | $server_id = intval($tmp['server_id']); |
189 | 201 | unset($tmp); |
190 | 202 | if($server_id == 0) $server_id = 1; |
191 | | - |
| 203 | + |
| 204 | + if (isset($_POST['local_server_id']) && intval($_POST['local_server_id']) !== $server_id){ |
| 205 | + $server_id = intval($_POST['local_server_id']); |
| 206 | + } |
192 | 207 | //* get the mail domain record |
193 | 208 | $mail_domain_rec = $client->mail_domain_get($remote_session_id, array('domain' => $mail_domain)); |
194 | 209 | if(is_array($mail_domain_rec)) { |
|
0 commit comments