<?php /* * Author: Hendrik Still * Email: gamma32@gmail.com */ require_once 'config.php'; require_once 'lib.php'; $requested_file = $_GET['file']; //file alias $file_path = $files[$requested_file]['path']; //real filepath $file_name = $files[$requested_file]['name']; if (isset($file_path)) { //check if alias exists if (check_download_ability()) { $session_name = create_session_files(); sent_header($file_name, $file_path); readfile($file_path); // remove_session_file($session_name); } else { header('Location:' . NO_DOWNLOAD_REDIRECTION); } } else { header('HTTP/1.1 404 Not Found'); header('Status: 404 Not Found'); }
/** * Build output * * @param $path_src * @param $path_out */ function build($path_src, $path_out, $is_fast = false) { $template_file = $path_src . '/template.html'; $index_file = $path_out . '/index.html'; $dirs = array('/css', '/js', '/files', '/fonts'); foreach ($dirs as $dir) { copy_files($path_src . $dir, $path_out . $dir); } create_dir("{$path_out}/session"); if (!$is_fast) { create_session_files("{$path_out}/session"); } create_dir("{$path_out}/audio"); create_dir("{$path_out}/images/thumbs"); copy_file($path_src, $path_out, 'images/background.png'); $template = file_get_contents($template_file); $html = preg_replace_callback('/\\{\\{([^}]+)\\}\\}/', "template_callback", $template); file_put_contents($index_file, $html); }