define('NETHGUI_DEBUG', TRUE);
define('NETHGUI_MENU_CATEGORIES', 'Status, Management, Administration, Security, Configuration, Gateway');
$namespaces = array();
include_once "autoload.php";
$nsbase = dirname(__DIR__);
$loader = new \Composer\Autoload\ClassLoader();
$loader->add('Nethgui', $nsbase);
$loader->add('NethServer', $nsbase);
$loader->register();
foreach ($loader->getPrefixes() as $nsName => $paths) {
    $namespaces[trim($nsName, '\\')] = reset($paths) . DIRECTORY_SEPARATOR . trim($nsName, '\\');
}
$loader->add('Pimple', $nsbase);
$loader->add('Mustache', $nsbase);
$loader->add('Symfony', $nsbase);
$FW = new \Nethgui\Framework();
$FW->setLogLevel(E_WARNING | E_ERROR | E_NOTICE)->registerNamespace($namespaces[__NAMESPACE__])->setDefaultModule('Dashboard')->setDecoratorTemplate('NethServer\\Template\\NethServer')->setForcedLoginModule(function ($dc) {
    return $dc['Platform']->getDatabase('configuration')->getProp('httpd-admin', 'ForcedLoginModule');
})->setAuthenticationValidator(function ($dc) {
    $v = new \NethServer\Tool\PamValidator();
    $v->setLog($dc['Log']);
    return $v;
});
try {
    $R = $FW->createRequest();
    if ($R->getFormat() === 'xhtml') {
        $R->setParameter('Menu', array())->setParameter('Tracker', array())->setParameter('Notification', array())->setParameter('Resource', array())->setParameter('Logout', array());
    } elseif ($R->getFormat() === 'json') {
        $R->setParameter('Tracker', array())->setParameter('Notification', array());
    }
    $FW->dispatch($R);
Example #2
0
<?php

/**
 * PHPUnit bootstrap file
 *
 * Execute
 *
 * phpunit --bootstrap <path-to-this-file> ...
 *
 */
// Some PHP settings:
date_default_timezone_set('UTC');
error_reporting(E_ALL | E_STRICT);
// If xdebug is loaded, disable xdebug backtraces:
extension_loaded('xdebug') && xdebug_disable();
require_once 'vendor/autoload.php';
$namespaces = array();
$nsbase = __DIR__;
$loader = new \Composer\Autoload\ClassLoader();
$loader->add('Nethgui', $nsbase);
$loader->add('NethServer', $nsbase);
$loader->register();
foreach ($loader->getPrefixes() as $nsName => $paths) {
    $namespaces[trim($nsName, '\\')] = reset($paths) . DIRECTORY_SEPARATOR . trim($nsName, '\\');
}
$loader->add('Pimple', $nsbase);
$loader->add('Mustache', $nsbase);
$loader->add('Symfony', $nsbase);
$FW = new \Nethgui\Framework();
$FW->setLogLevel(E_WARNING | E_ERROR | E_NOTICE)->setSiteUrl('http://localhost:8080');
$FW = NULL;