<?php
$subModules = array('settings' => 'settings.php');
$subModulePath = __PATH_ADMINCP_MODULES__ . $_REQUEST['module'] . '/';

if(isset($_REQUEST['page'])) {
    if(!array_key_exists($_REQUEST['page'], $subModules)) throw new Exception('The requested sub-module is not valid.');
    $subModulePath .= $subModules[$_REQUEST['page']];
    if(!is_file($subModulePath)) throw new Exception('The requested sub-module does not exist.');
    try {
        if(!@include($subModulePath)) throw new Exception('The requested sub-module could not be loaded.');
    } catch(Exception $ex) {
        message('error', $ex->getMessage());
    }
} else {
    message('error', 'Please select a sub-module.');
}
