Пример #1
0
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;
}
Пример #2
0
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;
    $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('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->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_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.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.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 (!empty($my_head)) {
        $xtpl->assign('NV_ADD_MY_HEAD', $my_head);
        $xtpl->parse('main.nv_add_my_head');
    }
    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['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.langdata.option');
            }
            $xtpl->parse('main.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']);
                $array_submenu = nv_get_submenu($m);
                if (!empty($array_submenu)) {
                    foreach ($array_submenu as $mop => $submenu_i) {
                        $xtpl->assign('SUBMENULINK', NV_BASE_ADMINURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&amp;" . NV_NAME_VARIABLE . "=" . $m . "&amp;" . NV_OP_VARIABLE . "=" . $mop);
                        $xtpl->assign('SUBMENUTITLE', $submenu_i);
                        $xtpl->parse('main.top_menu.top_menu_loop.submenu.submenu_loop');
                    }
                    $xtpl->parse('main.top_menu.top_menu_loop.submenu');
                }
                $xtpl->parse('main.top_menu.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'], "<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.hello_admin');
            } else {
                $temp = sprintf($lang_global['hello_admin3'], "<strong>" . $admin_info['username'] . "</strong>");
                $xtpl->assign('HELLO_ADMIN3', $temp);
                $xtpl->parse('main.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.hello_admin2');
        }
        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($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($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()));
    $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', sizeof($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.nv_show_queries.nv_show_queries_loop');
        }
        $xtpl->parse('main.nv_show_queries');
    }
    if (NV_LANG_INTERFACE == 'vi' and NV_LANG_DATA == 'vi') {
        $xtpl->parse('main.nv_if_mudim');
    }
    $xtpl->assign('NV_GENPASS', nv_genpass());
    $xtpl->parse('main');
    return $xtpl->text('main');
}