Exemplo n.º 1
0
    error_reporting(0);
}
// Set the default timezone
if (isset($settings['default_timezone']) and is_valid_timezone($settings['default_timezone'])) {
    date_default_timezone_set($settings['default_timezone']);
}
// Set the system environment
if (isset($settings['environment'])) {
    define('G_APP_ENV', $settings['environment']);
}
// Set the HTTP definitions
define('G_HTTP_HOST', $_SERVER['HTTP_HOST']);
define('G_HTTP_PROTOCOL', (!empty($_SERVER['HTTPS']) and strtolower($_SERVER['HTTPS']) == 'on' or $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') ? 'https' : 'http');
// Fix some $_SERVER vars
$_SERVER['SCRIPT_FILENAME'] = forward_slash($_SERVER['SCRIPT_FILENAME']);
$_SERVER['SCRIPT_NAME'] = forward_slash($_SERVER['SCRIPT_NAME']);
// Inherit application definitions
if (file_exists(G_APP_PATH . 'app.php')) {
    require_once G_APP_PATH . 'app.php';
}
// Set the DB constants
foreach (['host', 'port', 'name', 'user', 'pass', 'driver'] as $k) {
    if ($settings['db_' . $k]) {
        define('G_APP_DB_' . strtoupper($k), $settings['db_' . $k]);
    }
}
// Include app functions
file_exists(G_APP_FILE_FUNCTIONS) ? require_once G_APP_FILE_FUNCTIONS : die("G\\: Can't find <strong>" . G_APP_FILE_FUNCTIONS . '</strong>. Make sure that this file exists.');
if (file_exists(G_APP_FILE_FUNCTIONS_RENDER)) {
    require_once G_APP_FILE_FUNCTIONS_RENDER;
}
Exemplo n.º 2
0
 function absolute_to_url($filepath, $root_url = NULL)
 {
     if (!check_value($root_url)) {
         $root_url = G_ROOT_URL;
     }
     if (G_ROOT_PATH === G_ROOT_PATH_RELATIVE) {
         return $root_url . ltrim($filepath, '/');
     }
     return str_replace(G_ROOT_PATH, $root_url, forward_slash($filepath));
 }