Completed
Pull Request — master (#532)
06:37
created
app/admin/languages/edit.php 1 patch
Braces   +15 added lines, -5 removed lines patch added patch discarded remove patch
@@ -20,8 +20,9 @@  discard block
 block discarded – undo
20 20
 $csrf = $User->create_csrf_cookie ();
21 21
 
22 22
 # get lang details
23
-if($_POST['action']=="edit" || $_POST['action']=="delete")
24
-$lang = (array) $Admin->fetch_object ("lang", "l_id", $_POST['langid']);
23
+if($_POST['action']=="edit" || $_POST['action']=="delete") {
24
+    $lang = (array) $Admin->fetch_object ("lang", "l_id", $_POST['langid']);
25
+}
25 26
 
26 27
 # set title
27 28
 if($_POST['action'] == "edit")  		{ $title = 'Edit language'; }
@@ -41,14 +42,20 @@  discard block
 block discarded – undo
41 42
 	<!-- name -->
42 43
 	<tr>
43 44
 	    <td><?php print _('Language code'); ?></td>
44
-	    <td><input type="text" name="l_code" class="form-control input-sm" value="<?php print @$lang['l_code']; ?>" <?php if($_POST['action'] == "delete") print "readonly"; ?>></td>
45
+	    <td><input type="text" name="l_code" class="form-control input-sm" value="<?php print @$lang['l_code']; ?>" <?php if($_POST['action'] == "delete") {
46
+    print "readonly";
47
+}
48
+?>></td>
45 49
     </tr>
46 50
 
47 51
     <!-- description -->
48 52
     <tr>
49 53
     	<td><?php print _('Language name'); ?></td>
50 54
     	<td>
51
-    		<input type="text" name="l_name" class="form-control input-sm" value="<?php print @$lang['l_name']; ?>" <?php if($_POST['action'] == "delete") print "readonly"; ?>>
55
+    		<input type="text" name="l_name" class="form-control input-sm" value="<?php print @$lang['l_name']; ?>" <?php if($_POST['action'] == "delete") {
56
+    print "readonly";
57
+}
58
+?>>
52 59
 
53 60
     		<input type="hidden" name="l_id" value="<?php print $_POST['langid']; ?>">
54 61
     		<input type="hidden" name="csrf_cookie" value="<?php print $csrf; ?>">
@@ -68,7 +75,10 @@  discard block
 block discarded – undo
68 75
 <div class="pFooter">
69 76
 	<div class="btn-group">
70 77
 		<button class="btn btn-sm btn-default hidePopups"><?php print _('Cancel'); ?></button>
71
-		<button class="btn btn-sm btn-default <?php if($_POST['action']=="delete") { print "btn-danger"; } else { print "btn-success"; } ?>" id="langEditSubmit"><i class="fa <?php if($_POST['action']=="add") { print "fa-plus"; } else if ($_POST['action']=="delete") { print "fa-trash-o"; } else { print "fa-check"; } ?>"></i> <?php print ucwords(_($_POST['action'])); ?></button>
78
+		<button class="btn btn-sm btn-default <?php if($_POST['action']=="delete") { print "btn-danger"; }
79
+else { print "btn-success"; } ?>" id="langEditSubmit"><i class="fa <?php if($_POST['action']=="add") { print "fa-plus"; }
80
+else if ($_POST['action']=="delete") { print "fa-trash-o"; }
81
+else { print "fa-check"; } ?>"></i> <?php print ucwords(_($_POST['action'])); ?></button>
72 82
 	</div>
73 83
 
74 84
 	<!-- Result -->
Please login to merge, or discard this patch.
app/subnets/scan/subnet-scan-snmp-arp.php 1 patch
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -105,7 +105,7 @@
 block discarded – undo
105 105
 }
106 106
 
107 107
 # none and errors
