mirror of
https://github.com/standardebooks/web.git
synced 2025-07-22 15:24:46 -04:00
Add donation drive scaffolding
This commit is contained in:
parent
60585024b1
commit
bbe89b0baf
21 changed files with 472 additions and 85 deletions
|
@ -3,21 +3,30 @@ require_once('Core.php');
|
|||
|
||||
use function Safe\strtotime;
|
||||
|
||||
$colorScheme = $_POST['color-scheme'] ?? 'auto';
|
||||
$hideDonationAlert = HttpInput::Bool(POST, 'hide-donation-alert');
|
||||
$colorScheme = HttpInput::Str(POST, 'color-scheme');
|
||||
|
||||
if($colorScheme !== 'dark' && $colorScheme !== 'light' && $colorScheme !== 'auto'){
|
||||
$colorScheme = 'auto';
|
||||
if($hideDonationAlert !== null){
|
||||
setcookie('hide-donation-alert', $hideDonationAlert ? 'true' : 'false', strtotime('+1 month'), '/', '', true, true);
|
||||
}
|
||||
|
||||
if($colorScheme == 'auto'){
|
||||
// Delete the cookie; auto is the default
|
||||
setcookie('color-scheme', '', 0, '/', '', true, true);
|
||||
}
|
||||
else{
|
||||
setcookie('color-scheme', $colorScheme, strtotime('+10 years'), '/', '', true, true);
|
||||
if($colorScheme !== null){
|
||||
if($colorScheme !== 'dark' && $colorScheme !== 'light' && $colorScheme !== 'auto'){
|
||||
$colorScheme = 'auto';
|
||||
}
|
||||
|
||||
if($colorScheme == 'auto'){
|
||||
// Delete the cookie; auto is the default
|
||||
setcookie('color-scheme', '', 0, '/', '', true, true);
|
||||
}
|
||||
else{
|
||||
setcookie('color-scheme', $colorScheme, strtotime('+1 year'), '/', '', true, true);
|
||||
}
|
||||
}
|
||||
|
||||
// HTTP 303, See other
|
||||
http_response_code(303);
|
||||
header('Location: /settings');
|
||||
|
||||
$redirect = $_SERVER['HTTP_REFERER'] ?? '/';
|
||||
header('Location: ' . $redirect);
|
||||
?>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue