|
From: Florin C B. <ory...@us...> - 2013-05-29 04:34:05
|
Update of /cvsroot/mxbb/mx_shotcast In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv28026 Modified Files: ShotCast.pak shotcast_front.php shotcast_last10.php shotcast_stats.php Log Message: the other blocks for mx_shotcast page Index: shotcast_front.php =================================================================== RCS file: /cvsroot/mxbb/mx_shotcast/shotcast_front.php,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** shotcast_front.php 28 May 2013 07:14:33 -0000 1.10 --- shotcast_front.php 29 May 2013 04:34:03 -0000 1.11 *************** *** 20,24 **** // //error_reporting( E_ALL ); ! @ini_set( 'display_errors', '1' ); // -------------------------------------------------------------------------------- --- 20,24 ---- // //error_reporting( E_ALL ); ! //@ini_set( 'display_errors', '1' ); // -------------------------------------------------------------------------------- *************** *** 215,219 **** // $template->set_filenames(array( ! 'body' => 'shotcast_front.tpl') ); --- 215,219 ---- // $template->set_filenames(array( ! 'front_body' => 'shotcast_front.tpl') ); *************** *** 276,286 **** ); ! $template->pparse('body'); // REMOVE OLD SESSIONS ! drop_shotcast_users($period); ! unset($liteners, $sql, $howmanylisten, $listeners_list, $block_size, $module_root_path, $isimler, $can_listen); ?> \ No newline at end of file --- 276,286 ---- ); ! $template->pparse('front_body'); // REMOVE OLD SESSIONS ! //drop_shotcast_users($period); ! //unset($liteners, $sql, $howmanylisten, $listeners_list, $block_size, $module_root_path, $isimler, $can_listen); ?> \ No newline at end of file Index: shotcast_stats.php =================================================================== RCS file: /cvsroot/mxbb/mx_shotcast/shotcast_stats.php,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** shotcast_stats.php 28 May 2013 07:14:33 -0000 1.8 --- shotcast_stats.php 29 May 2013 04:34:03 -0000 1.9 *************** *** 13,17 **** // //error_reporting( E_ALL ); ! @ini_set( 'display_errors', '1' ); // -------------------------------------------------------------------------------- --- 13,17 ---- // //error_reporting( E_ALL ); ! //@ini_set( 'display_errors', '1' ); // -------------------------------------------------------------------------------- *************** *** 22,25 **** --- 22,27 ---- { die("Hacking attempt"); + $module_root_path = "./"; + $phpEx = substr(strrchr(__FILE__, '.'), 1); } *************** *** 34,92 **** include_once($module_root_path . 'includes/common.'.$phpEx); ! $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; ! $song[0] = !empty($song[0]) ? $song[0] : $title; ! // // 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.'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); ?> \ No newline at end of file --- 36,94 ---- include_once($module_root_path . 'includes/common.'.$phpEx); ! $shotcast_state_icon = ($state == 'Up') ? 'online.gif' : 'offline.gif'; // // Read block Configuration // // $block_config = read_block_config($block_id); ! $block_title = $mx_block->block_info['block_title']; ! $b_description = $mx_block->block_info['block_desc']; ! $block_size = $mx_block->block_info['block_size']; ! $block_id = $mx_block->block_info['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('statsbody' => 'shotcast_stats.tpl')); $template->assign_vars(array( ! 'SHOTCAST_STATE_IMG' => $module_root_path ."skins/".SKIN."/".$shotcast_state_icon, 'L_STATION' => $lang['Stats_for'], ! 'S_STATION' => $server_name, 'L_STATE' => $lang['Server_state'], 'S_STATE' => $state, 'L_SERVER_TITLE' => $lang['Station'], ! 'S_SERVER_TITLE' => $server_description, 'L_SONG' => $lang['Current_song'], ! 'S_SONG' => $title, 'L_BITRATE' => $lang['Bitrate'], ! 'S_BITRATE' => $bitrate, 'L_PEAK_LISTENERS' => $lang['Listeners_peak'], ! 'S_PEAK_LISTENERS' => $currentlisteners, 'L_MAX_LISTENERS' => $lang['Max_listeners'], ! 'S_MAX_LISTENERS' => $maxlisteners, 'L_SERVERGENRE' => $lang['Server_genre'], ! 'S_SERVERGENRE' => $stream_genre, 'L_SONGURL' => $lang['Stream_URL'], ! 'S_STREAMURL' => $no_cover_url, ! 'S_SONGURL' => aws_getInfo($artist, $song, 'track', 'url_info', $no_cover_url, false), ! 'S_SERVERURL' => $server_url, 'L_REPORTEDLISTENERS' => $lang['Unique'], ! 'S_REPORTEDLISTENERS' => $peaklisteners, 'BLOCK_SIZE' => $block_size, 'BLOCK_ID' => $block_id, ! 'L_TITLE' => $block_title,) ); ! //$mimetype = ""; ! //$server_description = ""; ! //$quality = ""; ! //$video_quality = ""; ! //$frame_size = ""; ! //$frame_rate = ""; ! //$server_url = ""; ! //$artist = ""; ! ! $template->pparse('statsbody'); ?> \ No newline at end of file Index: shotcast_last10.php =================================================================== RCS file: /cvsroot/mxbb/mx_shotcast/shotcast_last10.php,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** shotcast_last10.php 28 May 2013 07:14:33 -0000 1.8 --- shotcast_last10.php 29 May 2013 04:34:03 -0000 1.9 *************** *** 21,25 **** if( !defined('IN_PORTAL') || !is_object($mx_block)) { ! die("Hacking attempt"); } --- 21,27 ---- if( !defined('IN_PORTAL') || !is_object($mx_block)) { ! //die("Hacking attempt"); ! $module_root_path = "./"; ! $phpEx = substr(strrchr(__FILE__, '.'), 1); } *************** *** 60,65 **** */ ! $caster_ip = $shotcast_config['shotcast_host']; // IP adress or domain ! $caster_port = $shotcast_config['shotcast_port']; // Port if( empty($lang['Before_that_you_heard']) && empty($lang['Now_Playing']) ) --- 62,67 ---- */ ! //$caster_ip = $shotcast_config['shotcast_host']; // IP adress or domain ! //$caster_port = $shotcast_config['shotcast_port']; // Port if( empty($lang['Before_that_you_heard']) && empty($lang['Now_Playing']) ) *************** *** 73,78 **** // 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 --- 75,81 ---- // The lastN is configurable at the DNAS with, ShowLastSongs= it defaults to 10 and has a maximum of 20 ! $n = 10; ! $t_max = $n; ! if (!$t_max || $t_max < 1 || $t_max > 19) $t_max = 10; //19 is the max here because 20=current_track+19 *************** *** 83,161 **** $success=0; ! ! if (@phpversion() >= '5.0.0' && ($text[1] == 1)) { $state = "Up"; } else { $state = "Down"; } if (@phpversion() < '5.0.0') { $state = "Up"; } ! ! $fp1 = @fsockopen($caster_ip, $caster_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:" . $caster_ip . ":" . $caster_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($caster_ip, $caster_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: " . $caster_ip . ":" . $caster_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... --- 86,147 ---- $success=0; + if(empty($caster_internal_ip)) + { + $shout_caster_ip = $caster_ip; + $shout_caster_port = $caster_port; + } + else + { + $shout_caster_ip = $caster_internal_ip; + $shout_caster_port = $caster_internal_port; + } ! if (@phpversion() >= '5.0.0') { $state = "Up"; } else { $state = "Down"; } if (@phpversion() < '5.0.0') { $state = "Up"; } ! $song00 = $currentsong; ! //$fp1 = @fsockopen($shout_caster_ip, $shout_caster_port, $errno, $errstr, 5); //open connection ! $fp = @fsockopen($shout_caster_ip, $shout_caster_port, $errno, $errstr, 5); //open connection ! if(!$fp) ! { ! //if connection could not be made ! @fclose($fp); ! //$success++; } ! else { ! @fputs($fp, "GET /played.html HTTP/1.0\r\nUser-Agent: SHOUTcast DNAS Status Getter (Mozilla Compatible)\r\n\r\n"); ! $page = ""; ! while(!feof($fp)) ! { ! $page .= fgets($fp, 1000); ! } ! $page = preg_replace("~.*Server Status:~", "", $page); //extract data ! $page = preg_replace("~</b></td></tr></table><br>.*~", "", $page); //extract data ! $page_array = preg_split('~(</?[^>]+>)~' , $page, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); ! $played_html = $page; ! if ($played_html) { ! $played_html = preg_replace('~<x>~','|-|', preg_replace('~</tr>~','', preg_replace('~</td><td>~','<x>', preg_replace('~<tr><td>~','', preg_replace('~</tr>~', '</tr>' . $lf, preg_replace('~-->~','--]', preg_replace('~<!--~','[!--', preg_replace('~</table><br><br>.*~','', preg_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++; } ! } ! } ! @fclose($fp); //close connection ! // I now have $track[0-N] containg the current plus last N tracks... // Output time... *************** *** 204,210 **** <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>'; --- 190,196 ---- <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>'; *************** *** 212,216 **** else { ! $output_string .= str_replace("'", "'",str_replace('"', '"',$track[$r])) . '<br>'; } $r++; --- 198,202 ---- else { ! $output_string .= str_replace("'", "'",str_replace('"', '"', @$track[$r])) . '<br>'; } $r++; *************** *** 239,243 **** while ($r <= $t_max) { ! if ($r==0) { $output_string .= '<tr><td vAlign=top> ' . $lang['Before_that_you_heard'] . ' :</i><br><br>'; --- 225,229 ---- while ($r <= $t_max) { ! if ($r == 0) { $output_string .= '<tr><td vAlign=top> ' . $lang['Before_that_you_heard'] . ' :</i><br><br>'; Index: ShotCast.pak =================================================================== RCS file: /cvsroot/mxbb/mx_shotcast/ShotCast.pak,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ShotCast.pak 28 May 2013 07:14:33 -0000 1.2 --- ShotCast.pak 29 May 2013 04:34:03 -0000 1.3 *************** *** 9,17 **** block=+:=+:StreamCast Last 10=+:Demo block=+:87=+:0=+:5=+:0=+:0=+:0=+:0=+:1=+:1 New_function=+:---------------------------=+:0=+:0=+:0=+:0=+:0 ! function=+:71=+:88=+:Shotcast Stats=+:StreamCast Statinstics Block =+:shotcast_stats.php=+: parameter=+:0=+:0=+:0=+:endoflist=+:0=+:0 block=+:=+:StreamCast Stats=+:Demo block=+:88=+:0=+:5=+:0=+:0=+:0=+:0=+:1=+:1 New_function=+:---------------------------=+:0=+:0=+:0=+:0=+:0 ! function=+:71=+:89=+:Radio Player=+:Radio Player or Index=+:radioplayer.php=+: parameter=+:0=+:0=+:0=+:endoflist=+:0=+:0 block=+:=+:Radio Player=+:Demo block=+:89=+:0=+:5=+:0=+:0=+:0=+:0=+:1=+:1 --- 9,17 ---- block=+:=+:StreamCast Last 10=+:Demo block=+:87=+:0=+:5=+:0=+:0=+:0=+:0=+:1=+:1 New_function=+:---------------------------=+:0=+:0=+:0=+:0=+:0 ! function=+:71=+:88=+:Stream Stats=+:Stream Stats =+:shotcast_stats.php=+: parameter=+:0=+:0=+:0=+:endoflist=+:0=+:0 block=+:=+:StreamCast Stats=+:Demo block=+:88=+:0=+:5=+:0=+:0=+:0=+:0=+:1=+:1 New_function=+:---------------------------=+:0=+:0=+:0=+:0=+:0 ! function=+:71=+:89=+:Radio Player=+:Radio Player=+:radioplayer.php=+: parameter=+:0=+:0=+:0=+:endoflist=+:0=+:0 block=+:=+:Radio Player=+:Demo block=+:89=+:0=+:5=+:0=+:0=+:0=+:0=+:1=+:1 |