Completed
Pull Request — master (#532)
06:37
created
app/admin/vlans/edit.php 1 patch
Indentation   +112 added lines, -112 removed lines patch added patch discarded remove patch
@@ -39,14 +39,14 @@  discard block
 block discarded – undo
39 39
 
40 40
 # fetch l2 domain
41 41
 if($_POST['action']=="add") {
42
-	# all
43
-	if (@$_POST['domain']=="all") {
44
-		$vlan_domains = $Admin->fetch_all_objects("vlanDomains");
45
-	} else {
46
-		$vlan_domain = $Admin->fetch_object("vlanDomains", "id", $_POST['domain']);
47
-	}
42
+    # all
43
+    if (@$_POST['domain']=="all") {
44
+        $vlan_domains = $Admin->fetch_all_objects("vlanDomains");
45
+    } else {
46
+        $vlan_domain = $Admin->fetch_object("vlanDomains", "id", $_POST['domain']);
47
+    }
48 48
 } else {
49
-		$vlan_domain = $Admin->fetch_object("vlanDomains", "id", $vlan['domainId']);
49
+        $vlan_domain = $Admin->fetch_object("vlanDomains", "id", $vlan['domainId']);
50 50
 }
51 51
 if($vlan_domain===false)			{ $Result->show("danger", _("Invalid ID"), true, true); }
52 52
 ?>
@@ -71,17 +71,17 @@  discard block
 block discarded – undo
71 71
 		<td><?php print _('l2 domain'); ?></td>
72 72
 		<th>
73 73
 		<?php
74
-		# not all
75
-		if (@$_POST['domain']!="all") {
76
-			print $vlan_domain->name." (".$vlan_domain->description.")";
77
-		} else {
78
-			print "<select name='domainId' class='form-control input-sm'>";
79
-			foreach ($vlan_domains as $d) {
80
-				print "<option value='$d->id'>$d->name</option>";
81
-			}
82
-			print "</select>";
83
-		}
84
-		?>
74
+        # not all
75
+        if (@$_POST['domain']!="all") {
76
+            print $vlan_domain->name." (".$vlan_domain->description.")";
77
+        } else {
78
+            print "<select name='domainId' class='form-control input-sm'>";
79
+            foreach ($vlan_domains as $d) {
80
+                print "<option value='$d->id'>$d->name</option>";
81
+            }
82
+            print "</select>";
83
+        }
84
+        ?>
85 85
 		</th>
86 86
 	</tr>
87 87
 	<tr>
@@ -133,105 +133,105 @@  discard block
 block discarded – undo
133 133
 
134 134
 	<!-- Custom -->
135 135
 	<?php
136
-	if(sizeof($custom) > 0) {
137
-
138
-		print '<tr>';
139
-		print '	<td colspan="2"><hr></td>';
140
-		print '</tr>';
141
-
142
-		foreach($custom as $field) {
143
-
144
-			# replace spaces
145
-		    $field['nameNew'] = str_replace(" ", "___", $field['name']);
146
-
147
-			# required
148
-			if($field['Null']=="NO")	{ $required = "*"; }
149
-			else						{ $required = ""; }
150
-
151
-			# set default value !
152
-			if ($_POST['action']=="add")	{ $vlan[$field['name']] = $field['Default']; }
153
-
154
-			print '<tr>'. "\n";
155
-			print '	<td>'. $field['name'] .' '.$required.'</td>'. "\n";
156
-			print '	<td>'. "\n";
157
-
158
-			//set type
159
-			if(substr($field['type'], 0,3) == "set" || substr($field['type'], 0,4) == "enum") {
160
-				//parse values
161
-				$tmp = substr($field['type'], 0,3)=="set" ? explode(",", str_replace(array("set(", ")", "'"), "", $field['type'])) : explode(",", str_replace(array("enum(", ")", "'"), "", $field['type']));
162
-
163
-				//null
164
-				if($field['Null']!="NO") { array_unshift($tmp, ""); }
165
-
166
-				print "<select name='$field[nameNew]' class='form-control input-sm input-w-auto' rel='tooltip' data-placement='right' title='$field[Comment]'>";
167
-				foreach($tmp as $v) {
168
-					if($v==$vlan[$field['name']])	{ print "<option value='$v' selected='selected'>$v</option>"; }
169
-					else								{ print "<option value='$v'>$v</option>"; }
170
-				}
171
-				print "</select>";
172
-			}
173
-			//date and time picker
174
-			elseif($field['type'] == "date" || $field['type'] == "datetime") {
175
-				// just for first
176
-				if($timeP==0) {
177
-					print '<link rel="stylesheet" type="text/css" href="css/1.2/bootstrap/bootstrap-datetimepicker.min.css">';
178
-					print '<script type="text/javascript" src="js/1.2/bootstrap-datetimepicker.min.js"></script>';
179
-					print '<script type="text/javascript">';
180
-					print '$(document).ready(function() {';
181
-					//date only
182
-					print '	$(".datepicker").datetimepicker( {pickDate: true, pickTime: false, pickSeconds: false });';
183
-					//date + time
184
-					print '	$(".datetimepicker").datetimepicker( { pickDate: true, pickTime: true } );';
185
-
186
-					print '})';
187
-					print '</script>';
188
-				}
189
-				$timeP++;
190
-
191
-				//set size
192
-				if($field['type'] == "date")	{ $size = 10; $class='datepicker';		$format = "yyyy-MM-dd"; }
193
-				else							{ $size = 19; $class='datetimepicker';	$format = "yyyy-MM-dd"; }
194
-
195
-				//field
196
-				if(!isset($vlan[$field['name']]))	{ print ' <input type="text" class="'.$class.' form-control input-sm input-w-auto" data-format="'.$format.'" name="'. $field['nameNew'] .'" maxlength="'.$size.'" '.$readonly.' rel="tooltip" data-placement="right" title="'.$field['Comment'].'">'. "\n"; }
197
-				else								{ print ' <input type="text" class="'.$class.' form-control input-sm input-w-auto" data-format="'.$format.'" name="'. $field['nameNew'] .'" maxlength="'.$size.'" value="'. $vlan[$field['name']]. '" '.$readonly.' rel="tooltip" data-placement="right" title="'.$field['Comment'].'">'. "\n"; }
198
-			}
199
-			//boolean
200
-			elseif($field['type'] == "tinyint(1)") {
201
-				print "<select name='$field[nameNew]' class='form-control input-sm input-w-auto' rel='tooltip' data-placement='right' title='$field[Comment]'>";
202
-				$tmp = array(0=>"No",1=>"Yes");
203
-				//null
204
-				if($field['Null']!="NO") { $tmp[2] = ""; }
205
-
206
-				foreach($tmp as $k=>$v) {
207
-					if(strlen($vlan[$field['name']])==0 && $k==2)	{ print "<option value='$k' selected='selected'>"._($v)."</option>"; }
208
-					elseif($k==$vlan[$field['name']])				{ print "<option value='$k' selected='selected'>"._($v)."</option>"; }
209
-					else												{ print "<option value='$k'>"._($v)."</option>"; }
210
-				}
211
-				print "</select>";
212
-			}
213
-			//text
214
-			elseif($field['type'] == "text") {
215
-				print ' <textarea class="form-control input-sm" name="'. $field['nameNew'] .'" placeholder="'. $field['name'] .'" '.$readonly.' rowspan=3 rel="tooltip" data-placement="right" title="'.$field['Comment'].'">'. $vlan[$field['name']]. '</textarea>'. "\n";
216
-			}
217
-			//default - input field
218
-			else {
219
-				print ' <input type="text" class="ip_addr form-control input-sm" name="'. $field['nameNew'] .'" placeholder="'. $field['name'] .'" value="'. @$vlan[$field['name']]. '" size="30" '.$readonly.' rel="tooltip" data-placement="right" title="'.$field['Comment'].'">'. "\n";
220
-			}
221
-
222
-			print '	</td>'. "\n";
223
-			print '</tr>'. "\n";
224
-		}
225
-	}
226
-	?>
136
+    if(sizeof($custom) > 0) {
137
+
138
+        print '<tr>';
139
+        print '	<td colspan="2"><hr></td>';
140
+        print '</tr>';
141
+
142
+        foreach($custom as $field) {
143
+
144
+            # replace spaces
145
+            $field['nameNew'] = str_replace(" ", "___", $field['name']);
146
+
147
+            # required
148
+            if($field['Null']=="NO")	{ $required = "*"; }
149
+            else						{ $required = ""; }
150
+
151
+            # set default value !
152
+            if ($_POST['action']=="add")	{ $vlan[$field['name']] = $field['Default']; }
153
+
154
+            print '<tr>'. "\n";
155
+            print '	<td>'. $field['name'] .' '.$required.'</td>'. "\n";
156
+            print '	<td>'. "\n";
157
+
158
+            //set type
159
+            if(substr($field['type'], 0,3) == "set" || substr($field['type'], 0,4) == "enum") {
160
+                //parse values
161
+                $tmp = substr($field['type'], 0,3)=="set" ? explode(",", str_replace(array("set(", ")", "'"), "", $field['type'])) : explode(",", str_replace(array("enum(", ")", "'"), "", $field['type']));
162
+
163
+                //null
164
+                if($field['Null']!="NO") { array_unshift($tmp, ""); }
165
+
166
+                print "<select name='$field[nameNew]' class='form-control input-sm input-w-auto' rel='tooltip' data-placement='right' title='$field[Comment]'>";
167
+                foreach($tmp as $v) {
168
+                    if($v==$vlan[$field['name']])	{ print "<option value='$v' selected='selected'>$v</option>"; }
169
+                    else								{ print "<option value='$v'>$v</option>"; }
170
+                }
171
+                print "</select>";
172
+            }
173
+            //date and time picker
174
+            elseif($field['type'] == "date" || $field['type'] == "datetime") {
175
+                // just for first
176
+                if($timeP==0) {
177
+                    print '<link rel="stylesheet" type="text/css" href="css/1.2/bootstrap/bootstrap-datetimepicker.min.css">';
178
+                    print '<script type="text/javascript" src="js/1.2/bootstrap-datetimepicker.min.js"></script>';
179
+                    print '<script type="text/javascript">';
180
+                    print '$(document).ready(function() {';
181
+                    //date only
182
+                    print '	$(".datepicker").datetimepicker( {pickDate: true, pickTime: false, pickSeconds: false });';
183
+                    //date + time
184
+                    print '	$(".datetimepicker").datetimepicker( { pickDate: true, pickTime: true } );';
185
+
186
+                    print '})';
187
+                    print '</script>';
188
+                }
189
+                $timeP++;
190
+
191
+                //set size
192
+                if($field['type'] == "date")	{ $size = 10; $class='datepicker';		$format = "yyyy-MM-dd"; }
193
+                else							{ $size = 19; $class='datetimepicker';	$format = "yyyy-MM-dd"; }
194
+
195
+                //field
196
+                if(!isset($vlan[$field['name']]))	{ print ' <input type="text" class="'.$class.' form-control input-sm input-w-auto" data-format="'.$format.'" name="'. $field['nameNew'] .'" maxlength="'.$size.'" '.$readonly.' rel="tooltip" data-placement="right" title="'.$field['Comment'].'">'. "\n"; }
197
+                else								{ print ' <input type="text" class="'.$class.' form-control input-sm input-w-auto" data-format="'.$format.'" name="'. $field['nameNew'] .'" maxlength="'.$size.'" value="'. $vlan[$field['name']]. '" '.$readonly.' rel="tooltip" data-placement="right" title="'.$field['Comment'].'">'. "\n"; }
198
+            }
199
+            //boolean
200
+            elseif($field['type'] == "tinyint(1)") {
201
+                print "<select name='$field[nameNew]' class='form-control input-sm input-w-auto' rel='tooltip' data-placement='right' title='$field[Comment]'>";
202
+                $tmp = array(0=>"No",1=>"Yes");
203
+                //null
204
+                if($field['Null']!="NO") { $tmp[2] = ""; }
205
+
206
+                foreach($tmp as $k=>$v) {
207
+                    if(strlen($vlan[$field['name']])==0 && $k==2)	{ print "<option value='$k' selected='selected'>"._($v)."</option>"; }
208
+                    elseif($k==$vlan[$field['name']])				{ print "<option value='$k' selected='selected'>"._($v)."</option>"; }
209
+                    else												{ print "<option value='$k'>"._($v)."</option>"; }
210
+                }
211
+                print "</select>";
212
+            }
213
+            //text
214
+            elseif($field['type'] == "text") {
215
+                print ' <textarea class="form-control input-sm" name="'. $field['nameNew'] .'" placeholder="'. $field['name'] .'" '.$readonly.' rowspan=3 rel="tooltip" data-placement="right" title="'.$field['Comment'].'">'. $vlan[$field['name']]. '</textarea>'. "\n";
216
+            }
217
+            //default - input field
218
+            else {
219
+                print ' <input type="text" class="ip_addr form-control input-sm" name="'. $field['nameNew'] .'" placeholder="'. $field['name'] .'" value="'. @$vlan[$field['name']]. '" size="30" '.$readonly.' rel="tooltip" data-placement="right" title="'.$field['Comment'].'">'. "\n";
220
+            }
221
+
222
+            print '	</td>'. "\n";
223
+            print '</tr>'. "\n";
224
+        }
225
+    }
226
+    ?>
227 227
 
228 228
 	</table>
229 229
 	</form>
230 230
 
231 231
 	<?php
232
-	//print delete warning
233
-	if($_POST['action'] == "delete")	{ $Result->show("warning", _('Warning').':</strong> '._('removing VLAN will also remove VLAN reference from belonging subnets')."!", false);  }
234
-	?>
232
+    //print delete warning
233
+    if($_POST['action'] == "delete")	{ $Result->show("warning", _('Warning').':</strong> '._('removing VLAN will also remove VLAN reference from belonging subnets')."!", false);  }
234
+    ?>
235 235
 </div>
236 236
 
237 237
 
Please login to merge, or discard this patch.
app/admin/vlans/move-vlan-result.php 1 patch
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -31,20 +31,20 @@
 block discarded – undo
31 31
 
32 32
 // check that it is not already set !
33 33
 if($User->settings->vlanDuplicate==0) {
34
-	$check_vlan = $Admin->fetch_multiple_objects ("vlans", "domainId", $vlan_domain->id, "vlanId");
35
-	if($check_vlan!==false) {
36
-		foreach($check_vlan as $v) {
37
-			if($v->number == $vlan->number) {
38
-									{ $Result->show("danger", _("VLAN already exists"), true); }
39
-			}
40
-		}
41
-	}
34
+    $check_vlan = $Admin->fetch_multiple_objects ("vlans", "domainId", $vlan_domain->id, "vlanId");
35
+    if($check_vlan!==false) {
36
+        foreach($check_vlan as $v) {
37
+            if($v->number == $vlan->number) {
38
+                                    { $Result->show("danger", _("VLAN already exists"), true); }
39
+            }
40
+        }
41
+    }
42 42
 }
43 43
 
44 44
 # formulate update query
45 45
 $values = array("vlanId"=>@$_POST['vlanId'],
46
-				"domainId"=>$vlan_domain->id
47
-				);
46
+                "domainId"=>$vlan_domain->id
47
+                );
48 48
 # update
