function mn_secoes()
{
$sql = qry("select distinct tipo from fbz_paginas where ativa='S' and exibir='S' order by ordem asc");
$v = array();
$i = 0;
while ($rst=mfa($sql))
{
$v[$i] = $rst["tipo"]; $i++;
}
return $v;
}
function mn_paginas($tipo="")
{
global $fbz_tipo_url;
if($tipo!=""){
$sql = qry("select * from fbz_paginas where tipo='$tipo' and ativa='S' and exibir='S' order by ordem asc");
}else{
$sql = qry("select * from fbz_paginas where ativa='S' and exibir='S' order by ordem asc");
}
$v = array();
$i = 0;
while ($rst=mfa($sql))
{
$v[$i]['titulo'] = $rst['titulo'];
$v[$i]['secao'] = $rst['tipo_amigavel'];
$v[$i]['target'] = $rst['target'];
$v[$i]['url_amigavel'] = $rst['url_amigavel'];
if($rst['url']!=''){
$v[$i]['url'] = str_replace("`","'",$rst['url']);
}else{
if($fbz_tipo_url=='normal'){
$v[$i]['url'] = 'pagina.php?secao='.$rst['tipo_amigavel'].'&pagina='.$rst['url_amigavel'] ;
}else{
$v[$i]['url'] = $rst['tipo_amigavel'].','.$rst['url_amigavel'] ;
}
}
$i++;
}
return $v;
}
/**
* Procura Imagem na notícia
* @param [array] $rsn vetor da notícia
*/
function blog_media($rsn){
if($rsn["video"]!=''){
$media = 'https://img.youtube.com/vi/'.$rsn["video"].'/default.jpg';
}else if($rsn["imagem"]!='') {
$media = '../'.$rsn["imagem"];
}else {
$output = preg_match_all('/]+src=[\'"]([^\'"]+)[\'"][^>]*>/i', $rsn["texto"], $matches);
if(!empty($matches[1][0])){
$media = $matches[1][0];
}else{
$media = '';
}
}
return $media;
}
if($tpl->exists("INC_HEAD")) { $tpl->addFile("INC_HEAD", $fbz_frontend."html/inc/head.html"); }
if($tpl->exists("INC_HEADER")) { $tpl->addFile("INC_HEADER", $fbz_frontend."html/inc/header.html"); }
if($tpl->exists("INC_MENU")) { $tpl->addFile("INC_MENU", $fbz_frontend."html/inc/menu.html"); }
if($tpl->exists("INC_BUSCA")) { $tpl->addFile("INC_BUSCA", $fbz_frontend."html/inc/busca.html"); }
if($tpl->exists("INC_BANNER")) { $tpl->addFile("INC_BANNER", $fbz_frontend."html/inc/banner.html"); }
if($tpl->exists("INC_BOX")) { $tpl->addFile("INC_BOX", $fbz_frontend."html/inc/box.html"); }
if($tpl->exists("INC_FILTRO")) { $tpl->addFile("INC_FILTRO", $fbz_frontend."html/inc/filtro.html"); }
if($tpl->exists("INC_BANNERS")) { $tpl->addFile("INC_BANNERS", $fbz_frontend."html/inc/banners.html"); }
if($tpl->exists("INC_BLOGLIST")) { $tpl->addFile("INC_BLOGLIST", $fbz_frontend."html/inc/bloglist.html"); }
if($tpl->exists("INC_FOOTER")) { $tpl->addFile("INC_FOOTER", $fbz_frontend."html/inc/footer.html"); }
if($tpl->exists("INC_MODAL")) { $tpl->addFile("INC_MODAL", $fbz_frontend."html/inc/modal.html"); }
if($tpl->exists("INC_JS")) { $tpl->addFile("INC_JS", $fbz_frontend."html/inc/js.html"); }
if($tpl->exists("INC_CSS")) { $tpl->addFile("INC_CSS", $fbz_frontend."html/inc/css.html"); }
if($tpl->exists("INC_ANALYTICS")) { $tpl->addFile("INC_ANALYTICS", $fbz_frontend."html/inc/analytics.html"); }
if( $tpl->exists("INC_BUSCA") ) include("fbz/inc/busca.php");
if( $tpl->exists("INC_MENU") && test_table('fbz_paginas') ) include("fbz/inc/menu.php");
if( $tpl->exists("INC_BANNERS") && test_table('fbz_banners') ) include("fbz/inc/banners.php");
if( $tpl->exists("INC_BLOGLIST") && test_table('fbz_noticias') ) include("fbz/inc/blog.php");
// Header
if($tpl->exists("HTML_LANG")) $tpl->HTML_LANG = $fbz_fw_lang;
if($tpl->exists("HTML_CHARSET")) $tpl->HTML_CHARSET = $fbz_fw_charset;
if($tpl->exists("HTML_URL")) $tpl->HTML_URL = $fbz_url_site;
if($tpl->exists("HTML_LOGO")) $tpl->HTML_LOGO = $fbz_url_site.$site['design']['logo'];
if($tpl->exists("HTML_ICO")) $tpl->HTML_ICO = $site['design']['favicon']!='' ? $fbz_url_site.$site['design']['favicon'] : $fbz_url_site.'img/favicon.ico';
if($tpl->exists("HTML_CANONICAL")) $tpl->HTML_CANONICAL = "";
if($tpl->exists("HTML_IMG")) $tpl->HTML_IMG = "";
if($tpl->exists("HTML_TITLE")) $tpl->HTML_TITLE = $site['geral']['title'];
if($tpl->exists("HTML_DESC")) $tpl->HTML_DESC = $site['geral']['description'];
if($tpl->exists("HTML_KW")) $tpl->HTML_KW = $site['geral']['keywords'];
// dados gerais
if($tpl->exists("EMPRESA")) $tpl->EMPRESA = $site['geral']['nome'];
if($tpl->exists("RESUMO")) $tpl->RESUMO = $site['geral']['description'];
if($tpl->exists("EMAIL")) $tpl->EMAIL = $site['geral']['email'];
if($tpl->exists("DOMINIO")) $tpl->DOMINIO = $fbz_url_site;
if($tpl->exists("MAPS_KEY")) $tpl->MAPS_KEY = $site['google']['key_maps'];
// fbz_lojas
foreach ($site as $key => $value) {
if( strstr($key,'loja') ){
foreach ($site[$key] as $key => $value) {
$var = 'LOJA_'.strtoupper($key);
$exist = $var.'_EXIST';
if($key=='whatsapp'){
$whats_num = '55'.preg_replace("/[^0-9]/","",$value);
if( $tpl->exists('LOJA_WHATSAPP_NUM') ){
$tpl->LOJA_WHATSAPP_NUM = $whats_num;
}
}
if( $tpl->exists($var) ){
$tpl->$var = $value;
}
// show/hide de contatos
// LOJA_CAMPO_EXIST
if( $tpl->exists($exist) ){
$tpl->$exist = $value!='' ? '' : 'hidden';
}
}
if($tpl->exists("HEADER_CONTATO")) $tpl->block('HEADER_CONTATO');
if($tpl->exists("FOOTER_CONTATO")) $tpl->block('FOOTER_CONTATO');
if($tpl->exists("FOOTER_FONES")) $tpl->block('FOOTER_FONES');
}
}
// fbz_social
foreach ($site['social'] as $rede => $url) {
if( $url!='' ){
if($tpl->exists("SOCIAL_LABEL")) $tpl->SOCIAL_LABEL = $rede;
if($tpl->exists("SOCIAL_TITLE")) $tpl->SOCIAL_TITLE = Maiusculo($rede);
if($tpl->exists("SOCIAL_URL")) $tpl->SOCIAL_URL = $url;
if($tpl->exists("SOCIAL_CLASS")) $tpl->SOCIAL_CLASS = 'fa fa-'.$rede;
if($tpl->exists("HEADER_SOCIAL")) $tpl->block("HEADER_SOCIAL");
if($tpl->exists("FOOTER_SOCIAL")) $tpl->block("FOOTER_SOCIAL");
}
}
// site['design']
foreach ($site['design'] as $key => $value)
{
if( strstr($key,'color_') ){
$hex = $value;
list($r, $g, $b) = sscanf($hex, "#%02x%02x%02x");
$rgb = $r.','.$g.','.$b;
if($tpl->exists($key)) $tpl->$key = $hex;
$key_rgb = $key.'_rgb';
if($tpl->exists($key_rgb)) $tpl->$key_rgb = $rgb;
}
}
if($tpl->exists("FOOTER_CATEGORIAS"))
{
$categorias = fbz_array_busca($fbz_sql_query_tipos);
foreach($categorias as $categoria) {
$tpl->CODIGO_CATEGORIA = $categoria["CODIGO_CATEGORIA"];
$tpl->CATEGORIA = Maiusculo(fbz_tipos_plural($categoria["CATEGORIA"]));
$tpl->CATEGORIA_SELECTED = (get("busca")==$id_busca && fbz_getvg("tipo",$categoria["CODIGO_CATEGORIA"])) ? 'selected' : '' ;
$tpl->block("FOOTER_CATEGORIAS");
}
}
//analytics
if ($site['google']['key_analytics']!="") {
if($tpl->exists("GA_KEY")) $tpl->GA_KEY = $site['google']['key_analytics'];
$tpl->block("GA");
}
// alertas navegador
if (session('msg_'.$fbz_prefix)!="")
{
$tpl->MODAL_TITLE = "Atenção!";
$tpl->MODAL_CONTENT = session('msg_'.$fbz_prefix);
$tpl->block("MODAL");
setmsg("");
}
// selecao de idioma translator
if (session('lingua_'.$fbz_prefix)!="")
{
$tpl->JS_BTN_TRANSLATOR = session('lingua_'.$fbz_prefix);
}
// form footer
if($tpl->exists('formfooter'))
{
$vformfooter[] = array("Nome","Seu Nome","text","valida",12);
$vformfooter[] = array("E-mail","E-mail","email","valida valida-email",12);
$vformfooter[] = array("Telefone","Telefone","text","valida mask-fone",12);
$vformfooter[] = array("Mensagem","Sua mensagem","textarea","valida",12,'',3);
if (post("fooenviar")) {
//var_export($_POST); exit;
//fbz_captcha('validar');
$nome = $_POST['campo_1'];
$email = $_POST['campo_2'];
$titulo = 'Contato pelo Site';
$redir = post("url_retorno");
$html = "