GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 62d3cd...ba517c )
by Marco
01:43
created
lookup.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@
 block discarded – undo
11 11
 <h1> DNSBL Lookup</h1> 
12 12
 <?php
13 13
 
14
-$_POST['Value'] = str_replace('_','.',array_keys($_GET)[0]);
14
+$_POST['Value'] = str_replace('_', '.', array_keys($_GET)[0]);
15 15
 $_POST['genere'] = 'Spam IP';
16 16
 require_once('result.php');
17 17
 ?>
Please login to merge, or discard this patch.
contrib/ipImap/function.php 1 patch
Spacing   +132 added lines, -132 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-function getIP($header,$mxserver,$msa) {
2
+function getIP($header, $mxserver, $msa) {
3 3
 /* Get submission server's IP from header's mail */
4 4
 /* Each line must end with /r/n			 */
5 5
 /* IP is the first one written by your mxserver	 */
@@ -7,10 +7,10 @@  discard block
 block discarded – undo
7 7
 	$ip = FALSE;
8 8
 	$host = FALSE;
9 9
 	$dateR = FALSE;
10
-	if ( preg_match_all('/^Received:\sfrom(?:.|\r\n\s)*?[\[\(]\s*(?P<ip>\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})[\]\)](?:.|\r\n\s)+\s+by(?:\s|\r\n\s+)(?P<host>\S+).*(?:\s|\r\n\s\s)+.*;\s+(?P<date>.*)/m',$header,$received) ) {
11
-		for ($i = count($received[0])-1;$i>=0;$i--) {
10
+	if (preg_match_all('/^Received:\sfrom(?:.|\r\n\s)*?[\[\(]\s*(?P<ip>\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})[\]\)](?:.|\r\n\s)+\s+by(?:\s|\r\n\s+)(?P<host>\S+).*(?:\s|\r\n\s\s)+.*;\s+(?P<date>.*)/m', $header, $received)) {
11
+		for ($i = count($received[0])-1; $i>=0; $i--) {
12 12
 #			print "Examine ".$received[0][$i]."\n";
13
-			if ( preg_match($msa,$received['host'][$i]) )
13
+			if (preg_match($msa, $received['host'][$i]))
14 14
 				$dateR = $received['date'][$i];
15 15
         		foreach ($mxserver as $mx) {
16 16
         			if (!$ip)
@@ -21,38 +21,38 @@  discard block
 block discarded – undo
21 21
                 	}
22 22
         	}
23 23
 	}
24
-	if ( preg_match ('/\r\nDate:\s(?P<date>.*)\r\n/',$header,$dateC) != 1)
24
+	if (preg_match('/\r\nDate:\s(?P<date>.*)\r\n/', $header, $dateC) != 1)
25 25
 		$dateC['date'] = 'Not found';
26
-	if ( preg_match ('/\r\nMessage\-I(?:D|d):\s(?P<mid>.*)\r\n/',$header,$mid) != 1)
26
+	if (preg_match('/\r\nMessage\-I(?:D|d):\s(?P<mid>.*)\r\n/', $header, $mid) != 1)
27 27
 		$mid['mid'] = NULL;
28
-	return array($ip,$host,$dateR,$dateC['date'],$mid['mid']);
28
+	return array($ip, $host, $dateR, $dateC['date'], $mid['mid']);
29 29
 }
30 30
 
31
-function updateReport ($ip,$uid,$ipcount,$uidcount,$hostname,$dateC,$msgid,$dateL) {
31
+function updateReport($ip, $uid, $ipcount, $uidcount, $hostname, $dateC, $msgid, $dateL) {
32 32
 
33
-	return sprintf ('<tr><td nowrap>%s</td><td nowrap>%s</td><td>%s</td><td>%s</td><td>%u</td><td>%u</td><td>%s</td><td>%s</td></tr>'."\n",$dateL,$dateC,$uid,$ip,$uidcount,$ipcount,$hostname,htmlentities($msgid) );
33
+	return sprintf('<tr><td nowrap>%s</td><td nowrap>%s</td><td>%s</td><td>%s</td><td>%u</td><td>%u</td><td>%s</td><td>%s</td></tr>'."\n", $dateL, $dateC, $uid, $ip, $uidcount, $ipcount, $hostname, htmlentities($msgid));
34 34
 }
35 35
 
36
-function updatebadReport ( $uid,$dateC,$msgid,$dateL,$text ) {
37
-	return sprintf ('<tr><td nowrap>%s</td><td nowrap>%s</td><td>%s</td><td>%s</td><td nowrap>%s</td></tr>'."\n",$dateL,$dateC,$uid,htmlentities($msgid),$text );
36
+function updatebadReport($uid, $dateC, $msgid, $dateL, $text) {
37
+	return sprintf('<tr><td nowrap>%s</td><td nowrap>%s</td><td>%s</td><td>%s</td><td nowrap>%s</td></tr>'."\n", $dateL, $dateC, $uid, htmlentities($msgid), $text);
38 38
 }
39 39
 
40 40
 
41
-function summaryBadReport ($uidvet) {
41
+function summaryBadReport($uidvet) {
42 42
         $nuid = $uidvet['count'];
43
-        if ( empty($uidvet) ) return NULL;
43
+        if (empty($uidvet)) return NULL;
44 44
         $return = '<hr><h3>Statistics by UID</h3><table><tr><th>UID</th><th>Learned times</th></tr>'."\n";
45 45
 
46 46
         /* Remove count index */
47 47
         $uids = array_keys($uidvet['uid']);
48 48
 	$totlearn = 0;
49 49
 
50
-        foreach ( $uids as $uid ) {
51
-		$totlearn += $uidvet['uid']["$uid"]['count'];; 
52
-		$return .= sprintf ('<tr><td>%s</td><td>%u</td></tr>',$uid,$uidvet['uid']["$uid"]['count']);
50
+        foreach ($uids as $uid) {
51
+		$totlearn += $uidvet['uid']["$uid"]['count']; ; 
52
+		$return .= sprintf('<tr><td>%s</td><td>%u</td></tr>', $uid, $uidvet['uid']["$uid"]['count']);
53 53
 	}
54
-	$return .= sprintf ('<tr><th>%s</th><th>%u</th></tr></table>','TOT',$totlearn);
55
-	$return .= sprintf ('<p>%s : %u</p>','Unique UID',$nuid);
54
+	$return .= sprintf('<tr><th>%s</th><th>%u</th></tr></table>', 'TOT', $totlearn);
55
+	$return .= sprintf('<p>%s : %u</p>', 'Unique UID', $nuid);
56 56
 
57 57
 	return $return;
58 58
 }
@@ -69,12 +69,12 @@  discard block
 block discarded – undo
69 69
     foreach ($cols as $col => $order) {
70 70
         $eval .= '$colarr[\''.$col.'\'],'.$order.',';
71 71
     }
72
-    $eval = substr($eval,0,-1).');';
72
+    $eval = substr($eval, 0, -1).');';
73 73
     eval($eval);
74 74
     $ret = array();
75 75
     foreach ($colarr as $col => $arr) {
76 76
         foreach ($arr as $k => $v) {
77
-            $k = substr($k,1);
77
+            $k = substr($k, 1);
78 78
             if (!isset($ret[$k])) $ret[$k] = $array[$k];
79 79
             if (isset ($array[$k][$col])) $ret[$k][$col] = $array[$k][$col];
80 80
         }
@@ -84,29 +84,29 @@  discard block
 block discarded – undo
84 84
 }
85 85
 
86 86
 
87
-function summaryReportAndList ($cf,$myconn,$tables,$category,$ipvet) {
87
+function summaryReportAndList($cf, $myconn, $tables, $category, $ipvet) {
88 88
 	$nips = $ipvet['count'];
89 89
 
90
-	if ( empty($ipvet) ) return NULL;
90
+	if (empty($ipvet)) return NULL;
91 91
 	$return = '<h3>Statistics by IP</h3><table><tr><th>IP</th><th>Learned by</th><th>Learned times</th><th title="This field doesn\'t say if this ip is currently listed, but it says if this IP has listed now!">Listed Now</th></tr>'."\n";
92 92
 	
93 93
 	$ips = array_keys($ipvet['ip']);
94 94
 
95
-	foreach ( $ips as $ip ) {
96
-		if ( $ip == 'count' ) continue;
95
+	foreach ($ips as $ip) {
96
+		if ($ip == 'count') continue;
97 97
                 $nlearn = $ipvet['ip']["$ip"]['count'];
98 98
                 unset($ipvet['ip']["$ip"]['count']);
99 99
 		$quantity = $cf['quantity']["$category"]; /* In searchAndList this value is passed by reference and modified */
100 100
 		$nuid = count($ipvet['ip']["$ip"]);
101
-		if ( !$cf['onlyReport'] ) {
102
-			if ( ($nlearn >= $cf['thresholdip']["$category"])&&($nuid >= $cf['thresholduid']["$category"]) ) {
101
+		if (!$cf['onlyReport']) {
102
+			if (($nlearn>=$cf['thresholdip']["$category"]) && ($nuid>=$cf['thresholduid']["$category"])) {
103 103
 				$reason = "The IP <$ip> has been listed because was marked $nlearn times as $category by $nuid different accounts during last ".$cf['oldestday'].' days.';
104
-				$listed = searchAndList ($myconn,$cf['user'],$tables,$cf['list']["$category"],$ip,$cf['unit']["$category"],$quantity,$reason);
104
+				$listed = searchAndList($myconn, $cf['user'], $tables, $cf['list']["$category"], $ip, $cf['unit']["$category"], $quantity, $reason);
105 105
 			}
106 106
 			else $listed = FALSE;
107 107
 		}
108 108
 		else $listed = FALSE;
109
-		$nowlist = array( TRUE =>  array(
109
+		$nowlist = array(TRUE =>  array(
110 110
 					'style' => 'id=\'ipfound\'',
111 111
 					'name'  => 'YES',
112 112
 				  ),
@@ -120,45 +120,45 @@  discard block
 block discarded – undo
120 120
 				  )
121 121
 		);
122 122
 		
123
-		$return .='<tr><td rowspan="'.$nuid.'">'.$ip.'</td>';
124
-		$return .= sprintf ('<td>%s</td><td rowspan="'.$nuid.'">%u</td><td rowspan="'.$nuid.'" '.$nowlist["$listed"]['style'].'>%s</td></tr>',$ipvet['ip']["$ip"][0],$nlearn,$nowlist["$listed"]['name']);
125
-		$rowuid=NULL;
126
-                for ($j=1;$j<$nuid;$j++) $rowuid .= '<tr><td>%s</td></tr>';
123
+		$return .= '<tr><td rowspan="'.$nuid.'">'.$ip.'</td>';
124
+		$return .= sprintf('<td>%s</td><td rowspan="'.$nuid.'">%u</td><td rowspan="'.$nuid.'" '.$nowlist["$listed"]['style'].'>%s</td></tr>', $ipvet['ip']["$ip"][0], $nlearn, $nowlist["$listed"]['name']);
125
+		$rowuid = NULL;
126
+                for ($j = 1; $j<$nuid; $j++) $rowuid .= '<tr><td>%s</td></tr>';
127 127
 		array_shift($ipvet['ip']["$ip"]);
128
-                $return .= vsprintf ($rowuid,$ipvet['ip']["$ip"]);
128
+                $return .= vsprintf($rowuid, $ipvet['ip']["$ip"]);
129 129
 
130 130
 	}
131
-	$return .= sprintf ('<tr><th title="unique ips">%u</th><th title="unique uids">%u</th><th>%u</th></table>',$ipvet['ip']['count'],$ipvet['uid']['count'],$nips);
131
+	$return .= sprintf('<tr><th title="unique ips">%u</th><th title="unique uids">%u</th><th>%u</th></table>', $ipvet['ip']['count'], $ipvet['uid']['count'], $nips);
132 132
 
133 133
 
134 134
 	/* Statistics by UID */
135 135
 	/* Not used for listing purpose, but useful to you! */
136 136
 	$return .= '<h3>Statistics by UID</h3><table><tr><th>UID</th><th>IP learned</th><th>Learned times</th></tr>'."\n";
137 137
 	$uids = array_keys($ipvet['uid']);
138
-        foreach ( $uids as $uid ) {
139
-		if ( $uid == 'count' ) continue;	
138
+        foreach ($uids as $uid) {
139
+		if ($uid == 'count') continue;	
140 140
 	        $nlearn = $ipvet['uid']["$uid"]['count'];
141
-	        unset ( $ipvet['uid']["$uid"]['count'] );
141
+	        unset ($ipvet['uid']["$uid"]['count']);
142 142
 		$nip = count($ipvet['uid']["$uid"]);
143
-		$return .='<tr><td rowspan="'.$nip.'">'.$uid.'</td>';
144
-		$return .= sprintf ('<td>%s</td><td rowspan="'.$nip.'">%u</td></tr>',$ipvet['uid']["$uid"][0],$nlearn);
145
-                $rowuid=NULL;
146
-                for ($j=1;$j<$nip;$j++) $rowuid .= '<tr><td>%s</td></tr>';
143
+		$return .= '<tr><td rowspan="'.$nip.'">'.$uid.'</td>';
144
+		$return .= sprintf('<td>%s</td><td rowspan="'.$nip.'">%u</td></tr>', $ipvet['uid']["$uid"][0], $nlearn);
145
+                $rowuid = NULL;
146
+                for ($j = 1; $j<$nip; $j++) $rowuid .= '<tr><td>%s</td></tr>';
147 147
                 array_shift($ipvet['uid']["$uid"]);
148
-                $return .= vsprintf ($rowuid,$ipvet['uid']["$uid"]);
148
+                $return .= vsprintf($rowuid, $ipvet['uid']["$uid"]);
149 149
 
150 150
         }
151
-        $return .= sprintf ('<tr><th title="unique uids">%u</th><th title="unique ips">%u</th><th>%u</th></table>',$ipvet['uid']['count'],$ipvet['ip']['count'],$nips);	
151
+        $return .= sprintf('<tr><th title="unique uids">%u</th><th title="unique ips">%u</th><th>%u</th></table>', $ipvet['uid']['count'], $ipvet['ip']['count'], $nips);	
152 152
 
153 153
 
154 154
 	return $return;
155 155
 }
156 156
 
157 157
 
158
-function splunksearch ($service,$message_id,$date) {
158
+function splunksearch($service, $message_id, $date) {
159 159
 
160 160
 	// Run a blocking search
161
-	$searchQueryBlocking = 'search (message_id="'. addslashes( $message_id ) .
161
+	$searchQueryBlocking = 'search (message_id="'.addslashes($message_id).
162 162
 				'" OR sasl_username) | transaction message_id queue_id maxspan=3m maxpause=2m | search sasl_username message_id=* | table sasl_username';
163 163
 
164 164
 	/* Doesn't work on Splunk 6.6 for HTTP exceptions
@@ -177,8 +177,8 @@  discard block
 block discarded – undo
177 177
 
178 178
 	// A one shot search
179 179
         $searchParams = array(
180
-                'earliest_time' => date("c",strtotime ($date)-120),
181
-                'latest_time' => date("c",strtotime ($date)+60)
180
+                'earliest_time' => date("c", strtotime($date)-120),
181
+                'latest_time' => date("c", strtotime($date)+60)
182 182
         );
183 183
 
184 184
         // Run a oneshot search that returns the job's results
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 	    {
193 193
 	      // More than one field attribute returned by search
194 194
 	      // You must redefine the search
195
-	      if ( count($result->getFieldNames()) > 1 ) return FALSE;
195
+	      if (count($result->getFieldNames())>1) return FALSE;
196 196
 	    }
197 197
 	    else if ($result instanceof Splunk_ResultsMessage)
198 198
 	    {
@@ -224,51 +224,51 @@  discard block
 block discarded – undo
224 224
 }
225 225
 
226 226
 
227
-function imapReport ($cf,$myconnArray,$splunkconn,$tables,$type) {
228
-	$file = dirname(__FILE__) . '/' . $cf['reportFile']["$type"];
229
-	$fileb= dirname(__FILE__) . '/' . $cf['badreportFile']["$type"];
230
-	$m_mail = imap_open('{'.$cf['mailhost'].':143/imap/novalidate-cert/authuser='.$cf['authuser'].'}'.$cf['folder']["$type"], $cf['account'],$cf['authpassword'], OP_READONLY)
231
-        	or syslog (LOG_EMERG, $cf['user'].': Error in IMAP connection to <'.$cf['mailhost'].'>: ' . imap_last_error());
232
-	if ( !$m_mail ) exit(254);
227
+function imapReport($cf, $myconnArray, $splunkconn, $tables, $type) {
228
+	$file = dirname(__FILE__).'/'.$cf['reportFile']["$type"];
229
+	$fileb = dirname(__FILE__).'/'.$cf['badreportFile']["$type"];
230
+	$m_mail = imap_open('{'.$cf['mailhost'].':143/imap/novalidate-cert/authuser='.$cf['authuser'].'}'.$cf['folder']["$type"], $cf['account'], $cf['authpassword'], OP_READONLY)
231
+        	or syslog(LOG_EMERG, $cf['user'].': Error in IMAP connection to <'.$cf['mailhost'].'>: '.imap_last_error());
232
+	if (!$m_mail) exit(254);
233 233
 		
234 234
 
235
-	syslog (LOG_INFO,$cf['user'].': Successfully connected to <'.$cf['mailhost'].">; Reading $type messages of last ".$cf['oldestday'].' days...');
235
+	syslog(LOG_INFO, $cf['user'].': Successfully connected to <'.$cf['mailhost'].">; Reading $type messages of last ".$cf['oldestday'].' days...');
236 236
 	//get all messages
237
-	$dateTh = date ( "d-M-Y", strToTime ( '-'.$cf['oldestday'].' days' ) );
238
-        $dateN  = date ( "d-M-Y", strToTime ( "now" ) );
239
-        $m_search=imap_search ($m_mail, "SINCE \"$dateTh\" BEFORE \"$dateN\"" );
237
+	$dateTh = date("d-M-Y", strToTime('-'.$cf['oldestday'].' days'));
238
+        $dateN = date("d-M-Y", strToTime("now"));
239
+        $m_search = imap_search($m_mail, "SINCE \"$dateTh\" BEFORE \"$dateN\"");
240 240
 
241 241
 
242 242
 	// Order results starting from newest message
243
-	if ( empty($m_search) ) {
244
-		syslog (LOG_INFO,$cf['user'].": No mail found in $type folder. No reports written for $type.");
245
-	        if ( $ierr = imap_errors() )
246
-	                foreach ( $ierr as $thiserr )
247
-	                        syslog (LOG_ERR, $cf['user'].": IMAP Error: $thiserr");
248
-	        if ( $ierr = imap_alerts() )
249
-	                foreach ( $ierr as $thiserr )
250
-	                        syslog (LOG_ALERT, $cf['user'].": IMAP Alert: $thiserr");
251
-		imap_close( $m_mail );
252
-		if ( file_exists( $file ) ) unlink ($file);
253
-		if ( file_exists( $fileb ) ) unlink ($fileb);
243
+	if (empty($m_search)) {
244
+		syslog(LOG_INFO, $cf['user'].": No mail found in $type folder. No reports written for $type.");
245
+	        if ($ierr = imap_errors())
246
+	                foreach ($ierr as $thiserr)
247
+	                        syslog(LOG_ERR, $cf['user'].": IMAP Error: $thiserr");
248
+	        if ($ierr = imap_alerts())
249
+	                foreach ($ierr as $thiserr)
250
+	                        syslog(LOG_ALERT, $cf['user'].": IMAP Alert: $thiserr");
251
+		imap_close($m_mail);
252
+		if (file_exists($file)) unlink($file);
253
+		if (file_exists($fileb)) unlink($fileb);
254 254
 		return FALSE;
255 255
 	}
256
-	$nmes = count ($m_search);
257
-	syslog (LOG_INFO,$cf['user'].": Found $nmes mail in $type folder.");
256
+	$nmes = count($m_search);
257
+	syslog(LOG_INFO, $cf['user'].": Found $nmes mail in $type folder.");
258 258
 	if ($nmes>0) rsort($m_search);
259 259
 
260 260
 	// Create report file
261 261
 
262 262
 	$fp = fopen($file, 'w');
263
-	$fpb= fopen($fileb, 'w');
264
-	$lastup = "Last Update: " . date ("d F Y H:i", time());
265
-	fwrite( $fp, file_get_contents(dirname(__FILE__) . '/' . $cf['reportTemplateHeader']) );
266
-	fwrite( $fp,"<h1> Report of IP sending $type</h1><h5>$lastup</h5><h2>Detailed Report</h2>" );
267
-	if ($cf['onlyReport']) fwrite( $fp,'<p>None of the below IP has been listed because listing is not active in configuration.</p>');
268
-	fwrite( $fp,'<table><tr><th title="taken from Received header" nowrap>Date of Learn</th><th title="taken from Date header" nowrap>Date of Write</th><th nowrap>UID</th><th nowrap>IP</th><th title="How many times this uid learns">#UID</th><th title="Number of times this learned IP appears in different mails">#IP</th><th nowrap>Received by</th><th>Message-Id</th></tr>' );
269
-	fwrite( $fpb,file_get_contents(dirname(__FILE__) . '/' . $cf['reportTemplateHeader']) );
270
-	fwrite( $fpb,"<h1> Report of bad reported $type mails</h1><h5>$lastup</h5><h2>Detailed Report</h2>" );
271
-	fwrite( $fpb,'<table><tr><th title="taken from Received header" nowrap>Date Learn</th><th title="taken from Date header" nowrap>Date Received</th><th nowrap>UID</th><th>Message-Id</th><th title="Why is this a bad report?">Reason</th></tr>' );
263
+	$fpb = fopen($fileb, 'w');
264
+	$lastup = "Last Update: ".date("d F Y H:i", time());
265
+	fwrite($fp, file_get_contents(dirname(__FILE__).'/'.$cf['reportTemplateHeader']));
266
+	fwrite($fp, "<h1> Report of IP sending $type</h1><h5>$lastup</h5><h2>Detailed Report</h2>");
267
+	if ($cf['onlyReport']) fwrite($fp, '<p>None of the below IP has been listed because listing is not active in configuration.</p>');
268
+	fwrite($fp, '<table><tr><th title="taken from Received header" nowrap>Date of Learn</th><th title="taken from Date header" nowrap>Date of Write</th><th nowrap>UID</th><th nowrap>IP</th><th title="How many times this uid learns">#UID</th><th title="Number of times this learned IP appears in different mails">#IP</th><th nowrap>Received by</th><th>Message-Id</th></tr>');
269
+	fwrite($fpb, file_get_contents(dirname(__FILE__).'/'.$cf['reportTemplateHeader']));
270
+	fwrite($fpb, "<h1> Report of bad reported $type mails</h1><h5>$lastup</h5><h2>Detailed Report</h2>");
271
+	fwrite($fpb, '<table><tr><th title="taken from Received header" nowrap>Date Learn</th><th title="taken from Date header" nowrap>Date Received</th><th nowrap>UID</th><th>Message-Id</th><th title="Why is this a bad report?">Reason</th></tr>');
272 272
 
273 273
 	$ipuid = array();
274 274
 	$ipuid['count'] = 0;
@@ -286,69 +286,69 @@  discard block
 block discarded – undo
286 286
 	        //get imap header info for obj thang
287 287
 	        //$headers = imap_headerinfo($m_mail, $onem);
288 288
 	        //$head = imap_fetchheader($m_mail, $headers->Msgno);
289
-		$head = imap_fetchheader($m_mail, $onem );
289
+		$head = imap_fetchheader($m_mail, $onem);
290 290
 	        //$obj = imap_rfc822_parse_headers( $head);
291 291
 
292
-	        list ($ip,$host,$dateReceived,$dateClient,$mid) =  getIP( $head,$cf['mx'],$cf['msalearn'] );
292
+	        list ($ip, $host, $dateReceived, $dateClient, $mid) = getIP($head, $cf['mx'], $cf['msalearn']);
293 293
 		if (empty($mid)) {
294
-			$uid='NA';
295
-			syslog (LOG_ERR, $cf['user'].": Error retrieving data for empty Message-ID.");
296
-		} else {
294
+			$uid = 'NA';
295
+			syslog(LOG_ERR, $cf['user'].": Error retrieving data for empty Message-ID.");
296
+		}else {
297 297
 			if ($dateReceived === FALSE) {
298
-				$uid='unauthenticated';
299
-				syslog (LOG_ERR, $cf['user'].": Error retrieving date for $mid. Maybe this mail was not submitted to Learner MSA");
300
-			} else  
301
-				if ( !($uid = splunksearch ($splunkconn, trim($mid,'<>'), $dateReceived)) ) {
302
-					syslog (LOG_ERR, $cf['user'].": Error retrieving uid from Splunk log for $mid.");
303
-					$uid='unknown';
298
+				$uid = 'unauthenticated';
299
+				syslog(LOG_ERR, $cf['user'].": Error retrieving date for $mid. Maybe this mail was not submitted to Learner MSA");
300
+			}else  
301
+				if (!($uid = splunksearch($splunkconn, trim($mid, '<>'), $dateReceived))) {
302
+					syslog(LOG_ERR, $cf['user'].": Error retrieving uid from Splunk log for $mid.");
303
+					$uid = 'unknown';
304 304
 				}
305 305
 		}
306 306
 
307 307
 	        /* Update count of each ip */
308
-	        if ($host and ($uid!='NA') and ($uid!='unauthenticated') and ($uid!='unknown')) { /* IP is received by MX servers  and learned by valid uid */
309
-			$ipuid['count']++;					//number of right messages
308
+	        if ($host and ($uid != 'NA') and ($uid != 'unauthenticated') and ($uid != 'unknown')) { /* IP is received by MX servers  and learned by valid uid */
309
+			$ipuid['count']++; //number of right messages
310 310
 
311
-	                if (in_array($uid,array_keys($ipuid['uid']))) {
312
-				$ipuid['uid']["$uid"]['count']++;		//number of learn by this uid
313
-				if (!in_array($ip,$ipuid['uid']["$uid"])) 
314
-					$ipuid['uid']["$uid"][]=$ip;		//ips learned by this uid
311
+	                if (in_array($uid, array_keys($ipuid['uid']))) {
312
+				$ipuid['uid']["$uid"]['count']++; //number of learn by this uid
313
+				if (!in_array($ip, $ipuid['uid']["$uid"])) 
314
+					$ipuid['uid']["$uid"][] = $ip; //ips learned by this uid
315 315
 			}
316 316
 			else {
317 317
 				$ipuid['uid']["$uid"]['count'] = 1;
318
-				$ipuid['uid']["$uid"][]=$ip;
319
-				$ipuid['uid']['count']++;                	//number of unique uids
318
+				$ipuid['uid']["$uid"][] = $ip;
319
+				$ipuid['uid']['count']++; //number of unique uids
320 320
 			}
321 321
 
322
-                        if (in_array($ip,array_keys($ipuid['ip']))) {
323
-                                $ipuid['ip']["$ip"]['count']++;			//number of time this ip appears in different messages
324
-				if (!in_array($uid,$ipuid['ip']["$ip"]))
325
-					$ipuid['ip']["$ip"][]=$uid;		//uids that learned this ip
322
+                        if (in_array($ip, array_keys($ipuid['ip']))) {
323
+                                $ipuid['ip']["$ip"]['count']++; //number of time this ip appears in different messages
324
+				if (!in_array($uid, $ipuid['ip']["$ip"]))
325
+					$ipuid['ip']["$ip"][] = $uid; //uids that learned this ip
326 326
 			}
327 327
                         else {
328 328
                                 $ipuid['ip']["$ip"]['count'] = 1;
329
-				$ipuid['ip']["$ip"][]=$uid;
330
-				$ipuid['ip']['count']++;			//number of unique ips
329
+				$ipuid['ip']["$ip"][] = $uid;
330
+				$ipuid['ip']['count']++; //number of unique ips
331 331
                         }
332 332
 
333 333
 	        	/* Update HTML report */
334
-	        	fwrite($fp,updateReport ( $ip,$uid,$ipuid['ip']["$ip"]['count'],$ipuid['uid']["$uid"]['count'],$host,$dateClient,$mid,$dateReceived) );
334
+	        	fwrite($fp, updateReport($ip, $uid, $ipuid['ip']["$ip"]['count'], $ipuid['uid']["$uid"]['count'], $host, $dateClient, $mid, $dateReceived));
335 335
 		}
336 336
 	        else {	/* Bad learn */
337 337
 			
338
-                        if (in_array($uid,array_keys($uidbad['uid']))) 
339
-                                $uidbad['uid']["$uid"]['count']++;               //number of bad learn by this uid
338
+                        if (in_array($uid, array_keys($uidbad['uid']))) 
339
+                                $uidbad['uid']["$uid"]['count']++; //number of bad learn by this uid
340 340
                         else {
341 341
                                 $uidbad['uid']["$uid"]['count'] = 1;
342
-				$uidbad['uid']["$uid"][]=$uid;
343
-                                $uidbad['count']++;                       //numeber of unique bad uids
342
+				$uidbad['uid']["$uid"][] = $uid;
343
+                                $uidbad['count']++; //numeber of unique bad uids
344 344
                         }
345 345
 			/* The reason of bad report */
346 346
 			if ($host === FALSE) $reason = 'This mail was not received by recognized MX host';
347 347
 			if ($dateReceived === FALSE) $reason = 'This mail was not submitted to recognized MSA for learn';
348
-			if ($uid=='unknown') $reason = 'The uid of this mail was not found in splunk log';
348
+			if ($uid == 'unknown') $reason = 'The uid of this mail was not found in splunk log';
349 349
 			if (!isset($reason)) $reason = '?';
350 350
 				
351
-			fwrite( $fpb,updatebadReport ( $uid,$dateClient,$mid,$dateReceived,$reason ) );
351
+			fwrite($fpb, updatebadReport($uid, $dateClient, $mid, $dateReceived, $reason));
352 352
 		}
353 353
 	}
354 354
 
@@ -356,45 +356,45 @@  discard block
 block discarded – undo
356 356
 	//close report file and mailbox
357 357
 
358 358
 	/* Summary Report */
359
-	$ipuid['ip'] = array_msort( $ipuid['ip'], array('count'=>SORT_DESC) );
360
-	$ipuid['uid'] = array_msort( $ipuid['uid'], array('count'=>SORT_DESC) );
361
-	$uidbad['uid'] = array_msort( $uidbad['uid'], array('count'=>SORT_DESC) );
359
+	$ipuid['ip'] = array_msort($ipuid['ip'], array('count'=>SORT_DESC));
360
+	$ipuid['uid'] = array_msort($ipuid['uid'], array('count'=>SORT_DESC));
361
+	$uidbad['uid'] = array_msort($uidbad['uid'], array('count'=>SORT_DESC));
362 362
 	
363 363
 	fwrite($fp, '</table>');
364
-	fwrite($fp, '<hr><h2>Summary Report</h2><h5>Listing policy: ip must be learned at least '.$cf['thresholdip']["$type"].' times from at least '.$cf['thresholduid']["$type"].' different valid uids.</h5>' );
364
+	fwrite($fp, '<hr><h2>Summary Report</h2><h5>Listing policy: ip must be learned at least '.$cf['thresholdip']["$type"].' times from at least '.$cf['thresholduid']["$type"].' different valid uids.</h5>');
365 365
 
366 366
         /* Make MYSQL connection */
367
-	if ( $cf['onlyReport'] )
367
+	if ($cf['onlyReport'])
368 368
 		$mysqli = NULL;
369 369
 	else {
370 370
         	$mysqli = new mysqli($myconnArray['dbhost'], $myconnArray['userdb'], $myconnArray['pwd'], $myconnArray['db'], $myconnArray['dbport']);
371 371
         	if ($mysqli->connect_error) {
372
-                	syslog (LOG_EMERG, $cf['user'].': Connect Error (' . $mysqli->connect_errno . ') '
372
+                	syslog(LOG_EMERG, $cf['user'].': Connect Error ('.$mysqli->connect_errno.') '
373 373
                 	. $mysqli->connect_error);
374 374
                 	exit (254);
375 375
         	}
376
-        	syslog(LOG_INFO, $cf['user'].': Successfully mysql connected to ' . $mysqli->host_info) ;
376
+        	syslog(LOG_INFO, $cf['user'].': Successfully mysql connected to '.$mysqli->host_info);
377 377
 	}
378 378
 	/***********************/
379 379
 
380
-	fwrite($fp, summaryReportAndList ($cf,$mysqli,$tables,$type,$ipuid) );
381
-	if ( !$cf['onlyReport'] )
380
+	fwrite($fp, summaryReportAndList($cf, $mysqli, $tables, $type, $ipuid));
381
+	if (!$cf['onlyReport'])
382 382
 		$mysqli->close();
383
-	fwrite($fp,file_get_contents(dirname(__FILE__) . '/' . $cf['reportTemplateFooter']));
383
+	fwrite($fp, file_get_contents(dirname(__FILE__).'/'.$cf['reportTemplateFooter']));
384 384
 	fclose($fp);
385 385
 
386 386
 	fwrite($fpb, '</table>');
387
-	fwrite( $fpb,summaryBadReport( $uidbad ) );
388
-	fwrite($fpb,file_get_contents(dirname(__FILE__) . '/' . $cf['reportTemplateFooter']));
387
+	fwrite($fpb, summaryBadReport($uidbad));
388
+	fwrite($fpb, file_get_contents(dirname(__FILE__).'/'.$cf['reportTemplateFooter']));
389 389
 	fclose($fpb);
390
-	syslog (LOG_INFO,$cf['user'].': Report files written. Listing job for '.$type.' terminated.');
391
-
392
-	if ( $ierr = imap_errors() )
393
-		foreach ( $ierr as $thiserr )
394
-			syslog (LOG_ERR, $cf['user'].": IMAP Error: $thiserr");
395
-	if ( $ierr = imap_alerts() )
396
-                foreach ( $ierr as $thiserr )
397
-                        syslog (LOG_ALERT, $cf['user'].": IMAP Alert: $thiserr");
390
+	syslog(LOG_INFO, $cf['user'].': Report files written. Listing job for '.$type.' terminated.');
391
+
392
+	if ($ierr = imap_errors())
393
+		foreach ($ierr as $thiserr)
394
+			syslog(LOG_ERR, $cf['user'].": IMAP Error: $thiserr");
395
+	if ($ierr = imap_alerts())
396
+                foreach ($ierr as $thiserr)
397
+                        syslog(LOG_ALERT, $cf['user'].": IMAP Alert: $thiserr");
398 398
 	imap_close($m_mail);
399 399
 }
400 400
 ?>
Please login to merge, or discard this patch.
changeMilter.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 require_once('config.php');
3 3
 require_once('function.php');
4
-$typedesc=$_POST['type'];
4
+$typedesc = $_POST['type'];
5 5
 $type = $tables["$typedesc"]['field'];
6 6
 $col = milterTable($type);
7
-if ( $col === FALSE )
7
+if ($col === FALSE)
8 8
 	exit ("<p>Error in you config at field <b>$type</b>.</p>");
9 9
 ?>
10 10
 <td colspan="10" style="text-align: center">
@@ -18,54 +18,54 @@  discard block
 block discarded – undo
18 18
 	$new = $_POST['newvalues'];
19 19
 else
20 20
 	$new = array();
21
-if (! empty($_POST['oldvalues']))
21
+if (!empty($_POST['oldvalues']))
22 22
 	$old = explode(',', $_POST['oldvalues']);
23 23
 else
24
-	$old=array();
25
-$values=array();
26
-$logs=array();
24
+	$old = array();
25
+$values = array();
26
+$logs = array();
27 27
 
28 28
 print '<pre>';
29 29
 /* Check need to disable all milters, removing unnecessary setting */
30
-if ( in_array('DISABLE ALL', $new) )
30
+if (in_array('DISABLE ALL', $new))
31 31
 	$new = array('DISABLE ALL');
32 32
 
33 33
 /* Compare the values determining what to do */
34 34
 if (count(array_diff(array_merge($new, $old), array_intersect($new, $old))) !== 0) {
35 35
 	/* New and old are different (we assume we don't have duplicate values) */
36
-	if (! empty($new) ) {
36
+	if (!empty($new)) {
37 37
 		foreach ($new as $item) {
38
-			if ( in_array($item, $old) )
38
+			if (in_array($item, $old))
39 39
 				$values["$item"] = 'keep';
40 40
 			else
41 41
 				$values["$item"] = 'add';
42
-			$logs[] = "<$item>: ". $values["$item"];
42
+			$logs[] = "<$item>: ".$values["$item"];
43 43
 		}
44 44
 	}
45
-	if (! empty($old) ) {
45
+	if (!empty($old)) {
46 46
 		foreach ($old as $item) {
47
-        		if (! in_array($item, $new) ) {
47
+        		if (!in_array($item, $new)) {
48 48
                 		$values["$item"] = 'del';
49
-				$logs[] = "<$item>: ". $values["$item"];
49
+				$logs[] = "<$item>: ".$values["$item"];
50 50
 			}
51 51
 		}
52 52
 	}
53 53
 }
54 54
 
55 55
 /* Logging */
56
-if ( empty($values) ) 
56
+if (empty($values)) 
57 57
 	print 'No values to change.';
58 58
 else {
59
-	$msg = sprintf('%s: Changing Milter setting on list <%s> for %s <%s>.',$user,$typedesc,$type, $_POST['object']);
59
+	$msg = sprintf('%s: Changing Milter setting on list <%s> for %s <%s>.', $user, $typedesc, $type, $_POST['object']);
60 60
 	syslog(LOG_INFO, $msg);
61 61
 	foreach ($logs as $log)
62 62
 		syslog(LOG_INFO, "$user: milter $log");
63 63
 	
64 64
 	/* Store new values */
65
-	if ( ($mysqli = myConnect($dbhost, $userdb, $pwd, $db, $dbport, $tables, $typedesc, $user)) === FALSE )
66
-        	exit ($user.': Connect Error (' . $mysqli->connect_errno . ') '. $mysqli->connect_error);
65
+	if (($mysqli = myConnect($dbhost, $userdb, $pwd, $db, $dbport, $tables, $typedesc, $user)) === FALSE)
66
+        	exit ($user.': Connect Error ('.$mysqli->connect_errno.') '.$mysqli->connect_error);
67 67
 
68
-	if (changeMilter ($mysqli,$user,$values,$col,$_POST['miltId']))
68
+	if (changeMilter($mysqli, $user, $values, $col, $_POST['miltId']))
69 69
 		print 'OK milter setting changed.';
70 70
 	else
71 71
 		print 'ERROR updating milter setting; check your syslog. No changes made.';
Please login to merge, or discard this patch.
listForm.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,18 +1,18 @@
 block discarded – undo
1 1
 <?php
2
-if (in_array($user,array_keys(array_filter($adm)))) $extopt = '<option value="MONTH">MONTHS</option><option value="YEAR">YEARS</option>';
2
+if (in_array($user, array_keys(array_filter($adm)))) $extopt = '<option value="MONTH">MONTHS</option><option value="YEAR">YEARS</option>';
3 3
 else $extopt = NULL;
4 4
 
5
-if ( $tables["$typedesc"]['milter'] ) {
6
-	if ( checkMilterConf($tables["$typedesc"]) ) 
5
+if ($tables["$typedesc"]['milter']) {
6
+	if (checkMilterConf($tables["$typedesc"])) 
7 7
 		print '<p>This is a milter table. Please, first add your item as usual. Then you will be able to customize the milter settings.</p>';
8 8
 	else {
9 9
 		$err = "Error in config about <$typedesc>. Check at your config.php.";
10
-		syslog (LOG_EMERG, $err);
11
-		printf ('<p>%s</p>', htmlspecialchars($err) );
10
+		syslog(LOG_EMERG, $err);
11
+		printf('<p>%s</p>', htmlspecialchars($err));
12 12
 	}	
13 13
 }	
14 14
 ?>
15 15
 <form style="margin:0; text-align: left;" name='ListButton<?php echo $type ?>' enctype="text/plain" method="post" target="_self" action="list.php"  onSubmit="xmlhttpPost('list.php', 'ListButton<?php echo $type ?>', 'Risultato', '<img src=\'/include/pleasewait.gif\'>'); return false;" />
16 16
 
17 17
 		List <?php  echo $typedesc.' &lt;'.$value.'&gt;'; ?> for <input name="type" type="hidden" value="<?php echo $typedesc; ?>" /><input name="value" type="hidden" class="input_text" value="<?php echo $value; ?>" />
18
-		<select name="quantity" class="input_text" size="1"><option value="1">1</option><option value="2">2</option><option value="3">3</option><option value="4">4</option><option value="5">5</option><option value="6">6</option><option value="20">20</option></select><select class="input_text" name="unit" size="1"><option value="DAY">DAYS</option><option value="WEEK">WEEKS</option><?php echo $extopt;?></select>  Reason:<input maxlength="128" name="reason" size="30" type="text" class="input_text" /><input name="List" class="button" id="bwarn" type="submit" value="List"/></form>
18
+		<select name="quantity" class="input_text" size="1"><option value="1">1</option><option value="2">2</option><option value="3">3</option><option value="4">4</option><option value="5">5</option><option value="6">6</option><option value="20">20</option></select><select class="input_text" name="unit" size="1"><option value="DAY">DAYS</option><option value="WEEK">WEEKS</option><?php echo $extopt; ?></select>  Reason:<input maxlength="128" name="reason" size="30" type="text" class="input_text" /><input name="List" class="button" id="bwarn" type="submit" value="List"/></form>
Please login to merge, or discard this patch.
relist.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 require_once('config.php');
3 3
 require_once('function.php');
4
-$typedesc=$_POST['type'];
4
+$typedesc = $_POST['type'];
5 5
 $type = $tables["$typedesc"]['field'];
6 6
 $table = ($tables["$typedesc"]['milter']) ? milterTable($type) : $tables["$typedesc"]['name'];
7 7
 $cl = ($tables["$typedesc"]['milter']) ? 10 : 9;
@@ -10,15 +10,15 @@  discard block
 block discarded – undo
10 10
 <?php
11 11
 openlog($tag, LOG_PID, $fac);
12 12
 if (empty($_POST['reason'])) die ("Specify a reason, please!</td>");
13
-if (preg_match( '/[^\x20-\x7f]/', $_POST['reason']))
14
-        exit('ERROR: &lt;'.htmlentities($_POST['reason'],ENT_COMPAT | ENT_HTML401, 'ISO-8859-1').'&gt; contains NON ASCII chars.</td>');
13
+if (preg_match('/[^\x20-\x7f]/', $_POST['reason']))
14
+        exit('ERROR: &lt;'.htmlentities($_POST['reason'], ENT_COMPAT | ENT_HTML401, 'ISO-8859-1').'&gt; contains NON ASCII chars.</td>');
15 15
 $user = username();
16 16
 
17
-if ( ($mysqli = myConnect($dbhost, $userdb, $pwd, $db, $dbport, $tables, $typedesc, $user)) === FALSE )
18
-                exit ($user.': Connect Error (' . $mysqli->connect_errno . ') '. $mysqli->connect_error);
17
+if (($mysqli = myConnect($dbhost, $userdb, $pwd, $db, $dbport, $tables, $typedesc, $user)) === FALSE)
18
+                exit ($user.': Connect Error ('.$mysqli->connect_errno.') '.$mysqli->connect_error);
19 19
 
20
-if (isFull($mysqli,$typedesc,$tables)) die("ERROR in relist: ".htmlspecialchars("$typedesc has reached maximum value of ".$tables["$typedesc"]['limit'].' listed items.') );
21
-if (relist ($mysqli,username(),$_POST['value'],$type,$table,$_POST['unit'],$_POST['quantity'],$_POST['reason']))
20
+if (isFull($mysqli, $typedesc, $tables)) die("ERROR in relist: ".htmlspecialchars("$typedesc has reached maximum value of ".$tables["$typedesc"]['limit'].' listed items.'));
21
+if (relist($mysqli, username(), $_POST['value'], $type, $table, $_POST['unit'], $_POST['quantity'], $_POST['reason']))
22 22
  print 'OK '.$_POST["type"].' &lt;'.$_POST['value'].'&gt; relisted for '.$_POST['quantity'].$_POST['unit'];
23 23
 else
24 24
  print 'ERROR in relist; check log';
Please login to merge, or discard this patch.
result.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -5,20 +5,20 @@  discard block
 block discarded – undo
5 5
 $net = new \dautkom\ipv4\IPv4();
6 6
 
7 7
 $_ = $_POST['genere'];
8
-if ( ($tables["$_"]['field']=='email') AND ($_POST['Value']!='ALL') )
8
+if (($tables["$_"]['field'] == 'email') AND ($_POST['Value'] != 'ALL'))
9 9
 	if (!(filter_var($_POST['Value'], FILTER_VALIDATE_EMAIL)))
10 10
 		exit ('<pre>&lt;'.$_POST['Value'].'&gt; is NOT a valid email address.</pre>');
11 11
 
12
-if ( ($tables["$_"]['field']=='domain') AND ($_POST['Value']!='ALL') )
12
+if (($tables["$_"]['field'] == 'domain') AND ($_POST['Value'] != 'ALL'))
13 13
         if (!(filter_var(gethostbyname($_POST['Value']), FILTER_VALIDATE_IP)))
14 14
 		exit ('<pre>&lt;'.$_POST['Value'].'&gt; is NOT a valid domain.</pre>');
15 15
 
16
-if ( ($tables["$_"]['field']=='ip')  AND ($_POST['Value']!='ALL') )
16
+if (($tables["$_"]['field'] == 'ip') AND ($_POST['Value'] != 'ALL'))
17 17
 	if (!(filter_var($_POST['Value'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)))
18 18
 		exit ('<pre>&lt;'.$_POST['Value'].'&gt; is NOT a valid IP address.</pre>');
19 19
 	
20
-if ( ($tables["$_"]['field']=='network') AND ($_POST['Value']!='ALL') ) {
21
-	$value = explode('/',$_POST['Value']);
20
+if (($tables["$_"]['field'] == 'network') AND ($_POST['Value'] != 'ALL')) {
21
+	$value = explode('/', $_POST['Value']);
22 22
 	if (count($value) != 2)
23 23
 		exit ('<pre>&lt;'.$_POST['Value'].'&gt; is NOT a valid Network/Netmask pair.</pre>');
24 24
 	if (!$net->address($value[0])->mask($value[1])->isValid(1))
@@ -26,16 +26,16 @@  discard block
 block discarded – undo
26 26
 	$_POST['Value'] = $value[0].'/'.$net->mask($value[1])->convertTo('dec');
27 27
 }
28 28
 
29
-if ( ($tables["$_"]['field']=='username') AND ($_POST['Value']!='ALL') ) {
30
-        if ( preg_match( '/[^\x20-\x7f]/', $_POST['Value']) )
29
+if (($tables["$_"]['field'] == 'username') AND ($_POST['Value'] != 'ALL')) {
30
+        if (preg_match('/[^\x20-\x7f]/', $_POST['Value']))
31 31
                 exit('<pre>&lt;'.$_POST['Value'].'&gt; contains NON ASCII chars.</pre>');
32
-	if ( preg_match( '/[$~=#*+%,{}()\/\\<>;:\"`\[\]&?\s]/', $_POST['Value']) )
32
+	if (preg_match('/[$~=#*+%,{}()\/\\<>;:\"`\[\]&?\s]/', $_POST['Value']))
33 33
 		exit('<pre>&lt;'.$_POST['Value'].'&gt; contains invalid ASCII chars.</pre>');
34
-	switch ( $_POST['Value'] ) {
34
+	switch ($_POST['Value']) {
35 35
 		case 'anonymous':
36 36
 		case 'anybody':
37 37
 		case 'anyone':
38
-		case ( preg_match( '/^anyone@/',$_POST['Value']) == TRUE ):
38
+		case (preg_match('/^anyone@/', $_POST['Value']) == TRUE):
39 39
 			exit('<pre>&lt;'.$_POST['Value'].'&gt; is not allowed.</pre>');
40 40
 	}
41 41
 }	
@@ -51,10 +51,10 @@  discard block
 block discarded – undo
51 51
 openlog($tag, LOG_PID, $fac);
52 52
 $user = username();
53 53
 
54
-if ( ($mysqli = myConnect($dbhost, $userdb, $pwd, $db, $dbport, $tables, $_, $user)) === FALSE )
55
-	exit ('Connect Error (' . $mysqli->connect_errno . ') '. $mysqli->connect_error);
54
+if (($mysqli = myConnect($dbhost, $userdb, $pwd, $db, $dbport, $tables, $_, $user)) === FALSE)
55
+	exit ('Connect Error ('.$mysqli->connect_errno.') '.$mysqli->connect_error);
56 56
 	
57
-rlookup($mysqli,username(),$admins,$_POST['Value'],$_POST['genere'],$tables);
57
+rlookup($mysqli, username(), $admins, $_POST['Value'], $_POST['genere'], $tables);
58 58
 $mysqli->close();
59 59
 closelog();
60 60
 ?>
Please login to merge, or discard this patch.
list.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,25 +1,25 @@
 block discarded – undo
1 1
 <?php
2 2
 require_once('config.php');
3 3
 require_once('function.php');
4
-$typedesc=$_POST['type'];
4
+$typedesc = $_POST['type'];
5 5
 $type = $tables["$typedesc"]['field'];
6 6
 $table = ($tables["$typedesc"]['milter']) ? milterTable($type) : $tables["$typedesc"]['name'];
7 7
 
8 8
 openlog($tag, LOG_PID, $fac);
9 9
 if (empty($_POST['reason'])) die ("<p>Please, specify a reason!</p>");
10
-if (preg_match( '/[^\x20-\x7f]/', $_POST['reason']))
11
-	exit('<p>ERROR: &lt;'.htmlentities($_POST['reason'],ENT_COMPAT | ENT_HTML401, 'ISO-8859-1').'&gt; contains NON ASCII chars.</p>');
10
+if (preg_match('/[^\x20-\x7f]/', $_POST['reason']))
11
+	exit('<p>ERROR: &lt;'.htmlentities($_POST['reason'], ENT_COMPAT | ENT_HTML401, 'ISO-8859-1').'&gt; contains NON ASCII chars.</p>');
12 12
 $user = username();
13 13
 $err = NULL;
14 14
 
15
-if ( ($mysqli = myConnect($dbhost, $userdb, $pwd, $db, $dbport, $tables, $typedesc, $user)) === FALSE )
16
-                exit ($user.': Connect Error (' . $mysqli->connect_errno . ') '. $mysqli->connect_error);
15
+if (($mysqli = myConnect($dbhost, $userdb, $pwd, $db, $dbport, $tables, $typedesc, $user)) === FALSE)
16
+                exit ($user.': Connect Error ('.$mysqli->connect_errno.') '.$mysqli->connect_error);
17 17
 
18
-if (addtolist ($mysqli,$user,$_POST['value'],$tables["$typedesc"],$_POST['unit'],$_POST['quantity'],$_POST['reason'],$err))
18
+if (addtolist($mysqli, $user, $_POST['value'], $tables["$typedesc"], $_POST['unit'], $_POST['quantity'], $_POST['reason'], $err))
19 19
  print 'OK '.$_POST["type"].' &lt;'.$_POST['value'].'&gt; first time listed for '.$_POST['quantity'].$_POST['unit'].'.';
20 20
 else
21 21
  print 'List operation ERROR; check log.';
22
-if (!is_null($err) ) print htmlentities(' Error: ' . $err);
22
+if (!is_null($err)) print htmlentities(' Error: '.$err);
23 23
 $mysqli->close();
24 24
 closelog();
25 25
 ?>
Please login to merge, or discard this patch.
remove.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,17 +1,17 @@
 block discarded – undo
1 1
 <?php
2 2
 require_once('config.php');
3 3
 require_once('function.php');
4
-$typedesc=$_POST['type'];
5
-$type =  $tables["$typedesc"]['field'];
4
+$typedesc = $_POST['type'];
5
+$type = $tables["$typedesc"]['field'];
6 6
 $table = ($tables["$typedesc"]['milter']) ? milterTable($type) : $tables["$typedesc"]['name'];
7 7
 $cl = ($tables["$typedesc"]['milter']) ? 10 : 9;
8 8
 printf('<td colspan="%d" style="text-align: center">', $cl);
9 9
 openlog($tag, LOG_PID, $fac);
10 10
 $user = username();
11 11
 
12
-if ( ($mysqli = myConnect($dbhost, $userdb, $pwd, $db, $dbport, $tables, $typedesc, $user)) === FALSE )
13
-                exit ($user.': Connect Error (' . $mysqli->connect_errno . ') '. $mysqli->connect_error);
14
-if (remove ($mysqli,$user,$_POST['value'],$type,$table))
12
+if (($mysqli = myConnect($dbhost, $userdb, $pwd, $db, $dbport, $tables, $typedesc, $user)) === FALSE)
13
+                exit ($user.': Connect Error ('.$mysqli->connect_errno.') '.$mysqli->connect_error);
14
+if (remove($mysqli, $user, $_POST['value'], $type, $table))
15 15
  print 'OK '.$typedesc.' &lt;'.$_POST['value'].'&gt; permanently REMOVED!';
16 16
 else
17 17
  print 'Delete operation ERROR on '.$typedesc.' &lt;'.$_POST['value'].'&gt;; check log.';
Please login to merge, or discard this patch.
relistForm.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@
 block discarded – undo
1 1
 <?php
2 2
 $adm = unserialize($_POST["adm"]);
3
-if (in_array($_POST["user"],array_keys(array_filter($adm)))) $extopt = '<option value="MONTH">MONTHS</option><option value="YEAR">YEARS</option>';
3
+if (in_array($_POST["user"], array_keys(array_filter($adm)))) $extopt = '<option value="MONTH">MONTHS</option><option value="YEAR">YEARS</option>';
4 4
 else $extopt = NULL;
5 5
 
6 6
 require_once('config.php');
7
-$typedesc=$_POST['type'];
7
+$typedesc = $_POST['type'];
8 8
 $cl = ($tables["$typedesc"]['milter']) ? 10 : 9;
9 9
 ?>
10 10
 
Please login to merge, or discard this patch.