Completed
Pull Request — master (#532)
06:37
created
app/admin/vrfs/edit-result.php 2 patches
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -32,11 +32,11 @@  discard block
 block discarded – undo
32 32
 
33 33
 // set sections
34 34
 foreach($_POST as $key=>$line) {
35
-	if (strlen(strstr($key,"section-"))>0) {
36
-		$key2 = str_replace("section-", "", $key);
37
-		$temp[] = $key2;
38
-		unset($_POST[$key]);
39
-	}
35
+    if (strlen(strstr($key,"section-"))>0) {
36
+        $key2 = str_replace("section-", "", $key);
37
+        $temp[] = $key2;
38
+        unset($_POST[$key]);
39
+    }
40 40
 }
41 41
 # glue sections together
42 42
 $_POST['sections'] = sizeof($temp)>0 ? implode(";", $temp) : null;
@@ -45,18 +45,18 @@  discard block
 block discarded – undo
45 45
 
46 46
 # set update array
47 47
 $values = array("vrfId"=>@$_POST['vrfId'],
48
-				"name"=>$_POST['name'],
49
-				"rd"=>$_POST['rd'],
50
-				"sections"=>$_POST['sections'],
51
-				"description"=>$_POST['description']
52
-				);
48
+                "name"=>$_POST['name'],
49
+                "rd"=>$_POST['rd'],
50
+                "sections"=>$_POST['sections'],
51
+                "description"=>$_POST['description']
52
+                );
53 53
 # append custom
54 54
 if(sizeof($custom) > 0) {
55
-	foreach($custom as $myField) {
56
-		# replace possible ___ back to spaces!
57
-		$myField['nameTest']      = str_replace(" ", "___", $myField['name']);
58
-		if(isset($_POST[$myField['nameTest']])) { $values[$myField['name']] = @$_POST[$myField['nameTest']];}
59
-	}
55
+    foreach($custom as $myField) {
56
+        # replace possible ___ back to spaces!
57
+        $myField['nameTest']      = str_replace(" ", "___", $myField['name']);
58
+        if(isset($_POST[$myField['nameTest']])) { $values[$myField['name']] = @$_POST[$myField['nameTest']];}
59
+    }
60 60
 }
61 61
 
62 62
 # update
Please login to merge, or discard this patch.
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -5,65 +5,65 @@
 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 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
 # strip input tags
21
-$_POST = $Admin->strip_input_tags($_POST);
21
+$_POST = $Admin->strip_input_tags ($_POST);
22 22
 
23 23
 # validate csrf cookie
24
-$User->csrf_cookie ("validate", "vrf", $_POST['csrf_cookie']) === false ? $Result->show("danger", _("Invalid CSRF cookie"), true) : "";
24
+$User->csrf_cookie ("validate", "vrf", $_POST['csrf_cookie']) === false ? $Result->show ("danger", _ ("Invalid CSRF cookie"), true) : "";
25 25
 
26 26
 # fetch custom fields
27
-$custom = $Tools->fetch_custom_fields('vrf');
27
+$custom = $Tools->fetch_custom_fields ('vrf');
28 28
 
29 29
 
30 30
 # Hostname must be present!
31
-if($_POST['name'] == "") { $Result->show("danger", _("Name is mandatory"), true); }
31
+if ($_POST['name'] == "") { $Result->show ("danger", _ ("Name is mandatory"), true); }
32 32
 
33 33
 // set sections
