コード例 #1
0
ファイル: theme.php プロジェクト: lzhao18/nukeviet
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;
}
コード例 #2
0
 * @Project NUKEVIET 4.x
 * @Author VINADES.,JSC (contact@vinades.vn)
 * @Copyright (C) 2015 VINADES.,JSC. All rights reserved
 * @License GNU/GPL version 2 or any later version
 * @Createdate Sun, 10 May 2015 01:36:45 GMT
 */
if (!defined('NV_IS_MOD_BLOOD_BANK')) {
    die('Stop!!!');
}
$page_title = $module_info['custom_title'];
$key_words = $module_info['keywords'];
$array_data = array();
$array_history = array();
if (!nv_user_in_groups($array_config['groups_view_member'])) {
    $redirect = '<meta http-equiv="Refresh" content="4;URL=' . nv_url_rewrite(NV_BASE_SITEURL . 'index.php', true) . '" />';
    nv_info_die($lang_module['error_not_permission_title'], $lang_module['error_not_permission_title'], $lang_module['error_not_permission_content'] . $redirect);
    exit;
}
$result = $db->query('SELECT * FROM ' . NV_PREFIXLANG . '_' . $module_data . ' WHERE id=' . $id);
if ($result->rowCount() > 0) {
    $array_data = $result->fetch();
} else {
    Header('Location: ' . nv_url_rewrite(NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name, true));
    die;
}
$row['photo'] = '';
$result = $db->query('SELECT photo FROM ' . NV_USERS_GLOBALTABLE . ' WHERE userid=' . $array_data['userid']);
if ($result->rowCount() > 0) {
    $array_data['photo'] = $result->fetchColumn();
}
$result = $db->query('SELECT * FROM ' . NV_PREFIXLANG . '_' . $module_data . '_donation_person WHERE identity_card=' . $db->quote($array_data['identity_card']));
コード例 #3
0
ファイル: block_content.php プロジェクト: lzhao18/nukeviet
        } elseif (!empty($row['bid'])) {
            $db->query('DELETE FROM ' . NV_BLOCKS_TABLE . '_groups WHERE bid=' . $row['bid']);
            $db->query('DELETE FROM ' . NV_BLOCKS_TABLE . '_weight WHERE bid=' . $row['bid']);
            nv_del_moduleCache('themes');
        }
    }
}
$groups_view = explode(',', $row['groups_view']);
$sql = 'SELECT func_id, func_custom_name, in_module FROM ' . NV_MODFUNCS_TABLE . ' WHERE show_func=1 ORDER BY in_module ASC, subweight ASC';
$func_result = $db->query($sql);
$aray_mod_func = array();
while (list($id_i, $func_custom_name_i, $in_module_i) = $func_result->fetch(3)) {
    $aray_mod_func[$in_module_i][] = array('id' => $id_i, 'func_custom_name' => $func_custom_name_i);
}
// Load position file
$xml = @simplexml_load_file(NV_ROOTDIR . '/themes/' . $selectthemes . '/config.ini') or nv_info_die($lang_global['error_404_title'], $lang_module['block_error_fileconfig_title'], $lang_module['block_error_fileconfig_content']);
$xmlpositions = $xml->xpath('positions');
$positions = $xmlpositions[0]->position;
if ($row['bid'] != 0) {
    $xtpl->parse('main.block_group_notice');
}
$xtpl->assign('SELECTTHEMES', $selectthemes);
$xtpl->assign('BLOCKREDIRECT', $blockredirect);
$xtpl->assign('THEME_SELECTED', $row['module'] == 'theme' ? ' selected="selected"' : '');
$sql = 'SELECT title, custom_title FROM ' . NV_MODULES_TABLE . ' ORDER BY weight ASC';
$result = $db->query($sql);
while ($row_i = $result->fetch()) {
    $xtpl->assign('MODULE', array('key' => $row_i['title'], 'selected' => $row_i['title'] == $row['module'] ? ' selected="selected"' : '', 'title' => $row_i['custom_title']));
    $xtpl->parse('main.module');
}
$xtpl->assign('ROW', array('title' => $row['title'], 'exp_time' => $row['exp_time'] > 0 ? date('d/m/Y', $row['exp_time']) : '', 'block_active' => intval($row['active']) == 1 ? ' checked="checked"' : '', 'link' => $row['link'], 'bid' => $row['bid'], 'module' => $row['module'], 'file_name' => $row['file_name']));
コード例 #4
0
                 $xtpl->assign('SITE_EMAIL', $global_config['site_email']);
                 $xtpl->assign('SITE_FONE', $global_config['site_phone']);
                 $xtpl->assign('SITE_URL', $global_config['site_url']);
                 $xtpl->assign('TITLE', $title);
                 $xtpl->assign('CONTENT', $mess);
                 $xtpl->assign('AUTHOR_SIG', $my_sig);
                 $xtpl->assign('AUTHOR_NAME', $admin_info['username']);
                 $xtpl->assign('AUTHOR_POS', $admin_info['position']);
                 $xtpl->assign('AUTHOR_EMAIL', $my_mail);
                 $xtpl->parse('main');
                 $content = $xtpl->text('main');
                 $from = array($admin_info['username'], $my_mail);
                 $to = $row_user['email'];
                 $send = nv_sendmail($from, $to, nv_EncString($title), $content);
                 if (!$send) {
                     nv_info_die($lang_global['error_info_caption'], $lang_global['site_info'], $lang_global['error_sendmail_admin'], 1);
                 }
             }
         }
         Header("Location: " . NV_BASE_ADMINURL . "index.php?" . NV_NAME_VARIABLE . "=" . $module_name . "&" . NV_OP_VARIABLE . "=suspend&id=" . $id);
     }
 } else {
     $adminpass = $new_reason = "";
     $clean_history = $sendmail = 0;
 }
 $contents['change_suspend']['new_suspend_caption'] = !empty($error) ? $error : $lang_module['chg_is_suspend' . $new_suspend];
 $contents['change_suspend']['new_suspend_is_error'] = !empty($error) ? 1 : 0;
 $contents['change_suspend']['new_suspend_action'] = NV_BASE_ADMINURL . "index.php?" . NV_NAME_VARIABLE . "=" . $module_name . "&amp;" . NV_OP_VARIABLE . "=suspend&amp;admin_id=" . $admin_id;
 $contents['change_suspend']['sendmail'] = array($lang_module['suspend_sendmail'], $sendmail);
 if (!empty($new_suspend)) {
     $contents['change_suspend']['new_reason'] = array($lang_module['suspend_reason'], $new_reason, 255);
コード例 #5
0
if (defined("NV_IS_ADMIN")) {
    //Buoc admin khai bao lai pass neu khong online trong khoang thoi gian nhat dinh
    if (empty($admin_info['checkpass'])) {
        if ($nv_Request->isset_request(NV_ADMINRELOGIN_VARIABLE, 'get') and $nv_Request->get_int(NV_ADMINRELOGIN_VARIABLE, 'get') == 1) {
            require_once NV_ROOTDIR . "/includes/core/admin_relogin.php";
            exit;
        }
    }
} elseif (!in_array(NV_LANG_DATA, $global_config['allow_sitelangs'])) {
    $global_config['disable_site'] = 1;
}
//Dinh chi hoat dong cua site
if (!defined('NV_ADMIN') and !defined("NV_IS_ADMIN")) {
    if ($global_config['disable_site']) {
        $disable_site_content = (isset($global_config['disable_site_content']) and !empty($global_config['disable_site_content'])) ? $global_config['disable_site_content'] : $lang_global['disable_site_content'];
        nv_info_die($global_config['site_description'], $global_config['disable_site_title'], $disable_site_content);
    } elseif (!in_array(NV_LANG_DATA, $global_config['allow_sitelangs'])) {
        Header("Location: " . NV_BASE_SITEURL);
        exit;
    } elseif (empty($global_config['lang_multi']) and NV_LANG_DATA != $global_config['site_lang']) {
        Header("Location: " . NV_BASE_SITEURL);
        exit;
    }
}
$month_upload_dir = nv_mkdir(NV_UPLOADS_REAL_DIR, date("Y_m"));
//Thu muc uploads theo thang
if (!empty($month_upload_dir[0])) {
    define("NV_MONTH_UPLOADS_DIR", date("Y_m"));
    define("NV_MONTH_UPLOADS_REAL_DIR", NV_UPLOADS_REAL_DIR . '/' . NV_MONTH_UPLOADS_DIR);
}
define('PCLZIP_TEMPORARY_DIR', NV_ROOTDIR . '/' . NV_TEMP_DIR . '/');
コード例 #6
0
ファイル: theme.php プロジェクト: atarubi/nuke-viet
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;
}
コード例 #7
0
ファイル: theme.php プロジェクト: atarubi/nuke-viet
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;
}
コード例 #8
0
ファイル: print.php プロジェクト: NukeVietCMS/CodeWeb
}
$alias_cat_url = $array_op[1];
$array_page = explode('-', $array_op[2]);
$id = intval(end($array_page));
$catid = 0;
foreach ($global_array_cat as $catid_i => $array_cat_i) {
    if ($alias_cat_url == $array_cat_i['alias']) {
        $catid = $catid_i;
        break;
    }
}
if ($id > 0 and $catid > 0) {
    $sql = 'SELECT * FROM ' . NV_PREFIXLANG . '_' . $module_data . '_' . $catid . ' WHERE id =' . $id;
    $result = $db_slave->query($sql);
    if ($result->rowCount() !== 1) {
        nv_info_die($lang_global['error_404_title'], $lang_global['error_404_title'], $lang_global['error_404_content']);
    }
    $content = $result->fetch();
    $body_contents = $db_slave->query('SELECT bodyhtml as bodytext, sourcetext, imgposition, copyright, allowed_print FROM ' . NV_PREFIXLANG . '_' . $module_data . '_bodyhtml_' . ceil($content['id'] / 2000) . ' where id=' . $content['id'])->fetch();
    $content = array_merge($content, $body_contents);
    unset($sql, $result, $body_contents);
    if ($content['allowed_print'] == 1 and (defined('NV_IS_MODADMIN') or $content['status'] == 1 and $content['publtime'] < NV_CURRENTTIME and ($content['exptime'] == 0 or $content['exptime'] > NV_CURRENTTIME))) {
        $base_url_rewrite = nv_url_rewrite(NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name . '&amp;' . NV_OP_VARIABLE . '=print/' . $global_array_cat[$catid]['alias'] . '/' . $content['alias'] . '-' . $id . $global_config['rewrite_exturl'], true);
        if ($_SERVER['REQUEST_URI'] != $base_url_rewrite and NV_MAIN_DOMAIN . $_SERVER['REQUEST_URI'] != $base_url_rewrite) {
            Header('Location: ' . $base_url_rewrite);
            die;
        }
        $sql = 'SELECT title FROM ' . NV_PREFIXLANG . '_' . $module_data . '_sources WHERE sourceid = ' . $content['sourceid'];
        $result = $db_slave->query($sql);
        $sourcetext = $result->fetchColumn();
        unset($sql, $result);
コード例 #9
0
ファイル: mainfile.php プロジェクト: nukeplus/nuke
    $site_lang = $nv_Request->get_string(NV_LANG_VARIABLE, 'get,post', NV_LANG_DATA);
    if (!in_array($site_lang, $global_config['allow_sitelangs'])) {
        $global_config['closed_site'] = 1;
    }
}
// Dinh chi hoat dong cua site
if ($nv_check_update and !defined('NV_IS_UPDATE')) {
    // Dinh chi neu khong la admin toi cao
    if (!defined('NV_ADMIN') and !defined('NV_IS_GODADMIN')) {
        $disable_site_content = (isset($global_config['disable_site_content']) and !empty($global_config['disable_site_content'])) ? $global_config['disable_site_content'] : $lang_global['disable_site_content'];
        nv_info_die($global_config['site_description'], $lang_global['disable_site_title'], $disable_site_content, '', '', '', '');
    }
} elseif (!defined('NV_ADMIN') and !defined('NV_IS_ADMIN')) {
    if (!empty($global_config['closed_site'])) {
        $disable_site_content = (isset($global_config['disable_site_content']) and !empty($global_config['disable_site_content'])) ? $global_config['disable_site_content'] : $lang_global['disable_site_content'];
        nv_info_die($global_config['site_description'], $lang_global['disable_site_title'], $disable_site_content, '', '', '', '');
    } elseif (!in_array(NV_LANG_DATA, $global_config['allow_sitelangs'])) {
        Header('Location: ' . NV_BASE_SITEURL);
        exit;
    }
}
unset($nv_check_update);
$cache_file = NV_LANG_DATA . '_sitemods_' . NV_CACHE_PREFIX . '.cache';
if (($cache = $nv_Cache->getItem('modules', $cache_file)) != false) {
    $sys_mods = unserialize($cache);
} else {
    $sys_mods = array();
    try {
        $result = $db->query('SELECT * FROM ' . NV_MODULES_TABLE . ' m LEFT JOIN ' . NV_MODFUNCS_TABLE . ' f ON m.title=f.in_module WHERE m.act = 1 ORDER BY m.weight, f.subweight');
        while ($row = $result->fetch()) {
            $m_title = $row['title'];
コード例 #10
0
ファイル: admin_login.php プロジェクト: nukeviet/nukeviet
                    $nv_Request->set_Session('online', '1|' . NV_CURRENTTIME . '|' . NV_CURRENTTIME . '|0');
                    if ($global_config['lang_multi']) {
                        $sql = 'SELECT setup FROM ' . $db_config['prefix'] . '_setup_language WHERE lang=' . $db->quote(NV_LANG_INTERFACE);
                        $setup = $db->query($sql)->fetchColumn();
                        if ($setup) {
                            $nv_Request->set_Cookie('data_lang', NV_LANG_INTERFACE, NV_LIVE_COOKIE_TIME);
                        }
                    }
                    define('NV_IS_ADMIN', true);
                    $redirect = NV_BASE_SITEURL . NV_ADMINDIR;
                    if (!empty($admin_login_redirect) and strpos($admin_login_redirect, NV_NAME_VARIABLE . '=siteinfo&' . NV_OP_VARIABLE . '=notification_load') == 0) {
                        $redirect = $admin_login_redirect;
                        $nv_Request->unset_request('admin_login_redirect', 'session');
                    }
                    $error = '';
                    nv_info_die($global_config['site_description'], $lang_global['site_info'], $lang_global['admin_loginsuccessfully'] . " \n <meta http-equiv=\"refresh\" content=\"3;URL=" . $redirect . "\" />");
                    die;
                }
            } else {
                nv_insert_logs(NV_LANG_DATA, 'login', '[ ' . $nv_username . ' ] ' . $lang_global['loginsubmit'] . ' ' . $lang_global['fail'], ' Client IP:' . NV_CLIENT_IP, 0);
            }
        }
    }
} else {
    if (empty($admin_login_redirect)) {
        $nv_Request->set_Session('admin_login_redirect', $nv_Request->request_uri);
    }
    $nv_username = '';
}
if (file_exists(NV_ROOTDIR . '/includes/language/' . NV_LANG_INTERFACE . '/admin_global.php')) {
    require_once NV_ROOTDIR . '/includes/language/' . NV_LANG_INTERFACE . '/admin_global.php';
コード例 #11
0
ファイル: theme.php プロジェクト: anhtunguyen/vietnamguide
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;
}
コード例 #12
0
$session_files = $nv_Request->get_string('session_files', 'session', '');
if (empty($session_files)) {
    die('Wrong URL');
}
$session_files = unserialize($session_files);
if ($nv_Request->isset_request('code', 'get')) {
    $code = $nv_Request->get_string('code', 'get', '');
    if (empty($code) or !preg_match("/^([a-z0-9]{32})\$/i", $code) or !isset($session_files['linkdirect'][$code])) {
        die('Wrong URL');
    }
    $sql = 'UPDATE ' . NV_PREFIXLANG . '_' . $module_data . ' SET download_hits=download_hits+1 WHERE id=' . intval($session_files['linkdirect'][$code]['id']);
    $db->query($sql);
    $content = "<br /><img border=\"0\" src=\"" . NV_BASE_SITEURL . NV_ASSETS_DIR . "/images/load_bar.gif\"><br /><br />\n";
    $content .= sprintf($lang_module['download_wait2'], $session_files['linkdirect'][$code]['link']);
    $content .= "<meta http-equiv=\"refresh\" content=\"5;url=" . $session_files['linkdirect'][$code]['link'] . "\" />";
    nv_info_die($lang_module['download_detail'], $lang_module['download_wait'], $content);
    die;
}
$filename = $nv_Request->get_string('filename', 'get', '');
if (empty($filename) or !isset($session_files['fileupload'][$filename])) {
    die('Wrong URL');
}
if (!file_exists($session_files['fileupload'][$filename]['src'])) {
    die('Wrong URL');
}
if (!isset($session_files['fileupload'][$filename]['id'])) {
    die('Wrong URL');
}
$upload_dir = 'files';
$is_zip = false;
$is_resume = false;
コード例 #13
0
ファイル: functions.php プロジェクト: hpleduit/module-nvtools
<?php

