100 lines
2.8 KiB
PHP
100 lines
2.8 KiB
PHP
<?php
|
|
header('X-Content-Type-Options: nosniff');
|
|
header('X-Frame-Options: deny');
|
|
header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
|
|
header("Cache-Control: post-check=0, pre-check=0", false);
|
|
header("Pragma: no-cache");
|
|
header('X-Powered-By: kbsz');
|
|
|
|
/*
|
|
|
|
=============================================
|
|
kjokmjnoi API menu design updater
|
|
=============================================
|
|
|
|
This file checks and, if necessary, updates the design of the admin panel.
|
|
Panel created by: kjokmjnoi (https://api.kjokmjnoi.hu)
|
|
If you have some question please send me an email: sperg.tamas@kjokmjnoi.hu
|
|
|
|
This file version is: 2.1
|
|
|
|
============================================
|
|
SETTINGS
|
|
============================================
|
|
*/
|
|
|
|
|
|
$localfile = "panel.css"; // Define where is the style (.css) file.
|
|
|
|
//Cusom colors
|
|
//Be informed about the possible color settings before editing
|
|
|
|
$ColorSettings = [
|
|
"panelcolor" => "#2980b9", //Default: #2980b9
|
|
"bgcolor" => "#f5f5f5", //Default: #f5f5f5
|
|
"toppanel" => "#ffffff" //Default: #ffffff
|
|
];
|
|
|
|
//Custom CSS
|
|
|
|
$CustomCSS = file_get_contents("custom_panel.css");
|
|
|
|
/*
|
|
==== End Settings ====
|
|
|
|
|
|
|
|
|
|
--- Check and update ---
|
|
*/
|
|
|
|
$newestversion = file_get_contents("https://api.kjokmjnoi.hu/css/panel.css").$CustomCSS;
|
|
$currentversion = file_get_contents($localfile);
|
|
$version = substr($newestversion, 70, 14);
|
|
|
|
foreach ($ColorSettings as $name => $value) {
|
|
$rootcolorname = "--".$name.": ";
|
|
$rootcolorname_pos = strpos($newestversion, $rootcolorname);
|
|
|
|
$rootvalue = "";
|
|
if ($rootcolorname_pos !== false) {
|
|
$colorvalue_pos = strpos($newestversion, ";", $rootcolorname_pos);
|
|
if ($colorvalue_pos !== false) {
|
|
$rootvalue = substr($newestversion, $rootcolorname_pos, $colorvalue_pos - $rootcolorname_pos + 1);
|
|
} else {
|
|
$rootvalue = substr($newestversion, $rootcolorname_pos);
|
|
}
|
|
}
|
|
|
|
if ($rootvalue == "") {
|
|
echo "Error, There is no color value under the name '".$name."'<br>";
|
|
} else {
|
|
$newrootvalue = $rootcolorname.$value.";";
|
|
if ($newrootvalue != $rootvalue) {
|
|
$newestversion = str_replace($rootvalue, $newrootvalue, $newestversion);
|
|
echo "Color Setting: ".$rootvalue." -> ".$newrootvalue."<br>";
|
|
}
|
|
}
|
|
}
|
|
|
|
if ($newestversion != $currentversion) {
|
|
if (substr($newestversion, 7, 22) == "@license kjokmjnoi API") {
|
|
echo "Update design....";
|
|
$designfile = fopen($localfile, "w") or die("Unable to open css file!");
|
|
fwrite($designfile, $newestversion);
|
|
fclose($designfile);
|
|
echo "<br><br>Update finised!<br>";
|
|
print_r($version);
|
|
} else {
|
|
$version = substr($currentversion, 70, 14);
|
|
echo "The Design was been removed or temporarily unavailable.<br><br>Update failed!";
|
|
print_r($version);
|
|
echo " (Not synced)";
|
|
}
|
|
} else {
|
|
echo "The Design is on newest version.<br><br>";
|
|
print_r($version);
|
|
}
|
|
|
|
?>
|