Răsfoiți Sursa

#1786 Photos (maybe other modules): ACL isn't checked when photos are uploaded in the batch

Alex Trofimov 8 ani în urmă
părinte
comite
84b195cb03

+ 7 - 2
modules/base/files/classes/BxBaseModFilesFormUpload.php

@@ -80,6 +80,8 @@ class BxBaseModFilesFormUpload extends BxBaseModTextFormEntry
 
         $aContentIds = array();
         foreach ($aGhostFiles as $aFile) {
+            if (CHECK_ACTION_RESULT_ALLOWED !== $this->_oModule->checkAllowedAdd())
+                continue;
             if (is_array($mixedFileIds) && !in_array($aFile['id'], $mixedFileIds))
                 continue;
             $iContentId = 0;
@@ -95,8 +97,11 @@ class BxBaseModFilesFormUpload extends BxBaseModTextFormEntry
             
             if ($aFile['private'] || (isset($aFormValues[$CNF['FIELD_ALLOW_VIEW_TO']]) && BX_DOL_PG_ALL !== $aFormValues[$CNF['FIELD_ALLOW_VIEW_TO']]))
                 $oStorage->setFilePrivate ($aFile['id'], true);
-            if ($iContentId)
-                $this->_associalFileWithContent($oStorage, $aFile['id'], $iProfileId, $iContentId, $sFieldFile);
+            if (!$iContentId)
+                continue;
+
+            $this->_associalFileWithContent($oStorage, $aFile['id'], $iProfileId, $iContentId, $sFieldFile);
+            $this->_oModule->checkAllowedAdd(true);
         }
 
         return $aContentIds;

+ 0 - 3
modules/base/files/classes/BxBaseModFilesFormsEntryHelper.php

@@ -65,9 +65,6 @@ class BxBaseModFilesFormsEntryHelper extends BxBaseModTextFormsEntryHelper
             $sResult = $this->onDataAddAfter (getLoggedId(), $iContentId);
             if ($sResult)
                 return $sResult;
-
-            // perform action
-            $this->_oModule->checkAllowedAdd(true);
         }
         
         return array('need_redirect_after_action' => true, 'content_ids_array' => $aContentIds);