$opt) { foreach($opt as $v) if($$k==$v) $classBody="nohk"; } */ if($dir=="pagine") $idPagina = $_GET['id']; include_once("lib/rewrite.php"); if(!empty($blocco)) { include_once("blocchi.php"); exit; } //inizio la sessione session_set_cookie_params(60*240, "/"); session_start(); if (!empty($lang)){ $lingua_corrente = $lang; }elseif(!empty($_SESSION["lingua_corrente"])){ $lingua_corrente = $_SESSION["lingua_corrente"]; } else{ $lingua_corrente = $config->recupera_variabile("linguainiziale"); /* //SE MULTILINGUA ATTIVARE QUESTA SEZIONE PER FARE IN MODO CHE CHI HA //UN BROWSER NON ITALIANO ACCEDA DIRETTAMENTE ALLA SEZIONE INGLESE if (!check_if_spider()){ $langc = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2); $langc = strtolower($langc); if($langc != 'it') $lingua_corrente = 2; } */ } if(!empty($lingua) && $lingua_corrente!=$lingua && empty($lang)) { $lang = $lingua; $lingua_corrente = $lang; } $_SESSION["lingua_corrente"] = $lingua_corrente; switch ($lingua_corrente) { case 2: setlocale(LC_TIME, 'eng', 'en_EN'); break; default: setlocale(LC_TIME, 'ita', 'it_IT', 'it_IT.utf8'); } //estraggo quindi i dati della lingua corrente $campi = "*"; $tabFrom = "lingue AS l"; $sql_where = "id_lingua='".$lingua_corrente."'"; $array_lingua_corrente = $db->listaMod($campi, $tabFrom, $sql_where); //procedura di logout if ($_GET["logout"]){ $_SESSION["sessionUserFront"] = ""; $backLink = rewriteLink($website."/", $dirPagine, "home"); header("Location:". $backLink); } $actLogin = false; //verifico l'esistenza di parametri in post if($_POST["username_form"] != "" && $_POST["password_form"] != ""){ $admin_username = $_POST["username_form"]; $admin_password = md5($_POST["password_form"]); $actLogin = true; }//in alternativa li cerco nella sessione elseif($_SESSION["sessionUserFront"] != ""){ $sessionUserFront = $_SESSION["sessionUserFront"]; $admin_username = $sessionUserFront->impostaUtente["username"]; $admin_password = $sessionUserFront->impostaUtente["password"]; } elseif($_SESSION["inactiveUser"] != ""){ $admin_username = $_SESSION["inactiveUser"]["username"]; $admin_password = $_SESSION["inactiveUser"]["password"]; } else{ //infine se mancano del tutto mi assicuro di azzerarli $admin_username = ""; $admin_password = ""; } //effettuo l'autenticazione dell'utente $sessionuser->controllaUtente($admin_username, $admin_password); //se il login fallisce azzero i valori nel cookie if ($sessionuser->logged){ //metto l'oggetto utente in sessione $_SESSION["sessionUserFront"] = $sessionuser; $_SESSION["inactiveUser"] = ""; if($actLogin) header("location:".rewriteLink($website."/", $dirEcommerce, "intestazione", "", "")); }else{ $_SESSION["sessionUserFront"] = ""; } //verifico l'esistenza del file e se serve definisco il file di default if (empty($file)){ $file = "home"; } //effettuo lo stesso discorso con la directory, se non รจ settata definisco quella di default if (!isset($dir) || $dir==""){ $dir = $default_dir; } //ora che sono definiti file e dir verifico i permessi sul modulo della dir in questione //(controllo relativo solo ai moduli attivi sul cms corrente [LIVELLO CLIENTE]) if (!$obLicenza->verificaModulo($dir)){ die("Accesso non consentito per la directory ".$dir."."); } if (!$obLicenza->verificaFile($file, $dir)){ die("Accesso non consentito per il file ".$file."."); } //posso quindi procedere con l'inclusione dell'oggetto e del file config della directory corrente include_once($moduli ."/". $dir ."/object.php"); include_once($moduli ."/". $dir ."/config.php"); $errore = $_REQUEST["errore"]; $messaggio = $_REQUEST["messaggio"]; $tpl = new Template($path); if(!isset($_SESSION["tagsveco"]) || !empty($lang)){ //RECUPERO I TESTI DELLE TRADUZIONI $campi = "ti.tag, tc.traduzione"; $tabFrom = "traduzioni_index AS ti LEFT JOIN traduzioni_contents AS tc ON ti.id=tc.id AND tc.lingua_id='" . $lingua_corrente . "'"; $sql_where = ""; $order_by = "tag"; $listaTesti = $objGenerico->listaMod($campi, $tabFrom, $sql_where, $order_by); foreach($listaTesti as $tag){ $tags[$tag["tag"]]=$tag["traduzione"]?nl2br($tag["traduzione"]):$tag["tag"]; } $_SESSION["tagsveco"] = $tags; } else { $tags = $_SESSION["tagsveco"]; } // HOMEPAGE ************** $campi = "*"; $tabFrom = " pagine_contents AS nc, pagine_index AS n"; $where = " n.id='".$id."' AND n.id=nc.id AND nc.lingua_id='" . $lingua_corrente ."' AND n.attiva ".$extraWhere; $order_by = ""; $listaPag = $db->listaMod($campi, $tabFrom, $where, $order_by); $homepage = false; if($listaPag[0]["ordine"] == 1){ $homepage = true; } $tpl->assign('homepage', $homepage); $redirect_homepage = $_SERVER['REQUEST_URI']; $tpl->assign('redirect_homepage', $redirect_homepage); // HOMEPAGE ************** $tpl->assign("tags", $tags); //assegno la variabile della dir e del file correnti $tpl->assign('sessionuser', $sessionuser); $tpl->assign('dir', $dir); $tpl->assign('file', $file); $tpl->assign('linkSocial', $social); if(count($social)>0) $tpl->assign('socialW', (100/count($social))-1); $tpl->assign('ga', $ga); $tpl->assign('REWRITE', REWRITE); $tpl->assign('e_mail_admin', $e_mail_admin); $tpl->assign('classBody', $classBody); $tpl->assign('dir_upload', $dir_upload); $tpl->assign('dir_immagini', $dir_immagini); $tpl->assign('dir_file', $dir_file); //assegno la dir iniziale dei template del frontend $tpl->assign('dirTemplate', $dirTemplate ."/"); //assegno la variabile website $tpl->assign('website', $website ."/"); //assegno eventuali errori/messaggi $tpl->assign('errore', $errore); $tpl->assign('messaggio', $messaggio); //carico title, descriptione e keyword di default $htmltitle = $array_lingua_corrente[0]["title"]; $htmldescription = $array_lingua_corrente[0]["description"]; $htmlkeywords = $array_lingua_corrente[0]["keywords"]; $htmltag = $array_lingua_corrente[0]["tag"]; $htmlseo_body = $array_lingua_corrente[0]["seo_body"]; $htmlseo_footer = $array_lingua_corrente[0]["seo_footer"]; if($htmltitle=="") $htmltitle = $config->recupera_variabile("maintitle"); if($htmldescription=="") $htmldescription = $config->recupera_variabile("metadescription"); if($htmlkeywords=="") $htmlkeywords = $config->recupera_variabile("metakewords"); if($htmltag=="") $htmltag="it"; if(!empty($suffisso_title)) { $htmltitle .= " | $suffisso_title"; } $tpl->assign('title', $htmltitle); $tpl->assign('description', $htmldescription); $tpl->assign('keywords', $htmlkeywords); $tpl->assign('seo_body', $htmlseo_body); $tpl->assign('seo_footer', $htmlseo_footer); $tpl->assign('tag', $htmltag); $tpl->assign('lingua_corrente', $lingua_corrente); $tpl->assign('nome_lingua_corrente', $array_lingua_corrente[0]["nome"]); //includo una pagina che prepara tutti i blocchi necessari include($moduli."/".$dir_blocchi."/genera_blocchi.php"); if ($obLicenza->verificaModulo('banner')){ include($moduli."/".$dir_blocchi."/genera_banner.php"); } //assegno testata e piede di default $link_lingue = $_SERVER['REQUEST_URI']; if(!strpos($link_lingue,"?")) $link_lingue = $link_lingue."?"; else $link_lingue = $link_lingue."&"; $result = preg_match("/lang=([0-9]*)/", $link_lingue, $matches); if ($result) {//dump($link_lingue); $link_lingue = trim(str_replace("&".$matches[0], "", $link_lingue), "?"); $link_lingue = trim(str_replace($matches[0], "", $link_lingue), "?"); } $tpl->assign('link_lingue', trim($link_lingue,"&")); $testata = $tpl->fetch("default/testata.tpl"); $piede = $tpl->fetch("default/piede.tpl"); //includo la pagina che mi interessa include($moduli."/".$dir."/".$file.".php"); //ogni file ritrna sempre una variabile che si chiama corpo_principale $tpl->assign('corpo_principale', $corpo_principale); //assegno le variabili di piede e testata al template $tpl->assign('testata', $testata); $tpl->assign('piede', $piede); $tpl->assign('effetti_galleria', $config->recupera_variabile("effetti_galleria")); $tpl->assign('effetti_banner', $config->recupera_variabile("effetti_banner")); $tpl->assign('tempo_banner', $config->recupera_variabile("tempo_banner")); $tpl->assign('tempo_galleria', $config->recupera_variabile("tempo_galleria")); $tpl->display('default/index.tpl'); ?>