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

if(!is_numeric($porta)) {
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"]."'"));
$dados_onepage = @mysqli_fetch_array(@mysqli_query($conexao,"SELECT * FROM siteadm_onepage where codigo_stm = '".$dados_stm["codigo"]."'"));
$dados_servidor_camera_studio = mysqli_fetch_array(mysqli_query($conexao,"SELECT * FROM servidores where codigo = '".$dados_stm["codigo_servidor_camera_studio_atual"]."'"));

$servidor_camera_studio = code_decode($dados_servidor_camera_studio["nome"].".".$dados_config["dominio_padrao"],"E");

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

if($_SERVER["HTTPS"] != "on") {
  header("Location: https://" . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"]);
  exit();
}

$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') == "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_onepage["exibir_capa"] == "sim") {
echo str_replace("100x100bb", "600x600bb", $dados_api_itunes_json["results"][0]["artworkUrl100"]);
exit();
}

echo $dados_onepage["url_logo"];

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') == "rss") {
header('Content-type: application/xml');
$rss_feed = file_get_contents($dados_onepage["conteudo_menu_noticias"]);
$rss_feed = str_replace("<entry>", "<item>", $rss_feed);
$rss_feed = str_replace("</entry>", "</item>", $rss_feed);

echo $rss_feed;
exit();
}

$url_source_streaming = "https://".strtolower($dados_servidor["nome"]).".".$dados_config["dominio_padrao"].":".$dados_stm["porta"]."";

for($i=0;$i<=1000;$i++){echo "\n\n";}for($i=0;$i<=100;$i++){echo "        ";}
?>
<html lang="pt">
<head>
<title><?php echo $dados_onepage["nome"]; ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link href="<?php if(file_exists("site-adm-onepage/logo-".$dados_stm["porta"].".png")){ ?>/site-adm-onepage/logo-<?php echo $dados_stm["porta"]; ?>.png<?php } else { ?>/site-adm-onepage/img/logo.png<?php } ?>" rel="shortcut icon">    
<meta http-equiv="content-language" content="Portuguese">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link type="text/css" rel="stylesheet" href="https://fonts.googleapis.com/css?family=Oswald:500">
<link rel="stylesheet" href="/site-adm-onepage/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.5.2/animate.min.css">
<link rel="stylesheet" href="https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
<script src="/site-adm-onepage/js/nativeflashradiov4.js?v=1.19.04.13"></script>
<style type="text/css">
.bg-texture{
    background:linear-gradient(-45deg,<?php echo $dados_onepage["cor_background1"]; ?> 33%,transparent 0),linear-gradient(-45deg,<?php echo $dados_onepage["cor_background2"]; ?> 100%,transparent 0)
}
.bg-texture-collage{
    background:linear-gradient(-45deg,<?php echo $dados_onepage["cor_background1"]; ?> 33%,transparent 0),linear-gradient(-45deg,<?php echo $dados_onepage["cor_background2"]; ?> 67%,transparent 0),linear-gradient(-45deg,<?php echo $dados_onepage["cor_background1"]; ?> 100%,transparent 0)
}
</style>
</head>
<body>
<section class="bg-texture-collage p-0" id="inicio"> 
<div id="myradiodivcontainer" style="height: 100%; width: 100%; border-radius: 0px; border: 0px none rgb(255, 255, 255); overflow: hidden; display: block;" class="sodahnativeflashradio4"></div>
<script>
function load_cover() {

$.ajax({
url:"/one-page/<?php echo $dados_stm["porta"]; ?>/cover",
type:"GET",
success: function(cover, statusText, errorThrown){
if(cover) {
  $("#myradiodivcontainerimagehit1").attr('src',cover);
  $("#myradiodivcontainerimagehit2").attr('src',cover);
} else {
  $("#myradiodivcontainerimagehit1").attr('src',"<?php if(file_exists("site-adm-onepage/logo-".$dados_stm["porta"].".png")){ ?>/site-adm-onepage/logo-<?php echo $dados_stm["porta"]; ?>.png<?php } else { ?>/site-adm-onepage/img/logo.png<?php } ?>");
  $("#myradiodivcontainerimagehit2").attr('src',"<?php if(file_exists("site-adm-onepage/logo-".$dados_stm["porta"].".png")){ ?>/site-adm-onepage/logo-<?php echo $dados_stm["porta"]; ?>.png<?php } else { ?>/site-adm-onepage/img/logo.png<?php } ?>");
}
}
});

}
$("#myradiodivcontainer").flashradio({
        userinterface: "big",
        backgroundcolor: "transparent",
        themecolor: "<?php echo $dados_onepage["cor_texto"]; ?>", 
        themefontcolor: "<?php echo $dados_onepage["cor_background1"]; ?>", 
        startvolume: "100", 
        radioname: "<?php echo $dados_onepage["nome"]; ?>", 
        scroll: "false", 
        autoplay: "false", 
        useanalyzer: "real", 
        analyzertype: "<?php echo $dados_onepage["visualizer"]; ?>", 
        usecover: "true", 
        usestreamcorsproxy: "false", 
        affiliatetoken: "1000lIPN", 
        token: "",
        debug: "false", 
        ownsongtitleurl: "", 
        radiocover: "<?php if(file_exists("site-adm-onepage/logo-".$dados_stm["porta"].".png")){ ?>/site-adm-onepage/logo-<?php echo $dados_stm["porta"]; ?>.png<?php } else { ?>/site-adm-onepage/img/logo.png<?php } ?>", 
        songgooglefontname: "Oswald:500", 
        songfontname: "Oswald", 
        titlegooglefontname: "Roboto:500", 
        titlefontname: "Roboto", 
        corsproxy: "/one-page/<?php echo $dados_stm["porta"];?>/musica/", 
        streamid: "1", 
        streampath: "<?php echo $ponto; ?>", 
        streamtype: "shoutcast2", 
        streamurl: "<?php echo $url_source_streaming; ?>",
        songinformationinterval: "300000000000000000", 
    });
