Exemplo n.º 1
0
        die;
    }
} else {
    $sql = 'SELECT t1.admin_id as admin_id, t1.check_num as check_num, t1.last_agent as last_agent, t1.last_ip as last_ip, t1.last_login as last_login, t1.files_level as files_level, t1.lev as lev,t1.position as position, t1.editor as editor, t1.is_suspend as is_suspend, t1.susp_reason as susp_reason,
		t2.username as username, t2.email as email, t2.first_name as first_name, t2.last_name as last_name, t2.view_mail as view_mail, t2.regdate as regdate, t2.active as active
		FROM ' . NV_AUTHORS_GLOBALTABLE . ' t1 INNER JOIN ' . NV_USERS_GLOBALTABLE . ' t2 ON t1.admin_id = t2.userid ORDER BY t1.lev ASC';
    $adminrows = $db->query($sql)->fetchAll();
    $numrows = sizeof($adminrows);
}
if ($numrows) {
    $sql = 'SELECT * FROM ' . NV_MODULES_TABLE . ' ORDER BY weight ASC';
    $list_modules = $nv_Cache->db($sql, '', 'modules');
    foreach ($adminrows as $row) {
        $login = $row['username'];
        $email = defined('NV_IS_SPADMIN') ? $row['email'] : ($row['admin_id'] == $admin_info['admin_id'] ? $row['email'] : (intval($row['view_mail']) ? $row['email'] : ''));
        $email = !empty($email) ? nv_EncodeEmail($email) : '';
        $level = intval($row['lev']);
        if ($level == 1) {
            $level_txt = '<strong>' . $lang_global['level1'] . '</strong>';
        } elseif ($level == 2) {
            $level_txt = '<strong>' . $lang_global['level2'] . '</strong>';
        } else {
            $array_mod = array();
            foreach ($list_modules as $row_mod) {
                if (!empty($row_mod['admins']) and in_array($row['admin_id'], explode(',', $row_mod['admins']))) {
                    $array_mod[] = $row_mod['custom_title'];
                }
            }
            $level_txt = implode(', ', $array_mod);
        }
        $last_login = intval($row['last_login']);
Exemplo n.º 2
0
 * @Createdate 3/25/2010 21:38
 */
if (!defined('NV_IS_MOD_BANNERS')) {
    die('Stop!!!');
}
if (!defined('NV_IS_AJAX')) {
    die('Wrong URL');
}
if (!defined('NV_IS_BANNER_CLIENT')) {
    die('&nbsp;');
}
$contents = array();
$contents['edit_onclick'] = "nv_cl_edit('action');";
$contents['edit_name'] = $lang_module['edit_clinfo'];
$contents['rows']['login'] = array($lang_module['login'], $banner_client_info['login']);
$contents['rows']['email'] = array($lang_global['email'], nv_EncodeEmail($banner_client_info['email']));
$contents['rows']['full_name'] = array($lang_global['full_name'], $banner_client_info['full_name']);
$contents['rows']['reg_time'] = array($lang_module['reg_time'], nv_date("d/m/Y H:i", $banner_client_info['reg_time']));
if (!empty($banner_client_info['website']) and nv_is_url($banner_client_info['website'])) {
    $contents['rows']['website'] = array($lang_module['website'], "<a href=\"" . $banner_client_info['website'] . "\" target=\"_blank\">" . $banner_client_info['website'] . "</a>");
}
if (!empty($banner_client_info['location'])) {
    $contents['rows']['location'] = array($lang_module['location'], $banner_client_info['location']);
}
if (!empty($banner_client_info['yim'])) {
    $contents['rows']['yim'] = array($lang_module['yim'], $banner_client_info['yim']);
}
if (!empty($banner_client_info['phone'])) {
    $contents['rows']['phone'] = array($lang_global['phonenumber'], $banner_client_info['phone']);
}
if (!empty($banner_client_info['fax'])) {
Exemplo n.º 3
0
if (!defined('NV_IS_FILE_ADMIN')) {
    die('Stop!!!');
}
if (!defined('NV_IS_AJAX')) {
    die('Wrong URL');
}
$query = "SELECT * FROM `" . NV_BANNERS_CLIENTS_GLOBALTABLE . "`";
$query .= " ORDER BY `login` ASC";
$result = $db->sql_query($query);
$contents = array();
$contents['caption'] = $lang_module['client_list2'];
$contents['thead'] = array($lang_module['login'], $lang_module['full_name'], $lang_module['email'], $lang_module['reg_time'], $lang_module['is_act'], $lang_global['actions']);
$contents['view'] = $lang_global['detail'];
$contents['edit'] = $lang_global['edit'];
$contents['add'] = $lang_global['add'];
$contents['del'] = $lang_global['delete'];
$contents['rows'] = array();
while ($row = $db->sql_fetchrow($result)) {
    $contents['rows'][$row['id']]['login'] = $row['login'];
    $contents['rows'][$row['id']]['full_name'] = $row['full_name'];
    $contents['rows'][$row['id']]['email'] = nv_EncodeEmail($row['email']);
    $contents['rows'][$row['id']]['reg_time'] = nv_date("d/m/Y H:i", $row['reg_time']);
    $contents['rows'][$row['id']]['act'] = array('act_' . $row['id'], $row['act'], "nv_chang_act(" . $row['id'] . ",'act_" . $row['id'] . "');");
    $contents['rows'][$row['id']]['view'] = NV_BASE_ADMINURL . "index.php?" . NV_NAME_VARIABLE . "=" . $module_name . "&amp;" . NV_OP_VARIABLE . "=info_client&amp;id=" . $row['id'];
    $contents['rows'][$row['id']]['edit'] = NV_BASE_ADMINURL . "index.php?" . NV_NAME_VARIABLE . "=" . $module_name . "&amp;" . NV_OP_VARIABLE . "=edit_client&amp;id=" . $row['id'];
    $contents['rows'][$row['id']]['add'] = NV_BASE_ADMINURL . "index.php?" . NV_NAME_VARIABLE . "=" . $module_name . "&amp;" . NV_OP_VARIABLE . "=add_banner&amp;clid=" . $row['id'];
    $contents['rows'][$row['id']]['del'] = "nv_cl_del(" . $row['id'] . ");";
}
include NV_ROOTDIR . "/includes/header.php";
echo nv_cl_list_theme($contents);
include NV_ROOTDIR . "/includes/footer.php";
Exemplo n.º 4
0
if ($row['updatetime'] >= $today) {
    $row['updatetime'] = $lang_module['today'] . ', ' . date('H:i', $row['updatetime']);
} elseif ($row['updatetime'] >= $yesterday) {
    $row['updatetime'] = $lang_module['yesterday'] . ', ' . date('H:i', $row['updatetime']);
} else {
    $row['updatetime'] = nv_date('d/m/Y H:i', $row['updatetime']);
}
if (defined('NV_IS_MODADMIN') and !empty($row['user_id']) and !empty($row['user_name'])) {
    $row['user_name'] = '<a href="' . NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=users&amp;' . NV_OP_VARIABLE . '=edit&amp;userid=' . $row['user_id'] . '">' . $row['user_name'] . '</a>';
}
if (empty($row['user_name'])) {
    $row['user_name'] = $lang_module['unknown'];
}
if (!empty($row['author_name'])) {
    if (!empty($row['author_email'])) {
        $row['author_name'] .= ' (' . nv_EncodeEmail($row['author_email']) . ')';
    }
} else {
    $row['author_name'] = $lang_module['unknown'];
}
if (!empty($row['author_url'])) {
    $row['author_url'] = '<a href="' . $row['author_url'] . '" onclick="this.target=\'_blank\'">' . $row['author_url'] . '</a>';
} else {
    $row['author_url'] = $lang_module['unknown'];
}
if (empty($row['description'])) {
    $row['description'] = $row['introtext'];
}
if (empty($row['version'])) {
    $row['version'] = $lang_module['unknown'];
}
Exemplo n.º 5
0
        $xtpl->parse('main.notice.loop');
    }
    $xtpl->parse('main.notice');
} else {
    $xtpl->parse('main.NoNotice');
}
// Xuat cac thong tin thong ke
foreach ($array_statistics as $statistics) {
    $xtpl->assign('STATISTICS', $statistics);
    $xtpl->parse('main.statistics');
}
// Xuat thong tin module
include NV_ROOTDIR . "/modules/" . $module_file . "/version.php";
$module_version['date'] = intval(strtotime($module_version['date']));
$module_version['date'] = $module_version['date'] ? nv_date("D, j M Y H:i:s", $module_version['date']) . " GMT" : "N/A";
$xtpl->assign('MODULE_INFO', $module_version);
$xtpl->assign('AUTHOR_CONTACT', nv_EncodeEmail($BL->author_email));
$xtpl->assign('DONATE_EMAIL', $BL->author_email);
$xtpl->assign('DONATE_ORDERID', NV_CURRENTTIME);
$xtpl->assign('DONATE_AMOUNT', 200000);
$xtpl->assign('DONATE_RETURN', NV_MY_DOMAIN . NV_BASE_ADMINURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&" . NV_NAME_VARIABLE . "=" . $module_name);
$xtpl->assign('NV_BASE_SITEURL', NV_BASE_SITEURL);
$xtpl->assign('TEMPLATE', $global_config['module_theme']);
$xtpl->assign('MODULE_FILE', $module_file);
// Xuất một số link cần thiết
$xtpl->assign('BASE_ADMIN_LINK', NV_BASE_ADMINURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&" . NV_NAME_VARIABLE . "=" . $module_name . '&amp;' . NV_OP_VARIABLE . '=');
$xtpl->parse('main');
$contents = $xtpl->text('main');
include NV_ROOTDIR . '/includes/header.php';
echo nv_admin_theme($contents);
include NV_ROOTDIR . '/includes/footer.php';
Exemplo n.º 6
0
    die(error_info_theme($lang_module['error_group_not_found']));
}
$row = $db->sql_fetchrow($result);
$group_title = $row['title'];
if (!empty($row['users'])) {
    $page = $nv_Request->get_int('page', 'get', 0);
    $all_page = count(explode(",", $row['users']));
    $per_page = 10;
    $users_in_group = array();
    $users_in_group['caption'] = sprintf($lang_module['users_in_group_caption'], $group_title, $all_page);
    $users_in_group['thead'] = array("UserId", $lang_global['nickname'], $lang_global['full_name'], $lang_global['email'], $lang_global['regdate'], $lang_global['last_login']);
    $users_in_group['action'] = NV_BASE_ADMINURL . "index.php?" . NV_NAME_VARIABLE . "=" . $module_name . "&amp;" . NV_OP_VARIABLE . "=edit&amp;userid=";
    $base_url = NV_BASE_ADMINURL . "index.php?" . NV_NAME_VARIABLE . "=" . $module_name . "&amp;" . NV_OP_VARIABLE . "=groups_users&amp;group_id=" . $group_id;
    $query = "SELECT `userid`, `username`, `email`, `full_name`, `regdate`, `last_login` \r\n        FROM `" . NV_USERS_GLOBALTABLE . "` \r\n        WHERE `userid` IN (" . $row['users'] . ") \r\n        ORDER BY `username` ASC \r\n        LIMIT " . $page . "," . $per_page;
    $result = $db->sql_query($query);
    while ($row = $db->sql_fetchrow($result)) {
        $users_in_group['row'][$row['userid']]['username'] = $row['username'];
        $users_in_group['row'][$row['userid']]['full_name'] = $row['full_name'];
        $users_in_group['row'][$row['userid']]['email'] = nv_EncodeEmail($row['email']);
        $users_in_group['row'][$row['userid']]['regdate'] = nv_date("l, d/m/Y H:i", $row['regdate']);
        $users_in_group['row'][$row['userid']]['last_login'] = !empty($row['last_login']) ? nv_date("l, d/m/Y H:i", $row['last_login']) : $lang_global['never'];
        $users_in_group['row'][$row['userid']]['onclick'] = array("nv_group_exclude_user(" . $group_id . ", " . $row['userid'] . ")", sprintf($lang_module['exclude_user'], $row['full_name'], $group_title));
    }
    $users_in_group['generate_page'] = nv_generate_page($base_url, $all_page, $per_page, $page, true, true, 'nv_urldecode_ajax', 'list_users');
    $contents = main_list_users_theme($users_in_group);
    include NV_ROOTDIR . "/includes/header.php";
    echo $contents;
    include NV_ROOTDIR . "/includes/footer.php";
} else {
    die(error_info_theme($lang_module['error_users_not_found']));
}
Exemplo n.º 7
0
if ($row['updatetime'] >= $today) {
    $row['updatetime'] = $lang_module['today'] . ", " . date("H:i", $row['updatetime']);
} elseif ($row['updatetime'] >= $yesterday) {
    $row['updatetime'] = $lang_module['yesterday'] . ", " . date("H:i", $row['updatetime']);
} else {
    $row['updatetime'] = nv_date("d/m/Y H:i", $row['updatetime']);
}
if (defined('NV_IS_MODADMIN') and !empty($row['user_id']) and !empty($row['user_name'])) {
    $row['user_name'] = "<a href=\"" . NV_BASE_ADMINURL . "index.php?" . NV_NAME_VARIABLE . "=users&amp;" . NV_OP_VARIABLE . "=edit&amp;userid=" . $row['user_id'] . "\">" . $row['user_name'] . "</a>";
}
if (empty($row['user_name'])) {
    $row['user_name'] = $lang_module['unknown'];
}
if (!empty($row['author_name'])) {
    if (!empty($row['author_email'])) {
        $row['author_name'] .= " (" . nv_EncodeEmail($row['author_email']) . ")";
    }
} else {
    $row['author_name'] = $lang_module['unknown'];
}
if (!empty($row['author_url'])) {
    $row['author_url'] = "<a href=\"" . $row['author_url'] . "\" onclick=\"this.target='_blank'\">" . $row['author_url'] . "</a>";
} else {
    $row['author_url'] = $lang_module['unknown'];
}
if (empty($row['description'])) {
    $row['description'] = $row['introtext'];
}
if (empty($row['version'])) {
    $row['version'] = $lang_module['unknown'];
}
Exemplo n.º 8
0
    die('Stop!!!');
}
if (!defined('NV_IS_AJAX')) {
    die('Wrong URL');
}
$id = $nv_Request->get_int('id', 'get', 0);
$sql = 'SELECT * FROM ' . NV_BANNERS_GLOBALTABLE . '_clients WHERE id=' . $id;
$row = $db->query($sql)->fetch();
if (empty($row)) {
    die('Stop!!!');
}
$contents = array();
$contents['caption'] = sprintf($lang_module['info_client_caption'], $row['full_name']);
$contents['rows'][] = array($lang_module['login'], $row['login']);
$contents['rows'][] = array($lang_module['full_name'], $row['full_name']);
$contents['rows'][] = array($lang_module['email'], nv_EncodeEmail($row['email']));
$contents['rows'][] = array($lang_module['reg_time'], nv_date('d/m/Y H:i', $row['reg_time']));
if (!empty($row['website']) and nv_is_url($row['website'])) {
    $contents['rows'][] = array($lang_module['website'], '<a href="' . $row['website'] . '" target="_blank">' . $row['website'] . '</a>');
}
if (!empty($row['location'])) {
    $contents['rows'][] = array($lang_module['location'], $row['location']);
}
if (!empty($row['yim'])) {
    $contents['rows'][] = array($lang_module['yim'], $row['yim']);
}
if (!empty($row['phone'])) {
    $contents['rows'][] = array($lang_module['phone'], $row['phone']);
}
if (!empty($row['fax'])) {
    $contents['rows'][] = array($lang_module['fax'], $row['fax']);
}
$page = $nv_Request->get_int('page', 'get', 0);
$per_page = 10;
switch ($search_option) {
    case 1:
        $query .= " ORDER BY `email` ASC LIMIT " . $page . "," . $per_page;
        break;
    case 2:
        $query .= " ORDER BY `userid` ASC LIMIT " . $page . "," . $per_page;
        break;
    default:
        $query .= " ORDER BY `username` ASC LIMIT " . $page . "," . $per_page;
}
$result = $db->sql_query($query);
$search_result = array();
$search_result['caption'] = $lang_module['search_result_caption'];
$search_result['thead'] = array("UserId", $lang_global['nickname'], $lang_global['full_name'], $lang_global['email'], $lang_global['regdate'], $lang_global['last_login']);
$search_result['action'] = NV_BASE_ADMINURL . "index.php?" . NV_NAME_VARIABLE . "=" . $module_name . "&amp;" . NV_OP_VARIABLE . "=edit&amp;userid=";
while ($row = $db->sql_fetchrow($result)) {
    $search_result['row'][$row['userid']]['username'] = $row['username'];
    $search_result['row'][$row['userid']]['full_name'] = $row['full_name'];
    $search_result['row'][$row['userid']]['email'] = nv_EncodeEmail($row['email']);
    $search_result['row'][$row['userid']]['regdate'] = nv_date("l, d/m/Y H:i", $row['regdate']);
    $search_result['row'][$row['userid']]['last_login'] = !empty($row['last_login']) ? nv_date("l, d/m/Y H:i", $row['last_login']) : $lang_global['never'];
    $search_result['row'][$row['userid']]['onclick'] = array("nv_group_add_user(" . $group_id . "," . $row['userid'] . ")", sprintf($lang_module['add_user'], $row['full_name'], $group_title));
}
$search_result['generate_page'] = nv_generate_page($base_url, $all_page, $per_page, $page, true, true, 'nv_urldecode_ajax', 'search_users_result');
$contents = nv_admin_search_users_theme($search_result);
include NV_ROOTDIR . "/includes/header.php";
echo $contents;
include NV_ROOTDIR . "/includes/footer.php";
Exemplo n.º 10
0
         }
     }
     $array[$row['id']] = array('id' => (int) $row['id'], 'post_name' => $post_name, 'post_email' => $row['post_email'], 'photo' => $row['photo'], 'post_ip' => $row['post_ip'], 'post_time' => $post_time, 'subject' => $row['subject'], 'comment' => $row['comment'], 'admin_reply' => $admin_reply, 'edit_link' => NV_BASE_ADMINURL . "index.php?" . NV_NAME_VARIABLE . "=" . $module_name . "&amp;" . NV_OP_VARIABLE . "=comment&amp;edit=1&amp;id=" . $row['id'], 'del_link' => NV_BASE_ADMINURL . "index.php?" . NV_NAME_VARIABLE . "=" . $module_name . "&amp;" . NV_OP_VARIABLE . "=comment");
     //
 }
 if (!empty($users)) {
     $in = array_keys($users);
     $in = array_unique($in);
     $in = implode(",", $in);
     $query = "SELECT `view_mail`, `userid` FROM `" . NV_USERS_GLOBALTABLE . "` WHERE `userid` IN (" . $in . ")";
     $result = $db->sql_query($query);
     while (list($view_mail, $userid) = $db->sql_fetchrow($result)) {
         if (isset($users[$userid])) {
             foreach ($users[$userid] as $id) {
                 if (!empty($array[$id]['post_email']) and (defined('NV_IS_ADMIN') or $view_mail)) {
                     $array[$id]['post_email'] = nv_EncodeEmail($array[$id]['post_email']);
                     $array[$id]['post_name'] .= " (" . $array[$id]['post_email'] . ", " . $array[$id]['post_ip'] . ")";
                 } else {
                     $array[$id]['post_email'] = "";
                 }
             }
         }
     }
 }
 if (!empty($admins)) {
     $in = array_keys($admins);
     $in = array_unique($in);
     $in = implode(",", $in);
     $query = "SELECT `userid` AS admin_id, `username` AS admin_login, `full_name` AS admin_name FROM `" . NV_USERS_GLOBALTABLE . "` WHERE `userid` IN (" . $in . ")";
     $result = $db->sql_query($query);
     while (list($admin_id, $admin_login, $admin_name) = $db->sql_fetchrow($result)) {
Exemplo n.º 11
0
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;
}
Exemplo n.º 12
0
function nv_site_theme($contents)
{
    global $home, $array_mod_title, $lang_global, $language_array, $global_config, $site_mods, $module_name, $module_file, $module_data, $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('THEME_SITE_HREF', NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA);
    $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_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('THEME_SITE_NAME', sprintf($lang_global['copyright'], $global_config['site_name']));
    $xtpl->assign('THEME_CONTACT_EMAIL', $lang_global['email'] . ": " . nv_EncodeEmail($global_config['site_email']));
    $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);
            $xtpl->assign('SELECTED', NV_LANG_DATA == $lang_i ? ' selected' : '');
            $xtpl->parse('main.language.langitem');
        }
        $xtpl->parse('main.language');
    } else {
        $xtpl->parse('main.color_select');
    }
    $arr_home['index'] = array("custom_title" => $lang_global['Home'], "in_menu" => 1);
    $site_mods = array_merge($arr_home, $site_mods);
    $a = 0;
    foreach ($site_mods as $modname => $modvalues) {
        if (!empty($modvalues['in_menu'])) {
            if ($home == 1 && $a == 0) {
                $module_current = ' class="current"';
            } elseif ($modname == $module_name and $home != 1) {
                $module_current = ' class="current"';
            } else {
                $module_current = '';
            }
            if ($modname == "index") {
                $link = NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA;
            } else {
                $link = NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&amp;" . NV_NAME_VARIABLE . "=" . $modname;
            }
            $aryay_menu = array("title" => $modvalues['custom_title'], "class" => $modname, "current" => $module_current, "link" => $link);
            $xtpl->assign('TOP_MENU', $aryay_menu);
            $xtpl->parse('main.top_menu');
            if ($a <= 5) {
                if ($a < 5) {
                    $xtpl->parse('main.bottom_menu.spector');
                }
                $xtpl->parse('main.bottom_menu');
            }
        }
        ++$a;
    }
    //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');
    }
    // End process cat module
    $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><br />\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;
}