Example #1
0
/* Auto loader */
function __autoload($class_name)
{
    if (file_exists(dirname(dirname(__FILE__)) . '/class/' . $class_name . '.class.php')) {
        require_once dirname(dirname(__FILE__)) . '/class/' . $class_name . '.class.php';
    }
}
/* Project environment */
define('DEV_ENV', $_SERVER['SERVER_ADDR'] == '127.0.0.1' ? true : false);
/* Root definition */
define('ROOT', dirname(dirname(dirname(__FILE__))));
/* If development define the include root for html elements such as css files */
if (DEV_ENV) {
    $root_array = explode(DIRECTORY_SEPARATOR, ROOT);
    define('INC_ROOT', $root_array[count($root_array) - 1]);
}
Useful::setReporting(true);
if (DBUSER !== '') {
    require ROOT . "/lib/class/rb.php";
    R::setup(sprintf("%s:host=%s;dbname=%s", DBTYPE, DBHOST, DBNAME), DBUSER, DBPASS);
    /* If there is no bites table make it and add the bites plugin */
    R::exec("show tables like 'bites'");
    if (!R::$adapter->getAffectedRows()) {
        $item = R::dispense("bites");
        $item->name = 'bites';
        $item->desc = 'Bites are plugins for Nibble, “Bites” is the default module for Nibble that provides a means of enabling other Bites.';
        $item->status = '1';
        $item->type = '2';
        $id = R::store($item);
    }
}