function DisplayConfigChoices() { global $Config; echo '<form action="?" method="get">'; //Block Lists echo '<input type="hidden" name="action" value="blocklists">'; DrawSysTable('Block Lists'); DrawSysRow('NoTrack', '<input type="checkbox" name="blocklist_notrack"' . Checked($Config['BlockList_NoTrack']) . '> Default List, containing mixture of Trackers and Ad sites.'); DrawSysRow('Top Level Domain', '<input type="checkbox" name="blocklist_tld"' . Checked($Config['BlockList_TLD']) . '> Whole country and generic domains.'); DrawSysRow('AdBlock Plus EasyList', '<input type="checkbox" name="blocklist_easylist"' . Checked($Config['BlockList_EasyList']) . '> Utilises a small portion of the list to block entire Ad domains.'); DrawSysRow('EasyPrivacy', '<input type="checkbox" name="blocklist_easypriacy"' . Checked($Config['BlockList_EasyPrivacy']) . '> Supplementary list from AdBlock Plus to protect personal data.'); DrawSysRow('AdBlock Manager', '<input type="checkbox" name="blocklist_adblockmanager"' . Checked($Config['BlockList_AdBlockManager']) . '> Mostly Mobile Ad sites. Over 90% of this list is in NoTrack'); DrawSysRow('hpHosts', '<input type="checkbox" name="blocklist_hphosts"' . Checked($Config['BlockList_hpHosts']) . '> Very inefficient list containing multiple subdomains for known Ad sites.'); DrawSysRow('Malware Domains', '<input type="checkbox" name="blocklist_malwaredomains"' . Checked($Config['BlockList_MalwareDomains']) . '> A good list to add.'); DrawSysRow('PglYoyo', '<input type="checkbox" name="blocklist_pglyoyo"' . Checked($Config['BlockList_PglYoyo']) . '> Ad sites, a few are already in NoTrack.'); DrawSysRow('Someone Who Cares', '<input type="checkbox" name="blocklist_someonewhocares"' . Checked($Config['BlockList_SomeoneWhoCares']) . '> Mixture of Shock and Ad sites.'); DrawSysRow('WinHelp 2002', '<input type="checkbox" name="blocklist_winhelp2002"' . Checked($Config['BlockList_Winhelp2002']) . '> Very inefficient list containing multiple subdomains for known Ad sites.'); echo "</table><br />\n"; echo '<div class="centered"><input type="submit" value="Save Changes"></div>' . "\n"; echo "</div></div></form>\n"; echo '<form action="?" method="get">'; //Web Server echo '<input type="hidden" name="action" value="webserver">'; DrawSysTable('Web Server'); if ($Config['BlockMessage'] == 'pixel') { DrawSysRow('Block Message', '<input type="radio" name="block" value="pixel" checked>1x1 Blank Pixel (default)<br /><input type="radio" name="block" value="message">Message - Blocked by NoTrack<br />'); } else { DrawSysRow('Block Message', '<input type="radio" name="block" value="pixel">1x1 Blank Pixel (default)<br /><input type="radio" name="block" value="messge" checked>Message - Blocked by NoTrack<br />'); } echo "</table><br />\n"; echo '<div class="centered"><input type="submit" value="Save Changes"></div>' . "\n"; echo "</div></div></form>\n"; DrawSysTable('History'); DrawSysRow('Delete All History', '<button class="button-danger" type="reset" onclick="ConfirmLogDelete();">Purge</button>'); echo "</table></div></div>\n"; return null; }
} else { echo 'Invalid upgrade request'; } } else { //Just displaying status if ($Version == $Config['LatestVersion']) { //See if upgrade Needed DrawSysTable('NoTrack Upgrade'); DrawSysRow('Status', 'Running the latest version v' . $Version); DrawSysRow('Force Upgrade', 'Force upgrade to Development version of NoTrack<br /><button class="button-danger" onclick="window.location=\'?u=1\'">Upgrade</button>'); echo '</table>' . PHP_EOL; echo '</div></div>' . PHP_EOL; } else { DrawSysTable('NoTrack Upgrade'); DrawSysRow('Status', 'Running version v' . $Version . '<br />Latest version available: v' . $Config['LatestVersion']); DrawSysRow('Commence Upgrade', '<button class="button-blue" onclick="window.location=\'?u=1\'">Upgrade</button>'); echo '</table>' . PHP_EOL; echo '</div></div>' . PHP_EOL; } //Display changelog if (extension_loaded('curl')) { //Check if user has Curl installed $ch = curl_init(); //Initiate curl curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0'); curl_setopt($ch, CURLOPT_URL, 'https://raw.githubusercontent.com/quidsup/notrack/master/changelog.txt'); $Data = curl_exec($ch); //Download Changelog curl_close($ch);
DrawSysRow('Free Memory', $FreeMem[3] . ' MB'); DrawSysRow('Uptime', exec('uptime -p | cut -d \\ -f 2-')); DrawSysRow('NoTrack Version', $Version); echo "</table></div></div>\n"; DrawSysTable('Dnsmasq'); if ($PS_Dnsmasq[0] != null) { DrawSysRow('Status', 'Dnsmasq is running'); } else { DrawSysRow('Status', 'Inactive'); } DrawSysRow('Pid', $PS_Dnsmasq[1]); DrawSysRow('Started On', $PS_Dnsmasq[2]); DrawSysRow('Cpu', $PS_Dnsmasq[3]); DrawSysRow('Memory Used', $PS_Dnsmasq[4] . ' MB'); echo "</table></div></div>\n"; DrawSysTable('Lighttpd'); if ($PS_Lighttpd[0] != null) { DrawSysRow('Status', 'Lighttpd is running'); } else { DrawSysRow('Status', 'Inactive'); } DrawSysRow('Pid', $PS_Lighttpd[1]); DrawSysRow('Started On', $PS_Lighttpd[2]); DrawSysRow('Cpu', $PS_Lighttpd[3]); DrawSysRow('Memory Used', $PS_Lighttpd[4] . ' MB'); echo "</table></div></div>\n"; ?> </div> </body> </html>
function DisplayConfigChoices() { global $Config, $DirOldLogs, $Version, $SearchEngineList, $WhoIsList; $Load = sys_getloadavg(); $FreeMem = preg_split('/\\s+/', exec('free -m | grep Mem')); $PS_Dnsmasq = preg_split('/\\s+/', exec('ps -eo fname,pid,stime,pmem | grep dnsmasq')); $PS_Lighttpd = preg_split('/\\s+/', exec('ps -eo fname,pid,stime,pmem | grep lighttpd')); $Uptime = explode(',', exec('uptime'))[0]; if (preg_match('/\\d\\d\\:\\d\\d\\:\\d\\d\\040up\\040/', $Uptime) > 0) { $Uptime = substr($Uptime, 13); } //Cut time from string if it exists $fi = new FilesystemIterator($DirOldLogs, FilesystemIterator::SKIP_DOTS); DrawSysTable('Server'); DrawSysRow('Name', gethostname()); DrawSysRow('Network Device', $Config['NetDev']); if ($Config['IPVersion'] == 'IPv4' || $Config['IPVersion'] == 'IPv6') { DrawSysRow('Internet Protocol', $Config['IPVersion']); DrawSysRow('IP Address', $_SERVER['SERVER_ADDR']); } else { DrawSysRow('IP Address', $Config['IPVersion']); } DrawSysRow('Sysload', $Load[0] . ' | ' . $Load[1] . ' | ' . $Load[2]); DrawSysRow('Memory Used', $FreeMem[2] . ' MB'); DrawSysRow('Free Memory', $FreeMem[3] . ' MB'); DrawSysRow('Uptime', $Uptime); DrawSysRow('NoTrack Version', $Version); echo '</table></div></div>' . PHP_EOL; DrawSysTable('Dnsmasq'); if ($PS_Dnsmasq[0] != null) { DrawSysRow('Status', 'Dnsmasq is running'); } else { DrawSysRow('Status', 'Inactive'); } DrawSysRow('Pid', $PS_Dnsmasq[1]); DrawSysRow('Started On', $PS_Dnsmasq[2]); //DrawSysRow('Cpu', $PS_Dnsmasq[3]); DrawSysRow('Memory Used', $PS_Dnsmasq[3] . ' MB'); DrawSysRow('Historical Logs', iterator_count($fi) . ' Days'); DrawSysRow('Delete All History', '<button class="button-danger" onclick="ConfirmLogDelete();">Purge</button>'); echo '</table></div></div>' . PHP_EOL; //Web Server echo '<form name="blockmsg" action="?" method="post">'; echo '<input type="hidden" name="action" value="webserver">'; DrawSysTable('Lighttpd'); if ($PS_Lighttpd[0] != null) { DrawSysRow('Status', 'Lighttpd is running'); } else { DrawSysRow('Status', 'Inactive'); } DrawSysRow('Pid', $PS_Lighttpd[1]); DrawSysRow('Started On', $PS_Lighttpd[2]); //DrawSysRow('Cpu', $PS_Lighttpd[3]); DrawSysRow('Memory Used', $PS_Lighttpd[3] . ' MB'); if ($Config['BlockMessage'] == 'pixel') { DrawSysRow('Block Message', '<input type="radio" name="block" value="pixel" checked onclick="document.blockmsg.submit()">1x1 Blank Pixel (default)<br /><input type="radio" name="block" value="message" onclick="document.blockmsg.submit()">Message - Blocked by NoTrack<br />'); } else { DrawSysRow('Block Message', '<input type="radio" name="block" value="pixel" onclick="document.blockmsg.submit()">1x1 Blank Pixel (default)<br /><input type="radio" name="block" value="messge" checked onclick="document.blockmsg.submit()">Message - Blocked by NoTrack<br />'); } echo '</table></div></div></form>' . PHP_EOL; //Stats echo '<form name="stats" action="?" method="post">'; echo '<input type="hidden" name="action" value="stats">'; DrawSysTable('Domain Stats'); echo '<tr><td>Search Engine: </td>' . PHP_EOL; echo '<td><select name="search" onchange="submit()">' . PHP_EOL; echo '<option value="' . $Config['Search'] . '">' . $Config['Search'] . '</option>' . PHP_EOL; foreach ($SearchEngineList as $Site) { if ($Site != $Config['Search']) { echo '<option value="' . $Site . '">' . $Site . '</option>' . PHP_EOL; } } echo '</select></td></tr>' . PHP_EOL; echo '<tr><td>Who Is Lookup: </td>' . PHP_EOL; echo '<td><select name="whois" onchange="submit()">' . PHP_EOL; echo '<option value="' . $Config['WhoIs'] . '">' . $Config['WhoIs'] . '</option>' . PHP_EOL; foreach ($WhoIsList as $Site) { if ($Site != $Config['WhoIs']) { echo '<option value="' . $Site . '">' . $Site . '</option>' . PHP_EOL; } } echo '</select></td></tr>' . PHP_EOL; echo '</table></div></div></form>' . PHP_EOL; //End Stats //Security echo '<form name="security" action="?" method="post">'; echo '<input type="hidden" name="action" value="security">'; DrawSysTableHelp('Security', 'security'); DrawSysRow('NoTrack Username', '<input type="text" name="username" value="' . $Config['Username'] . '"><p><i>Optional authentication username.</i></p>'); DrawSysRow('NoTrack Password', '<input type="password" name="password"><p><i>Optional authentication password.</i></p>'); DrawSysRow('Delay', '<input type="number" name="delay" min="10" max="2400" value="' . $Config['Delay'] . '"><p><i>Delay in seconds between attempts.</i></p>'); echo '<tr><td colspan="2"><div class="centered"><input type="submit" value="Save Changes"></div></td></tr>'; echo '</table></div></div></form>' . PHP_EOL; return null; }