* For questions, help, comments, discussion, etc. please visit
 * https://github.com/CyberspaceNetworks/CoreSystem
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 */
include dirname(__FILE__) . "/../cnproject_config.php";
include dirname(__FILE__) . "/../cnautoload.php";
require_once dirname(__FILE__) . "/../cncore/web/includes/classes/CN.php";
require_once dirname(__FILE__) . "/../cncore/web/includes/classes/CNBootStrap.php";
require_once dirname(__FILE__) . "/../cncore/web/includes/classes/CNDispatcher.php";
require_once dirname(__FILE__) . "/../cncore/web/includes/classes/CNDownloadManager.php";
require_once dirname(__FILE__) . "/../cncore/api/CNProfiler/CNProfiler.php";
if (isset($_GET['profiler']) && $_GET['profiler'] == 1) {
    PA::$profiler = new PAProfiler();
    PA::$profiler->startTimer('PADispatcher');
}
$dispatcher = new PADispatcher($auto_load_list);
// User.php must be included after a new PADispatcher object is created
// otherwise the installation of CN breaks.
require_once getShadowedPath('api/CNUser/CNUser.php');
$script = $dispatcher->dispatch();
if (PA::$profiler) {
    PA::$profiler->stopTimer('PADispatcher');
}
if (PA::$profiler) {
    PA::$profiler->startTimer('Main Script', $script);
}
require_once $script;
if (PA::$profiler) {
    PA::$profiler->stopTimer('Main Script');
}
exit;