49 49
 if(!$Admin->object_modify("vlans", "edit", "vlanId", $values))	{ $Result->show("danger",  _("Failed to move VLAN to new domain").'!', true); }
50 50
 else															{ $Result->show("success", _("VLAN moved to new domain successfully").'!', false); }
Please login to merge, or discard this patch.
app/admin/vlans/vlans-scan-execute.php 1 patch
Indentation   +128 added lines, -128 removed lines patch added patch discarded remove patch
@@ -71,20 +71,20 @@  discard block
 block discarded – undo
71 71
         $res = $Snmp->get_query("get_vlan_table");
72 72
         // remove those not in subnet
73 73
         if (sizeof($res)>0) {
74
-           // save for debug
75
-           $debug[$d->hostname]["get_vlan_table"] = $res;
76
-           // loop and save
77
-           foreach ($res as $k=>$r) {
78
-               if (!array_key_exists($k, $new_vlans) && !array_key_exists($k, $ex_vlans) ) {
79
-                   $new_vlans[$k] = $r;
80
-               }
81
-           }
74
+            // save for debug
75
+            $debug[$d->hostname]["get_vlan_table"] = $res;
76
+            // loop and save
77
+            foreach ($res as $k=>$r) {
78
+                if (!array_key_exists($k, $new_vlans) && !array_key_exists($k, $ex_vlans) ) {
79
+                    $new_vlans[$k] = $r;
80
+                }
81
+            }
82 82
         }
83
-     } catch (Exception $e) {
84
-       // save for debug
85
-       $debug[$d->hostname]["get_vlan_table"] = $res;
86
-       $errors[] = $e->getMessage();
87
-	}
83
+        } catch (Exception $e) {
84
+        // save for debug
85
+        $debug[$d->hostname]["get_vlan_table"] = $res;
86
+        $errors[] = $e->getMessage();
87
+    }
88 88
 }
89 89
 
90 90
 # none and errors
@@ -107,131 +107,131 @@  discard block
 block discarded – undo
107 107
     }
108 108
 
109 109
     // calculate colspan
110
-	$colspan = 4 + sizeof(@$required_fields);
110
+    $colspan = 4 + sizeof(@$required_fields);
111 111
 
112 112
 
113
-	//form
114
-	print "<form name='scan-snmp-vlan-form' class='scan-snmp-arp-form' id='scan-snmp-vlan-form'>";
115
-	print "<table class='table table-striped table-top table-condensed'>";
113
+    //form
114
+    print "<form name='scan-snmp-vlan-form' class='scan-snmp-arp-form' id='scan-snmp-vlan-form'>";
115
+    print "<table class='table table-striped table-top table-condensed'>";
116 116
 
117
-	// titles
118
-	print "<tr>";
119
-	print "	<th>"._("Number")."</th>";
120
-	print "	<th>"._("Name")."</th>";
121
-	print "	<th>"._("Description")."</th>";
117
+    // titles
118
+    print "<tr>";
119
+    print "	<th>"._("Number")."</th>";
120
+    print "	<th>"._("Name")."</th>";
121
+    print "	<th>"._("Description")."</th>";
122 122
     // custom
