Example #1
0
 public function testConnectFailDatabase()
 {
     if (DB_TYPE == 'sqlite') {
         $this->markTestSkipped();
     }
     try {
         $db = new fDatabase(DB_TYPE, 'baddb', DB_USERNAME, DB_PASSWORD, DB_HOST, DB_PORT, 2);
         $db->connect();
     } catch (fNotFoundException $e) {
         $this->assertEquals('Unable to connect to database - database specified not found', $e->getMessage());
     }
     $db->__destruct();
 }
Example #2
0
    include_once TATTLE_ROOT . "/inc/config.override.php";
}
//Load in plugin files
$GLOBALS['hooks'] = array();
foreach (glob("plugins/*_plugin.php") as $plugin) {
    include_once $plugin;
}
// Check to make sure the session folder exists
$config_error = '';
$config_exit = false;
try {
    //Set DB connection (using flourish it isn't actually connected to until the first use)
    $mysql_db = new fDatabase('mysql', $GLOBALS['DATABASE_NAME'], $GLOBALS['DATABASE_USER'], $GLOBALS['DATABASE_PASS'], $GLOBALS['DATABASE_HOST']);
    // Please note that calling this method is not required, and simply
    // causes an exception to be thrown if the connection can not be made
    $mysql_db->connect();
} catch (fAuthorizationException $e) {
    $config_error = "DB error : " . $e->getMessage();
    $config_exit = true;
}
//Connect the db to the ORM functions
fORMDatabase::attach($mysql_db);
$default_plugin_settings = plugin_hook('plugin_settings');
$default_plugin_user_settings = plugin_hook('plugin_user_settings');
$send_methods = plugin_hook('send_methods');
$current_plugin_settings = Setting::findAll(array('type=' => 'system'));
$plugin_settings = $default_plugin_settings;
$plugin_user_settings = $default_plugin_user_settings;
foreach ($current_plugin_settings as $setting) {
    $plugin_settings[$setting->getName()]['value'] = $setting->getValue();
}
Example #3
0
    include_once TATTLE_ROOT . "/inc/config.override.php";
}
//Load in plugin files
$GLOBALS['hooks'] = array();
foreach (glob("plugins/*_plugin.php") as $plugin) {
    include_once $plugin;
}
// Check to make sure the session folder exists
$config_error = '';
$config_exit = false;
if ($GLOBALS['DATABASE_TYPE'] == 'mysql') {
    try {
        $db = new fDatabase('mysql', $GLOBALS['DATABASE_NAME'], $GLOBALS['DATABASE_USER'], $GLOBALS['DATABASE_PASS'], $GLOBALS['DATABASE_HOST'], $GLOBALS['DATABASE_PORT']);
        // Please note that calling this method is not required, and simply
        // causes an exception to be thrown if the connection can not be made
        $db->connect();
    } catch (fAuthorizationException $e) {
        $config_error = "DB error : " . $e->getMessage();
        $config_exit = true;
    } catch (fConnectivityException $e) {
        $config_error = "DB error : " . $e->getMessage();
        $config_exit = true;
    }
} else {
    $config_error = "Unsupported database type : " . $GLOBALS['DATABASE_TYPE'];
    $config_exit = true;
}
if (!$config_exit) {
    //Connect the db to the ORM functions
    fORMDatabase::attach($db);
    $default_plugin_settings = plugin_hook('plugin_settings');