################################################################
## Title:		Music Online Upgrading
## Author:		Cf Manager < cf_manager@yahoo.com > (Son Thai)
## FOR Version:		2.0.4 - 2.0.5
## Support:		http://cfmanager.net.tf
##			http://cfmanager.gate2vn.net
##
## Description:		If you are using the version 2.0.4 - 2.0.5, plz read 
##			the follows to upgrade your Music Online Page.
##
## Installation Level:	Advanced
## Installation Time:	10 minutes
## Files To Edit:	8
##			music_page.php
##			music_song.php
##			music_upload.php
##			admin\music_config.php
##			language\lang_english\lang_main_music.php
##			templates\subSilver\music_page_body.tpl
##			templates\subSilver\music_upload_body.tpl
##			templates\subSilver\admin\music_config_body.tpl
##
## Included Files:	1
##			music_update.php (Remember del it after finished)
##
################################################################
## 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_page.php

#
#-----[ FIND ]--------------------------------------------------
#
if( empty($thissong) or !file_exists(MUSIC_UPLOAD_PATH . $song_filename) )
{
	message_die(GENERAL_ERROR, $lang['Song_not_exist']);
}

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

#
#-----[ FIND ]--------------------------------------------------
#
if ($music_config['comment'])
{
	$template->assign_block_vars('comment_switch', array());
}

#
#-----[ AFTER, ADD ]--------------------------------------------
#
//
// Media Center
//
if ( $song_filetype == 'swf' )
{
	$template->assign_block_vars('flash', array());
}
else if ( $song_filetype == 'ram' )
{
	$template->assign_block_vars('ram', array());
}
else if ( $song_filetype == '.rm' )
{
	$template->assign_block_vars('rm', array());
}
else if ( $song_filetype == '.qt' )
{
	$template->assign_block_vars('qt', array());
}
else
{
	$template->assign_block_vars('media', array());
}
// End Media Center


#
#-----[ OPEN ]--------------------------------------------------
#
music_song.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_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 = 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;

#
#-----[ 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;


#
#-----[ OPEN ]--------------------------------------------------
#
music_upload.php

#
#-----[ FIND ]--------------------------------------------------
#
		'L_ALLOWED_MP3' => $lang['MP3_allowed'],
		'L_ALLOWED_WAV' => $lang['WAV_allowed'],
		'L_ALLOWED_WMA' => $lang['WMA_allowed'],

		'S_MP3' => ($music_config['mp3_allowed'] == 1) ? $lang['Yes'] : $lang['No'],
		'S_WAV' => ($music_config['wav_allowed'] == 1) ? $lang['Yes'] : $lang['No'],
		'S_WMA' => ($music_config['wma_allowed'] == 1) ? $lang['Yes'] : $lang['No'],

#
#-----[ REPLACE BY ]--------------------------------------------
#
		// Media Center
		'L_ALLOWED_FILE' => $lang['Allowed_file'],

		'S_MP3' => ($music_config['mp3_allowed'] == 1) ? 'MP3,' : '',
		'S_WAV' => ($music_config['wav_allowed'] == 1) ? 'WAV,' : '',
		'S_WMA' => ($music_config['wma_allowed'] == 1) ? 'WMA,' : '',
		'S_WMV' => ($music_config['wmv_allowed'] == 1) ? 'WMV,' : '',
		'S_MIDI' => ($music_config['mid_allowed'] == 1) ? 'MIDI,' : '',
		'S_RAM' => ($music_config['ram_allowed'] == 1) ? 'RAM,' : '',
		'S_AU' => ($music_config['au_allowed'] == 1) ? 'AU,' : '',
		'S_MPEG' => ($music_config['mpeg_allowed'] == 1) ? 'MPEG,' : '',
		'S_AVI' => ($music_config['avi_allowed'] == 1) ? 'AVI,' : '',
		'S_SWF' => ($music_config['swf_allowed'] == 1) ? 'SWF,' : '',
		'S_QT' => ($music_config['qt_allowed'] == 1) ? 'QT,' : '',
		'S_RM' => ($music_config['rm_allowed'] == 1) ? 'RM,' : '',
		// Media Center

#
#-----[ FIND ]--------------------------------------------------
#
		case 'audio/x-ms-wma':
			if ($music_config['wma_allowed'] == 0)
			{
				message_die(GENERAL_ERROR, $lang['Not_allowed_file_type']);
			}
			$song_filetype = '.wma';
			break;