123
-	if (isset($required_fields)) {
124
-		foreach ($required_fields as $field) {
123
+    if (isset($required_fields)) {
124
+        foreach ($required_fields as $field) {
125 125
             print "<th>"._($field['name'])."</th>";
126
-		}
126
+        }
127 127
     }
128
-	print "	<th></th>";
129
-	print "</tr>";
128
+    print "	<th></th>";
129
+    print "</tr>";
130 130
 
131
-	// alive
132
-	$m=0;
133
-	foreach ($new_vlans as $number=>$name ) {
131
+    // alive
132
+    $m=0;
133
+    foreach ($new_vlans as $number=>$name ) {
134 134
         print "<tr class='result$m'>";
135
-		//number
136
-		print "<td>$number</td>";
137
-		//name
138
-		print "<td>";
139
-		print "	<input type='text' class='form-control input-sm' name='name$m' value='$name'>";
140
-		print "	<input type='hidden' name='number$m' value='$number'>";
141
-		print "	<input type='hidden' name='domainId$m' value='$_POST[domainId]'>";
142
-
143
-		print "</td>";
144
-		//description
145
-		print "<td>";
146
-		print "	<input type='text' class='form-control input-sm' name='description$m' value='$name'>";
147
-		print "</td>";
148
-		// custom
149
-		if (isset($required_fields)) {
150
-    		foreach ($required_fields as $field) {
151
-    			# replace spaces with |
152
-    			$field['nameNew'] = str_replace(" ", "___", $field['name']);
153
-
154
-    			print '	<td>'. "\n";
155
-
156
-    			//set type
157
-    			if(substr($field['type'], 0,3) == "set" || substr($field['type'], 0,4) == "enum") {
158
-    				//parse values
159
-    				$tmp = substr($field['type'], 0,3)=="set" ? explode(",", str_replace(array("set(", ")", "'"), "", $field['type'])) : explode(",", str_replace(array("enum(", ")", "'"), "", $field['type']));
160
-    				//null
161
-    				if($field['Null']!="NO") { array_unshift($tmp, ""); }
162
-
163
-    				print "<select name='$field[nameNew]$m' class='form-control input-sm input-w-auto' rel='tooltip' data-placement='right' title='$field[Comment]'>";
164
-    				foreach($tmp as $v) {
165
-    					if($v==@$address[$field['name']])	{ print "<option value='$v' selected='selected'>$v</option>"; }
166
-    					else								{ print "<option value='$v'>$v</option>"; }
167
-    				}
168
-    				print "</select>";
169
-    			}
170
-    			//date and time picker
171
-    			elseif($field['type'] == "date" || $field['type'] == "datetime") {
172
-    				// just for first
173
-    				if($timeP==0) {
174
-    					print '<link rel="stylesheet" type="text/css" href="css/1.2/bootstrap/bootstrap-datetimepicker.min.css">';
175
-    					print '<script type="text/javascript" src="js/1.2/bootstrap-datetimepicker.min.js"></script>';
176
-    					print '<script type="text/javascript">';
177
-    					print '$(document).ready(function() {';
178
-    					//date only
179
-    					print '	$(".datepicker").datetimepicker( {pickDate: true, pickTime: false, pickSeconds: false });';
180
-    					//date + time
181
-    					print '	$(".datetimepicker").datetimepicker( { pickDate: true, pickTime: true } );';
182
-
183
-    					print '})';
184
-    					print '</script>';
185
-    				}
186
-    				$timeP++;
187
-
188
-    				//set size
189
-    				if($field['type'] == "date")	{ $size = 10; $class='datepicker';		$format = "yyyy-MM-dd"; }
190
-    				else							{ $size = 19; $class='datetimepicker';	$format = "yyyy-MM-dd"; }
191
-
192
-    				//field
193
-    				if(!isset($address[$field['name']]))	{ print ' <input type="text" class="'.$class.' form-control input-sm input-w-auto" data-format="'.$format.'" name="'. $field['nameNew'].$m .'" maxlength="'.$size.'" '.$delete.' rel="tooltip" data-placement="right" title="'.$field['Comment'].'">'. "\n"; }
194
-    				else									{ print ' <input type="text" class="'.$class.' form-control input-sm input-w-auto" data-format="'.$format.'" name="'. $field['nameNew'].$m .'" maxlength="'.$size.'" value="'. $address[$field['name']]. '" '.$delete.' rel="tooltip" data-placement="right" title="'.$field['Comment'].'">'. "\n"; }
195
-    			}
196
-    			//boolean
197
-    			elseif($field['type'] == "tinyint(1)") {
198
-    				print "<select name='$field[nameNew]$m' class='form-control input-sm input-w-auto' rel='tooltip' data-placement='right' title='$field[Comment]'>";
199
-    				$tmp = array(0=>"No",1=>"Yes");
200
-    				//null
201
-    				if($field['Null']!="NO") { $tmp[2] = ""; }
202
-
203
-    				foreach($tmp as $k=>$v) {
204
-    					if(strlen(@$address[$field['name']])==0 && $k==2)	{ print "<option value='$k' selected='selected'>"._($v)."</option>"; }
205
-    					elseif($k==@$address[$field['name']])				{ print "<option value='$k' selected='selected'>"._($v)."</option>"; }
206
-    					else												{ print "<option value='$k'>"._($v)."</option>"; }
207
-    				}
208
-    				print "</select>";
209
-    			}
210
-    			//default - input field
211
-    			else {
212
-    				print ' <input type="text" class="ip_addr form-control input-sm" name="'. $field['nameNew'].$m .'" placeholder="'. $field['name'] .'" value="'. @$address[$field['name']]. '" size="30" '.$delete.' rel="tooltip" data-placement="right" title="'.$field['Comment'].'">'. "\n";
213
-    			}
135
+        //number
136
+        print "<td>$number</td>";
137
+        //name
138
+        print "<td>";
139
+        print "	<input type='text' class='form-control input-sm' name='name$m' value='$name'>";
140
+        print "	<input type='hidden' name='number$m' value='$number'>";
141
+        print "	<input type='hidden' name='domainId$m' value='$_POST[domainId]'>";
142
+
143
+        print "</td>";
144
+        //description
145
+        print "<td>";
146
+        print "	<input type='text' class='form-control input-sm' name='description$m' value='$name'>";
147
+        print "</td>";
148
+        // custom
149
+        if (isset($required_fields)) {
150
+            foreach ($required_fields as $field) {
151
+                # replace spaces with |
152
+                $field['nameNew'] = str_replace(" ", "___", $field['name']);
153
+
154
+                print '	<td>'. "\n";
155
+
156
+                //set type
157
+                if(substr($field['type'], 0,3) == "set" || substr($field['type'], 0,4) == "enum") {
158
+                    //parse values
159
+                    $tmp = substr($field['type'], 0,3)=="set" ? explode(",", str_replace(array("set(", ")", "'"), "", $field['type'])) : explode(",", str_replace(array("enum(", ")", "'"), "", $field['type']));
160
+                    //null
161
+                    if($field['Null']!="NO") { array_unshift($tmp, ""); }
162
+
163
+                    print "<select name='$field[nameNew]$m' class='form-control input-sm input-w-auto' rel='tooltip' data-placement='right' title='$field[Comment]'>";
164
+                    foreach($tmp as $v) {
165
+                        if($v==@$address[$field['name']])	{ print "<option value='$v' selected='selected'>$v</option>"; }
166
+                        else								{ print "<option value='$v'>$v</option>"; }
167
+                    }
168
+                    print "</select>";
169
+                }
170
+                //date and time picker
171
+                elseif($field['type'] == "date" || $field['type'] == "datetime") {
172
+                    // just for first
173
+                    if($timeP==0) {
174
+                        print '<link rel="stylesheet" type="text/css" href="css/1.2/bootstrap/bootstrap-datetimepicker.min.css">';
175
+                        print '<script type="text/javascript" src="js/1.2/bootstrap-datetimepicker.min.js"></script>';
176
+                        print '<script type="text/javascript">';
177
+                        print '$(document).ready(function() {';
178
+                        //date only
179
+                        print '	$(".datepicker").datetimepicker( {pickDate: true, pickTime: false, pickSeconds: false });';
180
+                        //date + time
181
+                        print '	$(".datetimepicker").datetimepicker( { pickDate: true, pickTime: true } );';
182
+
183
+                        print '})';
184
+                        print '</script>';
185
+                    }
186
+                    $timeP++;
187
+
188
+                    //set size
189
+                    if($field['type'] == "date")	{ $size = 10; $class='datepicker';		$format = "yyyy-MM-dd"; }
190
+                    else							{ $size = 19; $class='datetimepicker';	$format = "yyyy-MM-dd"; }
191
+
192
+                    //field
193
+                    if(!isset($address[$field['name']]))	{ print ' <input type="text" class="'.$class.' form-control input-sm input-w-auto" data-format="'.$format.'" name="'. $field['nameNew'].$m .'" maxlength="'.$size.'" '.$delete.' rel="tooltip" data-placement="right" title="'.$field['Comment'].'">'. "\n"; }
194
+                    else									{ print ' <input type="text" class="'.$class.' form-control input-sm input-w-auto" data-format="'.$format.'" name="'. $field['nameNew'].$m .'" maxlength="'.$size.'" value="'. $address[$field['name']]. '" '.$delete.' rel="tooltip" data-placement="right" title="'.$field['Comment'].'">'. "\n"; }
195
+                }
196
+                //boolean
197
+                elseif($field['type'] == "tinyint(1)") {
198
+                    print "<select name='$field[nameNew]$m' class='form-control input-sm input-w-auto' rel='tooltip' data-placement='right' title='$field[Comment]'>";
199
+                    $tmp = array(0=>"No",1=>"Yes");
200
+                    //null
201
+                    if($field['Null']!="NO") { $tmp[2] = ""; }
202
+
203
+                    foreach($tmp as $k=>$v) {
204
+                        if(strlen(@$address[$field['name']])==0 && $k==2)	{ print "<option value='$k' selected='selected'>"._($v)."</option>"; }
205
+                        elseif($k==@$address[$field['name']])				{ print "<option value='$k' selected='selected'>"._($v)."</option>"; }
206
+                        else												{ print "<option value='$k'>"._($v)."</option>"; }
207
+                    }
208
+                    print "</select>";
209
+                }
210
+                //default - input field
211
+                else {
212
+                    print ' <input type="text" class="ip_addr form-control input-sm" name="'. $field['nameNew'].$m .'" placeholder="'. $field['name'] .'" value="'. @$address[$field['name']]. '" size="30" '.$delete.' rel="tooltip" data-placement="right" title="'.$field['Comment'].'">'. "\n";
213
+                }
214 214
 
215 215
                 print " </td>";
216
-    		}
217
-		}
218
-		//remove button
219
-		print 	"<td><a href='' class='btn btn-xs btn-danger resultRemove' data-target='result$m'><i class='fa fa-times'></i></a></td>";
220
-		print "</tr>";
221
-
222
-		$m++;
223
-	}
224
-
225
-	//submit
226
-	print "<tr>";
227
-	print "	<td colspan='$colspan'>";
228
-	print " <div id='vlanScanAddResult'></div>";
229
-	print "		<a href='' class='btn btn-sm btn-success pull-right' id='saveVlanScanResults' data-script='vlans-scan' data-subnetId='".$_POST['subnetId']."'><i class='fa fa-plus'></i> "._("Add discovered VLANS")."</a>";
230
-	print "	</td>";
231
-	print "</tr>";
232
-
233
-	print "</table>";
234
-	print "</form>";
216
+            }
217
+        }
218
+        //remove button
219
+        print 	"<td><a href='' class='btn btn-xs btn-danger resultRemove' data-target='result$m'><i class='fa fa-times'></i></a></td>";
220
+        print "</tr>";
221
+
222
+        $m++;
223
+    }
224
+
225
+    //submit
226
+    print "<tr>";
227
+    print "	<td colspan='$colspan'>";
228
+    print " <div id='vlanScanAddResult'></div>";
229
+    print "		<a href='' class='btn btn-sm btn-success pull-right' id='saveVlanScanResults' data-script='vlans-scan' data-subnetId='".$_POST['subnetId']."'><i class='fa fa-plus'></i> "._("Add discovered VLANS")."</a>";
230
+    print "	</td>";
231
+    print "</tr>";
232
+
233
+    print "</table>";
234
+    print "</form>";
235 235
 
236 236
     // print errors
237 237
     if (isset($errors)) {
Please login to merge, or discard this patch.
app/admin/filter-fields/index.php 1 patch
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 
11 11
 # get all fields in IP table
12 12
 foreach($Tools->fetch_standard_fields("ipaddresses") as $s) {
13
-	$standard_fields[$s] = $s;
13
+    $standard_fields[$s] = $s;
14 14
 }
15 15
 
16 16
 # get all selected fields and put them to array
@@ -18,10 +18,10 @@  discard block
 block discarded – undo
18 18
 
19 19
 /* unset mandatory fields -> id,subnetid,ip_addr */
20 20
 unset($standard_fields['id'], $standard_fields['state'], $standard_fields['subnetId'],
21
-      $standard_fields['ip_addr'], $standard_fields['description'], $standard_fields['dns_name'],
22
-      $standard_fields['lastSeen'], $standard_fields['excludePing'], $standard_fields['editDate'],
23
-      $standard_fields['is_gateway'], $standard_fields['PTR'], $standard_fields['PTRignore'],
24
-      $standard_fields['firewallAddressObject']);
21
+        $standard_fields['ip_addr'], $standard_fields['description'], $standard_fields['dns_name'],
22
+        $standard_fields['lastSeen'], $standard_fields['excludePing'], $standard_fields['editDate'],
23
+        $standard_fields['is_gateway'], $standard_fields['PTR'], $standard_fields['PTRignore'],
24
+        $standard_fields['firewallAddressObject']);
25 25
 ?>
26 26
 
27 27
 
@@ -42,16 +42,16 @@  discard block
 block discarded – undo
42 42
 <!-- fields -->
43 43
 <?php
44 44
 foreach($standard_fields as $field) {
45
-	# set active
46
-	$checked = in_array($field, $selected_fields) ? "checked" : "";
45
+    # set active
46
+    $checked = in_array($field, $selected_fields) ? "checked" : "";
47 47
 
48
-	# replace switch
49
-	$field_print = $field=="switch" ? "device" : $field;
48
+    # replace switch
49
+    $field_print = $field=="switch" ? "device" : $field;
50 50
 
51
-	print '<tr>'. "\n";
52
-	print '	<td style="width:10px;padding-left:10px;"><input type="checkbox" class="input-switch" name="'. $field .'" value="'. $field .'" '. $checked .'></td>';
53
-	print '	<td>'. ucfirst($field_print) .'</td>';
54
-	print '</tr>';
51
+    print '<tr>'. "\n";
52
+    print '	<td style="width:10px;padding-left:10px;"><input type="checkbox" class="input-switch" name="'. $field .'" value="'. $field .'" '. $checked .'></td>';
53
+    print '	<td>'. ucfirst($field_print) .'</td>';
54
+    print '</tr>';
55 55
 }
56 56
 ?>
57 57
 
Please login to merge, or discard this patch.
app/admin/filter-fields/filter-result.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@
 block discarded – undo
19 19
 
20 20
 # set fields to update
21 21
 $values = array("id"=>1,
22
-				"IPfilter"=>implode(';', $_POST));
22
+                "IPfilter"=>implode(';', $_POST));
23 23
 
