function webform_protected_downloads_file_is_protected in Webform Protected Downloads 7
Same name and namespace in other branches
- 6 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
5 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_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
- webform_protected_downloads_node_get_private_files in ./
webform_protected_downloads.module - Retrieve private files for the given node
File
- ./
webform_protected_downloads.module, line 636 - This file contains hook declarations and functions for the Webform Protected Downloads module.
Code
function webform_protected_downloads_file_is_protected($nid, $fid) {
$wpd_protected =& drupal_static(__FUNCTION__);
if (!isset($wpd_protected[$nid])) {
$wpd_protected[$nid] = array();
$result = db_query("SELECT fid FROM {wpd_protected_files} WHERE nid = :nid", array(
':nid' => $nid,
));
while ($row = $result
->fetchObject()) {
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;
}