Update of /cvsroot/mxbb/mx_shotcast In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv9956 Added Files: cur_song.php cur_song_save.php db_install.php db_uninstall.php db_upgrade.php getinfo.php getinfo1.php getinfo2.php getinfo_save.php last10.php moreinfo.php mx_install_readme.htm play_real.php play_real_save.php play_wmp.php play_wmp_save.php radio_update.php radio_update_save.php radioplayer.php radioplayer_save.php shotcast.pak shotcast_config.php shotcast_front.php shotcast_save_front.php shotcast_stats.php Log Message: --- NEW FILE: shotcast_config.php --- <?php /** * * @package mxBB Portal Module - mx_shotcast * @version $Id: shotcast_config.php,v 1.1 2007/06/06 23:18:14 orynider Exp $ * @copyright (c) 2002-2006 [OryNider] mxBB Development Team * @license http://opensource.org/licenses/gpl-license.php GNU General Public License v2 * */ define('IN_PORTAL', 1); $mx_root_path = "../../"; $mx_module_path = "./"; $phpEx = substr(strrchr(__FILE__, '.'), 1); include_once($mx_root_path . 'common.'.$phpEx); // // Start session management // // $mx_user->init($user_ip, PAGE_INDEX); define('_SHOTCAST_CONFIG', true); include_once($mx_module_path .'includes/common.'.$phpEx); // // End session management // $time=date("U"); $nick = str_replace(" ", "_", $userdata['username']); //read check period $period=$shotcast_config['check_period']*1000; $station = $shotcast_config['shotcast_name']; // Station name $scip = $shotcast_config['shotcast_host']; // IP adress or domain $scport = $shotcast_config['shotcast_port']; // Port $scpass = $shotcast_config['shotcast_pass']; // SHOUTcast Password $playlist = ( !empty($shotcast_config['play_list']) ? $shotcast_config['play_list'] : 'listen.pls' ); // Real Player Play List File ?> --- NEW FILE: play_wmp_save.php --- <?php include "getinfo_save.php";?> <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="true">'); 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="true"'); 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="true"'); 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: last10.php --- <?php /** * * @package mxBB Portal Module - mx_shotcast * @version $Id: last10.php,v 1.1 2007/06/06 23:18:01 orynider Exp $ * @copyright (c) 2002-2006 [OryNider] mxBB Development Team * @license http://opensource.org/licenses/gpl-license.php GNU General Public License v2 * */ // -------------------------------------------------------------------------------- // Security check // if( !defined('IN_PORTAL') ) { die("Hacking attempt"); } // // Common Includes and Read Module Settings // if( !file_exists($module_root_path . 'includes/common.'.$phpEx) ) { 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 . 'getinfo2.'.$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') { $open = fsockopen($host,$port); if ($open) { fputs($open,"GET /7.html HTTP/1.1\nUser-Agent:Mozilla\n\n"); $read = fread($open,1000); $text = explode("content-type:text/html",$read); $text = explode(",",$text[1]); } else { $er="Connection Refused!"; } } */ 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.... fclose($fp1); $success++; } else { $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 ($success==0) { 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 . ''; } ?> --- NEW FILE: radio_update_save.php --- <?php /** * * @package mxBB Portal Module - mx_shotcast * @version $Id: radio_update_save.php,v 1.1 2007/06/06 23:18:11 orynider Exp $ * @copyright (c) 2002-2006 [OryNider] mxBB Development Team * @license http://opensource.org/licenses/gpl-license.php GNU General Public License v2 * */ /*************************************************************************** * mx_shotcast *************************************************************************** * History: *OryNider (16/09/2006) : 1st try * 2007/01/27 * -modified by OryNider to work if some functions are disabled in php.ini ***************************************************************************/ error_reporting( E_ALL ); ini_set( 'display_errors', '1' ); define('IN_PORTAL', true); $mx_root_path = '../../'; $module_root_path = './'; $phpEx = substr(strrchr(__FILE__, '.'), 1); include_once($mx_root_path . 'common.'.$phpEx); define('_SHOTCAST_CONFIG', true); include_once($module_root_path . 'includes/common.'.$phpEx); // // Start session management // $mx_user->init($user_ip, PAGE_INDEX); // // End session management // $time=date("U"); $nick = str_replace(" ", "_", $userdata['username']); //read check period $period=$shotcast_config['check_period']*1000; $station = $shotcast_config['shotcast_name']; // Station name $scip = $shotcast_config['shotcast_host']; // IP adress or domain $scport = $shotcast_config['shotcast_port']; // Port $scpass = $shotcast_config['shotcast_pass']; // SHOUTcast Password $shoutcastserver = $shotcast_config['shotcast_name']; $servertitle = $shotcast_config['shotcast_name']; $currentlisteners = "11"; $bitrate = "56"; $song[0] = "Unknon Artist"; $maxlisteners = "32"; $time=date("U"); if ($_POST['update']==true) { update_shotcast_users($nick,$time); } else { update_shotcast_users($nick,$time); } function update_total_users($currentlisteners) { global $shotcast_config, $board_config, $db, $lang; $sql = "UPDATE ". SHOTCAST_CONFIG_TABLE ." SET `config_name` = 'currentlisteners' WHERE `config_value` = '". $currentlisteners ."'"; if( !$result = $db->sql_query($sql) ) { die("SQL Error in function update_total_users(): UPDATE<br />" . $sql); } } if( $currentlisteners != "" ) { update_total_users($currentlisteners); } //read check period $period=$shotcast_config['check_period']*1000; //radio_update.php (send to the db the user statue "listening" every $period seconds) echo "<html>"; echo "<head>"; echo "<script language=\"javascript\">"; echo "setInterval(\"document.forms['update'].submit();\",".$period.");"; echo "</script>"; echo "<script>\n"; echo "<!--\n"; echo "\n"; echo "//enter refresh time in \"minutes:seconds\" Minutes should range from 0 to inifinity. Seconds should range from 0 to 59\n"; echo "var limit=\"0:30\"\n"; echo "\n"; echo "if (document.images){\n"; echo "var parselimit=limit.split(\":\")\n"; echo "parselimit=parselimit[0]*60+parselimit[1]*1\n"; echo "}\n"; echo "function beginrefresh(){\n"; echo "if (!document.images)\n"; echo "return\n"; echo "if (parselimit==1)\n"; echo "window.location.reload()\n"; echo "else{\n"; echo "parselimit-=1\n"; echo "curmin=Math.floor(parselimit/60)\n"; echo "cursec=parselimit%60\n"; echo "if (curmin!=0)\n"; echo "curtime=curmin+\" minutes and \"+cursec+\" seconds left until page refresh!\"\n"; echo "else\n"; echo "curtime=cursec+\" seconds left until page refresh!\"\n"; echo "window.status=curtime\n"; echo "setTimeout(\"beginrefresh()\",1000)\n"; echo "}\n"; echo "}\n"; echo "\n"; echo "window.onload=beginrefresh\n"; echo "//-->\n"; echo "</script>\n"; echo "</head>"; echo "<body background=\"templates/gateway_files/iframe_bg.png\">"; echo "<form name=\"update\" action=\"radio_update_save.php\" method=\"POST\">"; echo "<input type=\"hidden\" name=\"update\" value=\"true\">"; echo "</form>"; echo " Loged in as: $nick\n"; echo "</body>"; echo "</html>"; ?> --- NEW FILE: play_wmp.php --- <?php include "getinfo.php";?> <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="true">'); 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="true"'); 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="true"'); 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: shotcast_stats.php --- <?php /** * * @package mxBB Portal Module - mx_shotcast * @version $Id: shotcast_stats.php,v 1.1 2007/06/06 23:18:16 orynider Exp $ * @copyright (c) 2002-2006 [OryNider] mxBB Development Team * @license http://opensource.org/licenses/gpl-license.php GNU General Public License v2 * */ // -------------------------------------------------------------------------------- // Security check // if( !defined('IN_PORTAL') ) { die("Hacking attempt"); } // // Common Includes and Read Module Settings // if( !file_exists($module_root_path . 'includes/common.'.$phpEx) ) { 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 . 'getinfo2.'.$phpEx); if ($text[1]==1) { $state = "Up"; $shotcast_state_icon = 'online.gif'; } else { $state = "Down"; $shotcast_state_icon = 'offline.gif'; } if ($text[2]=="") { $text[2] = $currentlisteners; } if ($text[3]=="") { $text[3] = $maxlisteners; } if ($text[5]=="") { $text[5] = $bitrate; } if ($song[0]=="") { $song[0] = $text[6]; } // // Read block Configuration // // $block_config = read_block_config($block_id); $block_size = ( isset($block_size) && !empty($block_size) ? $block_size : '100%' ); // Generate block output (using templates) // Generate HTML for the block... // $template->set_filenames(array( 'body' => 'shotcast_stats.tpl') ); $template->assign_vars(array( 'SHOTCAST_STATE_IMG' => $module_root_path.'templates/images/'.$shotcast_state_icon, 'L_STATION' => $lang['Stats_for'], 'S_STATION' => $station, 'L_STATE' => $lang['Server_state'], 'S_STATE' => $state, 'L_SERVER_TITLE' => $lang['Station'], 'S_SERVER_TITLE' => $servertitle, 'L_SONG' => $lang['Current_song'], 'S_SONG' => $song[0], 'L_BITRATE' => $lang['Bitrate'], 'S_BITRATE' => $text[5], 'L_PEAK_LISTENERS' => $lang['Listeners_peak'], 'S_PEAK_LISTENERS' => $text[2], 'L_MAX_LISTENERS' => $lang['Max_listeners'], 'S_MAX_LISTENERS' => $text[3], 'L_SERVERGENRE' => $lang['Server_genre'], 'S_SERVERGENRE' => $servergenre, 'L_SONGURL' => $lang['Stream_URL'], 'S_SONGURL' => $songurl, 'S_SERVERURL' => $serverurl, 'L_REPORTEDLISTENERS' => $lang['Unique'], 'S_REPORTEDLISTENERS' => $reportedlisteners, 'BLOCK_SIZE' => $block_size, 'BLOCK_ID' => $block_id, 'L_TITLE' => 'shotcast') ); $template->pparse('body'); unset($station, $block_config, $state, $servertitle, $block_size, $module_root_path, $song[0], $bitrate, $currentlisteners, $maxlisteners); ?> --- NEW FILE: db_uninstall.php --- <?php /** * * @package mxBB Portal Module - mx_shotcast * @version $Id: db_uninstall.php,v 1.1 2007/06/06 23:17:57 orynider Exp $ * @copyright (c) 2003 [ory...@rd..., OryNider] mxBB Development Team * @license http://opensource.org/licenses/gpl-license.php GNU General Public License v2 * */ define('IN_PORTAL', true); if ( !defined('IN_ADMIN') ) { $mx_root_path = '../../'; $phpEx = substr(strrchr(__FILE__, '.'), 1); include($mx_root_path . 'common.'.$phpEx); // // Start session management // $mx_user->init($user_ip, PAGE_INDEX); if( !$userdata['session_logged_in'] ) { die("Hacking attempt(3)"); } if( $userdata['user_level'] != ADMIN ) { die("Hacking attempt(4)"); } // // End session management // } $sql = array( "DROP TABLE ".$mx_table_prefix."shotcast_config", "DROP TABLE ".$mx_table_prefix."shotcast_session" ); $n = 0; $message = "<b>This list is a result of the SQL queries needed to uninstall shotcast Module Addon</b><br/><br/>"; while($sql[$n]) { $message .= ($mods[$n-1] != $mods[$n]) ? '<p><b><font size=3>'.$mods[$n].'</font></b><br/>' : ''; if( !$result = $db->sql_query($sql[$n]) ) { $message .= '<b><font color=#FF0000>[Error or Already removed]</font></b> line: '.($n+1).' , '.$sql[$n].'<br />'; } else { $message .='<b><font color=#0000fF>[Removed]</font></b> line: '.($n+1).' , '.$sql[$n].'<br />'; } $n++; } $message .= ' <br />If you get some Error, relax, this is normal when updating modules'; echo '<br /> <br />'; echo '<table cellpadding="4" cellspacing="1" border="0" class="forumline">'; echo '<tr><th class="thHead" align="center">Module Installation Information</th></tr>'; echo '<tr><td class="row1" align="center"><span class="gen">' . $message . '</span></td></tr>'; echo '</table> <br />'; ?> --- NEW FILE: getinfo_save.php --- <?php /** * * @package mxBB Portal Module - mx_shotcast * @version $Id: getinfo_save.php,v 1.1 2007/06/06 23:18:00 orynider Exp $ * @copyright (c) 2002-2006 [OryNider] mxBB Development Team * @license http://opensource.org/licenses/gpl-license.php GNU General Public License v2 * */ /*************************************************************************** * mx_shotcast *************************************************************************** * History: *OryNider (16/09/2006) : 1st try * 2007/01/27 * -modified by OryNider to work if some functions are disabled in php.ini ***************************************************************************/ include "shotcast_config.php"; ini_set("display_errors", "0"); $mx_user->init($user_ip, PAGE_INDEX); $nick = str_replace(" ", "_", $userdata['username']); $time=date("U"); if ($_POST['update']==true) { update_shotcast_user($nick,$time); } $shoutcastserver = $shotcast_config['shotcast_name']; $servertitle = $shotcast_config['shotcast_name']; $currentlisteners = "11"; $bitrate = "56"; $song[0] = "Unknon Artist"; $maxlisteners = "32"; // if ($currentlisteners=="") { $currentlisteners = $text[2]; } // if ($bitrate=="") { $bitrate = $text[5]; } // if ($song[0]=="") { $song[0] = $text[6]; } if(isset($_GET['status'])){ $status = $_GET['status']; } else{ $status = "stop"; } if(isset($_GET['z'])){ $z = $_GET['z']; } else{ $z = "wmp"; } if ($z == 'wmp'){ $mode = 'real'; } elseif ($z == 'real'){ $mode = 'wmp'; } ?> --- NEW FILE: radioplayer.php --- <?php /** * * @package mxBB Portal Module - mx_shotcast * @version $Id: radioplayer.php,v 1.1 2007/06/06 23:18:12 orynider Exp $ * @copyright (c) 2002-2006 [OryNider] mxBB Development Team * @license http://opensource.org/licenses/gpl-license.php GNU General Public License v2 * */ include "getinfo.php"; if ($currentlisteners=="") { $currentlisteners = $text[2]; } if ($bitrate=="") { $bitrate = $text[5]; } if ($song[0]=="") { $song[0] = $text[6]; } user_listensc($nick); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" /> <meta name="description" content="Radio Player" /> <meta name="keywords" content="Radio Player" /> <meta name="author" content="Radio Player originaly made by: Niklas Pull - http://pull.zapto.org" /> <title>Radio Player :: <?=$station;?></title> <style type="text/css"> <!-- body {margin:0; padding: 0; BACKGROUND-IMAGE: url(templates/gateway_files/iframe_bg.png); font-family: Verdana; font-size: 10px;} a{text-decoration:none; background-color:inherit; color:#26c;} a:hover{text-decoration:underline;} #main {width: 350px; height: 100px; position: relative; left: 0px; top: 0px; margin:0; padding:0; background-image: url(images/player.png); background-repeat: no-repeat; background-attachment: fixed; background-color: #eeeeee} #display {width: 315px; height: 39px; position: relative; left: 18px; top: 18px;} #display_low {width: 310px; height: 21px; position: relative; left: 3px; top: 3px;} #bottom {width: 350px; height: 39px; position: relative; left: 0px; top: 22px;} #songtitle {width: 310px; height: 12px; position: relative; left: 3px; top: 3px;} #station {width: 150px; position: relative; left: 23px; top: 30px;} #bitrate {width: 55px; position: relative; left: 185px; top: 18px;} #equalizer {width: 55px; position: relative; left: 280px; top: 0px;} #icon {width: 55px; position: relative; left: 300px; top: 10px;} #iframe {width: 0px; position: relative; left: 0px; top: 0px;} .table {font-family: Verdana; font-size: 10px;} --> </style> <script> function createRequestObject() { var ro; var browser = navigator.appName; if(browser == "Microsoft Internet Explorer"){ ro = new ActiveXObject("Microsoft.XMLHTTP"); }else{ ro = new XMLHttpRequest(); } return ro; } var http = createRequestObject(); function sndReq() { http.open('get', 'cur_song.php'); http.onreadystatechange = handleResponse; http.send(null); setTimeout("sndReq()", 2000); } function handleResponse() { if(http.readyState == 4){ var response = http.responseText; if (response != responseold || responsecheck != 1) { var responsecheck = 1; document.getElementById("messages").innerHTML = http.responseText; var responseold = response; } } } </script> </head> <body onLoad="javascript:sndReq();"> <div id="iframe"> <SCRIPT language="javascript"> <!-- document.writeln("<iframe width=\"350\" height=\"1\""); document.writeln(" id=\"myiframe\" name=\"myiframe\""); document.writeln(" src=\"radio_update.php\""); document.writeln(" scrolling=\"no\""); document.writeln(" style=\"width:350px;height:1px;border:1px\">"); document.writeln("Sorry, your browser doesn't seem to support IFrames!"); document.writeln("</iframe>"); document.writeln(""); //--> </SCRIPT> </div> <div id="main"> <div id="display"> <div id="songtitle"> <div id="messages"> </div> </div> <div id="display_low"> <table border="0" cellpadding="0" cellspacing="0" width="300" height="21"> <tr class="table"> <td align="left" valign="bottom"> <i>Station: <b><?=$servertitle;?></b></i> </td> <td align="center" valign="bottom"> <?=$bitrate;?> kbps </td> <td align="right" valign="bottom"> <img src="images/equalizer_<?=$status;?>.gif" height="21"> </td> </tr> </table> </div> </div> <div id="bottom"> <table border="0" cellpadding="0" cellspacing="0" width="350" height="39"> <tr class="table"> <td width="193"> <img src="images/player2.png" width="193" height="39" usemap="#play" border="0"> </td> <td width="157" height="39" background="images/player3_<?=$z;?>.png"> Switch to: <a href="radioplayer.php?z=<?=$mode;?>"><img src="images/small_<?=$mode;?>.png" border="0"></a> </td> </tr> </table> </div> </div> <div id="iframe"> <iframe src="<?=$status;?>_<?=$z;?>.php" name="stream" width="0" height="0"></iframe> </div> <map name="play"> <area shape="rect" alt="Stop" coords="55,0,78,27" href="radioplayer.php?z=<?=$z;?>" target="_self"> <area shape="rect" alt="Play" coords="21,0,47,28" href="radioplayer.php?z=<?=$z;?>&status=play" target="_self"> </map> </body> </html> --- NEW FILE: shotcast.pak --- module=+:1000=+:shotcast=+:modules/mx_shotcast/=+:mx_shotcast=+:1 New_function=+:---------------------------=+:0=+:0=+:0=+:0=+:0 function=+:1000=+:1010=+:shotcast Front=+:=+:shotcast_front.php=+: parameter=+:0=+:0=+:0=+:endoflist=+:0=+:0 block=+:1020=+:shotcast Front=+:=+:1010=+:0=+:5=+:0=+:0=+:0=+:0=+:1=+:1 New_function=+:---------------------------=+:0=+:0=+:0=+:0=+:0 function=+:45=+:45=+:Shotcast Save Front=+:=+:shotcast_save_front.php=+: parameter=+:0=+:0=+:0=+:endoflist=+:0=+:0 block=+:37=+:Shotcast Save Front=+:Demo block=+:45=+:0=+:5=+:0=+:0=+:0=+:0=+:1=+:1 New_function=+:---------------------------=+:0=+:0=+:0=+:0=+:0 function=+:46=+:99=+:Last 10=+:Shotcast Last 10 block =+:last10.php=+: parameter=+:0=+:0=+:0=+:endoflist=+:0=+:0 block=+:=+:Demo - Last 10=+:Demo block=+:99=+:0=+:5=+:0=+:0=+:0=+:0=+:1=+:1 New_function=+:---------------------------=+:0=+:0=+:0=+:0=+:0 function=+:71=+:191=+:Shotcast Stats=+:Shotcast Statinstics block =+:shotcast_stats.php=+: parameter=+:0=+:0=+:0=+:endoflist=+:0=+:0 block=+:=+:Demo - Shotcast Stats=+:Demo block=+:99=+:0=+:5=+:0=+:0=+:0=+:0=+:1=+:1 function=+:0=+:0=+:0=+:endoflist=+:0=+:0 --- NEW FILE: db_upgrade.php --- <?php /** * * @package mxBB Portal Module - mx_shotcast * @version $Id: db_upgrade.php,v 1.1 2007/06/06 23:17:58 orynider Exp $ * @copyright (c) 2002-2006 [Jon Ohlsson] mxBB Project Team * @license http://opensource.org/licenses/gpl-license.php GNU General Public License v2 * */ define( 'IN_PORTAL', true ); if ( !defined( 'IN_ADMIN' ) ) { $mx_root_path = './../../'; $phpEx = substr(strrchr(__FILE__, '.'), 1); include( $mx_root_path . 'common.' . $phpEx ); // Start session management $mx_user->init($user_ip, PAGE_INDEX); if ( !$userdata['session_logged_in'] ) { die( "Hacking attempt(1)" ); } if ( $userdata['user_level'] != ADMIN ) { die( "Hacking attempt(2)" ); } // End session management } $mx_module_version = '1.0.0 RC 3'; $mx_module_copy = 'mxBB <i> - Shotcast</i> module by OryNider & <a href="http://www.mxbb.net" target="_blank">Mx Team</a>'; $message = "<b>Upgrading!</b><br/><br/>"; $sql = array(); $sql[] = "UPDATE " . $mx_table_prefix . "module" . " SET module_version = '" . $mx_module_version . "', module_copy = '" . $mx_module_copy . "' WHERE module_id = '" . $mx_module_id . "'"; $message .= mx_do_install_upgrade( $sql ); echo "<br /><br />"; echo "<table width=\"90%\" align=\"center\" cellpadding=\"4\" cellspacing=\"1\" border=\"0\" class=\"forumline\">"; echo "<tr><th class=\"thHead\" align=\"center\">Module Installation/Upgrading/Uninstalling Information - module specific db tables</th></tr>"; echo "<tr><td class=\"row1\" align=\"left\"><span class=\"gen\">" . $message . "</span></td></tr>"; echo "</table><br />"; ?> --- NEW FILE: shotcast_front.php --- <?php /** * * @package mxBB Portal Module - mx_shotcast * @version $Id: shotcast_front.php,v 1.1 2007/06/06 23:18:15 orynider Exp $ * @copyright (c) 2002-2006 [OryNider] mxBB Development Team * @license http://opensource.org/licenses/gpl-license.php GNU General Public License v2 * */ /*************************************************************************** * mx_chatbox module written by markus_petrux at phpmix dot com *************************************************************************** * History: * 2006/09/10 * -modified by OryNider to shotcast_front ***************************************************************************/ // -------------------------------------------------------------------------------- // Security check // if( !defined('IN_PORTAL') ) { die("Hacking attempt"); } // -------------------------------------------------------------------------------- // Initialization // // // Common Includes and Read Module Settings // if( !file_exists($module_root_path . 'includes/common.'.$phpEx) ) { 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); if ( empty($shotcast_config['shotcast_host']) ) { include_once($module_root_path . 'getinfo1.'.$phpEx); } else { include_once($module_root_path . 'getinfo2.'.$phpEx); } // // Read block Configuration // $title = $mx_block->block_info['block_title']; $block_size = ( isset($block_size) && !empty($block_size) ? $block_size : '100%' ); $shotcast_icon = 'shotcast_front_02.gif'; $wmp_icon = 'wmp_front.gif'; $real_icon = 'real_front.gif'; // -------------------------------------------------------------------------------- // Get ChatBox Session information // // REMOVE OLD SESSIONS drop_shotcast_users($shotcast_config['check_period']); // Get all remain sessions $sql = "SELECT * FROM ".SHOTCAST_SESSION_TABLE; if (!$sol = $db->sql_query($sql)) { message_die(GENERAL_ERROR, "Could not query shotcast Session information", "", __LINE__, __FILE__, $sql); } if( empty($currentlisteners) && empty($text[2]) ) { $text[2] = $shotcast_config['currentlisteners']; } elseif (empty($currentlisteners) && !empty($text[2])) { $currentlisteners = $text[2]; } // if( $currentlisteners != "" ) if( !empty($currentlisteners)) { $howmanylisten = $db->sql_numrows($sol); $howmanypeak = $currentlisteners; } else { $howmanylisten = $db->sql_numrows($sol); // Return this $howmanypeak="0"; } $isimler[0] = $db->sql_numrows($sol); $i = 1; while ($record = $db->sql_fetchrow($sol)) { $isimler[$i++] = $record['username']; if ( ( $shotcast_config['show_listen_select'] ) ) { $can_listen="yes"; } elseif ($record['username']==$userdata['username']) { $can_listen="no"; } else { $can_listen="yes"; } } $listeners = ( empty($isimler[1]) ? '' : '<a href="' . append_sid( PHPBB_URL . 'profile.php?mode=viewprofile&u='.$isimler[1]) . '" >'.$isimler[1].'</a><br />' ); for($s = 2; $s <= $isimler[0]; $s++) { $listeners .= ', <a href="' . append_sid( PHPBB_URL . 'profile.php?mode=viewprofile&u='.$isimler[$s]) . '" >'.$isimler[$s].'</a><br />'; } // -------------------------------------------------------------------------------- // Generate block output (using templates) // Generate HTML for the block... // $template->set_filenames(array( 'body' => 'shotcast_front.tpl') ); if ( !$userdata['session_logged_in'] ) { $template->assign_block_vars('switch_user_logged_out', array()); } else { if ( $can_listen=="no") { $template->assign_block_vars('switch_user_listening', array()); } else { $template->assign_block_vars('switch_user_logged_in', array()); } } if( empty($listeners) ) { $template->assign_block_vars('switch_listeners_list_off', array()); $listeners_list = ''; } else { $template->assign_block_vars('switch_listeners_list_on', array()); $listeners_list = sprintf($lang['Who_Are_Listening'], $listeners); } $template->assign_vars(array( 'SHOTCAST_IMG' => $module_root_path.'templates/images/'.$shotcast_icon, 'WMP_IMG' => $module_root_path.'templates/images/'.$wmp_icon, 'REAL_IMG' => $module_root_path.'templates/images/'.$real_icon, 'TOTAL_LISTENERS_ONLINE' => sprintf($lang['How_Many_Listeners'], $howmanylisten), 'TOTAL_LISTENERS_PEAK' => sprintf($lang['How_Many_Peak'], $howmanypeak), 'LISTENERS_LIST' => $listeners_list, 'L_CLICK_TO_LISTEN_STATION' => $lang['Click_to_listen_station'], 'L_CLICK_TO_LISTEN_WMP' => $lang['Click_to_listen_wmp'], 'L_CLICK_TO_LISTEN_REAL' => $lang['Click_to_listen_real'], 'S_LISTEN_STATION' => append_sid($module_root_path.'radioplayer.php'), 'S_LISTEN_WMP' => append_sid($module_root_path.'radioplayer.php?lang=&z=wmp'), 'S_LISTEN_REAL' => append_sid($module_root_path.'radioplayer.php?lang=&z=real'), 'S_MOREINFO' => append_sid($module_root_path.'moreinfo.php'), 'L_LOGIN_TO_LISTEN_STATION' => $lang['Login_to_listen_station'], 'L_ALREADY_LISTENING' => $lang['Already_listening'], 'BLOCK_SIZE' => $block_size, // 'U_URL' => append_sid(PORTAL_URL . 'index.' . $phpEx . '?block_id=' . $block_id), 'BLOCK_ID' => $block_id, 'L_VERSION' => _SHOTCAST_VERSION, 'L_TITLE' => 'shotcast') ); $template->pparse('body'); unset($liteners, $sql, $howmanylisten, $listeners_list, $block_size, $module_root_path, $isimler, $can_listen); ?> --- NEW FILE: getinfo1.php --- <?php /** * * @package mxBB Portal Module - mx_shotcast * @version $Id: getinfo1.php,v 1.1 2007/06/06 23:17:59 orynider Exp $ * @copyright (c) 2002-2006 [OryNider] mxBB Development Team * @license http://opensource.org/licenses/gpl-license.php GNU General Public License v2 * */ // // Start session management // // $mx_user->init($user_ip, PAGE_INDEX); /* if ( !$userdata['session_logged_in'] ) { mx_redirect(append_sid(PHPBB_URL . "login.".$phpEx."?redirect=chat.".$phpEx, true)); exit; } */ // // End session management // $time=date("U"); // $nick = str_replace(" ", "_", $userdata['username']); /* if ($_POST['update']==true) { update_shotcast_user($nick,$time); } */ //read check period $period=$shotcast_config['check_period']*1000; $scip = "277.0.0.0"; $shoutcastserver = $shotcast_config['shotcast_name']; $servertitle = $shotcast_config['shotcast_name']; $currentlisteners = "0"; $bitrate = "56"; $song[0] = "Unknon Artist"; $maxlisteners = "32"; // if ($currentlisteners=="") { $currentlisteners = $text[2]; } // if ($bitrate=="") { $bitrate = $text[5]; } // if ($song[0]=="") { $song[0] = $text[6]; if(isset($_GET['status'])){ $status = $_GET['status']; } else{ $status = "stop"; } if(isset($_GET['z'])){ $z = $_GET['z']; } else{ $z = "wmp"; } if ($z == 'wmp'){ $mode = 'real'; } elseif ($z == 'real'){ $mode = 'wmp'; } ?> --- NEW FILE: play_real_save.php --- <?php include "getinfo_save.php";?> <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="true"> </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: radio_update.php --- <?php /** * * @package mxBB Portal Module - mx_shotcast * @version $Id: radio_update.php,v 1.1 2007/06/06 23:18:10 orynider Exp $ * @copyright (c) 2002-2006 [OryNider] mxBB Development Team * @license http://opensource.org/licenses/gpl-license.php GNU General Public License v2 * */ /*************************************************************************** * mx_shotcast *************************************************************************** * History: *OryNider (16/09/2006) : 1st try ***************************************************************************/ // error_reporting( E_ALL ); // ini_set( 'display_errors', '1' ); define('IN_PORTAL', true); $mx_root_path = '../../'; $module_root_path = './'; $phpEx = substr(strrchr(__FILE__, '.'), 1); include_once($mx_root_path . 'common.'.$phpEx); $mx_user->init($user_ip, PAGE_INDEX); define('_SHOTCAST_CONFIG', true); include_once($module_root_path . 'includes/common.'.$phpEx); include_once($module_root_path . 'getinfo2.'.$phpEx); $time=date("U"); $nick = str_replace(" ", "_", $userdata['username']); if ($_POST['update']==true) { update_shotcast_users($nick,$time); } else { update_shotcast_users($nick,$time); } $currentlisteners = $currentlisteners; function update_total_users($currentlisteners) { global $shotcast_config, $board_config, $db, $lang; $sql = "UPDATE ". SHOTCAST_CONFIG_TABLE ." SET `config_name` = 'currentlisteners' WHERE `config_value` = '". $currentlisteners ."'"; if( !$result = $db->sql_query($sql) ) { die("SQL Error in function update_total_users(): UPDATE<br />" . $sql); } } if( $currentlisteners != "" ) { update_total_users($currentlisteners); } //read check period $period=$shotcast_config['check_period']*1000; //radio_update.php (send to the db the user statue "listening" every $period seconds) echo "<html>"; echo "<head>"; echo "<script language=\"javascript\">"; echo "setInterval(\"document.forms['update'].submit();\",".$period.");"; echo "</script>"; echo "<script>\n"; echo "<!--\n"; echo "\n"; echo "//enter refresh time in \"minutes:seconds\" Minutes should range from 0 to inifinity. Seconds should range from 0 to 59\n"; echo "var limit=\"0:30\"\n"; echo "\n"; echo "if (document.images){\n"; echo "var parselimit=limit.split(\":\")\n"; echo "parselimit=parselimit[0]*60+parselimit[1]*1\n"; echo "}\n"; echo "function beginrefresh(){\n"; echo "if (!document.images)\n"; echo "return\n"; echo "if (parselimit==1)\n"; echo "window.location.reload()\n"; echo "else{\n"; echo "parselimit-=1\n"; echo "curmin=Math.floor(parselimit/60)\n"; echo "cursec=parselimit%60\n"; echo "if (curmin!=0)\n"; echo "curtime=curmin+\" minutes and \"+cursec+\" seconds left until page refresh!\"\n"; echo "else\n"; echo "curtime=cursec+\" seconds left until page refresh!\"\n"; echo "window.status=curtime\n"; echo "setTimeout(\"beginrefresh()\",1000)\n"; echo "}\n"; echo "}\n"; echo "\n"; echo "window.onload=beginrefresh\n"; echo "//-->\n"; echo "</script>\n"; echo "</head>"; echo "<body background=\"templates/gateway_files/iframe_bg.png\">"; echo "<form name=\"update\" action=\"radio_update.php\" method=\"POST\">"; echo "<input type=\"hidden\" name=\"update\" value=\"true\">"; echo "</form>"; echo " Loged in as: $nick\n"; echo "</body>"; echo "</html>"; ?> --- NEW FILE: moreinfo.php --- <?php /** * * @package mxBB Portal Module - mx_shotcast * @version $Id: moreinfo.php,v 1.1 2007/06/06 23:18:01 orynider Exp $ * @copyright (c) 2002-2006 [OryNider] mxBB Development Team * @license http://opensource.org/licenses/gpl-license.php GNU General Public License v2 * */ include "getinfo.php"; if ($text[1]==1) { $state = "Up"; } else { $state = "Down"; } if ($text[2]=="") { $text[2] = $currentlisteners; } if ($text[5]=="") { $text[5] = $bitrate; } if ($song[0]=="") { $song[0] = $text[6]; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" /> <title>Radio Moreinfo :: <?=$station;?></title> <style type="text/css"> <!-- body {margin:0; padding: 0; BACKGROUND-IMAGE: url('templates/gateway_files/iframe_bg.png'); font-family: Verdana; font-size: 10px} a{text-decoration:none; background-color:inherit; color:#26c;} a:hover{text-decoration:underline;} .main {position: relative; left: 0px; top: 0px; margin:0; padding:0; background-image: url('images/player.png'); background-repeat: no-repeat; background-attachment: fixed; background-color: #eeeeee} .display_low {position: relative; left: 3px; top: 3px;} .table {font-family: Verdana; font-size: 10px;} td.nav { background: #cccddd; border-top: 1px solid #FFFFFF; border-bottom: 1px solid #859288; padding: 1px 0 1px 5px; color: #000333; font-weight: bold; font-size: 12px} td.stat { background: #ccccde; border-top: 1px solid #FFFFFF; border-bottom: 1px solid #859288; padding: 1px 0 1px 5px;} --> </style> </head> <body> <div id="main"> </div> </div> <div id="display_low"> <table border="0" cellpadding="0" cellspacing="0" width="100%"> </tr> <tr class="table"> <td class="nav" align="left" valign="bottom"> <h8><b>Stats for <i><?=$station;?></i></b></h8> </td> </tr> <tr class="table"> <td class="stat" align="left" valign="bottom"> <b>Server State: <i><?=$state;?></i></b> </td> </tr> <tr class="table"> <td class="stat" align="left" valign="bottom"> <i>Station:<b><?=$servertitle;?></b></i> </td> </tr> </tr> <tr class="table"> <td class="stat" align="left" valign="bottom"> <i>Current Song: <b><?=$song[0];?></b></i> </td> </tr> </tr> <tr class="table"> <td class="stat" align="left" valign="bottom"> <i>BitRate: <b><?=$text[5];?> kbps</b></i> </td> </tr> <tr class="table"> <td class="stat" align="left" valign="bottom"> <i>Listeners Peak: <b><?=$text[2];?></b></i> </td> </tr> <tr class="table"> <td class="stat" align="left" valign="bottom"> <i>Max Listeners: <b><?=$maxlisteners;?></b></i></td> </tr> </table> </div> </div> </body> </html> --- NEW FILE: getinfo2.php --- <?php /** * * @package mxBB Portal Module - mx_shotcast * @version $Id: getinfo2.php,v 1.1 2007/06/06 23:17:59 orynider Exp $ * @copyright (c) 2002-2006 [OryNider] mxBB Development Team * @license http://opensource.org/licenses/gpl-license.php GNU General Public License v2 * */ /*************************************************************************** * mx_shotcast *************************************************************************** * History: *OryNider (16/09/2006) : 1st try * 2007/01/27 * -modified by OryNider to work if URL file-access is disabled in the * server configuration ***************************************************************************/ // // Start session management // // $mx_user->init($user_ip, PAGE_INDEX); /* if ( !$userdata['session_logged_in'] ) { mx_redirect(append_sid(PHPBB_URL . "login.".$phpEx."?redirect=chat.".$phpEx, true)); exit; } */ // // End session management // /* $time=date("U"); $nick = str_replace(" ", "_", $userdata['username']); if ($_POST['update']==true) { update_shotcast_user($nick,$time); } */ //read check period $period=$shotcast_config['check_period']*1000; $station = $shotcast_config['shotcast_name']; // Station name $scip = $shotcast_config['shotcast_host']; // IP adress or domain $scport = $shotcast_config['shotcast_port']; // Port $scpass = $shotcast_config['shotcast_pass']; // SHOUTcast Password ini_set("display_errors", "0"); if (@phpversion() >= '5.0.0') { $open = fsockopen($scip,$scport); if ($open) { fputs($open,"GET /7.html HTTP/1.1\nUser-Agent:Mozilla\n\n"); $read = fread($open,1000); $text = explode("content-type:text/html",$read); $text = explode(",",$text[1]); fclose($open); } else { $er="Connection Refused!"; } } //$scfp = fsockopen($scip, $scport, &$errno, &$errstr, 1); $scfp = fsockopen($scip, $scport); if(!$scfp) { $scsuccs=1; } if($scsuccs!=1){ fputs($scfp,"GET /admin.cgi?pass=$scpass&mode=viewxml HTTP/1.0\r\nUser-Agent: SHOUTcast Song Status (Mozilla Compatible)\r\n\r\n"); while(!feof($scfp)) { $page .= fgets($scfp, 1000); } $loop = array("STREAMSTATUS", "BITRATE", "SERVERTITLE", "CURRENTLISTENERS", "MAXLISTENERS", "BITRATE", "SERVERGENRE", "SONGURL", "SERVERURL", "REPORTEDLISTENERS"); $y=0; while($loop[$y]!=''){ $pageed = ereg_replace(".*<$loop[$y]>", "", $page); $scphp = strtolower($loop[$y]); $$scphp = ereg_replace("</$loop[$y]>.*", "", $pageed); if($loop[$y]==SERVERGENRE || $loop[$y]==SERVERTITLE || $loop[$y]==SONGTITLE || $loop[$y]==SERVERTITLE) $$scphp = urldecode($$scphp); $y++; } $pageed = ereg_replace(".*<SONGHISTORY>", "", $page); $pageed = ereg_replace("<SONGHISTORY>.*", "", $pageed); $songatime = explode("<SONG>", $pageed); $r=1; while($songatime[$r]!=""){ $t=$r-1; $playedat[$t] = ereg_replace(".*<PLAYEDAT>", "", $songatime[$r]); $playedat[$t] = ereg_replace("</PLAYEDAT>.*", "", $playedat[$t]); $song[$t] = ereg_replace(".*<TITLE>", "", $songatime[$r]); $song[$t] = ereg_replace("</TITLE>.*", "", $song[$t]); $song[$t] = urldecode($song[$t]); $dj[$t] = ereg_replace(".*<SERVERTITLE>", "", $page); $dj[$t] = ereg_replace("</SERVERTITLE>.*", "", $pageed); $r++; } fclose($scfp); } if(isset($_GET['status'])){ $status = $_GET['status']; } else{ $status = "stop"; } if(isset($_GET['z'])){ $z = $_GET['z']; } else{ $z = "wmp"; } if ($z == 'wmp'){ $mode = 'real'; } elseif ($z == 'real'){ $mode = 'wmp'; } ?> --- NEW FILE: cur_song_save.php --- <?php include "getinfo_save.php";?> <b><?=$song[0];?></b> --- NEW FILE: radioplayer_save.php --- <?php /** * * @package mxBB Portal Module - mx_shotcast * @version $Id: radioplayer_save.php,v 1.1 2007/06/06 23:18:13 orynider Exp $ * @copyright (c) 2002-2006 [OryNider] mxBB Development Team * @license http://opensource.org/licenses/gpl-license.php GNU General Public License v2 * */ /*************************************************************************** * mx_shotcast *************************************************************************** * History: *OryNider (16/09/2006) : 1st try * 2007/01/27 * -modified by OryNider to work if some functions are disabled in php.ini ***************************************************************************/ include "getinfo_save.php"; user_listensc($nick); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" /> <meta name="description" content="Radio Player" /> <meta name="keywords" content="Radio Player" /> <meta name="author" content="Radio Player originaly made by: Niklas Pull - http://pull.zapto.org" /> <title>Radio Player :: <?=$station;?></title> <style type="text/css"> <!-- body {margin:0; padding: 0; BACKGROUND-IMAGE: url(templates/gateway_files/iframe_bg.png); font-family: Verdana; font-size: 10px;} a{text-decoration:none; background-color:inherit; color:#26c;} a:hover{text-decoration:underline;} #main {width: 350px; height: 100px; position: relative; left: 0px; top: 0px; margin:0; padding:0; background-image: url(images/player.png); background-repeat: no-repeat; background-attachment: fixed; background-color: #eeeeee} #display {width: 315px; height: 39px; position: relative; left: 18px; top: 18px;} #display_low {width: 310px; height: 21px; position: relative; left: 3px; top: 3px;} #bottom {width: 350px; height: 39px; position: relative; left: 0px; top: 22px;} #songtitle {width: 310px; height: 12px; position: relative; left: 3px; top: 3px;} #station {width: 150px; position: relative; left: 23px; top: 30px;} #bitrate {width: 55px; position: relative; left: 185px; top: 18px;} #equalizer {width: 55px; position: relative; left: 280px; top: 0px;} #icon {width: 55px; position: relative; left: 300px; top: 10px;} #iframe {width: 0px; position: relative; left: 0px; top: 0px;} .table {font-family: Verdana; font-size: 10px;} --> </style> <script> function createRequestObject() { var ro; var browser = navigator.appName; if(browser == "Microsoft Internet Explorer"){ ro = new ActiveXObject("Microsoft.XMLHTTP"); }else{ ro = new XMLHttpRequest(); } return ro; } var http = createRequestObject(); function sndReq() { http.open('get', 'cur_song_save.php'); http.onreadystatechange = handleResponse; http.send(null); setTimeout("sndReq()", 2000); } function handleResponse() { if(http.readyState == 4){ var response = http.responseText; if (response != responseold || responsecheck != 1) { var responsecheck = 1; document.getElementById("messages").innerHTML = http.responseText; var responseold = response; } } } </script> </head> <body onLoad="javascript:sndReq();"> <div id="iframe"> <SCRIPT language="javascript"> <!-- document.writeln("<iframe width=\"350\" height=\"1\""); document.writeln(" id=\"myiframe\" name=\"myiframe\""); document.writeln(" src=\"radio_update_save.php\""); document.writeln(" scrolling=\"no\""); document.writeln(" style=\"width:350px;height:1px;border:1px\">"); document.writeln("Sorry, your browser doesn't seem to support IFrames!"); document.writeln("</iframe>"); document.writeln(""); //--> </SCRIPT> </div> <div id="main"> <div id="display"> <div id="songtitle"> <div id="messages"> </div> </div> <div id="display_low"> <table border="0" cellpadding="0" cellspacing="0" width="300" height="21"> <tr class="table"> <td align="left" valign="bottom"> <i>Station: <b><?=$servertitle;?></b></i> </td> <td align="center" valign="bottom"> <?=$bitrate;?> kbps </td> <td align="right" valign="bottom"> <img src="images/equalizer_<?=$status;?>.gif" height="21"> </td> </tr> </table> </div> </div> <div id="bottom"> <table border="0" cellpadding="0" cellspacing="0" width="350" height="39"> <tr class="table"> <td width="193"> <img src="images/player2.png" width="193" height="39" usemap="#play" border="0"> </td> <td width="157" height="39" background="images/player3_<?=$z;?>.png"> Switch to: <a href="radioplayer_save.php?z=<?=$mode;?>"><img src="images/small_<?=$mode;?>.png" border="0"></a> </td> </tr> </table> </div> </div> <div id="iframe"> <iframe src="<?=$status;?>_<?=$z;?>_save.php" name="stream" width="0" height="0"></iframe> </div> <map name="play"> <area shape="rect" alt="Stop" coords="55,0,78,27" href="radioplayer_save.php?z=<?=$z;?>" target="_self"> <area shape="rect" alt="Play" coords="21,0,47,28" href="radioplayer_save.php?z=<?=$z;?>&status=play" target="_self"> </map> </body> </html> --- NEW FILE: getinfo.php --- <?php /** * * @package mxBB Portal Module - mx_shotcast * @version $Id: getinfo.php,v 1.1 2007/06/06 23:17:59 orynider Exp $ * @copyright (c) 2002-2006 [OryNider] mxBB Development Team * @license http://opensource.org/licenses/gpl-license.php GNU General Public License v2 * */ include "shotcast_config.php"; $mx_user->init($user_ip, PAGE_INDEX); $nick = str_replace(" ", "_", $userdata['username']); $time=date("U"); if ($_POST['update']==true) { update_shotcast_user($nick,$time); } ini_set("display_errors", "0"); if (@phpversion() >= '5.0.0') { $open = fsockopen($scip,$scport); if ($open) { fputs($open,"GET /7.html HTTP/1.1\nUser-Agent:Mozilla\n\n"); $read = fread($open,1000); $text = explode("content-type:text/html",$read); $text = explode(",",$text[1... [truncated message content] |