|
From: OryNider <ory...@us...> - 2007-10-02 05:06:29
|
Update of /cvsroot/mxbb/mx_shotcast In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv17516 Added Files: Tag: core28x shotcast_last10.php stop_real.php stop_wmp.php Log Message: readding files... --- NEW FILE: stop_wmp.php --- <?php define( 'IN_PORTAL', 1 ); $module_root_path = './'; $phpEx = substr(strrchr(__FILE__, '.'), 1); include($module_root_path . 'shotcast_config.'.$phpEx); if (empty($song[0])) { $song[0] = $text[6]; } ?> <html><head> <STYLE type=text/css>BODY { PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px; BACKGROUND-REPEAT: repeat-x; FONT-FAMILY: Arial, Helvetica, sans-serif; BACKGROUND-COLOR: #CEDEDF; } </STYLE> </head><body> <TABLE cellSpacing=0 cellPadding=0 width=315 border=0> <TBODY> <TR> <TD vAlign=top align=left> <TABLE cellSpacing=0 cellPadding=0 width=300 border=0> <TBODY> <!-- Check Media Player Version --> <SCRIPT LANGUAGE="JavaScript"> var WMP7; var Mac; var Win; var Unix; var Linux; Win = navigator.userAgent.indexOf("Win") > -1; Mac = navigator.userAgent.indexOf("Mac") > -1; Unix = navigator.appVersion.indexOf("X11") > -1; Linux = navigator.appVersion.indexOf("Linux") > -1; if (Mac) { if ( navigator.appName == "Netscape" ){ //Netscape code document.write (' <Embed id="wmp" name="wmp" type="audio/mpeg"'); document.write (' pluginspage="http://www.microsoft.com/windows/windowsmedia/"'); document.write (' filename="http://<?=$scip;?>:<?=$scport;?>"'); document.write (' src="http://<?=$scip;?>:<?=$scport;?>"'); document.write (' Name=MediaPlayer'); document.write (' ShowControls=1'); document.write (' ShowDisplay=1'); document.write (' ShowStatusBar=1'); document.write (' AUTOSTART=1'); document.write (' width=332'); document.write (' height=354>'); document.write (' </Embed>'); } if ( navigator.appName != "Netscape" ){ document.write(' <embed id="wmp" name="wmp" type="audio/mpeg" width="332" height="354" ShowTracker="0" ShowDisplay="0" ShowGotoBar="0" ShowStatusBar="1" ShowCaptioning="0" AUTOSTART="1" src="http://<?=$scip;?>:<?=$scport;?>" ></embed>'); } } if (Win) { if ( navigator.appName != "Netscape" ){ WMP7 = new ActiveXObject('WMPlayer.OCX'); } // Windows Media Player 7 Code if ( WMP7 ) { document.write ('<OBJECT ID=MediaPlayer '); document.write (' CLASSID=CLSID:6BF52A52-394A-11D3-B153-00C04F79FAA6'); document.write (' standby="Loading Microsoft Windows Media Player components..."'); document.write (' TYPE="application/x-oleobject" width="332" height="354">'); document.write ('<PARAM NAME="url" VALUE="http://<?=$scip;?>:<?=$scport;?>">'); document.write ('<PARAM NAME="AutoStart" VALUE="false">'); document.write ('<PARAM NAME="ShowControls" VALUE="1">'); document.write ('<PARAM NAME="uiMode" VALUE="mini">'); document.write (' <Embed type="application/x-mplayer2"'); document.write (' pluginspage="http://www.microsoft.com/isapi/redir.dll?prd=windows&sbp=mediaplayer&ar=Media&sba=Plugin&"'); document.write (' filename="http://<?=$scip;?>:<?=$scport;?>"'); document.write (' src="http://<?=$scip;?>:<?=$scport;?>"'); document.write (' Name="MediaPlayer"'); document.write (' ShowControls="1"'); document.write (' ShowDisplay="1"'); document.write (' ShowStatusBar="1"'); document.write (' AUTOSTART="false"'); document.write (' width="332"'); document.write (' height="354">'); document.write (' </embed>'); document.write ('</OBJECT>'); } // Windows Media Player 6.4 Code else { //IE Code document.write ('<OBJECT ID=MediaPlayer '); document.write (' CLASSID=CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95'); document.write (' CODEBASE=http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715 '); document.write (' standby="Loading Microsoft Windows Media Player components..."'); document.write (' TYPE="application/x-oleobject" width="332" height="354">'); document.write (' <PARAM NAME="FileName" VALUE="http://<?=$scip;?>:<?=$scport;?>">'); document.write ('<PARAM NAME="url" VALUE="http://<?=$scip;?>:<?=$scport;?>"> '); document.write ('<PARAM NAME="AutoStart" VALUE="1">'); document.write ('<PARAM NAME="ShowControls" VALUE="1">'); //Firefox code document.write (' <Embed type="application/x-mplayer2"'); document.write (' pluginspage="http://www.microsoft.com/isapi/redir.dll?prd=windows&sbp=mediaplayer&ar=Media&sba=Plugin&"'); document.write (' filename="http://<?=$scip;?>:<?=$scport;?>"'); document.write (' src="http://<?=$scip;?>:<?=$scport;?>"'); document.write (' Name="MediaPlayer"'); document.write (' ShowControls="1"'); document.write (' ShowDisplay="1"'); document.write (' ShowStatusBar="1"'); document.write (' AUTOSTART="false"'); document.write (' width="332"'); document.write (' height="354">'); document.write (' </embed>'); document.write ('</OBJECT>'); } } else { document.write(' <embed type="audio/mpeg" width="332" height="354" AUTOSTART="1" filename="http://<?=$scip;?>:<?=$scport;?>" src="http://<?=$scip;?>:<?=$scport;?>" ></embed>'); } </SCRIPT> </TD></TR> </TBODY></TABLE> </body> </html> --- NEW FILE: stop_real.php --- <?php define( 'IN_PORTAL', 1 ); $module_root_path = './'; $phpEx = substr(strrchr(__FILE__, '.'), 1); include($module_root_path . 'shotcast_config.'.$phpEx); if (empty($song[0])) { $song[0] = $text[6]; } ?> <html> <head> <title>RealMedia</title> </head> <body> <p> <object id="RVOCX" classid="CLSID:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" width="320" height="172"> <param name="SRC" value="http://<?=$scip;?>:<?=$scport;?>/<?=$playlist;?>"> <param name="CONTROLS" value="ImageWindow"> <param name="CONSOLE" value="cons"> <embed autostart="true" src="http://<?=$scip;?>:<?=$scport;?>/<?=$playlist;?>" type="audio/x-pn-realaudio-plugin" width="320" height="172" controls="ImageWindow" console="cons"> </embed> <param name="autostart" value="false"> </object> </p> <p> <object id=RVOCX classid="CLSID:CFCDAA03-8BE4-11CF-B84B-0020AFBBCCFA" width="320" height="30" > <param name="SRC" value="http://<?=$scip;?>:<?=$scport;?>/<?=$playlist;?>"> <param name="CONTROLS" value="ControlPanel"> <param name="CONSOLE" value="cons"> <embed src="http://<?=$scip;?>:<?=$scport;?>/<?=$playlist;?>" type="audio/x-pn-realaudio-plugin" width="320" height="30" controls="ControlPanel" console="cons" > </embed> </object> </p> </body> </html> --- NEW FILE: shotcast_last10.php --- <?php /** * * @package mxBB Portal Module - mx_shotcast * @version $Id: shotcast_last10.php,v 1.2.2.2 2007/10/02 05:06:23 orynider Exp $ * @copyright (c) 2002-2006 [OryNider] mxBB Development Team * @license http://opensource.org/licenses/gpl-license.php GNU General Public License v2 * */ // // ERROR HANDLING // //error_reporting( E_ALL ); @ini_set( 'display_errors', '1' ); // -------------------------------------------------------------------------------- // Security check // if( !defined('IN_PORTAL') || !is_object($mx_block)) { die("Hacking attempt"); } // // Common Includes and Read Module Settings // if( !file_exists($module_root_path . 'includes/common.'.$phpEx) ) { mx_message_die(GENERAL_ERROR, "Could not find mx_shotcast includes folder.", "", __LINE__, __FILE__); } @define('_SHOTCAST_CONFIG', true); include_once($module_root_path . 'includes/common.'.$phpEx); include_once($module_root_path . 'getinfo.'.$phpEx); $bgcolor = '#ffffff'; // Page background color $tablew = '100%'; // Table width $tableh = '1'; $toprow = '#c0c0c0'; // Top background color $bottom = '#ffffff'; // Bottom background color $border = '#000000'; // Border color $thickness = '2'; // Border thickness $padding = '4'; // Cell padding $font = 'Verdana'; // Font $fontsize = '2'; // Font size $block_size = ( isset($block_size) && !empty($block_size) ? $block_size : '100%' ); $refresh = '30'; // How often should it refresh? (seconds) // Return JavaScript or HTML $jsOutput=FALSE; // TRUE=js | FALSE=HTML // try to get the target from the url... /* $host = $_REQUEST[host]; if (!$host) $host = $yourIP; $port = $_REQUEST[port]; if (!$port) $port = $yourPORT; */ $host = $shotcast_config['shotcast_host']; // IP adress or domain $port = $shotcast_config['shotcast_port']; // Port if( empty($lang['Before_that_you_heard']) && empty($lang['Now_Playing']) ) { $lang['Before_that_you_heard'] = "Before that you heard"; $lang['Now_Playing'] = "Now Playing"; $lang['Off_Air'] = "The server is <b>Off-Air</b>, try again later."; } $lf = chr(10); // 0x0A [\n] // The lastN is configurable at the DNAS with, ShowLastSongs= it defaults to 10 and has a maximum of 20 $t_max = $_REQUEST[n]; if (!t_max || $t_max<1 || $t_max>19) $t_max=10; //19 is the max here because 20=current_track+19 // Let's get /index.html first... to keep this short, there is no code to handle the dnas being down // or not running, so the script will display nothing in those cases. $connect_timeout=5; $success=0; if (@phpversion() >= '5.0.0' && ($text[1] == 1)) { $state = "Up"; } else { $state = "Down"; } if (@phpversion() < '5.0.0') { $state = "Up"; } $fp1 = @fsockopen($host, $port, &$errno, &$errstr, $connect_timeout); //open connection if (!$fp1) { //if this fails, I'm done.... $er = '<p>' . $lang['Socket_functions_disabled'] . '</p>'; @fclose($fp1); $success++; } else { $er = ''; $request="GET /index.html HTTP/1.1\r\nHost:" . $host . ":" . $port . "\r\nUser-Agent: SHOUTcast DNAS Status [index] * (Mozilla/PHP)\r\nConnection: close\r\n\r\n"; //get index.html @fputs($fp1,$request,strlen($request)); $page=''; while(!feof($fp1)) { $page .= fread($fp1, 16384); } @fclose($fp1); // now I have the entire /index.html in $page -- all I want from here is the current track... // (hint-hint) $song00 = ereg_replace("</b></td>.*", "", ereg_replace(".*Current Song: </font></td><td><font class=default><b>", "", $page)); // easy, right <img src="images/smilies/smile.gif" border="0" alt=""> // now let's get /played.html... (this is kinda long) $fp = @fsockopen($host, $port, &$errno, &$errstr, $connect_timeout); if(!$fp) { //if connection could not be made @fclose($fp); $success++; } else { $request="GET /played.html HTTP/1.1\r\nHost: " . $host . ":" . $port . "\r\nUser-Agent: SHOUTcast DNAS Status [played] * (Mozilla/PHP)\r\n"."Connection: close\r\n\r\n"; @fputs($fp,$request,strlen($request)); $page=''; while (!feof($fp)) { $page .= @fread($fp, 16384); } @fclose($fp); //close connection $played_html=$page; if ($played_html) { $played_html = ereg_replace('<x>','|-|',ereg_replace('</tr>','',ereg_replace('</td><td>','<x>',ereg_replace('<tr><td>','',ereg_replace('</tr>','</tr>' . $lf,ereg_replace('-->','--]',ereg_replace('<!--','[!--',ereg_replace('</table><br><br>.*','',ereg_replace('.*<b>Current Song</b></td></tr>','',$played_html))))))))); $xxn = strlen($played_html); $r = 2; $t_count = 0; $reading = 0; $track[0] = $song00; while ($r<$xxn & $t_count<=$t_max) { $cur = substr($played_html,$r,1); if ($cur == $lf) { $reading=0; } if ($reading == 1) { $track[$t_count] .= $cur; } if ($cur == "|" & substr($played_html,$r-1,1) == "-" & substr($played_html,$r-2,1) == "|") { $reading = 1; $t_count++; } $r++; } } } } // I now have $track[0-N] containg the current plus last N tracks... // Output time... if (!empty($er)) { // I couldn't connect to the DNAS $r = 0; $output_string = ''; $output_string .= '<table width="' . $tablew . '" height="' . $tableh . '" class="forumline" border="' . $thickness . '" bordercolor="' . $border . '"><tr bgcolor="' . $toprow . '"><td vAlign=top> <table width="100%" border="0" cellpadding="' . $padding . '"><tr><td> <font face=' . $font . ' size=' . $fontsize . '>' . $er; //Now playing... if ($success != 0) { $output_string .= '<td><tr>'; } if ($success == 0) { while ($r <= $t_max) { if ($r==0) { $output_string .= '<tr><td vAlign=top> ' . $lang['Before_that_you_heard'] . ' :</i><br><br>'; } else { $output_string .= str_replace("'", "'",str_replace('"', '"',$track[$r])) . '<br>'; } $r++; } } // I also want to close the table code now.... $output_string .= '</td></tr></font></td></tr></table></td></tr></table>'; echo $output_string . ''; } else if ($success == 0 && $state == "Up") { echo " <table width=\" . $block_size . \" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" class=\"forumline\">\n"; $r = 0; $output_string=''; //tweak the output string (the table init) here.... $output_string .= '<table width="' . $tablew . '" height="' . $tableh . '" class="forumline" border="' . $thickness . '" bordercolor="' . $border . '"><tr bgcolor="' . $toprow . '"><td vAlign=top> <table width="100%" border="0" cellpadding="' . $padding . '"><tr><td vAlign=top> <font face=' . $font . ' size=' . $fontsize . '>'; //Now playing... while ($r<=$t_max) { if ($r==0) { $output_string .= $lang['Now_Playing'] . ': <A><b>'.str_replace("'", "'",str_replace('"', '"',$track[$r])).'</b></A></td></tr></table></td></tr><tr><td><table bgcolor=' . $bottom . ' width="100%" border="0" cellpadding="' . $padding . '"><tr><td><br><font face=' . $font . ' size=' . $fontsize . '> ' . $lang['Before_that_you_heard'] . ' :<b><br><br>'; } else { $output_string .= str_replace("'", "'",str_replace('"', '"',$track[$r])) . '<br>'; } $r++; } // I also want to close the table code now.... $output_string .= '</b></font></td></tr></table></td></tr></table>'; echo $output_string . ''; } else { // I couldn't connect to the DNAS $r = 0; $output_string = ''; $output_string .= '<table width="' . $tablew . '" height="' . $tableh . '" class="forumline" border="' . $thickness . '" bordercolor="' . $border . '"><tr bgcolor="' . $toprow . '"><td vAlign=top> <table width="100%" border="0" cellpadding="' . $padding . '"><tr><td> <font face=' . $font . ' size=' . $fontsize . '>' . $lang['Off_Air']; //Now playing... if ($success != 0) { $output_string .= '<td><tr>'; } if ($success == 0) { while ($r <= $t_max) { if ($r==0) { $output_string .= '<tr><td vAlign=top> ' . $lang['Before_that_you_heard'] . ' :</i><br><br>'; } else { $output_string .= str_replace("'", "'",str_replace('"', '"',$track[$r])) . '<br>'; } $r++; } } // I also want to close the table code now.... $output_string .= '</td></tr></font></td></tr></table></td></tr></table>'; echo $output_string . ''; } ?> |