Server : Apache System : Linux indy02.toastserver.com 3.10.0-962.3.2.lve1.5.85.el7.x86_64 #1 SMP Thu Apr 18 15:18:36 UTC 2024 x86_64 User : palandch ( 1163) PHP Version : 7.1.33 Disable Function : NONE Directory : /home/palandch/www/core/model/modx/processors/browser/directory/ |
<?php /** * Moves a file/directory. * * @var modX $this->modx * @var array $scriptProperties * @var modProcessor $this * * @package modx * @subpackage processors.browser.directory */ class modBrowserFolderSortProcessor extends modProcessor { public function checkPermissions() { return $this->modx->hasPermission('directory_update'); } public function getLanguageTopics() { return array('file'); } public function process() { $from = $this->getProperty('from'); $to = $this->getProperty('to'); $point = $this->getProperty('point','append'); if (empty($from)) return $this->failure($this->modx->lexicon('file_folder_err_ns')); if (empty($to)) return $this->failure($this->modx->lexicon('file_folder_err_ns')); $source = $this->getProperty('source',1); /** @var modMediaSource $source */ $this->modx->loadClass('sources.modMediaSource'); $source = modMediaSource::getDefaultSource($this->modx,$source); if (!$source->getWorkingContext()) { return $this->failure($this->modx->lexicon('permission_denied')); } $source->setRequestProperties($this->getProperties()); $source->initialize(); if (!$source->checkPolicy('save')) { return $this->failure($this->modx->lexicon('permission_denied')); } $success = $source->moveObject($from,$to,$point); if (!$success) { $errors = $source->getErrors(); foreach ($errors as $k => $msg) { $this->addFieldError($k,$msg); } return $this->failure($this->modx->error->message); } return $this->success(); } } return 'modBrowserFolderSortProcessor';