59 lines
1.9 KiB
PHP
59 lines
1.9 KiB
PHP
<?php
|
|
// dsp26072025/index.php
|
|
// This is the main front controller for the application.
|
|
|
|
// Define the base path for consistent includes
|
|
// This will correctly point to the root directory of your project
|
|
define('BASE_PATH', __DIR__ . '/');
|
|
|
|
// Start the session once at the very beginning
|
|
if (session_status() === PHP_SESSION_NONE) {
|
|
session_start();
|
|
}
|
|
|
|
// Global Dependencies - All pages will have access to these.
|
|
// NOTE: Make sure these files exist in the specified paths.
|
|
require_once BASE_PATH . 'config.php';
|
|
require_once BASE_PATH . 'includes/auth.php';
|
|
require_once BASE_PATH . 'includes/functions.php';
|
|
require_once BASE_PATH . 'classes/DataSource.php';
|
|
require_once BASE_PATH . 'classes/Classifications.php';
|
|
require_once BASE_PATH . 'classes/User.php';
|
|
require_once BASE_PATH . 'classes/Permission.php';
|
|
require_once BASE_PATH . 'classes/Request.php';
|
|
require_once BASE_PATH . 'classes/Log.php';
|
|
|
|
// Get the requested page from the URL. Default to 'dashboard' if not set.
|
|
$page = $_GET['page'] ?? 'dashboard';
|
|
|
|
// A simple routing system to include the correct file
|
|
switch ($page) {
|
|
case 'dashboard':
|
|
include BASE_PATH . 'data_user/dashboard.php';
|
|
break;
|
|
case 'browse_datasources':
|
|
include BASE_PATH . 'data_user/browse_datasources.php';
|
|
break;
|
|
case 'my_permissions':
|
|
include BASE_PATH . 'data_user/my_permissions.php';
|
|
break;
|
|
case 'my_downloads':
|
|
include BASE_PATH . 'data_user/my_downloads.php';
|
|
break;
|
|
case 'login':
|
|
include BASE_PATH . 'data_user/login.php';
|
|
break;
|
|
case 'register':
|
|
include BASE_PATH . 'data_user/register.php';
|
|
break;
|
|
case 'process_request_permission':
|
|
include BASE_PATH . 'data_user/process_request_permission.php';
|
|
break;
|
|
default:
|
|
// Handle pages not found
|
|
header("HTTP/1.0 404 Not Found");
|
|
include BASE_PATH . 'data_user/404.php';
|
|
break;
|
|
}
|
|
?>
|