Change the way the darkmode is activated

The dark mode can now be activated or deactivated via the maintenance page with the help of a button.
This commit is contained in:
leiweibau
2022-06-22 21:42:18 +02:00
parent cf92ee43f8
commit d5e44ffb89
5 changed files with 49 additions and 20 deletions

View File

@@ -41,6 +41,7 @@
case 'deleteEvents': deleteEvents(); break;
case 'PiaBackupDBtoArchive': PiaBackupDBtoArchive(); break;
case 'PiaRestoreDBfromArchive': PiaRestoreDBfromArchive(); break;
case 'PiaEnableDarkmode': PiaEnableDarkmode(); break;
case 'getDevicesTotals': getDevicesTotals(); break;
case 'getDevicesList': getDevicesList(); break;
@@ -314,6 +315,25 @@ function PiaRestoreDBfromArchive() {
}
//------------------------------------------------------------------------------
// Switch Themes
//------------------------------------------------------------------------------
function PiaEnableDarkmode() {
$file = '../../../db/darkmode';
if (file_exists($file)) {
echo 'Darkmode Disabled';
unlink($file);
echo("<meta http-equiv='refresh' content='1'>");
} else {
echo 'Darkmode Enabled';
$darkmode = fopen($file, 'w');
echo("<meta http-equiv='refresh' content='1'>");
}
}
//------------------------------------------------------------------------------
// Query total numbers of Devices by status
//------------------------------------------------------------------------------