<?php
if (!defined('ROOT_PATH')) {
    define('ROOT_PATH', dirname(dirname(__DIR__)) . '/');
}

$premiumFile = ROOT_PATH . 'modules-premium/pro/order/public/success.php';
if (!is_file($premiumFile)) {
    require_once ROOT_PATH . 'core/lib/license.php';
    require_once ROOT_PATH . 'core/lib/license_guard.php';
    require_once ROOT_PATH . 'core/lib/module_loader.php';
    $license = new \Core\Lib\License();
    if ($license->getLevel() > \Core\Lib\License::LEVEL_FREE) {
        $loader = new \Core\Lib\ModuleLoader($license);
        $loader->syncAuthorizedModules();
    }
}

if (is_file($premiumFile)) {
    require $premiumFile;
    return;
}

header('Location: /public/index.php?m=index');
exit;
