Пример #1
0
function getHttpRoot()
{
    $app = Application::getInstance();
    $protocol = getProtocol();
    $host = $app->getHost();
    $base = $app->getBase();
    return $protocol . $host . $base . "/";
}
Пример #2
0
<?php

use Carbon\Application\Application;
/**
 * In this configuration file you can put database related configurations which
 * are passed to the application.
 *
 * @author  Joeri Hermans
 * @version 16 February 2016
 */
// BEGIN Configuration. ////////////////////////////////////////////////////////
$conf['db_host'] = "localhost";
$conf['db_user'] = "";
$conf['db_password'] = "";
$conf['db_schema'] = "";
$conf['db_driver'] = "";
// END Configuration. //////////////////////////////////////////////////////////
// DO NOT MODIFY BELOW THIS LINE. //////////////////////////////////////////////
$application = Application::getInstance();
$application->addConfiguration($conf);
unset($conf);
Пример #3
0
/**
 * A bootstrap which is responsible for loading all required files and classes
 * in order to setup the application.
 *
 * @author  Joeri Hermans
 * @since   16 February 2016
 */
// Load required functions and scripts.
require_once "core/inc.functions.php";
// Register the class autoloader function.
spl_autoload_register('loadClass');
use Carbon\Application\Application;
// Allocate the desired application.
// TODO Write your own application class (see Application or DatabaseApplication).
$app = null;
Application::setInstance($app);
parseConfiguration("Database");
parseConfiguration("Main");
use Carbon\Router\Router;
// Allocate a router, and add initial basic pages.
$router = new Router();
$app->setRouter($router);
$router->setBase($app->getConfiguration("base"));
$router->registerPage(\Carbon\Page\PageNotFound::PATH, "\\Carbon\\Page\\PageNotFound");
// Register the application pages.
registerPages($router);
// Route the user to the desired page.
$router->route();
$view = $router->getView();
$view->draw();