/** * get_allow_exts() * * @return */ function get_allow_exts() { global $global_config; $all_file_ext = nv_parse_ini_file(NV_ROOTDIR . '/includes/ini/mime.ini', true); $file_allowed_ext = (array) $global_config['file_allowed_ext']; $exts = array(); if (!empty($file_allowed_ext)) { foreach ($file_allowed_ext as $type) { if (!empty($type) and isset($all_file_ext[$type])) { foreach ($all_file_ext[$type] as $e => $m) { if (!in_array($e, $global_config['forbid_extensions']) and !in_array($m, $global_config['forbid_mimes'])) { $exts[$e] = is_array($m) ? implode(', ', $m) : $m; } } } } } return $exts; }
$allowed_html_tags = '<' . implode('><', $allowed_html_tags) . '>'; define('NV_ALLOWED_HTML_LANG', $allowed_html_tags); define('NV_IS_FILE_LANG', true); $dirlang = $nv_Request->get_title('dirlang', 'get', ''); /** * nv_admin_add_field_lang() * * @param mixed $dirlang * @return */ function nv_admin_add_field_lang($dirlang) { global $module_name, $db_config, $db, $language_array; if (isset($language_array[$dirlang]) and !empty($language_array[$dirlang])) { $add_field = true; $columns_array = $db->columns_array(NV_LANGUAGE_GLOBALTABLE . '_file'); foreach ($columns_array as $row) { if ($row['field'] == 'author_' . $dirlang) { $add_field = false; break; } } if ($add_field == true) { $db->columns_add(NV_LANGUAGE_GLOBALTABLE, 'lang_' . $dirlang, 'string', 4000, true); $db->columns_add(NV_LANGUAGE_GLOBALTABLE, 'update_' . $dirlang, 'integer', 2147483647, true, 0); $db->columns_add(NV_LANGUAGE_GLOBALTABLE . '_file', 'author_' . $dirlang, 'string', 4000, true); } } } $language_array = nv_parse_ini_file(NV_ROOTDIR . '/includes/ini/langs.ini', true);
<?php /** * @Project NUKEVIET 4.x * @Author VINADES.,JSC (contact@vinades.vn) * @Copyright (C) 2014 VINADES.,JSC. All rights reserved * @License GNU/GPL version 2 or any later version * @Createdate 2-9-2010 14:43 */ if (!defined('NV_ADMIN') or !defined('NV_MAINFILE') or !defined('NV_IS_MODADMIN')) { die('Stop!!!'); } $ini = nv_parse_ini_file(NV_ROOTDIR . '/includes/ini/mime.ini', true); $myini = array('types' => array(''), 'exts' => array(''), 'mimes' => array('')); foreach ($ini as $type => $extmime) { $myini['types'][] = $type; $myini['exts'] = array_merge($myini['exts'], array_keys($extmime)); $m = array_values($extmime); if (is_string($m)) { $myini['mimes'] = array_merge($myini['mimes'], $m); } else { foreach ($m as $m2) { if (!is_array($m2)) { $m2 = array($m2); } $myini['mimes'] = array_merge($myini['mimes'], $m2); } } } sort($myini['types']); unset($myini['types'][0]);
/** * nv_save_file_config_global() * * @return */ function nv_save_file_config_global() { global $db, $sys_info, $global_config, $db_config; if ($global_config['idsite']) { return false; } $content_config = "<?php" . "\n\n"; $content_config .= NV_FILEHEAD . "\n\n"; $content_config .= "if ( ! defined( 'NV_MAINFILE' ) ) die( 'Stop!!!' );\n\n"; //disable_classes $sys_info['disable_classes'] = (($disable_classes = ini_get('disable_classes')) != '' and $disable_classes != false) ? array_map('trim', preg_split("/[\\s,]+/", $disable_classes)) : array(); if (!empty($sys_info['disable_classes'])) { $disable_classes = "'" . implode("','", $sys_info['disable_classes']) . "'"; } else { $disable_classes = ''; } $content_config .= "\$sys_info['disable_classes']=array(" . $disable_classes . ");\n"; //disable_functions $sys_info['disable_functions'] = (($disable_functions = ini_get('disable_functions')) != '' and $disable_functions != false) ? array_map('trim', preg_split("/[\\s,]+/", $disable_functions)) : array(); if (extension_loaded('suhosin')) { $sys_info['disable_functions'] = array_merge($sys_info['disable_functions'], array_map('trim', preg_split("/[\\s,]+/", ini_get('suhosin.executor.func.blacklist')))); } if (!empty($sys_info['disable_functions'])) { $disable_functions = "'" . implode("','", $sys_info['disable_functions']) . "'"; } else { $disable_functions = ''; } $content_config .= "\$sys_info['disable_functions']=array(" . $disable_functions . ");\n"; //ini_set_support $sys_info['ini_set_support'] = (function_exists('ini_set') and !in_array('ini_set', $sys_info['disable_functions'])) ? true : false; $ini_set_support = $sys_info['ini_set_support'] ? 'true' : 'false'; $content_config .= "\$sys_info['ini_set_support']= " . $ini_set_support . ";\n"; //Kiem tra ho tro rewrite if (function_exists('apache_get_modules')) { $apache_modules = apache_get_modules(); if (in_array('mod_rewrite', $apache_modules)) { $sys_info['supports_rewrite'] = 'rewrite_mode_apache'; } else { $sys_info['supports_rewrite'] = false; } } elseif (strpos($_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS/7.') !== false) { if (isset($_SERVER['IIS_UrlRewriteModule']) and class_exists('DOMDocument')) { $sys_info['supports_rewrite'] = 'rewrite_mode_iis'; } else { $sys_info['supports_rewrite'] = false; } } if ($sys_info['supports_rewrite'] == 'rewrite_mode_iis' or $sys_info['supports_rewrite'] == 'rewrite_mode_apache') { $content_config .= "\$sys_info['supports_rewrite']='" . $sys_info['supports_rewrite'] . "';\n"; } else { $content_config .= "\$sys_info['supports_rewrite']=false;\n"; } $content_config .= "\n"; $config_variable = array(); $allowed_html_tags = ''; $sql = "SELECT module, config_name, config_value FROM " . NV_CONFIG_GLOBALTABLE . " WHERE lang='sys' AND (module='global' OR module='define') ORDER BY config_name ASC"; $result = $db->query($sql); while (list($c_module, $c_config_name, $c_config_value) = $result->fetch(3)) { if ($c_module == 'define') { if (preg_match('/^\\d+$/', $c_config_value)) { $content_config .= "define('" . strtoupper($c_config_name) . "', " . $c_config_value . ");\n"; } else { $content_config .= "define('" . strtoupper($c_config_name) . "', '" . $c_config_value . "');\n"; } if ($c_config_name == 'nv_allowed_html_tags') { $allowed_html_tags = $c_config_value; } } else { $config_variable[$c_config_name] = $c_config_value; } } $nv_eol = strtoupper(substr(PHP_OS, 0, 3) == 'WIN') ? '"\\r\\n"' : (strtoupper(substr(PHP_OS, 0, 3) == 'MAC') ? '"\\r"' : '"\\n"'); $upload_max_filesize = min(nv_converttoBytes(ini_get('upload_max_filesize')), nv_converttoBytes(ini_get('post_max_size')), $config_variable['nv_max_size']); $content_config .= "define('NV_EOL', " . $nv_eol . ");\n"; $content_config .= "define('NV_UPLOAD_MAX_FILESIZE', " . floatval($upload_max_filesize) . ");\n"; if ($config_variable['openid_mode']) { $content_config .= "define('NV_OPENID_ALLOWED', true);\n\n"; } $my_domains = array_map('trim', explode(',', $config_variable['my_domains'])); $my_domains[] = NV_SERVER_NAME; $config_variable['my_domains'] = implode(',', array_unique($my_domains)); $config_variable['check_rewrite_file'] = nv_check_rewrite_file(); $config_variable['allow_request_mods'] = NV_ALLOW_REQUEST_MODS != '' ? NV_ALLOW_REQUEST_MODS : "request"; $config_variable['request_default_mode'] = NV_REQUEST_DEFAULT_MODE != '' ? trim(NV_REQUEST_DEFAULT_MODE) : 'request'; $config_variable['session_save_path'] = NV_SESSION_SAVE_PATH; $config_variable['log_errors_list'] = NV_LOG_ERRORS_LIST; $config_variable['display_errors_list'] = NV_DISPLAY_ERRORS_LIST; $config_variable['send_errors_list'] = NV_SEND_ERRORS_LIST; $config_variable['error_log_path'] = NV_LOGS_DIR . '/error_logs'; $config_variable['error_log_filename'] = NV_ERRORLOGS_FILENAME; $config_variable['error_log_fileext'] = NV_LOGS_EXT; $config_variable['error_send_email'] = $config_variable['error_send_email']; $config_name_array = array('file_allowed_ext', 'forbid_extensions', 'forbid_mimes', 'allow_sitelangs', 'openid_servers', 'allow_request_mods', 'config_sso'); if (empty($config_variable['openid_servers'])) { $config_variable['openid_mode'] = 0; } if ($config_variable['is_user_forum']) { $forum_files = @scandir(NV_ROOTDIR . '/' . DIR_FORUM . '/nukeviet'); if (!empty($forum_files) and in_array('is_user.php', $forum_files) and in_array('changepass.php', $forum_files) and in_array('editinfo.php', $forum_files) and in_array('login.php', $forum_files) and in_array('logout.php', $forum_files) and in_array('lostpass.php', $forum_files) and in_array('register.php', $forum_files)) { $content_config .= "define( 'NV_IS_USER_FORUM', true );\n\n"; } else { $config_variable['is_user_forum'] = 0; } } foreach ($config_variable as $c_config_name => $c_config_value) { if ($c_config_name == 'config_sso') { $config_sso = empty($c_config_value) ? '' : nv_var_export(unserialize($c_config_value)); $content_config .= "\$global_config['" . $c_config_name . "']=" . $config_sso . ";\n"; } elseif (in_array($c_config_name, $config_name_array)) { if (!empty($c_config_value)) { $c_config_value = "'" . implode("','", array_map("trim", explode(',', $c_config_value))) . "'"; } else { $c_config_value = ''; } $content_config .= "\$global_config['" . $c_config_name . "']=array(" . $c_config_value . ");\n"; } else { if (preg_match('/^\\d+$/', $c_config_value) and $c_config_name != 'facebook_client_id') { $content_config .= "\$global_config['" . $c_config_name . "']=" . $c_config_value . ";\n"; } else { $c_config_value = nv_unhtmlspecialchars($c_config_value); if (!preg_match("/^[a-z0-9\\-\\_\\.\\,\\;\\:\\@\\/\\s]+\$/i", $c_config_value) and $c_config_name != 'my_domains') { $c_config_value = nv_htmlspecialchars($c_config_value); } $content_config .= "\$global_config['" . $c_config_name . "']='" . $c_config_value . "';\n"; } } } $content_config .= "\$global_config['array_theme_type']=" . nv_var_export(array_filter(array_map('trim', explode(',', NV_THEME_TYPE)))) . ";\n"; //allowed_html_tags if (!empty($allowed_html_tags)) { $allowed_html_tags = "'" . implode("','", array_map('trim', explode(',', $allowed_html_tags))) . "'"; } else { $allowed_html_tags = ''; } $content_config .= "\$global_config['allowed_html_tags']=array(" . $allowed_html_tags . ");\n"; //Xac dinh cac search_engine $engine_allowed = file_exists(NV_ROOTDIR . '/' . NV_DATADIR . '/search_engine.xml') ? nv_object2array(simplexml_load_file(NV_ROOTDIR . '/' . NV_DATADIR . '/search_engine.xml')) : array(); $content_config .= "\$global_config['engine_allowed']=" . nv_var_export($engine_allowed) . ";\n"; $content_config .= "\n"; $language_array = nv_parse_ini_file(NV_ROOTDIR . '/includes/ini/langs.ini', true); $tmp_array = array(); $lang_array_exit = nv_scandir(NV_ROOTDIR . "/language", "/^[a-z]{2}+\$/"); foreach ($lang_array_exit as $lang) { $tmp_array[$lang] = $language_array[$lang]; } unset($language_array); $content_config .= "\$language_array=" . nv_var_export($tmp_array) . ";\n"; $tmp_array = nv_parse_ini_file(NV_ROOTDIR . '/includes/ini/br.ini', true); $content_config .= "\$nv_parse_ini_browsers=" . nv_var_export($tmp_array) . ";\n"; $tmp_array = nv_parse_ini_file(NV_ROOTDIR . '/includes/ini/mobile.ini', true); $content_config .= "\$nv_parse_ini_mobile=" . nv_var_export($tmp_array) . ";\n"; $tmp_array = nv_parse_ini_file(NV_ROOTDIR . '/includes/ini/os.ini', true); $content_config .= "\$nv_parse_ini_os=" . nv_var_export($tmp_array) . ";\n"; $tmp_array = nv_parse_ini_file(NV_ROOTDIR . '/includes/ini/timezone.ini', true); $content_config .= "\$nv_parse_ini_timezone=" . nv_var_export($tmp_array) . ";\n"; $rewrite = array(); $global_config['rewrite_optional'] = $config_variable['rewrite_optional']; $global_config['rewrite_op_mod'] = $config_variable['rewrite_op_mod']; $global_config['rewrite_endurl'] = $config_variable['rewrite_endurl']; $global_config['rewrite_exturl'] = $config_variable['rewrite_exturl']; if ($config_variable['check_rewrite_file']) { require NV_ROOTDIR . '/includes/rewrite.php'; } else { require NV_ROOTDIR . '/includes/rewrite_index.php'; } $content_config .= "\n"; $nv_plugin_area = array(); $_sql = 'SELECT * FROM ' . $db_config['prefix'] . '_plugin ORDER BY plugin_area ASC, weight ASC'; $_query = $db->query($_sql); while ($row = $_query->fetch()) { $nv_plugin_area[$row['plugin_area']][] = $row['plugin_file']; } $content_config .= "\$nv_plugin_area=" . nv_var_export($nv_plugin_area) . ";\n\n"; $content_config .= "\$rewrite_keys=" . nv_var_export(array_keys($rewrite)) . ";\n"; $content_config .= "\$rewrite_values=" . nv_var_export(array_values($rewrite)) . ";\n"; $return = file_put_contents(NV_ROOTDIR . "/" . NV_DATADIR . "/config_global.php", trim($content_config), LOCK_EX); nv_delete_all_cache(); return $return; }
/** * download::my_mime_content_type() * * @param mixed $path * @return */ private function my_mime_content_type($path) { if (function_exists('mime_content_type')) { return mime_content_type($path); } if (function_exists('finfo_open')) { $finfo = finfo_open(FILEINFO_MIME); $mimetype = finfo_file($finfo, $path); finfo_close($finfo); return $mimetype; } $mime_types = nv_parse_ini_file(NV_MIME_INI_FILE); if (array_key_exists($this->properties['extension'], $mime_types)) { if (is_string($mime_types[$ext])) { return $mime_types[$ext]; } else { return $mime_types[$ext][0]; } } return 'application/force-download'; }
/** * download::my_mime_content_type() * * @param mixed $path * @return */ private function my_mime_content_type($path) { $mime = ''; if ($this->func_exists('finfo_open')) { if (empty($this->magic_path)) { $finfo = finfo_open(FILEINFO_MIME); } elseif ($this->magic_path != 'auto') { $finfo = finfo_open(FILEINFO_MIME, $this->magic_path); } else { if (($magic = getenv('MAGIC')) !== false) { $finfo = finfo_open(FILEINFO_MIME, $magic); } else { if (substr(PHP_OS, 0, 3) == 'WIN') { $path = realpath(ini_get('extension_dir') . '/../') . 'extras/magic'; $finfo = finfo_open(FILEINFO_MIME, $path); } else { $finfo = finfo_open(FILEINFO_MIME, '/usr/share/file/magic'); } } } if (is_resource($finfo)) { $mime = finfo_file($finfo, realpath($path)); finfo_close($finfo); $mime = preg_replace('/^([\\.\\-\\w]+)\\/([\\.\\-\\w]+)(.*)$/i', '$1/$2', trim($mime)); } } if (empty($mime) or $mime == 'application/octet-stream') { if ($this->cl_exists('finfo')) { $finfo = new finfo(FILEINFO_MIME); if ($finfo) { $mime = $finfo->file(realpath($path)); $mime = preg_replace('/^([\\.\\-\\w]+)\\/([\\.\\-\\w]+)(.*)$/i', '$1/$2', trim($mime)); } } } if (empty($mime) or $mime == 'application/octet-stream') { if (substr(PHP_OS, 0, 3) != 'WIN') { if ($this->func_exists('system')) { ob_start(); system('file -i -b ' . escapeshellarg($path)); $m = ob_get_clean(); $m = trim($m); if (!empty($m)) { $mime = preg_replace('/^([\\.\\-\\w]+)\\/([\\.\\-\\w]+)(.*)$/i', '$1/$2', $m); } } elseif ($this->func_exists('exec')) { $m = @exec('file -bi ' . escapeshellarg($path)); $m = trim($m); if (!empty($m)) { $mime = preg_replace('/^([\\.\\-\\w]+)\\/([\\.\\-\\w]+)(.*)$/i', '$1/$2', $m); } } } } if (empty($mime) or $mime == 'application/octet-stream') { if ($this->func_exists('mime_content_type')) { $mime = mime_content_type($path); $mime = preg_replace('/^([\\.\\-\\w]+)\\/([\\.\\-\\w]+)(.*)$/i', '$1/$2', trim($mime)); } } if (empty($mime) or $mime == 'application/octet-stream') { $img_exts = array('png', 'gif', 'jpg', 'bmp', 'tiff', 'swf', 'psd'); if (in_array($this->properties['extension'], $img_exts)) { if (($img_info = @getimagesize($path)) !== false) { if (array_key_exists('mime', $img_info) and !empty($img_info['mime'])) { $mime = trim($img_info['mime']); $mime = preg_replace('/^([\\.\\-\\w]+)\\/([\\.\\-\\w]+)(.*)$/i', '$1/$2', $mime); } if (empty($mime) and isset($img_info[2])) { $mime = image_type_to_mime_type($img_info[2]); } } } } if (empty($mime) or $mime == 'application/octet-stream') { $mime_types = nv_parse_ini_file(NV_MIME_INI_FILE); if (array_key_exists($this->properties['extension'], $mime_types)) { if (is_string($mime_types[$this->properties['extension']])) { return $mime_types[$this->properties['extension']]; } $mime = $mime_types[$this->properties['extension']][0]; } } if (preg_match('/^application\\/(?:x-)?zip(?:-compressed)?$/is', $mime)) { if ($this->properties['extension'] == 'docx') { $mime = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'; } elseif ($this->properties['extension'] == 'dotx') { $mime = 'application/vnd.openxmlformats-officedocument.wordprocessingml.template'; } elseif ($this->properties['extension'] == 'potx') { $mime = 'application/vnd.openxmlformats-officedocument.presentationml.template'; } elseif ($this->properties['extension'] == 'ppsx') { $mime = 'application/vnd.openxmlformats-officedocument.presentationml.slideshow'; } elseif ($this->properties['extension'] == 'pptx') { $mime = 'application/vnd.openxmlformats-officedocument.presentationml.presentation'; } elseif ($this->properties['extension'] == 'xlsx') { $mime = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'; } elseif ($this->properties['extension'] == 'xltx') { $mime = 'application/vnd.openxmlformats-officedocument.spreadsheetml.template'; } elseif ($this->properties['extension'] == 'docm') { $mime = 'application/vnd.ms-word.document.macroEnabled.12'; } elseif ($this->properties['extension'] == 'dotm') { $mime = 'application/vnd.ms-word.template.macroEnabled.12'; } elseif ($this->properties['extension'] == 'potm') { $mime = 'application/vnd.ms-powerpoint.template.macroEnabled.12'; } elseif ($this->properties['extension'] == 'ppam') { $mime = 'application/vnd.ms-powerpoint.addin.macroEnabled.12'; } elseif ($this->properties['extension'] == 'ppsm') { $mime = 'application/vnd.ms-powerpoint.slideshow.macroEnabled.12'; } elseif ($this->properties['extension'] == 'pptm') { $mime = 'application/vnd.ms-powerpoint.presentation.macroEnabled.12'; } elseif ($this->properties['extension'] == 'xlam') { $mime = 'application/vnd.ms-excel.addin.macroEnabled.12'; } elseif ($this->properties['extension'] == 'xlsb') { $mime = 'application/vnd.ms-excel.sheet.binary.macroEnabled.12'; } elseif ($this->properties['extension'] == 'xlsm') { $mime = 'application/vnd.ms-excel.sheet.macroEnabled.12'; } elseif ($this->properties['extension'] == 'xltm') { $mime = 'application/vnd.ms-excel.template.macroEnabled.12'; } } return !empty($mime) ? $mime : 'application/force-download'; }
<?php /** * @Project NUKEVIET 4.x * @Author VINADES.,JSC (contact@vinades.vn) * @Copyright (C) 2014 VINADES.,JSC. All rights reserved * @License GNU/GPL version 2 or any later version * @Createdate 2-9-2010 14:43 */ if (!defined('NV_IS_FILE_ADMIN')) { die('Stop!!!'); } $page_title = $lang_module['money']; $currencies_array = nv_parse_ini_file(NV_ROOTDIR . '/includes/ini/currencies.ini', true); if (!empty($pro_config['money_unit']) != '' and isset($currencies_array[$pro_config['money_unit']])) { $page_title .= ' ' . $lang_module['money_compare'] . ' ' . $currencies_array[$pro_config['money_unit']]['currency']; } $error = ''; $savecat = 0; $data = array(); $table_name = $db_config['prefix'] . '_' . $module_data . '_money_' . NV_LANG_DATA; $savecat = $nv_Request->get_int('savecat', 'post', 0); $id = $nv_Request->get_int('id', 'get', 0); if (!empty($savecat)) { $data['id'] = $nv_Request->get_int('id', 'post'); $data['code'] = $nv_Request->get_title('code', 'post'); $data['currency'] = $nv_Request->get_title('currency', 'post', '', 1); $data['exchange'] = $nv_Request->get_title('exchange', 'post,get', 0); $data['exchange'] = floatval(preg_replace('/[^0-9\\.]/', '', $data['exchange'])); $data['round'] = $nv_Request->get_title('round', 'post,get', 0); $data['round'] = floatval(preg_replace('/[^0-9\\.]/', '', $data['round']));
<?php /** * @Project NUKEVIET 3.x * @Author VINADES.,JSC (contact@vinades.vn) * @Copyright (C) 2012 VINADES.,JSC. All rights reserved * @Createdate 2-2-2010 12:55 */ if (!defined('NV_IS_FILE_SETTINGS')) { die('Stop!!!'); } $timezone_array = array_keys(nv_parse_ini_file(NV_ROOTDIR . '/includes/ini/timezone.ini', true)); $array_config_global = array(); if ($nv_Request->isset_request('submit', 'post')) { $array_config_global['online_upd'] = $nv_Request->get_int('online_upd', 'post'); $array_config_global['statistic'] = $nv_Request->get_int('statistic', 'post'); $statistics_timezone = filter_text_input('statistics_timezone', 'post', '', 0, 255); if (!empty($statistics_timezone) and in_array($statistics_timezone, $timezone_array)) { $array_config_global['statistics_timezone'] = $statistics_timezone; } else { $array_config_global['statistics_timezone'] = NV_SITE_TIMEZONE_NAME; } $array_config_global['googleAnalyticsID'] = filter_text_input('googleAnalyticsID', 'post', '', 1, 20); if (!preg_match('/^UA-\\d{4,}-\\d+$/', $array_config_global['googleAnalyticsID'])) { $array_config_global['googleAnalyticsID'] = ""; } $array_config_global['googleAnalyticsSetDomainName'] = $nv_Request->get_int('googleAnalyticsSetDomainName', 'post'); foreach ($array_config_global as $config_name => $config_value) { $db->sql_query("REPLACE INTO `" . NV_CONFIG_GLOBALTABLE . "` (`lang`, `module`, `config_name`, `config_value`) VALUES ('sys', 'global', '" . mysql_real_escape_string($config_name) . "', " . $db->dbescape($config_value) . ")"); } nv_save_file_config_global();
// Loi khong co file cau hinh if ($iniIndex == -1) { $error = $lang_module['autoinstall_error_missing_cfg']; } else { // Giai nen file config de doc thong tin $temp_extract_dir = NV_TEMP_DIR; // Xoa file config neu ton tai if (file_exists(NV_ROOTDIR . '/' . $temp_extract_dir . '/config.ini')) { @nv_deletefile(NV_ROOTDIR . '/' . $temp_extract_dir . '/config.ini'); } $extract = $zip->extractByIndex($iniIndex, PCLZIP_OPT_PATH, NV_ROOTDIR . '/' . $temp_extract_dir); if (empty($extract) or !isset($extract[0]['status']) or $extract[0]['status'] != 'ok' or !file_exists(NV_ROOTDIR . '/' . $temp_extract_dir . '/config.ini')) { $error = $lang_module['autoinstall_cantunzip']; } else { // Doc, kiem tra thong tin file config.ini $extConfig = nv_parse_ini_file(NV_ROOTDIR . '/' . $temp_extract_dir . '/config.ini', true); $extConfigCheck = nv_check_ext_config_filecontent($extConfig); if (!$extConfigCheck) { $error = $lang_module['autoinstall_error_cfg_content']; } elseif (!in_array($extConfig['extension']['type'], $arraySysOption['allowExtType'])) { $error = $lang_module['autoinstall_error_cfg_type']; } elseif (!preg_match($global_config['check_version'], $extConfig['extension']['version'])) { $error = $lang_module['autoinstall_error_cfg_version']; } elseif (is_array($arraySysOption['checkName'][$extConfig['extension']['type']])) { foreach ($arraySysOption['checkName'][$extConfig['extension']['type']] as $check) { if (!preg_match($check, $extConfig['extension']['name'])) { $error = $lang_module['autoinstall_error_cfg_name']; } } } elseif (!preg_match($arraySysOption['checkName'][$extConfig['extension']['type']], $extConfig['extension']['name'])) { $error = $lang_module['autoinstall_error_cfg_name'];
/** * nv_get_allowed_ext() * * @param mixed $allowed_filetypes * @param mixed $forbid_extensions * @param mixed $forbid_mimes * @return */ function nv_get_allowed_ext($allowed_filetypes, $forbid_extensions, $forbid_mimes) { if ($allowed_filetypes == "any" or !empty($allowed_filetypes) and is_array($allowed_filetypes) and in_array("any", $allowed_filetypes)) { return "*"; } $ini = nv_parse_ini_file(NV_ROOTDIR . '/includes/ini/mime.ini', true); $allowmimes = array(); if (!is_array($allowed_filetypes)) { $allowed_filetypes = array($allowed_filetypes); } if (!empty($allowed_filetypes)) { foreach ($allowed_filetypes as $type) { if (isset($ini[$type])) { foreach ($ini[$type] as $ext => $mimes) { if (!empty($ext) and !in_array($ext, $forbid_extensions)) { $a = true; if (!is_array($mimes)) { if (in_array($mimes, $forbid_mimes)) { $a = false; } } else { foreach ($mimes as $m) { if (in_array($m, $forbid_mimes)) { $a = false; break; } } } if ($a) { $allowmimes[$ext] = $mimes; } } } } } } return $allowmimes; }
/** * nv_getOs() * * @param string $agent * @param string $osinifile * @return */ function nv_getOs($agent, $osinifile) { $os = nv_parse_ini_file($osinifile, true); foreach ($os as $key => $info) { if (preg_match("#" . $info['rule'] . "#i", $agent, $results)) { if (strstr($key, "win")) { return $key . '|' . $info['name']; } if (isset($results[1])) { return $key . '|' . $info['name'] . ' ' . $results[1]; } return $key . '|' . $info['name']; } } return "Unspecified|Unspecified"; }
} if (file_exists(NV_ROOTDIR . '/includes/bots.php')) { include NV_ROOTDIR . '/includes/bots.php'; foreach ($bots as $_bot => $v) { $db->query("INSERT INTO " . $db_config['prefix'] . "_counter VALUES ('bot', " . $db->quote($_bot) . ", 0, 0, 0)"); } } $tmp_array = nv_parse_ini_file(NV_ROOTDIR . '/includes/ini/br.ini', true); foreach ($tmp_array as $_browser => $v) { $db->query("INSERT INTO " . $db_config['prefix'] . "_counter VALUES ('browser', " . $db->quote($_browser) . ", 0, 0, 0)"); } $db->query("INSERT INTO " . $db_config['prefix'] . "_counter VALUES ('browser', 'Mobile', 0, 0, 0)"); $db->query("INSERT INTO " . $db_config['prefix'] . "_counter VALUES ('browser', 'bots', 0, 0, 0)"); $db->query("INSERT INTO " . $db_config['prefix'] . "_counter VALUES ('browser', 'Unknown', 0, 0, 0)"); $db->query("INSERT INTO " . $db_config['prefix'] . "_counter VALUES ('browser', 'Unspecified', 0, 0, 0)"); $tmp_array = nv_parse_ini_file(NV_ROOTDIR . '/includes/ini/os.ini', true); foreach ($tmp_array as $_os => $v) { $db->query("INSERT INTO " . $db_config['prefix'] . "_counter VALUES ('os', " . $db->quote($_os) . ", 0, 0, 0)"); } $db->query("INSERT INTO " . $db_config['prefix'] . "_counter VALUES ('os', 'Unspecified', 0, 0, 0)"); foreach ($countries as $_country => $v) { $db->query("INSERT INTO " . $db_config['prefix'] . "_counter VALUES ('country', " . $db->quote($_country) . ", 0, 0, 0)"); } $db->query("INSERT INTO " . $db_config['prefix'] . "_counter VALUES ('country', 'unkown', 0, 0, 0)"); Header('Location: ' . NV_BASE_SITEURL . 'install/index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&step=' . $step); exit; } else { $error = sprintf($lang_module['file_not_writable'], NV_DATADIR . '/config_global.php'); } } else { $error = 'Error add Administrator';