34
-foreach($_POST as $key=>$line) {
35
-	if (strlen(strstr($key,"section-"))>0) {
36
-		$key2 = str_replace("section-", "", $key);
34
+foreach ($_POST as $key=>$line) {
35
+	if (strlen (strstr ($key, "section-")) > 0) {
36
+		$key2 = str_replace ("section-", "", $key);
37 37
 		$temp[] = $key2;
38 38
 		unset($_POST[$key]);
39 39
 	}
40 40
 }
41 41
 # glue sections together
42
-$_POST['sections'] = sizeof($temp)>0 ? implode(";", $temp) : null;
42
+$_POST['sections'] = sizeof ($temp) > 0 ? implode (";", $temp) : null;
43 43
 
44 44
 
45 45
 
46 46
 # set update array
47
-$values = array("vrfId"=>@$_POST['vrfId'],
47
+$values = array ("vrfId"=>@$_POST['vrfId'],
48 48
 				"name"=>$_POST['name'],
49 49
 				"rd"=>$_POST['rd'],
50 50
 				"sections"=>$_POST['sections'],
51 51
 				"description"=>$_POST['description']
52 52
 				);
53 53
 # append custom
54
-if(sizeof($custom) > 0) {
55
-	foreach($custom as $myField) {
54
+if (sizeof ($custom) > 0) {
55
+	foreach ($custom as $myField) {
56 56
 		# replace possible ___ back to spaces!
57
-		$myField['nameTest']      = str_replace(" ", "___", $myField['name']);
58
-		if(isset($_POST[$myField['nameTest']])) { $values[$myField['name']] = @$_POST[$myField['nameTest']];}
57
+		$myField['nameTest'] = str_replace (" ", "___", $myField['name']);
58
+		if (isset($_POST[$myField['nameTest']])) { $values[$myField['name']] = @$_POST[$myField['nameTest']]; }
59 59
 	}
60 60
 }
61 61
 
62 62
 # update
63
-if(!$Admin->object_modify("vrf", $_POST['action'], "vrfId", $values))	{ $Result->show("danger",  _("Failed to $_POST[action] VRF").'!', true); }
64
-else																	{ $Result->show("success", _("VRF $_POST[action] successfull").'!', false); }
63
+if (!$Admin->object_modify ("vrf", $_POST['action'], "vrfId", $values)) { $Result->show ("danger", _ ("Failed to $_POST[action] VRF").'!', true); }
64
+else { $Result->show ("success", _ ("VRF $_POST[action] successfull").'!', false); }
65 65
 
66 66
 
67 67
 # remove all references if delete
68
-if($_POST['action']=="delete") { $Admin->remove_object_references ("subnets", "vrfId", $_POST['vrfId']); }
68
+if ($_POST['action'] == "delete") { $Admin->remove_object_references ("subnets", "vrfId", $_POST['vrfId']); }
69 69
 ?>
Please login to merge, or discard this patch.
app/admin/vrfs/edit.php 3 patches
Braces   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -203,7 +203,10 @@
 block discarded – undo
203 203
 <div class="pFooter">
204 204
 	<div class="btn-group">
205 205
 		<button class="btn btn-sm btn-default hidePopups"><?php print _('Cancel'); ?></button>
206
-		<button class="btn btn-sm btn-default <?php if($_POST['action']=="delete") { print "btn-danger"; } else { print "btn-success"; } ?>" id="editVRF"><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>
206
+		<button class="btn btn-sm btn-default <?php if($_POST['action']=="delete") { print "btn-danger"; }
207
+else { print "btn-success"; } ?>" id="editVRF"><i class="fa <?php if($_POST['action']=="add") { print "fa-plus"; }
208
+else if ($_POST['action']=="delete") { print "fa-trash-o"; }
209
+else { print "fa-check"; } ?>"></i> <?php print ucwords(_($_POST['action'])); ?></button>
207 210
 	</div>
208 211
 	<!-- result -->
209 212
 	<div class="vrfManagementEditResult"></div>
Please login to merge, or discard this patch.
Indentation   +111 added lines, -111 removed lines patch added patch discarded remove patch
@@ -23,9 +23,9 @@  discard block
 block discarded – undo
23 23
 
24 24
 # get VRF
25 25
 if($_POST['action']!="add") {
26
-	$vrf = $Admin->fetch_object ("vrf", "vrfId", $_POST['vrfId']);
27
-	$vrf!==false ? : $Result->show("danger", _("Invalid ID"), true, true);
28
-	$vrf = (array) $vrf;
26
+    $vrf = $Admin->fetch_object ("vrf", "vrfId", $_POST['vrfId']);
27
+    $vrf!==false ? : $Result->show("danger", _("Invalid ID"), true, true);
28
+    $vrf = (array) $vrf;
29 29
 }
30 30
 
31 31
 # disable edit on delete
@@ -64,8 +64,8 @@  discard block
 block discarded – undo
64 64
 		<td><?php print _('Description'); ?></td>
65 65
 		<td>
66 66
 			<?php
67
-			if( ($_POST['action'] == "edit") || ($_POST['action'] == "delete") ) { print '<input type="hidden" name="vrfId" value="'. $_POST['vrfId'] .'">'. "\n";}
68
-			?>
67
+            if( ($_POST['action'] == "edit") || ($_POST['action'] == "delete") ) { print '<input type="hidden" name="vrfId" value="'. $_POST['vrfId'] .'">'. "\n";}
68
+            ?>
69 69
 			<input type="hidden" name="action" value="<?php print $_POST['action']; ?>">
70 70
 			<input type="hidden" name="csrf_cookie" value="<?php print $csrf; ?>">
71 71
 			<input type="text" class="description form-control input-sm" name="description" placeholder="<?php print _('Description'); ?>" value="<?php print @$vrf['description']; ?>" <?php print $readonly; ?>>
@@ -79,123 +79,123 @@  discard block
 block discarded – undo
79 79
 		<td style="vertical-align: top !important"><?php print _('Sections'); ?>:</td>
80 80
 		<td>
81 81
 		<?php
82
-		# select sections
83
-		$sections = $Sections->fetch_all_sections();
84
-		# reformat domains sections to array
85
-		$vrf_sections = explode(";", @$vrf['sections']);
86
-		$vrf_sections = is_array($vrf_sections) ? $vrf_sections : array();
87
-		// loop
88
-		if($sections!==false) {
89
-			foreach($sections as $section) {
90
-				if(in_array($section->id, @$vrf_sections)) 	{ print '<div class="checkbox" style="margin:0px;"><input type="checkbox" name="section-'. $section->id .'" value="on" checked> '. $section->name .'</div>'. "\n"; }
91
-				else 										{ print '<div class="checkbox" style="margin:0px;"><input type="checkbox" name="section-'. $section->id .'" value="on">'. $section->name .'</span></div>'. "\n"; }
92
-			}
93
-		}
94
-		?>
82
+        # select sections
83
+        $sections = $Sections->fetch_all_sections();
84
+        # reformat domains sections to array
85
+        $vrf_sections = explode(";", @$vrf['sections']);
86
+        $vrf_sections = is_array($vrf_sections) ? $vrf_sections : array();
87
+        // loop
88
+        if($sections!==false) {
89
+            foreach($sections as $section) {
90
+                if(in_array($section->id, @$vrf_sections)) 	{ print '<div class="checkbox" style="margin:0px;"><input type="checkbox" name="section-'. $section->id .'" value="on" checked> '. $section->name .'</div>'. "\n"; }
91
+                else 										{ print '<div class="checkbox" style="margin:0px;"><input type="checkbox" name="section-'. $section->id .'" value="on">'. $section->name .'</span></div>'. "\n"; }
92
+            }
93
+        }
94
+        ?>
95 95
 		</td>
96 96
 	</tr>
97 97
 
98 98
 	<!-- Custom -->
99 99
 	<?php
100
-	if(sizeof($custom) > 0) {
101
-
102
-		print '<tr>';
103
-		print '	<td colspan="2"><hr></td>';
104
-		print '</tr>';
105
-
106
-		foreach($custom as $field) {
107
-
108
-			# replace spaces
109
-		    $field['nameNew'] = str_replace(" ", "___", $field['name']);
110
-
111
-			# required
112
-			if($field['Null']=="NO")	{ $required = "*"; }
113
-			else						{ $required = ""; }
114
-
115
-			# set default value !
116
-			if ($_POST['action']=="add")	{ $vrf[$field['name']] = $field['Default']; }
117
-
118
-			print '<tr>'. "\n";
119
-			print '	<td>'. $field['name'] .' '.$required.'</td>'. "\n";
120
-			print '	<td>'. "\n";
121
-
122
-			//set type
123
-			if(substr($field['type'], 0,3) == "set" || substr($field['type'], 0,4) == "enum") {
124
-				//parse values
125
-				$tmp = substr($field['type'], 0,3)=="set" ? explode(",", str_replace(array("set(", ")", "'"), "", $field['type'])) : explode(",", str_replace(array("enum(", ")", "'"), "", $field['type']));
126
-				//null
127
-				if($field['Null']!="NO") { array_unshift($tmp, ""); }
128
-
129
-				print "<select name='$field[nameNew]' class='form-control input-sm input-w-auto' rel='tooltip' data-placement='right' title='$field[Comment]'>";
130
-				foreach($tmp as $v) {
131
-					if($v==$vrf[$field['name']])	{ print "<option value='$v' selected='selected'>$v</option>"; }
132
-					else								{ print "<option value='$v'>$v</option>"; }
133
-				}
134
-				print "</select>";
135
-			}
136
-			//date and time picker
137
-			elseif($field['type'] == "date" || $field['type'] == "datetime") {
138
-				// just for first
139
-				if($timeP==0) {
140
-					print '<link rel="stylesheet" type="text/css" href="css/1.2/bootstrap/bootstrap-datetimepicker.min.css">';
141
-					print '<script type="text/javascript" src="js/1.2/bootstrap-datetimepicker.min.js"></script>';
142
-					print '<script type="text/javascript">';
143
-					print '$(document).ready(function() {';
144
-					//date only
145
-					print '	$(".datepicker").datetimepicker( {pickDate: true, pickTime: false, pickSeconds: false });';
146
-					//date + time
147
-					print '	$(".datetimepicker").datetimepicker( { pickDate: true, pickTime: true } );';
148
-
149
-					print '})';
150
-					print '</script>';
151
-				}
152
-				$timeP++;
153
-
154
-				//set size
155
-				if($field['type'] == "date")	{ $size = 10; $class='datepicker';		$format = "yyyy-MM-dd"; }
156
-				else							{ $size = 19; $class='datetimepicker';	$format = "yyyy-MM-dd"; }
157
-
158
-				//field
159
-				if(!isset($vrf[$field['name']]))	{ print ' <input type="text" class="'.$class.' form-control input-sm input-w-auto" data-format="'.$format.'" name="'. $field['nameNew'] .'" maxlength="'.$size.'" '.$readonly.' rel="tooltip" data-placement="right" title="'.$field['Comment'].'">'. "\n"; }
160
-				else								{ print ' <input type="text" class="'.$class.' form-control input-sm input-w-auto" data-format="'.$format.'" name="'. $field['nameNew'] .'" maxlength="'.$size.'" value="'. $vrf[$field['name']]. '" '.$readonly.' rel="tooltip" data-placement="right" title="'.$field['Comment'].'">'. "\n"; }
161
-			}
162
-			//boolean
163
-			elseif($field['type'] == "tinyint(1)") {
164
-				print "<select name='$field[nameNew]' class='form-control input-sm input-w-auto' rel='tooltip' data-placement='right' title='$field[Comment]'>";
165
-				$tmp = array(0=>"No",1=>"Yes");
166
-				//null
167
-				if($field['Null']!="NO") { $tmp[2] = ""; }
168
-
169
-				foreach($tmp as $k=>$v) {
170
-					if(strlen($vrf[$field['name']])==0 && $k==2)	{ print "<option value='$k' selected='selected'>"._($v)."</option>"; }
171
-					elseif($k==$vrf[$field['name']])				{ print "<option value='$k' selected='selected'>"._($v)."</option>"; }
172
-					else												{ print "<option value='$k'>"._($v)."</option>"; }
173
-				}
174
-				print "</select>";
175
-			}
176
-			//text
177
-			elseif($field['type'] == "text") {
178
-				print ' <textarea class="form-control input-sm" name="'. $field['nameNew'] .'" placeholder="'. $field['name'] .'" '.$readonly.' rowspan=3 rel="tooltip" data-placement="right" title="'.$field['Comment'].'">'. $vrf[$field['name']]. '</textarea>'. "\n";
179
-			}
180
-			//default - input field
181
-			else {
182
-				print ' <input type="text" class="ip_addr form-control input-sm" name="'. $field['nameNew'] .'" placeholder="'. $field['name'] .'" value="'. @$vrf[$field['name']]. '" size="30" '.$readonly.' rel="tooltip" data-placement="right" title="'.$field['Comment'].'">'. "\n";
183
-			}
184
-
185
-			print '	</td>'. "\n";
186
-			print '</tr>'. "\n";
187
-		}
188
-	}
189
-	?>
100
+    if(sizeof($custom) > 0) {
101
+
102
+        print '<tr>';
103
+        print '	<td colspan="2"><hr></td>';
104
+        print '</tr>';
105
+
106
+        foreach($custom as $field) {
107
+
108
+            # replace spaces
109
+            $field['nameNew'] = str_replace(" ", "___", $field['name']);
110
+
111
+            # required
112
+            if($field['Null']=="NO")	{ $required = "*"; }
113
+            else						{ $required = ""; }
114
+
115
+            # set default value !
116
+            if ($_POST['action']=="add")	{ $vrf[$field['name']] = $field['Default']; }
117
+
118
+            print '<tr>'. "\n";
119
+            print '	<td>'. $field['name'] .' '.$required.'</td>'. "\n";
120
+            print '	<td>'. "\n";
121
+
122
+            //set type
123
+            if(substr($field['type'], 0,3) == "set" || substr($field['type'], 0,4) == "enum") {
124
+                //parse values
125
+                $tmp = substr($field['type'], 0,3)=="set" ? explode(",", str_replace(array("set(", ")", "'"), "", $field['type'])) : explode(",", str_replace(array("enum(", ")", "'"), "", $field['type']));
126
+                //null
127
+                if($field['Null']!="NO") { array_unshift($tmp, ""); }
128
+
129
+                print "<select name='$field[nameNew]' class='form-control input-sm input-w-auto' rel='tooltip' data-placement='right' title='$field[Comment]'>";
130
+                foreach($tmp as $v) {
131
+                    if($v==$vrf[$field['name']])	{ print "<option value='$v' selected='selected'>$v</option>"; }
132
+                    else								{ print "<option value='$v'>$v</option>"; }
133
+                }
134
+                print "</select>";
135
+            }
136
+            //date and time picker
137
+            elseif($field['type'] == "date" || $field['type'] == "datetime") {
138
+                // just for first
139
+                if($timeP==0) {
140
+                    print '<link rel="stylesheet" type="text/css" href="css/1.2/bootstrap/bootstrap-datetimepicker.min.css">';
141
+                    print '<script type="text/javascript" src="js/1.2/bootstrap-datetimepicker.min.js"></script>';
142
+                    print '<script type="text/javascript">';
143
+                    print '$(document).ready(function() {';
144
+                    //date only
145
+                    print '	$(".datepicker").datetimepicker( {pickDate: true, pickTime: false, pickSeconds: false });';
146
+                    //date + time
147
+                    print '	$(".datetimepicker").datetimepicker( { pickDate: true, pickTime: true } );';
148
+
149
+                    print '})';
150
+                    print '</script>';
151
+                }
152
+                $timeP++;
153
+
154
+                //set size
155
+                if($field['type'] == "date")	{ $size = 10; $class='datepicker';		$format = "yyyy-MM-dd"; }
156
+                else							{ $size = 19; $class='datetimepicker';	$format = "yyyy-MM-dd"; }
157
+
158
+                //field
159
+                if(!isset($vrf[$field['name']]))	{ print ' <input type="text" class="'.$class.' form-control input-sm input-w-auto" data-format="'.$format.'" name="'. $field['nameNew'] .'" maxlength="'.$size.'" '.$readonly.' rel="tooltip" data-placement="right" title="'.$field['Comment'].'">'. "\n"; }
160
+                else								{ print ' <input type="text" class="'.$class.' form-control input-sm input-w-auto" data-format="'.$format.'" name="'. $field['nameNew'] .'" maxlength="'.$size.'" value="'. $vrf[$field['name']]. '" '.$readonly.' rel="tooltip" data-placement="right" title="'.$field['Comment'].'">'. "\n"; }
161
+            }
162
+            //boolean
163
+            elseif($field['type'] == "tinyint(1)") {
164
+                print "<select name='$field[nameNew]' class='form-control input-sm input-w-auto' rel='tooltip' data-placement='right' title='$field[Comment]'>";
165
+                $tmp = array(0=>"No",1=>"Yes");
166
+                //null
167
+                if($field['Null']!="NO") { $tmp[2] = ""; }
168
+
169
+                foreach($tmp as $k=>$v) {
170
+                    if(strlen($vrf[$field['name']])==0 && $k==2)	{ print "<option value='$k' selected='selected'>"._($v)."</option>"; }
171
+                    elseif($k==$vrf[$field['name']])				{ print "<option value='$k' selected='selected'>"._($v)."</option>"; }
172
+                    else												{ print "<option value='$k'>"._($v)."</option>"; }
173
+                }
174
+                print "</select>";
175
+            }
176
+            //text
177
+            elseif($field['type'] == "text") {
178
+                print ' <textarea class="form-control input-sm" name="'. $field['nameNew'] .'" placeholder="'. $field['name'] .'" '.$readonly.' rowspan=3 rel="tooltip" data-placement="right" title="'.$field['Comment'].'">'. $vrf[$field['name']]. '</textarea>'. "\n";
179
+            }
180
+            //default - input field
181
+            else {
182
+                print ' <input type="text" class="ip_addr form-control input-sm" name="'. $field['nameNew'] .'" placeholder="'. $field['name'] .'" value="'. @$vrf[$field['name']]. '" size="30" '.$readonly.' rel="tooltip" data-placement="right" title="'.$field['Comment'].'">'. "\n";
183
+            }
184
+
185
+            print '	</td>'. "\n";
186
+            print '</tr>'. "\n";
187
+        }
188
+    }
189
+    ?>
190 190
 
191 191
 
192 192
 	</table>
193 193
 	</form>
194 194
 
195 195
 	<?php
196
-	//print delete warning
197
-	if($_POST['action'] == "delete")	{ $Result->show("warning", "<strong>"._('Warning').":</strong> "._("removing VRF will also remove VRF reference from belonging subnets!"), false);}
198
-	?>
196
+    //print delete warning
197
+    if($_POST['action'] == "delete")	{ $Result->show("warning", "<strong>"._('Warning').":</strong> "._("removing VRF will also remove VRF reference from belonging subnets!"), false);}
198
+    ?>
199 199
 </div>
200 200
 
201 201
 
Please login to merge, or discard this patch.
Spacing   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -5,39 +5,39 @@  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
-$Sections	= new Sections ($Database);
15
+$Sections = new Sections ($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", "vrf");
23 23
 
24 24
 # get VRF
25
-if($_POST['action']!="add") {
25
+if ($_POST['action'] != "add") {
26 26
 	$vrf = $Admin->fetch_object ("vrf", "vrfId", $_POST['vrfId']);
27
-	$vrf!==false ? : $Result->show("danger", _("Invalid ID"), true, true);
27
+	$vrf !== false ? : $Result->show ("danger", _ ("Invalid ID"), true, true);
28 28
 	$vrf = (array) $vrf;
29 29
 }
30 30
 
31 31
 # disable edit on delete
32
-$readonly = $_POST['action']=="delete" ? "readonly" : "";
32
+$readonly = $_POST['action'] == "delete" ? "readonly" : "";
33 33
 
34 34
 # fetch custom fields
35
-$custom = $Tools->fetch_custom_fields('vrf');
35
+$custom = $Tools->fetch_custom_fields ('vrf');
36 36
 ?>
37 37
 
38 38
 
39 39
 <!-- header -->
40
-<div class="pHeader"><?php print ucwords(_("$_POST[action]")); ?> <?php print _('VRF'); ?></div>
40
+<div class="pHeader"><?php print ucwords (_ ("$_POST[action]")); ?> <?php print _ ('VRF'); ?></div>
41 41
 
42 42
 <!-- content -->
43 43
 <div class="pContent">
@@ -47,28 +47,28 @@  discard block
 block discarded – undo
47 47
 
48 48
 	<!-- name  -->
49 49
 	<tr>
50
-		<td><?php print _('Name'); ?></td>
50
+		<td><?php print _ ('Name'); ?></td>
51 51
 		<td>
52
-			<input type="text" class="name form-control input-sm" name="name" placeholder="<?php print _('VRF name'); ?>" value="<?php print @$vrf['name']; ?>" <?php print $readonly; ?>>
52
+			<input type="text" class="name form-control input-sm" name="name" placeholder="<?php print _ ('VRF name'); ?>" value="<?php print @$vrf['name']; ?>" <?php print $readonly; ?>>
53 53
 		</td>
54 54
 	</tr>
55 55
 	<!-- RD -->
56 56
 	<tr>
57
-		<td><?php print _('RD'); ?></td>
57
+		<td><?php print _ ('RD'); ?></td>
58 58
 		<td>
59
-			<input type="text" class="rd form-control input-sm" name="rd" placeholder="<?php print _('Route distinguisher'); ?>" value="<?php print @$vrf['rd']; ?>" <?php print $readonly; ?>>
59
+			<input type="text" class="rd form-control input-sm" name="rd" placeholder="<?php print _ ('Route distinguisher'); ?>" value="<?php print @$vrf['rd']; ?>" <?php print $readonly; ?>>
60 60
 		</td>
61 61
 	</tr>
62 62
 	<!-- Description -->
63 63
 	<tr>
64
-		<td><?php print _('Description'); ?></td>
64
+		<td><?php print _ ('Description'); ?></td>
65 65
 		<td>
66 66
 			<?php
67
-			if( ($_POST['action'] == "edit") || ($_POST['action'] == "delete") ) { print '<input type="hidden" name="vrfId" value="'. $_POST['vrfId'] .'">'. "\n";}
67
+			if (($_POST['action'] == "edit") || ($_POST['action'] == "delete")) { print '<input type="hidden" name="vrfId" value="'.$_POST['vrfId'].'">'."\n"; }
68 68
 			?>
69 69
 			<input type="hidden" name="action" value="<?php print $_POST['action']; ?>">
70 70
 			<input type="hidden" name="csrf_cookie" value="<?php print $csrf; ?>">
71
-			<input type="text" class="description form-control input-sm" name="description" placeholder="<?php print _('Description'); ?>" value="<?php print @$vrf['description']; ?>" <?php print $readonly; ?>>
71
+			<input type="text" class="description form-control input-sm" name="description" placeholder="<?php print _ ('Description'); ?>" value="<?php print @$vrf['description']; ?>" <?php print $readonly; ?>>
72 72
 		</td>
73 73
 	</tr>
74 74
 	<tr>
@@ -76,19 +76,19 @@  discard block
 block discarded – undo
76 76
 	</tr>
77 77
 	<!-- sections -->
78 78
 	<tr>
79
-		<td style="vertical-align: top !important"><?php print _('Sections'); ?>:</td>
79
+		<td style="vertical-align: top !important"><?php print _ ('Sections'); ?>:</td>
80 80
 		<td>
81 81
 		<?php
82 82
 		# select sections
83
-		$sections = $Sections->fetch_all_sections();
83
+		$sections = $Sections->fetch_all_sections ();
84 84
 		# reformat domains sections to array
85
-		$vrf_sections = explode(";", @$vrf['sections']);
86
-		$vrf_sections = is_array($vrf_sections) ? $vrf_sections : array();
85
+		$vrf_sections = explode (";", @$vrf['sections']);
86
+		$vrf_sections = is_array ($vrf_sections) ? $vrf_sections : array ();
87 87
 		// loop
88
-		if($sections!==false) {
89
-			foreach($sections as $section) {
90
-				if(in_array($section->id, @$vrf_sections)) 	{ print '<div class="checkbox" style="margin:0px;"><input type="checkbox" name="section-'. $section->id .'" value="on" checked> '. $section->name .'</div>'. "\n"; }
91
-				else 										{ print '<div class="checkbox" style="margin:0px;"><input type="checkbox" name="section-'. $section->id .'" value="on">'. $section->name .'</span></div>'. "\n"; }
88
+		if ($sections !== false) {
89
+			foreach ($sections as $section) {
90
+				if (in_array ($section->id, @$vrf_sections)) { print '<div class="checkbox" style="margin:0px;"><input type="checkbox" name="section-'.$section->id.'" value="on" checked> '.$section->name.'</div>'."\n"; }
91
+				else { print '<div class="checkbox" style="margin:0px;"><input type="checkbox" name="section-'.$section->id.'" value="on">'.$section->name.'</span></div>'."\n"; }
92 92
 			}
93 93
 		}
94 94
 		?>
@@ -97,46 +97,46 @@  discard block
 block discarded – undo
97 97
 
98 98
 	<!-- Custom -->
99 99
 	<?php
100
-	if(sizeof($custom) > 0) {
100
+	if (sizeof ($custom) > 0) {
101 101
 
102 102
 		print '<tr>';
103 103
 		print '	<td colspan="2"><hr></td>';
104 104
 		print '</tr>';
105 105
 
106
-		foreach($custom as $field) {
106
+		foreach ($custom as $field) {
107 107
 
108 108
 			# replace spaces
109
-		    $field['nameNew'] = str_replace(" ", "___", $field['name']);
109
+		    $field['nameNew'] = str_replace (" ", "___", $field['name']);
110 110
 
111 111
 			# required
112
-			if($field['Null']=="NO")	{ $required = "*"; }
113
-			else						{ $required = ""; }
112
+			if ($field['Null'] == "NO") { $required = "*"; }
113
+			else { $required = ""; }
114 114
 
115 115
 			# set default value !
116
-			if ($_POST['action']=="add")	{ $vrf[$field['name']] = $field['Default']; }
116
+			if ($_POST['action'] == "add") { $vrf[$field['name']] = $field['Default']; }
117 117
 
118
-			print '<tr>'. "\n";
119
-			print '	<td>'. $field['name'] .' '.$required.'</td>'. "\n";
120
-			print '	<td>'. "\n";
118
+			print '<tr>'."\n";
119
+			print '	<td>'.$field['name'].' '.$required.'</td>'."\n";
120
+			print '	<td>'."\n";
121 121
 
122 122
 			//set type
123
-			if(substr($field['type'], 0,3) == "set" || substr($field['type'], 0,4) == "enum") {
123
+			if (substr ($field['type'], 0, 3) == "set" || substr ($field['type'], 0, 4) == "enum") {
124 124
 				//parse values
125
-				$tmp = substr($field['type'], 0,3)=="set" ? explode(",", str_replace(array("set(", ")", "'"), "", $field['type'])) : explode(",", str_replace(array("enum(", ")", "'"), "", $field['type']));
125
+				$tmp = substr ($field['type'], 0, 3) == "set" ? explode (",", str_replace (array ("set(", ")", "'"), "", $field['type'])) : explode (",", str_replace (array ("enum(", ")", "'"), "", $field['type']));
126 126
 				//null
127
-				if($field['Null']!="NO") { array_unshift($tmp, ""); }
127
+				if ($field['Null'] != "NO") { array_unshift ($tmp, ""); }
128 128
 
129 129
 				print "<select name='$field[nameNew]' class='form-control input-sm input-w-auto' rel='tooltip' data-placement='right' title='$field[Comment]'>";
130
-				foreach($tmp as $v) {
131
-					if($v==$vrf[$field['name']])	{ print "<option value='$v' selected='selected'>$v</option>"; }
132
-					else								{ print "<option value='$v'>$v</option>"; }
130
+				foreach ($tmp as $v) {
131
+					if ($v == $vrf[$field['name']]) { print "<option value='$v' selected='selected'>$v</option>"; }
132
+					else { print "<option value='$v'>$v</option>"; }
133 133
 				}
134 134
 				print "</select>";
135 135
 			}
136 136
 			//date and time picker
137
-			elseif($field['type'] == "date" || $field['type'] == "datetime") {
137
+			elseif ($field['type'] == "date" || $field['type'] == "datetime") {
138 138
 				// just for first
139
-				if($timeP==0) {
139
+				if ($timeP == 0) {
140 140
 					print '<link rel="stylesheet" type="text/css" href="css/1.2/bootstrap/bootstrap-datetimepicker.min.css">';
141 141
 					print '<script type="text/javascript" src="js/1.2/bootstrap-datetimepicker.min.js"></script>';
142 142
 					print '<script type="text/javascript">';
@@ -152,38 +152,38 @@  discard block
 block discarded – undo
152 152
 				$timeP++;
153 153
 
154 154
 				//set size
155
-				if($field['type'] == "date")	{ $size = 10; $class='datepicker';		$format = "yyyy-MM-dd"; }
156
-				else							{ $size = 19; $class='datetimepicker';	$format = "yyyy-MM-dd"; }
155
+				if ($field['type'] == "date") { $size = 10; $class = 'datepicker'; $format = "yyyy-MM-dd"; }
156
+				else { $size = 19; $class = 'datetimepicker'; $format = "yyyy-MM-dd"; }
157 157
 
158 158
 				//field
159
-				if(!isset($vrf[$field['name']]))	{ print ' <input type="text" class="'.$class.' form-control input-sm input-w-auto" data-format="'.$format.'" name="'. $field['nameNew'] .'" maxlength="'.$size.'" '.$readonly.' rel="tooltip" data-placement="right" title="'.$field['Comment'].'">'. "\n"; }
160
-				else								{ print ' <input type="text" class="'.$class.' form-control input-sm input-w-auto" data-format="'.$format.'" name="'. $field['nameNew'] .'" maxlength="'.$size.'" value="'. $vrf[$field['name']]. '" '.$readonly.' rel="tooltip" data-placement="right" title="'.$field['Comment'].'">'. "\n"; }
159
+				if (!isset($vrf[$field['name']])) { print ' <input type="text" class="'.$class.' form-control input-sm input-w-auto" data-format="'.$format.'" name="'.$field['nameNew'].'" maxlength="'.$size.'" '.$readonly.' rel="tooltip" data-placement="right" title="'.$field['Comment'].'">'."\n"; }
160
+				else { print ' <input type="text" class="'.$class.' form-control input-sm input-w-auto" data-format="'.$format.'" name="'.$field['nameNew'].'" maxlength="'.$size.'" value="'.$vrf[$field['name']].'" '.$readonly.' rel="tooltip" data-placement="right" title="'.$field['Comment'].'">'."\n"; }
161 161
 			}
162 162
 			//boolean
163
-			elseif($field['type'] == "tinyint(1)") {
163
+			elseif ($field['type'] == "tinyint(1)") {
164 164
 				print "<select name='$field[nameNew]' class='form-control input-sm input-w-auto' rel='tooltip' data-placement='right' title='$field[Comment]'>";
165
-				$tmp = array(0=>"No",1=>"Yes");
165
+				$tmp = array (0=>"No", 1=>"Yes");
166 166
 				//null
167
-				if($field['Null']!="NO") { $tmp[2] = ""; }
167
+				if ($field['Null'] != "NO") { $tmp[2] = ""; }
168 168
 
169
-				foreach($tmp as $k=>$v) {
170
-					if(strlen($vrf[$field['name']])==0 && $k==2)	{ print "<option value='$k' selected='selected'>"._($v)."</option>"; }
171
-					elseif($k==$vrf[$field['name']])				{ print "<option value='$k' selected='selected'>"._($v)."</option>"; }
172
-					else												{ print "<option value='$k'>"._($v)."</option>"; }
169
+				foreach ($tmp as $k=>$v) {
170
+					if (strlen ($vrf[$field['name']]) == 0 && $k == 2) { print "<option value='$k' selected='selected'>"._ ($v)."</option>"; }
171
+					elseif ($k == $vrf[$field['name']]) { print "<option value='$k' selected='selected'>"._ ($v)."</option>"; }
172
+					else { print "<option value='$k'>"._ ($v)."</option>"; }
173 173
 				}
174 174
 				print "</select>";
175 175
 			}
176 176
 			//text
177
-			elseif($field['type'] == "text") {
178
-				print ' <textarea class="form-control input-sm" name="'. $field['nameNew'] .'" placeholder="'. $field['name'] .'" '.$readonly.' rowspan=3 rel="tooltip" data-placement="right" title="'.$field['Comment'].'">'. $vrf[$field['name']]. '</textarea>'. "\n";
177
+			elseif ($field['type'] == "text") {
178
+				print ' <textarea class="form-control input-sm" name="'.$field['nameNew'].'" placeholder="'.$field['name'].'" '.$readonly.' rowspan=3 rel="tooltip" data-placement="right" title="'.$field['Comment'].'">'.$vrf[$field['name']].'</textarea>'."\n";
179 179
 			}
180 180
 			//default - input field
181 181
 			else {
182
-				print ' <input type="text" class="ip_addr form-control input-sm" name="'. $field['nameNew'] .'" placeholder="'. $field['name'] .'" value="'. @$vrf[$field['name']]. '" size="30" '.$readonly.' rel="tooltip" data-placement="right" title="'.$field['Comment'].'">'. "\n";
182
+				print ' <input type="text" class="ip_addr form-control input-sm" name="'.$field['nameNew'].'" placeholder="'.$field['name'].'" value="'.@$vrf[$field['name']].'" size="30" '.$readonly.' rel="tooltip" data-placement="right" title="'.$field['Comment'].'">'."\n";
183 183
 			}
184 184
 
185
-			print '	</td>'. "\n";
186
-			print '</tr>'. "\n";
185
+			print '	</td>'."\n";
186
+			print '</tr>'."\n";
187 187
 		}
188 188
 	}
189 189
 	?>
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
 
195 195
 	<?php
196 196
 	//print delete warning
197
-	if($_POST['action'] == "delete")	{ $Result->show("warning", "<strong>"._('Warning').":</strong> "._("removing VRF will also remove VRF reference from belonging subnets!"), false);}
197
+	if ($_POST['action'] == "delete") { $Result->show ("warning", "<strong>"._ ('Warning').":</strong> "._ ("removing VRF will also remove VRF reference from belonging subnets!"), false); }
198 198
 	?>
199 199
 </div>
200 200
 
@@ -202,8 +202,8 @@  discard block
 block discarded – undo
202 202
 <!-- footer -->
203 203
 <div class="pFooter">
204 204
 	<div class="btn-group">
205
-		<button class="btn btn-sm btn-default hidePopups"><?php print _('Cancel'); ?></button>
206
-		<button class="btn btn-sm btn-default <?php if($_POST['action']=="delete") { print "btn-danger"; } else { print "btn-success"; } ?>" id="editVRF"><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>
205
+		<button class="btn btn-sm btn-default hidePopups"><?php print _ ('Cancel'); ?></button>
206
+		<button class="btn btn-sm btn-default <?php if ($_POST['action'] == "delete") { print "btn-danger"; } else { print "btn-success"; } ?>" id="editVRF"><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>
207 207
 	</div>
208 208
 	<!-- result -->
209 209
 	<div class="vrfManagementEditResult"></div>
Please login to merge, or discard this patch.
app/admin/tags/index.php 2 patches
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -33,33 +33,33 @@
 block discarded – undo
33 33
 
34 34
 # loop
35 35
 if ($all_types!==false) {
36
-	// cast
37
-	$all_types = (array) $all_types;
38
-	// loop
39
-	foreach ($all_types as $type) {
40
-		//cast
41
-		$type = (array) $type;
36
+    // cast
37
+    $all_types = (array) $all_types;
38
+    // loop
39
+    foreach ($all_types as $type) {
40
+        //cast
41
+        $type = (array) $type;
42 42
 
43
-		//format type
44
-		$showtag = $type['showtag']==1 ? "Yes" : "No";
43
+        //format type
44
+        $showtag = $type['showtag']==1 ? "Yes" : "No";
45 45
 
46
-		//print details
47
-		print '<tr>'. "\n";
48
-		print '	<td>'. $type['type'] .'</td>'. "\n";
49
-		print '	<td>'.$showtag.'</td>'. "\n";
50
-		print '	<td style="background-color:'.$type['bgcolor'].'">'. $type['bgcolor'] .'</td>'. "\n";
51
-		print '	<td style="background-color:'.$type['fgcolor'].'">'. $type['fgcolor'] .'</td>'. "\n";
52
-		print '	<td>'. $type['compress'] .'</td>'. "\n";
53
-		print '	<td>'. $type['locked'] .'</td>'. "\n";
46
+        //print details
47
+        print '<tr>'. "\n";
48
+        print '	<td>'. $type['type'] .'</td>'. "\n";
49
+        print '	<td>'.$showtag.'</td>'. "\n";
50
+        print '	<td style="background-color:'.$type['bgcolor'].'">'. $type['bgcolor'] .'</td>'. "\n";
51
+        print '	<td style="background-color:'.$type['fgcolor'].'">'. $type['fgcolor'] .'</td>'. "\n";
52
+        print '	<td>'. $type['compress'] .'</td>'. "\n";
53
+        print '	<td>'. $type['locked'] .'</td>'. "\n";
54 54
 
55
-		print "	<td class='actions'>";
56
-		print "	<div class='btn-group'>";
57
-		print "		<button class='btn btn-xs btn-default editType' data-action='edit'   data-id='$type[id]'><i class='fa fa-pencil'></i></button>";
58
-		print "		<button class='btn btn-xs btn-default editType' data-action='delete' data-id='$type[id]'><i class='fa fa-times'></i></button>";
59
-		print "	</div>";
60
-		print "	</td>";
61
-		print '</tr>'. "\n";
62
-	}
55
+        print "	<td class='actions'>";
56
+        print "	<div class='btn-group'>";
57
+        print "		<button class='btn btn-xs btn-default editType' data-action='edit'   data-id='$type[id]'><i class='fa fa-pencil'></i></button>";
58
+        print "		<button class='btn btn-xs btn-default editType' data-action='delete' data-id='$type[id]'><i class='fa fa-times'></i></button>";
59
+        print "	</div>";
60
+        print "	</td>";
61
+        print '</tr>'. "\n";
62
+    }
63 63
 }
64 64
 print '</table>'. "\n";
65 65
 ?>
Please login to merge, or discard this patch.
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -5,34 +5,34 @@  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 vrfs
11
-$all_types = $Admin->fetch_all_objects("ipTags");
11
+$all_types = $Admin->fetch_all_objects ("ipTags");
12 12
 ?>
13 13
 
14
-<h4><?php print _('Manage Address Tags'); ?></h4>
14
+<h4><?php print _ ('Manage Address Tags'); ?></h4>
15 15
 <hr><br>
16 16
 
17
-<button class='btn btn-sm btn-default editType' data-action='add' data-vrfid='' style='margin-bottom:10px;'><i class='fa fa-plus'></i> <?php print _('Add Tag'); ?></button>
17
+<button class='btn btn-sm btn-default editType' data-action='add' data-vrfid='' style='margin-bottom:10px;'><i class='fa fa-plus'></i> <?php print _ ('Add Tag'); ?></button>
18 18
 
19 19
 <!-- vrfs -->
20 20
 <?php
21
-print '<table class="table table-striped table-top table-auto">'. "\n";
21
+print '<table class="table table-striped table-top table-auto">'."\n";
22 22
 
23 23
 # headers
24
-print '<tr>'. "\n";
25
-print '	<th>'._('type').'</th>'. "\n";
26
-print '	<th>'._('Show Tag').'</th>'. "\n";
27
-print '	<th>'._('BG color').'</th>'. "\n";
28
-print '	<th>'._('FG color').'</th>'. "\n";
29
-print '	<th>'._('Compress range').'</th>'. "\n";
30
-print '	<th>'._('Locked').'</th>'. "\n";
31
-print '	<th></th>'. "\n";
32
-print '</tr>'. "\n";
24
+print '<tr>'."\n";
25
+print '	<th>'._ ('type').'</th>'."\n";
26
+print '	<th>'._ ('Show Tag').'</th>'."\n";
27
+print '	<th>'._ ('BG color').'</th>'."\n";
28
+print '	<th>'._ ('FG color').'</th>'."\n";
29
+print '	<th>'._ ('Compress range').'</th>'."\n";
30
+print '	<th>'._ ('Locked').'</th>'."\n";
31
+print '	<th></th>'."\n";
32
+print '</tr>'."\n";
33 33
 
34 34
 # loop
35
-if ($all_types!==false) {
35
+if ($all_types !== false) {
36 36
 	// cast
37 37
 	$all_types = (array) $all_types;
38 38
 	// loop
@@ -41,16 +41,16 @@  discard block
 block discarded – undo
41 41
 		$type = (array) $type;
42 42
 
43 43
 		//format type
44
-		$showtag = $type['showtag']==1 ? "Yes" : "No";
44
+		$showtag = $type['showtag'] == 1 ? "Yes" : "No";
45 45
 
46 46
 		//print details
47
-		print '<tr>'. "\n";
48
-		print '	<td>'. $type['type'] .'</td>'. "\n";
49
-		print '	<td>'.$showtag.'</td>'. "\n";
50
-		print '	<td style="background-color:'.$type['bgcolor'].'">'. $type['bgcolor'] .'</td>'. "\n";
51
-		print '	<td style="background-color:'.$type['fgcolor'].'">'. $type['fgcolor'] .'</td>'. "\n";
52
-		print '	<td>'. $type['compress'] .'</td>'. "\n";
53
-		print '	<td>'. $type['locked'] .'</td>'. "\n";
47
+		print '<tr>'."\n";
48
+		print '	<td>'.$type['type'].'</td>'."\n";
49
+		print '	<td>'.$showtag.'</td>'."\n";
50
+		print '	<td style="background-color:'.$type['bgcolor'].'">'.$type['bgcolor'].'</td>'."\n";
51
+		print '	<td style="background-color:'.$type['fgcolor'].'">'.$type['fgcolor'].'</td>'."\n";
52
+		print '	<td>'.$type['compress'].'</td>'."\n";
53
+		print '	<td>'.$type['locked'].'</td>'."\n";
54 54
 
55 55
 		print "	<td class='actions'>";
56 56
 		print "	<div class='btn-group'>";
@@ -58,10 +58,10 @@  discard block
 block discarded – undo
58 58
 		print "		<button class='btn btn-xs btn-default editType' data-action='delete' data-id='$type[id]'><i class='fa fa-times'></i></button>";
59 59
 		print "	</div>";
60 60
 		print "	</td>";
61
-		print '</tr>'. "\n";
61
+		print '</tr>'."\n";
62 62
 	}
63 63
 }
64
-print '</table>'. "\n";
64
+print '</table>'."\n";
65 65
 ?>
66 66
 
67 67
 <!-- edit result holder -->
Please login to merge, or discard this patch.
app/admin/tags/edit-result.php 2 patches
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -24,28 +24,28 @@  discard block
 block discarded – undo
24 24
 
25 25
 # fetch old values
26 26
 if($_POST['action']=="delete") {
27
-	$old_tag = $Admin->fetch_object ("ipTags", "id", $_POST['id']);
27
+    $old_tag = $Admin->fetch_object ("ipTags", "id", $_POST['id']);
28 28
 }
29 29
 else {
30
-	$old_tag = new StdClass ();
30
+    $old_tag = new StdClass ();
31 31
 }
32 32
 
33 33
 /* checks */
34 34
 if($_POST['action']=="delete" && $old_tag->locked!="No")				{ $Result->show("danger", _("Cannot delete locked tag"), true); }
35 35
 if($_POST['action']!="delete") {
36
-	if(strlen($_POST['type'])<3)										{ $Result->show("danger", _("Invalid tag name"), true); }
37
-	if(strlen($_POST['bgcolor'])<4)										{ $Result->show("danger", _("Invalid bg color"), true); }
38
-	if(strlen($_POST['fgcolor'])<4)										{ $Result->show("danger", _("Invalid fg color"), true); }
36
+    if(strlen($_POST['type'])<3)										{ $Result->show("danger", _("Invalid tag name"), true); }
37
+    if(strlen($_POST['bgcolor'])<4)										{ $Result->show("danger", _("Invalid bg color"), true); }
38
+    if(strlen($_POST['fgcolor'])<4)										{ $Result->show("danger", _("Invalid fg color"), true); }
39 39
 }
40 40
 
41 41
 # create array of values for modification
42 42
 $values = array("id"=>@$_POST['id'],
43
-				"type"=>$_POST['type'],
44
-				"bgcolor"=>@$_POST['bgcolor'],
45
-				"fgcolor"=>@$_POST['fgcolor'],
46
-				"showtag"=>@$_POST['showtag'],
47
-				"compress"=>@$_POST['compress']
48
-				);
43
+                "type"=>$_POST['type'],
44
+                "bgcolor"=>@$_POST['bgcolor'],
45
+                "fgcolor"=>@$_POST['fgcolor'],
46
+                "showtag"=>@$_POST['showtag'],
47
+                "compress"=>@$_POST['compress']
48
+                );
49 49
 
50 50
 # execute
51 51
 if(!$Admin->object_modify("ipTags", $_POST['action'], "id", $values)) 	{ $Result->show("danger",  _("Tag $_POST[action] error"), true); }
@@ -53,6 +53,6 @@  discard block
 block discarded – undo
53 53
 
54 54
 # reset if delete to online
55 55
 if($_POST['action']=="delete") {
56
-	$Admin->update_object_references ("ipaddresses", "state", $old_tag->id, 0);
56
+    $Admin->update_object_references ("ipaddresses", "state", $old_tag->id, 0);
57 57
 }
58 58
 ?>
59 59
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -5,25 +5,25 @@  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
 # 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", "tags", $_POST['csrf_cookie']) === false ? $Result->show("danger", _("Invalid CSRF cookie"), true) : "";
23
+$User->csrf_cookie ("validate", "tags", $_POST['csrf_cookie']) === false ? $Result->show ("danger", _ ("Invalid CSRF cookie"), true) : "";
24 24
 
25 25
 # fetch old values
26
-if($_POST['action']=="delete") {
26
+if ($_POST['action'] == "delete") {
27 27
 	$old_tag = $Admin->fetch_object ("ipTags", "id", $_POST['id']);
28 28
 }
29 29
 else {
@@ -31,15 +31,15 @@  discard block
 block discarded – undo
31 31
 }
32 32
 
33 33
 /* checks */
34
-if($_POST['action']=="delete" && $old_tag->locked!="No")				{ $Result->show("danger", _("Cannot delete locked tag"), true); }
35
-if($_POST['action']!="delete") {
36
-	if(strlen($_POST['type'])<3)										{ $Result->show("danger", _("Invalid tag name"), true); }
37
-	if(strlen($_POST['bgcolor'])<4)										{ $Result->show("danger", _("Invalid bg color"), true); }
38
-	if(strlen($_POST['fgcolor'])<4)										{ $Result->show("danger", _("Invalid fg color"), true); }
34
+if ($_POST['action'] == "delete" && $old_tag->locked != "No") { $Result->show ("danger", _ ("Cannot delete locked tag"), true); }
35
+if ($_POST['action'] != "delete") {
36
+	if (strlen ($_POST['type']) < 3) { $Result->show ("danger", _ ("Invalid tag name"), true); }
37
+	if (strlen ($_POST['bgcolor']) < 4) { $Result->show ("danger", _ ("Invalid bg color"), true); }
38
+	if (strlen ($_POST['fgcolor']) < 4) { $Result->show ("danger", _ ("Invalid fg color"), true); }
39 39
 }
40 40
 
41 41
 # create array of values for modification
42
-$values = array("id"=>@$_POST['id'],
42
+$values = array ("id"=>@$_POST['id'],
43 43
 				"type"=>$_POST['type'],
44 44
 				"bgcolor"=>@$_POST['bgcolor'],
45 45
 				"fgcolor"=>@$_POST['fgcolor'],
@@ -48,11 +48,11 @@  discard block
 block discarded – undo
48 48
 				);
49 49
 
50 50
 # execute
51
-if(!$Admin->object_modify("ipTags", $_POST['action'], "id", $values)) 	{ $Result->show("danger",  _("Tag $_POST[action] error"), true); }
52
-else 																	{ $Result->show("success", _("Tag $_POST[action] success"), false); }
51
+if (!$Admin->object_modify ("ipTags", $_POST['action'], "id", $values)) { $Result->show ("danger", _ ("Tag $_POST[action] error"), true); }
52
+else { $Result->show ("success", _ ("Tag $_POST[action] success"), false); }
53 53
 
54 54
 # reset if delete to online
55
-if($_POST['action']=="delete") {
55
+if ($_POST['action'] == "delete") {
56 56
 	$Admin->update_object_references ("ipaddresses", "state", $old_tag->id, 0);
57 57
 }
58 58
 ?>
59 59
\ No newline at end of file
Please login to merge, or discard this patch.
app/admin/tags/edit.php 3 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -24,10 +24,10 @@
 block discarded – undo
24 24
 
25 25
 # fetch api for edit / add
26 26
 if($_POST['action']!="add") {
27
-	# fetch api details
28
-	$tag = $Admin->fetch_object ("ipTags", "id", $_POST['id']);
29
-	# null ?
30
-	$tag===false ? $Result->show("danger", _("Invalid ID"), true, true) : null;
27
+    # fetch api details
28
+    $tag = $Admin->fetch_object ("ipTags", "id", $_POST['id']);
29
+    # null ?
30
+    $tag===false ? $Result->show("danger", _("Invalid ID"), true, true) : null;
31 31
 }
32 32
 ?>
33 33
 
Please login to merge, or discard this patch.
Braces   +16 added lines, -4 removed lines patch added patch discarded remove patch
@@ -57,7 +57,10 @@  discard block
 block discarded – undo
57 57
 	<tr>
58 58
 	    <td style="width:120px;"><?php print _('Type'); ?></td>
59 59
 	    <td>
60
-		    <input type="text" name="type" class="form-control input-sm"  value="<?php print @$tag->type; ?>"  maxlength='32' <?php if($_POST['action'] == "delete") print "readonly"; ?>>
60
+		    <input type="text" name="type" class="form-control input-sm"  value="<?php print @$tag->type; ?>"  maxlength='32' <?php if($_POST['action'] == "delete") {
61
+    print "readonly";
62
+}
63
+?>>
61 64
 			<input type="hidden" name="id" value="<?php print @$tag->id; ?>">
62 65
 			<input type="hidden" name="action" value="<?php print $_POST['action']; ?>">
63 66
 			<input type="hidden" name="csrf_cookie" value="<?php print $csrf; ?>">
@@ -80,7 +83,10 @@  discard block
 block discarded – undo
80 83
 	    <td><?php print _('Bg color'); ?></td>
81 84
 	    <td>
82 85
 		    <div class="input-group select-bgcolor">
83
-				<input type="text" name="bgcolor" class="form-control input-xs"  value="<?php print @$tag->bgcolor; ?>"  maxlength='32' <?php if($_POST['action'] == "delete") print "readonly"; ?>><span class="input-group-addon"><i></i></span>
86
+				<input type="text" name="bgcolor" class="form-control input-xs"  value="<?php print @$tag->bgcolor; ?>"  maxlength='32' <?php if($_POST['action'] == "delete") {
87
+    print "readonly";
88
+}
89
+?>><span class="input-group-addon"><i></i></span>
84 90
 		    </div>
85 91
 		</td>
86 92
     </tr>
@@ -90,7 +96,10 @@  discard block
 block discarded – undo
90 96
 	    <td><?php print _('Fg color'); ?></td>
91 97
 	    <td>
92 98
 		    <div class="input-group select-fgcolor">
93
-			    <input type="text" name="fgcolor" class="form-control input-sm"  value="<?php print @$tag->fgcolor; ?>"  maxlength='32' <?php if($_POST['action'] == "delete") print "readonly"; ?>><span class="input-group-addon"><i></i></span>
99
+			    <input type="text" name="fgcolor" class="form-control input-sm"  value="<?php print @$tag->fgcolor; ?>"  maxlength='32' <?php if($_POST['action'] == "delete") {
100
+    print "readonly";
101
+}
102
+?>><span class="input-group-addon"><i></i></span>
94 103
 		    </div>
95 104
 		</td>
96 105
     </tr>
@@ -115,7 +124,10 @@  discard block
 block discarded – undo
115 124
 <div class="pFooter">
116 125
 	<div class="btn-group">
117 126
 		<button class="btn btn-sm btn-default hidePopups"><?php print _('Cancel'); ?></button>
118
-		<button class="btn btn-sm btn-default <?php if($_POST['action']=="delete") { print "btn-danger"; } else { print "btn-success"; } ?>" id="editTypesubmit"><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>
127
+		<button class="btn btn-sm btn-default <?php if($_POST['action']=="delete") { print "btn-danger"; }
128
+else { print "btn-success"; } ?>" id="editTypesubmit"><i class="fa <?php if($_POST['action']=="add") { print "fa-plus"; }
129
+else if ($_POST['action']=="delete") { print "fa-trash-o"; }
130
+else { print "fa-check"; } ?>"></i> <?php print ucwords(_($_POST['action'])); ?></button>
119 131
 	</div>
120 132
 	<!-- Result -->
121 133
 	<div class="editTypeResult"></div>
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -5,29 +5,29 @@  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", "tags");
21 21
 
22 22
 # ID must be numeric
23
-if($_POST['action']!="add" && !is_numeric($_POST['id'])) { $Result->show("danger", _("Invalid ID"), true, true); }
23
+if ($_POST['action'] != "add" && !is_numeric ($_POST['id'])) { $Result->show ("danger", _ ("Invalid ID"), true, true); }
24 24
 
25 25
 # fetch api for edit / add
26
-if($_POST['action']!="add") {
26
+if ($_POST['action'] != "add") {
27 27
 	# fetch api details
28 28
 	$tag = $Admin->fetch_object ("ipTags", "id", $_POST['id']);
29 29
 	# null ?
30
-	$tag===false ? $Result->show("danger", _("Invalid ID"), true, true) : null;
30
+	$tag === false ? $Result->show ("danger", _ ("Invalid ID"), true, true) : null;
31 31
 }
32 32
 ?>
33 33
 
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 
46 46
 
47 47
 <!-- header -->
48
-<div class="pHeader"><?php print ucwords($_POST['action']) .' '._('tag'); ?></div>
48
+<div class="pHeader"><?php print ucwords ($_POST['action']).' '._ ('tag'); ?></div>
49 49
 
50 50
 <!-- content -->
51 51
 <div class="pContent">
@@ -55,9 +55,9 @@  discard block
 block discarded – undo
55 55
 
56 56
 	<!-- type -->
57 57
 	<tr>
58
-	    <td style="width:120px;"><?php print _('Type'); ?></td>
58
+	    <td style="width:120px;"><?php print _ ('Type'); ?></td>
59 59
 	    <td>
60
-		    <input type="text" name="type" class="form-control input-sm"  value="<?php print @$tag->type; ?>"  maxlength='32' <?php if($_POST['action'] == "delete") print "readonly"; ?>>
60
+		    <input type="text" name="type" class="form-control input-sm"  value="<?php print @$tag->type; ?>"  maxlength='32' <?php if ($_POST['action'] == "delete") print "readonly"; ?>>
61 61
 			<input type="hidden" name="id" value="<?php print @$tag->id; ?>">
62 62
 			<input type="hidden" name="action" value="<?php print $_POST['action']; ?>">
63 63
 			<input type="hidden" name="csrf_cookie" value="<?php print $csrf; ?>">
@@ -66,42 +66,42 @@  discard block
 block discarded – undo
66 66
 
67 67
 	<!-- show tag -->
68 68
 	<tr>
69
-	    <td style="white-space: nowrap;"><?php print _('Show tag'); ?></td>
69
+	    <td style="white-space: nowrap;"><?php print _ ('Show tag'); ?></td>
70 70
 	    <td>
71 71
 		    <select name="showtag" class="form-control input-w-auto">
72
-			    <option value="0"><?php print _("No"); ?></option>
73
-			    <option value="1" <?php if(@$tag->showtag==1) { print "selected='selected'"; } ?>><?php print _("Yes"); ?></option>
72
+			    <option value="0"><?php print _ ("No"); ?></option>
73
+			    <option value="1" <?php if (@$tag->showtag == 1) { print "selected='selected'"; } ?>><?php print _ ("Yes"); ?></option>
74 74
 		    </select>
75 75
 		</td>
76 76
     </tr>
77 77
 
78 78
 	<!-- bg color -->
79 79
 	<tr>
80
-	    <td><?php print _('Bg color'); ?></td>
80
+	    <td><?php print _ ('Bg color'); ?></td>
81 81
 	    <td>
82 82
 		    <div class="input-group select-bgcolor">
83
-				<input type="text" name="bgcolor" class="form-control input-xs"  value="<?php print @$tag->bgcolor; ?>"  maxlength='32' <?php if($_POST['action'] == "delete") print "readonly"; ?>><span class="input-group-addon"><i></i></span>
83
+				<input type="text" name="bgcolor" class="form-control input-xs"  value="<?php print @$tag->bgcolor; ?>"  maxlength='32' <?php if ($_POST['action'] == "delete") print "readonly"; ?>><span class="input-group-addon"><i></i></span>
84 84
 		    </div>
85 85
 		</td>
86 86
     </tr>
87 87
 
88 88
 	<!-- fg color -->
89 89
 	<tr>
90
-	    <td><?php print _('Fg color'); ?></td>
90
+	    <td><?php print _ ('Fg color'); ?></td>
91 91
 	    <td>
92 92
 		    <div class="input-group select-fgcolor">
93
-			    <input type="text" name="fgcolor" class="form-control input-sm"  value="<?php print @$tag->fgcolor; ?>"  maxlength='32' <?php if($_POST['action'] == "delete") print "readonly"; ?>><span class="input-group-addon"><i></i></span>
93
+			    <input type="text" name="fgcolor" class="form-control input-sm"  value="<?php print @$tag->fgcolor; ?>"  maxlength='32' <?php if ($_POST['action'] == "delete") print "readonly"; ?>><span class="input-group-addon"><i></i></span>
94 94
 		    </div>
95 95
 		</td>
96 96
     </tr>
97 97
 
98 98
 	<!-- Compress -->
99 99
 	<tr>
100
-	    <td><?php print _('Compress range'); ?></td>
100
+	    <td><?php print _ ('Compress range'); ?></td>
101 101
 	    <td>
102 102
 		    <select name="compress" class="form-control input-w-auto">
103
-			    <option value="No"><?php print _("No"); ?></option>
104
-			    <option value="Yes" <?php if(@$tag->compress=="Yes") { print "selected='selected'"; } ?>><?php print _("Yes"); ?></option>
103
+			    <option value="No"><?php print _ ("No"); ?></option>
104
+			    <option value="Yes" <?php if (@$tag->compress == "Yes") { print "selected='selected'"; } ?>><?php print _ ("Yes"); ?></option>
105 105
 		    </select>
106 106
 		</td>
107 107
     </tr>
@@ -114,8 +114,8 @@  discard block
 block discarded – undo
114 114
 <!-- footer -->
115 115
 <div class="pFooter">
116 116
 	<div class="btn-group">
117
-		<button class="btn btn-sm btn-default hidePopups"><?php print _('Cancel'); ?></button>
118
-		<button class="btn btn-sm btn-default <?php if($_POST['action']=="delete") { print "btn-danger"; } else { print "btn-success"; } ?>" id="editTypesubmit"><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>
117
+		<button class="btn btn-sm btn-default hidePopups"><?php print _ ('Cancel'); ?></button>
118
+		<button class="btn btn-sm btn-default <?php if ($_POST['action'] == "delete") { print "btn-danger"; } else { print "btn-success"; } ?>" id="editTypesubmit"><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>
119 119
 	</div>
120 120
 	<!-- Result -->
121 121
 	<div class="editTypeResult"></div>
Please login to merge, or discard this patch.
app/admin/racks/edit-rack-devices-result.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -37,10 +37,10 @@
 block discarded – undo
37 37
 
38 38
 # set update values
39 39
 $values = array("id"=>@$_POST['deviceid'],
40
-				"rack"=>@$_POST['rackid'],
41
-				"rack_start"=>@$_POST['rack_start'],
42
-				"rack_size"=>@$_POST['rack_size'],
43
-				);
40
+                "rack"=>@$_POST['rackid'],
41
+                "rack_start"=>@$_POST['rack_start'],
42
+                "rack_size"=>@$_POST['rack_size'],
43
+                );
44 44
 
45 45
 # update rack
46 46
 if(!$Admin->object_modify("devices", "edit", "id", $values))	        { $Result->show("success", _("Failed to add device to rack").'!', false); }
Please login to merge, or discard this 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/racks/edit-rack-devices.php 2 patches
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -65,14 +65,14 @@  discard block
 block discarded – undo
65 65
 
66 66
 
67 67
     # all devices
68
-	$devices = $Admin->fetch_all_objects("devices", "id");
69
-	if ($devices!==false) {
70
-		foreach($devices as $k=>$d) {
71
-			if (strlen($d->rack)!=0) {
72
-				unset($devices[$k]);
73
-			}
74
-		}
75
-	}
68
+    $devices = $Admin->fetch_all_objects("devices", "id");
69
+    if ($devices!==false) {
70
+        foreach($devices as $k=>$d) {
71
+            if (strlen($d->rack)!=0) {
72
+                unset($devices[$k]);
73
+            }
74
+        }
75
+    }
76 76
 ?>
77 77
 
78 78
 <script type="text/javascript">
@@ -103,10 +103,10 @@  discard block
 block discarded – undo
103 103
         		<td>
104 104
         			<select name="deviceid" class="form-control input-sm input-w-auto">
105 105
         			<?php
106
-            			foreach($devices as $d) {
106
+                        foreach($devices as $d) {
107 107
                             print "<option value='$d->id' >$d->hostname</option>";
108 108
                         }
109
-        			?>
109
+                    ?>
110 110
         			</select>
111 111
         		</td>
112 112
         	</tr>
Please login to merge, or discard this patch.
Spacing   +35 added lines, -35 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
 # strip input tags
22
-$_POST = $Admin->strip_input_tags($_POST);
22
+$_POST = $Admin->strip_input_tags ($_POST);
23 23
 
24 24
 # ID must be numeric
25
-if($_POST['action']!="add" && !is_numeric($_POST['rackid']))		{ $Result->show("danger", _("Invalid ID"), true, true); }
25
+if ($_POST['action'] != "add" && !is_numeric ($_POST['rackid'])) { $Result->show ("danger", _ ("Invalid ID"), true, true); }
26 26
 
27 27
 # remove or add ?
28
-if ($_POST['action']=="remove") {
28
+if ($_POST['action'] == "remove") {
29 29
     # validate csrf cookie
30
-    $User->csrf_cookie ("validate", "rack_devices", $_POST['csrf_cookie']) === false ? $Result->show("danger", _("Invalid CSRF cookie"), true, true) : "";
30
+    $User->csrf_cookie ("validate", "rack_devices", $_POST['csrf_cookie']) === false ? $Result->show ("danger", _ ("Invalid CSRF cookie"), true, true) : "";
31 31
     # set values
32
-    $values = array("id"=>$_POST['deviceid'],
32
+    $values = array ("id"=>$_POST['deviceid'],
33 33
                     "rack"=>"",
34 34
                     "rack_start"=>"",
35 35
                     "rack_size"=>""
36 36
                     );
37 37
     # update
38
-    if(!$Admin->object_modify("devices", "edit", "id", $values))	{ $Result->show("success", _("Failed to remove device from rack").'!', true, true); }
39
-    else															{ $Result->show("success", _("Device removed from rack").'!', false, true); }
38
+    if (!$Admin->object_modify ("devices", "edit", "id", $values)) { $Result->show ("success", _ ("Failed to remove device from rack").'!', true, true); }
39
+    else { $Result->show ("success", _ ("Device removed from rack").'!', false, true); }
40 40
 
41 41
     # js
42 42
     ?>
@@ -57,18 +57,18 @@  discard block
 block discarded – undo
57 57
     # create csrf token
58 58
     $csrf = $User->csrf_cookie ("create", "rack_devices");
59 59
     # fetch rack details
60
-    $rack = $Admin->fetch_object("racks", "id", $_POST['rackid']);
60
+    $rack = $Admin->fetch_object ("racks", "id", $_POST['rackid']);
61 61
     # check
62
-    if ($rack===false)                                              { $Result->show("danger", _("Invalid ID"), true, true); }
62
+    if ($rack === false) { $Result->show ("danger", _ ("Invalid ID"), true, true); }
63 63
     # fetch existing devices
64
-    $rack_devices = $Racks->fetch_rack_devices($rack->id);
64
+    $rack_devices = $Racks->fetch_rack_devices ($rack->id);
65 65
 
66 66
 
67 67
     # all devices
68
-	$devices = $Admin->fetch_all_objects("devices", "id");
69
-	if ($devices!==false) {
70
-		foreach($devices as $k=>$d) {
71
-			if (strlen($d->rack)!=0) {
68
+	$devices = $Admin->fetch_all_objects ("devices", "id");
69
+	if ($devices !== false) {
70
+		foreach ($devices as $k=>$d) {
71
+			if (strlen ($d->rack) != 0) {
72 72
 				unset($devices[$k]);
73 73
 			}
74 74
 		}
@@ -82,14 +82,14 @@  discard block
 block discarded – undo
82 82
 </script>
83 83
 
84 84
 <!-- header -->
85
-<div class="pHeader"><?php print ucwords(_("$_POST[action]")); ?> <?php print _('device to rack'); ?></div>
85
+<div class="pHeader"><?php print ucwords (_ ("$_POST[action]")); ?> <?php print _ ('device to rack'); ?></div>
86 86
 
87 87
 <!-- content -->
88 88
 <div class="pContent">
89 89
     <?php
90 90
     // no devides
91
-    if (!isset($devices)||sizeof($devices)==0) {
92
-        $Result->show("info", _("No devices available"), false);
91
+    if (!isset($devices) || sizeof ($devices) == 0) {
92
+        $Result->show ("info", _ ("No devices available"), false);
93 93
     }
94 94
     else {
95 95
     ?>
@@ -99,11 +99,11 @@  discard block
 block discarded – undo
99 99
 
100 100
         	<!-- Select device  -->
101 101
         	<tr>
102
-        		<td><?php print _('Device'); ?></td>
102
+        		<td><?php print _ ('Device'); ?></td>
103 103
         		<td>
104 104
         			<select name="deviceid" class="form-control input-sm input-w-auto">
105 105
         			<?php
106
-            			foreach($devices as $d) {
106
+            			foreach ($devices as $d) {
107 107
                             print "<option value='$d->id' >$d->hostname</option>";
108 108
                         }
109 109
         			?>
@@ -113,20 +113,20 @@  discard block
 block discarded – undo
113 113
 
114 114
         	<!-- set start -->
115 115
         	<tr>
116
-        		<td><?php print _('Start position'); ?></td>
116
+        		<td><?php print _ ('Start position'); ?></td>
117 117
         		<td>
118 118
                     <select name="rack_start" class="form-control input-sm input-w-auto">
119 119
             		<?php
120 120
                     // available spaces
121
-                    $available = array();
122
-                    for($m=1; $m<=$rack->size; $m++) {
121
+                    $available = array ();
122
+                    for ($m = 1; $m <= $rack->size; $m++) {
123 123
                         $available[] = $m;
124 124
                     }
125 125
 
126
-                    if($rack_devices!==false) {
126
+                    if ($rack_devices !== false) {
127 127
                         foreach ($rack_devices as $d) {
128
-                            for($m=$d->rack_start; $m<=($d->rack_start+($d->rack_size-1)); $m++) {
129
-                                $pos = array_search($m, $available);
128
+                            for ($m = $d->rack_start; $m <= ($d->rack_start + ($d->rack_size - 1)); $m++) {
129
+                                $pos = array_search ($m, $available);
130 130
                                 unset($available[$pos]);
131 131
                             }
132 132
                         }
@@ -142,9 +142,9 @@  discard block
 block discarded – undo
142 142
 
143 143
         	<!-- Set size -->
144 144
         	<tr>
145
-        		<td><?php print _('Size'); ?></td>
145
+        		<td><?php print _ ('Size'); ?></td>
146 146
         		<td>
147
-        			<input type="text" name="rack_size" class="form-control input-sm" placeholder="<?php print _('Rack size in U'); ?>">
147
+        			<input type="text" name="rack_size" class="form-control input-sm" placeholder="<?php print _ ('Rack size in U'); ?>">
148 148
         			<input type="hidden" name="csrf_cookie" value="<?php print $csrf; ?>">
149 149
         			<input type="hidden" name="rackid" value="<?php print $_POST['rackid']; ?>">
150 150
         		</td>
@@ -159,9 +159,9 @@  discard block
 block discarded – undo
159 159
 <!-- footer -->
160 160
 <div class="pFooter">
161 161
 	<div class="btn-group">
162
-		<button class="btn btn-sm btn-default hidePopups"><?php print _('Cancel'); ?></button>
163
-		<?php if (sizeof($devices)>0) { ?>
164
-		<button class="btn btn-sm btn-default btn-success" id="editRackDevicesubmit"><i class="fa fa-plus"></i> <?php print ucwords(_($_POST['action'])); ?></button>
162
+		<button class="btn btn-sm btn-default hidePopups"><?php print _ ('Cancel'); ?></button>
163
+		<?php if (sizeof ($devices) > 0) { ?>
164
+		<button class="btn btn-sm btn-default btn-success" id="editRackDevicesubmit"><i class="fa fa-plus"></i> <?php print ucwords (_ ($_POST['action'])); ?></button>
165 165
         <?php } ?>
166 166
 	</div>
167 167
 
Please login to merge, or discard this patch.
app/admin/racks/edit-result.php 3 patches
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -46,31 +46,31 @@  discard block
 block discarded – undo
46 46
 # fetch custom fields
47 47
 $custom = $Tools->fetch_custom_fields('racks');
48 48
 if(sizeof($custom) > 0) {
49
-	foreach($custom as $myField) {
50
-		//booleans can be only 0 and 1!
51
-		if($myField['type']=="tinyint(1)") {
52
-			if($rack[$myField['name']]>1) {
53
-				$rack[$myField['name']] = 0;
54
-			}
55
-		}
56
-		//not null!
57
-		if($myField['Null']=="NO" && strlen($rack[$myField['name']])==0) {
58
-																		{ $Result->show("danger", $myField['name'].'" can not be empty!', true); }
59
-		}
60
-		# save to update array
61
-		$update[$myField['name']] = $rack[$myField['name']];
62
-	}
49
+    foreach($custom as $myField) {
50
+        //booleans can be only 0 and 1!
51
+        if($myField['type']=="tinyint(1)") {
52
+            if($rack[$myField['name']]>1) {
53
+                $rack[$myField['name']] = 0;
54
+            }
55
+        }
56
+        //not null!
57
+        if($myField['Null']=="NO" && strlen($rack[$myField['name']])==0) {
58
+                                                                        { $Result->show("danger", $myField['name'].'" can not be empty!', true); }
59
+        }
60
+        # save to update array
61
+        $update[$myField['name']] = $rack[$myField['name']];
62
+    }
63 63
 }
64 64
 
65 65
 # set update values
66 66
 $values = array("id"=>@$rack['rackid'],
67
-				"name"=>@$rack['name'],
68
-				"size"=>@$rack['size'],
69
-				"description"=>@$rack['description']
70
-				);
67
+                "name"=>@$rack['name'],
68
+                "size"=>@$rack['size'],
69
+                "description"=>@$rack['description']
70
+                );
71 71
 # custom fields
72 72
 if(isset($update)) {
73
-	$values = array_merge($values, $update);
73
+    $values = array_merge($values, $update);
74 74
 }
75 75
 
76 76
 # update rack
@@ -78,8 +78,8 @@  discard block
 block discarded – undo
78 78
 else																	{ $Result->show("success", _("Rack $rack[action] successfull").'!', false); }
79 79
 
80 80
 if($_POST['action']=="delete"){
81
-	# remove all references from subnets and ip addresses
82
-	$Admin->remove_object_references ("devices", "rack", $values["id"]);
81
+    # remove all references from subnets and ip addresses
82
+    $Admin->remove_object_references ("devices", "rack", $values["id"]);
83 83
 }
84 84
 
85 85
 ?>
Please login to merge, or discard this 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.
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/edit.php 3 patches
Indentation   +104 added lines, -104 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 
30 30
 # fetch device details
31 31
 if( ($_POST['action'] == "edit") || ($_POST['action'] == "delete") ) {
32
-	$rack = $Admin->fetch_object("racks", "id", $_POST['rackid']);
32
+    $rack = $Admin->fetch_object("racks", "id", $_POST['rackid']);
33 33
 }
34 34
 else {
35 35
     $rack = new StdClass ();
@@ -70,11 +70,11 @@  discard block
 block discarded – undo
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>"; }
76
-			}
77
-			?>
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
+            }
77
+            ?>
78 78
 			</select>
79 79
 		</td>
80 80
 	</tr>
@@ -85,9 +85,9 @@  discard block
 block discarded – undo
85 85
 		<td>
86 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";
90
-			} ?>
88
+            if( ($_POST['action'] == "edit") || ($_POST['action'] == "delete") ) {
89
+                print '<input type="hidden" name="rackid" value="'. $_POST['rackid'] .'">'. "\n";
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; ?>">
93 93
 		</td>
@@ -95,101 +95,101 @@  discard block
 block discarded – undo
95 95
 
96 96
 	<!-- Custom -->
97 97
 	<?php
98
-	if(sizeof($custom) > 0) {
99
-
100
-		print '<tr>';
101
-		print '	<td colspan="2"><hr></td>';
102
-		print '</tr>';
103
-
104
-		# count datepickers
105
-		$timeP = 0;
106
-
107
-		# all my fields
108
-		foreach($custom as $field) {
109
-			# replace spaces with |
110
-			$field['nameNew'] = str_replace(" ", "___", $field['name']);
111
-
112
-			# required
113
-			if($field['Null']=="NO")	{ $required = "*"; }
114
-			else						{ $required = ""; }
115
-
116
-			# set default value !
117
-			if ($_POST['action']=="add")	{ $rack->$field['name'] = $field['Default']; }
118
-
119
-			print '<tr>'. "\n";
120
-			print '	<td>'. ucwords($field['name']) .' '.$required.'</td>'. "\n";
121
-			print '	<td>'. "\n";
122
-
123
-			//set type
124
-			if(substr($field['type'], 0,3) == "set" || substr($field['type'], 0,4) == "enum") {
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']));
127
-				//null
128
-				if($field['Null']!="NO") { array_unshift($tmp, ""); }
129
-
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>"; }
134
-				}
135
-				print "</select>";
136
-			}
137
-			//date and time picker
138
-			elseif($field['type'] == "date" || $field['type'] == "datetime") {
139
-				// just for first
140
-				if($timeP==0) {
141
-					print '<link rel="stylesheet" type="text/css" href="css/1.2/bootstrap/bootstrap-datetimepicker.min.css">';
142
-					print '<script type="text/javascript" src="js/1.2/bootstrap-datetimepicker.min.js"></script>';
143
-					print '<script type="text/javascript">';
144
-					print '$(document).ready(function() {';
145
-					//date only
146
-					print '	$(".datepicker").datetimepicker( {pickDate: true, pickTime: false, pickSeconds: false });';
147
-					//date + time
148
-					print '	$(".datetimepicker").datetimepicker( { pickDate: true, pickTime: true } );';
149
-
150
-					print '})';
151
-					print '</script>';
152
-				}
153
-				$timeP++;
154
-
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"; }
158
-
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"; }
162
-			}
163
-			//boolean
164
-			elseif($field['type'] == "tinyint(1)") {
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");
167
-				//null
168
-				if($field['Null']!="NO") { $tmp[2] = ""; }
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>"; }
174
-				}
175
-				print "</select>";
176
-			}
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";
180
-			}
181
-			//default - input field
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";
184
-			}
185
-
186
-			print '	</td>'. "\n";
187
-			print '</tr>'. "\n";
188
-		}
189
-
190
-	}
191
-
192
-	?>
98
+    if(sizeof($custom) > 0) {
99
+
100
+        print '<tr>';
101
+        print '	<td colspan="2"><hr></td>';
102
+        print '</tr>';
103
+
104
+        # count datepickers
105
+        $timeP = 0;
106
+
107
+        # all my fields
108
+        foreach($custom as $field) {
109
+            # replace spaces with |
110
+            $field['nameNew'] = str_replace(" ", "___", $field['name']);
111
+
112
+            # required
113
+            if($field['Null']=="NO")	{ $required = "*"; }
114
+            else						{ $required = ""; }
115
+
116
+            # set default value !
117
+            if ($_POST['action']=="add")	{ $rack->$field['name'] = $field['Default']; }
118
+
119
+            print '<tr>'. "\n";
120
+            print '	<td>'. ucwords($field['name']) .' '.$required.'</td>'. "\n";
121
+            print '	<td>'. "\n";
122
+
123
+            //set type
124
+            if(substr($field['type'], 0,3) == "set" || substr($field['type'], 0,4) == "enum") {
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']));
127
+                //null
128
+                if($field['Null']!="NO") { array_unshift($tmp, ""); }
129
+
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>"; }
134
+                }
135
+                print "</select>";
136
+            }
137
+            //date and time picker
138
+            elseif($field['type'] == "date" || $field['type'] == "datetime") {
139
+                // just for first
140
+                if($timeP==0) {
141
+                    print '<link rel="stylesheet" type="text/css" href="css/1.2/bootstrap/bootstrap-datetimepicker.min.css">';
142
+                    print '<script type="text/javascript" src="js/1.2/bootstrap-datetimepicker.min.js"></script>';
143
+                    print '<script type="text/javascript">';
144
+                    print '$(document).ready(function() {';
145
+                    //date only
146
+                    print '	$(".datepicker").datetimepicker( {pickDate: true, pickTime: false, pickSeconds: false });';
147
+                    //date + time
148
+                    print '	$(".datetimepicker").datetimepicker( { pickDate: true, pickTime: true } );';
149
+
150
+                    print '})';
151
+                    print '</script>';
152
+                }
153
+                $timeP++;
154
+
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"; }
158
+
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"; }
162
+            }
163
+            //boolean
164
+            elseif($field['type'] == "tinyint(1)") {
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");
167
+                //null
168
+                if($field['Null']!="NO") { $tmp[2] = ""; }
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>"; }
174
+                }
175
+                print "</select>";
176
+            }
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";
180
+            }
181
+            //default - input field
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";
184
+            }
185
+
186
+            print '	</td>'. "\n";
187
+            print '</tr>'. "\n";
188
+        }
189
+
190
+    }
191
+
192
+    ?>
193 193
 
194 194
 	</table>
195 195
 	</form>
Please login to merge, or discard this patch.
Braces   +12 added lines, -3 removed lines patch added patch discarded remove patch
@@ -60,7 +60,10 @@  discard block
 block discarded – undo
60 60
 	<tr>
61 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)) {
64
+    print $rack->name;
65
+}
66
+?>" <?php print $readonly; ?>>
64 67
 		</td>
65 68
 	</tr>
66 69
 
@@ -83,7 +86,10 @@  discard block
 block discarded – undo
83 86
 	<tr>
84 87
 		<td><?php print _('Description'); ?></td>
85 88
 		<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>
89
+			<textarea name="description" class="form-control input-sm" placeholder="<?php print _('Description'); ?>" <?php print $readonly; ?>><?php if(isset($rack->description)) {
90
+    print $rack->description;
91
+}
92
+?></textarea>
87 93
 			<?php
88 94
 			if( ($_POST['action'] == "edit") || ($_POST['action'] == "delete") ) {
89 95
 				print '<input type="hidden" name="rackid" value="'. $_POST['rackid'] .'">'. "\n";
@@ -200,7 +206,10 @@  discard block
 block discarded – undo
200 206
 <div class="pFooter">
201 207
 	<div class="btn-group">
202 208
 		<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>
209
+		<button class="btn btn-sm btn-default <?php if($_POST['action']=="delete") { print "btn-danger"; }
210
+else { print "btn-success"; } ?>" id="editRacksubmit"><i class="fa <?php if($_POST['action']=="add") { print "fa-plus"; }
211
+else if ($_POST['action']=="delete") { print "fa-trash-o"; }
212
+else { print "fa-check"; } ?>"></i> <?php print ucwords(_($_POST['action'])); ?></button>
204 213
 	</div>
205 214
 
206 215
 	<!-- result -->
Please login to merge, or discard this 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.