PageRenderTime 50ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 0ms

/NukeViet3.3/themes/modern/theme.php

http://nuke-viet.googlecode.com/
PHP | 196 lines | 167 code | 20 blank | 9 comment | 32 complexity | d89b2bcd83ffc985b3b6fce7e8397b0b MD5 | raw file
Possible License(s): BSD-3-Clause, LGPL-2.1, GPL-2.0
  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, $db, $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( 'CHECKSS', md5( $client_info['session_id'] . $global_config['sitekey'] ) );
  68. $xtpl->assign( 'THEME_SITE_NAME', sprintf( $lang_global['copyright'], $global_config['site_name'] ) );
  69. $xtpl->assign( 'THEME_CONTACT_EMAIL', $lang_global['email'] . ": " . nv_EncodeEmail( $global_config['site_email'] ) );
  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(
  88. "custom_title" => $lang_global['Home'], "in_menu" => 1
  89. );
  90. $site_mods = array_merge( $arr_home, $site_mods );
  91. $a = 0;
  92. foreach ( $site_mods as $modname => $modvalues )
  93. {
  94. if ( ! empty( $modvalues['in_menu'] ) )
  95. {
  96. if ( $home == 1 && $a == 0 )
  97. {
  98. $module_current = ' class="current"';
  99. }
  100. elseif ( $modname == $module_name and $home != 1 )
  101. {
  102. $module_current = ' class="current"';
  103. }
  104. else
  105. {
  106. $module_current = '';
  107. }
  108. if ( $modname == "index" )
  109. {
  110. $link = NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA;
  111. }
  112. else
  113. {
  114. $link = NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&amp;" . NV_NAME_VARIABLE . "=" . $modname;
  115. }
  116. $aryay_menu = array(
  117. "title" => $modvalues['custom_title'], "class" => $modname, "current" => $module_current, "link" => $link
  118. );
  119. $xtpl->assign( 'TOP_MENU', $aryay_menu );
  120. $xtpl->parse( 'main.top_menu' );
  121. if ( $a <= 5 )
  122. {
  123. if ( $a < 5 )
  124. {
  125. $xtpl->parse( 'main.bottom_menu.spector' );
  126. }
  127. $xtpl->parse( 'main.bottom_menu' );
  128. }
  129. }
  130. ++$a;
  131. }
  132. //Breakcolumn
  133. if ( $home != 1 )
  134. {
  135. $arr_cat_title_i = array(
  136. 'catid' => 0, 'title' => $module_info['custom_title'], 'link' => NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&amp;" . NV_NAME_VARIABLE . "=" . $module_name
  137. );
  138. $xtpl->assign( 'BREAKCOLUMN', $arr_cat_title_i );
  139. $xtpl->parse( 'main.mod_title.breakcolumn' );
  140. foreach ( $array_mod_title as $arr_cat_title_i )
  141. {
  142. $xtpl->assign( 'BREAKCOLUMN', $arr_cat_title_i );
  143. $xtpl->parse( 'main.mod_title.breakcolumn' );
  144. }
  145. $xtpl->parse( 'main.mod_title' );
  146. }
  147. //Breakcolumn
  148. # end process cat module
  149. $theme_stat_img = "";
  150. if ( $global_config['statistic'] and isset( $site_mods['statistics'] ) )
  151. {
  152. $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";
  153. }
  154. $theme_footer_js = "<script type=\"text/javascript\">\n";
  155. $theme_footer_js .= "nv_DigitalClock('digclock');\n";
  156. $theme_footer_js .= "</script>\n";
  157. if ( NV_LANG_INTERFACE == 'vi' )
  158. {
  159. $theme_footer_js .= "<script type=\"text/javascript\" src=\"" . NV_BASE_SITEURL . "js/mudim.js\"></script>";
  160. }
  161. $xtpl->assign( 'THEME_STAT_IMG', $theme_stat_img );
  162. $xtpl->assign( 'THEME_IMG_CRONJOBS', NV_BASE_SITEURL . "index.php?second=cronjobs&amp;p=" . nv_genpass() );
  163. $xtpl->parse( 'main' );
  164. $sitecontent = $xtpl->text( 'main' );
  165. $sitecontent = nv_blocks_content($sitecontent);
  166. $sitecontent = str_replace( '[THEME_ERROR_INFO]', nv_error_info(), $sitecontent );
  167. $my_footer = $theme_footer_js . $my_footer;
  168. if ( defined( 'NV_IS_ADMIN' ) )
  169. {
  170. $my_footer = nv_admin_menu() . $my_footer;
  171. }
  172. if ( ! empty( $my_head ) ) $sitecontent = preg_replace( '/(<\/head>)/i', $my_head . "\\1", $sitecontent, 1 );
  173. if ( ! empty( $my_footer ) ) $sitecontent = preg_replace( '/(<\/body>)/i', $my_footer . "\\1", $sitecontent, 1 );
  174. return $sitecontent;
  175. }
  176. ?>