/home/admin/domains/nicsdata.no/public_html/library/Box/Mod.php
'servicedomain',
'servicedownloadable',
'servicehosting',
'servicelicense',
'staff',
'stats',
'support',
'system',
'theme',
'orderbutton',
'formbuilder',
];
/**
* @param string $mod
*/
public function __construct($mod)
{
if (!preg_match('#[a-zA-Z]#', $mod)) {
throw new FOSSBilling\Exception('Invalid module name');
}
$this->mod = strtolower($mod);
}
public function setDi(Pimple\Container $di): void
{
$this->di = $di;
}
public function hasManifest()
{
return file_exists(Path::normalize($this->_getModPath() . 'manifest.json'));
}
public function getManifest(): array
{
if (!$this->hasManifest()) {
throw new FOSSBilling\Exception('Module :mod manifest file is missing', [':mod' => $this->mod], 5897);
}
Arguments
/home/admin/domains/nicsdata.no/public_html/di.php
*
* @return Box_Url
*/
$di['url'] = function () use ($di) {
$url = new Box_Url();
$url->setDi($di);
$url->setBaseUri(SYSTEM_URL);
return $url;
};
/*
* Returns a new Box_Mod object, created with the provided module name.
*
* @param string $name The name of the module to create the object with.
*
* @return \Box_Mod The new Box_Mod object that was just created.
*/
$di['mod'] = $di->protect(function ($name) use ($di) {
$mod = new Box_Mod($name);
$mod->setDi($di);
return $mod;
});
/*
*
* @param string $mod the name of the module to get
*
* @return mixed the service of the associated module
*/
$di['mod_service'] = $di->protect(fn ($mod, $sub = '') => $di['mod']($mod)->getService($sub));
/*
*
* @param string $name the name of the module to get the configuration of
*
* @return mixed the configuration of the associated module
*/
$di['mod_config'] = $di->protect(fn ($name) => $di['mod']($name)->getConfig());
/home/admin/domains/nicsdata.no/public_html/library/Box/AppClient.php
/**
* Copyright 2022-2024 FOSSBilling
* Copyright 2011-2021 BoxBilling, Inc.
* SPDX-License-Identifier: Apache-2.0.
*
* @copyright FOSSBilling (https://www.fossbilling.org)
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache-2.0
*/
use DebugBar\Bridge\NamespacedTwigProfileCollector;
use FOSSBilling\Environment;
use FOSSBilling\TwigExtensions\DebugBar;
use Twig\Extension\ProfilerExtension;
use Twig\Profiler\Profile;
class Box_AppClient extends Box_App
{
protected function init(): void
{
$m = $this->di['mod']($this->mod);
$m->registerClientRoutes($this);
if ($this->mod == 'api') {
define('API_MODE', true);
// Prevent errors from being displayed in API mode as it can cause invalid JSON to be returned.
ini_set('display_errors', '0');
ini_set('display_startup_errors', '0');
} else {
$extensionService = $this->di['mod_service']('extension');
if ($extensionService->isExtensionActive('mod', 'redirect')) {
$m = $this->di['mod']('redirect');
$m->registerClientRoutes($this);
}
// init index module manually
$this->get('', 'get_index');
$this->get('/', 'get_index');
// init custom methods for undefined pages
/home/admin/domains/nicsdata.no/public_html/library/Box/App.php
}
public function put(string $url, string $methodName, ?array $conditions = [], string $class = null): void
{
$this->event('put', $url, $methodName, $conditions, $class);
}
public function delete(string $url, string $methodName, ?array $conditions = [], string $class = null): void
{
$this->event('delete', $url, $methodName, $conditions, $class);
}
public function run(): string
{
$this->debugBar['time']->startMeasure('registerModule', 'Registering module routes');
$this->registerModule();
$this->debugBar['time']->stopMeasure('registerModule');
$this->debugBar['time']->startMeasure('init', 'Initializing the app');
$this->init();
$this->debugBar['time']->stopMeasure('init');
$this->debugBar['time']->startMeasure('checkperm', 'Checking access to module');
$this->checkPermission();
$this->debugBar['time']->stopMeasure('checkperm');
return $this->processRequest();
}
/**
* @param string $path
*/
public function redirect($path): never
{
$location = $this->di['url']->link($path);
header("Location: $location");
exit;
}
public function render($fileName, $variableArray = []): string
/home/admin/domains/nicsdata.no/public_html/index.php
// If HTTP error code has been passed, handle it.
if (!is_null($http_err_code)) {
switch ($http_err_code) {
case '404':
$e = new FOSSBilling\Exception('Page :url not found', [':url' => $url], 404);
echo $app->show404($e);
break;
default:
$http_err_code = intval($http_err_code);
http_response_code($http_err_code);
$e = new FOSSBilling\Exception('HTTP Error :err_code occurred while attempting to load :url', [':err_code' => $http_err_code, ':url' => $url], $http_err_code);
echo $app->render('error', ['exception' => $e]);
}
exit;
}
// If no HTTP error passed, run the app.
echo $app->run();
exit;