$value) { $req_var = explode("_", $key); if(!in_array($req_var[0], $buffer)) { if(!in_array($req_var[0], $mandatory_modules)) { $buffer[] = $req_var[0]; } } } $required_modules = array_merge($buffer,$mandatory_modules); return $required_modules; } function includeRequiredModules() { /* Zorgen dat de benodigde modules geinclude worden */ global $cfg, $frontend_only_modules; $available_modules = get_modules(); $required_modules = get_required_modules(); for($i=0; $i < count($required_modules); $i++) { if(($available_modules[$required_modules[$i]]['main']['enabled'] == true) || in_array($required_modules[$i], $frontend_only_modules) == true) { if(in_array($required_modules[$i], $frontend_only_modules) == true) { if(file_exists($cfg['wbmRoot']."/modules/".$required_modules[$i]."/module.mod.php")) { require_once($cfg['wbmRoot']."/modules/".$required_modules[$i]."/module.mod.php"); } } else { if(file_exists($cfg['wbmRoot']."/modules/".$available_modules[$required_modules[$i]]['main']['path']."/module.mod.php")) { require_once($cfg['wbmRoot']."/modules/".$available_modules[$required_modules[$i]]['main']['path']."/module.mod.php"); } } } } } function setDomain($conn) { global $cfg; if($_REQUEST['domain'] != null) { $_SESSION['site']['domain_name'] = $_REQUEST['domain']; } if($_SESSION['site']['domain_name'] == null) { $_SESSION['site']['domain_name'] = $cfg['defdomain']; } $sql = sprintf("select * from domeinen where domeinnaam = '%s'", mysql_escape_string($_SESSION['site']['domain_name'])); $qry = mysql_query($sql,$conn); if($row = mysql_fetch_array($qry)) { $_SESSION['site']['domain_id'] = $row['id']; $_SESSION['site']['domain_name'] = $row['domeinnaam']; } else { session_destroy(); session_start(); $sql = "SELECT * FROM domeinen ORDER BY id LIMIT 0,1"; $qry = mysql_query($sql,$conn); if (mysql_num_rows($qry)) { $row = mysql_fetch_assoc($qry); $_SESSION['site']['domain_id'] = $row['id']; $_SESSION['site']['domain_name'] = $row['domeinnaam']; } else { die("Geen gegevens gevonden voor dit domein"); } } } function process_module_data($smarty, $conn) { $available_modules = get_modules(); $required_modules = get_required_modules(); for($i=0; $i < count($required_modules); $i++) { switch($required_modules[$i]): case "menu": $smarty = menuMain($conn, $smarty); break; case "pages": $smarty = pagesMain($conn, $smarty); break; case "photobook": $smarty = photoBookMain($conn, $smarty); break; case "agenda": $smarty = agendaMain($conn, $smarty); break; case "guestbook": $smarty = guestbookMain($conn, $smarty); break; case "links": $smarty = linksMain($conn, $smarty); break; case "nieuws": $smarty = newsMain($conn, $smarty); break; case "personel": $smarty = personelMain($conn, $smarty); break; case "subscribe": $smarty = subscribeMain($conn, $smarty); break; case "agenda": $smarty = agendaMain($conn, $smarty); break; endswitch; } return $smarty; } function handleNullAction() { global $cfg; if($_SERVER['REQUEST_URI'] == "/") { header("location: ".$cfg['defurl']); exit(); } } function main($conn, $smarty) { // Toekennen van gegevens voor benodigde modules $smarty = process_module_data($smarty, $conn); // Toekennen van de useragent browsertype if(strstr(strtolower($_SERVER['HTTP_USER_AGENT']), "msie")) { $smarty->assign("browser", "msie"); } $smarty->display("index.tpl"); } function initSmarty($smarty) { $smarty->compile_check = true; // Smarty configureren $smarty->compile_dir = "data/templates_c/".$_SESSION['site']['domain_name']."/"; $smarty->template_dir = "frontend/".$_SESSION['site']['domain_name']; // Template cache directory aanmaken indien nodig if(!file_exists("data/templates_c/".$_SESSION['site']['domain_name']."/")) { mkdir("data/templates_c/".$_SESSION['site']['domain_name']."/"); } // Globale variabelen aan smarty toekennen $smarty->assign("domain_name", $_SESSION['site']['domain_name']); // Huidig domain return $smarty; } function handleOperations($conn, $smarty) { switch($_REQUEST['operation']) { case "intro": $smarty->display("intro.tpl"); exit(); break; case "randomflashpic": include "modules/photobook/module.mod.php"; show_random_flash_picture($conn); exit(); break; } return $smarty; } session_start(); // Connecting to database $conn = db_connect(); // Determining which domain to use setDomain($conn); // Smarty initiŽren $smarty = new Smarty; $smarty = initSmarty($smarty); handleNullAction(); // captacha if(isset($_SESSION['site']['captcha']) == false) { $_SESSION['site']['captcha'] = substr(md5(rand(0,100000)),0,5); } $smarty = handleOperations($conn, $smarty); includeRequiredModules(); main($conn, $smarty); mysql_close($conn); ?>