<?php
//#################################################################################################
// Media page
//#################################################################################################
// chillyCMS - Content Management System
// Copyright (C) 2008
// Stefanie Wiegand <hide@address.com> & Johannes Cox <hide@address.com>
//
// This program is licensed under the GPL 3.0 license. For more information see LICENSE.txt.
//#################################################################################################
define('DOIT',true);
require_once("../core/session.backend.include.php");
require_once(PATH."/core/file.class.php");
require_once(PATH."/core/mime.include.php");
require_once(PATH."/admin/media.include.php");
$folders=array();
//Show which directory?
//Either the one we just uploaded to,...
if (isset($_POST["sentfile"])) {
$showfolder="../".cut_doubledots($_POST["destination"]);
$msg=upload_file($showfolder);
//...or the one that has been clicked,...
} else if (isset($_POST["folder"])) { $showfolder="../".cut_doubledots($_POST["folder"]); } else { $showfolder = false; }
//...or the standard directory
if (!$showfolder or $showfolder=="../") { $showfolder = "../media"; }
if (isset($_POST["action"])) { $action = only_text($_POST["action"]); } else { $action = false; }
if (isset($_POST["file"])) { $file = cut_doubledots($_POST["file"]); } else { $file = false; }
if (isset($_POST["parent"])) { $parent = cut_doubledots($_POST["parent"]); } else { $parent = false; }
if (isset($_POST["newfolder"])) {
$newfolder = cut_doubledots($_POST["newfolder"]);
$msg = create_folder($parent,$newfolder);
}
if ($action=="delete") { $msg = delete_file($file); }
elseif ($action=="unzip") { $msg = unzip_here($showfolder,$file); }
else { $msg = false; }
$page->print_head();
$page->add(newfolder_form());
$page->add(show_folders());
$page->add(uploadform());
$page->add(print_images($showfolder));
$page->print_body($msg);
?>