From 5e728255fab052f2e5488987cfe5fc416aee047b Mon Sep 17 00:00:00 2001 From: DL6ER Date: Tue, 31 Jan 2017 11:48:02 +0100 Subject: [PATCH] Exclude whitelisted domains from showing up in the Top Ads List --- scripts/pi-hole/php/data.php | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/scripts/pi-hole/php/data.php b/scripts/pi-hole/php/data.php index 8c6a8b7e..1071e0e3 100644 --- a/scripts/pi-hole/php/data.php +++ b/scripts/pi-hole/php/data.php @@ -103,6 +103,20 @@ ); } + // Test if variable exists and is positive + function ispositive(&$arg) + { + if(isset($arg)) + { + if($arg > 0) + { + return true; + } + return false; + } + return false; + } + function getTopItems($argument) { global $log,$setupVars,$privacyMode; @@ -136,7 +150,7 @@ // Process sorted domain names foreach ($dns_domains as $key => $value) { - if(isset($gravity_domains[$key]) && $adcounter < $qty) + if(ispositive($gravity_domains[$key]) && $adcounter < $qty) { // New entry for Top Ads $topAds[$key] = $value;