|
From: OryNider <ory...@us...> - 2008-04-29 02:40:01
|
Update of /cvsroot/mxbb/mx_shotcast/includes In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv19075/includes Modified Files: common.php cur_song.php detectScript.htm Added Files: cur_display.php cur_listeners.php getinfo.php Log Message: version 3.0.0-RC Index: detectScript.htm =================================================================== RCS file: /cvsroot/mxbb/mx_shotcast/includes/detectScript.htm,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** detectScript.htm 20 Apr 2008 07:21:40 -0000 1.3 --- detectScript.htm 29 Apr 2008 02:39:48 -0000 1.4 *************** *** 19,22 **** --- 19,67 ---- var cType = '<?=$mimetype;?>'; var radioStat = '<?=$radio->stat;?>'; + //Specify the marquee's width (in pixels) + var marqueewidth="250px"; + //Specify the marquee's height + var marqueeheight="18px"; + //Specify the marquee's marquee speed (larger is faster 1-10) + var marqueespeed=1; + //configure background color: + var marqueebgcolor="#FFFFFF"; + //Pause marquee onMousever (0=no. 1=yes)? + var pauseit=1; + + marqueespeed=(document.all)? marqueespeed : Math.max(1, marqueespeed-1); //slow speed down by 1 for NS + var copyspeed=marqueespeed; + var pausespeed=(pauseit==0)? copyspeed: 0; + var actualwidth=''; + var cross_marquee, ns_marquee; + + function checkDisplay(){ + var xmlHttp; + try{ + xmlHttp = new XMLHttpRequest(); + } + catch (e){ + try{ + xmlHttp = new ActiveXObject("Msxml2.XMLHTTP"); + } + catch (e){ + try{ + xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); + } + catch (e){ + return false; + } + } + } + + xmlHttp.onreadystatechange = function(){ + if(xmlHttp.readyState == 4){ + document.getElementById('display').innerHTML = xmlHttp.responseText; + setTimeout('checkDisplay()',15900); + } + } + xmlHttp.open("GET","<?=$module_root_path;?>includes/cur_display.<?=$phpEx;?>",true); + xmlHttp.send(null); + } function checkSong(){ *************** *** 42,53 **** if(xmlHttp.readyState == 4){ document.getElementById('songtitle').innerHTML = xmlHttp.responseText; setTimeout('checkSong()',15900); } } ! xmlHttp.open("GET","<?=$module_root_path;?>includes/cur_song.<?=$phpEx;?>",true); xmlHttp.send(null); } function embedInfo(embed){ --- 87,135 ---- if(xmlHttp.readyState == 4){ document.getElementById('songtitle').innerHTML = xmlHttp.responseText; + cross_marquee.style.left = "305px"; + actualwidth = document.getElementById("songtitle").offsetWidth; setTimeout('checkSong()',15900); + setInterval('scrollmarquee()',20); } } ! xmlHttp.open("GET","<?=$module_root_path;?>includes/cur_display.<?=$phpEx;?>",true); xmlHttp.send(null); } + function checklisteners(){ + var xmlHttp; + try{ + xmlHttp = new XMLHttpRequest(); + } + catch (e){ + try{ + xmlHttp = new ActiveXObject("Msxml2.XMLHTTP"); + } + catch (e){ + try{ + xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); + } + catch (e){ + return false; + } + } + } + + xmlHttp.onreadystatechange = function(){ + if(xmlHttp.readyState == 4){ + document.getElementById('currentlisteners').innerHTML = xmlHttp.responseText; + setTimeout('checklisteners()',15900); + } + } + xmlHttp.open("GET","<?=$module_root_path;?>includes/cur_listeners.<?=$phpEx;?>",true); + xmlHttp.send(null); + } + function scrollmarquee(){ + if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)) + cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed+"px" + else + cross_marquee.style.left="308px" + } function embedInfo(embed){ *************** *** 61,65 **** plugin = '<a href="http://www.real.com/realplayer.html">» Download Realplayer</a>'; } else{ ! plugin = '» No plugins seems<br> to be needed'; } --- 143,147 ---- plugin = '<a href="http://www.real.com/realplayer.html">» Download Realplayer</a>'; } else{ ! plugin = '» No plugins seems<br /> to be needed'; } *************** *** 70,77 **** plugin = '<a href="http://www.microsoft.com/windows/windowsmedia/">» Download WMP</a>'; if(AXcompatible()){ ! plugin += '<br><a href="http://activex.microsoft.com/activex/controls/mplayer/sv/nsmp2inf.cab#Version=6,4,5,715">»Download Plugin</a>'; } } else{ ! plugin = '» No plugins seems<br> to be needed'; } --- 152,159 ---- plugin = '<a href="http://www.microsoft.com/windows/windowsmedia/">» Download WMP</a>'; if(AXcompatible()){ ! plugin += '<br /><a href="http://activex.microsoft.com/activex/controls/mplayer/sv/nsmp2inf.cab#Version=6,4,5,715">»Download Plugin</a>'; } } else{ ! plugin = '» No plugins seems<br /> to be needed'; } *************** *** 82,86 **** plugin = '<a href="http://www.microsoft.com/windows/windowsmedia/">» Download WMP</a>'; } else{ ! plugin = '» No plugins seems<br> to be needed'; } --- 164,168 ---- plugin = '<a href="http://www.microsoft.com/windows/windowsmedia/">» Download WMP</a>'; } else{ ! plugin = '» No plugins seems<br /> to be needed'; } *************** *** 91,106 **** plugin = '<a href="http://www.microsoft.com/windows/windowsmedia/">» Download WMP</a>'; } else{ ! plugin = '» No plugins seems<br> to be needed'; } } else if(embed == 'quicktime'){ ! player = '<b>QuickTime</b><br><div style="font-size: 8px;">(Enable mp3 mime-type)</div>'; if(!detectQuickTime()){ plugin = '<a href="http://www.apple.com/quicktime/download/">» Download QT</a>'; if(AXcompatible()){ ! plugin += '<br><a href="http://www.apple.com/qtactivex/qtplugin.cab">» Download Plugin</a>'; } } else{ ! plugin = '» No plugins seems<br> to be needed'; } --- 173,188 ---- plugin = '<a href="http://www.microsoft.com/windows/windowsmedia/">» Download WMP</a>'; } else{ ! plugin = '» No plugins seems<br /> to be needed'; } } else if(embed == 'quicktime'){ ! player = '<b>QuickTime</b><br /><div style="font-size: 8px;">(Enable mp3 mime-type)</div>'; if(!detectQuickTime()){ plugin = '<a href="http://www.apple.com/quicktime/download/">» Download QT</a>'; if(AXcompatible()){ ! plugin += '<br /><a href="http://www.apple.com/qtactivex/qtplugin.cab">» Download Plugin</a>'; } } else{ ! plugin = '» No plugins seems<br /> to be needed'; } *************** *** 110,114 **** plugin = ''; if(!detectWindowsMedia()){ ! plugin += '<a href="http://www.microsoft.com/windows/windowsmedia/">» Download WMP</a><br>'; } plugin += '<a href="http://retro-radio.net/plugin/setup_AAC_aacPlus_plugin_1_0_36.exe">» AAC plugin f. WMP</a>'; --- 192,196 ---- plugin = ''; if(!detectWindowsMedia()){ ! plugin += '<a href="http://www.microsoft.com/windows/windowsmedia/">» Download WMP</a><br />'; } plugin += '<a href="http://retro-radio.net/plugin/setup_AAC_aacPlus_plugin_1_0_36.exe">» AAC plugin f. WMP</a>'; --- NEW FILE: getinfo.php --- <?php /** * * @package mxBB Portal Module - mx_shotcast * @version $Id: getinfo.php,v 1.1 2008/04/29 02:39:49 orynider Exp $ * @copyright (c) 2002-2006 [OryNider] mxBB Development Team * @license http://opensource.org/licenses/gpl-license.php GNU General Public License v2 * */ if( !defined('IN_PORTAL')) { die("Hacking attempt"); } // //starting config.php section // $autoplay = true; //$accplugin = 'http://' . $_SERVER['SERVER_NAME'] . substr($_SERVER['PHP_SELF'], 0, -strlen(basename(__FILE__))) . 'install/setup_AAC_aacPlus_plugin.exe'; //$accplugin = 'http://retro-radio.net/plugin/setup_AAC_aacPlus_plugin_1_0_36.exe'; $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 $stream_type = $shotcast_config['stream_type']; //Stream type: aac or mp3 $station_name = "Shotcast Radio"; // Radio Station Name (for the no pass version) $force_no_playlist = true; $radio_skin = isset($_GET['skin']) ? $_GET['skin'] : $shotcast_config['skin']; @define('SKIN', $radio_skin); // //ends config.php section // $errno = 0; $errstr = ''; $connect_timeout = 5; //$radio = new radio($scip, $scport); if (@phpversion() >= '5.0.0') { //$open = fsockopen($scip, $scport, &$errno, &$errstr, $connect_timeout); //open connection $open = @fsockopen($scip, $scport); //open connection if(!$open) { //if connection could not be made @fclose($open); $text = array(); if ($force_online == 1) { $text[1] = '1,1,4,32,1,128,Unknon Artist'; $text = explode(",",$text[1]); } $er = '<p>' . $lang['Socket_functions_disabled'] . '</p>'; } else { //@fputs($open,"GET /7.html HTTP/1.1\r\nHost:" . $scip . ":" . $scport . "\r\nUser-Agent: SHOUTcast DNAS Status [7] * XML Getter (Mozilla Compatible)\r\nConnection: close\r\n\r\n"); //get 7.html @fputs($open,"GET /7.html HTTP/1.1\r\nUser-Agent:Mozilla\r\n\r\n"); $read = @fread($open, 1000); $text = explode("content-type:text/html", $read); $text = explode(",",$text[1]); @fclose($open); } } else { $text = array(); $er = '<p> Old php version! </p>'; } /* $scfp = fsockopen($scip, $scport, &$errno, &$errstr, $connect_timeout); if (!$scfp) { $scsuccs = 1; } */ $scfp = @fsockopen($scip, $scport); $scsuccs = ($scfp) ? '' : 1; if ($scfp) { @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] == STREAMSTATUS || $loop[$y] == BITRATE || $loop[$y] == SERVERTITLE || $loop[$y] == SERVERGENRE || $loop[$y] == CURRENTLISTENERS || $loop[$y] == MAXLISTENERS || $loop[$y] == SONGURL || $loop[$y] == SERVERURL || $loop[$y] == SONGTITLE || $loop[$y] == REPORTEDLISTENERS) { $$scphp = urldecode($$scphp); } $y++; } $pageed = ereg_replace(".*<SONGHISTORY>", "", $page); $pageed = ereg_replace("</SONGHISTORY>.*", "", $pageed); $songatime = explode("<SONG>", $pageed); //$streamstatus = ereg_replace(".*<STREAMSTATUS>", "", $page); //$streamstatus = ereg_replace("</STREAMSTATUS>.*", "", $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); $text[1] = ($text[1] == 1) ? $text[1] : $streamstatus; //$text[2] = !empty($text[2]) ? $text[2] : $currentlisteners; $text[3] = !empty($text[3]) ? $text[3] : $maxlisteners; $text[5] = !empty($text[5]) ? $text[5] : $bitrate; } else { $shoutcastserver = $station = $servertitle = $station_name; $currentlisteners = "Unknon"; $bitrate = "Unknon"; $text[6] = $song[0] = "Unknon Artist"; $maxlisteners = "Unknon"; $servergenre = $lang['Socket_functions_disabled']; $songurl = "Unknon"; $serverurl = "Unknon"; $reportedlisteners = "Unknon"; $er = '<p>' . $lang['Socket_functions_disabled'] . '</p>'; } /** * radio.class is a stand-alone php class for ShoutCast Servers that obtains informations about the server. * USAGE: * $variable = new radio(HOST, PORT); - Construct the Object. ie. - new radio($SERVER_NAME, 8000); * $variable->host - Get server host. (INT) * $variable->port - Get server port. (INT) * $variable->stat - Status if server is on/off (INT, 1=on, 0=off) * $variable->bitrate - Bitrate of streaming audio. (INT) * $variable->listners - Listners. (INT) * $variable->station - Radiostation name (STRING) * $variable->genre - Streamers selected genre. (STRING) * $variable->song - Current song. (STRING) * $variable->played - Last played songs (ARRAY[STRING]) * * @author Niklas Pull * @created 2008-02-04, Sweden * * Keep the autor tag in order to use or distrubutate this php class, */ class radio { var $host; var $port; var $stat = 0; var $rawdata; var $c = 0; var $errno; var $errstr; /** * Constructor for radio class. * @param $host Server Host. * @param $port Server Port */ function radio($host, $port) { $this->host = $host; $this->port = $port; $this->rawdata = $this->getServerData("index.html"); $this->stat = $this->servStat(); } /** * Collecting raw data from ShoutCast server. * @param $source From where to collect data. * @return An array with each row. */ function getServerData($source) { $fp = @fsockopen($this->host, $this->port, $errno, $errstr, 10); if (!$fp) { return; } else { @fputs($fp, "GET /$source HTTP/1.1\r\n"); @fputs($fp, "Host: $this->host\r\n"); @fputs($fp, "User-Agent: SHOUTcast Song Status (Mozilla Compatible)\r\n\r\n"); @fputs($fp, "Connection: close\r\n\r\n"); while (!feof($fp)) { $buf .= fgets($fp,128); } @fclose($fp); return explode("\t", strip_tags(str_replace(array("</td>", "</tr>", "Current Song"), array("\t", "\t", " Current Song"), $buf))); } } /** * @return An integer, 1 if the server is streaming otherwise 0. */ function servStat() { $i = 0; while ($i < count($this->rawdata)) { $this->rawdata[$i] = trim($this->rawdata[$i]); if (strstr($this->rawdata[$i], "Server Status:")) { $tmp = explode(" ", $this->rawdata[$i+1]); return ($tmp[3] == "up") ? "1" : "0"; } $i++; } return 0; } /** * @return An integer representing the bitrate of the streaming. */ function bitrate() { $i = 0; if($this->stat != 1) { return 0; } while ($i < count($this->rawdata)) { $this->rawdata[$i] = trim($this->rawdata[$i]); if (strstr($this->rawdata[$i], "Stream Status:")) { $bitr = explode(" ", $this->rawdata[$i+1]); return $bitr[4]; } $i++; } } /** * @return An integer of how many listners. */ function listners() { $i = 0; if($this->stat != 1) { return 0; } while ($i < count($this->rawdata)) { $this->rawdata[$i] = trim($this->rawdata[$i]); if (strstr($this->rawdata[$i], "Stream Status:")) { $listn = explode(" ", $this->rawdata[$i+1]); return $listn[7]; } $i++; } } /** * @return A string representing the Stream title. */ function station() { $i = 0; if($this->stat != 1) { return; } while ($i < count($this->rawdata)) { $this->rawdata[$i] = trim($this->rawdata[$i]); if (strstr($this->rawdata[$i], "Stream Title:")) { return $this->rawdata[$i+1]; } $i++; } } /** * @return The mime-type of the stream */ function mimeType() { $i = 0; if($this->stat != 1) { return; } while ($i < count($this->rawdata)) { $this->rawdata[$i] = trim($this->rawdata[$i]); if (strstr($this->rawdata[$i], "Content Type:")) { return $this->rawdata[$i+1]; } $i++; } } /** * @return The streaming genre. */ function genre() { $i = 0; if($this->stat != 1){ return; } while ($i < count($this->rawdata)) { $this->rawdata[$i] = trim($this->rawdata[$i]); if (strstr($this->rawdata[$i], "Stream Genre:")) { return $this->rawdata[$i+1]; } $i++; } } /** * @return A string with the current song playing on the stream. */ function song(){ $i = 0; if($this->stat != 1){ return; } if($this->c != 0){ return trim($this->rawdata[$this->c]); } while ($i < count($this->rawdata)) { $this->rawdata[$i] = trim($this->rawdata[$i]); if (strstr($this->rawdata[$i], "Current Song:")) { $this->c = $i+1; return $this->rawdata[$i+1]; } $i++; } } /** * @return An array with Strings of every previous played song, the lenght is set inte the .ini file for the ShoutCast server. */ function played() { $played = array(); $i = 0; if($this->stat != 1) { return; } $raw_played = $this->getServerData("played.html"); while ($i < count($raw_played)) { $raw_played[$i] = trim($raw_played[$i]); if (strstr($raw_played[$i], "Current Song")) { $i=$i+3; break; } $i++; } $j=0; while ($raw_played[$i-1] != "") { $played[$j] = $raw_played[$i]; $i=$i+2; $j++; } return $played; } } $radio = new radio($scip, $scport); $mimetype = ''; if ($radio->mimeType()) { $mimetype = $radio->mimeType(); } else { $mimetype = ($stream_type == 'mp3') ? 'audio/mpeg' : 'audio/aacp'; } // The "i" after the pattern delimiter indicates a case-insensitive search if (preg_match("/Unauthorized/", $servertitle)) { $servertitle = $station_name; } if($radio->station()) { $stream_title = $radio->station(); } else { $stream_title = $servertitle; } if (preg_match("/Unauthorized/", $servergenre)) { $servergenre = $radio->genre(); } if (preg_match("/Unauthorized/", $songurl)) { $songurl = ""; } if (preg_match("/Unauthorized/", $serverurl)) { $serverurl = $lang['require_password']; } //Check for reported listeners if (preg_match("/Unauthorized/", $reportedlisteners)) { $reportedlisteners = $lang['require_password']; } //Check for max listeners if (preg_match("/Unauthorized/", $maxlisteners)) { $maxlisteners = $text[3]; } //Check for curent listeners if($radio->listners()) { if (is_numeric($currentlisteners)) { if ($currentlisteners < $radio->listners()) { $currentlisteners = $radio->listners(); } //Else return value from admin.cgi //Validate admin.cgi $shotcast_admin = true; } else { $currentlisteners = $radio->listners(); } //now compare $currentlisteners with value from 7.html if (is_numeric($text[2])) { if (($currentlisteners < $text[2])) { $currentlisteners = $text[2]; } //Validate 7.html $shotcast_stats = true; } if ((($shotcast_admin)&& ($shotcast_stats)) || (mt_rand(0, 3) === 1)) { $listeners_array = array(); $listeners_array[0] = $currentlisteners; $listeners_array[1] = $radio->listners(); $listeners_array[2] = $text[2]; $listeners_array[3] = $currentlisteners; $currentlisteners = $listeners_array[mt_rand(0, 3)]; } } elseif (preg_match("/^[a-zA-Z\-\'\ ]+$/", $text[2])) { $currentlisteners = $text[2]; } elseif (preg_match("/Unauthorized/", $currentlisteners)) { $currentlisteners = 'n/a'; } //Check for curent song if($radio->song()) { $curentsong = $radio->song(); } elseif (preg_match("/^[a-zA-Z\-\'\ ]+$/", $text[6])) { $curentsong = $text[6]; } elseif (($song[0]) || !(preg_match("/Unauthorized/", $song[0]))) { $curentsong = $song[0]; } else { $curentsong = $lang['Unknown_Artist']; } if($radio->genre()) { $stream_genre = $radio->genre(); } else { $stream_genre = $lang['Unknown']; } //Check for curent bitrate if($radio->bitrate()) { $bitrate = $radio->bitrate(); } elseif (preg_match("/^[a-zA-Z\-\'\ ]+$/", $text[5])) { $bitrate = $text[5]; } elseif (preg_match("/Unauthorized/", $bitrate)) { $bitrate = 'n/a'; } $wmpmode = ($mimetype !== 'audio/aacp') ? 'http://' : 'icyx://'; // AAC VS MPEG $wmplist = '/' . $playlist; $protocol_type = ($mimetype !== 'audio/aacp') ? 'http' : 'icyx'; $streamdest = $protocol_type . "://" . $scip . ":" . $scport . "/" . $playlist; $accplugin = 'http://retro-radio.net/plugin/setup_AAC_aacPlus_plugin_1_0_36.exe'; $ff2pluginspace = ($mimetype !== 'audio/aacp') ? 'http://port25.technet.com/videos/downloads/wmpfirefoxplugin.exe' : $accplugin; $wmp7pluginspace = ($mimetype !== 'audio/aacp') ? 'http://www.microsoft.com/isapi/redir.dll?prd=windows&sbp=mediaplayer&ar=Media&sba=Plugin&' : $accplugin; $wmp6pluginspace = ($mimetype !== 'audio/aacp') ? 'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715' : 'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715'; $state = ($text[1] == 1) ? 'Up' : 'Down'; $shotcast_state_icon = ($text[1] == 1) ? 'online.gif' : 'offline.gif'; $text[2] = !empty($text[2]) ? $text[2] : $currentlisteners; $text[3] = !empty($text[3]) ? $text[3] : $maxlisteners; $text[5] = !empty($text[5]) ? $text[5] : $bitrate; $status = isset($_GET['status']) ? $_GET['status'] : 'stop'; $player = isset($_GET['player']) ? $_GET['player'] : 'wmp'; $changeto = ($player == 'real') ? 'wmp' : 'real'; ?> Index: cur_song.php =================================================================== RCS file: /cvsroot/mxbb/mx_shotcast/includes/cur_song.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** cur_song.php 20 Apr 2008 07:21:41 -0000 1.1 --- cur_song.php 29 Apr 2008 02:39:48 -0000 1.2 *************** *** 1,4 **** <?php ! if( !defined('IN_PORTAL') || !is_object($mx_block)) { --- 1,11 ---- <?php ! /** ! * ! * @package Mx-Publisher StandAllone - radioplayer ! * @version $Id$ ! * @copyright (c) 2002-2006 [OryNider] mxBB Development Team ! * @license http://opensource.org/licenses/gpl-license.php GNU General Public License v2 ! * ! */ if( !defined('IN_PORTAL') || !is_object($mx_block)) { *************** *** 41,45 **** define('IN_SHOTCAST', true); require($module_root_path .'includes/common.'.$phpEx); - require($module_root_path . 'getinfo.'.$phpEx); header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); --- 48,51 ---- *************** *** 93,106 **** </HEAD> <body> ! <?php ! if($radio->song()) ! { ! echo '<span style="font-weight : bold;">'.$radio->song().'</span>'; ! } ! else ! { ! echo '<span style="font-weight : bold;">'.$song[0].'</span>'; ! } ! ?> </body> </HTML> \ No newline at end of file --- 99,103 ---- </HEAD> <body> ! <?php echo '<span style="font-weight : bold;">'.$curentsong.'</span>'; ?> </body> </HTML> \ No newline at end of file --- NEW FILE: cur_listeners.php --- <?php /** * * @package Mx-Publisher StandAllone - radioplayer * @version $Id: cur_listeners.php,v 1.1 2008/04/29 02:39:49 orynider Exp $ * @copyright (c) 2002-2006 [OryNider] mxBB Development Team * @license http://opensource.org/licenses/gpl-license.php GNU General Public License v2 * */ if( !defined('IN_PORTAL') || !is_object($mx_block)) { define('IN_PORTAL', true); $mx_root_path = "../../../"; $module_root_path = "./../"; $phpEx = substr(strrchr(__FILE__, '.'), 1); include_once($mx_root_path . 'common.'.$phpEx); // // Start session management // $mx_user->init($user_ip, PAGE_INDEX); // // End session management // $title = 'Media Player Radio'; $block_size = ( isset($block_size) && !empty($block_size) ? $block_size : '315' ); $is_block = FALSE; } else { // // Read block Configuration // $title = $mx_block->block_info['block_title']; $block_size = ( isset($block_size) && !empty($block_size) ? $block_size : '100%' ); if( is_object($mx_block)) { $is_block = TRUE; } } define('IN_SHOTCAST', true); require($module_root_path .'includes/common.'.$phpEx); header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); header('Cache-Control: no-store, no-cache, must-revalidate'); header('Cache-Control: post-check=0, pre-check=0', false); header('Pragma: no-cache'); ?> <HTML> <HEAD> <META http-equiv="pragma" content="no-cache"> <META HTTP-EQUIV="refresh" CONTENT="159"> <META name="robots" content="noindex"> <script> <!-- /* Auto Refresh Page with Time script By JavaScript Kit (javascriptkit.com) Over 200+ free scripts here! */ //enter refresh time in "minutes:seconds" Minutes should range from 0 to inifinity. Seconds should range from 0 to 59 var limit="1:59" if (document.images){ var parselimit=limit.split(":") parselimit=parselimit[0]*60+parselimit[1]*1 } function beginrefresh(){ if (!document.images) return if (parselimit==1) window.location.reload() else{ parselimit-=1 curmin=Math.floor(parselimit/60) cursec=parselimit%60 if (curmin!=0) curtime=curmin+" minutes and "+cursec+" seconds left until page refresh!" else curtime=cursec+" seconds left until page refresh!" window.status=curtime setTimeout("beginrefresh()",15900) } } window.onload=beginrefresh //--> </script> </HEAD> <body> <?php echo '<span style="font-weight : bold;">' . $currentlisteners . '</span>'; ?> </body> </HTML> --- NEW FILE: cur_display.php --- <?php /** * * @package Mx-Publisher StandAllone - radioplayer * @version $Id: cur_display.php,v 1.1 2008/04/29 02:39:48 orynider Exp $ * @copyright (c) 2002-2006 [OryNider] mxBB Development Team * @license http://opensource.org/licenses/gpl-license.php GNU General Public License v2 * */ if( !defined('IN_PORTAL') || !is_object($mx_block)) { define('IN_PORTAL', true); $mx_root_path = "../../../"; $module_root_path = "./../"; $phpEx = substr(strrchr(__FILE__, '.'), 1); include_once($mx_root_path . 'common.'.$phpEx); // // Start session management // $mx_user->init($user_ip, PAGE_INDEX); // // End session management // $title = 'Media Player Radio'; $block_size = ( isset($block_size) && !empty($block_size) ? $block_size : '315' ); $is_block = FALSE; } else { // // Read block Configuration // $title = $mx_block->block_info['block_title']; $block_size = ( isset($block_size) && !empty($block_size) ? $block_size : '100%' ); if( is_object($mx_block)) { $is_block = TRUE; } } define('IN_SHOTCAST', true); require($module_root_path .'includes/common.'.$phpEx); header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); header('Cache-Control: no-store, no-cache, must-revalidate'); header('Cache-Control: post-check=0, pre-check=0', false); header('Pragma: no-cache'); ?> <HTML> <HEAD> <META http-equiv="pragma" content="no-cache"> <META HTTP-EQUIV="refresh" CONTENT="159"> <META name="robots" content="noindex"> <script> <!-- /* Auto Refresh Page with Time script By JavaScript Kit (javascriptkit.com) Over 200+ free scripts here! */ //enter refresh time in "minutes:seconds" Minutes should range from 0 to inifinity. Seconds should range from 0 to 59 var limit="1:59" if (document.images){ var parselimit=limit.split(":") parselimit=parselimit[0]*60+parselimit[1]*1 } function beginrefresh(){ if (!document.images) return if (parselimit==1) window.location.reload() else{ parselimit-=1 curmin=Math.floor(parselimit/60) cursec=parselimit%60 if (curmin!=0) curtime=curmin+" minutes and "+cursec+" seconds left until page refresh!" else curtime=cursec+" seconds left until page refresh!" window.status=curtime setTimeout("beginrefresh()",15900) } } window.onload=beginrefresh //--> </script> </HEAD> <body> <?php echo '<span style="font-weight : bold;">' . $curentsong . ' <sup CLASS="exponent">*</sup> ' . $currentlisteners . ' ' . $lang['listeners'] . ' <sup CLASS="exponent">*</sup> Genre: ' . $stream_genre . ' <sup CLASS="exponent">*</sup> ' . $stream_title . ' <sup CLASS="exponent">***</sup> </span>'; ?> </body> </HTML> Index: common.php =================================================================== RCS file: /cvsroot/mxbb/mx_shotcast/includes/common.php,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** common.php 20 Apr 2008 07:21:40 -0000 1.8 --- common.php 29 Apr 2008 02:39:48 -0000 1.9 *************** *** 122,142 **** $radio_bot_id = ANONYMOUS; - if (($userdata['user_id'] != ANONYMOUS) && defined('ONLINE_ADV_SESSION_TABLE')) - { - if($this_agent) - { - $nick = $this_agent; - } - - if ($this_bot_id) - { - $radio_bot_id = $this_bot_id; - } - } - // ================================================================================ // [ SHOTCAST CONFIG ] // ================================================================================ // // Get radio Settings from config table --- 122,131 ---- $radio_bot_id = ANONYMOUS; // ================================================================================ // [ SHOTCAST CONFIG ] // ================================================================================ + $shotcast_config = array(); + // // Get radio Settings from config table *************** *** 146,153 **** $shotcast_config = $mx_cache->get('shotcast_config'); } ! else if(defined('IN_SHOTCAST')) { - $shotcast_config = array(); - $sql = "SELECT * FROM " . SHOTCAST_CONFIG_TABLE; --- 135,140 ---- $shotcast_config = $mx_cache->get('shotcast_config'); } ! else { $sql = "SELECT * FROM " . SHOTCAST_CONFIG_TABLE; *************** *** 176,182 **** --- 163,188 ---- } + $shotcast_config['skin'] = 'aero'; + //read check period $period = $shotcast_config['check_period'] * 1000; + if ($userdata['user_id'] == ANONYMOUS) + { + if($this_agent) + { + $nick = $this_agent; + } + else + { + $nick = $shotcast_config['guestname']; + } + + if ($this_bot_id) + { + $radio_bot_id = $this_bot_id; + } + } + // ================================================================================ // [ COMMON FUNCTIONS ] *************** *** 258,261 **** --- 264,270 ---- } + //require($module_root_path . 'includes/config.'.$phpEx); + require($module_root_path . 'includes/getinfo.'.$phpEx); + // REMOVE OLD SESSIONS drop_shotcast_users($period); |