108
-if(sizeof($found)==0 && isset($errors))          {
108
+if(sizeof($found)==0 && isset($errors)) {
109 109
     $Result->show("info", _("No new hosts found"), false);
110 110
     $Result->show("warning", implode("<hr>", $errors), false);
111 111
 }
Please login to merge, or discard this patch.
app/subnets/scan/subnet-scan-snmp-route-all.php 1 patch
Braces   +12 added lines, -8 removed lines patch added patch discarded remove patch
@@ -118,8 +118,9 @@  discard block
 block discarded – undo
118 118
     $masks =  $Subnets->get_ipv4_masks ();
119 119
 
120 120
     # fetch vrfs
121
-    if($User->settings->enableVRF==1)
122
-    $vrfs  = $Tools->fetch_all_objects("vrf", "name");
121
+    if($User->settings->enableVRF==1) {
122
+        $vrfs  = $Tools->fetch_all_objects("vrf", "name");
123
+    }
123 124
 
124 125
     # create csrf token
125 126
     $csrf = $User->create_csrf_cookie ();
@@ -141,8 +142,9 @@  discard block
 block discarded – undo
141 142
     	print "	<th>"._("Subnet")."</th>";
142 143
     	print "	<th>"._("Description")."</th>";
143 144
     	print "	<th>"._("VLAN")."</th>";
144
-    	if($User->settings->enableVRF==1)
145
-    	print "	<th>"._("VRF")."</th>";
145
+    	if($User->settings->enableVRF==1) {
146
+    	    	print "	<th>"._("VRF")."</th>";
147
+    	}
146 148
     	print "	<th>"._("Nameservers")."</th>";
147 149
     	print "	<th style='width:5px;'></th>";
148 150
     	print "</tr>";
@@ -207,10 +209,12 @@  discard block
 block discarded – undo
207 209
                     		print " <input type='hidden' name='sectionId-$m' value='$_POST[sectionId]'>";
208 210
                     		print " <input type='hidden' name='action-$m' value='add'>";
209 211
                     		print " <input type='hidden' name='device-$m' value='$deviceid'>";
210
-                    		if(isset($_POST['subnetId']))
211
-                    		print " <input type='hidden' name='masterSubnetId-$m' value='$_POST[subnetId]'>";
212
-                            else
213
-                    		print " <input type='hidden' name='masterSubnetId-$m' value='0'>";
212
+                    		if(isset($_POST['subnetId'])) {
213
+                    		                    		print " <input type='hidden' name='masterSubnetId-$m' value='$_POST[subnetId]'>";
214
+                    		}
215
+                            else {
216
+                                                		print " <input type='hidden' name='masterSubnetId-$m' value='0'>";
217
+                            }
214 218
                     		print " <input type='hidden' name='csrf_cookie' value='$csrf'>";
215 219
                     		print "</td>";
216 220
 
Please login to merge, or discard this patch.
app/subnets/scan/subnet-update-icmp.php 1 patch
Braces   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -35,9 +35,9 @@  discard block
 block discarded – undo
35 35
 	}
36 36
 
37 37
 	// null