24 24
 # update
25 25
 if(!$Admin->object_modify("settings", "edit", "id", $values))   { $Result->show("danger alert-absolute",  _("Update failed"), true); }
Please login to merge, or discard this patch.
app/admin/firewall-zones/settings-save.php 1 patch
Indentation   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -22,104 +22,104 @@  discard block
 block discarded – undo
22 22
 
23 23
 # check for the maximum length of the zone name, it has to be between 3 and 31. also be sure that this value is decimal.
24 24
 if (($_POST['zoneLength'] < 1) || ($_POST['zoneLength'] > 31)) {
25
-	$Result->show("danger", _("Invalid zone name length parameter. A valid valid value is between 1 and 31."), true);
25
+    $Result->show("danger", _("Invalid zone name length parameter. A valid valid value is between 1 and 31."), true);
26 26
 }
27 27
 
28 28
 # validate the IPv4 type alias.
29 29
 if (!preg_match('/^[a-zA-Z0-9\-\_.]+$/i', $_POST['ipType'][0])) {
30
-	$Result->show("danger", _("Invalid IPv4 address type alias. Only alphanumeric characters, &quot;-&quot;, &quot;_&quot; and &quot;.&quot; are allowed."), true);
30
+    $Result->show("danger", _("Invalid IPv4 address type alias. Only alphanumeric characters, &quot;-&quot;, &quot;_&quot; and &quot;.&quot; are allowed."), true);
31 31
 }
32 32
 
33 33
 # validate the IPv6 type alias.
34 34
 if (!preg_match('/^[a-zA-Z0-9\-\_.]+$/i', $_POST['ipType'][1])) {
35
-	$Result->show("danger", _("Invalid IPv4 address type alias. Only alphanumeric characters, &quot;-&quot;, &quot;_&quot; and &quot;.&quot; are allowed."), true);
35
+    $Result->show("danger", _("Invalid IPv4 address type alias. Only alphanumeric characters, &quot;-&quot;, &quot;_&quot; and &quot;.&quot; are allowed."), true);
36 36
 }
37 37
 
38 38
 # validate the separator character.
39 39
 if (!preg_match('/^[\-\_.]+$/i', $_POST['separator'])) {
40
-	$Result->show("danger", _("Invalid separator. Only &quot;-&quot;, &quot;_&quot; and &quot;.&quot; are allowed."), true);
40
+    $Result->show("danger", _("Invalid separator. Only &quot;-&quot;, &quot;_&quot; and &quot;.&quot; are allowed."), true);
41 41
 }
42 42
 
43 43
 # validate the indicator for own firewall zones.
