@@ -63,10 +63,12 @@ discard block |
||
63 | 63 | |
64 | 64 | if (!$network->subnetIsFolder) { |
65 | 65 | print '<td><a href="'.create_link("subnets",$network->sectionId,$network->subnetId).'">'.$Subnets->transform_to_dotted($network->subnet).'/'.$network->subnetMask.$network->subnetDescription.'</a></td>'; |
66 | - } else { |
|
66 | + } |
|
67 | + else { |
|
67 | 68 | print '<td><a href="'.create_link("subnets",$network->sectionId,$network->subnetId).'">Folder'.$network->subnetDescription.'</a></td>'; |
68 | 69 | } |
69 | - } else { |
|
70 | + } |
|
71 | + else { |
|
70 | 72 | print '<td>/</td>'; |
71 | 73 | } |
72 | 74 | # display vlan informations |
@@ -74,7 +76,8 @@ discard block |
||
74 | 76 | // name fix |
75 | 77 | $network->vlanName = strlen($network->vlanName)>0 ? " (".$network->vlanName.")" : ""; |
76 | 78 | print '<td><a href="'.create_link('tools','vlan',$network->domainId,$network->vlanId).'">'.$network->vlan.$network->vlanName.'</a></td>'; |
77 | - } else { |
|
79 | + } |
|
80 | + else { |
|
78 | 81 | print '<td>/</td>'; |
79 | 82 | } |
80 | 83 | // actions |
@@ -116,7 +119,8 @@ discard block |
||
116 | 119 | } |
117 | 120 | print "</tbody>"; |
118 | 121 | print '</table>'; |
119 | -} else { |
|
122 | +} |
|
123 | +else { |
|
120 | 124 | # print an info if there are no zones in the database |
121 | 125 | $Result->show("info", _("No firewall zones configured"), false); |
122 | 126 | } |
@@ -67,7 +67,8 @@ discard block |
||
67 | 67 | $Result->show("warning", "<strong>"._('Warning').":</strong><br>"._("You are about to remove the following Network from the firewall zone:<br>".$network), false); ?> |
68 | 68 | <input type="hidden" name="masterSubnetId" value="<?php print $_POST['subnetId']; ?>"> |
69 | 69 | </td> |
70 | - <?php } else { |
|
70 | + <?php } |
|
71 | +else { |
|
71 | 72 | # add a network to the zone |
72 | 73 | ?> |
73 | 74 | <tr> |
@@ -83,7 +84,7 @@ discard block |
||
83 | 84 | <td> |
84 | 85 | <select name="sectionId" class="firewallZoneSection form-control input-sm input-w-auto input-max-200"> |
85 | 86 | <?php |
86 | - if(sizeof($sections)>1){ |
|
87 | + if(sizeof($sections)>1) { |
|
87 | 88 | print '<option value="0">'._('No section selected').'</option>'; |
88 | 89 | } |
89 | 90 | foreach ($sections as $section) { |
@@ -104,13 +105,15 @@ discard block |
||
104 | 105 | print '<td><div class="sectionSubnets">'; |
105 | 106 | print $Subnets->print_mastersubnet_dropdown_menu($firewallZone->sectionId,$firewallZone->subnetId); |
106 | 107 | print '</div></td>'; |
107 | - } else { |
|
108 | + } |
|
109 | + else { |
|
108 | 110 | # if there is only one section, fetch the subnets of that section |
109 | - if(sizeof($sections)<=1){ |
|
111 | + if(sizeof($sections)<=1) { |
|
110 | 112 | print '<td>'; |
111 | 113 | print $Subnets->print_mastersubnet_dropdown_menu($sections[0]->id,$firewallZone->subnetId); |
112 | 114 | print '</td>'; |
113 | - } else { |
|
115 | + } |
|
116 | + else { |
|
114 | 117 | # if there are more than one section, use ajax to fetch the subnets of the selected section |
115 | 118 | print '<td><div class="sectionSubnets"></div></td>'; |
116 | 119 | } |
@@ -139,7 +142,10 @@ discard block |
||
139 | 142 | <div class="pFooter"> |
140 | 143 | <div class="btn-group"> |
141 | 144 | <button class="btn btn-sm btn-default hidePopup2"><?php print _('Cancel'); ?></button> |
142 | - <button class="btn btn-sm btn-default <?php if($_POST['action']=="delete") { print "btn-danger"; } else { print "btn-success"; } ?>" id="editNetworkSubmit"><i class="fa <?php if($_POST['action']=="add") { print "fa-plus"; } else if ($_POST['action']=="delete") { print "fa-trash-o"; } else { print "fa-check"; } ?>"></i> <?php print ucwords(_($_POST['action'])); ?></button> |
|
145 | + <button class="btn btn-sm btn-default <?php if($_POST['action']=="delete") { print "btn-danger"; } |
|
146 | +else { print "btn-success"; } ?>" id="editNetworkSubmit"><i class="fa <?php if($_POST['action']=="add") { print "fa-plus"; } |
|
147 | +else if ($_POST['action']=="delete") { print "fa-trash-o"; } |
|
148 | +else { print "fa-check"; } ?>"></i> <?php print ucwords(_($_POST['action'])); ?></button> |
|
143 | 149 | </div> |
144 | 150 | <!-- result --> |
145 | 151 | <div class="zones-edit-network-result"></div> |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | $User->check_user_session(); |
19 | 19 | |
20 | 20 | # validate the action type |
21 | -if($_POST['action'] != 'add' && $_POST['action'] != 'delete' && $_POST['action'] != 'edit'){ |
|
21 | +if($_POST['action'] != 'add' && $_POST['action'] != 'delete' && $_POST['action'] != 'edit') { |
|
22 | 22 | $Result->show("danger", _("Invalid action."), true); |
23 | 23 | } |
24 | 24 | # check the zone alias. valid values are alphanumeric characters and special characters like ".-_ " |
@@ -33,13 +33,15 @@ discard block |
||
33 | 33 | # check the zone ID. valid value: integer |
34 | 34 | if(!preg_match('/^[0-9]+$/i',$_POST['zoneId'])) { |
35 | 35 | $Result->show("danger", _("Invalid zone ID."), true); |
36 | - } elseif (preg_match('/^0$/i',$_POST['zoneId'])) { |
|
36 | + } |
|
37 | + elseif (preg_match('/^0$/i',$_POST['zoneId'])) { |
|
37 | 38 | $Result->show("danger", _("Invalid zone ID."), true); |
38 | 39 | } |
39 | 40 | # check the device ID. valid value: integer |
40 | 41 | if(!preg_match('/^[0-9]+$/i',$_POST['deviceId'])) { |
41 | 42 | $Result->show("danger", _("Invalid device ID."), true); |
42 | - } elseif (preg_match('/^0$/i',$_POST['deviceId'])) { |
|
43 | + } |
|
44 | + elseif (preg_match('/^0$/i',$_POST['deviceId'])) { |
|
43 | 45 | $Result->show("danger", _("Please select a device."), true); |
44 | 46 | } |
45 | 47 | # check the mapping ID. valid value: integer |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | |
23 | 23 | # validations |
24 | 24 | # validate the action type |
25 | -if($_POST['action'] != 'add' && $_POST['action'] != 'delete' && $_POST['action'] != 'edit'){ |
|
25 | +if($_POST['action'] != 'add' && $_POST['action'] != 'delete' && $_POST['action'] != 'edit') { |
|
26 | 26 | $Result->show("danger", _("Invalid action."), true); |
27 | 27 | } |
28 | 28 | |
@@ -31,10 +31,11 @@ discard block |
||
31 | 31 | $Result->show("danger", _("Invalid zone name value."), true); |
32 | 32 | } |
33 | 33 | |
34 | -if($firewallZoneSettings['zoneGenerator']=="2") |
|
35 | -if(strlen(@$_POST['zone']) < 1 || strlen(@$_POST['zone'])>$firewallZoneSettings['zoneLength']) { |
|
34 | +if($firewallZoneSettings['zoneGenerator']=="2") { |
|
35 | + if(strlen(@$_POST['zone']) < 1 || strlen(@$_POST['zone'])>$firewallZoneSettings['zoneLength']) { |
|
36 | 36 | $Result->show("danger", _("Invalid zone name length."), true); |
37 | 37 | } |
38 | +} |
|
38 | 39 | |
39 | 40 | # check the zone indicator ID. valid values are 0 or 1. |
40 | 41 | if($_POST['indicator'] && !preg_match('/^[0-1]$/i',$_POST['indicator'])) { |
@@ -55,7 +56,8 @@ discard block |
||
55 | 56 | if($_POST['generator'] != 2) { |
56 | 57 | if($_POST['padding']) { |
57 | 58 | $padding = 1; |
58 | - } else { |
|
59 | + } |
|
60 | + else { |
|
59 | 61 | $padding = 0; |
60 | 62 | } |
61 | 63 | } |
@@ -64,18 +66,19 @@ discard block |
||
64 | 66 | $description = trim(htmlspecialchars($_POST['description'])); |
65 | 67 | |
66 | 68 | # generate a unique zone name if the generator is set to decimal or hex |
67 | -if (!$_POST['zone'] && $_POST['action'] == 'add') { |
|
68 | - if(!$zone=$Zones->generate_zone_name()){ |
|
69 | +if (!$_POST['zone'] && $_POST['action'] == 'add') { |
|
70 | + if(!$zone=$Zones->generate_zone_name()) { |
|
69 | 71 | $Result->show("danger", _("Cannot generate zone name"), true); |
70 | 72 | } |
71 | -} else { |
|
73 | +} |
|
74 | +else { |
|
72 | 75 | $zone = $_POST['zone']; |
73 | 76 | } |
74 | 77 | |
75 | 78 | # validate the zone name if text mode is enabled |
76 | 79 | if ($_POST['generator'] == 2 ) { |
77 | 80 | $textSettings = array ( $_POST['zone'],$_POST['id']); |
78 | - if(!$zone=$Zones->generate_zone_name($textSettings)){ |
|
81 | + if(!$zone=$Zones->generate_zone_name($textSettings)) { |
|
79 | 82 | $Result->show("danger", _("Cannot validate zone name"), true); |
80 | 83 | } |
81 | 84 | } |
@@ -133,7 +133,8 @@ discard block |
||
133 | 133 | <?php foreach ($firewallZoneSettings['zoneGeneratorType'] as $key => $generator) { |
134 | 134 | if ($firewallZoneSettings['zoneGenerator'] == $key) { |
135 | 135 | print '<option value='.$key.' selected>'.$generator.'</option>'; |
136 | - } else { |
|
136 | + } |
|
137 | + else { |
|
137 | 138 | print '<option value='.$key.'>'.$generator.'</option>'; |
138 | 139 | } |
139 | 140 | }?> |
@@ -171,7 +172,8 @@ discard block |
||
171 | 172 | <?php foreach ($deviceTypes as $deviceType) { |
172 | 173 | if ($firewallZoneSettings['deviceType'] == $deviceType->tid) { |
173 | 174 | print '<option value='.$deviceType->tid.' selected>'.$deviceType->tname.'</option>'; |
174 | - } else { |
|
175 | + } |
|
176 | + else { |
|
175 | 177 | print '<option value='.$deviceType->tid.'>'.$deviceType->tname.'</option>'; |
176 | 178 | } |
177 | 179 | }?> |
@@ -260,9 +262,11 @@ discard block |
||
260 | 262 | if (preg_match('/patternSeparator/i',$settingsPattern)) { |
261 | 263 | $patternCount++; |
262 | 264 | |
263 | - } elseif (!$firewallZoneSettings['pattern']) { |
|
265 | + } |
|
266 | + elseif (!$firewallZoneSettings['pattern']) { |
|
264 | 267 | print $pattern; |
265 | - } elseif (!in_array($key,$firewallZoneSettings['pattern'])) { |
|
268 | + } |
|
269 | + elseif (!in_array($key,$firewallZoneSettings['pattern'])) { |
|
266 | 270 | print $pattern; |
267 | 271 | } |
268 | 272 | } |
@@ -303,7 +307,8 @@ discard block |
||
303 | 307 | <?php foreach ($firewallZoneSettings['subnetPatternValues'] as $key => $subnetObjectPattern) { |
304 | 308 | if ($firewallZoneSettings['subnetPattern'] == $key) { |
305 | 309 | print '<option value='.$key.' selected>'.$subnetObjectPattern.'</option>'; |
306 | - } else { |
|
310 | + } |
|
311 | + else { |
|
307 | 312 | print '<option value='.$key.'>'.$subnetObjectPattern.'</option>'; |
308 | 313 | } |
309 | 314 | }?> |
@@ -47,7 +47,7 @@ |
||
47 | 47 | if(!$Zones->modify_mapping('add',$values)) { $Result->show("danger", _("Cannot add mapping"), true); } |
48 | 48 | } |
49 | 49 | # check and then add the network to the zone if possible |
50 | -if($Zones->check_zone_network($_POST['subnetId'])) { |
|
50 | +if($Zones->check_zone_network($_POST['subnetId'])) { |
|
51 | 51 | if (!$Zones->add_zone_network($_POST['zoneId'],$_POST['subnetId'])) { $Result->show("danger", _("Cannot add this network to a zone."), true); } |
52 | 52 | else { $Result->show("success", _("Zone modified successfully"), true); } |
53 | 53 | } |
@@ -17,13 +17,14 @@ discard block |
||
17 | 17 | $User->check_user_session(); |
18 | 18 | |
19 | 19 | # validate the action type |
20 | -if($_POST['action'] != 'add' && $_POST['action'] != 'delete'){ |
|
20 | +if($_POST['action'] != 'add' && $_POST['action'] != 'delete') { |
|
21 | 21 | $Result->show("danger", _("Invalid action."), true); |
22 | 22 | } |
23 | 23 | # check the mastersubnet ID. valid value: integer |
24 | 24 | if($_POST['masterSubnetId'] && !preg_match('/^[0-9]+$/i',$_POST['masterSubnetId'])) { |
25 | 25 | $Result->show("danger", _("Invalid subnet ID."), true); |
26 | -} elseif (!$_POST['masterSubnetId']) { |
|
26 | +} |
|
27 | +elseif (!$_POST['masterSubnetId']) { |
|
27 | 28 | $Result->show("danger", _("Please choose a appropriate network to bind to the firewall zone."), true); |
28 | 29 | } |
29 | 30 | |
@@ -46,12 +47,14 @@ discard block |
||
46 | 47 | # check the zone ID. valid value: integer |
47 | 48 | if($_POST['netZoneId'] && !preg_match('/^[0-9]+$/i',$_POST['netZoneId'])) { |
48 | 49 | $Result->show("danger", _("Invalid zone ID."), true); |
49 | -} else { |
|
50 | +} |
|
51 | +else { |
|
50 | 52 | # update |
51 | 53 | if ($_POST['action'] == 'add') { |
52 | 54 | if(!$Zones->add_zone_network($_POST['netZoneId'],$_POST['masterSubnetId'])) { $Result->show("danger", _("Cannot add the network to the zone."), true); } |
53 | 55 | else { $Result->show("success", _("Network successfully added."), true); } |
54 | - } elseif ($_POST['action'] == 'delete') { |
|
56 | + } |
|
57 | + elseif ($_POST['action'] == 'delete') { |
|
55 | 58 | if(!$Zones->delete_zone_network($_POST['netZoneId'],$_POST['masterSubnetId'])) { $Result->show("danger", _("Cannot delete the network mapping."), true); } |
56 | 59 | else { $Result->show("success", _("Successfully deleted the networt mapping."), true); } |
57 | 60 | } |
@@ -20,10 +20,12 @@ |
||
20 | 20 | # release and commit logs |
21 | 21 | print "<ul class='nav nav-tabs log-tabs'>"; |
22 | 22 | print "<li role='presentation' class='active'><a href='' data-target='changelog'>Change log</a></li>"; |
23 | -if(!is_null($Tools->phpipam_releases)) |
|
24 | -print "<li role='presentation'> <a href='' data-target='releaselog'>Release log</a></li>"; |
|
25 | -if ($User->settings->version > $version) |
|
26 | -print "<li role='presentation'> <a href='' data-target='gitlog'>Commit log (local)</a></li>"; |
|
23 | +if(!is_null($Tools->phpipam_releases)) { |
|
24 | + print "<li role='presentation'> <a href='' data-target='releaselog'>Release log</a></li>"; |
|
25 | +} |
|
26 | +if ($User->settings->version > $version) { |
|
27 | + print "<li role='presentation'> <a href='' data-target='gitlog'>Commit log (local)</a></li>"; |
|
28 | +} |
|
27 | 29 | print "</ul>"; |
28 | 30 | |
29 | 31 |
@@ -32,7 +32,10 @@ discard block |
||
32 | 32 | <td> |
33 | 33 | <select name="mtype" class="form-control input-sm input-w-auto" id="mtype"> |
34 | 34 | <option value="localhost"><?php print _("Localhost"); ?></option> |
35 | - <option value="smtp" <?php if($mail_settings->mtype=="smtp") print "selected='selected'"; ?>><?php print _("SMTP"); ?></option> |
|
35 | + <option value="smtp" <?php if($mail_settings->mtype=="smtp") { |
|
36 | + print "selected='selected'"; |
|
37 | +} |
|
38 | +?>><?php print _("SMTP"); ?></option> |
|
36 | 39 | </select> |
37 | 40 | <input type="hidden" name="csrf_cookie" value="<?php print $csrf; ?>"> |
38 | 41 | </td> |
@@ -40,7 +43,10 @@ discard block |
||
40 | 43 | </tr> |
41 | 44 | |
42 | 45 | <!-- smtp --> |
43 | - <tbody id="smtp" <?php if($mail_settings->mtype=="localhost") print "style='display:none;'"; ?>> |
|
46 | + <tbody id="smtp" <?php if($mail_settings->mtype=="localhost") { |
|
47 | + print "style='display:none;'"; |
|
48 | +} |
|
49 | +?>> |
|
44 | 50 | |
45 | 51 | <!-- Server settings --> |
46 | 52 | <tr class="settings-title"> |
@@ -70,8 +76,14 @@ discard block |
||
70 | 76 | <td> |
71 | 77 | <select name="msecure" class="smtp form-control input-sm input-w-auto"> |
72 | 78 | <option value="none"><?php print _('None'); ?></option> |
73 | - <option value="ssl" <?php if($mail_settings->msecure=="ssl") print "selected='selected'"; ?>><?php print _('SSL'); ?></option> |
|
74 | - <option value="tls" <?php if($mail_settings->msecure=="tls") print "selected='selected'"; ?>><?php print _('TLS'); ?></option> |
|
79 | + <option value="ssl" <?php if($mail_settings->msecure=="ssl") { |
|
80 | + print "selected='selected'"; |
|
81 | +} |
|
82 | +?>><?php print _('SSL'); ?></option> |
|
83 | + <option value="tls" <?php if($mail_settings->msecure=="tls") { |
|
84 | + print "selected='selected'"; |
|
85 | +} |
|
86 | +?>><?php print _('TLS'); ?></option> |
|
75 | 87 | </select> |
76 | 88 | </td> |
77 | 89 | <td class="info2"><?php print _('Select yes if authentication is required'); ?></td> |
@@ -83,7 +95,10 @@ discard block |
||
83 | 95 | <td> |
84 | 96 | <select name="mauth" class="smtp form-control input-sm input-w-auto"> |
85 | 97 | <option value="no"><?php print _('No'); ?></option> |
86 | - <option value="yes" <?php if($mail_settings->mauth=="yes") print "selected='selected'"; ?>><?php print _('Yes'); ?></option> |
|
98 | + <option value="yes" <?php if($mail_settings->mauth=="yes") { |
|
99 | + print "selected='selected'"; |
|
100 | +} |
|
101 | +?>><?php print _('Yes'); ?></option> |
|
87 | 102 | </select> |
88 | 103 | </td> |
89 | 104 | <td class="info2"><?php print _('Select yes if authentication is required'); ?></td> |