Location: PHPKode > projects > DevSite > devsite1.0/index.php
<?php
/**
 * Main index file that pretty much sets up everything.
 *
 * This file is the only file that should be called directly by an end-user,
 * it will display the requested page if possible, authorize the current user
 * if necessary, and perform other very important initialization tasks.
 *
 * @package	DevSite
 * @version	0.1
 * @author	Steven Normore
*/
error_reporting(E_ALL); /* TURN THIS OFF FOR THE RELEASE - E_NONE */

if(!file_exists('install.lock'))
{
	echo 'Run "install.php" first.';
	return;
}

require_once('config.php');
require_once(LIB_PATH.'Auth.php');
require_once(LIB_PATH.'UserInfo.php');

ob_start();	// start output buffer

// connect to mysql database
$dbh = mysql_connect($db_host, $db_user, $db_pass);
mysql_select_db($db_dbname, $dbh);

global $_NAV;
empty($_GET['mod']) ? $_NAV['module'] = 'system' : $_NAV['module'] = $_GET['mod'];
empty($_GET['page']) ? $_NAV['page'] = 'index' : $_NAV['page'] = $_GET['page'];

// authentication
if(Auth::isAuth())
	$Me = new UserInfo(Auth::getUserId());
else
{
	$_NAV['module'] = 'system';
	$_NAV['page'] = 'login';
}

// module and page check
if(!in_array($_NAV['module'], $_modules))
	exit('Invalid module.');
if(!in_array($_NAV['page'], $_pages[$_NAV['module']]))
	exit('Invalid page');

define('TEMP_MAINMENU', MODULES_PATH.'system/menu.php');
define('TEMP_PROJECTMENU', MODULES_PATH.'system/project_menu.php');
define('TEMP_TEAMMENU', MODULES_PATH.'system/team_menu.php');
define('TEMP_INFOSNIPPET', MODULES_PATH.'system/info_snippet.php');
define('TEMP_BOOKMARKS', MODULES_PATH.'bookmarks/bmarks.php');
define('TEMP_SUBMENU', MODULES_PATH.'system/submenu.php');
define('TEMP_CONTENTPAGE', MODULES_PATH.$_NAV['module'].'/'.$_NAV['page'].'.php');
define('PAGE_TITLE', '');
require(THEME_PATH.'index.php');

ob_end_flush();	// flush and destroy output buffer
?>
Return current item: DevSite