44 44
 if (!preg_match('/^[a-zA-Z0-9\-\_.]+$/i', $_POST['indicator'][0])) {
45
-	$Result->show("danger", _("Invalid zone indicator. Only alphanumeric characters, &quot;-&quot;, &quot;_&quot; and &quot;.&quot; are allowed."), true);
45
+    $Result->show("danger", _("Invalid zone indicator. Only alphanumeric characters, &quot;-&quot;, &quot;_&quot; and &quot;.&quot; are allowed."), true);
46 46
 }
47 47
 
48 48
 # validate the IPv6 type alias.
49 49
 if (!preg_match('/^[a-zA-Z0-9\-\_.]+$/i', $_POST['indicator'][1])) {
50
-	$Result->show("danger", _("Invalid zone indicator. Only alphanumeric characters, &quot;-&quot;, &quot;_&quot; and &quot;.&quot; are allowed."), true);
50
+    $Result->show("danger", _("Invalid zone indicator. Only alphanumeric characters, &quot;-&quot;, &quot;_&quot; and &quot;.&quot; are allowed."), true);
51 51
 }
52 52
 
53 53
 # validate the zoneGenerator value.
54 54
 if (!preg_match('/^[0-3]$/i', $_POST['zoneGenerator'])) {
55
-	$Result->show("danger", _("Invalid zone generator method. Do not manipulate the POST values!"), true);
55
+    $Result->show("danger", _("Invalid zone generator method. Do not manipulate the POST values!"), true);
56 56
 }
57 57
 
58 58
 # validate the hidden values (zoneGeneratorType).
59 59
 if ($_POST['zoneGeneratorType'][0] != 'decimal') {
60
-	$Result->show("danger", _("Invalid zone generator types [decimal]. Do not manipulate the POST values!"), true);
60
+    $Result->show("danger", _("Invalid zone generator types [decimal]. Do not manipulate the POST values!"), true);
61 61
 }
62 62
 if ($_POST['zoneGeneratorType'][1] != 'hex') {
63
-	$Result->show("danger", _("Invalid zone generator types [hex]. Do not manipulate the POST values!"), true);
63
+    $Result->show("danger", _("Invalid zone generator types [hex]. Do not manipulate the POST values!"), true);
64 64
 }
65 65
 if ($_POST['zoneGeneratorType'][2] != 'text') {
66
-	$Result->show("danger", _("Invalid zone generator types [text]. Do not manipulate the POST values!"), true);
66
+    $Result->show("danger", _("Invalid zone generator types [text]. Do not manipulate the POST values!"), true);
67 67
 }
68 68
 
69 69
 # validate the padding checkbox value
70 70
 if ($_POST['padding']) {
71
-	if ($_POST['padding'] != 'on' && $_POST['padding'] != 'off') {
72
-		$Result->show("danger", _("Invalid padding value. Use the checkbox to set the padding value to on or off."), true);
73
-	}
71
+    if ($_POST['padding'] != 'on' && $_POST['padding'] != 'off') {
72
+        $Result->show("danger", _("Invalid padding value. Use the checkbox to set the padding value to on or off."), true);
73
+    }
74 74
 }
75 75
 
76 76
 # validate the strictMode checkbox value
77 77
 if ($_POST['strictMode']) {
78
-	if ($_POST['strictMode'] != 'on' && $_POST['strictMode'] != 'off') {
79
-		$Result->show("danger", _("Invalid padding value. Use the checkbox to set the padding value to on or off."), true);
80
-	}
78
+    if ($_POST['strictMode'] != 'on' && $_POST['strictMode'] != 'off') {
79
+        $Result->show("danger", _("Invalid padding value. Use the checkbox to set the padding value to on or off."), true);
80
+    }
81 81
 }
82 82
 
83 83
 # validate the autogen checkbox value
84 84
 if ($_POST['autogen']) {
85
-	if ($_POST['autogen'] != 'on' && $_POST['autogen'] != 'off') {
86
-		$Result->show("danger", _("Invalid autogen value. Use the checkbox to set the autogen value to on or off."), true);
87
-	}
85
+    if ($_POST['autogen'] != 'on' && $_POST['autogen'] != 'off') {
86
+        $Result->show("danger", _("Invalid autogen value. Use the checkbox to set the autogen value to on or off."), true);
87
+    }
88 88
 }
89 89
 
90 90
 # validate the pattern array
91 91
 if ($_POST['pattern']) {
92
-	foreach ($_POST['pattern'] as $pattern) {
93
-		if (	$pattern != 'patternIndicator' 
94
-			&& 	$pattern != 'patternZoneName' 
95
-			&& 	$pattern != 'patternIPType' 
96
-			&& 	$pattern != 'patternHost' 
97
-			&& 	$pattern != 'patternFQDN' 
98
-			&& 	$pattern != 'patternSeparator' 
99
-			&& 	$pattern != '') {
100
-			$Result->show("danger", _("Invalid pattern value."), true);
101
-		}
102
-	}
92
+    foreach ($_POST['pattern'] as $pattern) {
93
+        if (	$pattern != 'patternIndicator' 
94
+            && 	$pattern != 'patternZoneName' 
95
+            && 	$pattern != 'patternIPType' 
96
+            && 	$pattern != 'patternHost' 
97
+            && 	$pattern != 'patternFQDN' 
98
+            && 	$pattern != 'patternSeparator' 
99
+            && 	$pattern != '') {
100
+            $Result->show("danger", _("Invalid pattern value."), true);
101
+        }
102
+    }
103 103
 } else {
104
-	$Result->show("danger", _("Please select at least one item to generate a valid name pattern."), true);
104
+    $Result->show("danger", _("Please select at least one item to generate a valid name pattern."), true);
105 105
 }
106 106
 
107 107
 # validate device type ID.
108 108
 if (!preg_match('/^[0-9]+$/i', $_POST['deviceType'])) {
109
-	$Result->show("danger", _("Invalid device type."), true);
109
+    $Result->show("danger", _("Invalid device type."), true);
110 110
 }
111 111
 
112 112
 # validate the hidden values (subnetPatternValues).
113 113
 if ($_POST['subnetPatternValues'][0] != 'network') {
114
-	$Result->show("danger", _("Invalid subnet name type [network]. Do not manipulate the POST values!"), true);
114
+    $Result->show("danger", _("Invalid subnet name type [network]. Do not manipulate the POST values!"), true);
115 115
 }
116 116
 if ($_POST['subnetPatternValues'][1] != 'description') {
117
-	$Result->show("danger", _("Invalid subnet name type [description]. Do not manipulate the POST values!"), true);
117
+    $Result->show("danger", _("Invalid subnet name type [description]. Do not manipulate the POST values!"), true);
118 118
 }
119 119
 
120 120
 # validate the subnetPattern value.
121 121
 if (!preg_match('/^[0-1]$/i', $_POST['subnetPattern'])) {
122
-	$Result->show("danger", _("Invalid subnet name. Do not manipulate the POST values!"), true);
122
+    $Result->show("danger", _("Invalid subnet name. Do not manipulate the POST values!"), true);
123 123
 }
124 124
 
125 125
 # formulate json
@@ -151,8 +151,8 @@  discard block
 block discarded – undo
151 151
 
152 152
 # prepare the database update and encode the array with JSON_FORCE_OBJECT to keep the ids.
153 153
 $values = array('id' => 1,
154
-				'firewallZoneSettings' => json_encode($values,JSON_FORCE_OBJECT)
155
-				);
154
+                'firewallZoneSettings' => json_encode($values,JSON_FORCE_OBJECT)
155
+                );
156 156
 
157 157
 # update the settings, alert or reply the success message.
158 158
 if(!$Admin->object_modify("settings", "edit", "id", $values)) 	{ $Result->show("danger",  _("Cannot update settings"), true); }
Please login to merge, or discard this patch.
app/admin/firewall-zones/mapping.php 1 patch
Indentation   +91 added lines, -91 removed lines patch added patch discarded remove patch
@@ -19,12 +19,12 @@  discard block
 block discarded – undo
19 19
 
20 20
 # reorder by device
21 21
 if ($firewallZoneMapping!==false) {
22
-	# devices
23
-	$devices = array();
24
-	# add
25
-	foreach ($firewallZoneMapping as $m) {
26
-		$devices[$m->deviceId][] = $m;
27
-	}
22
+    # devices
23
+    $devices = array();
24
+    # add
25
+    foreach ($firewallZoneMapping as $m) {
26
+        $devices[$m->deviceId][] = $m;
27
+    }
28 28
 }
29 29
 ?>
30 30
 <!-- Add new firewall zone mapping -->
@@ -50,99 +50,99 @@  discard block
 block discarded – undo
50 50
 
51 51
 	<?php
52 52
 
