<?php
header("Content-Type: text/html;  charset=ISO-8859-1",true);
function status_ao_vivo($ip,$porta,$senha){$ch=curl_init();curl_setopt($ch,CURLOPT_URL,"http://".$ip.":".$porta."/admin.cgi?sid=1&mode=viewxml&pass=".$senha."");curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,2);curl_setopt($ch,CURLOPT_TIMEOUT,2);curl_setopt($ch,CURLOPT_USERAGENT,'Painel de Streaming 3.0.0');$resultado=curl_exec($ch);$status_http=curl_getinfo($ch,CURLINFO_HTTP_CODE);curl_close($ch);if($status_http==200){$xml=@simplexml_load_string(utf8_encode($resultado));if(filter_var($xml->STREAMSOURCE,FILTER_VALIDATE_IP)&&($xml->STREAMSOURCE!="127.0.0.1"&&$xml->STREAMSOURCE!=$ip)){return "aovivo";}}}

$porta = query_string('1');

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

$verifica_stm = @mysqli_fetch_array(@mysqli_query($conexao,"SELECT COUNT(*) as total FROM streamings where porta = '".$porta."'"));

if($verifica_stm["total"] == 0) {
  die('<style> body { margin:0; padding:0; background-color:#000000}</style><div style="width:100%;text-align:center;margin-top:30%;font-size: 14px;font-family: Geneva, Arial, Helvetica, sans-serif;color:#FFFFFF;padding-left: 10px; padding-right: 10px"><img width="256" height="256" src="/app-multi-plataforma/img-app-offline.png" alt="Radio Offline" title="Radio Offline"><br><br><br><br><br>Estamos atualizando nosso App, por favor volte em alguns minutos.<br><br>We are updating our App, please come back in a few minutes.<br><br>Estamos actualizando nuestro App, por favor regrese en unos pocos minutos.</div>');
}

$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"]."'"));
$dados_app_multi_plataforma = @mysqli_fetch_array(@mysqli_query($conexao,"SELECT * FROM app_multi_plataforma where codigo_stm = '".$dados_stm["codigo"]."'"));

$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($_SERVER["HTTPS"] != "on") {
  header("Location: https://" . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"]);
  exit();
}

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

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);
$musica_completa = ucwords(strtolower($musica_completa));
$musica_completa = utf8_decode($musica_completa);
  
$musica_completa = str_replace(" e "," & ",$musica_completa);
$musica_completa = str_replace(" E "," & ",$musica_completa);
$musica_completa = str_replace(".","",$musica_completa);

$musica_partes = explode("-",$musica_completa);

$artista = str_replace("_"," ",$musica_partes[0]);
$artista = rtrim($artista, " \t.");
  
$artista = str_replace(" ","-",$artista);

$artista = ($artista) ? $artista : $musica_completa;

$dados_api_itunes_json = json_decode(@file_get_contents("https://itunes.apple.com/search?term=".$artista."&media=music&limit=1"),true);

if($dados_api_itunes_json["results"][0]["artworkUrl100"] && $dados_app_multi_plataforma["exibir_capa"] == "sim") {
echo str_replace("100x100bb", "600x600bb", $dados_api_itunes_json["results"][0]["artworkUrl100"]);
exit();
}

echo $dados_app_multi_plataforma["url_logo"];

exit();
}

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

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);
$musica_completa = ucwords(strtolower($musica_completa));
$musica_completa = utf8_decode($musica_completa);
  
$musica_completa = str_replace(" e "," & ",$musica_completa);
$musica_completa = str_replace(" E "," & ",$musica_completa);
$musica_completa = str_replace(".","",$musica_completa);

$musica_partes = explode("-",$musica_completa);

$artista = str_replace("_"," ",$musica_partes[0]);
$artista = rtrim($artista, " \t.");
  
$artista = str_replace(" ","-",$artista);

$artista = ($artista) ? $artista : $musica_completa;

$dados_api_itunes_json = json_decode(@file_get_contents("https://itunes.apple.com/search?term=".$artista."&media=music&limit=1"),true);

if($dados_api_itunes_json["results"][0]["artworkUrl100"] && $dados_app_multi_plataforma["exibir_capa"] == "sim") {
echo str_replace("100x100bb", "600x600bb", $dados_api_itunes_json["results"][0]["artworkUrl100"])."|".$musica_completa;
exit();
}

echo $dados_app_multi_plataforma["url_logo"]."|".$musica_completa;

exit();
}

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);
echo str_replace("_"," ",$musica_completa);

exit();
}

