Exemplo n.º 1
0
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 . '&amp;' . 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 . "&amp;" . NV_NAME_VARIABLE . "=statistics\"><img alt=\"" . $lang_global['viewstats'] . "\" src=\"" . NV_BASE_SITEURL . "index.php?second=statimg&amp;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 . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name . '&amp;nv' . NV_LANG_DATA . 'themever=' . $theme_type . '&amp;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;
}
Exemplo n.º 2
0
         $module_info['template'] = $global_config['module_theme'];
         if (!file_exists(NV_ROOTDIR . "/themes/" . $global_config['module_theme'] . "/modules/" . $module_file)) {
             if (file_exists(NV_ROOTDIR . "/themes/default/modules/" . $module_file)) {
                 $module_info['template'] = "default";
             }
         }
         if (file_exists(NV_ROOTDIR . "/themes/" . $global_config['module_theme'] . "/modules/" . $module_file . "/theme.php")) {
             require_once NV_ROOTDIR . "/themes/" . $global_config['module_theme'] . "/modules/" . $module_file . "/theme.php";
         } elseif (file_exists(NV_ROOTDIR . "/modules/" . $module_file . "/theme.php")) {
             require_once NV_ROOTDIR . "/modules/" . $module_file . "/theme.php";
         }
         if (!defined('NV_IS_AJAX')) {
             if ($module_info['submenu']) {
                 nv_create_submenu();
             }
             $nv_array_block_contents = nv_blocks_content();
         }
         //Ket noi voi cac op cua module de thuc hien
         require_once NV_ROOTDIR . "/modules/" . $module_file . "/funcs/" . $op . ".php";
         exit;
     } else {
         $db->sql_query("UPDATE `" . NV_MODULES_TABLE . "` SET `act`=2 WHERE `title`=" . $db->dbescape($module_name));
         nv_del_moduleCache('modules');
     }
 } else {
     $sql = "SELECT * FROM `" . NV_MODFUNCS_TABLE . "` AS f, `" . NV_MODULES_TABLE . "` AS m WHERE m.act = 1 AND f.in_module = m.title ORDER BY m.weight, f.subweight";
     $list = nv_db_cache($sql, '', 'modules');
     foreach ($list as $row) {
         if ($row['title'] == $module_name) {
             $groups_view = (string) $row['groups_view'];
             if (!defined('NV_IS_USER') and $groups_view == 1) {
Exemplo n.º 3
0
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 . '&amp;' . 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 . '&amp;' . 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 . "&amp;" . NV_NAME_VARIABLE . "=statistics\"><img alt=\"" . $lang_global['viewstats'] . "\" src=\"" . NV_BASE_SITEURL . "index.php?second=statimg&amp;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 . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name . '&amp;nv' . NV_LANG_DATA . 'themever=' . $theme_type . '&amp;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;
}
Exemplo n.º 4
0
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 . "&nbsp;");
    $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 . "&amp;" . 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 . "&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";
    }
    $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&amp;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 . "&amp;" . NV_NAME_VARIABLE . "=" . $module_name . "&amp;nv" . NV_LANG_DATA . "themever=" . $theme_type . "&amp;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;
}
Exemplo n.º 5
0
function nv_site_theme($contents)
{
    global $home, $array_mod_title, $lang_global, $language_array, $global_config, $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']);
    }
    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\" />";
    }
    $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', nv_html_site_js());
    $xtpl->assign('THEME_CSS', nv_html_css());
    $xtpl->assign('THEME_PAGE_TITLE', nv_html_page_title());
    $xtpl->assign('MODULE_CONTENT', $contents . "&nbsp;");
    $xtpl->assign('THEME_SITE_HREF', NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA);
    $xtpl->assign('NV_NAME_VARIABLE', NV_NAME_VARIABLE);
    $xtpl->assign('NV_LANG_VARIABLE', NV_LANG_VARIABLE);
    $xtpl->assign('NV_LANG_DATA', NV_LANG_DATA);
    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 . "&amp;" . 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');
    }
    $xtpl->assign('THEME_IMG_CRONJOBS', NV_BASE_SITEURL . "index.php?second=cronjobs&amp;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 . "&amp;" . NV_NAME_VARIABLE . "=" . $module_name . "&amp;nv" . NV_LANG_DATA . "themever=" . $theme_type . "&amp;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);
    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;
}