Exemple #1
0
    if (!empty($_REQUEST['action']) && 'login' == strtolower($_REQUEST['action'])) {
        $screen = process_login($_REQUEST);
    } else {
        $screen = 'screen_login';
    }
    if ($screen == 'screen_login') {
        $screen();
        exit;
    }
}
//if vfs_id is set we're not browsing a regular folder but a virtual filesystem, e.g.
//a search result set or the contents of an archive
$vfs_id = empty($_REQUEST['vfs_id']) ? false : $_REQUEST['vfs_id'];
//try the value in $_REQUEST then $fm_config['HOME_FOLDER'] then default value '/'
$folder = empty($_REQUEST['folder']) ? empty($fm_config['HOME_FOLDER']) ? '/' : $fm_config['HOME_FOLDER'] : $_REQUEST['folder'];
$folder = validate_folder($folder);
//check if it's a valid folder and if it's within the tree we're allowed to access
if (empty($folder)) {
    $logmessage = 'Folder does not exist or you do not have permissions to access it';
} else {
    $folder_contents = reload_folder($folder);
    if (empty($folder_contents)) {
        $logmessage = 'Folder does not exist or you do not have permissions to access it';
        $screen = '';
    } else {
        $logmessage = '';
        $screen = process_request($_REQUEST, $folder);
    }
}
if (!empty($screen) && function_exists($screen)) {
    $screen();
// HTTP headers for no cache etc
header('Content-type: text/plain; charset=UTF-8');
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
// Uncomment to log every the last request
//file_put_contents('/tmp/last_plupload_req.log',var_export(apache_request_headers(), true).'\n'.var_export($_GET,true).'\n'.var_export($_POST,true));
// Settings
$cleanupTargetDir = true;
// Remove old files
$maxFileAge = 60 * 60;
// Temp file age in seconds
// Get sanely the destination folder from  user request
$finalDir = validate_folder($_GET['folder']);
//"/tmp/uploads2/"; //final directory <- need these to be variable
// 5 minutes execution time
@set_time_limit(5 * 60);
// usleep(5000);
// Get parameters
$chunk = isset($_REQUEST["chunk"]) ? $_REQUEST["chunk"] : 0;
$chunks = isset($_REQUEST["chunks"]) ? $_REQUEST["chunks"] : 0;
$fileName = isset($_REQUEST["name"]) ? $_REQUEST["name"] : '';
// Clean the fileName for security reasons
$fileName = preg_replace('/[^\\w\\._]+/', '', $fileName);
// Create target dir
if (!file_exists($tmp_upload_dir)) {
    @mkdir($tmp_upload_dir);
}
// Remove old temp files