Add automatic donation drives

This commit is contained in:
Alex Cabal 2024-10-17 11:55:03 -05:00
parent d8ed44e20e
commit 19cf14c1aa
10 changed files with 396 additions and 296 deletions

View file

@ -1,5 +1,20 @@
<? if($GLOBALS['User'] === null){
// The Kindle browsers renders <aside> as an undismissable popup. Serve a <div> to Kindle instead. See https://github.com/standardebooks/web/issues/204
<?
// Hide this alert if...
$donationDrive = DonationDrive::GetByIsRunning();
if(
$GLOBALS['User'] !== null // If a user is logged in.
||
$donationDrive !== null // There is a currently-running donation drive.
||
rand(1, 5) <= 3 // A 3-in-5 chance occurs.
){
return;
}
if($GLOBALS['User'] === null){
// The Kindle browsers renders `<aside>` as an undismissable popup. Serve a `<div>` to Kindle instead.
// See <https://github.com/standardebooks/web/issues/204>.
$element = 'aside';
if(stripos($_SERVER['HTTP_USER_AGENT'] ?? '', 'kindle') !== false){