/**
 * @Project NUKEVIET 4.x
 * @Author VINADES.,JSC (contact@vinades.vn)
 * @Copyright (C) 2014 VINADES.,JSC. All rights reserved
 * @License GNU/GPL version 2 or any later version
 * @Createdate Sat, 19 Mar 2011 16:50:45 GMT
 */
if (!defined('NV_SYSTEM')) {
    die('Stop!!!');
}
define('NV_IS_MOD_NVTOOLS', true);
if (!((NV_CLIENT_IP == '127.0.0.1' or NV_CLIENT_IP == '::1') and defined('NV_IS_GODADMIN'))) {
    $redirect = '<meta http-equiv="Refresh" content="3;URL=' . nv_url_rewrite(NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA, true) . '" />';
    nv_info_die($lang_module['error_title'], $lang_module['error_title'], $lang_module['error_content'] . $redirect);
}
function nv_mkdir_nvtools($path, $dir_name, $index_file = 0, $htaccess = 0)
{
    global $lang_global, $global_config, $sys_info;
    $dir_name = nv_string_to_filename(trim(basename($dir_name)));
    if (!preg_match("/^[a-zA-Z0-9-_.]+\$/", $dir_name)) {
        return array(0, sprintf($lang_global['error_create_directories_name_invalid'], $dir_name));
    }
    $path = @realpath($path);
    if (!preg_match('/\\/$/', $path)) {
        $path = $path . "/";
    }
    if (file_exists($path . $dir_name)) {
        return array(2, sprintf($lang_global['error_create_directories_name_used'], $dir_name), $path . $dir_name);
    }
コード例 #14
0
ファイル: admin_logout.php プロジェクト: nukeplus/nuke
/**
 * @Project NUKEVIET 4.x
 * @Author VINADES.,JSC (contact@vinades.vn)
 * @Copyright (C) 2014 VINADES.,JSC. All rights reserved
 * @License GNU/GPL version 2 or any later version
 * @Createdate 12/30/2009 0:51
 */
if (!defined('NV_MAINFILE')) {
    die('Stop!!!');
}
$js = $nv_Request->get_int('js', 'get', 0);
if ($js) {
    nv_insert_logs(NV_LANG_DATA, 'login', '[' . $admin_info['username'] . '] ' . $lang_global['admin_logout_title'], ' Client IP:' . NV_CLIENT_IP, 0);
    $nv_Request->unset_request('admin,online', 'session');
    include NV_ROOTDIR . '/includes/header.php';
    die('1');
}
$ok = $nv_Request->get_int('ok', 'get', 0);
if ($ok) {
    nv_insert_logs(NV_LANG_DATA, 'login', '[' . $admin_info['username'] . '] ' . $lang_global['admin_logout_title'], ' Client IP:' . NV_CLIENT_IP, 0);
    $nv_Request->unset_request('admin,online', 'session');
    $info = $lang_global['admin_logout_ok'];
    $info .= '<meta http-equiv="Refresh" content="5;URL=' . $global_config['site_url'] . '" />';
} else {
    $url = $client_info['referer'] != '' ? $client_info['referer'] : (isset($_SERVER['SCRIPT_URI']) ? $_SERVER['SCRIPT_URI'] : '');
    $info = $lang_global['admin_logout_question'] . " ?<br /><br />\n";
    $info .= "<a href=\"" . NV_BASE_SITEURL . "index.php?second=admin_logout&amp;ok=1\">" . $lang_global['ok'] . "</a> | \n";
    $info .= "<a href=\"" . $url . "\">" . $lang_global['cancel'] . "</a>\n";
}
nv_info_die($global_config['site_description'], $lang_global['admin_logout_title'], $info);
コード例 #15
0
ファイル: read.php プロジェクト: atarubi/nuke-viet
/**
 * nv_admin_read_lang()
 * 
 * @param mixed $dirlang
 * @param mixed $idfile
 * @return error read file
 */
function nv_admin_read_lang($dirlang, $module, $admin_file = 1)
{
    global $db, $global_config, $include_lang, $lang_module;
    $include_lang = "";
    $modules_exit = nv_scandir(NV_ROOTDIR . "/modules", $global_config['check_module']);
    if ($module == "global" and preg_match("/^block\\.global\\.([a-zA-Z0-9\\-\\_]+)\\.php\$/", $admin_file, $m)) {
        $include_lang = NV_ROOTDIR . "/language/" . $dirlang . "/" . $admin_file;
        $admin_file = 'block.global.' . $m[1];
    } elseif (preg_match("/^block\\.(global|module)\\.([a-zA-Z0-9\\-\\_]+)\\_" . $dirlang . "\\.php\$/", $admin_file, $m)) {
        $include_lang = NV_ROOTDIR . "/modules/" . $module . "/language/" . $admin_file;
        $admin_file = 'block.' . $m[1] . '.' . $m[2];
    } elseif ($module == "global" and $admin_file == 1) {
        $include_lang = NV_ROOTDIR . "/language/" . $dirlang . "/admin_" . $module . ".php";
    } elseif ($module == "global" and $admin_file == 0) {
        $include_lang = NV_ROOTDIR . "/language/" . $dirlang . "/" . $module . ".php";
    } elseif ($module == "install" and $admin_file == 0) {
        $include_lang = NV_ROOTDIR . "/language/" . $dirlang . "/" . $module . ".php";
    } elseif (in_array($module, $modules_exit) and $admin_file == 1) {
        $include_lang = NV_ROOTDIR . "/modules/" . $module . "/language/admin_" . $dirlang . ".php";
    } elseif (in_array($module, $modules_exit) and $admin_file == 0) {
        $include_lang = NV_ROOTDIR . "/modules/" . $module . "/language/" . $dirlang . ".php";
    } elseif (file_exists(NV_ROOTDIR . "/language/" . $dirlang . "/admin_" . $module . ".php")) {
        $admin_file = 1;
        $include_lang = NV_ROOTDIR . "/language/" . $dirlang . "/admin_" . $module . ".php";
    }
    if ($include_lang != "" and file_exists($include_lang)) {
        $lang_module_temp = $lang_module;
        $lang_module = array();
        $lang_global = array();
        $lang_block = array();
        $lang_translator = array();
        include $include_lang;
        list($idfile, $langtype) = $db->sql_fetchrow($db->sql_query("SELECT idfile, langtype FROM `" . NV_LANGUAGE_GLOBALTABLE . "_file` WHERE `module` =" . $db->dbescape($module) . " AND `admin_file`=" . $db->dbescape($admin_file)));
        if (intval($idfile) == 0) {
            $langtype = isset($lang_translator['langtype']) ? strip_tags($lang_translator['langtype']) : "lang_module";
            $lang_translator_save = array();
            $lang_translator_save['author'] = isset($lang_translator['author']) ? strip_tags($lang_translator['author']) : "VINADES.,JSC (contact@vinades.vn)";
            $lang_translator_save['createdate'] = isset($lang_translator['createdate']) ? strip_tags($lang_translator['createdate']) : date("d/m/Y, H:i");
            $lang_translator_save['copyright'] = isset($lang_translator['copyright']) ? strip_tags($lang_translator['copyright']) : "Copyright (C) 2010 VINADES.,JSC. All rights reserved";
            $lang_translator_save['info'] = isset($lang_translator['info']) ? strip_tags($lang_translator['info']) : "";
            $lang_translator_save['langtype'] = $langtype;
            //$author = base64_encode( serialize( $lang_translator_save ) );
            $author = var_export($lang_translator_save, true);
            $idfile = $db->sql_query_insert_id("INSERT INTO `" . NV_LANGUAGE_GLOBALTABLE . "_file` (`idfile`, `module`, `admin_file`, `langtype`, `author_" . $dirlang . "`) VALUES (NULL, " . $db->dbescape($module) . ", " . $db->dbescape($admin_file) . ", " . $db->dbescape($langtype) . ", '" . mysql_real_escape_string($author) . "')");
            if (!$idfile) {
                nv_info_die($lang_global['error_404_title'], $lang_global['error_404_title'], "Error insert file: " . $filelang);
            }
        } else {
            $lang_translator_save = array();
            $langtype = isset($lang_translator['langtype']) ? strip_tags($lang_translator['langtype']) : "lang_module";
            $lang_translator_save['author'] = isset($lang_translator['author']) ? strip_tags($lang_translator['author']) : "VINADES.,JSC (contact@vinades.vn)";
            $lang_translator_save['createdate'] = isset($lang_translator['createdate']) ? strip_tags($lang_translator['createdate']) : date("d/m/Y, H:i");
            $lang_translator_save['copyright'] = isset($lang_translator['copyright']) ? strip_tags($lang_translator['copyright']) : "Copyright (C) 2010 VINADES.,JSC. All rights reserved";
            $lang_translator_save['info'] = isset($lang_translator['info']) ? strip_tags($lang_translator['info']) : "";
            $lang_translator_save['langtype'] = $langtype;
            //$author = base64_encode( serialize( $lang_translator_save ) );
            $author = var_export($lang_translator_save, true);
            $sql = "UPDATE `" . NV_LANGUAGE_GLOBALTABLE . "_file` SET `author_" . $dirlang . "` = '" . mysql_real_escape_string($author) . "' WHERE `idfile` = '" . $idfile . "'";
            $db->sql_query($sql);
        }
        $temp_lang = array();
        switch ($langtype) {
            case 'lang_global':
                $temp_lang = $lang_global;
                break;
            case 'lang_module':
                $temp_lang = $lang_module;
                break;
            case 'lang_block':
                $temp_lang = $lang_block;
                break;
        }
        $result = $db->sql_query("SHOW COLUMNS FROM `" . NV_LANGUAGE_GLOBALTABLE . "_file`");
        $add_field = true;
        $array_lang_key = array();
        $array_lang_value = array();
        while ($row = $db->sql_fetch_assoc($result)) {
            if (substr($row['Field'], 0, 7) == "author_" and $row['Field'] != "author_" . $dirlang) {
                $array_lang_key[] = str_replace("author_", "lang_", $row['Field']);
                $array_lang_value[] = "";
            }
        }
        $string_lang_key = implode("`, `", $array_lang_key);
        $string_lang_value = "";
        if ($string_lang_key != "") {
            $string_lang_key = ", `" . $string_lang_key . "`";
            $string_lang_value = implode("', '", $array_lang_value);
            $string_lang_value = ", '" . $string_lang_value . "'";
        }
        $read_type = intval($global_config['read_type']);
        while (list($lang_key, $lang_value) = each($temp_lang)) {
            $check_type_update = false;
            $lang_key = trim($lang_key);
            $lang_value = nv_nl2br($lang_value);
            $lang_value = str_replace('<br  />', '<br />', $lang_value);
            $lang_value = str_replace('<br />', '<br />', $lang_value);
            if ($read_type == 0 or $read_type == 1) {
                $sql = "INSERT INTO `" . NV_LANGUAGE_GLOBALTABLE . "` (`id`, `idfile`, `lang_key`, `lang_" . $dirlang . "`, `update_" . $dirlang . "` " . $string_lang_key . ") VALUES (NULL, '" . $idfile . "', '" . mysql_real_escape_string($lang_key) . "', '" . mysql_real_escape_string($lang_value) . "',  UNIX_TIMESTAMP( ) " . $string_lang_value . ")";
                if (!$db->sql_query_insert_id($sql) and $read_type == 0) {
                    $check_type_update = true;
                }
            }
            if ($read_type == 2 or $check_type_update) {
                $sql = "UPDATE `" . NV_LANGUAGE_GLOBALTABLE . "` SET `lang_" . $dirlang . "` = '" . mysql_real_escape_string($lang_value) . "',  `update_" . $dirlang . "` =  UNIX_TIMESTAMP( ) WHERE `idfile` = '" . $idfile . "' AND `lang_key` = '" . mysql_real_escape_string($lang_key) . "' LIMIT 1";
                $db->sql_query($sql);
            }
        }
        $lang_module = $lang_module_temp;
        return "";
    } else {
        $include_lang = "";
        return $lang_module['nv_error_exit_module'] . " : " . $module;
    }
}
コード例 #16
0
ファイル: view.php プロジェクト: NukeVlad/module-download
<?php

/**
 * @Project NUKEVIET 4.x
 * @Author VINADES.,JSC (contact@vinades.vn)
 * @Copyright (C) 2014 VINADES.,JSC. All rights reserved
 * @License GNU/GPL version 2 or any later version
 * @Createdate 2-9-2010 14:43
 */
if (!defined('NV_IS_FILE_ADMIN')) {
    die('Stop!!!');
}
$id = $nv_Request->get_int('id', 'get,post', 0);
$row = $db->query('SELECT * FROM ' . NV_PREFIXLANG . '_' . $module_data . ' where id=' . $id)->fetch();
if (!empty($row['id'])) {
    $_url_rewrite = nv_url_rewrite(NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name . '&amp;' . NV_OP_VARIABLE . '=' . $list_cats[$row['catid']]['alias'] . '/' . $row['alias'] . $global_config['rewrite_exturl'], true);
    Header('Location: ' . $_url_rewrite);
    die;
}
nv_info_die($lang_global['error_404_title'], $lang_global['error_404_title'], $lang_global['admin_no_allow_func']);
コード例 #17
0
ファイル: categories.php プロジェクト: hoangvtien/blog
    $BL->fixWeightCat($parentid);
    nv_del_moduleCache($module_name);
    die('OK');
}
$page_title = $BL->lang('categoriesManager');
$xtpl = new XTemplate("categories.tpl", NV_ROOTDIR . "/themes/" . $global_config['module_theme'] . "/modules/" . $module_file);
$xtpl->assign('LANG', $lang_module);
$xtpl->assign('GLANG', $lang_global);
// Them va sua chuyen muc
$id = $nv_Request->get_int("id", "post,get", 0);
$error = "";
if ($id) {
    $sql = "SELECT id, parentid, title, alias, keywords, description, weight FROM " . $BL->table_prefix . "_categories WHERE id=" . $id;
    $result = $db->query($sql);
    if ($result->rowCount() != 1) {
        nv_info_die($BL->glang('error_404_title'), $BL->glang('error_404_title'), $BL->glang('error_404_content'));
    }
    $row = $result->fetch();
    $data = $row;
} else {
    $data = array("parentid" => $nv_Request->get_int("parentid", "post,get", 0), "title" => "", "alias" => "", "keywords" => "", "description" => "");
}
if ($nv_Request->isset_request("submit", "post")) {
    $data['parentid'] = $nv_Request->get_int("parentid", "post", 0);
    $data['title'] = nv_substr($nv_Request->get_title('title', 'post', '', 1), 0, 255);
    $data['alias'] = nv_substr($nv_Request->get_title('alias', 'post', '', 1), 0, 255);
    $data['keywords'] = nv_substr($nv_Request->get_title('keywords', 'post', '', 1), 0, 255);
    $data['description'] = nv_substr($nv_Request->get_title('description', 'post', '', 1), 0, 255);
    $data['alias'] = $data['alias'] ? strtolower(change_alias($data['alias'])) : strtolower(change_alias($data['title']));
    $data['keywords'] = $data['keywords'] ? implode(", ", array_filter(array_unique(array_map("trim", explode(",", $data['keywords']))))) : "";
    if (empty($data['title'])) {
コード例 #18
0
ファイル: read.php プロジェクト: lzhao18/nukeviet
/**
 * nv_admin_read_lang()
 *
 * @param mixed $dirlang
 * @param mixed $idfile
 * @return error read file
 */
function nv_admin_read_lang($dirlang, $module, $admin_file = 1)
{
    global $db, $global_config, $include_lang, $lang_module;
    $include_lang = '';
    $modules_exit = nv_scandir(NV_ROOTDIR . '/modules', $global_config['check_module']);
    if ($module == 'global' and preg_match('/^block\\.global\\.([a-zA-Z0-9\\-\\_]+)\\.php$/', $admin_file, $m)) {
        $include_lang = NV_ROOTDIR . '/language/' . $dirlang . '/' . $admin_file;
        $admin_file = 'block.global.' . $m[1];
    } elseif (preg_match('/^block\\.(global|module)\\.([a-zA-Z0-9\\-\\_]+)\\_' . $dirlang . '\\.php$/', $admin_file, $m)) {
        $include_lang = NV_ROOTDIR . '/modules/' . $module . '/language/' . $admin_file;
        $admin_file = 'block.' . $m[1] . '.' . $m[2];
    } elseif ($module == 'global' and $admin_file == 1) {
        $include_lang = NV_ROOTDIR . '/language/' . $dirlang . '/admin_' . $module . '.php';
    } elseif ($module == 'global' and $admin_file == 0) {
        $include_lang = NV_ROOTDIR . '/language/' . $dirlang . '/' . $module . '.php';
    } elseif ($module == 'install' and $admin_file == 0) {
        $include_lang = NV_ROOTDIR . '/language/' . $dirlang . '/' . $module . '.php';
    } elseif (in_array($module, $modules_exit) and $admin_file == 1) {
        $include_lang = NV_ROOTDIR . '/modules/' . $module . '/language/admin_' . $dirlang . '.php';
    } elseif (in_array($module, $modules_exit) and $admin_file == 0) {
        $include_lang = NV_ROOTDIR . '/modules/' . $module . '/language/' . $dirlang . '.php';
    } elseif (file_exists(NV_ROOTDIR . '/language/' . $dirlang . '/admin_' . $module . '.php')) {
        $admin_file = 1;
        $include_lang = NV_ROOTDIR . '/language/' . $dirlang . '/admin_' . $module . '.php';
    }
    if ($include_lang != '' and file_exists($include_lang)) {
        $lang_module_temp = $lang_module;
        $lang_module = array();
        $lang_global = array();
        $lang_block = array();
        $lang_translator = array();
        include $include_lang;
        $sth = $db->prepare('SELECT idfile, langtype FROM ' . NV_LANGUAGE_GLOBALTABLE . '_file WHERE module = :module AND admin_file= :admin_file');
        $sth->bindParam(':module', $module, PDO::PARAM_STR);
        $sth->bindParam(':admin_file', $admin_file, PDO::PARAM_STR);
        $sth->execute();
        list($idfile, $langtype) = $sth->fetch(3);
        if (empty($idfile)) {
            $langtype = isset($lang_translator['langtype']) ? strip_tags($lang_translator['langtype']) : 'lang_module';
            $lang_translator_save = array();
            $lang_translator_save['author'] = isset($lang_translator['author']) ? strip_tags($lang_translator['author']) : 'VINADES.,JSC (contact@vinades.vn)';
            $lang_translator_save['createdate'] = isset($lang_translator['createdate']) ? strip_tags($lang_translator['createdate']) : date('d/m/Y, H:i');
            $lang_translator_save['copyright'] = isset($lang_translator['copyright']) ? strip_tags($lang_translator['copyright']) : 'Copyright (C) ' . date('Y') . ' VINADES.,JSC. All rights reserved';
            $lang_translator_save['info'] = isset($lang_translator['info']) ? strip_tags($lang_translator['info']) : '';
            $lang_translator_save['langtype'] = $langtype;
            $author = var_export($lang_translator_save, true);
            $data = array();
            $data['module'] = $module;
            $data['admin_file'] = $admin_file;
            $data['langtype'] = $langtype;
            $data['author'] = $author;
            $idfile = $db->insert_id('INSERT INTO ' . NV_LANGUAGE_GLOBALTABLE . '_file (module, admin_file, langtype, author_' . $dirlang . ') VALUES (:module, :admin_file, :langtype, :author)', 'idfile', $data);
            if (empty($idfile)) {
                nv_info_die($lang_global['error_404_title'], $lang_global['error_404_title'], 'error read file: ' . str_replace(NV_ROOTDIR . '/', '', $include_lang));
            }
        } else {
            $lang_translator_save = array();
            $langtype = isset($lang_translator['langtype']) ? strip_tags($lang_translator['langtype']) : 'lang_module';
            $lang_translator_save['author'] = isset($lang_translator['author']) ? strip_tags($lang_translator['author']) : 'VINADES.,JSC (contact@vinades.vn)';
            $lang_translator_save['createdate'] = isset($lang_translator['createdate']) ? strip_tags($lang_translator['createdate']) : date('d/m/Y, H:i');
            $lang_translator_save['copyright'] = isset($lang_translator['copyright']) ? strip_tags($lang_translator['copyright']) : 'Copyright (C) ' . date('Y') . ' VINADES.,JSC. All rights reserved';
            $lang_translator_save['info'] = isset($lang_translator['info']) ? strip_tags($lang_translator['info']) : '';
            $lang_translator_save['langtype'] = $langtype;
            $author = var_export($lang_translator_save, true);
            try {
                $sth = $db->prepare('UPDATE ' . NV_LANGUAGE_GLOBALTABLE . '_file SET author_' . $dirlang . '= :author WHERE idfile= ' . $idfile);
                $sth->bindParam(':author', $author, PDO::PARAM_STR, strlen($author));
                $sth->execute();
            } catch (PDOException $e) {
                nv_info_die($lang_global['error_404_title'], $lang_global['error_404_title'], $e->getMessage());
            }
        }
        $temp_lang = array();
        switch ($langtype) {
            case 'lang_global':
                $temp_lang = $lang_global;
                break;
            case 'lang_module':
                $temp_lang = $lang_module;
                break;
            case 'lang_block':
                $temp_lang = $lang_block;
                break;
        }
        $add_field = true;
        $array_lang_key = array();
        $array_lang_value = array();
        $columns_array = $db->columns_array(NV_LANGUAGE_GLOBALTABLE . '_file');
        foreach ($columns_array as $row) {
            if (substr($row['field'], 0, 7) == 'author_' and $row['field'] != 'author_' . $dirlang) {
                $array_lang_key[] = str_replace('author_', 'lang_', $row['field']);
                $array_lang_value[] = '';
            }
        }
        $string_lang_key = implode(', ', $array_lang_key);
        $string_lang_value = '';
        if ($string_lang_key != '') {
            $string_lang_key = ', ' . $string_lang_key;
            $string_lang_value = implode("', '", $array_lang_value);
            $string_lang_value = ", '" . $string_lang_value . "'";
        }
        $read_type = intval($global_config['read_type']);
        $sth_is = $db->prepare('INSERT INTO ' . NV_LANGUAGE_GLOBALTABLE . ' (idfile, lang_key, lang_' . $dirlang . ', update_' . $dirlang . ') VALUES (:idfile, :lang_key, :lang_value, ' . NV_CURRENTTIME . ')');
        $sth_ud = $db->prepare('UPDATE ' . NV_LANGUAGE_GLOBALTABLE . ' SET lang_' . $dirlang . ' = :lang_value, update_' . $dirlang . ' = ' . NV_CURRENTTIME . ' WHERE idfile = :idfile AND lang_key = :lang_key');
        while (list($lang_key, $lang_value) = each($temp_lang)) {
            $check_type_update = false;
            $lang_key = trim($lang_key);
            $lang_value = nv_nl2br($lang_value);
            $lang_value = preg_replace("/<br\\s*\\/>/", '<br />', $lang_value);
            $lang_value = preg_replace("/<\\/\\s*br\\s*>/", '<br />', $lang_value);
            if ($read_type == 0 or $read_type == 1) {
                try {
                    $sth_is->bindParam(':idfile', $idfile, PDO::PARAM_INT);
                    $sth_is->bindParam(':lang_key', $lang_key, PDO::PARAM_STR);
                    $sth_is->bindParam(':lang_value', $lang_value, PDO::PARAM_STR);
                    $sth_is->execute();
                    if ($read_type == 0 and !$sth_is->rowCount()) {
                        $check_type_update = true;
                    }
                } catch (PDOException $e) {
                    if ($read_type == 0) {
                        $check_type_update = true;
                    }
                }
            }
            if ($read_type == 2 or $check_type_update) {
                $sth_ud->bindParam(':idfile', $idfile, PDO::PARAM_INT);
                $sth_ud->bindParam(':lang_key', $lang_key, PDO::PARAM_STR);
                $sth_ud->bindParam(':lang_value', $lang_value, PDO::PARAM_STR);
                $sth_ud->execute();
            }
        }
        $lang_module = $lang_module_temp;
        return '';
    } else {
        $include_lang = '';
        return $lang_module['nv_error_exit_module'] . ' : ' . $module;
    }
}
コード例 #19
0
                $checknum = nv_genpass(10);
                $checknum = $crypt->hash($checknum);
                $array_admin = array('admin_id' => $admin_id, 'checknum' => $checknum, 'current_agent' => $agent, 'last_agent' => $row['admin_last_agent'], 'current_ip' => $client_info['ip'], 'last_ip' => $row['admin_last_ip'], 'current_login' => $current_login, 'last_login' => intval($row['admin_last_login']));
                $admin_serialize = serialize($array_admin);
                $query = $db->constructQuery("UPDATE `" . NV_AUTHORS_GLOBALTABLE . "` SET `check_num` = [s], `last_login` = [d], `last_ip` = [s], `last_agent` = [s] WHERE `admin_id`=[d]", $checknum, $current_login, $client_info['ip'], $agent, $admin_id);
                $db->sql_query($query);
                $nv_Request->set_Session('admin', $admin_serialize);
                $nv_Request->set_Session('online', '1|' . NV_CURRENTTIME . '|' . NV_CURRENTTIME . '|0');
                define('NV_IS_ADMIN', true);
                $redirect = NV_BASE_SITEURL . NV_ADMINDIR;
                if (!empty($admin_login_redirect)) {
                    $redirect = $admin_login_redirect;
                    $nv_Request->unset_request('admin_login_redirect', 'session');
                }
                $error = "";
                nv_info_die($global_config['site_description'], $lang_global['site_info'], $lang_global['admin_loginsuccessfully'] . "<META HTTP-EQUIV=\"refresh\" content=\"3;URL=" . $redirect . "\" />");
                die;
            }
        }
    }
} else {
    if (empty($admin_login_redirect)) {
        $nv_Request->set_Session('admin_login_redirect', $nv_Request->request_uri);
    }
    $nv_username = "";
}
if (file_exists(NV_ROOTDIR . "/language/" . NV_LANG_INTERFACE . "/admin_global.php")) {
    require_once NV_ROOTDIR . "/language/" . NV_LANG_INTERFACE . "/admin_global.php";
} elseif (file_exists(NV_ROOTDIR . "/language/en/admin_global.php")) {
    require_once NV_ROOTDIR . "/language/en/admin_global.php";
}
コード例 #20
0
ファイル: main.php プロジェクト: nukeplus/nuke
 * @Createdate 3-6-2010 0:14
 */