if(query_string('2') == "manifest.webmanifest") {
header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header('Content-Type: application/manifest+json');
echo '{
  "short_name": "'.utf8_encode($dados_app_multi_plataforma["nome"]).'",
  "name": "'.utf8_encode($dados_app_multi_plataforma["nome"]).'",
  "icons": [
    {
      "src": "'.$dados_app_multi_plataforma["url_logo"].'",
      "type": "image/png",
      "sizes": "300x300",
      "purpose": "any"
    }
  ],
  "description": "Radio App",
  "start_url": "https://player.'.$dados_config["dominio_padrao"].'/player-app-multi-plataforma/'.$dados_stm["porta"].'?app-multi='.time().'",
  "scope": "/player-app-multi-plataforma/'.$dados_stm["porta"].'",
  "display": "standalone",
  "orientation": "portrait",
  "theme_color": "'.$dados_app_multi_plataforma["cor_splash"].'",
  "background_color": "'.$dados_app_multi_plataforma["cor_splash"].'"
}';

exit();
}

$status_conexao_transmissao = status_ao_vivo($dados_servidor["ip"],$dados_stm["porta"],$dados_stm["senha_admin"]);

$logo_radio = ($dados_app_multi_plataforma["url_logo"]) ? $dados_app_multi_plataforma["url_logo"] : "/app-multi-plataforma/img-app-logo.png";
$background_radio = ($dados_app_multi_plataforma["url_background"]) ? "background: url('".$dados_app_multi_plataforma["url_background"]."') bottom / cover no-repeat;" : "background: #000000";

$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"]."";

