################################################################
## Title:		Edit Download Add-on
## Author:		Cf Manager < cf_manager@yahoo.com > (Son Thai)
## Support:		http://cfmanager.net.tf
##			http://cfmanager.gate2vn.net
##
## Description:		If you are using Music Download Add-on v1.0.1, you must edit it
##			after upgrade to MOM 2.0.6.
##
## Installation Level:	Easy
## Installation Time:	5 minutes
## Files To Edit:	1
##			music_download.php
##
## Included Files:	n/a
##
################################################################
## Author Notes:
## 	Full support for this MOD can be obtained at: http://cfmanager.net.tf 
## 	This MOD was tested with the following databases: MySQL
##	Do not remove my copyright notice!
################################################################
## This MOD is released under the GPL License.
################################################################
## Before UPGRADING, You Should Back Up All Files and your DB
################################################################
#
#-----[ OPEN ]--------------------------------------------------
#
music_download.php

#
#-----[ FIND ]--------------------------------------------------
#
if ( $thissong['song_url'] == '' )
{
	$song_filetype = substr($thissong['song_filename'], strlen($thissong['song_filename']) - 4, 4);
	$song_filename = $thissong['song_filename'];
}
else
{
	$song_filetype_url = substr($thissong['song_url'], strlen($thissong['song_url']) - 4, 4);
	$song_url = $thissong['song_url'];
}

#
#-----[ REPLACE BY ]--------------------------------------------
#
if ( $thissong['song_url'] == '' )
{
	$song_filetype = substr($thissong['song_filename'], strlen($thissong['song_filename']) - 3, 3);
	$song_filename = $thissong['song_filename'];
}
else
{
	$song_filetype_url = substr($thissong['song_url'], strlen($thissong['song_url']) - 3, 3);
	$song_url = $thissong['song_url'];
}

#
#-----[ FIND ]--------------------------------------------------
#
		case '.mp3':
			header('Content-type: audio/mp3');
			break;
		case '.wav':
			header('Content-type: audio/wav');
			break;
		case '.wma':
			header('Content-type: audio/x-ms-wma');
			break;
		default:
			die('The filename data in the DBs was corrupted');
	}
	header("Content-Disposition: attachment; filename=\"$song_title - $song_singer\"");
	readfile(MUSIC_UPLOAD_PATH  . $thissong['song_filename']);
	}
else
	{
	switch ( $song_filetype_url )
	{
		case '.mp3':
			header('Content-type: audio/mp3');
			break;
		case '.wav':
			header('Content-type: audio/wav');
			break;
		case '.wma':
			header('Content-type: audio/x-ms-wma');
			break;

#
#-----[ REPLACE BY ]--------------------------------------------
#
		case 'mp3':
			header('Content-type: audio/mp3');
			break;
		case 'wav':
			header('Content-type: audio/wav');
			break;
		case 'wma':
			header('Content-type: audio/x-ms-wma');
			break;
		case 'wmv':
			header('Content-type: video/x-ms-wmv');
			break;
		case 'peg':
			header('Content-type: video/mpeg');
			break;
		case 'avi':
			header('Content-type: video/x-msvideo');
			break;
		case 'swf':
			header('Content-type: application/x-shockwave-flash');
			break;
		case '.au':
			header('Content-type: audio/basic');
			break;
		case 'mid':
			header('Content-type: audio/mid');
			break;
		case '.qt':
			header('Content-type: video/quicktime');
			break;
		case 'ram':
			header('Content-type: audio/x-pn-realaudio');
			break;
		case '.rm':
			header('Content-type: application/vnd.rn-realmedia');
			break;
		default:
			die('The filename data in the DBs was corrupted');
	}
	header("Content-Disposition: attachment; filename=\"$song_title - $song_singer\"");
	readfile(MUSIC_UPLOAD_PATH  . $thissong['song_filename']);
	}
else
	{
	switch ( $song_filetype_url )
	{
		case 'mp3':
			header('Content-type: audio/mp3');
			break;
		case 'wav':
			header('Content-type: audio/wav');
			break;
		case 'wma':
			header('Content-type: audio/x-ms-wma');
			break;
		case 'wmv':
			header('Content-type: video/x-ms-wmv');
			break;
		case 'peg':
			header('Content-type: video/mpeg');
			break;
		case 'avi':
			header('Content-type: video/x-msvideo');
			break;
		case 'swf':
			header('Content-type: application/x-shockwave-flash');
			break;
		case '.au':
			header('Content-type: audio/basic');
			break;
		case 'mid':
			header('Content-type: audio/mid');
			break;
		case '.qt':
			header('Content-type: video/quicktime');
			break;
		case 'ram':
			header('Content-type: audio/x-pn-realaudio');
			break;
		case '.rm':
			header('Content-type: application/vnd.rn-realmedia');
			break;

################################################################
################################################################
#
#-----[ HAVE FUN! ALL MY USERS ]--------------------------------
#
# EoM