Beispiel #1
0
function WriteTmpConfig()
{
    //1. Check if Latest Version is less than Current Version
    //2. Open Temp Config file for writing
    //3. Loop through Config Array
    //4. Write all values, except for "Status = Enabled"
    //5. Close Config File
    //6. Delete Config Array out of Memcache, in order to force reload
    //7. Onward process is to Display appropriate config view
    global $Config, $FileTmpConfig, $Mem, $Version;
    //Prevent wrong version being written to config file if user has just upgraded and old LatestVersion is still stored in Memcache
    if (Check_Version($Config['LatestVersion'])) {
        $Config['LatestVersion'] = $Version;
    }
    $FileHandle = fopen($FileTmpConfig, 'w');
    //Open temp config for writing
    foreach ($Config as $Key => $Value) {
        //Loop through Config array
        if ($Key == 'Status') {
            if ($Value != 'Enabled') {
                fwrite($FileHandle, $Key . ' = ' . $Value . PHP_EOL);
                //Write Key & Value
            }
        } else {
            fwrite($FileHandle, $Key . ' = ' . $Value . PHP_EOL);
            //Write Key & Value
        }
    }
    fclose($FileHandle);
    //Close file
    $Mem->delete('Config');
    //Delete config from Memcache
}
Beispiel #2
0
        //NoTrack not writing to CSV File
        echo '<a href="./config.php?v=sites"><div class="home-nav"><h2>Block List</h2><hr /><span>' . number_format(floatval(exec('/usr/local/sbin/notrack --count'))) . '<br />Domains</span><div class="icon-box"><img src="./svg/home_trackers.svg" alt=""></div></div></a>' . PHP_EOL;
    }
} else {
    //Block List missing
    echo '<a href="./config.php?v=sites"><div class="home-nav"><h2>Block List</h2><hr /><h6>File Not Found</h6><div class="icon-box"><img src="./svg/home_trackers.svg" alt=""></div></div></a>' . PHP_EOL;
}
//Sites Blocked
echo '<a href="./blocked.php"><div class="home-nav"><h2>Sites Blocked</h2><hr /><span>' . number_format(floatval(exec('grep -v admin /var/log/lighttpd/access.log | wc -l'))) . '<br />This Week</span><div class="icon-box"><img src="./svg/home_blocked.svg" alt=""></div></div></a>' . PHP_EOL;
//DNS Queries
echo '<a href="./queries.php"><div class="home-nav"><h2>DNS Queries</h2><hr /><span>' . number_format(floatval(exec('grep -F query[A] /var/log/notrack.log | wc -l'))) . '<br />Today</span><div class="icon-box"><img src="./svg/home_queries.svg" srcset="./svg/home_queries.svg" alt=""></div></div></a>' . PHP_EOL;
if (file_exists('/var/lib/misc/dnsmasq.leases')) {
    //DHCP Active
    echo '<a href="./dhcpleases.php"><div class="home-nav"><h2>Network</h2><hr /><span>' . number_format(floatval(exec('wc -l /var/lib/misc/dnsmasq.leases | cut -d\\  -f 1'))) . '<br />Systems</span><div class="icon-box"><img src="./svg/home_dhcp.svg" alt=""></div></div></a>' . PHP_EOL;
} else {
    //DHCP Disabled
    echo '<a href="./dhcpleases.php"><div class="home-nav"><h2>Network</h2><hr /><span>DHCP Disabled</span><div class="icon-box"><img class="full" src="./svg/home_dhcp.svg" alt=""></div></div></a>' . PHP_EOL;
}
echo '</div>' . PHP_EOL;
echo '<div class="row"><br /></div>' . PHP_EOL;
if ($Version != $Config['LatestVersion'] && Check_Version($Config['LatestVersion'])) {
    //See if upgrade Needed
    DrawSysTable('Upgrade');
    echo '<p>New version available: v' . $Config['LatestVersion'] . '&nbsp;&nbsp;<a class="button-grey" href="./upgrade.php">Upgrade</a></p>';
    echo '</table></div></div>' . PHP_EOL;
}
?>
</div>
</body>
</html>