if (is_array($auto_dropzone['destination_filepath']) && !empty($auto_dropzone['destination_filepath'][$sFileExt]) && is_dir($_SESSION['upload_path'] . $auto_dropzone['destination_filepath'][$sFileExt])) { $sFileName = $auto_dropzone['destination_filepath'][$sFileExt] . $sFileName; echo $ok; rename($_FILES['myfile']['tmp_name'], $_SESSION['upload_path'] . $sFileName); chmod($_SESSION['upload_path'] . $sFileName, 0644); } elseif (is_array($auto_dropzone['destination_filepath']) && !empty($auto_dropzone['destination_filepath'][$sFileExt]) && !is_dir($_SESSION['upload_path'] . $auto_dropzone['destination_filepath'][$sFileExt]) || is_string($auto_dropzone['destination_filepath']) && !is_dir($_SESSION['upload_path'] . $auto_dropzone['destination_filepath'])) { //local upload dir error echo '<li class="DD_file DD_error"><span class="DD_filename">Upload path problem with ' . $sFileName . ' </span></li> '; } elseif ($sFileError) { // file upload error echo '<li class="DD_file DD_error"><span class="DD_filename">' . $sFileName . ': ' . $sFileError . ' </span></li> '; } elseif (is_dir($_SESSION['upload_path'] . $auto_dropzone['destination_filepath'])) { $file = $sFileName; $sFileName = $auto_dropzone['destination_filepath'] . $sFileName; if (is_file($_SESSION['upload_path'] . $sFileName)) { $newfilename = rename_item($file); echo '<li class="DD_file DD_warning"><span class="DD_filename">' . $file . ' => ' . $newfilename . ' </span></li>'; $sFileName = $auto_dropzone['destination_filepath'] . $newfilename; } echo $ok; rename($_FILES['myfile']['tmp_name'], $_SESSION['upload_path'] . $sFileName); chmod($_SESSION['upload_path'] . $sFileName, 0644); addID($sFileName); } } else { echo $notok; } exit; } else { // GENERATE DROPZONE if ($auto_dropzone['use_style']) {
del_items($dir); break; //------------------------------------------------------------------------------ // COPY/MOVE FILE(S)/DIR(S) //------------------------------------------------------------------------------ // COPY/MOVE FILE(S)/DIR(S) case "copy": case "move": require _QUIXPLORER_PATH . "/include/fun_copy_move.php"; copy_move_items($dir); break; // RENAME FILE(S)/DIR(S) // RENAME FILE(S)/DIR(S) case "rename": require _QUIXPLORER_PATH . "/include/fun_rename.php"; rename_item($dir, $item); break; //------------------------------------------------------------------------------ // DOWNLOAD FILE //------------------------------------------------------------------------------ // DOWNLOAD FILE case "download": require _QUIXPLORER_PATH . "/include/fun_down.php"; @ob_end_clean(); // get rid of cached unwanted output download_item($dir, $item); ob_start(false); // prevent unwanted output exit; break; //------------------------------------------------------------------------------
} } save($_SESSION['profiles_rights_file'], $rights); header('location:index.php?p=edit_profiles&token=' . TOKEN . '&msg=' . e('Changes saved', false)); exit; } # Editor if (isset($_POST['editor_content']) && !empty($_POST['editor_filename']) && is_allowed('markdown editor')) { $extension = pathinfo($_POST['editor_filename'], PATHINFO_EXTENSION); if (empty($extension)) { $_POST['editor_filename'] .= '.md'; } $file = no_special_char($_POST['editor_filename']); $path = addslash_if_needed($_SESSION['upload_root_path'] . $_SESSION['upload_user_path'] . $_SESSION['current_path']); if (is_file($path . $file) && !isset($_POST['overwrite'])) { $file = rename_item($file, $path); } file_put_contents($path . $file, $_POST['editor_content']); if (!isset($_POST['overwrite'])) { $id = addID($path . $file); $tree = add_branch($path . $file, $id, $_SESSION['login'], $tree); } header('location:index.php?p=admin&token=' . TOKEN . '&msg=' . $_POST['editor_filename'] . ' ' . e('Changes saved', false)); exit; } # Config change if (isset($_POST['config']) && is_allowed('config page')) { } if ($_FILES && is_allowed('upload')) { include 'core/auto_dropzone.php'; exit;
if (!empty($_POST['file']) && !empty($_POST['destination'])) { $file = $_POST['file']; if ($file == '/') { $file = ''; } $destination = $_POST['destination']; if ($destination == '/') { $destination = ''; } if (check_path($file) && check_path($destination)) { if (is_file($_SESSION['upload_path'] . $file) || is_dir($_SESSION['upload_path'] . $file)) { $file = stripslashes($file); $destination = addslash_if_needed($destination) . basename($file); # if file/folder exists in destination folder, change name if (is_file($_SESSION['upload_path'] . $destination) || is_dir($_SESSION['upload_path'] . $destination)) { $destination = addslash_if_needed($destination) . rename_item(basename($file)); } # move file rename($_SESSION['upload_path'] . $file, $_SESSION['upload_path'] . $destination); if (!is_dir(dirname('thumbs/' . $destination))) { mkdir(dirname('thumbs/' . $destination), 0744, true); } rename(get_thumbs_name($file), get_thumbs_name($destination)); # change path in id $id = file2id($file); $ids = unstore(); $ids[$id] = $destination; store(); } } header('location:admin.php');
function new_folder($folder = null) { if (!$folder) { return false; } $thumbs_path = 'thumbs/' . $_SESSION['upload_user_path'] . addslash_if_needed($_SESSION['current_path']); $path = $_SESSION['upload_root_path'] . $_SESSION['upload_user_path'] . addslash_if_needed($_SESSION['current_path']); $complete_path = $path . $folder; $complete_thumbs = $thumbs_path . $folder; if (is_dir($complete_path) && is_dir($complete_thumbs)) { # Folder already exists, rename $folder = rename_item($folder, $path); $complete_path = $path . $folder; $complete_thumbs = $thumbs_path . $folder; } else { if (!is_dir($complete_path) && is_dir($complete_thumbs)) { rrmdir($complete_thumbs); } } mkdir($complete_path, 0744, true); mkdir($complete_thumbs, 0744, true); return addID($complete_path); }
if (is_array($auto_dropzone['destination_filepath']) && !empty($auto_dropzone['destination_filepath'][$sFileExt]) && is_dir($_SESSION['upload_root_path'] . $_SESSION['upload_user_path'] . $auto_dropzone['destination_filepath'][$sFileExt])) { $sFileName = $auto_dropzone['destination_filepath'][$sFileExt] . $sFileName; echo $ok; rename($_FILES['myfile']['tmp_name'], $_SESSION['upload_root_path'] . $_SESSION['upload_user_path'] . $sFileName); chmod($_SESSION['upload_root_path'] . $_SESSION['upload_user_path'] . $sFileName, 0644); } elseif (is_array($auto_dropzone['destination_filepath']) && !empty($auto_dropzone['destination_filepath'][$sFileExt]) && !is_dir($_SESSION['upload_root_path'] . $_SESSION['upload_user_path'] . $auto_dropzone['destination_filepath'][$sFileExt]) || is_string($auto_dropzone['destination_filepath']) && !is_dir($_SESSION['upload_root_path'] . $_SESSION['upload_user_path'] . $auto_dropzone['destination_filepath'])) { //local upload dir error echo '<li class="DD_file DD_error"><span class="DD_filename">Upload path problem with ' . $sFileName . ' </span></li> '; } elseif ($sFileError) { // file upload error echo '<li class="DD_file DD_error"><span class="DD_filename">' . $sFileName . ': ' . $sFileError . ' </span></li> '; } elseif (is_dir($_SESSION['upload_root_path'] . $_SESSION['upload_user_path'] . $auto_dropzone['destination_filepath'])) { $file = $sFileName; $sFileName = $auto_dropzone['destination_filepath'] . $sFileName; if (is_file($_SESSION['upload_root_path'] . $_SESSION['upload_user_path'] . $sFileName)) { $newfilename = rename_item($file, $_SESSION['upload_root_path'] . $_SESSION['upload_user_path'] . $auto_dropzone['destination_filepath']); echo '<li class="DD_file DD_warning"><span class="DD_filename">' . $file . ' => ' . $newfilename . ' </span></li>'; $sFileName = $auto_dropzone['destination_filepath'] . $newfilename; } echo $ok; rename($_FILES['myfile']['tmp_name'], $_SESSION['upload_root_path'] . $_SESSION['upload_user_path'] . $sFileName); chmod($_SESSION['upload_root_path'] . $_SESSION['upload_user_path'] . $sFileName, 0644); $id = addID($_SESSION['upload_root_path'] . $_SESSION['upload_user_path'] . $sFileName); $tree = add_branch($_SESSION['upload_root_path'] . $_SESSION['upload_user_path'] . $sFileName, $id, $_SESSION['login'], $tree); } } else { echo $notok; } exit; } else { // GENERATE DROPZONE