Beispiel #1
0
/**
 * sendcontact()
 *
 * @param mixed $url
 * @return
 */
function sendcontact($url)
{
    global $module_file, $module_info, $lang_module;
    $xtpl = new XTemplate('sendcontact.tpl', NV_ROOTDIR . '/themes/' . $module_info['template'] . '/modules/' . $module_file);
    $lang_module['urlrefresh'] = nv_url_rewrite($url, true);
    $xtpl->assign('LANG', $lang_module);
    $xtpl->parse('main');
    return $xtpl->text('main');
}
/**
 * nv_show_playlist_cat_list()
 *
 * @return
 */
function nv_show_playlist_cat_list()
{
    global $db, $lang_module, $lang_global, $module_name, $module_data, $op, $module_file, $module_config, $global_config, $module_info, $user_info;
    $sql = 'SELECT * FROM ' . NV_PREFIXLANG . '_' . $module_data . '_playlist_cat WHERE userid=' . $user_info['userid'] . ' ORDER BY weight ASC';
    $_array_block_cat = $db->query($sql)->fetchAll();
    $num = sizeof($_array_block_cat);
    if ($num > 0) {
        $array_status = array($lang_global['no'], $lang_global['yes']);
        $array_share_mode = array($lang_module['playlist_private_off'], $lang_module['playlist_private_on']);
        $xtpl = new XTemplate('playlist_cat.tpl', NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/modules/' . $module_file);
        $xtpl->assign('LANG', $lang_module);
        $xtpl->assign('GLANG', $lang_global);
        foreach ($_array_block_cat as $row) {
            $numnews = $db->query('SELECT COUNT(*) FROM ' . NV_PREFIXLANG . '_' . $module_data . '_playlist where playlist_id=' . $row['playlist_id'])->fetchColumn();
            $xtpl->assign('ROW', array('playlist_id' => $row['playlist_id'], 'title' => $row['title'], 'numnews' => $numnews, 'weight' => $row['weight'], 'link' => nv_url_rewrite(NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=' . $module_info['alias']['user-playlist'] . '/' . $row['alias'] . '-' . $row['playlist_id'], true), 'linksite' => nv_url_rewrite(NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=' . $module_info['alias']['playlists'] . '/' . $row['alias'], true), 'url_edit' => nv_url_rewrite(NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=' . $op . '&playlist_id=' . $row['playlist_id'] . '&mode=edit#edit', true), 'url_delete' => nv_url_rewrite(NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=' . $op . '&playlist_id=' . $row['playlist_id'] . '&mode=delete', true)));
            for ($i = 1; $i <= $num; ++$i) {
                $xtpl->assign('WEIGHT', array('key' => $i, 'title' => $i, 'selected' => $i == $row['weight'] ? ' selected="selected"' : ''));
                $xtpl->parse('playlistcat_lists.loop.weight');
            }
            foreach ($array_share_mode as $key => $val) {
                $xtpl->assign('PRIVATE_MODE', array('key' => $key, 'title' => $val, 'selected' => $key == $row['private_mode'] ? ' selected="selected"' : ''));
                $xtpl->parse('playlistcat_lists.loop.private_mode');
            }
            foreach ($array_status as $key => $val) {
                $xtpl->assign('STATUS', array('key' => $key, 'title' => $val, 'selected' => $key == $row['status'] ? ' selected="selected"' : ''));
                $xtpl->parse('playlistcat_lists.loop.status');
            }
            for ($i = 1; $i <= 30; ++$i) {
                $xtpl->assign('NUMBER', array('key' => $i, 'title' => $i, 'selected' => $i == $row['numbers'] ? ' selected="selected"' : ''));
                $xtpl->parse('playlistcat_lists.loop.number');
            }
            if ($row['status'] == 2) {
                $xtpl->parse('playlistcat_lists.loop.pl_moderate');
            } elseif ($row['status'] == 0) {
                $xtpl->parse('playlistcat_lists.loop.pl_disallow');
            }
            if ($module_config[$module_name]['playlist_allow_detele'] > 0) {
                $xtpl->parse('playlistcat_lists.loop.delete');
            }
            if ($module_config[$module_name]['allow_user_plist'] == 1) {
                $xtpl->parse('playlistcat_lists.loop.edit_link');
                $xtpl->parse('playlistcat_lists.loop.edit_btn');
            } else {
                $xtpl->parse('playlistcat_lists.loop.title_only');
            }
            $xtpl->parse('playlistcat_lists.loop');
        }
        $xtpl->parse('playlistcat_lists');
        $contents = $xtpl->text('playlistcat_lists');
    } else {
        $contents = '&nbsp;';
    }
    return $contents;
}
 function nv_comment_new($block_config)
 {
     global $db, $site_mods, $db_slave, $module_info, $global_config;
     $module = $block_config['module'];
     $mod_data = $site_mods[$module]['module_data'];
     $sql = "SELECT * FROM " . NV_PREFIXLANG . "_comment WHERE module = " . $db->quote($module) . " AND status=1 ORDER BY post_time DESC LIMIT " . $block_config['numrow'];
     $result = $db_slave->query($sql);
     $array_comment = array();
     $array_news_id = array();
     while ($comment = $result->fetch()) {
         $array_comment[] = $comment;
         $array_news_id[] = $comment['id'];
     }
     if (!empty($array_news_id)) {
         $result = $db_slave->query('SELECT t1.id, t1.alias AS alias_id, t2.alias AS alias_cat FROM ' . NV_PREFIXLANG . '_' . $mod_data . '_rows t1 INNER JOIN ' . NV_PREFIXLANG . '_' . $mod_data . '_cat t2 ON t1.catid = t2.catid WHERE t1.id IN (' . implode(',', array_unique($array_news_id)) . ') AND status = 1');
         $array_news_id = array();
         while ($row = $result->fetch()) {
             $array_news_id[$row['id']] = $row;
         }
         $mod_file = $site_mods[$module]['module_file'];
         if (file_exists(NV_ROOTDIR . '/themes/' . $module_info['template'] . '/modules/' . $mod_file . '/block_new_comment.tpl')) {
             $block_theme = $module_info['template'];
         } else {
             $block_theme = 'default';
         }
         $xtpl = new XTemplate('block_new_comment.tpl', NV_ROOTDIR . '/themes/' . $block_theme . '/modules/' . $mod_file);
         $xtpl->assign('NV_BASE_SITEURL', NV_BASE_SITEURL);
         $xtpl->assign('TEMPLATE', $block_theme);
         foreach ($array_comment as $comment) {
             if (isset($array_news_id[$comment['id']])) {
                 $comment['url_comment'] = nv_url_rewrite(NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module . '&' . NV_OP_VARIABLE . '=' . $array_news_id[$comment['id']]['alias_cat'] . '/' . $array_news_id[$comment['id']]['alias_id'] . '-' . $comment['id'] . $global_config['rewrite_exturl'], true);
                 $comment['content'] = nv_clean60($comment['content'], $block_config['titlelength']);
                 $comment['post_time'] = nv_date('d/m/Y H:i', $comment['post_time']);
                 $xtpl->assign('COMMENT', $comment);
                 $xtpl->parse('main.loop');
             }
         }
         $xtpl->parse('main');
         return $xtpl->text('main');
     }
 }
Beispiel #4
0
/**
 * openidLogin_Res1()
 * Function thuc hien khi OpenID duoc nhan dien
 *
 * @param mixed $attribs
 * @return
 */
function openidLogin_Res1($attribs)
{
    global $page_title, $key_words, $mod_title, $db, $crypt, $nv_Request, $lang_module, $lang_global, $module_name, $module_info, $global_config, $gfx_chk, $nv_redirect, $op, $db_config;
    $email = (isset($attribs['contact/email']) and nv_check_valid_email($attribs['contact/email']) == '') ? $attribs['contact/email'] : '';
    if (empty($email)) {
        $nv_Request->unset_request('openid_attribs', 'session');
        openidLogin_Res0($lang_module['logged_in_failed']);
        die;
    }
    $opid = $crypt->hash($attribs['id']);
    $current_mode = isset($attribs['current_mode']) ? $attribs['current_mode'] : 1;
    $stmt = $db->prepare('SELECT a.userid AS uid, a.email AS uemail, b.active AS uactive FROM ' . NV_USERS_GLOBALTABLE . '_openid a, ' . NV_USERS_GLOBALTABLE . ' b
		WHERE a.opid= :opid
		AND a.email= :email
		AND a.userid=b.userid');
    $stmt->bindParam(':opid', $opid, PDO::PARAM_STR);
    $stmt->bindParam(':email', $email, PDO::PARAM_STR);
    $stmt->execute();
    list($user_id, $op_email, $user_active) = $stmt->fetch(3);
    if ($user_id) {
        $nv_Request->unset_request('openid_attribs', 'session');
        if ($op_email != $email) {
            openidLogin_Res0($lang_module['not_logged_in']);
            die;
        }
        if (!$user_active) {
            openidLogin_Res0($lang_module['login_no_active']);
            die;
        }
        if (defined('NV_IS_USER_FORUM') and file_exists(NV_ROOTDIR . '/' . DIR_FORUM . '/nukeviet/set_user_login.php')) {
            require_once NV_ROOTDIR . '/' . DIR_FORUM . '/nukeviet/set_user_login.php';
            if (defined('NV_IS_USER_LOGIN_FORUM_OK')) {
                $nv_redirect = !empty($nv_redirect) ? nv_base64_decode($nv_redirect) : NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name;
            } else {
                $nv_redirect = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name;
            }
        } else {
            $query = 'SELECT * FROM ' . NV_USERS_GLOBALTABLE . ' WHERE userid=' . $user_id;
            $row = $db->query($query)->fetch();
            if (!empty($row)) {
                validUserLog($row, 1, $opid, $current_mode);
                $nv_redirect = !empty($nv_redirect) ? nv_base64_decode($nv_redirect) : NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name;
            } else {
                $nv_redirect = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name;
            }
        }
        Header('Location: ' . nv_url_rewrite($nv_redirect, true));
        die;
    }
    $stmt = $db->prepare('SELECT * FROM ' . NV_USERS_GLOBALTABLE . ' WHERE email= :email');
    $stmt->bindParam(':email', $email, PDO::PARAM_STR);
    $stmt->execute();
    $nv_row = $stmt->fetch();
    if (!empty($nv_row)) {
        $login_allowed = false;
        if (empty($nv_row['password'])) {
            $nv_Request->unset_request('openid_attribs', 'session');
            $login_allowed = true;
        }
        if ($nv_Request->isset_request('openid_account_confirm', 'post')) {
            $password = $nv_Request->get_string('password', 'post', '');
            $nv_seccode = $nv_Request->get_title('nv_seccode', 'post', '');
            $nv_seccode = !$gfx_chk ? 1 : (nv_capcha_txt($nv_seccode) ? 1 : 0);
            $nv_Request->unset_request('openid_attribs', 'session');
            if (defined('NV_IS_USER_FORUM') and file_exists(NV_ROOTDIR . '/' . DIR_FORUM . '/nukeviet/login.php')) {
                $nv_username = $nv_row['username'];
                $nv_password = $password;
                require_once NV_ROOTDIR . '/' . DIR_FORUM . '/nukeviet/login.php';
                if (empty($error)) {
                    $login_allowed = true;
                } else {
                    openidLogin_Res0($lang_module['openid_confirm_failed']);
                    die;
                }
            } else {
                if ($crypt->validate_password($password, $nv_row['password']) and $nv_seccode) {
                    $login_allowed = true;
                } else {
                    openidLogin_Res0($lang_module['openid_confirm_failed']);
                    die;
                }
            }
        }
        if ($login_allowed) {
            $stmt = $db->prepare('INSERT INTO ' . NV_USERS_GLOBALTABLE . '_openid VALUES (' . intval($nv_row['userid']) . ', :server, :opid, :email )');
            $stmt->bindParam(':server', $attribs['server'], PDO::PARAM_STR);
            $stmt->bindParam(':opid', $opid, PDO::PARAM_STR);
            $stmt->bindParam(':email', $email, PDO::PARAM_STR);
            $stmt->execute();
            if (intval($nv_row['active']) != 1) {
                openidLogin_Res0($lang_module['login_no_active']);
            } else {
                validUserLog($nv_row, 1, $opid, $current_mode);
                Header('Location: ' . nv_url_rewrite(NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name, true));
            }
            die;
        }
        $page_title = $lang_module['openid_login'];
        $key_words = $module_info['keywords'];
        $mod_title = $lang_module['openid_login'];
        $lang_module['login_info'] = sprintf($lang_module['openid_confirm_info'], $email);
        $contents = openid_account_confirm($gfx_chk, $attribs);
        include NV_ROOTDIR . '/includes/header.php';
        echo nv_site_theme($contents);
        include NV_ROOTDIR . '/includes/footer.php';
        exit;
    }
    if ($global_config['allowuserreg'] == 2 or $global_config['allowuserreg'] == 3) {
        $query = 'SELECT * FROM ' . NV_USERS_GLOBALTABLE . '_reg WHERE email= :email';
        if ($global_config['allowuserreg'] == 2) {
            $query .= ' AND regdate>' . (NV_CURRENTTIME - 86400);
        }
        $stmt = $db->prepare($query);
        $stmt->bindParam(':email', $email, PDO::PARAM_STR);
        $stmt->execute();
        $row = $stmt->fetch();
        if (!empty($row)) {
            if ($global_config['allowuserreg'] == 2) {
                if ($nv_Request->isset_request('openid_active_confirm', 'post')) {
                    $nv_Request->unset_request('openid_attribs', 'session');
                    $password = $nv_Request->get_string('password', 'post', '');
                    $nv_seccode = $nv_Request->get_title('nv_seccode', 'post', '');
                    $nv_seccode = !$gfx_chk ? 1 : (nv_capcha_txt($nv_seccode) ? 1 : 0);
                    if ($crypt->validate_password($password, $row['password']) and $nv_seccode) {
                        $reg_attribs = set_reg_attribs($attribs);
                        $sql = "INSERT INTO " . NV_USERS_GLOBALTABLE . " (\n\t\t\t\t\t\t\tusername, md5username, password, email, first_name, last_name, gender, photo, birthday, regdate,\n\t\t\t\t\t\t\tquestion, answer, passlostkey, view_mail, remember, in_groups,\n\t\t\t\t\t\t\tactive, checknum, last_login, last_ip, last_agent, last_openid, idsite) VALUES (\n\t\t\t\t\t\t\t:username,\n\t\t\t\t\t\t\t:md5username,\n\t\t\t\t\t\t\t:password,\n\t\t\t\t\t\t\t:email,\n\t\t\t\t\t\t\t:first_name,\n\t\t\t\t\t\t\t:last_name,\n\t\t\t\t\t\t\t:gender,\n\t\t\t\t\t\t\t'', 0,\n\t\t\t\t\t\t\t:regdate,\n\t\t\t\t\t\t\t:question,\n\t\t\t\t\t\t\t:answer,\n\t\t\t\t\t\t\t'', 1, 1, '', 1, '', 0, '', '', '', " . $global_config['idsite'] . ")";
                        $data_insert = array();
                        $data_insert['username'] = $row['username'];
                        $data_insert['md5username'] = nv_md5safe($row['username']);
                        $data_insert['password'] = $row['password'];
                        $data_insert['email'] = $row['email'];
                        $data_insert['first_name'] = $row['first_name'];
                        $data_insert['last_name'] = $row['last_name'];
                        $data_insert['gender'] = $reg_attribs['gender'];
                        $data_insert['regdate'] = $row['regdate'];
                        $data_insert['question'] = $row['question'];
                        $data_insert['answer'] = $row['answer'];
                        $userid = $db->insert_id($sql, 'userid', $data_insert);
                        if (!$userid) {
                            openidLogin_Res0($lang_module['account_active_error']);
                            die;
                        }
                        $db->query('UPDATE ' . NV_GROUPS_GLOBALTABLE . ' SET numbers = numbers+1 WHERE group_id=4');
                        $stmt = $db->prepare('DELETE FROM ' . NV_USERS_GLOBALTABLE . '_reg WHERE userid= :userid');
                        $stmt->bindParam(':userid', $row['userid'], PDO::PARAM_STR);
                        $stmt->execute();
                        $stmt = $db->prepare('INSERT INTO ' . NV_USERS_GLOBALTABLE . '_openid VALUES (' . $userid . ', :server, :opid, :email )');
                        $stmt->bindParam(':server', $attribs['server'], PDO::PARAM_STR);
                        $stmt->bindParam(':opid', $opid, PDO::PARAM_STR);
                        $stmt->bindParam(':email', $email, PDO::PARAM_STR);
                        $stmt->execute();
                        $query = 'SELECT * FROM ' . NV_USERS_GLOBALTABLE . ' WHERE userid=' . $userid;
                        $result = $db->query($query);
                        $row = $result->fetch();
                        validUserLog($row, 1, $opid, $current_mode);
                        $info = $lang_module['account_active_ok'] . "<br /><br />\n";
                        $info .= "<img border=\"0\" src=\"" . NV_BASE_SITEURL . "images/load_bar.gif\"><br /><br />\n";
                        $info .= '[<a href="' . NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '">' . $lang_module['redirect_to_home'] . '</a>]';
                        $contents = user_info_exit($info);
                        $contents .= '<meta http-equiv="refresh" content="2;url=' . nv_url_rewrite(NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name, true) . '" />';
                        include NV_ROOTDIR . '/includes/header.php';
                        echo nv_site_theme($contents);
                        include NV_ROOTDIR . '/includes/footer.php';
                        exit;
                    } else {
                        openidLogin_Res0($lang_module['openid_confirm_failed']);
                        die;
                    }
                }
                $page_title = $mod_title = $lang_module['openid_activate_account'];
                $key_words = $module_info['keywords'];
                $lang_module['login_info'] = sprintf($lang_module['openid_active_confirm_info'], $email);
                $contents = openid_active_confirm($gfx_chk, $attribs);
                include NV_ROOTDIR . '/includes/header.php';
                echo nv_site_theme($contents);
                include NV_ROOTDIR . '/includes/footer.php';
                exit;
            } else {
                $nv_Request->unset_request('openid_attribs', 'session');
                openidLogin_Res0($lang_module['account_register_to_admin']);
                die;
            }
        }
    }
    $option = $nv_Request->get_int('option', 'get', 0);
    if (!$global_config['allowuserreg']) {
        $option = 3;
    }
    $contents = '';
    $page_title = $lang_module['openid_login'];
    if ($option == 3) {
        $error = '';
        if ($nv_Request->isset_request('nv_login', 'post')) {
            $nv_username = $nv_Request->get_title('nv_login', 'post', '', 1);
            $nv_password = $nv_Request->get_title('nv_password', 'post', '');
            $nv_seccode = $nv_Request->get_title('nv_seccode', 'post', '');
            $check_seccode = !$gfx_chk ? true : (nv_capcha_txt($nv_seccode) ? true : false);
            if (!$check_seccode) {
                $error = $lang_global['securitycodeincorrect'];
            } elseif (empty($nv_username)) {
                $error = $lang_global['username_empty'];
            } elseif (empty($nv_password)) {
                $error = $lang_global['password_empty'];
            } else {
                if (defined('NV_IS_USER_FORUM')) {
                    require_once NV_ROOTDIR . '/' . DIR_FORUM . '/nukeviet/login.php';
                } else {
                    $error = $lang_global['loginincorrect'];
                    $sql = "SELECT * FROM " . NV_USERS_GLOBALTABLE . " WHERE md5username ='******'";
                    $row = $db->query($sql)->fetch();
                    if (!empty($row)) {
                        if ($row['username'] == $nv_username and $crypt->validate($nv_password, $row['password'])) {
                            if (!$row['active']) {
                                $error = $lang_module['login_no_active'];
                            } else {
                                $error = '';
                                $stmt = $db->prepare('INSERT INTO ' . NV_USERS_GLOBALTABLE . '_openid VALUES (' . intval($row['userid']) . ', :server, :opid, :email )');
                                $stmt->bindParam(':server', $attribs['server'], PDO::PARAM_STR);
                                $stmt->bindParam(':opid', $opid, PDO::PARAM_STR);
                                $stmt->bindParam(':email', $email, PDO::PARAM_STR);
                                $stmt->execute();
                                validUserLog($row, 1, $opid);
                            }
                        }
                    }
                }
            }
            if (empty($error)) {
                $nv_Request->unset_request('openid_attribs', 'session');
                $nv_redirect = !empty($nv_redirect) ? nv_base64_decode($nv_redirect) : NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name;
                $info = $lang_module['login_ok'] . "<br /><br />\n";
                $info .= "<img border=\"0\" src=\"" . NV_BASE_SITEURL . "images/load_bar.gif\"><br /><br />\n";
                $info .= '[<a href="' . $nv_redirect . '">' . $lang_module['redirect_to_back'] . '</a>]';
                $contents .= user_info_exit($info);
                $contents .= '<meta http-equiv="refresh" content="2;url=' . nv_url_rewrite($nv_redirect, true) . '" />';
                include NV_ROOTDIR . '/includes/header.php';
                echo nv_site_theme($contents);
                include NV_ROOTDIR . '/includes/footer.php';
                exit;
            }
            $array_login = array('nv_login' => $nv_username, 'nv_password' => $nv_password, 'nv_redirect' => $nv_redirect, 'login_info' => '<span style="color:#fb490b;">' . $error . '</span>');
        } else {
            $array_login = array('nv_login' => '', 'nv_password' => '', 'login_info' => $lang_module['openid_note1'], 'nv_redirect' => $nv_redirect);
        }
        $contents .= user_openid_login($gfx_chk, $array_login, $attribs);
        include NV_ROOTDIR . '/includes/header.php';
        echo nv_site_theme($contents);
        include NV_ROOTDIR . '/includes/footer.php';
        exit;
    } elseif ($option == 1 or $option == 2) {
        $nv_Request->unset_request('openid_attribs', 'session');
        $reg_attribs = set_reg_attribs($attribs);
        if (empty($reg_attribs['username'])) {
            openidLogin_Res0($lang_module['logged_in_failed']);
            die;
        }
        if ($option == 2) {
            // Dang nhap bang mot tai khoan do he thong tao tu dong
            $sql = "INSERT INTO " . NV_USERS_GLOBALTABLE . "\n\t\t\t\t(username, md5username, password, email, first_name, last_name, gender, photo, birthday,  regdate,\n\t\t\t\tquestion, answer, passlostkey, view_mail, remember, in_groups,\n\t\t\t\tactive, checknum, last_login, last_ip, last_agent, last_openid, idsite)  VALUES (\n\t\t\t\t:username,\n\t\t\t\t:md5username,\n\t\t\t\t'',\n\t\t\t\t:email,\n\t\t\t\t:first_name,\n\t\t\t\t:last_name,\n\t\t\t\t:gender,\n\t\t\t\t'', 0,\n\t\t\t\t" . NV_CURRENTTIME . ",\n\t\t\t\t'', '', '', 0, 0, '', 1, '', 0, '', '', '', " . intval($global_config['idsite']) . "\n\t\t\t)";
            $data_insert = array();
            $data_insert['username'] = $reg_attribs['username'];
            $data_insert['md5username'] = nv_md5safe($reg_attribs['username']);
            $data_insert['email'] = $reg_attribs['email'];
            $data_insert['first_name'] = $reg_attribs['first_name'];
            $data_insert['last_name'] = $reg_attribs['last_name'];
            $data_insert['gender'] = ucfirst($reg_attribs['gender'] ? $reg_attribs['gender'][0] : 'N');
            $userid = $db->insert_id($sql, 'userid', $data_insert);
            if (!$userid) {
                openidLogin_Res0($lang_module['err_no_save_account']);
                die;
            }
            // Cap nhat so thanh vien
            $db->query('UPDATE ' . NV_GROUPS_GLOBALTABLE . ' SET numbers = numbers+1 WHERE group_id=4');
            $query = 'SELECT * FROM ' . NV_USERS_GLOBALTABLE . ' WHERE userid=' . $userid . ' AND active=1';
            $result = $db->query($query);
            $row = $result->fetch();
            $result->closeCursor();
            // Luu vao bang thong tin tuy chinh
            $query_field = array();
            $query_field['userid'] = $userid;
            $result_field = $db->query('SELECT * FROM ' . NV_USERS_GLOBALTABLE . '_field ORDER BY fid ASC');
            while ($row_f = $result_field->fetch()) {
                $query_field[$row_f['field']] = $db->quote($row_f['default_value']);
            }
            $db->query('INSERT INTO ' . NV_USERS_GLOBALTABLE . '_info (' . implode(', ', array_keys($query_field)) . ') VALUES (' . implode(', ', array_values($query_field)) . ')');
            // Luu vao bang OpenID
            $stmt = $db->prepare('INSERT INTO ' . NV_USERS_GLOBALTABLE . '_openid VALUES (' . intval($row['userid']) . ', :server, :opid , :email)');
            $stmt->bindParam(':server', $reg_attribs['server'], PDO::PARAM_STR);
            $stmt->bindParam(':opid', $reg_attribs['opid'], PDO::PARAM_STR);
            $stmt->bindParam(':email', $reg_attribs['email'], PDO::PARAM_STR);
            $stmt->execute();
            validUserLog($row, 1, $reg_attribs['opid'], $current_mode);
            $nv_redirect = !empty($nv_redirect) ? nv_base64_decode($nv_redirect) : NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name;
            Header('Location: ' . nv_url_rewrite($nv_redirect, true));
            exit;
        } else {
            $reg_attribs = serialize($reg_attribs);
            $nv_Request->set_Session('reg_attribs', $reg_attribs);
            Header('Location: ' . nv_url_rewrite(NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=register&openid=1&nv_redirect=' . $nv_redirect, true));
            exit;
        }
    }
    $array_user_login = array();
    if (!defined('NV_IS_USER_FORUM')) {
        $array_user_login[] = array('title' => $lang_module['openid_note3'], 'link' => NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name . '&amp;' . NV_OP_VARIABLE . '=login&amp;server=' . $attribs['server'] . '&amp;result=1&amp;option=1&amp;nv_redirect=' . $nv_redirect);
        $array_user_login[] = array('title' => $lang_module['openid_note4'], 'link' => NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name . '&amp;' . NV_OP_VARIABLE . '=login&amp;server=' . $attribs['server'] . '&amp;result=1&amp;option=2&amp;nv_redirect=' . $nv_redirect);
    } else {
        $array_user_login[] = array('title' => $lang_module['openid_note6'], 'link' => NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name . '&amp;' . NV_OP_VARIABLE . '=register&amp;nv_redirect=' . $nv_redirect);
    }
    $array_user_login[] = array('title' => $lang_module['openid_note5'], 'link' => NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name . '&amp;' . NV_OP_VARIABLE . '=login&amp;server=' . $attribs['server'] . '&amp;result=1&amp;option=3&amp;nv_redirect=' . $nv_redirect);
    $page_title = $lang_module['openid_login'];
    $key_words = $module_info['keywords'];
    $mod_title = $lang_module['openid_login'];
    $contents .= user_openid_login2($attribs, $array_user_login);
    include NV_ROOTDIR . '/includes/header.php';
    echo nv_site_theme($contents);
    include NV_ROOTDIR . '/includes/footer.php';
    exit;
}
Beispiel #5
0
 * @Createdate 17/6/2010, 11:25
 */
if (!defined('NV_IS_MOD_STATISTICS')) {
    die('Stop!!!');
}
$host = $nv_Request->get_string('host', 'get', '');
if (!isset($host) or !preg_match('/^[0-9a-z]([-.]?[0-9a-z])*.[a-z]{2,4}$/', $host)) {
    Header('Location: ' . nv_url_rewrite(NV_BASE_MOD_URL, true));
    die;
}
$sth = $db->prepare('SELECT * FROM ' . NV_REFSTAT_TABLE . ' WHERE host= :host');
$sth->bindParam(':host', $host, PDO::PARAM_STR);
$sth->execute();
$row = $sth->fetch();
if (empty($row)) {
    Header('Location: ' . nv_url_rewrite(NV_BASE_MOD_URL, true));
    die;
}
$contents = '';
$mod_title = $page_title = sprintf($lang_module['refererbysite'], $host);
$key_words = $module_info['keywords'];
$cts = array();
$cts['caption'] = $page_title;
$cts['rows'] = array();
$cts['rows']['Jan'] = array('fullname' => $lang_global['january'], 'count' => $row['month01']);
$cts['rows']['Feb'] = array('fullname' => $lang_global['february'], 'count' => $row['month02']);
$cts['rows']['Mar'] = array('fullname' => $lang_global['march'], 'count' => $row['month03']);
$cts['rows']['Apr'] = array('fullname' => $lang_global['april'], 'count' => $row['month04']);
$cts['rows']['May'] = array('fullname' => $lang_global['may'], 'count' => $row['month05']);
$cts['rows']['Jun'] = array('fullname' => $lang_global['june'], 'count' => $row['month06']);
$cts['rows']['Jul'] = array('fullname' => $lang_global['july'], 'count' => $row['month07']);
Beispiel #6
0
            $end_publtime = $item['publtime'];
            $item['link'] = $global_array_cat[$item['catid']]['link'] . '/' . $item['alias'] . '-' . $item['id'] . $global_config['rewrite_exturl'];
            $item_array[] = $item;
        }
        $result->closeCursor();
        unset($query, $row);
        $item_array_other = array();
        if ($st_links > 0) {
            $db->sqlreset()->select('id, catid, addtime, edittime, publtime, title, alias, hitstotal')->from(NV_PREFIXLANG . '_' . $module_data . '_rows')->where('status=1 AND id IN (SELECT id FROM ' . NV_PREFIXLANG . '_' . $module_data . '_tags_id WHERE tid=' . $tid . ') and publtime < ' . $end_publtime)->order('publtime DESC')->limit($st_links);
            $result = $db->query($db->sql());
            while ($item = $result->fetch()) {
                $item['link'] = $global_array_cat[$item['catid']]['link'] . '/' . $item['alias'] . '-' . $item['id'] . $global_config['rewrite_exturl'];
                $item_array_other[] = $item;
            }
            unset($query, $row);
        }
        $generate_page = nv_alias_page($page_title, $base_url, $num_items, $per_page, $page);
        if (!empty($image_tag)) {
            $image_tag = NV_BASE_SITEURL . NV_FILES_DIR . '/' . $module_upload . '/' . $image_tag;
        }
        $contents = topic_theme($item_array, $item_array_other, $generate_page, $page_title, $description, $image_tag);
        if ($page > 1) {
            $page_title .= ' ' . NV_TITLEBAR_DEFIS . ' ' . $lang_global['page'] . ' ' . $page;
        }
        include NV_ROOTDIR . '/includes/header.php';
        echo nv_site_theme($contents);
        include NV_ROOTDIR . '/includes/footer.php';
    }
}
$redirect = '<meta http-equiv="Refresh" content="3;URL=' . nv_url_rewrite(NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name, true) . '" />';
nv_info_die($lang_global['error_404_title'], $lang_global['error_404_title'], $lang_global['error_404_content'] . $redirect);
Beispiel #7
0
 }
 $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);
     $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 . '=' . $global_array_cat[$catid]['alias'] . '/' . $content['alias'] . '-' . $id . $global_config['rewrite_exturl'], true);
     $canonicalUrl = NV_MAIN_DOMAIN . $base_url_rewrite;
     $meta_tags = nv_html_meta_tags();
     $result = array('url' => $global_config['site_url'], 'meta_tags' => $meta_tags, 'sitename' => $global_config['site_name'], 'title' => $content['title'], 'alias' => $content['alias'], 'image' => '', 'position' => $content['imgposition'], 'time' => nv_date('l - d/m/Y H:i', $content['publtime']), 'status' => $content['status'], 'hometext' => $content['hometext'], 'bodytext' => $content['bodytext'], 'copyright' => $content['copyright'], 'copyvalue' => $module_config[$module_name]['copyright'], 'link' => "<a href=\"" . NV_MY_DOMAIN . $base_url_rewrite . "\" title=\"" . $content['title'] . "\">" . NV_MY_DOMAIN . $base_url_rewrite . "</a>\n", 'contact' => $global_config['site_email'], 'author' => $content['author'], 'source' => $sourcetext);
     if (!empty($content['homeimgfile']) and $content['imgposition'] > 0) {
         $src = $alt = $note = '';
         $width = $height = 0;
         if ($content['homeimgthumb'] == 1 and $content['imgposition'] == 1) {
             $src = NV_BASE_SITEURL . NV_FILES_DIR . '/' . $module_upload . '/' . $content['homeimgfile'];
             $width = $module_config[$module_name]['homewidth'];
         } elseif ($content['homeimgthumb'] == 3) {
             $src = $content['homeimgfile'];
             $width = $content['imgposition'] == 1 ? $module_config[$module_name]['homewidth'] : $module_config[$module_name]['imagefull'];
         } elseif (file_exists(NV_UPLOADS_REAL_DIR . '/' . $module_upload . '/' . $content['homeimgfile'])) {
             $src = NV_BASE_SITEURL . NV_UPLOADS_DIR . '/' . $module_upload . '/' . $content['homeimgfile'];
             $width = $content['imgposition'] == 1 ? $module_config[$module_name]['homewidth'] : $module_config[$module_name]['imagefull'];
Beispiel #8
0
<?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']);
/**
 * nv_rss_generate()
 * 
 * @param mixed $channel
 * @param mixed $imamge
 * @param mixed $items
 * @return void
 */
function nv_rss_generate($channel, $items)
{
    global $db, $global_config;
    if (file_exists(NV_ROOTDIR . "/themes/" . $global_config['site_theme'] . "/layout/rss.tpl")) {
        $path = NV_ROOTDIR . "/themes/" . $global_config['site_theme'] . "/layout/";
    } else {
        $path = NV_ROOTDIR . "/themes/default/layout/";
    }
    $xtpl = new XTemplate("rss.tpl", $path);
    $channel['title'] = nv_unhtmlspecialchars($channel['title']);
    $channel['description'] = nv_unhtmlspecialchars($channel['description']);
    $channel['lang'] = $global_config['site_lang'];
    $channel['copyright'] = htmlspecialchars($global_config['site_name']);
    $channel['docs'] = NV_MY_DOMAIN . NV_BASE_SITEURL . '?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=rss';
    $channel['generator'] = htmlspecialchars('Nukeviet Version ' . $global_config['version']);
    $xtpl->assign('CHANNEL', $channel);
    if (file_exists(NV_ROOTDIR . '/images/' . $global_config['site_logo'])) {
        $image = NV_ROOTDIR . '/images/' . $global_config['site_logo'];
        $image = nv_ImageInfo($image, 144, true, NV_UPLOADS_REAL_DIR);
        if (!empty($image)) {
            $image['title'] = $channel['title'];
            $image['link'] = $channel['link'];
            $image['src'] = NV_MY_DOMAIN . $image['src'];
            $xtpl->assign('IMAGE', $image);
            $xtpl->parse('main.image');
        }
    }
    if (!empty($items)) {
        foreach ($items as $item) {
            if (!empty($item['title'])) {
                $item['title'] = nv_unhtmlspecialchars($item['title']);
            }
            if (!empty($item['description'])) {
                $item['description'] = htmlspecialchars($item['description'], ENT_QUOTES);
            }
            $item['pubdate'] = gmdate("D, j M Y H:m:s", $item['pubdate']) . ' GMT';
            $xtpl->assign('ITEM', $item);
            $xtpl->parse('main.item');
        }
    }
    $xtpl->parse('main');
    $content = $xtpl->text('main');
    $content = $db->unfixdb($content);
    $content = nv_url_rewrite($content);
    header("Content-Type: text/xml");
    header("Content-Type: application/rss+xml");
    header("Content-Encoding: none");
    echo $content;
    die;
}
Beispiel #10
0
            $message = sprintf($lang_module['safe_send_content'], $name, $sitename, $row['safekey']);
            @nv_sendmail($global_config['site_email'], $row['email'], $lang_module['safe_send_subject'], $message);
            $ss_safesend = NV_CURRENTTIME + 600;
            $nv_Request->set_Session('safesend', $ss_safesend);
        }
        $ss_safesend = ceil(($ss_safesend - NV_CURRENTTIME) / 60);
        die(json_encode(array('status' => 'ok', 'input' => '', 'mess' => sprintf($lang_module['safe_send_ok'], $ss_safesend))));
    }
    $safe_key = nv_substr($nv_Request->get_title('safe_key', 'post', '', 1), 0, 32);
    if (empty($row['safekey']) or $safe_key != $row['safekey']) {
        die(json_encode(array('status' => 'error', 'input' => 'safe_key', 'mess' => $lang_module['verifykey_error'])));
    }
    $stmt = $db->prepare('UPDATE ' . NV_USERS_GLOBALTABLE . ' SET safemode=1, safekey= :safekey WHERE userid=' . $user_info['userid']);
    $stmt->bindParam(':safekey', $row['safekey'], PDO::PARAM_STR);
    $stmt->execute();
    die(json_encode(array('status' => 'ok', 'input' => nv_url_rewrite(NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name . '&amp;' . NV_OP_VARIABLE . '=editinfo', true), 'mess' => $lang_module['safe_activate_ok'])));
}
$page_title = $mod_title = $lang_module['editinfo_pagetitle'];
$key_words = $module_info['keywords'];
if (!defined('NV_EDITOR')) {
    define('NV_EDITOR', 'ckeditor');
}
require_once NV_ROOTDIR . '/' . NV_EDITORSDIR . '/' . NV_EDITOR . '/nv.php';
$sql = 'SELECT * FROM ' . NV_USERS_GLOBALTABLE . '_info WHERE userid=' . $user_info['userid'];
$result = $db->query($sql);
$custom_fields = $result->fetch();
$array_data['username'] = $row['username'];
$array_data['email'] = $row['email'];
$array_data['first_name'] = $row['first_name'];
$array_data['last_name'] = $row['last_name'];
$array_data['gender'] = $row['gender'];
Beispiel #11
0
                    $query = "SELECT COUNT(*) AS `count` FROM `" . NV_USERS_GLOBALTABLE . "_reg` WHERE `email`=" . $db->dbescape($email);
                    if ($global_config['allowuserreg'] == 2) {
                        $query .= " AND `regdate`>" . (NV_CURRENTTIME - 86400);
                    }
                    $result = $db->sql_query($query);
                    list($count) = $db->sql_fetchrow($result);
                    if ($count) {
                        $nv_Request->set_Session('openid_error', 6);
                        header("Location: " . nv_url_rewrite(NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&" . NV_NAME_VARIABLE . "=" . $module_name . "&" . NV_OP_VARIABLE . "=openid", true));
                        die;
                    }
                }
                $sql = "INSERT INTO `" . NV_USERS_GLOBALTABLE . "_openid` VALUES (" . $user_info['userid'] . ", " . $db->dbescape($openid) . ", " . $db->dbescape($opid) . ", " . $db->dbescape($email) . ")";
                $db->sql_query($sql);
                nv_insert_logs(NV_LANG_DATA, $module_name, $lang_module['openid_add'], $user_info['username'] . " | " . $client_info['ip'] . " | " . $opid, 0);
                header("Location: " . nv_url_rewrite(NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&" . NV_NAME_VARIABLE . "=" . $module_name . "&" . NV_OP_VARIABLE . "=openid", true));
                die;
            }
        } else {
            $openid_class->identity = $openid_servers[$server]['identity'];
            $openid_class->required = array_values($openid_servers[$server]['required']);
            header('Location: ' . $openid_class->authUrl());
            die;
        }
    }
}
$data = array();
$data['openid_list'] = array();
$sql = "SELECT * FROM `" . NV_USERS_GLOBALTABLE . "_openid` WHERE `userid`=" . $user_info['userid'];
$query = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($query)) {
 * @author VINADES.,JSC (contact@vinades.vn)
 * @Copyright (C) 2012 VINADES.,JSC. all rights reserved
 * @createdate 3-6-2010 0:14
 */
if (!defined('NV_IS_MOD_WEBLINKS')) {
    die('Stop!!!');
}
$submit = $nv_Request->get_string('submit', 'post');
$report_id = $nv_Request->get_int('report_id', 'post');
$id = $id == 0 ? $report_id : $id;
$sql = "SELECT `title`, `alias` FROM `" . NV_PREFIXLANG . "_" . $module_data . "_rows` WHERE `id`='" . $id . "'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
unset($sql, $result);
$row['error'] = "";
$row['action'] = nv_url_rewrite(NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&amp;" . NV_NAME_VARIABLE . "=" . $module_name . "&amp;" . NV_OP_VARIABLE . "=reportlink-" . $row['alias'] . "-" . $id, true);
$row['id'] = $id;
if ($id) {
    $check = false;
    if ($submit and $report_id) {
        $sql = "SELECT `type` FROM `" . NV_PREFIXLANG . "_" . $module_data . "_report` WHERE `id`='" . $report_id . "'";
        $result = $db->sql_query($sql);
        $rows = $db->sql_fetchrow($result);
        $report = $nv_Request->get_int('report', 'post');
        $report_note = filter_text_input('report_note', 'post', '', 1, 255);
        $row['report_note'] = $report_note;
        if ($report == 0 and empty($report_note)) {
            $row['error'] = $lang_module['error'];
        } elseif (!empty($report_note) and !isset($report_note[9])) {
            $row['error'] = $lang_module['error_word_min'];
        } elseif ($rows['type'] == $report) {
Beispiel #13
0
            if (!empty($array_link_content)) {
                $xtpl->assign('ADMINLINK', implode('&nbsp;-&nbsp;', $array_link_content));
                $xtpl->parse('main.viewcatloop.news.adminlink');
            }
            if ($array_row_i['imghome'] != '') {
                $xtpl->assign('HOMEIMG1', $array_row_i['imghome']);
                $xtpl->assign('HOMEIMGALT1', !empty($array_row_i['homeimgalt']) ? $array_row_i['homeimgalt'] : $array_row_i['title']);
                $xtpl->parse('main.viewcatloop.news.image');
            }
            $xtpl->parse('main.viewcatloop.news');
            ++$a;
        }
        $xtpl->parse('main.viewcatloop');
        $generate_page = nv_alias_page($page_title, $base_url, $num_items, $per_page, $page);
        if (!empty($generate_page)) {
            $xtpl->assign('GENERATE_PAGE', $generate_page);
            $xtpl->parse('main.generate_page');
        }
        $xtpl->parse('main');
        $contents .= $xtpl->text('main');
        if ($page > 1) {
            $page_title .= ' ' . NV_TITLEBAR_DEFIS . ' ' . $lang_global['page'] . ' ' . $page;
        }
    }
} elseif ($array_post_user['addcontent']) {
    Header('Location: ' . nv_url_rewrite(NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=' . $op . '&contentid=0&checkss=' . md5('0' . $client_info['session_id'] . $global_config['sitekey']), true));
    die;
}
include NV_ROOTDIR . '/includes/header.php';
echo nv_site_theme($contents);
include NV_ROOTDIR . '/includes/footer.php';
Beispiel #14
0
            if ($db->exec('INSERT INTO ' . NV_USERS_GLOBALTABLE . '_info (' . implode(', ', array_keys($query_field)) . ') VALUES (' . implode(', ', array_values($query_field)) . ')')) {
                $db->query('UPDATE ' . NV_GROUPS_GLOBALTABLE . ' SET numbers = numbers+1 WHERE group_id=4');
                $db->query('DELETE FROM ' . NV_USERS_GLOBALTABLE . '_reg WHERE userid=' . $row['userid']);
                $check_update_user = true;
                nv_insert_logs(NV_LANG_DATA, $module_name, $lang_module['account_active_log'], $row['username'] . ' | ' . $client_info['ip'], 0);
            } else {
                $db->query('DELETE FROM ' . NV_USERS_GLOBALTABLE . ' WHERE userid=' . $row['userid']);
            }
        }
    }
}
if ($check_update_user) {
    if ($is_change_email) {
        $info = $lang_module['account_change_mail_ok'] . "<br /><br />\n";
    } else {
        $info = $lang_module['account_active_ok'] . "<br /><br />\n";
    }
} else {
    if ($is_change_email) {
        $info = $lang_module['account_active_error'] . "<br /><br />\n";
    } else {
        $info = $lang_module['account_change_mail_error'] . "<br /><br />\n";
    }
}
$info .= "<img border=\"0\" src=\"" . NV_BASE_SITEURL . "images/load_bar.gif\"><br /><br />\n";
$info .= "[<a href=\"" . NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&amp;" . NV_NAME_VARIABLE . "=" . $module_name . "\">" . $lang_module['redirect_to_login'] . "</a>]";
$contents = user_info_exit($info);
$contents .= "<meta http-equiv=\"refresh\" content=\"5;url=" . nv_url_rewrite(NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name, true) . "\" />";
include NV_ROOTDIR . '/includes/header.php';
echo nv_site_theme($contents);
include NV_ROOTDIR . '/includes/footer.php';
Beispiel #15
0
        if ($st_links > 0) {
            $db_slave->sqlreset()->select('id, catid, addtime, edittime, publtime, title, alias, hitstotal')->from(NV_PREFIXLANG . '_' . $module_data . '_rows')->where('status=1 AND topicid = ' . $topicid . ' AND publtime < ' . $end_publtime)->order('publtime DESC')->limit($st_links);
            $result = $db_slave->query($db_slave->sql());
            while ($item = $result->fetch()) {
                $item['link'] = $global_array_cat[$item['catid']]['link'] . '/' . $item['alias'] . '-' . $item['id'] . $global_config['rewrite_exturl'];
                $topic_other_array[] = $item;
            }
            unset($result, $row);
        }
        $generate_page = nv_alias_page($page_title, $base_url, $num_items, $per_page, $page);
        if (!empty($topic_image)) {
            $topic_image = NV_BASE_SITEURL . NV_FILES_DIR . '/' . $module_upload . '/topics/' . $topic_image;
        }
        $contents = topic_theme($topic_array, $topic_other_array, $generate_page, $page_title, $description, $topic_image);
    } else {
        Header('Location: ' . nv_url_rewrite(NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&amp;' . NV_OP_VARIABLE . '=' . $module_info['alias']['topic'], true));
        exit;
    }
} else {
    $page_title = $module_info['custom_title'];
    $key_words = $module_info['keywords'];
    $result = $db_slave->query('SELECT topicid as id, title, alias, image, description as hometext, keywords, add_time as publtime FROM ' . NV_PREFIXLANG . '_' . $module_data . '_topics ORDER BY weight ASC');
    while ($item = $result->fetch()) {
        if (!empty($item['image']) and file_exists(NV_ROOTDIR . '/' . NV_FILES_DIR . '/' . $module_upload . '/topics/' . $item['image'])) {
            //image thumb
            $item['src'] = NV_BASE_SITEURL . NV_FILES_DIR . '/' . $module_upload . '/topics/' . $item['image'];
        } elseif (!empty($item['image'])) {
            //image file
            $item['src'] = NV_BASE_SITEURL . NV_UPLOADS_DIR . '/' . $module_upload . '/topics/' . $item['image'];
        } elseif (!empty($show_no_image)) {
            //no image
Beispiel #16
0
if (!defined('NV_IS_MOD_EVENT')) {
    die('Stop!!!');
}
$key_words = $module_info['keywords'];
$array_data = array();
$_sql = 'SELECT * FROM ' . NV_PREFIXLANG . '_' . $module_data . ' WHERE status=1 AND alias=' . $db->quote($alias_url);
$array_data = $db->query($_sql)->fetch();
if (empty($array_data)) {
    Header('Location: ' . nv_url_rewrite(NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name, true));
    die;
}
if (nv_user_in_groups($global_array_event_cat[$catid]['groups_view']) and nv_user_in_groups($array_data['groups_view'])) {
    if (!empty($array_data['homeimgfile']) and file_exists(NV_UPLOADS_REAL_DIR . '/' . $module_upload . '/' . $array_data['homeimgfile'])) {
        $array_data['homeimgfile'] = NV_BASE_SITEURL . NV_UPLOADS_DIR . '/' . $module_upload . '/' . $array_data['homeimgfile'];
    } else {
        $array_data['homeimgfile'] = NV_BASE_SITEURL . 'themes/' . $global_config['site_theme'] . '/images/no_image.gif';
    }
    //metatag image facebook
    $meta_property['og:image'] = NV_MY_DOMAIN . $array_data['homeimgfile'];
    $contents = nv_theme_event_detail($array_data);
    $page_title = $array_data['title'];
    if (!empty($array_data['keywords'])) {
        $key_words = $array_data['keywords'];
    }
} else {
    $nv_redirect = nv_url_rewrite(NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name, true);
    redict_link($lang_module['detail_no_permission'], $lang_module['redirect_to_back'], $nv_redirect);
}
include NV_ROOTDIR . '/includes/header.php';
echo nv_site_theme($contents);
include NV_ROOTDIR . '/includes/footer.php';
Beispiel #17
0
            $stmt->execute();
        }
        $db->query('UPDATE ' . NV_GROUPS_GLOBALTABLE . ' SET numbers = numbers+1 WHERE group_id=4');
        $users_info = unserialize(nv_base64_decode($row['users_info']));
        $query_field = array();
        $query_field['userid'] = $userid;
        $result_field = $db->query('SELECT * FROM ' . NV_USERS_GLOBALTABLE . '_field ORDER BY fid ASC');
        while ($row_f = $result_field->fetch()) {
            $query_field[$row_f['field']] = isset($users_info[$row_f['field']]) ? $users_info[$row_f['field']] : $db->quote($row_f['default_value']);
        }
        if ($db->exec('INSERT INTO ' . NV_USERS_GLOBALTABLE . '_info (' . implode(', ', array_keys($query_field)) . ') VALUES (' . implode(', ', array_values($query_field)) . ')')) {
            $db->query('DELETE FROM ' . NV_USERS_GLOBALTABLE . '_reg WHERE userid=' . $row['userid']);
            nv_insert_logs(NV_LANG_DATA, $module_name, $lang_module['active_users'], 'userid: ' . $userid . ' - username: '******'username'], $admin_info['userid']);
            $first_name = !empty($row['first_name']) ? $row['first_name'] : $row['username'];
            $subject = $lang_module['adduser_register'];
            $message = sprintf($lang_module['adduser_register_info'], $first_name, $global_config['site_name'], NV_MY_DOMAIN . nv_url_rewrite(NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name, true), $row['username']);
            @nv_sendmail($global_config['site_email'], $row['email'], $subject, $message);
        } else {
            $db->query('DELETE FROM ' . NV_USERS_GLOBALTABLE . ' WHERE userid=' . $row['userid']);
        }
    }
    Header('Location: ' . NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=user_waiting');
    die;
}
$page_title = $table_caption = $lang_module['member_wating'];
$base_url = NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name . '&amp;' . NV_OP_VARIABLE . '=user_waiting';
$methods = array('userid' => array('key' => 'userid', 'sql' => 'userid', 'value' => $lang_module['search_id'], 'selected' => ''), 'username' => array('key' => 'username', 'sql' => 'username', 'value' => $lang_module['search_account'], 'selected' => ''), 'fullname' => array('key' => 'fullname', 'sql' => $global_config['name_show'] == 0 ? "concat(last_name,' ',first_name)" : "concat(first_name,' ',last_name)", 'value' => $lang_module['search_name'], 'selected' => ''), 'email' => array('key' => 'email', 'sql' => 'email', 'value' => $lang_module['search_mail'], 'selected' => ''));
$method = $nv_Request->isset_request('method', 'post') ? $nv_Request->get_string('method', 'post', '') : ($nv_Request->isset_request('method', 'get') ? urldecode($nv_Request->get_string('method', 'get', '')) : '');
$methodvalue = $nv_Request->isset_request('value', 'post') ? $nv_Request->get_string('value', 'post') : ($nv_Request->isset_request('value', 'get') ? urldecode($nv_Request->get_string('value', 'get', '')) : '');
$orders = array('userid', 'username', 'first_name', 'email', 'regdate');
$orderby = $nv_Request->get_string('sortby', 'get', '');
/**
 * nv_del_content_module()
 *
 * @param mixed $id
 * @return
 */
function nv_del_content_module($id)
{
    global $db, $module_name, $module_data, $title, $lang_module;
    $content_del = 'NO_' . $id;
    $title = '';
    list($id, $listcatid, $title, $homeimgfile) = $db->query('SELECT id, listcatid, title, homeimgfile FROM ' . NV_PREFIXLANG . '_' . $module_data . '_rows WHERE id=' . intval($id))->fetch(3);
    if ($id > 0) {
        $number_no_del = 0;
        $array_catid = explode(',', $listcatid);
        foreach ($array_catid as $catid_i) {
            $catid_i = intval($catid_i);
            if ($catid_i > 0) {
                $_sql = 'DELETE FROM ' . NV_PREFIXLANG . '_' . $module_data . '_' . $catid_i . ' WHERE id=' . $id;
                if (!$db->exec($_sql)) {
                    ++$number_no_del;
                }
            }
        }
        $_sql = 'DELETE FROM ' . NV_PREFIXLANG . '_' . $module_data . '_rows WHERE id=' . $id;
        if (!$db->exec($_sql)) {
            ++$number_no_del;
        }
        $_sql = 'DELETE FROM ' . NV_PREFIXLANG . '_' . $module_data . '_bodyhtml_' . ceil($id / 2000) . ' WHERE id = ' . $id;
        if (!$db->exec($_sql)) {
            ++$number_no_del;
        }
        $_sql = 'DELETE FROM ' . NV_PREFIXLANG . '_' . $module_data . '_bodytext WHERE id = ' . $id;
        if (!$db->exec($_sql)) {
            ++$number_no_del;
        }
        $db->query('DELETE FROM ' . NV_PREFIXLANG . '_comment WHERE module=' . $db->quote($module_name) . ' AND id = ' . $id);
        $db->query('DELETE FROM ' . NV_PREFIXLANG . '_' . $module_data . '_block WHERE id = ' . $id);
        $db->query('UPDATE ' . NV_PREFIXLANG . '_' . $module_data . '_tags SET numnews = numnews-1 WHERE tid IN (SELECT tid FROM ' . NV_PREFIXLANG . '_' . $module_data . '_tags_id WHERE id=' . $id . ')');
        $db->query('DELETE FROM ' . NV_PREFIXLANG . '_' . $module_data . '_tags_id WHERE id = ' . $id);
        if ($number_no_del == 0) {
            $content_del = 'OK_' . $id . '_' . nv_url_rewrite(NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name, true);
        } else {
            $content_del = 'ERR_' . $lang_module['error_del_content'];
        }
    }
    return $content_del;
}
Beispiel #19
0
        } else {
            include_once NV_ROOTDIR . '/includes/class/openid.class.php';
            $openid = new LightOpenID();
            if ($nv_Request->isset_request('openid_mode', 'get')) {
                $openid_mode = $nv_Request->get_string('openid_mode', 'get', '');
                if ($openid_mode == 'cancel') {
                    $attribs = array('result' => 'cancel');
                } elseif (!$openid->validate()) {
                    $attribs = array('result' => 'notlogin');
                } else {
                    $attribs = array('result' => 'is_res', 'id' => $openid->identity, 'server' => $server) + $openid->getAttributes();
                }
                $attribs = serialize($attribs);
                $nv_Request->set_Session('openid_attribs', $attribs);
                $op_redirect = defined('NV_IS_USER') ? 'openid' : 'login';
                Header('Location: ' . NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=' . $op_redirect . '&server=' . $server . '&result=1&nv_redirect=' . $nv_redirect);
                exit;
            }
            if (!$nv_Request->isset_request('result', 'get')) {
                include_once NV_ROOTDIR . '/modules/users/login/openid-' . $server . '.php';
                $openid->identity = $openid_server_config['identity'];
                $openid->required = array_values($openid_server_config['required']);
                header('Location: ' . $openid->authUrl());
                die;
            }
            exit;
        }
    }
}
Header('Location: ' . nv_url_rewrite(NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name, true));
die;
Beispiel #20
0
     @Header('Content-Type: text/xml; charset=utf-8');
     print_r($content);
     die;
 }
 $listcatid_arr = explode(',', $news_contents['listcatid']);
 $catid_i = $listcatid_arr[0];
 $webtitle = htmlspecialchars(nv_unhtmlspecialchars($news_contents['title']), ENT_QUOTES);
 $webhome = nv_url_rewrite(NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA);
 if (strpos($webhome, NV_MY_DOMAIN) !== 0) {
     $webhome = NV_MY_DOMAIN . $webhome;
 }
 $linkpage = nv_url_rewrite(NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name . '&amp;' . NV_OP_VARIABLE . '=' . $global_array_cat[$catid_i]['alias'] . '/' . $news_contents['alias'] . '-' . $news_contents['id'] . $global_config['rewrite_exturl'], 1);
 if (strpos($linkpage, NV_MY_DOMAIN) !== 0) {
     $linkpage = NV_MY_DOMAIN . $linkpage;
 }
 $webrss = nv_url_rewrite(NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name . '&amp;' . NV_OP_VARIABLE . '=' . $module_info['alias']['rss'] . '/' . $global_array_cat[$catid_i]['alias'], 1);
 if (strpos($webrss, NV_MY_DOMAIN) !== 0) {
     $webrss = NV_MY_DOMAIN . $webrss;
 }
 $pingtotal = $nv_Request->get_int('total', 'post', 0);
 if ($sys_info['allowed_set_time_limit']) {
     set_time_limit(0);
 }
 if ($sys_info['ini_set_support']) {
     ini_set('allow_url_fopen', 1);
     ini_set('default_socket_timeout', 200);
 }
 $sCount = count($services_active);
 if ($pingtotal > $sCount) {
     $finish->nodeValue = 'OK';
 } else {
Beispiel #21
0
            $subject = $lang_module['account_register'];
            $message = sprintf($lang_module['account_register_info'], $array_register['first_name'], $global_config['site_name'], NV_MY_DOMAIN . nv_url_rewrite(NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name, true), $array_register['username']);
            nv_sendmail($global_config['site_email'], $array_register['email'], $subject, $message);
            if (!empty($global_config['auto_login_after_reg'])) {
                // Auto login
                $array_user = array('userid' => $userid, 'last_agent' => '', 'last_ip' => '', 'last_login' => 0, 'last_openid' => '');
                validUserLog($array_user, 1, '');
                $nv_redirect = nv_redirect_decrypt($nv_redirect);
                $url = !empty($nv_redirect) ? $nv_redirect : NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name;
            } else {
                $url = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=login';
                if (!empty($nv_redirect)) {
                    $url .= '&nv_redirect=' . $nv_redirect;
                }
            }
            $nv_redirect = '';
            die(reg_result(array('status' => 'ok', 'input' => nv_url_rewrite($url, true), 'mess' => $lang_module['register_ok'])));
        }
    }
}
if ($nv_Request->isset_request('get_usage_terms', 'post')) {
    $sql = "SELECT content FROM " . NV_USERS_GLOBALTABLE . "_config WHERE config='siteterms_" . NV_LANG_DATA . "'";
    $siteterms = $db->query($sql)->fetchColumn();
    include NV_ROOTDIR . '/includes/header.php';
    echo $siteterms;
    include NV_ROOTDIR . '/includes/footer.php';
}
$contents = user_register($gfx_chk, $array_register['checkss'], $data_questions, $array_field_config, $custom_fields);
include NV_ROOTDIR . '/includes/header.php';
echo nv_site_theme($contents);
include NV_ROOTDIR . '/includes/footer.php';
Beispiel #22
0
    die;
} else {
    $page_title = $mod_title = $BL->lang('allTags');
    $key_words = $module_info['keywords'] . ', tags';
    $description = $module_info['description'] . ' tags';
    $sql = "SELECT id, title, alias, numposts FROM " . $BL->table_prefix . "_tags ORDER BY title ASC";
    $result = $db->query($sql);
    $array = array();
    while ($row = $result->fetch()) {
        $array[$row['id']] = $row;
        $array[$row['id']]['link'] = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name . '&amp;' . NV_OP_VARIABLE . '=' . $op . '/' . $row['alias'];
    }
    // Open Graph
    $my_head .= "<meta property=\"og:title\" content=\"" . $page_title . ' ' . NV_TITLEBAR_DEFIS . ' ' . $global_config['site_name'] . "\" />\n";
    $my_head .= "<meta property=\"og:type\" content=\"website\" />\n";
    $my_head .= "<meta property=\"og:url\" content=\"" . NV_MY_DOMAIN . nv_url_rewrite(NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&" . NV_NAME_VARIABLE . "=" . $module_name . "&" . NV_OP_VARIABLE . "=tags", true) . "\" />\n";
    $my_head .= "<meta property=\"og:description\" content=\"" . $description . "\" />\n";
    if (!empty($BL->setting['sysDefaultImage'])) {
        if (preg_match("/^\\//", $BL->setting['sysDefaultImage'])) {
            $my_head .= "<meta property=\"og:image\" content=\"" . NV_MY_DOMAIN . $BL->setting['sysDefaultImage'] . "\" />\n";
        } else {
            $my_head .= "<meta property=\"og:image\" content=\"" . $BL->setting['sysDefaultImage'] . "\" />\n";
        }
    } else {
        $my_head .= "<meta property=\"og:image\" content=\"" . NV_MY_DOMAIN . NV_BASE_SITEURL . $global_config['site_logo'] . "\" />\n";
    }
    $contents = nv_all_tags_theme($array, $BL);
    include NV_ROOTDIR . '/includes/header.php';
    echo nv_site_theme($contents);
    include NV_ROOTDIR . '/includes/footer.php';
    die;
        $content .= "        </sitemap>\n";
    }
    $content .= "</sitemapindex>\n";
    echo $content;
    die;
} else {
    $array_url = array();
    $cacheFile = NV_LANG_DATA . '_sitemap_image_' . $page . '_' . NV_CACHE_PREFIX . '.cache';
    $pa = NV_CURRENTTIME - 7200;
    if (($cache = nv_get_cache($module_name, $cacheFile)) != false and filemtime(NV_ROOTDIR . '/' . NV_CACHEDIR . '/' . $module_name . '/' . $cacheFile) >= $pa) {
        $array_url = unserialize($cache);
    } else {
        $db->sqlreset()->select('album_id, category_id, name, alias, meta_title')->from(NV_PREFIXLANG . '_' . $module_data . '_album')->where('status=1')->order('date_added ASC')->limit($per_page)->offset(($page - 1) * $per_page);
        $albums = $db->query($db->sql());
        while ($album = $albums->fetch()) {
            $album['link'] = NV_MAIN_DOMAIN . nv_url_rewrite($global_photo_cat[$album['category_id']]['link'] . '/' . $album['alias'] . '-' . $album['album_id'] . $global_config['rewrite_exturl'], true);
            $album['photo'] = array();
            $db->sqlreset()->select('row_id, file')->from(NV_PREFIXLANG . '_' . $module_data . '_rows')->where('status=1 AND album_id=' . $album['album_id']);
            $photo = $db->query($db->sql());
            while ($row = $photo->fetch()) {
                $album['photo'][] = array('image' => NV_MAIN_DOMAIN . NV_BASE_SITEURL . NV_UPLOADS_DIR . '/' . $module_name . '/images/' . $row['file'], 'row_id' => $row['row_id']);
            }
            $photo->closeCursor();
            $array_url[] = $album;
        }
        $cache = serialize($array_url);
        nv_set_cache($module_name, $cacheFile, $cache);
    }
    $content = "";
    $content .= "<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\" xmlns:xhtml=\"http://www.w3.org/1999/xhtml\" xmlns:image=\"http://www.google.com/schemas/sitemap-image/1.1\">\n";
    foreach ($array_url as $data) {
Beispiel #24
0
//Xac dinh thu muc goc cua site
define('NV_ROOTDIR', str_replace('\\', '/', realpath(pathinfo(__FILE__, PATHINFO_DIRNAME) . '/../')));
require NV_ROOTDIR . '/includes/mainfile.php';
// Kiem tra tu cach admin
if (!defined('NV_IS_GODADMIN')) {
    Header('Location:' . nv_url_rewrite(NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA));
    die;
}
// Kiem tra ton tai goi update
if (!file_exists(NV_ROOTDIR . '/install/update_data.php')) {
    Header('Location:' . nv_url_rewrite(NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA));
    die;
}
require NV_ROOTDIR . '/install/update_data.php';
if (empty($nv_update_config)) {
    Header('Location:' . nv_url_rewrite(NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA));
    die;
}
// Ham cua admin
define('NV_ADMIN', true);
include_once NV_ROOTDIR . '/includes/core/admin_functions.php';
// Xac dinh ngon ngu cap nhat
$dirs = nv_scandir(NV_ROOTDIR . '/includes/language', '/^([a-z]{2})/');
$languageslist = array();
foreach ($dirs as $file) {
    if (is_file(NV_ROOTDIR . '/includes/language/' . $file . '/install.php')) {
        $languageslist[] = $file;
    }
}
$data_update_lang = array_keys($nv_update_config['lang']);
$array_lang_update = array_intersect($data_update_lang, $languageslist);
/**
 * nv_html_meta_tags()
 *
 * @param bool $html
 * @return
 */
function nv_html_meta_tags($html = true)
{
    global $global_config, $db_config, $lang_global, $key_words, $description, $module_info, $home, $client_info, $op, $page_title, $canonicalUrl, $meta_property;
    $return = array();
    $site_description = $home ? $global_config['site_description'] : (!empty($description) ? $description : (empty($module_info['description']) ? '' : $module_info['description']));
    if (empty($site_description)) {
        $ds = array();
        if (!empty($page_title)) {
            $ds[] = $page_title;
        }
        if ($op != 'main') {
            $ds[] = $module_info['funcs'][$op]['func_custom_name'];
        }
        $ds[] = $module_info['custom_title'];
        $ds[] = $client_info['selfurl'];
        $site_description = implode(' - ', $ds);
    } elseif ($site_description == 'no') {
        $site_description = '';
    }
    if (!empty($site_description)) {
        $site_description = preg_replace(array('/<[^>]*>/', '/[\\r\\n\\t]+/'), ' ', $site_description);
        $site_description = trim(preg_replace('/[ ]+/', ' ', $site_description));
        if ($global_config['description_length']) {
            $site_description = nv_clean60($site_description, $global_config['description_length'], true);
        }
        $return[] = array('name' => 'name', 'value' => 'description', 'content' => $site_description);
    }
    $kw = array();
    if (!empty($key_words)) {
        if ($key_words != 'no') {
            $kw[] = $key_words;
        }
    } elseif (!empty($module_info['keywords'])) {
        $kw[] = $module_info['keywords'];
    }
    if ($home and !empty($global_config['site_keywords'])) {
        $kw[] = $global_config['site_keywords'];
    }
    if (!empty($kw)) {
        $kw = array_unique($kw);
        $key_words = implode(',', $kw);
        $key_words = preg_replace(array("/[ ]*\\,[ ]+/", "/[\\,]+/"), array(", ", ", "), $key_words);
        $key_words = nv_strtolower(strip_tags($key_words));
        $return[] = array('name' => 'name', 'value' => 'keywords', 'content' => $key_words);
        $return[] = array('name' => 'name', 'value' => 'news_keywords', 'content' => $key_words);
    }
    $return[] = array('name' => 'http-equiv', 'value' => 'Content-Type', 'content' => "text/html; charset=" . $global_config['site_charset']);
    if ($global_config['idsite'] and file_exists(NV_ROOTDIR . '/' . NV_DATADIR . '/site_' . $global_config['idsite'] . '_metatags.xml')) {
        $file_metatags = NV_ROOTDIR . '/' . NV_DATADIR . '/site_' . $global_config['idsite'] . '_metatags.xml';
    } else {
        $file_metatags = NV_ROOTDIR . '/' . NV_DATADIR . '/metatags.xml';
    }
    if (file_exists($file_metatags)) {
        $mt = file_get_contents($file_metatags);
        $patters = array();
        $patters['/\\{CONTENT\\-LANGUAGE\\}/'] = $lang_global['Content_Language'];
        $patters['/\\{LANGUAGE\\}/'] = $lang_global['LanguageName'];
        $patters['/\\{SITE\\_NAME\\}/'] = $global_config['site_name'];
        $patters['/\\{SITE\\_EMAIL\\}/'] = $global_config['site_email'];
        $mt = preg_replace(array_keys($patters), array_values($patters), $mt);
        $mt = preg_replace('/\\{(.*)\\}/', '', $mt);
        $mt = simplexml_load_string($mt);
        $mt = nv_object2array($mt);
        if ($mt['meta_item']) {
            if (isset($mt['meta_item'][0])) {
                $metatags = $mt['meta_item'];
            } else {
                $metatags[] = $mt['meta_item'];
            }
            foreach ($metatags as $meta) {
                if (($meta['group'] == 'http-equiv' or $meta['group'] == 'name' or $meta['group'] == 'property') and preg_match('/^[a-zA-Z0-9\\-\\_\\.\\:]+$/', $meta['value']) and preg_match("/^([^\\'\"]+)\$/", (string) $meta['content'])) {
                    $return[] = array('name' => $meta['group'], 'value' => $meta['value'], 'content' => $meta['content']);
                }
            }
        }
    }
    $return[] = array('name' => 'name', 'value' => 'generator', 'content' => 'NukeViet v4.0');
    if (defined('NV_IS_ADMIN')) {
        $return[] = array('name' => 'http-equiv', 'value' => 'refresh', 'content' => $global_config['admin_check_pass_time']);
    }
    if ($global_config['current_theme_type'] == 'r') {
        $return[] = array('name' => 'name', 'value' => 'viewport', 'content' => "width=device-width, initial-scale=1");
    }
    if ($home) {
        $canonicalUrl = nv_url_rewrite(NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $global_config['site_home_module'], true);
    } elseif (empty($canonicalUrl)) {
        $canonicalUrl = str_replace(NV_MY_DOMAIN . '/', NV_MAIN_DOMAIN . '/', $client_info['selfurl']);
    }
    if (substr($canonicalUrl, 0, 4) != 'http') {
        if (substr($canonicalUrl, 0, 1) != '/') {
            $canonicalUrl = NV_BASE_SITEURL . $canonicalUrl;
        }
        $canonicalUrl = NV_MAIN_DOMAIN . $canonicalUrl;
    }
    //Open Graph protocol http://ogp.me
    if ($global_config['metaTagsOgp']) {
        if (empty($meta_property['og:title'])) {
            $meta_property['og:title'] = $page_title;
        }
        if (empty($meta_property['og:description'])) {
            $meta_property['og:description'] = $site_description;
        }
        if (empty($meta_property['og:type'])) {
            $meta_property['og:type'] = 'website';
        }
        if (empty($meta_property['og:url'])) {
            $meta_property['og:url'] = $canonicalUrl;
        }
        $meta_property['og:site_name'] = $global_config['site_name'];
        foreach ($meta_property as $key => $value) {
            if (is_array($value)) {
                foreach ($value as $value_i) {
                    if (!empty($value_i)) {
                        $return[] = array('name' => 'property', 'value' => $key, 'content' => $value_i);
                    }
                }
            } elseif (!empty($value)) {
                $return[] = array('name' => 'property', 'value' => $key, 'content' => $value);
            }
        }
    } else {
        foreach ($meta_property as $key => $value) {
            if (!preg_match('/^og\\:/', $key) and !empty($value)) {
                $return[] = array('name' => 'property', 'value' => $key, 'content' => $value);
            }
        }
    }
    if (!$html) {
        return $return;
    }
    $res = "";
    foreach ($return as $link) {
        $res .= "<meta " . $link['name'] . "=\"" . $link['value'] . "\" content=\"" . $link['content'] . "\" />" . PHP_EOL;
    }
    return $res;
}
Beispiel #26
0
    $sql = "SELECT * " . $sql . " ORDER BY pubtime DESC LIMIT " . ($page - 1) * $per_page . ", " . $per_page;
    $result = $db->query($sql);
    while ($row = $result->fetch()) {
        $row['mediatype'] = intval($row['mediatype']);
        $row['link'] = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name . '&amp;' . NV_OP_VARIABLE . '=' . $row['alias'] . $global_config['rewrite_exturl'];
        $row['postName'] = '';
        $array['contents'][$row['id']] = $row;
        $array_userids[$row['postid']] = $row['postid'];
    }
    // Du lieu phan trang
    $generate_page = $BL->pagination($page_title, $base_url, $all_page, $per_page, $page, true, '&amp;');
    $total_pages = ceil($all_page / $per_page);
}
// Khong cho dat $page tuy y
if ($page > 1 and empty($array['contents'])) {
    header('Location:' . nv_url_rewrite(NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&" . NV_NAME_VARIABLE . "=" . $module_name, true));
    die;
}
// Lay thanh vien dang bai
if (!empty($array_userids)) {
    $sql = "SELECT userid, username, full_name FROM " . NV_USERS_GLOBALTABLE . " WHERE userid IN(" . implode(",", $array_userids) . ")";
    $result = $db->query($sql);
    $array_userids = array();
    while ($row = $result->fetch()) {
        $array_userids[$row['userid']] = $row['full_name'] ? $row['full_name'] : $row['username'];
    }
    foreach ($array['contents'] as $row) {
        if (isset($array_userids[$row['postid']])) {
            $array['contents'][$row['id']]['postName'] = $array_userids[$row['postid']];
        }
    }
Beispiel #27
0
/**
 * nv_search_theme()
 * 
 * @param mixed $array
 * @param mixed $page
 * @param mixed $total_pages
 * @param mixed $all_page
 * @param mixed $generate_page
 * @param mixed $BL
 * @return
 */
function nv_search_theme($array, $page, $total_pages, $all_page, $generate_page, $BL)
{
    global $lang_global, $lang_module, $module_file, $module_info;
    $xtpl = new XTemplate("search.tpl", NV_ROOTDIR . "/themes/" . $module_info['template'] . "/modules/" . $module_file);
    $xtpl->assign('GLANG', $lang_global);
    $xtpl->assign('LANG', $lang_module);
    if (empty($array['contents']) and !empty($array['q'])) {
        $xtpl->assign('NORESULT_MESSAGE', nv_message_theme(sprintf($BL->lang('searchNoResult'), $array['q']), 1));
        $xtpl->parse('main.noResult');
    }
    if (!empty($array['contents'])) {
        $xtpl->assign('RESULT_INFO', sprintf($BL->lang('searchResultInfo'), $all_page, $array['q']));
        $xtpl->assign('PAGE_TOTAL', $total_pages);
        $xtpl->assign('PAGE_CURRENT', $page);
        foreach ($array['contents'] as $row) {
            $row['title'] = $BL->BoldKeywordInStr($row['title'], $array['q']);
            $row['hometext'] = $BL->BoldKeywordInStr($row['hometext'], $array['q']);
            $row['pubtime'] = str_replace(array(' AM ', ' PM '), array(' SA ', ' CH '), nv_date('g:i A d/m/Y', $row['pubtime']));
            $row['numcomments'] = number_format($row['numcomments'], 0, ',', '.');
            $row['linkComment'] = nv_url_rewrite($row['link'], true) . '#comment';
            $row['icon'] = empty($BL->setting['iconClass' . $row['posttype']]) ? 'icon-pencil' : $BL->setting['iconClass' . $row['posttype']];
            $xtpl->assign('ROW', $row);
            $xtpl->parse('main.result.loop');
        }
        if (!empty($generate_page)) {
            $xtpl->assign('GENERATE_PAGE', $generate_page);
            $xtpl->parse('main.result.generate_page');
        }
        $xtpl->parse('main.result');
    }
    $xtpl->parse('main');
    return $xtpl->text('main');
}
Beispiel #28
0
/**
 * nv_xmlSitemap_generate()
 *
 * @param mixed $url
 * @return void
 */
function nv_xmlSitemap_generate($url)
{
    global $global_config;
    if (file_exists(NV_ROOTDIR . 'themes/' . $global_config['site_theme'] . '/css/sitemap.xsl')) {
        $path_css_sitemap = NV_BASE_SITEURL . 'themes/' . $global_config['site_theme'] . '/css/sitemap.xsl';
    } else {
        $path_css_sitemap = NV_BASE_SITEURL . 'themes/default/css/sitemap.xsl';
    }
    $sitemapHeader = '<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet type="text/xsl" href="' . $path_css_sitemap . '"?><urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"></urlset>';
    $xml = new SimpleXMLElement($sitemapHeader);
    $lastModified = time() - 86400;
    if (!empty($url)) {
        foreach ($url as $key => $values) {
            $publdate = date('c', $values['publtime']);
            $row = $xml->addChild('url');
            $row->addChild('loc', "'" . nv_url_rewrite($values['link'], true) . "'");
            $row->addChild('lastmod', $publdate);
            $row->addChild('changefreq', 'daily');
            $row->addChild('priority', '0.8');
            if ($key == 0) {
                $lastModified = $values['publtime'];
            }
        }
    }
    $contents = $xml->asXML();
    $contents = nv_url_rewrite($contents);
    $contents = preg_replace("/(<loc>)\\'(.*?)\\'(<\\/loc>)/", "\\1" . NV_MY_DOMAIN . "\\2\\3", $contents);
    nv_xmlOutput($contents, $lastModified);
}
Beispiel #29
0
 * @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 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();
Beispiel #30
0
 * @Author VINADES.,JSC (contact@vinades.vn)
 * @Copyright (C) 2014 VINADES.,JSC. All rights reserved
 * @License GNU/GPL version 2 or any later version
 * @Createdate 3-6-2010 0:14
 */
if (!defined('NV_IS_MOD_NEWS')) {
    die('Stop!!!');
}
$cache_file = '';
$contents = '';
$viewcat = $global_array_cat[$catid]['viewcat'];
$base_url_rewrite = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name . '&amp;' . NV_OP_VARIABLE . '=' . $global_array_cat[$catid]['alias'];
if ($page > 1) {
    $base_url_rewrite .= '/page-' . $page;
}
$base_url_rewrite = nv_url_rewrite($base_url_rewrite, true);
if ($_SERVER['REQUEST_URI'] != $base_url_rewrite and NV_MAIN_DOMAIN . $_SERVER['REQUEST_URI'] != $base_url_rewrite) {
    Header('Location: ' . $base_url_rewrite);
    die;
}
$set_view_page = ($page > 1 and substr($viewcat, 0, 13) == 'viewcat_main_') ? true : false;
if (!defined('NV_IS_MODADMIN') and $page < 5) {
    if ($set_view_page) {
        $cache_file = NV_LANG_DATA . '_' . $module_info['template'] . '_' . $op . '_' . $catid . '_page_' . $page . '_' . NV_CACHE_PREFIX . '.cache';
    } else {
        $cache_file = NV_LANG_DATA . '_' . $module_info['template'] . '_' . $op . '_' . $catid . '_' . $page . '_' . NV_CACHE_PREFIX . '.cache';
    }
    if (($cache = $nv_Cache->getItem($module_name, $cache_file)) != false) {
        $contents = $cache;
    }
}