本文整理汇总了PHP中nv_user_in_groups函数的典型用法代码示例。如果您正苦于以下问题:PHP nv_user_in_groups函数的具体用法?PHP nv_user_in_groups怎么用?PHP nv_user_in_groups使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了nv_user_in_groups函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: nv_list_cats
/**
* nv_list_cats()
*
* @param bool $is_link
* @param bool $is_parentlink
* @return
*/
function nv_list_cats($is_link = false, $is_parentlink = true)
{
global $db, $module_data, $module_name, $module_info;
$sql = "SELECT * FROM " . NV_PREFIXLANG . "_" . $module_data . "_categories WHERE status=1 ORDER BY parentid,weight ASC";
$result = $db->query($sql);
$list = array();
while ($row = $result->fetch()) {
if (nv_user_in_groups($row['groups_view'])) {
$list[$row['id']] = array('id' => (int) $row['id'], 'title' => $row['title'], 'alias' => $row['alias'], 'description' => $row['description'], 'parentid' => (int) $row['parentid'], 'subcats' => array(), 'keywords' => $row['keywords']);
}
}
$list2 = array();
if (!empty($list)) {
foreach ($list as $row) {
if (!$row['parentid'] or isset($list[$row['parentid']])) {
$list2[$row['id']] = $list[$row['id']];
$list2[$row['id']]['name'] = $list[$row['id']]['title'];
if ($is_link) {
$list2[$row['id']]['name'] = "<a href=\"" . NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&" . NV_NAME_VARIABLE . "=" . $module_name . "&" . NV_OP_VARIABLE . "=" . $list2[$row['id']]['alias'] . "\">" . $list2[$row['id']]['name'] . "</a>";
}
if ($row['parentid']) {
$list2[$row['parentid']]['subcats'][] = $row['id'];
$list2[$row['id']]['name'] = nv_setcats($row['parentid'], $list, $list2[$row['id']]['name'], $is_parentlink);
}
if ($is_parentlink) {
$list2[$row['id']]['name'] = "<a href=\"" . NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&" . NV_NAME_VARIABLE . "=" . $module_name . "\">" . $module_info['custom_title'] . "</a> » " . $list2[$row['id']]['name'];
}
}
}
}
return $list2;
}
示例2: check_upload3
function check_upload3()
{
global $data_config, $user_info, $op, $module_name;
if ($data_config['who_upload'] == 0) {
return true;
} elseif ($data_config['who_upload'] == 1) {
if (!defined('NV_IS_USER')) {
return false;
} else {
return true;
}
} elseif ($data_config['who_upload'] == 2) {
if (!defined('NV_IS_ADMIN')) {
return false;
} else {
return true;
}
} elseif ($data_config['who_upload'] == 3) {
if (!defined('NV_IS_USER')) {
return false;
} elseif (empty($data_config['groups_view'])) {
return false;
} else {
if (nv_user_in_groups($data_config['groups_view'])) {
return true;
} else {
return false;
}
}
}
}
示例3: nv_mod_down_config
function nv_mod_down_config($module)
{
global $site_mods, $module_info;
$sql = 'SELECT config_name,config_value FROM ' . NV_PREFIXLANG . '_' . $site_mods[$module]['module_file'] . '_config';
$list = nv_db_cache($sql, '', $module);
$download_config = array();
foreach ($list as $values) {
$download_config[$values['config_name']] = $values['config_value'];
}
$download_config['upload_filetype'] = !empty($download_config['upload_filetype']) ? explode(',', $download_config['upload_filetype']) : array();
if (!empty($download_config['upload_filetype'])) {
$download_config['upload_filetype'] = array_map('trim', $download_config['upload_filetype']);
}
if (empty($download_config['upload_filetype'])) {
$download_config['is_upload'] = 0;
}
if ($download_config['is_addfile']) {
$download_config['is_addfile_allow'] = nv_user_in_groups($download_config['groups_addfile']);
} else {
$download_config['is_addfile_allow'] = false;
}
if ($download_config['is_addfile_allow'] and $download_config['is_upload']) {
$download_config['is_upload_allow'] = nv_user_in_groups($download_config['groups_upload']);
} else {
$download_config['is_upload_allow'] = false;
}
return $download_config;
}
示例4: nv_mod_down_config
function nv_mod_down_config($module)
{
global $site_mods, $module_info, $nv_Cache;
$_mod_table = defined('SYS_DOWNLOAD_TABLE') ? SYS_DOWNLOAD_TABLE : NV_PREFIXLANG . '_' . $site_mods[$module]['module_data'];
$sql = 'SELECT config_name,config_value FROM ' . $_mod_table . '_config';
$list = $nv_Cache->db($sql, '', $module);
$download_config = array();
foreach ($list as $values) {
$download_config[$values['config_name']] = $values['config_value'];
}
$download_config['upload_filetype'] = !empty($download_config['upload_filetype']) ? explode(',', $download_config['upload_filetype']) : array();
if (!empty($download_config['upload_filetype'])) {
$download_config['upload_filetype'] = array_map('trim', $download_config['upload_filetype']);
}
if ($download_config['is_addfile']) {
$download_config['is_addfile_allow'] = nv_user_in_groups($download_config['groups_addfile']);
} else {
$download_config['is_addfile_allow'] = false;
}
if ($download_config['is_addfile_allow']) {
$download_config['is_upload_allow'] = nv_user_in_groups($download_config['groups_upload']);
} else {
$download_config['is_upload_allow'] = false;
}
return $download_config;
}
示例5: nv_mod_down_config
/**
* nv_mod_down_config()
*
* @return
*/
function nv_mod_down_config()
{
global $module_name, $module_name, $nv_Cache;
$sql = 'SELECT config_name,config_value FROM ' . NV_MOD_TABLE . '_config';
$list = $nv_Cache->db($sql, '', $module_name);
$download_config = array();
foreach ($list as $values) {
$download_config[$values['config_name']] = $values['config_value'];
}
$download_config['upload_filetype'] = !empty($download_config['upload_filetype']) ? explode(',', $download_config['upload_filetype']) : array();
if (!empty($download_config['upload_filetype'])) {
$download_config['upload_filetype'] = array_map('trim', $download_config['upload_filetype']);
}
if ($download_config['is_addfile']) {
$download_config['is_addfile_allow'] = nv_user_in_groups($download_config['groups_addfile']);
} else {
$download_config['is_addfile_allow'] = false;
}
if ($download_config['is_addfile_allow']) {
$download_config['is_upload_allow'] = nv_user_in_groups($download_config['groups_upload']);
} else {
$download_config['is_upload_allow'] = false;
}
return $download_config;
}
示例6: nv_menu_blocks
/**
* nv_menu_blocks()
*
* Ham xu ly chinh cho block
*
* @param mixed $block_config
* @return
*/
function nv_menu_blocks($block_config)
{
global $db, $global_config, $my_head;
$list_cats = array();
$sql = 'SELECT id, parentid, title, link, icon, note, subitem, groups_view, module_name, op, target, css, active_type FROM ' . NV_PREFIXLANG . '_menu_rows WHERE status=1 AND mid = ' . $block_config['menuid'] . ' ORDER BY weight ASC';
$list = nv_db_cache($sql, '', $block_config['module']);
foreach ($list as $row) {
if (nv_user_in_groups($row['groups_view'])) {
switch ($row['target']) {
case 1:
$row['target'] = '';
break;
case 3:
$row['target'] = ' onclick="window.open(this.href,\'targetWindow\',\'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,\');return false;"';
break;
default:
$row['target'] = ' onclick="this.target=\'_blank\'"';
}
if (!empty($row['icon']) and file_exists(NV_UPLOADS_REAL_DIR . '/menu/' . $row['icon'])) {
$row['icon'] = NV_BASE_SITEURL . NV_UPLOADS_DIR . '/menu/' . $row['icon'];
} else {
$row['icon'] = '';
}
$list_cats[$row['id']] = array('id' => $row['id'], 'parentid' => $row['parentid'], 'subcats' => $row['subitem'], 'title' => $row['title'], 'title_trim' => nv_clean60($row['title'], $block_config['title_length']), 'target' => $row['target'], 'note' => empty($row['note']) ? $row['title'] : $row['note'], 'link' => nv_url_rewrite(nv_unhtmlspecialchars($row['link']), true), 'icon' => $row['icon'], 'html_class' => $row['css'], 'current' => nv_menu_check_current($row['link'], (int) $row['active_type']));
}
}
if (file_exists(NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/modules/menu/' . $block_config['block_name'] . '.tpl')) {
$block_theme = $global_config['module_theme'];
} elseif (file_exists(NV_ROOTDIR . '/themes/' . $global_config['site_theme'] . '/modules/menu/' . $block_config['block_name'] . '.tpl')) {
$block_theme = $global_config['site_theme'];
} else {
$block_theme = 'default';
}
$xtpl = new XTemplate($block_config['block_name'] . '.tpl', NV_ROOTDIR . '/themes/' . $block_theme . '/modules/menu');
$xtpl->assign('BLOCK_THEME', $block_theme);
$xtpl->assign('NV_BASE_SITEURL', NV_BASE_SITEURL);
foreach ($list_cats as $cat) {
if (empty($cat['parentid'])) {
$cat['class'] = nv_menu_blocks_active($cat);
$xtpl->assign('CAT1', $cat);
if (!empty($cat['icon'])) {
$xtpl->parse('main.loopcat1.icon');
}
if (!empty($cat['subcats'])) {
$html_content = nv_smenu_blocks($block_config['block_name'], $list_cats, $cat['subcats']);
$xtpl->assign('HTML_CONTENT', $html_content);
if ($html_content != '') {
$xtpl->parse('main.loopcat1.cat2');
$xtpl->parse('main.loopcat1.expand');
}
}
$xtpl->parse('main.loopcat1');
}
}
$xtpl->assign('MENUID', $block_config['bid']);
$xtpl->parse('main');
return $xtpl->text('main');
}
示例7: nv_block_voting_select
function nv_block_voting_select($block_config, $global_array_cat)
{
global $module_info, $global_config, $db, $site_mods, $module_name, $my_head, $client_info;
$module = $block_config['module'];
$mod_data = $site_mods[$module]['module_data'];
$sql = "SELECT vid, question, link, acceptcm, groups_view, publ_time, exp_time FROM " . NV_PREFIXLANG . "_" . $site_mods['voting']['module_data'] . " WHERE act=1";
$list = nv_db_cache($sql, 'vid', 'voting');
if (isset($list[$block_config['vid']])) {
$current_voting = $list[$block_config['vid']];
if ($current_voting['publ_time'] <= NV_CURRENTTIME and nv_user_in_groups($current_voting['groups_view'])) {
$sql = "SELECT id, vid, title, url FROM " . NV_PREFIXLANG . "_" . $site_mods['voting']['module_data'] . "_rows WHERE vid = " . $block_config['vid'] . " ORDER BY id ASC";
$list = nv_db_cache($sql, '', 'voting');
if (empty($list)) {
return '';
}
include NV_ROOTDIR . '/modules/' . $site_mods['voting']['module_file'] . '/language/' . NV_LANG_INTERFACE . '.php';
if (file_exists(NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/modules/' . $site_mods['voting']['module_file'] . '/global.voting.tpl')) {
$block_theme = $global_config['module_theme'];
} elseif (file_exists(NV_ROOTDIR . '/themes/' . $global_config['site_theme'] . '/modules/' . $site_mods['voting']['module_file'] . '/global.voting.tpl')) {
$block_theme = $global_config['site_theme'];
} else {
$block_theme = 'default';
}
if (!defined('SHADOWBOX')) {
$my_head .= "<link rel=\"Stylesheet\" href=\"" . NV_BASE_SITEURL . "js/shadowbox/shadowbox.css\" />\n";
$my_head .= "<script type=\"text/javascript\" src=\"" . NV_BASE_SITEURL . "js/shadowbox/shadowbox.js\"></script>\n";
$my_head .= "<script type=\"text/javascript\">Shadowbox.init();</script>";
define('SHADOWBOX', true);
}
$my_head .= "<script type=\"text/javascript\" src=\"" . NV_BASE_SITEURL . "modules/" . $site_mods['voting']['module_file'] . "/js/user.js\"></script>\n";
$action = NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&" . NV_NAME_VARIABLE . "=voting";
$voting_array = array('checkss' => md5($current_voting['vid'] . $client_info['session_id'] . $global_config['sitekey']), 'accept' => $current_voting['acceptcm'], 'errsm' => $current_voting['acceptcm'] > 1 ? sprintf($lang_module['voting_warning_all'], $current_voting['acceptcm']) : $lang_module['voting_warning_accept1'], 'vid' => $current_voting['vid'], 'question' => empty($current_voting['link']) ? $current_voting['question'] : '<a target="_blank" href="' . $current_voting['link'] . '">' . $current_voting['question'] . '</a>', 'action' => $action, 'langresult' => $lang_module['voting_result'], 'langsubmit' => $lang_module['voting_hits']);
$xtpl = new XTemplate('global.voting.tpl', NV_ROOTDIR . '/themes/' . $block_theme . '/modules/' . $site_mods['voting']['module_file']);
$xtpl->assign('VOTING', $voting_array);
foreach ($list as $row) {
if (!empty($row['url'])) {
$row['title'] = '<a target="_blank" href="' . $row['url'] . '">' . $row['title'] . '</a>';
}
$xtpl->assign('RESULT', $row);
if ((int) $current_voting['acceptcm'] > 1) {
$xtpl->parse('main.resultn');
} else {
$xtpl->parse('main.result1');
}
}
if (!defined('MODAL_LOADED')) {
$xtpl->parse('main.modal_loaded');
define('MODAL_LOADED', true);
}
$xtpl->parse('main');
return $xtpl->text('main');
}
}
}
示例8: nv_sdown_cats
/**
* nv_sdown_cats()
*
* @param mixed $module_data
* @return
*/
function nv_sdown_cats($_mod_table)
{
global $db;
$sql = 'SELECT id, title, alias, groups_view FROM ' . $_mod_table . '_categories WHERE status=1';
$result = $db->query($sql);
$list = array();
while ($row = $result->fetch()) {
if (nv_user_in_groups($row['groups_view'])) {
$list[$row['id']] = array('id' => $row['id'], 'title' => $row['title'], 'alias' => $row['alias']);
}
}
return $list;
}
示例9: nv_faq_list_cats
/**
* nv_faq_list_cats()
*
* @param mixed $module_data
* @return
*/
function nv_faq_list_cats($module_data)
{
global $db;
$sql = "SELECT id, title, alias, groups_view FROM " . NV_PREFIXLANG . "_" . $module_data . "_categories WHERE status=1";
$result = $db->query($sql);
$list = array();
while ($row = $result->fetch()) {
if (nv_user_in_groups($row['groups_view'])) {
$list[$row['id']] = array('id' => (int) $row['id'], 'title' => $row['title'], 'alias' => $row['alias']);
}
}
return $list;
}
示例10: nv_bdown_news
function nv_bdown_news($block_config)
{
global $db, $module_info, $site_mods, $global_config, $nv_Cache;
$module = $block_config['module'];
$file = $site_mods[$module]['module_file'];
// Lay thong tin phan quyen
$sql = 'SELECT id, alias, groups_view FROM ' . NV_PREFIXLANG . '_' . $site_mods[$module]['module_data'] . '_categories WHERE status=1';
$_tmp = $nv_Cache->db($sql, 'id', $module);
$list_cat = array();
if ($_tmp) {
foreach ($_tmp as $row) {
if (nv_user_in_groups($row['groups_view'])) {
$list_cat[$row['id']] = $row['alias'];
}
}
}
unset($_tmp, $sql);
if ($list_cat) {
$db->sqlreset()->select('id, catid, title, alias, updatetime')->from(NV_PREFIXLANG . '_' . $site_mods[$module]['module_data'])->where('status AND catid IN (' . implode(',', array_keys($list_cat)) . ')')->order('updatetime DESC')->limit($block_config['numrow']);
$list = $nv_Cache->db($db->sql(), 'id', $module);
if (!empty($list)) {
if (file_exists(NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/modules/' . $file . '/block_new_files.tpl')) {
$block_theme = $global_config['module_theme'];
} else {
$block_theme = 'default';
}
$xtpl = new XTemplate('block_new_files.tpl', NV_ROOTDIR . '/themes/' . $block_theme . '/modules/' . $file);
$xtpl->assign('CONFIG', $block_config);
foreach ($list as $row) {
$row['link'] = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module . '&' . NV_OP_VARIABLE . '=' . $list_cat[$row['catid']] . '/' . $row['alias'] . $global_config['rewrite_exturl'];
$row['updatetime'] = nv_date('d/m/Y', $row['updatetime']);
$row['stitle'] = nv_clean60($row['title'], $block_config['title_length']);
$xtpl->assign('ROW', $row);
if ($block_config['img_bullet']) {
$xtpl->parse('main.loop.bullet');
}
$xtpl->parse('main.loop');
}
$xtpl->parse('main');
return $xtpl->text('main');
}
}
}
示例11: nv_download_content
/**
* nv_download_content
*
* @param mixed $data_content
* @param mixed $linktab
* @return
*/
function nv_download_content($data_content)
{
global $module_info, $lang_module, $lang_global, $module_name, $module_data, $module_file, $pro_config, $op;
$xtpl = new XTemplate('download_content.tpl', NV_ROOTDIR . '/themes/' . $module_info['template'] . '/modules/' . $module_file);
$xtpl->assign('LANG', $lang_module);
$xtpl->assign('proid', $data_content['id']);
if (!empty($data_content['files'])) {
$login = 0;
foreach ($data_content['files'] as $files) {
if (file_exists(NV_ROOTDIR . '/themes/' . $module_info['template'] . '/images/' . $module_file . '/icon_files/' . $files['extension'] . '.png')) {
$files['extension_icon'] = NV_BASE_SITEURL . 'themes/' . $module_info['template'] . '/images/' . $module_file . '/icon_files/' . $files['extension'] . '.png';
} else {
$files['extension_icon'] = NV_BASE_SITEURL . 'themes/' . $module_info['template'] . '/images/' . $module_file . '/icon_files/document.png';
}
$xtpl->assign('FILES', $files);
if ($files['download_groups'] == '-1') {
$files['download_groups'] = $pro_config['download_groups'];
}
if (!nv_user_in_groups($files['download_groups'])) {
$xtpl->assign('NOTE', $lang_module['download_file_no']);
$xtpl->parse('main.files_content.loop.disabled');
} else {
$xtpl->assign('NOTE', $lang_module['download_file']);
}
$xtpl->parse('main.files_content.loop');
}
if ($login > 0) {
$link_login = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=users&' . NV_OP_VARIABLE . '=login&nv_redirect=' . nv_redirect_encrypt($client_info['selfurl'] . '#' . $linktab);
$xtpl->assign('DOWNLOAD_LOGIN', '<a title="' . $lang_global['loginsubmit'] . '" href="' . $link_login . '">' . $lang_module['download_login'] . '</a>');
$xtpl->parse('main.form_login');
}
$xtpl->parse('main.files_content');
$xtpl->parse('main');
return $xtpl->text('main');
}
}
示例12: header
if ($checkss != md5($vid . NV_CHECK_SESSION) or $vid <= 0 or $lid == '') {
header('location:' . $global_config['site_url']);
exit;
}
$sql = 'SELECT vid, question, acceptcm, groups_view, publ_time, exp_time FROM ' . NV_PREFIXLANG . '_' . $module_data . ' WHERE act=1';
$list = $nv_Cache->db($sql, 'vid', 'voting');
if (empty($list) or !isset($list[$vid])) {
header('location:' . $global_config['site_url']);
exit;
}
$row = $list[$vid];
if ((int) $row['exp_time'] < 0 or (int) $row['exp_time'] > 0 and $row['exp_time'] < NV_CURRENTTIME) {
header('location:' . $global_config['site_url']);
exit;
}
if (!nv_user_in_groups($row['groups_view'])) {
header('location:' . $global_config['site_url']);
exit;
}
$difftimeout = 3600;
$dir = NV_ROOTDIR . '/' . NV_LOGS_DIR . '/voting_logs';
$log_fileext = preg_match('/[a-z]+/i', NV_LOGS_EXT) ? NV_LOGS_EXT : 'log';
$pattern = '/^(.*)\\.' . $log_fileext . '$/i';
$logs = nv_scandir($dir, $pattern);
if (!empty($logs)) {
foreach ($logs as $file) {
$vtime = filemtime($dir . '/' . $file);
if (!$vtime or $vtime <= NV_CURRENTTIME - $difftimeout) {
@unlink($dir . '/' . $file);
}
}
示例13: die
if (empty($filename) or !isset($session_files['fileupload'][$filename])) {
die('Wrong URL');
}
if (!file_exists($session_files['fileupload'][$filename]['src'])) {
die('Wrong URL');
}
if (!isset($session_files['fileupload'][$filename]['id'])) {
die('Wrong URL');
}
$upload_dir = 'files';
$is_zip = false;
$is_resume = false;
$max_speed = 0;
$filepdf = $nv_Request->get_int('filepdf', 'get', 0);
if ($filepdf == 1) {
if (!nv_user_in_groups($row['groups_onlineview']) or !nv_user_in_groups($list_cats[$row['catid']]['groups_onlineview'])) {
die('Wrong URL');
}
$download_config = nv_mod_down_config();
$file_url = '';
$file_src = $session_files['fileupload'][$filename]['src'];
if ($download_config['pdf_handler'] == 'filetmp') {
$file_src_new = NV_ROOTDIR . '/' . NV_TEMP_DIR . '/' . NV_TEMPNAM_PREFIX . md5($file_src) . '.' . nv_getextension($file_src);
if (file_exists($file_src_new) or nv_copyfile($file_src, $file_src_new)) {
$file_url = NV_MY_DOMAIN . NV_BASE_SITEURL . substr($file_src_new, strlen(NV_ROOTDIR . '/'));
}
} elseif ($download_config['pdf_handler'] == 'base64') {
$file_url = 'data:application/pdf;base64,' . base64_encode(file_get_contents($file_src));
} else {
$file_url = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=down&filepdf=2&filename=' . $filename;
}
示例14: nv_create_submenu
nv_create_submenu();
}
// Ket noi voi cac op cua module de thuc hien
if ($is_mobile and file_exists(NV_ROOTDIR . '/modules/' . $module_file . '/mobile/' . $op_file . '.php')) {
require NV_ROOTDIR . '/modules/' . $module_file . '/mobile/' . $op_file . '.php';
} else {
require NV_ROOTDIR . '/modules/' . $module_file . '/funcs/' . $op_file . '.php';
}
exit;
} elseif (isset($module_info['funcs']['main'])) {
$sth = $db->prepare('UPDATE ' . NV_MODULES_TABLE . ' SET act=2 WHERE title= :title');
$sth->bindParam(':title', $module_name, PDO::PARAM_STR);
$sth->execute();
nv_insert_notification('modules', 'auto_deactive_module', array('custom_title' => $site_mods[$module_name]['custom_title']));
nv_del_moduleCache('modules');
}
} elseif (isset($sys_mods[$module_name])) {
$groups_view = (string) $sys_mods[$module_name]['groups_view'];
if (!defined('NV_IS_USER') and $groups_view == 4) {
// Login users
Header('Location: ' . NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=users&' . NV_OP_VARIABLE . '=login&nv_redirect=' . nv_base64_encode($client_info['selfurl']));
die;
} elseif (!defined('NV_IS_ADMIN') and ($groups_view == '2' or $groups_view == '1')) {
// Exit
nv_info_die($lang_global['error_404_title'], $lang_global['site_info'], $lang_global['module_for_admin']);
} elseif (defined('NV_IS_USER') and !nv_user_in_groups($groups_view)) {
nv_info_die($lang_global['error_404_title'], $lang_global['error_404_title'], $lang_global['error_404_content']);
}
}
}
nv_info_die($lang_global['error_404_title'], $lang_global['error_404_title'], $lang_global['error_404_content']);
示例15: nv_block_voting
/**
* nv_block_voting()
*
* @return
*/
function nv_block_voting()
{
global $nv_Cache, $db, $my_footer, $site_mods, $global_config, $client_info;
$content = '';
if (!isset($site_mods['voting'])) {
return '';
}
$sql = 'SELECT vid, question, link, acceptcm, groups_view, publ_time, exp_time FROM ' . NV_PREFIXLANG . '_' . $site_mods['voting']['module_data'] . ' WHERE act=1';
$list = $nv_Cache->db($sql, 'vid', 'voting');
if (empty($list)) {
return '';
}
$allowed = array();
$is_update = array();
$a = 0;
foreach ($list as $row) {
if ($row['exp_time'] > 0 and $row['exp_time'] < NV_CURRENTTIME) {
$is_update[] = $row['vid'];
} elseif ($row['publ_time'] <= NV_CURRENTTIME and nv_user_in_groups($row['groups_view'])) {
$allowed[$a] = $row;
++$a;
}
}
if (!empty($is_update)) {
$is_update = implode(',', $is_update);
$sql = 'UPDATE ' . NV_PREFIXLANG . '_' . $site_mods['voting']['module_data'] . ' SET act=0 WHERE vid IN (' . $is_update . ')';
$db->query($sql);
$nv_Cache->delMod('voting');
}
if ($allowed) {
--$a;
$rand = rand(0, $a);
$current_voting = $allowed[$rand];
$sql = 'SELECT id, vid, title, url FROM ' . NV_PREFIXLANG . '_' . $site_mods['voting']['module_data'] . '_rows WHERE vid = ' . $current_voting['vid'] . ' ORDER BY id ASC';
$list = $nv_Cache->db($sql, '', 'voting');
if (empty($list)) {
return '';
}
include NV_ROOTDIR . '/modules/' . $site_mods['voting']['module_file'] . '/language/' . NV_LANG_INTERFACE . '.php';
if (file_exists(NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/modules/' . $site_mods['voting']['module_file'] . '/global.voting.tpl')) {
$block_theme = $global_config['module_theme'];
} elseif (file_exists(NV_ROOTDIR . '/themes/' . $global_config['site_theme'] . '/modules/' . $site_mods['voting']['module_file'] . '/global.voting.tpl')) {
$block_theme = $global_config['site_theme'];
} else {
$block_theme = 'default';
}
if (file_exists(NV_ROOTDIR . '/themes/' . $block_theme . '/js/voting.js')) {
$my_footer .= "<script type=\"text/javascript\" src=\"" . NV_BASE_SITEURL . "themes/" . $block_theme . "/js/voting.js\"></script>\n";
}
$action = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=voting';
$voting_array = array('checkss' => md5($current_voting['vid'] . $client_info['session_id'] . $global_config['sitekey']), 'accept' => (int) $current_voting['acceptcm'], 'errsm' => (int) $current_voting['acceptcm'] > 1 ? sprintf($lang_module['voting_warning_all'], (int) $current_voting['acceptcm']) : $lang_module['voting_warning_accept1'], 'vid' => $current_voting['vid'], 'question' => empty($current_voting['link']) ? $current_voting['question'] : '<a target="_blank" href="' . $current_voting['link'] . '">' . $current_voting['question'] . '</a>', 'action' => $action, 'langresult' => $lang_module['voting_result'], 'langsubmit' => $lang_module['voting_hits']);
$xtpl = new XTemplate('global.voting.tpl', NV_ROOTDIR . '/themes/' . $block_theme . '/modules/' . $site_mods['voting']['module_file']);
$xtpl->assign('VOTING', $voting_array);
foreach ($list as $row) {
if (!empty($row['url'])) {
$row['title'] = '<a target="_blank" href="' . $row['url'] . '">' . $row['title'] . '</a>';
}
$xtpl->assign('RESULT', $row);
if ((int) $current_voting['acceptcm'] > 1) {
$xtpl->parse('main.resultn');
} else {
$xtpl->parse('main.result1');
}
}
$xtpl->parse('main');
$content = $xtpl->text('main');
}
return $content;
}