#
#-----[ AFTER, ADD ]--------------------------------------------
#
		//
		// Extra extensions
		//
		case 'video/x-ms-wmv':
			if ($music_config['wmv_allowed'] == 0)
			{
				message_die(GENERAL_ERROR, $lang['Not_allowed_file_type']);
			}
			$song_filetype = '.wmv';
			break;

		case 'video/mpeg':
			if ($music_config['mpeg_allowed'] == 0)
			{
				message_die(GENERAL_ERROR, $lang['Not_allowed_file_type']);
			}
			$song_filetype = '.mpeg';
			break;

		case 'video/avi':
		case 'video/x-msvideo':
			if ($music_config['avi_allowed'] == 0)
			{
				message_die(GENERAL_ERROR, $lang['Not_allowed_file_type']);
			}
			$song_filetype = '.avi';
			break;

		case 'application/x-shockwave-flash':
			if ($music_config['swf_allowed'] == 0)
			{
				message_die(GENERAL_ERROR, $lang['Not_allowed_file_type']);
			}
			$song_filetype = '.swf';
			break;

		case 'video/quicktime':
			if ($music_config['qt_allowed'] == 0)
			{
				message_die(GENERAL_ERROR, $lang['Not_allowed_file_type']);
			}
			$song_filetype = '.qt';
			break;

		case 'audio/x-midi':
		case 'audio/mid':
		case 'audio/midi':
			if ($music_config['mid_allowed'] == 0)
			{
				message_die(GENERAL_ERROR, $lang['Not_allowed_file_type']);
			}
			$song_filetype = '.mid';
			break;

		case 'audio/x-pn-realaudio':
			if ($music_config['ram_allowed'] == 0)
			{
				message_die(GENERAL_ERROR, $lang['Not_allowed_file_type']);
			}
			$song_filetype = '.ram';
			break;

		case 'audio/basic':
			if ($music_config['au_allowed'] == 0)
			{
				message_die(GENERAL_ERROR, $lang['Not_allowed_file_type']);
			}
			$song_filetype = '.au';
			break;

		case 'audio/vnd.rn-realmedia':
		case 'application/vnd.rn-realmedia':
		case 'video/vnd.rn-realvideo':
		case 'application/vnd':
			if ($music_config['rm_allowed'] == 0)
			{
				message_die(GENERAL_ERROR, $lang['Not_allowed_file_type']);
			}
			$song_filetype = '.rm';
			break;

		// End extra


#
#-----[ OPEN ]--------------------------------------------------
#
admin\admin_music_config.php

#
#-----[ FIND ]--------------------------------------------------
#
	'WMA_ENABLED' => ($new['wma_allowed'] == 1) ? 'checked="checked"' : '',
	'WMA_DISABLED' => ($new['wma_allowed'] == 0) ? 'checked="checked"' : '',

#
#-----[ AFTER, ADD ]--------------------------------------------
#
	// Media Center
	'WMV_ENABLED' => ($new['wmv_allowed'] == 1) ? 'checked="checked"' : '',
	'WMV_DISABLED' => ($new['wmv_allowed'] == 0) ? 'checked="checked"' : '',

	'MIDI_ENABLED' => ($new['mid_allowed'] == 1) ? 'checked="checked"' : '',
	'MIDI_DISABLED' => ($new['mid_allowed'] == 0) ? 'checked="checked"' : '',

	'RAM_ENABLED' => ($new['ram_allowed'] == 1) ? 'checked="checked"' : '',
	'RAM_DISABLED' => ($new['ram_allowed'] == 0) ? 'checked="checked"' : '',

	'AU_ENABLED' => ($new['au_allowed'] == 1) ? 'checked="checked"' : '',
	'AU_DISABLED' => ($new['au_allowed'] == 0) ? 'checked="checked"' : '',

	'MPEG_ENABLED' => ($new['mpeg_allowed'] == 1) ? 'checked="checked"' : '',
	'MPEG_DISABLED' => ($new['mpeg_allowed'] == 0) ? 'checked="checked"' : '',

	'AVI_ENABLED' => ($new['avi_allowed'] == 1) ? 'checked="checked"' : '',
	'AVI_DISABLED' => ($new['avi_allowed'] == 0) ? 'checked="checked"' : '',

	'SWF_ENABLED' => ($new['swf_allowed'] == 1) ? 'checked="checked"' : '',
	'SWF_DISABLED' => ($new['swf_allowed'] == 0) ? 'checked="checked"' : '',

	'QT_ENABLED' => ($new['qt_allowed'] == 1) ? 'checked="checked"' : '',
	'QT_DISABLED' => ($new['qt_allowed'] == 0) ? 'checked="checked"' : '',

	'RM_ENABLED' => ($new['rm_allowed'] == 1) ? 'checked="checked"' : '',
	'RM_DISABLED' => ($new['rm_allowed'] == 0) ? 'checked="checked"' : '',
	// Media Center

