Skip to content

Commit 0bed9eb

Browse files
author
Victor Isadov
committed
Chains select output in foreach instead of hardcoding it
1 parent fcea9ab commit 0bed9eb

File tree

1 file changed

+22
-9
lines changed

1 file changed

+22
-9
lines changed

web/templates/admin/add_firewall_banlist.html

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,28 @@
5151
</tr>
5252
<tr>
5353
<td>
54-
<select class="vst-list" name="v_chain">
55-
<option value="SSH" <?php if ((!empty($v_chain)) && ( $v_chain == "'SSH'" )) echo 'selected'?>><?php print __('SSH') ?></option>
56-
<option value="WEB" <?php if ((!empty($v_chain)) && ( $v_chain == "'WEB'" )) echo 'selected'?>><?php print __('WEB') ?></option>
57-
<option value="FTP" <?php if ((!empty($v_chain)) && ( $v_chain == "'FTP'" )) echo 'selected'?>><?php print __('FTP') ?></option>
58-
<option value="DNS" <?php if ((!empty($v_chain)) && ( $v_chain == "'DNS'" )) echo 'selected'?>><?php print __('DNS') ?></option>
59-
<option value="MAIL" <?php if ((!empty($v_chain)) && ( $v_chain == "'MAIL'" )) echo 'selected'?>><?php print __('MAIL') ?></option>
60-
<option value="DB" <?php if ((!empty($v_chain)) && ( $v_chain == "'DB'" )) echo 'selected'?>><?php print __('DB') ?></option>
61-
<option value="VESTA" <?php if ((!empty($v_chain)) && ( $v_chain == "'VESTA'" )) echo 'selected'?>><?php print __('VESTA') ?></option>
62-
</select>
54+
<select class="vst-list" name="v_chain">
55+
<?php
56+
// chains list
57+
$chains = array(
58+
'SSH',
59+
'WEB',
60+
'FTP',
61+
'DNS',
62+
'MAIL',
63+
'DB',
64+
'VESTA'
65+
);
66+
67+
foreach($chains as $chain){
68+
$selected = (!empty($v_chain)) && ( $v_chain == $chain) ? 'selected' : '';
69+
?>
70+
<option value="<?php echo $chain?>" <?php echo $selected ?>>
71+
<?php print __($chain) ?>
72+
</option>
73+
74+
<?php } ?>
75+
</select>
6376
</td>
6477
</tr>
6578
<tr>

0 commit comments

Comments
 (0)