Completed
Pull Request — master (#532)
06:37
created
app/admin/custom-fields/edit.php 1 patch
Braces   +8 added lines, -2 removed lines patch added patch discarded remove patch
@@ -114,7 +114,10 @@  discard block
 block discarded – undo
114 114
 	<tr>
115 115
 		<td><?php print _('Required field'); ?></td>
116 116
 		<td>
117
-			<input name="NULL" type="checkbox" value="NO" <?php if(@$fieldval['Null']=="NO") print "checked"; ?>>
117
+			<input name="NULL" type="checkbox" value="NO" <?php if(@$fieldval['Null']=="NO") {
118
+    print "checked";
119
+}
120
+?>>
118 121
 		</td>
119 122
 	</tr>
120 123
 
@@ -127,7 +130,10 @@  discard block
 block discarded – undo
127 130
 <div class="pFooter">
128 131
 	<div class="btn-group">
129 132
 		<button class="btn btn-sm btn-default hidePopups"><?php print _('Close'); ?></button>
130
-		<button class="btn btn-sm btn-default <?php if($_POST['action']=="delete") { print "btn-danger"; } else { print "btn-success";} ?>" id="editcustomSubmit"><i class="fa <?php if($_POST['action']=="add") { print "fa-plus"; } else if ($_POST['action']=="delete") { print "fa-trash-o"; } else { print "fa-check"; } ?>"></i> <?php print ucwords(_($_POST['action'])); ?></button>
133
+		<button class="btn btn-sm btn-default <?php if($_POST['action']=="delete") { print "btn-danger"; }
134
+else { print "btn-success";} ?>" id="editcustomSubmit"><i class="fa <?php if($_POST['action']=="add") { print "fa-plus"; }
135
+else if ($_POST['action']=="delete") { print "fa-trash-o"; }
136
+else { print "fa-check"; } ?>"></i> <?php print ucwords(_($_POST['action'])); ?></button>
131 137
 	</div>
132 138
 	<!-- result -->
133 139
 	<div class="customEditResult"></div>
Please login to merge, or discard this patch.
app/admin/devices/index.php 1 patch
Braces   +10 added lines, -7 removed lines patch added patch discarded remove patch
@@ -53,10 +53,12 @@  discard block
 block discarded – undo
53 53
 	print '	<th>'._('IP address').'</th>';
54 54
 	print '	<th>'._('Type').'</th>';
55 55
 	print '	<th>'._('Description').'</th>';
56
-    if($User->settings->enableSNMP=="1")
57
-	print '	<th>'._('SNMP').'</th>';
58
-    if($User->settings->enableRACK=="1")
59
-	print '	<th>'._('Rack').'</th>';
56
+    if($User->settings->enableSNMP=="1") {
57
+    	print '	<th>'._('SNMP').'</th>';
58
+    }
59
+    if($User->settings->enableRACK=="1") {
60
+    	print '	<th>'._('Rack').'</th>';
61
+    }
60 62
 	print '	<th><i class="icon-gray icon-info-sign" rel="tooltip" title="'._('Shows in which sections device will be visible for selection').'"></i> '._('Sections').'</th>';
61 63
 	if(sizeof($custom) > 0) {
62 64
 		foreach($custom as $field) {
@@ -133,7 +135,7 @@  discard block
 block discarded – undo
133 135
 					$device[$field['name']] = $Result->create_links ($device[$field['name']], $field['type']);
134 136
 
135 137
 					//booleans
136
-					if($field['type']=="tinyint(1)")	{
138
+					if($field['type']=="tinyint(1)") {
137 139
 						if($device[$field['name']] == "0")		{ print _("No"); }
138 140
 						elseif($device[$field['name']] == "1")	{ print _("Yes"); }
139 141
 					}
@@ -154,8 +156,9 @@  discard block
 block discarded – undo
154 156
 		print '	<td class="actions">'. "\n";
155 157
 		print "	<div class='btn-group'>";
156 158
 		print "		<button class='btn btn-xs btn-default editSwitch' data-action='edit'   data-switchid='$device[id]'><i class='fa fa-pencil'></i></button>";
157
-		if($User->settings->enableSNMP=="1")
158
-		print "		<button class='btn btn-xs btn-default editSwitchSNMP' data-action='edit' data-switchid='$device[id]'><i class='fa fa-cogs'></i></button>";
159
+		if($User->settings->enableSNMP=="1") {
160
+				print "		<button class='btn btn-xs btn-default editSwitchSNMP' data-action='edit' data-switchid='$device[id]'><i class='fa fa-cogs'></i></button>";
161
+		}
159 162
 		print "		<button class='btn btn-xs btn-default editSwitch' data-action='delete' data-switchid='$device[id]'><i class='fa fa-times'></i></button>";
160 163
 		print "	</div>";
161 164
 		print '	</td>'. "\n";
Please login to merge, or discard this patch.
app/admin/devices/edit-snmp.php 1 patch
Braces   +12 added lines, -3 removed lines patch added patch discarded remove patch
@@ -76,9 +76,18 @@
 block discarded – undo
76 76
 		<td>
77 77
     		<select class="form-control" name="snmp_version">
78 78
         		<option value="0"><?php print _("Not used"); ?></option>
79
-        		<option value="1" <?php if($device->snmp_version=="1") print "selected"; ?>>SNMP v1</option>
80
-        		<option value="2" <?php if($device->snmp_version=="2") print "selected"; ?>>SNMP v2c</option>
81
-        		<option value="3" <?php if($device->snmp_version=="3") print "selected"; ?>>SNMP v3</option>
79
+        		<option value="1" <?php if($device->snmp_version=="1") {
80
+    print "selected";
81
+}
82
+?>>SNMP v1</option>
83
+        		<option value="2" <?php if($device->snmp_version=="2") {
84
+    print "selected";
85
+}
86
+?>>SNMP v2c</option>
87
+        		<option value="3" <?php if($device->snmp_version=="3") {
88
+    print "selected";
89
+}
90
+?>>SNMP v3</option>
82 91
     		</select>
83 92
     		<input type="hidden" name="device_id" value="<?php print $device->id; ?>">
84 93
     		<input type="hidden" name="csrf_cookie" value="<?php print $csrf; ?>">
Please login to merge, or discard this patch.
app/admin/devices/edit-result.php 1 patch
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -101,7 +101,7 @@
 block discarded – undo
101 101
 if(!$Admin->object_modify("devices", $_POST['action'], "id", $values))	{}
102 102
 else																	{ $Result->show("success", _("Device $device[action] successfull").'!', false); }
103 103
 
104
-if($_POST['action']=="delete"){
104
+if($_POST['action']=="delete") {
105 105
 	# remove all references from subnets and ip addresses
106 106
 	$Admin->remove_object_references ("subnets", "device", $values["id"]);
107 107
 	$Admin->remove_object_references ("ipaddresses", "switch", $values["id"]);
Please login to merge, or discard this patch.
app/admin/devices/edit.php 1 patch
Braces   +21 added lines, -6 removed lines patch added patch discarded remove patch
@@ -70,7 +70,10 @@  discard block
 block discarded – undo
70 70
 	<tr>
71 71
 		<td><?php print _('Name'); ?></td>
72 72
 		<td>
73
-			<input type="text" name="hostname" class="form-control input-sm" placeholder="<?php print _('Hostname'); ?>" value="<?php if(isset($device['hostname'])) print $device['hostname']; ?>" <?php print $readonly; ?>>
73
+			<input type="text" name="hostname" class="form-control input-sm" placeholder="<?php print _('Hostname'); ?>" value="<?php if(isset($device['hostname'])) {
74
+    print $device['hostname'];
75
+}
76
+?>" <?php print $readonly; ?>>
74 77
 		</td>
75 78
 	</tr>
76 79
 
@@ -78,7 +81,10 @@  discard block
 block discarded – undo
78 81
 	<tr>
79 82
 		<td><?php print _('IP address'); ?></td>
80 83
 		<td>
81
-			<input type="text" name="ip_addr" class="form-control input-sm" placeholder="<?php print _('IP address'); ?>" value="<?php if(isset($device['ip_addr'])) print $device['ip_addr']; ?>" <?php print $readonly; ?>>
84
+			<input type="text" name="ip_addr" class="form-control input-sm" placeholder="<?php print _('IP address'); ?>" value="<?php if(isset($device['ip_addr'])) {
85
+    print $device['ip_addr'];
86
+}
87
+?>" <?php print $readonly; ?>>
82 88
 		</td>
83 89
 	</tr>
84 90
 
@@ -115,7 +121,7 @@  discard block
 block discarded – undo
115 121
                 <?php
116 122
                 foreach ($Racks->all_racks as $r) {
117 123
      				if($device['rack'] == $r->id)	{ print "<option value='$r->id' selected='selected'>$r->name</option>"; }
118
-    				else							{ print "<option value='$r->id' >$r->name</option>"; }
124
+     				else							{ print "<option value='$r->id' >$r->name</option>"; }
119 125
                 }
120 126
                 ?>
121 127
             </select>
@@ -148,7 +154,10 @@  discard block
 block discarded – undo
148 154
 	<tr>
149 155
 		<td><?php print _('SW version'); ?></td>
150 156
 		<td>
151
-			<input type="text" name="version" class="form-control input-sm" placeholder="<?php print _('Software version'); ?>" value="<?php if(isset($device['version'])) print $device['version']; ?>" <?php print $readonly; ?>>
157
+			<input type="text" name="version" class="form-control input-sm" placeholder="<?php print _('Software version'); ?>" value="<?php if(isset($device['version'])) {
158
+    print $device['version'];
159
+}
160
+?>" <?php print $readonly; ?>>
152 161
 		</td>
153 162
 	</tr>
154 163
 
@@ -156,7 +165,10 @@  discard block
 block discarded – undo
156 165
 	<tr>
157 166
 		<td><?php print _('Description'); ?></td>
158 167
 		<td>
159
-			<textarea name="description" class="form-control input-sm" placeholder="<?php print _('Description'); ?>" <?php print $readonly; ?>><?php if(isset($device['description'])) print $device['description']; ?></textarea>
168
+			<textarea name="description" class="form-control input-sm" placeholder="<?php print _('Description'); ?>" <?php print $readonly; ?>><?php if(isset($device['description'])) {
169
+    print $device['description'];
170
+}
171
+?></textarea>
160 172
 			<?php
161 173
 			if( ($_POST['action'] == "edit") || ($_POST['action'] == "delete") ) {
162 174
 				print '<input type="hidden" name="switchId" value="'. $_POST['switchId'] .'">'. "\n";
@@ -303,7 +315,10 @@  discard block
 block discarded – undo
303 315
 <div class="pFooter">
304 316
 	<div class="btn-group">
305 317
 		<button class="btn btn-sm btn-default hidePopups"><?php print _('Cancel'); ?></button>
306
-		<button class="btn btn-sm btn-default <?php if($_POST['action']=="delete") { print "btn-danger"; } else { print "btn-success"; } ?>" id="editSwitchsubmit"><i class="fa <?php if($_POST['action']=="add") { print "fa-plus"; } else if ($_POST['action']=="delete") { print "fa-trash-o"; } else { print "fa-check"; } ?>"></i> <?php print ucwords(_($_POST['action'])); ?></button>
318
+		<button class="btn btn-sm btn-default <?php if($_POST['action']=="delete") { print "btn-danger"; }
319
+else { print "btn-success"; } ?>" id="editSwitchsubmit"><i class="fa <?php if($_POST['action']=="add") { print "fa-plus"; }
320
+else if ($_POST['action']=="delete") { print "fa-trash-o"; }
321
+else { print "fa-check"; } ?>"></i> <?php print ucwords(_($_POST['action'])); ?></button>
307 322
 	</div>
308 323
 
309 324
 	<!-- result -->
Please login to merge, or discard this patch.
app/admin/import-export/import-load-data.php 1 patch
Braces   +10 added lines, -5 removed lines patch added patch discarded remove patch
@@ -18,7 +18,8 @@  discard block
 block discarded – undo
18 18
 $reqfields = explode("|",$_GET['reqfields']);
19 19
 if (isset($_GET['filetype'])) {
20 20
 	$filetype = $_GET['filetype'];
21
-} else {
21
+}
22
+else {
22 23
 	$Result->show('danger', _("Error: could not read the uploaded file type!"), true, true);
23 24
 }
24 25
 
@@ -34,10 +35,12 @@  discard block
 block discarded – undo
34 35
 		$impfield = $_GET['importFields__'.str_replace(" ", "_",$expfield)];
35 36
 		if (in_array($expfield,$reqfields) && ($impfield == "-")) {
36 37
 			$Result->show('danger', _("Error: missing required field mapping for expected field")." <b>".$expfield."</b>."._("Please check field matching in previous window."), true, true);
37
-		} else {
38
+		}
39
+		else {
38 40
 			if ($impfield != "-") { $impfields[$impfield] = $expfield; }
39 41
 		}
40
-	} else {
42
+	}
43
+	else {
41 44
 		$Result->show('danger', _("Internal error: missing import field mapping."), true, true);
42 45
 	}
43 46
 	# prepare header row for preview table
@@ -76,7 +79,8 @@  discard block
 block discarded – undo
76 79
 			$col++;
77 80
 			if ($col > $hcol) {
78 81
 				$Result->show('danger', _("Extra column found on line ").$row._(" in CSV file. CSV delimiter used in value field?"), true);
79
-			} else {
82
+			}
83
+			else {
80 84
 				# read each row into a dictionary with expected fields as keys
81 85
 				$record[$fieldmap[$col]] = trim($val);
82 86
 			}
@@ -105,7 +109,8 @@  discard block
 block discarded – undo
105 109
 			$record++;
106 110
 			if ($col > $hcol) {
107 111
 					$Result->show('danger', _("Extra column found on line ").$row._(" in XLS file. Please check input file."), true);
108
-			} else {
112
+			}
113
+			else {
109 114
 				$record[$fieldmap[$col]] = trim($xls->val($row,$col,$sheet));
110 115
 			}
111 116
 		}
Please login to merge, or discard this patch.
app/admin/import-export/import-recompute.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -48,7 +48,8 @@
 block discarded – undo
48 48
 			if ($c_subnet['result']) {
49 49
 				$trc = $colors[$c_subnet['action']];
50 50
 				$msg = "Master ".$c_subnet['action']." successful.";
51
-			} else {
51
+			}
52
+			else {
52 53
 				$trc = "danger";
53 54
 				$msg = "Master ".$c_subnet['action']." failed.";
54 55
 			}
Please login to merge, or discard this patch.
app/admin/import-export/generate-xls.php 1 patch
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -170,7 +170,7 @@
 block discarded – undo
170 170
 			}
171 171
 
172 172
 		}
