Example #1
0
    $cookie_name = 'pun_cookie';
}
// Load the cache module
require PUN_ROOT . 'modules/cache/src/Cache.php';
$cache = Flux_Cache::load($flux_config['cache']['type'], array('dir' => $flux_config['cache']['dir']), 'VarExport');
// TODO: Move this config into config.php
// Define a few commonly used constants
define('PUN_UNVERIFIED', 0);
define('PUN_ADMIN', 1);
define('PUN_MOD', 2);
define('PUN_GUEST', 3);
define('PUN_MEMBER', 4);
// Load the DB module
require PUN_ROOT . 'modules/database/src/Database/Adapter.php';
$db_options = array_merge($flux_config['db'], array('debug' => defined('PUN_DEBUG')));
$db = Flux_Database_Adapter::factory($flux_config['db']['type'], $db_options);
// Start a transaction
$db->startTransaction();
// Load cached config
$pun_config = $cache->get('config');
if ($pun_config === Flux_Cache::NOT_FOUND) {
    $pun_config = array();
    // Get the forum config from the DB
    $query = $db->select(array('conf_name' => 'c.conf_name', 'conf_value' => 'c.conf_value'), 'config AS c');
    $params = array();
    $result = $query->run($params);
    foreach ($result as $cur_config_item) {
        $pun_config[$cur_config_item['conf_name']] = $cur_config_item['conf_value'];
    }
    unset($query, $params, $result);
    $cache->set('config', $pun_config);
Example #2
0
</div>

</div>
<div class="end-box"><div><!-- Bottom Corners --></div></div>
</div>

</body>
</html>
<?php 
} else {
    if (!Flux_Database_Adapter::driverExists($db_type)) {
        error($lang->t('DB type not valid', pun_htmlspecialchars($db_type)));
    }
    // Create the database object (and connect/select db)
    $options = array('host' => $db_host, 'dbname' => $db_name, 'username' => $db_username, 'password' => $db_password, 'prefix' => $db_prefix);
    $db = Flux_Database_Adapter::factory($db_type, $options);
    // Validate prefix
    if (strlen($db_prefix) > 0 && (!preg_match('%^[a-zA-Z_][a-zA-Z0-9_]*$%', $db_prefix) || strlen($db_prefix) > 40)) {
        error($lang->t('Table prefix error', $db->prefix));
    }
    // Do some DB type specific checks
    switch ($db_type) {
        // TODO: fix the version checks
        //		case 'mysql':
        //		case 'mysqli':
        //		case 'mysql_innodb':
        //		case 'mysqli_innodb':
        //			$mysql_info = $db->getVersion();
        //			if (version_compare($mysql_info['version'], MIN_MYSQL_VERSION, '<'))
        //				error($lang->t('You are running error', 'MySQL', $mysql_info['version'], FORUM_VERSION, MIN_MYSQL_VERSION));
        //			break;