<?php if(empty($dados_onepage["exibir_capa"]) || $dados_onepage["exibir_capa"] == "sim"){ ?>
setTimeout(load_cover,5000);
setInterval(load_cover,30000);
<?php } ?>
    </script>
      </section>
        <nav class="navbar navbar-expand-md navbar-dark fixed-top sticky-navigation" style="background-color: #000000;">
            <a class="navbar-brand" href="#"><?php if(file_exists("site-adm-onepage/logo-".$dados_stm["porta"].".png")){ ?><img src="/site-adm-onepage/logo-<?php echo $dados_stm["porta"]; ?>.png" width="auto" height="50"><?php } else { ?><?php echo $dados_onepage["nome"]; ?><?php } ?></a>
            <button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarCollapse" aria-controls="navbarCollapse" aria-expanded="false" aria-label="Toggle navigation">
            <span class="navbar-toggler-icon"></span>
            </button>
            <div class="collapse navbar-collapse" id="navbarCollapse">
                <ul class="navbar-nav ml-auto">
                <li class="nav-item mr-3">
                        <a class="nav-link page-scroll" href="#inicio">Player</a>
                    </li>
                    <?php if($dados_onepage["exibir_menu_app"] == "sim"){ ?>
                    <li class="nav-item mr-3">
                    <a class="nav-link page-scroll" href="#download"><?php echo $dados_onepage["titulo_menu_app"]; ?></a>
                    </li>
                    <?php } ?>
                    <?php if($dados_onepage["exibir_menu_nosso_trabalho"] == "sim"){ ?>
                   <li class="nav-item mr-3">
                        <a class="nav-link page-scroll" href="#features"><?php echo $dados_onepage["titulo_menu_quem_somos"]; ?></a>
                    </li>
                    <?php } ?>
                    <?php if($dados_onepage["exibir_menu_quem_somos"] == "sim"){ ?>
                    <li class="nav-item mr-3">
                        <a class="nav-link page-scroll" href="#extra-features"><?php echo $dados_onepage["titulo_menu_nosso_trabalho"]; ?></a>
                    </li>
                    <?php } ?>
                    <?php if($dados_onepage["exibir_menu_programacao"] == "sim"){ ?>
                    <li class="nav-item mr-3">
                        <a class="nav-link page-scroll" href="#team"><?php echo $dados_onepage["titulo_menu_programacao"]; ?></a>
                    </li>
                    <?php } ?>
                    <?php if($dados_onepage["exibir_menu_noticias"] == "sim"){ ?>
                    <li class="nav-item mr-3">
                        <a class="nav-link page-scroll" href="#news"><?php echo $dados_onepage["titulo_menu_noticias"]; ?></a>
                    </li>
                    <?php } ?>
                    <?php if($dados_onepage["url_chat"] == "sim"){ ?>
                    <li class="nav-item mr-3">
                        <a class="nav-link page-scroll" href="#chat">Chat</a>
                    </li>
                    <?php } ?>
                    <?php if($dados_onepage["url_camera_studio"]){ ?>
                    <li class="nav-item mr-3">
                        <a class="nav-link page-scroll" href="#camera">Camera Studio</a>
                    </li>
                    <?php } ?>
                    <?php if($dados_onepage["exibir_menu_contato"] == "sim"){ ?>
                    <li class="nav-item mr-3">
                        <a class="nav-link page-scroll" href="#contact"><?php echo $dados_onepage["titulo_menu_contato"]; ?></a>
                    </li>
                    <?php } ?>
                </ul>
            </div>
        </nav>
        <!--main section-->
        <?php if($dados_onepage["exibir_menu_app"] == "sim"){ ?>
        <section class="bg-texture hero pt-5" id="download">
            <div class="container">
                <div class="row">
                    <div class="col-md-6 text-black wow fadeIn" style="color:<?php echo $dados_onepage["cor_texto"]; ?>;visibility: hidden; animation-name: none; font-size: 18px">
                        <div class="mt-5 pt-5 d-none d-md-block"></div>
                        <h1 style="color:<?php echo $dados_onepage["cor_texto"]; ?>"><?php echo $dados_onepage["titulo_menu_app"]; ?></h1>
                        <p class="mt-4 lead" style="color:<?php echo $dados_onepage["cor_texto"]; ?>; font-size: 18px"><?php echo $dados_onepage["conteudo_menu_app"]; ?></p>
                        <p class="mt-5" style="color:<?php echo $dados_onepage["cor_texto"]; ?>">
                            <?php if($dados_onepage["app_url_google_play"]){ ?>
                            <a href="<?php echo $dados_onepage["app_url_google_play"]; ?>" target="_blank" class="mr-2"><img src="/site-adm-onepage/img/google_play_0.png" class="store-img"></a>
                            <?php } ?>
                            <?php if($dados_onepage["app_url_apple_store"]){ ?>
                            <a href="<?php echo $dados_onepage["app_url_apple_store"]; ?>" target="_blank" class="mr-2"><img src="/site-adm-onepage/img/apple_store.png" class="store-img"></a>
                            <?php } ?>
                        </p>
                    </div>
                    <div class="col-md-6 pt-5 d-none d-md-block wow fadeInRight" style="text-align: center; visibility: hidden; animation-name: none;background: url('/site-adm-onepage/img/app.png') no-repeat center center; min-height: 500px;">
                        <center><img style=" padding-top:100px" src="/site-adm-onepage/logo-<?php echo $dados_stm["porta"]; ?>.png" width="auto" height="200"></center>
                    </div>
                </div>
            </div>
        </section>
        <?php } ?>
        <?php if($dados_onepage["exibir_menu_quem_somos"] == "sim" && !empty($dados_onepage["conteudo_menu_quem_somos"])){ ?>
        <!--main features-->
        <section class="bg-texture-collage" id="features">
            <div class="container">
                <div class="row">
                    <div class="col-md-6 offset-md-3 col-sm-8 offset-sm-2 col-xs-12 text-center wow fadeIn" style="visibility: hidden; animation-name: none;">
                        <h2 style="color:<?php echo $dados_onepage["cor_texto"]; ?>"><?php echo $dados_onepage["titulo_menu_quem_somos"]; ?></h2>
                    </div>
                </div>
                <div class="row">
                    <div class="col-md-6 col-sm-8 mx-auto wow fadeIn" style="visibility: hidden; animation-name: none;color:<?php echo $dados_onepage["cor_texto"]; ?>; font-size: 18px">
                        <p class="lead" style="color:<?php echo $dados_onepage["cor_texto"]; ?>;text-align: left!important; font-size: 18px">
                           <?php echo $dados_onepage["conteudo_menu_quem_somos"]; ?>
                        </p>
                    </div>
                    <div class="col-sm-4 wow fadeIn" style="visibility: hidden; animation-name: none;">
                        <img class="img-fluid mx-auto d-block pb-3" style="padding-top: 50px" src="/site-adm-onepage/logo-<?php echo $dados_stm["porta"]; ?>.png" width="auto" height="200">
                    </div>
                </div>
            </div>
        </section>
        <?php } ?>
        <?php if($dados_onepage["exibir_menu_nosso_trabalho"] == "sim" && !empty($dados_onepage["conteudo_menu_nosso_trabalho"])){ ?>
        <section class="bg-texture text-white" id="extra-features">
            <div class="container">
                <div class="row">
                    <div class="col-md-12 text-center wow fadeIn" style="visibility: hidden; animation-name: none;color:<?php echo $dados_onepage["cor_texto"]; ?>; font-size: 18px">
                        <h2 style="color:<?php echo $dados_onepage["cor_texto"]; ?>"><?php echo $dados_onepage["titulo_menu_nosso_trabalho"]; ?></h2>
                        <p class="lead" style="color:<?php echo $dados_onepage["cor_texto"]; ?>; font-size: 18px"><?php echo $dados_onepage["conteudo_menu_nosso_trabalho"]; ?></p>
                    </div>
                </div>
            </div>
        </section>
        <?php } ?>
        <?php if($dados_onepage["exibir_menu_programacao"] == "sim" && !empty($dados_onepage["conteudo_menu_programacao"])){ ?>
        <!--team-->
        <section class="bg-texture-collage" id="team">
            <div class="container">
                <div class="row">
                    <div class="col-md-12 text-center wow fadeIn" style="visibility: hidden; animation-name: none;color:<?php echo $dados_onepage["cor_texto"]; ?>; font-size: 18px">
                        <h2 style="color:<?php echo $dados_onepage["cor_texto"]; ?>"><?php echo $dados_onepage["titulo_menu_programacao"]; ?></h2>
                        <p class="lead" style="color:<?php echo $dados_onepage["cor_texto"]; ?>; font-size: 18px"><?php echo $dados_onepage["conteudo_menu_programacao"]; ?></p>
                    </div>
                </div>
            </div>
        </section>
        <?php } ?>
        <?php if($dados_onepage["exibir_menu_noticias"] == "sim" && !empty($dados_onepage["conteudo_menu_noticias"])){ ?>
        <!--news-->
        <section class="bg-texture p-0" id="news">
            <div class="container">
                <div class="row d-md-flex text-white text-center wow fadeIn" style="visibility: hidden; animation-name: none;">
                    <div class="col-12 p-5" id="noticias" style="min-height: 400px;">
                        <center><img src="/img/ajax-loader.gif" /></center>
                    </div>
                </div>
            </div>
        </section>
        <?php } ?>
        <?php if($dados_onepage["url_chat"] == "sim"){ ?>
        <!--news-->
        <section class="bg-texture p-0" id="chat">
            <div class="container">
                <div class="row d-md-flex text-white text-center wow fadeIn" style="visibility: hidden; animation-name: none;">
                    <div class="col-12" style="min-height: 350px;">
                        <iframe id="iframe_chat" style="width:100%; height:450px;" src="/chat/<?php echo $dados_stm["porta"]; ?>" scrolling="No" frameborder="0" allowfullscreen="allowfullscreen"></iframe>
                    </div>
                </div>
            </div>
        </section>
        <?php } ?>
        <?php if($dados_onepage["url_camera_studio"] == "sim"){ ?>
        <!--news-->
        <section class="bg-texture p-0" id="camera">
            <div class="container">
                <div class="row d-md-flex text-white text-center wow fadeIn" style="visibility: hidden; animation-name: none;">
                    <div class="col-12 p-5">
                        <iframe id="iframe_camera" style="width:90%; height:100%;" src="/camera-studio/<?php echo $dados_stm["porta"]; ?>/<?php echo $servidor_camera_studio; ?>/16:9/true" scrolling="No" frameborder="0" allowfullscreen="allowfullscreen"></iframe>
                    </div>
                </div>
            </div>
        </section>
        <?php } ?>
        <?php if($dados_onepage["exibir_menu_contato"] == "sim" && ($dados_onepage["whatsapp"] || $dados_onepage["email"] || $dados_onepage["localidade"])){ ?>
        <!--contact-->
        <section class="bg-texture-collage p-0" id="contact" style="min-height: 370px; padding-top: 130px!important; font-size: 18px">
            <div class="container">
                <div class="row d-md-flex text-center wow fadeIn" style="visibility: hidden; animation-name: none;">
                    <?php if($dados_onepage["whatsapp"]) { ?>
                    <div class="col-md-4 p-5" style="color:<?php echo $dados_onepage["cor_texto"]; ?>">
                        <p><em class="ion-social-whatsapp icon-sm mr-3" style="font-size: 36px;"></em></p>
                        <p class="lead" style="font-weight: bold;"><?php echo $dados_onepage["whatsapp"]; ?></p>
                    </div>
                    <?php } ?>
                    <?php if($dados_onepage["email"]) { ?>
                    <div class="col-md-4 p-5" style="color:<?php echo $dados_onepage["cor_texto"]; ?>">
                        <p><em class="material-icons dp36" style="font-size: 36px;">email</em></p>
                        <p class="lead" style="font-weight: bold;"><?php echo $dados_onepage["email"]; ?></p>
                    </div>
                    <?php } ?>
                    <?php if($dados_onepage["localidade"]) { ?>
                    <div class="col-md-4 p-5" style="color:<?php echo $dados_onepage["cor_texto"]; ?>">
                        <p><em class="material-icons dp36" style="font-size: 36px;">location_on</em></p>
                        <p class="lead" style="font-weight: bold;"><?php echo $dados_onepage["localidade"]; ?></p>
                    </div>
                    <?php } ?>
                </div>
            </div>
        </section>
        <?php } ?>
        <!--footer-->
        <section class="bg-darkk pt-5" id="connect">
            <div class="container">
                <div class="row">
                    <div class="col-md-6 offset-md-3 col-sm-8 offset-sm-2 col-xs-12 text-center wow fadeIn" style="visibility: hidden; animation-name: none;">
                        <?php if($dados_onepage["url_facebook"] || $dados_onepage["url_instagram"] || $dados_onepage["url_twitter"] || $dados_onepage["url_youtube"]) { ?>
                        <p class="mt-4">
                            <?php if($dados_onepage["url_facebook"]) { ?>
                            <a href="<?php echo $dados_onepage["url_facebook"]; ?>" target="_blank"><em class="ion-social-facebook text-twitter-alt icon-sm mr-3"></em></a>
                            <?php } ?>
                            <?php if($dados_onepage["url_instagram"]) { ?>
                            <a href="<?php echo $dados_onepage["url_instagram"]; ?>" target="_blank"><em class="ion-social-instagram text-twitter-alt icon-sm mr-3"></em></a>
                            <?php } ?>
                            <?php if($dados_onepage["url_twitter"]) { ?>
                            <a href="<?php echo $dados_onepage["url_twitter"]; ?>" target="_blank"><em class="ion-social-twitter text-twitter-alt icon-sm mr-3"></em></a>
                            <?php } ?>
                            <?php if($dados_onepage["url_youtube"]) { ?>
                            <a href="<?php echo $dados_onepage["url_youtube"]; ?>" target="_blank"><em class="ion-social-youtube text-twitter-alt icon-sm mr-3"></em></a>
                            <?php } ?>
                        </p>
                        <?php } ?>
                        <p class="pt-2 text-white">
                            © 2021 <?php echo $dados_onepage["nome"]; ?>
                    </div>
                </div>
            </div>
            </section>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.3/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.3/jquery.easing.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/wow/1.1.2/wow.js"></script>