#
#-----[ FIND ]--------------------------------------------------
#
	'L_WMA_ALLOWED' => $lang['WMA_allowed'],

#
#-----[ AFTER, ADD ]--------------------------------------------
#
	// Media Center
	'L_WMV_ALLOWED' => $lang['WMV_allowed'],
	'L_MIDI_ALLOWED' => $lang['MIDI_allowed'],
	'L_RAM_ALLOWED' => $lang['RAM_allowed'],
	'L_AU_ALLOWED' => $lang['AU_allowed'],
	'L_MPEG_ALLOWED' => $lang['MPEG_allowed'],
	'L_AVI_ALLOWED' => $lang['AVI_allowed'],
	'L_SWF_ALLOWED' => $lang['SWF_allowed'],
	'L_QT_ALLOWED' => $lang['QT_allowed'],
	'L_RM_ALLOWED' => $lang['RM_allowed'],
	// Media Center

#
#-----[ OPEN ]--------------------------------------------------
#
language\lang_english\lang_main_music.php

#
#-----[ FIND ]--------------------------------------------------
#
$lang['MP3_allowed'] = 'Allowed to upload MP3 files';
$lang['WAV_allowed'] = 'Allowed to upload WAV files';
$lang['WMA_allowed'] = 'Allowed to upload WMA files';

#
#-----[ REPLACE BY ]--------------------------------------------
#
$lang['Allowed_file'] = 'These files are allowed';

#
#-----[ OPEN ]--------------------------------------------------
#
templates\subSilver\music_page_body.tpl

#
#-----[ FIND ]--------------------------------------------------
#
<object id="wmp" width={WIDTH} height={HEIGHT} classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" 
codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,0,0,0" 
standby="Loading Microsoft Windows Media Player components..." type="application/x-oleobject">
        <param name="FileName" value="{U_SONG}">
        <param name="ShowControls" value="1">
        <param name="ShowDisplay" value="0">
        <param name="ShowStatusBar" value="1">
        <param name="AutoSize" value="1">
        <embed type="application/x-mplayer2" 
pluginspage="http://www.microsoft.com/windows95/downloads/contents/wurecommended/s_wufeatured/mediaplayer/default.asp" 
src="{U_SONG}" name=MediaPlayer2 showcontrols=1 showdisplay=0 showstatusbar=1 autosize=1 visible=1 animationatstart=0 transparentatstart=1 loop=0 height=70 width=300> 
        </embed></object>

#
#-----[ REPLACE BY ]--------------------------------------------
#
      <!-- BEGIN media -->
<object id="wmp" width={WIDTH} height={HEIGHT} classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" 
codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,0,0,0" 
standby="Loading Microsoft Windows Media Player components..." type="application/x-oleobject">
        <param name="FileName" value="{U_SONG}">
        <param name="ShowControls" value="1">
        <param name="ShowDisplay" value="0">
        <param name="ShowStatusBar" value="1">
        <param name="AutoSize" value="1">
        <embed type="application/x-mplayer2" 
pluginspage="http://www.microsoft.com/windows95/downloads/contents/wurecommended/s_wufeatured/mediaplayer/default.asp" 
src="{U_SONG}" name=MediaPlayer2 showcontrols=1 showdisplay=0 showstatusbar=1 autosize=1 visible=1 animationatstart=0 transparentatstart=1 loop=0 height=70 width=300> 
        </embed></object>
      <!-- END media -->

      <!-- BEGIN flash -->
<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0"> 
<PARAM NAME=movie VALUE="{U_SONG}"><PARAM NAME=quality VALUE=high> <PARAM NAME=scale VALUE=noborder> <PARAM NAME=wmode VALUE=transparent> <PARAM NAME=bgcolor VALUE=#000000> 
  <EMBED src="{U_SONG}" quality=high scale=noborder wmode=transparent bgcolor=#000000 TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">
