Fix expired download codes not clearing sometimes
This commit is contained in:
parent
879bd8d408
commit
012ae2d767
@ -19,18 +19,19 @@ use odsPhpGenerator\odsTableCellString;
|
|||||||
use odsPhpGenerator\odsStyleTableColumn;
|
use odsPhpGenerator\odsStyleTableColumn;
|
||||||
use odsPhpGenerator\odsStyleTableCell;
|
use odsPhpGenerator\odsStyleTableCell;
|
||||||
|
|
||||||
// Allow access with a one-time code, for mobile app and stuff
|
// Allow access with a download code, for mobile app and stuff
|
||||||
|
$date = date("Y-m-d H:i:s");
|
||||||
if (isset($VARS['code']) && LOADED) {
|
if (isset($VARS['code']) && LOADED) {
|
||||||
$date = date("Y-m-d H:i:s");
|
if (!$database2->has('report_access_codes', ["AND" => ['code' => $VARS['code'], 'expires[>]' => $date]])) {
|
||||||
if ($database2->has('report_access_codes', ["AND" => ['code' => $VARS['code'], 'expires[>]' => $date]])) {
|
|
||||||
$database2->delete('report_access_codes', ["OR" => ['code' => $VARS['code'], 'expires[<=]' => $date]]);
|
|
||||||
} else {
|
|
||||||
dieifnotloggedin();
|
dieifnotloggedin();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
dieifnotloggedin();
|
dieifnotloggedin();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Delete old DB entries
|
||||||
|
$database2->delete('report_access_codes', ['expires[<=]' => $date]);
|
||||||
|
|
||||||
if (LOADED) {
|
if (LOADED) {
|
||||||
if (isset($VARS['type']) && isset($VARS['format'])) {
|
if (isset($VARS['type']) && isset($VARS['format'])) {
|
||||||
generateReport($VARS['type'], $VARS['format']);
|
generateReport($VARS['type'], $VARS['format']);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user