本文整理汇总了PHP中FileManager::clear_path方法的典型用法代码示例。如果您正苦于以下问题:PHP FileManager::clear_path方法的具体用法?PHP FileManager::clear_path怎么用?PHP FileManager::clear_path使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileManager
的用法示例。
在下文中一共展示了FileManager::clear_path方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: count
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' => '');
}
示例2: defined
<?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/rename_file.php
*/
/*
Защита от прямой загрузки
*/
defined('ACCESS') or die;
echo json_encode(array('done' => FileManager::rename(FileManager::clear_path(str_ireplace(Manager::$conf['filesystem.path'], Manager::$conf['filesystem.files_abs_path'] . DS, $_REQUEST['old_name'])), FileManager::clear_path(str_ireplace(Manager::$conf['filesystem.path'], Manager::$conf['filesystem.files_abs_path'] . DS, $_REQUEST['new_name'])))));
示例3: explode
case UPLOAD_ERR_INI_SIZE:
$code = 1;
//Файл превышает максимальный размер
break;
case UPLOAD_ERR_PARTIAL:
$code = 2;
//Файл был передан не полностью
break;
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;
//Запрешенное расширение файла
}
示例4: defined
/**
* 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/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 . '"');
示例5: defined
<?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'])))));
示例6: ErrorManager
Manager::$error_m = new ErrorManager();
//загрузка менеджера сессий
require_once INCLUDE_PATH . 'SessionManager' . EXT;
Manager::$sess_m = new SessionManager();
//проверка авторизации
if (!Manager::$sess_m->authorisation()) {
die;
}
//загружаем менеджер изображений
require_once INCLUDE_PATH . 'ImageManager' . EXT;
Manager::$image_m = new ImageManager();
//загружаем менеджер файловой системы
require_once INCLUDE_PATH . 'FileManager' . EXT;
Manager::$file_m = new FileManager();
//получаем абсолютный путь к папке с фалами
Manager::$conf['filesystem.files_abs_path'] = FileManager::clear_path(realpath(Manager::$conf['filesystem.files_path']) . DS);
$task = isset($_REQUEST['task']) ? $_REQUEST['task'] : 'page';
Manager::peform($task);
//получение и очистка буфера вывода
$buffer = ob_get_contents();
ob_end_clean();
//определяем нужно ли сжимать
if (Manager::$conf['stream.use_gzip']) {
//определяем метод сжатия
if (strpos((string) $_SERVER['HTTP_ACCEPT_ENCODING'], 'x-gzip') !== false) {
$encoding = 'x-gzip';
} elseif (strpos((string) $_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== false) {
$encoding = 'gzip';
} elseif (strpos((string) $_SERVER['HTTP_ACCEPT_ENCODING'], 'deflate') !== false) {
$encoding = 'deflate';
}
示例7: defined
<?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);
示例8: defined
<?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/rename_dir.php
*/
/*
Защита от прямой загрузки
*/
defined('ACCESS') or die;
echo json_encode(array('done' => FileManager::rename(FileManager::clear_path(Manager::$conf['filesystem.files_path'] . $_REQUEST['old_name']), FileManager::clear_path(Manager::$conf['filesystem.files_path'] . $_REQUEST['new_name']))));