PageRenderTime 52ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/nukeviet/themes/default/theme.php

http://nuke-viet.googlecode.com/
PHP | 190 lines | 144 code | 38 blank | 8 comment | 26 complexity | 6bd4969b679c3e0139da0af5ffd39f0e MD5 | raw file
Possible License(s): BSD-3-Clause, LGPL-2.1, GPL-2.0
  1. <?php
  2. /**
  3. * @Project NUKEVIET 3.x
  4. * @Author VINADES.,JSC (contact@vinades.vn)
  5. * @Copyright (C) 2012 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_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. if( $client_info['browser']['version'] == 6 )
  25. {
  26. $css .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"" . NV_BASE_SITEURL . "themes/" . $global_config['module_theme'] . "/css/ie6.css\" />\n";
  27. $js .= "<script type=\"text/javascript\" src=\"" . NV_BASE_SITEURL . "js/fix-png-ie6.js\"></script>\n";
  28. $js .= "<script type=\"text/javascript\">DD_belatedPNG.fix('#');</script>\n";
  29. }
  30. else
  31. {
  32. $css .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"" . NV_BASE_SITEURL . "themes/" . $global_config['module_theme'] . "/css/gtie6.css\" />\n";
  33. if( $client_info['browser']['version'] >= 9 )
  34. {
  35. $css .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"" . NV_BASE_SITEURL . "themes/" . $global_config['module_theme'] . "/css/ie9.css\" />\n";
  36. }
  37. }
  38. }
  39. if( defined( 'NV_IS_ADMIN' ) )
  40. {
  41. $css .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"" . NV_BASE_SITEURL . "themes/" . $global_config['module_theme'] . "/css/admin.css\" />\n";
  42. }
  43. if( defined( 'NV_DISPLAY_ERRORS_LIST' ) and NV_DISPLAY_ERRORS_LIST != 0 )
  44. {
  45. $css .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"" . NV_BASE_SITEURL . "themes/" . $global_config['module_theme'] . "/css/tab_info.css\" />\n";
  46. }
  47. $xtpl = new XTemplate( "layout." . $module_info['layout_funcs'][$op] . ".tpl", NV_ROOTDIR . "/themes/" . $global_config['module_theme'] . "/layout/" );
  48. $xtpl->assign( 'LANG', $lang_global );
  49. $xtpl->assign( 'TEMPLATE', $global_config['module_theme'] );
  50. $xtpl->assign( 'NV_BASE_SITEURL', NV_BASE_SITEURL );
  51. $xtpl->assign( 'THEME_META_TAGS', nv_html_meta_tags() );
  52. $xtpl->assign( 'THEME_SITE_JS', $js );
  53. $xtpl->assign( 'THEME_CSS', $css );
  54. $xtpl->assign( 'THEME_PAGE_TITLE', nv_html_page_title() );
  55. $xtpl->assign( 'NV_TOP_MENU_HOME', $lang_global['Home'] );
  56. $xtpl->assign( 'MODULE_CONTENT', $contents . "&nbsp;" );
  57. $xtpl->assign( 'THEME_NOJS', $lang_global['nojs'] );
  58. $xtpl->assign( 'THEME_LOGO_TITLE', $global_config['site_name'] );
  59. $xtpl->assign( 'THEME_SITE_HREF', NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA );
  60. $xtpl->assign( 'THEME_SITE_RSS', nv_html_site_rss() );
  61. $xtpl->assign( 'THEME_DIGCLOCK_TEXT', nv_date( "H:i T l, d/m/Y", NV_CURRENTTIME ) );
  62. $xtpl->assign( 'THEME_SEARCH_QUERY_MAX_LENGTH', NV_MAX_SEARCH_LENGTH );
  63. $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 . ");" );
  64. $xtpl->assign( 'SITE_NAME', $global_config['site_name'] );
  65. $xtpl->assign( 'LOGO_SRC', NV_BASE_SITEURL . $global_config['site_logo'] );
  66. if( $global_config['lang_multi'] and sizeof( $global_config['allow_sitelangs'] ) > 1 )
  67. {
  68. $xtpl->assign( 'SELECTLANGSITE', $lang_global['langsite'] );
  69. foreach( $global_config['allow_sitelangs'] as $lang_i )
  70. {
  71. $langname = $language_array[$lang_i]['name'];
  72. $xtpl->assign( 'LANGSITENAME', $langname );
  73. $xtpl->assign( 'LANGSITEURL', NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . $lang_i );
  74. if( NV_LANG_DATA != $lang_i )
  75. {
  76. $xtpl->parse( 'main.language.langitem' );
  77. }
  78. else
  79. {
  80. $xtpl->parse( 'main.language.langcuritem' );
  81. }
  82. }
  83. $xtpl->parse( 'main.language' );
  84. }
  85. //Breakcolumn
  86. if( $home != 1 )
  87. {
  88. $arr_cat_title_i = array(
  89. 'catid' => 0,
  90. 'title' => $module_info['custom_title'],
  91. 'link' => NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&amp;" . NV_NAME_VARIABLE . "=" . $module_name
  92. );
  93. $xtpl->assign( 'BREAKCOLUMN', $arr_cat_title_i );
  94. $xtpl->parse( 'main.mod_title.breakcolumn' );
  95. foreach( $array_mod_title as $arr_cat_title_i )
  96. {
  97. $xtpl->assign( 'BREAKCOLUMN', $arr_cat_title_i );
  98. $xtpl->parse( 'main.mod_title.breakcolumn' );
  99. }
  100. $xtpl->parse( 'main.mod_title' );
  101. }
  102. $theme_stat_img = "";
  103. if( $global_config['statistic'] and isset( $site_mods['statistics'] ) )
  104. {
  105. $theme_stat_img .= "<a title=\"" . $lang_global['viewstats'] . "\" href=\"" . NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&amp;" . 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>\n";
  106. }
  107. $theme_footer_js = "<script type=\"text/javascript\">\n";
  108. $theme_footer_js .= "nv_DigitalClock('digclock');\n";
  109. $theme_footer_js .= "</script>\n";
  110. if( NV_LANG_INTERFACE == 'vi' )
  111. {
  112. $theme_footer_js .= "<script type=\"text/javascript\" src=\"" . NV_BASE_SITEURL . "js/mudim.js\"></script>";
  113. }
  114. $xtpl->assign( 'THEME_STAT_IMG', $theme_stat_img );
  115. $xtpl->assign( 'THEME_IMG_CRONJOBS', NV_BASE_SITEURL . "index.php?second=cronjobs&amp;p=" . nv_genpass() );
  116. // Chuyen doi giao dien
  117. if( ! empty( $global_config['switch_mobi_des'] ) and ! empty( $module_info['mobile'] ) )
  118. {
  119. $num_theme_type = sizeof( $global_config['array_theme_type'] ) - 1;
  120. foreach( $global_config['array_theme_type'] as $i => $theme_type )
  121. {
  122. $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'] ) );
  123. $xtpl->assign( 'STHEME_TITLE', $lang_global['theme_type_' . $i] );
  124. $xtpl->assign( 'STHEME_INFO', sprintf( $lang_global['theme_type_chose'], $lang_global['theme_type_' . $i] ) );
  125. if( $theme_type == $global_config['current_theme_type'] )
  126. {
  127. $xtpl->parse( 'main.theme_type.loop.current' );
  128. }
  129. else
  130. {
  131. $xtpl->parse( 'main.theme_type.loop.other' );
  132. }
  133. if( $i < $num_theme_type ) $xtpl->parse( 'main.theme_type.loop.space' );
  134. $xtpl->parse( 'main.theme_type.loop' );
  135. }
  136. $xtpl->parse( 'main.theme_type' );
  137. }
  138. unset( $theme_type, $i, $num_theme_type );
  139. $xtpl->parse( 'main' );
  140. $sitecontent = $xtpl->text( 'main' );
  141. $sitecontent = nv_blocks_content( $sitecontent );
  142. $sitecontent = str_replace( '[THEME_ERROR_INFO]', nv_error_info(), $sitecontent );
  143. $my_footer = $theme_footer_js . $my_footer;
  144. if( defined( 'NV_IS_ADMIN' ) )
  145. {
  146. $my_footer = nv_admin_menu() . $my_footer;
  147. }
  148. if( ! empty( $my_head ) ) $sitecontent = preg_replace( '/(<\/head>)/i', $my_head . "\\1", $sitecontent, 1 );
  149. if( ! empty( $my_footer ) ) $sitecontent = preg_replace( '/(<\/body>)/i', $my_footer . "\\1", $sitecontent, 1 );
  150. return $sitecontent;
  151. }
  152. ?>