Browse Source

Merge pull request #803 from kondurake/patch-5

Fix "Parsing error" if a NAT IP is specified
naumov-socolov 9 years ago
parent
commit
9cae6988b5
1 changed files with 4 additions and 9 deletions
  1. 4 9
      web/templates/admin/edit_web.html

+ 4 - 9
web/templates/admin/edit_web.html

@@ -65,15 +65,10 @@
                                 <td>
                                     <select class="vst-list" name="v_ip">
                                         <?php
-                                            foreach ($ips as $key => $value) {
-                                                $display_ip = $key;
-                                                if (!empty($value['NAT'])) $display_ip = $value['NAT'];
-                                                $skey = "'".$display_ip."'";
-                                                echo "\n\t\t\t\t\t\t\t\t\t\t\t\t<option value=\"".htmlentities($display_ip)."\"";
-                                                if ((!empty($v_ip)) && ( $display_ip == $v_ip ) || ( $skey == $v_ip )){
-                                                    echo ' selected';
-                                                }
-                                                echo ">".htmlentities($display_ip)."</option>\n";
+                                            foreach ($ips as $ip => $value) {
+                                                $display_ip = htmlentities(empty($value['NAT']) ? $ip : "{$ip} → {$value['NAT']}");
+                                                $ip_selected = ((!empty($v_ip) && $ip == $v_ip) || $v_ip == "'{$ip}'")  ? 'selected' : '';
+                                                echo "\n\t\t\t\t\t\t\t\t\t\t\t\t<option value=\"{$ip}\" {$ip_selected}>{$display_ip}</option>\n";
                                             }
                                         ?>
                                     </select>