Dave Jarvis' Repositories

git clone https://repo.autonoma.ca/repo/keenwrite.git

Fixes expiration bug

AuthorDaveJarvis <email>
Date2023-11-11 17:13:35 GMT-0800
Commit1a0256bb60015b299ad1981eb5f5680615596e56
Parent72e50a2
www/downloads/counter.php
$filename = get_sanitized_filename();
- $unique_hit = download_token_expired( 24 * 60 * 60 );
+ $valid_filename = !empty( $filename );
+ $expiry = 24 * 60 * 60;
- if( !empty( $filename ) && download( $filename ) && $unique_hit ) {
+ if( $valid_filename && download( $filename ) && token_expired( $expiry ) ) {
increment_count( "$filename-count.txt" );
}
* @return bool True indicates the token has expired (or was not set).
*/
- function download_token_expired( $lifetime ) {
+ function token_expired( $lifetime ) {
$TOKEN_NAME = 'LAST_DOWNLOAD';
$now = time();
Delta4 lines added, 3 lines removed, 1-line increase