<?php if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest' && _request('cookie')) { setcookie("pcookie", 1, time()+86400*365, "/", COOKIE_DOMAIN); exit; } if ($_SERVER['REQUEST_METHOD'] == 'POST') { if (_request('action') == 'gift-card-saldo') { $recaptcha = new \ReCaptcha\ReCaptcha("6LdwKAwUAAAAAMKpQYhiqVuMtbMkUEkJ-5-zqN8S"); if (!$recaptcha->verify(_request('g-recaptcha-response'),$_SERVER["REMOTE_ADDR"])->isSuccess()) { $smarty->assign("result", array("error" => 1)); } else { $result = classes\Fidelity::GetGift(_request('card1'), _request('card2')); if ($result && !_a($result, 'Errore')) { $result = array( "action" => "gift-card-saldo", "card" => _request('card1'), "expiration" => substr($result['data_scadenza']['date'], 0, 10), "amount" => (float)$result['importo_saldo'], ); $smarty->assign("result", $result); } } } } if ($page['slug'] == '/') { require("controllers/home.inc.php"); } else if ($page['slug'] == '/prodotti') { $banners = models\Banner::get(array("published" => 1, "dates" => 1, "category" => 4), 0, 4); $smarty->assign("banners", $banners); $focus = models\BlogArticle::get(array("published" => 1, "dates" => 1, "c_category_id" => 1, "focus_prodotti" => 1), 0, 4); $smarty->assign("focus", $focus); } else if ($page['slug'] == '/cardoro/vantaggi') { $products = models\Product::get(array("published" => 1), 0, 64); $smarty->assign("products", $products); $categories = models\ProductCategory::get(array("published" => 1), 0, 8); // mod $smarty->assign("categories", $categories); // mod } else { $focus = models\BlogArticle::get(array("published" => 1, "dates" => 1, "c_category_id" => 1, "focus" => $page['id']), 0, 10000); $smarty->assign("focus", $focus); } $confirm = false; $errors = array(); $smarty->assign("page", $page); $smarty->assign("errors", $errors); $smarty->assign("confirm", $confirm); $smarty->display("cms.tmpl");