$array_lang = array(
	"pt-br" => array("redes_sociais" => "Redes Sociais", "politica" => "Pol&iacute;tica & Privacidade", "pedir_musica" => "Pedir M&uacute;sica", "voltar" => "Voltar", "prog" => "Nossa Programa&ccedil;&atilde;o", "hist" => "Nossa Hist&oacute;ria", "aviso_instalar" => "Clique no bot&atilde;o abaixo para instalar o App com seguran&ccedil;a em seu aparelho.", "aviso_instalar_iphone" => "Para instalar o App, aperte o botão <img width='23' height='32' src='/app-multi-plataforma/img-icone-share-ios.png'> de compartilhar em seu iPhone e escolha a opção &quot;Adicionar a Tela de Inicio&quot;", "aviso_instalar_windows" => "Para usar este App Windows, voc&ecirc; precisa clicar no bot&atilde;o de instala&ccedil;&atilde;o que ser&aacute; exibido pelo navegador.<br>Se ja estiver instalado, abra-o pelo menu iniciar <i class='fa fa-windows'></i> do seu windows.<br><br>&Eacute; necessario uso do navegador Chrome<i class='fa fa-chrome'></i> ou Edge<i class='fa fa-edge'></i> para a instala&ccedil;&atilde;o.", "aviso_atualizar" => "Uma nova vers&atilde;o do App esta dispon&iacute;vel, clique para atualizar.", "btn_instalar" => "Instalar App"),

	"en" => array("redes_sociais" => "Social Networks", "politica" => "Privacy Policy.", "pedir_musica" => "Request Song", "voltar" => "Back", "prog" => "Our Schedule", "hist" => "Our Story", "aviso_instalar" => "Click the button below to install the App safely on your device.", "aviso_instalar_iphone" => "To install the App, press the share button <img width='23' height='32' src='/app-multi-plataforma/img-icone-share-ios.png'> on your iPhone and choose the option &quot;Add to Home Screen&quot;", "aviso_instalar_windows" => "To use this Windows App, you need to click on the installation button that will be displayed by the browser.<br>If is already installed, then open the app by the start menu <i class='fa fa-windows'></i> on your windows.<br><br>Chrome<i class='fa fa-chrome'></i> or Edge<i class='fa fa-edge'></i> browser is required for installation.", "aviso_atualizar" => "A new version of the App is available, click to update.", "btn_instalar" => "Install App"),

	"es" => array("redes_sociais" => "Redes Sociales", "politica" => "Pol&iacute;tica de Privacidad", "pedir_musica" => "Pedir Canci&oacute;n", "voltar" => "Volver", "prog" => "Nuestro Horario", "hist" => "Nuestra Historia", "aviso_instalar" => "Haga clic en el bot&oacute;n de abajo para instalar la aplicaci&oacute;n de forma segura en su dispositivo.", "aviso_instalar_iphone" => "Para instalar la aplicaci&oacute;n, presione el bot&oacute;n compartir <img width='23' height='32' src='/app-multi-plataforma/img-icone-share-ios.png'> en su iPhone y elija la opci&oacute;n &quot;A&ntilde;adir a la pantalla de inicio&quot;", "aviso_instalar_windows" => "Para utilizar esta aplicaci&oacute;n de Windows, debe hacer clic en el bot&oacute;n de instalaci&oacute;n que se mostrar&aacute; en el navegador.<br>Si ya est&aacute; instalado, &aacute;bralo desde el men&uacute; de inicio <i class='fa fa-windows'></i> en su windows.<br><br>Se requiere el navegador Chrome<i class='fa fa-chrome'></i> o Edge<i class='fa fa-edge'></i> para la instalaci&oacute;n.", "aviso_atualizar" => "Hay una nueva versi&oacute;n de la aplicaci&oacute;n disponible, haga clic para actualizar.", "btn_instalar" => "Instalar App")
);
for($i=0;$i<=1000;$i++){echo "\n\n";}for($i=0;$i<=100;$i++){echo "        ";}
?>
<!DOCTYPE html>
<html lang="pt-BR">
<head>
<meta charset="UTF-8">
<title><?php echo $dados_app_multi_plataforma["nome"];?></title>
<meta http-equiv="cache-control" content="max-age=0" />
<meta http-equiv="cache-control" content="no-cache" />
<meta http-equiv="expires" content="0" />
<meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT" />
<meta http-equiv="pragma" content="no-cache" />
<meta name="Description" content="Radio App">
<meta name="apple-touch-fullscreen" content="yes">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-title" content="<?php echo $dados_app_multi_plataforma["nome"];?>">
<meta name="msapplication-TileColor" content="<?php echo $dados_app_multi_plataforma["cor_splash"]; ?>">
<meta name="theme-color" content="<?php echo $dados_app_multi_plataforma["cor_splash"]; ?>">
<link rel="icon" type="image/png" href="<?php echo $dados_app_multi_plataforma["url_logo"];?>" sizes="300x300" />
<link rel="apple-touch-icon" sizes="300x300" href="<?php echo $dados_app_multi_plataforma["url_logo"];?>">
<link rel="manifest" href="/player-app-multi-plataforma/<?php echo $dados_stm["porta"];?>/manifest.webmanifest?<?php echo time();?>"/>
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta http-equiv=X-UA-Compatible content="IE=edge,chrome=1">
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta2/dist/js/bootstrap.bundle.min.js" integrity="sha384-b5kHyXgcpbZJO/tY9Ul7kGkf1S0CWuKcCD38l8YkeH8z8QjE0GmW1gYU5S9FOnJ0" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/limonte-sweetalert2/10.6.1/sweetalert2.min.js"></script>
<?php if(!empty($_GET["app-multi"])) {?>
<script src="/app-multi-plataforma/player.js"></script>
<?php } ?>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BmbxuPwQa2lc/FVzBcNJ7UAyJxM6wuqIj61tLrc4wSX0szH/Ev+nYRRuWlolflfl" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/limonte-sweetalert2/10.6.1/sweetalert2.css">
<style> body { margin:0; padding:0; background-color:#000000}#player-app-volumewrapper{display: none;}#player-app-buttonvolumeoff{display: none;}#player-app-buttonvolumeon{display: none;}#player-app-textvolumeend{display: none;}<?php if($status_conexao_transmissao != "aovivo") { echo '#player-app-iconlive{display: none;}'; } else { echo '#player-app-iconlive{fill: rgb(255 0 0 / 100%)!important;}'; } ?>#player-app-buttonanalyzer{display: none;}.icone-menu{position:absolute;left:0;top:0;width: 32px;height: 32px;padding-left: 5px;padding-bottom: 10px; margin: 10px; border-radius: 3px;color: #FFFFFF;font-size: 32px;text-align: center;z-index: 500;}@import url(https://fonts.googleapis.com/css?family=Poppins:300,400,500,600,700);body{font-family:Poppins,sans-serif;background:#fafafa}p{font-family:Poppins,sans-serif;font-size:1.1em;font-weight:300;line-height:1.7em;color:#999}a,a:focus,a:hover{color:inherit;text-decoration:none;transition:all .3s}.navbar{padding:15px 10px;background:#fff;border:none;border-radius:0;margin-bottom:40px;box-shadow:1px 1px 3px rgba(0,0,0,.1)}.navbar-btn{box-shadow:none;outline:0!important;border:none}.line{width:100%;height:1px;border-bottom:1px dashed #ddd;margin:40px 0}#sidebar{width:250px;position:fixed;top:0;left:-250px;height:100vh;z-index:999;background:<?php echo $dados_app_multi_plataforma["cor_menu_claro"]; ?>;color:#fff;transition:all .3s;overflow-y:scroll;box-shadow:3px 3px 3px rgba(0,0,0,.2);overflow: hidden}#sidebar.active{left:0}#dismiss{width:30px;height:30px;line-height:30px;text-align:center;background:<?php echo $dados_app_multi_plataforma["cor_menu_claro"]; ?>;position:absolute;top:10px;right:10px;cursor:pointer;-webkit-transition:all .3s;-o-transition:all .3s;transition:all .3s}#dismiss2{width:70px;height:30px;line-height:30px;text-align:center;background:<?php echo $dados_app_multi_plataforma["cor_menu_claro"]; ?>;position:absolute;top:5px;left:5px;cursor:pointer;color: #FFFFFF;}#dismiss:hover{background:#fff;color:<?php echo $dados_app_multi_plataforma["cor_menu_claro"]; ?>}.overlay{display:none;position:fixed;width:100vw;height:100vh;background:rgba(0,0,0,.7);z-index:998;opacity:0;transition:all .5s ease-in-out}.overlay.active{display:block;opacity:1}#sidebar .sidebar-header{padding:20px;background:<?php echo $dados_app_multi_plataforma["cor_menu_escuro"]; ?>}#sidebar ul.components{padding:20px 0;}#sidebar ul p{color:#fff;padding:10px}#sidebar ul li a{padding:10px;font-size:1.1em;display:block}#sidebar ul li a:hover{color:<?php echo $dados_app_multi_plataforma["cor_menu_claro"]; ?>;background:#fff}#sidebar ul li.active>a,a[aria-expanded=true]{color:#fff;background:<?php echo $dados_app_multi_plataforma["cor_menu_escuro"]; ?>}a[data-bs-toggle=collapse]{position:relative}.dropdown-toggle::after{display:block;position:absolute;top:50%;right:20px;transform:translateY(-50%)}ul ul a{font-size:.9em!important;padding-left:30px!important;background:<?php echo $dados_app_multi_plataforma["cor_menu_escuro"]; ?>}ul.CTAs{padding:20px}ul.CTAs a{text-align:center;font-size:.9em!important;display:block;border-radius:5px;margin-bottom:5px}a.download{background:#fff;color:<?php echo $dados_app_multi_plataforma["cor_menu_claro"]; ?>}a.article,a.article:hover{background:<?php echo $dados_app_multi_plataforma["cor_menu_escuro"]; ?>!important;color:#fff!important}#content{width:100%;padding:20px;min-height:100vh;transition:all .3s;position:absolute;top:0;right:0}.chromeframe{margin:.2em 0;background:#ccc;color:#000;padding:.2em 0}#loader-wrapper{position:fixed;top:0;left:0;width:100%;height:100%;z-index:1000}#loader{display:block;position:relative;left:50%;top:50%;width:150px;height:150px;margin:-75px 0 0 -75px;border-radius:50%;border:3px solid transparent;border-top-color:#3498db;-webkit-animation:spin 2s linear infinite;animation:spin 2s linear infinite;z-index:1001}#loader:before{content:"";position:absolute;top:5px;left:5px;right:5px;bottom:5px;border-radius:50%;border:3px solid transparent;border-top-color:#e74c3c;-webkit-animation:spin 3s linear infinite;animation:spin 3s linear infinite}#loader:after{content:"";position:absolute;top:15px;left:15px;right:15px;bottom:15px;border-radius:50%;border:3px solid transparent;border-top-color:#f9c922;-webkit-animation:spin 1.5s linear infinite;animation:spin 1.5s linear infinite}@-webkit-keyframes spin{0%{-webkit-transform:rotate(0);-ms-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(360deg);-ms-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes spin{0%{-webkit-transform:rotate(0);-ms-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(360deg);-ms-transform:rotate(360deg);transform:rotate(360deg)}}#loader-wrapper .loader-section{position:fixed;top:0;width:51%;height:100%;background:#222;z-index:1000}#loader-wrapper .loader-section.section-left{left:0}#loader-wrapper .loader-section.section-right{right:0}.loaded #loader-wrapper .loader-section.section-left{-webkit-transform:translateX(-100%);-ms-transform:translateX(-100%);transform:translateX(-100%);-webkit-transition:all .7s .3s cubic-bezier(.645,.045,.355,1);transition:all .7s .3s cubic-bezier(.645,.045,.355,1)}.loaded #loader-wrapper .loader-section.section-right{-webkit-transform:translateX(100%);-ms-transform:translateX(100%);transform:translateX(100%);-webkit-transition:all .7s .3s cubic-bezier(.645,.045,.355,1);transition:all .7s .3s cubic-bezier(.645,.045,.355,1)}.loaded #loader{opacity:0;-webkit-transition:all .3s ease-out;transition:all .3s ease-out}.loaded #loader-wrapper{visibility:hidden;-webkit-transform:translateY(-100%);-ms-transform:translateY(-100%);transform:translateY(-100%);-webkit-transition:all .3s 1s ease-out;transition:all .3s 1s ease-out}.ir{background-color:transparent;border:0;overflow:hidden}.ir:before{content:"";display:block;width:0;height:150%}.hidden{display:none!important;visibility:hidden}.visuallyhidden{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.visuallyhidden.focusable:active,.visuallyhidden.focusable:focus{clip:auto;height:auto;margin:0;overflow:visible;position:static;width:auto}.invisible{visibility:hidden}.clearfix:after,.clearfix:before{content:" ";display:table}.clearfix:after{clear:both}</style>
</head>
<body oncontextmenu="return false">
<?php if(empty($_GET["app-multi"])) {?>

<?php  $Android = stripos($_SERVER['HTTP_USER_AGENT'],"Android"); $iPhone  = stripos($_SERVER['HTTP_USER_AGENT'],"iPhone"); $Windows  = stripos($_SERVER['HTTP_USER_AGENT'],"Windows"); ?>

<?php if($Android) { ?>

<div style="width:100%;text-align:center;margin-top:20px;font-size: 18px;font-family: Geneva, Arial, Helvetica, sans-serif;color:#333333;padding-left: 10px; padding-right: 10px"><img width="256" height="256" src="<?php echo $dados_app_multi_plataforma["url_logo"]; ?>" alt="<?php echo $dados_app_multi_plataforma["nome"]; ?>" title="<?php echo $dados_app_multi_plataforma["nome"]; ?>"><br><br><br><?php echo $array_lang[$dados_stm["idioma_painel"]]["aviso_instalar"]; ?><br><br><br><button id="instalar" type="button" class="btn btn-success" style="font-size: inherit;"><i class='fa fa-android'></i> <?php echo $array_lang[$dados_stm["idioma_painel"]]["btn_instalar"]; ?></button></div>

<?php } ?>

<?php if($iPhone) { ?>

<div style="width:100%;text-align:center;margin-top:20px;font-size: 18px;font-family: Geneva, Arial, Helvetica, sans-serif;color:#333333;padding-left: 10px; padding-right: 10px"><img width="256" height="256" src="<?php echo $dados_app_multi_plataforma["url_logo"]; ?>" alt="<?php echo $dados_app_multi_plataforma["nome"]; ?>" title="<?php echo $dados_app_multi_plataforma["nome"]; ?>"><br><br><br><?php echo $array_lang[$dados_stm["idioma_painel"]]["aviso_instalar"]; ?><br><br><br><button type="button" class="btn btn-success" style="font-size: inherit;" onClick="instalar_app_iphone();"><i class='fa fa-apple'></i> <?php echo $array_lang[$dados_stm["idioma_painel"]]["btn_instalar"]; ?></button></div>

<?php } ?>

<?php if($Windows) { ?>

<div style="width:100%;text-align:center;margin-top:20px;font-size: 18px;font-family: Geneva, Arial, Helvetica, sans-serif;color:#333333;padding-left: 10px; padding-right: 10px"><img width="256" height="256" src="<?php echo $dados_app_multi_plataforma["url_logo"]; ?>" alt="<?php echo $dados_app_multi_plataforma["nome"]; ?>" title="<?php echo $dados_app_multi_plataforma["nome"]; ?>"><br><br><br><?php echo $array_lang[$dados_stm["idioma_painel"]]["aviso_instalar_windows"]; ?><br><br><br><button id="instalar" type="button" class="btn btn-success" style="font-size: inherit;"><i class='fa fa-windows'></i> <?php echo $array_lang[$dados_stm["idioma_painel"]]["btn_instalar"]; ?></button></div>

<?php } ?>

<?php } else {?>
<div id="loader-wrapper"><div id="loader"></div><div class="loader-section section-left"></div><div class="loader-section section-right"></div></div>
<div class="icone-menu"><button type="button" id="sidebarCollapse" class="btn btn-sm btn-light"><i class="fa fa-bars"></i></button></div>
<nav id="sidebar">
   <div id="dismiss">
      <i class="fa fa-arrow-left"></i>
   </div>
   <div class="sidebar-header">
      <h4><?php echo $dados_app_multi_plataforma["nome"]; ?></h3>
   </div>
   <ul class="list-unstyled components">
    <?php if($dados_app_multi_plataforma["url_facebook"] || $dados_app_multi_plataforma["url_instagram"] || $dados_app_multi_plataforma["url_twitter"] || $dados_app_multi_plataforma["url_site"] || $dados_app_multi_plataforma["url_youtube"]) { ?>
      <li>
        <a href="#redessociais" data-bs-toggle="collapse" aria-expanded="false"><i class="fa fa-heart"></i> <?php echo $array_lang[$dados_stm["idioma_painel"]]["redes_sociais"]; ?></a>
        <ul class="collapse list-unstyled" id="redessociais">
          <?php if($dados_app_multi_plataforma["url_facebook"]) { ?>
           <li>
              <a target="_blank" rel="noopener" href="<?php echo $dados_app_multi_plataforma["url_facebook"]; ?>" ><i class="fa fa-facebook-official"></i> Facebook</a>
           </li>
          <?php } ?>
          <?php if($dados_app_multi_plataforma["url_instagram"]) { ?>
           <li>
              <a target="_blank" rel="noopener" href="<?php echo $dados_app_multi_plataforma["url_instagram"]; ?>"><i class="fa fa-instagram"></i> Instagram</a>
           </li>
          <?php } ?>
          <?php if($dados_app_multi_plataforma["url_twitter"]) { ?>
           <li>
              <a target="_blank" rel="noopener" href="<?php echo $dados_app_multi_plataforma["url_twitter"]; ?>"><i class="fa fa-twitter"></i> Twitter</a>
           </li>
          <?php } ?>
          <?php if($dados_app_multi_plataforma["url_site"]) { ?>
           <li>
              <a target="_blank" rel="noopener" href="<?php echo $dados_app_multi_plataforma["url_site"]; ?>"><i class="fa fa-globe"></i> Site</a>
           </li>
          <?php } ?>
          <?php if($dados_app_multi_plataforma["url_youtube"]) { ?>
           <li>
              <a target="_blank" rel="noopener" href="<?php echo $dados_app_multi_plataforma["url_youtube"]; ?>"><i class="fa fa-youtube"></i> YouTube</a>
           </li>
          <?php } ?>
        </ul>
      </li>
    <?php } ?>
    <?php if($dados_app_multi_plataforma["url_pedir_musica"]) { ?>
      <li>
         <a href="#" onClick="abrir_link('<?php echo $dados_app_multi_plataforma["url_pedir_musica"]; ?>')"><i class="fa fa-bullhorn"></i> <?php echo $array_lang[$dados_stm["idioma_painel"]]["pedir_musica"]; ?></a>
      </li>
     <?php } ?>
     <?php if($dados_app_multi_plataforma["url_chat"]) { ?>
      <li>
         <a href="#" onClick="abrir_link('<?php echo $dados_app_multi_plataforma["url_chat"]; ?>')"><i class="fa fa-comments"></i> Chat</a>
      </li>
     <?php } ?>
     <?php if($dados_app_multi_plataforma["url_camera_studio"]) { ?>
      <li>
         <a href="#" onClick="abrir_camera_studio('<?php echo $dados_app_multi_plataforma["url_camera_studio"]; ?>')"><i class="fa fa-video-camera"></i> Camera Studio</a>
      </li>
     <?php } ?>
     <?php if($dados_app_multi_plataforma["whatsapp"]) { ?>
      <li>
         <a href="https://api.whatsapp.com/send/?phone=<?php echo $dados_app_multi_plataforma["whatsapp"]; ?>&text&app_absent=0"><i class="fa fa-whatsapp"></i> Whatsapp</a>
      </li>
     <?php } ?>
     <?php if($dados_app_multi_plataforma["text_prog"]) { ?>
      <li>
         <a href="#" onClick="abrir_link('/app-multi-plataforma/texto/<?php echo $dados_stm["porta"]; ?>/programacao')"><i class="fa fa-calendar-check-o"></i> <?php echo $array_lang[$dados_stm["idioma_painel"]]["prog"]; ?></a>
      </li>
     <?php } ?>
     <?php if($dados_app_multi_plataforma["text_hist"]) { ?>
      <li>
         <a href="#" onClick="abrir_link('/app-multi-plataforma/texto/<?php echo $dados_stm["porta"]; ?>/historia')"><i class="fa fa-info-circle"></i> <?php echo $array_lang[$dados_stm["idioma_painel"]]["hist"]; ?></a>
      </li>
     <?php } ?>
      <li>
         <a href="#app" data-bs-toggle="collapse" aria-expanded="false"><i class="fa fa-tablet"></i> App</a>
         <ul class="collapse list-unstyled" id="app">
            <li>
               <a href="#" onClick="abrir_link('/app-multi-plataforma/politica.html')"><i class="fa fa-gavel"></i> <?php echo $array_lang[$dados_stm["idioma_painel"]]["politica"]; ?></a>
            </li>
            <?php if($dados_app_multi_plataforma["email"]) { ?>
            <li>
               <a href="mailto:<?php echo $dados_app_multi_plataforma["email"]; ?>"><i class="fa fa-envelope"></i> E-mail</a>
            </li>
        <?php } ?>
         </ul>
      </li>
   </ul>
</nav>
<div id="conteudo_externo" style="position: absolute;left:0px;top:0px;width:100%;height:100%;background: #FFFFFF;margin:0;padding:0;z-index: 999999;display: none;">
<div style="width: 100%;height: 40px;margin:0;padding:0px 10px;background:<?php echo $dados_app_multi_plataforma["cor_menu_escuro"]; ?>"><div id="dismiss2"><i class="fa fa-arrow-left" onClick="$('#conteudo_externo').hide();$('#iframe_conteudo_externo').attr('src', '');"> <?php echo $array_lang[$dados_stm["idioma_painel"]]["voltar"]; ?></i></div></div>
<iframe target="_parent" id="iframe_conteudo_externo" frameborder="0" src="" style="position: absolute;width:100%;height:100%;background: #FFFFFF url('/app-multi-plataforma/app-loader.gif') center center no-repeat;margin:0;padding:0;z-index: 999999"></iframe>
</div>
<div class="overlay"></div>
<div id="player-app-" style="width:100%; height:100%;position: absolute; left:0; top:0; z-index: 300;<?php echo $background_radio; ?>"><center><img width="256" height="256" src="/app-multi-plataforma/app-loader.gif" style="margin-top: 15%" ></center></div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta2/dist/js/bootstrap.bundle.min.js" integrity="sha384-b5kHyXgcpbZJO/tY9Ul7kGkf1S0CWuKcCD38l8YkeH8z8QjE0GmW1gYU5S9FOnJ0" crossorigin="anonymous"></script>   
<script>
function ajustes_navegador() {  
var altura_tela = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
$("#conteudo_externo").height(altura_tela);
$("#iframe_conteudo_externo").height(altura_tela-35);
$("#sidebarCollapse").delay(200).fadeOut(100);
$("#sidebarCollapse").delay(200).fadeIn(100);
}
function abrir_link(link) {
$("#conteudo_externo").show();
$("#iframe_conteudo_externo").attr("src", link);
$('#sidebar').removeClass('active');
$('.overlay').removeClass('active');
}
function abrir_camera_studio(link) {
$("#conteudo_externo").show();
$("#iframe_conteudo_externo").attr("src", link);
$("#player-app-").data('lunaradio').pause();
$('#sidebar').removeClass('active');
$('.overlay').removeClass('active');
}
function load_cover() {

$.ajax({
url:"/player-app-multi-plataforma/<?php echo $dados_stm["porta"]; ?>/cover",
type:"GET",
success: function(cover, statusText, errorThrown){
  $("#player-app-coverwrapper2").css("background", "transparent url("+cover+") 0% 0% / cover no-repeat");
  $("#player-app-coverwrapper2").css("opacity", "1");
  $("#player-app-coverwrapper1").css("opacity", "0");
},
error: function(xhr, statusText, errorThrown){
  $("#player-app-coverwrapper2").css("opacity", "0");
  $("#player-app-coverwrapper1").css("opacity", "1");
}
});

}

function load_title() {

$.ajax({
url:"/player-app-multi-plataforma/<?php echo $dados_stm["porta"];?>/title",
type:"GET",
success: function(title, statusText, errorThrown){

var dados = title.split("|");
var cover = dados[0];
var musica = dados[1];

if ('mediaSession' in navigator) {

  navigator.mediaSession.metadata = new MediaMetadata({
    title: '<?php echo $dados_app_multi_plataforma["nome"];?>',
    artist: musica,
    //album: 'Whenever You Need Somebody',
    artwork: [
      { src: cover, sizes: '96x96',   type: 'image/jpeg' },
      { src: cover, sizes: '128x128', type: 'image/jpeg' },
      { src: cover, sizes: '192x192', type: 'image/jpeg' },
      { src: cover, sizes: '256x256', type: 'image/jpeg' },
      { src: cover, sizes: '384x384', type: 'image/jpeg' },
      { src: cover, sizes: '512x512', type: 'image/jpeg' },
    ]
  });

}

  $(document).attr("title", "<?php echo $dados_app_multi_plataforma["nome"];?>");
},
error: function(xhr, statusText, errorThrown){
  $(document).attr("title", "<?php echo $dados_app_multi_plataforma["nome"];?>");
}
});

}
$(document).ready(function () {
    $('#dismiss, .overlay').on('click', function () {
        $('#sidebar').removeClass('active');
        $('.overlay').removeClass('active');
    });
    $('#sidebarCollapse').on('click', function () {
        $('#sidebar').addClass('active');
        $('.overlay').addClass('active');
        $('.collapse.in').toggleClass('in');
        $('a[aria-expanded=true]').attr('aria-expanded', 'false');
    });
  $("#player-app-").lunaradio({
    userinterface: "big", 
    backgroundcolor: "",
    fontcolor: "<?php echo $dados_app_multi_plataforma["cor_texto"]; ?>",
    hightlightcolor: "#FFFFFF", 
    fontname: "Unica One", 
    googlefont: "Unica+One&display=swap", 
    fontratio: "0.6", 
    radioname: "<?php echo $dados_app_multi_plataforma["nome"]; ?>", 
    scroll: "true", 
    coverimage: "<?php echo $logo_radio; ?>",
    onlycoverimage: "true",
    coverstyle: "animated",
    usevisualizer: "real", 
    visualizertype: "<?php echo $dados_app_multi_plataforma["visualizer"]; ?>", 
    itunestoken: "1000lIPN", 
    metadatatechnic: "corsproxy", 
    usestreamcorsproxy: "false",
    corsproxy: "/player-app-multi-plataforma/<?php echo $dados_stm["porta"];?>/musica/", 
    streamurl: "<?php echo $url_source_streaming; ?>", 
    streamtype: "shoutcast2",
    shoutcastpath: "<?php echo $ponto; ?>",
    shoutcastid: "1", 
    metadatainterval: "30000", 
    volume: "100",
    debug: "false",
    autoplay: "true"
  });

setTimeout(ajustes_navegador,3000);
setTimeout(function(){$('body').addClass('loaded');}, 1000);
<?php if(empty($dados_app_multi_plataforma["exibir_capa"]) || $dados_app_multi_plataforma["exibir_capa"] == "sim"){ ?>
setTimeout(load_cover,5000);
setInterval(load_cover,30000);
<?php } ?>
setTimeout(load_title,2000);
setInterval(load_title,30000);
});
</script>
<?php } ?>
<script>
if ('serviceWorker' in navigator) {
    navigator.serviceWorker.register('/service-worker.js', {useCache: false, scope: '/player-app-multi-plataforma/<?php echo $dados_stm["porta"]; ?>'})
      .then(function(registration) {

    registration.addEventListener('updatefound', () => {
      newWorker = registration.installing;
      <?php if(!empty($_GET["app-multi"])) {?>
      newWorker.addEventListener('statechange', () => {
        switch (newWorker.state) {
          case 'installed':
            if (navigator.serviceWorker.controller) {
              Swal.fire({title: '',icon: 'warning',html: "<?php echo $array_lang[$dados_stm["idioma_painel"]]["aviso_atualizar"]; ?>"}).then((result) => { if (result.isConfirmed) { newWorker.postMessage({ action: 'skipWaiting' }); window.location.reload(); }})
            }
            break;
        }
      });
      <?php } ?>
    });
  });
}
if (('standalone' in navigator) && (!navigator.standalone)) {
    import('https://unpkg.com/pwacompat');
}
$(window).on("keydown",function(e){return 123==e.keyCode?!1:e.ctrlKey&&e.shiftKey&&73==e.keyCode?!1:e.ctrlKey&&73==e.keyCode?!1:void 0}),$(document).on("contextmenu",function(e){e.preventDefault()});
$(document).keydown(function(e){var o=String.fromCharCode(e.keyCode).toLowerCase();return!e.ctrlKey||"c"!=o&&"u"!=o?void 0:!1});</script>
<?php if(empty($_GET["app-multi"])) {?>
<script>
window.onload=function(){

let installPromptEvent;
window.addEventListener('beforeinstallprompt', (event) => {
  event.preventDefault();
  installPromptEvent = event;
});
window.addEventListener('appinstalled', () => {
  installPromptEvent = null;
  window.location = 'https://player.<?php echo $dados_config["dominio_padrao"]; ?>/player-app-multi-plataforma/<?php echo $dados_stm["porta"]; ?>?app-multi=<?php echo time(); ?>';
});
var buttonInstall = document.getElementById("instalar");
buttonInstall.addEventListener('click', (e) => {
  installPromptEvent.prompt();    
  installPromptEvent.userChoice.then((choice) => {}); 
});
}
function instalar_app_iphone() {
  Swal.fire({title: '',icon: 'info',html: "<?php echo $array_lang[$dados_stm["idioma_painel"]]["aviso_instalar_iphone"]; ?>"})
}
</script>
<?php } ?>
</body>
</html>
<?php for($i=0;$i<=1000;$i++){echo "\n\n";}for($i=0;$i<=100;$i++){echo "        ";} ?>