</EMBED></OBJECT>
      <!-- END flash -->

	<!-- BEGIN ram -->
<embed src="{U_SONG}" align="center" 
width="275" height="40" type="audio/x-pn-realaudio-plugin" console="cons" 
controls="ControlPanel" autostart="false"></embed>
	<!-- END ram -->

	<!-- BEGIN qt -->
    	<object id="qt" classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab" width="377" height="212">
				<param name="qtsrc" value="{U_SONG}">
				<param name="autoplay" value="true">
				<param name="loop" value="false">
				<param name="controller" value="true">
				<param name="kioskmode" value="true">
				<param name="cache" value="false">
				<embed src="templates/subSilver/images/uneedqt41.jpg" qtsrc="{U_SONG}" width="377" height="212" type="video/quicktime" pluginspage="http://www.apple.com/quicktime/download/" controller="true" loop="false" autoplay="true" kioskmode="true" cache="false">
				</embed>
		</object>
	<!-- END qt -->

#
#-----[ OPEN ]--------------------------------------------------
#
templates\subSilver\music_upload_body.tpl

#
#-----[ FIND ]--------------------------------------------------
#
  <tr>
	<td class="row1" height="28"><span class="gen">{L_ALLOWED_WMA}:</span></td>
	<td class="row2"><span class="gen"><b>{S_WMA}</b></span></td>
  </tr>
  <tr>
	<td class="row1" height="28"><span class="gen">{L_ALLOWED_MP3}:</span></td>
	<td class="row2"><span class="gen"><b>{S_MP3}</b></span></td>
  </tr>
  <tr>
	<td class="row1" height="28"><span class="gen">{L_ALLOWED_WAV}:</span></td>
	<td class="row2"><span class="gen"><b>{S_WAV}</b></span></td>
  </tr>

#
#-----[ REPLACE BY ]--------------------------------------------
#
  <tr>
	<td class="row1" height="28"><span class="gen">{L_ALLOWED_FILE}:</span></td>
	<td class="row2"><span class="gen"><b>{S_MP3} {S_WMA} {S_WMV} {S_MPEG} {S_AVI} {S_SWF} {S_AU} {S_WAV} {S_MIDI} {S_RAM} {S_QT} {S_RM}</b></span></td>
  </tr>

#
#-----[ OPEN ]--------------------------------------------------
#
templates\subSilver\admin\music_config_body.tpl

#
#-----[ FIND ]--------------------------------------------------
#
	<tr>
	  <td class="row1"><span class="genmed">{L_MP3_ALLOWED}</span></td>
	  <td class="row2"><span class="genmed"><input type="radio" {MP3_ENABLED} name="mp3_allowed" value="1" />{L_YES}&nbsp;&nbsp;<input type="radio" {MP3_DISABLED} name="mp3_allowed" value="0" />{L_NO}</span></td>
	</tr>
	<tr>
	  <td class="row1"><span class="genmed">{L_WAV_ALLOWED}</span></td>
	  <td class="row2"><span class="genmed"><input type="radio" {WAV_ENABLED} name="wav_allowed" value="1" />{L_YES}&nbsp;&nbsp;<input type="radio" {WAV_DISABLED} name="wav_allowed" value="0" />{L_NO}</span></td>
	</tr>
	<tr>
	  <td class="row1"><span class="genmed">{L_WMA_ALLOWED}</span></td>
	  <td class="row2"><span class="genmed"><input type="radio" {WMA_ENABLED} name="wma_allowed" value="1" />{L_YES}&nbsp;&nbsp;<input type="radio" {WMA_DISABLED} name="wma_allowed" value="0" />{L_NO}</span></td>
	</tr>


