<?php
$porta = query_string('1');

$facebook = (query_string('6')) ? '<li class="facebook"><a target="_blank" href="https://fb.com/'.query_string('6').'" class="init"><i class="fab fa-facebook-f fa-2x"></i></a></li>' : '';
$instagram = (query_string('7')) ? '<li class="instagram"><a target="_blank"  href="https://instagram.com/'.query_string('7').'"><i class="fab fa-instagram fa-2x"></i></a></li>' : '';
$whatsapp = (query_string('8')) ? '<li class="whatsapp"><a target="_blank" class="ico-hide" href="https://wa.me/'.query_string('8').'"><i class="fab fa-whatsapp fa-2x"></i></a></li>' : '';

if(!is_numeric($porta)) {
die ("Error! Missing data.");
}

$verifica_stm = mysqli_num_rows(mysqli_query($conexao,"SELECT * FROM streamings where porta = '".$porta."'"));

if($verifica_stm == 0) {
die ("Error! Missing data.");
}

$dados_config = @mysqli_fetch_array(@mysqli_query($conexao,"SELECT * FROM configuracoes"));
$dados_stm = mysqli_fetch_array(mysqli_query($conexao,"SELECT * FROM streamings where porta = '".$porta."'"));
$dados_servidor = mysqli_fetch_array(mysqli_query($conexao,"SELECT * FROM servidores where codigo = '".$dados_stm["codigo_servidor"]."'"));

$total_pontos = mysqli_num_rows(mysqli_query($conexao,"SELECT * FROM multipoint where codigo_stm = '".$dados_stm["codigo"]."'"));

if($total_pontos > 0) {
$ponto = "/1";
} else {
$ponto = "/stream";
}

if(query_string('2') == "musica") {

if($dados_stm["tipo_servidor"] == "icecast") {

   $porta_admin_icecast = $dados_stm["porta"]+1;

   $dados_icecast = @file_get_contents("http://".$dados_servidor["ip"].":".$porta_admin_icecast."/status-json.xsl?mount=".$ponto);

   $dados_json_icecast = json_decode($dados_icecast, true);

   $musica_completa = ($dados_json_icecast["icestats"]["source"]["artist"]) ? $dados_json_icecast["icestats"]["source"]["artist"]." - ".$dados_json_icecast["icestats"]["source"]["title"] : $dados_json_icecast["icestats"]["source"]["title"];

} else {
   $musica_completa = @file_get_contents("http://".$dados_servidor["ip"].":".$dados_stm["porta"]."/currentsong?sid=1");
   $musica_completa = utf8_decode($musica_completa);
}

$musica_completa = str_replace("_"," ",$musica_completa);

header('Content-Type: application/json; charset=utf-8');

echo $_GET['callback'].'({"songtitle":"'.$musica_completa.'"})';

exit();
}

