Example #1
0
 * Main entry script for the framework. 
 */
/**
 * If the request is intended for the API then setup the session handlers
 * since the API caller may not have session cookies stored.
 */
if (isset($_REQUEST["__api_session_id"])) {
    session_id($_REQUEST["__api_session_id"]);
    unset($_REQUEST["__api_session_id"]);
    unset($_POST["__api_session_id"]);
    unset($_GET["__api_session_id"]);
}
require "cfx_bootstrap.php";
$authExcludedPaths = array();
$t = new TemplateEngine();
Application::$templateEngine = $t;
if (defined('AUTH_PACKAGE')) {
    $authPackage = AUTH_PACKAGE;
} else {
    $authPackage = 'system';
}
$authExcludedPaths[] = "{$authPackage}/login";
// Authentication ... check if someone is already logged in if not force
// a login
if ($_SESSION["logged_in"] == false && array_search($_GET["q"], $authExcludedPaths) === false && substr($_GET["q"], 0, 10) != "system/api") {
    $redirect = urlencode(Application::getLink("/{$_GET["q"]}"));
    foreach ($_GET as $key => $value) {
        if ($key == "q") {
            continue;
        }
        $redirect .= urlencode("{$key}={$value}");
Example #2
0
<?php

require "app/config.php";
define("SOFTWARE_HOME", $config['home']);
require "coreutils.php";
// Setup the database driver and other boilerplate stuff
$dbDriver = $config['db'][$selected]['driver'];
$dbDriverClass = Application::camelize($dbDriver);
add_include_path("lib/models/datastores/databases/{$dbDriver}");
Db::$defaultDatabase = $selected;
SQLDBDataStore::$activeDriver = $dbDriver;
SQLDBDataStore::$activeDriverClass = $dbDriverClass;
Cache::init($config['cache']['method']);
define('CACHE_MODELS', $config['cache']['models']);
define('CACHE_PREFIX', "");
define('ENABLE_AUDIT_TRAILS', $config['audit_trails']);
Application::$config = $config;
Application::$prefix = $config['prefix'];
Application::$templateEngine = new TemplateEngine();
if (Application::$config['custom_sessions']) {
    $handler = Sessions::getHandler();
    session_set_save_handler(array($handler, 'open'), array($handler, 'close'), array($handler, 'read'), array($handler, 'write'), array($handler, 'destroy'), array($handler, 'gc'));
    register_shutdown_function('session_write_close');
}
Application::setSiteName(Application::$config['name']);
//ntentan\logger\Logger::init('app/logs/application.log');
// Add the script which contains the third party libraries
require "app/includes.php";
require SOFTWARE_HOME . "app/bootstrap.php";