<script src="/site-adm-onepage/js/scripts.js"></script>
<script type="text/javascript">
  function carregar_noticias(callback) {
    $.ajax({
      url: '/one-page/<?php echo $dados_stm["porta"]; ?>/rss',
      dataType: 'xml',
      error: function(e) {
            $('#noticias').append('<div class="col-md-12" style="margin-bottom: 5px;"> <div class="card"> <div class="card-body" style="padding: 0.50em!important;"> <strong>Erro ao carregar noticias.</strong> </div> </div> </div>');       
      },
      success: function(response) {

        $('#noticias').children().remove();

        var total = 0;
        var max = 10;

        $(response).find("item").each(function() {

        if(total == max) return false;

          var noticia_titulo = $(this).find('title').text();
          var noticia_imagem = $(this).find('mediaurl').text() || $(this).find('media\\:content').attr('url') || $(this).find('media\\:thumbnail').attr('url');
          var noticia_link = $(this).find('url').text() || $(this).find('link').attr('href') || $(this).find('link').text();

          if(!noticia_imagem) {
            var noticia_imagem = "/site-adm-onepage/img/img-noticia-nao-disponivel.jpg";
          }
          


          $('#noticias').append('<div class="col-md-12" style="margin-bottom: 5px;"> <div class="card"> <div class="card-body" style="padding: 0.50em!important;"> <div class="d-flex flex-row"> <img src="'+noticia_imagem+'" style="width: 100px; height: auto;max-height: 60px;" /> <div class="ml-3"> <h6 style="padding-top:20px"><a href="'+noticia_link+'" target="_blank" style="color:#000000"><em class="material-icons" style="font-size: 20px;">link</em> '+noticia_titulo+'</a></h6></div> </div> </div> </div> </div>');

          total++;
        });
      }
    });
  }
  $(document).ready(function() {
  <?php if($dados_onepage["exibir_menu_noticias"] == "sim" && $dados_onepage["conteudo_menu_noticias"]){ ?>
    carregar_noticias();
  <?php } ?>
    var largura_camera = $("#iframe_camera").width();
    var altura = $(window).height();
    $("#iframe_camera").css('height',(largura_camera/2)+'px');
    $("#camera").css('height',(largura_camera/1.7)+'px');
    $("#iframe_chat").css('min-height',altura+'px');
    $("#team").css('min-height',altura+'px');
    $("#download").css('min-height',altura+'px');
    $("#features").css('min-height',altura+'px');
    $("#extra-features").css('min-height',altura+'px');
    $("#news").css('min-height',altura+'px');
  });
</script>
</body>
</html>