#
#-----[ REPLACE BY ]--------------------------------------------
#
	<tr>
	  <td class="row1"><span class="genmed">MP3</span></td>
	  <td class="row2"><span class="genmed"><input type="radio" {MP3_ENABLED} name="mp3_allowed" value="1" />{L_YES}&nbsp;&nbsp;<input type="radio" {MP3_DISABLED} name="mp3_allowed" value="0" />{L_NO}</span></td>
	</tr>
	<tr>
	  <td class="row1"><span class="genmed">WAV</span></td>
	  <td class="row2"><span class="genmed"><input type="radio" {WAV_ENABLED} name="wav_allowed" value="1" />{L_YES}&nbsp;&nbsp;<input type="radio" {WAV_DISABLED} name="wav_allowed" value="0" />{L_NO}</span></td>
	</tr>
	<tr>
	  <td class="row1"><span class="genmed">WMA</span></td>
	  <td class="row2"><span class="genmed"><input type="radio" {WMA_ENABLED} name="wma_allowed" value="1" />{L_YES}&nbsp;&nbsp;<input type="radio" {WMA_DISABLED} name="wma_allowed" value="0" />{L_NO}</span></td>
	</tr>
	<tr>
	  <td class="row1"><span class="genmed">WMV</span></td>
	  <td class="row2"><span class="genmed"><input type="radio" {WMV_ENABLED} name="wmv_allowed" value="1" />{L_YES}&nbsp;&nbsp;<input type="radio" {WMV_DISABLED} name="wmv_allowed" value="0" />{L_NO}</span></td>
	</tr>
	<tr>
	  <td class="row1"><span class="genmed">MIDI</span></td>
	  <td class="row2"><span class="genmed"><input type="radio" {MIDI_ENABLED} name="mid_allowed" value="1" />{L_YES}&nbsp;&nbsp;<input type="radio" {MIDI_DISABLED} name="mid_allowed" value="0" />{L_NO}</span></td>
	</tr>
	<tr>
	  <td class="row1"><span class="genmed">RAM</span></td>
	  <td class="row2"><span class="genmed"><input type="radio" {RAM_ENABLED} name="ram_allowed" value="1" />{L_YES}&nbsp;&nbsp;<input type="radio" {RAM_DISABLED} name="ram_allowed" value="0" />{L_NO}</span></td>
	</tr>
	<tr>
	  <td class="row1"><span class="genmed">AU</span></td>
	  <td class="row2"><span class="genmed"><input type="radio" {AU_ENABLED} name="au_allowed" value="1" />{L_YES}&nbsp;&nbsp;<input type="radio" {AU_DISABLED} name="au_allowed" value="0" />{L_NO}</span></td>
	</tr>
	<tr>
	  <td class="row1"><span class="genmed">MPEG</span></td>
	  <td class="row2"><span class="genmed"><input type="radio" {MPEG_ENABLED} name="mpeg_allowed" value="1" />{L_YES}&nbsp;&nbsp;<input type="radio" {MPEG_DISABLED} name="mpeg_allowed" value="0" />{L_NO}</span></td>
	</tr>
	<tr>
	  <td class="row1"><span class="genmed">AVI</span></td>
	  <td class="row2"><span class="genmed"><input type="radio" {AVI_ENABLED} name="avi_allowed" value="1" />{L_YES}&nbsp;&nbsp;<input type="radio" {AVI_DISABLED} name="avi_allowed" value="0" />{L_NO}</span></td>
	</tr>
	<tr>
	  <td class="row1"><span class="genmed">SWF</span></td>
	  <td class="row2"><span class="genmed"><input type="radio" {SWF_ENABLED} name="swf_allowed" value="1" />{L_YES}&nbsp;&nbsp;<input type="radio" {SWF_DISABLED} name="swf_allowed" value="0" />{L_NO}</span></td>
	</tr>
	<tr>
	  <td class="row1"><span class="genmed">QT</span></td>
	  <td class="row2"><span class="genmed"><input type="radio" {QT_ENABLED} name="qt_allowed" value="1" />{L_YES}&nbsp;&nbsp;<input type="radio" {QT_DISABLED} name="qt_allowed" value="0" />{L_NO}</span></td>
	</tr>
	<tr>
	  <td class="row1"><span class="genmed">RM</span></td>
	  <td class="row2"><span class="genmed"><input type="radio" {RM_ENABLED} name="rm_allowed" value="1" />{L_YES}&nbsp;&nbsp;<input type="radio" {RM_DISABLED} name="rm_allowed" value="0" />{L_NO}</span></td>
	</tr>


#
#-----[ SQL ]---------------------------------------------------
#
# Upload update\music_update.php to your phpBB root directory then run it by 
# typing on the browser. After that, delete it.
################################################################
################################################################
#
#-----[ HAVE FUN! ALL MY USERS ]--------------------------------
#
# EoM