PageRenderTime 61ms CodeModel.GetById 25ms RepoModel.GetById 0ms app.codeStats 1ms

/01.Source/01.CORE/mainfile.php

http://creative-portal.googlecode.com/
PHP | 437 lines | 381 code | 30 blank | 26 comment | 34 complexity | 9042589f98a5b6ff7be1b15aa0a01706 MD5 | raw file
Possible License(s): BSD-3-Clause
  1. <?php
  2. /**
  3. * @Project NUKEVIET 3.0
  4. * @Author VINADES.,JSC (contact@vinades.vn)
  5. * @Copyright (C) 2010 VINADES.,JSC. All rights reserved
  6. * @Createdate 31/05/2010, 00:36
  7. */
  8. if ( ! defined( 'NV_SYSTEM' ) and ! defined( 'NV_ADMIN' ) and ! defined( 'NV_WYSIWYG' ) )
  9. {
  10. Header( "Location: index.php" );
  11. exit();
  12. }
  13. define( 'NV_MAINFILE', true );
  14. //Thoi gian bat dau phien lam viec
  15. define( 'NV_START_TIME', array_sum( explode( " ", microtime() ) ) );
  16. //Khong cho xac dinh tu do cac variables
  17. $db_config = array();
  18. $global_config = array();
  19. $module_config = array();
  20. $client_info = array();
  21. $user_info = array();
  22. $admin_info = array();
  23. $sys_info = array();
  24. $lang_global = array();
  25. $lang_ = array();
  26. $rss = array();
  27. $nv_vertical_menu = array();
  28. $array_mod_title = array();
  29. $content_type = array();
  30. $blocks = array();
  31. $contents = "";
  32. $submenu = array();
  33. $select_options = array();
  34. $error_info = array();
  35. unset( $key_words, $page_title, $mod_title, $editor, $editor_password, $my_head, $description );
  36. //Xac dinh thu muc goc cua site
  37. define( 'NV_ROOTDIR', pathinfo( str_replace( '\\', '/', __file__ ), PATHINFO_DIRNAME ) );
  38. $sys_info['disable_functions'] = ( ini_get( "disable_functions" ) != "" and ini_get( "disable_functions" ) != false ) ? array_map( 'trim', preg_split( "/[\s,]+/", ini_get( "disable_functions" ) ) ) : array();
  39. $sys_info['ini_set_support'] = ( function_exists( 'ini_set' ) and ! in_array( 'ini_set', $sys_info['disable_functions'] ) ) ? true : false;
  40. //Ket noi voi cac file constants, config, timezone
  41. require_once ( NV_ROOTDIR . "/includes/constants.php" );
  42. if ( file_exists( NV_ROOTDIR . "/" . NV_CONFIG_FILENAME ) )
  43. {
  44. require_once ( realpath( NV_ROOTDIR . "/" . NV_CONFIG_FILENAME ) );
  45. }
  46. else
  47. {
  48. $base_siteurl = pathinfo( $_SERVER['PHP_SELF'], PATHINFO_DIRNAME );
  49. if ( $base_siteurl == '\\' or $base_siteurl == '/' ) $base_siteurl = '';
  50. if ( ! empty( $base_siteurl ) ) $base_siteurl = str_replace( '\\', '/', $base_siteurl );
  51. if ( ! empty( $base_siteurl ) ) $base_siteurl = preg_replace( "/[\/]+$/", '', $base_siteurl );
  52. if ( ! empty( $base_siteurl ) ) $base_siteurl = preg_replace( "/^[\/]*(.*)$/", '/\\1', $base_siteurl );
  53. if ( defined( 'NV_ADMIN' ) )
  54. {
  55. $base_siteurl = preg_replace( "#/" . NV_ADMINDIR . "(.*)$#", '', $base_siteurl );
  56. }
  57. Header( "Location: " . $base_siteurl . "/install/index.php" );
  58. die();
  59. }
  60. require_once ( NV_ROOTDIR . "/" . NV_DATADIR . "/config_global.php" );
  61. $global_config['file_allowed_ext'] = ! empty( $global_config['file_allowed_ext'] ) ? explode( ",", $global_config['file_allowed_ext'] ) : array();
  62. $global_config['forbid_extensions'] = ! empty( $global_config['forbid_extensions'] ) ? explode( ",", $global_config['forbid_extensions'] ) : array();
  63. $global_config['forbid_mimes'] = ! empty( $global_config['forbid_mimes'] ) ? explode( ",", $global_config['forbid_mimes'] ) : array();
  64. $global_config['allow_sitelangs'] = ! empty( $global_config['allow_sitelangs'] ) ? explode( ",", $global_config['allow_sitelangs'] ) : array();
  65. $global_config['allow_adminlangs'] = ! empty( $global_config['allow_adminlangs'] ) ? explode( ",", $global_config['allow_adminlangs'] ) : array();
  66. $global_config['openid_servers'] = ! empty( $global_config['openid_servers'] ) ? explode( ",", $global_config['openid_servers'] ) : array();
  67. if ( empty( $global_config['openid_servers'] ) ) $global_config['openid_mode'] = 0;
  68. if ( $global_config['is_user_forum'] )
  69. {
  70. $forum_files = @scandir( NV_ROOTDIR . '/' . DIR_FORUM . '/nukeviet' );
  71. 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 ) )
  72. {
  73. define( 'NV_IS_USER_FORUM', true );
  74. $global_config['openid_mode'] = 0;
  75. }
  76. else
  77. {
  78. $global_config['is_user_forum'] = 0;
  79. }
  80. }
  81. if ( $global_config['openid_mode'] )
  82. {
  83. define( 'NV_OPENID_ALLOWED', true );
  84. $openid_servers = array();
  85. require_once ( NV_ROOTDIR . '/includes/openid.php' );
  86. $openid_servers = array_intersect_key( $openid_servers, array_flip( $global_config['openid_servers'] ) );
  87. }
  88. require_once ( NV_ROOTDIR . '/includes/timezone.php' );
  89. define( 'NV_CURRENTTIME', time() );
  90. define( 'NV_CURRENTYEAR_FNUM', date( 'Y', NV_CURRENTTIME ) ); //2009
  91. define( 'NV_CURRENTYEAR_2NUM', date( 'y', NV_CURRENTTIME ) ); //09
  92. define( 'NV_CURRENTMONTH_NUM', date( 'm', NV_CURRENTTIME ) ); //01-12
  93. define( 'NV_CURRENTMONTH_FTXT', date( 'F', NV_CURRENTTIME ) ); //January - December
  94. define( 'NV_CURRENTMONTH_STXT', date( 'M', NV_CURRENTTIME ) ); //Jan - Dec
  95. define( 'NV_CURRENTDAY_2NUM', date( 'd', NV_CURRENTTIME ) ); //01 - 31
  96. define( 'NV_CURRENTDAY_1NUM', date( 'j', NV_CURRENTTIME ) ); //1 - 31
  97. define( 'NV_CURRENT12HOUR_2NUM', date( 'h', NV_CURRENTTIME ) ); //00-12
  98. define( 'NV_CURRENT12HOUR_1NUM', date( 'g', NV_CURRENTTIME ) ); //0-12
  99. define( 'NV_CURRENT24HOUR_2NUM', date( 'H', NV_CURRENTTIME ) ); //00-23
  100. define( 'NV_CURRENT24HOUR_1NUM', date( 'G', NV_CURRENTTIME ) ); //0-23
  101. define( 'NV_CURRENTMIN_2NUM', date( 'i', NV_CURRENTTIME ) ); //00-59
  102. define( 'NV_DEL_ONLINE_TIME', ( NV_CURRENTTIME - NV_ONLINE_UPD_TIME ) ); //Thoi gian xoa tinh trang online
  103. $global_config['log_errors_list'] = NV_LOG_ERRORS_LIST;
  104. $global_config['display_errors_list'] = NV_DISPLAY_ERRORS_LIST;
  105. $global_config['send_errors_list'] = NV_SEND_ERRORS_LIST;
  106. $global_config['error_log_path'] = NV_LOGS_DIR . '/error_logs';
  107. $global_config['error_log_filename'] = NV_ERRORLOGS_FILENAME;
  108. $global_config['error_log_fileext'] = NV_LOGS_EXT;
  109. //Ket noi voi class Error_handler
  110. require_once ( NV_ROOTDIR . '/includes/class/error.class.php' );
  111. $ErrorHandler = new Error( $global_config );
  112. set_error_handler( array(
  113. &$ErrorHandler, 'error_handler'
  114. ) );
  115. if ( empty( $global_config['allow_sitelangs'] ) or empty( $global_config['allow_adminlangs'] ) )
  116. {
  117. trigger_error( "Error! Language variables is empty!", 256 );
  118. }
  119. //Ket noi voi cac file cau hinh, function va template
  120. require_once ( NV_ROOTDIR . "/includes/ini.php" );
  121. require_once ( NV_ROOTDIR . '/includes/functions.php' );
  122. require_once ( NV_ROOTDIR . '/includes/core/theme_functions.php' );
  123. require_once ( NV_ROOTDIR . "/includes/class/xtemplate.class.php" );
  124. $global_config['allow_request_mods'] = NV_ALLOW_REQUEST_MODS != '' ? array_map( "trim", explode( ",", NV_ALLOW_REQUEST_MODS ) ) : "request";
  125. $global_config['request_default_mode'] = NV_REQUEST_DEFAULT_MODE != '' ? trim( NV_REQUEST_DEFAULT_MODE ) : 'request';
  126. $global_config['XSS_replaceString'] = NV_XSS_REPLACESTRING != '' ? NV_XSS_REPLACESTRING : '';
  127. $global_config['cookie_key'] = $global_config['sitekey'];
  128. $global_config['cookie_secure'] = NV_COOKIE_SECURE;
  129. $global_config['cookie_httponly'] = NV_COOKIE_HTTPONLY;
  130. $global_config['session_save_path'] = NV_SESSION_SAVE_PATH;
  131. //Ket noi voi file xac dinh IP
  132. require_once ( NV_ROOTDIR . '/includes/class/ips.class.php' );
  133. $ips = new ips();
  134. //define( 'NV_SERVER_IP', $ips->server_ip );
  135. define( 'NV_CLIENT_IP', $ips->client_ip );
  136. define( 'NV_FORWARD_IP', $ips->forward_ip );
  137. define( 'NV_REMOTE_ADDR', $ips->remote_addr );
  138. //Xac dinh IP cua client
  139. $client_info['ip'] = $ips->remote_ip;
  140. if ( $client_info['ip'] == "none" ) trigger_error( 'Error: Your IP address is not correct', 256 ); //Neu khong co IP
  141. if ( nv_is_banIp( $client_info['ip'] ) ) trigger_error( "Hi and Good-bye!!!", 256 ); //IP Ban
  142. if ( $global_config['proxy_blocker'] != 0 ) //Chan proxy
  143. {
  144. $client_info['is_proxy'] = $ips->nv_check_proxy();
  145. if ( nv_is_blocker_proxy( $client_info['is_proxy'], $global_config['proxy_blocker'] ) )
  146. {
  147. trigger_error( 'ERROR: You are behind a proxy server. Please disconnect and come again!', 256 );
  148. }
  149. }
  150. //Xac dinh cac search_engine
  151. $global_config['engine_allowed'] = array();
  152. if ( file_exists( NV_ROOTDIR . '/' . NV_DATADIR . '/search_engine.xml' ) )
  153. {
  154. $global_config['engine_allowed'] = nv_object2array( simplexml_load_file( NV_ROOTDIR . '/' . NV_DATADIR . '/search_engine.xml' ) );
  155. }
  156. //Ket noi voi class xu ly request
  157. require_once ( NV_ROOTDIR . '/includes/class/request.class.php' );
  158. $nv_Request = new Request( $global_config, $client_info['ip'] );
  159. //Ngon ngu
  160. $language_array = nv_parse_ini_file( NV_ROOTDIR . '/includes/ini/langs.ini', true );
  161. //'name_'
  162. require_once ( NV_ROOTDIR . '/includes/language.php' );
  163. require_once ( NV_ROOTDIR . "/language/" . NV_LANG_INTERFACE . "/global.php" );
  164. $global_config['cookie_path'] = $nv_Request->cookie_path; //vd: /ten_thu_muc_chua_site/
  165. $global_config['cookie_domain'] = $nv_Request->cookie_domain; //vd: .mydomain1.com
  166. $global_config['site_url'] = $nv_Request->site_url; //vd: http://mydomain1.com/ten_thu_muc_chua_site
  167. $global_config['my_domains'] = $nv_Request->my_domains; //vd: "mydomain1.com,mydomain2.com"
  168. $sys_info['register_globals'] = $nv_Request->is_register_globals; //0 = khong, 1 = bat
  169. $sys_info['magic_quotes_gpc'] = $nv_Request->is_magic_quotes_gpc; // 0 = khong, 1 = co
  170. $sys_info['sessionpath'] = $nv_Request->session_save_path; //vd: D:/AppServ/www/ten_thu_muc_chua_site/sess/
  171. $client_info['session_id'] = $nv_Request->session_id; //ten cua session
  172. $client_info['referer'] = $nv_Request->referer; //referer
  173. $client_info['is_myreferer'] = $nv_Request->referer_key; //0 = referer tu ben ngoai site, 1 = referer noi bo, 2 = khong co referer
  174. $client_info['selfurl'] = $nv_Request->my_current_domain . $nv_Request->request_uri; //trang dang xem
  175. $client_info['agent'] = $nv_Request->user_agent; //HTTP_USER_AGENT
  176. define( 'NV_SERVER_NAME', $nv_Request->server_name ); //vd: mydomain1.com
  177. define( 'NV_SERVER_PROTOCOL', $nv_Request->server_protocol ); //vd: http
  178. define( 'NV_SERVER_PORT', $nv_Request->server_port ); //vd: 80
  179. define( 'NV_MY_DOMAIN', $nv_Request->my_current_domain ); //vd: http://mydomain1.com:80
  180. define( 'NV_HEADERSTATUS', $nv_Request->headerstatus ); //vd: HTTP/1.0
  181. define( 'NV_USER_AGENT', $nv_Request->user_agent ); //HTTP_USER_AGENT
  182. define( "NV_BASE_SITEURL", $nv_Request->base_siteurl . '/' ); //vd: /ten_thu_muc_chua_site/
  183. define( "NV_BASE_ADMINURL", $nv_Request->base_adminurl . '/' ); //vd: /ten_thu_muc_chua_site/admin/
  184. define( 'NV_DOCUMENT_ROOT', $nv_Request->doc_root ); // D:/AppServ/www
  185. define( 'NV_EOL', ( strtoupper( substr( PHP_OS, 0, 3 ) == 'WIN' ) ? "\r\n" : ( strtoupper( substr( PHP_OS, 0, 3 ) == 'MAC' ) ? "\r" : "\n" ) ) ); //Ngat dong
  186. define( 'NV_UPLOAD_MAX_FILESIZE', min( nv_converttoBytes( ini_get( 'upload_max_filesize' ) ), nv_converttoBytes( ini_get( 'post_max_size' ) ), $global_config['nv_max_size'] ) );
  187. define( 'NV_UPLOADS_REAL_DIR', NV_ROOTDIR . '/' . NV_UPLOADS_DIR ); //Xac dinh duong dan thuc den thu muc upload
  188. define( 'NV_CACHE_PREFIX', md5( $global_config['sitekey'] . NV_BASE_SITEURL ) ); //Hau to cua file cache
  189. if ( preg_match( "/^[0-9]{10,}$/", $nv_Request->get_string( 'nocache', 'get', '' ) ) and //Xac dinh co phai AJAX hay khong
  190. $client_info['is_myreferer'] === 1 ) define( 'NV_IS_AJAX', true );
  191. //Chan truy cap neu HTTP_USER_AGENT == 'none'
  192. if ( NV_USER_AGENT == "none" )
  193. {
  194. trigger_error( 'We\'re sorry. The software you are using to access our website is not allowed. Some examples of this are e-mail harvesting programs and programs that will copy websites to your hard drive. If you feel you have gotten this message in error, please send an e-mail addressed to admin. Your I.P. address has been logged. Thanks.', 256 );
  195. }
  196. //xac dinh co phai User_Agent cua NukeViet hay khong
  197. if ( NV_USER_AGENT == 'NUKEVIET CMS ' . $global_config['version'] . '. Developed by VINADES. Url: http://nukeviet.vn. Code: ' . md5( $global_config['sitekey'] ) )
  198. {
  199. define( 'NV_IS_MY_USER_AGENT', true );
  200. }
  201. //Xac dinh co phai la bot hay khong
  202. $client_info['bot_info'] = nv_check_bot();
  203. $client_info['is_bot'] = ( ! empty( $client_info['bot_info'] ) ) ? 1 : 0;
  204. //Neu la bot va bot bi cam truy cap
  205. if ( $client_info['is_bot'] and empty( $client_info['bot_info']['allowed'] ) ) trigger_error( 'Sorry! Website does not support the bot', 256 );
  206. //Xac dinh co phai truy cap bang mobile hay khong
  207. $client_info['is_mobile'] = nv_checkmobile();
  208. //Chan hoac chuyen huong neu truy cap tu mobile
  209. //if ($client_info['is_mobile'])
  210. // trigger_error('Sorry! Website does not support the browser your mobile', 256);
  211. //Ket noi voi class chong flood
  212. if ( defined( 'NV_IS_FLOOD_BLOCKER' ) and NV_IS_FLOOD_BLOCKER == 1 and ! $nv_Request->isset_request( 'admin', 'session' ) and //
  213. ( ! $nv_Request->isset_request( 'second', 'get' ) or ( $nv_Request->isset_request( 'second', 'get' ) and $client_info['is_myreferer'] != 1 ) ) )
  214. {
  215. require_once ( NV_ROOTDIR . '/includes/core/flood_blocker.php' );
  216. }
  217. //Xac dinh borwser cua client
  218. $client_info['browser'] = $client_info['is_bot'] ? array(
  219. 'key' => "Unknown", 'name' => 'Unknown'
  220. ) : array_combine( array(
  221. 'key', 'name'
  222. ), explode( "|", nv_getBrowser( NV_USER_AGENT, NV_ROOTDIR . '/includes/ini/br.ini' ) ) );
  223. //Xac dinh OS cua client
  224. $client_info['client_os'] = $client_info['is_bot'] ? array(
  225. 'key' => "Robot", 'name' => $client_info['bot_info']['name']
  226. ) : array_combine( array(
  227. 'key', 'name'
  228. ), explode( "|", nv_getOs( NV_USER_AGENT, NV_ROOTDIR . '/includes/ini/os.ini' ) ) );
  229. //Captcha
  230. if ( $nv_Request->isset_request( 'scaptcha', 'get' ) )
  231. {
  232. include_once ( NV_ROOTDIR . "/includes/core/captcha.php" );
  233. }
  234. //Bat dau phien lam viec cua MySQL
  235. require_once ( NV_ROOTDIR . '/includes/class/mysql.class.php' );
  236. $db_config['new_link'] = NV_MYSQL_NEW_LINK;
  237. $db_config['persistency'] = NV_MYSQL_PERSISTENCY;
  238. $db = new sql_db( $db_config );
  239. if ( ! empty( $db->error ) )
  240. {
  241. $die = ! empty( $db->error['user_message'] ) ? $db->error['user_message'] : $db->error['message'];
  242. $die .= ! empty( $db->error['code'] ) ? ' (Code: ' . $db->error['code'] . ')' : '';
  243. trigger_error( $die, 256 );
  244. }
  245. unset( $db_config['dbpass'] );
  246. //Ten cac table cua CSDL dung chung cho he thong
  247. define( 'NV_AUTHORS_GLOBALTABLE', $db_config['prefix'] . '_authors' );
  248. define( 'NV_GROUPS_GLOBALTABLE', $db_config['prefix'] . '_groups' );
  249. define( 'NV_USERS_GLOBALTABLE', $db_config['prefix'] . '_users' );
  250. define( 'NV_SESSIONS_GLOBALTABLE', $db_config['prefix'] . '_sessions' );
  251. define( 'NV_LANGUAGE_GLOBALTABLE', $db_config['prefix'] . '_language' );
  252. define( 'NV_BANNERS_CLIENTS_GLOBALTABLE', $db_config['prefix'] . '_banners_clients' );
  253. define( 'NV_BANNERS_PLANS_GLOBALTABLE', $db_config['prefix'] . '_banners_plans' );
  254. define( 'NV_BANNERS_ROWS_GLOBALTABLE', $db_config['prefix'] . '_banners_rows' );
  255. define( 'NV_BANNERS_CLICK_GLOBALTABLE', $db_config['prefix'] . '_banners_click' );
  256. define( 'NV_CONFIG_GLOBALTABLE', $db_config['prefix'] . '_config' );
  257. define( 'NV_CRONJOBS_GLOBALTABLE', $db_config['prefix'] . '_cronjobs' );
  258. define( 'NV_PREFIXLANG', $db_config['prefix'] . '_' . NV_LANG_DATA );
  259. define( 'NV_MODULES_TABLE', NV_PREFIXLANG . '_modules' );
  260. define( 'NV_BLOCKS_TABLE', NV_PREFIXLANG . '_blocks' );
  261. define( 'NV_MODFUNCS_TABLE', NV_PREFIXLANG . '_modfuncs' );
  262. define( 'NV_COUNTER_TABLE', NV_PREFIXLANG . '_counter' );
  263. define( 'NV_SEARCHKEYS_TABLE', NV_PREFIXLANG . '_searchkeys' );
  264. define( 'NV_REFSTAT_TABLE', NV_PREFIXLANG . '_referer_stats' );
  265. $sql = "SELECT `module`, `config_name`, `config_value` FROM `" . NV_CONFIG_GLOBALTABLE . "` WHERE `lang`='" . NV_LANG_DATA . "' ORDER BY `module` ASC";
  266. $list = nv_db_cache( $sql, '', 'settings' );
  267. foreach ( $list as $row )
  268. {
  269. if ( $row['module'] == "global" )
  270. {
  271. $global_config[$row['config_name']] = $row['config_value'];
  272. }
  273. else
  274. {
  275. $module_config[$row['module']][$row['config_name']] = $row['config_value'];
  276. }
  277. }
  278. if ( $global_config['is_url_rewrite'] )
  279. {
  280. $check_rewrite_file = nv_check_rewrite_file();
  281. if ( ! $check_rewrite_file )
  282. {
  283. $global_config['is_url_rewrite'] = 0;
  284. }
  285. if ( empty( $global_config['is_url_rewrite'] ) )
  286. {
  287. $db->sql_query( "UPDATE `" . NV_CONFIG_GLOBALTABLE . "` SET `config_value`= '0' WHERE `module`='global' AND `config_name` = 'is_url_rewrite'" );
  288. nv_delete_all_cache(); //xoa toan bo cache
  289. }
  290. }
  291. if ( defined( 'NV_ADMIN' ) )
  292. {
  293. if ( ! in_array( NV_LANG_DATA, $global_config['allow_adminlangs'] ) )
  294. {
  295. if ( $global_config['lang_multi'] )
  296. {
  297. $nv_Request->set_Cookie( 'data_lang', $global_config['site_lang'], NV_LIVE_COOKIE_TIME );
  298. }
  299. Header( "Location: " . NV_BASE_ADMINURL );
  300. exit();
  301. }
  302. if ( ! in_array( NV_LANG_INTERFACE, $global_config['allow_adminlangs'] ) )
  303. {
  304. if ( $global_config['lang_multi'] )
  305. {
  306. $nv_Request->set_Cookie( 'int_lang', $global_config['site_lang'], NV_LIVE_COOKIE_TIME );
  307. }
  308. Header( "Location: " . NV_BASE_ADMINURL );
  309. exit();
  310. }
  311. }
  312. //Class ma hoa du lieu $crypt->hash($data)
  313. require_once ( NV_ROOTDIR . '/includes/class/crypt.class.php' );
  314. $crypt = new nv_Crypt( $global_config['sitekey'], NV_CRYPT_SHA1 == 1 ? 'sha1' : 'md5' );
  315. if ( ! $crypt->_otk ) trigger_error( "sitekey not declared", 256 );
  316. //cronjobs
  317. if ( $nv_Request->isset_request( 'second', 'get' ) and $nv_Request->get_string( 'second', 'get' ) == "cronjobs" )
  318. {
  319. include_once ( NV_ROOTDIR . "/includes/core/cronjobs.php" );
  320. }
  321. //Kiem tra tu cach admin
  322. if ( defined( 'NV_IS_ADMIN' ) || defined( 'NV_IS_SPADMIN' ) )
  323. {
  324. trigger_error( "Hacking attempt", 256 );
  325. }
  326. $admin_cookie = $nv_Request->get_bool( 'admin', 'session', false );
  327. if ( ! empty( $admin_cookie ) )
  328. {
  329. require_once ( NV_ROOTDIR . "/includes/core/admin_access.php" );
  330. require_once ( NV_ROOTDIR . "/includes/core/is_admin.php" );
  331. }
  332. if ( defined( "NV_IS_ADMIN" ) )
  333. {
  334. //Buoc admin khai bao lai pass neu khong online trong khoang thoi gian nhat dinh
  335. if ( empty( $admin_info['checkpass'] ) )
  336. {
  337. if ( $nv_Request->isset_request( NV_ADMINRELOGIN_VARIABLE, 'get' ) and $nv_Request->get_int( NV_ADMINRELOGIN_VARIABLE, 'get' ) == 1 )
  338. {
  339. require_once ( NV_ROOTDIR . "/includes/core/admin_relogin.php" );
  340. exit();
  341. }
  342. }
  343. }
  344. elseif ( ! in_array( NV_LANG_DATA, $global_config['allow_sitelangs'] ) )
  345. {
  346. $global_config['disable_site'] = 1;
  347. }
  348. //Dinh chi hoat dong cua site
  349. if ( ! defined( 'NV_ADMIN' ) and ! defined( "NV_IS_ADMIN" ) )
  350. {
  351. if ( $global_config['disable_site'] )
  352. {
  353. $disable_site_content = ( isset( $global_config['disable_site_content'] ) and ! empty( $global_config['disable_site_content'] ) ) ? $global_config['disable_site_content'] : $lang_global['disable_site_content'];
  354. nv_info_die( $global_config['site_description'], $global_config['disable_site_title'], $disable_site_content );
  355. }
  356. elseif ( ! in_array( NV_LANG_DATA, $global_config['allow_sitelangs'] ) )
  357. {
  358. Header( "Location: " . NV_BASE_SITEURL );
  359. exit();
  360. }
  361. elseif ( empty( $global_config['lang_multi'] ) and NV_LANG_DATA != $global_config['site_lang'] )
  362. {
  363. Header( "Location: " . NV_BASE_SITEURL );
  364. exit();
  365. }
  366. }
  367. $month_upload_dir = nv_mkdir( NV_UPLOADS_REAL_DIR, date( "Y_m" ) ); //Thu muc uploads theo thang
  368. if ( ! empty( $month_upload_dir[0] ) )
  369. {
  370. define( "NV_MONTH_UPLOADS_DIR", date( "Y_m" ) );
  371. define( "NV_MONTH_UPLOADS_REAL_DIR", NV_UPLOADS_REAL_DIR . '/' . NV_MONTH_UPLOADS_DIR );
  372. }
  373. define( 'PCLZIP_TEMPORARY_DIR', NV_ROOTDIR . '/' . NV_TEMP_DIR . '/' );
  374. unset( $month_upload_dir );
  375. ?>