function nv_admin_theme($contents, $head_site = 1) { global $global_config, $lang_global, $admin_mods, $site_mods, $admin_menu_mods, $module_name, $module_file, $module_info, $admin_info, $db, $page_title, $submenu, $select_options, $op, $set_active_op, $array_lang_admin, $my_head, $my_footer, $array_mod_title, $array_url_instruction, $op, $client_info; $dir_template = ''; if ($head_site == 1) { $file_name_tpl = 'main.tpl'; if (file_exists(NV_ROOTDIR . '/themes/' . $global_config['admin_theme'] . '/system/' . $file_name_tpl)) { $dir_template = NV_ROOTDIR . '/themes/' . $global_config['admin_theme'] . '/system'; } else { $dir_template = NV_ROOTDIR . '/themes/admin_default/system'; $global_config['admin_theme'] = 'admin_default'; } } else { $file_name_tpl = 'content.tpl'; if (file_exists(NV_ROOTDIR . '/themes/' . $global_config['admin_theme'] . '/system/' . $file_name_tpl)) { $dir_template = NV_ROOTDIR . '/themes/' . $global_config['admin_theme'] . '/system'; } else { $dir_template = NV_ROOTDIR . '/themes/admin_default/system'; $global_config['admin_theme'] = 'admin_default'; } } $global_config['site_name'] = empty($global_config['site_name']) ? NV_SERVER_NAME : $global_config['site_name']; $xtpl = new XTemplate($file_name_tpl, $dir_template); $xtpl->assign('NV_SITE_COPYRIGHT', $global_config['site_name'] . ' [' . $global_config['site_email'] . '] '); $xtpl->assign('NV_SITE_NAME', $global_config['site_name']); $xtpl->assign('NV_SITE_TITLE', $global_config['site_name'] . ' ' . NV_TITLEBAR_DEFIS . ' ' . $lang_global['admin_page'] . ' ' . NV_TITLEBAR_DEFIS . ' ' . $module_info['custom_title']); $xtpl->assign('SITE_DESCRIPTION', $global_config['site_description']); $xtpl->assign('NV_CHECK_PASS_MSTIME', (intval($global_config['admin_check_pass_time']) - 62) * 1000); $xtpl->assign('NV_BASE_SITEURL', NV_BASE_SITEURL); $xtpl->assign('NV_ADMINDIR', NV_ADMINDIR); $xtpl->assign('NV_BASE_ADMINURL', NV_BASE_ADMINURL); $xtpl->assign('NV_ASSETS_DIR', NV_ASSETS_DIR); $xtpl->assign('MODULE_NAME', $module_name); $xtpl->assign('MODULE_FILE', $module_file); $xtpl->assign('NV_ADMIN_THEME', $global_config['admin_theme']); $xtpl->assign('LANG', $lang_global); if (file_exists(NV_ROOTDIR . '/themes/' . $global_config['admin_theme'] . '/css/' . $module_file . '.css')) { $xtpl->assign('NV_CSS_MODULE_THEME', NV_BASE_SITEURL . 'themes/' . $global_config['admin_theme'] . '/css/' . $module_file . '.css'); $xtpl->parse('main.css_module'); } elseif (file_exists(NV_ROOTDIR . '/themes/admin_default/css/' . $module_file . '.css')) { $xtpl->assign('NV_CSS_MODULE_THEME', NV_BASE_SITEURL . 'themes/admin_default/css/' . $module_file . '.css'); $xtpl->parse('main.css_module'); } $xtpl->assign('NV_LANG_VARIABLE', NV_LANG_VARIABLE); $xtpl->assign('NV_LANG_INTERFACE', NV_LANG_INTERFACE); $xtpl->assign('NV_NAME_VARIABLE', NV_NAME_VARIABLE); $xtpl->assign('NV_OP_VARIABLE', NV_OP_VARIABLE); $xtpl->assign('NV_SITE_TIMEZONE_OFFSET', round(NV_SITE_TIMEZONE_OFFSET / 3600)); $xtpl->assign('NV_CURRENTTIME', nv_date('T', NV_CURRENTTIME)); $xtpl->assign('NV_COOKIE_PREFIX', $global_config['cookie_prefix']); if (file_exists(NV_ROOTDIR . '/themes/' . $global_config['admin_theme'] . '/js/' . $module_file . '.js')) { $xtpl->assign('NV_JS_MODULE', NV_BASE_SITEURL . 'themes/' . $global_config['admin_theme'] . '/js/' . $module_file . '.js'); $xtpl->parse('main.module_js'); } if (defined('NV_EDITOR') and nv_function_exists('nv_add_editor_js')) { $xtpl->assign('NV_ADD_EDITOR_JS', nv_add_editor_js()); $xtpl->parse('main.nv_add_editor_js'); } if ($head_site == 1) { $xtpl->assign('NV_GO_CLIENTSECTOR', $lang_global['go_clientsector']); $lang_site = !empty($site_mods) ? NV_LANG_DATA : $global_config['site_lang']; $xtpl->assign('NV_GO_CLIENTSECTOR_URL', NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . $lang_site); $xtpl->assign('NV_LOGOUT', $lang_global['admin_logout_title']); if (!empty($array_lang_admin)) { $xtpl->assign('NV_LANGDATA', $lang_global['langdata']); $xtpl->assign('NV_LANGDATA_CURRENT', $array_lang_admin[NV_LANG_DATA]); foreach ($array_lang_admin as $lang_i => $lang_name) { $xtpl->assign('DISABLED', $lang_i == NV_LANG_DATA ? " class=\"disabled\"" : ""); $xtpl->assign('LANGVALUE', $lang_name); $xtpl->assign('LANGOP', NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . $lang_i); $xtpl->parse('main.langdata.option'); } $xtpl->parse('main.langdata'); } // Top_menu $top_menu = $admin_mods; if (sizeof($top_menu) > 8) { if ($module_name != 'authors') { unset($top_menu['authors']); } if ($module_name != 'language') { unset($top_menu['language']); } } foreach ($top_menu as $m => $v) { if (!empty($v['custom_title'])) { $array_submenu = nv_get_submenu($m); $xtpl->assign('TOP_MENU_CLASS', $array_submenu ? ' class="dropdown"' : ''); $xtpl->assign('TOP_MENU_HREF', $m); $xtpl->assign('TOP_MENU_NAME', $v['custom_title']); if (!empty($array_submenu)) { $xtpl->parse('main.top_menu_loop.has_sub'); foreach ($array_submenu as $mop => $submenu_i) { $xtpl->assign('SUBMENULINK', NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $m . '&' . NV_OP_VARIABLE . '=' . $mop); $xtpl->assign('SUBMENUTITLE', $submenu_i); $xtpl->parse('main.top_menu_loop.submenu.submenu_loop'); } $xtpl->parse('main.top_menu_loop.submenu'); } $xtpl->parse('main.top_menu_loop'); } } $xtpl->parse('main.top_menu'); $xtpl->assign('NV_DIGCLOCK', nv_date('H:i T l, d/m/Y', NV_CURRENTTIME)); if ($admin_info['current_login'] >= NV_CURRENTTIME - 60) { if (!empty($admin_info['last_login'])) { $temp = sprintf($lang_global['hello_admin1'], $admin_info['username'], date('H:i d/m/Y', $admin_info['last_login']), $admin_info['last_ip']); $xtpl->assign('HELLO_ADMIN1', $temp); $xtpl->parse('main.hello_admin'); } else { $temp = sprintf($lang_global['hello_admin3'], $admin_info['username']); $xtpl->assign('HELLO_ADMIN3', $temp); $xtpl->parse('main.hello_admin3'); } } else { $temp = sprintf($lang_global['hello_admin2'], $admin_info['username'], nv_convertfromSec(NV_CURRENTTIME - $admin_info['current_login']), $admin_info['current_ip']); $xtpl->assign('HELLO_ADMIN2', $temp); $xtpl->parse('main.hello_admin2'); } // Admin photo $xtpl->assign('ADMIN_USERNAME', $admin_info['username']); if (!empty($admin_info['photo']) and file_exists(NV_ROOTDIR . '/' . $admin_info['photo'])) { $xtpl->assign('ADMIN_PHOTO', NV_BASE_SITEURL . $admin_info['photo']); } else { $xtpl->assign('ADMIN_PHOTO', NV_BASE_SITEURL . 'themes/default/images/users/no_avatar.png'); } // Vertical menu foreach ($admin_menu_mods as $m => $v) { $xtpl->assign('MENU_CLASS', $module_name == $m ? ' class="active"' : ''); $xtpl->assign('MENU_HREF', $m); $xtpl->assign('MENU_NAME', $v); if ($m != $module_name) { $submenu = nv_get_submenu_mod($m); $xtpl->assign('MENU_CLASS', $submenu ? ' class="dropdown"' : ''); if (!empty($submenu)) { foreach ($submenu as $n => $l) { $xtpl->assign('MENU_SUB_HREF', $m); $xtpl->assign('MENU_SUB_OP', $n); $xtpl->assign('MENU_SUB_NAME', (is_array($l) and isset($l['title'])) ? $l['title'] : $l); $xtpl->parse('main.menu_loop.submenu.loop'); } $xtpl->parse('main.menu_loop.submenu'); } } elseif (!empty($submenu)) { foreach ($submenu as $n => $l) { if (is_array($l) and isset($l['submenu'])) { $_subtitle = $l['title']; $_submenu_i = $l['submenu']; } else { $_subtitle = $l; $_submenu_i = ''; } $xtpl->assign('MENU_SUB_CURRENT', (!empty($op) and $op == $n or !empty($set_active_op) and $set_active_op == $n) ? 'subactive' : 'subcurrent'); $xtpl->assign('MENU_SUB_HREF', $m); $xtpl->assign('MENU_SUB_OP', $n); $xtpl->assign('MENU_SUB_NAME', $_subtitle); $xtpl->assign('MENU_CLASS', ''); if (!empty($_submenu_i)) { $xtpl->assign('MENU_CLASS', ' class="dropdown"'); foreach ($_submenu_i as $sn => $sl) { $xtpl->assign('CUR_SUB_OP', $sn); $xtpl->assign('CUR_SUB_NAME', $sl); $xtpl->parse('main.menu_loop.current.submenu.loop'); } $xtpl->parse('main.menu_loop.current.submenu'); } $xtpl->parse('main.menu_loop.current'); } } $xtpl->parse('main.menu_loop'); } // Notification icon if ($global_config['notification_active']) { $xtpl->parse('main.notification'); $xtpl->parse('main.notification_js'); } } if (!empty($select_options)) { $xtpl->assign('PLEASE_SELECT', $lang_global['please_select']); foreach ($select_options as $value => $link) { $xtpl->assign('SELECT_NAME', $link); $xtpl->assign('SELECT_VALUE', $value); $xtpl->parse('main.select_option.select_option_loop'); } $xtpl->parse('main.select_option'); } elseif (isset($site_mods[$module_name]['main_file']) and $site_mods[$module_name]['main_file']) { $xtpl->assign('NV_GO_CLIENTMOD', $lang_global['go_clientmod']); $xtpl->parse('main.site_mods'); } if (!empty($array_url_instruction)) { foreach ($array_url_instruction as $key => $value) { if ($op == $key and filter_var($value, FILTER_VALIDATE_URL)) { $xtpl->assign('NV_INSTRUCTION', $lang_global['go_instrucion']); $xtpl->assign('NV_URL_INSTRUCTION', $value); $xtpl->parse('main.url_instruction'); break; } } } /** * Breadcrumbs * Note: If active is true, the link will be dismiss * If empty $array_mod_title and $page_title, breadcrumbs do not display * By default, breadcrumbs is $page_title */ if (empty($array_mod_title) and !empty($page_title)) { $array_mod_title = array(0 => array('title' => $page_title, 'link' => '', 'active' => true)); } if (!empty($array_mod_title)) { foreach ($array_mod_title as $breadcrumbs) { $xtpl->assign('BREADCRUMBS', $breadcrumbs); if (!empty($breadcrumbs['active'])) { $xtpl->parse('main.breadcrumbs.loop.active'); } if (!empty($breadcrumbs['link']) and empty($breadcrumbs['active'])) { $xtpl->parse('main.breadcrumbs.loop.linked'); } else { $xtpl->parse('main.breadcrumbs.loop.text'); } $xtpl->parse('main.breadcrumbs.loop'); } $xtpl->parse('main.breadcrumbs'); } $xtpl->assign('THEME_ERROR_INFO', nv_error_info()); $xtpl->assign('MODULE_CONTENT', $contents); $xtpl->assign('NV_COPYRIGHT', sprintf($lang_global['copyright'], $global_config['site_name'])); if (defined('CKEDITOR')) { $xtpl->parse('main.ckeditor'); } if (defined('NV_IS_SPADMIN') and $admin_info['level'] == 1) { $xtpl->parse('main.memory_time_usage'); } if ($client_info['browser']['key'] == 'explorer' and $client_info['browser']['version'] < 9) { $xtpl->parse('main.lt_ie9'); } $xtpl->parse('main'); $sitecontent = $xtpl->text('main'); if (!empty($my_head)) { $sitecontent = preg_replace('/(<\\/head>)/i', $my_head . "\\1", $sitecontent, 1); } if (!empty($my_footer)) { $sitecontent = preg_replace('/(<\\/body>)/i', $my_footer . "\\1", $sitecontent, 1); } return $sitecontent; }
function nv_site_theme($contents, $full = true) { global $home, $array_mod_title, $lang_global, $language_array, $global_config, $site_mods, $module_name, $module_info, $op_file, $mod_title, $my_head, $my_footer, $client_info, $module_config, $op, $drag_block; // Determine tpl file, check exists tpl file $layout_file = $full ? 'layout.' . $module_info['layout_funcs'][$op_file] . '.tpl' : 'simple.tpl'; if (!file_exists(NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/layout/' . $layout_file)) { nv_info_die($lang_global['error_layout_title'], $lang_global['error_layout_title'], $lang_global['error_layout_content']); } if (isset($global_config['sitetimestamp'])) { $global_config['timestamp'] += $global_config['sitetimestamp']; } $css = nv_html_css(); // Css for admin if (defined('NV_IS_ADMIN') and $full) { $css .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"" . NV_BASE_SITEURL . "themes/" . $global_config['module_theme'] . "/css/admin.css\" />\n"; } // Style config if (isset($module_config['themes'][$global_config['module_theme']])) { if (!file_exists(NV_ROOTDIR . '/' . SYSTEM_FILES_DIR . '/css/theme_' . $global_config['module_theme'] . '_' . $global_config['idsite'] . '.css')) { $config_theme = unserialize($module_config['themes'][$global_config['module_theme']]); $css_content = nv_css_setproperties('body', $config_theme['body']); $css_content .= nv_css_setproperties('a, a:link, a:active, a:visited', $config_theme['a_link']); $css_content .= nv_css_setproperties('a:hover', $config_theme['a_link_hover']); $css_content .= nv_css_setproperties('#wraper', $config_theme['content']); $css_content .= nv_css_setproperties('#header, #banner', $config_theme['header']); $css_content .= nv_css_setproperties('#footer', $config_theme['footer']); $css_content .= nv_css_setproperties('.panel, .well, .nv-block-banners', $config_theme['block']); $css_content .= nv_css_setproperties('.panel-default>.panel-heading', $config_theme['block_heading']); $css_content .= nv_css_setproperties('generalcss', $config_theme['generalcss']); // Không nên thay đổi "generalcss" file_put_contents(NV_ROOTDIR . '/' . SYSTEM_FILES_DIR . '/css/theme_' . $global_config['module_theme'] . '_' . $global_config['idsite'] . '.css', $css_content); unset($config_theme, $css_content); } $my_footer .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"" . NV_BASE_SITEURL . SYSTEM_FILES_DIR . "/css/theme_" . $global_config['module_theme'] . "_" . $global_config['idsite'] . ".css?t=" . $global_config['timestamp'] . "\" />\n"; } $xtpl = new XTemplate($layout_file, NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/layout'); $xtpl->assign('LANG', $lang_global); $xtpl->assign('TEMPLATE', $global_config['module_theme']); $xtpl->assign('NV_BASE_SITEURL', NV_BASE_SITEURL); // System variables $xtpl->assign('THEME_PAGE_TITLE', nv_html_page_title()); $xtpl->assign('THEME_META_TAGS', nv_html_meta_tags()); $xtpl->assign('THEME_SITE_RSS', nv_html_site_rss()); $xtpl->assign('THEME_CSS', $css); $xtpl->assign('THEME_SITE_JS', nv_html_site_js()); // Module contents $xtpl->assign('MODULE_CONTENT', $contents); // Header variables $xtpl->assign('SITE_NAME', $global_config['site_name']); $xtpl->assign('THEME_SITE_HREF', NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA); $xtpl->assign('LOGO_SRC', NV_BASE_SITEURL . $global_config['site_logo']); $size = @getimagesize(NV_ROOTDIR . '/' . $global_config['site_logo']); $xtpl->assign('LOGO_WIDTH', $size[0]); $xtpl->assign('LOGO_HEIGHT', $size[1]); if (isset($size['mime']) and $size['mime'] == 'application/x-shockwave-flash') { $xtpl->parse('main.swf'); } else { $xtpl->parse('main.image'); } if ($op == 'main') { $xtpl->parse('main.main_h1'); } else { $xtpl->parse('main.main_none_h1'); } // Only full theme if ($full) { // Search form variables $xtpl->assign('THEME_SEARCH_QUERY_MAX_LENGTH', NV_MAX_SEARCH_LENGTH); $xtpl->assign('THEME_SEARCH_SUBMIT_ONCLICK', "nv_search_submit('topmenu_search_query', 'topmenu_search_submit', " . NV_MIN_SEARCH_LENGTH . ", " . NV_MAX_SEARCH_LENGTH . ");"); // Breadcrumbs if ($home != 1) { if ($global_config['rewrite_op_mod'] != $module_name) { $arr_cat_title_i = array('catid' => 0, 'title' => $module_info['custom_title'], 'link' => NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name); array_unshift($array_mod_title, $arr_cat_title_i); } if (!empty($array_mod_title)) { foreach ($array_mod_title as $arr_cat_title_i) { $xtpl->assign('BREADCRUMBS', $arr_cat_title_i); $xtpl->parse('main.breadcrumbs.loop'); } $xtpl->parse('main.breadcrumbs'); } } // Statistics image $theme_stat_img = ''; if ($global_config['statistic'] and isset($site_mods['statistics'])) { $theme_stat_img .= "<a title=\"" . $lang_global['viewstats'] . "\" href=\"" . NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&" . NV_NAME_VARIABLE . "=statistics\"><img alt=\"" . $lang_global['viewstats'] . "\" src=\"" . NV_BASE_SITEURL . "index.php?second=statimg&p=" . nv_genpass() . "\" width=\"88\" height=\"31\" /></a>\n"; } $xtpl->assign('THEME_STAT_IMG', $theme_stat_img); // Change theme types if (!empty($global_config['switch_mobi_des'])) { $mobile_theme = empty($module_info['mobile']) ? $global_config['mobile_theme'] : $module_info['mobile']; if (!empty($mobile_theme)) { $num_theme_type = sizeof($global_config['array_theme_type']) - 1; foreach ($global_config['array_theme_type'] as $i => $theme_type) { $xtpl->assign('STHEME_TYPE', NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&nv' . NV_LANG_DATA . 'themever=' . $theme_type . '&nv_redirect=' . nv_base64_encode($client_info['selfurl'])); $xtpl->assign('STHEME_TITLE', $lang_global['theme_type_' . $theme_type]); $xtpl->assign('STHEME_INFO', sprintf($lang_global['theme_type_chose'], $lang_global['theme_type_' . $theme_type])); if ($theme_type == $global_config['current_theme_type']) { $xtpl->parse('main.theme_type.loop.current'); } else { $xtpl->parse('main.theme_type.loop.other'); } if ($i < $num_theme_type) { $xtpl->parse('main.theme_type.loop.space'); } $xtpl->parse('main.theme_type.loop'); } $xtpl->parse('main.theme_type'); } } } if (!$drag_block) { $xtpl->parse('main.no_drag_block'); } $xtpl->parse('main'); $sitecontent = $xtpl->text('main'); // Only full theme if ($full) { $sitecontent = nv_blocks_content($sitecontent); $sitecontent = str_replace('[THEME_ERROR_INFO]', nv_error_info(), $sitecontent); if (defined('NV_IS_ADMIN')) { $my_footer = nv_admin_menu() . $my_footer; } } if (!empty($my_head)) { $sitecontent = preg_replace('/(<\\/head>)/i', $my_head . '\\1', $sitecontent, 1); } if (!empty($my_footer)) { $sitecontent = preg_replace('/(<\\/body>)/i', $my_footer . '\\1', $sitecontent, 1); } return $sitecontent; }
function nv_site_theme($contents) { 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; if (!file_exists(NV_ROOTDIR . "/themes/" . $global_config['module_theme'] . "/layout/layout." . $module_info['layout_funcs'][$op] . ".tpl")) { nv_info_die($lang_global['error_layout_title'], $lang_global['error_layout_title'], $lang_global['error_layout_content']); } $css = nv_html_css(); $js = nv_html_site_js(); if ($client_info['browser']['key'] != "explorer") { 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"; } } else { if ($client_info['browser']['version'] == 6) { $css .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"" . NV_BASE_SITEURL . "themes/" . $global_config['module_theme'] . "/css/ie6.css\" />\n"; $js .= "<script type=\"text/javascript\" src=\"" . NV_BASE_SITEURL . "js/fix-png-ie6.js\"></script>\n"; $js .= "<script type=\"text/javascript\">DD_belatedPNG.fix('#');</script>\n"; } else { $css .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"" . NV_BASE_SITEURL . "themes/" . $global_config['module_theme'] . "/css/gtie6.css\" />\n"; if ($client_info['browser']['version'] >= 9) { $css .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"" . NV_BASE_SITEURL . "themes/" . $global_config['module_theme'] . "/css/ie9.css\" />\n"; } } } if (defined('NV_IS_ADMIN')) { $css .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"" . NV_BASE_SITEURL . "themes/" . $global_config['module_theme'] . "/css/admin.css\" />\n"; } if (defined('NV_DISPLAY_ERRORS_LIST') and NV_DISPLAY_ERRORS_LIST != 0) { $css .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"" . NV_BASE_SITEURL . "themes/" . $global_config['module_theme'] . "/css/tab_info.css\" />\n"; } $xtpl = new XTemplate("layout." . $module_info['layout_funcs'][$op] . ".tpl", NV_ROOTDIR . "/themes/" . $global_config['module_theme'] . "/layout/"); $xtpl->assign('LANG', $lang_global); $xtpl->assign('TEMPLATE', $global_config['module_theme']); $xtpl->assign('NV_BASE_SITEURL', NV_BASE_SITEURL); $xtpl->assign('THEME_META_TAGS', nv_html_meta_tags()); $xtpl->assign('THEME_SITE_JS', $js); $xtpl->assign('THEME_CSS', $css); $xtpl->assign('THEME_PAGE_TITLE', nv_html_page_title()); $xtpl->assign('NV_TOP_MENU_HOME', $lang_global['Home']); $xtpl->assign('MODULE_CONTENT', $contents . " "); $xtpl->assign('THEME_NOJS', $lang_global['nojs']); $xtpl->assign('THEME_LOGO_TITLE', $global_config['site_name']); $xtpl->assign('THEME_SITE_HREF', NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA); $xtpl->assign('THEME_SITE_RSS', nv_html_site_rss()); $xtpl->assign('THEME_DIGCLOCK_TEXT', nv_date("H:i T l, d/m/Y", NV_CURRENTTIME)); $xtpl->assign('THEME_SEARCH_QUERY_MAX_LENGTH', NV_MAX_SEARCH_LENGTH); $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 . ");"); $xtpl->assign('SITE_NAME', $global_config['site_name']); $xtpl->assign('LOGO_SRC', NV_BASE_SITEURL . $global_config['site_logo']); if ($global_config['lang_multi'] and sizeof($global_config['allow_sitelangs']) > 1) { $xtpl->assign('SELECTLANGSITE', $lang_global['langsite']); foreach ($global_config['allow_sitelangs'] as $lang_i) { $langname = $language_array[$lang_i]['name']; $xtpl->assign('LANGSITENAME', $langname); $xtpl->assign('LANGSITEURL', NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . $lang_i); if (NV_LANG_DATA != $lang_i) { $xtpl->parse('main.language.langitem'); } else { $xtpl->parse('main.language.langcuritem'); } } $xtpl->parse('main.language'); } //Breakcolumn if ($home != 1) { $arr_cat_title_i = array('catid' => 0, 'title' => $module_info['custom_title'], 'link' => NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&" . NV_NAME_VARIABLE . "=" . $module_name); $xtpl->assign('BREAKCOLUMN', $arr_cat_title_i); $xtpl->parse('main.mod_title.breakcolumn'); foreach ($array_mod_title as $arr_cat_title_i) { $xtpl->assign('BREAKCOLUMN', $arr_cat_title_i); $xtpl->parse('main.mod_title.breakcolumn'); } $xtpl->parse('main.mod_title'); } $theme_stat_img = ""; if ($global_config['statistic'] and isset($site_mods['statistics'])) { $theme_stat_img .= "<a title=\"" . $lang_global['viewstats'] . "\" href=\"" . NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&" . NV_NAME_VARIABLE . "=statistics\"><img alt=\"" . $lang_global['viewstats'] . "\" title=\"" . $lang_global['viewstats'] . "\" src=\"" . NV_BASE_SITEURL . "index.php?second=statimg&p=" . nv_genpass() . "\" width=\"88\" height=\"31\" /></a>\n"; } $theme_footer_js = "<script type=\"text/javascript\">\n"; $theme_footer_js .= "nv_DigitalClock('digclock');\n"; $theme_footer_js .= "</script>\n"; if (NV_LANG_INTERFACE == 'vi') { $theme_footer_js .= "<script type=\"text/javascript\" src=\"" . NV_BASE_SITEURL . "js/mudim.js\"></script>"; } $xtpl->assign('THEME_STAT_IMG', $theme_stat_img); $xtpl->assign('THEME_IMG_CRONJOBS', NV_BASE_SITEURL . "index.php?second=cronjobs&p=" . nv_genpass()); // Chuyen doi giao dien if (!empty($global_config['switch_mobi_des']) and !empty($module_info['mobile'])) { $num_theme_type = sizeof($global_config['array_theme_type']) - 1; foreach ($global_config['array_theme_type'] as $i => $theme_type) { $xtpl->assign('STHEME_TYPE', NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&" . NV_NAME_VARIABLE . "=" . $module_name . "&nv" . NV_LANG_DATA . "themever=" . $theme_type . "&nv_redirect=" . nv_base64_encode($client_info['selfurl'])); $xtpl->assign('STHEME_TITLE', $lang_global['theme_type_' . $i]); $xtpl->assign('STHEME_INFO', sprintf($lang_global['theme_type_chose'], $lang_global['theme_type_' . $i])); if ($theme_type == $global_config['current_theme_type']) { $xtpl->parse('main.theme_type.loop.current'); } else { $xtpl->parse('main.theme_type.loop.other'); } if ($i < $num_theme_type) { $xtpl->parse('main.theme_type.loop.space'); } $xtpl->parse('main.theme_type.loop'); } $xtpl->parse('main.theme_type'); } unset($theme_type, $i, $num_theme_type); $xtpl->parse('main'); $sitecontent = $xtpl->text('main'); $sitecontent = nv_blocks_content($sitecontent); $sitecontent = str_replace('[THEME_ERROR_INFO]', nv_error_info(), $sitecontent); $my_footer = $theme_footer_js . $my_footer; if (defined('NV_IS_ADMIN')) { $my_footer = nv_admin_menu() . $my_footer; } if (!empty($my_head)) { $sitecontent = preg_replace('/(<\\/head>)/i', $my_head . "\\1", $sitecontent, 1); } if (!empty($my_footer)) { $sitecontent = preg_replace('/(<\\/body>)/i', $my_footer . "\\1", $sitecontent, 1); } return $sitecontent; }
function nv_site_theme($contents, $full = true) { global $home, $array_mod_title, $lang_global, $language_array, $global_config, $site_mods, $module_name, $module_info, $op_file, $mod_title, $my_head, $my_footer, $client_info, $module_config, $op, $drag_block; // Determine tpl file, check exists tpl file $layout_file = $full ? 'layout.' . $module_info['layout_funcs'][$op_file] . '.tpl' : 'simple.tpl'; if (!file_exists(NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/layout/' . $layout_file)) { nv_info_die($lang_global['error_layout_title'], $lang_global['error_layout_title'], $lang_global['error_layout_content']); } if (isset($global_config['sitetimestamp'])) { $global_config['timestamp'] += $global_config['sitetimestamp']; } $xtpl = new XTemplate($layout_file, NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/layout'); $xtpl->assign('LANG', $lang_global); $xtpl->assign('TEMPLATE', $global_config['module_theme']); $xtpl->assign('NV_BASE_SITEURL', NV_BASE_SITEURL); // System variables $xtpl->assign('THEME_PAGE_TITLE', nv_html_page_title(false)); // Meta-tags $metatags = nv_html_meta_tags(false); $metatags[] = array('name' => 'name', 'value' => 'viewport', 'content' => 'width=device-width, initial-scale=1'); foreach ($metatags as $meta) { $xtpl->assign('THEME_META_TAGS', $meta); $xtpl->parse('main.metatags'); } //Links $html_links = array(); $html_links[] = array('rel' => 'StyleSheet', 'href' => NV_BASE_SITEURL . 'themes/default/css/font-awesome.min.css'); $html_links[] = array('rel' => 'StyleSheet', 'href' => NV_BASE_SITEURL . 'themes/' . $global_config['module_theme'] . '/css/bootstrap.min.css'); $html_links[] = array('rel' => 'StyleSheet', 'href' => NV_BASE_SITEURL . 'themes/' . $global_config['module_theme'] . '/css/style.css'); if (defined('NV_IS_ADMIN') and $full) { $html_links[] = array('rel' => 'StyleSheet', 'href' => NV_BASE_SITEURL . 'themes/' . $global_config['module_theme'] . '/css/admin.css'); } $html_links += nv_html_links(false); // Customs Style if (isset($module_config['themes'][$global_config['module_theme']]) and !empty($module_config['themes'][$global_config['module_theme']])) { $config_theme = unserialize($module_config['themes'][$global_config['module_theme']]); if (isset($config_theme['css_content']) && !empty($config_theme['css_content'])) { $customFileName = $global_config['module_theme'] . '.' . NV_LANG_DATA . '.' . $global_config['idsite']; if (!file_exists(NV_ROOTDIR . '/' . NV_ASSETS_DIR . '/css/' . $customFileName . '.css')) { $replace = array('[body]' => 'body', '[a_link]' => 'a, a:link, a:active, a:visited', '[a_link_hover]' => 'a:hover', '[content]' => '.wraper', '[header]' => '#header', '[footer]' => '#footer', '[block]' => '.panel, .well, .nv-block-banners', '[block_heading]' => '.panel-default > .panel-heading'); $css_content = str_replace(array_keys($replace), array_values($replace), $config_theme['css_content']); file_put_contents(NV_ROOTDIR . '/' . NV_ASSETS_DIR . '/css/' . $customFileName . '.css', $css_content); } $html_links[] = array('rel' => 'StyleSheet', 'href' => NV_BASE_SITEURL . NV_ASSETS_DIR . '/css/' . $customFileName . '.css?t=' . $global_config['timestamp']); } if (isset($config_theme['gfont']) && !empty($config_theme['gfont']) && isset($config_theme['gfont']['family']) && !empty($config_theme['gfont']['family'])) { $subset = isset($config_theme['gfont']['subset']) ? $config_theme['gfont']['subset'] : ''; $gf = new Gfonts(array('fonts' => array($config_theme['gfont']), 'subset' => $subset), $client_info); $webFontFile = $gf->getUrlCss(); array_unshift($html_links, array('rel' => 'StyleSheet', 'href' => $webFontFile)); } unset($config_theme, $css_content, $webFontFile, $font, $subset, $gf); } foreach ($html_links as $links) { foreach ($links as $key => $value) { $xtpl->assign('LINKS', array('key' => $key, 'value' => $value)); $xtpl->parse('main.links.attr'); } $xtpl->parse('main.links'); } $html_js = nv_html_site_js(false); $html_js[] = array('ext' => 1, 'content' => NV_BASE_SITEURL . 'themes/' . $global_config['module_theme'] . '/js/main.js'); foreach ($html_js as $js) { if ($js['ext']) { $xtpl->assign('JS_SRC', $js['content']); $xtpl->parse('main.js.ext'); } else { $xtpl->assign('JS_CONTENT', PHP_EOL . $js['content'] . PHP_EOL); $xtpl->parse('main.js.int'); } $xtpl->parse('main.js'); } if ($client_info['browser']['key'] == 'explorer' and $client_info['browser']['version'] < 9) { $xtpl->parse('main.lt_ie9'); } // Module contents $xtpl->assign('MODULE_CONTENT', $contents); // Header variables $xtpl->assign('SITE_NAME', $global_config['site_name']); $xtpl->assign('SITE_DESCRIPTION', $global_config['site_description']); $xtpl->assign('THEME_SITE_HREF', NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA); $logo_small = preg_replace('/(\\.[a-z]+)$/i', '_small\\1', $global_config['site_logo']); $logo = file_exists(NV_ROOTDIR . '/' . $logo_small) ? $logo_small : $global_config['site_logo']; $size = @getimagesize(NV_ROOTDIR . '/' . $logo); $logo_svg = preg_replace('/\\.[a-z]+$/i', '.svg', $logo); file_exists(NV_ROOTDIR . '/' . $logo_svg) && ($logo = $logo_svg); $xtpl->assign('LOGO_SRC', NV_BASE_SITEURL . $logo); $xtpl->assign('LOGO_WIDTH', $size[0]); $xtpl->assign('LOGO_HEIGHT', $size[1]); if (isset($size['mime']) and $size['mime'] == 'application/x-shockwave-flash') { $xtpl->parse('main.swf'); } else { $xtpl->parse('main.image'); } // Only full theme if ($full) { // Search form variables $xtpl->assign('NV_MAX_SEARCH_LENGTH', NV_MAX_SEARCH_LENGTH); $xtpl->assign('NV_MIN_SEARCH_LENGTH', NV_MIN_SEARCH_LENGTH); $xtpl->assign('THEME_SEARCH_URL', NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=seek&q='); // Breadcrumbs if ($home != 1) { if ($global_config['rewrite_op_mod'] != $module_name) { $arr_cat_title_i = array('catid' => 0, 'title' => $module_info['custom_title'], 'link' => NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name); array_unshift($array_mod_title, $arr_cat_title_i); } if (!empty($array_mod_title)) { foreach ($array_mod_title as $arr_cat_title_i) { $xtpl->assign('BREADCRUMBS', $arr_cat_title_i); $xtpl->parse('main.breadcrumbs.loop'); } $xtpl->parse('main.breadcrumbs'); } } // Statistics image $theme_stat_img = ''; if ($global_config['statistic'] and isset($site_mods['statistics'])) { $theme_stat_img .= "<a title=\"" . $lang_global['viewstats'] . "\" href=\"" . NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&" . NV_NAME_VARIABLE . "=statistics\"><img alt=\"" . $lang_global['viewstats'] . "\" src=\"" . NV_BASE_SITEURL . "index.php?second=statimg&p=" . nv_genpass() . "\" width=\"88\" height=\"31\" /></a>\n"; } $xtpl->assign('THEME_STAT_IMG', $theme_stat_img); // Change theme types foreach ($global_config['array_theme_type'] as $theme_type) { $xtpl->assign('STHEME_TYPE', NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&nv' . NV_LANG_DATA . 'themever=' . $theme_type . '&nv_redirect=' . nv_base64_encode($client_info['selfurl'])); $xtpl->assign('STHEME_TITLE', $lang_global['theme_type_' . $theme_type]); $xtpl->assign('STHEME_INFO', sprintf($lang_global['theme_type_chose'], $lang_global['theme_type_' . $theme_type])); if ($theme_type != $global_config['current_theme_type']) { $xtpl->parse('main.theme_type.loop.other'); } $xtpl->parse('main.theme_type.loop'); } $xtpl->parse('main.theme_type'); if (defined('NV_IS_ADMIN')) { $xtpl->assign('ADMINTOOLBAR', nv_admin_menu()); } } if (!$drag_block) { $xtpl->parse('main.no_drag_block'); } $xtpl->parse('main'); $sitecontent = $xtpl->text('main'); // Only full theme if ($full) { $sitecontent = nv_blocks_content($sitecontent); $sitecontent = str_replace('[THEME_ERROR_INFO]', nv_error_info(), $sitecontent); if (defined('NV_IS_ADMIN')) { $my_footer .= $my_footer; } } if (!empty($my_head)) { $sitecontent = preg_replace('/(<\\/head>)/i', $my_head . '\\1', $sitecontent, 1); } if (!empty($my_footer)) { $sitecontent = preg_replace('/(<\\/body>)/i', $my_footer . '\\1', $sitecontent, 1); } return $sitecontent; }
function nv_admin_theme($contents) { global $global_config, $lang_global, $admin_mods, $site_mods, $admin_menu_mods, $module_name, $module_file, $module_info, $admin_info, $db, $page_title, $submenu, $select_options, $op, $set_active_op, $array_lang_admin, $my_head; $dir_template = ""; if (file_exists(NV_ROOTDIR . "/themes/" . $global_config['admin_theme'] . "/system/main.tpl")) { $dir_template = NV_ROOTDIR . "/themes/" . $global_config['admin_theme'] . "/system"; } else { $dir_template = NV_ROOTDIR . "/themes/admin_default/system"; $global_config['admin_theme'] = "default"; } $global_config['site_name'] = empty($global_config['site_name']) ? NV_SERVER_NAME : $global_config['site_name']; $xtpl = new XTemplate("main.tpl", $dir_template); $xtpl->assign('NV_SITE_COPYRIGHT', "" . $global_config['site_name'] . " [" . $global_config['site_email'] . "] "); $xtpl->assign('NV_SITE_NAME', $global_config['site_name']); $xtpl->assign('NV_SITE_TITLE', "" . $global_config['site_name'] . " " . NV_TITLEBAR_DEFIS . " " . $lang_global['admin_page'] . " " . NV_TITLEBAR_DEFIS . " " . $module_info['custom_title'] . ""); $xtpl->assign('NV_ADMIN_CHECK_PASS_TIME', NV_ADMIN_CHECK_PASS_TIME); $xtpl->assign('NV_BASE_SITEURL', NV_BASE_SITEURL); $xtpl->assign('NV_ADMINDIR', NV_ADMINDIR); $xtpl->assign('NV_BASE_ADMINURL', NV_BASE_ADMINURL); $xtpl->assign('MODULE_NAME', $module_name); $xtpl->assign('MODULE_FILE', $module_file); $xtpl->assign('NV_ADMIN_THEME', $global_config['admin_theme']); if (file_exists(NV_ROOTDIR . "/themes/" . $global_config['admin_theme'] . "/css/" . $module_file . ".css")) { $xtpl->parse('main.header.css_module'); } $xtpl->assign('NV_LANG_VARIABLE', NV_LANG_VARIABLE); $xtpl->assign('NV_LANG_INTERFACE', NV_LANG_INTERFACE); $xtpl->assign('NV_NAME_VARIABLE', NV_NAME_VARIABLE); $xtpl->assign('NV_OP_VARIABLE', NV_OP_VARIABLE); $xtpl->assign('NV_LANG_VARIABLE', NV_LANG_VARIABLE); $xtpl->assign('NV_SITE_TIMEZONE_OFFSET', round(NV_SITE_TIMEZONE_OFFSET / 3600)); $xtpl->assign('NV_CURRENTTIME', nv_date("T", NV_CURRENTTIME)); $xtpl->assign('NV_COOKIE_PREFIX', $global_config['cookie_prefix']); if (file_exists(NV_ROOTDIR . "/js/admin_" . $module_file . ".js")) { $xtpl->assign('NV_JS_MODULE', NV_BASE_SITEURL . "js/admin_" . $module_file . ".js"); $xtpl->parse('main.header.module_js'); } elseif (file_exists(NV_ROOTDIR . "/modules/" . $module_file . "/js/admin.js")) { $xtpl->assign('NV_JS_MODULE', NV_BASE_SITEURL . "modules/" . $module_file . "/js/admin.js"); $xtpl->parse('main.header.module_js'); } if (defined('NV_EDITOR') and function_exists('nv_add_editor_js')) { $xtpl->assign('NV_ADD_EDITOR_JS', nv_add_editor_js()); $xtpl->parse('main.header.nv_add_editor_js'); } if (!empty($my_head)) { $xtpl->assign('NV_ADD_MY_HEAD', $my_head); $xtpl->parse('main.header.nv_add_my_head'); } $xtpl->assign('NV_GO_CLIENTSECTOR', $lang_global['go_clientsector']); $lang_site = !empty($site_mods) ? NV_LANG_DATA : $global_config['site_lang']; $xtpl->assign('NV_GO_CLIENTSECTOR_URL', NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . $lang_site); $xtpl->assign('NV_LOGOUT', $lang_global['logout']); if (!empty($array_lang_admin)) { $xtpl->assign('NV_LANGDATA', $lang_global['langdata']); foreach ($array_lang_admin as $lang_i => $lang_name) { $xtpl->assign('SELECTED', $lang_i == NV_LANG_DATA ? " selected=\"selected\"" : ""); $xtpl->assign('LANGVALUE', $lang_name); $xtpl->assign('LANGOP', NV_BASE_ADMINURL . "index.php?" . NV_LANG_VARIABLE . "=" . $lang_i); $xtpl->parse('main.header.langdata.option'); } $xtpl->parse('main.header.langdata'); } //Top_menu foreach ($admin_mods as $m => $v) { if (!empty($v['custom_title'])) { $xtpl->assign('TOP_MENU_CURRENT', $module_name == $m ? " class=\"current\"" : ""); $xtpl->assign('TOP_MENU_HREF', $m); $xtpl->assign('TOP_MENU_NAME', $v['custom_title']); $xtpl->parse('main.header.top_menu.top_menu_loop'); } } $xtpl->parse('main.header.top_menu'); $xtpl->assign('NV_DIGCLOCK', nv_date("H:i T l, d/m/Y", NV_CURRENTTIME)); if ($admin_info['current_login'] >= NV_CURRENTTIME - 60) { if (!empty($admin_info['last_login'])) { $temp = sprintf($lang_global['hello_admin1'], "<strong>" . $admin_info['username'] . "</strong>", date("H:i d/m/Y", $admin_info['last_login']), $admin_info['last_ip']); $xtpl->assign('HELLO_ADMIN1', $temp); $xtpl->parse('main.header.hello_admin'); } else { $temp = sprintf($lang_global['hello_admin3'], "<strong>" . $admin_info['username'] . "</strong>"); $xtpl->assign('HELLO_ADMIN3', $temp); $xtpl->parse('main.header.hello_admin3'); } } else { $temp = sprintf($lang_global['hello_admin2'], "<strong>" . $admin_info['username'] . "</strong>", nv_convertfromSec(NV_CURRENTTIME - $admin_info['current_login']), $admin_info['current_ip']); $xtpl->assign('HELLO_ADMIN2', $temp); $xtpl->parse('main.header.hello_admin2'); } $xtpl->parse('main.header'); if (!empty($admin_menu_mods)) { //Vertical menu foreach ($admin_menu_mods as $m => $v) { $xtpl->assign('VERTICAL_MENU_CURRENT', $module_name == $m ? "class=\"current\"" : ""); $xtpl->assign('VERTICAL_MENU_HREF', $m); $xtpl->assign('VERTICAL_MENU_NAME', $v); if ($m == $module_name and !empty($submenu)) { foreach ($submenu as $n => $l) { $xtpl->assign('VERTICAL_MENU_SUB_CURRENT', (!empty($op) and $op == $n or !empty($set_active_op) and $set_active_op == $n) ? " class=\"sub_current\"" : " class=\"sub_normal\""); $xtpl->assign('VERTICAL_MENU_SUB_HREF', $m); $xtpl->assign('VERTICAL_MENU_SUB_HREF1', $n); $xtpl->assign('VERTICAL_MENU_SUB_NAME', $l); $xtpl->parse('main.vertical_menu.vertical_menu_loop.vertical_menu_sub_loop'); } } $xtpl->parse('main.vertical_menu.vertical_menu_loop'); } } $xtpl->parse('main.vertical_menu'); if (!empty($select_options)) { $xtpl->assign('PLEASE_SELECT', $lang_global['please_select']); foreach ($select_options as $value => $link) { $xtpl->assign('SELECT_NAME', $link); $xtpl->assign('SELECT_VALUE', $value); $xtpl->parse('main.select_option.select_option_loop'); } $xtpl->parse('main.select_option'); } elseif (!isset($admin_mods[$module_name]) and isset($site_mods[$module_name])) { $xtpl->assign('NV_GO_CLIENTMOD', $lang_global['go_clientmod']); $xtpl->parse('main.site_mods'); } if (!empty($page_title)) { $xtpl->assign('PAGE_TITLE', $page_title); $xtpl->parse('main.empty_page_title'); } $xtpl->assign('THEME_ERROR_INFO', nv_error_info()); $xtpl->assign('MODULE_CONTENT', $contents); $end_time = array_sum(explode(" ", microtime())); $total_time = substr($end_time - NV_START_TIME + $db->time, 0, 5); $xtpl->assign('NV_TOTAL_TIME', substr($end_time - NV_START_TIME + $db->time, 0, 5)); if (defined("NV_IS_SPADMIN")) { $xtpl->assign('NV_SHOW_QUERIES', $lang_global['show_queries']); } $xtpl->assign('NV_DB_NUM_QUERIES', $lang_global['db_num_queries']); $xtpl->assign('COUNT_QUERY_STRS', count($db->query_strs)); $xtpl->assign('NV_COPYRIGHT', sprintf($lang_global['copyright'], $global_config['site_name'])); if (defined("NV_IS_SPADMIN")) { foreach ($db->query_strs as $key => $field) { $xtpl->assign('NV_SHOW_QUERIES_CLASS', $key % 2 ? " class=\"second\"" : ""); $xtpl->assign('NV_FIELD1', $field[1] ? "<img alt=\"" . $lang_global['ok'] . "\" title=\"" . $lang_global['ok'] . "\" src=\"" . NV_BASE_SITEURL . "themes/" . $global_config['admin_theme'] . "/images/icons/good.png\" />" : "<img alt=\"" . $lang_global['fail'] . "\" title=\"" . $lang_global['fail'] . "\" src=\"" . NV_BASE_SITEURL . "themes/" . $global_config['admin_theme'] . "/images/icons/bad.png\" />"); $xtpl->assign('NV_FIELD', $field[0]); $xtpl->parse('main.footer.nv_show_queries.nv_show_queries_loop'); } $xtpl->parse('main.footer.nv_show_queries'); } if (NV_LANG_INTERFACE == 'vi' and NV_LANG_DATA == 'vi') { $xtpl->parse('main.footer.nv_if_mudim'); } $xtpl->assign('NV_GENPASS', nv_genpass()); $xtpl->parse('main.footer'); $xtpl->parse('main'); $xtpl->out('main'); }
function nv_site_theme($contents) { global $home, $array_mod_title, $lang_global, $language_array, $global_config, $site_mods, $module_name, $module_info, $op, $db, $mod_title, $my_head, $nv_array_block_contents, $client_info; if (!file_exists(NV_ROOTDIR . "/themes/" . $global_config['module_theme'] . "/layout/layout." . $module_info['funcs'][$op]['layout'] . ".tpl")) { nv_info_die($lang_global['error_layout_title'], $lang_global['error_layout_title'], $lang_global['error_layout_content']); } if (defined('NV_IS_ADMIN')) { $my_head .= "<link rel=\"stylesheet\" href=\"" . NV_BASE_SITEURL . "themes/" . $global_config['module_theme'] . "/css/admin.css\" type=\"text/css\" />"; } if (defined('NV_DISPLAY_ERRORS_LIST') and NV_DISPLAY_ERRORS_LIST != 0) { $my_head .= "<link rel=\"stylesheet\" href=\"" . NV_BASE_SITEURL . "themes/" . $global_config['module_theme'] . "/css/tab_info.css\" type=\"text/css\" />"; } $xtpl = new XTemplate("layout." . $module_info['funcs'][$op]['layout'] . ".tpl", NV_ROOTDIR . "/themes/" . $global_config['module_theme'] . "/layout/"); $xtpl->assign('LANG', $lang_global); $xtpl->assign('TEMPLATE', $global_config['module_theme']); $xtpl->assign('NV_BASE_SITEURL', NV_BASE_SITEURL); $xtpl->assign('THEME_META_TAGS', nv_html_meta_tags()); $xtpl->assign('THEME_SITE_JS', nv_html_site_js()); $xtpl->assign('THEME_CSS', nv_html_css()); $xtpl->assign('THEME_PAGE_TITLE', nv_html_page_title()); $xtpl->assign('NV_TOP_MENU_HOME', $lang_global['Home']); $xtpl->assign('NV_LINK_MAIL', $lang_global['E-mail']); $xtpl->assign('CP_MAIL_SERVER', $lang_global['web_mail']); $xtpl->assign('NV_LINK_CONTACT', $lang_global['Contact-us']); $xtpl->assign('NV_LINK_NGONNGU', $lang_global['Ngonngu']); $xtpl->assign('NV_LINK_TIMKIEM', $lang_global['Timkiem']); $xtpl->assign('NV_LINK_TROVEDAUTRANG', $lang_global['Trovedautrang']); $xtpl->assign('NV_SITE_COPYRIGHT', $lang_global['Copyright']); $xtpl->assign('NV_SITE_CERTIFICATE', $lang_global['Certificate']); $xtpl->assign('NV_SITE_DIACHI', $lang_global['Diachi']); $xtpl->assign('NV_SITE_DIENTHOAI', $lang_global['Dienthoai']); $xtpl->assign('MODULE_CONTENT', $contents . " "); $xtpl->assign('THEME_NOJS', $lang_global['nojs']); $xtpl->assign('THEME_LOGO_TITLE', $global_config['site_name']); $xtpl->assign('THEME_SITE_HREF', NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA); $xtpl->assign('THEME_SITE_RSS', nv_html_site_rss()); $xtpl->assign('THEME_DIGCLOCK_TEXT', nv_date("H:i T l, d/m/Y", NV_CURRENTTIME)); $xtpl->assign('THEME_RSS_INDEX_HREF', NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&" . NV_NAME_VARIABLE . "=rss"); $xtpl->assign('THEME_SEARCH_QUERY_MAX_LENGTH', NV_MAX_SEARCH_LENGTH); $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 . ");"); $xtpl->assign('CHECKSS', md5($client_info['session_id'] . $global_config['sitekey'])); $xtpl->assign('THEME_SITE_NAME', sprintf($lang_global['copyright'], $global_config['site_name'])); // $xtpl->assign( 'THEME_CONTACT_PHONE', $lang_global['phonenumber'] . ": " . $global_config['site_phone'] ); $xtpl->assign('THEME_CONTACT_EMAIL', $lang_global['email'] . ": " . nv_EncodeEmail($global_config['site_email'])); //TODO: Update site name $xtpl->assign('SITE_NAME', $global_config['site_name']); $xtpl->assign('SITE_DESC', $global_config['site_description']); if ($global_config['lang_multi'] and count($global_config['allow_sitelangs']) > 1) { $xtpl->assign('SELECTLANGSITE', $lang_global['langsite']); foreach ($global_config['allow_sitelangs'] as $lang_i) { $langname = $language_array[$lang_i]['name']; $xtpl->assign('LANGSITENAME', $langname); $xtpl->assign('LANGSITEURL', NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . $lang_i); if (NV_LANG_DATA != $lang_i) { $xtpl->parse('main.language.langitem'); } else { $xtpl->parse('main.language.langcuritem'); } } $xtpl->parse('main.language'); } global $array_op; $cat_alias = isset($array_op[0]) ? $array_op[0] : ""; foreach ($site_mods as $modname => $modvalues) { if ($modvalues['module_file'] == "news") { $result2 = "SELECT `title`, `alias` FROM `" . NV_PREFIXLANG . "_" . $modvalues['module_data'] . "_cat` WHERE `parentid`='0' AND `is_top_menu`='1' ORDER BY `weight` ASC LIMIT 0,10"; $list = nv_db_cache($result2, '', $modname); foreach ($list as $l) { if (!empty($cat_alias)) { $module_current = $cat_alias == $l['alias'] ? ' class="current"' : ''; } else { $module_current = ''; } $url = NV_BASE_SITEURL . "index.php?"; $url .= NV_LANG_VARIABLE . "=" . NV_LANG_DATA; $url .= "&" . NV_NAME_VARIABLE . "=" . $modname; $url .= "&" . NV_OP_VARIABLE . "=" . $l['alias']; $aryay_menu = array('title' => $l['title'], 'current' => $module_current, 'link' => $url); $xtpl->assign('TOP_MENU', $aryay_menu); $xtpl->parse('main.top_menu'); } } elseif (!empty($modvalues['in_menu'])) { $module_current = $modname == $module_name ? ' class="current"' : ''; $aryay_menu = array("title" => $modvalues['custom_title'], "class" => $modname, "current" => $module_current, "link" => NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&" . NV_NAME_VARIABLE . "=" . $modname); if (!empty($modvalues['funcs'])) { $sub_nav_item = array(); if ($modvalues['module_file'] == "weblinks") { $result2 = "SELECT `title`, `alias` FROM `" . NV_PREFIXLANG . "_" . $modvalues['module_data'] . "_cat` WHERE `parentid`='0' AND `inhome`='1' ORDER BY `weight` ASC LIMIT 0,10"; $list = nv_db_cache($result2, '', $modname); foreach ($list as $l) { $sub_nav_item[] = array('title' => $l['title'], 'link' => NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&" . NV_NAME_VARIABLE . "=" . $modname . "&" . NV_OP_VARIABLE . "=" . $l['alias']); } } elseif ($modvalues['module_file'] == "download") { $aryay_menu = array("title" => $modvalues['custom_title'], "class" => $modname, "current" => $module_current, "link" => NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&" . NV_NAME_VARIABLE . "=" . $modname . "&" . NV_OP_VARIABLE . "=newsearch"); // $result2 = "SELECT `title`, `alias` FROM `" . NV_PREFIXLANG . "_" . $modvalues['module_data'] . "_categories` WHERE `parentid`='0' AND `status`='1'ORDER BY `weight` ASC LIMIT 0,10"; // $list = nv_db_cache( $result2, '', $modname ); // foreach($list as $l) // { // $sub_nav_item[] = array( // 'title' => $l['title'], 'link' => NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&" . NV_NAME_VARIABLE . "=" . $modname . "&" . NV_OP_VARIABLE . "=" . $l['alias'] // ); // } } elseif ($modname == "users") { if (defined('NV_IS_USER')) { $in_submenu_users = array("changepass", "openid", "logout"); } else { $in_submenu_users = array("login", "register", "lostpass"); } foreach ($modvalues['funcs'] as $key => $sub_item) { if ($sub_item['in_submenu'] == 1 and in_array($key, $in_submenu_users)) { $sub_nav_item[] = array("title" => $sub_item['func_custom_name'], "link" => NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&" . NV_NAME_VARIABLE . "=" . $modname . "&" . NV_OP_VARIABLE . "=" . $key); } } } else { foreach ($modvalues['funcs'] as $key => $sub_item) { if ($sub_item['in_submenu'] == 1) { $sub_nav_item[] = array("title" => $sub_item['func_custom_name'], "link" => NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&" . NV_NAME_VARIABLE . "=" . $modname . "&" . NV_OP_VARIABLE . "=" . $key); } } } if (!empty($sub_nav_item)) { foreach ($sub_nav_item as $sub_nav) { $xtpl->assign('SUB', $sub_nav); $xtpl->parse('main.top_menu.sub.item'); } $xtpl->parse('main.top_menu.sub'); } } $xtpl->assign('TOP_MENU', $aryay_menu); $xtpl->parse('main.top_menu'); } } //Breakcolumn if ($home != 1) { if ($module_name == "news" || $module_info['module_file'] == "news") { $title = $lang_global['home_page']; } else { $title = $module_info['custom_title']; } if ($module_name == "rss") { $title = $lang_global['sitemap']; } if ($module_name == "news" || $module_info['module_file'] == "news" || $module_name == "hoc-vien" || $module_info['module_file'] == "hoc-vien") { $arr_cat_title_i = array('catid' => 0, 'title' => $title, 'link' => NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA); } if ($module_name != "news" && $module_info['module_file'] != "news" && $module_name != "hoc-vien" && $module_info['module_file'] != "hoc-vien") { $arr_cat_title_i = array('catid' => 0, 'title' => $title, 'link' => NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&" . NV_NAME_VARIABLE . "=" . $module_name); } if ($module_name == "download") { $arr_cat_title_i = array('catid' => 0, 'title' => $title, 'link' => NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&" . NV_NAME_VARIABLE . "=" . $module_name . "&" . NV_OP_VARIABLE . "=newsearch" . "&" . "f=m"); } $xtpl->assign('BREAKCOLUMN', $arr_cat_title_i); $xtpl->parse('main.mod_title.breakcolumn'); foreach ($array_mod_title as $arr_cat_title_i) { $xtpl->assign('BREAKCOLUMN', $arr_cat_title_i); $xtpl->parse('main.mod_title.breakcolumn'); } $xtpl->parse('main.mod_title'); } //Breakcolumn $theme_stat_img = ""; if ($global_config['statistic'] and isset($site_mods['statistics'])) { $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&p=" . nv_genpass() . "\" width=\"88\" height=\"31\" /></a>\n"; } $theme_footer_js = "<script type=\"text/javascript\">\n"; $theme_footer_js .= "nv_DigitalClock('digclock');\n"; $theme_footer_js .= "</script>\n"; if (NV_LANG_INTERFACE == 'vi') { $theme_footer_js .= "<script type=\"text/javascript\" src=\"" . NV_BASE_SITEURL . "js/mudim.js\"></script>"; } $xtpl->assign('THEME_STAT_IMG', $theme_stat_img); $xtpl->assign('THEME_IMG_CRONJOBS', NV_BASE_SITEURL . "index.php?second=cronjobs&p=" . nv_genpass()); $xtpl->assign('THEME_FOOTER_JS', $theme_footer_js); if (defined('NV_IS_ADMIN')) { $xtpl->assign('THEME_ADMIN_MENU', nv_admin_menu()); $end_time = array_sum(explode(" ", microtime())); $total_time = substr($end_time - NV_START_TIME + $db->time, 0, 5); $theme_click_show_queries = ""; if (defined('NV_IS_SPADMIN')) { $show_queries = " <a href=\"#queries\" onclick=\"nv_show_hidden('div_hide',2);\">" . $lang_global['show_queries'] . "</a>"; $theme_click_show_queries = $lang_global['db_num_queries'] . ": " . count($db->query_strs) . " / " . $total_time . "'." . $show_queries . "<br />\n"; } $xtpl->assign('CLICK_SHOW_QUERIES', $theme_click_show_queries); $xtpl->assign('SHOW_QUERIES_FOR_ADMIN', nv_show_queries_for_admin()); $xtpl->parse('main.for_admin'); } $xtpl->assign('THEME_ERROR_INFO', nv_error_info()); $xtpl->parse('main'); $sitecontent = $xtpl->text('main'); foreach ($nv_array_block_contents as $position => $blcontent) { $sitecontent = str_replace($position, $blcontent, $sitecontent); } echo $sitecontent; }