[10.0.052] RFM éditeur image actif + mise à jour config
|
@ -33,7 +33,7 @@ class common {
|
|||
const TEMP_DIR = 'site/tmp/';
|
||||
|
||||
// Numéro de version
|
||||
const ZWII_VERSION = '10.0.051';
|
||||
const ZWII_VERSION = '10.0.052';
|
||||
const ZWII_UPDATE_CHANNEL = "v10";
|
||||
|
||||
public static $actions = [];
|
||||
|
|
|
@ -97,6 +97,17 @@ $config = array(
|
|||
*/
|
||||
'thumbs_base_path' => '../../../site/file/thumb/',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| path from base_url to base of thumbs folder
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| with final /
|
||||
| DO NOT put inside upload folder
|
||||
|
|
||||
*/
|
||||
'thumbs_upload_dir' => '/thumb/',
|
||||
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
@ -395,21 +406,84 @@ $config = array(
|
|||
*/
|
||||
'files_without_extension' => false,
|
||||
|
||||
/******************
|
||||
* AVIARY config
|
||||
*******************/
|
||||
'aviary_active' => false,
|
||||
'aviary_apiKey' => "2444282ef4344e3dacdedc7a78f8877d",
|
||||
'aviary_language' => "fr",
|
||||
'aviary_theme' => "light",
|
||||
'aviary_tools' => "all",
|
||||
'aviary_maxSize' => "1400",
|
||||
// Add or modify the Aviary options below as needed - they will be json encoded when added to the configuration so arrays can be utilized as needed
|
||||
/******************
|
||||
* TUI Image Editor config
|
||||
*******************/
|
||||
// Add or modify the options below as needed - they will be json encoded when added to the configuration so arrays can be utilized as needed
|
||||
'tui_active' => true,
|
||||
'tui_position' => 'bottom',
|
||||
// 'common.bi.image' => "../assets/images/logo.png",
|
||||
// 'common.bisize.width' => '70px',
|
||||
// 'common.bisize.height' => '25px',
|
||||
'common.backgroundImage' => 'none',
|
||||
'common.backgroundColor' => '#ececec',
|
||||
'common.border' => '1px solid #E6E7E8',
|
||||
|
||||
//The filter and sorter are managed through both javascript and php scripts because if you have a lot of
|
||||
//file in a folder the javascript script can't sort all or filter all, so the filemanager switch to php script.
|
||||
//The plugin automatic swich javascript to php when the current folder exceeds the below limit of files number
|
||||
'file_number_limit_js' => 500,
|
||||
// header
|
||||
'header.backgroundImage' => 'none',
|
||||
'header.backgroundColor' => '#ececec',
|
||||
'header.border' => '0px',
|
||||
|
||||
// main icons
|
||||
'menu.normalIcon.path' => 'svg/icon-d.svg',
|
||||
'menu.normalIcon.name' => 'icon-d',
|
||||
'menu.activeIcon.path' => 'svg/icon-b.svg',
|
||||
'menu.activeIcon.name' => 'icon-b',
|
||||
'menu.disabledIcon.path' => 'svg/icon-a.svg',
|
||||
'menu.disabledIcon.name' => 'icon-a',
|
||||
'menu.hoverIcon.path' => 'svg/icon-c.svg',
|
||||
'menu.hoverIcon.name' => 'icon-c',
|
||||
'menu.iconSize.width' => '24px',
|
||||
'menu.iconSize.height' => '24px',
|
||||
|
||||
// submenu primary color
|
||||
'submenu.backgroundColor' => '#ececec',
|
||||
'submenu.partition.color' => '#000000',
|
||||
|
||||
// submenu icons
|
||||
'submenu.normalIcon.path' => 'svg/icon-d.svg',
|
||||
'submenu.normalIcon.name' => 'icon-d',
|
||||
'submenu.activeIcon.path' => 'svg/icon-b.svg',
|
||||
'submenu.activeIcon.name' => 'icon-b',
|
||||
'submenu.iconSize.width' => '32px',
|
||||
'submenu.iconSize.height' => '32px',
|
||||
|
||||
// submenu labels
|
||||
'submenu.normalLabel.color' => '#000',
|
||||
'submenu.normalLabel.fontWeight' => 'normal',
|
||||
'submenu.activeLabel.color' => '#000',
|
||||
'submenu.activeLabel.fontWeight' => 'normal',
|
||||
|
||||
// checkbox style
|
||||
'checkbox.border' => '1px solid #E6E7E8',
|
||||
'checkbox.backgroundColor' => '#000',
|
||||
|
||||
// rango style
|
||||
'range.pointer.color' => '#333',
|
||||
'range.bar.color' => '#ccc',
|
||||
'range.subbar.color' => '#606060',
|
||||
|
||||
'range.disabledPointer.color' => '#d3d3d3',
|
||||
'range.disabledBar.color' => 'rgba(85,85,85,0.06)',
|
||||
'range.disabledSubbar.color' => 'rgba(51,51,51,0.2)',
|
||||
|
||||
'range.value.color' => '#000',
|
||||
'range.value.fontWeight' => 'normal',
|
||||
'range.value.fontSize' => '11px',
|
||||
'range.value.border' => '0',
|
||||
'range.value.backgroundColor' => '#f5f5f5',
|
||||
'range.title.color' => '#000',
|
||||
'range.title.fontWeight' => 'lighter',
|
||||
|
||||
// colorpicker style
|
||||
'colorpicker.button.border' => '0px',
|
||||
'colorpicker.title.color' => '#000',
|
||||
|
||||
|
||||
//The filter and sorter are managed through both javascript and php scripts because if you have a lot of
|
||||
//file in a folder the javascript script can't sort all or filter all, so the filemanager switch to php script.
|
||||
//The plugin automatic swich javascript to php when the current folder exceeds the below limit of files number
|
||||
'file_number_limit_js' => 500,
|
||||
|
||||
//**********************
|
||||
// Hidden files and folders
|
||||
|
@ -488,13 +562,55 @@ return array_merge(
|
|||
$config['ext_video'],
|
||||
$config['ext_music']
|
||||
),
|
||||
// For a list of options see: https://developers.aviary.com/docs/web/setup-guide#constructor-config
|
||||
'aviary_defaults_config' => array(
|
||||
'apiKey' => $config['aviary_apiKey'],
|
||||
'language' => $config['aviary_language'],
|
||||
'theme' => $config['aviary_theme'],
|
||||
'tools' => $config['aviary_tools'],
|
||||
'maxSize' => $config['aviary_maxSize']
|
||||
),
|
||||
'tui_defaults_config' => array(
|
||||
//'common.bi.image' => $config['common.bi.image'],
|
||||
//'common.bisize.width' => $config['common.bisize.width'],
|
||||
//'common.bisize.height' => $config['common.bisize.height'],
|
||||
'common.backgroundImage' => $config['common.backgroundImage'],
|
||||
'common.backgroundColor' => $config['common.backgroundColor'],
|
||||
'common.border' => $config['common.border'],
|
||||
'header.backgroundImage' => $config['header.backgroundImage'],
|
||||
'header.backgroundColor' => $config['header.backgroundColor'],
|
||||
'header.border' => $config['header.border'],
|
||||
'menu.normalIcon.path' => $config['menu.normalIcon.path'],
|
||||
'menu.normalIcon.name' => $config['menu.normalIcon.name'],
|
||||
'menu.activeIcon.path' => $config['menu.activeIcon.path'],
|
||||
'menu.activeIcon.name' => $config['menu.activeIcon.name'],
|
||||
'menu.disabledIcon.path' => $config['menu.disabledIcon.path'],
|
||||
'menu.disabledIcon.name' => $config['menu.disabledIcon.name'],
|
||||
'menu.hoverIcon.path' => $config['menu.hoverIcon.path'],
|
||||
'menu.hoverIcon.name' => $config['menu.hoverIcon.name'],
|
||||
'menu.iconSize.width' => $config['menu.iconSize.width'],
|
||||
'menu.iconSize.height' => $config['menu.iconSize.height'],
|
||||
'submenu.backgroundColor' => $config['submenu.backgroundColor'],
|
||||
'submenu.partition.color' => $config['submenu.partition.color'],
|
||||
'submenu.normalIcon.path' => $config['submenu.normalIcon.path'],
|
||||
'submenu.normalIcon.name' => $config['submenu.normalIcon.name'],
|
||||
'submenu.activeIcon.path' => $config['submenu.activeIcon.path'],
|
||||
'submenu.activeIcon.name' => $config['submenu.activeIcon.name'],
|
||||
'submenu.iconSize.width' => $config['submenu.iconSize.width'],
|
||||
'submenu.iconSize.height' => $config['submenu.iconSize.height'],
|
||||
'submenu.normalLabel.color' => $config['submenu.normalLabel.color'],
|
||||
'submenu.normalLabel.fontWeight' => $config['submenu.normalLabel.fontWeight'],
|
||||
'submenu.activeLabel.color' => $config['submenu.activeLabel.color'],
|
||||
//'submenu.activeLabel.fontWeight' => $config['submenu.activeLabel.fontWeightcommon.bi.image'],
|
||||
'checkbox.border' => $config['checkbox.border'],
|
||||
'checkbox.backgroundColor' => $config['checkbox.backgroundColor'],
|
||||
'range.pointer.color' => $config['range.pointer.color'],
|
||||
'range.bar.color' => $config['range.bar.color'],
|
||||
'range.subbar.color' => $config['range.subbar.color'],
|
||||
'range.disabledPointer.color' => $config['range.disabledPointer.color'],
|
||||
'range.disabledBar.color' => $config['range.disabledBar.color'],
|
||||
'range.disabledSubbar.color' => $config['range.disabledSubbar.color'],
|
||||
'range.value.color' => $config['range.value.color'],
|
||||
'range.value.fontWeight' => $config['range.value.fontWeight'],
|
||||
'range.value.fontSize' => $config['range.value.fontSize'],
|
||||
'range.value.border' => $config['range.value.border'],
|
||||
'range.value.backgroundColor' => $config['range.value.backgroundColor'],
|
||||
'range.title.color' => $config['range.title.color'],
|
||||
'range.title.fontWeight' => $config['range.title.fontWeight'],
|
||||
'colorpicker.button.border' => $config['colorpicker.button.border'],
|
||||
'colorpicker.title.color' => $config['colorpicker.title.color']
|
||||
),
|
||||
)
|
||||
);
|
||||
|
|
|
@ -3,73 +3,68 @@ $config = include 'config/config.php';
|
|||
|
||||
include 'include/utils.php';
|
||||
|
||||
if ($_SESSION['RF']["verify"] != "RESPONSIVEfilemanager")
|
||||
{
|
||||
response(trans('forbiden').AddErrorLocation())->send();
|
||||
exit;
|
||||
if ($_SESSION['RF']["verify"] != "RESPONSIVEfilemanager") {
|
||||
response(trans('forbidden') . AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
|
||||
if (!checkRelativePath($_POST['path']))
|
||||
{
|
||||
response(trans('wrong path').AddErrorLocation())->send();
|
||||
exit;
|
||||
if (!checkRelativePath($_POST['path'])) {
|
||||
response(trans('wrong path') . AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
|
||||
if (isset($_SESSION['RF']['language']) && file_exists('lang/' . basename($_SESSION['RF']['language']) . '.php'))
|
||||
{
|
||||
$languages = include 'lang/languages.php';
|
||||
if(array_key_exists($_SESSION['RF']['language'],$languages)){
|
||||
include 'lang/' . basename($_SESSION['RF']['language']) . '.php';
|
||||
}else{
|
||||
response(trans('Lang_Not_Found').AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
response(trans('Lang_Not_Found').AddErrorLocation())->send();
|
||||
exit;
|
||||
if (isset($_SESSION['RF']['language']) && file_exists('lang/' . basename($_SESSION['RF']['language']) . '.php')) {
|
||||
$languages = include 'lang/languages.php';
|
||||
if (array_key_exists($_SESSION['RF']['language'], $languages)) {
|
||||
include 'lang/' . basename($_SESSION['RF']['language']) . '.php';
|
||||
} else {
|
||||
response(trans('Lang_Not_Found') . AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
} else {
|
||||
response(trans('Lang_Not_Found') . AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
|
||||
$ftp = ftp_con($config);
|
||||
|
||||
$base = $config['current_path'];
|
||||
$path = $base.$_POST['path'];
|
||||
$cycle = TRUE;
|
||||
$path = $base . $_POST['path'];
|
||||
$cycle = true;
|
||||
$max_cycles = 50;
|
||||
$i = 0;
|
||||
while($cycle && $i<$max_cycles)
|
||||
{
|
||||
$i++;
|
||||
if ($path == $base) $cycle=FALSE;
|
||||
|
||||
if (file_exists($path."config.php"))
|
||||
{
|
||||
require_once $path."config.php";
|
||||
$cycle = FALSE;
|
||||
}
|
||||
$path = fix_dirname($path)."/";
|
||||
while ($cycle && $i < $max_cycles) {
|
||||
$i++;
|
||||
if ($path == $base) {
|
||||
$cycle = false;
|
||||
}
|
||||
|
||||
if (file_exists($path . "config.php")) {
|
||||
require_once $path . "config.php";
|
||||
$cycle = false;
|
||||
}
|
||||
$path = fix_dirname($path) . "/";
|
||||
}
|
||||
|
||||
function returnPaths($_path,$_name,$config){
|
||||
global $ftp;
|
||||
$path = $config['current_path'].$_path;
|
||||
$path_thumb = $config['thumbs_base_path'].$_path;
|
||||
$name = null;
|
||||
if($ftp){
|
||||
$path = $config['ftp_base_folder'].$config['upload_dir'].$_path;
|
||||
$path_thumb = $config['ftp_base_folder'].$config['ftp_thumbs_dir'].$_path;
|
||||
}
|
||||
if ($_name)
|
||||
{
|
||||
$name = fix_filename($_name,$config);
|
||||
if (strpos($name,'../') !== FALSE || strpos($name,'..\\') !== FALSE)
|
||||
{
|
||||
response(trans('wrong name').AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
}
|
||||
return array($path,$path_thumb,$name);
|
||||
function returnPaths($_path, $_name, $config)
|
||||
{
|
||||
global $ftp;
|
||||
$path = $config['current_path'] . $_path;
|
||||
$path_thumb = $config['thumbs_base_path'] . $_path;
|
||||
$name = null;
|
||||
if ($ftp) {
|
||||
$path = $config['ftp_base_folder'] . $config['upload_dir'] . $_path;
|
||||
$path_thumb = $config['ftp_base_folder'] . $config['ftp_thumbs_dir'] . $_path;
|
||||
}
|
||||
if ($_name) {
|
||||
$name = fix_filename($_name, $config);
|
||||
if (strpos($name, '../') !== false || strpos($name, '..\\') !== false) {
|
||||
response(trans('wrong name') . AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
}
|
||||
return array($path, $path_thumb, $name);
|
||||
}
|
||||
|
||||
if(isset($_POST['paths'])){
|
||||
|
@ -89,7 +84,7 @@ if(isset($_POST['paths'])){
|
|||
$paths_thumb[] = $path_thumb;
|
||||
$names = $name;
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
$name = null;
|
||||
if(isset($_POST['name'])){
|
||||
$name = $_POST['name'];
|
||||
|
@ -99,27 +94,25 @@ if(isset($_POST['paths'])){
|
|||
}
|
||||
|
||||
$info = pathinfo($path);
|
||||
if (isset($info['extension']) && !(isset($_GET['action']) && $_GET['action']=='delete_folder') &&
|
||||
!check_extension($info['extension'],$config)
|
||||
&& $_GET['action'] != 'create_file' )
|
||||
{
|
||||
response(trans('wrong extension').AddErrorLocation())->send();
|
||||
exit;
|
||||
if (isset($info['extension']) && !(isset($_GET['action']) && $_GET['action'] == 'delete_folder') &&
|
||||
!check_extension($info['extension'], $config)
|
||||
&& $_GET['action'] != 'create_file') {
|
||||
response(trans('wrong extension') . AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
|
||||
if (isset($_GET['action']))
|
||||
{
|
||||
switch($_GET['action'])
|
||||
{
|
||||
case 'delete_file':
|
||||
if (isset($_GET['action'])) {
|
||||
switch ($_GET['action']) {
|
||||
case 'delete_file':
|
||||
|
||||
deleteFile($path,$path_thumb,$config);
|
||||
deleteFile($path, $path_thumb, $config);
|
||||
|
||||
break;
|
||||
case 'delete_files':
|
||||
foreach ($paths as $key => $p) {
|
||||
deleteFile($p,$paths_thumb[$key],$config);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'delete_files':
|
||||
foreach ($paths as $key => $p) {
|
||||
deleteFile($p, $paths_thumb[$key], $config);
|
||||
}
|
||||
|
||||
break;
|
||||
case 'delete_folder':
|
||||
|
@ -169,259 +162,251 @@ if (isset($_GET['action']))
|
|||
response(trans('wrong path').AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
$name=fix_filename($name,$config);
|
||||
$name=str_replace('.','',$name);
|
||||
$name = fix_filename($name, $config);
|
||||
$name = str_replace('.', '', $name);
|
||||
|
||||
if (!empty($name)){
|
||||
if (!rename_folder($path,$name,$ftp,$config))
|
||||
{
|
||||
response(trans('Rename_existing_folder').AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
rename_folder($path_thumb,$name,$ftp,$config);
|
||||
if (!$ftp && $config['fixed_image_creation']){
|
||||
foreach($config['fixed_path_from_filemanager'] as $k=>$paths){
|
||||
if ($paths!="" && $paths[strlen($paths)-1] != "/") $paths.="/";
|
||||
if (!empty($name)) {
|
||||
if (!rename_folder($path, $name, $ftp, $config)) {
|
||||
response(trans('Rename_existing_folder') . AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
rename_folder($path_thumb, $name, $ftp, $config);
|
||||
if (!$ftp && $config['fixed_image_creation']) {
|
||||
foreach ($config['fixed_path_from_filemanager'] as $k => $paths) {
|
||||
if ($paths != "" && $paths[strlen($paths) - 1] != "/") {
|
||||
$paths .= "/";
|
||||
}
|
||||
|
||||
$base_dir=$paths.substr_replace($path, '', 0, strlen($config['current_path']));
|
||||
rename_folder($base_dir,$name,$ftp,$config);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
response(trans('Empty_name').AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'create_file':
|
||||
if ($config['create_text_files'] === FALSE) {
|
||||
response(sprintf(trans('File_Open_Edit_Not_Allowed'), strtolower(trans('Edit'))).AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
$base_dir = $paths . substr_replace($path, '', 0, strlen($config['current_path']));
|
||||
rename_folder($base_dir, $name, $ftp, $config);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
response(trans('Empty_name') . AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
if (!isset($config['editable_text_file_exts']) || !is_array($config['editable_text_file_exts'])){
|
||||
$config['editable_text_file_exts'] = array();
|
||||
}
|
||||
case 'create_file':
|
||||
if ($config['create_text_files'] === false) {
|
||||
response(sprintf(trans('File_Open_Edit_Not_Allowed'), strtolower(trans('Edit'))) . AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
|
||||
// check if user supplied extension
|
||||
if (strpos($name, '.') === FALSE){
|
||||
response(trans('No_Extension').' '.sprintf(trans('Valid_Extensions'), implode(', ', $config['editable_text_file_exts'])).AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
if (!isset($config['editable_text_file_exts']) || !is_array($config['editable_text_file_exts'])) {
|
||||
$config['editable_text_file_exts'] = array();
|
||||
}
|
||||
|
||||
// correct name
|
||||
$old_name = $name;
|
||||
$name=fix_filename($name,$config);
|
||||
if (empty($name))
|
||||
{
|
||||
response(trans('Empty_name').AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
// check if user supplied extension
|
||||
if (strpos($name, '.') === false) {
|
||||
response(trans('No_Extension') . ' ' . sprintf(trans('Valid_Extensions'), implode(', ', $config['editable_text_file_exts'])) . AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
|
||||
// check extension
|
||||
$parts = explode('.', $name);
|
||||
if (!in_array(end($parts), $config['editable_text_file_exts'])) {
|
||||
response(trans('Error_extension').' '.sprintf(trans('Valid_Extensions'), implode(', ', $config['editable_text_file_exts'])).AddErrorLocation(), 400)->send();
|
||||
exit;
|
||||
}
|
||||
// correct name
|
||||
$old_name = $name;
|
||||
$name = fix_filename($name, $config);
|
||||
if (empty($name)) {
|
||||
response(trans('Empty_name') . AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
|
||||
$content = $_POST['new_content'];
|
||||
// check extension
|
||||
$parts = explode('.', $name);
|
||||
if (!in_array(end($parts), $config['editable_text_file_exts'])) {
|
||||
response(trans('Error_extension') . ' ' . sprintf(trans('Valid_Extensions'), implode(', ', $config['editable_text_file_exts'])) . AddErrorLocation(), 400)->send();
|
||||
exit;
|
||||
}
|
||||
|
||||
if($ftp){
|
||||
$temp = tempnam('/tmp','RF');
|
||||
file_put_contents($temp, $content);
|
||||
$ftp->put("/".$path.$name, $temp, FTP_BINARY);
|
||||
unlink($temp);
|
||||
response(trans('File_Save_OK'))->send();
|
||||
}else{
|
||||
if (!checkresultingsize(strlen($content))) {
|
||||
response(sprintf(trans('max_size_reached'),$config['MaxSizeTotal']).AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
// file already exists
|
||||
if (file_exists($path.$name)) {
|
||||
response(trans('Rename_existing_file').AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
$content = $_POST['new_content'];
|
||||
|
||||
if (@file_put_contents($path.$name, $content) === FALSE) {
|
||||
response(trans('File_Save_Error').AddErrorLocation())->send();
|
||||
exit;
|
||||
} else {
|
||||
if (is_function_callable('chmod') !== FALSE){
|
||||
chmod($path.$name, 0644);
|
||||
}
|
||||
response(trans('File_Save_OK'))->send();
|
||||
exit;
|
||||
}
|
||||
}
|
||||
if ($ftp) {
|
||||
$temp = tempnam('/tmp', 'RF');
|
||||
file_put_contents($temp, $content);
|
||||
$ftp->put("/" . $path . $name, $temp, FTP_BINARY);
|
||||
unlink($temp);
|
||||
response(trans('File_Save_OK'))->send();
|
||||
} else {
|
||||
if (!checkresultingsize(strlen($content))) {
|
||||
response(sprintf(trans('max_size_reached'), $config['MaxSizeTotal']) . AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
// file already exists
|
||||
if (file_exists($path . $name)) {
|
||||
response(trans('Rename_existing_file') . AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
|
||||
break;
|
||||
case 'rename_file':
|
||||
if ($config['rename_files']){
|
||||
$name=fix_filename($name,$config);
|
||||
if (!empty($name))
|
||||
{
|
||||
if (!rename_file($path,$name,$ftp,$config))
|
||||
{
|
||||
response(trans('Rename_existing_file').AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
if (@file_put_contents($path . $name, $content) === false) {
|
||||
response(trans('File_Save_Error') . AddErrorLocation())->send();
|
||||
exit;
|
||||
} else {
|
||||
if (is_function_callable('chmod') !== false) {
|
||||
chmod($path . $name, 0644);
|
||||
}
|
||||
response(trans('File_Save_OK'))->send();
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
rename_file($path_thumb,$name,$ftp,$config);
|
||||
break;
|
||||
|
||||
if ($config['fixed_image_creation'])
|
||||
{
|
||||
$info=pathinfo($path);
|
||||
case 'rename_file':
|
||||
if ($config['rename_files']) {
|
||||
$name = fix_filename($name, $config);
|
||||
if (!empty($name)) {
|
||||
if (!rename_file($path, $name, $ftp, $config)) {
|
||||
response(trans('Rename_existing_file') . AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
|
||||
foreach($config['fixed_path_from_filemanager'] as $k=>$paths)
|
||||
{
|
||||
if ($paths!="" && $paths[strlen($paths)-1] != "/") $paths.="/";
|
||||
rename_file($path_thumb, $name, $ftp, $config);
|
||||
|
||||
$base_dir = $paths.substr_replace($info['dirname']."/", '', 0, strlen($config['current_path']));
|
||||
if (file_exists($base_dir.$config['fixed_image_creation_name_to_prepend'][$k].$info['filename'].$config['fixed_image_creation_to_append'][$k].".".$info['extension']))
|
||||
{
|
||||
rename_file($base_dir.$config['fixed_image_creation_name_to_prepend'][$k].$info['filename'].$config['fixed_image_creation_to_append'][$k].".".$info['extension'],$config['fixed_image_creation_name_to_prepend'][$k].$name.$config['fixed_image_creation_to_append'][$k],$ftp,$config);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
response(trans('Empty_name').AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'duplicate_file':
|
||||
if ($config['duplicate_files'])
|
||||
{
|
||||
$name=fix_filename($name,$config);
|
||||
if (!empty($name))
|
||||
{
|
||||
if (!$ftp && !checkresultingsize(filesize($path))) {
|
||||
response(sprintf(trans('max_size_reached'),$config['MaxSizeTotal']).AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
if (!duplicate_file($path,$name,$ftp,$config))
|
||||
{
|
||||
response(trans('Rename_existing_file').AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
if ($config['fixed_image_creation']) {
|
||||
$info = pathinfo($path);
|
||||
|
||||
duplicate_file($path_thumb,$name,$ftp,$config);
|
||||
foreach ($config['fixed_path_from_filemanager'] as $k => $paths) {
|
||||
if ($paths != "" && $paths[strlen($paths) - 1] != "/") {
|
||||
$paths .= "/";
|
||||
}
|
||||
|
||||
if (!$ftp && $config['fixed_image_creation'])
|
||||
{
|
||||
$info=pathinfo($path);
|
||||
foreach($config['fixed_path_from_filemanager'] as $k=>$paths)
|
||||
{
|
||||
if ($paths!="" && $paths[strlen($paths)-1] != "/") $paths.= "/";
|
||||
$base_dir = $paths . substr_replace($info['dirname'] . "/", '', 0, strlen($config['current_path']));
|
||||
if (file_exists($base_dir . $config['fixed_image_creation_name_to_prepend'][$k] . $info['filename'] . $config['fixed_image_creation_to_append'][$k] . "." . $info['extension'])) {
|
||||
rename_file($base_dir . $config['fixed_image_creation_name_to_prepend'][$k] . $info['filename'] . $config['fixed_image_creation_to_append'][$k] . "." . $info['extension'], $config['fixed_image_creation_name_to_prepend'][$k] . $name . $config['fixed_image_creation_to_append'][$k], $ftp, $config);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
response(trans('Empty_name') . AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
$base_dir=$paths.substr_replace($info['dirname']."/", '', 0, strlen($config['current_path']));
|
||||
case 'duplicate_file':
|
||||
if ($config['duplicate_files']) {
|
||||
$name = fix_filename($name, $config);
|
||||
if (!empty($name)) {
|
||||
if (!$ftp && !checkresultingsize(filesize($path))) {
|
||||
response(sprintf(trans('max_size_reached'), $config['MaxSizeTotal']) . AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
if (!duplicate_file($path, $name, $ftp, $config)) {
|
||||
response(trans('Rename_existing_file') . AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
|
||||
if (file_exists($base_dir.$config['fixed_image_creation_name_to_prepend'][$k].$info['filename'].$config['fixed_image_creation_to_append'][$k].".".$info['extension']))
|
||||
{
|
||||
duplicate_file($base_dir.$config['fixed_image_creation_name_to_prepend'][$k].$info['filename'].$config['fixed_image_creation_to_append'][$k].".".$info['extension'],$config['fixed_image_creation_name_to_prepend'][$k].$name.$config['fixed_image_creation_to_append'][$k]);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
response(trans('Empty_name').AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
}
|
||||
break;
|
||||
duplicate_file($path_thumb, $name, $ftp, $config);
|
||||
|
||||
case 'paste_clipboard':
|
||||
if ( ! isset($_SESSION['RF']['clipboard_action'], $_SESSION['RF']['clipboard']['path'])
|
||||
|| $_SESSION['RF']['clipboard_action'] == ''
|
||||
|| $_SESSION['RF']['clipboard']['path'] == '')
|
||||
{
|
||||
response()->send();
|
||||
exit;
|
||||
}
|
||||
if (!$ftp && $config['fixed_image_creation']) {
|
||||
$info = pathinfo($path);
|
||||
foreach ($config['fixed_path_from_filemanager'] as $k => $paths) {
|
||||
if ($paths != "" && $paths[strlen($paths) - 1] != "/") {
|
||||
$paths .= "/";
|
||||
}
|
||||
|
||||
$action = $_SESSION['RF']['clipboard_action'];
|
||||
$data = $_SESSION['RF']['clipboard'];
|
||||
$base_dir = $paths . substr_replace($info['dirname'] . "/", '', 0, strlen($config['current_path']));
|
||||
|
||||
if (file_exists($base_dir . $config['fixed_image_creation_name_to_prepend'][$k] . $info['filename'] . $config['fixed_image_creation_to_append'][$k] . "." . $info['extension'])) {
|
||||
duplicate_file($base_dir . $config['fixed_image_creation_name_to_prepend'][$k] . $info['filename'] . $config['fixed_image_creation_to_append'][$k] . "." . $info['extension'], $config['fixed_image_creation_name_to_prepend'][$k] . $name . $config['fixed_image_creation_to_append'][$k]);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
response(trans('Empty_name') . AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 'paste_clipboard':
|
||||
if (!isset($_SESSION['RF']['clipboard_action'], $_SESSION['RF']['clipboard']['path'])
|
||||
|| $_SESSION['RF']['clipboard_action'] == ''
|
||||
|| $_SESSION['RF']['clipboard']['path'] == '') {
|
||||
response()->send();
|
||||
exit;
|
||||
}
|
||||
|
||||
$action = $_SESSION['RF']['clipboard_action'];
|
||||
$data = $_SESSION['RF']['clipboard'];
|
||||
|
||||
|
||||
if($ftp){
|
||||
if($_POST['path']!=""){
|
||||
$path.=DIRECTORY_SEPARATOR;
|
||||
$path_thumb.=DIRECTORY_SEPARATOR;
|
||||
}
|
||||
$path_thumb .= basename($data['path']);
|
||||
$path .= basename($data['path']) ;
|
||||
$data['path_thumb'] = DIRECTORY_SEPARATOR.$config['ftp_base_folder'].$config['ftp_thumbs_dir'].$data['path'];
|
||||
$data['path'] = DIRECTORY_SEPARATOR.$config['ftp_base_folder'].$config['upload_dir'].$data['path'];
|
||||
}else{
|
||||
$data['path_thumb'] = $config['thumbs_base_path'].$data['path'];
|
||||
$data['path'] = $config['current_path'].$data['path'];
|
||||
}
|
||||
if ($ftp) {
|
||||
if ($_POST['path'] != "") {
|
||||
$path .= DIRECTORY_SEPARATOR;
|
||||
$path_thumb .= DIRECTORY_SEPARATOR;
|
||||
}
|
||||
$path_thumb .= basename($data['path']);
|
||||
$path .= basename($data['path']);
|
||||
$data['path_thumb'] = DIRECTORY_SEPARATOR . $config['ftp_base_folder'] . $config['ftp_thumbs_dir'] . $data['path'];
|
||||
$data['path'] = DIRECTORY_SEPARATOR . $config['ftp_base_folder'] . $config['upload_dir'] . $data['path'];
|
||||
} else {
|
||||
$data['path_thumb'] = $config['thumbs_base_path'] . $data['path'];
|
||||
$data['path'] = $config['current_path'] . $data['path'];
|
||||
}
|
||||
|
||||
$pinfo = pathinfo($data['path']);
|
||||
$pinfo = pathinfo($data['path']);
|
||||
|
||||
// user wants to paste to the same dir. nothing to do here...
|
||||
if ($pinfo['dirname'] == rtrim($path, DIRECTORY_SEPARATOR)) {
|
||||
response()->send();
|
||||
exit;
|
||||
}
|
||||
// user wants to paste to the same dir. nothing to do here...
|
||||
if ($pinfo['dirname'] == rtrim($path, DIRECTORY_SEPARATOR)) {
|
||||
response()->send();
|
||||
exit;
|
||||
}
|
||||
|
||||
// user wants to paste folder to it's own sub folder.. baaaah.
|
||||
if (is_dir($data['path']) && strpos($path, $data['path']) !== FALSE){
|
||||
response()->send();
|
||||
exit;
|
||||
}
|
||||
// user wants to paste folder to it's own sub folder.. baaaah.
|
||||
if (is_dir($data['path']) && strpos($path, $data['path']) !== false) {
|
||||
response()->send();
|
||||
exit;
|
||||
}
|
||||
|
||||
// something terribly gone wrong
|
||||
if ($action != 'copy' && $action != 'cut'){
|
||||
response(trans('wrong action').AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
if($ftp){
|
||||
if ($action == 'copy')
|
||||
{
|
||||
$tmp = time().basename($data['path']);
|
||||
$ftp->get($tmp, $data['path'], FTP_BINARY);
|
||||
$ftp->put(DIRECTORY_SEPARATOR.$path, $tmp, FTP_BINARY);
|
||||
unlink($tmp);
|
||||
// something terribly gone wrong
|
||||
if ($action != 'copy' && $action != 'cut') {
|
||||
response(trans('wrong action') . AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
if ($ftp) {
|
||||
if ($action == 'copy') {
|
||||
$tmp = time() . basename($data['path']);
|
||||
$ftp->get($tmp, $data['path'], FTP_BINARY);
|
||||
$ftp->put(DIRECTORY_SEPARATOR . $path, $tmp, FTP_BINARY);
|
||||
unlink($tmp);
|
||||
|
||||
if(url_exists($data['path_thumb'])){
|
||||
$tmp = time().basename($data['path_thumb']);
|
||||
@$ftp->get($tmp, $data['path_thumb'], FTP_BINARY);
|
||||
@$ftp->put(DIRECTORY_SEPARATOR.$path_thumb, $tmp, FTP_BINARY);
|
||||
unlink($tmp);
|
||||
}
|
||||
if (url_exists($data['path_thumb'])) {
|
||||
$tmp = time() . basename($data['path_thumb']);
|
||||
@$ftp->get($tmp, $data['path_thumb'], FTP_BINARY);
|
||||
@$ftp->put(DIRECTORY_SEPARATOR . $path_thumb, $tmp, FTP_BINARY);
|
||||
unlink($tmp);
|
||||
}
|
||||
} elseif ($action == 'cut') {
|
||||
$ftp->rename($data['path'], DIRECTORY_SEPARATOR . $path);
|
||||
if (url_exists($data['path_thumb'])) {
|
||||
@$ftp->rename($data['path_thumb'], DIRECTORY_SEPARATOR . $path_thumb);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// check for writability
|
||||
if (is_really_writable($path) === false || is_really_writable($path_thumb) === false) {
|
||||
response(trans('Dir_No_Write') . '<br/>' . str_replace('../', '', $path) . '<br/>' . str_replace('../', '', $path_thumb) . AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
|
||||
} elseif ($action == 'cut') {
|
||||
$ftp->rename($data['path'], DIRECTORY_SEPARATOR.$path);
|
||||
if(url_exists($data['path_thumb'])){
|
||||
@$ftp->rename($data['path_thumb'], DIRECTORY_SEPARATOR.$path_thumb);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
// check for writability
|
||||
if (is_really_writable($path) === FALSE || is_really_writable($path_thumb) === FALSE){
|
||||
response(trans('Dir_No_Write').'<br/>'.str_replace('../','',$path).'<br/>'.str_replace('../','',$path_thumb).AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
|
||||
// check if server disables copy or rename
|
||||
if (is_function_callable(($action == 'copy' ? 'copy' : 'rename')) === FALSE){
|
||||
response(sprintf(trans('Function_Disabled'), ($action == 'copy' ? (trans('Copy')) : (trans('Cut')))).AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
if ($action == 'copy')
|
||||
{
|
||||
list($sizeFolderToCopy,$fileNum,$foldersCount) = folder_info($path,false);
|
||||
if (!checkresultingsize($sizeFolderToCopy)) {
|
||||
response(sprintf(trans('max_size_reached'),$config['MaxSizeTotal']).AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
rcopy($data['path'], $path);
|
||||
rcopy($data['path_thumb'], $path_thumb);
|
||||
} elseif ($action == 'cut') {
|
||||
rrename($data['path'], $path);
|
||||
rrename($data['path_thumb'], $path_thumb);
|
||||
// check if server disables copy or rename
|
||||
if (is_function_callable(($action == 'copy' ? 'copy' : 'rename')) === false) {
|
||||
response(sprintf(trans('Function_Disabled'), ($action == 'copy' ? (trans('Copy')) : (trans('Cut')))) . AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
if ($action == 'copy') {
|
||||
list($sizeFolderToCopy, $fileNum, $foldersCount) = folder_info($path, false);
|
||||
if (!checkresultingsize($sizeFolderToCopy)) {
|
||||
response(sprintf(trans('max_size_reached'), $config['MaxSizeTotal']) . AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
rcopy($data['path'], $path);
|
||||
rcopy($data['path_thumb'], $path_thumb);
|
||||
} elseif ($action == 'cut') {
|
||||
rrename($data['path'], $path);
|
||||
rrename($data['path_thumb'], $path_thumb);
|
||||
|
||||
// cleanup
|
||||
if (is_dir($data['path']) === TRUE){
|
||||
|
@ -431,91 +416,90 @@ if (isset($_GET['action']))
|
|||
}
|
||||
}
|
||||
|
||||
// cleanup
|
||||
$_SESSION['RF']['clipboard']['path'] = NULL;
|
||||
$_SESSION['RF']['clipboard_action'] = NULL;
|
||||
// cleanup
|
||||
$_SESSION['RF']['clipboard']['path'] = null;
|
||||
$_SESSION['RF']['clipboard_action'] = null;
|
||||
|
||||
break;
|
||||
case 'chmod':
|
||||
$mode = $_POST['new_mode'];
|
||||
$rec_option = $_POST['is_recursive'];
|
||||
$valid_options = array('none', 'files', 'folders', 'both');
|
||||
$chmod_perm = ($_POST['folder'] ? $config['chmod_dirs'] : $config['chmod_files']);
|
||||
break;
|
||||
|
||||
// check perm
|
||||
if ($chmod_perm === FALSE) {
|
||||
response(sprintf(trans('File_Permission_Not_Allowed'), (is_dir($path) ? (trans('Folders')) : (trans('Files')) )).AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
// check mode
|
||||
if (!preg_match("/^[0-7]{3}$/", $mode)){
|
||||
response(trans('File_Permission_Wrong_Mode').AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
// check recursive option
|
||||
if (!in_array($rec_option, $valid_options)){
|
||||
response(trans("wrong option").AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
// check if server disabled chmod
|
||||
if (!$ftp && is_function_callable('chmod') === FALSE){
|
||||
response(sprintf(trans('Function_Disabled'), 'chmod').AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
case 'chmod':
|
||||
$mode = $_POST['new_mode'];
|
||||
$rec_option = $_POST['is_recursive'];
|
||||
$valid_options = array('none', 'files', 'folders', 'both');
|
||||
$chmod_perm = ($_POST['folder'] ? $config['chmod_dirs'] : $config['chmod_files']);
|
||||
|
||||
$mode = "0".$mode;
|
||||
$mode = octdec($mode);
|
||||
if($ftp){
|
||||
$ftp->chmod($mode, "/".$path);
|
||||
}else{
|
||||
rchmod($path, $mode, $rec_option);
|
||||
}
|
||||
// check perm
|
||||
if ($chmod_perm === false) {
|
||||
response(sprintf(trans('File_Permission_Not_Allowed'), (is_dir($path) ? (trans('Folders')) : (trans('Files')))) . AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
// check mode
|
||||
if (!preg_match("/^[0-7]{3}$/", $mode)) {
|
||||
response(trans('File_Permission_Wrong_Mode') . AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
// check recursive option
|
||||
if (!in_array($rec_option, $valid_options)) {
|
||||
response(trans("wrong option") . AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
// check if server disabled chmod
|
||||
if (!$ftp && is_function_callable('chmod') === false) {
|
||||
response(sprintf(trans('Function_Disabled'), 'chmod') . AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
|
||||
break;
|
||||
case 'save_text_file':
|
||||
$content = $_POST['new_content'];
|
||||
// $content = htmlspecialchars($content); not needed
|
||||
// $content = stripslashes($content);
|
||||
$mode = "0" . $mode;
|
||||
$mode = octdec($mode);
|
||||
if ($ftp) {
|
||||
$ftp->chmod($mode, "/" . $path);
|
||||
} else {
|
||||
rchmod($path, $mode, $rec_option);
|
||||
}
|
||||
|
||||
if($ftp){
|
||||
$tmp = time();
|
||||
file_put_contents($tmp, $content);
|
||||
try{
|
||||
$ftp->put("/".$path, $tmp, FTP_BINARY);
|
||||
}catch(FtpClient\FtpException $e){
|
||||
echo $e->getMessage();
|
||||
}
|
||||
unlink($tmp);
|
||||
response(trans('File_Save_OK'))->send();
|
||||
}else{
|
||||
// no file
|
||||
if (!file_exists($path)) {
|
||||
response(trans('File_Not_Found').AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
break;
|
||||
|
||||
// not writable or edit not allowed
|
||||
if (!is_writable($path) || $config['edit_text_files'] === FALSE) {
|
||||
response(sprintf(trans('File_Open_Edit_Not_Allowed'), strtolower(trans('Edit'))).AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
case 'save_text_file':
|
||||
$content = $_POST['new_content'];
|
||||
// $content = htmlspecialchars($content); not needed
|
||||
// $content = stripslashes($content);
|
||||
|
||||
if (!checkresultingsize(strlen($content))) {
|
||||
response(sprintf(trans('max_size_reached'),$config['MaxSizeTotal']).AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
if (@file_put_contents($path, $content) === FALSE) {
|
||||
response(trans('File_Save_Error').AddErrorLocation())->send();
|
||||
exit;
|
||||
} else {
|
||||
response(trans('File_Save_OK'))->send();
|
||||
exit;
|
||||
}
|
||||
}
|
||||
if ($ftp) {
|
||||
$tmp = time();
|
||||
file_put_contents($tmp, $content);
|
||||
$ftp->put("/" . $path, $tmp, FTP_BINARY);
|
||||
unlink($tmp);
|
||||
response(trans('File_Save_OK'))->send();
|
||||
} else {
|
||||
// no file
|
||||
if (!file_exists($path)) {
|
||||
response(trans('File_Not_Found') . AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
response(trans('wrong action').AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
// not writable or edit not allowed
|
||||
if (!is_writable($path) || $config['edit_text_files'] === false) {
|
||||
response(sprintf(trans('File_Open_Edit_Not_Allowed'), strtolower(trans('Edit'))) . AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
|
||||
if (!checkresultingsize(strlen($content))) {
|
||||
response(sprintf(trans('max_size_reached'), $config['MaxSizeTotal']) . AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
if (@file_put_contents($path, $content) === false) {
|
||||
response(trans('File_Save_Error') . AddErrorLocation())->send();
|
||||
exit;
|
||||
} else {
|
||||
response(trans('File_Save_OK'))->send();
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
response(trans('wrong action') . AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,27 +5,23 @@ $config = include 'config/config.php';
|
|||
include 'include/utils.php';
|
||||
include 'include/mime_type_lib.php';
|
||||
|
||||
$ftp = ftp_con($config);
|
||||
|
||||
if ($_SESSION['RF']["verify"] != "RESPONSIVEfilemanager") {
|
||||
response(trans('forbiden') . AddErrorLocation(), 403)->send();
|
||||
response(trans('forbidden') . AddErrorLocation(), 403)->send();
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
if (!checkRelativePath($_POST['path']) ||
|
||||
strpos($_POST['path'], '/') === 0
|
||||
) {
|
||||
response(trans('wrong path').AddErrorLocation(), 400)->send();
|
||||
if (!checkRelativePath($_POST['path']) || strpos($_POST['path'], '/') === 0) {
|
||||
response(trans('wrong path') . AddErrorLocation(), 400)->send();
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
if (strpos($_POST['name'], '/') !== false) {
|
||||
response(trans('wrong path').AddErrorLocation(), 400)->send();
|
||||
response(trans('wrong path') . AddErrorLocation(), 400)->send();
|
||||
exit;
|
||||
}
|
||||
|
||||
$ftp = ftp_con($config);
|
||||
|
||||
if ($ftp) {
|
||||
$path = $config['ftp_base_url'] . $config['upload_dir'] . $_POST['path'];
|
||||
} else {
|
||||
|
@ -36,13 +32,13 @@ $name = $_POST['name'];
|
|||
$info = pathinfo($name);
|
||||
|
||||
if (!check_extension($info['extension'], $config)) {
|
||||
response(trans('wrong extension').AddErrorLocation(), 400)->send();
|
||||
response(trans('wrong extension') . AddErrorLocation(), 400)->send();
|
||||
exit;
|
||||
}
|
||||
|
||||
$file_name = $info['basename'];
|
||||
$file_ext = $info['extension'];
|
||||
$file_path = $path . $name;
|
||||
$file_name = $info['basename'];
|
||||
$file_ext = $info['extension'];
|
||||
$file_path = $path . $name;
|
||||
|
||||
|
||||
// make sure the file exists
|
||||
|
@ -102,6 +98,7 @@ if ($ftp) {
|
|||
|
||||
$chunksize = 1 * (1024 * 1024);
|
||||
$bytes_send = 0;
|
||||
|
||||
if ($file = fopen($file_path, 'r')) {
|
||||
if (isset($_SERVER['HTTP_RANGE'])) {
|
||||
fseek($file, $range);
|
||||
|
|
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3.4 KiB |
Before Width: | Height: | Size: 4.0 KiB After Width: | Height: | Size: 4.0 KiB |
Before Width: | Height: | Size: 4.0 KiB After Width: | Height: | Size: 4.0 KiB |
Before Width: | Height: | Size: 4.0 KiB After Width: | Height: | Size: 4.0 KiB |
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.3 KiB |
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3.4 KiB |
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3.4 KiB |
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 3.7 KiB |
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3.4 KiB |
Before Width: | Height: | Size: 4.1 KiB After Width: | Height: | Size: 4.1 KiB |
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 3.7 KiB |
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 3.5 KiB |
Before Width: | Height: | Size: 4.0 KiB After Width: | Height: | Size: 4.0 KiB |
Before Width: | Height: | Size: 4.0 KiB After Width: | Height: | Size: 4.0 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 3.5 KiB |
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 3.5 KiB |
Before Width: | Height: | Size: 535 B After Width: | Height: | Size: 535 B |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 3.7 KiB |
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.3 KiB |
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 3.6 KiB |
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 3.5 KiB |
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 3.6 KiB |
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 3.7 KiB |
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 3.7 KiB |
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: |