elemento_id; if ($elemento->alias_id) { $elemento2=new elemento_sito($elemento->alias_id); $elemento->elemento_titolo=$elemento2->elemento_titolo; $elemento->elemento_testo=$elemento2->elemento_testo; $elemento->elemento_accesso=$elemento2->elemento_accesso; $elemento->elemento_path=$elemento2->elemento_path; $elemento->elemento_link=$elemento2->elemento_link; $elemento->elemento_template=$elemento2->elemento_template; $elemento->elemento_link_eredita=$elemento2->elemento_link_eredita; } if ($elemento->elemento_accesso) { if (empty($CFG->username)) { $query = getenv("QUERY_STRING"); if (!$query) { $query = "pagina=$elemento_id"; }; $_SESSION['query_string']=$query; header("Location:login_prompt.php"); exit(); } } if ($elemento->elemento_tipo=="3") { $file=$elemento->elemento_path; $file_download=$CFG->files.$file; if (!file_exists($file_download)) { die("non trovo il file $file_download "); exit(); }; $type= getmimetype($file); $fsize = filesize($file_download); /* $doc = fopen($file_download,"rb"); header("Content-Type: $type"); header("Content-Disposition: attachment; filename=$file"); fpassthru($doc); */ header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Cache-Control: public"); header("Content-Description: File Transfer"); header("Content-Type: $type"); header("Content-Disposition: attachment; filename=$file"); header("Content-Transfer-Encoding: binary"); header("Content-Length: " . $fsize); // download $doc = fopen($file_download,"rb"); fpassthru($doc); //@readfile(file_download); exit(); }; $trail=array(); $percorso=array(); if ($elemento->elemento_padre) { genera_trail($elemento->elemento_padre); for ($i=(count($trail)-1);$i>=0;$i--) { $percorso[]=$trail[$i]; }; }; $link=array(); if ($elemento->elemento_link) { $rs=$db->Execute("SELECT * FROM ".$CFG->prefix."elemento_sito WHERE elemento_padre='$elemento_id' AND elemento_tipo<>'3' ORDER BY elemento_posizione"); $titolo_link=$elemento->elemento_titolo; $eredita=true; if ($rs->RecordCount()) { $link=get_link($rs); if (count($link)) { $eredita=false; } else { $eredita=true; } } if ($eredita) { if ($elemento->elemento_link_eredita and $elemento->elemento_padre) { $padre = new elemento_sito($elemento->elemento_padre); $titolo_link=$padre->elemento_titolo; $rs=$db->Execute("SELECT * FROM ".$CFG->prefix."elemento_sito WHERE elemento_padre='".$elemento->elemento_padre."' AND elemento_tipo<>'3' ORDER BY elemento_posizione"); if ($rs->RecordCount()) $link=get_link($rs); } } }; $contenuto=stripslashes($elemento->elemento_testo); $titolo_pagina=$elemento->elemento_titolo; if (!(trim($elemento->elemento_template))) $elemento->elemento_template="interna.tpl"; } else { //home page $titolo_pagina="Home"; $percorso=""; $link=""; $elemento->elemento_template="index.tpl"; } if ($CFG->username) { $loggato="1"; } else { $loggato="0"; }; $rss_description=$CFG->rss_description; $smarty= new MySmarty(); $smarty->db=$db; $smarty->template_dir = $CFG->dirroot.'/template/'; $smarty->compile_dir = $CFG->dirroot.'/template_c/'; $smarty->config_dir = $CFG->dirroot.'/configs/'; $smarty->cache_dir = $CFG->dirroot.'/cache/'; $smarty->assign('titolo_pagina',$titolo_pagina); $smarty->assign('percorso',$percorso); $smarty->assign('pagina',$elemento->elemento_id); $smarty->assign('id_poll',$elemento->id_poll); $smarty->assign('link',$link); $smarty->assign('titolo_link',$titolo_link); $smarty->assign('link_n',count($link)-1); $smarty->assign('contenuto',$contenuto); $smarty->assign('rss_description',$rss_description); $smarty->assign('loggato',$loggato); $smarty->assign('username',$CFG->username); $smarty->assign('userpwd',$CFG->userpwd); $news=get_news($CFG->news_home); if (count($news)) { $smarty->assign('news',$news); }; if (isset($_GET["username"]) and isset($_GET["password"])) { $smarty->assign('utente_pegasus',$_GET["username"]); $smarty->assign('pwd_pegasus',$_GET["password"]); }; if (isset($_GET["cognome"]) and isset($_GET["nome"])) { $smarty->assign('cognome',htmlentities($_GET["cognome"])); $smarty->assign('nome',htmlentities($_GET["nome"])); }; $smarty->display($elemento->elemento_template); ?>