1
+ <?php
2
+
3
+ /**
4
+ * @Project NUKEVIET 4.x
5
+ * @Author VINADES.,JSC ([email protected] )
6
+ * @Copyright (C) 2017 VINADES.,JSC. All rights reserved
7
+ * @License GNU/GPL version 2 or any later version
8
+ * @Createdate Jul 2, 2017 2:06:56 PM
9
+ */
10
+
11
+ define ('NV_SYSTEM ' , true );
12
+
13
+ // Xac dinh thu muc goc cua site
14
+ define ('NV_ROOTDIR ' , pathinfo (str_replace (DIRECTORY_SEPARATOR , '/ ' , __file__), PATHINFO_DIRNAME ));
15
+
16
+ require NV_ROOTDIR . '/includes/mainfile.php ' ;
17
+
18
+ // Xac dinh kieu giao dien mac dinh
19
+ $ global_config ['current_theme_type ' ] = $ nv_Request ->get_string ('nv ' . NV_LANG_DATA . 'themever ' , 'cookie ' , '' );
20
+ if (!in_array ($ global_config ['current_theme_type ' ], $ global_config ['array_theme_type ' ])) {
21
+ $ global_config ['current_theme_type ' ] = '' ;
22
+ $ nv_Request ->set_Cookie ('nv ' . NV_LANG_DATA . 'themever ' , '' , NV_LIVE_COOKIE_TIME );
23
+ }
24
+
25
+ // Xac dinh giao dien chung
26
+ $ is_mobile = false ;
27
+ $ theme_type = '' ;
28
+ $ _theme_mobile = $ global_config ['mobile_theme ' ];
29
+ if ((($ client_info ['is_mobile ' ] and (empty ($ global_config ['current_theme_type ' ]) or empty ($ global_config ['switch_mobi_des ' ]))) or ($ global_config ['current_theme_type ' ] == 'm ' and !empty ($ global_config ['switch_mobi_des ' ]))) and !empty ($ _theme_mobile ) and file_exists (NV_ROOTDIR . '/themes/ ' . $ _theme_mobile . '/theme.php ' )) {
30
+ $ site_theme = $ _theme_mobile ;
31
+ $ is_mobile = true ;
32
+ $ theme_type = 'm ' ;
33
+ } else {
34
+ if (empty ($ global_config ['current_theme_type ' ]) and ($ client_info ['is_mobile ' ] or empty ($ _theme_mobile ))) {
35
+ $ global_config ['current_theme_type ' ] = 'r ' ;
36
+ }
37
+
38
+ $ _theme = $ global_config ['site_theme ' ];
39
+ if (!empty ($ _theme ) and file_exists (NV_ROOTDIR . '/themes/ ' . $ _theme . '/theme.php ' )) {
40
+ $ site_theme = $ _theme ;
41
+ $ theme_type = $ global_config ['current_theme_type ' ];
42
+ } elseif (file_exists (NV_ROOTDIR . '/themes/default/theme.php ' )) {
43
+ $ site_theme = 'default ' ;
44
+ $ theme_type = $ global_config ['current_theme_type ' ];
45
+ } else {
46
+ trigger_error ('Error! Does not exist themes default ' , 256 );
47
+ }
48
+ }
49
+
50
+ // Xac lap lai giao kieu giao dien hien tai
51
+ if ($ theme_type != $ global_config ['current_theme_type ' ]) {
52
+ $ global_config ['current_theme_type ' ] = $ theme_type ;
53
+ $ nv_Request ->set_Cookie ('nv ' . NV_LANG_DATA . 'themever ' , $ theme_type , NV_LIVE_COOKIE_TIME );
54
+ }
55
+ unset($ theme_type );
56
+
57
+ // Doc file cau hinh giao dien
58
+ $ themeConfig = nv_object2array (simplexml_load_file (NV_ROOTDIR . '/themes/ ' . $ site_theme . '/config.ini ' ));
59
+ if (isset ($ themeConfig ['positions ' ]['position ' ]['name ' ])) {
60
+ $ themeConfig ['positions ' ]['position ' ] = array (
61
+ $ themeConfig ['positions ' ]['position ' ]
62
+ );
63
+ }
64
+ require NV_ROOTDIR . '/themes/ ' . $ site_theme . '/theme.php ' ;
65
+
66
+ // Ket noi ngon ngu theo theme
67
+ if (file_exists (NV_ROOTDIR . '/themes/ ' . $ site_theme . '/language/ ' . NV_LANG_INTERFACE . '.php ' )) {
68
+ require NV_ROOTDIR . '/themes/ ' . $ site_theme . '/language/ ' . NV_LANG_INTERFACE . '.php ' ;
69
+ } elseif (file_exists (NV_ROOTDIR . '/themes/ ' . $ site_theme . '/language/en.php ' )) {
70
+ require NV_ROOTDIR . '/themes/ ' . $ site_theme . '/language/en.php ' ;
71
+ }
72
+
73
+ $ error_code = $ nv_Request ->get_int ('code ' , 'get ' , 404 );
74
+
75
+ $ title = isset ($ lang_global ['error_ ' . $ error_code . '_title ' ]) ? $ lang_global ['error_ ' . $ error_code . '_title ' ] : 'Error Code: ' . $ error_code ;
76
+
77
+ if (isset ($ lang_global ['error_ ' . $ error_code . '_content ' ])) {
78
+ $ content = $ lang_global ['error_ ' . $ error_code . '_content ' ];
79
+ } else {
80
+ switch ($ error_code ) {
81
+ case 400 :
82
+ $ content = 'Bad Request ' ;
83
+ break ;
84
+ case 403 :
85
+ $ content = 'Forbidden ' ;
86
+ break ;
87
+ case 404 :
88
+ $ content = 'Not Found ' ;
89
+ break ;
90
+ case 405 :
91
+ $ content = 'Method Not Allowed ' ;
92
+ break ;
93
+ case 408 :
94
+ $ content = 'Request Time-out ' ;
95
+ break ;
96
+ case 500 :
97
+ $ content = 'Internal Server Error ' ;
98
+ break ;
99
+ case 502 :
100
+ $ content = 'Bad Gateway ' ;
101
+ break ;
102
+ case 504 :
103
+ $ content = 'Gateway Time-out ' ;
104
+ break ;
105
+ default :
106
+ $ content = 'Error code: ' . $ error_code ;
107
+ break ;
108
+ }
109
+ }
110
+
111
+ if (function_exists ('nv_error_theme ' )) {
112
+ nv_error_theme ($ title , $ content , $ error_code );
113
+ } else {
114
+ nv_info_die ($ title , $ title , $ content , $ error_code );
115
+ }
0 commit comments