$url_proxy_musica_atual = "https://player.".$dados_config["dominio_padrao"]."/musica-atual/".$dados_stm["porta"]."?";
$url_source_streaming = "https://".strtolower($dados_servidor["nome"]).".".$dados_config["dominio_padrao"].":".$dados_stm["porta"].$ponto;
?> 
<!DOCTYPE html><html> <head> <meta charset="utf-8"> <title>Web Radio</title> <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport"> <meta content="Ouvindo a Web Radio" name='Description'/> <meta content="Web Radio,Ouça a melhor rádio, web rádio" name='keywords'/> <meta itemprop="name" content="Web Radio"/> <meta itemprop="description" content="Clique para ouvir"/> <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.13.0/css/all.min.css" rel="stylesheet" type="text/css"/> <link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-slider/11.0.2/css/bootstrap-slider.min.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="https://code.jquery.com/jquery-3.3.1.min.js"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-slider/11.0.2/bootstrap-slider.min.js" type="text/javascript"></script> <script>$(function(){$(".player");var a={getMusicaAtual:function(){$.getJSON("?info=true",function(o,s){if("off"!=o.status){var n="object"==typeof o.musica?document.title:o.musica.replace(/_/g," ");$(".musica-musica-atualxx,.contents").find("span").html("<marquee scrolldelay='100'>"+n+"</marquee>");var i="object"==typeof o.capa?"images/img-capa-artista-padrao.png":o.capa;$(".cover-musica").css({background:"url("+i+") no-repeat center 100%"})}a.invervalo()})},invervalo:function(){setTimeout(a.getMusicaAtual,3e4)},onRadioPlay:function(){var o=$(this);o.hasClass("on")?(a.radio.pause(),o.removeClass("on"),o.removeClass("animar"),$(".ondas,.ondas2").removeClass("animar")):(a.radio.play(),o.addClass("animar"),$(".ondas,.ondas2").addClass("animar"),o.addClass("on"))},onRadioMute:function(){var a=$(this);a.hasClass("on")?(a.removeClass("on"),$(".musica-vol2").fadeOut()):(a.addClass("on"),$(".musica-vol2").fadeIn())},onRadioInfo:function(){var a=$(".musica-capa");a.hasClass("on")?a.removeClass("on"):a.addClass("on")},radio:new Audio($(".player").data("url"))};$(".musica-pause").on("click",function(){a.radio.pause(),$(".musica-play").removeClass("animar"),$(".ondas,.ondas2").removeClass("animar"),$(".musica-play").addClass("on")}),$(".musica-play").on("click",a.onRadioPlay),$(".musica-vol1").on("click",a.onRadioMute),$(".btn-infor").on("click",a.onRadioInfo),$(".jp-mute").on("click",function(){a.radio.volume=0}),a.getMusicaAtual();var o=$("#volume").slider({tooltip:"always"}).on("slide",function(){var s;s=10==o.getValue()?"1":"0."+o.getValue(),a.radio.volume=s}).data("slider")});</script><style>body{margin:0;padding:0}.ucplayer{background:#fff;position:relative;height:90px;overflow:hidden;display:table;width:100%;max-width:4000px}.ucplayer1{display:table-cell;width:33%;position:relative}.ucplayer2{display:table-cell;width:33%}.ucplayer3{display:table-cell;width:33%;text-align:right}.musica-body{background:#fff;position:relative;max-height:90px;overflow:hidden}.box-controls{position:relative;width:147px;margin:4px auto}.musica-play{margin:auto;text-align:center;width:60px;height:60px;color:#000;padding:10px;border-radius:100%}.musica-play i{margin:8px 15px;display:block;font-size:2.7em;color:#fff}.musica-play:after{width:140px;height:140px;border:1px solid #999;content:'';top:-30px;left:3px;border-radius:100px;position:absolute}.musica-play.animar:after,.musica-play.animar:before{-webkit-animation-name:animar;-webkit-animation-duration:4s;animation-name:animar;animation-duration:4s;animation-iteration-count:infinite}.ondas{display:none;width:200px;height:200px;border:1px solid #d5d5d5;content:'';top:-60px;left:-30px;border-radius:100%;position:absolute}.ondas2{display:none;width:250px;height:250px;border:1px solid #777;content:'';top:-85px;left:-55px;border-radius:100%;position:absolute}.ondas2:after{width:280px;height:280px;border:1px solid #333;content:'';top:-16px;left:-16px;border-radius:100%;position:absolute}.ondas2:before{width:340px;height:340px;border:1px solid #000;content:'';top:-47px;left:-47px;border-radius:100%;position:absolute}.ondas.animar,.ondas2.animar,.ondas2.animar:after,.ondas2.animar:before{display:block;-webkit-animation-name:animar;-webkit-animation-duration:4s;animation-name:animar;animation-duration:4s;animation-iteration-count:infinite}@keyframes animar{0%{transform:scale(1)}50%{transform:scale(1.3)}50%{transform:scale(1.5)}75%{transform:scale(1.8),opacity:.5}100%{transform:scale(2);opacity:.1}}.musica-play:before{width:160px;height:160px;border:1px solid #999;content:'';top:-40px;left:-8px;border-radius:100px;position:absolute}.musica-vol1{position:absolute;top:50%;margin-top:-18px;background:#000;padding:10px;border-radius:100%;width:15px;height:15px;color:#fff;text-align:center}.musica-pause{position:absolute;top:50%;right:0;margin-top:-18px;background:#000;padding:10px;border-radius:100%;width:15px;height:15px;color:#fff;text-align:center}.musica-vol1:hover body>.musica-vol2{display:block}.musica-vol2{position:absolute;display:none;bottom:0;left:0}.slider-handle{border-radius:100%}.slider{width:140px!important}.slider-track{border:1px solid #ccc}#GC>.tooltip{position:absolute;bottom:20px;z-index:10;color:#8716b8}.slider-selection{background:#8716b8}.shareds{position:absolute;right:0;top:0;bottom:0}.shareds ul{padding:10px;margin:10px 0;text-align:center;display:table-cell;height:50px;overflow:hidden}.shareds li{width:50px;border-radius:100%;position:relative;display:inline-block;padding:10px;height:50px}.shareds li:hover{border-radius:100%;-webkit-filter:blur(2px);filter:blur(3px) brightness(200%)}.shareds li a{color:#fff;bottom:0;position:relative;display:inline-block;padding:9px 0}.shareds li i{width:50px}.instagram{background:#8716b8;background-image:-linear-gradient(to bottom,#b81639,#8716b8);background-image:-webkit-linear-gradient(to bottom,#b81639,#8716b8);background-image:-moz-linear-gradient(to right bottom,#b81639,#8716b8);background-image:-o-linear-gradient(to bottom,#b81639,#8716b8)}.twitter{background:#3193cc}.whatsapp{background:#009652}.facebook{background:#004196}.capa-radio{border:1px solid #ddd;display:block;height:80px;width:100px;float:left;background-size:cover!important;margin:4px 10px;border-radius:4px}.musica-musica-atual{background:#000;color:#fff;font-size:16px;font-family:arial,sans-serif;text-transform:uppercase;padding:5px 15px;max-width:600px;border-radius:10px;width:90%;position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);z-index:1000}.musica-musica-atual label{font-weight:700;overflow:hidden;float:left;display:inline-block}.musica-musica-atual span{font-weight:700;overflow:hidden;float:left;margin-left:10px;max-width:350px;display:inline-block}.cover{position:absolute;width:140px;top:0;z-index:1;right:310px;height:90px;background-size:contain!important;background-repeat:no-repeat!important}@media (max-width:1260px){.twitter{display:none!important}.shareds li{position:relative;display:inline-block;padding:10px;height:70px;transform:skew(-15deg)}.shareds li a{color:#fff;bottom:0;position:relative;display:inline-block;padding:10px 0;transform:skew(15deg)}.cover-musica{right:220px;width:90px;background-size:cover!important}}@media (max-width:960px){.twitter{display:none!important}.shareds li{position:relative;display:inline-block;padding:10px;height:70px;transform:skew(-15deg)}.shareds li a{color:#fff;bottom:0;position:relative;display:inline-block;padding:10px 0;transform:skew(15deg)}.cover-musica{right:220px;width:90px;background-size:cover!important}.musica-musica-atual{max-width:300px;overflow:hidden}.musica-musica-atual span{font-weight:700;overflow:hidden;margin-left:10px}}@media (max-width:768px){.twitter{display:none!important}.shareds li{position:relative;display:inline-block;padding:10px;height:70px;transform:skew(-15deg)}.shareds li a{color:#fff;bottom:0;position:relative;display:inline-block;padding:10px 0;transform:skew(15deg)}.cover-musica{right:150px;width:90px;background-size:cover!important}.capa-radio{width:80px}.twitter{display:none!important}.instagram{display:none!important}}@media (max-width:548px){.cover-musica{display:none}.musica-musica-atual{display:none}.capa-radio{width:80px}}@media (max-width:430px){.shareds{display:none}}</style></head> <body class="mobo" > <div class="player" data-porta="<?php echo $porta; ?>" data-api="<?php echo $url_source_streaming; ?>" data-autoplay='1' data-volume='8' data-url="<?php echo $url_source_streaming; ?>" ></div><div class='ucplayer' style="background:<?php echo "#".query_string('5'); ?>;border-bottom:4px solid <?php echo "#".query_string('3'); ?>"><div class='ucplayer1'><?php if(query_string('2')) { ?><div class="musica-musica-atual" style="background:#3e1c63;color:#b04374" > <span><div id='musica'></div></span> </div><?php } ?></div><div class='ucplayer2'><div class="box-controls"> <div class="ondas"></div><div class="ondas2"></div><div class="musica-play" style="background:<?php echo "#".query_string('3'); ?>"><i class="fa fa-play fa-4x" style="color:<?php echo "#".query_string('4'); ?>"></i></div><div class="musica-pause" style="background:<?php echo "#".query_string('3'); ?>"><i class="fa fa-pause" style="color:<?php echo "#".query_string('4'); ?>"></i></div><div class="musica-vol1" style="background:<?php echo "#".query_string('3'); ?>" data-tipo="menos"><i class="fa fa-volume-up" style="color:<?php echo "#".query_string('4'); ?>"></i></div><div class="musica-vol2" data-tipo="mais"> <input type="slider" class="span2" value="" data-slider-min="0" data-slider-max="10" data-slider-step="1" data-slider-value="5" data-slider-id="GC" id="volume" data-slider-tooltip="true" data-slider-handle="custom"/> </div></div></div><div class='ucplayer3'><div class="btn-infor shareds "> <ul class="btn-footer"> <?php echo $facebook; ?><?php echo $instagram; ?><?php echo $whatsapp; ?></ul> </div></div></div><div class="musica-body "> <div class="cover cover-musica"> </div></div><script>function load_musica_atual(){$(function(){$.ajax({url:"/musica-atual/<?php echo $dados_stm["porta"]; ?>",type:"GET",success:function(o){o?($("#status").html('Online <div class="light"></div>'),$("#musica").html('<marquee width="100%" direction="left">Tocando agora: '+o+"</marquee>")):($("#status").text("Offline"),$("#musica").html(""))}})})}setInterval(load_musica_atual,6e4),load_musica_atual();</script></body></html>