@@ -2,7 +2,7 @@ discard block |
||
2 | 2 | <?php |
3 | 3 | |
4 | 4 | //prevent non cli access |
5 | -if(php_sapi_name()!=='cli') exit(); |
|
5 | +if (php_sapi_name()!=='cli') exit(); |
|
6 | 6 | |
7 | 7 | $dir = dirname(dirname(__FILE__)); |
8 | 8 | class_exists('Setup', false) or include($dir.'/classes/Setup.class.php'); |
@@ -29,10 +29,10 @@ discard block |
||
29 | 29 | } |
30 | 30 | |
31 | 31 | |
32 | -function main(){ |
|
32 | +function main() { |
|
33 | 33 | // start process watch |
34 | 34 | $parentProcessId = getmypid(); |
35 | - if($parentProcessId == false || $parentProcessId == 0) { |
|
35 | + if ($parentProcessId==false || $parentProcessId==0) { |
|
36 | 36 | _Logging::appLog("Parent process couldnt get pid"); |
37 | 37 | } |
38 | 38 | |
@@ -43,11 +43,11 @@ discard block |
||
43 | 43 | |
44 | 44 | // control |
45 | 45 | while (true) { |
46 | - try{ |
|
46 | + try { |
|
47 | 47 | $mysql->connect(Setup::$connectionArray); |
48 | - if(!Utilities::is_process_running($userProcessId)){ |
|
48 | + if (!Utilities::is_process_running($userProcessId)) { |
|
49 | 49 | $userCheck = $mysql->runQueryReturnVar("select username from users where beenChecked = 0"); |
50 | - if($userCheck!==false){ |
|
50 | + if ($userCheck!==false) { |
|
51 | 51 | $cmd = 'php '.dirname(__FILE__).'/userJob.php -i '.$parentProcessId; |
52 | 52 | $userProcessId = Utilities::run_in_background($cmd); |
53 | 53 | } |
@@ -55,16 +55,16 @@ discard block |
||
55 | 55 | } catch (Exception $e) { |
56 | 56 | _Logging::appLog($e->getMessage()); |
57 | 57 | } |
58 | - if(!Utilities::is_process_running($monitorProcessesId)){ |
|
58 | + if (!Utilities::is_process_running($monitorProcessesId)) { |
|
59 | 59 | $cmd = 'php '.dirname(__FILE__).'/blacklistmonitor.php -p monitorProcessWatch -i '.$parentProcessId; |
60 | 60 | $monitorProcessesId = Utilities::run_in_background($cmd); |
61 | 61 | } |
62 | - sleep(15);//15 seconds |
|
62 | + sleep(15); //15 seconds |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | } |
66 | 66 | |
67 | -function monitorProcessWatch($parentProcessId){ |
|
67 | +function monitorProcessWatch($parentProcessId) { |
|
68 | 68 | |
69 | 69 | $m = new _MeasurePerformance(); |
70 | 70 | $mysql = new _MySQL(); |
@@ -79,14 +79,14 @@ discard block |
||
79 | 79 | |
80 | 80 | while (true) { |
81 | 81 | // are we still running? |
82 | - if(!Utilities::is_process_running($parentProcessId)){ |
|
82 | + if (!Utilities::is_process_running($parentProcessId)) { |
|
83 | 83 | _Logging::appLog("Parent Stopped - monitorStartWatch exited"); |
84 | 84 | exit(); |
85 | 85 | } |
86 | 86 | |
87 | 87 | $processCountMonitors = count($monitorProcesses); |
88 | 88 | |
89 | - if ($processCountMonitors < $parallelProcessesMonitors){ |
|
89 | + if ($processCountMonitors < $parallelProcessesMonitors) { |
|
90 | 90 | $ipDomain = Utilities::getNextMonitor($mysql); |
91 | 91 | if ($ipDomain!==false) { |
92 | 92 | // start it |
@@ -98,16 +98,16 @@ discard block |
||
98 | 98 | } |
99 | 99 | |
100 | 100 | // was there any work? |
101 | - if($ipDomain===false){ |
|
102 | - sleep(10);//10 seconds |
|
103 | - }else{ |
|
104 | - usleep(10000);//ideal time 10ms |
|
101 | + if ($ipDomain===false) { |
|
102 | + sleep(10); //10 seconds |
|
103 | + }else { |
|
104 | + usleep(10000); //ideal time 10ms |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | // delete finished processes |
108 | 108 | for ($x = 0; $x < $processCountMonitors; $x++) { |
109 | - if(isset($monitorProcesses[$x])){ |
|
110 | - if(!Utilities::is_process_running($monitorProcesses[$x])){ |
|
109 | + if (isset($monitorProcesses[$x])) { |
|
110 | + if (!Utilities::is_process_running($monitorProcesses[$x])) { |
|
111 | 111 | unset($monitorProcesses[$x]); |
112 | 112 | } |
113 | 113 | } |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | $processCountMonitors = count($monitorProcesses); |
120 | 120 | |
121 | 121 | //randomly reset counter every now and then |
122 | - if(mt_rand(1,2000)==1){ |
|
122 | + if (mt_rand(1, 2000)==1) { |
|
123 | 123 | $m->endWork(); |
124 | 124 | _Logging::appLog("App Avg Hosts/sec: {$m->avgPerformance}\tMonitor Threads: $processCountMonitors/$parallelProcessesMonitors"); |
125 | 125 | $m = new _MeasurePerformance(); |
@@ -2,7 +2,9 @@ discard block |
||
2 | 2 | <?php |
3 | 3 | |
4 | 4 | //prevent non cli access |
5 | -if(php_sapi_name()!=='cli') exit(); |
|
5 | +if(php_sapi_name()!=='cli') { |
|
6 | + exit(); |
|
7 | +} |
|
6 | 8 | |
7 | 9 | $dir = dirname(dirname(__FILE__)); |
8 | 10 | class_exists('Setup', false) or include($dir.'/classes/Setup.class.php'); |
@@ -100,7 +102,7 @@ discard block |
||
100 | 102 | // was there any work? |
101 | 103 | if($ipDomain===false){ |
102 | 104 | sleep(10);//10 seconds |
103 | - }else{ |
|
105 | + } else{ |
|
104 | 106 | usleep(10000);//ideal time 10ms |
105 | 107 | } |
106 | 108 |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | set_time_limit(0); |
4 | 4 | |
5 | 5 | //prevent non cli access |
6 | -if(php_sapi_name()!=='cli') exit(); |
|
6 | +if (php_sapi_name()!=='cli') exit(); |
|
7 | 7 | |
8 | 8 | $dir = dirname(dirname(__FILE__)); |
9 | 9 | class_exists('Setup', false) or include($dir.'/classes/Setup.class.php'); |
@@ -17,32 +17,32 @@ discard block |
||
17 | 17 | $mysql = new _MySQL(); |
18 | 18 | $mysql->connect(Setup::$connectionArray); |
19 | 19 | |
20 | -if($options['r']=='blockListStats'){ |
|
20 | +if ($options['r']=='blockListStats') { |
|
21 | 21 | $mysql->runQuery("update blockLists set blocksYesterday = blocksToday, cleanYesterday = cleanToday; "); |
22 | 22 | $mysql->runQuery("update blockLists set blocksToday = 0, cleanToday = 0; "); |
23 | 23 | _Logging::appLog("block list stats updated"); |
24 | 24 | } |
25 | -if($options['r']=='weekly'){ |
|
25 | +if ($options['r']=='weekly') { |
|
26 | 26 | $mysql->runQuery("update users set beenChecked = 0 where checkFrequency = 'weekly';"); |
27 | 27 | _Logging::appLog("weekly reset"); |
28 | 28 | } |
29 | -if($options['r']=='daily'){ |
|
29 | +if ($options['r']=='daily') { |
|
30 | 30 | $mysql->runQuery("update users set beenChecked = 0 where checkFrequency = 'daily';"); |
31 | 31 | _Logging::appLog("daily reset"); |
32 | 32 | } |
33 | -if($options['r']=='8hour'){ |
|
33 | +if ($options['r']=='8hour') { |
|
34 | 34 | $mysql->runQuery("update users set beenChecked = 0 where checkFrequency = '8hour';"); |
35 | 35 | _Logging::appLog("8 hour reset"); |
36 | 36 | } |
37 | -if($options['r']=='2hour'){ |
|
37 | +if ($options['r']=='2hour') { |
|
38 | 38 | $mysql->runQuery("update users set beenChecked = 0 where checkFrequency = '2hour';"); |
39 | 39 | _Logging::appLog("2 hour reset"); |
40 | 40 | } |
41 | -if($options['r']=='1hour'){ |
|
41 | +if ($options['r']=='1hour') { |
|
42 | 42 | $mysql->runQuery("update users set beenChecked = 0 where checkFrequency = '1hour';"); |
43 | 43 | _Logging::appLog("1 hour reset"); |
44 | 44 | } |
45 | -if($options['r']=='deleteOld'){ |
|
45 | +if ($options['r']=='deleteOld') { |
|
46 | 46 | //clear orphan status |
47 | 47 | $mysql->runQuery(" |
48 | 48 | delete mh |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | |
54 | 54 | $days = isset(Setup::$settings['history_keep_days']) ? (int)Setup::$settings['history_keep_days'] : 0; |
55 | 55 | |
56 | - if($days > 0){ |
|
56 | + if ($days > 0) { |
|
57 | 57 | $mysql->runQuery(" |
58 | 58 | delete from monitorHistory |
59 | 59 | where monitorTime <= DATE_SUB(NOW(), INTERVAL $days day) |
@@ -3,7 +3,9 @@ |
||
3 | 3 | set_time_limit(0); |
4 | 4 | |
5 | 5 | //prevent non cli access |
6 | -if(php_sapi_name()!=='cli') exit(); |
|
6 | +if(php_sapi_name()!=='cli') { |
|
7 | + exit(); |
|
8 | +} |
|
7 | 9 | |
8 | 10 | $dir = dirname(dirname(__FILE__)); |
9 | 11 | class_exists('Setup', false) or include($dir.'/classes/Setup.class.php'); |
@@ -5,7 +5,9 @@ |
||
5 | 5 | ini_set('memory_limit', '64M'); |
6 | 6 | |
7 | 7 | //prevent non cli access |
8 | -if(php_sapi_name()!=='cli') exit(); |
|
8 | +if(php_sapi_name()!=='cli') { |
|
9 | + exit(); |
|
10 | +} |
|
9 | 11 | |
10 | 12 | $dir = dirname(dirname(__FILE__)); |
11 | 13 | class_exists('Setup', false) or include($dir.'/classes/Setup.class.php'); |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | ini_set('memory_limit', '64M'); |
6 | 6 | |
7 | 7 | //prevent non cli access |
8 | -if(php_sapi_name()!=='cli') exit(); |
|
8 | +if (php_sapi_name()!=='cli') exit(); |
|
9 | 9 | |
10 | 10 | $dir = dirname(dirname(__FILE__)); |
11 | 11 | class_exists('Setup', false) or include($dir.'/classes/Setup.class.php'); |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | $options = getopt("h:"); |
17 | 17 | $options['h'] = isset($options['h']) ? trim($options['h']) : ''; |
18 | 18 | |
19 | -if($options['h'] == ''){ |
|
19 | +if ($options['h']=='') { |
|
20 | 20 | _Logging::appLog("monitorJob called without params"); |
21 | 21 | exit(); |
22 | 22 | } |
@@ -28,14 +28,14 @@ discard block |
||
28 | 28 | select * |
29 | 29 | from monitors |
30 | 30 | where ipDomain = '".$mysql->escape($options['h'])."'"); |
31 | -while($row = mysqli_fetch_array($rs)) { |
|
31 | +while ($row = mysqli_fetch_array($rs)) { |
|
32 | 32 | $monitor = $row; |
33 | 33 | } |
34 | 34 | |
35 | 35 | // get blacklists |
36 | 36 | Utilities::setBlockLists(); |
37 | 37 | |
38 | -if( (empty(Utilities::$domainBlacklists)===true) && (empty(Utilities::$ipBlacklists)===true) ){ |
|
38 | +if ((empty(Utilities::$domainBlacklists)===true) && (empty(Utilities::$ipBlacklists)===true)) { |
|
39 | 39 | _Logging::appLog("no blacklists configured"); |
40 | 40 | exit(); |
41 | 41 | } |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | |
60 | 60 | |
61 | 61 | // status change on this host |
62 | -if(strcasecmp($result, $monitor['status']) != 0){ |
|
62 | +if (strcasecmp($result, $monitor['status'])!=0) { |
|
63 | 63 | //update current status |
64 | 64 | $mysql->runQuery(" |
65 | 65 | update monitors |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | |
83 | 83 | //make api callback |
84 | 84 | $user = Utilities::getAccount(); |
85 | - if($user['apiCallbackURL']!=''){ |
|
85 | + if ($user['apiCallbackURL']!='') { |
|
86 | 86 | Utilities::makeAPICallback($user['apiCallbackURL'], |
87 | 87 | $monitor['ipDomain'], |
88 | 88 | $isBlocked, |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | ini_set('memory_limit', '1024M'); |
5 | 5 | |
6 | 6 | //prevent non cli access |
7 | -if(php_sapi_name()!=='cli') exit(); |
|
7 | +if (php_sapi_name()!=='cli') exit(); |
|
8 | 8 | |
9 | 9 | $dir = dirname(dirname(__FILE__)); |
10 | 10 | class_exists('Setup', false) or include($dir.'/classes/Setup.class.php'); |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | $options = getopt("i:"); |
20 | 20 | $parentProcessId = isset($options['i']) ? (int)$options['i'] : 0; |
21 | 21 | |
22 | -if($parentProcessId == 0){ |
|
22 | +if ($parentProcessId==0) { |
|
23 | 23 | _Logging::appLog("userJob called without all params"); |
24 | 24 | exit(); |
25 | 25 | } |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | // get the accounts blacklists |
38 | 38 | Utilities::setBlockLists(); |
39 | 39 | |
40 | -if( (empty(Utilities::$domainBlacklists)===true) && (empty(Utilities::$ipBlacklists)===true) ){ |
|
40 | +if ((empty(Utilities::$domainBlacklists)===true) && (empty(Utilities::$ipBlacklists)===true)) { |
|
41 | 41 | _Logging::appLog("no blacklists configured"); |
42 | 42 | // mark this one as ran |
43 | 43 | $mysql->runQuery("update users set beenChecked = 1, lastChecked = '".date('Y-m-d H:i:s')."'"); |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | |
47 | 47 | //anything to monitor? |
48 | 48 | $monitorCount = Utilities::getHostCount($mysql); |
49 | -if($monitorCount==0){ |
|
49 | +if ($monitorCount==0) { |
|
50 | 50 | _Logging::appLog("nothing to monitor"); |
51 | 51 | exit(); |
52 | 52 | } |
@@ -55,15 +55,15 @@ discard block |
||
55 | 55 | $mysql->runQuery("update monitors set beenChecked = 0"); |
56 | 56 | |
57 | 57 | // wait for results |
58 | -while(true){ |
|
59 | - if(!Utilities::is_process_running($parentProcessId)){ |
|
58 | +while (true) { |
|
59 | + if (!Utilities::is_process_running($parentProcessId)) { |
|
60 | 60 | _Logging::appLog("parent died - userJob exited"); |
61 | 61 | exit(); |
62 | 62 | } |
63 | 63 | $rs = $mysql->runQuery("select ipDomain from monitors where beenChecked = 0 limit 1;"); |
64 | - if($row = mysqli_fetch_array($rs)){ |
|
65 | - sleep(4);//wait 4 seconds for them to finish |
|
66 | - }else{ |
|
64 | + if ($row = mysqli_fetch_array($rs)) { |
|
65 | + sleep(4); //wait 4 seconds for them to finish |
|
66 | + }else { |
|
67 | 67 | break; |
68 | 68 | } |
69 | 69 | } |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | $newCleanHosts = Utilities::getHostCleanCount($mysql, 0, true); |
83 | 83 | |
84 | 84 | |
85 | -if($hostsChanged > 0 && $user['disableEmailNotices']==0){ |
|
85 | +if ($hostsChanged > 0 && $user['disableEmailNotices']==0) { |
|
86 | 86 | $table = ""; |
87 | 87 | $summary = ""; |
88 | 88 | $summaryText = ""; |
@@ -100,13 +100,13 @@ discard block |
||
100 | 100 | |
101 | 101 | $summary .= "<br><div><a href='$url/m.php'>Monitor Groups</a></div><br>"; |
102 | 102 | |
103 | - if( (isset(Setup::$settings['email_report_detailed_host_changes'])) |
|
104 | - && (Setup::$settings['email_report_detailed_host_changes']==true) ){ |
|
103 | + if ((isset(Setup::$settings['email_report_detailed_host_changes'])) |
|
104 | + && (Setup::$settings['email_report_detailed_host_changes']==true)) { |
|
105 | 105 | $table .= '<hr>'; |
106 | 106 | $table .= '<strong>New Blocks</strong><br>'; |
107 | 107 | $rs = $mysql->runQuery("select m.ipDomain, mg.groupName FROM monitors m inner join monitorGroup mg on mg.id = m.monitorGroupId where m.isBlocked = 1 and m.lastStatusChanged = 1 order by m.isDomain desc, m.ipDomain"); |
108 | 108 | $table .= '<table width="100%">'; |
109 | - while($row = mysqli_fetch_array($rs)){ |
|
109 | + while ($row = mysqli_fetch_array($rs)) { |
|
110 | 110 | $table .= '<tr>'; |
111 | 111 | $table .= '<td><a href="'.$url.'"/hostHistory.php?host='.urlencode($row['ipDomain']).'">'.$row['ipDomain'].'</a></td><td>'.$row['groupName'].'</td>'; |
112 | 112 | $table .= '</tr>'; |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | $table .= '<strong>New Clean</strong><br>'; |
118 | 118 | $rs = $mysql->runQuery("select m.ipDomain, mg.groupName FROM monitors m inner join monitorGroup mg on mg.id = m.monitorGroupId where m.isBlocked = 0 and m.lastStatusChanged = 1 order by m.isDomain desc, m.ipDomain"); |
119 | 119 | $table .= '<table width="100%">'; |
120 | - while($row = mysqli_fetch_array($rs)){ |
|
120 | + while ($row = mysqli_fetch_array($rs)) { |
|
121 | 121 | $table .= '<tr>'; |
122 | 122 | $table .= '<td><a href="'.$url.'"/hostHistory.php?host='.urlencode($row['ipDomain']).'">'.$row['ipDomain'].'</a></td><td>'.$row['groupName'].'</td>'; |
123 | 123 | $table .= '</tr>'; |
@@ -133,16 +133,16 @@ discard block |
||
133 | 133 | $summaryText .= "New Blocked: ".number_format($newErrorHosts)."\n"; |
134 | 134 | $summaryText .= "New Clean: ".number_format($newCleanHosts)."\n"; |
135 | 135 | |
136 | - $e = explode("\n",$user['noticeEmailAddresses']); |
|
137 | - if( (count($e) > 0) && (Setup::$settings['smtp_server']!='') ){ |
|
136 | + $e = explode("\n", $user['noticeEmailAddresses']); |
|
137 | + if ((count($e) > 0) && (Setup::$settings['smtp_server']!='')) { |
|
138 | 138 | // regular email |
139 | 139 | $mail = new PHPMailer(); |
140 | 140 | $mail->IsSMTP(); |
141 | 141 | $mail->Host = Setup::$settings['smtp_server']; |
142 | 142 | $mail->From = Setup::$settings['from_email']; |
143 | 143 | $mail->FromName = Setup::$settings['from_name']; |
144 | - foreach($e as $a){ |
|
145 | - if(trim($a)!=''){ |
|
144 | + foreach ($e as $a) { |
|
145 | + if (trim($a)!='') { |
|
146 | 146 | $mail->AddAddress($a); |
147 | 147 | } |
148 | 148 | } |
@@ -153,15 +153,15 @@ discard block |
||
153 | 153 | } |
154 | 154 | |
155 | 155 | // text message |
156 | - $e = explode("\n",$user['textMessageEmails']); |
|
157 | - if( (count($e) > 0) && (Setup::$settings['smtp_server']!='') ){ |
|
156 | + $e = explode("\n", $user['textMessageEmails']); |
|
157 | + if ((count($e) > 0) && (Setup::$settings['smtp_server']!='')) { |
|
158 | 158 | $mail = new PHPMailer(); |
159 | 159 | $mail->IsSMTP(); |
160 | 160 | $mail->Host = Setup::$settings['smtp_server']; |
161 | 161 | $mail->From = Setup::$settings['from_email']; |
162 | 162 | $mail->FromName = Setup::$settings['from_name']; |
163 | - foreach($e as $a){ |
|
164 | - if(trim($a)!=''){ |
|
163 | + foreach ($e as $a) { |
|
164 | + if (trim($a)!='') { |
|
165 | 165 | $mail->AddAddress($a); |
166 | 166 | } |
167 | 167 | } |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | $mail->Send(); |
172 | 172 | } |
173 | 173 | |
174 | - if($user['twitterHandle']!=''){ |
|
174 | + if ($user['twitterHandle']!='') { |
|
175 | 175 | $t = new Twitter(); |
176 | 176 | $t->message($user['twitterHandle'], $summaryText); |
177 | 177 | } |
@@ -4,7 +4,9 @@ discard block |
||
4 | 4 | ini_set('memory_limit', '1024M'); |
5 | 5 | |
6 | 6 | //prevent non cli access |
7 | -if(php_sapi_name()!=='cli') exit(); |
|
7 | +if(php_sapi_name()!=='cli') { |
|
8 | + exit(); |
|
9 | +} |
|
8 | 10 | |
9 | 11 | $dir = dirname(dirname(__FILE__)); |
10 | 12 | class_exists('Setup', false) or include($dir.'/classes/Setup.class.php'); |
@@ -63,7 +65,7 @@ discard block |
||
63 | 65 | $rs = $mysql->runQuery("select ipDomain from monitors where beenChecked = 0 limit 1;"); |
64 | 66 | if($row = mysqli_fetch_array($rs)){ |
65 | 67 | sleep(4);//wait 4 seconds for them to finish |
66 | - }else{ |
|
68 | + } else{ |
|
67 | 69 | break; |
68 | 70 | } |
69 | 71 | } |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | <html lang="en"> |
5 | 5 | <head> |
6 | 6 | <meta charset="utf-8"> |
7 | - <title><?php if(isset($titlePreFix)) echo("$titlePreFix | ");?>Open Source Blacklist Monitoring</title> |
|
7 | + <title><?php if (isset($titlePreFix)) echo("$titlePreFix | "); ?>Open Source Blacklist Monitoring</title> |
|
8 | 8 | <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
9 | 9 | <script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script> |
10 | 10 | <script type="text/javascript" src="//www.google.com/jsapi"></script> |
@@ -22,16 +22,16 @@ discard block |
||
22 | 22 | <div class="container"> |
23 | 23 | <div class="header"> |
24 | 24 | <ul class="nav nav-pills pull-right"> |
25 | - <?php $pageName = basename($_SERVER['PHP_SELF']);?> |
|
25 | + <?php $pageName = basename($_SERVER['PHP_SELF']); ?> |
|
26 | 26 | <?php |
27 | - if(Utilities::isLoggedIn()!==false){ |
|
27 | + if (Utilities::isLoggedIn()!==false) { |
|
28 | 28 | ?> |
29 | - <li <?php if(in_array($pageName,array('account.php','hosts.php','blockLists.php','apiDocumentation.php','hostHistory.php'))) echo('class="active"');?>><a href="account.php">Profile</a></li> |
|
29 | + <li <?php if (in_array($pageName, array('account.php', 'hosts.php', 'blockLists.php', 'apiDocumentation.php', 'hostHistory.php'))) echo('class="active"'); ?>><a href="account.php">Profile</a></li> |
|
30 | 30 | <li><a href="login.php?logout=1">Logout</a></li> |
31 | 31 | <?php |
32 | - }else{ |
|
32 | + }else { |
|
33 | 33 | ?> |
34 | - <li <?php if($pageName=='login.php' || $pageName=='index.php' ) echo('class="active"');?>><a href="login.php">Login</a><li> |
|
34 | + <li <?php if ($pageName=='login.php' || $pageName=='index.php') echo('class="active"'); ?>><a href="login.php">Login</a><li> |
|
35 | 35 | <?php |
36 | 36 | } |
37 | 37 | ?> |
@@ -4,7 +4,10 @@ discard block |
||
4 | 4 | <html lang="en"> |
5 | 5 | <head> |
6 | 6 | <meta charset="utf-8"> |
7 | - <title><?php if(isset($titlePreFix)) echo("$titlePreFix | ");?>Open Source Blacklist Monitoring</title> |
|
7 | + <title><?php if(isset($titlePreFix)) { |
|
8 | + echo("$titlePreFix | "); |
|
9 | +} |
|
10 | +?>Open Source Blacklist Monitoring</title> |
|
8 | 11 | <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
9 | 12 | <script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script> |
10 | 13 | <script type="text/javascript" src="//www.google.com/jsapi"></script> |
@@ -26,12 +29,18 @@ discard block |
||
26 | 29 | <?php |
27 | 30 | if(Utilities::isLoggedIn()!==false){ |
28 | 31 | ?> |
29 | - <li <?php if(in_array($pageName,array('account.php','hosts.php','blockLists.php','apiDocumentation.php','hostHistory.php'))) echo('class="active"');?>><a href="account.php">Profile</a></li> |
|
32 | + <li <?php if(in_array($pageName,array('account.php','hosts.php','blockLists.php','apiDocumentation.php','hostHistory.php'))) { |
|
33 | + echo('class="active"'); |
|
34 | +} |
|
35 | +?>><a href="account.php">Profile</a></li> |
|
30 | 36 | <li><a href="login.php?logout=1">Logout</a></li> |
31 | 37 | <?php |
32 | - }else{ |
|
38 | + } else{ |
|
33 | 39 | ?> |
34 | - <li <?php if($pageName=='login.php' || $pageName=='index.php' ) echo('class="active"');?>><a href="login.php">Login</a><li> |
|
40 | + <li <?php if($pageName=='login.php' || $pageName=='index.php' ) { |
|
41 | + echo('class="active"'); |
|
42 | +} |
|
43 | +?>><a href="login.php">Login</a><li> |
|
35 | 44 | <?php |
36 | 45 | } |
37 | 46 | ?> |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | |
6 | 6 | $groupName = array_key_exists('searchS', $_GET) ? trim($_GET['searchS']) : ''; |
7 | 7 | |
8 | -if(Utilities::isLoggedIn()===false){ |
|
8 | +if (Utilities::isLoggedIn()===false) { |
|
9 | 9 | header('Location: login.php?location='.urlencode('monitorGroup.php')); |
10 | 10 | exit(); |
11 | 11 | } |
@@ -57,13 +57,13 @@ discard block |
||
57 | 57 | </thead> |
58 | 58 | <tbody> |
59 | 59 | <?php |
60 | - while($row = mysqli_fetch_array($rs)){ |
|
60 | + while ($row = mysqli_fetch_array($rs)) { |
|
61 | 61 | echo('<tr>'); |
62 | 62 | echo('<td><a href="editHostGroup.php?id='.$row['id'].'"><div class="glyphicon glyphicon-pencil glyphicon-pencil-lg"></div></a> <a href="hosts.php?monitorGroupId='.urlencode($row['id']).'">'.$row['groupName'].'</a></td>'); |
63 | - echo('<td>'.number_format($row['hostCount'],0).'</td>'); |
|
64 | - echo('<td>'.number_format($row['hostCountError'],0).'</td>'); |
|
65 | - echo('<td>'.number_format($row['hostRecentBlock'],0).'</td>'); |
|
66 | - echo('<td>'.number_format((($row['hostCount']>0) ? ($row['hostCountError']/$row['hostCount']*100) : 0),1).'</td>'); |
|
63 | + echo('<td>'.number_format($row['hostCount'], 0).'</td>'); |
|
64 | + echo('<td>'.number_format($row['hostCountError'], 0).'</td>'); |
|
65 | + echo('<td>'.number_format($row['hostRecentBlock'], 0).'</td>'); |
|
66 | + echo('<td>'.number_format((($row['hostCount'] > 0) ? ($row['hostCountError']/$row['hostCount']*100) : 0), 1).'</td>'); |
|
67 | 67 | echo('</tr>'); |
68 | 68 | } |
69 | 69 | $mysql->close(); |