2012-02-27 16:59:03 +00:00
|
|
|
<?php
|
|
|
|
define("MAIN_DIR", __dir__."/..");
|
|
|
|
|
2012-05-20 08:22:37 +00:00
|
|
|
require(MAIN_DIR."/common.php");
|
2012-03-05 21:46:25 +00:00
|
|
|
|
2012-05-20 08:22:37 +00:00
|
|
|
if (isset($_GET["s"]))
|
|
|
|
$stream = "inline";
|
|
|
|
else
|
|
|
|
$stream = "attachment";
|
2012-03-05 21:46:25 +00:00
|
|
|
|
|
|
|
if (isset($_GET["f"]))
|
|
|
|
{
|
2012-05-20 08:22:37 +00:00
|
|
|
$musiks = get_dlmusiks($user);
|
2012-03-05 21:46:25 +00:00
|
|
|
|
2012-05-20 08:22:37 +00:00
|
|
|
foreach ($musiks as $k => $lign)
|
|
|
|
{
|
|
|
|
if ($k == $_GET["f"])
|
2012-03-05 21:46:25 +00:00
|
|
|
{
|
2012-05-20 08:22:37 +00:00
|
|
|
$musik = get_info($lign["url"]);
|
|
|
|
if (isset($musik) && (is_file(MAIN_DIR."/content/".$musik["mp3"])
|
|
|
|
|| is_file(MAIN_DIR."/content/".$musik["ogg"])))
|
2012-03-05 21:46:25 +00:00
|
|
|
{
|
2012-05-20 08:22:37 +00:00
|
|
|
if (is_file(MAIN_DIR."/content/".$musik["ogg"]))
|
2012-03-05 21:46:25 +00:00
|
|
|
{
|
2012-05-20 08:22:37 +00:00
|
|
|
$filename = MAIN_DIR."/content/".$musik["ogg"];
|
|
|
|
$ext = ".ogg";
|
2012-03-05 21:46:25 +00:00
|
|
|
}
|
2012-05-20 08:22:37 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
$filename = MAIN_DIR."/content/".$musik["mp3"];
|
|
|
|
$ext = ".mp3";
|
|
|
|
}
|
|
|
|
|
|
|
|
//Mark file as dled
|
|
|
|
mark_as_dled($user, $k);
|
|
|
|
|
|
|
|
if (is_file(MAIN_DIR."/content/".$musik["ogg"]))
|
|
|
|
$fname = MAIN_DIR."/content/".$musik["ogg"];
|
|
|
|
else
|
|
|
|
$fname = MAIN_DIR."/content/".$musik["mp3"];
|
|
|
|
|
|
|
|
header('Content-Description: File Transfer');
|
|
|
|
header('Content-Type: '.mime_content_type($filename));
|
|
|
|
header("Content-Disposition: ".$stream."; filename=\"".addslashes($musik["title"]).$ext."\"");
|
|
|
|
header('Content-Transfer-Encoding: binary');
|
|
|
|
//header('Expires: 0');
|
|
|
|
//header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
|
|
|
|
header('Pragma: public');
|
|
|
|
header('Content-Length: ' . filesize($filename));
|
|
|
|
readfile($filename);
|
|
|
|
exit;
|
2012-03-05 21:46:25 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2012-02-27 16:59:03 +00:00
|
|
|
}
|
2012-03-05 21:46:25 +00:00
|
|
|
die ("Fichier introuvable");
|
2012-04-15 14:30:53 +00:00
|
|
|
?>
|