예제 #1
0
            break;
        case UPLOAD_ERR_OK:
            if (!preg_match(',[[:cntrl:]]|[/\\:\\*\\?\\"\\<\\>\\|],', $_FILES['file']['name'])) {
                $tempFile = $_FILES['file']['tmp_name'];
                $targetPath = FileManager::clear_path(Manager::$conf['filesystem.files_abs_path'] . $_REQUEST['folder']);
                $targetFile = $targetPath . $_FILES['file']['name'];
                $s = Manager::$conf['filesystem.allowed_extensions'];
                if ($s) {
                    $fileTypes = explode('|', strtolower(Manager::$conf['filesystem.allowed_extensions']));
                } else {
                    $fileTypes = null;
                }
                $ext = FileManager::get_ext($_FILES['file']['name']);
                if (!$fileTypes or in_array(strtolower($ext), $fileTypes)) {
                    move_uploaded_file(FileManager::convertToFileSystem($tempFile), FileManager::convertToFileSystem($targetFile));
                    chmod(FileManager::convertToFileSystem($targetFile), Manager::$conf['filesystem.file_chmod']);
                } else {
                    $code = 4;
                    //Запрешенное расширение файла
                }
            } else {
                $code = 5;
            }
            break;
    }
} else {
    $code = 1;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
예제 #2
0
if (!is_dir($thumb_path)) {
    FileManager::create_dir(FileManager::convertToGeniral($thumb_path));
}
/*
	Формируем данные о по станичной навигации
*/
$start = ($_REQUEST['page'] - 1) * Manager::$conf['general.elements'];
$total = count($list);
$pages = ceil($total / Manager::$conf['general.elements']);
$list = array_slice($list, $start, Manager::$conf['general.elements']);
/*
	Формируем список файлов для ответа
*/
foreach ($list as $item) {
    //создаем превьюшки
    $src = FileManager::clear_path(FileManager::convertToFileSystem(Manager::$conf['filesystem.files_abs_path'] . DS . $_REQUEST['path'] . DS . $item['name']));
    $dest = '';
    //$thumb_path.$item['name'];
    //$width = Manager::$conf['thumbnail.width'];
    //$height = Manager::$conf['thumbnail.hieght'];
    //if (!file_exists($dest)){
    //создаем превью
    //	if (!ImageManager::instance()->thunbnail($src, $dest, $width, $height)){
    //если не удалось то выводим превью что просмотр не доступен
    //		$dest = 'pages/'.Manager::$conf['general.template'].'/img/error_thumbnails.gif';
    //	};
    //}
    $src = str_ireplace(Manager::$conf['filesystem.files_abs_path'], Manager::$conf['filesystem.path'], FileManager::convertToGeniral($src));
    $dest = FileManager::convertToGeniral(str_ireplace(Manager::$conf['filesystem.files_abs_path'], Manager::$conf['filesystem.files_path'], $dest));
    $files[] = array('fileext' => FileManager::get_ext($item['name']), 'filename' => $item['name'], 'filepath' => FileManager::path_encode(str_replace(array($item['name'], DS), array($item['name'], '/'), $src)), 'thumbnail' => '');
}
예제 #3
0
 * @package		Cyber Image Manager
 * @author		Radik
 * @copyright	Copyright (c) 2010, Cyber Applications.
 * @link		http://www.cyberapp.ru/
 * @since		Version 1.1
 * @file 		/includes/tasks/download_file.php
 */
/*
  		Защита от прямой загрузки
*/
defined('ACCESS') or die;
$file = FileManager::clear_path(Manager::$conf['filesystem.files_abs_path'] . DS . $_REQUEST['file']);
if (file_exists(FileManager::convertToFileSystem($file))) {
    Manager::$conf['stream.mimes']['use_gzip'] = false;
    //заружаем файл
    $data = file_get_contents(FileManager::convertToFileSystem($file));
    //получаем расширение файла
    $ext = strtolower(FileManager::get_ext($file));
    // Устанавливаем mime поумолчанию если не можем найти тип этого фала
    if (!isset(Manager::$conf['stream.mimes'][$ext])) {
        $mime = 'application/octet-stream';
    } else {
        $mime = is_array(Manager::$conf['stream.mimes'][$ext]) ? Manager::$conf['stream.mimes'][$ext][0] : Manager::$conf['stream.mimes'][$ext];
    }
    // Генирируем заголовки сервера
    if (strstr($_SERVER['HTTP_USER_AGENT'], "MSIE")) {
        header('Content-Type: "' . $mime . '"');
        header('Content-Disposition: attachment; filename="' . basename($file) . '"');
        header('Expires: 0');
        header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
        header("Content-Transfer-Encoding: binary");
예제 #4
0
<?php

/**
 * Cyber Image Manager
 *
 *
 * @package		Cyber Image Manager
 * @author		Radik
 * @copyright	Copyright (c) 2010, Cyber Applications.
 * @link		http://www.cyberapp.ru/
 * @since		Version 1.1
 * @file 		/includes/tasks/del_file.php
 */
/*
  		Защита от прямой загрузки
*/
defined('ACCESS') or die;
echo json_encode(array('done' => FileManager::delete_file(FileManager::convertToFileSystem(FileManager::clear_path(Manager::$conf['filesystem.files_abs_path'] . DS . $_REQUEST['file'])))));
예제 #5
0
 public static function rename($old = '', $new = '')
 {
     return $old != '' && $new != '' && rename(FileManager::convertToFileSystem($old), FileManager::convertToFileSystem($new));
 }
예제 #6
0
<?php

/**
 * Cyber Image Manager
 *
 *
 * @package		Cyber Image Manager
 * @author		Radik
 * @copyright	Copyright (c) 2010, Cyber Applications.
 * @link		http://www.cyberapp.ru/
 * @since		Version 1.1
 * @file 		/includes/tasks/check_upload.php
 */
/*
  		Защита от прямой загрузки
*/
defined('ACCESS') or die;
header('Content-type: text/json; charset=' . Manager::$conf['general.char_set']);
$fileArray = array();
foreach ($_POST as $key => $value) {
    if ($key != 'folder' && !empty($value)) {
        $f = FileManager::clear_path(Manager::$conf['filesystem.files_abs_path'] . $_POST['folder'] . $value);
        if (file_exists(FileManager::convertToFileSystem($f))) {
            $fileArray[] = $key;
        }
    }
}
echo json_encode($fileArray);
예제 #7
0
<?php

/**
 * Cyber Image Manager
 *
 *
 * @package		Cyber Image Manager
 * @author		Radik
 * @copyright	Copyright (c) 2010, Cyber Applications.
 * @link		http://www.cyberapp.ru/
 * @since		Version 1.1
 * @file 		/includes/tasks/get_info.php
 */
/*
  		Защита от прямой загрузки
*/
defined('ACCESS') or die;
header('Content-type: text/json; charset=' . Manager::$conf['general.char_set']);
$filename = FileManager::convertToFileSystem(urldecode(str_ireplace(Manager::$conf['filesystem.path'], Manager::$conf['filesystem.files_path'], $_POST['filename'])));
$types = Manager::$conf['stream.mimes'];
$types = htmlspecialchars($types[strtolower(FileManager::get_ext($filename))]);
$info = array('size' => filesize($filename), 'type' => $types);
echo json_encode($info);