コード例 #1
0
ファイル: zip.php プロジェクト: sonvq/2015_freelance6
require_once "classes/FileSystems/LocalFileImpl.php";
require_once "classes/pclzip/pclzip.lib.php";
$data = array();
verifyAccess($mcFileManagerConfig);
$path = getRequestParam("path", "");
$rootpath = getRequestParam("rootpath", toUnixPath(getRealPath($mcFileManagerConfig, 'filesystem.rootpath')));
$fileFactory =& new FileFactory($mcFileManagerConfig, $rootpath);
$targetFile =& $fileFactory->getFile($path);
$config = $targetFile->getConfig();
addFileEventListeners($fileFactory);
$filename = getRequestParam("filename", false);
$submitted = getRequestParam("submitted", false);
$data['path'] = $path;
$data['submitted'] = $submitted;
$data['short_path'] = getUserFriendlyPath($path, 30);
$data['full_path'] = getUserFriendlyPath($path);
$data['errorMsg'] = "";
$data['filename'] = "";
$data['demo'] = checkBool($config['general.demo']) ? "true" : "false";
$data['demo_msg'] = $config['general.demo_msg'];
// Create zip
if ($submitted && $targetFile->canWrite() && checkBool($config["filesystem.writable"])) {
    $targetFile =& $fileFactory->getFile($path, $filename . ".zip", MC_IS_FILE);
    $config = $targetFile->getConfig();
    // Setup first filter
    $fileFilterA =& new BasicFileFilter();
    $fileFilterA->setIncludeFilePattern($config['filesystem.include_file_pattern']);
    $fileFilterA->setExcludeFilePattern($config['filesystem.exclude_file_pattern']);
    if (!$fileFilterA->accept($targetFile)) {
        $data['errorMsg'] = $config['filesystem.invalid_file_name_msg'];
        renderPage("zip.tpl.php", $data);
コード例 #2
0
ファイル: images.php プロジェクト: stormlab/Stormlab
    }
}
// Dir is not in droplist, use first one or root if the first one is gone too
if ($valid_folder == false) {
    if (count($dirList) > 0) {
        $targetFile =& $fileFactory->getFile($dirList[0]['abs_path']);
        if (!$targetFile->exists()) {
            $targetFile = $rootFile;
        }
        // Grab new config
        $config = $targetFile->getConfig();
    } else {
        $dirItem = array();
        $dirItem['even'] = false;
        $dirItem['abs_path'] = $targetFile->getAbsolutePath();
        $dirItem['path'] = getUserFriendlyPath($targetFile->getAbsolutePath());
        $dirList[] = $dirItem;
    }
}
$dirsFiltered = array();
// Get filtered files
$fileFilter =& new BasicFileFilter();
$fileFilter->setIncludeDirectoryPattern($config['filesystem.include_directory_pattern']);
$fileFilter->setExcludeDirectoryPattern($config['filesystem.exclude_directory_pattern']);
$fileFilter->setIncludeFilePattern($config['filesystem.include_file_pattern']);
$fileFilter->setExcludeFilePattern($config['filesystem.exclude_file_pattern']);
$fileFilter->setIncludeExtensions($config['filesystem.extensions']);
$fileFilter->setOnlyFiles(true);
$files =& $targetFile->listFilesFiltered($fileFilter);
$fileList = array();
$even = true;
コード例 #3
0
ファイル: preview.php プロジェクト: sonvq/2015_freelance6
$fileFilterA->setIncludeFilePattern($config['filesystem.include_file_pattern']);
$fileFilterA->setExcludeFilePattern($config['filesystem.exclude_file_pattern']);
$fileFilterA->setIncludeExtensions($config['filesystem.extensions']);
// Setup second filter
$fileFilterB =& new BasicFileFilter();
$fileFilterB->setIncludeFilePattern($config['download.include_file_pattern']);
$fileFilterB->setExcludeFilePattern($config['download.exclude_file_pattern']);
$fileFilterB->setIncludeExtensions($config['download.extensions']);
$data['download'] = $fileFilterA->accept($targetFile) && $fileFilterB->accept($targetFile);
addFileEventListeners($fileFactory);
$file =& $fileFactory->getFile($path);
if (!$file->exists()) {
    renderPage("blank.tpl.php", $data);
}
$data['path'] = $file->getAbsolutePath();
$data['filename'] = basename(getUserFriendlyPath($file->getAbsolutePath()));
if ($data['filename'] == "") {
    $data['filename'] = "/";
}
$data['filesize'] = getSizeStr($file->length());
$fileType = getFileType($file->getAbsolutePath());
$data['icon'] = $fileType['icon'];
$data['type'] = $fileType['type'];
$data['preview'] = $fileType['preview'];
$data['previewurl'] = "";
$data['modificationdate'] = date($config['filesystem.datefmt'], $file->lastModified());
$data['creationdate'] = date($config['filesystem.datefmt'], $file->creationDate());
$data['readable'] = $file->canRead() && checkBool($config["filesystem.readable"]) ? "readable" : "not_readable";
$data['writable'] = $file->canWrite() && checkBool($config["filesystem.writable"]) ? "writable" : "not_writable";
$data['type'] = $file->isDirectory() ? "dir" : "file";
$data['description'] = $fileType['type'];