173
-			else {
173
+		else {
174 174
 				$worksheet->write($lineCount, 0, _('No hosts'));
175 175
 				$lineCount++;
176 176
 			}
Please login to merge, or discard this patch.
app/admin/import-export/import-vlan-check.php 1 patch
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -52,12 +52,14 @@  discard block
 block discarded – undo
52 52
 	$msg = ""; $action = ""; $cfieldtds = "";
53 53
 
54 54
 	# set a default domain if none specified
55
-	if ($cdata['domain'] != "") { $cdom = $cdata['domain']; } else { $cdom = "default"; }
55
+	if ($cdata['domain'] != "") { $cdom = $cdata['domain']; }
56
+	else { $cdom = "default"; }
56 57
 
57 58
 	# check if domain exists and link ID, otherwise issue error
58 59
 	if (!in_array($cdom,$vdom)) {
59 60
 		$msg.= "Missing VLAN domain. Please add/import VLAN domain first."; $action = "error";
60
-	} else {
61
+	}
62
+	else {
61 63
 		$cdata['domainId'] = $vdomid[$cdom];
62 64
 	}
63 65
 
@@ -100,7 +102,8 @@  discard block
 block discarded – undo
100 102
 			if ($action == "skip") {
101 103
 				$msg.= "Duplicate, will skip.";
102 104
 			}
103
-		} else {
105
+		}
106
+		else {
104 107
 			$msg.="New entry, will be added."; $action = "add";
105 108
 		}
106 109
 	}
Please login to merge, or discard this patch.