|
From: Florin C B. <ory...@us...> - 2013-07-03 04:30:07
|
Update of /cvsroot/mxbb/mx_radio/includes In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv25055/includes Modified Files: common.php Added Files: cast_functions.php cd_cover_getter.php css.php cur_display.php cur_listeners.php cur_picture.php cur_song.php cur_url.php getinfo_ice.php getinfo_shout.php index.htm index.html java_script.php Log Message: --- NEW FILE: index.html --- <HTML><HEAD> <META http-equiv="Content-Type" content="text/html; charset=iso-8859-2"> <META name="GENERATOR" content="3D Editor 1.03 Copyright (c) 2003 by Albu Cristian"> <META name="robots" content="INDEX, FOLLOW"> <TITLE>Index of /radioplayer/v4/includes</TITLE> </HEAD> <BODY text="#FCFCFC" bgcolor="#0055AA" link="#147AEB" vlink="#144ABB" alink="#14FFBB"> <H1><HR><CENTER>Index of /radioplayer/v4/includes<P>Last Updated: Saturday, May 11th, 2013</CENTER><HR></H1><P><TABLE WIDTH=100%> <TD WIDTH=20% BGCOLOR=#147AEB><FONT COLOR=#EB8514><B>File name</B></FONT> <TD WIDTH=10% BGCOLOR=#005ACB><FONT COLOR=#EB8514><B>Size</B></FONT> <TD WIDTH=20% BGCOLOR=#003AAB><FONT COLOR=#EB8514><B>Last update</B></FONT> <TD WIDTH=50% BGCOLOR=#001A8B><FONT COLOR=#EB8514><B>Description</B></FONT></TR> <TR VALIGN=TOP><TD><A HREF="../index.html">[..]</A><TD ALIGN=CENTER><DIR><TD ALIGN=CENTER>5/11/2013, 16:3<TD>Parent directory <TR VALIGN=TOP><TD><A HREF="cd_cover_getter.php">cd_cover_getter.php</A><TD ALIGN=RIGHT>2,272<TD ALIGN=CENTER>11/22/2008, 0:10<TD> <TR VALIGN=TOP><TD><A HREF="common.php">common.php</A><TD ALIGN=RIGHT>6,035<TD ALIGN=CENTER>3/3/2011, 0:57<TD> <TR VALIGN=TOP><TD><A HREF="css.php">css.php</A><TD ALIGN=RIGHT>3,977<TD ALIGN=CENTER>11/22/2008, 0:9<TD> <TR VALIGN=TOP><TD><A HREF="cur_display.php">cur_display.php</A><TD ALIGN=RIGHT>2,653<TD ALIGN=CENTER>11/22/2008, 0:9<TD> <TR VALIGN=TOP><TD><A HREF="getinfo_ice.php">getinfo_ice.php</A><TD ALIGN=RIGHT>5,313<TD ALIGN=CENTER>2/17/2009, 19:39<TD> <TR VALIGN=TOP><TD><A HREF="getinfo_shout.php">getinfo_shout.php</A><TD ALIGN=RIGHT>3,106<TD ALIGN=CENTER>3/3/2011, 0:44<TD> <TR VALIGN=TOP><TD><A HREF="java_script.php">java_script.php</A><TD ALIGN=RIGHT>19,746<TD ALIGN=CENTER>12/27/2008, 1:9<TD> </TABLE><P ALIGN=RIGHT><SMALL>There are 7 files and 1 directories<BR ALIGN=RIGHT>for a total of 43102 bytes.</SMALL></BODY> </HTML> --- NEW FILE: getinfo_shout.php --- <?php /** * * @package StandAllone - Radiplayer. * @version $Id: getinfo_shout.php,v 1.1 2013/07/03 04:30:04 orynider Exp $ * @copyright (c) 2006-2013 Little Frog, FlorinCB [aka OryNider], drknas * @license http://opensource.org/licenses/gpl-license.php GNU General Public License v2 * // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License // as published by the Free Software Foundation; either version 2 // of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ // History: // Little Frog (v 1.x - 2.x) // OryNider (v 1.x - 3.x) // DrKnas (Current maintainer v 4.0 -) if( !defined('IN_PORTAL') ) { die( "Hacking attempt(shout)" ); } $errno = "0"; $errstr = ""; $connect_timeout = "5"; $state = ""; $currentsong = ""; $currentlisteners = ""; $maxlisteners = ""; $mimetype = ""; $stream_genre = ""; $bitrate = ""; $peaklisteners = ""; $server_name = ""; $server_description = ""; $quality = ""; $video_quality = ""; $frame_size = ""; $frame_rate = ""; $server_url = ""; $artist = ""; $stream_title = ""; 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; } $stream_url = $server_url = "http://".$shout_caster_ip.":".$shout_caster_port; #error_reporting(0); $fp = @fsockopen($shout_caster_ip, $shout_caster_port, $errno, $errstr, 5); if(!$fp) { $data = @file_get_contents("http://".$shout_caster_ip.":".$shout_caster_port."/2XS/?format=csv"); if(!$data) { $data = @file_get_contents("http://".$shout_caster_ip.":".$shout_caster_port."/index.html"); } if(!$data) { $state = "Down"; $peaklisteners = 1; $bitrate = "56"; $stream_title = "Stream"; $currentsong = "Track"; //$mimetype = "audio/mpeg"; $lang['Off_Air'] = $lang['Socket_functions_disabled']; } else { $state = "Up"; //Shoutcast Name $regex = '/Shoutcast-Name:(.*)/'; @preg_match($regex, $data, $name); $nameclean = str_replace("%20", " ", $name[1]); //var_dump($name); //echo $name[1]; //Ascoltatori $regex = '/Listeners:(.*)\/(.*)/'; preg_match($regex, $data, $peaklisteners); //var_dump($peaklisteners); //echo $peaklisteners[1]; //echo $peaklisteners[2]; //Bitrate $regex = '/Shoutcast-Bitrate:(.*)/'; preg_match($regex, $data, $bitrate); //var_dump($bitrate); //echo $bitrate[1]; //mimetype $regex = '/Content Type:(.*)/'; preg_match($regex, $data, $mimetype); //Genere $regex = '/Shoutcast-Genre:(.*)/'; preg_match($regex, $data, $stream_genre); //var_dump($stream_genre); //echo $stream_genre[1]; //$server_url $regex = '/Stream-URL:(.*)/'; preg_match($regex, $data, $stream_url); //var_dump($server_url); //echo $server_url[1]; //currentsong $regex = '/Current Song:(.*)/'; preg_match($regex, $data, $currentsong); //Stream Title NOT WORKING NOW! $regex = '/Shoutcast-StreamTitle:(.*)/'; preg_match($regex, $data, $stream_title); //var_dump($stream_title); //echo $stream_title[1]; // ADD Current Song: $stream_title[1] } } else { fputs($fp, "GET /index.html HTTP/1.0\r\nUser-Agent: XML 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); if(count($page_array) > 10) { for( $i = 0; $i < count( $page_array ); $i++ ) { $state = "Up"; if($page_array[$i] == "Server Status: ") { $server_status = strip_tags($page_array[$i+6]); } if($page_array[$i] == "Stream Status: ") { $bitrate = preg_replace("/ kbps.*/", "", preg_replace("/.*at /", "", $page_array[$i+6])); $currentlisteners = preg_replace("/of.*/", "", $page_array[$i+8]); $maxlisteners = preg_replace("/ listeners.*/", "", preg_replace("/.*of/", "", $page_array[$i+8])); } if($page_array[$i] == "Listener Peak: ") { $peaklisteners = strip_tags($page_array[$i+6]); } if($page_array[$i] == "Stream Title: ") { $stream_title = strip_tags($page_array[$i+6]); } if($page_array[$i] == "Content Type: ") { $mimetype = strip_tags($page_array[$i+6]); } if($page_array[$i] == "Stream Genre: ") { $stream_genre = strip_tags($page_array[$i+6]); } if($page_array[$i] == "Stream URL: ") { $stream_url = strip_tags($page_array[$i+6]); } if($page_array[$i] == "Current Song: ") { $currentsong = strip_tags($page_array[$i+6]); } } } else { $state = $server_status = "Down"; $peaklisteners = 1; $bitrate = "56"; $stream_title = "Stream"; $currentsong = "Track"; $server_url = "http://".$shout_caster_ip.":".$shout_caster_port."/"; //$mimetype = "audio/mpeg"; $lang['Off_Air'] = $lang['Socket_functions_disabled']; } } @fclose($fp); $x = explode(" - ", $currentsong); $artist = !empty($x[0]) ? $x[0] : $currentsong; $song = !empty($x[1]) ? $x[1] : $currentsong; $server_description[1] = sprintf($lang['Description_Status'] ." kbps - ". $lang['listeners'] .": %s", $bitrate, $peaklisteners); $server_description[2] = !empty($server_status) ? $server_status : $stream_title; $server_description[3] = $stream_title; $choice = rand(1, 3); $server_description = $server_description[$choice]; $server_url = !empty($stream_url) ? $stream_url : "http://".$shout_caster_ip.":".$shout_caster_port."/"; // The "i" after the pattern delimiter indicates a case-insensitive search if (preg_match("/Unauthorized/", $stream_title)) { $servertitle = $stream_title = $station_name; } if (preg_match("/Unauthorized/", $stream_genre)) { $servergenre = $stream_genre = "genre"; } if (preg_match("/Unauthorized/", $stream_url)) { $songurl = $stream_url = ""; } if (preg_match("/Unauthorized/", $server_url)) { $serverurl = $server_url = $lang['require_password']; } if (@preg_match("/Unauthorized/", $currentlisteners)) { $currentlisteners = 'n/a'; } if (preg_match("/Unauthorized/", $bitrate)) { $bitrate = 'n/a'; } #error_reporting(E_ALL ^ E_NOTICE); ?> --- NEW FILE: cur_display.php --- <?php /** * * @package StandAllone - Radiplayer. * @version $Id: cur_display.php,v 1.1 2013/07/03 04:30:04 orynider Exp $ * @copyright (c) 2006-2013 Little Frog, FlorinCB [aka OryNider], drknas * @license http://opensource.org/licenses/gpl-license.php GNU General Public License v2 * // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License // as published by the Free Software Foundation; either version 2 // of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ // History: // Little Frog (v 1.x - 2.x) // OryNider (v 1.x - 3.x) // DrKnas (v 4.0 - 4.2.x) // OryNider (Current maintainer: 3.5.x & 4.9.x & mxpcms versions)) @define('_RADIO_CONFIG', true); define('STRIP_URL', (@ini_get('allow_url_fopen')) ? false : true); //fopen_url not allowed $module_root_path = "./../"; $phpEx = substr(strrchr(__FILE__, '.'), 1); require($module_root_path ."includes/common." . $phpEx); //* MX-CMS Code Start if(defined('IN_PORTAL')) { update_radio_users($nick); //Update web listen users } //* MX-CMS Code End if(isset($_GET["skin"])) { $radio_skin = $_GET["skin"]; $module_root_bang = "./"; //Hardcoded for Security } elseif(isset($_GET["style"])) { $radio_skin = $_GET["style"]; $module_root_bang = "./"; //Hardcoded for Security } else { if(empty($radio_skin)) { $radio_skin = "default"; } $module_root_bang = STRIP_URL ? "./" : $module_root_path; } @define('SKIN', $radio_skin); $url_picture = $parsed_xml = "nochange"; $url_info = $caster_url; if(isset($_GET["old_title"])) { $old_title = $_GET["old_title"]; } else { if(empty($old_title)) { $old_title = asc2hex($title); } } //Search: Music; MusicTracks; MP3Downloads; DVD; //$song = "O Jah"; //$artist = "Paul Wilbur"; //$title = (!empty($song) ? trim($song) : trim($title)) . " - " . (!empty($artist) ? trim($artist) : trim($title)); if($picture == "cover") { if(isset($old_title) || STRIP_URL) { //Try site url inside song title $url_info = song_siteInfo($artist, $song, $no_cover_url, 'url_info'); if(($old_title != asc2hex($title)) || STRIP_URL) { //Try Last.FM Api $url_picture = aws_getInfo($artist, $song, 'track', 'url_picture', $url_picture); $url_info = aws_getInfo($artist, $song, 'track', 'url_info', $no_cover_url, false); //Try Amazone Commerce Service Api if ($url_picture === $parsed_xml) { $search = "DigitalMusic"; $parsed_xml = aws_signed_request(array("AssociateTag"=>"knas-20", "Operation"=>"ItemSearch", "SearchIndex"=>$search, "ResponseGroup"=>"Medium,Offers", "Keywords"=>clean_string_alpha_num($title)), $title, $curl); if ($parsed_xml === false) { $search = "MP3Downloads"; $parsed_xml = aws_search_album(array("AssociateTag"=>"knas-20", "Operation"=>"ItemSearch", "SearchIndex"=>$search, "ResponseGroup"=>"Medium,Offers", "Keywords"=>clean_string_alpha_num($title)), $title, $curl); } $data = @is_object($parsed_xml) ? aws_get_wanted_data($parsed_xml) : ""; if(is_array($data)) { $url_picture = ($url_picture != 'nochange') ? $url_picture : $data[0]; if(!empty($data[1]) && ($data[0] != $data[1])) { $url_info = ($url_info != $no_cover_url) ? $url_info : $data[1]; } } /* if (isset($parsed_xml->Items->Item->SmallImage->URL)) { $url_picture = ($url_picture != 'nochange') ? $url_picture : $parsed_xml->Items->Item->SmallImage->URL; $url_info = ($url_info != 'nochange') ? $url_picture : (isset($parsed_xml->Items->Item->DetailPageURL) ? $parsed_xml->Items->Item->DetailPageURL : $url_picture); } */ } if ($url_picture == "nochange") { if($fallback == "logo") { $url_picture = (empty($full_logo_url)) ? $module_root_bang . "logos/" . $logo_name : $full_logo_url; } else { $url_picture = $module_root_bang. "skins/" . SKIN . "/equalizer_play.gif"; } } } } } if($picture == "logo") { $url_picture = (empty($full_logo_url)) ? $module_root_bang . "logos/" . $logo_name : $full_logo_url; //Try FavIcon.Ico if a site is found in song title $url_picture = song_siteInfo($artist, $song, $url_picture, 'url_picture'); } //Blank Picture check for Curenct Picture ver 3.x if(empty($url_picture)) { if($fallback == "logo") { $url_picture = (empty($full_logo_url)) ? $module_root_bang . "logos/" . $logo_name : $full_logo_url; } else { $url_picture = $module_root_bang. "skins/" . SKIN . "/equalizer_play.gif"; } } $old_title = asc2hex($currentsong); // generate the XML headers header('Content-type: text/xml'); echo '<?xml version="1.0" ?>'; if($disable_clean_string == "no") { $title = clean_string($title); $server_description = clean_string($server_description); $server_url = clean_string($server_url); $firstinfo = clean_string($firstinfo); $secondinfo = clean_string($secondinfo); $thirdinfo = clean_string($thirdinfo); $forthinfo = clean_string($forthinfo); } else { $title = trim($title); $server_description = trim($server_description); $server_url = trim($server_url); $firstinfo = trim($firstinfo); $secondinfo = trim($secondinfo); $thirdinfo = trim($thirdinfo); $forthinfo = trim($forthinfo); } // generate the XML Response print " <message> <content>".htmlentities(clean_string($title))."</content> <firstinfo>".htmlentities(clean_string($firstinfo))."</firstinfo> <secondinfo>".htmlentities(clean_string($secondinfo))."</secondinfo> <thirdinfo>".htmlentities(clean_string($thirdinfo))."</thirdinfo> <forthinfo>".htmlentities(clean_string($forthinfo))."</forthinfo> <reload>".htmlentities($update_title)."</reload> <url_picture>".htmlentities($url_picture)."</url_picture> <url_info>".htmlentities($url_info)."</url_info> <description>".htmlentities($server_description)."</description> <url>".htmlentities($server_url)."</url> <old_title>".htmlentities($old_title)."</old_title> </message> "; ?> --- NEW FILE: cur_url.php --- <?php /** * * @package StandAllone - Radiplayer. * @version $Id: cur_url.php,v 1.1 2013/07/03 04:30:04 orynider Exp $ * @copyright (c) 2006-2013 Little Frog, FlorinCB [aka OryNider], drknas * @license http://opensource.org/licenses/gpl-license.php GNU General Public License v2 * // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License // as published by the Free Software Foundation; either version 2 // of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ // History: // Little Frog (v 1.x - 2.x) // OryNider (v 1.x - 3.x) // DrKnas (Current maintainer v 4.0 -) @define('_RADIO_CONFIG', true); define('STRIP_URL', (@ini_get('allow_url_fopen')) ? false : true); //fopen_url not allowed $module_root_path = "./../"; $phpEx = substr(strrchr(__FILE__, '.'), 1); require($module_root_path ."includes/common." . $phpEx); if(isset($_GET["mode"])) { $mode = $_GET["mode"]; } else { $mode = 'url_info'; } if(isset($_GET["skin"])) { $radio_skin = $_GET["skin"]; $module_root_bang = "./"; //Hardcoded for Security } elseif(isset($_GET["style"])) { $radio_skin = $_GET["style"]; $module_root_bang = "./"; //Hardcoded for Security } else { if(empty($radio_skin)) { $radio_skin = "default"; } $module_root_bang = STRIP_URL ? "./" : $module_root_path; } @define('SKIN', $radio_skin); $url_picture = $parsed_xml = "nochange"; $url_info = $caster_url; if(isset($_GET["old_title"])) { $old_title = $_GET["old_title"]; } else { if(empty($old_title)) { $old_title = asc2hex($title); } } //Search: Music; MusicTracks; MP3Downloads; DVD; //$song = "O Jah"; //$artist = "Paul Wilbur"; //$title = (!empty($song) ? trim($song) : trim($title)) . " - " . (!empty($artist) ? trim($artist) : trim($title)); if($picture == "cover") { //Try FavIcon.Ico if a site is found in song title as temp Logo if(isset($old_title) || STRIP_URL) { //Try site url inside song title $url_info = song_siteInfo($artist, $song, $no_cover_url, 'url_info'); if(($old_title != asc2hex($title)) || STRIP_URL) { //Try Last.FM Api $url_info = aws_getInfo($artist, $song, 'track', 'url_info', $no_cover_url); //Try Amazone Commerce Service Api if ($url_picture === $parsed_xml) { $search = "DigitalMusic"; $parsed_xml = aws_signed_request(array("AssociateTag"=>"knas-20", "Operation"=>"ItemSearch", "SearchIndex"=>$search, "ResponseGroup"=>"Medium,Offers", "Keywords"=>clean_string_alpha_num($title)), $title, $curl); if ($parsed_xml === false) { $search = "MP3Downloads"; $parsed_xml = aws_search_album(array("AssociateTag"=>"knas-20", "Operation"=>"ItemSearch", "SearchIndex"=>$search, "ResponseGroup"=>"Medium,Offers", "Keywords"=>clean_string_alpha_num($title)), $title, $curl); } $data = @is_object($parsed_xml) ? aws_get_wanted_data($parsed_xml) : ""; if(is_array($data)) { $url_info = ($url_info != $no_cover_url) ? $url_info : $data[1]; } if (isset($parsed_xml->Items->Item->SmallImage->URL)) { $url_info = ($url_picture != 'nochange') ? $url_picture : $parsed_xml->Items->Item->DetailPageURL; } } } } } $old_title = asc2hex($currentsong); if($mode == 'url_info') { die("$url_info"); } else { die("$$mode "); } ?> --- NEW FILE: cur_song.php --- <?php /** * * @package Mx-Publisher StandAllone - radioplayer * @version $Id: cur_song.php,v 1.1 2013/07/03 04:30:04 orynider Exp $ * @copyright (c) 2002-2006 [OryNider] mxBB Development Team * @license http://opensource.org/licenses/gpl-license.php GNU General Public License v2 * */ $module_root_path = "./../"; $phpEx = substr(strrchr(__FILE__, '.'), 1); @define('_RADIO_CONFIG', true); define('STRIP_URL', (@ini_get('allow_url_fopen')) ? false : true); //fopen_url not allowed $module_root_path = "./../"; $phpEx = substr(strrchr(__FILE__, '.'), 1); require($module_root_path ."includes/common." . $phpEx); if(isset($_GET["skin"])) { $radio_skin = $_GET["skin"]; $module_root_bang = "./"; //Hardcoded for Security } elseif(isset($_GET["style"])) { $radio_skin = $_GET["style"]; $module_root_bang = "./"; //Hardcoded for Security } else { if(empty($radio_skin)) { $radio_skin = "default"; } $module_root_bang = STRIP_URL ? "./" : $module_root_path; } @define('SKIN', $radio_skin); $url_picture = "nochange"; $url_info = $no_cover_url; $currentsong = (!empty($song) ? trim($song) : trim($title)) . " - " . (!empty($artist) ? trim($artist) : trim($title)); $title = !empty($title) ? $currentsong : $no_cover_url; die("$title"); //Remove this line if your hosting supports frames 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'); print ' <HTML> <HEAD> <META http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\" /> <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> <span style="font-weight: bold;">' . $title . ' </span> </body> </HTML>'; ?> --- NEW FILE: cd_cover_getter.php --- <?php /** * * @package StandAllone - Radiplayer. * @version $Id: cd_cover_getter.php,v 1.1 2013/07/03 04:30:03 orynider Exp $ * @copyright (c) 2006-2013 Little Frog, FlorinCB [aka OryNider], drknas * @license http://opensource.org/licenses/gpl-license.php GNU General Public License v2 * // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License // as published by the Free Software Foundation; either version 2 // of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ // History: // Little Frog (v 1.x - 2.x) // OryNider (v 1.x - 3.x) // DrKnas (Current maintainer v 4.0 -) // Get image thingy by drknas... function Radio_Search_Album($params, $title, $curl) { static $response, $request; $method = "GET"; $host = "ecs.amazonaws.com"; $uri = "/onca/xml"; $params["Service"] = "AWSECommerceService"; $params["AWSAccessKeyId"] = "0ZYCZQTQW9GRW4AY2602"; $params["Timestamp"] = gmdate("Y-m-d\TH:i:s\Z"); $params["Version"] = "2013-05-16"; ksort($params); $canonicalized_query = array(); foreach ($params as $param=>$value) { $param = str_replace("%7E", "~", rawurlencode($param)); $value = str_replace("%7E", "~", rawurlencode($value)); $canonicalized_query[] = $param."=".$value; } $canonicalized_query = implode("&", $canonicalized_query); $string_to_sign = $method."\n".$host."\n".$uri."\n".$canonicalized_query; $signature = base64_encode(hash_hmac("sha256", $string_to_sign, "LFpXAmTy+mZjDWISXr7bGkTVMapgrgUorRKEUOin", true)); $signature = str_replace("%7E", "~", rawurlencode($signature)); $request = "http://".$host.$uri."?".$canonicalized_query."&Signature=".$signature; if($curl == "yes") { $response = curl_file_get_contents($request); } if ($response === false) { $response = @file_get_contents($request); } if ($response === false) { $canonicalized_query = "Service=AWSECommerceService&AWSAccessKeyId=0ZYCZQTQW9GRW4AY2602&AssociateTag=knas-20&Operation=ItemSearch&ResponseGroup=Medium,Offers&SearchIndex=Music&Keywords=".$title."&ItemPage="; $fp = @fsockopen($host, 80, $errno, $errstr, 5); if($fp) { @fputs($fp,"GET /".$uri."?".$canonicalized_query." HTTP/1.0\r\nUser-Agent: XML Getter (Mozilla Compatible)\r\n\r\n"); while(!feof($fp)) { $response .= fgets($fp, 1000); } $response = substr($response, 7); $response = substr($response, 0, strlen($response) - 6); } } if ($response === false) { return false; } else { $parsed_xml = @simplexml_load_string($response); if ($parsed_xml === false) { return false; } else { return $parsed_xml; } } } function radio_get_wanted_data($parsed_xml) { $numOfItems = $parsed_xml->Items->TotalResults; if($numOfItems > 0) { $first = $parsed_xml->Items->Item[0]; $wanted_data[] = $first->SmallImage->URL; $wanted_data[] = $first->DetailPageURL; return $wanted_data; } if($numOfItems < 1) { return false; } } ?> --- NEW FILE: java_script.php --- <?php /** * * @package StandAllone - Radiplayer. * @version $Id: java_script.php,v 1.1 2013/07/03 04:30:04 orynider Exp $ * @copyright (c) 2006-2013 Little Frog, FlorinCB [aka OryNider], drknas * @license http://opensource.org/licenses/gpl-license.php GNU General Public License v2 * // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License // as published by the Free Software Foundation; either version 2 // of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ // History: // Little Frog (v 1.x - 2.x) // OryNider (v 1.x - 3.x) // DrKnas (Current maintainer v 4.0 -) if( !defined('IN_PORTAL') ) { die( "Hacking attempt(java)" ); } function java_template($module_root_path, $phpEx, $mimetype, $clean_config, $radio_skin, $autoplay, $state, $lang, $java_debug, $update_title) { static $allow_url_config, $allow_url_info, $allow_url_picture; global $skininfo; if(@ini_get('allow_url_fopen')) { $allow_url_config = "?config=".$clean_config; $allow_url_info = "?config=" . $clean_config . "&mode=url_info"; $allow_url_picture = "?config=".$clean_config."&mode=url_picture&style=".$radio_skin; } //some overwrite $java_script = " <SCRIPT TYPE=\"text/javascript\"> <!--// onerror=handleErr; "; if($java_debug == "yes") { $java_script .= " var txt=\"\"; function handleErr(msg, url, l) { txt=\"There was an error on this page.\\n\\n\"; txt+=\"Error: \" + msg + \"\\n\"; txt+=\"URL: \" + url + \"\\n\"; txt+=\"Line: \" + l + \"\\n\\n\"; txt+=\"Click OK to continue.\\n\\n\"; alert(txt); return true; } "; } else { $java_script .= " function handleErr() { clearTimeout(to); setTimeout(\"updateInfo()\", 15900); } "; } $java_script .= " var detectableWithVB = false; var pluginFound = false; var cType = '" . $mimetype . "'; var gecko = !(navigator.appName == 'Internet Explorer'); if (!gecko) { if(document.getElementById(\"IWinAmpActiveX\") != null) { var winampx = document.getElementById(\"IWinAmpActiveX\"); } } else { if (document.getElementById(\"IWinAmpActiveXG\") != null) { var winampx = document.getElementById(\"IWinAmpActiveXG\"); } } "; if(basename($_SERVER['PHP_SELF']) !== "play.php") { $java_script .= " var oMarquees = [], oMrunning, oMInterv = 20, //interval between increments oMStep = 1, //number of pixels to move between increments oStopMAfter = 0, //how many seconds should marquees run (0 for no limit) oResetMWhenStop = false, //set to true to allow linewrapping when stopping oMDirection = 'left'; //'left' for LTR text, 'right' for RTL text /*** Do not edit anything after here ***/ function doMStop() { clearInterval(oMrunning); for( var i = 0; i < oMarquees.length; i++ ) { oDiv = oMarquees[i]; oDiv.mchild.style[oMDirection] = '0px'; if( oResetMWhenStop ) { oDiv.mchild.style.cssText = oDiv.mchild.style.cssText.replace(/;white-space:nowrap;/g,''); oDiv.mchild.style.whiteSpace = ''; oDiv.style.height = ''; oDiv.style.overflow = ''; oDiv.style.position = ''; oDiv.mchild.style.position = ''; oDiv.mchild.style.top = ''; } } oMarquees = []; } function doDMarquee() { if( oMarquees.length || !document.getElementsByTagName ) { return; } var oDivs = document.getElementsByTagName('div'); for( var i = 0, oDiv; i < oDivs.length; i++ ) { oDiv = oDivs[i]; if( oDiv.className && oDiv.className.match(/\bdmarquee\b/) ) { if( !( oDiv = oDiv.getElementsByTagName('div')[0] ) ) { continue; } if( !( oDiv.mchild = oDiv.getElementsByTagName('div')[0] ) ) { continue; } oDiv.mchild.style.cssText += ';".$skininfo['display_style']."'; oDiv.mchild.style.whiteSpace = 'nowrap'; oDiv.style.height = oDiv.offsetHeight + 'px'; oDiv.style.overflow = 'hidden'; oDiv.style.position = 'relative'; oDiv.style.width = '".$skininfo['display_width']."' + 'px'; oDiv.style.height = '".$skininfo['display_height']."' + 'px'; oDiv.style.left = '".$skininfo['display_left']."' + 'px'; oDiv.style.right = '".$skininfo['display_right']."' + 'px'; oDiv.style.top = '".$skininfo['display_top']."' + 'px'; oDiv.style.fontWeight = 'bold'; oDiv.style.fontSize = '".$skininfo['display_fontSize']."' + 'px'; oDiv.style.fontFamily = '".$skininfo['display_font'].",Calibri,Trebuchet MS,Lucida Grande,Helvetica,Verdana,sans-serif'; oDiv.mchild.style.position = 'absolute'; oDiv.mchild.style.top = '0px'; oDiv.mchild.style[oMDirection] = oDiv.offsetWidth + 'px'; oMarquees[oMarquees.length] = oDiv; i += 2; } } oMrunning = setInterval('aniMarquee()',oMInterv); if( oStopMAfter ) { setTimeout('doMStop()',oStopMAfter*1000); } } function aniMarquee() { var oDiv, oPos; for( var i = 0; i < oMarquees.length; i++ ) { oDiv = oMarquees[i].mchild; oPos = parseInt(oDiv.style[oMDirection]); if( oPos <= -1 * oDiv.offsetWidth ) { oDiv.style[oMDirection] = oMarquees[i].offsetWidth + 'px'; } else { oDiv.style[oMDirection] = ( oPos - oMStep ) + 'px'; } } } if( window.addEventListener ) { window.addEventListener('load',doDMarquee,false); } else if( document.addEventListener ) { document.addEventListener('load',doDMarquee,false); } else if( window.attachEvent ) { window.attachEvent('onload',doDMarquee); } function playR() { var oDivs = document.getElementsByTagName('div'); for( var i = 0, oDiv; i < oDivs.length; i++ ) { oDiv = oDivs[i]; if( oDiv.className && oDiv.className.match(/\bdmarquee\b/) ) { if( !( oDiv = oDiv.getElementsByTagName('div')[0] ) ) { continue; } if( !( oDiv.mchild = oDiv.getElementsByTagName('div')[0] ) ) { continue; } oDiv.getElementsByTagName('div')[0].innerHTML = '" . $lang['checking_title'] . "'; i += 2; } } intervalID = window.top.setInterval( 'updateInfo()', " . $update_title . " ); doDMarquee(); document.getElementById('eq').src = '" . $module_root_path . "skins/" . SKIN . "/equalizer_play.gif'; var embed = document.getElementById('embedchoise'); var frame = document.getElementById('embedFrame'); if(embed.value != \"auto\" && embed.value != \"wmp\"){ frame.src = \"" . $module_root_path . "play." . $phpEx . "?config=" . $clean_config . "&embed=\" + embed.value; embedInfo(embed.value); } else if(embed.value == \"wmp\"){ frame.src = \"play." . $phpEx . "?config=" . $clean_config . "&embed=\" + detectWMPEmbed(embed.value); embedInfo(detectWMPEmbed(embed.value)); embedFramereload(); } else{ frame.src = \"" . $module_root_path . "play." . $phpEx . "?config=" . $clean_config . (isset($_GET['embed']) ? $_GET['embed'] : '') . "\"; embedInfo(detectEmbed()); } } function stopR(){ document.getElementById('eq').src = '" . $module_root_path . "skins/" . SKIN . "/equalizer_stop.gif'; document.getElementById('embedFrame').src = \"\"; window.top.clearInterval(intervalID); doMStop(); var oDivs = document.getElementsByTagName('div'); for( var i = 0, oDiv; i < oDivs.length; i++ ) { oDiv = oDivs[i]; if( oDiv.className && oDiv.className.match(/\bdmarquee\b/) ) { if( !( oDiv = oDiv.getElementsByTagName('div')[0] ) ) { continue; } if( !( oDiv.mchild = oDiv.getElementsByTagName('div')[0] ) ) { continue; } oDiv.getElementsByTagName('div')[0].innerHTML = '" . $lang['stop'] . "'; i += 2; } } document.getElementById('firstinfo').innerHTML = \"\"; document.getElementById('secondinfo').innerHTML = \"\"; document.getElementById('thirdinfo').innerHTML = \"\"; document.getElementById('forthinfo').innerHTML = \"\"; } "; } $java_script .= " function embedInfo(embed) { var player = ''; var plugin = ''; if(embed == 'real') { player = '<b>Real player<\/b>'; if(!detectReal()) { plugin = '<a href=\"http://www.real.com/realplayer.html\">» " . $lang['download'] . " Realplayer<\/a>'; } else { plugin = '» " . $lang['no_plugins_seems_to_be_needed'] . "'; } } else if(embed == 'wmp6') { player = '<b>Windows Media<\/b>'; if(!detectWindowsMedia()){ plugin = '<a href=\"http://www.microsoft.com/windows/windowsmedia/\">» " . $lang['download'] . " WMP<\/a>'; if(AXcompatible()){ plugin += '<br><a href=\"http://activex.microsoft.com/activex/controls/mplayer/sv/nsmp2inf.cab#Version=6,4,5,715\">»" . $lang['download'] . " WMP ". $lang['Plugin'] . "<\/a>'; } } else{ plugin = '» " . $lang['no_plugins_seems_to_be_needed'] . "'; } } else if(embed == 'wmp7') { player = '<b>Windows Media<\/b>'; if(!detectWindowsMedia()) { plugin = '<a href=\"http://www.microsoft.com/windows/windowsmedia/\">» " . $lang['download'] . " WMP<\/a>'; } else { plugin = '» " . $lang['no_plugins_seems_to_be_needed'] . "'; } } else if(embed == 'wmpo') { player = '<b>Windows Media<\/b>'; if(!detectWindowsMedia()) { plugin = '<a href=\"http://www.microsoft.com/windows/windowsmedia/\">» " . $lang['download'] . " WMP<\/a>'; } else { plugin = '» " . $lang['no_plugins_seems_to_be_needed'] . "'; } } else if(embed == 'quicktime') { player = '<b>QuickTime<\/b>'; if(!detectQuickTime()) { plugin = '<a href=\"http://www.apple.com/quicktime/download/\">» " . $lang['download'] . " QT<\/a>'; if(AXcompatible()) { plugin += '<br><a href=\"http://www.apple.com/qtactivex/qtplugin.cab\">» " . $lang['download'] . " QT " . $lang['Plugin'] . "<\/a>'; } } else { plugin = '» " . $lang['no_plugins_seems_to_be_needed'] . "'; } } else if(embed == 'aac_wmp') { player = '<b>Windows Media<\/b>'; plugin = ''; if(!detectWindowsMedia()) { plugin += '<a href=\"http://www.microsoft.com/windows/windowsmedia/\">» " . $lang['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>'; } else if(embed == 'winampX') { player = 'Winamp ActiveX'; if(AXcompatible()) { plugin = '<a href=\"".ADDON_URL."addonsx/ampx_en_dl.cab\">» " . $lang['download'] . " WinampX<\/a>'; } }"; if(basename($_SERVER['PHP_SELF']) !== "play.php") { $java_script .= " document.getElementById('infoPlayer').innerHTML = player; document.getElementById('infoPlugin').innerHTML = plugin; "; } $java_script .= " } function changeEmbed() { var embed = document.getElementById('embedchoise'); if(embed.value && embed.value != \"auto\" && embed.value != \"wmp\") { embedInfo(embed.value); } else if(embed.value == \"wmp\") { embedInfo(detectWMPEmbed(embed.value)); } else { embedInfo(detectEmbed()); } } function stopWinampx() { if((document.getElementById(\"IWinAmpActiveXG\") != null) || (document.getElementById(\"IWinAmpActiveX\") != null)) { winampx.Deinitialize(); } } function stopWMP() { if((document.getElementById(\"IWinAmpActiveXG\") != null) || (document.getElementById(\"IWinAmpActiveX\") != null)) { winampx.Deinitialize(); } } function AXcompatible() { if (window.ActiveXObject) { // ActiveXObject is supported return true; } else if (window.GeckoActiveXObject) { // GeckoActiveXObject is supported return true; } else if (document.all) { // use ActiveXObject or write IE only OBJECT markup return true; } // use Netscape Plugins return false; } function canDetectPlugins() { if( detectableWithVB || (navigator.plugins && navigator.plugins.length > 0) ) { return true; } else { return false; } } function detectQuickTime() { pluginFound = detectPlugin('QuickTime'); // if not found, try to detect with VisualBasic if(!pluginFound && detectableWithVB) { pluginFound = detectQuickTimeActiveXControl(); } return pluginFound; } function detectReal() { pluginFound = detectPlugin('RealPlayer'); // if not found, try to detect with VisualBasic if(!pluginFound && detectableWithVB) { pluginFound = (detectActiveXControl('rmocx.RealPlayer G2 Control') || detectActiveXControl('RealPlayer.RealPlayer(tm) ActiveX Control (32-bit)') || detectActiveXControl('RealVideo.RealVideo(tm) ActiveX Control (32-bit)')); } return pluginFound; } function detectWindowsMedia() { pluginFound = detectPlugin('Windows Media Player'); // if not found, try to detect with VisualBasic if(!pluginFound && detectableWithVB) { pluginFound = detectActiveXControl('MediaPlayer.MediaPlayer.1'); } return pluginFound; } function detectPlugin() { // allow for multiple checks in a single pass var daPlugins = detectPlugin.arguments; // consider pluginFound to be false until proven true var pluginFound = false; // if plugins array is there and not fake if (navigator.plugins && navigator.plugins.length > 0) { var pluginsArrayLength = navigator.plugins.length; // for each plugin... for (pluginsArrayCounter=0; pluginsArrayCounter < pluginsArrayLength; pluginsArrayCounter++ ) { // loop through all desired names and check each against the current plugin name var numFound = 0; for(namesCounter=0; namesCounter < daPlugins.length; namesCounter++) { // if desired plugin name is found in either plugin name or description if( (navigator.plugins[pluginsArrayCounter].name.indexOf(daPlugins[namesCounter]) >= 0) || (navigator.plugins[pluginsArrayCounter].description.indexOf(daPlugins[namesCounter]) >= 0) ) { // this name was found numFound++; } } // now that we have checked all the required names against this one plugin, // if the number we found matches the total number provided then we were successful if(numFound == daPlugins.length) { pluginFound = true; // if we've found the plugin, we can stop looking through at the rest of the plugins break; } } } return pluginFound; } // detectPlugin // Here we write out the VBScript block for MSIE Windows if ((navigator.userAgent.indexOf('MSIE') != -1) && (navigator.userAgent.indexOf('Win') != -1)) { document.writeln('<script language=\"VBscript\">'); document.writeln('\'do a one-time test for a version of VBScript that can handle this code'); document.writeln('detectableWithVB = False'); document.writeln('If ScriptEngineMajorVersion >= 2 then'); document.writeln(' detectableWithVB = True'); document.writeln('End If'); document.writeln('\'this next function will detect most plugins'); document.writeln('Function detectActiveXControl(activeXControlName)'); document.writeln(' on error resume next'); document.writeln(' detectActiveXControl = False'); document.writeln(' If detectableWithVB Then'); document.writeln(' detectActiveXControl = IsObject(CreateObject(activeXControlName))'); document.writeln(' End If'); document.writeln('End Function'); document.writeln('\'and the following function handles QuickTime'); document.writeln('Function detectQuickTimeActiveXControl()'); document.writeln(' on error resume next'); document.writeln(' detectQuickTimeActiveXControl = False'); document.writeln(' If detectableWithVB Then'); document.writeln(' detectQuickTimeActiveXControl = False'); document.writeln(' hasQuickTimeChecker = false'); document.writeln(' Set hasQuickTimeChecker = CreateObject(\"QuickTimeCheckObject.QuickTimeCheck.1\")'); document.writeln(' If IsObject(hasQuickTimeChecker) Then'); document.writeln(' If hasQuickTimeChecker.IsQuickTimeAvailable(0) Then '); document.writeln(' detectQuickTimeActiveXControl = True'); document.writeln(' End If'); document.writeln(' End If'); document.writeln(' End If'); document.writeln('End Function'); document.writeln('<\/scr' + 'ipt>'); } function detectOS(){ var OS = \"unknown\"; if (navigator.appVersion.indexOf(\"Win\")!=-1) OS = \"win\"; if (navigator.appVersion.indexOf(\"Mac\")!=-1) OS = \"mac\"; if (navigator.appVersion.indexOf(\"X11\")!=-1) OS = \"unix\"; if (navigator.appVersion.indexOf(\"Linux\")!=-1) OS = \"linux\"; return OS; } function detectWMPEmbed(){ var cType = '" . $mimetype . "'; if(cType == \"audio/aacp\"){ return 'aac_wmp'; } if(canDetectPlugins() && detectWindowsMedia() && AXcompatible()){ fHasWMP = false; WMPVer = \"unknown\"; try{ if (document.WMP64.FileName == \"\"){ WMPVer = \"6.4\"; } fHasWMP = true; } catch(e){}; try{ if(document.WMP7.URL == \"\"){ WMPVer = document.WMP7.versionInfo; } fHasWMP = true; } catch(e){}; if(fHasWMP == true && WMPVer != 'unknown'){ WMPVer = parseFloat(WMPVer); if(WMPVer == 6.4){ return 'wmp6'; } } } return 'wmp7'; } function detectEmbed() { var cType = '" . $mimetype . "'; if(cType == \"audio/aacp\") { if(AXcompatible()) { return 'winampX'; } return detectWMPEmbed(); } if(canDetectPlugins()) { if(cType == \"audio/mpeg\"){ return detectWMPEmbed(); } if(detectReal()) { return 'real'; } else if(detectWindowsMedia()) { return detectWMPEmbed(); } else if(detectQuickTime()) { return 'quicktime'; } } if(AXcompatible()){ return 'winampX'; } var OS = detectOS(); if(OS == \"mac\"){ return 'quicktime'; } else if(OS == \"unix\" || OS == \"linux\"){ return 'real'; } return detectWMPEmbed(); }"; if(basename($_SERVER['PHP_SELF']) !== "play.php") { $java_script .= " var old_title = '73746172745f66617274'; "; } $java_script .= " function makeHttpRequest(url, callback_function, return_xml) { //Create a boolean variable to check for a valid Internet Explorer instance. var xmlHttp = false; //Check if we are using IE. try { //If the JavaScript version is greater than 5. xmlHttp = new ActiveXObject(\"Msxml2.XMLHTTP\"); } catch(e) { //If not, then use the older ActiveX object. try { //If we are using Internet Explorer. xmlHttp = new ActiveXObject(\"Microsoft.XMLHTTP\"); } catch(E) { //Else we must be using a non-IE browser. xmlHttp = false; } } // If we are not using IE, create a JavaScript instance of the object. if (!xmlHttp && typeof XMLHttpRequest != 'undefined') { xmlHttp = new XMLHttpRequest(); } if (!xmlHttp) { alert('Browser doesn\'t support Ajax'); return false; } xmlHttp.onreadystatechange = function() { if (xmlHttp.readyState == 4) { if (xmlHttp.status == 200) { if (return_xml) { eval(callback_function + '(xmlHttp.responseXML)'); } else { eval(callback_function + '(xmlHttp.responseText)'); } } else { setTimeout(\"updateInfo()\",15900); } } } xmlHttp.open('GET', url, true); xmlHttp.send(null); } function loadXML(xml) { var html_title = xml.getElementsByTagName('content').item(0).firstChild.nodeValue; var html_firstinfo = xml.getElementsByTagName('firstinfo').item(0).firstChild.nodeValue; var html_secondinfo = xml.getElementsByTagName('secondinfo').item(0).firstChild.nodeValue; var html_thirdinfo = xml.getElementsByTagName('thirdinfo').item(0).firstChild.nodeValue; var html_forthinfo = xml.getElementsByTagName('forthinfo').item(0).firstChild.nodeValue; var reload_after = xml.getElementsByTagName('reload').item(0).firstChild.nodeValue; var url_picture = xml.getElementsByTagName('url_picture').item(0).firstChild.nodeValue; var url_info = xml.getElementsByTagName('url_info').item(0).firstChild.nodeValue; old_title = xml.getElementsByTagName('old_title').item(0).firstChild.nodeValue; if(url_picture != 'nochange') { document.getElementById('eq').src = url_picture; document.getElementById('cover_url').href = url_info; document.getElementById('cover_url').target = \"_blank\"; } document.getElementById('firstinfo').innerHTML = html_firstinfo; document.getElementById('secondinfo').innerHTML = html_secondinfo; document.getElementById('thirdinfo').innerHTML = html_thirdinfo; document.getElementById('forthinfo').innerHTML = html_forthinfo; var oDivs = document.getElementsByTagName('div'); for(var i = 0, oDiv; i < oDivs.length; i++) { oDiv = oDivs[i]; if(oDiv.className && oDiv.className.match(/\bdmarquee\b/)) { if(!(oDiv = oDiv.getElementsByTagName('div')[0])) { continue; } if(!(oDiv.mchild = oDiv.getElementsByTagName('div')[0])) { continue; } oDiv.getElementsByTagName('div')[0].innerHTML = html_title; i += 2; } } //to = setTimeout(\"updateInfo()\", parseInt(reload_after)); } function checkSong() { //Create a boolean variable to check for a valid Internet Explorer instance. var xmlHttp = false; //Check if we are using IE. try { //If the JavaScript version is greater than 5. xmlHttp = new ActiveXObject(\"Msxml2.XMLHTTP\"); } catch(e) { //If not, then use the older ActiveX object. try { //If we are using Internet Explorer. xmlHttp = new ActiveXObject(\"Microsoft.XMLHTTP\"); } catch(E) { //Else we must be using a non-IE browser. xmlHttp = false; } } // If we are not using IE, create a JavaScript instance of the object. if (!xmlHttp && typeof XMLHttpRequest != 'undefined') { xmlHttp = new XMLHttpRequest(); } var songtitle = document.getElementById('songtitle'); var url = '".$module_root_path."includes/cur_song.".$phpEx.$allow_url_config."'; //xmlHttp.open(\"GET\", url); xmlHttp.onreadystatechange = function() { if (xmlHttp.readyState == 4 && xmlHttp.status == 200) { songtitle.innerHTML = xmlHttp.responseText; setTimeout('checkSong()', 25000); } } xmlHttp.open(\"GET\", url, true); xmlHttp.send(null); } function checkSong2() { 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('songtitle').innerHTML = xmlHttp.responseText; setTimeout('Ajax()',25000); } } var url = '".$module_root_path."includes/cur_song.".$phpEx.$allow_url_config."'; xmlHttp.open(\"GET\", url, true); xmlHttp.send(null); } function checkcover_url() { 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('cover_url').href = xmlHttp.responseText; //setTimeout('checkcover_url()', 100); } } var url = '".$module_root_path."includes/cur_url.".$phpEx.$allow_url_info."'; xmlHttp.open(\"GET\", url, true); xmlHttp.send(null); } function checkCover() { 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 && xmlHttp.status == 200) { document.getElementById('eq').src = xmlHttp.responseText; //setTimeout('checkCover()', 100); } } var url = '".$module_root_path."includes/cur_picture.".$phpEx.$allow_url_picture."'; xmlHttp.open(\"GET\", url, 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 updateInfo() { var now = new Date(); "; if($autoplay) { //if($state == "Up") //{ $java_script .= " var url = '" . $module_root_path . "includes/cur_display.php?old_title=' + old_title + '&config=" . $clean_config . "&skin=". SKIN ."&ts=' + now.getTime(); "; //} } else { //if($state == "Up") //{ $java_script .= " var url = '" . $module_root_path . "includes/cur_display.php?old_title=' + old_title + '&config=" . $clean_config . "&skin=". SKIN ."&ts=' + now.getTime(); "; //} } $java_script .= " makeHttpRequest(url, 'loadXML', true); }"; //End of functions $java_script2 = ""; $java_script2 .= " loadimg = new Image(27,27); loadimg.src = \"" . $module_root_path . "skins/" . SKIN . "/play_h.jpg\"; loadimg2 = new Image(19,19); loadimg2.src = \"" . $module_root_path . "skins/" . SKIN . "/stop_h.jpg\"; loadimg3 = new Image(18,18); loadimg3.src = \"" . $module_root_path . "skins/" . SKIN . "/close_h.png\"; window.onunload = function(){ stopWinampx(); } window.onload = function(){ embedInfo(detectEmbed()); "; if(basename($_SERVER['PHP_SELF']) !== "play.php") { $java_script2 .= " updateInfo(); "; if($autoplay) { //if($state == "Up") //{ $java_script2 .= " playR();"; //} } } $java_script2 .= " } "; return $java_script . "// --></SCRIPT>"; } ?> --- NEW FILE: getinfo_ice.php --- <?php /** * * @package StandAllone - Radiplayer. * @version $Id: getinfo_ice.php,v 1.1 2013/07/03 04:30:04 orynider Exp $ * @copyright (c) 2006-2013 Little Frog, FlorinCB [aka OryNider], drknas * @license http://opensource.org/licenses/gpl-license.php GNU General Public License v2 * // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License // as published by the Free Software Foundation; either version 2 // of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ // History: // Little Frog (v 1.x - 2.x) // OryNider (v 1.x - 3.x) // DrKnas (Current maintainer v 4.0 -) if( !defined('IN_PORTAL') ) { die( "Hacking attempt(ice)" ); } $state = ""; $currentsong = ""; $currentlisteners = ""; $maxlisteners = ""; $mimetype = ""; $stream_genre = ""; $bitrate = ""; $peaklisteners = ""; $server_name = ""; $server_description = ""; $quality = ""; $video_quality = ""; $frame_size = ""; $frame_rate = ""; $server_url = ""; $artist = ""; $stream_title = ""; if(empty($caster_internal_ip)) { $ice_caster_ip = $caster_ip; $ice_caster_port = $caster_port; } else { $ice_caster_ip = $caster_internal_ip; $ice_caster_port = $caster_internal_port; } $stream_url = $server_url = "http://".$ice_caster_ip.":".$ice_caster_port; //error_reporting(0); define('SERVER', "http://".$ice_caster_ip.":".$ice_caster_port); //your icecast server address, without the ending "/" define('MOUNT', $icecast_mount_point); //your radio\'s mount point, with the leading "/" #error_reporting(0); $stream = radio_getStreamInfo($ice_caster_ip, $ice_caster_port, $icecast_mount_point); if($icecast_status = radio_icecast_status($ice_caster_ip, $ice_caster_port, $icecast_mount_point)) { $state = "Up"; foreach ($icecast_status as $value) { if(isset($value['server_name'])) { if($value['mount'] === $icecast_mount_point) { $currentsong = $value['title']; $stream_title = strip_tags($value['title']); $currentlisteners = $value['listeners']; $peaklisteners = $value['listener_peak']; $max_listeners = $value['max_listeners']; $mimetype = $value['server_type']; $stream_genre = $value['genre']; $server_name = $value['server_name']; $server_description = $value['server_description']; $bitrate = $value['bitrate']; $quality = $value['quality']; $video_quality = $value['video_quality']; $frame_size = $value['frame_size']; $frame_rate = $value['frame_rate']; $server_url = $value['server_url']; $title = strip_tags($value['title']); $artist = $value['artist']; if(empty($bitrate)) { $bitrate = "VBR"; } else { $bitrate = $value['bitrate']; } $state = $value['status']; } } } } elseif($stream['']['status'] == 'Down') { $state = "Down"; $peaklisteners = 1; $bitrate = "56"; $stream_title = "Stream"; $currentsong = "Track"; //$mimetype = "audio/mpeg"; } elseif($stream['']['status'] == 'Socket') { $state = "Down"; $peaklisteners = 1; $bitrate = "56"; $stream_title = "Stream"; $currentsong = "Track"; //$mimetype = "audio/mpeg"; $lang['Off_Air'] = $lang['Socket_functions_disabled']; } if($stream['']['status'] == 'Up') { $state = "Up"; $currentsong = $stream['']['artist_song']; $maxlisteners = $stream['']['max_listeners']; $currentlisteners = $stream['']['listeners']; $peaklisteners = $stream['']['listener_peak']; $mimetype = $stream['']['type']; $stream_genre = $stream['']['genre']; $server_name = $stream['']['title']; $stream_title = strip_tags($stream['']['title']); //Station Name $server_description = $stream['']['description']; $bitrate = $stream['']['bitrate']; $quality = !empty($quality) ? $quality : ""; //$stream['']['quality']; $video_quality = !empty($video_quality) ? $video_quality : ""; //$stream['']['video_quality']; $frame_size = !empty($frame_size) ? $frame_size : ""; //$stream['']['frame_size']; $frame_rate = !empty($frame_rate) ? $frame_rate : ""; //$stream['']['frame_rate']; $server_url = !empty($server_url) ? $server_url : ""; //$stream['']['server_url']; $start = $stream['']['start']; $stream_url = $stream['']['stream_url']; $title = $artist_song = $stream['']['artist_song']; $artist = $stream['']['artist']; $song = $stream['']['song']; } #error_reporting(E_ALL ^ E_NOTICE); function radio_icecast_status($caster_ip, $caster_port, $icecast_mount_point) { static $streamdata; $errno = 0; $errstr = ''; $connect_timeout = 5; $page = ""; # error_reporting(0); $fp = @fsockopen($caster_ip, $caster_port, $errno, $errstr, 5); if($fp) { fputs($fp,"GET /short_status.xsl HTTP/1.0\r\nUser-Agent: XML Getter (Mozilla Compatible)\r\n\r\n"); while(!feof($fp)) { $page .= fgets($fp, 1000); } //$mount_points = explode("_END_", $page); //$page_array = preg_split('/<td\s[^>]*class=\"streamdata\">(.*)<\/td>/isU' , $page, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); ////die("$page"); //for( $i = 0; $i < $n = count($page_array); $i++ ) //{ // $state = "Up"; //} $mount_points = explode("_END_",$page); if(count($mount_points) < 2) { return FALSE; } foreach ($mount_points as $value) { if ( ( $value !== '_END_' ) && !empty( $value ) ) { $info = explode("|",$value); if(isset($info[0])) { $mountpoint = explode("_START_", $info[0]); if(count($mountpoint) > 1) { $status[$info[0]]['mount'] = preg_replace("/[\n\r]/","",$mountpoint[1]) ; } else { $status[$info[0]]['mount'] = preg_replace("/[\n\r]/","",$mountpoint[0]) ; } } if(isset($info[1])) { $status[$info[0]]['server_name'] = preg_replace("/[\n\r]/","",$info[1]) ; } if(isset($info[2])) { $status[$info[0]]['server_description'] = preg_replace("/[\n\r]/","",$info[2]) ; } if(isset($info[3])) { $status[$info[0]]['server_type'] = preg_replace("/[\n\r]/","",$info[3]) ; } if(isset($info[4])) { $status[$info[0]]['bitrate'] = preg_replace("/[\n\r]/","",$info[4]) ; } if(isset($info[5])) { $status[$info[0]]['quality'] = preg_replace("/[\n\r]/","",$info[5]) ; } if(isset($info[6])) { $status[$info[0]]['video_quality'] = preg_replace("/[\n\r]/","",$info[6]) ; } if(isset($info[7])) { $status[$info[0]]['frame_size'] = preg_replace("/[\n\r]/","",$info[7]) ; } if(isset($info[8])) { $status[$info[0]]['frame_rate'] = preg_replace("/[\n\r]/","",$info[8]) ; } if(isset($info[9])) { $status[$info[0]]['listeners'] = preg_replace("/[\n\r]/","",$info[9]) ; } if(isset($info[10])) { $status[$info[0]]['listener_peak'] = preg_replace("/[\n\r]/","",$info[10]) ; } if(isset($info[11])) { $status[$info[0]]['genre'] = preg_replace("/[\n\r]/","",$info[11]) ; } if(isset($info[12])) { $status[$info[0]]['server_url'] = preg_replace("/[\n\r]/","",$info[12]) ; } if(isset($info[13])) { $status[$info[0]]['artist'] = preg_replace("/[\n\r]/","",$info[13]) ; } if(isset($info[14])) { $status[$info[0]]['title'] = preg_replace("/[\n\r]/","",$info[14]) ; } $status[$streamdata]['status'] = 'Up'; } } if(isset($status)) { return $status; } else { return FALSE; } } else { $status[$streamdata]['status'] = 'Socket'; return $status; } @fclose($fp); # error_reporting(E_ALL ^ E_NOTICE); } /* based on function by Jude <sur...@gm...> http://jude.im/ FlorinCB <ory...@gm...> works with Icecast 2.3.2 */ function radio_getStreamInfo($ice_caster_ip, $ice_caster_port, $icecast_mount_point) { static $streamdata; $status = array(); $str = @file_get_contents('http://'.$ice_caster_ip.":".$ice_caster_port.'/status.xsl?mount='.$icecast_mount_point); if(!$str) { $fp = @fsockopen($ice_caster_ip, $ice_caster_port, $errno, $errstr, 5); if($fp) { @fputs($fp,"GET /status.xsl?mount=".$icecast_mount_point." HTTP/1.0\r\nUser-Agent: XML Getter (Mozilla Compatible)\r\n\r\n"); while(!@feof($fp)) { $str .= @fgets($fp, 1000); } } else { $status[$streamdata]['status'] = 'Down'; } } if(preg_match_all('/<td\s[^>]*class=\"streamdata\">(.*)<\/td>/isU', $str, $match)) { //Stream Title: title 1,0 //Stream Description: description 1.1 //Content Type: audio/mpeg ... [truncated message content] |