[mode: ".$cmd."] [dest: ".getenv("REMOTE_ADDR")."] [user: ".$u."] ".$string."\r\n");
fclose($fpdebug);
}
}
/* For those with Register Globals off in the latest PHP versions */
/******************************************************************/
if (isset($_REQUEST)) { // do we have a $_REQUEST array?
while(list($varname, $varvalue) = each($_REQUEST)) { $$varname = $varvalue; } // We do, so lets take all the values in the array and match them up to the associative couter part.
}
if (isset($_SERVER)) { // do we have a $_SERVER array?
while (list($varname, $varvalue) = each($_ENV)) { $$varname = $varvalue; } // We do, so we also might have environmental so let's convert that to vars as well.
while (list($varname, $varvalue) = each($_SERVER)) { $$varname = $varvalue; } // Same as above except for $_SERVER
}
/* Authenticate the user */
/*************************/
$authpoint = "";
if (eregi("yes", $private_server))
{
$u = $_SERVER['PHP_AUTH_USER'];
$p = $_SERVER['PHP_AUTH_PW'];
include("authlist.php");
$ar_user = array_search($u, $authuser);
if ($authpass[$ar_user] != $p || $ar_user === FALSE)
{
header("HTTP/1.0 401 Authorization Required");
header("Status: 401 Authorization Required");
header('WWW-Authenticate: Basic realm="Mp3 Toolbox/v'.VERSION.'", stale=FALSE');
die("Authorization Required");
}
//else
//{
// //$authpoint = "&u=".$u."&p=".$p;
//}
}
/* If it's a shoutcast server that just hit us, throw the Radio Style stream at it */
/***********************************************************************************/
if (eregi("SHOUTcast|Winamp|Nanocaster", getenv("HTTP_USER_AGENT")) && !$cmd) // Does the User-Agent Request Header have SHOUTcast in it?
{
$cmd = 'radio'; // If so it must be shoutcast, and shoutcast can only accept an MP3 stream.
}
/* Template parsing function. */
/******************************/
function parse_skin($skin_component)
{
global $skin_file, $skin_data, $lang;
//if (sizeof($file_dump) == 0)
//{
include($skin_file);
// $file_dump = $skin;
//}
//else
//{
// $skin = $file_dump;
//}
switch($skin_component)
{
case "SKIN_TOP":
$component = $skin['top'];
break;
case "SKIN_CATEGORY":
$component = $skin['category'];
break;
case "SKIN_FOLDER":
$component = $skin['folder'];
break;
case "SKIN_FILE":
$component = $skin['file'];
break;
case "SKIN_BOTTOM":
$component = $skin['bottom'];
break;
case "SKIN_LANG_DIRECTORY":
$component = $skin['dir_play'];
break;
case "SKIN_LANG_ALL":
$component = $skin['all_play'];
break;
case "SKIN_LANG_RADIO":
$component = $skin['radio_play'];
break;
}
return $component;
}
/* Replacement function for ucwords which doesn't quite do an adequate job */
/* of making common mp3 names pretty, props to the user contributed notes at */
/* php.net */
/***********************************************************************************/
function ucase_words($txt)
{
$i = 0;
$txt = strtolower($txt);
while ($i < strlen($txt))
{
if (ord(substr($txt, $i, 1)) > 96 && ord(substr($txt, $i, 1)) < 123) // any lower case letter
{
if ($i == 0) //first letter should be upper case
{
$newtxt .= strtoupper(substr($txt, $i, 1));
}
else //check for preceding letter or number, so things like 3rd wont be 3Rd
{
if ((ord(substr($txt, $i - 1, 1)) > 96 && ord(substr($txt, $i - 1 , 1)) < 123) || (ord(substr($txt, $i - 1, 1)) > 47 && ord(substr($txt, $i - 1, 1)) < 58) || ord(substr($txt, $i - 1, 1)) == 44 || ord(substr($txt, $i - 1, 1)) == 39 || ord(substr($txt, $i - 1, 1)) == 96)
{
$newtxt .= substr($txt, $i, 1);
}
else
{
$newtxt .= strtoupper(substr($txt, $i, 1));
}
}
}
else
{
$newtxt .= substr($txt, $i, 1);
}
$i++;
}
return($newtxt);
}
/* this guy is for the Super_Shuffle Function, move along */
/**********************************************************/
function reverse_splice(&$splice, $i1, $i2)
{
if ($i1>$i2)
{
$swp = $i1;
$i1 = $i2;
$i2 = $swp;
}
for($k=$i2;$k>=$i1;$k--) // P433R 4 100P5
{
$tmpArr[] = $splice[$k];
}
for($k=0;$k<@count($tmpArr);$k++) // P433R 4 100P5
{
$splice[$i1+$k] = $tmpArr[$k];
}
}
/* super array shuffle, because we are too good to use PHP's array_shuffle function ;P */
function Super_Shuffle(&$arr)
{
// Reverse a splice in an array (used by Super_Shuffle()
$i = @count($arr);
while($i>0)
{
--$i;
$j = @mt_rand(0, $i);
if($i!=$j)
{
@reverse_splice($arr, $i, $j);
}
}
}
/* Sourting for future stuff, static at this point, move along */
function oursort($a, $b)
{
$a = substr(strrchr($a, "/"), 1);
$b = substr(strrchr($b, "/"), 1);
if ($a == $b) return 0;
return ($a < $b) ? -1 : 1;
}
/* The magic behind Getting files from directories */
function GetDirArray($dirname, $recursive = FALSE, $sub_dir = "")
{
$result_array = array(); // Reinitiallize array for cleanliness
$handle = @opendir($dirname); // Open handled to directory to be indexed
while (false !== ($file = @readdir($handle))) // As long as files are coming in we do this
{
if($file == '.'||$file == '..') // Do not want to index system directories for current and parent for security
{
continue;
}
if(@is_dir($dirname.'/'.$file) && $recursive) // If it's a directory we need to ignore it or treat it differently depending on the $recursive setting
{
$list = @GetDirArray($dirname.'/'.$file, $recursive, $sub_dir.'/'.$file); //If we are set to recursive we need to get this new directory into our main directories list of files and so on and so on and so on until there are no more arrays
$i = 0;
while($list[$i])
{
$result_array[] = $list[$i]; // Copying files returned from our sub directory to main directory
$i++;
}
}
else // It's just a plain ole file/directory (not recursive) so copy it to the array
{
$result_array[] = $sub_dir."/".$file;
}
}
@closedir($handle); // Close handle to our directory
@usort($result_array, "oursort"); // Sort our array using the sort method described in oursort()
return $result_array; // Return our array of sorted files
}
/* usleep in PHP wasn't supported in windows, so here is our own works in nix and windows,
useful for controlling data output for SHOUTcast server, not useful for players */
function win_usleep($usec)
{
$start = @gettimeofday(); // Get time of day in microseconds, whoa now that's precise
do
{
$stop = @gettimeofday();
$timePassed = 1000000 * ($stop['sec'] - $start['sec']) // As long as we haven't elapsted $usec, we follow while loop. Loops are fun but CPU intensive
+ $stop['usec'] - $start['usec'];
}
while ($timePassed < $usec);
}
/* the magic behind getting MP3 file bitrate, frequency etc data right from the mp3 frame header */
function readframe($file)
{
global $lang;
while (!$tag_data['bitrate'])
{
global $debug; // bring $debug into function scope
$tag_data['debug'] = "";
if (!($f = @fopen($file, 'rb'))) // Attempt to open MP3 file in question
{
if ($debug)
$tag_data['debug'] .= "FAILED OPENING A FILE!!\r\n";
return false;
}
fseek($f, $notfound);
$filesize = filesize($file); // Get size of MP3 file, duh
do
{
while (@fread($f,1) != Chr(255)) // We search for MPEG frame header
{ // Find the first frame
if (@feof($f))
{
$tag_data['debug'] .= "No mpeg frame found\r\n";
exit;
}
}
$header_loc = @ftell($f);
if ($debug)
$tag_data['debug'] .= "Mpeg frame found at: ".$header_loc." for ".$file."
\r\n";
@fseek($f, @ftell($f) - 1); // back up one byte
$frameoffset = @ftell($f);
$r = @fread($f, 4);
$bits = bin2hex($r);
$bits = @base_convert($bits,16,2);
} while (($bits[8] != "1" || $bits[9] != "1" || $bits[10] != "1") || ($bits == "11111111111111111111111111111111")); // 1st 8 bits true from the while
//echo $bits;
$notfound = ftell($f);
if ($debug)
$tag_data['debug'] .= "Bits: ".$bits."\r\n";
$tag_data['header_loc'] = $header_loc;
/* Now we determine if there is an ID3v1 or ID3v1.1 tag at the end of the mp3, if we */
/* do we read it and add it to our $tag_data array so the rest of the script can use it */
/****************************************************************************************/
if (fseek($f, -128, SEEK_END) != -1)
{
$rawtag = fread($f, 128);
if ($rawtag[125] == Chr(0) and $rawtag[126] != Chr(0))
{
// ID3 v1.1
$format = 'a3idtag/a30idtitle/a30idartist/a30idalbum/a4idyear/a28idcomment/x1/C1idtrack/C1idgenrenum';
}
else
{
// ID3 v1
$format = 'a3idtag/a30idtitle/a30idartist/a30idalbum/a4idyear/a30idcomment/C1idgenrenum';
}
$id3tag = unpack($format, $rawtag);
if ($id3tag['idtag'] == 'TAG')
{
$genre_array = array(
0 => 'Blues',
1 => 'Classic Rock',
2 => 'Country',
3 => 'Dance',
4 => 'Disco',
5 => 'Funk',
6 => 'Grunge',
7 => 'Hip-Hop',
8 => 'Jazz',
9 => 'Metal',
10 => 'New Age',
11 => 'Oldies',
12 => 'Other',
13 => 'Pop',
14 => 'R&B',
15 => 'Rap',
16 => 'Reggae',
17 => 'Rock',
18 => 'Techno',
19 => 'Industrial',
20 => 'Alternative',
21 => 'Ska',
22 => 'Death Metal',
23 => 'Pranks',
24 => 'Soundtrack',
25 => 'Euro-Techno',
26 => 'Ambient',
27 => 'Trip-Hop',
28 => 'Vocal',
29 => 'Jazz+Funk',
30 => 'Fusion',
31 => 'Trance',
32 => 'Classical',
33 => 'Instrumental',
34 => 'Acid',
35 => 'House',
36 => 'Game',
37 => 'Sound Clip',
38 => 'Gospel',
39 => 'Noise',
40 => 'Alternative Rock',
41 => 'Bass',
42 => 'Soul',
43 => 'Punk',
44 => 'Space',
45 => 'Meditative',
46 => 'Instrumental Pop',
47 => 'Instrumental Rock',
48 => 'Ethnic',
49 => 'Gothic',
50 => 'Darkwave',
51 => 'Techno-Industrial',
52 => 'Electronic',
53 => 'Pop-Folk',
54 => 'Eurodance',
55 => 'Dream',
56 => 'Southern Rock',
57 => 'Comedy',
58 => 'Cult',
59 => 'Gangsta',
60 => 'Top 40',
61 => 'Christian Rap',
62 => 'Pop/Funk',
63 => 'Jungle',
64 => 'Native US',
65 => 'Cabaret',
66 => 'New Wave',
67 => 'Psychadelic',
68 => 'Rave',
69 => 'Showtunes',
70 => 'Trailer',
71 => 'Lo-Fi',
72 => 'Tribal',
73 => 'Acid Punk',
74 => 'Acid Jazz',
75 => 'Polka',
76 => 'Retro',
77 => 'Musical',
78 => 'Rock & Roll',
79 => 'Hard Rock',
80 => 'Folk',
81 => 'Folk-Rock',
82 => 'National Folk',
83 => 'Swing',
84 => 'Fast Fusion',
85 => 'Bebob',
86 => 'Latin',
87 => 'Revival',
88 => 'Celtic',
89 => 'Bluegrass',
90 => 'Avantgarde',
91 => 'Gothic Rock',
92 => 'Progressive Rock',
93 => 'Psychedelic Rock',
94 => 'Symphonic Rock',
95 => 'Slow Rock',
96 => 'Big Band',
97 => 'Chorus',
98 => 'Easy Listening',
99 => 'Acoustic',
100 => 'Humour',
101 => 'Speech',
102 => 'Chanson',
103 => 'Opera',
104 => 'Chamber Music',
105 => 'Sonata',
106 => 'Symphony',
107 => 'Booty Bass',
108 => 'Primus',
109 => 'Porn Groove',
110 => 'Satire',
111 => 'Slow Jam',
112 => 'Club',
113 => 'Tango',
114 => 'Samba',
115 => 'Folklore',
116 => 'Ballad',
117 => 'Power Ballad',
118 => 'Rhytmic Soul',
119 => 'Freestyle',
120 => 'Duet',
121 => 'Punk Rock',
122 => 'Drum Solo',
123 => 'Acapella',
124 => 'Euro-House',
125 => 'Dance Hall',
126 => 'Goa',
127 => 'Drum & Bass',
128 => 'Club-House',
129 => 'Hardcore',
130 => 'Terror',
131 => 'Indie',
132 => 'BritPop',
133 => 'Negerpunk',
134 => 'Polsk Punk',
135 => 'Beat',
136 => 'Christian Gangsta Rap',
137 => 'Heavy Metal',
138 => 'Black Metal',
139 => 'Crossover',
140 => 'Contemporary Christian',
141 => 'Christian Rock',
142 => 'Merengue',
143 => 'Salsa',
144 => 'Trash Metal',
145 => 'Anime',
146 => 'Jpop',
147 => 'Synthpop'
);
$id3tag['idtitle'] = trim($id3tag['idtitle']);
$id3tag['idartist'] = trim($id3tag['idartist']);
$id3tag['idalbum'] = trim($id3tag['idalbum']);
$id3tag['idyear'] = trim($id3tag['idyear']);
$id3tag['idcomment'] = trim($id3tag['idcomment']);
$id3tag['idgenre'] = $genre_array[$id3tag['idgenrenum']];
parse_skin("LANG");
if ($id3tag['idtitle'] == "")
{
$id3tag['idtitle'] = $lang['unknown_title'];
}
if ($id3tag['idartist'] == "")
{
$id3tag['idartist'] = $lang['unknown_artist'];
}
if ($id3tag['idalbum'] == "")
{
$id3tag['idalbum'] = $lang['unknown_album'];
}
}
else
{
}
$tag_data = array_merge($tag_data, $id3tag);
}
@fclose($f); // We have all we need so let's close the mp3 file
/* the rest of this code pretty much follow header decoding standards */
/**********************************************************************/
if ($bits[11] == 0) {
$mpeg_ver = "2.5";
$bitrates = array(
'1' => array(0, 32, 48, 56, 64, 80, 96, 112, 128, 144, 160, 176, 192, 224, 256, 0),
'2' => array(0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160, 0),
'3' => array(0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160, 0),
);
} else if ($bits[12] == 0) {
$mpeg_ver = "2";
$bitrates = array(
'1' => array(0, 32, 48, 56, 64, 80, 96, 112, 128, 144, 160, 176, 192, 224, 256, 0),
'2' => array(0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160, 0),
'3' => array(0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160, 0),
);
} else {
$mpeg_ver = "1";
$bitrates = array(
'1' => array(0, 32, 64, 96, 128, 160, 192, 224, 256, 288, 320, 352, 384, 416, 448, 0),
'2' => array(0, 32, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384, 0),
'3' => array(0, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 0),
);
}
if ($debug)
$tag_data['debug'] .= "MPEGver: ".$mpeg_ver."\r\n";
$layer = array(
array(0,3),
array(2,1),
);
$layer = $layer[$bits[13]][$bits[14]];
if ($debug)
$tag_data['debug'] .= "Layer: ".$layer."\r\n";
if ($bits[15] == 0) {
// It's backwards, if the bit is not set then it is protected.
if ($debug)
$tag_data['debug'] .= "CRC Protected\r\n";
$crc = true;
}
$bitrate = 0;
if ($bits[16] == 1) $bitrate += 8;
if ($bits[17] == 1) $bitrate += 4;
if ($bits[18] == 1) $bitrate += 2;
if ($bits[19] == 1) $bitrate += 1;
$bitrate = $bitrates[$layer][$bitrate];
if ($debug)
$tag_data['debug'] .= "Bitrate: ".$bitrate."\r\n";
$frequency = array(
'1' => array(
'0' => array(44100, 48000),
'1' => array(32000, 0),
),
'2' => array(
'0' => array(22050, 24000),
'1' => array(16000, 0),
),
'2.5' => array(
'0' => array(11025, 12000),
'1' => array(8000, 0),
),
);
$frequency = $frequency[$mpeg_ver][$bits[20]][$bits[21]];
if ($debug)
$tag_data['debug'] .= "Frequency: ".$frequency."\r\n";
$padding = $bits[22];
$private = $bits[23];
$mode = array(
array('Stereo', 'Joint Stereo'),
array('Dual Channel', 'Mono'),
);
$mode = $mode[$bits[24]][$bits[25]];
// XXX: I dunno what the mode extension is for bits 26,27
$copyright = $bits[28];
$original = $bits[29];
$emphasis = array(
array('none', '50/15ms'),
array('', 'CCITT j.17'),
);
$emphasis = $emphasis[$bits[30]][$bits[31]];
if ($bitrate == 0) {
$s = -1;
} else {
$s = ((8*@filesize($file))/1000) / $bitrate;
}
//$length = @sprintf('%02d:%02d',@floor($s/60),@floor($s-(@floor($s/60)*60)));
$length = @floor($s);
$lengths = (int)$s;
if ($debug)
$tag_data['debug'] .= "Length: ".$length."\r\n";
//print "$length\n$frequency\n$bitrate\n$mode";
$tag_data['bitrate'] = $bitrate;
$tag_data['frequency'] = $frequency;
$tag_data['length'] = $length;
$tag_data['channel'] = $mode;
}
return $tag_data; // Yawn....
}
function format_title($tag)
{
global $title_format;
return str_replace("%2", $tag['idtitle'], str_replace("%1", $tag['idartist'], str_replace("%3", $tag['idalbum'], str_replace("%4", $tag['idyear'], str_replace("%5", $tag['idcomment'], str_replace("%6", $tag['idgenre'], str_replace("%7", $tag['idtrack'], $title_format)))))));
}
/* Searching in multi-dimensional array is a pain, so this little tid bit of code is useful */
function in_multi_array($needle, $haystack)
{
$in_multi_array = false;
if(in_array($needle, $haystack)) // Use regular in_array on array first
{
$in_multi_array = true;
}
else // Not in first dimenstion let's look further into the array.
{
while (list($tmpkey,$tmpval) = each ($haystack)) //here is the change
{
if(is_array($haystack[$tmpkey]))
{
if (in_multi_array($needle, $haystack[$tmpkey]))
{
$in_multi_array = true;
break;
}
}
}
}
return $in_multi_array; // Return TRUE or FALSE depending on whether we found our needle
}
/* meat and guts and glory */
switch($cmd) // $cmd is passed in from user.
{
case "listen": // They want to listen to something, throw them the PLS file
header("Content-Type: audio/x-scpls"); // PLS proper header for browser's who actually care enough to use it.
header("Content-Disposition: filename=listen.pls"); // Ensure filename and compatibility by telling the browser that this is not a PHP file but a PLS file, whether the browser cares or not depends on them I guess
if ($s) // Do they want to listen to Radio Style?
{
$file_stream = 'http://'.$HTTP_SERVER_VARS["HTTP_HOST"].''.$PHP_SELF.'?cmd=radio'.$authpoint;
}
else // no, they want to listen to a single MP3.
{
$file_stream = 'http://'.$HTTP_SERVER_VARS["HTTP_HOST"].''.$PHP_SELF.'?cmd=stream&mp3='.rawurlencode(stripslashes($mp3)).'&dir_id='.$dir_id.$authpoint;
}
/* thow out a formatted PLS playlist file. */
echo '[Playlist]
File1='.$file_stream.'
Title1='.eregi_replace(".*/|\.mp3$", "", $songlist[$j]).'
Length1=-1
Numberofentries=1
Version=2';
break; // We are done, leave
case "listenall": // They want to listen to everything, those greedy bastards, throw them a PLS file with everything in it.
@set_time_limit(0); // Becuase this process can be time consuming on 4 billion mp3's let's tell PHP to wait up forever. Does not work in SAFE MODE
if (ini_get("max_execution_time") != "0")
{
debug_file("WARNING: PHP function set_time_limit() has been blocked. Max script execution time is set to ".ini_get("max_execution_time")."sec this may cause streaming/downloading to function improperly.");
}
header("Content-Type: audio/x-scpls"); // PLS MIME Type, yummy
header("Content-Disposition: filename=listenall.pls"); //for caring browsers
if (ini_get("output_buffering") != 0)
{
debug_file("WARNING: Ouput Buffering is enabled (".ini_get("output_buffering")."), this could cause extremely long wait times for files and problems with the radio service. Output Buffering has been disabled using ob_end_flush()");
@ob_end_flush();
}
/* Spit out the ole PLS format now, hopefully the browser is ready for it */
echo '[playlist]
';
if ($recurse_dir && $rec_subdir && !eregi("\.", $rec_subdir))
{
$i = $dir_id;
}
else
{
$i = 0;
}
$j = 0;
$lc = 1;
while($source_dir[$i]) // Is there a setting for this point in the arry?
{
$j = 0;
if ($recurse_dir && $rec_subdir && !eregi("\.", $rec_subdir))
{
$sub_dir = stripslashes($rec_subdir);
}
else
{
$sub_dir = "";
}
if (@dir($source_dir[$i].$sub_dir)) // There is, is this a real directory?
{
if ($category[$i]) // Check, Let's what category we are in, this is a dummy and the player should pass over it
{
echo 'File'.$lc.'=\\'.$category[$i].$sub_dir.'.mp3
Title'.$lc.'='.$category[$i].$sub_dir.'
Length'.$lc.'=-1
';
$lc++;
}
if ($od == "yes")
{
$tmp_recurse_dir = false;
}
else
{
$tmp_recurse_dir = $recurse_dir;
}
$songlist = GetDirArray($source_dir[$i].$sub_dir, $tmp_recurse_dir); // Get list of Mp3's in this directory
while($songlist[$j]) // If we got a list of mp3's let's use them.
{
if (eregi("\.mp3$", $songlist[$j])) // Does the file claim to be an mp3 file?
{
$tag = readframe($source_dir[$i].$sub_dir.$songlist[$j]); // Read the Mp3's Frame headers
if (filemtime($source_dir[$i].$sub_dir.$songlist[$j]) > time() - 5) // make sure the file isn't being currently worked on by the system or user, if it is ignore it.
{
$j++;
continue;
} // If not thow it in the PLS list.
if ($tag['idtag'] == 'TAG')
{
$sent_title = $sent_title = format_title($tag);
}
else if ($pretty_titles)
{
$sent_title = ucase_words(strtolower(eregi_replace(".*/|\.mp3$", "", $songlist[$j])));
}
else
{
$sent_title = eregi_replace(".*/|\.mp3$", "", $songlist[$j]);
}
echo 'File'.$lc.'=http://'.$HTTP_SERVER_VARS["HTTP_HOST"].''.$PHP_SELF.'?cmd=stream&mp3='.rawurlencode($sub_dir.$songlist[$j]).'&dir_id='.$i.$authpoint.'
Title'.$lc.'='.$sent_title.'
Length'.$lc.'='.$tag['length'].'
';
$lc++;
}
$j++;
}
}
else
{ // If not a directory or cannot find the directory, throw error to player.
echo 'File'.$lc.'=\\'.$category[$i].' Does not Exist.mp3
Title'.$lc.'='.$category[$i].' Does not Exist
Length'.$lc.'=-1
';
}
if ($recurse_dir && $rec_subdir && !eregi("\.", $rec_subdir))
{
$i++;
break;
}
else
{
$i++;
}
}
echo 'Numberofentries='.--$lc.'
Version=2';
break; // We are done with this command, leave
case "stream": // They want an MP3 to listen to not download
if (eregi($agent_block, getenv("HTTP_USER_AGENT")) && eregi("\.\./", stripslashes($mp3)))
{
header('Location: http://'.$HTTP_SERVER_VARS["HTTP_HOST"].$PHP_SELF.$authpoint);
exit; // Make sure that the header doesn't match our banned user-agents to attempt to curtail downloading when we don't want it.
}
$start_time = time();
ignore_user_abort(true); //this way, the user can stop the output, but not the script.
debug_file("Single Stream Started by ".getenv("REMOTE_ADDR"));
/* Debug Notify point on PHP configuration */
if (ini_get("safe_mode") != 0)
{
debug_file("WARNING: Safemode is enabled (".ini_get("safe_mode").")in php, streaming may not functions properly, or may be cut off by execution time limits.");
}
if ($recurse_dir != true)
{
$mp3 = strrchr($mp3, '/');
}
$tag = readframe($source_dir[$dir_id].''.stripslashes($mp3));
$fp = @fopen($source_dir[$dir_id].''.stripslashes($mp3), "rb"); // Open MP3 for streaming
if (!$fp)
{
@header("Status: 404 Resource Not Found");
@header("HTTP/1.1 404 Resource Not Found");
echo "Resource Not Found";
exit;
}
$offset = @eregi_replace("bytes=(.*)-", '\1', $HTTP_RANGE); // Determing if the player wants to start at any particular location in the file
@fseek($fp, $offset); // If so offset the file to that point
@header("icy-notice1:If you are not sure why you're here click here"); // If they are looking at this in a browser then let's at least help them to the right place
@header("icy-notice2:Mp3 ToolBox/v".VERSION."
"); // Issue our server information for the player
if ($tag['idtag'] == 'TAG')
{
$sent_title = $sent_title = format_title($tag);
}
else if ($pretty_titles) // Do we pretty up the title or leave it the same case as the filename
{
$sent_title = @ucase_words(@strtolower(@eregi_replace(".*/|\.mp3", "", stripslashes($mp3))));
}
else
{
$sent_title = @eregi_replace(".*/|\.mp3", "", stripslashes($mp3));
}
@header("icy-name:".$sent_title); // Send the title of the MP3 so they aren't looking at a url
@header("Content-Length:".@filesize($source_dir[$dir_id].''.stripslashes($mp3))); // Dispatch the size of the mp3 to the player so players like winamp can have a progress bar
@header("Content-Type: audio/mpeg"); // Let the world know that the MIME type is of an MP3
if (ini_get("output_buffering") != 0)
{
debug_file("WARNING: Ouput Buffering is enabled (".ini_get("output_buffering")."), this could cause extremely long wait times for files and problems with the radio service. Output Buffering has been disabled using ob_end_flush()");
@ob_end_flush();
}
@set_time_limit(0); // Seeing as this could take some time let's set time limit to infinate.
if (ini_get("max_execution_time") != "0")
{
debug_file("WARNING: PHP function set_time_limit() has been blocked. Max script execution time is set to ".ini_get("max_execution_time")."sec this may cause streaming/downloading to function improperly.");
}
while($data = @fread($fp, $MetaInterval)) // Dispatch MP3 data loop
{
//if ($demenish == "Yes")
//{
// echo pack("h", "00");
// substr($data, 0, 1);
//}
if (connection_aborted() == 1)
{
debug_file("CONNECT-KILL: (".connection_aborted().") Connection has been terminated by the client {".(time()-$start_time)."secs}");
exit;
}
else if (connection_aborted() > 1)
{
debug_file("CONNECT-KILL: (".connection_aborted().") The script has timed out. {".(time()-$start_time)."secs}");
exit;
}
echo $data;
//echo @bin2hex($data)."\r\n";
}
@fclose($fp); // We must be done uploading the MP3 to them, let's close the file
debug_file("CONNECT-KILL: The connection has been terminated normally {".(time()-$start_time)."secs}");
break; // We are done with this command, leave now
case "download": // They want to download the MP3, if we allow it, it will happen here
if (eregi("yes", $downloadable) && !eregi("\.\./", stripslashes($mp3)))
{
ignore_user_abort(true); //this way, the user can stop the output, but not the script.
debug_file("Download Started by".getenv("REMOTE_ADDR"));
/* Debug Notify point on PHP configuration */
if (ini_get("safe_mode") != 0)
{
debug_file("WARNING: Safemode is enabled (".ini_get("safe_mode").")in php, streaming may not functions properly, or may be cut off by execution time limits.");
}
if ($recurse_dir != true)
{
$mp3 = strrchr($mp3, '/');
}
$fp = @fopen($source_dir[$dir_id].''.$mp3, "rb"); // Open Mp3 for Dispatch to user
if (!$fp)
{
@header("Status: 404 Resource Not Found");
@header("HTTP/1.1 404 Resource Not Found");
echo "Resource Not Found";
exit;
}
header("Content-Type: audio/mpeg"); // Tell the browser that it's an MP3
header("Content-Disposition: attachment; filename=".eregi_replace(".*/|\.mp3$", "", stripslashes($mp3)).".mp3"); //Tell the brower to prompt for Download and Saving of MP3
header("Content-Length: ".filesize($source_dir[$dir_id].''.stripslashes($mp3))); //Let the Browser know how large the file is so that the user can see how much longer they have to wait to get all of the file
if (ini_get("output_buffering") != 0)
{
debug_file("WARNING: Ouput Buffering is enabled (".ini_get("output_buffering")."), this could cause extremely long wait times for files and problems with the radio service. Output Buffering has been disabled using ob_end_flush()");
@ob_end_flush();
}
@set_time_limit(0); // Set time limit to infinate where possible so
if (ini_get("max_execution_time") != "0")
{
debug_file("WARNING: PHP function set_time_limit() has been blocked. Max script execution time is set to ".ini_get("max_execution_time")."sec this may cause streaming/downloading to function improperly.");
}
while($data = fread($fp, $MetaInterval)) // Dispatch loop
{
if (connection_aborted() != 0)
{
debug_file("CONNECT-KILL: (".connection_aborted().") Connection has been terminated by client");
exit;
}
echo $data;
}
fclose($fp); // We are done sending the data so let's close the file
debug_file("CONNECT-KILL: Connection has been terminated normally");
}
else
{
debug_file("CONNECT-KILL: Download Attempted by an unauthorized client (".getenv("HTTP_USER_AGENT").")");
echo "Downloading has been denied"; // We don't want them to download so let's just inform them of this
}
break; // We are done with this command, let's take a nap
case "radio": // They want to feel all warm and fuzzy and get all the MP3's in a radio like fasion.
if (eregi($agent_block, getenv("HTTP_USER_AGENT"))) // Must pass User-Agent test
{
header('Location: http://'.$HTTP_SERVER_VARS["HTTP_HOST"].''.$PHP_SELF);
exit;
}
$start_time = time();
ignore_user_abort(true); //this way, the user can stop the output, but not the script.
debug_file("Stream Started by ".getenv("REMOTE_ADDR"));
if (ini_get("safe_mode") != 0)
{
debug_file("WARNING: Safemode is enabled (".ini_get("safe_mode").")in php, streaming may not functions properly, or may be cut off by execution time limits.");
}
if (eregi("shoutcast|Nanocaster", getenv("HTTP_USER_AGENT")) && $AllowRelay == false)
{
header("HTTP/1.0 401 Relaying Not Allowed");
header("Status: 401 Relaying Not Allowed");
echo "This resource has denied you because of who you are.";
exit;
}
$blah = false;
$intro_status = 0;
$connect_time = time();
if ($stream_mode != "") // Stream mode filter
{
if (eregi("stereo", $stream_mode))
{
$stream_channel = "stereo|joint stereo|dual channel";
}
else if (eregi("mono", $stream_mode))
{
$stream_channel = "mono";
}
}
else
{
$stream_channel = "";
}
if ($stream_bitrate != "")
{
$base_bitrate = $stream_bitrate;
}
@header("X-Powered-By: Mp3ToolBox\r\nServer: Mp3 ToolBox/v".VERSION, true); // Identify ourselves
header("Content-Type: audio/mpeg"); // Let Client's know that the data being sent is MPEG
if ($HTTP_ICY_METADATA == 1) // Determine if the client want's title meta-data
{
$meta = true;
}
if (@eregi("RMA", getenv("HTTP_USER_AGENT"))) // Determine if the player is Real
{
print("ICY 200 OK\r\n");
print("icy-notice1:If you are not sure why you're here click here\r\n");
print("icy-notice2:Mp3 ToolBox/v".VERSION."
\r\n");
print("icy-name:".$station_name."\r\n");
print("icy-genre:".$genre."\r\n");
print("icy-pub:".$publicize."\r\n");
print("icy-br:".$base_bitrate."\r\n");
print("icy-url:".$url."\r\n");
if ($meta) // If the player wants title data let's tell them how often we are going to send it
{
print("icy-metaint:$MetaInterval\r\n\r\n");
}
}
else // all other clients get the headers the right way
{
//header("ICY 200 OK");
header("icy-notice1:If you are not sure why you're here click here");
header("icy-notice2:Mp3 ToolBox/v".VERSION."
");
header("icy-name:".$station_name);
header("icy-genre:".$genre);
header("icy-pub:".$publicize);
header("icy-br:".$base_bitrate);
header("icy-url:".$url);
if ($meta)
{
header("icy-metaint:$MetaInterval");
}
}
@set_time_limit(0); // Seeing as Radio Style is endless let's inform PHP of this, NOTE: SAFEMODE WILL NOT ALLOW THIS FUNCTION TO ISSUE
if (ini_get("output_buffering") != 0)
{
debug_file("WARNING: Ouput Buffering is enabled (".ini_get("output_buffering")."), this could cause extremely long wait times for files and problems with the radio service. Output Buffering has been disabled using ob_end_flush()");
@ob_end_flush();
}
if (ini_get("max_execution_time") != "0")
{
debug_file("WARNING: PHP function set_time_limit() has been blocked. Max script execution time is set to ".ini_get("max_execution_time")."sec this may cause streaming/downloading to function improperly.");
}
$i = 0;
$j = 0;
$last_song = "blah";
$end_track = false;
$audio_bite = $MetaInterval;
$song_history[0]['song'] = "adfasvaeavd";
$song_history[0]['time'] = time();
debug_file("STATUS: HEADER SENT");
if ($intro_file == "") // Do we have an Intro file to send?
$intro_status = 2;
while (1 == 1) // Our Radio Style endless loop
{
if (!$$i)
$$i = Array();
if ($playlist_script == true && $playlist_scr[$i] && $recurse_dir == true) // Are we running a Playlist Script?
{
debug_file("MODE: Playlist Script Enabled");
$source_dir[$i] = $playlist_scr[$i];
}
else if (eregi("Yes", $shuffle))
{
debug_file("MODE: Playlist Script Disabled");
@Super_Shuffle($source_dir);
}
while($source_dir[$i])
{
if (connection_aborted())
{
exit;
}
if (@dir($source_dir[$i]))
{
if ($category[$i])
{
}
//exec("ls \"$source_dir[$i]\"", $songlist);
if ($$i && $playlist_script == true && $playlist_scr[$i] && $recurse_dir == true && sizeof($$i) > $playlist_pos[$i])
{
$songlist = $$i;
$j = $playlist_pos[$i];
debug_file("COPY-LIST: Copying prior unfinished list (point $j)");
}
else
{
$songlist = GetDirArray($source_dir[$i], $recurse_dir);
if (eregi("Yes", $shuffle))
{
@Super_Shuffle($songlist);
}
$$i = $songlist;
$j = $playlist_pos[$i] = 0;
debug_file("NEW-LIST: Creating new list [".$source_dir[$i]."] (optional shuffle)");
}
while($songlist[$j])
{
if (@eregi("\.mp3$", $songlist[$j]))
{
$tag = @readframe($source_dir[$i]."".$songlist[$j]);
debug_file("LOADING_FILE: ".$songlist[$j]." - br: ".$tag['bitrate']." - fq: ".$tag['frequency']." - md: ".$tag['channel']." - lg: ".$tag['length']);
//echo $source_dir[$i]."".$songlist[$j];
/*if ($playlist_script && $no_song_repeat_within > 0)
{
$safet_chk = 1;
while (in_multi_array($songlist[$j], $song_history) && $safet_chk <= sizeof($songlist))
{
$tmp = $songlist[$j];
$songlist[$j] = $songlist[sizeof($songlist)];
$songlist[sizeof($songlist)] = $tmp;
$safet_chk++;
}
if ($safet_chk > sizeof($songlist))
{
break;
}
}*/
if (connection_aborted() == 1)
{
debug_file("CONNECT-KILL: (".connection_aborted().") Connection has been terminated by the client {".(time()-$start_time)."secs}");
exit;
}
else if (connection_aborted() > 1)
{
debug_file("CONNECT-KILL: (".connection_aborted().") The script has timed out. {".(time()-$start_time)."secs}");
exit;
}
if (@filemtime($source_dir[$i].''.$songlist[$j]) > @time() - 5 || ($stream_freq != "" && $tag['frequency'] != $stream_freq) || ($stream_channel != "" && !eregi($stream_channel, $tag['channel'])) || ($stream_bitrate != "" && $tag['bitrate'] != $stream_bitrate) || in_multi_array($songlist[$j], $song_history))
{
debug_file("FILE_SKIPPED: File has failed to meet filtration standards");
$intro_status = 2;
$j++;
continue;
}
if ($intro_status == 0) // If Not Played
{
$fp = @fopen($intro_file, "rb");
$open_filesize = filesize($intro_file);
debug_file("INTROBEG: Intro File Started");
$intro_status = 1; // Playing
}
else
{
$fp = @fopen($source_dir[$i].$songlist[$j], "rb");
$open_filesize = filesize($source_dir[$i].''.$songlist[$j]);
debug_file("FOPEN: ".$source_dir[$i].$songlist[$j]);
}
if ($fp)
{
$update_meta = true;
@fseek($fp, $tag['header_loc']);
if ($no_song_repeat_within > 0 && !in_array($source_dir[$i], $noapply_repeat)&& $playlist_script && $intro_status == 2)
{
$shc = 0;
$tmp_song_history = $song_history;
$song_history[$shc]['song'] = $songlist[$j];
$song_history[$shc]['time'] = time();
$shc++;
while($tmp_song_history[$shc-1]['song'] != "" && $tmp_song_history[$shc-1]['time'] > time() - ($no_song_repeat_within*60))
{
$song_history[$shc]['song'] = $tmp_song_history[$shc-1]['song'];
$song_history[$shc]['time'] = $tmp_song_history[$shc-1]['time'];
$shc++;
}
while($song_history[$shc]['song'] != "" && $playlist_script)
{
$song_history[$shc]['song'] = "";
$song_history[$shc]['time'] = "";
$shc++;
}
//$shc = 0;
//$arraydump = fopen("array.txt", "w");
//while($song_history[$shc]['song'] != "")
//{
// fwrite($arraydump, "song_history[".$shc."]['song']".$song_history[$shc]['song']."\r\nsong_history[".$shc."]['time']".$song_history[$shc]['time']."\r\n");
// $shc++;
//}
//fclose($arraydump);
}
else
{
$shc = 0;
while($song_history[$shc]['song'] != "" && $playlist_script)
{
if ($song_history[$shc]['time'] < time() - ($no_song_repeat_within*60))
{
$song_history[$shc]['song'] = "";
$song_history[$shc]['time'] = "";
}
$shc++;
}
}
if ($blah != true && $intro_status == 2)
{
$pointer = 0;
{
$pointer = @mt_rand(1, @filesize($source_dir[$i].''.$songlist[$j])); //%@filesize($source_dir[$i].''.$songlist[$j]);
@fseek($fp, $pointer);
$last_song = @eregi_replace(".*/|\.mp3$", "", $songlist[$j]);
$song_start_point = time()-(($pointer/$open_filesize)*$tag['length']);
}
$blah = true;
}
$pre_end = false;
while(($data = @fread($fp, $audio_bite)) && $pre_end == false)
{
if (connection_aborted() == 1)
{
debug_file("CONNECT-KILL: (".connection_aborted().") Connection has been terminated by the client {".(time()-$start_time)."secs}");
exit;
}
else if (connection_aborted() > 1)
{
debug_file("CONNECT-KILL: (".connection_aborted().") The script has timed out. {".(time()-$start_time)."secs}");
exit;
}
$hex = @bin2hex($data);
//$data = @pack("H*", $hex);
$data_sent += $audio_bite*8;
if (@eregi("On", $silence_eleminator) && (ftell($fp)/$open_filesize)*100 > 95)
{
$char_count = count_chars($hex, 0);
//if (eregi("00000000000000000000000000000000000000000000000000000000000000000000000000000", $hex))
if (($char_count[060]/strlen($hex))*100 > 15)
{
$hex = substr($hex, 0, strstr($hex, "000"));
$data = @pack("H*", $hex);
$pre_end = true;
}
}
if (@strlen($data) < $MetaInterval || $end_track == true)
{
if ($end_track == false)
{
$audio_bite = $MetaInterval - @strlen($data);
$end_buf = $data;
$end_track = true;
debug_file("FUSEPOINT END ".strlen($data));
continue;
}
else
{
$audio_bite = $MetaInterval;
$data = $end_buf.$data;
$hex = @bin2hex($data);
$end_track = false;
debug_file("FUSEPOINT END ".strlen($data));
}
}
else
{
$audio_bite = $MetaInterval;
}
//debug_file("DATASENT: ".strlen($data));
echo $data;
if (@eregi("shoutcast|nanocaster", getenv("HTTP_USER_AGENT")))
{
$wait = (64/($tag['bitrate']*1.05))*1000000;
@win_usleep($wait);
}
if ($meta)
{
$song_title = @eregi_replace(".*/|\.mp3$", "", $songlist[$j]);
if ($time_mode == 'COUNTDOWN')
{
if ($song_title != $last_song)
{
$song_start_point = time();
$last_song = $song_title;
}
$song_timer = time() - $song_start_point;
if ($song_timer >= 0)
{
$time_cd_tag = " (-".@floor(($tag['length'] - $song_timer)/60).":".@str_pad((($tag['length'] - $song_timer)%60), 2, "0", STR_PAD_LEFT).")";
$update_meta = true;
}
}
if ($update_meta == true)
{
if ($time_mode == 'COUNTDOWN')
{
$time_tag = $time_cd_tag;
}
else if ($time_mode == 'TOTAL_TIME')
{
$time_tag = " (".@floor($tag['length']/60).":".@str_pad(($tag['length']%60), 2, "0", STR_PAD_LEFT).")";
}
else
{
$time_tag = '';
}
if ($debug)
{
$extra_inf = "[".$tag['bitrate']."kbps - ".$tag['frequency']."khz]";
}
if ($tag['idtag'] == 'TAG')
{
$sent_title = $sent_title = format_title($tag);
}
else if ($pretty_titles)
{
$sent_title = @ucase_words(@strtolower($song_title));
}
else
{
$sent_title = $song_title;
}
if ($intro_status != 2)
{
$sent_title = $intro_msg;
$time_tag = "";
}
$meta_data = "StreamTitle='".ereg_replace("'", "`", $sent_title)."".$time_tag."".$extra_inf."';StreamUrl='';";
$len = @strlen($meta_data);
$update_meta = false;
}
else
{
$meta_data = NULL;
$len = 0;
}
$len_topoff = 0;
while($len > $len_topoff)
{
$len_topoff += 16;
}
while ($len != $len_topoff)
{
$meta_data .= "\0";
$len = @strlen($meta_data);
}
if ($len_topoff != 0)
{
$len_topoff /= 16;
}
echo @pack("h1", @dechex($len_topoff));
echo $meta_data;
//debug_file("META-TAG POINT: SEND $meta_data");
}
if (time() - $ListenerTimer*60 > $connect_time && $ListenerTimer != 0)
{
debug_file("CONNECT-KILLED: ListenerTimer Limit exceeded");
fclose($fp);
exit;
}
}
@fclose($fp);
}
}
if (($playlist_script == true && $recurse_dir == true && $playlist_scr[$i+1] != $playlist_scr[$i]) || $intro_status != 2)
{
if ($intro_status != 2)
{
debug_file("INTROEND: Intro File Played");
$intro_status = 2; // We have played, we shall no more
$i--;
}
$j++;
$playlist_pos[$i] = $j;
break;
}
$j++;
}
}
$i++;
if ($playlist_script == true && $playlist_scr[$i] && $recurse_dir == true)
{
$source_dir[$i] = $playlist_scr[$i];
}
else
{
break;
}
}
$i = 0;
$j = 0;
}
break;
default: // They didn't tell us anything so they must no know anything, let's help and show them the index of all our mp3's
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
// always modified
header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache"); // HTTP/1.0
include("page_header.php"); // Throw out the customizable header
// echo '
//
Filename | Length | Size | Command | //'; echo parse_skin(SKIN_TOP); $blah = false; if ($recurse_dir && $rec_subdir && !eregi("\.", $rec_subdir)) { $i = $dir_id; } else { $i = 0; } //$j = 0; while($source_dir[$i]) { $j = 0; if ($recurse_dir && $rec_subdir && !eregi("\.", $rec_subdir)) { $sub_dir = stripslashes($rec_subdir); } else { $sub_dir = ""; } if (@dir($source_dir[$i].$sub_dir)) { if ($category[$i]) { $skin_data['category'] = $category[$i].$sub_dir; echo parse_skin(SKIN_CATEGORY); } $option = ""; if ($o == "size") { $option = " -S"; } //exec("ls \"$source_dir[$i].$sub_dir\"$option", $songlist); $songlist = GetDirArray($source_dir[$i].$sub_dir, false); if ($sub_dir != "") { if ($blah != true) { $skin_data['folder'] = ''.$lang['dir_parent'].''; $skin_data['cmd_open'] = ''.$lang['dir_open'].''; echo parse_skin("SKIN_FOLDER"); $blah = true; } } $cc = 0; while($songlist[$j]) { if (is_dir($source_dir[$i].$sub_dir.$songlist[$j]) && $recurse_dir) { if ($cc % 2 == 0) { $ssclass = "cellone"; } else { $ssclass = "celltwo"; } $cc++; $skin_data['fclass'] = $ssclass; $skin_data['folder'] = ''.eregi_replace(".*/", "", $songlist[$j]).''; $skin_data['cmd_open'] = ''.$lang['dir_open'].''; echo parse_skin("SKIN_FOLDER"); } $j++; } $j=0; $tot_length = 0; while($songlist[$j]) { if (eregi("\.mp3$", $songlist[$j])) { if ($cc % 2 == 0) { $ssclass = "cellone"; } else { $ssclass = "celltwo"; } $cc++; $tag = readframe($source_dir[$i].$sub_dir.$songlist[$j]); if ($tag['bitrate'] == 0) { $bitrate = "?"; } else { $bitrate = $tag['bitrate']; } $tot_length += $tag['length']; if ($tag['length'] == -1) { $time = "??:??"; } else { $time = floor($tag['length']/60).":".str_pad(($tag['length']%60), 2, "0", STR_PAD_LEFT); } if (!@in_array($songlist[$j], $filedata)) { $filedata[$j][0] = $songlist[$j]; $filedata[$j][1] = filemtime($source_dir[$i].$sub_dir.$songlist[$j]); $filedata[$j][2] = $i; } if ($filedata[$j][1] > time() - 5) { $listen_cmd = $lang['updating']; } else { $listen_cmd= ''.$lang['play'].''; if (eregi("yes", $downloadable)) { $download_cmd = ''.$lang['download'].''; } } $size = filesize($source_dir[$i].$sub_dir.$songlist[$j]); $tot_size += $size; switch ($size_mode) { case "B": $size = number_format($size); $size .= ' bytes'; break; case "KB": $size = number_format($size/1024, 2); $size .= ' KB'; break; case "MB": default: $size = number_format($size/1048576, 2); $size .= ' MB'; break; } if ($tag['idtag'] == 'TAG') { $sent_title = format_title($tag); } else if ($pretty_titles) { $sent_title = ucase_words(strtolower(eregi_replace(".*/|\.mp3$", "", $songlist[$j]))); } else { $sent_title = eregi_replace(".*/|\.mp3$", "", $songlist[$j]); } $skin_data['fclass'] = $ssclass; $skin_data['fbitrate'] = $bitrate; $skin_data['fname'] = $sent_title; $skin_data['ftime'] = $time; $skin_data['fsize'] = $size; $skin_data['cmd_fdownload'] = $download_cmd; $skin_data['cmd_flisten'] = $listen_cmd; echo parse_skin("SKIN_FILE"); } $j++; } } else { $skin_data['category'] = "Directory ".$category[$i].$sub_dir." Does Not Exist."; echo parse_skin(SKIN_CATEGORY); } if ($recurse_dir && $rec_subdir && !eregi("\.", $rec_subdir)) { $i++; break; } else { $i++; } } if ($recurse_dir == true) $skin_data['pdirectory'] = ''.$lang['dir_play'].' '; $skin_data['tot_time'] = floor($tot_length/60).":".str_pad(($tot_length%60), 2, "0", STR_PAD_LEFT); $skin_data['tot_size'] = number_format($tot_size/1048576, 2); $skin_data['pall'] = ''.$lang['all_play'].''; $skin_data['pradio'] = ''.$lang['radio_play'].''; echo parse_skin(SKIN_BOTTOM); if ($i == 0) { $skin_data['category'] = "Error Opening Directory ".$category[$i].$sub_dir; echo parse_skin(SKIN_CATEGORY); } include("page_footer.php"); // Page footer for index. } // That be all there is to it.... I know, my code sucks, but what do you expect, it just wouldn't feel like free code if it were actually readable ;) ?>
---|