53
-	# loop
54
-	foreach ($devices as $k=>$firewallZoneMapping) { ?>
53
+    # loop
54
+    foreach ($devices as $k=>$firewallZoneMapping) { ?>
55 55
 		<!-- header -->
56 56
 		<tr>
57 57
 		<?php
58
-		$devices[$k][0]->deviceDescription = strlen($devices[$k][0]->deviceDescription)<1 ? "" : "(".$devices[$k][0]->deviceDescription.")";
59
-		print '<th colspan="8" style="background:white"><h4>'.$devices[$k][0]->deviceName.$devices[$k][0]->deviceDescription	.'</h4></th>';
60
-		?>
58
+        $devices[$k][0]->deviceDescription = strlen($devices[$k][0]->deviceDescription)<1 ? "" : "(".$devices[$k][0]->deviceDescription.")";
59
+        print '<th colspan="8" style="background:white"><h4>'.$devices[$k][0]->deviceName.$devices[$k][0]->deviceDescription	.'</h4></th>';
60
+        ?>
61 61
 		</tr>
62 62
 		<?php
63 63
 
64
-		# mappings
65
-		foreach ($firewallZoneMapping as $mapping ) {
66
-			# set rowspan in case if there are more than one networks bound to the zone
67
-			$counter = count($mapping->network);
68
-			if ($counter === 0) {
69
-				$counter = 1;
70
-			}
71
-			# set the loop counter
72
-			$i = 1;
73
-			if ($mapping->network) {
74
-				foreach ($mapping->network as $key => $network) {
75
-					print '<tr class="border-top">';
76
-					if ($i === 1) {
77
-						$title = $mapping->indicator == 0 ? 'Own Zone' : 'Customer Zone';
78
-						// print
79
-						print '<td rowspan="'.$counter.'"><span class="fa '.($mapping->indicator == 0 ? 'fa-home':'fa-group').'"  title="'._($title).'"></span></td>';
80
-						print '<td rowspan="'.$counter.'">'.$mapping->zone.'</td>';
81
-						print '<td rowspan="'.$counter.'">'.$mapping->alias.'</td>';
82
-						print '<td rowspan="'.$counter.'">'.$mapping->description.'</td>';
83
-						print '<td rowspan="'.$counter.'">'.$mapping->interface.'</td>';
84
-					}
85
-					# display subnet informations
86
-					if ($network->subnetId) {
87
-						// description fix
88
-						$network->subnetDescription = strlen($network->subnetDescription)>0 ? " (".$network->subnetDescription.")" : "";
89
-						// subnet
90
-						if (!$network->subnetIsFolder) {
91
-							print '<td><a href="'.create_link("subnets",$network->sectionId,$network->subnetId).'">'.$Subnets->transform_to_dotted($network->subnet).'/'.$network->subnetMask.$network->subnetDescription.'</a></td>';
92
-						}
93
-						else {
94
-							print '<td><a href="'.create_link("subnets",$network->sectionId,$network->subnetId).'">Folder'.$network->subnetDescription.'</a></td>';
95
-						}
96
-					} else {
97
-						print '<td>/</td>';
98
-					}
99
-					# display vlan informations
100
-					if ($network->vlanId) {
101
-						// name fix
102
-						$network->vlanName = strlen($network->vlanName)>0 ? " (".$network->vlanName.")" : "";
103
-						print '<td><a href="'.create_link('tools','vlan',$network->domainId,$network->vlanId).'">Vlan '.$network->vlan.''.$network->vlanName.'</a></td>';
104
-					} else {
105
-						print '<td>/</td>';
106
-					}
107
-					if ($i === 1) {
108
-						# action menu
109
-						print '<td rowspan="'.$counter.'">';
110
-						print '<div class="btn-group">';
111
-						print '<button class="btn btn-default btn-xs editMapping" data-action="edit" data-id="'.$mapping->mappingId.'""><i class="fa fa-pencil"></i></button>';
112
-						print '<button class="btn btn-default btn-xs editMapping" data-action="delete" data-id="'.$mapping->mappingId.'"><i class="fa fa-remove"></i></button>';
113
-						print '</div>';
114
-						print '</td>';
115
-					}
116
-					print '</tr>';
117
-					# increase the loop counter
118
-					$i++;
119
-				}
120
-			} else {
121
-				print "<tr class='border-top'>";
122
-				# display only the zone mapping data if there is no network data available
123
-				$title = $mapping->indicator == 0 ? 'Own Zone' : 'Customer Zone';
64
+        # mappings
65
+        foreach ($firewallZoneMapping as $mapping ) {
66
+            # set rowspan in case if there are more than one networks bound to the zone
67
+            $counter = count($mapping->network);
68
+            if ($counter === 0) {
69
+                $counter = 1;
70
+            }
71
+            # set the loop counter
72
+            $i = 1;
73
+            if ($mapping->network) {
74
+                foreach ($mapping->network as $key => $network) {
75
+                    print '<tr class="border-top">';
76
+                    if ($i === 1) {
77
+                        $title = $mapping->indicator == 0 ? 'Own Zone' : 'Customer Zone';
78
+                        // print
79
+                        print '<td rowspan="'.$counter.'"><span class="fa '.($mapping->indicator == 0 ? 'fa-home':'fa-group').'"  title="'._($title).'"></span></td>';
80
+                        print '<td rowspan="'.$counter.'">'.$mapping->zone.'</td>';
81
+                        print '<td rowspan="'.$counter.'">'.$mapping->alias.'</td>';
82
+                        print '<td rowspan="'.$counter.'">'.$mapping->description.'</td>';
83
+                        print '<td rowspan="'.$counter.'">'.$mapping->interface.'</td>';
84
+                    }
85
+                    # display subnet informations
86
+                    if ($network->subnetId) {
87
+                        // description fix
88
+                        $network->subnetDescription = strlen($network->subnetDescription)>0 ? " (".$network->subnetDescription.")" : "";
89
+                        // subnet
90
+                        if (!$network->subnetIsFolder) {
91
+                            print '<td><a href="'.create_link("subnets",$network->sectionId,$network->subnetId).'">'.$Subnets->transform_to_dotted($network->subnet).'/'.$network->subnetMask.$network->subnetDescription.'</a></td>';
92
+                        }
93
+                        else {
94
+                            print '<td><a href="'.create_link("subnets",$network->sectionId,$network->subnetId).'">Folder'.$network->subnetDescription.'</a></td>';
95
+                        }
96
+                    } else {
97
+                        print '<td>/</td>';
98
+                    }
99
+                    # display vlan informations
100
+                    if ($network->vlanId) {
101
+                        // name fix
102
+                        $network->vlanName = strlen($network->vlanName)>0 ? " (".$network->vlanName.")" : "";
103
+                        print '<td><a href="'.create_link('tools','vlan',$network->domainId,$network->vlanId).'">Vlan '.$network->vlan.''.$network->vlanName.'</a></td>';
104
+                    } else {
105
+                        print '<td>/</td>';
106
+                    }
107
+                    if ($i === 1) {
108
+                        # action menu
109
+                        print '<td rowspan="'.$counter.'">';
110
+                        print '<div class="btn-group">';
111
+                        print '<button class="btn btn-default btn-xs editMapping" data-action="edit" data-id="'.$mapping->mappingId.'""><i class="fa fa-pencil"></i></button>';
112
+                        print '<button class="btn btn-default btn-xs editMapping" data-action="delete" data-id="'.$mapping->mappingId.'"><i class="fa fa-remove"></i></button>';
113
+                        print '</div>';
114
+                        print '</td>';
115
+                    }
116
+                    print '</tr>';
117
+                    # increase the loop counter
118
+                    $i++;
119
+                }
120
+            } else {
121
+                print "<tr class='border-top'>";
122
+                # display only the zone mapping data if there is no network data available
123
+                $title = $mapping->indicator == 0 ? 'Own Zone' : 'Customer Zone';
124 124
 
125
-				print '<td rowspan="'.$counter.'"><span class="fa fa-home"  title="'._($title).'"></span></td>';
126
-				print '<td rowspan="'.$counter.'">'.$mapping->zone.'</td>';
127
-				print '<td rowspan="'.$counter.'">'.$mapping->alias.'</td>';
128
-				print '<td rowspan="'.$counter.'">'.$mapping->description.'</td>';
129
-				print '<td rowspan="'.$counter.'">'.$mapping->interface.'</td>';
130
-				print '<td colspan="2"></td>';
131
-				# action menu
132
-				print '<td>';
133
-				print '<div class="btn-group">';
134
-				print '<button class="btn btn-default btn-xs editMapping" data-action="edit" data-id="'.$mapping->mappingId.'""><i class="fa fa-pencil"></i></button>';
135
-				print '<button class="btn btn-default btn-xs editMapping" data-action="delete" data-id="'.$mapping->mappingId.'"><i class="fa fa-remove"></i></button>';
136
-				print '</div>';
137
-				print '</td>';
138
-				print '</tr>';
139
-			}
140
-		}
141
-	}
142
-	print '</table>';
125
+                print '<td rowspan="'.$counter.'"><span class="fa fa-home"  title="'._($title).'"></span></td>';
126
+                print '<td rowspan="'.$counter.'">'.$mapping->zone.'</td>';
127
+                print '<td rowspan="'.$counter.'">'.$mapping->alias.'</td>';
128
+                print '<td rowspan="'.$counter.'">'.$mapping->description.'</td>';
129
+                print '<td rowspan="'.$counter.'">'.$mapping->interface.'</td>';
130
+                print '<td colspan="2"></td>';
131
+                # action menu
132
+                print '<td>';
133
+                print '<div class="btn-group">';
134
+                print '<button class="btn btn-default btn-xs editMapping" data-action="edit" data-id="'.$mapping->mappingId.'""><i class="fa fa-pencil"></i></button>';
135
+                print '<button class="btn btn-default btn-xs editMapping" data-action="delete" data-id="'.$mapping->mappingId.'"><i class="fa fa-remove"></i></button>';
136
+                print '</div>';
137
+                print '</td>';
138
+                print '</tr>';
139
+            }
140
+        }
141
+    }
142
+    print '</table>';
143 143
 }
