Example #1
0
define('CONFIG_DIR', APP_DIR . 'config/');
// directory where libraries are located
define('LIBRARIES_DIR', APP_DIR . 'libraries/');
// directory for logs
define('LOGS_DIR', APP_DIR . 'logs/');
// output errors to brower
ini_set('display_errors', true);
// level of errors to log/display
ini_set('error_reporting', E_ALL);
// log errors
ini_set('log_errors', true);
// file for error logging
ini_set('error_log', LOGS_DIR . 'error_log');
require_once LIBRARIES_DIR . 'dabl/ClassLoader.php';
require_once LIBRARIES_DIR . 'dabl/print_r2.php';
// Strip added slashes if needed
if (get_magic_quotes_gpc()) {
    require_once LIBRARIES_DIR . 'dabl/strip_request_slashes.php';
    strip_request_slashes();
}
ClassLoader::addRepository('LIBRARIES', LIBRARIES_DIR);
ClassLoader::import('LIBRARIES:dabl');
if (is_file(APP_DIR . 'vendor/autoload.php')) {
    require_once APP_DIR . 'vendor/autoload.php';
}
// load all config files
$config_files = glob(CONFIG_DIR . '*.php');
sort($config_files);
foreach ($config_files as $filename) {
    require_once $filename;
}
Example #2
0
<?php

ClassLoader::addRepository('DATABASE', LIBRARIES_DIR . 'dabl/database');
ClassLoader::import('DATABASE');
ClassLoader::import('DATABASE:query');
ClassLoader::import('DATABASE:adapter');
if (!class_exists('PDO')) {
    ClassLoader::import('DATABASE:PDO');
}
$db_connections = parse_ini_file(CONFIG_DIR . 'connections.ini', true);
// connect to database(s)
foreach ($db_connections as $connection_name => $db_params) {
    DBManager::addConnection($connection_name, $db_params);
}
// timestamp to use for Created and Updated column values
define('CURRENT_TIMESTAMP', time());
define('MODELS_DIR', APP_DIR . 'models/');
define('MODELS_BASE_DIR', MODELS_DIR . 'base/');
define('MODELS_QUERY_DIR', MODELS_DIR . 'query/');
define('MODELS_BASE_QUERY_DIR', MODELS_DIR . 'query/base/');
ClassLoader::addRepository('MODELS', MODELS_DIR);
ClassLoader::import('MODELS');
ClassLoader::import('MODELS:base');
ClassLoader::addRepository('MODEL_QUERIES', MODELS_QUERY_DIR);
ClassLoader::import('MODEL_QUERIES');
ClassLoader::import('MODEL_QUERIES:base');
Example #3
0
    $params = session_get_cookie_params();
    setcookie(session_name(), '', time() - 42000, $params['path'], $params['domain'], $params['secure'], $params['httponly']);
    if (!headers_sent()) {
        redirect('/');
    }
    throw new RuntimeException('Session ID was invalid and couldn\'t recover');
}
$result = @session_start();
if (!$result) {
    if (!headers_sent()) {
        redirect('/');
    }
    throw new RuntimeException('Session ID was invalid and couldn\'t recover');
}
// the browser path to this application.  it should be:
// a full url with http:// and a trailing slash OR
// a subdirectory with leading and trailing slashes
define('BASE_URL', '/');
// directory for public html files that are directly exposed to the web server
define('PUBLIC_DIR', APP_DIR . 'public/');
// default controller
define('DEFAULT_CONTROLLER', 'index');
// controllers directory
define('CONTROLLERS_DIR', APP_DIR . 'controllers/');
ClassLoader::addRepository('CONTROLLERS', CONTROLLERS_DIR);
// views directory
define('VIEWS_DIR', APP_DIR . 'views/');
// default timestamp format for views
define('VIEW_TIMESTAMP_FORMAT', 'n/j/Y g:i a');
// default date format for views
define('VIEW_DATE_FORMAT', 'n/j/Y');