Completed
Pull Request — master (#532)
06:37
created
app/dashboard/widgets/access_logs.php 3 patches
Indentation   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -2,13 +2,13 @@  discard block
 block discarded – undo
2 2
 
3 3
 # required functions
4 4
 if(!is_object(@$User)) {
5
-	require( dirname(__FILE__) . '/../../../functions/functions.php' );
6
-	# classes
7
-	$Database	= new Database_PDO;
8
-	$User 		= new User ($Database);
9
-	$Tools 		= new Tools ($Database);
10
-	$Log		= new Logging ($Database);
11
-	$Result		= new Result ();
5
+    require( dirname(__FILE__) . '/../../../functions/functions.php' );
6
+    # classes
7
+    $Database	= new Database_PDO;
8
+    $User 		= new User ($Database);
9
+    $Tools 		= new Tools ($Database);
10
+    $Log		= new Logging ($Database);
11
+    $Result		= new Result ();
12 12
 }
13 13
 
14 14
 # user must be authenticated
@@ -16,52 +16,52 @@  discard block
 block discarded – undo
16 16
 
17 17
 # if direct request that redirect to tools page
18 18
 if($_SERVER['HTTP_X_REQUESTED_WITH']!="XMLHttpRequest")	{
19
-	header("Location: ".create_link("tools","logs"));
19
+    header("Location: ".create_link("tools","logs"));
20 20
 }
21 21
 
22 22
 # if syslog print
23 23
 if ($User->settings->log=="syslog") {
24
-	$Result->show("warning", _("Log files are sent to syslog"));
24
+    $Result->show("warning", _("Log files are sent to syslog"));
25 25
 }
26 26
 else {
27
-	# print last 5 access logs
28
-	$logs = $Log->fetch_logs(5, NULL, NULL, NULL, 0, 0, 0);
27
+    # print last 5 access logs
28
+    $logs = $Log->fetch_logs(5, NULL, NULL, NULL, 0, 0, 0);
29 29
 
30
-	print "<table class='table table-condensed table-hover table-top'>";
30
+    print "<table class='table table-condensed table-hover table-top'>";
31 31
 
32
-	# headers
33
-	print "<tr>";
34
-	print "	<th>"._('Severity')."</th>";
35
-	print "	<th>"._('Command')."</th>";
36
-	print "	<th>"._('Date')."</th>";
37
-	print "	<th>"._('Username')."</th>";
38
-	print "</tr>";
32
+    # headers
33
+    print "<tr>";
34
+    print "	<th>"._('Severity')."</th>";
35
+    print "	<th>"._('Command')."</th>";
36
+    print "	<th>"._('Date')."</th>";
37
+    print "	<th>"._('Username')."</th>";
38
+    print "</tr>";
39 39
 
40
-	# logs
41
-	foreach($logs as $log) {
42
-		# cast
43
-		$log = (array) $log;
44
-		# reformat severity
45
-		if($log['severity'] == 0)		{ $log['severityText'] = _("Info"); }
46
-		else if($log['severity'] == 1)	{ $log['severityText'] = _("Warn"); }
47
-		else if($log['severity'] == 2)	{ $log['severityText'] = _("Err"); }
40
+    # logs
41
+    foreach($logs as $log) {
42
+        # cast
43
+        $log = (array) $log;
44
+        # reformat severity
45
+        if($log['severity'] == 0)		{ $log['severityText'] = _("Info"); }
46
+        else if($log['severity'] == 1)	{ $log['severityText'] = _("Warn"); }
47
+        else if($log['severity'] == 2)	{ $log['severityText'] = _("Err"); }
48 48
 
49
-		print "<tr>";
50
-		print "	<td><span class='severity$log[severity]'>$log[severityText]</span></td>";
51
-		print "	<td><a class='openLogDetail' data-logid='$log[id]'>$log[command]</a></td>";
52
-		print "	<td>$log[date]</td>";
53
-		print "	<td>$log[username]</td>";
49
+        print "<tr>";
50
+        print "	<td><span class='severity$log[severity]'>$log[severityText]</span></td>";
51
+        print "	<td><a class='openLogDetail' data-logid='$log[id]'>$log[command]</a></td>";
52
+        print "	<td>$log[date]</td>";
53
+        print "	<td>$log[username]</td>";
54 54
 
55
-		print "</tr>";
56
-	}
55
+        print "</tr>";
56
+    }
57 57
 
58
-	print "</table>";
58
+    print "</table>";
59 59
 
60
-	# print if none
61
-	if(sizeof($logs) == 0) {
62
-		print "<blockquote style='margin-top:20px;margin-left:20px;'>";
63
-		print "<p>"._("No logs available")."</p>";
64
-		print "</blockquote>";
65
-	}
60
+    # print if none
61
+    if(sizeof($logs) == 0) {
62
+        print "<blockquote style='margin-top:20px;margin-left:20px;'>";
63
+        print "<p>"._("No logs available")."</p>";
64
+        print "</blockquote>";
65
+    }
66 66
 }
67 67
 ?>
68 68
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@
 block discarded – undo
15 15
 $User->check_user_session ();
16 16
 
17 17
 # if direct request that redirect to tools page
18
-if($_SERVER['HTTP_X_REQUESTED_WITH']!="XMLHttpRequest")	{
18
+if($_SERVER['HTTP_X_REQUESTED_WITH']!="XMLHttpRequest") {
19 19
 	header("Location: ".create_link("tools","logs"));
20 20
 }
21 21
 
Please login to merge, or discard this patch.
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 # required functions
4
-if(!is_object(@$User)) {
5
-	require( dirname(__FILE__) . '/../../../functions/functions.php' );
4
+if (!is_object (@$User)) {
5
+	require(dirname (__FILE__).'/../../../functions/functions.php');
6 6
 	# classes
7
-	$Database	= new Database_PDO;
8
-	$User 		= new User ($Database);
7
+	$Database = new Database_PDO;
8
+	$User = new User ($Database);
9 9
 	$Tools 		= new Tools ($Database);
10
-	$Log		= new Logging ($Database);
10
+	$Log = new Logging ($Database);
11 11
 	$Result		= new Result ();
12 12
 }
13 13
 
@@ -15,36 +15,36 @@  discard block
 block discarded – undo
15 15
 $User->check_user_session ();
16 16
 
17 17
 # if direct request that redirect to tools page
18
-if($_SERVER['HTTP_X_REQUESTED_WITH']!="XMLHttpRequest")	{
19
-	header("Location: ".create_link("tools","logs"));
18
+if ($_SERVER['HTTP_X_REQUESTED_WITH'] != "XMLHttpRequest") {
19
+	header ("Location: ".create_link ("tools", "logs"));
20 20
 }
21 21
 
22 22
 # if syslog print
23
-if ($User->settings->log=="syslog") {
24
-	$Result->show("warning", _("Log files are sent to syslog"));
23
+if ($User->settings->log == "syslog") {
24
+	$Result->show ("warning", _ ("Log files are sent to syslog"));
25 25
 }
26 26
 else {
27 27
 	# print last 5 access logs
28
-	$logs = $Log->fetch_logs(5, NULL, NULL, NULL, 0, 0, 0);
28
+	$logs = $Log->fetch_logs (5, NULL, NULL, NULL, 0, 0, 0);
29 29
 
30 30
 	print "<table class='table table-condensed table-hover table-top'>";
31 31
 
32 32
 	# headers
33 33
 	print "<tr>";
34
-	print "	<th>"._('Severity')."</th>";
35
-	print "	<th>"._('Command')."</th>";
36
-	print "	<th>"._('Date')."</th>";
37
-	print "	<th>"._('Username')."</th>";
34
+	print "	<th>"._ ('Severity')."</th>";
35
+	print "	<th>"._ ('Command')."</th>";
36
+	print "	<th>"._ ('Date')."</th>";
37
+	print "	<th>"._ ('Username')."</th>";
38 38
 	print "</tr>";
39 39
 
40 40
 	# logs
41
-	foreach($logs as $log) {
41
+	foreach ($logs as $log) {
42 42
 		# cast
43 43
 		$log = (array) $log;
44 44
 		# reformat severity
45
-		if($log['severity'] == 0)		{ $log['severityText'] = _("Info"); }
46
-		else if($log['severity'] == 1)	{ $log['severityText'] = _("Warn"); }
47
-		else if($log['severity'] == 2)	{ $log['severityText'] = _("Err"); }
45
+		if ($log['severity'] == 0) { $log['severityText'] = _ ("Info"); }
46
+		else if ($log['severity'] == 1) { $log['severityText'] = _ ("Warn"); }
47
+		else if ($log['severity'] == 2) { $log['severityText'] = _ ("Err"); }
48 48
 
49 49
 		print "<tr>";
50 50
 		print "	<td><span class='severity$log[severity]'>$log[severityText]</span></td>";
@@ -58,9 +58,9 @@  discard block
 block discarded – undo
58 58
 	print "</table>";
59 59
 
60 60
 	# print if none
61
-	if(sizeof($logs) == 0) {
61
+	if (sizeof ($logs) == 0) {
62 62
 		print "<blockquote style='margin-top:20px;margin-left:20px;'>";
63
-		print "<p>"._("No logs available")."</p>";
63
+		print "<p>"._ ("No logs available")."</p>";
64 64
 		print "</blockquote>";
65 65
 	}
66 66
 }
Please login to merge, or discard this patch.
app/dashboard/widget-popup.php 3 patches
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -28,26 +28,26 @@
 block discarded – undo
28 28
 <!-- content -->
29 29
 <div class="pContent">
30 30
 	<?php
31
-	print "<ul id='sortablePopup' class='sortable'>";
32
-	# print widghets that are not yet selected
33
-	$m = 0;
34
-	foreach($widgets as $k=>$w) {
35
-		if(!in_array($k, $uwidgets))	{
36
-			$wtmp = (array) $widgets[$k];
37
-			# size fix
38
-			if(strlen($wtmp['wsize'])==0)	{ $wtmp['wsize']=6; }
39
-			print "<li id='$k'>";
40
-			print "	<a href='' class='btn btn-xs fa-marg-right  btn-default widget-add' id='w-$wtmp[wfile]' data-size='$wtmp[wsize]' data-htitle='$wtmp[wtitle]'><i class='fa fa-plus'></i></a>"._($wtmp['wtitle']);
41
-			print "	<div class='muted' style='margin-left:27px;'>"._($wtmp['wdescription'])."</div>";
42
-			print "</li>";
43
-			$m++;
44
-		}
45
-	}
46
-	print "</ul>";
47
-
48
-	# print empty
49
-	if($m==0)	{ $Result->show("info", _("All available widgets are already on dashboard"), false); }
50
-	?>
31
+    print "<ul id='sortablePopup' class='sortable'>";
32
+    # print widghets that are not yet selected
33
+    $m = 0;
34
+    foreach($widgets as $k=>$w) {
35
+        if(!in_array($k, $uwidgets))	{
36
+            $wtmp = (array) $widgets[$k];
37
+            # size fix
38
+            if(strlen($wtmp['wsize'])==0)	{ $wtmp['wsize']=6; }
39
+            print "<li id='$k'>";
40
+            print "	<a href='' class='btn btn-xs fa-marg-right  btn-default widget-add' id='w-$wtmp[wfile]' data-size='$wtmp[wsize]' data-htitle='$wtmp[wtitle]'><i class='fa fa-plus'></i></a>"._($wtmp['wtitle']);
41
+            print "	<div class='muted' style='margin-left:27px;'>"._($wtmp['wdescription'])."</div>";
42
+            print "</li>";
43
+            $m++;
44
+        }
45
+    }
46
+    print "</ul>";
47
+
48
+    # print empty
49
+    if($m==0)	{ $Result->show("info", _("All available widgets are already on dashboard"), false); }
50
+    ?>
51 51
 </div>
52 52
 
53 53
 <!-- footer -->
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@
 block discarded – undo
32 32
 	# print widghets that are not yet selected
33 33
 	$m = 0;
34 34
 	foreach($widgets as $k=>$w) {
35
-		if(!in_array($k, $uwidgets))	{
35
+		if(!in_array($k, $uwidgets)) {
36 36
 			$wtmp = (array) $widgets[$k];
37 37
 			# size fix
38 38
 			if(strlen($wtmp['wsize'])==0)	{ $wtmp['wsize']=6; }
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 # show available widgets
4
-require(dirname(__FILE__) . '../../../functions/functions.php');
4
+require(dirname (__FILE__).'../../../functions/functions.php');
5 5
 
6 6
 # Classes
7
-$Database	= new Database_PDO;
8
-$User 		= new User ($Database);
7
+$Database = new Database_PDO;
8
+$User = new User ($Database);
9 9
 $Tools 		= new Tools ($Database);
10 10
 $Result 	= new Result ();
11 11
 
@@ -13,17 +13,17 @@  discard block
 block discarded – undo
13 13
 $User->check_user_session (false);
14 14
 
15 15
 # user widgets form database
16
-$uwidgets = explode(";",$User->user->widgets);	//selected
17
-$uwidgets = array_filter((array) $uwidgets);
16
+$uwidgets = explode (";", $User->user->widgets); //selected
17
+$uwidgets = array_filter ((array) $uwidgets);
18 18
 
19 19
 # fetch all widgets
20
-$widgets = $Tools->fetch_widgets ($User->is_admin(false), false);
20
+$widgets = $Tools->fetch_widgets ($User->is_admin (false), false);
21 21
 $widgets = (array) $widgets;
22 22
 
23 23
 ?>
24 24
 
25 25
 <!-- header -->
26
-<div class="pHeader"><?php print _('Add new widget to dashboard'); ?></div>
26
+<div class="pHeader"><?php print _ ('Add new widget to dashboard'); ?></div>
27 27
 
28 28
 <!-- content -->
29 29
 <div class="pContent">
@@ -31,14 +31,14 @@  discard block
 block discarded – undo
31 31
 	print "<ul id='sortablePopup' class='sortable'>";
32 32
 	# print widghets that are not yet selected
33 33
 	$m = 0;
34
-	foreach($widgets as $k=>$w) {
35
-		if(!in_array($k, $uwidgets))	{
34
+	foreach ($widgets as $k=>$w) {
35
+		if (!in_array ($k, $uwidgets)) {
36 36
 			$wtmp = (array) $widgets[$k];
37 37
 			# size fix
38
-			if(strlen($wtmp['wsize'])==0)	{ $wtmp['wsize']=6; }
38
+			if (strlen ($wtmp['wsize']) == 0) { $wtmp['wsize'] = 6; }
39 39
 			print "<li id='$k'>";
40
-			print "	<a href='' class='btn btn-xs fa-marg-right  btn-default widget-add' id='w-$wtmp[wfile]' data-size='$wtmp[wsize]' data-htitle='$wtmp[wtitle]'><i class='fa fa-plus'></i></a>"._($wtmp['wtitle']);
41
-			print "	<div class='muted' style='margin-left:27px;'>"._($wtmp['wdescription'])."</div>";
40
+			print "	<a href='' class='btn btn-xs fa-marg-right  btn-default widget-add' id='w-$wtmp[wfile]' data-size='$wtmp[wsize]' data-htitle='$wtmp[wtitle]'><i class='fa fa-plus'></i></a>"._ ($wtmp['wtitle']);
41
+			print "	<div class='muted' style='margin-left:27px;'>"._ ($wtmp['wdescription'])."</div>";
42 42
 			print "</li>";
43 43
 			$m++;
44 44
 		}
@@ -46,11 +46,11 @@  discard block
 block discarded – undo
46 46
 	print "</ul>";
47 47
 
48 48
 	# print empty
49
-	if($m==0)	{ $Result->show("info", _("All available widgets are already on dashboard"), false); }
49
+	if ($m == 0) { $Result->show ("info", _ ("All available widgets are already on dashboard"), false); }
50 50
 	?>
51 51
 </div>
52 52
 
53 53
 <!-- footer -->
54 54
 <div class="pFooter">
55
-	<button class="btn btn-sm btn-default hidePopups"><?php print _('Cancel'); ?></button>
55
+	<button class="btn btn-sm btn-default hidePopups"><?php print _ ('Cancel'); ?></button>
56 56
 </div>
57 57
\ No newline at end of file
Please login to merge, or discard this patch.
app/dashboard/index.php 2 patches
Indentation   +67 added lines, -67 removed lines patch added patch discarded remove patch
@@ -94,20 +94,20 @@  discard block
 block discarded – undo
94 94
 
95 95
 # if user has no groups and is not admin print warning
96 96
 if ($User->isadmin!==true && (strlen($User->user->groups)==0 || $User->user->groups==="null") ) {
97
-	print '<div class="row-fluid">';
98
-	print "	<div class='col-xs-12 col-sm-12 col-md-12 col-lg-12' style='min-height:10px'>";
99
-	print "	<div class='inner' style='min-height:10px'>";
100
-	print " <h4>"._("No groups")."</h4>";
101
-	print "	<div class='hContent'>";
102
-	print "		<div class='alert alert-info' style='margin:10px;'>"._("You are not member of any group. Please contact system administrator!")."</div>";
103
-	print "	</div>";
104
-	print "	</div>";
105
-	print "	</div>";
106
-	print "</div>";
107
-	print "<div class='clearfix'></div>";
108
-
109
-	// reset uwidgets
110
-	$uwidgets = array("tools", "ipcalc");
97
+    print '<div class="row-fluid">';
98
+    print "	<div class='col-xs-12 col-sm-12 col-md-12 col-lg-12' style='min-height:10px'>";
99
+    print "	<div class='inner' style='min-height:10px'>";
100
+    print " <h4>"._("No groups")."</h4>";
101
+    print "	<div class='hContent'>";
102
+    print "		<div class='alert alert-info' style='margin:10px;'>"._("You are not member of any group. Please contact system administrator!")."</div>";
103
+    print "	</div>";
104
+    print "	</div>";
105
+    print "	</div>";
106
+    print "</div>";
107
+    print "<div class='clearfix'></div>";
108
+
109
+    // reset uwidgets
110
+    $uwidgets = array("tools", "ipcalc");
111 111
 }
112 112
 
113 113
 # split widgets to rows (chunks)
@@ -115,22 +115,22 @@  discard block
 block discarded – undo
115 115
 $m=0;							//to calculate chunk index
116 116
 
117 117
 foreach($uwidgets as $uk=>$uv) {
118
-	//get fetails
119
-	$wdet = (array) $widgets[$uv];
120
-	if(strlen($wdet['wsize'])==0)	{ $wsize = 6; }
121
-	else							{ $wsize = $wdet['wsize']; }
122
-
123
-	//calculate current size
124
-	$currSize = $currSize + $wsize;
125
-
126
-	//ok, we have sizes, we need to split them into chunks of 12
127
-	if($currSize > 12) {
128
-		$m++; 					//new index
129
-		$currSize = $wsize; 	//reset size
130
-	}
131
-
132
-	//add to array
133
-	$uwidgetschunk[$m][] = $uv;
118
+    //get fetails
119
+    $wdet = (array) $widgets[$uv];
120
+    if(strlen($wdet['wsize'])==0)	{ $wsize = 6; }
121
+    else							{ $wsize = $wdet['wsize']; }
122
+
123
+    //calculate current size
124
+    $currSize = $currSize + $wsize;
125
+
126
+    //ok, we have sizes, we need to split them into chunks of 12
127
+    if($currSize > 12) {
128
+        $m++; 					//new index
129
+        $currSize = $wsize; 	//reset size
130
+    }
131
+
132
+    //add to array
133
+    $uwidgetschunk[$m][] = $uv;
134 134
 }
135 135
 
136 136
 # print
@@ -140,46 +140,46 @@  discard block
 block discarded – undo
140 140
 
141 141
 if(sizeof($uwidgets)>1) {
142 142
 
143
-	print '<div class="row-fluid">';
144
-
145
-	foreach($uwidgetschunk as $w) {
146
-		# print itams in a row
147
-		foreach($w as $c) {
148
-
149
-			/* print items */
150
-			$wdet = (array) $widgets[$c];
151
-			if(array_key_exists($c, $widgets)) {
152
-				//reset size if not set
153
-				if(strlen($wdet['wsize'])==0)	{ $wdet['wsize'] = 6; }
154
-
155
-				print "	<div class='col-xs-12 col-sm-12 col-md-12 col-lg-$wdet[wsize] widget-dash' id='w-$wdet[wfile]'>";
156
-				print "	<div class='inner'><i class='fa fa-times remove-widget icon-action fa-gray pull-right'></i>";
157
-				// href?
158
-				if($wdet['whref']=="yes")	{ print "<a href='".create_link("widgets",$wdet['wfile'])."'> <h4>"._($wdet['wtitle'])."<i class='fa fa-external-link fa-gray pull-right'></i></h4></a>"; }
159
-				else						{ print "<h4>"._($wdet['wtitle'])."</h4>"; }
160
-				print "		<div class='hContent'>";
161
-				print "			<div style='text-align:center;padding-top:50px;'><strong>"._('Loading statistics')."</strong><br><i class='fa fa-spinner fa-spin'></i></div>";
162
-				print "		</div>";
163
-				print "	</div>";
164
-				print "	</div>";
165
-
166
-			}
167
-			# invalid widget
168
-			else {
169
-				print "	<div class='col-xs-12 col-sm-12 col-md-12 col-lg-6' id='w-$c'>";
170
-				print "	<div class='inner'>";
171
-				print "		<blockquote style='margin-top:20px;margin-left:20px;'><p>Invalid widget $c</p></blockquote>";
172
-				print "	</div>";
173
-				print "	</div>";
174
-			}
175
-
176
-		}
177
-	}
178
-	print "</div>";
143
+    print '<div class="row-fluid">';
144
+
145
+    foreach($uwidgetschunk as $w) {
146
+        # print itams in a row
147
+        foreach($w as $c) {
148
+
149
+            /* print items */
150
+            $wdet = (array) $widgets[$c];
151
+            if(array_key_exists($c, $widgets)) {
152
+                //reset size if not set
153
+                if(strlen($wdet['wsize'])==0)	{ $wdet['wsize'] = 6; }
154
+
155
+                print "	<div class='col-xs-12 col-sm-12 col-md-12 col-lg-$wdet[wsize] widget-dash' id='w-$wdet[wfile]'>";
156
+                print "	<div class='inner'><i class='fa fa-times remove-widget icon-action fa-gray pull-right'></i>";
157
+                // href?
158
+                if($wdet['whref']=="yes")	{ print "<a href='".create_link("widgets",$wdet['wfile'])."'> <h4>"._($wdet['wtitle'])."<i class='fa fa-external-link fa-gray pull-right'></i></h4></a>"; }
159
+                else						{ print "<h4>"._($wdet['wtitle'])."</h4>"; }
160
+                print "		<div class='hContent'>";
161
+                print "			<div style='text-align:center;padding-top:50px;'><strong>"._('Loading statistics')."</strong><br><i class='fa fa-spinner fa-spin'></i></div>";
162
+                print "		</div>";
163
+                print "	</div>";
164
+                print "	</div>";
165
+
166
+            }
167
+            # invalid widget
168
+            else {
169
+                print "	<div class='col-xs-12 col-sm-12 col-md-12 col-lg-6' id='w-$c'>";
170
+                print "	<div class='inner'>";
171
+                print "		<blockquote style='margin-top:20px;margin-left:20px;'><p>Invalid widget $c</p></blockquote>";
172
+                print "	</div>";
173
+                print "	</div>";
174
+            }
175
+
176
+        }
177
+    }
178
+    print "</div>";
179 179
 }
180 180
 # empty
181 181
 else {
182
-	print "<br><div class='alert alert-warning'><strong>"._('No widgets selected')."!</strong> <hr>"._('Please select widgets to be displayed on dashboard on user menu page')."!</div>";
182
+    print "<br><div class='alert alert-warning'><strong>"._('No widgets selected')."!</strong> <hr>"._('Please select widgets to be displayed on dashboard on user menu page')."!</div>";
183 183
 }
184 184
 ?>
185 185
 <hr>
186 186
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  *******************************************/
7 7
 
8 8
 # verify that user is logged in
9
-$User->check_user_session();
9
+$User->check_user_session ();
10 10
 
11 11
 ?>
12 12
 <script type="text/javascript">
@@ -86,20 +86,20 @@  discard block
 block discarded – undo
86 86
 <?php
87 87
 
88 88
 # fetch all widgets
89
-$widgets = $Tools->fetch_widgets ($User->is_admin(false), false);
89
+$widgets = $Tools->fetch_widgets ($User->is_admin (false), false);
90 90
 $widgets = (array) $widgets;
91 91
 
92 92
 # show user-selected widgets
93
-$uwidgets = array_filter(explode(";",$User->user->widgets));
93
+$uwidgets = array_filter (explode (";", $User->user->widgets));
94 94
 
95 95
 # if user has no groups and is not admin print warning
96
-if ($User->is_admin(false)!==true && (strlen($User->user->groups)==0 || $User->user->groups==="null") ) {
96
+if ($User->is_admin (false) !== true && (strlen ($User->user->groups) == 0 || $User->user->groups === "null")) {
97 97
 	print '<div class="row-fluid">';
98 98
 	print "	<div class='col-xs-12 col-sm-12 col-md-12 col-lg-12' style='min-height:10px'>";
99 99
 	print "	<div class='inner' style='min-height:10px'>";
100
-	print " <h4>"._("No groups")."</h4>";
100
+	print " <h4>"._ ("No groups")."</h4>";
101 101
 	print "	<div class='hContent'>";
102
-	print "		<div class='alert alert-info' style='margin:10px;'>"._("You are not member of any group. Please contact system administrator!")."</div>";
102
+	print "		<div class='alert alert-info' style='margin:10px;'>"._ ("You are not member of any group. Please contact system administrator!")."</div>";
103 103
 	print "	</div>";
104 104
 	print "	</div>";
105 105
 	print "	</div>";
@@ -107,26 +107,26 @@  discard block
 block discarded – undo
107 107
 	print "<div class='clearfix'></div>";
108 108
 
109 109
 	// reset uwidgets
110
-	$uwidgets = array("tools", "ipcalc");
110
+	$uwidgets = array ("tools", "ipcalc");
111 111
 }
112 112
 
113 113
 # split widgets to rows (chunks)
114
-$currSize = 0;					//to calculate size
115
-$m=0;							//to calculate chunk index
114
+$currSize = 0; //to calculate size
115
+$m = 0; //to calculate chunk index
116 116
 
117
-foreach($uwidgets as $uk=>$uv) {
117
+foreach ($uwidgets as $uk=>$uv) {
118 118
 	//get fetails
119 119
 	$wdet = (array) $widgets[$uv];
120
-	if(strlen($wdet['wsize'])==0)	{ $wsize = 6; }
121
-	else							{ $wsize = $wdet['wsize']; }
120
+	if (strlen ($wdet['wsize']) == 0) { $wsize = 6; }
121
+	else { $wsize = $wdet['wsize']; }
122 122
 
123 123
 	//calculate current size
124 124
 	$currSize = $currSize + $wsize;
125 125
 
126 126
 	//ok, we have sizes, we need to split them into chunks of 12
127
-	if($currSize > 12) {
128
-		$m++; 					//new index
129
-		$currSize = $wsize; 	//reset size
127
+	if ($currSize > 12) {
128
+		$m++; //new index
129
+		$currSize = $wsize; //reset size
130 130
 	}
131 131
 
132 132
 	//add to array
@@ -138,27 +138,27 @@  discard block
 block discarded – undo
138 138
 print "	<a href='' class='btn btn-sm btn-default btn-success add-new-widget'><i class='fa fa-plus'></i> Add new widget</a>";
139 139
 print "</div>";
140 140
 
141
-if(sizeof($uwidgets)>1) {
141
+if (sizeof ($uwidgets) > 1) {
142 142
 
143 143
 	print '<div class="row-fluid">';
144 144
 
145
-	foreach($uwidgetschunk as $w) {
145
+	foreach ($uwidgetschunk as $w) {
146 146
 		# print itams in a row
147
-		foreach($w as $c) {
147
+		foreach ($w as $c) {
148 148
 
149 149
 			/* print items */
150 150
 			$wdet = (array) $widgets[$c];
151
-			if(array_key_exists($c, $widgets)) {
151
+			if (array_key_exists ($c, $widgets)) {
152 152
 				//reset size if not set
153
-				if(strlen($wdet['wsize'])==0)	{ $wdet['wsize'] = 6; }
153
+				if (strlen ($wdet['wsize']) == 0) { $wdet['wsize'] = 6; }
154 154
 
155 155
 				print "	<div class='col-xs-12 col-sm-12 col-md-12 col-lg-$wdet[wsize] widget-dash' id='w-$wdet[wfile]'>";
156 156
 				print "	<div class='inner'><i class='fa fa-times remove-widget icon-action fa-gray pull-right'></i>";
157 157
 				// href?
158
-				if($wdet['whref']=="yes")	{ print "<a href='".create_link("widgets",$wdet['wfile'])."'> <h4>"._($wdet['wtitle'])."<i class='fa fa-external-link fa-gray pull-right'></i></h4></a>"; }
159
-				else						{ print "<h4>"._($wdet['wtitle'])."</h4>"; }
158
+				if ($wdet['whref'] == "yes") { print "<a href='".create_link ("widgets", $wdet['wfile'])."'> <h4>"._ ($wdet['wtitle'])."<i class='fa fa-external-link fa-gray pull-right'></i></h4></a>"; }
159
+				else { print "<h4>"._ ($wdet['wtitle'])."</h4>"; }
160 160
 				print "		<div class='hContent'>";
161
-				print "			<div style='text-align:center;padding-top:50px;'><strong>"._('Loading statistics')."</strong><br><i class='fa fa-spinner fa-spin'></i></div>";
161
+				print "			<div style='text-align:center;padding-top:50px;'><strong>"._ ('Loading statistics')."</strong><br><i class='fa fa-spinner fa-spin'></i></div>";
162 162
 				print "		</div>";
163 163
 				print "	</div>";
164 164
 				print "	</div>";
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
 }
180 180
 # empty
181 181
 else {
182
-	print "<br><div class='alert alert-warning'><strong>"._('No widgets selected')."!</strong> <hr>"._('Please select widgets to be displayed on dashboard on user menu page')."!</div>";
182
+	print "<br><div class='alert alert-warning'><strong>"._ ('No widgets selected')."!</strong> <hr>"._ ('Please select widgets to be displayed on dashboard on user menu page')."!</div>";
183 183
 }
184 184
 ?>
185 185
 <hr>
186 186
\ No newline at end of file
Please login to merge, or discard this patch.
app/install/install_automatic.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -74,7 +74,7 @@
 block discarded – undo
74 74
 				<hr>
75 75
 				<div class="btn-block">
76 76
 					<!-- Back -->
77
-					<a class="btn btn-sm btn-default" href="<?php print create_link("install",null,null,null,null,true); ?>" ><i class='fa fa-angle-left'></i> Back</a>
77
+					<a class="btn btn-sm btn-default" href="<?php print create_link ("install", null, null, null, null, true); ?>" ><i class='fa fa-angle-left'></i> Back</a>
78 78
 					<a class="install btn btn-sm btn-info" version="0">Install phpipam database</a>
79 79
 				</div>
80 80
 			</div>
Please login to merge, or discard this patch.
app/install/postinstall_configure.php 2 patches
Indentation   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -10,40 +10,40 @@
 block discarded – undo
10 10
 		<hr>
11 11
 
12 12
 		<?php
13
-		# lets verify database
14
-		$errors = $Tools->verify_database ();
15
-
16
-		/* print result */
17
-		if( (isset($errors['tableError'])) || (isset($errors['fieldError'])) ) {
18
-
19
-			print "<div class='alert alert-danger alert-block'>";
20
-			print "<strong>Some tables or fields are missing in database:</strong><hr>";
21
-
22
-			//tables
23
-			if (isset($errors['tableError'])) {
24
-				print '<b>Missing tables:</b>'. "\n";
25
-				print '<ul class="fix-table">'. "\n";
26
-				foreach ($errors['tableError'] as $table) {
27
-					print "<li>$table</li>";
28
-				}
29
-				print '</ul>'. "\n";
30
-			}
31
-			//fields
32
-			if (isset($errors['fieldError'])) {
33
-				print '<b>Missing fields:</b>'. "\n";
34
-				print '<ul class="fix-field">'. "\n";
35
-				foreach ($errors['fieldError'] as $table=>$field) {
36
-					print '<li>';
37
-					print 'Table `'. $table .'`: missing field `'. $field .'`;';
38
-					print '</li>'. "\n";
39
-				}
40
-				print '</ul>'. "\n";
41
-			}
42
-			print "</div>";
43
-		}
44
-		# no db errors, lets configure !
45
-		else {
46
-		?>
13
+        # lets verify database
14
+        $errors = $Tools->verify_database ();
15
+
16
+        /* print result */
17
+        if( (isset($errors['tableError'])) || (isset($errors['fieldError'])) ) {
18
+
19
+            print "<div class='alert alert-danger alert-block'>";
20
+            print "<strong>Some tables or fields are missing in database:</strong><hr>";
21
+
22
+            //tables
23
+            if (isset($errors['tableError'])) {
24
+                print '<b>Missing tables:</b>'. "\n";
25
+                print '<ul class="fix-table">'. "\n";
26
+                foreach ($errors['tableError'] as $table) {
27
+                    print "<li>$table</li>";
28
+                }
29
+                print '</ul>'. "\n";
30
+            }
31
+            //fields
32
+            if (isset($errors['fieldError'])) {
33
+                print '<b>Missing fields:</b>'. "\n";
34
+                print '<ul class="fix-field">'. "\n";
35
+                foreach ($errors['fieldError'] as $table=>$field) {
36
+                    print '<li>';
37
+                    print 'Table `'. $table .'`: missing field `'. $field .'`;';
38
+                    print '</li>'. "\n";
39
+                }
40
+                print '</ul>'. "\n";
41
+            }
42
+            print "</div>";
43
+        }
44
+        # no db errors, lets configure !
45
+        else {
46
+        ?>
47 47
 
48 48
 
49 49
 		<form name="postinstall" id="postinstall" class="form-inline" method="post">
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -14,30 +14,30 @@  discard block
 block discarded – undo
14 14
 		$errors = $Tools->verify_database ();
15 15
 
16 16
 		/* print result */
17
-		if( (isset($errors['tableError'])) || (isset($errors['fieldError'])) ) {
17
+		if ((isset($errors['tableError'])) || (isset($errors['fieldError']))) {
18 18
 
19 19
 			print "<div class='alert alert-danger alert-block'>";
20 20
 			print "<strong>Some tables or fields are missing in database:</strong><hr>";
21 21
 
22 22
 			//tables
23 23
 			if (isset($errors['tableError'])) {
24
-				print '<b>Missing tables:</b>'. "\n";
25
-				print '<ul class="fix-table">'. "\n";
24
+				print '<b>Missing tables:</b>'."\n";
25
+				print '<ul class="fix-table">'."\n";
26 26
 				foreach ($errors['tableError'] as $table) {
27 27
 					print "<li>$table</li>";
28 28
 				}
29
-				print '</ul>'. "\n";
29
+				print '</ul>'."\n";
30 30
 			}
31 31
 			//fields
32 32
 			if (isset($errors['fieldError'])) {
33
-				print '<b>Missing fields:</b>'. "\n";
34
-				print '<ul class="fix-field">'. "\n";
33
+				print '<b>Missing fields:</b>'."\n";
34
+				print '<ul class="fix-field">'."\n";
35 35
 				foreach ($errors['fieldError'] as $table=>$field) {
36 36
 					print '<li>';
37
-					print 'Table `'. $table .'`: missing field `'. $field .'`;';
38
-					print '</li>'. "\n";
37
+					print 'Table `'.$table.'`: missing field `'.$field.'`;';
38
+					print '</li>'."\n";
39 39
 				}
40
-				print '</ul>'. "\n";
40
+				print '</ul>'."\n";
41 41
 			}
42 42
 			print "</div>";
43 43
 		}
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 			<!-- Database location -->
78 78
 			<div class="col-xs-12 col-md-4"><strong>Site URL</strong></div>
79 79
 			<div class="col-xs-12 col-md-8">
80
-				<input type="text" style="width:100%;" name="siteURL" class="form-control" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" value="<?php print $_SERVER['SCRIPT_URI'];  ?>">
80
+				<input type="text" style="width:100%;" name="siteURL" class="form-control" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" value="<?php print $_SERVER['SCRIPT_URI']; ?>">
81 81
 				<div class="text-muted"></div>
82 82
 			</div>
83 83
 
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 				<hr>
87 87
 				<div class="btn-block">
88 88
 					<!-- Back -->
89
-					<a class="btn btn-sm btn-default" href="<?php print create_link("install","install_automatic",null,null,null,true); ?>" ><i class='fa fa-angle-left'></i> Back</a>
89
+					<a class="btn btn-sm btn-default" href="<?php print create_link ("install", "install_automatic", null, null, null, true); ?>" ><i class='fa fa-angle-left'></i> Back</a>
90 90
 					<input type="submit" class="btn btn-sm btn-info" version="0" value="Save settings">
91 91
 				</div>
92 92
 			</div>
Please login to merge, or discard this patch.
app/install/install_manual.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
 	<div style="padding:10px;">
7 7
 
8 8
 		<!-- Back -->
9
-		<a href="<?php print create_link("install",null,null,null,null,true); ?>" class="btn btn-sm btn-default"><i class='fa fa-angle-left'></i> Back</a>
9
+		<a href="<?php print create_link ("install", null, null, null, null, true); ?>" class="btn btn-sm btn-default"><i class='fa fa-angle-left'></i> Back</a>
10 10
 		<!-- Instructions -->
11 11
 		<div style="margin-top:10px;padding:30px 20px;">
12 12
 			For importing database file with mysqlimport tool please follow below instructions:<hr>
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 					Copy below SQL queries and paste them to mysql
20 20
 				</li>
21 21
 				<li>Finished ! Now login with <strong>Admin/ipamadmin</strong> to webpage<br>
22
-				<a href="<?php print create_link(null,null,null,null,null,true); ?>" class="btn btn-sm btn-info">Login</a>
22
+				<a href="<?php print create_link (null, null, null, null, null, true); ?>" class="btn btn-sm btn-info">Login</a>
23 23
 				</li>
24 24
 			</ol> 
25 25
 			<hr>
@@ -44,8 +44,8 @@  discard block
 block discarded – undo
44 44
 $file .= "# Create tables and import data\n";
45 45
 $file .= "# ------------------------------------------------------------\n\n\n\n";
46 46
 
47
-$file .= file_get_contents("db/SCHEMA.sql"); 
48
-print_r($file); ?>
47
+$file .= file_get_contents ("db/SCHEMA.sql"); 
48
+print_r ($file); ?>
49 49
 </pre>
50 50
 		</div>
51 51
 			
Please login to merge, or discard this patch.
app/install/postinstall_submit.php 2 patches
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -17,23 +17,23 @@
 block discarded – undo
17 17
 # only permit if Admin user has default pass !!!
18 18
 $admin = $Admin->fetch_object ("users","username","Admin");
19 19
 if($admin->password!='$6$rounds=3000$JQEE6dL9NpvjeFs4$RK5X3oa28.Uzt/h5VAfdrsvlVe.7HgQUYKMXTJUsud8dmWfPzZQPbRbk8xJn1Kyyt4.dWm4nJIYhAV2mbOZ3g.') {
20
-	$Result->show("danger", "Not allowed!", true);
20
+    $Result->show("danger", "Not allowed!", true);
21 21
 }
22 22
 # update
23 23
 else {
24
-	# check lenghts
25
-	if(strlen($_POST['password1'])<8)				{ $Result->show("danger", _("Password must be at least 8 characters long!"), true); }
26
-	if(strlen($_POST['password2'])<8)				{ $Result->show("danger", _("Password must be at least 8 characters long!"), true); }
24
+    # check lenghts
25
+    if(strlen($_POST['password1'])<8)				{ $Result->show("danger", _("Password must be at least 8 characters long!"), true); }
26
+    if(strlen($_POST['password2'])<8)				{ $Result->show("danger", _("Password must be at least 8 characters long!"), true); }
27 27
 
28
-	# check password match
29
-	if($_POST['password1']!=$_POST['password2'])	{ $Result->show("danger", _("Passwords do not match"), true); }
28
+    # check password match
29
+    if($_POST['password1']!=$_POST['password2'])	{ $Result->show("danger", _("Passwords do not match"), true); }
30 30
 
31
-	# Crypt password
32
-	$_POST['password1'] = $User->crypt_user_pass ($_POST['password1']);
31
+    # Crypt password
32
+    $_POST['password1'] = $User->crypt_user_pass ($_POST['password1']);
33 33
 
34
-	# all good, update password!
35
-	$Install->postauth_update($_POST['password1'], $_POST['siteTitle'], $_POST['siteURL']);
36
-	# ok
37
-													{ $Result->show("success", "Settings updated, installation complete!<hr><a class='btn btn-sm btn-default' href='".create_link("login")."'>Proceed to login</a>", false); }
34
+    # all good, update password!
35
+    $Install->postauth_update($_POST['password1'], $_POST['siteTitle'], $_POST['siteURL']);
36
+    # ok
37
+                                                    { $Result->show("success", "Settings updated, installation complete!<hr><a class='btn btn-sm btn-default' href='".create_link("login")."'>Proceed to login</a>", false); }
38 38
 }
39 39
 ?>
40 40
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -5,35 +5,35 @@
 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
 # objects
11
-$Database 	= new Database_PDO;
11
+$Database = new Database_PDO;
12 12
 $Admin 		= new Admin ($Database, false);
13
-$Install 	= new Install ($Database);
14
-$User		= new User ($Database);
13
+$Install = new Install ($Database);
14
+$User = new User ($Database);
15 15
 $Result		= new Result;
16 16
 
17 17
 # only permit if Admin user has default pass !!!
18
-$admin = $Admin->fetch_object ("users","username","Admin");
19
-if($admin->password!='$6$rounds=3000$JQEE6dL9NpvjeFs4$RK5X3oa28.Uzt/h5VAfdrsvlVe.7HgQUYKMXTJUsud8dmWfPzZQPbRbk8xJn1Kyyt4.dWm4nJIYhAV2mbOZ3g.') {
20
-	$Result->show("danger", "Not allowed!", true);
18
+$admin = $Admin->fetch_object ("users", "username", "Admin");
19
+if ($admin->password != '$6$rounds=3000$JQEE6dL9NpvjeFs4$RK5X3oa28.Uzt/h5VAfdrsvlVe.7HgQUYKMXTJUsud8dmWfPzZQPbRbk8xJn1Kyyt4.dWm4nJIYhAV2mbOZ3g.') {
20
+	$Result->show ("danger", "Not allowed!", true);
21 21
 }
22 22
 # update
23 23
 else {
24 24
 	# check lenghts
25
-	if(strlen($_POST['password1'])<8)				{ $Result->show("danger", _("Password must be at least 8 characters long!"), true); }
26
-	if(strlen($_POST['password2'])<8)				{ $Result->show("danger", _("Password must be at least 8 characters long!"), true); }
25
+	if (strlen ($_POST['password1']) < 8) { $Result->show ("danger", _ ("Password must be at least 8 characters long!"), true); }
26
+	if (strlen ($_POST['password2']) < 8) { $Result->show ("danger", _ ("Password must be at least 8 characters long!"), true); }
27 27
 
28 28
 	# check password match
29
-	if($_POST['password1']!=$_POST['password2'])	{ $Result->show("danger", _("Passwords do not match"), true); }
29
+	if ($_POST['password1'] != $_POST['password2']) { $Result->show ("danger", _ ("Passwords do not match"), true); }
30 30
 
31 31
 	# Crypt password
32 32
 	$_POST['password1'] = $User->crypt_user_pass ($_POST['password1']);
33 33
 
34 34
 	# all good, update password!
35
-	$Install->postauth_update($_POST['password1'], $_POST['siteTitle'], $_POST['siteURL']);
35
+	$Install->postauth_update ($_POST['password1'], $_POST['siteTitle'], $_POST['siteURL']);
36 36
 	# ok
37
-													{ $Result->show("success", "Settings updated, installation complete!<hr><a class='btn btn-sm btn-default' href='".create_link("login")."'>Proceed to login</a>", false); }
37
+													{ $Result->show ("success", "Settings updated, installation complete!<hr><a class='btn btn-sm btn-default' href='".create_link ("login")."'>Proceed to login</a>", false); }
38 38
 }
39 39
 ?>
40 40
\ No newline at end of file
Please login to merge, or discard this patch.
app/install/invalid_install_type.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -4,9 +4,9 @@
 block discarded – undo
4 4
 
5 5
 	<div class="hContent">
6 6
 	<div style="padding:10px;">
7
-		<?php $Result->show("danger", "This installation type does not exist. Please select valid installation method!", false); ?>
7
+		<?php $Result->show ("danger", "This installation type does not exist. Please select valid installation method!", false); ?>
8 8
 
9
-		<a href="<?php print create_link("install",null,null,null,null,true); ?>" class="btn btn-sm btn-default"><i class='fa fa-angle-left'></i> Back</a>
9
+		<a href="<?php print create_link ("install", null, null, null, null, true); ?>" class="btn btn-sm btn-default"><i class='fa fa-angle-left'></i> Back</a>
10 10
 
11 11
 	</div>
12 12
 	</div>
Please login to merge, or discard this patch.
app/install/install_mysqlimport.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
 	<div style="padding:10px;">
7 7
 
8 8
 		<!-- Back -->
9
-		<a href="<?php print create_link("install",null,null,null,null,true); ?>" class="btn btn-sm btn-default"><i class='fa fa-angle-left'></i> Back</a>
9
+		<a href="<?php print create_link ("install", null, null, null, null, true); ?>" class="btn btn-sm btn-default"><i class='fa fa-angle-left'></i> Back</a>
10 10
 		<!-- Instructions -->
11 11
 		<div style="margin-top:10px;padding:30px 20px;">
12 12
 			For installation with mysqlimport please follow below steps:<hr>
@@ -27,11 +27,11 @@  discard block
 block discarded – undo
27 27
 				</li>
28 28
 				
29 29
 				<li>Set permissions for phpipam user
30
-				<pre>GRANT ALL on `<?php print $db['name'];?>`.* to <?php print $db['user'];?>@localhost identified by '<?php print $db['pass'];?>';</pre>
30
+				<pre>GRANT ALL on `<?php print $db['name']; ?>`.* to <?php print $db['user']; ?>@localhost identified by '<?php print $db['pass']; ?>';</pre>
31 31
 				</li>
32 32
 				
33 33
 				<li>Finished ! Now login with <strong>Admin/ipamadmin</strong> to webpage<br>
34
-				<a href="<?php print create_link(null,null,null,null,null,true); ?>" class="btn btn-sm btn-info">Login</a>
34
+				<a href="<?php print create_link (null, null, null, null, null, true); ?>" class="btn btn-sm btn-info">Login</a>
35 35
 				</li>
36 36
 			</ol> 
37 37
 			<hr>
Please login to merge, or discard this patch.