if (!defined('NV_IS_MOD_NEWS')) {
    die('Stop!!!');
}
$page_title = $module_info['custom_title'];
$key_words = $module_info['keywords'];
$contents = '';
$cache_file = '';
$base_url = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name;
$base_url_rewrite = nv_url_rewrite($base_url, true);
$page_url_rewrite = $page ? nv_url_rewrite($base_url . '/page-' . $page, true) : $base_url_rewrite;
$request_uri = $_SERVER['REQUEST_URI'];
if (!($home or $request_uri == $base_url_rewrite or $request_uri == $page_url_rewrite or NV_MAIN_DOMAIN . $request_uri == $base_url_rewrite or NV_MAIN_DOMAIN . $request_uri == $page_url_rewrite)) {
    $redirect = '<meta http-equiv="Refresh" content="3;URL=' . $base_url_rewrite . '" />';
    nv_info_die($lang_global['error_404_title'], $lang_global['error_404_title'], $lang_global['error_404_content'] . $redirect);
}
if (!defined('NV_IS_MODADMIN') and $page < 5) {
    $cache_file = NV_LANG_DATA . '_' . $module_info['template'] . '-' . $op . '-' . $page . '-' . NV_CACHE_PREFIX . '.cache';
    if (($cache = $nv_Cache->getItem($module_name, $cache_file)) != false) {
        $contents = $cache;
    }
}
if (empty($contents)) {
    $viewcat = $module_config[$module_name]['indexfile'];
    $show_no_image = $module_config[$module_name]['show_no_image'];
    $array_catpage = array();
    $array_cat_other = array();
    if ($viewcat == 'viewcat_none') {
        $contents = '';
    } elseif ($viewcat == 'viewcat_page_new' or $viewcat == 'viewcat_page_old') {
コード例 #21
0
ファイル: theme.php プロジェクト: syphuonglam/creative-portal
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 . "&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_RSS_INDEX_HREF', NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&amp;" . 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 .= "&amp;" . NV_NAME_VARIABLE . "=" . $modname;
                $url .= "&amp;" . 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 . "&amp;" . 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 . "&amp;" . NV_NAME_VARIABLE . "=" . $modname . "&amp;" . 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 . "&amp;" . NV_NAME_VARIABLE . "=" . $modname . "&amp;" . 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 . "&amp;" . NV_NAME_VARIABLE . "=" . $modname . "&amp;" . 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 . "&amp;" . NV_NAME_VARIABLE . "=" . $modname . "&amp;" . 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 . "&amp;" . NV_NAME_VARIABLE . "=" . $modname . "&amp;" . 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 . "&amp;" . 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 . "&amp;" . NV_NAME_VARIABLE . "=" . $module_name . "&amp;" . NV_OP_VARIABLE . "=newsearch" . "&amp;" . "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&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());
    $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;
}