This repository has been archived on 2023-10-16. You can view files and clone it, but cannot push or open issues or pull requests.
2022-05-08 02:37:00 +08:00

136 lines
3.9 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?PHP
// 获取数据
$group = $_POST["Group"];
$time = date("H:i"); // 获取服务器时间
// 判断(赋予Cookie)
if (!$group == NULL) {
if ($group == "A") {
// 移除Cookie符合根据时间自动判断
setcookie("color","",time()-1,"/");
} elseif ($group == "B") {
setcookie( "color", "light" , time() + 43200 , "/" );
} elseif ($group == "C") {
setcookie( "color", "night" , time() + 43200 , "/" );
} elseif ($group == "01") { // 主题色自选
setcookie( "color", "green" , time() + 86400 , "/" );
} elseif ($group == "02") { // 主题色自选
setcookie( "color", "amber" , time() + 86400 , "/" );
} elseif ($group == "03") { // 主题色自选
setcookie( "color", "light-blue" , time() + 86400 , "/" );
} elseif ($group == "04") { // 主题色自选
setcookie( "color", "indigo" , time() + 86400 , "/" );
}
$group = NULL;
header("location:?");
}
// 判断开启
if (isset($_COOKIE["color"]) == NULL) {
// 判断时间
if ($time >= "18:00" && $time <= "23:59" or $time >= "00.00" && $time <= "06:00") {
// 执行函数
function check_night_time_primary() {
echo "grey";
}
function check_night_time_accent() {
echo "pink";
}
function check_night_black() {
echo "mdui-theme-layout-dark";
}
} else {
// 执行函数
function check_night_time_primary() {
global $setting;
echo $setting["Web"]["color"];
}
function check_night_time_accent() {
global $setting;
echo $setting["Web"]["subcolor"];
}
function check_night_black() {}
}
} else {
// Light
if ($_COOKIE["color"] == "light") {
// 执行函数
function check_night_time_primary() {
echo "light-green";
}
function check_night_time_accent() {
echo "blue";
}
function check_night_black() {}
}
// Night
if ($_COOKIE["color"] == "night") {
// 执行函数
function check_night_time_primary() {
echo "grey";
}
function check_night_time_accent() {
echo "pink";
}
function check_night_black() {
echo "mdui-theme-layout-dark";
}
}
// green
if ($_COOKIE["color"] == "green") {
// 执行函数
function check_night_time_primary() {
echo "light-green";
}
function check_night_time_accent() {
echo "blue";
}
function check_night_black() {}
}
// amber
if ($_COOKIE["color"] == "amber") {
// 执行函数
function check_night_time_primary() {
echo "amber";
}
function check_night_time_accent() {
echo "deep-orange";
}
function check_night_black() {}
}
// light-blue
if ($_COOKIE["color"] == "light-blue") {
// 执行函数
function check_night_time_primary() {
echo "light-blue";
}
function check_night_time_accent() {
echo "deep-purple";
}
function check_night_black() {}
}
// indigo
if ($_COOKIE["color"] == "indigo") {
// 执行函数
function check_night_time_primary() {
echo "indigo";
}
function check_night_time_accent() {
echo "pink";
}
function check_night_black() {}
}
}
// DeBUG模式报错查询
if ($setting["Debug"] == true) {
echo "[DeBUG] 主题颜色配置:\n\n";
echo "\ncheck_night_time_primary函数模块输出";
check_night_time_primary();
echo "\ncheck_night_time_accent函数模块输出";
check_night_time_accent();
echo "\ncheck_night_black函数模块输出";
check_night_black();
echo "\nCookie调用情况";
echo $_COOKIE["color"];
}