getConfig("WEBSITE_SWITCH") && $page->ignoreWebsiteSwitch() == false && $from_subdomain == false) { $smarty->assign("from_subdomain", $from_subdomain); $smarty->assign("config_website_switch", $config->getConfig("WEBSITE_SWITCH")); $comingSoonData = false; if (file_exists(DOC_ROOT . "templates/coming_soon.tpl")) $comingSoonData = true; $smarty->assign("comingSoonData", $comingSoonData); require_once(DOC_ROOT . "includes/essential.inc.php"); $smarty->cache_lifetime = 0; $useTemplate = "sys_templates/coming_soon.tpl"; $smarty->display(DOC_ROOT . $useTemplate, "comingsoon"); exit; } /* p contains the page url */ if (isset($_REQUEST['p'])) { $p = $_REQUEST['p']; } $pagefunction = "page"; $panelArea = "page-area"; /* If the page URL is empty, then we can assume the page is the home page. Else determine the page id from the url. */ //Changed by Rich to allow passing of Page ID from url if (empty($p)) { if (!empty($_REQUEST['pid'])) { $pid = (int)$_REQUEST['pid']; } else { $pid = 1; } } else { if (substr($p, -1, 1) != "/") $p = $p . "/"; $page_url->setDataValue("url", $p); $pid = $page_url->getIDFromUrl(); } /* If a corrosponding page can not be found in the database redirect the user to the 404 page. */ //Modified by Rih McPharlin 22 March 2011 to send 404 status code if (!$pid) { header("HTTP/1.1 404 Not Found"); echo ""; die(); } else { $page->setDataValue("page_id", $pid); } $page->dbload(); /* If the page is not live, redirect the user to the 410 page. */ if ($page->getDataValue("is_live") == "No") { header("HTTP/1.1 410 Gone"); echo ""; die(); } /* If the page has a redirect value, then redirect the user to the page specified. */ if (!empty($_REQUEST['redirect'])) $redirect = $_REQUEST['redirect']; else $redirect = $page->getDataValue("redirect"); if (!empty($redirect)) header("Location: " . $redirect, TRUE, 301); /* Does the page have membership permissions? */ $privilege_array = $page_privileges->getPagePrivs($page->getDataValue("page_id"), $privileges->getPrivileges("page")); foreach ($privilege_array as $p_array) { if (isset($p_array['groups'])) { if (!$_SESSION['dvcms']['userid'] >= 1) { if (isset($_SESSION['cust']['loggedin'])) { if (isset($_SESSION['cust']['groups'])) { $group_list = $_SESSION['cust']['groups']; foreach ($p_array['groups'] as $p_group) { foreach ($group_list as $g_list) { if (in_array($g_list, $p_group)) { $p_allowed = true; } } } } if (!$p_allowed) { header("Location: " . XBASE_URL . "412"); } } else { header("Location: " . XBASE_URL . "401"); } } } } /* The page has passed all the tests above, so lets determine the appropiate data to be displayed. Load ALL data associated with this page, so it can be passed to the smarty template engine. */ $pageData = $page->getData(); $page->setTopParentId($pageData['page_id']); $pageData['top_parent_page_id'] = $page->topParentId; /* If a DVCMS user is logged in, store some session data about the page for purposes of the administration section frame. */ if ($pageData["is_skinless"] != "Yes") { $_SESSION['dvcms']['item_id'] = $pageData['page_id']; } $_SESSION['dvcms']['function'] = $pagefunction; $pageData['breadcrumbs'] = $page->getPathToPage($pid, "true"); if (empty($pageData['description'])) $pageData['description'] = $page->data["description"]; if (empty($pageData['keywords'])) $pageData['keywords'] = $page->data["keywords"]; if (empty($pageData['author'])) $pageData['author'] = $config->getConfig("META_AUTHOR"); $_SESSION['dvcms']['returnURL'] = getReturnURL(); /* Derive canonical address */ $smarty->assign("canonical", getCanonical($pageData['url'], $config->getConfig("ALWAYS_SECURE"))); $metadata->dbload($pid, 'page'); /* ANYTHING ADDED TO THE $_SESSION VARIABLE AFTER THE FOLLOWING REQUIRE_ONCE WILL BE LOST SO DONT ADD AFTER THE ESSENTIAL_INC */ require_once(DOC_ROOT . "includes/essential.inc.php"); $smarty->assign("metadata", (array) $metadata); // Get Cart Products if shop is ON if ($config->getConfig("SHOPPING_SYSTEM")) { $_SESSION['cust']['returnURL'] = $_SERVER['REQUEST_URI']; $smarty->assign("cartProducts", $cart->getDataValue('session_cart_products')); } // output OPENGRAPH $smarty->assign("opengraph", $ogp->toHTML()); // output JSONLD $schema = new JSONLD; $schema->setPageType("page"); $smarty->assign("schema", $schema->outputJSONLD()); // Display the output - check for skinless $cache_id = $pid; if ($deviceType == "phone") $cache_id = "$cache_id-$deviceType"; $smarty->setCacheLifetime($cacheTime); if ($page->getDataValue("is_skinless") == 'Yes') { $smarty->display(DOC_ROOT . 'sys_templates/skinless.tpl', $cache_id); } else { $tpl = trim(strtolower($page->getDataValue("channel"))) . ".tpl"; if (strlen($tpl) < 9) $tpl = "main.tpl"; $smarty->display($tpl, $cache_id); } //dump($smarty); /*********************** NOTIFICATION ********************************/ if ($_SESSION['dvcms']['userid'] == 2) { $cust_id = $config->getConfig("WA_SITE_ID"); // if cust_id is missing, set to something that will return no results (-1) if (!$cust_id) $cust_id = -1; // API host to use - is this Live or Dev environment? if ($notLiveGateway) { $urltopost = 'https://customers.webarena.local/NOTIFICATION_API/?controller=NOTIFICATION&app_id=APP001&customer_id=' . $cust_id . '&status=Unread&action=read&username=admin&userpass=password'; } else { $urltopost = 'https://customers.webarena.me/NOTIFICATION_API/?controller=NOTIFICATION&app_id=APP001&customer_id=' . $cust_id . '&status=Unread&action=read&username=admin&userpass=password'; } $ch = curl_init($urltopost); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_URL, $urltopost); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $array); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); $returndata = curl_exec($ch); curl_close($ch); $notification = json_decode($returndata, true); if (!empty($notification['data'])) { ?>