144 144
 else {
145
-	# print an info if there are no zones in the database
146
-	$Result->show("info", _("No firewall zones configured"), false);
145
+    # print an info if there are no zones in the database
146
+    $Result->show("info", _("No firewall zones configured"), false);
147 147
 }
148 148
 ?>
149 149
\ No newline at end of file
Please login to merge, or discard this patch.
app/admin/firewall-zones/zones-edit.php 1 patch
Indentation   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 
32 32
 # fetch old zone
33 33
 if ($_POST['action'] != 'add') {
34
-	$firewallZone = $Zones->get_zone($_POST['id']);
34
+    $firewallZone = $Zones->get_zone($_POST['id']);
35 35
 }
36 36
 
37 37
 # disable edit on delete
@@ -65,31 +65,31 @@  discard block
 block discarded – undo
65 65
 		</td>
66 66
 
67 67
 		<?php
68
-		# transmit the action and firewall zone id
69
-		print '<input type="hidden" name="action" value="'.$_POST['action'].'">';
70
-		print '<input type="hidden" name="id" value="'.$firewallZone->id.'">';
71
-		# possible zoneGenerator values:
72
-		#		0 == autogenerated decimal name
73
-		#		1 == autogenerated hex name
74
-		#		2 == free text name
75
-
76
-		if ($_POST['action'] == 'add') {
77
-			# check if we have to autogenerate a zone name or if we have to display a text box
78
-			if ($firewallZoneSettings['zoneGenerator'] == 2) {
79
-				print '<td><input type="text" class="form-control input-sm" name="zone" placeholder="'._('Zone name (Only alphanumeric and special characters like .-_ and space.)').'" value="'.$firewallZone->zone.'" '.$readonly.'></td>';
80
-			} else {
81
-				print '<td><input type="text" class="form-control input-sm" name="zone" placeholder="'._('The zone name will be automatically generated').'" value="'.$firewallZone->zone.'" '.$readonly.' disabled></td>';
82
-			}
83
-		} else {
84
-			if ($firewallZone->generator == 1) {
85
-				print '<td><input type="text" class="form-control input-sm" name="zone" placeholder="'._('Zone name').'" readonly value="'.$firewallZone->zone.'"></td>';
86
-			} elseif ($firewallZone->generator != 2) {
87
-				print '<td><input type="text" class="form-control input-sm" name="zone" placeholder="'._('Zone name').'" readonly value="'.$firewallZone->zone.'"></td>';
88
-			} else {
89
-				print '<td><input type="text" class="form-control input-sm" name="zone" placeholder="'._('Zone name (Only alphanumeric and special characters like .-_ and space.)').'" value="'.$firewallZone->zone.'" '.$readonly.'></td>';
90
-			}
91
-		}
92
-		?>
68
+        # transmit the action and firewall zone id
69
+        print '<input type="hidden" name="action" value="'.$_POST['action'].'">';
70
+        print '<input type="hidden" name="id" value="'.$firewallZone->id.'">';
71
+        # possible zoneGenerator values:
72
+        #		0 == autogenerated decimal name
73
+        #		1 == autogenerated hex name
74
+        #		2 == free text name
75
+
76
+        if ($_POST['action'] == 'add') {
77
+            # check if we have to autogenerate a zone name or if we have to display a text box
78
+            if ($firewallZoneSettings['zoneGenerator'] == 2) {
79
+                print '<td><input type="text" class="form-control input-sm" name="zone" placeholder="'._('Zone name (Only alphanumeric and special characters like .-_ and space.)').'" value="'.$firewallZone->zone.'" '.$readonly.'></td>';
80
+            } else {
81
+                print '<td><input type="text" class="form-control input-sm" name="zone" placeholder="'._('The zone name will be automatically generated').'" value="'.$firewallZone->zone.'" '.$readonly.' disabled></td>';
82
+            }
83
+        } else {
84
+            if ($firewallZone->generator == 1) {
85
+                print '<td><input type="text" class="form-control input-sm" name="zone" placeholder="'._('Zone name').'" readonly value="'.$firewallZone->zone.'"></td>';
86
+            } elseif ($firewallZone->generator != 2) {
87
+                print '<td><input type="text" class="form-control input-sm" name="zone" placeholder="'._('Zone name').'" readonly value="'.$firewallZone->zone.'"></td>';
88
+            } else {
89
+                print '<td><input type="text" class="form-control input-sm" name="zone" placeholder="'._('Zone name (Only alphanumeric and special characters like .-_ and space.)').'" value="'.$firewallZone->zone.'" '.$readonly.'></td>';
90
+            }
91
+        }
92
+        ?>
93 93
 		<input type="hidden" name="generator" value="<?php print $firewallZoneSettings['zoneGenerator']; ?>">
94 94
 
95 95
 	</tr>
@@ -143,29 +143,29 @@  discard block
 block discarded – undo
143 143
 <table class="table table-noborder table-condensed" style="padding-bottom:20px;">
144 144
 <?php
145 145
 if ($firewallZone->network) {
146
-	print "<tr><td colspan='2'><hr></tr>";
147
-	$rowspan = count($firewallZone->network);
148
-	$i = 1;
149
-	foreach ($firewallZone->network as $network) {
150
-		print '<tr>';
151
-		if ($i === 1) {
152
-			print '<td rowspan="'.$rowspan.'" style="width:150px;vertical-align:top">Networks</td>';
153
-		}
154
-		print '<td>';
155
-		print '<a class="btn btn-xs btn-danger editNetwork" style="margin-right:5px;" alt="'._('Delete Network').'" title="'._('Delete Network').'" data-action="delete" data-zoneId="'.$firewallZone->id.'" data-subnetId="'.$network->subnetId.'">';
156
-		print '<span><i class="fa fa-close"></i></span>';
157
-		print "</a>";
158
-
159
-		if ($network->subnetIsFolder == 1) {
160
-			print 'Folder: '.$network->subnetDescription.'</td>';
161
-		} else {
162
-			# display network information with or without description
163
-			if ($network->subnetDescription) 	{	print $Subnets->transform_to_dotted($network->subnet).'/'.$network->subnetMask.' ('.$network->subnetDescription.')</td>';	}
164
-			else 								{	print $Subnets->transform_to_dotted($network->subnet).'/'.$network->subnetMask.'</td>';	}
165
-		}
166
-		print '</tr>';
167
-		$i++;
168
-	}
146
+    print "<tr><td colspan='2'><hr></tr>";
147
+    $rowspan = count($firewallZone->network);
148
+    $i = 1;
149
+    foreach ($firewallZone->network as $network) {
150
+        print '<tr>';
151
+        if ($i === 1) {
152
+            print '<td rowspan="'.$rowspan.'" style="width:150px;vertical-align:top">Networks</td>';
153
+        }
154
+        print '<td>';
155
+        print '<a class="btn btn-xs btn-danger editNetwork" style="margin-right:5px;" alt="'._('Delete Network').'" title="'._('Delete Network').'" data-action="delete" data-zoneId="'.$firewallZone->id.'" data-subnetId="'.$network->subnetId.'">';
156
+        print '<span><i class="fa fa-close"></i></span>';
157
+        print "</a>";
158
+
159
+        if ($network->subnetIsFolder == 1) {
160
+            print 'Folder: '.$network->subnetDescription.'</td>';
161
+        } else {
162
+            # display network information with or without description
163
+            if ($network->subnetDescription) 	{	print $Subnets->transform_to_dotted($network->subnet).'/'.$network->subnetMask.' ('.$network->subnetDescription.')</td>';	}
164
+            else 								{	print $Subnets->transform_to_dotted($network->subnet).'/'.$network->subnetMask.'</td>';	}
165
+        }
166
+        print '</tr>';
167
+        $i++;
168
+    }
169 169
 }
170 170
 ?>
171 171
 </table>
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 <?php
178 178
 #print delete warning
179 179
 if($_POST['action'] == "delete"){
180
-	$Result->show("warning", "<strong>"._('Warning').":</strong> "._("Removing this firewall zone will also remove all referenced mappings!"), false);
180
+    $Result->show("warning", "<strong>"._('Warning').":</strong> "._("Removing this firewall zone will also remove all referenced mappings!"), false);
181 181
 }
182 182
 ?>
183 183
 </div>
Please login to merge, or discard this patch.
app/admin/firewall-zones/zones.php 1 patch
Indentation   +92 added lines, -92 removed lines patch added patch discarded remove patch
@@ -20,104 +20,104 @@
 block discarded – undo
20 20
 # display the zone table if there are any zones in the database