38
-	if (sizeof($script_result->values->dead)==0)  {
38
+	if (sizeof($script_result->values->dead)==0) {
39 39
 		unset($script_result->values->dead); }
40
-	else	{
40
+		else {
41 41
 		$script_result->values->dead = array_values($script_result->values->dead);
42 42
 	}
43 43
 
@@ -67,19 +67,19 @@  discard block
 block discarded – undo
67 67
 				$res[$ip]['dns_name'] 	 = $ipdet['dns_name'];
68 68
 
69 69
 				//online
70
-				if($k=="alive")	{
70
+				if($k=="alive") {
71 71
 					$res[$ip]['status'] = "Online";
72 72
 					$res[$ip]['code']=0;
73 73
 					//update alive time
74 74
 					@$Scan->ping_update_lastseen($ipdet['id']);
75 75
 				}
76 76
 				//offline
77
-				elseif($k=="dead")	{
77
+				elseif($k=="dead") {
78 78
 					$res[$ip]['status'] = "Offline";
79 79
 					$res[$ip]['code']=1;
80 80
 				}
81 81
 				//excluded
82
-				elseif($k=="excluded")	{
82
+				elseif($k=="excluded") {
83 83
 					$res[$ip]['status'] = "Excluded form check";
84 84
 					$res[$ip]['code']=100;
85 85
 				}
Please login to merge, or discard this patch.
app/subnets/index.php 1 patch
Braces   +7 added lines, -3 removed lines patch added patch discarded remove patch
@@ -48,7 +48,8 @@  discard block
 block discarded – undo
48 48
 	}
49 49
 
50 50
 	$subnet_usage  = $Subnets->calculate_subnet_usage ($addresses_cnt, $subnet['mask'], $subnet['subnet'], $subnet['isFull'] );		//Calculate free/used etc
51
-} else {
51
+}
52
+else {
52 53
 	$addresses = $Addresses->fetch_subnet_addresses ($subnet['id']);
53 54
 	// save count
54 55
 	$addresses_cnt = gmp_strval(sizeof($addresses));
@@ -56,7 +57,7 @@  discard block
 block discarded – undo
56 57
 }
57 58
 
58 59
 # verify that is it displayed in proper section, otherwise warn!
59
-if($subnet['sectionId']!=$_GET['section'])	{
60
+if($subnet['sectionId']!=$_GET['section']) {
60 61
 	$sd = (array) $Sections->fetch_section(null,$subnet['sectionId']);
61 62
 	$Result->show("warning", _("Subnet is in section")." <a href='".create_link("subnets",$sd['id'],$subnet['id'])."'>$sd[name]</a>!", false);
62 63
 }
@@ -82,7 +83,10 @@  discard block
 block discarded – undo
82 83
 
83 84
 	<!-- subnet slaves list -->
84 85
 	<div class="col-xs-12 subnetSlaves">
85
-		<?php if($slaves) include('subnet-slaves.php'); ?>
86
+		<?php if($slaves) {
87
+    include('subnet-slaves.php');
88
+}
89
+?>
86 90
 	</div>
87 91
 
88 92
 	<!-- addresses -->
Please login to merge, or discard this patch.
app/subnets/import-subnet/print-file.php 1 patch
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -62,14 +62,17 @@
 block discarded – undo
62 62
 $errors = 0;
63 63
 foreach($outFile as $line) {
64 64
     // errors
65
-    if($line['class']=="danger") $errors++;
65
+    if($line['class']=="danger") {
66
+        $errors++;
67
+    }
66 68
 	//print
67 69
 	print '<tr class="'.$line['class'].'">';
68 70
 	// remove class
69 71
 	unset($line['class']);
70 72
 
71 73
 	foreach ($line as $value) {
72
-		if (!empty($line[0])) {			//IP address must be present otherwise ignore field
74
+		if (!empty($line[0])) {
75
+//IP address must be present otherwise ignore field
73 76
 			print '<td>'. $value .'</td>';
74 77
 		}
75 78
 	}
Please login to merge, or discard this patch.
app/subnets/import-subnet/import-file.php 1 patch
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -22,7 +22,9 @@  discard block
 block discarded – undo
22 22
 $permission = $Subnets->check_permission ($User->user, $_POST['subnetId']);
23 23
 
24 24
 # die if write not permitted
25
-if($permission < 2) 			   $Result->show("danger", _('You cannot write to this subnet'), true);
25
+if($permission < 2) {
26
+    $Result->show("danger", _('You cannot write to this subnet'), true);
27
+}
26 28
 # check integer
27 29
 is_numeric($_POST['subnetId']) ? : $Result->show("danger", _("Invalid subnet ID") ,true);
28 30
 
@@ -104,7 +106,7 @@  discard block
 block discarded – undo
104 106
 }
105 107
 
106 108
 # print success if no errors
107
-if($errors==0)	{
109
+if($errors==0) {
108 110
 	$Result->show("success", _('Import successfull'), false);
109 111
 	# erase file on success
110 112
 	unlink('upload/import.'.$filetype);
Please login to merge, or discard this patch.
app/subnets/addresses/mail-notify.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -56,8 +56,9 @@
 block discarded – undo
56 56
 						$content[] = "&bull; "._('Subnet').": \t\t $subnet[ip]/$subnet[mask] $s_descrip";
57 57
 # gateway
58 58
 $gateway = $Subnets->find_gateway($subnet['id']);
59
-if($gateway !==false)
59
+if($gateway !==false) {
60 60
  						$content[] = "&bull; "._('Gateway').": \t\t". $Subnets->transform_to_dotted($gateway->ip_addr);
61
+}
61 62
 
62 63
 
63 64
 # VLAN
Please login to merge, or discard this patch.
app/subnets/addresses/address-details.php 1 patch
Braces   +9 added lines, -11 removed lines patch added patch discarded remove patch
@@ -166,7 +166,8 @@  discard block
 block discarded – undo
166 166
     		$device = (array) $Tools->fetch_device(null, $address['switch']);
167 167
     		$device = $Addresses->reformat_empty_array_fields($device, "");
168 168
     		print "	<td><a href='".create_link("tools","devices","hosts",$device['id'])."'>".@$device['hostname']."</a> ".@$device['description']."</td>";
169
-    	} else {
169
+    	}
170
+    	else {
170 171
     		print "	<td>$address[switch]</td>";
171 172
     	}
172 173
     	print "</tr>";
@@ -185,7 +186,8 @@  discard block
 block discarded – undo
185 186
     	print "	<th>"._('Last edited')."</th>";
186 187
     	if(strlen($address['editDate'])>1) {
187 188
     		print "	<td>$address[editDate]</td>";
188
-    	} else {
189
+    	}
190
+    	else {
189 191
     		print "	<td>"._('Never')."</td>";
190 192
     	}
191 193
     	print "</tr>";
@@ -248,7 +250,7 @@  discard block
 block discarded – undo
248 250
     			print "	<th>$key</th>";
249 251
     			print "	<td>";
250 252
     			#booleans
251
-    			if($field['type']=="tinyint(1)")	{
253
+    			if($field['type']=="tinyint(1)") {
252 254
     				if($address[$key] == 0)		{ print _("No"); }
253 255
     				elseif($address[$key] == 1)	{ print _("Yes"); }
254 256
     			}
@@ -325,16 +327,14 @@  discard block
 block discarded – undo
325 327
     	print "	<div class='btn-group'>";
326 328
     	# write permitted
327 329
     	if( $subnet_permission > 1) {
328
-    		if(@$address['class']=="range-dhcp")
329
-    		{
330
+    		if(@$address['class']=="range-dhcp") {
330 331
     			print "		<a class='edit_ipaddress   btn btn-default btn-xs modIPaddr' data-action='edit'   data-subnetId='".$address['subnetId']."' data-id='".$address['id']."' data-stopIP='".$address['stopIP']."' href='#' 		   rel='tooltip' data-container='body' title='"._('Edit IP address details')."'>	<i class='fa fa-gray fa-pencil'>  </i></a>";
331 332
     			print "		<a class='				   btn btn-default btn-xs disabled' href='#'>																																													<i class='fa fa-gray fa-cogs'> </i></a>";
332 333
     			print "		<a class='				   btn btn-default btn-xs disabled' href='#'>																																													<i class='fa fa-gray fa-search'></i></a>";
333 334
     			print "		<a class='				   btn btn-default btn-xs disabled' href='#'>																																													<i class='fa fa-gray fa-envelope-o'></i></a>";
334 335
     			print "		<a class='delete_ipaddress btn btn-default btn-xs modIPaddr' data-action='delete' data-subnetId='".$address['subnetId']."' data-id='".$address['id']."' href='#' id2='$address[ip]' rel='tooltip' data-container='body' title='"._('Delete IP address')."'>		<i class='fa fa-gray fa-times'>  </i></a>";
335 336
     		}
336
-    		else
337
-    		{
337
+    		else {
338 338
     			print "		<a class='edit_ipaddress   btn btn-default btn-xs modIPaddr' data-action='edit'   data-subnetId='".$address['subnetId']."' data-id='".$address['id']."' href='#' 											   rel='tooltip' data-container='body' title='"._('Edit IP address details')."'>				<i class='fa fa-gray fa-pencil'></i></a>";
339 339
     			print "		<a class='ping_ipaddress   btn btn-default btn-xs' data-subnetId='".$address['subnetId']."' data-id='".$address['id']."' href='#' 						   													rel='tooltip' data-container='body' title='"._('Check availability')."'>							<i class='fa fa-gray fa-cogs'></i></a>";
340 340
     			print "		<a class='search_ipaddress btn btn-default btn-xs         "; if(strlen($resolve['name']) == 0) { print "disabled"; } print "' href='".create_link("tools","search",$resolve['name'])."' "; if(strlen($resolve['name']) != 0)   { print "rel='tooltip' data-container='body' title='"._('Search same hostnames in db')."'"; } print ">	<i class='fa fa-gray fa-search'></i></a>";
@@ -351,16 +351,14 @@  discard block
 block discarded – undo
351 351
     	}
352 352
     	# write not permitted
353 353
     	else {
354
-    		if(@$address['class']=="range-dhcp")
355
-    		{
354
+    		if(@$address['class']=="range-dhcp") {
356 355
     			print "		<a class='edit_ipaddress   btn btn-default btn-xs disabled' rel='tooltip' data-container='body' title='"._('Edit IP address details (disabled)')."'>	<i class='fa fa-gray fa-pencil'>  </i></a>";
357 356
     			print "		<a class='				   btn btn-default btn-xs disabled' href='#'>																<i class='fa fa-gray fa-retweet'> </i></a>";
358 357
     			print "		<a class='				   btn btn-default btn-xs disabled' href='#'>																<i class='fa fa-gray fa-search'></i></a>";
359 358
     			print "		<a class='				   btn btn-default btn-xs disabled' href='#'>																<i class='fa fa-gray fa-envelope'></i></a>";
360 359
     			print "		<a class='delete_ipaddress btn btn-default btn-xs disabled' rel='tooltip' data-container='body' title='"._('Delete IP address (disabled)')."'>			<i class='fa fa-gray fa-times'>  </i></a>";
361 360
     		}
362
-    		else
363
-    		{
361
+    		else {
364 362
     			print "		<a class='edit_ipaddress   btn btn-default btn-xs disabled' rel='tooltip' data-container='body' title='"._('Edit IP address details (disabled)')."'>							<i class='fa fa-gray fa-pencil'>  </i></a>";
365 363
     			print "		<a class='				   btn btn-default btn-xs disabled'  data-id='".$address['id']."' href='#' rel='tooltip' data-container='body' title='"._('Check availability')."'>		<i class='fa fa-gray fa-retweet'>  </i></a>";
366 364
     			print "		<a class='search_ipaddress btn btn-default btn-xs         "; if(strlen($resolve['name']) == 0) { print "disabled"; } print "' href='".create_link("tools","search",$resolve['name'])."' "; if(strlen($resolve['name']) != 0) { print "rel='tooltip' data-container='body' title='"._('Search same hostnames in db')."'"; } print ">	<i class='fa fa-gray fa-search'></i></a>";
Please login to merge, or discard this patch.