PageRenderTime 55ms CodeModel.GetById 15ms RepoModel.GetById 0ms app.codeStats 0ms

/Quản lý website nội thất PHP/noithatviet/themes/modern/theme.php

https://gitlab.com/phamngsinh/baitaplon_sinhvien
PHP | 246 lines | 192 code | 45 blank | 9 comment | 36 complexity | d2ba1aee98a00c113dde5fcdb77b6131 MD5 | raw file
  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' ) or ! defined( 'NV_MAINFILE' ) ) die( 'Stop!!!' );
  9. function nv_site_theme( $contents )
  10. {
  11. global $home, $array_mod_title, $lang_global, $language_array, $global_config, $site_mods, $module_name, $module_file, $module_data, $module_info, $op, $mod_title, $my_head, $my_footer, $client_info;
  12. if( ! file_exists( NV_ROOTDIR . "/themes/" . $global_config['module_theme'] . "/layout/layout." . $module_info['layout_funcs'][$op] . ".tpl" ) )
  13. {
  14. nv_info_die( $lang_global['error_layout_title'], $lang_global['error_layout_title'], $lang_global['error_layout_content'] );
  15. }
  16. $css = nv_html_css();
  17. $js = nv_html_site_js();
  18. if( $client_info['browser']['key'] != "explorer" )
  19. {
  20. if( ! $client_info['is_bot'] ) $css .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"" . NV_BASE_SITEURL . "themes/" . $global_config['module_theme'] . "/css/real.css\" />\n";
  21. }
  22. else
  23. {
  24. unset( $matches );
  25. preg_match( "/^([^0-9]+)([0-9]+)\.(.*)$/", $client_info['browser']['name'], $matches );
  26. $ieversion = ( int )$matches[2];
  27. if( $ieversion == 6 )
  28. {
  29. $css .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"" . NV_BASE_SITEURL . "themes/" . $global_config['module_theme'] . "/css/ie6.css\" />\n";
  30. $js .= "<script type=\"text/javascript\" src=\"" . NV_BASE_SITEURL . "js/fix-png-ie6.js\"></script>\n";
  31. $js .= "<script type=\"text/javascript\">DD_belatedPNG.fix('#');</script>\n";
  32. }
  33. else
  34. {
  35. $css .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"" . NV_BASE_SITEURL . "themes/" . $global_config['module_theme'] . "/css/gtie6.css\" />\n";
  36. if( $ieversion >= 9 )
  37. {
  38. $css .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"" . NV_BASE_SITEURL . "themes/" . $global_config['module_theme'] . "/css/ie9.css\" />\n";
  39. }
  40. }
  41. }
  42. if( defined( 'NV_IS_ADMIN' ) )
  43. {
  44. $css .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"" . NV_BASE_SITEURL . "themes/" . $global_config['module_theme'] . "/css/admin.css\" />\n";
  45. }
  46. if( defined( 'NV_DISPLAY_ERRORS_LIST' ) and NV_DISPLAY_ERRORS_LIST != 0 )
  47. {
  48. $css .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"" . NV_BASE_SITEURL . "themes/" . $global_config['module_theme'] . "/css/tab_info.css\" />\n";
  49. }
  50. $xtpl = new XTemplate( "layout." . $module_info['layout_funcs'][$op] . ".tpl", NV_ROOTDIR . "/themes/" . $global_config['module_theme'] . "/layout/" );
  51. $xtpl->assign( 'LANG', $lang_global );
  52. $xtpl->assign( 'TEMPLATE', $global_config['module_theme'] );
  53. $xtpl->assign( 'NV_BASE_SITEURL', NV_BASE_SITEURL );
  54. $xtpl->assign( 'THEME_META_TAGS', nv_html_meta_tags() );
  55. $xtpl->assign( 'THEME_SITE_JS', $js );
  56. $xtpl->assign( 'THEME_CSS', $css );
  57. $xtpl->assign( 'THEME_PAGE_TITLE', nv_html_page_title() );
  58. $xtpl->assign( 'THEME_SITE_HREF', NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA );
  59. $xtpl->assign( 'MODULE_CONTENT', $contents . "&nbsp;" );
  60. $xtpl->assign( 'THEME_NOJS', $lang_global['nojs'] );
  61. $xtpl->assign( 'THEME_LOGO_TITLE', $global_config['site_name'] );
  62. $xtpl->assign( 'THEME_SITE_RSS', nv_html_site_rss() );
  63. $xtpl->assign( 'THEME_DIGCLOCK_TEXT', nv_date( "H:i T l, d/m/Y", NV_CURRENTTIME ) );
  64. $xtpl->assign( 'THEME_RSS_INDEX_HREF', NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&amp;" . NV_NAME_VARIABLE . "=rss" );
  65. $xtpl->assign( 'THEME_SEARCH_QUERY_MAX_LENGTH', NV_MAX_SEARCH_LENGTH );
  66. $xtpl->assign( 'THEME_SEARCH_SUBMIT_ONCLICK', "nv_search_submit('topmenu_search_query', 'topmenu_search_checkss', 'topmenu_search_submit', " . NV_MIN_SEARCH_LENGTH . ", " . NV_MAX_SEARCH_LENGTH . ");" );
  67. $xtpl->assign( 'THEME_SITE_NAME', sprintf( $lang_global['copyright'], $global_config['site_name'] ) );
  68. $xtpl->assign( 'THEME_CONTACT_EMAIL', $lang_global['email'] . ": " . nv_EncodeEmail( $global_config['site_email'] ) );
  69. $xtpl->assign( 'LOGO_SRC', NV_BASE_SITEURL . $global_config['site_logo'] );
  70. if( $global_config['lang_multi'] and sizeof( $global_config['allow_sitelangs'] ) > 1 )
  71. {
  72. $xtpl->assign( 'SELECTLANGSITE', $lang_global['langsite'] );
  73. foreach( $global_config['allow_sitelangs'] as $lang_i )
  74. {
  75. $langname = $language_array[$lang_i]['name'];
  76. $xtpl->assign( 'LANGSITENAME', $langname );
  77. $xtpl->assign( 'LANGSITEURL', NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . $lang_i );
  78. $xtpl->assign( 'SELECTED', ( NV_LANG_DATA == $lang_i ) ? ' selected' : '' );
  79. $xtpl->parse( 'main.language.langitem' );
  80. }
  81. $xtpl->parse( 'main.language' );
  82. }
  83. else
  84. {
  85. $xtpl->parse( 'main.color_select' );
  86. }
  87. $arr_home['index'] = array( "custom_title" => $lang_global['Home'], "in_menu" => 1 );
  88. $site_mods = array_merge( $arr_home, $site_mods );
  89. $a = 0;
  90. foreach( $site_mods as $modname => $modvalues )
  91. {
  92. if( ! empty( $modvalues['in_menu'] ) )
  93. {
  94. if( $home == 1 && $a == 0 )
  95. {
  96. $module_current = ' class="current"';
  97. }
  98. elseif( $modname == $module_name and $home != 1 )
  99. {
  100. $module_current = ' class="current"';
  101. }
  102. else
  103. {
  104. $module_current = '';
  105. }
  106. if( $modname == "index" )
  107. {
  108. $link = NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA;
  109. }
  110. else
  111. {
  112. $link = NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&amp;" . NV_NAME_VARIABLE . "=" . $modname;
  113. }
  114. $aryay_menu = array(
  115. "title" => $modvalues['custom_title'],
  116. "class" => $modname,
  117. "current" => $module_current,
  118. "link" => $link
  119. );
  120. $xtpl->assign( 'TOP_MENU', $aryay_menu );
  121. $xtpl->parse( 'main.top_menu' );
  122. if( $a <= 5 )
  123. {
  124. if( $a < 5 )
  125. {
  126. $xtpl->parse( 'main.bottom_menu.spector' );
  127. }
  128. $xtpl->parse( 'main.bottom_menu' );
  129. }
  130. }
  131. ++$a;
  132. }
  133. //Breakcolumn
  134. if( $home != 1 )
  135. {
  136. $arr_cat_title_i = array(
  137. 'catid' => 0,
  138. 'title' => $module_info['custom_title'],
  139. 'link' => NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&amp;" . NV_NAME_VARIABLE . "=" . $module_name
  140. );
  141. $xtpl->assign( 'BREAKCOLUMN', $arr_cat_title_i );
  142. $xtpl->parse( 'main.mod_title.breakcolumn' );
  143. foreach( $array_mod_title as $arr_cat_title_i )
  144. {
  145. $xtpl->assign( 'BREAKCOLUMN', $arr_cat_title_i );
  146. $xtpl->parse( 'main.mod_title.breakcolumn' );
  147. }
  148. $xtpl->parse( 'main.mod_title' );
  149. }
  150. // End process cat module
  151. $theme_stat_img = "";
  152. if( $global_config['statistic'] and isset( $site_mods['statistics'] ) )
  153. {
  154. $theme_stat_img .= "<a title=\"" . $lang_global['viewstats'] . "\" href=\"" . NV_BASE_SITEURL . "index.php?" . NV_NAME_VARIABLE . "=statistics\"><img alt=\"" . $lang_global['viewstats'] . "\" title=\"" . $lang_global['viewstats'] . "\" src=\"" . NV_BASE_SITEURL . "index.php?second=statimg&amp;p=" . nv_genpass() . "\" width=\"88\" height=\"31\" /></a><br />\n";
  155. }
  156. $theme_footer_js = "<script type=\"text/javascript\">\n";
  157. $theme_footer_js .= "nv_DigitalClock('digclock');\n";
  158. $theme_footer_js .= "</script>\n";
  159. if( NV_LANG_INTERFACE == 'vi' )
  160. {
  161. $theme_footer_js .= "<script type=\"text/javascript\" src=\"" . NV_BASE_SITEURL . "js/mudim.js\"></script>";
  162. }
  163. $xtpl->assign( 'THEME_STAT_IMG', $theme_stat_img );
  164. $xtpl->assign( 'THEME_IMG_CRONJOBS', NV_BASE_SITEURL . "index.php?second=cronjobs&amp;p=" . nv_genpass() );
  165. // Chuyen doi giao dien
  166. if( ! empty( $global_config['switch_mobi_des'] ) and ! empty( $module_info['mobile'] ) )
  167. {
  168. $num_theme_type = sizeof( $global_config['array_theme_type'] ) - 1;
  169. foreach( $global_config['array_theme_type'] as $i => $theme_type )
  170. {
  171. $xtpl->assign( 'STHEME_TYPE', NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&amp;" . NV_NAME_VARIABLE . "=" . $module_name . "&amp;nv" . NV_LANG_DATA . "themever=" . $theme_type . "&amp;nv_redirect=" . nv_base64_encode( $client_info['selfurl'] ) );
  172. $xtpl->assign( 'STHEME_TITLE', $lang_global['theme_type_' . $i] );
  173. $xtpl->assign( 'STHEME_INFO', sprintf( $lang_global['theme_type_chose'], $lang_global['theme_type_' . $i] ) );
  174. if( $theme_type == $global_config['current_theme_type'] )
  175. {
  176. $xtpl->parse( 'main.theme_type.loop.current' );
  177. }
  178. else
  179. {
  180. $xtpl->parse( 'main.theme_type.loop.other' );
  181. }
  182. if( $i < $num_theme_type ) $xtpl->parse( 'main.theme_type.loop.space' );
  183. $xtpl->parse( 'main.theme_type.loop' );
  184. }
  185. $xtpl->parse( 'main.theme_type' );
  186. }
  187. unset( $theme_type, $i, $num_theme_type );
  188. $xtpl->parse( 'main' );
  189. $sitecontent = $xtpl->text( 'main' );
  190. $sitecontent = nv_blocks_content( $sitecontent );
  191. $sitecontent = str_replace( '[THEME_ERROR_INFO]', nv_error_info(), $sitecontent );
  192. $my_footer = $theme_footer_js . $my_footer;
  193. if( defined( 'NV_IS_ADMIN' ) )
  194. {
  195. $my_footer = nv_admin_menu() . $my_footer;
  196. }
  197. if( ! empty( $my_head ) ) $sitecontent = preg_replace( '/(<\/head>)/i', $my_head . "\\1", $sitecontent, 1 );
  198. if( ! empty( $my_footer ) ) $sitecontent = preg_replace( '/(<\/body>)/i', $my_footer . "\\1", $sitecontent, 1 );
  199. return $sitecontent;
  200. }
  201. ?>