示例#1
0
    } else {
        $module_config[$row['module']][$row['config_name']] = $row['config_value'];
    }
}
if (!isset($global_config['upload_checking_mode']) or !in_array($global_config['upload_checking_mode'], array("mild", "lite", "none"))) {
    $global_config['upload_checking_mode'] = "strong";
}
define('UPLOAD_CHECKING_MODE', $global_config['upload_checking_mode']);
//Cap nhat Country moi
if (!empty($newCountry)) {
    if ($db->sql_query("INSERT INTO `" . $db_config['prefix'] . "_ipcountry` VALUES (" . $newCountry['ip_from'] . ", " . $newCountry['ip_to'] . ", '" . $newCountry['code'] . "', '" . $newCountry['ip_file'] . "', " . NV_CURRENTTIME . ")")) {
        $time_del = NV_CURRENTTIME - 604800;
        $db->sql_query("DELETE FROM `" . $db_config['prefix'] . "_ipcountry` WHERE `ip_file`='" . $newCountry['ip_file'] . "' AND `country`='ZZ' AND `time` < " . $time_del);
        $result = $db->sql_query("SELECT `ip_from`, `ip_to`, `country` FROM `" . $db_config['prefix'] . "_ipcountry` WHERE `ip_file`='" . $newCountry['ip_file'] . "'");
        $array_ip_file = array();
        while ($row = $db->sql_fetch_assoc($result)) {
            $array_ip_file[] = $row['ip_from'] . " => array(" . $row['ip_to'] . ", '" . $row['country'] . "')";
        }
        file_put_contents(NV_ROOTDIR . "/" . NV_DATADIR . "/ip_files/" . $newCountry['ip_file'] . ".php", "<?php\n\n\$ranges = array(" . implode(', ', $array_ip_file) . ");\n\n?>", LOCK_EX);
    }
    unset($newCountry, $time_del, $array_ip_file, $result, $row);
}
if ($global_config['is_url_rewrite']) {
    $check_rewrite_file = nv_check_rewrite_file();
    if ($check_rewrite_file) {
        require NV_ROOTDIR . "/includes/rewrite.php";
    } else {
        require NV_ROOTDIR . "/includes/rewrite_index.php";
    }
    if (preg_match("/^" . nv_preg_quote(NV_BASE_SITEURL . "index.php?") . "/i", $_SERVER['REQUEST_URI'])) {
        $url_rewrite = nv_url_rewrite($_SERVER['REQUEST_URI'], true);
示例#2
0
 $db_config['num_table'] = 0;
 $db_config['create_db'] = 1;
 if (!empty($db_config['dbhost']) and !empty($db_config['dbname']) and !empty($db_config['dbuname']) and !empty($db_config['prefix'])) {
     $db_config['dbuname'] = preg_replace(array("/[^a-z0-9]/", '/[\\_]+/', "/^[\\_]+/", "/[\\_]+\$/"), array("_", "_", "", ""), strtolower($db_config['dbuname']));
     $db_config['dbname'] = preg_replace(array("/[^a-z0-9]/", '/[\\_]+/', "/^[\\_]+/", "/[\\_]+\$/"), array("_", "_", "", ""), strtolower($db_config['dbname']));
     $db_config['prefix'] = preg_replace(array("/[^a-z0-9]/", '/[\\_]+/', "/^[\\_]+/", "/[\\_]+\$/"), array("_", "_", "", ""), strtolower($db_config['prefix']));
     $db = new sql_db($db_config);
     if (!empty($db->error)) {
         $db_config['error'] = !empty($db->error['user_message']) ? $db->error['user_message'] : $db->error['message'];
     } else {
         $tables = array();
         $result = $db->sql_query("SHOW TABLE STATUS LIKE '" . $db_config['prefix'] . "\\_%'");
         $num_table = intval($db->sql_numrows($result));
         if ($num_table > 0) {
             if ($db_config['db_detete'] == 1) {
                 while ($item = $db->sql_fetch_assoc($result)) {
                     $db->sql_query("DROP TABLE `" . $item['Name'] . "`");
                 }
                 $num_table = 0;
             } else {
                 $db_config['error'] = $lang_module['db_err_prefix'];
             }
         }
         $db_config['num_table'] = $num_table;
         if ($num_table == 0) {
             nv_save_file_config();
             $db_config['error'] = "";
             $sql_create_table = array();
             //cai dat du lieu cho he thong
             require_once NV_ROOTDIR . "/install/data.php";
             foreach ($sql_create_table as $query) {