mirror of
https://github.com/pi-hole/web.git
synced 2026-04-26 03:40:09 +01:00
* Remove double click handler * ~Today~ Over Last 24 Hours * Rename Top Advertisers to Top Blocked Domains * percentage should be a float instead of an integer * Define $over_time as array. Fixes #501 * Add hover/hit radius for Forward Destinations over Time graph * Add custom callback for tooltips and disable legend for Forward Destinations over Time graph * Remove legend, add tooltips and increase hit/hover radius for Query Types over Time graph. Fixes #502 * Don't hide detailed graphs on small screens any longer * 🌮 is the new :shipit: squirrel * revise wording on main page shorter text to fit in one line on smaller screens * Show warning in browser when fopen() failed * open links in new tab * open links in new tab * Update header.php * select 'Login' in Navbar when showing loginpage using the same term as it is already used to show up the loginpage (in line 565) * set the mainbox wider on smaller screens solves issue of overlapping text with loginbutton when using smaller screens * also fix overlapping loginpage on footerbar * remove border on logo * add link feedback (on hover) * sessiontimer in bold letters * use AdminLTE function to toggle dropdown-menu AdminLTE has already an implemented function to toggle the user menu. So there is no need to use an own script in footer.js Benefit: The dropdown-menu closes if you click on a blank Place * align donate-url with url in footerbar * remove function to open user menu AdminLTE has already an implemented function to toggle the user menu. So there is no need to use an own script in footer.js Benefit: The dropdown-menu closes if you click on a blank Place * Update LICENSE of the project to EUPL v1.2 * Major overhaul of update checker - checks only every 30 minutes to reduce number of GitHub API requests * Add version info to dropdown menu (top right) for viewing on small screens. Addresses #333 partially * Fix typo * footer.php: improve and clean up move animation-stylesheet to pi-hole.css (Have you noticed that there is even a text- and text-shadow animation set, but for webkit-browsers only) added <!-- Version Infos --> correct continuous hide of version info (AdminLTEs classed widths as `xs` > `sm` > `md` > `lg`) display Donate-text alwas in one line (do not wrap in between when version info string gets very long) * pi-hole.css: pasted animation stylesheet and improved the text-shadow-animation to work correctly with and without -webkit-prefix (for me this wasn't working until now) * header.php: some corrections & improvements pull dropdown-menu always to right side changed <!-- Update alerts --> to <!-- Version Infos --> (just like it is in footer) hide version infos in dropdown-menu if it gets shown in footer repaired update-urls, they also should open up in new tab & gets underlined on hover `background:none` is needed because AdminLTE adds dark bg on hover to links when using it on smallscreen (xs) * Minor change to make the dashboard's javascript compatible with escaped characters (like apostrophe) in client names * Add the same for the top domains * ... and Top Ads * Minor change to comments * footer.php: edited as discussed * header.php: edited as discussed * Update queryads.js * Update list.js * queryads.js: codacy fixes * list.js: codacy fixes * list.js: small correction * queryads.js: small correction * Be able to interpret status 5 * Sort list entries (black-/whitelist) alphabetically before creating the table * queryads.js: Update* * removed double comment and updated code to center and separate the buttons on small screens, like in my last screenshot. * list.js: update* updated code to center and separate the buttons on small screens, like in my last screenshot.
119 lines
3.5 KiB
PHP
119 lines
3.5 KiB
PHP
<?php
|
|
// Allow file_get_contents to read remote sources via URL
|
|
ini_set("allow_url_fopen", 1);
|
|
|
|
// Function that grabs latest tag from GitHub
|
|
function get_github_version($url)
|
|
{
|
|
// Have to fake the user agent to be able to query from Github's API
|
|
$context = stream_context_create(array("http" => array("user_agent" => "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36")));
|
|
|
|
$json = file_get_contents($url, false, $context);
|
|
$result = json_decode($json);
|
|
|
|
return $result->tag_name;
|
|
}
|
|
|
|
/********** Get Pi-hole core branch / version / commit **********/
|
|
// Check if on a dev branch
|
|
$core_branch = exec("cd /etc/.pihole/ && git rev-parse --abbrev-ref HEAD");
|
|
if($core_branch !== "master") {
|
|
$core_current = "vDev";
|
|
$core_commit = exec("cd /etc/.pihole/ && git describe --long --dirty --tags");
|
|
}
|
|
else {
|
|
$core_current = exec("cd /etc/.pihole/ && git describe --tags --abbrev=0");
|
|
}
|
|
|
|
/********** Get Pi-hole web branch / version / commit **********/
|
|
$web_branch = exec("git rev-parse --abbrev-ref HEAD");
|
|
if($web_branch !== "master") {
|
|
$web_current = "vDev";
|
|
$web_commit = exec("git describe --long --dirty --tags");
|
|
}
|
|
else {
|
|
$web_current = exec("git describe --tags --abbrev=0");
|
|
}
|
|
|
|
/********** Get Pi-hole FTL version (not a git repository) **********/
|
|
$FTL_current = exec("pihole-FTL version");
|
|
|
|
// can write only in the root web dir, i.e. /var/www/html
|
|
$versionfile = "../versions";
|
|
|
|
$check_version = false;
|
|
|
|
// Check version if version buffer file does not exist
|
|
if(is_readable($versionfile))
|
|
{
|
|
// Obtain latest time stamp from buffer file
|
|
$versions = explode(",",file_get_contents($versionfile));
|
|
$date = date_create();
|
|
$timestamp = date_timestamp_get($date);
|
|
|
|
// Is last check for updates older than 30 minutes?
|
|
if($timestamp >= intval($versions[0]) + 1800)
|
|
{
|
|
// Yes: Retrieve new/updated version data
|
|
$check_version = true;
|
|
}
|
|
else
|
|
{
|
|
// No: We can use the buffered data
|
|
$check_version = false;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
// No buffer file or not readable: Request version data
|
|
$check_version = true;
|
|
}
|
|
|
|
// Get data from GitHub if requested
|
|
if($check_version){
|
|
$core_latest = get_github_version("https://api.github.com/repos/pi-hole/pi-hole/releases/latest");
|
|
$web_latest = get_github_version("https://api.github.com/repos/pi-hole/AdminLTE/releases/latest");
|
|
$FTL_latest = get_github_version("https://api.github.com/repos/pi-hole/FTL/releases/latest");
|
|
|
|
// Save to buffer file
|
|
file_put_contents($versionfile, array($timestamp,",",$core_latest,",",$web_latest,",",$FTL_latest));
|
|
}
|
|
else
|
|
{
|
|
// Use data from buffer file
|
|
$core_latest = $versions[1];
|
|
$web_latest = $versions[2];
|
|
$FTL_latest = $versions[3];
|
|
}
|
|
|
|
// Core version comparison
|
|
if($core_current !== "vDev")
|
|
{
|
|
// This logic allows the local core version to be newer than the upstream version
|
|
// The update indicator is only shown if the upstream version is NEWER
|
|
$core_update = (version_compare($core_current, $core_latest) < 0);
|
|
}
|
|
else
|
|
{
|
|
$core_update = false;
|
|
}
|
|
|
|
// Web version comparison
|
|
if($web_current !== "vDev")
|
|
{
|
|
// This logic allows the local core version to be newer than the upstream version
|
|
// The update indicator is only shown if the upstream version is NEWER
|
|
$web_update = (version_compare($web_current, $web_latest) < 0);
|
|
}
|
|
else
|
|
{
|
|
$web_update = false;
|
|
}
|
|
|
|
// FTL version comparison
|
|
// This logic allows the local core version to be newer than the upstream version
|
|
// The update indicator is only shown if the upstream version is NEWER
|
|
$FTL_update = (version_compare($FTL_current, $FTL_latest) < 0);
|
|
|
|
?>
|