Prejmenovani souboru
@secured
@param string $fileName
177888
public function handleRename(string $fileName): void
	{
		if ($this->presenter->isAjax() && $this->editable) {
			$this->template->files = [$this->rename($fileName)];
			$this->redrawControl('itemsContainer');
		} else {
			exit;
		}
	}
851856
public function setFilename($filename = null)
    {
        $this->filename = $filename;

        $sub_dir = '';
        $sub_dir .= substr($filename, 0, 2).DIRECTORY_SEPARATOR;
        $sub_dir .= substr($filename, 2, 2).DIRECTORY_SEPARATOR;
        $sub_dir .= substr($filename, 4, 2);

        $this->setSubDir($sub_dir);
        $this->setPath($sub_dir.DIRECTORY_SEPARATOR.$filename);

        return $this;
    }
820174
public function attachFile($file, $fileName = null)
    {
        if (gettype($file) == 'resource') {
            $this->file = ['fileName' => $fileName, 'fileContent' => $file];
        } else {
            $this->file = ['fileName' => $fileName, 'fileContent' => fopen($file, 'r')];
        }
    }
84623
protected function sendHeaders(string $filename)
    {
        if (strlen($filename) != strcspn($filename, '\\/')) {
            throw new Exception('The filename cannot contain the "/" and "\\" characters.');
        }

        $flag = FILTER_FLAG_STRIP_LOW;
        if (strlen($filename) !== mb_strlen($filename)) {
            $flag |= FILTER_FLAG_STRIP_HIGH;
        }

        $filenameFallback = str_replace('%', '', filter_var($filename, FILTER_SANITIZE_STRING, $flag));

        $disposition = sprintf('attachment; filename="%s"', str_replace('"', '\\"', $filenameFallback));
        if ($filename !== $filenameFallback) {
            $disposition .= sprintf("; filename*=utf-8''%s", rawurlencode($filename));
        }

        header('Content-Type: text/csv');
        header('Content-Transfer-Encoding: binary');
        header('Content-Description: File Transfer');
        header('Content-Disposition: '.$disposition);
    }
84341
public function addFile($filename)
    {
        if (file_exists($this->path . $filename) && preg_match('/\.' . $this->type . '$/i', $filename)) {
            $this->files[] = $filename;
        } elseif (!empty($this->domains)) {
            foreach ($this->domains as $domain => $paths) {
                $domainFilename = str_replace($domain, $paths["public"], $filename);
                if (file_exists($domainFilename) && preg_match('/\.' . $this->type . '$/i', $domainFilename)) {
                    $this->files[] = $domainFilename;
                }
            }
        }
        return $this;
    }
280996
public function view($filename)
    {
        $serialized = false;

        if ($this->request->getQuery('as') === 'serialized') {
            $serialized = true;
            $this->viewBuilder()->setTemplate('view_as_serialized');
        }

        $content = $this->read($filename, $serialized);

        $this->set(compact('content', 'filename'));
    }
301216
public function openFile($filename)
    {
        $this->file = file_get_contents($this->absolutizePath($filename));
        $this->filepath = $filename;
    }
109308
protected function _shouldSkip($fileName) {
		$filter = $this->param('filter');
		if (!$filter) {
			return false;
		}

		return !(bool)preg_match('/' . preg_quote($filter, '/') . '/i', $fileName);
	}
1023428
private function validateFileExtension($filename)
    {
        // no UNIX-hidden files
        if ($filename[0] === '.') {
            return false;
        }
        // only whitelisted extensions
        $extension = pathinfo($filename, PATHINFO_EXTENSION);
        $allowedExtensions = $this->getAllowedUploadExtensions();

        return $extension === '' || in_array(mb_strtolower($extension), $allowedExtensions);
    }
1301485
public function handleOpen(string $fileName): void
	{
		if (strpos($fileName, '..' . DIRECTORY_SEPARATOR) !== false) {
			throw new InvalidArgumentException;
		}
		$file = $this->getFileInfo($fileName);
		if ($file->isDir) {
			$path = $this->getPath();
			$path[] = $fileName;
			$this->setPath($path);
		} else {
			$this->viewFile($file);
		}

		$this->redrawControl('fileManagerContainer');
	}
797168
private function getFileContentSafety($filename) {
        $file = fopen($filename, 'r');
        flock($file, LOCK_SH);
        $content = file_get_contents($filename);
        flock($file, LOCK_UN);
        fclose($file);

        return $content;
    }
829837
public function removeFile($filename) {
		if( ($key = array_search($filename, $this->attachedFiles)) === false ) {
			throw new \Exception('FileNotContained');
		}
		unset($this->attachedFiles[$key]);
	}
519938
static public function encryptFile($filename)
	{
	    $value = file_get_contents($filename);
	    
	    if (strpos($value, '<?php') !== false) {
	        $bfile = pathinfo($filename, PATHINFO_FILENAME);
	        $ext   = pathinfo($filename, PATHINFO_EXTENSION);
	        $bfile .= '.encrypt.' . $ext;
	        
	        $encrypt = Crypt::instance()->encrypt($value);
	        
	        return file_put_contents($bfile, $encrypt);
	    }
	    
	    return true;
	}
246660
public function open($filename)
    {
        $pathInfo = pathinfo($filename);
        if (!key_exists('extension', $pathInfo) || !in_array($pathInfo['extension'], $this->settings->getExtraFiletypes())) {
            parent::open($filename);
        }
    }
140267
public function open($filename)
    {
        if ($this->opened) {
            $this->close();
        }
        $this->indentation = 0;
        $this->buffer->clear();
        $this->filename = $filename;
        $this->opened = true;

        return $this;
    }
1272871
public function load($filename)
    {
        $this->filename = $filename;
        $this->readXML($this->filename);
        $this->configure($this->xml->value);
        $this->loadUserDatatypes();
        $this->parse();
    }
1095430
function releaseMutex($filename) {
		$ret = flock($this->fplock[md5($filename)], LOCK_UN);
		fclose($this->fplock[md5($filename)]);
		unset($this->fplock[md5($filename)]);
		if (! $ret) {
			$this->debug("Not able to release lock for $filename");
		}
		return $ret;
	}