if (!empty($_SESSION['upload_user_path']) && !is_readable($_SESSION['upload_root_path'] . $_SESSION['upload_user_path'] . $_SESSION['current_path'])) { $message .= '<div class="error">' . e('Problem accessing ' . $_SESSION['current_path'] . ': folder not readable', false) . '</div>'; } if (!empty($_SESSION['upload_user_path']) && !is_writable($_SESSION['upload_root_path'] . $_SESSION['upload_user_path'] . $_SESSION['current_path'])) { $message .= '<div class="error">' . e('Problem accessing ' . $_SESSION['current_path'] . ': folder not writable', false) . '</div>'; } $behaviour['FILES_TO_ECHO'] = array('txt', 'js', 'html', 'php', 'SECURED_PHP', 'htm', 'shtml', 'shtm', 'css'); $behaviour['FILES_TO_RETURN'] = array('md', 'jpg', 'jpeg', 'gif', 'png', 'pdf', 'swf', 'mp3', 'mp4', 'svg'); $auto_dropzone['destination_filepath'] = $_SESSION['current_path'] . '/'; $auto_thumb['default_width'] = '64'; $auto_thumb['default_height'] = '64'; $auto_thumb['dont_try_to_resize_thumbs_files'] = true; # CONSTANTS define('THEME_PATH', 'templates/' . $_SESSION['theme'] . '/'); include 'core/templates.php'; $ids = purgeIDs(); # Functions function load($file) { return file_exists($file) ? unserialize(gzinflate(base64_decode(substr(file_get_contents($file), 9, -strlen(6))))) : array(); } function save($file, $data) { return file_put_contents($file, '<?php /* ' . base64_encode(gzdeflate(serialize($data))) . ' */ ?>'); } function store($ids = null) { return save($_SESSION['id_file'], $ids); } function unstore() {
if (!empty($_GET['del']) && $_GET['del'] != '') { $f = id2file($_GET['del']); if (is_file($_SESSION['upload_path'] . $f)) { # delete file unlink($_SESSION['upload_path'] . $f); unlink(get_thumbs_name($f)); unset($ids[$_GET['del']]); store(); kill_thumb_if_exists($f); } else { if (is_dir($_SESSION['upload_path'] . $f)) { # delete dir rrmdir($_SESSION['upload_path'] . $f); rrmdir('thumbs/' . $f); # remove all vanished sub files & folders from id file purgeIDs(); } } header('location:admin.php'); exit; } # rename file/folder if (!empty($_GET['id']) && !empty($_GET['newname'])) { $oldfile = id2file($_GET['id']); $path = addslash_if_needed($_SESSION['current_path']); $newfile = $path . only_alphanum_and_dot($_GET['newname']); if ($newfile != basename($oldfile) && check_path($newfile)) { # if newname exists, change newname if (is_file($_SESSION['upload_path'] . $newfile) || is_dir($_SESSION['upload_path'] . $newfile)) { $newfile = $path . rename_item(basename($newfile)); }