21 21
 if($firewallZones) {
22 22
 
23
-	# table
24
-	print '<table id="zonesPrint" class="table table-top table-td-top table-condensed">';
23
+    # table
24
+    print '<table id="zonesPrint" class="table table-top table-td-top table-condensed">';
25 25
 
26
-	# table headers
27
-	print "<thead>";
28
-	print '<tr style="background:white">';
29
-	print '<th>'._('Type').'</th>';
30
-	print '<th>'._('Zone').'</th>';
31
-	print '<th>'._('Description').'</th>';
32
-	print '<th>'._('Subnet').'</th>';
33
-	print '<th>'._('VLAN').'</th>';
34
-	print '<th style="width:60px;"></th>';
35
-	print '</tr>';
36
-	print "</thead>";
26
+    # table headers
27
+    print "<thead>";
28
+    print '<tr style="background:white">';
29
+    print '<th>'._('Type').'</th>';
30
+    print '<th>'._('Zone').'</th>';
31
+    print '<th>'._('Description').'</th>';
32
+    print '<th>'._('Subnet').'</th>';
33
+    print '<th>'._('VLAN').'</th>';
34
+    print '<th style="width:60px;"></th>';
35
+    print '</tr>';
36
+    print "</thead>";
37 37
 
38 38
     print "<tbody>";
39
-	# display all firewall zones and network information
40
-	foreach ($firewallZones as $zoneObject ) {
41
-		# set rowspan in case if there are more than one networks bound to the zone
42
-		$counter = count($zoneObject->network);
43
-		if ($counter === 0) {
44
-			$counter = 1;
45
-		}
46
-		# set the loop counter
47
-		$i = 1;
48
-		if ($zoneObject->network) {
49
-			foreach ($zoneObject->network as $key => $network) {
50
-				print '<tr class="border-top">';
51
-				if ($i === 1) {
52
-					// set title
53
-					$title = $zoneObject->indicator == 0 ? 'Own Zone' : 'Customer Zone';
54
-					// print
55
-					print '<td rowspan="'.$counter.'"><span class="fa '.($zoneObject->indicator == 0 ? 'fa-home':'fa-group').'"  title="'._($title).'"></span></td>';
56
-					print '<td rowspan="'.$counter.'">'.$zoneObject->zone.'</td>';
57
-					print '<td rowspan="'.$counter.'">'.$zoneObject->description.'</td>';
58
-				}
59
-				# display subnet informations
60
-				if ($network->subnetId) {
61
-					// description fix
62
-					$network->subnetDescription = strlen($network->subnetDescription)>0 ? " (".$network->subnetDescription.")" : "";
39
+    # display all firewall zones and network information
40
+    foreach ($firewallZones as $zoneObject ) {
41
+        # set rowspan in case if there are more than one networks bound to the zone
42
+        $counter = count($zoneObject->network);
43
+        if ($counter === 0) {
44
+            $counter = 1;
45
+        }
46
+        # set the loop counter
47
+        $i = 1;
48
+        if ($zoneObject->network) {
49
+            foreach ($zoneObject->network as $key => $network) {
50
+                print '<tr class="border-top">';
51
+                if ($i === 1) {
52
+                    // set title
53
+                    $title = $zoneObject->indicator == 0 ? 'Own Zone' : 'Customer Zone';
54
+                    // print
55
+                    print '<td rowspan="'.$counter.'"><span class="fa '.($zoneObject->indicator == 0 ? 'fa-home':'fa-group').'"  title="'._($title).'"></span></td>';
56
+                    print '<td rowspan="'.$counter.'">'.$zoneObject->zone.'</td>';
57
+                    print '<td rowspan="'.$counter.'">'.$zoneObject->description.'</td>';
58
+                }
59
+                # display subnet informations
60
+                if ($network->subnetId) {
61
+                    // description fix
62
+                    $network->subnetDescription = strlen($network->subnetDescription)>0 ? " (".$network->subnetDescription.")" : "";
63 63
 
64
-					if (!$network->subnetIsFolder) {
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 {
67
-						print '<td><a href="'.create_link("subnets",$network->sectionId,$network->subnetId).'">Folder'.$network->subnetDescription.'</a></td>';
68
-					}
69
-				} else {
70
-					print '<td>/</td>';
71
-				}
72
-				# display vlan informations
73
-				if ($network->vlanId) {
74
-					// name fix
75
-					$network->vlanName = strlen($network->vlanName)>0 ? " (".$network->vlanName.")" : "";
76
-					print '<td><a href="'.create_link('tools','vlan',$network->domainId,$network->vlanId).'">'.$network->vlan.$network->vlanName.'</a></td>';
77
-				} else {
78
-					print '<td>/</td>';
79
-				}
80
-				// actions
81
-				if ($i === 1) {
82
-					# action menu
83
-					print '<td rowspan="'.$counter.'">';
84
-					print '<div class="btn-group">';
85
-					print '<button class="btn btn-default btn-xs editFirewallZone" data-action="edit" data-id="'.$zoneObject->id.'""><i class="fa fa-pencil"></i></button>';
86
-					print '<button class="btn btn-default btn-xs editFirewallZone" data-action="delete" data-id="'.$zoneObject->id.'"><i class="fa fa-remove"></i></button>';
87
-					print '</div>';
88
-					print '</td>';
89
-				}
90
-				print '</tr>';
64
+                    if (!$network->subnetIsFolder) {
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 {
67
+                        print '<td><a href="'.create_link("subnets",$network->sectionId,$network->subnetId).'">Folder'.$network->subnetDescription.'</a></td>';
68
+                    }
69
+                } else {
70
+                    print '<td>/</td>';
71
+                }
72
+                # display vlan informations
73
+                if ($network->vlanId) {
74
+                    // name fix
75
+                    $network->vlanName = strlen($network->vlanName)>0 ? " (".$network->vlanName.")" : "";
76
+                    print '<td><a href="'.create_link('tools','vlan',$network->domainId,$network->vlanId).'">'.$network->vlan.$network->vlanName.'</a></td>';
77
+                } else {
78
+                    print '<td>/</td>';
79
+                }
80
+                // actions
81
+                if ($i === 1) {
82
+                    # action menu
83
+                    print '<td rowspan="'.$counter.'">';
84
+                    print '<div class="btn-group">';
85
+                    print '<button class="btn btn-default btn-xs editFirewallZone" data-action="edit" data-id="'.$zoneObject->id.'""><i class="fa fa-pencil"></i></button>';
86
+                    print '<button class="btn btn-default btn-xs editFirewallZone" data-action="delete" data-id="'.$zoneObject->id.'"><i class="fa fa-remove"></i></button>';
87
+                    print '</div>';
88
+                    print '</td>';
89
+                }
90
+                print '</tr>';
91 91
 
92
-				// increase the loop counter
93
-				$i++;
94
-			}
95
-		}
96
-		# display only the zone data if there is no network data available
97
-		else {
98
-			// set title
99
-			$title = $zoneObject->indicator == 0 ? 'Own Zone' : 'Customer Zone';
92
+                // increase the loop counter
93
+                $i++;
94
+            }
95
+        }
96
+        # display only the zone data if there is no network data available
97
+        else {
98
+            // set title
99
+            $title = $zoneObject->indicator == 0 ? 'Own Zone' : 'Customer Zone';
100 100
 
101
-			print '<tr class="border-top">';
102
-			print '<td rowspan="'.$counter.'"><span class="fa fa-home"  title="'._($title).'"></span></td>';
103
-			print '<td>'.$zoneObject->zone.'</td>';
104
-			print '<td>'.$zoneObject->description.'</td>';
105
-			print '<td>/</td>';
106
-			print '<td>/</td>';
107
-			# action menu
108
-			print '<td>';
109
-			print '<div class="btn-group">';
110
-			print '<button class="btn btn-default btn-xs editFirewallZone" data-action="edit" data-id="'.$zoneObject->id.'""><i class="fa fa-pencil"></i></button>';
111
-			print '<button class="btn btn-default btn-xs editFirewallZone" data-action="delete" data-id="'.$zoneObject->id.'"><i class="fa fa-remove"></i></button>';
112
-			print '</div>';
113
-			print '</td>';
114
-			print '</tr>';
115
-		}
116
-	}
117
-	print "</tbody>";
118
-	print '</table>';
101
+            print '<tr class="border-top">';
102
+            print '<td rowspan="'.$counter.'"><span class="fa fa-home"  title="'._($title).'"></span></td>';
103
+            print '<td>'.$zoneObject->zone.'</td>';
104
+            print '<td>'.$zoneObject->description.'</td>';
105
+            print '<td>/</td>';
106
+            print '<td>/</td>';
107
+            # action menu
108
+            print '<td>';
109
+            print '<div class="btn-group">';
110
+            print '<button class="btn btn-default btn-xs editFirewallZone" data-action="edit" data-id="'.$zoneObject->id.'""><i class="fa fa-pencil"></i></button>';
111
+            print '<button class="btn btn-default btn-xs editFirewallZone" data-action="delete" data-id="'.$zoneObject->id.'"><i class="fa fa-remove"></i></button>';
112
+            print '</div>';
113
+            print '</td>';
114
+            print '</tr>';
115
+        }
116
+    }
117
+    print "</tbody>";
118
+    print '</table>';
119 119
 } else {
120
-	# print an info if there are no zones in the database
121
-	$Result->show("info", _("No firewall zones configured"), false);
120
+    # print an info if there are no zones in the database
121
+    $Result->show("info", _("No firewall zones configured"), false);
122 122
 }
123 123
 ?>
Please login to merge, or discard this patch.