diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 8338ea7e2..e7eacb2a3 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,6 +1,9 @@ CHANGE LOG: NukeViet eGovernment http://egov.nukeviet.vn +NukeViet eGovernment 1.2.02 +- Cập nhật NukeViet CMS 4.4.02 + NukeViet eGovernment 1.2.01 - Cập nhật NukeViet CMS 4.4.01 - Sửa lỗi thanh tìm kiếm trên giao diện mobile không hoạt động (#104) diff --git a/admin/themes/sort_order.php b/admin/themes/sort_order.php index 930397328..b814f698d 100755 --- a/admin/themes/sort_order.php +++ b/admin/themes/sort_order.php @@ -8,14 +8,15 @@ * @Createdate 2-9-2010 14:43 * @Development version theme control */ + if (!defined('NV_IS_FILE_THEMES')) { die('Stop!!!'); } -$array_bid = $nv_Request->get_typed_array('bl', 'post', 'int', array()); +$array_bid = $nv_Request->get_typed_array('bl', 'post', 'int', []); $func_id = $nv_Request->get_int('func_id', 'post'); - $position = $nv_Request->get_string('position', 'post'); + if (md5(NV_CHECK_SESSION . '_' . $position) == $nv_Request->get_string('checkss', 'post')) { if (!empty($array_bid) and !empty($position)) { $pos_new = '[' . $position . ']'; @@ -41,7 +42,7 @@ $weight = 0; while (list ($bid_i) = $sth->fetch(3)) { - ++ $weight; + ++$weight; $db->query('UPDATE ' . NV_BLOCKS_TABLE . '_groups SET weight=' . $weight . ' WHERE bid=' . $bid_i); } @@ -49,14 +50,14 @@ $func_id_old = $weight = 0; $sth = $db->prepare('SELECT t1.bid, t1.func_id FROM ' . NV_BLOCKS_TABLE . '_weight t1 - INNER JOIN ' . NV_BLOCKS_TABLE . '_groups t2 ON t1.bid = t2.bid - WHERE t2.theme= :theme AND t2.position= :position ORDER BY t1.func_id ASC, t1.weight ASC'); + INNER JOIN ' . NV_BLOCKS_TABLE . '_groups t2 ON t1.bid = t2.bid + WHERE t2.theme= :theme AND t2.position= :position ORDER BY t1.func_id ASC, t1.weight ASC'); $sth->bindParam(':theme', $theme, PDO::PARAM_STR); $sth->bindParam(':position', $pos_old, PDO::PARAM_STR); $sth->execute(); while (list ($bid_i, $func_id_i) = $sth->fetch(3)) { if ($func_id_i == $func_id_old) { - ++ $weight; + ++$weight; } else { $weight = 1; $func_id_old = $func_id_i; @@ -67,29 +68,29 @@ // Update weight for news position $sth = $db->prepare('SELECT bid FROM ' . NV_BLOCKS_TABLE . '_groups - WHERE theme= :theme AND position= :position - ORDER BY weight ASC'); + WHERE theme= :theme AND position= :position + ORDER BY weight ASC'); $sth->bindParam(':theme', $theme, PDO::PARAM_STR); $sth->bindParam(':position', $pos_new, PDO::PARAM_STR); $sth->execute(); $weight = 0; while (list ($bid_i) = $sth->fetch(3)) { - ++ $weight; + ++$weight; $db->query('UPDATE ' . NV_BLOCKS_TABLE . '_groups SET weight=' . $weight . ' WHERE bid=' . $bid_i); } $func_id_old = $weight = 0; $sth = $db->prepare('SELECT t1.bid, t1.func_id FROM ' . NV_BLOCKS_TABLE . '_weight t1 - INNER JOIN ' . NV_BLOCKS_TABLE . '_groups t2 ON t1.bid = t2.bid - WHERE t2.theme= :theme AND t2.position= :position - ORDER BY t1.func_id ASC, t1.weight ASC'); + INNER JOIN ' . NV_BLOCKS_TABLE . '_groups t2 ON t1.bid = t2.bid + WHERE t2.theme= :theme AND t2.position= :position + ORDER BY t1.func_id ASC, t1.weight ASC'); $sth->bindParam(':theme', $theme, PDO::PARAM_STR); $sth->bindParam(':position', $pos_new, PDO::PARAM_STR); $sth->execute(); while (list ($bid_i, $func_id_i) = $sth->fetch(3)) { if ($func_id_i == $func_id_old) { - ++ $weight; + ++$weight; } else { $weight = 1; $func_id_old = $func_id_i; @@ -104,7 +105,7 @@ if (!empty($array_bid) and $func_id > 0) { foreach ($array_bid as $bid) { $db->query('UPDATE ' . NV_BLOCKS_TABLE . '_weight SET weight = ' . $weight . ' WHERE bid = ' . $bid . ' AND func_id=' . $func_id); - ++ $weight; + ++$weight; } } @@ -114,4 +115,4 @@ $db->query('OPTIMIZE TABLE ' . NV_BLOCKS_TABLE . '_weight'); } -die('OK_' . $func_id); \ No newline at end of file +die('OK_' . $func_id); diff --git a/assets/js/admin.js b/assets/js/admin.js index ff3fdb221..b2dbe6c35 100755 --- a/assets/js/admin.js +++ b/assets/js/admin.js @@ -7,63 +7,63 @@ */ function nv_admin_logout() { - confirm(nv_admlogout_confirm[0]) && $.get(nv_base_siteurl + "index.php?second=admin_logout&js=1&nocache=" + (new Date).getTime(), function(b) { - 1 == b && (alert(nv_admlogout_confirm[1]), window.location.href = 1 == nv_area_admin ? nv_base_siteurl + "index.php" : strHref) - }); - return !1 + confirm(nv_admlogout_confirm[0]) && $.get(nv_base_siteurl + "index.php?second=admin_logout&js=1&nocache=" + (new Date).getTime(), function(b) { + 1 == b && (alert(nv_admlogout_confirm[1]), window.location.href = 1 == nv_area_admin ? nv_base_siteurl + "index.php" : strHref) + }); + return !1 } function nv_sh(b, a) { - 3 == $("#" + b).val() ? nv_show_hidden(a, 1) : nv_show_hidden(a, 0); - return !1 + 3 == $("#" + b).val() ? nv_show_hidden(a, 1) : nv_show_hidden(a, 0); + return !1 } $(function() { - if ("undefined" != typeof drag_block && 0 != drag_block) { - $("a.delblock").click(function() { - confirm(block_delete_confirm) && $.post(post_url + "blocks_del", "bid=" + $(this).attr("name") + "&checkss=" + $(this).data("checkss"), function(a) { - alert(a); - window.location.href = selfurl - }) - }); - $("a.outgroupblock").click(function() { - confirm(block_outgroup_confirm) && $.post(post_url + "block_outgroup", "func_id=" + func_id + "&bid=" + $(this).attr("name") + "&checkss=" + $(this).data("checkss"), function(a) { - alert(a); - window.location.href = selfurl - }) - }); - $("a.block_content").click(function() { - nv_open_browse(post_url + "block_content&selectthemes=" + module_theme + "&tag=" + $(this).attr("id") + "&bid=" + $(this).attr("name") + "&blockredirect=" + blockredirect, "ChangeBlock", 800, 500, "resizable=no,scrollbars=yes,toolbar=no,location=no,status=no") - }); + if ("undefined" != typeof drag_block && 0 != drag_block) { + $("a.delblock").click(function() { + confirm(block_delete_confirm) && $.post(post_url + "blocks_del", "bid=" + $(this).attr("name") + "&checkss=" + $(this).data("checkss"), function(a) { + alert(a); + window.location.href = selfurl + }) + }); + $("a.outgroupblock").click(function() { + confirm(block_outgroup_confirm) && $.post(post_url + "block_outgroup", "func_id=" + func_id + "&bid=" + $(this).attr("name") + "&checkss=" + $(this).data("checkss"), function(a) { + alert(a); + window.location.href = selfurl + }) + }); + $("a.block_content").click(function() { + nv_open_browse(post_url + "block_content&selectthemes=" + module_theme + "&tag=" + $(this).attr("id") + "&bid=" + $(this).attr("name") + "&blockredirect=" + blockredirect, "ChangeBlock", 800, 500, "resizable=no,scrollbars=yes,toolbar=no,location=no,status=no") + }); $("a.actblock").click(function() { - $(this).prop("disabled", !0); - var a = this; - $.ajax({ - type: "post", - url: post_url + "block_change_show", - data: "bid=" + $(this).attr("name") + "&checkss=" + $(this).data("checkss"), - cache: !1, - dataType: "json" - }).done(function(b) { - $(a).prop("disabled", !1); - "ok" == b.status && ($(a).attr("title", $(a).attr("data-" + b.act)).attr("alt", $(a).attr("data-" + b.act)).find("em").attr("class", $("em", a).attr("data-" + b.act)), "act" == b.act ? $(a).parent().parent().find(".blockct").removeClass("act0") : $(a).parent().parent().find(".blockct").addClass("act0")) - }) + $(this).prop("disabled", !0); + var a = this; + $.ajax({ + type: "post", + url: post_url + "block_change_show", + data: "bid=" + $(this).attr("name") + "&checkss=" + $(this).data("checkss"), + cache: !1, + dataType: "json" + }).done(function(b) { + $(a).prop("disabled", !1); + "ok" == b.status && ($(a).attr("title", $(a).attr("data-" + b.act)).attr("alt", $(a).attr("data-" + b.act)).find("em").attr("class", $("em", a).attr("data-" + b.act)), "act" == b.act ? $(a).parent().parent().find(".blockct").removeClass("act0") : $(a).parent().parent().find(".blockct").addClass("act0")) + }); + }); + var b = !1; + $(".column").sortable({ + connectWith: ".column", + opacity: .8, + cursor: "move", + receive: function() { + b = !0; + $.post(post_url + "sort_order", $(this).sortable("serialize") + "&position=" + $(this).data("id") + "&checkss=" + $(this).data("checkss") + "&func_id=" + func_id, function(a) { + a == "OK_" + func_id ? $("div#toolbar>ul.info").html('
  • ' + blocks_saved + "
  • ").fadeIn(1E3) : alert(blocks_saved_error) + }); + }, + stop: function() { + 0 == b && $.post(post_url + "sort_order", $(this).sortable("serialize") + "&position=" + $(this).data("id") + "&checkss=" + $(this).data("checkss") + "&func_id=" + func_id, function(a) { + a == "OK_" + func_id ? $("div#toolbar>ul.info").html('' + blocks_saved + "").fadeIn(1E3) : alert(blocks_saved_error) + }); + } }); - var b = !1; - $(".column").sortable({ - connectWith: ".column", - opacity: .8, - cursor: "move", - receive: function() { - b = !0; - $.post(post_url + "sort_order", $(this).sortable("serialize") + "&position=" + $(this).data("id") + "&checkss=" + $(this).data("checkss") + "&func_id=" + func_id, function(a) { - a == "OK_" + func_id ? $("div#toolbar>ul.info").html('
  • ' + blocks_saved + "
  • ").fadeIn(1E3) : alert(blocks_saved_error) - }) - }, - stop: function() { - 0 == b && $.post(post_url + "sort_order", $(this).sortable("serialize") + "&checkss=" + $(this).data("checkss") + "&func_id=" + func_id, function(a) { - a == "OK_" + func_id ? $("div#toolbar>ul.info").html('' + blocks_saved + "").fadeIn(1E3) : alert(blocks_saved_error) - }) - } - }); - $(".column").disableSelection() - } -}); \ No newline at end of file + $(".column").disableSelection(); + } +}); diff --git a/includes/action_mysql.php b/includes/action_mysql.php index b22139c67..b3983746e 100755 --- a/includes/action_mysql.php +++ b/includes/action_mysql.php @@ -174,21 +174,21 @@ function nv_create_table_sys($lang) title, module_file, module_data, module_upload, module_theme, custom_title, admin_title, set_time, main_file, admin_file, theme, mobile, description, keywords, groups_view, weight, act, admins, rss, sitemap ) VALUES - ('about', 'page', 'about', 'about', 'page', 'About', '', 1592038800, 1, 1, '', '', '', '', '0', 1, 1, '', 1, 1), - ('news', 'news', 'news', 'news', 'news', 'News', '', 1592038800, 1, 1, '', '', '', '', '0', 2, 1, '', 1, 1), - ('users', 'users', 'users', 'users', 'users', 'Users', 'Users', 1592038800, 1, 1, '', '', '', '', '0', 3, 1, '', 0, 1), - ('contact', 'contact', 'contact', 'contact', 'contact', 'Contact', '', 1592038800, 1, 1, '', '', '', '', '0', 4, 1, '', 0, 1), - ('statistics', 'statistics', 'statistics', 'statistics', 'statistics', 'Statistics', '', 1592038800, 1, 0, '', '', '', '', '0', 5, 1, '', 0, 1), - ('voting', 'voting', 'voting', 'voting', 'voting', 'Voting', '', 1592038800, 1, 1, '', '', '', '', '0', 6, 1, '', 1, 1), - ('banners', 'banners', 'banners', 'banners', 'banners', 'Banners', '', 1592038800, 1, 1, '', '', '', '', '0', 7, 1, '', 0, 1), - ('seek', 'seek', 'seek', 'seek', 'seek', 'Search', '', 1592038800, 1, 0, '', '', '', '', '0', 8, 1, '', 0, 1), - ('menu', 'menu', 'menu', 'menu', 'menu', 'Menu Site', '', 1592038800, 0, 1, '', '', '', '', '0', 9, 1, '', 0, 1), - ('feeds', 'feeds', 'feeds', 'feeds', 'feeds', 'Rss Feeds', '', 1592038800, 1, 1, '', '', '', '', '0', 10, 1, '', 0, 1), - ('page', 'page', 'page', 'page', 'page', 'Page', '', 1592038800, 1, 1, '', '', '', '', '0', 11, 1, '', 1, 0), - ('comment', 'comment', 'comment', 'comment', 'comment', 'Comment', '', 1592038800, 1, 1, '', '', '', '', '0', 12, 1, '', 0, 1), - ('siteterms', 'page', 'siteterms', 'siteterms', 'page', 'Siteterms', '', 1592038800, 1, 1, '', '', '', '', '0', 13, 1, '', 1, 1), - ('freecontent', 'freecontent', 'freecontent', 'freecontent', 'freecontent', 'Free Content', '', 1592038800, 0, 1, '', '', '', '', '0', 14, 1, '', 0, 1), - ('two-step-verification', 'two-step-verification', 'two_step_verification', 'two-step-verification', 'two_step_verification', 'Two-Step Verification', '', 1592038800, 1, 0, '', '', '', '', '0', 15, 1, '', 0, 1)"; + ('about', 'page', 'about', 'about', 'page', 'About', '', 1592816400, 1, 1, '', '', '', '', '0', 1, 1, '', 1, 1), + ('news', 'news', 'news', 'news', 'news', 'News', '', 1592816400, 1, 1, '', '', '', '', '0', 2, 1, '', 1, 1), + ('users', 'users', 'users', 'users', 'users', 'Users', 'Users', 1592816400, 1, 1, '', '', '', '', '0', 3, 1, '', 0, 1), + ('contact', 'contact', 'contact', 'contact', 'contact', 'Contact', '', 1592816400, 1, 1, '', '', '', '', '0', 4, 1, '', 0, 1), + ('statistics', 'statistics', 'statistics', 'statistics', 'statistics', 'Statistics', '', 1592816400, 1, 0, '', '', '', '', '0', 5, 1, '', 0, 1), + ('voting', 'voting', 'voting', 'voting', 'voting', 'Voting', '', 1592816400, 1, 1, '', '', '', '', '0', 6, 1, '', 1, 1), + ('banners', 'banners', 'banners', 'banners', 'banners', 'Banners', '', 1592816400, 1, 1, '', '', '', '', '0', 7, 1, '', 0, 1), + ('seek', 'seek', 'seek', 'seek', 'seek', 'Search', '', 1592816400, 1, 0, '', '', '', '', '0', 8, 1, '', 0, 1), + ('menu', 'menu', 'menu', 'menu', 'menu', 'Menu Site', '', 1592816400, 0, 1, '', '', '', '', '0', 9, 1, '', 0, 1), + ('feeds', 'feeds', 'feeds', 'feeds', 'feeds', 'Rss Feeds', '', 1592816400, 1, 1, '', '', '', '', '0', 10, 1, '', 0, 1), + ('page', 'page', 'page', 'page', 'page', 'Page', '', 1592816400, 1, 1, '', '', '', '', '0', 11, 1, '', 1, 0), + ('comment', 'comment', 'comment', 'comment', 'comment', 'Comment', '', 1592816400, 1, 1, '', '', '', '', '0', 12, 1, '', 0, 1), + ('siteterms', 'page', 'siteterms', 'siteterms', 'page', 'Siteterms', '', 1592816400, 1, 1, '', '', '', '', '0', 13, 1, '', 1, 1), + ('freecontent', 'freecontent', 'freecontent', 'freecontent', 'freecontent', 'Free Content', '', 1592816400, 0, 1, '', '', '', '', '0', 14, 1, '', 0, 1), + ('two-step-verification', 'two-step-verification', 'two_step_verification', 'two-step-verification', 'two_step_verification', 'Two-Step Verification', '', 1592816400, 1, 0, '', '', '', '', '0', 15, 1, '', 0, 1)"; $sql_create_table[] = "INSERT INTO " . NV_CONFIG_GLOBALTABLE . " (lang, module, config_name, config_value) VALUES ('" . $lang . "', 'global', 'site_domain', ''), diff --git a/includes/core/user_functions.php b/includes/core/user_functions.php index 6ccd04e0e..4b23ab15f 100755 --- a/includes/core/user_functions.php +++ b/includes/core/user_functions.php @@ -624,16 +624,23 @@ function nv_html_site_rss($html = true) /** * nv_html_site_js() - * + * * @param bool $html - * @return + * Xuất ra dạng string (html) hay để nguyên dạng array + * Mặc định true + * + * @param array $other_js + * Thêm js vào ngay sau global.js + * Mặc định rỗng + * + * @return string | array */ -function nv_html_site_js($html = true) +function nv_html_site_js($html = true, $other_js = []) { global $global_config, $module_info, $module_name, $module_file, $lang_global, $op, $client_info, $user_info; $safemode = defined('NV_IS_USER') ? $user_info['safemode'] : 0; - $jsDef = "var nv_base_siteurl=\"" . NV_BASE_SITEURL . "\",nv_lang_data=\"" . NV_LANG_INTERFACE . "\",nv_lang_interface=\"" . NV_LANG_INTERFACE . "\",nv_name_variable=\"" . NV_NAME_VARIABLE . "\",nv_fc_variable=\"" . NV_OP_VARIABLE . "\",nv_lang_variable=\"" . NV_LANG_VARIABLE . "\",nv_module_name=\"" . $module_name . "\",nv_func_name=\"" . $op . "\",nv_is_user=" . (( int )defined("NV_IS_USER")) . ", nv_my_ofs=" . round(NV_SITE_TIMEZONE_OFFSET / 3600) . ",nv_my_abbr=\"" . nv_date("T", NV_CURRENTTIME) . "\",nv_cookie_prefix=\"" . $global_config['cookie_prefix'] . "\",nv_check_pass_mstime=" . ((intval($global_config['user_check_pass_time']) - 62) * 1000) . ",nv_area_admin=0,nv_safemode=" . $safemode . ",theme_responsive=" . (( int )($global_config['current_theme_type'] == 'r')); + $jsDef = "var nv_base_siteurl=\"" . NV_BASE_SITEURL . "\",nv_lang_data=\"" . NV_LANG_INTERFACE . "\",nv_lang_interface=\"" . NV_LANG_INTERFACE . "\",nv_name_variable=\"" . NV_NAME_VARIABLE . "\",nv_fc_variable=\"" . NV_OP_VARIABLE . "\",nv_lang_variable=\"" . NV_LANG_VARIABLE . "\",nv_module_name=\"" . $module_name . "\",nv_func_name=\"" . $op . "\",nv_is_user=" . ((int) defined("NV_IS_USER")) . ", nv_my_ofs=" . round(NV_SITE_TIMEZONE_OFFSET / 3600) . ",nv_my_abbr=\"" . nv_date("T", NV_CURRENTTIME) . "\",nv_cookie_prefix=\"" . $global_config['cookie_prefix'] . "\",nv_check_pass_mstime=" . ((intval($global_config['user_check_pass_time']) - 62) * 1000) . ",nv_area_admin=0,nv_safemode=" . $safemode . ",theme_responsive=" . ((int) ($global_config['current_theme_type'] == 'r')); if (defined('NV_IS_DRAG_BLOCK')) { $jsDef .= ',drag_block=1,blockredirect="' . nv_redirect_encrypt($client_info['selfurl']) . '",selfurl="' . $client_info['selfurl'] . '",block_delete_confirm="' . $lang_global['block_delete_confirm'] . '",block_outgroup_confirm="' . $lang_global['block_outgroup_confirm'] . '",blocks_saved="' . $lang_global['blocks_saved'] . '",blocks_saved_error="' . $lang_global['blocks_saved_error'] . '",post_url="' . NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=themes&' . NV_OP_VARIABLE . '=",func_id=' . $module_info['funcs'][$op]['func_id'] . ',module_theme="' . $global_config['module_theme'] . '"'; @@ -645,26 +652,63 @@ function nv_html_site_js($html = true) $jsDef .= ';'; $return = []; - $return[] = array( 'ext' => 0, 'content' => $jsDef ); - $return[] = array( 'ext' => 1, 'content' => NV_BASE_SITEURL . NV_ASSETS_DIR . '/js/jquery/jquery.min.js' ); - $return[] = array( 'ext' => 1, 'content' => NV_BASE_SITEURL . NV_ASSETS_DIR . '/js/language/' . NV_LANG_INTERFACE . '.js' ); - $return[] = array( 'ext' => 1, 'content' => NV_BASE_SITEURL . NV_ASSETS_DIR . '/js/global.js' ); - + $return[] = array( + 'ext' => 0, + 'content' => $jsDef + ); + $return[] = array( + 'ext' => 1, + 'content' => NV_BASE_SITEURL . NV_ASSETS_DIR . '/js/jquery/jquery.min.js' + ); + $return[] = array( + 'ext' => 1, + 'content' => NV_BASE_SITEURL . NV_ASSETS_DIR . '/js/language/' . NV_LANG_INTERFACE . '.js' + ); + $return[] = array( + 'ext' => 1, + 'content' => NV_BASE_SITEURL . NV_ASSETS_DIR . '/js/global.js' + ); + + if (!empty($other_js)) { + foreach ($other_js as $other) { + if (isset($other['ext']) and ($other['ext'] == '0' or $other['ext'] == '1') and !empty($other['content'])) { + $return[] = array( + 'ext' => (int) $other['ext'], + 'content' => $other['content'] + ); + } + } + } if (defined('NV_IS_ADMIN')) { - $return[] = array( 'ext' => 1, 'content' => NV_BASE_SITEURL . NV_ASSETS_DIR . '/js/admin.js' ); + $return[] = array( + 'ext' => 1, + 'content' => NV_BASE_SITEURL . NV_ASSETS_DIR . '/js/admin.js' + ); } // module js if (file_exists(NV_ROOTDIR . '/themes/' . $module_info['template'] . '/js/' . $module_info['module_theme'] . '.js')) { - $return[] = array( 'ext' => 1, 'content' => NV_BASE_SITEURL . 'themes/' . $module_info['template'] . '/js/' . $module_info['module_theme'] . '.js' ); + $return[] = array( + 'ext' => 1, + 'content' => NV_BASE_SITEURL . 'themes/' . $module_info['template'] . '/js/' . $module_info['module_theme'] . '.js' + ); } elseif (file_exists(NV_ROOTDIR . '/themes/' . $module_info['template'] . '/js/' . $module_file . '.js')) { - $return[] = array( 'ext' => 1, 'content' => NV_BASE_SITEURL . 'themes/' . $module_info['template'] . '/js/' . $module_file . '.js' ); + $return[] = array( + 'ext' => 1, + 'content' => NV_BASE_SITEURL . 'themes/' . $module_info['template'] . '/js/' . $module_file . '.js' + ); } elseif (file_exists(NV_ROOTDIR . '/themes/default/js/' . $module_file . '.js')) { - $return[] = array( 'ext' => 1, 'content' => NV_BASE_SITEURL . 'themes/default/js/' . $module_file . '.js' ); + $return[] = array( + 'ext' => 1, + 'content' => NV_BASE_SITEURL . 'themes/default/js/' . $module_file . '.js' + ); } if (defined('NV_IS_DRAG_BLOCK')) { - $return[] = array( 'ext' => 1, 'content' => NV_BASE_SITEURL . NV_ASSETS_DIR . '/js/jquery-ui/jquery-ui.min.js' ); + $return[] = array( + 'ext' => 1, + 'content' => NV_BASE_SITEURL . NV_ASSETS_DIR . '/js/jquery-ui/jquery-ui.min.js' + ); } if (!$html) { diff --git a/includes/functions.php b/includes/functions.php index f84efb5cf..fa4753bf5 100644 --- a/includes/functions.php +++ b/includes/functions.php @@ -81,13 +81,12 @@ function nv_is_myreferer($referer = '') return 2; } - $server_name = preg_replace('/^[w]+\./', '', nv_getenv('HTTP_HOST')); - $referer = preg_replace(array( + $referer = preg_replace([ '/^[a-zA-Z]+\:\/\/([w]+\.)?/', '/^[w]+\./' - ), '', $referer); + ], '', $referer); - if (preg_match('/^' . nv_preg_quote($server_name) . '/', $referer)) { + if (preg_match('/^' . nv_preg_quote(NV_SERVER_NAME) . '/', $referer)) { return 1; } diff --git a/includes/ini.php b/includes/ini.php index 6a9e94e2b..f5f4f5790 100755 --- a/includes/ini.php +++ b/includes/ini.php @@ -18,7 +18,7 @@ $iniSaveTime = 0; $ini_list = ini_get_all(null, false); -$ini_server = in_array($server_name, $global_config['my_domains']) ? $server_name : $global_config['my_domains'][0]; +$ini_server = in_array(NV_SERVER_NAME, $global_config['my_domains']) ? NV_SERVER_NAME : $global_config['my_domains'][0]; $config_ini_file = NV_ROOTDIR . '/' . NV_DATADIR . '/config_ini.' . preg_replace('/[^a-zA-Z0-9\.\_]/', '', $ini_server) . '.php'; @include_once $config_ini_file; if ($iniSaveTime + 86400 < NV_CURRENTTIME) { diff --git a/includes/mainfile.php b/includes/mainfile.php index 265a0d74e..8c3e1a4ca 100644 --- a/includes/mainfile.php +++ b/includes/mainfile.php @@ -28,45 +28,16 @@ // Ket noi voi cac file constants, config require NV_ROOTDIR . '/includes/constants.php'; +require NV_ROOTDIR . '/vendor/autoload.php'; -$server_name = trim((isset($_SERVER['HTTP_HOST']) and ! empty($_SERVER['HTTP_HOST'])) ? $_SERVER['HTTP_HOST'] : $_SERVER['SERVER_NAME']); -$server_name = preg_replace('/^[a-z]+\:\/\//i', '', $server_name); -$server_name = preg_replace('/(\:[0-9]+)$/', '', $server_name); -$server_protocol = strtolower(preg_replace('/^([^\/]+)\/*(.*)$/', '\\1', $_SERVER['SERVER_PROTOCOL'])) . (($_SERVER['HTTPS'] == 'on') ? 's' : ''); -$server_port = ($_SERVER['SERVER_PORT'] == '80' or $_SERVER['SERVER_PORT'] == '443') ? '' : (':' . $_SERVER['SERVER_PORT']); -if (filter_var($server_name, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6) === false) { - $my_current_domain = $server_protocol . '://' . $server_name . $server_port; -} else { - $my_current_domain = $server_protocol . '://[' . $server_name . ']' . $server_port; -} +$nv_Server = new NukeViet\Core\Server(); -$base_siteurl = pathinfo($_SERVER['PHP_SELF'], PATHINFO_DIRNAME); -if ($base_siteurl == DIRECTORY_SEPARATOR) { - $base_siteurl = ''; -} -if (!empty($base_siteurl)) { - $base_siteurl = str_replace(DIRECTORY_SEPARATOR, '/', $base_siteurl); -} -if (!empty($base_siteurl)) { - $base_siteurl = preg_replace('/[\/]+$/', '', $base_siteurl); -} -if (!empty($base_siteurl)) { - $base_siteurl = preg_replace('/^[\/]*(.*)$/', '/\\1', $base_siteurl); -} -if (defined('NV_WYSIWYG') and !defined('NV_ADMIN')) { - $base_siteurl = preg_replace('/\/' . NV_EDITORSDIR . '(.*)$/i', '', $base_siteurl); -} elseif (defined('NV_IS_UPDATE') or defined('NV_IS_INSTALL')) { - $base_siteurl = preg_replace('/\/install(\/(index|update)\.php.*)*$/i', '', $base_siteurl); -} elseif (defined('NV_ADMIN')) { - $base_siteurl = preg_replace('/\/' . NV_ADMINDIR . '(\/index\.php.*)*$/i', '', $base_siteurl); -} elseif (!empty($base_siteurl)) { - $base_siteurl = preg_replace('/\/index\.php(.*)$/', '', $base_siteurl); -} -define('NV_SERVER_NAME', $server_name);// vd: mydomain1.com -define('NV_SERVER_PROTOCOL', $server_protocol);// vd: http -define('NV_SERVER_PORT', $server_port);// vd: 80 -define('NV_MY_DOMAIN', $my_current_domain);// vd: http://mydomain1.com:80 -define('NV_BASE_SITEURL', $base_siteurl . '/');// vd: /ten_thu_muc_chua_site/ +define('NV_SERVER_NAME', $nv_Server->getServerHost()); +define('NV_SERVER_PROTOCOL', $nv_Server->getServerProtocol()); +define('NV_SERVER_PORT', $nv_Server->getServerPort()); + +define('NV_MY_DOMAIN', $nv_Server->getOriginalDomain()); +define('NV_BASE_SITEURL', $nv_Server->getWebsitePath() . '/'); if (file_exists(NV_ROOTDIR . '/' . NV_CONFIG_FILENAME)) { require realpath(NV_ROOTDIR . '/' . NV_CONFIG_FILENAME); @@ -87,9 +58,6 @@ } require NV_ROOTDIR . '/includes/ini.php'; - -// Vendor autoload -require NV_ROOTDIR . '/vendor/autoload.php'; require NV_ROOTDIR . '/includes/xtemplate.class.php'; // Xac dinh IP cua client @@ -150,7 +118,7 @@ } // Ket noi voi class xu ly request -$nv_Request = new NukeViet\Core\Request($global_config, NV_CLIENT_IP); +$nv_Request = new NukeViet\Core\Request($global_config, NV_CLIENT_IP, $nv_Server); define('NV_HEADERSTATUS', $nv_Request->headerstatus); // vd: HTTP/1.0 diff --git a/install/config.php b/install/config.php index d44587a51..6a7b59e42 100755 --- a/install/config.php +++ b/install/config.php @@ -35,7 +35,7 @@ $array_data['socialbutton'] = 1; $global_config['unofficial_mode'] = 0; // Cảnh báo bản thử nghiệm -$global_config['version'] = '1.2.01'; // NukeViet eGovernment Build from 4.4.01 +$global_config['version'] = '1.2.02'; // NukeViet eGovernment Build from 4.4.02 $global_config['site_email'] = ''; $global_config['site_phone'] = ''; $global_config['error_set_logs'] = 1; diff --git a/install/data.php b/install/data.php index 6eacef875..c582c73bb 100755 --- a/install/data.php +++ b/install/data.php @@ -171,24 +171,24 @@ $sql_create_table[] = "INSERT INTO " . NV_CRONJOBS_GLOBALTABLE . " (start_time, inter_val, run_file, run_func, params, del, is_sys, act, last_time, last_result) VALUES (" . NV_CURRENTTIME . ", 60, 'check_version.php', 'cron_auto_check_version', '', 0, 1, 1, 0, 0)"; $sql_create_table[] = "INSERT INTO " . NV_CRONJOBS_GLOBALTABLE . " (start_time, inter_val, run_file, run_func, params, del, is_sys, act, last_time, last_result) VALUES (" . NV_CURRENTTIME . ", 1440, 'notification_autodel.php', 'cron_notification_autodel', '', 0, 1, 1, 0, 0)"; -$sql_create_table[] = "INSERT INTO " . $db_config['prefix'] . "_setup_extensions (id, type, title, is_sys, is_virtual, basename, table_prefix, version, addtime, author, note) VALUES (0, 'module', 'about', 0, 0, 'page', 'about', '4.4.01 1592038800', " . NV_CURRENTTIME . ", 'VINADES ', '')"; -$sql_create_table[] = "INSERT INTO " . $db_config['prefix'] . "_setup_extensions (id, type, title, is_sys, is_virtual, basename, table_prefix, version, addtime, author, note) VALUES (0, 'module', 'siteterms', 0, 0, 'page', 'siteterms', '4.4.01 1592038800', " . NV_CURRENTTIME . ", 'VINADES ', '')"; -$sql_create_table[] = "INSERT INTO " . $db_config['prefix'] . "_setup_extensions (id, type, title, is_sys, is_virtual, basename, table_prefix, version, addtime, author, note) VALUES (19, 'module', 'banners', 1, 0, 'banners', 'banners', '4.4.01 1592038800', " . NV_CURRENTTIME . ", 'VINADES ', '')"; -$sql_create_table[] = "INSERT INTO " . $db_config['prefix'] . "_setup_extensions (id, type, title, is_sys, is_virtual, basename, table_prefix, version, addtime, author, note) VALUES (20, 'module', 'contact', 0, 1, 'contact', 'contact', '4.4.01 1592038800', " . NV_CURRENTTIME . ", 'VINADES ', '')"; -$sql_create_table[] = "INSERT INTO " . $db_config['prefix'] . "_setup_extensions (id, type, title, is_sys, is_virtual, basename, table_prefix, version, addtime, author, note) VALUES (1, 'module', 'news', 0, 1, 'news', 'news', '4.4.01 1592038800', " . NV_CURRENTTIME . ", 'VINADES ', '')"; -$sql_create_table[] = "INSERT INTO " . $db_config['prefix'] . "_setup_extensions (id, type, title, is_sys, is_virtual, basename, table_prefix, version, addtime, author, note) VALUES (21, 'module', 'voting', 0, 0, 'voting', 'voting', '4.4.01 1592038800', " . NV_CURRENTTIME . ", 'VINADES ', '')"; -$sql_create_table[] = "INSERT INTO " . $db_config['prefix'] . "_setup_extensions (id, type, title, is_sys, is_virtual, basename, table_prefix, version, addtime, author, note) VALUES (22, 'module', 'forum', 0, 0, 'forum', 'forum', '4.4.01 1592038800', " . NV_CURRENTTIME . ", 'VINADES ', '')"; -$sql_create_table[] = "INSERT INTO " . $db_config['prefix'] . "_setup_extensions (id, type, title, is_sys, is_virtual, basename, table_prefix, version, addtime, author, note) VALUES (284, 'module', 'seek', 1, 0, 'seek', 'seek', '4.4.01 1592038800', " . NV_CURRENTTIME . ", 'VINADES ', '')"; -$sql_create_table[] = "INSERT INTO " . $db_config['prefix'] . "_setup_extensions (id, type, title, is_sys, is_virtual, basename, table_prefix, version, addtime, author, note) VALUES (24, 'module', 'users', 1, 1, 'users', 'users', '4.4.01 1592038800', " . NV_CURRENTTIME . ", 'VINADES ', '')"; -$sql_create_table[] = "INSERT INTO " . $db_config['prefix'] . "_setup_extensions (id, type, title, is_sys, is_virtual, basename, table_prefix, version, addtime, author, note) VALUES (27, 'module', 'statistics', 0, 0, 'statistics', 'statistics', '4.4.01 1592038800', " . NV_CURRENTTIME . ", 'VINADES ', '')"; -$sql_create_table[] = "INSERT INTO " . $db_config['prefix'] . "_setup_extensions (id, type, title, is_sys, is_virtual, basename, table_prefix, version, addtime, author, note) VALUES (29, 'module', 'menu', 0, 0, 'menu', 'menu', '4.4.01 1592038800', " . NV_CURRENTTIME . ", 'VINADES ', '')"; -$sql_create_table[] = "INSERT INTO " . $db_config['prefix'] . "_setup_extensions (id, type, title, is_sys, is_virtual, basename, table_prefix, version, addtime, author, note) VALUES (283, 'module', 'feeds', 1, 0, 'feeds', 'feeds', '4.4.01 1592038800', " . NV_CURRENTTIME . ", 'VINADES ', '')"; -$sql_create_table[] = "INSERT INTO " . $db_config['prefix'] . "_setup_extensions (id, type, title, is_sys, is_virtual, basename, table_prefix, version, addtime, author, note) VALUES (282, 'module', 'page', 1, 1, 'page', 'page', '4.4.01 1592038800', " . NV_CURRENTTIME . ", 'VINADES ', '')"; -$sql_create_table[] = "INSERT INTO " . $db_config['prefix'] . "_setup_extensions (id, type, title, is_sys, is_virtual, basename, table_prefix, version, addtime, author, note) VALUES (281, 'module', 'comment', 1, 0, 'comment', 'comment', '4.4.01 1592038800', " . NV_CURRENTTIME . ", 'VINADES ', '')"; -$sql_create_table[] = "INSERT INTO " . $db_config['prefix'] . "_setup_extensions (id, type, title, is_sys, is_virtual, basename, table_prefix, version, addtime, author, note) VALUES (312, 'module', 'freecontent', 0, 1, 'freecontent', 'freecontent', '4.4.01 1592038800', " . NV_CURRENTTIME . ", 'VINADES ', '')"; -$sql_create_table[] = "INSERT INTO " . $db_config['prefix'] . "_setup_extensions (id, type, title, is_sys, is_virtual, basename, table_prefix, version, addtime, author, note) VALUES (327, 'module', 'two-step-verification', 1, 0, 'two-step-verification', 'two_step_verification', '4.4.01 1592038800', " . NV_CURRENTTIME . ", 'VINADES ', '')"; -$sql_create_table[] = "INSERT INTO " . $db_config['prefix'] . "_setup_extensions (id, type, title, is_sys, is_virtual, basename, table_prefix, version, addtime, author, note) VALUES (307, 'theme', 'default', 0, 0, 'default', 'default', '4.4.01 1592038800', " . NV_CURRENTTIME . ", 'VINADES ', '')"; -$sql_create_table[] = "INSERT INTO " . $db_config['prefix'] . "_setup_extensions (id, type, title, is_sys, is_virtual, basename, table_prefix, version, addtime, author, note) VALUES (311, 'theme', 'mobile_default', 0, 0, 'mobile_default', 'mobile_default', '4.4.01 1592038800', " . NV_CURRENTTIME . ", 'VINADES ', '')"; +$sql_create_table[] = "INSERT INTO " . $db_config['prefix'] . "_setup_extensions (id, type, title, is_sys, is_virtual, basename, table_prefix, version, addtime, author, note) VALUES (0, 'module', 'about', 0, 0, 'page', 'about', '4.4.02 1592816400', " . NV_CURRENTTIME . ", 'VINADES ', '')"; +$sql_create_table[] = "INSERT INTO " . $db_config['prefix'] . "_setup_extensions (id, type, title, is_sys, is_virtual, basename, table_prefix, version, addtime, author, note) VALUES (0, 'module', 'siteterms', 0, 0, 'page', 'siteterms', '4.4.02 1592816400', " . NV_CURRENTTIME . ", 'VINADES ', '')"; +$sql_create_table[] = "INSERT INTO " . $db_config['prefix'] . "_setup_extensions (id, type, title, is_sys, is_virtual, basename, table_prefix, version, addtime, author, note) VALUES (19, 'module', 'banners', 1, 0, 'banners', 'banners', '4.4.02 1592816400', " . NV_CURRENTTIME . ", 'VINADES ', '')"; +$sql_create_table[] = "INSERT INTO " . $db_config['prefix'] . "_setup_extensions (id, type, title, is_sys, is_virtual, basename, table_prefix, version, addtime, author, note) VALUES (20, 'module', 'contact', 0, 1, 'contact', 'contact', '4.4.02 1592816400', " . NV_CURRENTTIME . ", 'VINADES ', '')"; +$sql_create_table[] = "INSERT INTO " . $db_config['prefix'] . "_setup_extensions (id, type, title, is_sys, is_virtual, basename, table_prefix, version, addtime, author, note) VALUES (1, 'module', 'news', 0, 1, 'news', 'news', '4.4.02 1592816400', " . NV_CURRENTTIME . ", 'VINADES ', '')"; +$sql_create_table[] = "INSERT INTO " . $db_config['prefix'] . "_setup_extensions (id, type, title, is_sys, is_virtual, basename, table_prefix, version, addtime, author, note) VALUES (21, 'module', 'voting', 0, 0, 'voting', 'voting', '4.4.02 1592816400', " . NV_CURRENTTIME . ", 'VINADES ', '')"; +$sql_create_table[] = "INSERT INTO " . $db_config['prefix'] . "_setup_extensions (id, type, title, is_sys, is_virtual, basename, table_prefix, version, addtime, author, note) VALUES (22, 'module', 'forum', 0, 0, 'forum', 'forum', '4.4.02 1592816400', " . NV_CURRENTTIME . ", 'VINADES ', '')"; +$sql_create_table[] = "INSERT INTO " . $db_config['prefix'] . "_setup_extensions (id, type, title, is_sys, is_virtual, basename, table_prefix, version, addtime, author, note) VALUES (284, 'module', 'seek', 1, 0, 'seek', 'seek', '4.4.02 1592816400', " . NV_CURRENTTIME . ", 'VINADES ', '')"; +$sql_create_table[] = "INSERT INTO " . $db_config['prefix'] . "_setup_extensions (id, type, title, is_sys, is_virtual, basename, table_prefix, version, addtime, author, note) VALUES (24, 'module', 'users', 1, 1, 'users', 'users', '4.4.02 1592816400', " . NV_CURRENTTIME . ", 'VINADES ', '')"; +$sql_create_table[] = "INSERT INTO " . $db_config['prefix'] . "_setup_extensions (id, type, title, is_sys, is_virtual, basename, table_prefix, version, addtime, author, note) VALUES (27, 'module', 'statistics', 0, 0, 'statistics', 'statistics', '4.4.02 1592816400', " . NV_CURRENTTIME . ", 'VINADES ', '')"; +$sql_create_table[] = "INSERT INTO " . $db_config['prefix'] . "_setup_extensions (id, type, title, is_sys, is_virtual, basename, table_prefix, version, addtime, author, note) VALUES (29, 'module', 'menu', 0, 0, 'menu', 'menu', '4.4.02 1592816400', " . NV_CURRENTTIME . ", 'VINADES ', '')"; +$sql_create_table[] = "INSERT INTO " . $db_config['prefix'] . "_setup_extensions (id, type, title, is_sys, is_virtual, basename, table_prefix, version, addtime, author, note) VALUES (283, 'module', 'feeds', 1, 0, 'feeds', 'feeds', '4.4.02 1592816400', " . NV_CURRENTTIME . ", 'VINADES ', '')"; +$sql_create_table[] = "INSERT INTO " . $db_config['prefix'] . "_setup_extensions (id, type, title, is_sys, is_virtual, basename, table_prefix, version, addtime, author, note) VALUES (282, 'module', 'page', 1, 1, 'page', 'page', '4.4.02 1592816400', " . NV_CURRENTTIME . ", 'VINADES ', '')"; +$sql_create_table[] = "INSERT INTO " . $db_config['prefix'] . "_setup_extensions (id, type, title, is_sys, is_virtual, basename, table_prefix, version, addtime, author, note) VALUES (281, 'module', 'comment', 1, 0, 'comment', 'comment', '4.4.02 1592816400', " . NV_CURRENTTIME . ", 'VINADES ', '')"; +$sql_create_table[] = "INSERT INTO " . $db_config['prefix'] . "_setup_extensions (id, type, title, is_sys, is_virtual, basename, table_prefix, version, addtime, author, note) VALUES (312, 'module', 'freecontent', 0, 1, 'freecontent', 'freecontent', '4.4.02 1592816400', " . NV_CURRENTTIME . ", 'VINADES ', '')"; +$sql_create_table[] = "INSERT INTO " . $db_config['prefix'] . "_setup_extensions (id, type, title, is_sys, is_virtual, basename, table_prefix, version, addtime, author, note) VALUES (327, 'module', 'two-step-verification', 1, 0, 'two-step-verification', 'two_step_verification', '4.4.02 1592816400', " . NV_CURRENTTIME . ", 'VINADES ', '')"; +$sql_create_table[] = "INSERT INTO " . $db_config['prefix'] . "_setup_extensions (id, type, title, is_sys, is_virtual, basename, table_prefix, version, addtime, author, note) VALUES (307, 'theme', 'default', 0, 0, 'default', 'default', '4.4.02 1592816400', " . NV_CURRENTTIME . ", 'VINADES ', '')"; +$sql_create_table[] = "INSERT INTO " . $db_config['prefix'] . "_setup_extensions (id, type, title, is_sys, is_virtual, basename, table_prefix, version, addtime, author, note) VALUES (311, 'theme', 'mobile_default', 0, 0, 'mobile_default', 'mobile_default', '4.4.02 1592816400', " . NV_CURRENTTIME . ", 'VINADES ', '')"; $sql_create_table[] = "INSERT INTO " . $db_config['prefix'] . "_banners_plans (id, blang, title, description, form, width, height, act, require_image, uploadtype) VALUES (1, '', 'Quang cao giua trang', '', 'sequential', 575, 72, 1, 1, 'images')"; $sql_create_table[] = "INSERT INTO " . $db_config['prefix'] . "_banners_plans (id, blang, title, description, form, width, height, act, require_image, uploadtype) VALUES (2, '', 'Quang cao trai', '', 'sequential', 212, 800, 1, 1, 'images')"; diff --git a/install/samples/data_egovernment.php b/install/samples/data_egovernment.php index 79d5dc95b..8b3bcbd5d 100644 --- a/install/samples/data_egovernment.php +++ b/install/samples/data_egovernment.php @@ -5,7 +5,7 @@ * @Author VINADES.,JSC * @Copyright (C) 2020 VINADES.,JSC. All rights reserved * @License GNU/GPL version 2 or any later version - * @Createdate Tue, 09 Jun 2020 08:40:21 GMT + * @Createdate Mon, 22 Jun 2020 07:38:43 GMT */ if (!defined('NV_MAINFILE')) { @@ -191,9 +191,9 @@ $sql_create_table[] = "REPLACE INTO `" . $db_config['prefix'] . "_config` (`lang`, `module`, `config_name`, `config_value`) VALUES ('sys', 'global', 'gzip_method', '1')"; $sql_create_table[] = "REPLACE INTO `" . $db_config['prefix'] . "_config` (`lang`, `module`, `config_name`, `config_value`) VALUES ('sys', 'global', 'authors_detail_main', '0')"; $sql_create_table[] = "REPLACE INTO `" . $db_config['prefix'] . "_config` (`lang`, `module`, `config_name`, `config_value`) VALUES ('sys', 'global', 'spadmin_add_admin', '1')"; -$sql_create_table[] = "REPLACE INTO `" . $db_config['prefix'] . "_config` (`lang`, `module`, `config_name`, `config_value`) VALUES ('sys', 'global', 'timestamp', '1591691995')"; +$sql_create_table[] = "REPLACE INTO `" . $db_config['prefix'] . "_config` (`lang`, `module`, `config_name`, `config_value`) VALUES ('sys', 'global', 'timestamp', '1592811506')"; $sql_create_table[] = "REPLACE INTO `" . $db_config['prefix'] . "_config` (`lang`, `module`, `config_name`, `config_value`) VALUES ('sys', 'global', 'captcha_type', '1')"; -$sql_create_table[] = "REPLACE INTO `" . $db_config['prefix'] . "_config` (`lang`, `module`, `config_name`, `config_value`) VALUES ('sys', 'global', 'version', '1.2.01')"; +$sql_create_table[] = "REPLACE INTO `" . $db_config['prefix'] . "_config` (`lang`, `module`, `config_name`, `config_value`) VALUES ('sys', 'global', 'version', '1.2.02')"; $sql_create_table[] = "REPLACE INTO `" . $db_config['prefix'] . "_config` (`lang`, `module`, `config_name`, `config_value`) VALUES ('sys', 'global', 'cookie_httponly', '1')"; $sql_create_table[] = "REPLACE INTO `" . $db_config['prefix'] . "_config` (`lang`, `module`, `config_name`, `config_value`) VALUES ('sys', 'global', 'admin_check_pass_time', '1800')"; $sql_create_table[] = "REPLACE INTO `" . $db_config['prefix'] . "_config` (`lang`, `module`, `config_name`, `config_value`) VALUES ('sys', 'global', 'cookie_secure', '0')"; @@ -216,6 +216,14 @@ $sql_create_table[] = "REPLACE INTO `" . $db_config['prefix'] . "_config` (`lang`, `module`, `config_name`, `config_value`) VALUES ('sys', 'global', 'recaptcha_secretkey', '')"; $sql_create_table[] = "REPLACE INTO `" . $db_config['prefix'] . "_config` (`lang`, `module`, `config_name`, `config_value`) VALUES ('sys', 'global', 'recaptcha_type', 'image')"; $sql_create_table[] = "REPLACE INTO `" . $db_config['prefix'] . "_config` (`lang`, `module`, `config_name`, `config_value`) VALUES ('sys', 'global', 'users_special', '0')"; +$sql_create_table[] = "REPLACE INTO `" . $db_config['prefix'] . "_config` (`lang`, `module`, `config_name`, `config_value`) VALUES ('sys', 'global', 'crosssite_restrict', '1')"; +$sql_create_table[] = "REPLACE INTO `" . $db_config['prefix'] . "_config` (`lang`, `module`, `config_name`, `config_value`) VALUES ('sys', 'global', 'crosssite_valid_domains', '')"; +$sql_create_table[] = "REPLACE INTO `" . $db_config['prefix'] . "_config` (`lang`, `module`, `config_name`, `config_value`) VALUES ('sys', 'global', 'crosssite_valid_ips', '')"; +$sql_create_table[] = "REPLACE INTO `" . $db_config['prefix'] . "_config` (`lang`, `module`, `config_name`, `config_value`) VALUES ('sys', 'global', 'crossadmin_restrict', '1')"; +$sql_create_table[] = "REPLACE INTO `" . $db_config['prefix'] . "_config` (`lang`, `module`, `config_name`, `config_value`) VALUES ('sys', 'global', 'crossadmin_valid_domains', '')"; +$sql_create_table[] = "REPLACE INTO `" . $db_config['prefix'] . "_config` (`lang`, `module`, `config_name`, `config_value`) VALUES ('sys', 'global', 'crossadmin_valid_ips', '')"; +$sql_create_table[] = "REPLACE INTO `" . $db_config['prefix'] . "_config` (`lang`, `module`, `config_name`, `config_value`) VALUES ('sys', 'global', 'domains_whitelist', '[\"youtube.com\",\"www.youtube.com\",\"google.com\",\"www.google.com\",\"drive.google.com\"]')"; +$sql_create_table[] = "REPLACE INTO `" . $db_config['prefix'] . "_config` (`lang`, `module`, `config_name`, `config_value`) VALUES ('sys', 'global', 'domains_restrict', '1')"; $sql_create_table[] = "REPLACE INTO `" . $db_config['prefix'] . "_config` (`lang`, `module`, `config_name`, `config_value`) VALUES ('sys', 'define', 'nv_gfx_width', '150')"; $sql_create_table[] = "REPLACE INTO `" . $db_config['prefix'] . "_config` (`lang`, `module`, `config_name`, `config_value`) VALUES ('sys', 'define', 'nv_gfx_height', '40')"; $sql_create_table[] = "REPLACE INTO `" . $db_config['prefix'] . "_config` (`lang`, `module`, `config_name`, `config_value`) VALUES ('sys', 'define', 'nv_max_width', '1500')"; @@ -246,7 +254,7 @@ $sql_create_table[] = "REPLACE INTO `" . $db_config['prefix'] . "_config` (`lang`, `module`, `config_name`, `config_value`) VALUES ('vi', 'global', 'autologosize3', '30')"; $sql_create_table[] = "REPLACE INTO `" . $db_config['prefix'] . "_config` (`lang`, `module`, `config_name`, `config_value`) VALUES ('vi', 'global', 'autologomod', '')"; $sql_create_table[] = "REPLACE INTO `" . $db_config['prefix'] . "_config` (`lang`, `module`, `config_name`, `config_value`) VALUES ('vi', 'global', 'name_show', '0')"; -$sql_create_table[] = "REPLACE INTO `" . $db_config['prefix'] . "_config` (`lang`, `module`, `config_name`, `config_value`) VALUES ('vi', 'global', 'cronjobs_next_time', '1591692154')"; +$sql_create_table[] = "REPLACE INTO `" . $db_config['prefix'] . "_config` (`lang`, `module`, `config_name`, `config_value`) VALUES ('vi', 'global', 'cronjobs_next_time', '1592811719')"; $sql_create_table[] = "REPLACE INTO `" . $db_config['prefix'] . "_config` (`lang`, `module`, `config_name`, `config_value`) VALUES ('vi', 'global', 'disable_site_content', 'Vì lý do kỹ thuật website tạm ngưng hoạt động. Thành thật xin lỗi các bạn vì sự bất tiện này!')"; $sql_create_table[] = "REPLACE INTO `" . $db_config['prefix'] . "_config` (`lang`, `module`, `config_name`, `config_value`) VALUES ('vi', 'seotools', 'prcservice', '')"; $sql_create_table[] = "REPLACE INTO `" . $db_config['prefix'] . "_config` (`lang`, `module`, `config_name`, `config_value`) VALUES ('vi', 'about', 'auto_postcomm', '1')"; @@ -394,14 +402,6 @@ $sql_create_table[] = "REPLACE INTO `" . $db_config['prefix'] . "_config` (`lang`, `module`, `config_name`, `config_value`) VALUES ('vi', 'laws', 'alloweditorcomm', '0')"; $sql_create_table[] = "REPLACE INTO `" . $db_config['prefix'] . "_config` (`lang`, `module`, `config_name`, `config_value`) VALUES ('vi', 'opinions', 'allowattachcomm', '1')"; $sql_create_table[] = "REPLACE INTO `" . $db_config['prefix'] . "_config` (`lang`, `module`, `config_name`, `config_value`) VALUES ('vi', 'opinions', 'alloweditorcomm', '1')"; -$sql_create_table[] = "REPLACE INTO `" . $db_config['prefix'] . "_config` (`lang`, `module`, `config_name`, `config_value`) VALUES ('sys', 'global', 'domains_restrict', '1')"; -$sql_create_table[] = "REPLACE INTO `" . $db_config['prefix'] . "_config` (`lang`, `module`, `config_name`, `config_value`) VALUES ('sys', 'global', 'domains_whitelist', '[\"youtube.com\",\"www.youtube.com\",\"google.com\",\"www.google.com\",\"drive.google.com\"]')"; -$sql_create_table[] = "REPLACE INTO `" . $db_config['prefix'] . "_config` (`lang`, `module`, `config_name`, `config_value`) VALUES ('sys', 'global', 'crosssite_restrict', '1')"; -$sql_create_table[] = "REPLACE INTO `" . $db_config['prefix'] . "_config` (`lang`, `module`, `config_name`, `config_value`) VALUES ('sys', 'global', 'crosssite_valid_domains', '')"; -$sql_create_table[] = "REPLACE INTO `" . $db_config['prefix'] . "_config` (`lang`, `module`, `config_name`, `config_value`) VALUES ('sys', 'global', 'crosssite_valid_ips', '')"; -$sql_create_table[] = "REPLACE INTO `" . $db_config['prefix'] . "_config` (`lang`, `module`, `config_name`, `config_value`) VALUES ('sys', 'global', 'crossadmin_restrict', '1')"; -$sql_create_table[] = "REPLACE INTO `" . $db_config['prefix'] . "_config` (`lang`, `module`, `config_name`, `config_value`) VALUES ('sys', 'global', 'crossadmin_valid_domains', '')"; -$sql_create_table[] = "REPLACE INTO `" . $db_config['prefix'] . "_config` (`lang`, `module`, `config_name`, `config_value`) VALUES ('sys', 'global', 'crossadmin_valid_ips', '')"; $sql_create_table[] = "DROP TABLE IF EXISTS `" . $db_config['prefix'] . "_cronjobs`"; $sql_create_table[] = "CREATE TABLE `" . $db_config['prefix'] . "_cronjobs` ( @@ -421,15 +421,15 @@ PRIMARY KEY (`id`), KEY `is_sys` (`is_sys`) ) ENGINE=MyISAM AUTO_INCREMENT=10 DEFAULT CHARSET=utf8"; -$sql_create_table[] = "INSERT INTO `" . $db_config['prefix'] . "_cronjobs` (`id`, `start_time`, `inter_val`, `inter_val_type`, `run_file`, `run_func`, `params`, `del`, `is_sys`, `act`, `last_time`, `last_result`, `vi_cron_name`) VALUES (1, 1546504163, 5, 0, 'online_expired_del.php', 'cron_online_expired_del', '', 0, 1, 1, 1591691854, 1, 'Xóa các dòng ghi trạng thái online đã cũ trong CSDL')"; -$sql_create_table[] = "INSERT INTO `" . $db_config['prefix'] . "_cronjobs` (`id`, `start_time`, `inter_val`, `inter_val_type`, `run_file`, `run_func`, `params`, `del`, `is_sys`, `act`, `last_time`, `last_result`, `vi_cron_name`) VALUES (2, 1546504163, 1440, 0, 'dump_autobackup.php', 'cron_dump_autobackup', '', 0, 1, 1, 1591691854, 1, 'Tự động lưu CSDL')"; -$sql_create_table[] = "INSERT INTO `" . $db_config['prefix'] . "_cronjobs` (`id`, `start_time`, `inter_val`, `inter_val_type`, `run_file`, `run_func`, `params`, `del`, `is_sys`, `act`, `last_time`, `last_result`, `vi_cron_name`) VALUES (3, 1546504163, 60, 0, 'temp_download_destroy.php', 'cron_auto_del_temp_download', '', 0, 1, 1, 1591691854, 1, 'Xóa các file tạm trong thư mục tmp')"; -$sql_create_table[] = "INSERT INTO `" . $db_config['prefix'] . "_cronjobs` (`id`, `start_time`, `inter_val`, `inter_val_type`, `run_file`, `run_func`, `params`, `del`, `is_sys`, `act`, `last_time`, `last_result`, `vi_cron_name`) VALUES (4, 1546504163, 30, 0, 'ip_logs_destroy.php', 'cron_del_ip_logs', '', 0, 1, 1, 1591691854, 1, 'Xóa IP log files, Xóa các file nhật ký truy cập')"; -$sql_create_table[] = "INSERT INTO `" . $db_config['prefix'] . "_cronjobs` (`id`, `start_time`, `inter_val`, `inter_val_type`, `run_file`, `run_func`, `params`, `del`, `is_sys`, `act`, `last_time`, `last_result`, `vi_cron_name`) VALUES (5, 1546504163, 1440, 0, 'error_log_destroy.php', 'cron_auto_del_error_log', '', 0, 1, 1, 1591691854, 1, 'Xóa các file error_log quá hạn')"; +$sql_create_table[] = "INSERT INTO `" . $db_config['prefix'] . "_cronjobs` (`id`, `start_time`, `inter_val`, `inter_val_type`, `run_file`, `run_func`, `params`, `del`, `is_sys`, `act`, `last_time`, `last_result`, `vi_cron_name`) VALUES (1, 1546504163, 5, 0, 'online_expired_del.php', 'cron_online_expired_del', '', 0, 1, 1, 1592811419, 1, 'Xóa các dòng ghi trạng thái online đã cũ trong CSDL')"; +$sql_create_table[] = "INSERT INTO `" . $db_config['prefix'] . "_cronjobs` (`id`, `start_time`, `inter_val`, `inter_val_type`, `run_file`, `run_func`, `params`, `del`, `is_sys`, `act`, `last_time`, `last_result`, `vi_cron_name`) VALUES (2, 1546504163, 1440, 0, 'dump_autobackup.php', 'cron_dump_autobackup', '', 0, 1, 1, 1592810097, 1, 'Tự động lưu CSDL')"; +$sql_create_table[] = "INSERT INTO `" . $db_config['prefix'] . "_cronjobs` (`id`, `start_time`, `inter_val`, `inter_val_type`, `run_file`, `run_func`, `params`, `del`, `is_sys`, `act`, `last_time`, `last_result`, `vi_cron_name`) VALUES (3, 1546504163, 60, 0, 'temp_download_destroy.php', 'cron_auto_del_temp_download', '', 0, 1, 1, 1592810097, 1, 'Xóa các file tạm trong thư mục tmp')"; +$sql_create_table[] = "INSERT INTO `" . $db_config['prefix'] . "_cronjobs` (`id`, `start_time`, `inter_val`, `inter_val_type`, `run_file`, `run_func`, `params`, `del`, `is_sys`, `act`, `last_time`, `last_result`, `vi_cron_name`) VALUES (4, 1546504163, 30, 0, 'ip_logs_destroy.php', 'cron_del_ip_logs', '', 0, 1, 1, 1592810097, 1, 'Xóa IP log files, Xóa các file nhật ký truy cập')"; +$sql_create_table[] = "INSERT INTO `" . $db_config['prefix'] . "_cronjobs` (`id`, `start_time`, `inter_val`, `inter_val_type`, `run_file`, `run_func`, `params`, `del`, `is_sys`, `act`, `last_time`, `last_result`, `vi_cron_name`) VALUES (5, 1546504163, 1440, 0, 'error_log_destroy.php', 'cron_auto_del_error_log', '', 0, 1, 1, 1592810097, 1, 'Xóa các file error_log quá hạn')"; $sql_create_table[] = "INSERT INTO `" . $db_config['prefix'] . "_cronjobs` (`id`, `start_time`, `inter_val`, `inter_val_type`, `run_file`, `run_func`, `params`, `del`, `is_sys`, `act`, `last_time`, `last_result`, `vi_cron_name`) VALUES (6, 1546504163, 360, 0, 'error_log_sendmail.php', 'cron_auto_sendmail_error_log', '', 0, 1, 0, 0, 0, 'Gửi email các thông báo lỗi cho admin')"; -$sql_create_table[] = "INSERT INTO `" . $db_config['prefix'] . "_cronjobs` (`id`, `start_time`, `inter_val`, `inter_val_type`, `run_file`, `run_func`, `params`, `del`, `is_sys`, `act`, `last_time`, `last_result`, `vi_cron_name`) VALUES (7, 1546504163, 60, 0, 'ref_expired_del.php', 'cron_ref_expired_del', '', 0, 1, 1, 1591691854, 1, 'Xóa các referer quá hạn')"; -$sql_create_table[] = "INSERT INTO `" . $db_config['prefix'] . "_cronjobs` (`id`, `start_time`, `inter_val`, `inter_val_type`, `run_file`, `run_func`, `params`, `del`, `is_sys`, `act`, `last_time`, `last_result`, `vi_cron_name`) VALUES (8, 1546504163, 60, 0, 'check_version.php', 'cron_auto_check_version', '', 0, 1, 1, 1591691854, 1, 'Kiểm tra phiên bản NukeViet')"; -$sql_create_table[] = "INSERT INTO `" . $db_config['prefix'] . "_cronjobs` (`id`, `start_time`, `inter_val`, `inter_val_type`, `run_file`, `run_func`, `params`, `del`, `is_sys`, `act`, `last_time`, `last_result`, `vi_cron_name`) VALUES (9, 1546504163, 1440, 0, 'notification_autodel.php', 'cron_notification_autodel', '', 0, 1, 1, 1591691854, 1, 'Xóa thông báo cũ')"; +$sql_create_table[] = "INSERT INTO `" . $db_config['prefix'] . "_cronjobs` (`id`, `start_time`, `inter_val`, `inter_val_type`, `run_file`, `run_func`, `params`, `del`, `is_sys`, `act`, `last_time`, `last_result`, `vi_cron_name`) VALUES (7, 1546504163, 60, 0, 'ref_expired_del.php', 'cron_ref_expired_del', '', 0, 1, 1, 1592810097, 1, 'Xóa các referer quá hạn')"; +$sql_create_table[] = "INSERT INTO `" . $db_config['prefix'] . "_cronjobs` (`id`, `start_time`, `inter_val`, `inter_val_type`, `run_file`, `run_func`, `params`, `del`, `is_sys`, `act`, `last_time`, `last_result`, `vi_cron_name`) VALUES (8, 1546504163, 60, 0, 'check_version.php', 'cron_auto_check_version', '', 0, 1, 1, 1592810097, 1, 'Kiểm tra phiên bản NukeViet')"; +$sql_create_table[] = "INSERT INTO `" . $db_config['prefix'] . "_cronjobs` (`id`, `start_time`, `inter_val`, `inter_val_type`, `run_file`, `run_func`, `params`, `del`, `is_sys`, `act`, `last_time`, `last_result`, `vi_cron_name`) VALUES (9, 1546504163, 1440, 0, 'notification_autodel.php', 'cron_notification_autodel', '', 0, 1, 1, 1592810097, 1, 'Xóa thông báo cũ')"; $sql_create_table[] = "DROP TABLE IF EXISTS `" . $db_config['prefix'] . "_extension_files`"; $sql_create_table[] = "CREATE TABLE `" . $db_config['prefix'] . "_extension_files` ( @@ -530,26 +530,26 @@ KEY `id` (`id`), KEY `type` (`type`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8"; -$sql_create_table[] = "INSERT INTO `" . $db_config['prefix'] . "_setup_extensions` (`id`, `type`, `title`, `is_sys`, `is_virtual`, `basename`, `table_prefix`, `version`, `addtime`, `author`, `note`) VALUES (0, 'module', 'siteterms', 0, 0, 'page', 'siteterms', '4.4.01 1592038800', 1546504163, 'VINADES (contact@vinades.vn)', '')"; -$sql_create_table[] = "INSERT INTO `" . $db_config['prefix'] . "_setup_extensions` (`id`, `type`, `title`, `is_sys`, `is_virtual`, `basename`, `table_prefix`, `version`, `addtime`, `author`, `note`) VALUES (19, 'module', 'banners', 1, 0, 'banners', 'banners', '4.4.01 1592038800', 1546504163, 'VINADES (contact@vinades.vn)', '')"; -$sql_create_table[] = "INSERT INTO `" . $db_config['prefix'] . "_setup_extensions` (`id`, `type`, `title`, `is_sys`, `is_virtual`, `basename`, `table_prefix`, `version`, `addtime`, `author`, `note`) VALUES (20, 'module', 'contact', 0, 1, 'contact', 'contact', '4.4.01 1592038800', 1546504163, 'VINADES (contact@vinades.vn)', '')"; -$sql_create_table[] = "INSERT INTO `" . $db_config['prefix'] . "_setup_extensions` (`id`, `type`, `title`, `is_sys`, `is_virtual`, `basename`, `table_prefix`, `version`, `addtime`, `author`, `note`) VALUES (1, 'module', 'news', 0, 1, 'news', 'news', '4.4.01 1592038800', 1546504163, 'VINADES (contact@vinades.vn)', '')"; -$sql_create_table[] = "INSERT INTO `" . $db_config['prefix'] . "_setup_extensions` (`id`, `type`, `title`, `is_sys`, `is_virtual`, `basename`, `table_prefix`, `version`, `addtime`, `author`, `note`) VALUES (21, 'module', 'voting', 0, 0, 'voting', 'voting', '4.4.01 1592038800', 1546504163, 'VINADES (contact@vinades.vn)', '')"; +$sql_create_table[] = "INSERT INTO `" . $db_config['prefix'] . "_setup_extensions` (`id`, `type`, `title`, `is_sys`, `is_virtual`, `basename`, `table_prefix`, `version`, `addtime`, `author`, `note`) VALUES (0, 'module', 'siteterms', 0, 0, 'page', 'siteterms', '4.4.02 1592816400', 1546504163, 'VINADES (contact@vinades.vn)', '')"; +$sql_create_table[] = "INSERT INTO `" . $db_config['prefix'] . "_setup_extensions` (`id`, `type`, `title`, `is_sys`, `is_virtual`, `basename`, `table_prefix`, `version`, `addtime`, `author`, `note`) VALUES (19, 'module', 'banners', 1, 0, 'banners', 'banners', '4.4.02 1592816400', 1546504163, 'VINADES (contact@vinades.vn)', '')"; +$sql_create_table[] = "INSERT INTO `" . $db_config['prefix'] . "_setup_extensions` (`id`, `type`, `title`, `is_sys`, `is_virtual`, `basename`, `table_prefix`, `version`, `addtime`, `author`, `note`) VALUES (20, 'module', 'contact', 0, 1, 'contact', 'contact', '4.4.02 1592816400', 1546504163, 'VINADES (contact@vinades.vn)', '')"; +$sql_create_table[] = "INSERT INTO `" . $db_config['prefix'] . "_setup_extensions` (`id`, `type`, `title`, `is_sys`, `is_virtual`, `basename`, `table_prefix`, `version`, `addtime`, `author`, `note`) VALUES (1, 'module', 'news', 0, 1, 'news', 'news', '4.4.02 1592816400', 1546504163, 'VINADES (contact@vinades.vn)', '')"; +$sql_create_table[] = "INSERT INTO `" . $db_config['prefix'] . "_setup_extensions` (`id`, `type`, `title`, `is_sys`, `is_virtual`, `basename`, `table_prefix`, `version`, `addtime`, `author`, `note`) VALUES (21, 'module', 'voting', 0, 0, 'voting', 'voting', '4.4.02 1592816400', 1546504163, 'VINADES (contact@vinades.vn)', '')"; $sql_create_table[] = "INSERT INTO `" . $db_config['prefix'] . "_setup_extensions` (`id`, `type`, `title`, `is_sys`, `is_virtual`, `basename`, `table_prefix`, `version`, `addtime`, `author`, `note`) VALUES (28, 'module', 'faq', 0, 1, 'faq', 'faq', '4.3.04 1546504163', 1498555548, 'VINADES (contact@vinades.vn)', '')"; -$sql_create_table[] = "INSERT INTO `" . $db_config['prefix'] . "_setup_extensions` (`id`, `type`, `title`, `is_sys`, `is_virtual`, `basename`, `table_prefix`, `version`, `addtime`, `author`, `note`) VALUES (284, 'module', 'seek', 1, 0, 'seek', 'seek', '4.4.01 1592038800', 1546504163, 'VINADES (contact@vinades.vn)', '')"; -$sql_create_table[] = "INSERT INTO `" . $db_config['prefix'] . "_setup_extensions` (`id`, `type`, `title`, `is_sys`, `is_virtual`, `basename`, `table_prefix`, `version`, `addtime`, `author`, `note`) VALUES (24, 'module', 'users', 1, 1, 'users', 'users', '4.4.01 1592038800', 1546504163, 'VINADES (contact@vinades.vn)', '')"; -$sql_create_table[] = "INSERT INTO `" . $db_config['prefix'] . "_setup_extensions` (`id`, `type`, `title`, `is_sys`, `is_virtual`, `basename`, `table_prefix`, `version`, `addtime`, `author`, `note`) VALUES (27, 'module', 'statistics', 0, 0, 'statistics', 'statistics', '4.4.01 1592038800', 1546504163, 'VINADES (contact@vinades.vn)', '')"; -$sql_create_table[] = "INSERT INTO `" . $db_config['prefix'] . "_setup_extensions` (`id`, `type`, `title`, `is_sys`, `is_virtual`, `basename`, `table_prefix`, `version`, `addtime`, `author`, `note`) VALUES (29, 'module', 'menu', 0, 0, 'menu', 'menu', '4.4.01 1592038800', 1546504163, 'VINADES (contact@vinades.vn)', '')"; -$sql_create_table[] = "INSERT INTO `" . $db_config['prefix'] . "_setup_extensions` (`id`, `type`, `title`, `is_sys`, `is_virtual`, `basename`, `table_prefix`, `version`, `addtime`, `author`, `note`) VALUES (283, 'module', 'feeds', 1, 0, 'feeds', 'feeds', '4.4.01 1592038800', 1546504163, 'VINADES (contact@vinades.vn)', '')"; -$sql_create_table[] = "INSERT INTO `" . $db_config['prefix'] . "_setup_extensions` (`id`, `type`, `title`, `is_sys`, `is_virtual`, `basename`, `table_prefix`, `version`, `addtime`, `author`, `note`) VALUES (282, 'module', 'page', 1, 1, 'page', 'page', '4.4.01 1592038800', 1546504163, 'VINADES (contact@vinades.vn)', '')"; -$sql_create_table[] = "INSERT INTO `" . $db_config['prefix'] . "_setup_extensions` (`id`, `type`, `title`, `is_sys`, `is_virtual`, `basename`, `table_prefix`, `version`, `addtime`, `author`, `note`) VALUES (281, 'module', 'comment', 1, 0, 'comment', 'comment', '4.4.01 1592038800', 1546504163, 'VINADES (contact@vinades.vn)', '')"; -$sql_create_table[] = "INSERT INTO `" . $db_config['prefix'] . "_setup_extensions` (`id`, `type`, `title`, `is_sys`, `is_virtual`, `basename`, `table_prefix`, `version`, `addtime`, `author`, `note`) VALUES (312, 'module', 'freecontent', 0, 1, 'freecontent', 'freecontent', '4.4.01 1592038800', 1546504163, 'VINADES (contact@vinades.vn)', '')"; -$sql_create_table[] = "INSERT INTO `" . $db_config['prefix'] . "_setup_extensions` (`id`, `type`, `title`, `is_sys`, `is_virtual`, `basename`, `table_prefix`, `version`, `addtime`, `author`, `note`) VALUES (327, 'module', 'two-step-verification', 1, 0, 'two-step-verification', 'two_step_verification', '4.4.01 1592038800', 1546504163, 'VINADES (contact@vinades.vn)', '')"; -$sql_create_table[] = "INSERT INTO `" . $db_config['prefix'] . "_setup_extensions` (`id`, `type`, `title`, `is_sys`, `is_virtual`, `basename`, `table_prefix`, `version`, `addtime`, `author`, `note`) VALUES (307, 'theme', 'default', 0, 0, 'default', 'default', '4.4.01 1592038800', 1546504163, 'VINADES (contact@vinades.vn)', '')"; -$sql_create_table[] = "INSERT INTO `" . $db_config['prefix'] . "_setup_extensions` (`id`, `type`, `title`, `is_sys`, `is_virtual`, `basename`, `table_prefix`, `version`, `addtime`, `author`, `note`) VALUES (311, 'theme', 'mobile_default', 0, 0, 'mobile_default', 'mobile_default', '4.4.01 1592038800', 1546504163, 'VINADES (contact@vinades.vn)', '')"; +$sql_create_table[] = "INSERT INTO `" . $db_config['prefix'] . "_setup_extensions` (`id`, `type`, `title`, `is_sys`, `is_virtual`, `basename`, `table_prefix`, `version`, `addtime`, `author`, `note`) VALUES (284, 'module', 'seek', 1, 0, 'seek', 'seek', '4.4.02 1592816400', 1546504163, 'VINADES (contact@vinades.vn)', '')"; +$sql_create_table[] = "INSERT INTO `" . $db_config['prefix'] . "_setup_extensions` (`id`, `type`, `title`, `is_sys`, `is_virtual`, `basename`, `table_prefix`, `version`, `addtime`, `author`, `note`) VALUES (24, 'module', 'users', 1, 1, 'users', 'users', '4.4.02 1592816400', 1546504163, 'VINADES (contact@vinades.vn)', '')"; +$sql_create_table[] = "INSERT INTO `" . $db_config['prefix'] . "_setup_extensions` (`id`, `type`, `title`, `is_sys`, `is_virtual`, `basename`, `table_prefix`, `version`, `addtime`, `author`, `note`) VALUES (27, 'module', 'statistics', 0, 0, 'statistics', 'statistics', '4.4.02 1592816400', 1546504163, 'VINADES (contact@vinades.vn)', '')"; +$sql_create_table[] = "INSERT INTO `" . $db_config['prefix'] . "_setup_extensions` (`id`, `type`, `title`, `is_sys`, `is_virtual`, `basename`, `table_prefix`, `version`, `addtime`, `author`, `note`) VALUES (29, 'module', 'menu', 0, 0, 'menu', 'menu', '4.4.02 1592816400', 1546504163, 'VINADES (contact@vinades.vn)', '')"; +$sql_create_table[] = "INSERT INTO `" . $db_config['prefix'] . "_setup_extensions` (`id`, `type`, `title`, `is_sys`, `is_virtual`, `basename`, `table_prefix`, `version`, `addtime`, `author`, `note`) VALUES (283, 'module', 'feeds', 1, 0, 'feeds', 'feeds', '4.4.02 1592816400', 1546504163, 'VINADES (contact@vinades.vn)', '')"; +$sql_create_table[] = "INSERT INTO `" . $db_config['prefix'] . "_setup_extensions` (`id`, `type`, `title`, `is_sys`, `is_virtual`, `basename`, `table_prefix`, `version`, `addtime`, `author`, `note`) VALUES (282, 'module', 'page', 1, 1, 'page', 'page', '4.4.02 1592816400', 1546504163, 'VINADES (contact@vinades.vn)', '')"; +$sql_create_table[] = "INSERT INTO `" . $db_config['prefix'] . "_setup_extensions` (`id`, `type`, `title`, `is_sys`, `is_virtual`, `basename`, `table_prefix`, `version`, `addtime`, `author`, `note`) VALUES (281, 'module', 'comment', 1, 0, 'comment', 'comment', '4.4.02 1592816400', 1546504163, 'VINADES (contact@vinades.vn)', '')"; +$sql_create_table[] = "INSERT INTO `" . $db_config['prefix'] . "_setup_extensions` (`id`, `type`, `title`, `is_sys`, `is_virtual`, `basename`, `table_prefix`, `version`, `addtime`, `author`, `note`) VALUES (312, 'module', 'freecontent', 0, 1, 'freecontent', 'freecontent', '4.4.02 1592816400', 1546504163, 'VINADES (contact@vinades.vn)', '')"; +$sql_create_table[] = "INSERT INTO `" . $db_config['prefix'] . "_setup_extensions` (`id`, `type`, `title`, `is_sys`, `is_virtual`, `basename`, `table_prefix`, `version`, `addtime`, `author`, `note`) VALUES (327, 'module', 'two-step-verification', 1, 0, 'two-step-verification', 'two_step_verification', '4.4.02 1592816400', 1546504163, 'VINADES (contact@vinades.vn)', '')"; +$sql_create_table[] = "INSERT INTO `" . $db_config['prefix'] . "_setup_extensions` (`id`, `type`, `title`, `is_sys`, `is_virtual`, `basename`, `table_prefix`, `version`, `addtime`, `author`, `note`) VALUES (307, 'theme', 'default', 0, 0, 'default', 'default', '4.4.02 1592816400', 1546504163, 'VINADES (contact@vinades.vn)', '')"; +$sql_create_table[] = "INSERT INTO `" . $db_config['prefix'] . "_setup_extensions` (`id`, `type`, `title`, `is_sys`, `is_virtual`, `basename`, `table_prefix`, `version`, `addtime`, `author`, `note`) VALUES (311, 'theme', 'mobile_default', 0, 0, 'mobile_default', 'mobile_default', '4.4.02 1592816400', 1546504163, 'VINADES (contact@vinades.vn)', '')"; $sql_create_table[] = "INSERT INTO `" . $db_config['prefix'] . "_setup_extensions` (`id`, `type`, `title`, `is_sys`, `is_virtual`, `basename`, `table_prefix`, `version`, `addtime`, `author`, `note`) VALUES (254, 'module', 'laws', 0, 1, 'laws', 'laws', '4.3.04 1546504163', 1498555548, 'VINADES (contact@vinades.vn)', 'Modules văn bản pháp luật')"; $sql_create_table[] = "INSERT INTO `" . $db_config['prefix'] . "_setup_extensions` (`id`, `type`, `title`, `is_sys`, `is_virtual`, `basename`, `table_prefix`, `version`, `addtime`, `author`, `note`) VALUES (391, 'theme', 'egov', 0, 0, 'egov', 'egov', '4.3.04 1546504163', 1510912800, 'VINADES (contact@vinades.vn)', 'egov')"; -$sql_create_table[] = "INSERT INTO `" . $db_config['prefix'] . "_setup_extensions` (`id`, `type`, `title`, `is_sys`, `is_virtual`, `basename`, `table_prefix`, `version`, `addtime`, `author`, `note`) VALUES (0, 'module', 'about', 0, 0, 'page', 'about', '4.4.01 1592038800', 1500862887, '', '')"; +$sql_create_table[] = "INSERT INTO `" . $db_config['prefix'] . "_setup_extensions` (`id`, `type`, `title`, `is_sys`, `is_virtual`, `basename`, `table_prefix`, `version`, `addtime`, `author`, `note`) VALUES (0, 'module', 'about', 0, 0, 'page', 'about', '4.4.02 1592816400', 1500862887, '', '')"; $sql_create_table[] = "INSERT INTO `" . $db_config['prefix'] . "_setup_extensions` (`id`, `type`, `title`, `is_sys`, `is_virtual`, `basename`, `table_prefix`, `version`, `addtime`, `author`, `note`) VALUES (374, 'module', 'organs', 0, 1, 'organs', 'organs', '4.3.04 1546504163', 1506565060, 'VINADES (contact@vinades.vn)', '')"; $sql_create_table[] = "INSERT INTO `" . $db_config['prefix'] . "_setup_extensions` (`id`, `type`, `title`, `is_sys`, `is_virtual`, `basename`, `table_prefix`, `version`, `addtime`, `author`, `note`) VALUES (0, 'module', 'co-cau-to-chuc', 0, 0, 'organs', 'co_cau_to_chuc', '4.3.04 1546504163', 1506565068, '', '')"; $sql_create_table[] = "INSERT INTO `" . $db_config['prefix'] . "_setup_extensions` (`id`, `type`, `title`, `is_sys`, `is_virtual`, `basename`, `table_prefix`, `version`, `addtime`, `author`, `note`) VALUES (0, 'module', 'opinions', 0, 0, 'laws', 'opinions', '4.3.04 1546504163', 1506570465, '', '')"; diff --git a/install/tpl/step1.tpl b/install/tpl/step1.tpl index e096e0dd4..040d9686a 100644 --- a/install/tpl/step1.tpl +++ b/install/tpl/step1.tpl @@ -98,6 +98,11 @@

    {LANG.thanks_list_member_other_version}:

    +
    {LANG.thanks_other_version} 4.4.02
    + VINADES.,JSC (3 commits), + hoaquynhtim99 (2 commits), + anhtunguyen (1 commits) +

    {LANG.thanks_other_version} 4.4.01
    VINADES.,JSC (41 commits), hoaquynhtim99 (5 commits), diff --git a/modules/banners/version.php b/modules/banners/version.php index 11f75115f..307cd3f14 100755 --- a/modules/banners/version.php +++ b/modules/banners/version.php @@ -17,8 +17,8 @@ 'modfuncs' => 'main, addads, stats', 'is_sysmod' => 1, 'virtual' => 0, - 'version' => '4.4.01', - 'date' => 'Saturday, June 13, 2020 16:00:00 GMT+07:00', + 'version' => '4.4.02', + 'date' => 'Monday, June 22, 2020 16:00:00 GMT+07:00', 'author' => 'VINADES ', 'note' => '', 'uploads_dir' => array( diff --git a/modules/comment/version.php b/modules/comment/version.php index 5bfc1cebd..a2152a4db 100755 --- a/modules/comment/version.php +++ b/modules/comment/version.php @@ -18,8 +18,8 @@ 'submenu' => '', 'is_sysmod' => 0, 'virtual' => 0, - 'version' => '4.4.01', - 'date' => 'Saturday, June 13, 2020 16:00:00 GMT+07:00', + 'version' => '4.4.02', + 'date' => 'Monday, June 22, 2020 16:00:00 GMT+07:00', 'author' => 'VINADES ', 'uploads_dir' => array($module_upload), 'note' => '' diff --git a/modules/contact/admin/forward.php b/modules/contact/admin/forward.php index 0eb32669e..0bbafd6f4 100644 --- a/modules/contact/admin/forward.php +++ b/modules/contact/admin/forward.php @@ -47,12 +47,12 @@ foreach ($_arr_mail as $_email) { $_email = nv_unhtmlspecialchars($_email); if (nv_check_valid_email($_email) == '') { - $mail->addAddress($_email); + $mail->addTo($_email); } } - $mail->Content($mess_content); - $mail->Subject($row['title']); + $mail->setContent($mess_content); + $mail->setSubject($row['title']); if ($mail->Send()) { $sth = $db->prepare('INSERT INTO ' . NV_PREFIXLANG . '_' . $module_data . '_reply (id, reply_content, reply_time, reply_aid) VALUES (' . $id . ', :reply_content, ' . NV_CURRENTTIME . ', ' . $admin_info['admin_id'] . ')'); $content = sprintf($lang_module['forward'], $forward_to) . '
    ' . $mess_content; diff --git a/modules/contact/admin/send.php b/modules/contact/admin/send.php index a868fb834..a1971007b 100644 --- a/modules/contact/admin/send.php +++ b/modules/contact/admin/send.php @@ -27,7 +27,7 @@ if ($nv_Request->get_int('save', 'post') == '1') { $mess_content = $nv_Request->get_editor('mess_content', '', NV_ALLOWED_HTML_TAGS); - + if (empty($post['email'])) { $error = $lang_module['error_mail_empty']; } elseif (strip_tags($mess_content) == '') { @@ -36,17 +36,17 @@ $error = $lang_module['error_title']; } else { $mail = new NukeViet\Core\Sendmail($global_config, NV_LANG_INTERFACE); - $mail->Subject($post['title']); - + $mail->setSubject($post['title']); + $_arr_mail = explode(',', $post['email']); foreach ($_arr_mail as $_email) { $_email = nv_unhtmlspecialchars($_email); if (nv_check_valid_email($_email) == '') { - $mail->addAddress($_email); + $mail->addTo($_email); } } - - $mail->Content($mess_content); + + $mail->setContent($mess_content); if ($mail->Send()) { $error = $lang_module['send_suc_send_title']; } else { diff --git a/modules/contact/version.php b/modules/contact/version.php index 5fc98387f..5fe98ff45 100755 --- a/modules/contact/version.php +++ b/modules/contact/version.php @@ -17,8 +17,8 @@ 'modfuncs' => 'main', 'is_sysmod' => 0, 'virtual' => 1, - 'version' => '4.4.01', - 'date' => 'Saturday, June 13, 2020 16:00:00 GMT+07:00', + 'version' => '4.4.02', + 'date' => 'Monday, June 22, 2020 16:00:00 GMT+07:00', 'author' => 'VINADES ', 'note' => '', 'uploads_dir' => array( diff --git a/modules/feeds/version.php b/modules/feeds/version.php index d5ed7027e..79b3d66f8 100755 --- a/modules/feeds/version.php +++ b/modules/feeds/version.php @@ -17,8 +17,8 @@ 'modfuncs' => 'main', 'is_sysmod' => 1, 'virtual' => 0, - 'version' => '4.4.01', - 'date' => 'Saturday, June 13, 2020 16:00:00 GMT+07:00', + 'version' => '4.4.02', + 'date' => 'Monday, June 22, 2020 16:00:00 GMT+07:00', 'author' => 'VINADES ', 'note' => '' ); diff --git a/modules/freecontent/version.php b/modules/freecontent/version.php index 56a9698a2..a27ea6705 100644 --- a/modules/freecontent/version.php +++ b/modules/freecontent/version.php @@ -17,8 +17,8 @@ 'modfuncs' => '', 'is_sysmod' => 0, 'virtual' => 0, - 'version' => '4.4.01', - 'date' => 'Saturday, June 13, 2020 16:00:00 GMT+07:00', + 'version' => '4.4.02', + 'date' => 'Monday, June 22, 2020 16:00:00 GMT+07:00', 'author' => 'VINADES ', 'note' => '', 'uploads_dir' => array( diff --git a/modules/menu/version.php b/modules/menu/version.php index 80f619192..284f0e5b9 100755 --- a/modules/menu/version.php +++ b/modules/menu/version.php @@ -14,8 +14,8 @@ 'submenu' => '', 'is_sysmod' => 1, 'virtual' => 0, - 'version' => '4.4.01', - 'date' => 'Saturday, June 13, 2020 16:00:00 GMT+07:00', + 'version' => '4.4.02', + 'date' => 'Monday, June 22, 2020 16:00:00 GMT+07:00', 'author' => 'VINADES ', 'note' => '', 'uploads_dir' => array( diff --git a/modules/news/version.php b/modules/news/version.php index 504c88f66..f874cb9c9 100755 --- a/modules/news/version.php +++ b/modules/news/version.php @@ -19,8 +19,8 @@ 'submenu' => 'content,rss,search', 'is_sysmod' => 0, // 1:0 => Co phai la module he thong hay khong 'virtual' => 1, // 1:0 => Co cho phep ao hao module hay khong - 'version' => '4.4.01', // Phien ban cua modle - 'date' => 'Saturday, June 13, 2020 16:00:00 GMT+07:00', // Ngay phat hanh phien ban + 'version' => '4.4.02', // Phien ban cua modle + 'date' => 'Monday, June 22, 2020 16:00:00 GMT+07:00', // Ngay phat hanh phien ban 'author' => 'VINADES ', // Tac gia 'note' => '', // Ghi chu 'uploads_dir' => array( diff --git a/modules/page/version.php b/modules/page/version.php index 624264d27..8fb7c3377 100755 --- a/modules/page/version.php +++ b/modules/page/version.php @@ -17,8 +17,8 @@ 'modfuncs' => 'main,rss', 'is_sysmod' => 1, 'virtual' => 1, - 'version' => '4.4.01', - 'date' => 'Saturday, June 13, 2020 16:00:00 GMT+07:00', + 'version' => '4.4.02', + 'date' => 'Monday, June 22, 2020 16:00:00 GMT+07:00', 'author' => 'VINADES ', 'note' => '', 'uploads_dir' => array( diff --git a/modules/seek/version.php b/modules/seek/version.php index 2cac2a13d..2a1701631 100755 --- a/modules/seek/version.php +++ b/modules/seek/version.php @@ -17,8 +17,8 @@ 'modfuncs' => 'main', 'is_sysmod' => 1, 'virtual' => 0, - 'version' => '4.4.01', - 'date' => 'Saturday, June 13, 2020 16:00:00 GMT+07:00', + 'version' => '4.4.02', + 'date' => 'Monday, June 22, 2020 16:00:00 GMT+07:00', 'author' => 'VINADES ', 'note' => '' ); \ No newline at end of file diff --git a/modules/statistics/version.php b/modules/statistics/version.php index 2fed90f64..d185c4606 100755 --- a/modules/statistics/version.php +++ b/modules/statistics/version.php @@ -20,8 +20,8 @@ 'layoutdefault' => 'body:main,allreferers,allcountries,allbrowsers,allos,allbots', 'is_sysmod' => 0, 'virtual' => 2, - 'version' => '4.4.01', - 'date' => 'Saturday, June 13, 2020 16:00:00 GMT+07:00', + 'version' => '4.4.02', + 'date' => 'Monday, June 22, 2020 16:00:00 GMT+07:00', 'author' => 'VINADES ', 'note' => '' ); \ No newline at end of file diff --git a/modules/two-step-verification/version.php b/modules/two-step-verification/version.php index e7483489c..3787f3f62 100644 --- a/modules/two-step-verification/version.php +++ b/modules/two-step-verification/version.php @@ -18,8 +18,8 @@ 'submenu' => 'main,setup,confirm', 'is_sysmod' => 1, 'virtual' => 0, - 'version' => '4.4.01', - 'date' => 'Saturday, June 13, 2020 16:00:00 GMT+07:00', + 'version' => '4.4.02', + 'date' => 'Monday, June 22, 2020 16:00:00 GMT+07:00', 'author' => 'VINADES ', 'note' => 'Two-Step Verification' ); \ No newline at end of file diff --git a/modules/users/version.php b/modules/users/version.php index b482cb8bf..1f3053250 100755 --- a/modules/users/version.php +++ b/modules/users/version.php @@ -18,8 +18,8 @@ 'submenu' => 'main,login,logout,register,lostpass,active,editinfo,lostactivelink,memberlist', 'is_sysmod' => 1, 'virtual' => 1, - 'version' => '4.4.01', - 'date' => 'Saturday, June 13, 2020 16:00:00 GMT+07:00', + 'version' => '4.4.02', + 'date' => 'Monday, June 22, 2020 16:00:00 GMT+07:00', 'author' => 'VINADES ', 'note' => '' ); \ No newline at end of file diff --git a/modules/voting/version.php b/modules/voting/version.php index 0b533c14c..d57365578 100755 --- a/modules/voting/version.php +++ b/modules/voting/version.php @@ -17,8 +17,8 @@ 'modfuncs' => 'main', 'is_sysmod' => 0, 'virtual' => 0, - 'version' => '4.4.01', - 'date' => 'Saturday, June 13, 2020 16:00:00 GMT+07:00', + 'version' => '4.4.02', + 'date' => 'Monday, June 22, 2020 16:00:00 GMT+07:00', 'author' => 'VINADES ', 'note' => '' ); \ No newline at end of file diff --git a/themes/default/css/style.css b/themes/default/css/style.css index ef5c159d7..2aabf5242 100644 --- a/themes/default/css/style.css +++ b/themes/default/css/style.css @@ -1075,6 +1075,11 @@ a.btn { color:#333333; } +.headerSearch .form-control, +.headerSearch .btn { + z-index: 0; +} + /* Bootstrap Menu */ #menusite .navbar-default { background-color: #428BCA; diff --git a/vendor/vinades/nukeviet/Core/Request.php b/vendor/vinades/nukeviet/Core/Request.php index b86d72479..f6de2eead 100644 --- a/vendor/vinades/nukeviet/Core/Request.php +++ b/vendor/vinades/nukeviet/Core/Request.php @@ -203,8 +203,9 @@ class Request /** * @param array $config * @param string $ip Client IP + * @param \NukeViet\Core\Server|boolean $nv_Server */ - public function __construct($config, $ip) + public function __construct($config, $ip, $nv_Server = false) { if (isset($config['allowed_html_tags']) and is_array($config['allowed_html_tags'])) { $this->disabletags = array_diff($this->disabletags, $config['allowed_html_tags']); @@ -276,7 +277,10 @@ public function __construct($config, $ip) $this->cookie_key = md5($this->cookie_key); - $this->Initialize(); + if ($nv_Server === false) { + $nv_Server = new Server(); + } + $this->Initialize($nv_Server); $this->get_cookie_save_path(); $_ssl_https = (isset($config['ssl_https'])) ? $config['ssl_https'] : 0; @@ -310,9 +314,9 @@ private function get_Env($key) } /** - * + * @param \NukeViet\Core\Server $nv_Server */ - private function Initialize() + private function Initialize($nv_Server) { if (sizeof($_GET)) { $array_keys = array_keys($_GET); @@ -356,28 +360,7 @@ private function Initialize() if (defined('NV_BASE_SITEURL')) { $base_siteurl = preg_replace('/[\/]+$/', '', NV_BASE_SITEURL); } else { - $base_siteurl = pathinfo($_SERVER['PHP_SELF'], PATHINFO_DIRNAME); - if ($base_siteurl == DIRECTORY_SEPARATOR) { - $base_siteurl = ''; - } - if (!empty($base_siteurl)) { - $base_siteurl = str_replace(DIRECTORY_SEPARATOR, '/', $base_siteurl); - } - if (!empty($base_siteurl)) { - $base_siteurl = preg_replace('/[\/]+$/', '', $base_siteurl); - } - if (!empty($base_siteurl)) { - $base_siteurl = preg_replace('/^[\/]*(.*)$/', '/\\1', $base_siteurl); - } - if (defined('NV_WYSIWYG') and !defined('NV_ADMIN')) { - $base_siteurl = preg_replace('/\/' . NV_EDITORSDIR . '(.*)$/i', '', $base_siteurl); - } elseif (defined('NV_IS_UPDATE') or defined('NV_IS_INSTALL')) { - $base_siteurl = preg_replace('/\/install(\/(index|update)\.php.*)*$/i', '', $base_siteurl); - } elseif (defined('NV_ADMIN')) { - $base_siteurl = preg_replace('/\/' . NV_ADMINDIR . '(\/index\.php.*)*$/i', '', $base_siteurl); - } elseif (!empty($base_siteurl)) { - $base_siteurl = preg_replace('/\/index\.php(.*)$/', '', $base_siteurl); - } + $base_siteurl = $nv_Server->getWebsitePath(); } if (NV_ROOTDIR !== $doc_root . $base_siteurl) { @@ -395,39 +378,31 @@ private function Initialize() if (defined('NV_SERVER_NAME')) { $this->server_name = NV_SERVER_NAME; } else { - $this->server_name = preg_replace('/^[a-z]+\:\/\//i', '', $this->get_Env(['HTTP_HOST', 'SERVER_NAME'])); - $this->server_name = preg_replace('/(\:[0-9]+)$/', '', $this->server_name); + $this->server_name = $nv_Server->getServerHost(); } - $_SERVER['SERVER_NAME'] = $this->server_name; - - $this->base_siteurl = $base_siteurl; - $this->base_adminurl = $base_siteurl . (NV_ADMINDIR != '' ? '/' . NV_ADMINDIR : ''); - $this->doc_root = $doc_root; if (defined('NV_SERVER_PROTOCOL')) { $this->server_protocol = NV_SERVER_PROTOCOL; } else { - $this->server_protocol = strtolower(preg_replace('/^([^\/]+)\/*(.*)$/', '\\1', $_SERVER['SERVER_PROTOCOL'])) . (($this->get_Env('HTTPS') == 'on') ? 's' : ''); + $this->server_protocol = $nv_Server->getServerProtocol(); } if (defined('NV_SERVER_PORT')) { $this->server_port = NV_SERVER_PORT; } else { - $this->server_port = ($_SERVER['SERVER_PORT'] == '80' or $_SERVER['SERVER_PORT'] == '443') ? '' : (':' . $_SERVER['SERVER_PORT']); + $this->server_port = $nv_Server->getServerPort(); } + $this->base_siteurl = $base_siteurl; + $this->base_adminurl = $base_siteurl . (NV_ADMINDIR != '' ? '/' . NV_ADMINDIR : ''); + $this->doc_root = $doc_root; + if (defined('NV_MY_DOMAIN')) { $this->my_current_domain = NV_MY_DOMAIN; } else { - if (filter_var($this->server_name, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6) === false) { - $this->my_current_domain = $this->server_protocol . '://' . $this->server_name . $this->server_port; - } else { - $this->my_current_domain = $this->server_protocol . '://[' . $this->server_name . ']' . $this->server_port; - } + $this->my_current_domain = $nv_Server->getOriginalDomain(); } $this->headerstatus = (substr(php_sapi_name(), 0, 3) == 'cgi') ? 'Status:' : $_SERVER['SERVER_PROTOCOL']; - $this->site_url = $this->my_current_domain . $this->base_siteurl; - $this->standardizeReferer(); $this->standardizeOrigin(); $this->method = strtoupper($this->get_Env(['REQUEST_METHOD', 'Method'])); diff --git a/vendor/vinades/nukeviet/Core/Server.php b/vendor/vinades/nukeviet/Core/Server.php new file mode 100644 index 000000000..241673d37 --- /dev/null +++ b/vendor/vinades/nukeviet/Core/Server.php @@ -0,0 +1,248 @@ +server_host = $this->original_host = $this->standardizeHost((string) $this->getEnv(['HTTP_HOST', 'SERVER_NAME', 'Host'])); + $_SERVER['SERVER_NAME'] = $this->server_host; + + // Xác định giao thức máy chủ website + $this->server_protocol = strtolower(preg_replace('/^([^\/]+)\/*(.*)$/', '\\1', $_SERVER['SERVER_PROTOCOL'])); + if (isset($_SERVER['HTTPS']) and strtolower($_SERVER['HTTPS']) == 'on') { + $this->server_protocol .= 's'; + } + $this->original_protocol = $this->server_protocol; + + // Xác định cổng máy chủ website + $this->server_port = $this->original_port = ($_SERVER['SERVER_PORT'] == '80' or $_SERVER['SERVER_PORT'] == '443') ? '' : (':' . $_SERVER['SERVER_PORT']); + + // Xác định domain chạy thật của máy chủ + if (filter_var($this->server_host, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6) === false) { + $this->server_domain = $this->server_protocol . '://' . $this->server_host . $this->server_port; + } else { + $this->server_domain = $this->server_protocol . '://[' . $this->server_host . ']' . $this->server_port; + } + $this->original_domain = $this->server_domain; + + /* + * Xác định lại host, port, protocol phía client nếu có Forwarded + * Ví dụ Server thiết lập HTTP proxy, load balancer + */ + $original_host = $this->getEnv(['HTTP_X_FORWARDED_HOST', 'X-Forwarded-Host']); + $original_protocol = $this->getEnv(['HTTP_X_FORWARDED_PROTO', 'X-Forwarded-Proto']); + $original_port = $this->getEnv(['HTTP_X_FORWARDED_PORT', 'X-Forwarded-Port']); + if ($original_host !== false and $original_protocol !== false) { + if ($original_port === false) { + $original_port = $this->server_port; + } + + $this->original_host = $this->standardizeHost($original_host); + $this->original_protocol = strtolower($original_protocol); + $this->original_port = $original_port; + if ($this->original_port != 80 and $this->original_port != 443) { + $this->original_port = ':' . $this->original_port; + } else { + $this->original_port = ''; + } + + if (filter_var($this->original_host, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6) === false) { + $this->original_domain = $this->original_protocol . '://' . $this->original_host . $this->original_port; + } else { + $this->original_domain = $this->original_protocol . '://[' . $this->original_host . ']' . $this->original_port; + } + } + + // Xác định đường dẫn đến thư mục chứa site + $site_path = pathinfo($_SERVER['PHP_SELF'], PATHINFO_DIRNAME); + if ($site_path == DIRECTORY_SEPARATOR) { + $site_path = ''; + } + if (!empty($site_path)) { + $site_path = str_replace(DIRECTORY_SEPARATOR, '/', $site_path); + } + if (!empty($site_path)) { + $site_path = preg_replace('/[\/]+$/', '', $site_path); + } + if (!empty($site_path)) { + $site_path = preg_replace('/^[\/]*(.*)$/', '/\\1', $site_path); + } + if (defined('NV_WYSIWYG') and !defined('NV_ADMIN')) { + $site_path = preg_replace('/\/' . NV_EDITORSDIR . '(.*)$/i', '', $site_path); + } elseif (defined('NV_IS_UPDATE') or defined('NV_IS_INSTALL')) { + $site_path = preg_replace('/\/install(\/(index|update)\.php.*)*$/i', '', $site_path); + } elseif (defined('NV_ADMIN')) { + $site_path = preg_replace('/\/' . NV_ADMINDIR . '(\/index\.php.*)*$/i', '', $site_path); + } elseif (!empty($site_path)) { + $site_path = preg_replace('/\/index\.php(.*)$/', '', $site_path); + } + + $this->sitePath = $site_path; + } + + /** + * @param string $key + * @return mixed + */ + protected function getEnv($key) + { + if (!is_array($key)) { + $key = [$key]; + } + foreach ($key as $k) { + if (isset($_SERVER[$k])) { + return $_SERVER[$k]; + } elseif (isset($_ENV[$k])) { + return $_ENV[$k]; + } elseif (@getenv($k)) { + return @getenv($k); + } elseif (function_exists('apache_getenv') and apache_getenv($k, true)) { + return apache_getenv($k, true); + } + } + return false; + } + + /** + * @param string $host + * @return string + */ + protected function standardizeHost($host) + { + return preg_replace('/(\:[0-9]+)$/', '', preg_replace('/^[a-z]+\:\/\//i', '', trim($host))); + } + + /** + * @return string + */ + public function getServerHost() + { + return $this->server_host; + } + + /** + * @return string + */ + public function getServerPort() + { + return $this->server_port; + } + + /** + * @return string + */ + public function getServerProtocol() + { + return $this->server_protocol; + } + + /** + * @return string + */ + public function getServerDomain() + { + return $this->server_domain; + } + + /** + * @return string + */ + public function getOriginalHost() + { + return $this->original_host; + } + + /** + * @return string + */ + public function getOriginalPort() + { + return $this->original_port; + } + + /** + * @return string + */ + public function getOriginalProtocol() + { + return $this->original_protocol; + } + + /** + * @return string + */ + public function getOriginalDomain() + { + return $this->original_domain; + } + + /** + * @return string + */ + public function getWebsitePath() + { + return $this->sitePath; + } +} diff --git a/vendor/vinades/nukeviet/Http/Http.php b/vendor/vinades/nukeviet/Http/Http.php index cdd9ad019..5bcb7ebe9 100644 --- a/vendor/vinades/nukeviet/Http/Http.php +++ b/vendor/vinades/nukeviet/Http/Http.php @@ -10,7 +10,9 @@ namespace NukeViet\Http; -class Http +use NukeViet\Core\Server; + +class Http extends Server { /** * Variable to set dir @@ -62,16 +64,8 @@ public function __construct($config, $tmp_dir = 'tmp') } // Find my domain - $server_name = preg_replace('/^[a-z]+\:\/\//i', '', $this->get_Env(array( 'HTTP_HOST', 'SERVER_NAME' ))); - $server_protocol = strtolower(preg_replace('/^([^\/]+)\/*(.*)$/', '\\1', $this->get_Env('SERVER_PROTOCOL'))) . (($this->get_Env('HTTPS') == 'on') ? 's' : ''); - $server_port = $this->get_Env('SERVER_PORT'); - $server_port = ($server_port == '80') ? '' : (':' . $server_port); - - if (filter_var($server_name, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6) === false) { - Http::$site_config['my_domain'] = $server_protocol . '://' . $server_name . $server_port; - } else { - Http::$site_config['my_domain'] = $server_protocol . '://[' . $server_name . ']' . $server_port; - } + parent::__construct(); + Http::$site_config['my_domain'] = $this->original_domain; // Check user custom temp dir if (!is_null($tmp_dir)) {