示例#1
0
unset($tuffyScriptDepth, $tuffyAppPath, $tuffyAppPrefix);
/**
 * The path to Tuffy's module files.
 */
define('TUFFY_PATH', rtrim(dirname(__FILE__), '/\\') . '/');
// 3. Load the debugging tools.
require_once TUFFY_PATH . 'Debug.php';
Tuffy_Debug::registerHandlers();
// 4. Set up the autoloader.
require_once TUFFY_PATH . 'Loader.php';
$tuffyCoreLoader = new Tuffy_Loader_ForTuffy('Tuffy', TUFFY_PATH, array('Tuffy' => TUFFY_PATH . 'Tuffy.php'));
$tuffyCoreLoader->register();
// 5. Load and normalize settings.
$tuffySettingsFile = Tuffy_Util::interpretPath(defined('TUFFY_SETTINGS_FILE') ? TUFFY_SETTINGS_FILE : '_data/settings.php');
if (is_file($tuffySettingsFile)) {
    $tuffyFileSettings = Tuffy_Util::loadVariables($tuffySettingsFile);
    Tuffy::configure($tuffyFileSettings);
    unset($tuffyFileSettings);
}
unset($tuffySettingsFile);
if (isset($GLOBALS['tuffySettings']) && is_array($GLOBALS['tuffySettings'])) {
    Tuffy::configure($GLOBALS['tuffySettings']);
}
if (!Tuffy::setting('appName')) {
    die("You must define the appName setting.");
}
// 6. Configure the environment.
$tuffyTimezone = Tuffy::setting('timezone');
if ($tuffyTimezone !== NULL) {
    date_default_timezone_set(Tuffy::setting('timezone'));
}