function webform_protected_downloads_file_is_protected in Webform Protected Downloads 6
Same name and namespace in other branches
- 7 webform_protected_downloads.module \webform_protected_downloads_file_is_protected()
Checks wheather the given file is protected for the given node
Parameters
int $nid :
int $fid :
Return value
boolean
6 calls to webform_protected_downloads_file_is_protected()
- theme_webform_protected_downloads_mail_token_file_list in ./
webform_protected_downloads.module - Theme function for the file list that may be included in the confirmation mail which is send to the user.
- webform_protected_downloads_adjust_upload_form in ./
webform_protected_downloads.module - Updates the file listing in an upload form to disable delete, list and private checkboxes of files protected by this module.
- webform_protected_downloads_configuration_form in ./
webform_protected_downloads.form.inc - Form callback for the webform configuration subpage
- webform_protected_downloads_file_download in ./
webform_protected_downloads.module - Implementation of hook_file_download().
- webform_protected_downloads_file_set_protected in ./
webform_protected_downloads.module - Set the protected status for the given node / file combination
File
- ./
webform_protected_downloads.module, line 425 - This file contains hook declarations and functions for the Webform Protected Downloads module.
Code
function webform_protected_downloads_file_is_protected($nid, $fid) {
static $wpd_protected;
if (!isset($wpd_protected[$nid])) {
$wpd_protected[$nid] = array();
$result = db_query("SELECT fid FROM {wpd_protected_files} WHERE nid = %d", $nid);
while ($row = db_fetch_object($result)) {
if (!in_array($row->fid, $wpd_protected[$nid])) {
$wpd_protected[$nid][] = $row->fid;
}
}
}
return isset($wpd_protected[$nid]) ? in_array($fid, $wpd_protected[$nid]) : FALSE;
}