2013-06-17 06:13:38 +00:00
|
|
|
<?php
|
2013-06-19 19:05:12 +00:00
|
|
|
error_reporting(E_ALL);
|
|
|
|
ini_set('display_errors', 'on');
|
2013-06-17 06:13:38 +00:00
|
|
|
require( '../config.php' );
|
|
|
|
require( '../../ams_lib/libinclude.php' );
|
2013-06-25 19:33:49 +00:00
|
|
|
session_start();
|
2013-06-15 14:01:11 +00:00
|
|
|
|
2013-06-26 01:26:25 +00:00
|
|
|
//print_r($_SESSION);
|
2013-06-25 19:33:49 +00:00
|
|
|
|
2013-06-26 15:43:29 +00:00
|
|
|
//perform an action in case one is specified
|
|
|
|
if ( isset( $_POST["function"] ) ){
|
|
|
|
require( "inc/" . $_POST["function"] . ".php" );
|
|
|
|
$return = $_POST["function"]();
|
|
|
|
}
|
|
|
|
|
2013-06-25 19:33:49 +00:00
|
|
|
//Decide what page to load
|
|
|
|
if(isset($_SESSION['user'])){
|
|
|
|
$page = 'home';
|
2013-06-26 15:43:29 +00:00
|
|
|
$return['username'] = $_SESSION['user'];
|
2013-06-25 19:33:49 +00:00
|
|
|
}else{
|
|
|
|
//default page
|
|
|
|
$page = 'login';
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( isset( $_GET["page"] ) ){
|
|
|
|
$page = $_GET["page"];
|
|
|
|
}
|
|
|
|
|
2013-06-17 06:13:38 +00:00
|
|
|
function loadpage ( $page ){
|
2013-06-26 14:35:33 +00:00
|
|
|
$filename = 'autoload/' . $page . '.php';
|
|
|
|
if(is_file($filename)){
|
|
|
|
require_once($filename);
|
|
|
|
}
|
2013-06-25 19:33:49 +00:00
|
|
|
}
|
2013-06-15 14:01:11 +00:00
|
|
|
|
2013-06-26 14:35:33 +00:00
|
|
|
loadpage($page);
|
|
|
|
|
2013-06-25 19:33:49 +00:00
|
|
|
//Set permission
|
2013-06-26 01:26:25 +00:00
|
|
|
if(isset($_SESSION['permission'])){
|
|
|
|
$return['permission'] = $_SESSION['permission'];
|
2013-06-25 19:33:49 +00:00
|
|
|
}else{
|
|
|
|
//default permission
|
|
|
|
$return['permission'] = 0;
|
2013-06-17 14:29:20 +00:00
|
|
|
}
|
2013-06-18 05:22:24 +00:00
|
|
|
|
2013-06-25 19:33:49 +00:00
|
|
|
|
|
|
|
//hide sidebar + topbar in case of login/register
|
2013-06-26 14:35:33 +00:00
|
|
|
if($page == 'login' || $page == 'register' || $page == 'logout'){
|
2013-06-25 19:33:49 +00:00
|
|
|
$return['no_visible_elements'] = 'TRUE';
|
2013-06-18 05:22:24 +00:00
|
|
|
}else{
|
2013-06-25 19:33:49 +00:00
|
|
|
$return['no_visible_elements'] = 'FALSE';
|
2013-06-18 05:22:24 +00:00
|
|
|
}
|
2013-06-26 01:26:25 +00:00
|
|
|
//print_r($return);
|
2013-06-17 06:13:38 +00:00
|
|
|
helpers :: loadTemplate( $page , $return );
|