Completed
Pull Request — master (#532)
06:37
created
app/admin/import-export/import-subnets-check.php 1 patch
Indentation   +167 added lines, -167 removed lines patch added patch discarded remove patch
@@ -30,23 +30,23 @@  discard block
 block discarded – undo
30 30
 # load VLANs and process for easier later check
31 31
 $vlan_data = array();
32 32
 foreach ($vlan_domains as $vlan_domain) {
33
-	//cast
34
-	$vlan_domain = (array) $vlan_domain;
35
-	// read vlans
36
-	$all_vlans = $Admin->fetch_multiple_objects("vlans", "domainId", $vlan_domain['id'], "number");
37
-	$all_vlans = (array) $all_vlans;
38
-	// skip empty domains
39
-	if (sizeof($all_vlans)==0) {
40
-		# create entry for domain check
41
-		$vlan_data[$vlan_domain['name']] = array();
42
-		continue;
43
-	}
44
-	//write all VLAN entries
45
-	foreach ($all_vlans as $vlan) {
46
-		//cast
47
-		$vlan = (array) $vlan;
48
-		$vlan_data[$vlan_domain['name']][$vlan['number']] = $vlan;
49
-	}
33
+    //cast
34
+    $vlan_domain = (array) $vlan_domain;
35
+    // read vlans
36
+    $all_vlans = $Admin->fetch_multiple_objects("vlans", "domainId", $vlan_domain['id'], "number");
37
+    $all_vlans = (array) $all_vlans;
38
+    // skip empty domains
39
+    if (sizeof($all_vlans)==0) {
40
+        # create entry for domain check
41
+        $vlan_data[$vlan_domain['name']] = array();
42
+        continue;
43
+    }
44
+    //write all VLAN entries
45
+    foreach ($all_vlans as $vlan) {
46
+        //cast
47
+        $vlan = (array) $vlan;
48
+        $vlan_data[$vlan_domain['name']][$vlan['number']] = $vlan;
49
+    }
50 50
 }
51 51
 
52 52
 # fetch all VRFs
@@ -57,10 +57,10 @@  discard block
 block discarded – undo
57 57
 # process for easier later check
58 58
 $vrf_data = array();
59 59
 foreach ($all_vrfs as $vrf) {
60
-	//cast
61
-	$vrf = (array) $vrf;
62
-	$vrf_data[$vrf['name']] = $vrf;
63
-	$vrf_data[$vrf['rd']] = $vrf;	# add also RD as VRF name, will allow matches against both name and RD
60
+    //cast
61
+    $vrf = (array) $vrf;
62
+    $vrf_data[$vrf['name']] = $vrf;
63
+    $vrf_data[$vrf['rd']] = $vrf;	# add also RD as VRF name, will allow matches against both name and RD
64 64
 }
65 65
 
66 66
 # fetch all sections and load all subnets
@@ -70,18 +70,18 @@  discard block
 block discarded – undo
70 70
 $edata = array(); $section_names = array();
71 71
 
72 72
 foreach ($all_sections as $section) {
73
-	$section = (array) $section;
74
-	$section_names[$section['name']] = $section;
75
-	$section_subnets = $Subnets->fetch_section_subnets($section['id']);
76
-	# skip empty sections
77
-	if (sizeof($section_subnets)==0) { continue; }
78
-
79
-	foreach ($section_subnets as $subnet) {
80
-		$subnet = (array) $subnet;
81
-		# load whole record in array
82
-		$edata[$section['id']][$subnet['vrfId']][$subnet['ip']][$subnet['mask']] = $subnet;
83
-		$edata[$section['id']][$subnet['vrfId']][$subnet['ip']][$subnet['mask']]['type'] = $Subnets->identify_address($subnet['ip']);
84
-	}
73
+    $section = (array) $section;
74
+    $section_names[$section['name']] = $section;
75
+    $section_subnets = $Subnets->fetch_section_subnets($section['id']);
76
+    # skip empty sections
77
+    if (sizeof($section_subnets)==0) { continue; }
78
+
79
+    foreach ($section_subnets as $subnet) {
80
+        $subnet = (array) $subnet;
81
+        # load whole record in array
82
+        $edata[$section['id']][$subnet['vrfId']][$subnet['ip']][$subnet['mask']] = $subnet;
83
+        $edata[$section['id']][$subnet['vrfId']][$subnet['ip']][$subnet['mask']]['type'] = $Subnets->identify_address($subnet['ip']);
84
+    }
85 85
 }
86 86
 
87 87
 #print_r($vlan_data);
@@ -92,140 +92,140 @@  discard block
 block discarded – undo
92 92
 
93 93
 # check the fields
94 94
 foreach ($data as &$cdata) {
95
-	$msg = ""; $action = ""; $cfieldtds = "";
96
-
97
-	# check if required fields are present and not empty
98
-	foreach($reqfields as $creq) {
99
-		if ((!isset($cdata[$creq])) or ($cdata[$creq] == "")) { $msg.= "Required field ".$creq." missing or empty."; $action = "error"; }
100
-	}
101
-
102
-	# if the subnet contains "/", split it in network and mask
103
-	if ($action != "error") {
104
-		if (preg_match("/\//", $cdata['subnet'])) {
105
-			list($caddr,$cmask) = explode("/",$cdata['subnet'],2);
106
-			$cdata['mask'] = $cmask;
107
-			$cdata['subnet'] = $caddr;
108
-		} else { # check that mask is provided
109
-			if ((!isset($cdata['mask'])) or ($cdata['mask'] == "")) { $msg.= "Required field mask missing or empty."; $action = "error"; }
110
-		}
111
-		if ((!empty($cdata['mask'])) && (!preg_match("/^([0-9]+|[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)$/", $cdata['mask']))) {
112
-			$msg.="Invalid network mask format."; $action = "error";
113
-		} else {
114
-			$cdata['type'] = $Subnets->identify_address($cdata['subnet']);
115
-			if (($cdata['type'] == "IPv6") && (($cdata['mask']<0) || ($cdata['mask']>128))) { $msg.="Invalid IPv6 network mask."; $action = "error"; }
116
-		}
117
-	}
118
-
119
-	# Check if section is provided and valid and link it if it is
120
-	if (!isset($section_names[$cdata['section']])) {
121
-		$msg.= "Invalid section."; $action = "error";
122
-	} else {
123
-		$cdata['sectionId'] = $section_names[$cdata['section']]['id'];
124
-	}
125
-
126
-	# Check if VRF is provided and valid and link it if it is
127
-	if (!empty($cdata['vrf'])) {
128
-		if (!isset($vrf_data[$cdata['vrf']])) {
129
-			$msg.= "Invalid VRF."; $action = "error";
130
-		} else {
131
-			$cdata['vrfId'] = $vrf_data[$cdata['vrf']]['vrfId'];
132
-		}
133
-	} else {
134
-		# no VRF provided
135
-		$cdata['vrfId'] = 0;
136
-	}
137
-
138
-	# 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"; }
140
-	if (!isset($vlan_data[$cdom])) {
141
-		# the default domain is always there, so if anything is missing we return an error
142
-		$msg.= "Invalid VLAN domain."; $action = "error";
143
-	} else {
144
-		if (!empty($cdata['vlan'])) {
145
-		        if (in_array(strtolower($cdata['vlan']),array("na","n/a","nan"))) { $cdata['vlan'] = ""; }
146
-			if ((!empty($cdata['vlan'])) && (strtolower($cdata['vlan']) != "na")) {
147
-				if (!isset($vlan_data[$cdom][$cdata['vlan']])) {
148
-					$msg.= "VLAN not found in provided domain."; $action = "error";
149
-				} else {
150
-					$cdata['vlanId'] = $vlan_data[$cdom][$cdata['vlan']]['vlanId'];
151
-				}
152
-			} else {
153
-				# no VLAN provided
154
-				$cdata['vlanId'] = 0;
155
-			}
156
-		}
157
-	}
158
-
159
-	# check data format
160
-	if ($action != "error") {
161
-		if ($net = $Subnets->get_network_boundaries($cdata['subnet'],$cdata['mask'])) {
162
-			$cdata['mask'] = $net['bitmask'];
163
-			$cidr_check = $Subnets->verify_cidr_address($cdata['subnet']."/".$cdata['mask']);
164
-			if (strlen($cidr_check)>5) { $msg.=$cidr_check; $action = "error"; }
165
-		} else { $msg.=$net['message']; $action = "error"; }
166
-		if (preg_match("/[;'\"]/", $cdata['description'])) { $msg.="Invalid characters in description."; $action = "error"; }
167
-		if ((!empty($cdata['vrf'])) && (!preg_match("/^[a-zA-Z0-9-:]+$/", $cdata['vrf']))) { $msg.="Invalid VRF name format."; $action = "error"; }
168
-		if ((!empty($cdata['vlan'])) && (!preg_match("/^[0-9]+$/", $cdata['vlan']))) { $msg.="Invalid VLAN number format."; $action = "error"; }
169
-		if ((!empty($cdata['domain'])) && (!preg_match("/^[a-zA-Z0-9-_ ]+$/", $cdata['domain']))) { $msg.="Invalid VLAN domain format."; $action = "error"; }
170
-	}
171
-
172
-	# check if duplicate in the import data
173
-	if ($action != "error") {
174
-		if (isset($ndata[$cdata['sectionId']][$cdata['vrfId']][$cdata['subnet']][$cdata['mask']])) { $msg.="Duplicate entry in imported data."; $action = "error"; }
175
-	}
176
-
177
-	# check if existing in database
178
-	if ($action != "error") {
179
-		if (isset($edata[$cdata['sectionId']][$cdata['vrfId']][$cdata['subnet']][$cdata['mask']])) {
180
-			# copy content to a variable for easier checks
181
-			$cedata = $edata[$cdata['sectionId']][$cdata['vrfId']][$cdata['subnet']][$cdata['mask']];
182
-
183
-			# Check if we need to change any fields
184
-			$action = "skip"; # skip duplicate fields if identical, update if different
185
-			if ($cdata['description'] != $cedata['description']) { $msg.= "Subnet description will be updated."; $action = "edit"; }
186
-			if ($cdata['vlanId'] != $cedata['vlanId']) { $msg.= "VLAN ID will be updated."; $action = "edit"; }
187
-			# Check if the values of the custom fields have changed
188
-			if(sizeof($custom_fields) > 0) {
189
-				foreach($custom_fields as $myField) {
190
-					if ($cdata[$myField['name']] != $cedata[$myField['name']]) {
191
-						$msg.= $myField['name']." will be updated."; $action = "edit";
192
-					}
193
-				}
194
-			}
195
-
196
-			if ($action == "skip") {
197
-				$msg.= "Duplicate, will skip.";
198
-			} else {
199
-				# set id of matched subnet
200
-				$cdata['id'] = $cedata['id'];
201
-				# copy some fields which we don't import, but need to set
202
-				$cdata['masterSubnetId'] = $cedata['masterSubnetId'];
203
-				$cdata['permissions'] = $cedata['permissions'];
204
-				// $cdata['allowRequests'] = $cedata['allowRequests'];			$cdata['showName'] = $cedata['showName'];
205
-				// $cdata['pingSubnet'] = $cedata['pingSubnet'];				$cdata['discoverSubnet'] = $cedata['discoverSubnet'];
206
-			}
207
-		} else {
208
-			$msg.="New entry, will be added."; $action = "add";
209
-			# Set master to 0 for now, will figure that after we add it, with the recompute function
210
-			$cdata['masterSubnetId'] = "0";
211
-			# Inherit section permissions for new subnets
212
-			$cdata['permissions'] = $section_names[$cdata['section']]['permissions'];
213
-
214
-			# No overlap checking, smaller subnets will be considered nested, larger ones will be masters
215
-			# Master ID is set later, with the recompute functions
216
-
217
-			# Add it to ndata for duplicate check
218
-			$ndata[$cdata['sectionId']][$cdata['vrfId']][$cdata['subnet']][$cdata['mask']] = $cdata;
219
-		}
220
-	}
221
-
222
-	$cdata['msg'].= $msg;
223
-	$cdata['action'] = $action;
224
-	$counters[$action]++;
225
-
226
-	$rows.="<tr class='".$colors[$action]."'><td><i class='fa ".$icons[$action]."' rel='tooltip' data-placement='bottom' title='"._($msg)."'></i></td>";
227
-	foreach ($expfields as $cfield) { $rows.= "<td>".$cdata[$cfield]."</td>"; }
228
-	$rows.= "<td>"._($cdata['msg'])."</td></tr>";
95
+    $msg = ""; $action = ""; $cfieldtds = "";
96
+
97
+    # check if required fields are present and not empty
98
+    foreach($reqfields as $creq) {
99
+        if ((!isset($cdata[$creq])) or ($cdata[$creq] == "")) { $msg.= "Required field ".$creq." missing or empty."; $action = "error"; }
100
+    }
101
+
102
+    # if the subnet contains "/", split it in network and mask
103
+    if ($action != "error") {
104
+        if (preg_match("/\//", $cdata['subnet'])) {
105
+            list($caddr,$cmask) = explode("/",$cdata['subnet'],2);
106
+            $cdata['mask'] = $cmask;
107
+            $cdata['subnet'] = $caddr;
108
+        } else { # check that mask is provided
109
+            if ((!isset($cdata['mask'])) or ($cdata['mask'] == "")) { $msg.= "Required field mask missing or empty."; $action = "error"; }
110
+        }
111
+        if ((!empty($cdata['mask'])) && (!preg_match("/^([0-9]+|[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)$/", $cdata['mask']))) {
112
+            $msg.="Invalid network mask format."; $action = "error";
113
+        } else {
114
+            $cdata['type'] = $Subnets->identify_address($cdata['subnet']);
115
+            if (($cdata['type'] == "IPv6") && (($cdata['mask']<0) || ($cdata['mask']>128))) { $msg.="Invalid IPv6 network mask."; $action = "error"; }
116
+        }
117
+    }
118
+
119
+    # Check if section is provided and valid and link it if it is
120
+    if (!isset($section_names[$cdata['section']])) {
121
+        $msg.= "Invalid section."; $action = "error";
122
+    } else {
123
+        $cdata['sectionId'] = $section_names[$cdata['section']]['id'];
124
+    }
125
+
126
+    # Check if VRF is provided and valid and link it if it is
127
+    if (!empty($cdata['vrf'])) {
128
+        if (!isset($vrf_data[$cdata['vrf']])) {
129
+            $msg.= "Invalid VRF."; $action = "error";
130
+        } else {
131
+            $cdata['vrfId'] = $vrf_data[$cdata['vrf']]['vrfId'];
132
+        }
133
+    } else {
134
+        # no VRF provided
135
+        $cdata['vrfId'] = 0;
136
+    }
137
+
138
+    # 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"; }
140
+    if (!isset($vlan_data[$cdom])) {
141
+        # the default domain is always there, so if anything is missing we return an error
142
+        $msg.= "Invalid VLAN domain."; $action = "error";
143
+    } else {
144
+        if (!empty($cdata['vlan'])) {
145
+                if (in_array(strtolower($cdata['vlan']),array("na","n/a","nan"))) { $cdata['vlan'] = ""; }
146
+            if ((!empty($cdata['vlan'])) && (strtolower($cdata['vlan']) != "na")) {
147
+                if (!isset($vlan_data[$cdom][$cdata['vlan']])) {
148
+                    $msg.= "VLAN not found in provided domain."; $action = "error";
149
+                } else {
150
+                    $cdata['vlanId'] = $vlan_data[$cdom][$cdata['vlan']]['vlanId'];
151
+                }
152
+            } else {
153
+                # no VLAN provided
154
+                $cdata['vlanId'] = 0;
155
+            }
156
+        }
157
+    }
158
+
159
+    # check data format
160
+    if ($action != "error") {
161
+        if ($net = $Subnets->get_network_boundaries($cdata['subnet'],$cdata['mask'])) {
162
+            $cdata['mask'] = $net['bitmask'];
163
+            $cidr_check = $Subnets->verify_cidr_address($cdata['subnet']."/".$cdata['mask']);
164
+            if (strlen($cidr_check)>5) { $msg.=$cidr_check; $action = "error"; }
165
+        } else { $msg.=$net['message']; $action = "error"; }
166
+        if (preg_match("/[;'\"]/", $cdata['description'])) { $msg.="Invalid characters in description."; $action = "error"; }
167
+        if ((!empty($cdata['vrf'])) && (!preg_match("/^[a-zA-Z0-9-:]+$/", $cdata['vrf']))) { $msg.="Invalid VRF name format."; $action = "error"; }
168
+        if ((!empty($cdata['vlan'])) && (!preg_match("/^[0-9]+$/", $cdata['vlan']))) { $msg.="Invalid VLAN number format."; $action = "error"; }
169
+        if ((!empty($cdata['domain'])) && (!preg_match("/^[a-zA-Z0-9-_ ]+$/", $cdata['domain']))) { $msg.="Invalid VLAN domain format."; $action = "error"; }
170
+    }
171
+
172
+    # check if duplicate in the import data
173
+    if ($action != "error") {
174
+        if (isset($ndata[$cdata['sectionId']][$cdata['vrfId']][$cdata['subnet']][$cdata['mask']])) { $msg.="Duplicate entry in imported data."; $action = "error"; }
175
+    }
176
+
177
+    # check if existing in database
178
+    if ($action != "error") {
179
+        if (isset($edata[$cdata['sectionId']][$cdata['vrfId']][$cdata['subnet']][$cdata['mask']])) {
180
+            # copy content to a variable for easier checks
181
+            $cedata = $edata[$cdata['sectionId']][$cdata['vrfId']][$cdata['subnet']][$cdata['mask']];
182
+
183
+            # Check if we need to change any fields
184
+            $action = "skip"; # skip duplicate fields if identical, update if different
185
+            if ($cdata['description'] != $cedata['description']) { $msg.= "Subnet description will be updated."; $action = "edit"; }
186
+            if ($cdata['vlanId'] != $cedata['vlanId']) { $msg.= "VLAN ID will be updated."; $action = "edit"; }
187
+            # Check if the values of the custom fields have changed
188
+            if(sizeof($custom_fields) > 0) {
189
+                foreach($custom_fields as $myField) {
190
+                    if ($cdata[$myField['name']] != $cedata[$myField['name']]) {
191
+                        $msg.= $myField['name']." will be updated."; $action = "edit";
192
+                    }
193
+                }
194
+            }
195
+
196
+            if ($action == "skip") {
197
+                $msg.= "Duplicate, will skip.";
198
+            } else {
199
+                # set id of matched subnet
200
+                $cdata['id'] = $cedata['id'];
201
+                # copy some fields which we don't import, but need to set
202
+                $cdata['masterSubnetId'] = $cedata['masterSubnetId'];
203
+                $cdata['permissions'] = $cedata['permissions'];
204
+                // $cdata['allowRequests'] = $cedata['allowRequests'];			$cdata['showName'] = $cedata['showName'];
205
+                // $cdata['pingSubnet'] = $cedata['pingSubnet'];				$cdata['discoverSubnet'] = $cedata['discoverSubnet'];
206
+            }
207
+        } else {
208
+            $msg.="New entry, will be added."; $action = "add";
209
+            # Set master to 0 for now, will figure that after we add it, with the recompute function
210
+            $cdata['masterSubnetId'] = "0";
211
+            # Inherit section permissions for new subnets
212
+            $cdata['permissions'] = $section_names[$cdata['section']]['permissions'];
213
+
214
+            # No overlap checking, smaller subnets will be considered nested, larger ones will be masters
215
+            # Master ID is set later, with the recompute functions
216
+
217
+            # Add it to ndata for duplicate check
218
+            $ndata[$cdata['sectionId']][$cdata['vrfId']][$cdata['subnet']][$cdata['mask']] = $cdata;
219
+        }
220
+    }
221
+
222
+    $cdata['msg'].= $msg;
223
+    $cdata['action'] = $action;
224
+    $counters[$action]++;
225
+
226
+    $rows.="<tr class='".$colors[$action]."'><td><i class='fa ".$icons[$action]."' rel='tooltip' data-placement='bottom' title='"._($msg)."'></i></td>";
227
+    foreach ($expfields as $cfield) { $rows.= "<td>".$cdata[$cfield]."</td>"; }
228
+    $rows.= "<td>"._($cdata['msg'])."</td></tr>";
229 229
 
230 230
 }
231 231
 
Please login to merge, or discard this patch.
app/admin/import-export/import-recompute-select.php 1 patch
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -29,18 +29,18 @@  discard block
 block discarded – undo
29 29
 
30 30
 # Lets do some reordering to show slaves!
31 31
 foreach($all_sections as $s) {
32
-	if($s->masterSection=="0") {
33
-		# it is master
34
-		$s->class = "master";
35
-		$sectionssorted[] = $s;
36
-		# check for slaves
37
-		foreach($all_sections as $ss) {
38
-			if($ss->masterSection==$s->id) {
39
-				$ss->class = "slave";
40
-				$sectionssorted[] = $ss;
41
-			}
42
-		}
43
-	}
32
+    if($s->masterSection=="0") {
33
+        # it is master
34
+        $s->class = "master";
35
+        $sectionssorted[] = $s;
36
+        # check for slaves
37
+        foreach($all_sections as $ss) {
38
+            if($ss->masterSection==$s->id) {
39
+                $ss->class = "slave";
40
+                $sectionssorted[] = $ss;
41
+            }
42
+        }
43
+    }
44 44
 }
45 45
 
46 46
 # set new array
@@ -48,27 +48,27 @@  discard block
 block discarded – undo
48 48
 
49 49
 # show sections
50 50
 if(sizeof($all_sections) > 0) {
51
-	$section_rows = ""; $last_master = 0;
52
-	# existing sections
53
-	foreach ($sections_sorted as $section) {
54
-		//cast
55
-		$section = (array) $section;
56
-		//master Section
57
-		if (($section['masterSection']!=0) && ($section['masterSection']==$last_master)) {
58
-			$sect_prefix = " - ";
59
-		} else {
60
-			$sect_prefix = "";
61
-			$last_master = $section['id'];
62
-		}
63
-		$section_rows.= "<tr>";
64
-		$section_rows.= "<td><div class='checkbox'><label><input type='checkbox' id='recomputeSectionCheck' name='recomputeSection_".$section['id']."' checked>".$sect_prefix.str_replace('_', ' ', $section['name'])."</label></div></td>";
65
-		$section_rows.= "<td><div class='checkbox'><label><input type='checkbox' id='recomputeIPv4Check' name='recomputeSectionIPv4_".$section['id']."' checked></label></div></td>";
66
-		$section_rows.= "<td><div class='checkbox'><label><input type='checkbox' id='recomputeIPv6Check' name='recomputeSectionIPv6_".$section['id']."' checked></label></div></td>";
67
-		$section_rows.= "<td><div class='checkbox'><label><input type='checkbox' id='recomputeCVRFCheck' name='recomputeSectionCVRF_".$section['id']."' checked></label></div></td>";
68
-		$section_rows.="</tr>\n";
69
-	}
51
+    $section_rows = ""; $last_master = 0;
52
+    # existing sections
53
+    foreach ($sections_sorted as $section) {
54
+        //cast
55
+        $section = (array) $section;
56
+        //master Section
57
+        if (($section['masterSection']!=0) && ($section['masterSection']==$last_master)) {
58
+            $sect_prefix = " - ";
59
+        } else {
60
+            $sect_prefix = "";
61
+            $last_master = $section['id'];
62
+        }
63
+        $section_rows.= "<tr>";
64
+        $section_rows.= "<td><div class='checkbox'><label><input type='checkbox' id='recomputeSectionCheck' name='recomputeSection_".$section['id']."' checked>".$sect_prefix.str_replace('_', ' ', $section['name'])."</label></div></td>";
65
+        $section_rows.= "<td><div class='checkbox'><label><input type='checkbox' id='recomputeIPv4Check' name='recomputeSectionIPv4_".$section['id']."' checked></label></div></td>";
66
+        $section_rows.= "<td><div class='checkbox'><label><input type='checkbox' id='recomputeIPv6Check' name='recomputeSectionIPv6_".$section['id']."' checked></label></div></td>";
67
+        $section_rows.= "<td><div class='checkbox'><label><input type='checkbox' id='recomputeCVRFCheck' name='recomputeSectionCVRF_".$section['id']."' checked></label></div></td>";
68
+        $section_rows.="</tr>\n";
69
+    }
70 70
 } else {
71
-	$section_rows = "<td colspan='3'>No sections found!</td>";
71
+    $section_rows = "<td colspan='3'>No sections found!</td>";
72 72
 }
73 73
 
74 74
 ?>
Please login to merge, or discard this patch.
app/admin/import-export/import-l2dom.php 1 patch
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -33,28 +33,28 @@
 block discarded – undo
33 33
 
34 34
 # import L2 Domains
35 35
 foreach ($data as &$cdata) {
36
-	if (($cdata['action'] == "add") || ($cdata['action'] == "edit")) {
37
-		# set update array
38
-		$values = array("id"=>$cdata['id'],
39
-						"name"=>$cdata['name'],
40
-						"description"=>$cdata['description']
41
-						);
36
+    if (($cdata['action'] == "add") || ($cdata['action'] == "edit")) {
37
+        # set update array
38
+        $values = array("id"=>$cdata['id'],
39
+                        "name"=>$cdata['name'],
40
+                        "description"=>$cdata['description']
41
+                        );
42 42
 
43
-		# update
44
-		$cdata['result'] = $Admin->object_modify("vlanDomains", $cdata['action'], "id", $values);
43
+        # update
44
+        $cdata['result'] = $Admin->object_modify("vlanDomains", $cdata['action'], "id", $values);
45 45
 
46
-		if ($cdata['result']) {
47
-			$trc = $colors[$cdata['action']];
48
-			$msg = "L2 Domain ".$cdata['action']." successful.";
49
-		} else {
50
-			$trc = "danger";
51
-			$msg = "L2 Domain ".$cdata['action']." failed.";
52
-		}
53
-		$rows.="<tr class='".$trc."'><td><i class='fa ".$icons[$cdata['action']]."' rel='tooltip' data-placement='bottom' title='"._($msg)."'></i></td>
46
+        if ($cdata['result']) {
47
+            $trc = $colors[$cdata['action']];
48
+            $msg = "L2 Domain ".$cdata['action']." successful.";
49
+        } else {
50
+            $trc = "danger";
51
+            $msg = "L2 Domain ".$cdata['action']." failed.";
52
+        }
53
+        $rows.="<tr class='".$trc."'><td><i class='fa ".$icons[$cdata['action']]."' rel='tooltip' data-placement='bottom' title='"._($msg)."'></i></td>
54 54
 			<td>".$cdata['name']."</td>
55 55
 			<td>".$cdata['description']."</td>
56 56
 			<td>"._($msg)."</td></tr>";
57
-	}
57
+    }
58 58
 }
59 59
 
60 60
 print "<table class='table table-condensed table-hover' id='resultstable'><tbody>";
Please login to merge, or discard this patch.
app/admin/import-export/generate-hosts.php 1 patch
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -29,31 +29,31 @@
 block discarded – undo
29 29
 
30 30
 //loop
31 31
 if(sizeof($hosts)>0) {
32
-	//details
33
-	$m=0;
34
-	foreach($hosts as $host) {
35
-		//fetch subnet and section details on change!
36
-		if(@$hosts[$m-1]->subnetId!=$hosts[$m]->subnetId) {
37
-			$subnet  = (array) $Subnets->fetch_subnet(null, $host->subnetId);
38
-			$section = (array) $Sections->fetch_section(null, $subnet['sectionId']);
39
-
40
-			//first print subnet and section details
41
-			$res[] = "# $subnet[description] (".$Subnets->transform_to_dotted($subnet['subnet'])."/$subnet[mask]) - $section[description]";
42
-		}
43
-
44
-		//than address details
45
-		$diff = 17 - strlen($Subnets->transform_to_dotted($host->ip_addr));	//for print offset
46
-		$diff>0 ? : $diff = 3;												//IPv6 print offset
47
-
48
-		$res[] = $Subnets->transform_to_dotted($host->ip_addr).str_repeat(" ", $diff)."$host->dns_name";
49
-
50
-		//break
51
-		if($hosts[$m]->subnetId!=@$hosts[$m+1]->subnetId) {
52
-		$res[] = "";
53
-		}
54
-
55
-		$m++;		//next index
56
-	}
32
+    //details
33
+    $m=0;
34
+    foreach($hosts as $host) {
35
+        //fetch subnet and section details on change!
36
+        if(@$hosts[$m-1]->subnetId!=$hosts[$m]->subnetId) {
37
+            $subnet  = (array) $Subnets->fetch_subnet(null, $host->subnetId);
38
+            $section = (array) $Sections->fetch_section(null, $subnet['sectionId']);
39
+
40
+            //first print subnet and section details
41
+            $res[] = "# $subnet[description] (".$Subnets->transform_to_dotted($subnet['subnet'])."/$subnet[mask]) - $section[description]";
42
+        }
43
+
44
+        //than address details
45
+        $diff = 17 - strlen($Subnets->transform_to_dotted($host->ip_addr));	//for print offset
46
+        $diff>0 ? : $diff = 3;												//IPv6 print offset
47
+
48
+        $res[] = $Subnets->transform_to_dotted($host->ip_addr).str_repeat(" ", $diff)."$host->dns_name";
49
+
50
+        //break
51
+        if($hosts[$m]->subnetId!=@$hosts[$m+1]->subnetId) {
52
+        $res[] = "";
53
+        }
54
+
55
+        $m++;		//next index
56
+    }
57 57
 }
58 58
 
59 59
 # join content
Please login to merge, or discard this patch.
app/admin/import-export/export-vlan-field-select.php 1 patch
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -27,12 +27,12 @@  discard block
 block discarded – undo
27 27
 
28 28
 
29 29
 if(sizeof($custom_fields) > 0) {
30
-	foreach($custom_fields as $myField) {
31
-		//change spaces to "___" so it can be used as element id
32
-		$myField['nameTemp'] = str_replace(" ", "___", $myField['name']);
33
-		$custom_fields_names.= "	<th>$myField[name]</th>";
34
-		$custom_fields_boxes.= "	<td><input type='checkbox' name='$myField[nameTemp]' checked> </td>";
35
-	}
30
+    foreach($custom_fields as $myField) {
31
+        //change spaces to "___" so it can be used as element id
32
+        $myField['nameTemp'] = str_replace(" ", "___", $myField['name']);
33
+        $custom_fields_names.= "	<th>$myField[name]</th>";
34
+        $custom_fields_boxes.= "	<td><input type='checkbox' name='$myField[nameTemp]' checked> </td>";
35
+    }
36 36
 }
37 37
 
38 38
 ?>
@@ -74,23 +74,23 @@  discard block
 block discarded – undo
74 74
 print '<form id="selectExportDomains">';
75 75
 
76 76
 if(sizeof($vlan_domains) > 0) {
77
-	print '<h4>L2 Domains</h4>';
78
-	print "	<table class='table table-striped table-condensed'>";
79
-	print "	<tr>";
77
+    print '<h4>L2 Domains</h4>';
78
+    print "	<table class='table table-striped table-condensed'>";
79
+    print "	<tr>";
80 80
     print "	<th>"._('Name')."</th>";
81 81
     print "	<th>"._('Description')."</th>";
82 82
     print "	<th>"._('Export')."</th>";
83 83
     print "	</tr>\n";
84 84
 
85
-	foreach($vlan_domains as $domain) {
86
-		$domain = (array) $domain;
85
+    foreach($vlan_domains as $domain) {
86
+        $domain = (array) $domain;
87 87
 
88
-		print "	<tr>";
89
-		print "	<td>".$domain['name']."</th>";
90
-		print "	<td>".$domain['description']."</th>";
91
-		print "	<td><input type='checkbox' name='exportDomain__".str_replace(" ", "_",$domain['name'])."' checked> </td>";
92
-		print "	</tr>\n";
93
-	}
88
+        print "	<tr>";
89
+        print "	<td>".$domain['name']."</th>";
90
+        print "	<td>".$domain['description']."</th>";
91
+        print "	<td><input type='checkbox' name='exportDomain__".str_replace(" ", "_",$domain['name'])."' checked> </td>";
92
+        print "	</tr>\n";
93
+    }
94 94
 }
95 95
 
96 96
 print '</table>';
Please login to merge, or discard this patch.
app/admin/import-export/export-ipaddr-field-select.php 1 patch
Indentation   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -24,22 +24,22 @@  discard block
 block discarded – undo
24 24
 
25 25
 # Lets do some reordering to show slaves!
26 26
 if($all_sections!==false) {
27
-	foreach($all_sections as $s) {
28
-		if($s->masterSection=="0") {
29
-			# it is master
30
-			$s->class = "master";
31
-			$sectionssorted[] = $s;
32
-			# check for slaves
33
-			foreach($all_sections as $ss) {
34
-				if($ss->masterSection==$s->id) {
35
-					$ss->class = "slave";
36
-					$sectionssorted[] = $ss;
37
-				}
38
-			}
39
-		}
40
-	}
41
-	# set new array
42
-	$sections_sorted = @$sectionssorted;
27
+    foreach($all_sections as $s) {
28
+        if($s->masterSection=="0") {
29
+            # it is master
30
+            $s->class = "master";
31
+            $sectionssorted[] = $s;
32
+            # check for slaves
33
+            foreach($all_sections as $ss) {
34
+                if($ss->masterSection==$s->id) {
35
+                    $ss->class = "slave";
36
+                    $sectionssorted[] = $ss;
37
+                }
38
+            }
39
+        }
40
+    }
41
+    # set new array
42
+    $sections_sorted = @$sectionssorted;
43 43
 }
44 44
 
45 45
 # get all custom fields
@@ -49,12 +49,12 @@  discard block
 block discarded – undo
49 49
 $custom_fields_boxes = "";
50 50
 
51 51
 if(sizeof($custom_fields) > 0) {
52
-	foreach($custom_fields as $myField) {
53
-		//change spaces to "___" so it can be used as element id
54
-		$myField['nameTemp'] = str_replace(" ", "___", $myField['name']);
55
-		$custom_fields_names.= "	<th>$myField[name]</th>";
56
-		$custom_fields_boxes.= "	<td><input type='checkbox' name='$myField[nameTemp]' checked> </td>";
57
-	}
52
+    foreach($custom_fields as $myField) {
53
+        //change spaces to "___" so it can be used as element id
54
+        $myField['nameTemp'] = str_replace(" ", "___", $myField['name']);
55
+        $custom_fields_names.= "	<th>$myField[name]</th>";
56
+        $custom_fields_boxes.= "	<td><input type='checkbox' name='$myField[nameTemp]' checked> </td>";
57
+    }
58 58
 }
59 59
 
60 60
 ?>
@@ -111,36 +111,36 @@  discard block
 block discarded – undo
111 111
 
112 112
 # show sections
113 113
 if($all_sections!==false) {
114
-	print '<h4>Sections</h4>';
115
-	print "	<table class='table table-striped table-condensed'>";
116
-	print "	<tr>";
114
+    print '<h4>Sections</h4>';
115
+    print "	<table class='table table-striped table-condensed'>";
116
+    print "	<tr>";
117 117
     print '	<th><input type="checkbox" id="exportSelectAll" checked> '._('Name').'</th>';
118 118
     print "	<th>"._('Description')."</th>";
119 119
     print "	<th>"._('Parent')."</th>";
120 120
     print "	</tr>\n";
121 121
 
122
-	# existing sections
123
-	foreach ($sections_sorted as $section) {
124
-		//cast
125
-		$section = (array) $section;
126
-
127
-		print '<tr>';
128
-		print '	<td><div class="checkbox"><label><input type="checkbox" id="exportCheck" name="exportSection__'.str_replace(" ", "_", $section['name']).'" checked>'.str_replace("_", " ", $section['name']).'</label></div></td>';
129
-		print '	<td>'. $section['description'] .'</td>'. "\n";
130
-		//master Section
131
-		if($section['masterSection']!=0) {
132
-			# get section details
133
-			$ssec = $Admin->fetch_object("sections", "id", $section['masterSection']);
134
-			print "	<td>$ssec->name</td>";
135
-		} else {
136
-			print "	<td>/</td>";
137
-		}
138
-		print '</tr>'. "\n";
139
-	}
140
-
141
-	print '</table>';
142
-
143
-	print '<div class="checkbox"><label><input type="checkbox" name="exportSections" checked>'._("Include the sections in a separate sheet.").'</label></div>';
122
+    # existing sections
123
+    foreach ($sections_sorted as $section) {
124
+        //cast
125
+        $section = (array) $section;
126
+
127
+        print '<tr>';
128
+        print '	<td><div class="checkbox"><label><input type="checkbox" id="exportCheck" name="exportSection__'.str_replace(" ", "_", $section['name']).'" checked>'.str_replace("_", " ", $section['name']).'</label></div></td>';
129
+        print '	<td>'. $section['description'] .'</td>'. "\n";
130
+        //master Section
131
+        if($section['masterSection']!=0) {
132
+            # get section details
133
+            $ssec = $Admin->fetch_object("sections", "id", $section['masterSection']);
134
+            print "	<td>$ssec->name</td>";
135
+        } else {
136
+            print "	<td>/</td>";
137
+        }
138
+        print '</tr>'. "\n";
139
+    }
140
+
141
+    print '</table>';
142
+
143
+    print '<div class="checkbox"><label><input type="checkbox" name="exportSections" checked>'._("Include the sections in a separate sheet.").'</label></div>';
144 144
 //	print '<div class="checkbox"><label><input type="checkbox" name="separateSheets">'._("Export each section in a separate sheet.").'</label></div>';
145 145
 
146 146
 }
Please login to merge, or discard this patch.
app/admin/import-export/import-vrf-check.php 1 patch
Indentation   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -22,9 +22,9 @@  discard block
 block discarded – undo
22 22
 $edata = array();
23 23
 # process for easier later check
24 24
 foreach ($all_vrfs as $vrf) {
25
-	//cast
26
-	$vrf = (array) $vrf;
27
-	$edata[$vrf['rd']] = $vrf;
25
+    //cast
26
+    $vrf = (array) $vrf;
27
+    $edata[$vrf['rd']] = $vrf;
28 28
 }
29 29
 
30 30
 $rows = "";
@@ -32,41 +32,41 @@  discard block
 block discarded – undo
32 32
 
33 33
 # check the fields
34 34
 foreach ($data as &$cdata) {
35
-	$msg = ""; $action = "";
36
-
37
-	# check if required fields are present and not empty
38
-	foreach($reqfields as $creq) {
39
-		if ((!isset($cdata[$creq])) or ($cdata[$creq] == "")) { $msg.= "Required field ".$creq." missing or empty."; $action = "error"; }
40
-	}
41
-
42
-	# check data format
43
-	if ($action != "error") {
44
-		if (!preg_match("/^[a-zA-Z0-9-]+$/", $cdata['name'])) { $msg.="Invalid name format."; $action = "error"; }
45
-		if (!preg_match("/^[0-9:]+$/", $cdata['rd'])) { $msg.="Invalid RD format."; $action = "error"; }
46
-		if (preg_match("/[;'\"]/", $cdata['description'])) { $msg.="Invalid characters in description."; $action = "error"; }
47
-	}
48
-
49
-	# check if existing
50
-	if ($action != "error") {
51
-		if (isset($edata[$cdata['rd']])) {
52
-			$cdata['vrfId'] = $edata[$cdata['rd']]['vrfId'];
53
-			$action = "skip"; # skip duplicate fields if identical, update if different
54
-			if ($cdata['name'] != $edata[$cdata['rd']]['name']) { $msg.= "VRF name will be updated."; $action = "edit"; }
55
-			if ($cdata['description'] != $edata[$cdata['rd']]['description']) { $msg.= "VRF description will be updated."; $action = "edit"; }
56
-
57
-			if ($action == "skip") {
58
-				$msg.= "Duplicate, will skip.";
59
-			}
60
-		} else {
61
-			$msg.="New entry, will be added."; $action = "add";
62
-		}
63
-	}
64
-
65
-	$cdata['msg'].= $msg;
66
-	$cdata['action'] = $action;
67
-	$counters[$action]++;
68
-
69
-	$rows.="<tr class='".$colors[$action]."'><td><i class='fa ".$icons[$action]."' rel='tooltip' data-placement='bottom' title='"._($msg)."'></i></td>
35
+    $msg = ""; $action = "";
36
+
37
+    # check if required fields are present and not empty
38
+    foreach($reqfields as $creq) {
39
+        if ((!isset($cdata[$creq])) or ($cdata[$creq] == "")) { $msg.= "Required field ".$creq." missing or empty."; $action = "error"; }
40
+    }
41
+
42
+    # check data format
43
+    if ($action != "error") {
44
+        if (!preg_match("/^[a-zA-Z0-9-]+$/", $cdata['name'])) { $msg.="Invalid name format."; $action = "error"; }
45
+        if (!preg_match("/^[0-9:]+$/", $cdata['rd'])) { $msg.="Invalid RD format."; $action = "error"; }
46
+        if (preg_match("/[;'\"]/", $cdata['description'])) { $msg.="Invalid characters in description."; $action = "error"; }
47
+    }
48
+
49
+    # check if existing
50
+    if ($action != "error") {
51
+        if (isset($edata[$cdata['rd']])) {
52
+            $cdata['vrfId'] = $edata[$cdata['rd']]['vrfId'];
53
+            $action = "skip"; # skip duplicate fields if identical, update if different
54
+            if ($cdata['name'] != $edata[$cdata['rd']]['name']) { $msg.= "VRF name will be updated."; $action = "edit"; }
55
+            if ($cdata['description'] != $edata[$cdata['rd']]['description']) { $msg.= "VRF description will be updated."; $action = "edit"; }
56
+
57
+            if ($action == "skip") {
58
+                $msg.= "Duplicate, will skip.";
59
+            }
60
+        } else {
61
+            $msg.="New entry, will be added."; $action = "add";
62
+        }
63
+    }
64
+
65
+    $cdata['msg'].= $msg;
66
+    $cdata['action'] = $action;
67
+    $counters[$action]++;
68
+
69
+    $rows.="<tr class='".$colors[$action]."'><td><i class='fa ".$icons[$action]."' rel='tooltip' data-placement='bottom' title='"._($msg)."'></i></td>
70 70
 		<td>".$cdata['name']."</td>
71 71
 		<td>".$cdata['rd']."</td>
72 72
 		<td>".$cdata['description']."</td>
Please login to merge, or discard this patch.
app/admin/import-export/export-vrf.php 1 patch
Indentation   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -45,42 +45,42 @@
 block discarded – undo
45 45
 
46 46
 //write headers
47 47
 if( (isset($_GET['name'])) && ($_GET['name'] == "on") ) {
48
-	$worksheet->write($lineCount, $rowCount, _('Name') ,$format_header);
49
-	$rowCount++;
48
+    $worksheet->write($lineCount, $rowCount, _('Name') ,$format_header);
49
+    $rowCount++;
50 50
 }
51 51
 if( (isset($_GET['rd'])) && ($_GET['rd'] == "on") ) {
52
-	$worksheet->write($lineCount, $rowCount, _('RD') ,$format_header);
53
-	$rowCount++;
52
+    $worksheet->write($lineCount, $rowCount, _('RD') ,$format_header);
53
+    $rowCount++;
54 54
 }
55 55
 if( (isset($_GET['description'])) && ($_GET['description'] == "on") ) {
56
-	$worksheet->write($lineCount, $rowCount, _('Description') ,$format_header);
57
-	$rowCount++;
56
+    $worksheet->write($lineCount, $rowCount, _('Description') ,$format_header);
57
+    $rowCount++;
58 58
 }
59 59
 
60 60
 $lineCount++;
61 61
 
62 62
 //write all VRF entries
63 63
 foreach ($all_vrfs as $vrf) {
64
-	//cast
65
-	$vrf = (array) $vrf;
66
-
67
-	//reset row count
68
-	$rowCount = 0;
69
-
70
-	if( (isset($_GET['name'])) && ($_GET['name'] == "on") ) {
71
-		$worksheet->write($lineCount, $rowCount, $vrf['name'], $format_text);
72
-		$rowCount++;
73
-	}
74
-	if( (isset($_GET['rd'])) && ($_GET['rd'] == "on") ) {
75
-		$worksheet->write($lineCount, $rowCount, $vrf['rd'], $format_text);
76
-		$rowCount++;
77
-	}
78
-	if( (isset($_GET['description'])) && ($_GET['description'] == "on") ) {
79
-		$worksheet->write($lineCount, $rowCount, $vrf['description'], $format_text);
80
-		$rowCount++;
81
-	}
82
-
83
-	$lineCount++;
64
+    //cast
65
+    $vrf = (array) $vrf;
66
+
67
+    //reset row count
68
+    $rowCount = 0;
69
+
70
+    if( (isset($_GET['name'])) && ($_GET['name'] == "on") ) {
71
+        $worksheet->write($lineCount, $rowCount, $vrf['name'], $format_text);
72
+        $rowCount++;
73
+    }
74
+    if( (isset($_GET['rd'])) && ($_GET['rd'] == "on") ) {
75
+        $worksheet->write($lineCount, $rowCount, $vrf['rd'], $format_text);
76
+        $rowCount++;
77
+    }
78
+    if( (isset($_GET['description'])) && ($_GET['description'] == "on") ) {
79
+        $worksheet->write($lineCount, $rowCount, $vrf['description'], $format_text);
80
+        $rowCount++;
81
+    }
82
+
83
+    $lineCount++;
84 84
 }
85 85
 
86 86
 //new line
Please login to merge, or discard this patch.
app/admin/import-export/import-subnets-select.php 1 patch
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -48,43 +48,43 @@
 block discarded – undo
48 48
 
49 49
 # manually adjust the standard fields
50 50
 foreach($expfields as $std_field) {
51
-	# extra table and field
52
-	if (isset($extfields[$std_field])) {
53
-		$cfield = $extfields[$std_field]["field"];
54
-		$ctable = $extfields[$std_field]["table"];
55
-		$pname  = $extfields[$std_field]["pname"]." ";
56
-	} else {
57
-		# default table and field
58
-		$cfield = $std_field;
59
-		$ctable = $mtable;
60
-		$pname = "";
61
-	}
62
-
63
-	# read field attributes
64
-	$field = $Tools->fetch_full_field_definition($ctable,$cfield);
65
-	$field = (array) $field;
66
-
67
-	# mark required fields with *
68
-	$msgr = in_array($std_field,$reqfields) ? "*" : "";
69
-
70
-	#prebuild template table rows to avoid useless foreach loops
71
-	$tpl_field_names.= "<th>".$pname.$field['Field'].$msgr."</th>";
72
-	$tpl_field_types.= "<td><small>". wordwrap($field['Type'],18,"<br>\n",true) ."</small></td>";
51
+    # extra table and field
52
+    if (isset($extfields[$std_field])) {
53
+        $cfield = $extfields[$std_field]["field"];
54
+        $ctable = $extfields[$std_field]["table"];
55
+        $pname  = $extfields[$std_field]["pname"]." ";
56
+    } else {
57
+        # default table and field
58
+        $cfield = $std_field;
59
+        $ctable = $mtable;
60
+        $pname = "";
61
+    }
62
+
63
+    # read field attributes
64
+    $field = $Tools->fetch_full_field_definition($ctable,$cfield);
65
+    $field = (array) $field;
66
+
67
+    # mark required fields with *
68
+    $msgr = in_array($std_field,$reqfields) ? "*" : "";
69
+
70
+    #prebuild template table rows to avoid useless foreach loops
71
+    $tpl_field_names.= "<th>".$pname.$field['Field'].$msgr."</th>";
72
+    $tpl_field_types.= "<td><small>". wordwrap($field['Type'],18,"<br>\n",true) ."</small></td>";
73 73
 }
74 74
 
75 75
 # append the custom fields, if any
76 76
 $custom_fields = $Tools->fetch_custom_fields($mtable);
77 77
 if(sizeof($custom_fields) > 0) {
78
-	foreach($custom_fields as $myField) {
79
-		# add field to required fields if needed
80
-		if ($myField['Null'] == "NO") { $reqfields[] = $myField['name']; }
81
-		# mark required fields with *
82
-		$msgr = in_array($myField['name'],$reqfields) ? "*" : "";
83
-
84
-		$tpl_field_names.= "<th>".$myField['name'].$msgr."</th>";
85
-		$tpl_field_types.= "<td><small>". wordwrap($myField['type'],18,"<br>\n",true) ."</small></td>";
86
-		$expfields[] = $myField['name'];
87
-	}
78
+    foreach($custom_fields as $myField) {
79
+        # add field to required fields if needed
80
+        if ($myField['Null'] == "NO") { $reqfields[] = $myField['name']; }
81
+        # mark required fields with *
82
+        $msgr = in_array($myField['name'],$reqfields) ? "*" : "";
83
+
84
+        $tpl_field_names.= "<th>".$myField['name'].$msgr."</th>";
85
+        $tpl_field_types.= "<td><small>". wordwrap($myField['type'],18,"<br>\n",true) ."</small></td>";
86
+        $expfields[] = $myField['name'];
87
+    }
88 88
 }
89 89
 
90 90
 ?>
Please login to merge, or discard this patch.