-
-
Save Fi1osof/f385c27df60c306d8a27 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
switch($modx->event->name){ | |
case 'OnFileManagerUpload': | |
$source = & $scriptProperties['source']; | |
if(!$source->hasErrors()){ | |
/* | |
Запрещаем загрузку в корень, точнее удаляем новый файл, | |
так как в MODX нет нормальной обработки событий на загрузку файлов, | |
чтобы запретить загрузку | |
*/ | |
if($directory == '/' && $files){ | |
foreach($files as $file){ | |
$path = $directory . $source->fileHandler->sanitizePath($file['name']); | |
$source->removeObject($path); | |
} | |
$source->addError('path', "Нельзя загружать файлы в корневой раздел."); | |
} | |
} | |
break; | |
default:; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment