ob_start(); session_start(); require_once("config.inc.php"); $unDB = DB::connect($DSN); if (DB::isError($unDB)) { die ("Non trovo il DB: " . $unDB->getMessage() . "\n"); } $unDB->setFetchMode(DB_FETCHMODE_ASSOC); $smarty = new Smarty; // USATO PER LA SICUREZZA $smarty->compile_dir = $_SERVER['DOCUMENT_ROOT']."/".md5("tempristorantiverdi")."_c/"; $smarty->template_dir = $_SERVER['DOCUMENT_ROOT']."/".md5("tempristorantiverdi"); if ( isset($_GET['pagina']) ) $pagina = $_GET['pagina']; else $pagina = $homepage; if (isset($_GET["lingua"])) { $SLingua = $_GET["lingua"]; $_SESSION["SLingua"] = $SLingua; } else { if (!isset($_SESSION["SLingua"])) { $_SESSION["SLingua"] = $LinguaDiDefault; $SLingua = $LinguaDiDefault; } if (isset($_SESSION["SLingua"])) { $SLingua = $_SESSION["SLingua"]; } } $smarty->assign("LinguadiSessione", $SLingua); $smarty->assign("path_locale",$path_image_locali); //$smarty->assign("ListaLingue", $Lingua->Stampa()); /***********************************************/ /* Lista regioni */ $Regioni = new Regioni($unDB); $ListaRegioni = $Regioni->Stampa(); $smarty->assign("ListaRegioni", $ListaRegioni); $Utente = new Utente($unDB); $ArrayUtente = $Utente->Stampa(); $arrayLength = count ($ArrayUtente); $ArrayFinale[0]['id_regione'] = 0; $ArrayFinale[0]['contatore'] = 0; $f=0; for ( $i=0; $i<$arrayLength; $i++) { $contatore = 0; $verifica = false; for ( $k=0; $kassign("ListaRegioniOK", $ArrayFinale); $smarty->assign("TotaleRistoranti", $TotaleRistoranti); /* Fine Lista regioni */ /***********************************************/ /***********************************************/ /* Le 2 news sempre visibili */ $step_news = 2; $News = new News($unDB); $ArrayNews = $News->StampaTraLimiti(0, $step_news); $smarty->assign("ArrayNews", $ArrayNews); /* Fine Lista regioni */ /***********************************************/ switch($pagina) { case 'login': $smarty->assign("TitoloPagina", "Ristoranti Verdi - Login"); $smarty->assign("pagina", $_GET['pagina']); $smarty->display('login.tpl'); break; case 'home': /**************************************************************************************/ // Per le news $smarty->assign("pagina", $pagina); $smarty->assign("template", "inc-home.tpl"); $smarty->display('home.tpl'); break; case 'lista-locali': /**************************************************************************************/ // Il progetto $Utente = new Utente($unDB); $ListaUtenti = $Utente->StampaXRegione($_GET['id_regione']); $Menulocale = new Menulocale ($unDB); $ArrayMenulocale = $Menulocale->Stampa(); $Tipolocale = new Tipolocale ($unDB); $ArrayTipolocale = $Tipolocale->Stampa(); $smarty->assign("ArrayListaUtenti", $ListaUtenti); $smarty->assign("ArrayMenulocale", $ArrayMenulocale); $smarty->assign("ArrayTipolocale", $ArrayTipolocale); $smarty->assign("id_regione_selezionata", $_GET['id_regione']); $smarty->assign("pagina", $_GET['pagina']); $smarty->assign("template", "inc-lista-locali.tpl"); $smarty->display('home2.tpl'); break; case 'locale-dettagli': /**************************************************************************************/ // Il progetto $Utente = new Utente($unDB); $Utente->Carica_da_id($_GET['id_utente']); $Locale = new Locale($unDB); $Locale->CaricaDaUtente($_GET['id_utente'], $_SESSION['SLingua']); $smarty->assign("Id_Gruppo", $Utente->mId_Gruppo); $smarty->assign("Foto", $Utente->mFoto); $smarty->assign("Nome", $Utente->mNome); $smarty->assign("Indirizzo", $Utente->mIndirizzo); $smarty->assign("Citta", $Utente->mCitta); $smarty->assign("Provincia", $Utente->mProvincia); $smarty->assign("Cap", $Utente->mCap); $smarty->assign("Tel", $Utente->mTel); $smarty->assign("Fax", $Utente->mFax); $smarty->assign("Email", $Utente->mEmail); $smarty->assign("Sito", $Utente->mSito); $smarty->assign("Id_Regione", $Utente->mId_Regione); $smarty->assign("Id_Tipolocale", $Utente->mId_TipoLocale); $smarty->assign("Periodo_Apertura", $Locale->mPeriodo_Apertura); $smarty->assign("Orario", $Locale->mOrario); $smarty->assign("Riposo_Settimanale", $Locale->mRiposo_Settimanale); $smarty->assign("Carte", $Locale->mCarte); $smarty->assign("Prezzo_Medio", $Locale->mPrezzo_Medio); $smarty->assign("Proprietario_Gestione", $Locale->mProprietario_Gestione); $smarty->assign("Parcheggio", $Locale->mParcheggio); $smarty->assign("Descrizione", $Locale->mDescrizione); $smarty->assign("Note", $Locale->mNote); $smarty->assign("Click", $Locale->mClick); $smarty->assign("Id_Lingua", $Locale->mId_Lingua); $smarty->assign("Id_Utente", $Locale->mId_Utente); $smarty->assign("id_regione_selezionata", $_GET['id_regione']); $smarty->assign("pagina", $_GET['pagina']); $smarty->assign("template", "inc-locale-dettagli.tpl"); $smarty->display('home2.tpl'); break; case 'progetto-perche': /**************************************************************************************/ // Il progetto $smarty->assign("pagina", $_GET['pagina']); $smarty->display('progetto-perche.tpl'); break; case 'progetto-cosa': /**************************************************************************************/ // Cosa significa $smarty->assign("pagina", $_GET['pagina']); $smarty->display('progetto-cosa.tpl'); break; case 'progetto-marchio': /**************************************************************************************/ // Cosa significa $smarty->assign("pagina", $_GET['pagina']); $smarty->display('progetto-marchio.tpl'); break; case 'progetto-aderire': /**************************************************************************************/ // Cosa significa $smarty->assign("pagina", $_GET['pagina']); $smarty->display('progetto-aderire.tpl'); break; case 'progetto-network': /**************************************************************************************/ // Cosa significa $smarty->assign("pagina", $_GET['pagina']); $smarty->display('progetto-network.tpl'); break; case 'progetto-il-tuo-ristorante': /**************************************************************************************/ // Il progetto $Tipolocale = new Tipolocale ($unDB); $ArrayTipolocale = $Tipolocale->Stampa(); $smarty->assign("ArrayTipolocale",$ArrayTipolocale); $smarty->assign("pagina", $_GET['pagina']); $smarty->display('progetto-il-tuo-ristorante.tpl'); break; case 'progetto-grazie': /**************************************************************************************/ // Cosa significa $smarty->assign("pagina", $_GET['pagina']); $smarty->display('progetto-grazie.tpl'); break; case 'progetto-errore': /**************************************************************************************/ // Cosa significa $smarty->assign("pagina", $_GET['pagina']); $smarty->display('progetto-errore.tpl'); break; case 'news': $smarty->assign("TitoloPagina", "Ristoranti Verdi - News, informazioni, comunicazioni"); $smarty->assign("ParoleChiave",""); $smarty->assign("Description",""); /**************************************************************************************/ // News INIZIO $News = new News($unDB); $step_news2 = 10; if ( !isset($_GET['start']) ) $start_news2 = 0; else $start_news2 = $_GET['start']; $ArrayNewsTutte = $News->Stampa(); $tot_news = count($ArrayNewsTutte); $ArrayNewsTutte = $News->StampaTraLimiti($start_news2, $step_news2); $pages = intval ( ($tot_news -1) / ($step_news2) ) + 1; $start_back = $start_news2 - $step_news2; $start_next = $start_news2 + $step_news2; for ($i=0; $i<$pages; $i++) { $start_page = $i * $step_news2; $arrayPagineTesti[$i]['pagina'] = $start_page; $arrayPagineTesti[$i]['numero_pagina'] = $i+1; } $smarty->assign("start", $start_news2); $smarty->assign("start_back", $start_back); $smarty->assign("start_next", $start_next); $smarty->assign("step", $step_news2); $smarty->assign("tot", $tot_news); $smarty->assign("NumeroPagine", $arrayPagineTesti); /**************************************************************************************/ $smarty->assign("ArrayNewsTutte", $ArrayNewsTutte); $smarty->assign("pagina", $_GET['pagina']); $smarty->assign("template", "inc-news.tpl"); $smarty->display('news.tpl'); break; case 'news-dettagli': $smarty->assign("TitoloPagina", "Ristoranti Verdi - News, informazioni, comunicazioni"); $smarty->assign("ParoleChiave",""); $smarty->assign("Description",""); $News = new News($unDB); $News->Carica($_GET['id_news']); $smarty->assign( "Id_News", $News->mId ); $smarty->assign( "Titolo", $News->mTitolo ); $smarty->assign( "Testo", $News->mTesto ); $smarty->assign( "Data", $News->mData ); $smarty->assign( "Click", $News->mClick ); $smarty->assign("pagina", $_GET['pagina']); $smarty->assign("template", "inc-news-dettagli.tpl"); $smarty->display('news.tpl'); break; case 'news-archivio': $smarty->assign("TitoloPagina", "Ristoranti Verdi - Archivio: News, informazioni, comunicazioni"); $smarty->assign("ParoleChiave",""); $smarty->assign("Description",""); /**************************************************************************************/ // News INIZIO $News = new News($unDB); $step_news = 10; if ( !isset($_GET['start']) ) $start_news = 0; else $start_news = $_GET['start']; $ArrayNewsTutte = $News->StampaVecchi(); $tot_news = count($ArrayNewsTutte); $ArrayNewsTutte = $News->StampaTraLimitiVecchi($start_news, $step_news); $pages = intval ( ($tot_news -1) / ($step_news) ) + 1; $start_back = $start_news - $step_news; $start_next = $start_news + $step_news; for ($i=0; $i<$pages; $i++) { $start_page = $i * $step_news; $arrayPagineTesti[$i]['pagina'] = $start_page; $arrayPagineTesti[$i]['numero_pagina'] = $i+1; } $smarty->assign("start_news", $start_news); $smarty->assign("start_back", $start_back); $smarty->assign("start_next", $start_next); $smarty->assign("step_news", $step_news); $smarty->assign("tot_news", $tot_news); $smarty->assign("array_pagine", $arrayPagineTesti); /**************************************************************************************/ $smarty->assign("ArrayNewsTutte", $ArrayNewsTutte); $smarty->assign("pagina", $_GET['pagina']); $smarty->assign("template", "inc-news-archivio.tpl"); $smarty->display('news.tpl'); break; case 'newsletter': $smarty->assign("TitoloPagina", "Ristoranti Verdi - Newsletter"); $smarty->assign("ParoleChiave",""); $smarty->assign("Description",""); /**************************************************************************************/ // Eventi INIZIO /**************************************************************************************/ $smarty->assign("pagina", $_GET['pagina']); $smarty->assign("template", "inc-newsletter.tpl"); $smarty->display('home2.tpl'); break; case 'ricette': $smarty->assign("TitoloPagina", "Ristoranti Verdi - Ricette"); $smarty->assign("ParoleChiave",""); $smarty->assign("Description",""); /**************************************************************************************/ // Eventi INIZIO $Ricette = new Ricette($unDB); $step_news = 10; if ( !isset($start_news) or ($start_news<0) ) $start_news = 0; $ArrayRicetteTutte = $Ricette->Stampa(); $tot_news = count($ArrayRicetteTutte); $ArrayRicetteTutte = $Ricette->StampaTraLimiti($start_news, $step_news); $pages = intval ( ($tot_news -1) / ($step_news) ) + 1; $start_back = $start_news - $step_news; $start_next = $start_news + $step_news; for ($i=0; $i<$pages; $i++) { $start_page = $i * $step_news; $arrayPagineTesti[$i]['pagina'] = $start_page; $arrayPagineTesti[$i]['numero_pagina'] = $i+1; } $smarty->assign("start", $start_news); $smarty->assign("start_back", $start_back); $smarty->assign("start_next", $start_next); $smarty->assign("step", $step_news); $smarty->assign("tot", $tot_news); $smarty->assign("NumeroPagine", $arrayPagineTesti); /**************************************************************************************/ $smarty->assign("ArrayRicetteTutte", $ArrayRicetteTutte); $smarty->assign("pagina", $_GET['pagina']); $smarty->assign("template", "inc-ricette.tpl"); $smarty->display('home2.tpl'); break; case 'ricette-dettagli': $smarty->assign("TitoloPagina", "Ristoranti Verdi - Ricette"); $smarty->assign("ParoleChiave",""); $smarty->assign("Description",""); $Ricette = new Ricette ($unDB); $Ricette ->Carica($_GET['id_ricette']); $smarty->assign("id_evento", $Ricette->mId); $smarty->assign("Titolo", $Ricette->mTitolo); $smarty->assign("Testo", $Ricette->mTesto); $smarty->assign("Data", $Ricette->mData); $smarty->assign("Click", $Ricette->mClick ); $smarty->assign("pagina", $_GET['pagina']); $smarty->assign("template", "inc-ricette-dettagli.tpl"); $smarty->display('home2.tpl'); break; case 'ingredienti': $smarty->assign("TitoloPagina", "Ristoranti Verdi - Ricette"); $smarty->assign("ParoleChiave",""); $smarty->assign("Description",""); /**************************************************************************************/ // Eventi INIZIO $Ingredienti = new Ingredienti($unDB); $step_news = 10; if ( !isset($start_news) or ($start_news<0) ) $start_news = 0; $ArrayIngredientiTutte = $Ingredienti->Stampa(); $tot_news = count($ArrayIngredientiTutte); $ArrayIngredientiTutte = $Ingredienti->StampaTraLimiti($start_news, $step_news); $pages = intval ( ($tot_news -1) / ($step_news) ) + 1; $start_back = $start_news - $step_news; $start_next = $start_news + $step_news; for ($i=0; $i<$pages; $i++) { $start_page = $i * $step_news; $arrayPagineTesti[$i]['pagina'] = $start_page; $arrayPagineTesti[$i]['numero_pagina'] = $i+1; } $smarty->assign("start", $start_news); $smarty->assign("start_back", $start_back); $smarty->assign("start_next", $start_next); $smarty->assign("step", $step_news); $smarty->assign("tot", $tot_news); $smarty->assign("NumeroPagine", $arrayPagineTesti); /**************************************************************************************/ $smarty->assign("ArrayIngredientiTutte", $ArrayIngredientiTutte); $smarty->assign("pagina", $_GET['pagina']); $smarty->assign("template", "inc-ingredienti.tpl"); $smarty->display('home2.tpl'); break; case 'ingredienti-dettagli': $smarty->assign("TitoloPagina", "Ristoranti Verdi - Ricette"); $smarty->assign("ParoleChiave",""); $smarty->assign("Description",""); $Ingredienti = new Ingredienti ($unDB); $Ingredienti->Carica($_GET['id_ingredienti']); $smarty->assign("id_ingredienti", $Ingredienti->mId); $smarty->assign("Nome", $Ingredienti->mNome); $smarty->assign("Descrizione", $Ingredienti->mDescrizione); $smarty->assign("Caratteristiche", $Ingredienti->mCaratteristiche); $smarty->assign("Mercato", $Ingredienti->mMercato); $smarty->assign("Come", $Ingredienti->mCome); $smarty->assign("Click", $Ingredienti->mClick ); $smarty->assign("pagina", $_GET['pagina']); $smarty->assign("template", "inc-ingredienti-dettagli.tpl"); $smarty->display('home2.tpl'); break; case 'link': /**************************************************************************************/ // lista link $smarty->assign("pagina", $_GET['pagina']); $smarty->assign("template", "inc-link.tpl"); $smarty->display('home2.tpl'); break; case 'chisiamo': /**************************************************************************************/ // Chi siamo $smarty->assign("pagina", $_GET['pagina']); $smarty->assign("template", "inc-chisiamo.tpl"); $smarty->display('home2.tpl'); break; } $unDB->disconnect(); ob_end_flush(); ?>