read())) { if( $entry != '.' && $entry != '..' && !is_dir($path.$entry) && strpos($entry , 'banner_') !== FALSE && strpos($entry , '.html') !== FALSE ) { $banners[] = $entry; } } $d->close(); } $banner_global = file($path."/".$banners[rand(0,count($banners)-1)]); $banner_global = implode("", $banner_global); unset($banners); /********************************** Captura o snippet a ser invocado */ if(isset($_REQUEST['snippet'])) $snippet = $_REQUEST['snippet']; else{ //$snippet = "index"; Header("Location:/site/"); exit; } /********************************** Verifica quais os controles devem estar disponíveis no menu de conteúdo */ $content_menu = "\n"; //if(getsession("logado") === true){ // $content_menu = ""; //} $content_menu .= "\n"; require("content.".$snippet.".php"); /********************************** Seleção de template */ switch ($snippet) { case "channel": $template = file("tpl/channel.html"); break; default: $template = file("tpl/default.html"); } $template = implode("", $template); /********************************** Merge template x snippet */ /* Passagem de valores de sistema */ $template = str_replace("%ALIAS_CLIENTE%", $alias_cliente, $template); $template = str_replace("%ID_CLIENTE%", $ws_nbr_int_cli, $template); $template = str_replace("%PAGE_TITLE%", $page_title, $template); $template = str_replace("%META_TAGS%", $meta_tags, $template); $template = str_replace("%META_DESCRIPTION%", $meta_description, $template); $template = str_replace("%CONTENT%", $content, $template); $template = str_replace("%CONTENT_MENU%", $content_menu, $template); $template = str_replace("%SYS_LANG%", $sys_lang, $template); $template = str_replace("%CSS_CLIENTE%", $css_cliente, $template); $template = str_replace("%BANNER_CLIENTE%", $banner_cliente, $template); $template = str_replace("%BANNER2_CLIENTE%", $banner2_cliente, $template); $template = str_replace("%BANNER3_CLIENTE%", $banner3_cliente, $template); $template = str_replace("%BANNER4_CLIENTE%", $banner4_cliente, $template); $template = str_replace("%BANNER_GLOBAL%", $banner_global, $template); $template = str_replace("%HEADER%", $header, $template); $template = str_replace("%FOOTER%", $footer, $template); /* Passagem de valores de integração */ $template = str_replace("%FB_APP_ID%", SIS_FB_APPID, $template); $template = str_replace("%SOCIAL_PAGE_ID%", $social_page_id, $template); $template = str_replace("%SOCIAL_PAGE_URL%", $social_page_url, $template); /* Passagem de variáveis de ambiente */ $template = str_replace("%SERVER_HTTP_HOST%", $_SERVER['HTTP_HOST'], $template); $template = str_replace("%SERVER_SCRIPT_NAME%", $_SERVER['REDIRECT_URL'], $template); /* Passagem de variáveis para embed no Facebook */ $template = str_replace("%VIDEO_TITLE%", $fb_video_title, $template); $template = str_replace("%VIDEO_DESCRIPTION%", $fb_video_desc, $template); $template = str_replace("%VIDEO_IMAGE%", $fb_video_image, $template); $template = str_replace("%VIDEO_SITENAME%", "Z1on.com", $template); $template = str_replace("%VIDEO_URL%", $fb_video_url, $template); $template = str_replace("%VIDEO_LOCATION%", $fb_video_location, $template); $template = str_replace("%VIDEO_LOCATION_SECURE%", $fb_video_location_secure, $template); echo $template; ?>