@@ -151,7 +151,8 @@ discard block |
||
151 | 151 | $subnet_text = ''; |
152 | 152 | if ($subnet['isFolder']) { |
153 | 153 | $subnet_text = $subnet['description']." (folder)"; |
154 | - } else { |
|
154 | + } |
|
155 | + else { |
|
155 | 156 | $subnet_text = $subnet['ip']."/".$subnet['mask']; |
156 | 157 | } |
157 | 158 | $worksheet->write($lineCount, $rowCount, $subnet_text, $format_text); |
@@ -182,7 +183,8 @@ discard block |
||
182 | 183 | if (!empty($subnet['vrfId'])) { |
183 | 184 | $vrf = (array) $Tools->fetch_vrf(null, $subnet['vrfId']); |
184 | 185 | $worksheet->write($lineCount, $rowCount, $vrf['name'], $format_text); |
185 | - } else { |
|
186 | + } |
|
187 | + else { |
|
186 | 188 | $worksheet->write($lineCount, $rowCount, '', $format_text); |
187 | 189 | } |
188 | 190 | $rowCount++; |
@@ -196,10 +198,12 @@ discard block |
||
196 | 198 | $master = (array) $Subnets->fetch_subnet (null, $subnet['masterSubnetId']); |
197 | 199 | if($master['isFolder']) { |
198 | 200 | $worksheet->write($lineCount, $rowCount, $master['description']." [folder]", $format_text); |
199 | - } else { |
|
201 | + } |
|
202 | + else { |
|
200 | 203 | $worksheet->write($lineCount, $rowCount, $master['ip']."/".$master['mask'], $format_text); |
201 | 204 | } |
202 | - } else { |
|
205 | + } |
|
206 | + else { |
|
203 | 207 | $worksheet->write($lineCount, $rowCount, "/", $format_text); |
204 | 208 | } |
205 | 209 | $rowCount++; |
@@ -278,7 +282,8 @@ discard block |
||
278 | 282 | $ssec = $Admin->fetch_object("sections", "id", $section['masterSection']); |
279 | 283 | $worksheet_sections->write($lineCount, $rowCount, $ssec->name, $format_text); |
280 | 284 | $rowCount++; |
281 | - } else { |
|
285 | + } |
|
286 | + else { |
|
282 | 287 | $worksheet_sections->write($lineCount, $rowCount, "/", $format_text); |
283 | 288 | $rowCount++; |
284 | 289 | } |
@@ -105,12 +105,15 @@ discard block |
||
105 | 105 | list($caddr,$cmask) = explode("/",$cdata['subnet'],2); |
106 | 106 | $cdata['mask'] = $cmask; |
107 | 107 | $cdata['subnet'] = $caddr; |
108 | - } else { # check that mask is provided |
|
108 | + } |
|
109 | + else { |
|
110 | +# check that mask is provided |
|
109 | 111 | if ((!isset($cdata['mask'])) or ($cdata['mask'] == "")) { $msg.= "Required field mask missing or empty."; $action = "error"; } |
110 | 112 | } |
111 | 113 | if ((!empty($cdata['mask'])) && (!preg_match("/^([0-9]+|[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)$/", $cdata['mask']))) { |
112 | 114 | $msg.="Invalid network mask format."; $action = "error"; |
113 | - } else { |
|
115 | + } |
|
116 | + else { |
|
114 | 117 | $cdata['type'] = $Subnets->identify_address($cdata['subnet']); |
115 | 118 | if (($cdata['type'] == "IPv6") && (($cdata['mask']<0) || ($cdata['mask']>128))) { $msg.="Invalid IPv6 network mask."; $action = "error"; } |
116 | 119 | } |
@@ -119,7 +122,8 @@ discard block |
||
119 | 122 | # Check if section is provided and valid and link it if it is |
120 | 123 | if (!isset($section_names[$cdata['section']])) { |
121 | 124 | $msg.= "Invalid section."; $action = "error"; |
122 | - } else { |
|
125 | + } |
|
126 | + else { |
|
123 | 127 | $cdata['sectionId'] = $section_names[$cdata['section']]['id']; |
124 | 128 | } |
125 | 129 | |
@@ -127,29 +131,35 @@ discard block |
||
127 | 131 | if (!empty($cdata['vrf'])) { |
128 | 132 | if (!isset($vrf_data[$cdata['vrf']])) { |
129 | 133 | $msg.= "Invalid VRF."; $action = "error"; |
130 | - } else { |
|
134 | + } |
|
135 | + else { |
|
131 | 136 | $cdata['vrfId'] = $vrf_data[$cdata['vrf']]['vrfId']; |
132 | 137 | } |
133 | - } else { |
|
138 | + } |
|
139 | + else { |
|
134 | 140 | # no VRF provided |
135 | 141 | $cdata['vrfId'] = 0; |
136 | 142 | } |
137 | 143 | |
138 | 144 | # Check if VLAN Domain and VLAN are valid, and link them if they are |
139 | - if (!empty($cdata['domain'])) { $cdom = $cdata['domain']; } else { $cdom = "default"; } |
|
145 | + if (!empty($cdata['domain'])) { $cdom = $cdata['domain']; } |
|
146 | + else { $cdom = "default"; } |
|
140 | 147 | if (!isset($vlan_data[$cdom])) { |
141 | 148 | # the default domain is always there, so if anything is missing we return an error |
142 | 149 | $msg.= "Invalid VLAN domain."; $action = "error"; |
143 | - } else { |
|
150 | + } |
|
151 | + else { |
|
144 | 152 | if (!empty($cdata['vlan'])) { |
145 | 153 | if (in_array(strtolower($cdata['vlan']),array("na","n/a","nan"))) { $cdata['vlan'] = ""; } |
146 | 154 | if ((!empty($cdata['vlan'])) && (strtolower($cdata['vlan']) != "na")) { |
147 | 155 | if (!isset($vlan_data[$cdom][$cdata['vlan']])) { |
148 | 156 | $msg.= "VLAN not found in provided domain."; $action = "error"; |
149 | - } else { |
|
157 | + } |
|
158 | + else { |
|
150 | 159 | $cdata['vlanId'] = $vlan_data[$cdom][$cdata['vlan']]['vlanId']; |
151 | 160 | } |
152 | - } else { |
|
161 | + } |
|
162 | + else { |
|
153 | 163 | # no VLAN provided |
154 | 164 | $cdata['vlanId'] = 0; |
155 | 165 | } |
@@ -162,7 +172,8 @@ discard block |
||
162 | 172 | $cdata['mask'] = $net['bitmask']; |
163 | 173 | $cidr_check = $Subnets->verify_cidr_address($cdata['subnet']."/".$cdata['mask']); |
164 | 174 | if (strlen($cidr_check)>5) { $msg.=$cidr_check; $action = "error"; } |
165 | - } else { $msg.=$net['message']; $action = "error"; } |
|
175 | + } |
|
176 | + else { $msg.=$net['message']; $action = "error"; } |
|
166 | 177 | if (preg_match("/[;'\"]/", $cdata['description'])) { $msg.="Invalid characters in description."; $action = "error"; } |
167 | 178 | if ((!empty($cdata['vrf'])) && (!preg_match("/^[a-zA-Z0-9-:]+$/", $cdata['vrf']))) { $msg.="Invalid VRF name format."; $action = "error"; } |
168 | 179 | if ((!empty($cdata['vlan'])) && (!preg_match("/^[0-9]+$/", $cdata['vlan']))) { $msg.="Invalid VLAN number format."; $action = "error"; } |
@@ -195,7 +206,8 @@ discard block |
||
195 | 206 | |
196 | 207 | if ($action == "skip") { |
197 | 208 | $msg.= "Duplicate, will skip."; |
198 | - } else { |
|
209 | + } |
|
210 | + else { |
|
199 | 211 | # set id of matched subnet |
200 | 212 | $cdata['id'] = $cedata['id']; |
201 | 213 | # copy some fields which we don't import, but need to set |
@@ -204,7 +216,8 @@ discard block |
||
204 | 216 | // $cdata['allowRequests'] = $cedata['allowRequests']; $cdata['showName'] = $cedata['showName']; |
205 | 217 | // $cdata['pingSubnet'] = $cedata['pingSubnet']; $cdata['discoverSubnet'] = $cedata['discoverSubnet']; |
206 | 218 | } |
207 | - } else { |
|
219 | + } |
|
220 | + else { |
|
208 | 221 | $msg.="New entry, will be added."; $action = "add"; |
209 | 222 | # Set master to 0 for now, will figure that after we add it, with the recompute function |
210 | 223 | $cdata['masterSubnetId'] = "0"; |
@@ -56,7 +56,8 @@ discard block |
||
56 | 56 | //master Section |
57 | 57 | if (($section['masterSection']!=0) && ($section['masterSection']==$last_master)) { |
58 | 58 | $sect_prefix = " - "; |
59 | - } else { |
|
59 | + } |
|
60 | + else { |
|
60 | 61 | $sect_prefix = ""; |
61 | 62 | $last_master = $section['id']; |
62 | 63 | } |
@@ -67,7 +68,8 @@ discard block |
||
67 | 68 | $section_rows.= "<td><div class='checkbox'><label><input type='checkbox' id='recomputeCVRFCheck' name='recomputeSectionCVRF_".$section['id']."' checked></label></div></td>"; |
68 | 69 | $section_rows.="</tr>\n"; |
69 | 70 | } |
70 | -} else { |
|
71 | +} |
|
72 | +else { |
|
71 | 73 | $section_rows = "<td colspan='3'>No sections found!</td>"; |
72 | 74 | } |
73 | 75 |
@@ -57,7 +57,8 @@ |
||
57 | 57 | if ($action == "skip") { |
58 | 58 | $msg.= "Duplicate, will skip."; |
59 | 59 | } |
60 | - } else { |
|
60 | + } |
|
61 | + else { |
|
61 | 62 | $msg.="New entry, will be added."; $action = "add"; |
62 | 63 | } |
63 | 64 | } |
@@ -53,7 +53,8 @@ |
||
53 | 53 | $cfield = $extfields[$std_field]["field"]; |
54 | 54 | $ctable = $extfields[$std_field]["table"]; |
55 | 55 | $pname = $extfields[$std_field]["pname"]." "; |
56 | - } else { |
|
56 | + } |
|
57 | + else { |
|
57 | 58 | # default table and field |
58 | 59 | $cfield = $std_field; |
59 | 60 | $ctable = $mtable; |
@@ -74,7 +74,8 @@ discard block |
||
74 | 74 | # get section details |
75 | 75 | $ssec = $Admin->fetch_object("sections", "id", $section['masterSection']); |
76 | 76 | print " <td>$ssec->name</td>"; |
77 | - } else { |
|
77 | + } |
|
78 | + else { |
|
78 | 79 | print " <td>/</td>"; |
79 | 80 | } |
80 | 81 | //strictMode |
@@ -127,7 +128,8 @@ discard block |
||
127 | 128 | </table> <!-- end table --> |
128 | 129 | |
129 | 130 | <!-- show no configured --> |
130 | -<?php } else { ?> |
|
131 | +<?php } |
|
132 | +else { ?> |
|
131 | 133 | <div class="alert alert-warn alert-absolute"><?php print _('No sections configured'); ?>!</div> |
132 | 134 | <?php } ?> |
133 | 135 |
@@ -63,7 +63,10 @@ discard block |
||
63 | 63 | <tr> |
64 | 64 | <td><?php print _('Parent'); ?></td> |
65 | 65 | <td colspan="2"> |
66 | - <select name="masterSection" class="form-control input-sm input-w-auto pull-left" <?php if($_POST['action']=="delete") print 'disabled="disabled"'; ?>> |
|
66 | + <select name="masterSection" class="form-control input-sm input-w-auto pull-left" <?php if($_POST['action']=="delete") { |
|
67 | + print 'disabled="disabled"'; |
|
68 | +} |
|
69 | +?>> |
|
67 | 70 | <option value="0">Root</option> |
68 | 71 | <?php |
69 | 72 | if($sections!==false) { |
@@ -85,9 +88,15 @@ discard block |
||
85 | 88 | <tr> |
86 | 89 | <td><?php print _('Strict Mode'); ?></td> |
87 | 90 | <td colspan="2"> |
88 | - <select name="strictMode" class="input-small form-control input-sm input-w-auto pull-left" <?php if($_POST['action']=="delete") print 'disabled="disabled"'; ?>> |
|
91 | + <select name="strictMode" class="input-small form-control input-sm input-w-auto pull-left" <?php if($_POST['action']=="delete") { |
|
92 | + print 'disabled="disabled"'; |
|
93 | +} |
|
94 | +?>> |
|
89 | 95 | <option value="1"><?php print _('Yes'); ?></option> |
90 | - <option value="0" <?php if(@$section['strictMode'] == "0") print "selected='selected'"; ?>><?php print _('No'); ?></option> |
|
96 | + <option value="0" <?php if(@$section['strictMode'] == "0") { |
|
97 | + print "selected='selected'"; |
|
98 | +} |
|
99 | +?>><?php print _('No'); ?></option> |
|
91 | 100 | </select> |
92 | 101 | <span class="help-inline info2"><?php print _('No disables overlapping subnet checks. Subnets can be nested/created randomly. Anarchy.'); ?></span> |
93 | 102 | </td> |
@@ -97,9 +106,15 @@ discard block |
||
97 | 106 | <tr> |
98 | 107 | <td><?php print _('Show VLANs'); ?></td> |
99 | 108 | <td colspan="2"> |
100 | - <select name="showVLAN" class="input-small form-control input-sm input-w-auto pull-left" <?php if($_POST['action']=="delete") print 'disabled="disabled"'; ?>> |
|
109 | + <select name="showVLAN" class="input-small form-control input-sm input-w-auto pull-left" <?php if($_POST['action']=="delete") { |
|
110 | + print 'disabled="disabled"'; |
|
111 | +} |
|
112 | +?>> |
|
101 | 113 | <option value="1"><?php print _('Yes'); ?></option> |
102 | - <option value="0" <?php if(@$section['showVLAN'] == "0") print "selected='selected'"; ?>><?php print _('No'); ?></option> |
|
114 | + <option value="0" <?php if(@$section['showVLAN'] == "0") { |
|
115 | + print "selected='selected'"; |
|
116 | +} |
|
117 | +?>><?php print _('No'); ?></option> |
|
103 | 118 | </select> |
104 | 119 | <span class="help-inline info2"><?php print _('Show list of VLANs and belonging subnets in subnet list'); ?></span> |
105 | 120 | </td> |
@@ -109,9 +124,15 @@ discard block |
||
109 | 124 | <tr> |
110 | 125 | <td><?php print _('Show VRFs'); ?></td> |
111 | 126 | <td colspan="2"> |
112 | - <select name="showVRF" class="input-small form-control input-sm input-w-auto pull-left" <?php if($_POST['action']=="delete") print 'disabled="disabled"'; ?>> |
|
127 | + <select name="showVRF" class="input-small form-control input-sm input-w-auto pull-left" <?php if($_POST['action']=="delete") { |
|
128 | + print 'disabled="disabled"'; |
|
129 | +} |
|
130 | +?>> |
|
113 | 131 | <option value="1"><?php print _('Yes'); ?></option> |
114 | - <option value="0" <?php if(@$section['showVRF'] == "0") print "selected='selected'"; ?>><?php print _('No'); ?></option> |
|
132 | + <option value="0" <?php if(@$section['showVRF'] == "0") { |
|
133 | + print "selected='selected'"; |
|
134 | +} |
|
135 | +?>><?php print _('No'); ?></option> |
|
115 | 136 | </select> |
116 | 137 | <span class="help-inline info2"><?php print _('Show list of VRFs and belonging subnets in subnet list'); ?></span> |
117 | 138 | </td> |
@@ -229,7 +250,10 @@ discard block |
||
229 | 250 | <div class="pFooter"> |
230 | 251 | <div class="btn-group"> |
231 | 252 | <button class="btn btn-sm btn-default hidePopups"><?php print _('Cancel'); ?></button> |
232 | - <button class="btn btn-sm btn-default <?php if($_POST['action']=="delete") { print "btn-danger";} else { print "btn-success"; } ?>" id="editSectionSubmit"><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> |
|
253 | + <button class="btn btn-sm btn-default <?php if($_POST['action']=="delete") { print "btn-danger";} |
|
254 | +else { print "btn-success"; } ?>" id="editSectionSubmit"><i class="fa <?php if($_POST['action']=="add") { print "fa-plus"; } |
|
255 | +else if ($_POST['action']=="delete") { print "fa-trash-o"; } |
|
256 | +else { print "fa-check"; } ?>"></i> <?php print ucwords(_($_POST['action'])); ?></button> |
|
233 | 257 | </div> |
234 | 258 | <!-- result holder --> |
235 | 259 | <div class="sectionEditResult"></div> |
@@ -25,7 +25,8 @@ discard block |
||
25 | 25 | //get fix |
26 | 26 | if(!$fix = $Tools->get_table_fix($table)) { |
27 | 27 | $Result->show("danger", _("Cannot get fix for table")." $table!", true); |
28 | - } else { |
|
28 | + } |
|
29 | + else { |
|
29 | 30 | print "<a class='btn btn-xs btn-default btn-tablefix' style='margin-left:8px;' href='' data-tableid='$table' data-fieldid='' data-type='table'><i class='fa fa-magic fa-pad-right'></i>"._("Fix table")."</a>"; |
30 | 31 | print "<div id='fix-result-$table' style='display:none'></div>"; |
31 | 32 | } |
@@ -50,7 +51,8 @@ discard block |
||
50 | 51 | //get fix |
51 | 52 | if(!$fix = $Tools->get_field_fix($table, $field)) { |
52 | 53 | $Result->show("danger", _("Cannot get fix for table field ")." `$table` `$field`!", true); |
53 | - } else { |
|
54 | + } |
|
55 | + else { |
|
54 | 56 | print "<a class='btn btn-xs btn-default btn-tablefix' style='margin-left:8px;' href='' data-tableid='$table' data-fieldid='$field' data-type='field'><i class='fa fa-magic fa-pad-right'></i>"._("Fix field")."</a>"; |
55 | 57 | print "<div id='fix-result-$table$field' style='display:none'></div>"; |
56 | 58 | } |
@@ -75,7 +75,10 @@ |
||
75 | 75 | <div class="pFooter"> |
76 | 76 | <div class="btn-group"> |
77 | 77 | <button class="btn btn-sm btn-default hidePopups"><?php print _('Cancel'); ?></button> |
78 | - <button class="btn btn-sm btn-default <?php if($_POST['action']=="delete") { print "btn-danger"; } else { print "btn-success"; } ?>" id="editDevTypeSubmit"><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> |
|
78 | + <button class="btn btn-sm btn-default <?php if($_POST['action']=="delete") { print "btn-danger"; } |
|
79 | +else { print "btn-success"; } ?>" id="editDevTypeSubmit"><i class="fa <?php if($_POST['action']=="add") { print "fa-plus"; } |
|
80 | +else if ($_POST['action']=="delete") { print "fa-trash-o"; } |
|
81 | +else { print "fa-check"; } ?>"></i> <?php print ucwords(_($_POST['action'])); ?></button> |
|
79 | 82 | </div> |
80 | 83 | |
81 | 84 | <!-- result --> |