mirror of
https://github.com/standardebooks/web.git
synced 2025-07-19 12:54:48 -04:00
Merge reset.css into core.css, and add settings page for specifying dark mode preferences
This commit is contained in:
parent
27d081b644
commit
11224136d1
9 changed files with 272 additions and 196 deletions
21
www/settings/post.php
Normal file
21
www/settings/post.php
Normal file
|
@ -0,0 +1,21 @@
|
|||
<?
|
||||
require_once('Core.php');
|
||||
|
||||
$colorScheme = $_POST['color-scheme'] ?? 'auto';
|
||||
|
||||
if($colorScheme !== 'dark' && $colorScheme !== 'light' && $colorScheme !== 'auto'){
|
||||
$colorScheme = 'auto';
|
||||
}
|
||||
|
||||
if($colorScheme == 'auto'){
|
||||
// Delete the cookie; auto is the default
|
||||
setcookie('color-scheme', null, ['expires' => 0, 'path' => '/', 'secure' => true, 'httponly' => true]);
|
||||
}
|
||||
else{
|
||||
setcookie('color-scheme', $colorScheme, ['expires' => strtotime('+10 years'), 'path' => '/', 'secure' => true, 'httponly' => true]);
|
||||
}
|
||||
|
||||
// HTTP 303, See other
|
||||
http_response_code(303);
|
||||
header('Location: /settings');
|
||||
?>
|
Loading…
Add table
Add a link
Reference in a new issue