Example #1
0
             cot_error('install_error_config');
         }
     }
     break;
 case 2:
     // Database setup
     $db_x = cot_import('db_x', 'P', 'TXT', 0, false, true);
     try {
         $dbc_port = empty($db_port) ? '' : ';port=' . $db_port;
         $db = new CotDB('mysql:host=' . $db_host . $dbc_port . ';dbname=' . $db_name, $db_user, $db_pass);
     } catch (PDOException $e) {
         if ($e->getCode() == 1049 || mb_strpos($e->getMessage(), '[1049]') !== false) {
             // Attempt to create a new database
             try {
                 $db = new CotDB('mysql:host=' . $db_host . $dbc_port, $db_user, $db_pass);
                 $db->query("CREATE DATABASE `{$db_name}`");
                 $db->query("USE `{$db_name}`");
             } catch (PDOException $e) {
                 cot_error('install_error_sql_db', 'db_name');
             }
         } else {
             cot_error('install_error_sql', 'db_host');
         }
     }
     if (!cot_error_found() && function_exists('version_compare') && !version_compare($db->getAttribute(PDO::ATTR_SERVER_VERSION), '5.0.7', '>=')) {
         cot_error(cot_rc('install_error_sql_ver', array('ver' => $db->getAttribute(PDO::ATTR_SERVER_VERSION))));
     }
     if (!cot_error_found()) {
         $config_contents = file_get_contents($file['config']);
         cot_install_config_replace($config_contents, 'mysqlhost', $db_host);
         if (!empty($db_port)) {
Example #2
0
        if (empty($lang)) {
            $lang = cot_lang_determine();
        }
    } else {
        $lang = $_SESSION['cot_inst_lang'];
    }
    require_once cot_langfile('main', 'core');
    require_once $cfg['system_dir'] . '/resources.rc.php';
} else {
    $branch = 'siena';
    $prev_branch = 'genoa';
    require_once $cfg['system_dir'] . '/database.php';
    $dbc_port = empty($cfg['mysqlport']) ? '' : ';port=' . $cfg['mysqlport'];
    $db = new CotDB('mysql:host=' . $cfg['mysqlhost'] . $dbc_port . ';dbname=' . $cfg['mysqldb'], $cfg['mysqluser'], $cfg['mysqlpassword']);
    cot::init();
    $sql_install = @$db->query("SHOW TABLES LIKE '{$db_updates}'");
    if ($sql_install->rowCount() != 1) {
        define('COT_UPGRADE', true);
        $cfg['defaulttheme'] = 'nemesis';
        $cfg['defaultscheme'] = 'default';
    }
    require_once $cfg['system_dir'] . '/common.php';
}
require_once cot_incfile('forms');
require_once cot_incfile('extensions');
require_once cot_langfile('install', 'module');
require_once cot_langfile('users', 'core');
require_once cot_langfile('admin', 'core');
require_once cot_incfile('install', 'module', 'resources');
// Various Generic Vars needed to operate as Normal
$theme = $cfg['defaulttheme'];
Example #3
0
    $db = new CotDB('mysql:host=' . $cfg['mysqlhost'] . $dbc_port . ';dbname=' . $cfg['mysqldb'], $cfg['mysqluser'], $cfg['mysqlpassword']);
} catch (PDOException $e) {
    cot_diefatal('Could not connect to database !<br />
		Please check your settings in the file datas/config.php<br />
		MySQL error : ' . $e->getMessage());
}
unset($cfg['mysqlhost'], $cfg['mysqluser'], $cfg['mysqlpassword'], $dbc_port);
// Here we can init our globals facade
cot::init();
$cache && $cache->init();
/* ======== Configuration settings ======== */
if ($cache && $cot_cfg) {
    $cfg = array_merge($cot_cfg, $cfg);
} else {
    // Part 1: Load main configuration
    $sql_config = $db->query("SELECT * FROM {$db_config}");
    while ($row = $sql_config->fetch()) {
        if ($row['config_owner'] == 'core') {
            $cfg[$row['config_name']] = $row['config_value'];
        } elseif ($row['config_owner'] == 'module') {
            if (empty($row['config_subcat'])) {
                $cfg[$row['config_cat']][$row['config_name']] = $row['config_value'];
            } else {
                $cfg[$row['config_cat']]['cat_' . $row['config_subcat']][$row['config_name']] = $row['config_value'];
            }
        } else {
            $cfg['plugin'][$row['config_cat']][$row['config_name']] = $row['config_value'];
        }
    }
    $sql_config->closeCursor();
}