header("Location: https://optimal.pt"); exit(); if (substr_count($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip')) { ob_start(); ob_start("ob_gzhandler"); } $DOMAIN = $_SERVER['SERVER_NAME']; if (strrpos($DOMAIN, "aero") !== false || strrpos($DOMAIN, "deploy1298") !== false) $DOMAIN = "aerostructures"; else $DOMAIN = "structural"; //structural include_once("config.php"); $_SESSION["regular_request"] = true; $r1 = isset($_GET["r1"]) ? strtolower($_GET["r1"]) : ""; $r2 = isset($_GET["r2"]) ? strtolower($_GET["r2"]) : ""; $r3 = isset($_GET["r3"]) ? strtolower($_GET["r3"]) : ""; $r4 = isset($_GET["r4"]) ? strtolower($_GET["r4"]) : ""; $r5 = isset($_GET["r5"]) ? strtolower($_GET["r5"]) : ""; $r6 = isset($_GET["r6"]) ? strtolower($_GET["r6"]) : ""; $lang = ""; if (in_array($r1, $langs)) { $lang = $r1; } else { if (isset($_SESSION["lang"]) && $_SESSION["lang"] != "") $lang = $_SESSION["lang"]; else $lang = $langs[0]; } $_SESSION['lang'] = $lang; if (sizeof($langs) > 1) $menu_name = $r2; else $menu_name = $r2; //this is a one level menu, you can define your internal structure and define wich one appears on the menu $menus = array(); //dynamic templates of a simple text template $templatetext = new AYSchema(); $templatetext->load(0, "DynPage"); $templatetext = $templatetext->selectAll(array("active"), array(1), array("=")); $templatetmp = new AYSchema(); $templatetmp->load(0, "DynSubpage"); for ($i = 0; $i < sizeof($templatetext); $i++) { $sub_pages = $templatetmp->selectAll(array("active", "parent_id"), array(1, $templatetext[$i]["id"]), array("=", "=")); array_push($menus, array("key" => array($templatetext[$i]["urlseo"]), "file" => "template_text", "title" => array($templatetext[$i]["title"]), "menu" => "1", "submenu" => $sub_pages)); } array_push($menus, array("key" => array(""), "file" => "home", "title" => array("Home"), "menu" => "0", "submenu" => array())); array_push($menus, array("key" => array("contacts"), "file" => "contacts", "title" => array("Contacts"), "menu" => "1", "submenu" => array())); array_push($menus, array("key" => array("news"), "file" => "template_list", "title" => array("News"), "menu" => "1", "submenu" => array())); $change_lang = array(); array_push($change_lang, $langs); $menu_item = NULL; for ($i = 0; $i < sizeof($menus); $i++) { if (parseLanguage($menus[$i]["key"]) == $menu_name) { $menu_item = $menus[$i]; break; } } if ($menu_item == NULL) $menu_item = $menus[0]; array_push($change_lang, $menu_item["key"]); $file = $menu_item["file"]; $page = parseLanguage($menu_item["key"]); $page_title = parseLanguage($menu_item["title"]); $sitetags = new AYSchema(); $sitetags->load(0, "SiteMetatagsAnalytics"); $sitetags->setCurrentLanguage($_SESSION["lang"]); $sitetags_detail = $sitetags->selectFirst(); $site_title = $sitetags_detail["title"]; $site_description = $sitetags_detail["description"]; $site_keywords = $sitetags_detail["keywords"]; ob_start(); if (file_exists("pages/" . $file . ".php")) include_once("pages/" . $file . ".php"); $contents = ob_get_clean(); ob_start(); if (file_exists("pages/header.php")) include_once("pages/header.php"); $header = ob_get_clean(); ob_start(); if (file_exists("pages/footer.php")) include_once("pages/footer.php"); $footer = ob_get_clean(); ?>