Beispiel #1
0
use Buan\AutoLoader;
use Buan\Config;
use Buan\Database;
use Buan\ModelRelation;
/*
# Config variables
*/
Config::set('app.command.urlPrefix', 'do');
Config::set('app.command.parameter', 'do');
Config::set('app.command.default', '');
Config::set('app.dir.controllers', dirname(dirname(__FILE__)) . '/controllers');
Config::set('app.dir.ignored', array('.', '..', '.svn', 'cvs'));
Config::set('app.docRoot', dirname(dirname(__FILE__)));
Config::set('app.domain', 'localhost');
Config::set('app.password', 'password');
Config::set('app.dir.databases', dirname(dirname(__FILE__)) . '/db');
AutoLoader::addClassPath(dirname(dirname(__FILE__)) . '/models');
AutoLoader::addClassPath(dirname(dirname(__FILE__)) . '/models/managers');
/*
# Database
*/
Database::addConnection(array('name' => 'default', 'driver' => 'sqlite', 'dsn' => 'sqlite:' . Config::get('app.dir.databases') . '/model.s3db'));
/* Alternative for testing whilst building test on dev machine
Database::addConnection(array(
	'name'=>'default',
	'driver'=>'mysql',
	'dsn'=>'mysql:host=localhost;dbname=buan_test',
	'username'=>'root',
	'password'=>''
));*/
/*
Beispiel #2
0
#	- Prepare global functions and variables
#
# It does NOT operate on any passed parameters (in particular, $_REQUEST['do'])
# - this is left to the application in order to provide as much freedom from the
# core as possible. The core is only here to provide the code framework, not
# overly-enforce routines on the programmer.
*/
/*
# Set some global configuration values.
# Try to work out the url on which the app is running.
*/
use Buan\Config;
/*
# Enable output buffering (if it's not too late!)
*/
$ini_ob = (int) ini_get('output_buffering');
if ($ini_ob <= 0) {
    ob_start();
}
/*
# Setup the class auto-loader and other common classes
*/
$cwd = str_replace("\\", "/", dirname(__FILE__));
$dr = isset($_SERVER['DOCUMENT_ROOT']) && !empty($_SERVER['DOCUMENT_ROOT']) ? str_replace("\\", "/", $_SERVER['DOCUMENT_ROOT']) : dirname($cwd);
$cwu = strpos(dirname($cwd), $dr) !== false ? str_replace($dr, '', dirname($cwd)) : '';
Config::set('timeStarted', microtime(true));
Config::set('core', ['customUrlRoutes' => [], 'dir' => ['controllers' => $cwd . '/controllers', 'resources' => $cwd . '/buan-pub', 'views' => $cwd . '/views'], 'docRoot' => $cwd, 'url' => ['resources' => "{$cwu}/buan/buan-pub"], 'version' => ['major' => 1, 'minor' => 1, 'revision' => 3]]);
/*
# Clean up
*/
unset($cwd, $dr, $cwu);
Beispiel #3
0
# the "app.password" setting.
#
# MOD_REWRITE:
# If you do not have mod_rewrite available on your apache installation then set
# the [app.command.urlPrefix] config variable to "/index.php"
*/
$__pwd = dirname(dirname(__FILE__));
Config::set('app.command.default', '/core');
Config::set('app.command.parameter', 'do');
Config::set('app.command.urlPrefix', '');
Config::set('app.dir.controllers', "{$__pwd}/app/controllers");
Config::set('app.dir.ignored', array('.', '..', '.svn', 'cvs'));
Config::set('app.docRoot', "{$__pwd}");
Config::set('app.domain', isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : 'localhost');
Config::set('app.password', 'admin');
Config::set('app.urlRoot', '');
/*
# Model and ModelManager class paths
# If you use Models and ModelManagers then add their locations to the global
# class path.
*/
AutoLoader::addClassPath("{$__pwd}/models");
AutoLoader::addClassPath("{$__pwd}/models/managers");
/*
# Database connections.
# You may add any number of database connections using Database::addConnection().
# If you are going to use databases at all, you MUST define one named "default".
#
# See documentation for "Database::addConnection()".
*/
/*