<?php
	require_once( "local.config.inc.php" );

	// -- article fallback
	require_once( $GLOBALS["site_root"] . "/includes/models/Articles.inc.php" );
	$am = new ArticlesModel();
	$art = $am->getArticleIdFromURL( "/".$getparams["url"] , $GLOBALS["langcode"] );
	if ($art) {
		require_once( $GLOBALS["site_root"] . "/includes/pages/ArticlePage.inc.php" );
		$getparams["article_id"]=$art["article_id"];
		$getparams["pagenum"]=$art["pagenum"];
		$page = new ArticlePage();
		$page->passGetPost( $getparams , $postparams );
		$page->handleEvents();
		echo $page->render();
		fo_exit();
	}

	// overall else
	header( "HTTP/1.1 404 Not found" );
	require_once( $GLOBALS["site_root"] . "/includes/pages/MainPage.inc.php" );
	$page = new MainPage();
	$page->passGetPost( $getparams , $postparams );
	$page->handleEvents();
	echo $page->render();
	fo3_exit();

?>
