рУССКИЙ
ИДИ НАХУЙ

После обновления безопасности модуля FileField до версии 6.x-3.13 вылетает ошибка при сохранении нод в админке, с филдами файлов.

Полный тред можно почитать по ссылке https://www.drupal.org/node/2305969 .

У меня заработало с патчем filefield-2305969-39-fix-predicate-with-19.patch #40.

diff --git a/filefield.module b/filefield.module
--- a/filefield.module
+++ b/filefield.module
@@ -191,9 +191,10 @@ function filefield_file_download($filepath) {
           // If revision is the current revision, grant access.
           $revision_access = TRUE;
         }
-        elseif (!$denied && $revision_node = node_load($content['nid'], $revision_id) && _node_revision_access($revision_node, 'view')) {
+        elseif (!$denied) {
+          $revision_node = node_load($content['nid'], $revision_id);
           // You have access to the node as well as that particular revision.
-          $revision_access = TRUE;
+          $revision_access = _node_revision_access($revision_node, 'view');
         }
 
         // If node access denied, skip other revisions; or if we have node
diff --git a/filefield_widget.inc b/filefield_widget.inc
--- a/filefield_widget.inc
+++ b/filefield_widget.inc
@@ -381,7 +381,7 @@ function filefield_widget_process($element, $edit, &$form_state, $form) {
   );
 
   if ($item['fid'] != 0) {
-    if (function_exists('file_download_access') && $item['status'] && !file_download_access($item['filepath'])) {
+    if (variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC) == FILE_DOWNLOADS_PRIVATE && function_exists('file_download_access') && $item['status'] && !file_download_access($item['filepath'])) {
       $element['preview'] = array(
         '#type' => 'markup',
         '#value' => t('Access denied'),
@@ -466,7 +466,7 @@ function filefield_widget_validate(&$element, &$form_state) {
     if ($file = field_file_load($element['fid']['#value'])) {
       $file = (object) $file;
       if ($file->status == FILE_STATUS_PERMANENT) {
-        if (field_file_references($file) == 0 || (function_exists('file_download_access') && !file_download_access($file->filepath))) {
+        if (field_file_references($file) == 0 || (variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC) == FILE_DOWNLOADS_PRIVATE && function_exists('file_download_access') && !file_download_access($file->filepath))) {
           form_error($element, t('Referencing to the file used in the %field field is not allowed.', array('%field' => $element['#title'])));
         }
       }

Добавить комментарий

Содержимое данного поля является приватным и не предназначено для показа.
  • HTML-теги не обрабатываются и показываются как обычный текст
             oooooooooooo                            oooooo     oooo  ooooooooo.   
`888' `8 `888. .8' `888 `Y88.
oooooooo 888 oooo ooo ooo. .oo. `888. .8' 888 .d88'
d'""7d8P 888oooo8 `88b..8P' `888P"Y88b `888. .8' 888ooo88P'
.d8P' 888 " Y888' 888 888 `888.8' 888
.d8P' .P 888 .o8"'88b 888 888 `888' 888
d8888888P o888o o88' 888o o888o o888o `8' o888o


Введите код, изображенный в стиле ASCII-арт.
рУССКИЙ
ИДИ НАХУЙ