Skip to content

Instantly share code, notes, and snippets.

@davecranwell
Created March 30, 2012 12:03
Show Gist options
  • Save davecranwell/2251080 to your computer and use it in GitHub Desktop.
Save davecranwell/2251080 to your computer and use it in GitHub Desktop.
diff --git webform_protected_downloads.module webform_protected_downloads.module
index bf9a728..36c6889 100644
--- webform_protected_downloads.module
+++ webform_protected_downloads.module
@@ -461,7 +461,7 @@ function webform_protected_downloads_file_user_has_access($nid, $fid) {
unset($_SESSION[WEBFORM_PROTECTED_DOWNLOADS_SESSION_KEY][$row->hash]);
$ok = FALSE;
}
- } else {
+ } else {/
$ok = FALSE;
}
$ok = $ok && ($row->expires == 0 || $row->expires > time());
@@ -578,7 +578,7 @@ function webform_protected_downloads_process_submissions($form, &$form_state) {
// create hash, calculate expiration timestamp
$hash = webform_protected_downloads_create_hash();
$processed = time();
- $expires = $processed + $conf->expiration_download;
+ $expires = $conf->expiration_download == 0 ? 0 : $processed + $conf->expiration_download;
// we need to save before sending the mail
$record = array(
diff --git webform_protected_downloads.page.inc webform_protected_downloads.page.inc
index 2a1ff09..b52536a 100644
--- webform_protected_downloads.page.inc
+++ webform_protected_downloads.page.inc
@@ -164,7 +164,7 @@ function webform_protected_downloads_hash_is_valid($hash) {
}
else {
// otherwise we grant access if the hash has not yet expired
- return $access->expires > time();
+ return ($access->expires == 0) || $access->expires > time();
}
return FALSE;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment