diff --git a/front/css/pialert.css b/front/css/pialert.css index e2577ab0..a56fae81 100644 --- a/front/css/pialert.css +++ b/front/css/pialert.css @@ -453,7 +453,7 @@ } .dbtools-button { - margin: 5px; display: inline-block; width: 140px; height: 140px; white-space: normal; word-wrap: break-word; font-size: 16px; border-radius: 10px; + margin: 5px; display: inline-block; width: 140px; height: 100px; white-space: normal; word-wrap: break-word; font-size: 16px; border-radius: 10px; } .db_info_table_cell:nth-child(1) {background: white} @@ -472,4 +472,4 @@ } .db_info_table_row {display: table-row; padding: 3px; } .db_info_table_cell {display: table-cell; padding: 3px; padding-left: 10px;} -} \ No newline at end of file + diff --git a/front/darkmode b/front/darkmode deleted file mode 100644 index e69de29b..00000000 diff --git a/front/maintenance.php b/front/maintenance.php index c67e2bbe..b26de1e2 100644 --- a/front/maintenance.php +++ b/front/maintenance.php @@ -28,7 +28,7 @@ -
+
+ + @@ -221,6 +223,22 @@ function PiaRestoreDBfromArchive() }); } +// Restore DB from Archive +function askPiaEnableDarkmode () { + // Ask + showModalWarning('Switch Theme', 'After the theme switch, the page tries to reload itself to activate the change. If necessary, the cache must be cleared.', + 'Cancel', 'Switch', 'PiaEnableDarkmode'); +} + + +function PiaEnableDarkmode() +{ + // Execute + $.get('php/server/devices.php?action=PiaEnableDarkmode', function(msg) { + showMessage (msg); + }); +} + diff --git a/front/php/server/devices.php b/front/php/server/devices.php index 8fa5249f..ef231d93 100644 --- a/front/php/server/devices.php +++ b/front/php/server/devices.php @@ -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(""); + } else { + echo 'Darkmode Enabled'; + $darkmode = fopen($file, 'w'); + echo(""); + } + } + + + //------------------------------------------------------------------------------ // Query total numbers of Devices by status //------------------------------------------------------------------------------ diff --git a/front/php/templates/header.php b/front/php/templates/header.php index cb4ed727..8228f4fe 100644 --- a/front/php/templates/header.php +++ b/front/php/templates/header.php @@ -8,7 +8,7 @@ #--------------------------------------------------------------------------- --> @@ -57,9 +57,7 @@ if (file_exists("darkmode")) { - - - + @@ -77,7 +75,7 @@ if ($ENABLED_DARKMODE === True) { var pia_servertime = new Date(); function show_pia_servertime() { - if (!document.all && !document.getElementById) { + if (!document.getElementById) { return; } var pia_hour = pia_servertime.getHours(); @@ -87,7 +85,7 @@ function show_pia_servertime() { if (pia_hour <= 9) { pia_hour = "0" + pia_hour; } if (pia_minute <= 9) { pia_minute = "0" + pia_minute; } if (pia_second <= 9) { pia_second = "0" + pia_second; } realtime_pia_servertime = "(" + pia_hour + ":" + pia_minute + ":" + pia_second + ")"; - if (document.getElementById) { document.getElementById("PIA_Servertime_place").innerHTML = realtime_pia_servertime; } else if (document.all) { PIA_Servertime_place.innerHTML = realtime_pia_servertime; } setTimeout("show_pia_servertime()", 1000); + if (document.getElementById) { document.getElementById("PIA_Servertime_place").innerHTML = realtime_pia_servertime; } setTimeout("show_pia_servertime()", 1000); } @@ -147,7 +145,7 @@ function show_pia_servertime() { - - - + - - - - - + - - +