Completed
Pull Request — master (#532)
06:37
created
app/admin/racks/edit.php 1 patch
Spacing   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -5,38 +5,38 @@  discard block
 block discarded – undo
5 5
  ************************/
6 6
 
7 7
 /* functions */
8
-require( dirname(__FILE__) . '/../../../functions/functions.php');
8
+require(dirname (__FILE__).'/../../../functions/functions.php');
9 9
 
10 10
 # initialize user object
11
-$Database 	= new Database_PDO;
12
-$User 		= new User ($Database);
11
+$Database = new Database_PDO;
12
+$User = new User ($Database);
13 13
 $Admin	 	= new Admin ($Database);
14 14
 $Tools	 	= new Tools ($Database);
15
-$Racks      = new phpipam_rack ($Database);
15
+$Racks = new phpipam_rack ($Database);
16 16
 $Result 	= new Result ();
17 17
 
18 18
 # verify that user is logged in
19
-$User->check_user_session();
19
+$User->check_user_session ();
20 20
 
21 21
 # create csrf token
22 22
 $csrf = $User->csrf_cookie ("create", "rack");
23 23
 
24 24
 # fetch custom fields
25
-$custom = $Tools->fetch_custom_fields('racks');
25
+$custom = $Tools->fetch_custom_fields ('racks');
26 26
 
27 27
 # ID must be numeric
28
-if($_POST['action']!="add" && !is_numeric($_POST['rackid']))		{ $Result->show("danger", _("Invalid ID"), true, true); }
28
+if ($_POST['action'] != "add" && !is_numeric ($_POST['rackid'])) { $Result->show ("danger", _ ("Invalid ID"), true, true); }
29 29
 
30 30
 # fetch device details
31
-if( ($_POST['action'] == "edit") || ($_POST['action'] == "delete") ) {
32
-	$rack = $Admin->fetch_object("racks", "id", $_POST['rackid']);
31
+if (($_POST['action'] == "edit") || ($_POST['action'] == "delete")) {
32
+	$rack = $Admin->fetch_object ("racks", "id", $_POST['rackid']);
33 33
 }
34 34
 else {
35 35
     $rack = new StdClass ();
36 36
 }
37 37
 
38 38
 # set readonly flag
39
-$readonly = $_POST['action']=="delete" ? "readonly" : "";
39
+$readonly = $_POST['action'] == "delete" ? "readonly" : "";
40 40
 ?>
41 41
 
42 42
 <script type="text/javascript">
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 
48 48
 
49 49
 <!-- header -->
50
-<div class="pHeader"><?php print ucwords(_("$_POST[action]")); ?> <?php print _('rack'); ?></div>
50
+<div class="pHeader"><?php print ucwords (_ ("$_POST[action]")); ?> <?php print _ ('rack'); ?></div>
51 51
 
52 52
 
53 53
 <!-- content -->
@@ -58,21 +58,21 @@  discard block
 block discarded – undo
58 58
 
59 59
 	<!-- hostname  -->
60 60
 	<tr>
61
-		<td><?php print _('Name'); ?></td>
61
+		<td><?php print _ ('Name'); ?></td>
62 62
 		<td>
63
-			<input type="text" name="name" class="form-control input-sm" placeholder="<?php print _('Name'); ?>" value="<?php if(isset($rack->name)) print $rack->name; ?>" <?php print $readonly; ?>>
63
+			<input type="text" name="name" class="form-control input-sm" placeholder="<?php print _ ('Name'); ?>" value="<?php if (isset($rack->name)) print $rack->name; ?>" <?php print $readonly; ?>>
64 64
 		</td>
65 65
 	</tr>
66 66
 
67 67
 	<!-- Type -->
68 68
 	<tr>
69
-		<td><?php print _('Size'); ?></td>
69
+		<td><?php print _ ('Size'); ?></td>
70 70
 		<td>
71 71
 			<select name="size" class="form-control input-sm input-w-auto">
72 72
 			<?php
73
-			foreach($Racks->rack_sizes as $s) {
74
-				if($rack->size == $s)	{ print "<option value='$s' selected='selected'>$s U</option>"; }
75
-				else					{ print "<option value='$s' >$s U</option>"; }
73
+			foreach ($Racks->rack_sizes as $s) {
74
+				if ($rack->size == $s) { print "<option value='$s' selected='selected'>$s U</option>"; }
75
+				else { print "<option value='$s' >$s U</option>"; }
76 76
 			}
77 77
 			?>
78 78
 			</select>
@@ -81,12 +81,12 @@  discard block
 block discarded – undo
81 81
 
82 82
 	<!-- Description -->
83 83
 	<tr>
84
-		<td><?php print _('Description'); ?></td>
84
+		<td><?php print _ ('Description'); ?></td>
85 85
 		<td>
86
-			<textarea name="description" class="form-control input-sm" placeholder="<?php print _('Description'); ?>" <?php print $readonly; ?>><?php if(isset($rack->description)) print $rack->description; ?></textarea>
86
+			<textarea name="description" class="form-control input-sm" placeholder="<?php print _ ('Description'); ?>" <?php print $readonly; ?>><?php if (isset($rack->description)) print $rack->description; ?></textarea>
87 87
 			<?php
88
-			if( ($_POST['action'] == "edit") || ($_POST['action'] == "delete") ) {
89
-				print '<input type="hidden" name="rackid" value="'. $_POST['rackid'] .'">'. "\n";
88
+			if (($_POST['action'] == "edit") || ($_POST['action'] == "delete")) {
89
+				print '<input type="hidden" name="rackid" value="'.$_POST['rackid'].'">'."\n";
90 90
 			} ?>
91 91
 			<input type="hidden" name="action" value="<?php print $_POST['action']; ?>">
92 92
 			<input type="hidden" name="csrf_cookie" value="<?php print $csrf; ?>">
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 
96 96
 	<!-- Custom -->
97 97
 	<?php
98
-	if(sizeof($custom) > 0) {
98
+	if (sizeof ($custom) > 0) {
99 99
 
100 100
 		print '<tr>';
101 101
 		print '	<td colspan="2"><hr></td>';
@@ -105,39 +105,39 @@  discard block
 block discarded – undo
105 105
 		$timeP = 0;
106 106
 
107 107
 		# all my fields
108
-		foreach($custom as $field) {
108
+		foreach ($custom as $field) {
109 109
 			# replace spaces with |
110
-			$field['nameNew'] = str_replace(" ", "___", $field['name']);
110
+			$field['nameNew'] = str_replace (" ", "___", $field['name']);
111 111
 
112 112
 			# required
113
-			if($field['Null']=="NO")	{ $required = "*"; }
114
-			else						{ $required = ""; }
113
+			if ($field['Null'] == "NO") { $required = "*"; }
114
+			else { $required = ""; }
115 115
 
116 116
 			# set default value !
117
-			if ($_POST['action']=="add")	{ $rack->$field['name'] = $field['Default']; }
117
+			if ($_POST['action'] == "add") { $rack->$field['name'] = $field['Default']; }
118 118
 
119
-			print '<tr>'. "\n";
120
-			print '	<td>'. ucwords($field['name']) .' '.$required.'</td>'. "\n";
121
-			print '	<td>'. "\n";
119
+			print '<tr>'."\n";
120
+			print '	<td>'.ucwords ($field['name']).' '.$required.'</td>'."\n";
121
+			print '	<td>'."\n";
122 122
 
123 123
 			//set type
124
-			if(substr($field['type'], 0,3) == "set" || substr($field['type'], 0,4) == "enum") {
124
+			if (substr ($field['type'], 0, 3) == "set" || substr ($field['type'], 0, 4) == "enum") {
125 125
 				//parse values
126
-				$tmp = substr($field['type'], 0,3)=="set" ? explode(",", str_replace(array("set(", ")", "'"), "", $field['type'])) : explode(",", str_replace(array("enum(", ")", "'"), "", $field['type']));
126
+				$tmp = substr ($field['type'], 0, 3) == "set" ? explode (",", str_replace (array ("set(", ")", "'"), "", $field['type'])) : explode (",", str_replace (array ("enum(", ")", "'"), "", $field['type']));
127 127
 				//null
128
-				if($field['Null']!="NO") { array_unshift($tmp, ""); }
128
+				if ($field['Null'] != "NO") { array_unshift ($tmp, ""); }
129 129
 
130 130
 				print "<select name='$field[nameNew]' class='form-control input-sm input-w-auto' rel='tooltip' data-placement='right' title='$field[Comment]'>";
131
-				foreach($tmp as $v) {
132
-					if($v==$rack->$field['name'])	{ print "<option value='$v' selected='selected'>$v</option>"; }
133
-					else							{ print "<option value='$v'>$v</option>"; }
131
+				foreach ($tmp as $v) {
132
+					if ($v == $rack->$field['name']) { print "<option value='$v' selected='selected'>$v</option>"; }
133
+					else { print "<option value='$v'>$v</option>"; }
134 134
 				}
135 135
 				print "</select>";
136 136
 			}
137 137
 			//date and time picker
138
-			elseif($field['type'] == "date" || $field['type'] == "datetime") {
138
+			elseif ($field['type'] == "date" || $field['type'] == "datetime") {
139 139
 				// just for first
140
-				if($timeP==0) {
140
+				if ($timeP == 0) {
141 141
 					print '<link rel="stylesheet" type="text/css" href="css/1.2/bootstrap/bootstrap-datetimepicker.min.css">';
142 142
 					print '<script type="text/javascript" src="js/1.2/bootstrap-datetimepicker.min.js"></script>';
143 143
 					print '<script type="text/javascript">';
@@ -153,38 +153,38 @@  discard block
 block discarded – undo
153 153
 				$timeP++;
154 154
 
155 155
 				//set size
156
-				if($field['type'] == "date")	{ $size = 10; $class='datepicker';		$format = "yyyy-MM-dd"; }
157
-				else							{ $size = 19; $class='datetimepicker';	$format = "yyyy-MM-dd"; }
156
+				if ($field['type'] == "date") { $size = 10; $class = 'datepicker'; $format = "yyyy-MM-dd"; }
157
+				else { $size = 19; $class = 'datetimepicker'; $format = "yyyy-MM-dd"; }
158 158
 
159 159
 				//field
160
-				if(!isset($rack->$field['name']))	{ print ' <input type="text" class="'.$class.' form-control input-sm input-w-auto" data-format="'.$format.'" name="'. $field['nameNew'] .'" maxlength="'.$size.'" rel="tooltip" data-placement="right" title="'.$field['Comment'].'">'. "\n"; }
161
-				else								{ print ' <input type="text" class="'.$class.' form-control input-sm input-w-auto" data-format="'.$format.'" name="'. $field['nameNew'] .'" maxlength="'.$size.'" value="'. $rack->$field['name']. '" rel="tooltip" data-placement="right" title="'.$field['Comment'].'">'. "\n"; }
160
+				if (!isset($rack->$field['name'])) { print ' <input type="text" class="'.$class.' form-control input-sm input-w-auto" data-format="'.$format.'" name="'.$field['nameNew'].'" maxlength="'.$size.'" rel="tooltip" data-placement="right" title="'.$field['Comment'].'">'."\n"; }
161
+				else { print ' <input type="text" class="'.$class.' form-control input-sm input-w-auto" data-format="'.$format.'" name="'.$field['nameNew'].'" maxlength="'.$size.'" value="'.$rack->$field['name'].'" rel="tooltip" data-placement="right" title="'.$field['Comment'].'">'."\n"; }
162 162
 			}
163 163
 			//boolean
164
-			elseif($field['type'] == "tinyint(1)") {
164
+			elseif ($field['type'] == "tinyint(1)") {
165 165
 				print "<select name='$field[nameNew]' class='form-control input-sm input-w-auto' rel='tooltip' data-placement='right' title='$field[Comment]'>";
166
-				$tmp = array(0=>"No",1=>"Yes");
166
+				$tmp = array (0=>"No", 1=>"Yes");
167 167
 				//null
168
-				if($field['Null']!="NO") { $tmp[2] = ""; }
168
+				if ($field['Null'] != "NO") { $tmp[2] = ""; }
169 169
 
170
-				foreach($tmp as $k=>$v) {
171
-					if(strlen($rack->$field['name'])==0 && $k==2)	{ print "<option value='$k' selected='selected'>"._($v)."</option>"; }
172
-					elseif($k==$rack->$field['name'])				{ print "<option value='$k' selected='selected'>"._($v)."</option>"; }
173
-					else											{ print "<option value='$k'>"._($v)."</option>"; }
170
+				foreach ($tmp as $k=>$v) {
171
+					if (strlen ($rack->$field['name']) == 0 && $k == 2) { print "<option value='$k' selected='selected'>"._ ($v)."</option>"; }
172
+					elseif ($k == $rack->$field['name']) { print "<option value='$k' selected='selected'>"._ ($v)."</option>"; }
173
+					else { print "<option value='$k'>"._ ($v)."</option>"; }
174 174
 				}
175 175
 				print "</select>";
176 176
 			}
177 177
 			//text
178
-			elseif($field['type'] == "text") {
179
-				print ' <textarea class="form-control input-sm" name="'. $field['nameNew'] .'" placeholder="'. $field['name'] .'" rowspan=3 rel="tooltip" data-placement="right" title="'.$field['Comment'].'">'. $rack->$field['name']. '</textarea>'. "\n";
178
+			elseif ($field['type'] == "text") {
179
+				print ' <textarea class="form-control input-sm" name="'.$field['nameNew'].'" placeholder="'.$field['name'].'" rowspan=3 rel="tooltip" data-placement="right" title="'.$field['Comment'].'">'.$rack->$field['name'].'</textarea>'."\n";
180 180
 			}
181 181
 			//default - input field
182 182
 			else {
183
-				print ' <input type="text" class="ip_addr form-control input-sm" name="'. $field['nameNew'] .'" placeholder="'. $field['name'] .'" value="'. $rack->$field['name']. '" size="30" rel="tooltip" data-placement="right" title="'.$field['Comment'].'">'. "\n";
183
+				print ' <input type="text" class="ip_addr form-control input-sm" name="'.$field['nameNew'].'" placeholder="'.$field['name'].'" value="'.$rack->$field['name'].'" size="30" rel="tooltip" data-placement="right" title="'.$field['Comment'].'">'."\n";
184 184
 			}
185 185
 
186
-			print '	</td>'. "\n";
187
-			print '</tr>'. "\n";
186
+			print '	</td>'."\n";
187
+			print '</tr>'."\n";
188 188
 		}
189 189
 
190 190
 	}
@@ -199,8 +199,8 @@  discard block
 block discarded – undo
199 199
 <!-- footer -->
200 200
 <div class="pFooter">
201 201
 	<div class="btn-group">
202
-		<button class="btn btn-sm btn-default hidePopups"><?php print _('Cancel'); ?></button>
203
-		<button class="btn btn-sm btn-default <?php if($_POST['action']=="delete") { print "btn-danger"; } else { print "btn-success"; } ?>" id="editRacksubmit"><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>
202
+		<button class="btn btn-sm btn-default hidePopups"><?php print _ ('Cancel'); ?></button>
203
+		<button class="btn btn-sm btn-default <?php if ($_POST['action'] == "delete") { print "btn-danger"; } else { print "btn-success"; } ?>" id="editRacksubmit"><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>
204 204
 	</div>
205 205
 
206 206
 	<!-- result -->
Please login to merge, or discard this patch.
app/admin/racks/edit-result.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -5,57 +5,57 @@  discard block
 block discarded – undo
5 5
  ***************************/
6 6
 
7 7
 /* functions */
8
-require( dirname(__FILE__) . '/../../../functions/functions.php');
8
+require(dirname (__FILE__).'/../../../functions/functions.php');
9 9
 
10 10
 # initialize user object
11
-$Database 	= new Database_PDO;
12
-$User 		= new User ($Database);
11
+$Database = new Database_PDO;
12
+$User = new User ($Database);
13 13
 $Admin	 	= new Admin ($Database);
14 14
 $Tools	 	= new Tools ($Database);
15
-$Racks      = new phpipam_rack ($Database);
15
+$Racks = new phpipam_rack ($Database);
16 16
 $Result 	= new Result ();
17 17
 
18 18
 # verify that user is logged in
19
-$User->check_user_session();
19
+$User->check_user_session ();
20 20
 
21 21
 # validate csrf cookie
22
-$User->csrf_cookie ("validate", "rack", $_POST['csrf_cookie']) === false ? $Result->show("danger", _("Invalid CSRF cookie"), true) : "";
22
+$User->csrf_cookie ("validate", "rack", $_POST['csrf_cookie']) === false ? $Result->show ("danger", _ ("Invalid CSRF cookie"), true) : "";
23 23
 
24 24
 # get modified details
25
-$rack = $Tools->strip_input_tags($_POST);
25
+$rack = $Tools->strip_input_tags ($_POST);
26 26
 
27 27
 # ID must be numeric
28
-if($_POST['action']!="add" && !is_numeric($_POST['rackid']))			{ $Result->show("danger", _("Invalid ID"), true); }
28
+if ($_POST['action'] != "add" && !is_numeric ($_POST['rackid'])) { $Result->show ("danger", _ ("Invalid ID"), true); }
29 29
 
30 30
 # Hostname must be present
31
-if($rack['name'] == "") 											    { $Result->show("danger", _('Name is mandatory').'!', true); }
31
+if ($rack['name'] == "") { $Result->show ("danger", _ ('Name is mandatory').'!', true); }
32 32
 
33 33
 # rack checks
34 34
 # validate position and size
35
-if (!is_numeric($rack['size']))                                         { $Result->show("danger", _('Invalid rack size').'!', true); }
35
+if (!is_numeric ($rack['size'])) { $Result->show ("danger", _ ('Invalid rack size').'!', true); }
36 36
 # validate rack
37
-if ($rack['action']=="edit") {
38
-    if (!is_numeric($rack['rackid']))                                       { $Result->show("danger", _('Invalid rack identifier').'!', true); }
37
+if ($rack['action'] == "edit") {
38
+    if (!is_numeric ($rack['rackid'])) { $Result->show ("danger", _ ('Invalid rack identifier').'!', true); }
39 39
     $rack_details = $Racks->fetch_rack_details ($rack['rackid']);
40
-    if ($rack_details===false)                                          { $Result->show("danger", _('Rack does not exist').'!', true); }
40
+    if ($rack_details === false) { $Result->show ("danger", _ ('Rack does not exist').'!', true); }
41 41
 }
42
-elseif($rack['action']=="delete") {
43
-    if (!is_numeric($rack['rackid']))                                       { $Result->show("danger", _('Invalid rack identifier').'!', true); }
42
+elseif ($rack['action'] == "delete") {
43
+    if (!is_numeric ($rack['rackid'])) { $Result->show ("danger", _ ('Invalid rack identifier').'!', true); }
44 44
 }
45 45
 
46 46
 # fetch custom fields
47
-$custom = $Tools->fetch_custom_fields('racks');
48
-if(sizeof($custom) > 0) {
49
-	foreach($custom as $myField) {
47
+$custom = $Tools->fetch_custom_fields ('racks');
48
+if (sizeof ($custom) > 0) {
49
+	foreach ($custom as $myField) {
50 50
 		//booleans can be only 0 and 1!
51
-		if($myField['type']=="tinyint(1)") {
52
-			if($rack[$myField['name']]>1) {
51
+		if ($myField['type'] == "tinyint(1)") {
52
+			if ($rack[$myField['name']] > 1) {
53 53
 				$rack[$myField['name']] = 0;
54 54
 			}
55 55
 		}
56 56
 		//not null!
57
-		if($myField['Null']=="NO" && strlen($rack[$myField['name']])==0) {
58
-																		{ $Result->show("danger", $myField['name'].'" can not be empty!', true); }
57
+		if ($myField['Null'] == "NO" && strlen ($rack[$myField['name']]) == 0) {
58
+																		{ $Result->show ("danger", $myField['name'].'" can not be empty!', true); }
59 59
 		}
60 60
 		# save to update array
61 61
 		$update[$myField['name']] = $rack[$myField['name']];
@@ -63,21 +63,21 @@  discard block
 block discarded – undo
63 63
 }
64 64
 
65 65
 # set update values
66
-$values = array("id"=>@$rack['rackid'],
66
+$values = array ("id"=>@$rack['rackid'],
67 67
 				"name"=>@$rack['name'],
68 68
 				"size"=>@$rack['size'],
69 69
 				"description"=>@$rack['description']
70 70
 				);
71 71
 # custom fields
72
-if(isset($update)) {
73
-	$values = array_merge($values, $update);
72
+if (isset($update)) {
73
+	$values = array_merge ($values, $update);
74 74
 }
75 75
 
76 76
 # update rack
77
-if(!$Admin->object_modify("racks", $_POST['action'], "id", $values))	{}
78
-else																	{ $Result->show("success", _("Rack $rack[action] successfull").'!', false); }
77
+if (!$Admin->object_modify ("racks", $_POST['action'], "id", $values)) {}
78
+else { $Result->show ("success", _ ("Rack $rack[action] successfull").'!', false); }
79 79
 
80
-if($_POST['action']=="delete"){
80
+if ($_POST['action'] == "delete") {
81 81
 	# remove all references from subnets and ip addresses
82 82
 	$Admin->remove_object_references ("devices", "rack", $values["id"]);
83 83
 }
Please login to merge, or discard this patch.
app/admin/racks/print-racks.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -5,8 +5,8 @@
 block discarded – undo
5 5
  ***************************/
6 6
 
7 7
 # verify that user is logged in
8
-$User->check_user_session();
8
+$User->check_user_session ();
9 9
 
10 10
 # include tools rack
11
-include(dirname(__FILE__) . "/../../tools/racks/index.php");
11
+include(dirname (__FILE__)."/../../tools/racks/index.php");
12 12
 ?>
13 13
\ No newline at end of file
Please login to merge, or discard this patch.
app/admin/racks/edit-rack-devices-result.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -5,45 +5,45 @@
 block discarded – undo
5 5
  ***************************/
6 6
 
7 7
 /* functions */
8
-require( dirname(__FILE__) . '/../../../functions/functions.php');
8
+require(dirname (__FILE__).'/../../../functions/functions.php');
9 9
 
10 10
 # initialize user object
11
-$Database 	= new Database_PDO;
12
-$User 		= new User ($Database);
11
+$Database = new Database_PDO;
12
+$User = new User ($Database);
13 13
 $Admin	 	= new Admin ($Database);
14 14
 $Result 	= new Result ();
15 15
 
16 16
 # verify that user is logged in
17
-$User->check_user_session();
17
+$User->check_user_session ();
18 18
 
19 19
 # strip input tags
20
-$_POST = $Admin->strip_input_tags($_POST);
20
+$_POST = $Admin->strip_input_tags ($_POST);
21 21
 
22 22
 # validate csrf cookie
23
-$User->csrf_cookie ("validate", "rack_devices", $_POST['csrf_cookie']) === false ? $Result->show("danger", _("Invalid CSRF cookie"), true) : "";
23
+$User->csrf_cookie ("validate", "rack_devices", $_POST['csrf_cookie']) === false ? $Result->show ("danger", _ ("Invalid CSRF cookie"), true) : "";
24 24
 
25 25
 # ID must be numeric
26
-if(!is_numeric($_POST['rackid']))			                           { $Result->show("danger", _("Invalid ID"), true); }
27
-if(!is_numeric($_POST['deviceid']))			                           { $Result->show("danger", _("Invalid ID"), true); }
28
-if(!is_numeric($_POST['rack_start']))			                       { $Result->show("danger", _("Invalid start value"), true); }
29
-if(!is_numeric($_POST['rack_size']))			                       { $Result->show("danger", _("Invalid size value"), true); }
26
+if (!is_numeric ($_POST['rackid'])) { $Result->show ("danger", _ ("Invalid ID"), true); }
27
+if (!is_numeric ($_POST['deviceid'])) { $Result->show ("danger", _ ("Invalid ID"), true); }
28
+if (!is_numeric ($_POST['rack_start'])) { $Result->show ("danger", _ ("Invalid start value"), true); }
29
+if (!is_numeric ($_POST['rack_size'])) { $Result->show ("danger", _ ("Invalid size value"), true); }
30 30
 
31 31
 # validate rack
32
-$rack = $Admin->fetch_object("racks", "id", $_POST['rackid']);
33
-if ($rack===false)                                                     { $Result->show("danger", _("Invalid ID"), true); }
32
+$rack = $Admin->fetch_object ("racks", "id", $_POST['rackid']);
33
+if ($rack === false) { $Result->show ("danger", _ ("Invalid ID"), true); }
34 34
 
35 35
 # check size
36
-if($_POST['rack_start']+($_POST['rack_size']-1)>$rack->size)            { $Result->show("danger", _("Invalid rack position (overflow)"), true); }
36
+if ($_POST['rack_start'] + ($_POST['rack_size'] - 1) > $rack->size) { $Result->show ("danger", _ ("Invalid rack position (overflow)"), true); }
37 37
 
38 38
 # set update values
39
-$values = array("id"=>@$_POST['deviceid'],
39
+$values = array ("id"=>@$_POST['deviceid'],
40 40
 				"rack"=>@$_POST['rackid'],
41 41
 				"rack_start"=>@$_POST['rack_start'],
42 42
 				"rack_size"=>@$_POST['rack_size'],
43 43
 				);
44 44
 
45 45
 # update rack
46
-if(!$Admin->object_modify("devices", "edit", "id", $values))	        { $Result->show("success", _("Failed to add device to rack").'!', false); }
47
-else																	{ $Result->show("success", _("Device added to rack").'!', false); }
46
+if (!$Admin->object_modify ("devices", "edit", "id", $values)) { $Result->show ("success", _ ("Failed to add device to rack").'!', false); }
47
+else { $Result->show ("success", _ ("Device added to rack").'!', false); }
48 48
 
49 49
 ?>
50 50
\ No newline at end of file
Please login to merge, or discard this patch.
app/admin/device-types/edit.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -5,36 +5,36 @@  discard block
 block discarded – undo
5 5
  ************************/
6 6
 
7 7
 /* functions */
8
-require( dirname(__FILE__) . '/../../../functions/functions.php');
8
+require(dirname (__FILE__).'/../../../functions/functions.php');
9 9
 
10 10
 # initialize user object
11
-$Database 	= new Database_PDO;
12
-$User 		= new User ($Database);
11
+$Database = new Database_PDO;
12
+$User = new User ($Database);
13 13
 $Admin	 	= new Admin ($Database);
14 14
 $Result 	= new Result ();
15 15
 
16 16
 # verify that user is logged in
17
-$User->check_user_session();
17
+$User->check_user_session ();
18 18
 
19 19
 # create csrf token
20 20
 $csrf = $User->csrf_cookie ("create", "device_types");
21 21
 
22 22
 # ID must be numeric
23
-if($_POST['action']!="add" && !is_numeric($_POST['tid'])) { $Result->show("danger", _("Invalid ID"), true, true); }
23
+if ($_POST['action'] != "add" && !is_numeric ($_POST['tid'])) { $Result->show ("danger", _ ("Invalid ID"), true, true); }
24 24
 # set delete flag
25
-$readonly = $_POST['action']=="delete" ? "readonly" : "";
25
+$readonly = $_POST['action'] == "delete" ? "readonly" : "";
26 26
 
27 27
 # fetch device type details
28
-if( ($_POST['action'] == "edit") || ($_POST['action'] == "delete") ) {
29
-	$device = $Admin->fetch_object("deviceTypes", "tid", $_POST['tid']);
28
+if (($_POST['action'] == "edit") || ($_POST['action'] == "delete")) {
29
+	$device = $Admin->fetch_object ("deviceTypes", "tid", $_POST['tid']);
30 30
 	# fail if false
31
-	$device===false ? $Result->show("danger", _("Invalid ID"), true) : null;
31
+	$device === false ? $Result->show ("danger", _ ("Invalid ID"), true) : null;
32 32
 }
33 33
 ?>
34 34
 
35 35
 
36 36
 <!-- header -->
37
-<div class="pHeader"><?php print ucwords(_("$_POST[action]")); ?> <?php print _('device type'); ?></div>
37
+<div class="pHeader"><?php print ucwords (_ ("$_POST[action]")); ?> <?php print _ ('device type'); ?></div>
38 38
 
39 39
 
40 40
 <!-- content -->
@@ -45,14 +45,14 @@  discard block
 block discarded – undo
45 45
 
46 46
 	<!-- hostname  -->
47 47
 	<tr>
48
-		<td><?php print _('Name'); ?></td>
48
+		<td><?php print _ ('Name'); ?></td>
49 49
 		<td>
50
-			<input type="text" name="tname" class="form-control input-sm" placeholder="<?php print _('Name'); ?>" value="<?php print @$device->tname; ?>" <?php print $readonly; ?>>
50
+			<input type="text" name="tname" class="form-control input-sm" placeholder="<?php print _ ('Name'); ?>" value="<?php print @$device->tname; ?>" <?php print $readonly; ?>>
51 51
 			<input type="hidden" name="action" value="<?php print $_POST['action']; ?>">
52 52
 			<input type="hidden" name="csrf_cookie" value="<?php print $csrf; ?>">
53 53
 			<?php
54
-			if( ($_POST['action'] == "edit") || ($_POST['action'] == "delete") ) {
55
-				print '<input type="hidden" name="tid" value="'. $_POST['tid'] .'">'. "\n";
54
+			if (($_POST['action'] == "edit") || ($_POST['action'] == "delete")) {
55
+				print '<input type="hidden" name="tid" value="'.$_POST['tid'].'">'."\n";
56 56
 			}
57 57
 			?>
58 58
 		</td>
@@ -60,9 +60,9 @@  discard block
 block discarded – undo
60 60
 
61 61
 	<!-- IP address -->
62 62
 	<tr>
63
-		<td><?php print _('Description'); ?></td>
63
+		<td><?php print _ ('Description'); ?></td>
64 64
 		<td>
65
-			<input type="text" name="tdescription" class="form-control input-sm" placeholder="<?php print _('Description'); ?>" value="<?php print @$device->tdescription; ?>" <?php print $readonly; ?>>
65
+			<input type="text" name="tdescription" class="form-control input-sm" placeholder="<?php print _ ('Description'); ?>" value="<?php print @$device->tdescription; ?>" <?php print $readonly; ?>>
66 66
 		</td>
67 67
 	</tr>
68 68
 
@@ -74,8 +74,8 @@  discard block
 block discarded – undo
74 74
 <!-- footer -->
75 75
 <div class="pFooter">
76 76
 	<div class="btn-group">
77
-		<button class="btn btn-sm btn-default hidePopups"><?php print _('Cancel'); ?></button>
78
-		<button class="btn btn-sm btn-default <?php if($_POST['action']=="delete") { print "btn-danger"; } else { print "btn-success"; } ?>" id="editDevTypeSubmit"><i class="fa <?php if($_POST['action']=="add") { print "fa-plus"; } else if ($_POST['action']=="delete") { print "fa-trash-o"; } else { print "fa-check"; } ?>"></i> <?php print ucwords(_($_POST['action'])); ?></button>
77
+		<button class="btn btn-sm btn-default hidePopups"><?php print _ ('Cancel'); ?></button>
78
+		<button class="btn btn-sm btn-default <?php if ($_POST['action'] == "delete") { print "btn-danger"; } else { print "btn-success"; } ?>" id="editDevTypeSubmit"><i class="fa <?php if ($_POST['action'] == "add") { print "fa-plus"; } else if ($_POST['action'] == "delete") { print "fa-trash-o"; } else { print "fa-check"; } ?>"></i> <?php print ucwords (_ ($_POST['action'])); ?></button>
79 79
 	</div>
80 80
 
81 81
 	<!-- result -->
Please login to merge, or discard this patch.
app/admin/device-types/edit-result.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -5,36 +5,36 @@
 block discarded – undo
5 5
  ***************************/
6 6
 
7 7
 /* functions */
8
-require( dirname(__FILE__) . '/../../../functions/functions.php');
8
+require(dirname (__FILE__).'/../../../functions/functions.php');
9 9
 
10 10
 # initialize user object
11
-$Database 	= new Database_PDO;
12
-$User 		= new User ($Database);
11
+$Database = new Database_PDO;
12
+$User = new User ($Database);
13 13
 $Admin	 	= new Admin ($Database);
14 14
 $Result 	= new Result ();
15 15
 
16 16
 # verify that user is logged in
17
-$User->check_user_session();
17
+$User->check_user_session ();
18 18
 
19 19
 # strip input tags
20
-$_POST = $Admin->strip_input_tags($_POST);
20
+$_POST = $Admin->strip_input_tags ($_POST);
21 21
 
22 22
 # validate csrf cookie
23
-$User->csrf_cookie ("validate", "device_types", $_POST['csrf_cookie']) === false ? $Result->show("danger", _("Invalid CSRF cookie"), true) : "";
23
+$User->csrf_cookie ("validate", "device_types", $_POST['csrf_cookie']) === false ? $Result->show ("danger", _ ("Invalid CSRF cookie"), true) : "";
24 24
 
25 25
 # ID must be numeric
26
-if($_POST['action']!="add" && !is_numeric($_POST['tid'])) 	{ $Result->show("danger", _("Invalid ID"), true); }
26
+if ($_POST['action'] != "add" && !is_numeric ($_POST['tid'])) { $Result->show ("danger", _ ("Invalid ID"), true); }
27 27
 
28 28
 # name must be present! */
29
-if($_POST['tname'] == "") 									{ $Result->show("danger", _('Name is mandatory').'!', false); }
29
+if ($_POST['tname'] == "") { $Result->show ("danger", _ ('Name is mandatory').'!', false); }
30 30
 
31 31
 # create array of values for modification
32
-$values = array("tid"=>@$_POST['tid'],
32
+$values = array ("tid"=>@$_POST['tid'],
33 33
 				"tname"=>$_POST['tname'],
34 34
 				"tdescription"=>@$_POST['tdescription']);
35 35
 
36 36
 # update
37
-if(!$Admin->object_modify("deviceTypes", $_POST['action'], "tid", $values)) 	{ $Result->show("danger",  _("Failed to $_POST[action] device type").'!', false); }
38
-else 																			{ $Result->show("success", _("Device type $_POST[action] successfull").'!', false); }
37
+if (!$Admin->object_modify ("deviceTypes", $_POST['action'], "tid", $values)) { $Result->show ("danger", _ ("Failed to $_POST[action] device type").'!', false); }
38
+else { $Result->show ("success", _ ("Device type $_POST[action] successfull").'!', false); }
39 39
 
40 40
 ?>
41 41
\ No newline at end of file
Please login to merge, or discard this patch.
app/admin/device-types/index.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -5,24 +5,24 @@  discard block
 block discarded – undo
5 5
  ***************************/
6 6
 
7 7
 # verify that user is logged in
8
-$User->check_user_session();
8
+$User->check_user_session ();
9 9
 
10 10
 # fetch all devices
11
-$devices = $Admin->fetch_all_objects("deviceTypes", "tid");
11
+$devices = $Admin->fetch_all_objects ("deviceTypes", "tid");
12 12
 ?>
13 13
 
14
-<h4><?php print _('Device type management'); ?></h4>
14
+<h4><?php print _ ('Device type management'); ?></h4>
15 15
 <hr>
16 16
 
17 17
 <div class="btn-group">
18
-	<a href="<?php print create_link("administration", "devices"); ?>" class="btn btn-sm btn-default"><i class='fa fa-angle-left'></i> <?php print _('Manage devices'); ?></a>
19
-	<button class='btn btn-sm btn-default editDevType' data-action='add'   data-tid='' style='margin-bottom:10px;'><i class='fa fa-plus'></i> <?php print _('Add device type'); ?></button>
18
+	<a href="<?php print create_link ("administration", "devices"); ?>" class="btn btn-sm btn-default"><i class='fa fa-angle-left'></i> <?php print _ ('Manage devices'); ?></a>
19
+	<button class='btn btn-sm btn-default editDevType' data-action='add'   data-tid='' style='margin-bottom:10px;'><i class='fa fa-plus'></i> <?php print _ ('Add device type'); ?></button>
20 20
 </div>
21 21
 
22 22
 <?php
23 23
 /* first check if they exist! */
24
-if(sizeof($devices) == 0) {
25
-	print '	<div class="alert alert-warn alert-absolute">'._('No devices configured').'!</div>'. "\n";
24
+if (sizeof ($devices) == 0) {
25
+	print '	<div class="alert alert-warn alert-absolute">'._ ('No devices configured').'!</div>'."\n";
26 26
 }
27 27
 /* Print them out */
28 28
 else {
@@ -31,8 +31,8 @@  discard block
 block discarded – undo
31 31
 
32 32
 	#headers
33 33
 	print '<tr>';
34
-	print '	<th>'._('Name').'</th>';
35
-	print '	<th>'._('Description').'</th>';
34
+	print '	<th>'._ ('Name').'</th>';
35
+	print '	<th>'._ ('Description').'</th>';
36 36
 	print '	<th class="actions"></th>';
37 37
 	print '</tr>';
38 38
 
@@ -41,19 +41,19 @@  discard block
 block discarded – undo
41 41
 		$type = (array) $type;
42 42
 
43 43
 		//print details
44
-		print '<tr>'. "\n";
44
+		print '<tr>'."\n";
45 45
 
46
-		print '	<td>'. _($type['tname']) .'</td>'. "\n";
47
-		print '	<td>'. _($type['tdescription']) .'</td>'. "\n";
46
+		print '	<td>'._ ($type['tname']).'</td>'."\n";
47
+		print '	<td>'._ ($type['tdescription']).'</td>'."\n";
48 48
 
49
-		print '	<td class="actions">'. "\n";
49
+		print '	<td class="actions">'."\n";
50 50
 		print "	<div class='btn-group'>";
51 51
 		print "		<button class='btn btn-xs btn-default editDevType' data-action='edit'   data-tid='$type[tid]'><i class='fa fa-pencil'></i></button>";
52 52
 		print "		<button class='btn btn-xs btn-default editDevType' data-action='delete' data-tid='$type[tid]'><i class='fa fa-times'></i></button>";
53 53
 		print "	</div>";
54
-		print '	</td>'. "\n";
54
+		print '	</td>'."\n";
55 55
 
56
-		print '</tr>'. "\n";
56
+		print '</tr>'."\n";
57 57
 
58 58
 	}
59 59
 	print '</table>';
Please login to merge, or discard this patch.
app/admin/ripe-import/import-subnets.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -6,52 +6,52 @@  discard block
 block discarded – undo
6 6
 
7 7
 
8 8
 /* functions */
9
-require( dirname(__FILE__) . '/../../../functions/functions.php');
9
+require(dirname (__FILE__).'/../../../functions/functions.php');
10 10
 
11 11
 # initialize user object
12
-$Database 	= new Database_PDO;
13
-$User 		= new User ($Database);
12
+$Database = new Database_PDO;
13
+$User = new User ($Database);
14 14
 $Admin	 	= new Admin ($Database);
15 15
 $Subnets	= new Subnets ($Database);
16 16
 $Result 	= new Result ();
17 17
 
18 18
 # verify that user is logged in
19
-$User->check_user_session();
19
+$User->check_user_session ();
20 20
 
21 21
 
22 22
 //get size of subnets - $_POST/4
23
-$size = sizeof($_POST) / 4;
23
+$size = sizeof ($_POST) / 4;
24 24
 
25 25
 //get unique keys for subnets because they are not sequential if deleted!!!
26
-foreach($_POST as $key=>$line) {
27
-	if (strlen(strstr($key,"subnet"))>0) {
26
+foreach ($_POST as $key=>$line) {
27
+	if (strlen (strstr ($key, "subnet")) > 0) {
28 28
 		$allSubnets[] = $key;
29 29
 	}
30 30
 }
31 31
 
32 32
 # format and verify each record
33
-foreach($allSubnets as $subnet) {
33
+foreach ($allSubnets as $subnet) {
34 34
 	//get sequential number
35
-	$m = str_replace("subnet-", "", $subnet);
35
+	$m = str_replace ("subnet-", "", $subnet);
36 36
 
37 37
 	//reformat subnet
38
-	$_temp = explode("/", $_POST['subnet-' . $m]);
38
+	$_temp = explode ("/", $_POST['subnet-'.$m]);
39 39
 
40 40
 	//set subnet details for importing
41
-	$subnet_import['subnet'] 	   = $Subnets->transform_to_decimal($_temp[0]);
41
+	$subnet_import['subnet'] = $Subnets->transform_to_decimal ($_temp[0]);
42 42
 	$subnet_import['mask'] 	   	   = $_temp[1];
43
-	$subnet_import['sectionId']    = $_POST['section-' . $m];
44
-	$subnet_import['description']  = $_POST['description-' . $m];
45
-	$subnet_import['vlanId'] 	   = $_POST['vlan-' . $m];
46
-	$subnet_import['vrfId'] 	   = $_POST['vrf-' . $m];
47
-	$subnet_import['showName']	   = $_POST['showName-' . $m];
43
+	$subnet_import['sectionId']    = $_POST['section-'.$m];
44
+	$subnet_import['description']  = $_POST['description-'.$m];
45
+	$subnet_import['vlanId'] = $_POST['vlan-'.$m];
46
+	$subnet_import['vrfId'] = $_POST['vrf-'.$m];
47
+	$subnet_import['showName'] = $_POST['showName-'.$m];
48 48
 
49 49
 	//cidr
50
-	if(strlen($err=$Subnets->verify_cidr($Subnets->transform_to_dotted($subnet_import['subnet'])."/".$subnet_import['mask']))>5) {
50
+	if (strlen ($err = $Subnets->verify_cidr ($Subnets->transform_to_dotted ($subnet_import['subnet'])."/".$subnet_import['mask'])) > 5) {
51 51
 		$errors[] = $err;
52 52
 	}
53 53
 	//overlapping, only root !
54
-	else if (strlen($err=$Subnets->verify_subnet_overlapping ($subnet_import['sectionId'], $Subnets->transform_to_dotted($subnet_import['subnet'])."/".$subnet_import['mask'], $subnet_import['vrfId']))>5) {
54
+	else if (strlen ($err = $Subnets->verify_subnet_overlapping ($subnet_import['sectionId'], $Subnets->transform_to_dotted ($subnet_import['subnet'])."/".$subnet_import['mask'], $subnet_import['vrfId'])) > 5) {
55 55
 		$errors[] = $err;
56 56
 	}
57 57
 	//set insert
@@ -62,8 +62,8 @@  discard block
 block discarded – undo
62 62
 
63 63
 
64 64
 # print errors if they exist or success
65
-if(isset($errors)) {
66
-	print '<div class="alert alert-danger alert-absolute">'._('Please fix the following errors before inserting').':<hr>'. "\n";
65
+if (isset($errors)) {
66
+	print '<div class="alert alert-danger alert-absolute">'._ ('Please fix the following errors before inserting').':<hr>'."\n";
67 67
 	foreach ($errors as $line) {
68 68
 		print $line.'<br>';
69 69
 	}
@@ -73,9 +73,9 @@  discard block
 block discarded – undo
73 73
 	$errors_import_failed = 0;
74 74
 
75 75
 	//insert if all other is ok!
76
-	foreach($subnets_to_insert as $subnet_import) {
76
+	foreach ($subnets_to_insert as $subnet_import) {
77 77
 		//formulate insert query
78
-		$values = array("sectionId"=>$subnet_import['sectionId'],
78
+		$values = array ("sectionId"=>$subnet_import['sectionId'],
79 79
 						"subnet"=>$subnet_import['subnet'],
80 80
 						"mask"=>$subnet_import['mask'],
81 81
 						"description"=>$subnet_import['description'],
@@ -85,12 +85,12 @@  discard block
 block discarded – undo
85 85
 						"showName"=>$subnet_import['showName']
86 86
 						);
87 87
 
88
-		if(!$Admin->object_modify("subnets", "add", "id", $values)) {
89
-			$Result->show("danger", _('Failed to import subnet').' '. $Subnets->transform_to_dotted($subnet_import['subnet'])."/".$subnet_import['mask'], false);
88
+		if (!$Admin->object_modify ("subnets", "add", "id", $values)) {
89
+			$Result->show ("danger", _ ('Failed to import subnet').' '.$Subnets->transform_to_dotted ($subnet_import['subnet'])."/".$subnet_import['mask'], false);
90 90
 			$errors_import_failed++;
91 91
 		}
92 92
 	}
93 93
 	//check if all is ok and print it!
94
-	if($errors_import_failed == 0) 	{ $Result->show("success", _("Import successfull")."!", false); }
94
+	if ($errors_import_failed == 0) { $Result->show ("success", _ ("Import successfull")."!", false); }
95 95
 }
96 96
 ?>
97 97
\ No newline at end of file
Please login to merge, or discard this patch.
app/admin/ripe-import/ripe-telnet.php 1 patch
Spacing   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -5,22 +5,22 @@  discard block
 block discarded – undo
5 5
  *************************************************/
6 6
 
7 7
 /* functions */
8
-require( dirname(__FILE__) . '/../../../functions/functions.php');
8
+require(dirname (__FILE__).'/../../../functions/functions.php');
9 9
 
10 10
 # initialize user object
11
-$Database 	= new Database_PDO;
12
-$User 		= new User ($Database);
11
+$Database = new Database_PDO;
12
+$User = new User ($Database);
13 13
 $Admin	 	= new Admin ($Database);
14 14
 $Subnets	= new Subnets ($Database);
15 15
 $Result 	= new Result ();
16 16
 
17 17
 # verify that user is logged in
18
-$User->check_user_session();
18
+$User->check_user_session ();
19 19
 
20 20
 
21 21
 //strip AS if provided, to get just the number
22
-if(substr($_POST['as'], 0,2)=="AS" || substr($_POST['as'], 0,2)=="as") {
23
-	$_POST['as'] = substr($_POST['as'], 2);
22
+if (substr ($_POST['as'], 0, 2) == "AS" || substr ($_POST['as'], 0, 2) == "as") {
23
+	$_POST['as'] = substr ($_POST['as'], 2);
24 24
 };
25 25
 
26 26
 
@@ -29,13 +29,13 @@  discard block
 block discarded – undo
29 29
 
30 30
 # fetch all sections
31 31
 $sections = $Admin->fetch_all_objects ("sections", "id");
32
-$vlans	  = $Admin->fetch_all_objects ("vlans", "vlanId");
33
-$vrfs	  = $Admin->fetch_all_objects ("vrf", "vrfId");
32
+$vlans = $Admin->fetch_all_objects ("vlans", "vlanId");
33
+$vrfs = $Admin->fetch_all_objects ("vrf", "vrfId");
34 34
 
35 35
 //none found
36
-if(sizeof(@$subnet) == 0) {
36
+if (sizeof (@$subnet) == 0) {
37 37
 	print "<hr>";
38
-	$Result->show("danger alert-absolute", _('No subnets found').'!', true);
38
+	$Result->show ("danger alert-absolute", _ ('No subnets found').'!', true);
39 39
 }
40 40
 else {
41 41
 	//form
@@ -44,17 +44,17 @@  discard block
 block discarded – undo
44 44
 	print '<table class="asImport table table-striped table-condensed table-top table-auto">';
45 45
 	//headers
46 46
 	print '<tr>';
47
-	print '	<th colspan="5">'._('I found the following routes belonging to AS').' '.$_POST['as'].':</th>';
47
+	print '	<th colspan="5">'._ ('I found the following routes belonging to AS').' '.$_POST['as'].':</th>';
48 48
 	print '</tr> ';
49 49
 
50 50
 	print "<tr>";
51 51
 	print "	<th></th>";
52
-	print "	<th>"._('Subnet')."</th>";
53
-	print "	<th>"._('select section')."</th>";
54
-	print "	<th>"._('Description')."</th>";
55
-	print "	<th>"._('VLAN')."</th>";
56
-	print "	<th>"._('VRF')."</th>";
57
-	print "	<th>"._('Show name')."</th>";
52
+	print "	<th>"._ ('Subnet')."</th>";
53
+	print "	<th>"._ ('select section')."</th>";
54
+	print "	<th>"._ ('Description')."</th>";
55
+	print "	<th>"._ ('VLAN')."</th>";
56
+	print "	<th>"._ ('VRF')."</th>";
57
+	print "	<th>"._ ('Show name')."</th>";
58 58
 
59 59
 	print "</tr>";
60 60
 
@@ -62,72 +62,72 @@  discard block
 block discarded – undo
62 62
 	$m = 0;
63 63
 	foreach ($subnet as $route) {
64 64
 		# only not empty
65
-		if(strlen($route)>2) {
66
-			print '<tr>'. "\n";
65
+		if (strlen ($route) > 2) {
66
+			print '<tr>'."\n";
67 67
 
68 68
 			//delete
69
-			print '<td class="removeSubnet">'. "\n";
70
-			print '	<button class="btn btn-xs btn-default btn-danger" rel="tooltip" title="'._('Remove this subnet').'"><i class="fa fa-times"></i></button>'. "\n";
71
-			print '</td>'. "\n";
69
+			print '<td class="removeSubnet">'."\n";
70
+			print '	<button class="btn btn-xs btn-default btn-danger" rel="tooltip" title="'._ ('Remove this subnet').'"><i class="fa fa-times"></i></button>'."\n";
71
+			print '</td>'."\n";
72 72
 			//subnet
73
-			print '<td>'. "\n";
74
-			print '<input type="text" class="form-control input-sm" name="subnet-'. $m .'" value="'. $route .'">'. "\n";
75
-			print '</td>'. "\n";
73
+			print '<td>'."\n";
74
+			print '<input type="text" class="form-control input-sm" name="subnet-'.$m.'" value="'.$route.'">'."\n";
75
+			print '</td>'."\n";
76 76
 			//section
77
-			print '<td>'. "\n";
78
-			print '<select name="section-'. $m .'" class="form-control input-sm input-w-auto">'. "\n";
79
-			foreach($sections as $section) {
80
-				print '<option value="'. $section->id .'">'. $section->name .'</option>';
77
+			print '<td>'."\n";
78
+			print '<select name="section-'.$m.'" class="form-control input-sm input-w-auto">'."\n";
79
+			foreach ($sections as $section) {
80
+				print '<option value="'.$section->id.'">'.$section->name.'</option>';
81 81
 			}
82
-			print '</select>'. "\n";
83
-			print '</td>'. "\n";
82
+			print '</select>'."\n";
83
+			print '</td>'."\n";
84 84
 			//description
85
-			print '<td>'. "\n";
86
-			print '<input type="text" class="form-control input-sm input-w-250" name="description-'. $m .'">'. "\n";
87
-			print '</td>'. "\n";
85
+			print '<td>'."\n";
86
+			print '<input type="text" class="form-control input-sm input-w-250" name="description-'.$m.'">'."\n";
87
+			print '</td>'."\n";
88 88
 			//VLAN
89
-			print '<td>'. "\n";
90
-			print '<select name="vlan-'. $m .'" class="form-control input-sm input-w-auto">'. "\n";
89
+			print '<td>'."\n";
90
+			print '<select name="vlan-'.$m.'" class="form-control input-sm input-w-auto">'."\n";
91 91
 			print '<option value="0">No VLAN</option>';
92
-			if(sizeof(@$vlans)>0) {
93
-				foreach($vlans as $vlan) {
92
+			if (sizeof (@$vlans) > 0) {
93
+				foreach ($vlans as $vlan) {
94 94
 					# set description
95
-					$vlan_description = strlen($vlan->description)>0 ? " (".$vlan->description.")" : "";
95
+					$vlan_description = strlen ($vlan->description) > 0 ? " (".$vlan->description.")" : "";
96 96
 					print '<option value="'.$vlan->vlanId.'">'.$vlan->number.$vlan_description.'</option>';
97 97
 				}
98 98
 			}
99 99
 			//VRF
100
-			print '<td>'. "\n";
101
-			print '<select name="vrf-'. $m .'" class="form-control input-sm input-w-auto">'. "\n";
100
+			print '<td>'."\n";
101
+			print '<select name="vrf-'.$m.'" class="form-control input-sm input-w-auto">'."\n";
102 102
 			print '<option value="0">No VRF</option>';
103
-			if(sizeof(@$vrfs)>0) {
104
-				foreach($vrfs as $vrf) {
103
+			if (sizeof (@$vrfs) > 0) {
104
+				foreach ($vrfs as $vrf) {
105 105
 					# set description
106
-					$vrf_description = strlen($vrf->description)>0 ? " (".$vrf->description.")" : "";
106
+					$vrf_description = strlen ($vrf->description) > 0 ? " (".$vrf->description.")" : "";
107 107
 					print '<option value="'.$vrf->vrfId.'">'.$vrf->name.$vrf_description.'</option>';
108 108
 				}
109 109
 			}
110 110
 			//show name
111
-			print '<td>'. "\n";
112
-			print '<select name="showName-'. $m .'" class="form-control input-sm input-w-auto">'. "\n";
113
-			print '<option value="0">'._('No') .'</option>';
114
-			print '<option value="1">'._('Yes').'</option>';
115
-			print '</td>'. "\n";
111
+			print '<td>'."\n";
112
+			print '<select name="showName-'.$m.'" class="form-control input-sm input-w-auto">'."\n";
113
+			print '<option value="0">'._ ('No').'</option>';
114
+			print '<option value="1">'._ ('Yes').'</option>';
115
+			print '</td>'."\n";
116 116
 
117
-			print '</tr>'. "\n";
117
+			print '</tr>'."\n";
118 118
 		}
119 119
 		$m++;
120 120
 	}
121 121
 
122 122
 	//submit
123
-	print '<tr style="border-top:1px solid white" class="th">'. "\n";
124
-	print '<td colspan="7" style="text-align:right">'. "\n";
125
-	print '	<input type="submit" class="btn btn-sm btn-default" value="'._('Import to database').'">'. "\n";
126
-	print '</td>'. "\n";
127
-	print '</tr>'. "\n";
128
-
129
-	print '</table>'. "\n";
130
-	print '</form>'. "\n";
123
+	print '<tr style="border-top:1px solid white" class="th">'."\n";
124
+	print '<td colspan="7" style="text-align:right">'."\n";
125
+	print '	<input type="submit" class="btn btn-sm btn-default" value="'._ ('Import to database').'">'."\n";
126
+	print '</td>'."\n";
127
+	print '</tr>'."\n";
128
+
129
+	print '</table>'."\n";
130
+	print '</form>'."\n";
131 131
 }
132 132
 ?>
133 133
 <div class="ripeImportResult"></div>
134 134
\ No newline at end of file
Please login to merge, or discard this patch.