public function info($filename = '')
 {
     $this->open($filename);
     $i['width'] = $this->im->getImageWidth();
     $i['height'] = $this->im->getImageHeight();
     $i['type'] = FileManager::get_ext($filename);
     return $i;
 }
Пример #2
0
}
/*
	Формируем данные о по станичной навигации
*/
$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' => '');
}
count($files) == 0 ? $data = array() : ($data = array('paginator' => array('pagesTotal' => $pages, 'pageCurrent' => $_REQUEST['page']), 'files' => $files));
echo json_encode($data);
Пример #3
0
        case UPLOAD_ERR_NO_FILE:
            $code = 3;
            //файл не был загружен
            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;
}
Пример #4
0
 * @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");
        header('Pragma: public');
        header("Content-Length: " . strlen($data));
Пример #5
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);
 public function info($filename = '')
 {
     $i = getimagesize($filename);
     return array('width' => $i[0], 'height' => $i[1], 'type' => FileManager::get_ext($filename));
 }