@@ -51,12 +51,6 @@ function hook_file_download_access($file_item, $entity_type, $entity) {
|
||||
* The type of $entity; for example, 'node' or 'user'.
|
||||
* @param $entity
|
||||
* The $entity to which $file is referenced.
|
||||
*
|
||||
* @return
|
||||
* An array of grants, keyed by module name, each with a Boolean grant value.
|
||||
* Return an empty array to assert FALSE. You may choose to return your own
|
||||
* module's value in addition to other grants or to overwrite the values set
|
||||
* by other modules.
|
||||
*/
|
||||
function hook_file_download_access_alter(&$grants, $file_item, $entity_type, $entity) {
|
||||
// For our example module, we always enforce the rules set by node module.
|
||||
|
@@ -6,8 +6,8 @@ core = 7.x
|
||||
dependencies[] = field
|
||||
files[] = tests/file.test
|
||||
|
||||
; Information added by drupal.org packaging script on 2012-10-17
|
||||
version = "7.16"
|
||||
; Information added by drupal.org packaging script on 2012-11-07
|
||||
version = "7.17"
|
||||
project = "drupal"
|
||||
datestamp = "1350508567"
|
||||
datestamp = "1352325357"
|
||||
|
||||
|
@@ -73,7 +73,14 @@ Drupal.file = Drupal.file || {
|
||||
var acceptableMatch = new RegExp('\\.(' + extensionPattern + ')$', 'gi');
|
||||
if (!acceptableMatch.test(this.value)) {
|
||||
var error = Drupal.t("The selected file %filename cannot be uploaded. Only files with the following extensions are allowed: %extensions.", {
|
||||
'%filename': this.value,
|
||||
// According to the specifications of HTML5, a file upload control
|
||||
// should not reveal the real local path to the file that a user
|
||||
// has selected. Some web browsers implement this restriction by
|
||||
// replacing the local path with "C:\fakepath\", which can cause
|
||||
// confusion by leaving the user thinking perhaps Drupal could not
|
||||
// find the file because it messed up the file path. To avoid this
|
||||
// confusion, therefore, we strip out the bogus fakepath string.
|
||||
'%filename': this.value.replace('C:\\fakepath\\', ''),
|
||||
'%extensions': extensionPattern.replace(/\|/g, ', ')
|
||||
});
|
||||
$(this).closest('div.form-managed-file').prepend('<div class="messages error file-upload-js-error">' + error + '</div>');
|
||||
|
@@ -5,8 +5,8 @@ version = VERSION
|
||||
core = 7.x
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by drupal.org packaging script on 2012-10-17
|
||||
version = "7.16"
|
||||
; Information added by drupal.org packaging script on 2012-11-07
|
||||
version = "7.17"
|
||||
project = "drupal"
|
||||
datestamp = "1350508567"
|
||||
datestamp = "1352325357"
|
||||
|
||||
|
Reference in New Issue
Block a user