* @version 2.0 * @package Digital Nachos platter * @date July 2010 * * CHANGE LOG: * */ require_once('config.php'); if($arrConfig['recordAccessLog']) { general::accessLog(); } if($arrConfig['maintainenceMode'] && !in_array($_SERVER['REMOTE_ADDR'], $arrConfig['exemptIP'])) { include("maintenance.php"); die(); } if(empty($_POST)) { $_SESSION['lastUrl'] = $_SERVER['HTTP_REFERER']; } /*$dbdata = new dbdata(); $strSql = file_get_contents('scripts/db-update.php'); echo substr($strSql, 0, 300 ); $dbdata->dbquery( $strSql );*/ $members = new members(); $banner = new banner(); $notifications = new notifications(); if( $arrConfig['isShop'] ) { $shop = new shop(); } // Members control if( isset( $_POST['isMemberLogin'] ) ) { $strLocation = (!empty($_GET['location']) && $_GET['location']) ? $_GET['location'] : (!empty($_POST['location']) ? $_POST['location'] : '/shop'); $members->login($_POST['email'], $_POST['password'], $strLocation); } if( isset( $_GET['logout'] ) ) { $members->logout(); } //$members->sessionCheck(); // Get the current page location/* $system = new pagecontrol( ( isset( $_GET['ref'] ) ? $_GET['ref'] : '' ) ); // Handle redirects $objRedirect = new redirects(); $arrRedirect = $objRedirect->getRedirect($system->reference); if(!empty($arrRedirect)) { header("HTTP/1.1 " . $arrRedirect->strType); header("Location: " . $arrRedirect->strPageTo); } // Check to see if the user has logged only for the admin section if( $system->folder == 'admin/' ) { $user = new user(); $user->sessionCheck( $system->section, FALSE ); $system->master = 'admin'; $arrAdminBreadcrumbs = array( $system->section => $system->section ); if(!empty($system->action)) { $arrAdminBreadcrumbs[$system->action] = $system->section . "/" . $system->action; } if($system->section != "pages" && !empty($system->id)) { $arrAdminBreadcrumbs[$system->id] = $system->section . "/" . $system->action . "/" . $system->id; } // Is the user allowed here? if(!empty($arrConfig['menuSubSections'])) { foreach($arrConfig['menuSubSections'] as $section => $subSection) { foreach($subSection as $sub => $sectionDetails) { if($system->reference == $sectionDetails['url']) { if(!in_array($user->group_id, $sectionDetails['group'])) { general::redirect("/admin/dashboard"); exit(); } } } } } } else { // Cleans global post array from injected input general::cleanGlobals(); } // Secure Trading payment form if( $system->subSection == "frame" ) { $system->master = "basic"; $system->templateName = "checkout-order-frame"; } // --------------------------------------------------------------------------------------- // CONTROLLER $strTemplate = $arrConfig['sitePath'] . 'controllers/' . $system->folder . $system->section . '.php'; if( file_exists( $strTemplate ) ) { require_once( $strTemplate ); } else { echo general::siteError('Controller error', 'The controller ' . $system->section . ' cannot be found!'); exit(); } // --------------------------------------------------------------------------------------- // TITLE PAGE $lang = new lang(); // Get project title $strPageTitle = $arrConfig['siteName']; // Get page title from either the section or sub section $strMainTab = isset($strMainTab) ? $strMainTab : ''; $strTitle = $lang->titles(isset($strTab) ? $strTab : $strMainTab); // Assemble page title $strPageTitle = $strTitle . ' :: ' . $strPageTitle; // --------------------------------------------------------------------------------------- // CLASSIFY BODY TAG // This allows us to use CSS and target certain pages based on section, title or subsection $strBodyClass = ''; $strBodyClass .= isset( $system->section ) ? ' section-' . $system->section : ''; $strBodyClass .= isset( $system->subSection ) ? ' subsection-' . $system->subSection : ''; $strBodyClass .= isset( $system->templateName ) ? ' template-' . $system->templateName : ''; $strBodyClass .= " " . $system->page; // --------------------------------------------------------------------------------------- // DEFAULT TEMPLATE $strTemplate = $arrConfig['sitePath'] . 'views/' . $system->master . '.php'; if( file_exists( $strTemplate ) ) { require_once( $strTemplate ); } else { echo general::siteError('Default template', 'The default template cannot be found!'); exit(); } ?>