|
|
|
@ -3,33 +3,49 @@ error_reporting(E_ALL);
|
|
|
|
|
ini_set('display_errors', 'on');
|
|
|
|
|
require( '../config.php' );
|
|
|
|
|
require( '../../ams_lib/libinclude.php' );
|
|
|
|
|
//default page
|
|
|
|
|
$page = 'login';
|
|
|
|
|
session_start();
|
|
|
|
|
|
|
|
|
|
print("[" . $_SESSION['user'] . "] ");
|
|
|
|
|
|
|
|
|
|
//Decide what page to load
|
|
|
|
|
if(isset($_SESSION['user'])){
|
|
|
|
|
$page = 'home';
|
|
|
|
|
}else{
|
|
|
|
|
//default page
|
|
|
|
|
$page = 'login';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( isset( $_GET["page"] ) ){
|
|
|
|
|
$page = $_GET["page"];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//perform an action in case one is specified
|
|
|
|
|
if ( isset( $_POST["function"] ) ){
|
|
|
|
|
require( "inc/" . $_POST["function"] . ".php" );
|
|
|
|
|
$tempReturn = $_POST["function"]();
|
|
|
|
|
$return = $_POST["function"]();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function loadpage ( $page ){
|
|
|
|
|
require_once( 'autoload/' . $page . '.php' );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( isset( $_GET["page"] ) ){
|
|
|
|
|
$page = $_GET["page"];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//Page Handling
|
|
|
|
|
if($page == 'login' || $page == 'register'){
|
|
|
|
|
$no_visible_elements = 'TRUE';
|
|
|
|
|
//Set permission
|
|
|
|
|
if(isset($_SESSION['Permission'])){
|
|
|
|
|
$return['permission'] = $_SESSION['Permission'];
|
|
|
|
|
}else{
|
|
|
|
|
//default permission
|
|
|
|
|
$return['permission'] = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( isset($functionReturn) ){
|
|
|
|
|
$return = array_merge(array( 'permission' => 1, 'no_visible_elements' => $no_visible_elements ),$functionReturn);
|
|
|
|
|
|
|
|
|
|
//hide sidebar + topbar in case of login/register
|
|
|
|
|
if($page == 'login' || $page == 'register'){
|
|
|
|
|
$return['no_visible_elements'] = 'TRUE';
|
|
|
|
|
}else{
|
|
|
|
|
$return = array( 'permission' => 1, 'no_visible_elements' => $no_visible_elements );
|
|
|
|
|
$return['no_visible_elements'] = 'FALSE';
|
|
|
|
|
}
|
|
|
|
|
//print_r($return);
|
|
|
|
|
|
|
|
|
|
helpers :: loadTemplate( $page , $return );
|
|
|
|
|
|
|
|
|
|
session_destroy();
|
|
|
|
|