if ($version > '4.1' && $charset) { $db->query($set_names); } if ($version > '5.0') { $db->query($set_modes); } $sqls = file_get_contents($schema_common_path . "mysql.sql"); $r = sql_run($sqls); if (!$r) { Errors::showError(mysql_error(), 'db'); exit; } $must_sql_data = file_get_contents($schema_path . "mysql.data.sql"); $r = sql_run($must_sql_data); if (!$r) { Errors::showError(mysql_error(), 'db'); exit; } $structure_sql_data1 = file_get_contents($schema_common_path . "mysql.data.area.sql"); $r = sql_run($structure_sql_data1); $structure_sql_data2 = file_get_contents($schema_common_path . "mysql.data.industry.sql"); $r = sql_run($structure_sql_data2); @touch(PHPB2B_ROOT . './data/install.lock'); if (!empty($testdata)) { $source = "data/attachment/sample"; $dest = "../attachment/sample"; $sqls = file_get_contents($schema_path . "mysql.sample.sql"); sql_run($sqls); dir_copy($source, $dest, 1); } else { //basic datas
$smarty = new TemplateEngines(); $includes = array(CLASS_PATH . 'logger.class.php', CLASS_PATH . 'plugin.class.php', LIB_PATH . 'core/object.php', LIB_PATH . 'core/model.php', LIB_PATH . 'core/controller.php', LIB_PATH . 'core/view.php'); foreach ($includes as $inc) { require $inc; } $log = new Logger(); $plugin = new PluginManager(); $connected = $pdb->Connect($dbhost, $dbuser, $dbpasswd, $dbname); if (!$connected or empty($connected)) { $msg = L("db_conn_error", 'msg', $pdb->ErrorMsg()); $msg .= "<br />" . L("db_conn_error_no", 'msg', $pdb->ErrorNo()); if (!file_exists(DATA_PATH . "install.lock")) { $msg .= "<br /><a href='" . URL . "install/install.php'>" . L("please_reinstall_program", "msg") . "</a>"; } require CLASS_PATH . "error.class.php"; Errors::showError($msg, 'db'); exit; } if ($dbcharset) { $pdb->Execute("SET NAMES '{$dbcharset}'"); } //caches check if (!file_exists(CACHE_COMMON_PATH . "cache_setting.php")) { require LIB_PATH . "cache.class.php"; $cache = new Caches(); if ($cache->cacheAll()) { $msg .= "<a href='" . pb_getenv('REQUEST_URI') . "'>Cached successfully, please refresh.</a>"; header_sent($msg); exit; } }