/** * 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; }
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; } } } }
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; }
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; }
/** * 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; }
/** * 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'); }
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'); } } }
/** * 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; }
/** * 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; }
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'); } } }
/** * 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'); } }
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); } }
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; }
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']);
/** * 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; }
* @Copyright (C) 2015 VINADES.,JSC. All rights reserved * @License GNU/GPL version 2 or any later version * @Createdate Sun, 21 Jun 2015 00:23:50 GMT */ 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 . '&' . NV_NAME_VARIABLE . '=' . $module_name, true); redict_link($lang_module['detail_no_permission'], $lang_module['redirect_to_back'], $nv_redirect);
$img = NV_UPLOADS_DIR . $row['fileimage']; $row['fileimage'] = nv_ImageInfo(NV_ROOTDIR . '/' . $img, 300, true, NV_ROOTDIR . '/' . NV_TEMP_DIR); $dfile = $nv_Request->get_string('dfile', 'session', ''); $dfile = !empty($dfile) ? unserialize($dfile) : array(); if (!in_array($row['id'], $dfile)) { $dfile[] = $row['id']; $dfile = serialize($dfile); $nv_Request->set_Session('dfile', $dfile); $sql = 'UPDATE ' . NV_PREFIXLANG . '_' . $module_data . ' SET view_hits=view_hits+1 WHERE id=' . $row['id']; $db->query($sql); ++$row['view_hits']; } // comment if (isset($site_mods['comment']) and isset($module_config[$module_name]['activecomm'])) { define('NV_COMM_ID', $row['id']); define('NV_COMM_ALLOWED', nv_user_in_groups($row['groups_comment'])); // Kiem tra quyen dang binh luan $allowed = $module_config[$module_name]['allowed_comm']; if ($allowed == '-1') { // Quyen han dang binh luan theo bai viet $allowed = defined('NV_COMM_ALLOWED') ? NV_COMM_ALLOWED : $module_config[$module_name]['setcomm']; } define('NV_PER_PAGE_COMMENT', 5); //per_page_comment require_once NV_ROOTDIR . '/modules/comment/comment.php'; $area = defined('NV_COMM_AREA') ? NV_COMM_AREA : 0; $checkss = md5($module_name . '-' . $area . '-' . NV_COMM_ID . '-' . $allowed . '-' . NV_CACHE_PREFIX); //get url comment $url_info = parse_url($client_info['selfurl']); $content_comment = nv_comment_module($module_name, $checkss, $area, NV_COMM_ID, $allowed, 1); } else {
$cache_file = ''; 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_get_cache($module_name, $cache_file)) != false) { $contents = $cache; } } if (empty($contents)) { $array_data = array(); $base_url = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name; $db->sqlreset()->select('COUNT(*)')->from(NV_PREFIXLANG . '_' . $module_data)->where('status=1'); $all_page = $db->query($db->sql())->fetchColumn(); $db->select('*')->order('id DESC')->limit($per_page)->offset(($page - 1) * $per_page); $_query = $db->query($db->sql()); while ($row = $_query->fetch()) { if (!nv_user_in_groups($global_array_event_cat[$row['catid']]['groups_view']) or !nv_user_in_groups($row['groups_view'])) { continue; } $image = NV_UPLOADS_REAL_DIR . '/' . $module_upload . '/' . $row['homeimgfile']; if ($row['homeimgfile'] != '' and file_exists($image)) { $width = 175; $height = 150; $row['imgsource'] = NV_BASE_SITEURL . NV_UPLOADS_DIR . '/' . $module_upload . '/' . $row['homeimgfile']; $imginfo = nv_is_image($image); $basename = basename($image); if ($imginfo['width'] > $width or $imginfo['height'] > $height) { $basename = preg_replace('/(.*)(\\.[a-zA-Z]+)$/', $module_name . '_' . $row['id'] . '_\\1_' . $width . '-' . $height . '\\2', $basename); if (file_exists(NV_ROOTDIR . '/' . NV_TEMP_DIR . '/' . $basename)) { $row['imgsource'] = NV_BASE_SITEURL . NV_TEMP_DIR . '/' . $basename; } else { require_once NV_ROOTDIR . '/includes/class/image.class.php';
/** * @Project PHOTOS 4.x * @Author KENNY NGUYEN (nguyentiendat713@gmail.com) * @Copyright (C) 2015 tradacongnghe.com. All rights reserved * @Based on NukeViet CMS * @License GNU/GPL version 2 or any later version * @Createdate Fri, 18 Sep 2015 11:52:59 GMT */ if (!defined('NV_IS_MOD_PHOTO')) { die('Stop!!!'); } $contents = ''; $date_added = 0; $per_page = $module_config[$module_name]['per_page_photo']; // kiem tra tu cach xem album if (nv_user_in_groups($global_photo_cat[$category_id]['groups_view'])) { // truy van lay thong tin album $query = $db->query('SELECT a.*, r.file, r.thumb FROM ' . TABLE_PHOTO_NAME . '_album a LEFT JOIN ' . TABLE_PHOTO_NAME . '_rows r ON ( a.album_id = r.album_id ) WHERE a.status= 1 AND r.defaults = 1 AND a.album_id = ' . $album_id); $album = $query->fetch(); if ($album['album_id'] > 0) { if (defined('NV_IS_MODADMIN') or $album['status'] == 1) { // cap nhat luot xem $time_set = $nv_Request->get_int($module_data . '_' . $op . '_' . $album['album_id'], 'session'); if (empty($time_set)) { $nv_Request->set_Session($module_data . '_' . $op . '_' . $album['album_id'], NV_CURRENTTIME); $db->query('UPDATE ' . TABLE_PHOTO_NAME . '_album SET viewed=viewed+1 WHERE album_id=' . $album['album_id']); } if ($alias_url == $album['alias']) { $date_added = intval($album['date_added']);
<?php /** * @Project NUKEVIET 4.x * @Author VINADES.,JSC (contact@vinades.vn) * @Copyright (C) 2010 - 2014 VINADES.,JSC. All rights reserved * @License GNU/GPL version 2 or any later version * @Createdate Sun, 08 Apr 2012 00:00:00 GMT */ if (!defined('NV_IS_MOD_USER')) { die('Stop!!!'); } $page_title = $module_info['funcs'][$op]['func_custom_name']; $key_words = $module_info['keywords']; $mod_title = $lang_module['listusers']; if (!nv_user_in_groups($global_config['whoviewuser'])) { header('Location: ' . nv_url_rewrite(NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name)); die; } // Them vao tieu de $array_mod_title[] = array('catid' => 0, 'title' => $lang_module['listusers'], 'link' => NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=' . $op); // Xem chi tiet thanh vien if (isset($array_op[1]) && !empty($array_op[1])) { $md5 = ''; unset($matches); if (preg_match('/^(.*)\\-([a-z0-9]{32})$/', $array_op[1], $matches)) { $md5 = $matches[2]; } if (!empty($md5)) { $stmt = $db->prepare('SELECT * FROM ' . NV_MOD_TABLE . ' WHERE md5username = :md5'); $stmt->bindParam(':md5', $md5, PDO::PARAM_STR);
/** * nv_blocks_get_content() * * @return */ function nv_blocks_content($sitecontent) { global $db, $nv_Cache, $module_info, $module_name, $op, $global_config, $lang_global, $sys_mods, $user_info, $client_info, $themeConfig; $_posAllowed = array(); foreach ($themeConfig['positions']['position'] as $_pos) { $_pos = trim((string) $_pos['tag']); unset($matches); if (preg_match('/^\\[([^\\]]+)\\]$/is', $_pos, $matches)) { $_posAllowed[] = $matches[1]; } } if (empty($_posAllowed)) { return $sitecontent; } //Tim trong noi dung trang cac doan ma phu hop voi cac nhom block tren $_posAllowed = implode('|', array_map('nv_preg_quote', $_posAllowed)); preg_match_all('/\\[(' . $_posAllowed . ')(\\d+)?\\]()/', $sitecontent, $_posReal); if (empty($_posReal[0])) { return $sitecontent; } $_posReal = array_combine($_posReal[0], $_posReal[3]); $cache_file = NV_LANG_DATA . '_' . $global_config['module_theme'] . '_' . $module_name . '_' . NV_CACHE_PREFIX . '.cache'; $blocks = array(); if (($cache = $nv_Cache->getItem('themes', $cache_file)) !== false) { $cache = unserialize($cache); if (isset($cache[$module_info['funcs'][$op]['func_id']])) { $blocks = $cache[$module_info['funcs'][$op]['func_id']]; } unset($cache); } else { $cache = array(); $in = array(); $list = $sys_mods[$module_name]['funcs']; foreach ($list as $row) { if ($row['show_func']) { $in[] = $row['func_id']; } } $_result = $db->query("SELECT t1.*, t2.func_id FROM " . NV_BLOCKS_TABLE . "_groups t1\n\t\t\t INNER JOIN " . NV_BLOCKS_TABLE . "_weight t2\n\t\t\t ON t1.bid = t2.bid\n\t\t\t WHERE t2.func_id IN (" . implode(',', $in) . ")\n\t\t\t AND t1.theme ='" . $global_config['module_theme'] . "'\n\t\t\t AND t1.active!=''\n\t\t\t ORDER BY t2.weight ASC"); while ($_row = $_result->fetch()) { // Cau hinh block $block_config = !empty($_row['config']) ? unserialize($_row['config']) : array(); $block_config['bid'] = $_row['bid']; $block_config['module'] = $_row['module']; $block_config['title'] = $_row['title']; $block_config['block_name'] = substr($_row['file_name'], 0, -4); // Tieu de block $blockTitle = (!empty($_row['title']) and !empty($_row['link'])) ? "<a href=\"" . $_row['link'] . "\">" . $_row['title'] . "</a>" : $_row['title']; if (!isset($cache[$_row['func_id']])) { $cache[$_row['func_id']] = array(); } $cache[$_row['func_id']][] = array('bid' => $_row['bid'], 'position' => $_row['position'], 'module' => $_row['module'], 'blockTitle' => $blockTitle, 'file_name' => $_row['file_name'], 'template' => $_row['template'], 'exp_time' => $_row['exp_time'], 'show_device' => !empty($_row['active']) ? explode(',', $_row['active']) : array(), 'act' => $_row['act'], 'groups_view' => $_row['groups_view'], 'all_func' => $_row['all_func'], 'block_config' => $block_config); } $_result->closeCursor(); if (isset($cache[$module_info['funcs'][$op]['func_id']])) { $blocks = $cache[$module_info['funcs'][$op]['func_id']]; } $cache = serialize($cache); $nv_Cache->setItem('themes', $cache_file, $cache); unset($cache, $in, $block_config, $blockTitle); } if (!empty($blocks)) { $unact = array(); global $blockID; $array_position = array_keys($_posReal); foreach ($blocks as $_key => $_row) { if ($_row['exp_time'] != 0 and $_row['exp_time'] <= NV_CURRENTTIME) { $unact[] = $_row['bid']; continue; } if (!defined('NV_IS_DRAG_BLOCK') and !$_row['act']) { continue; } // Kiem hien thi tren cac thiet bi $_active = false; if (in_array(1, $_row['show_device'])) { $_active = true; } else { if ($client_info['is_mobile'] and in_array(2, $_row['show_device'])) { $_active = true; } elseif ($client_info['is_tablet'] and in_array(3, $_row['show_device'])) { $_active = true; } elseif (!$client_info['is_mobile'] and !$client_info['is_tablet'] and in_array(4, $_row['show_device'])) { $_active = true; } } // Kiem tra quyen xem block if ($_active and in_array($_row['position'], $array_position) and nv_user_in_groups($_row['groups_view'])) { $block_config = $_row['block_config']; $blockTitle = $_row['blockTitle']; $content = ''; $blockID = 'nv' . $_key; if ($_row['module'] == 'theme' and file_exists(NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/blocks/' . $_row['file_name'])) { include NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/blocks/' . $_row['file_name']; } elseif (isset($sys_mods[$_row['module']]['module_file']) and !empty($sys_mods[$_row['module']]['module_file']) and file_exists(NV_ROOTDIR . '/modules/' . $sys_mods[$_row['module']]['module_file'] . '/blocks/' . $_row['file_name'])) { include NV_ROOTDIR . '/modules/' . $sys_mods[$_row['module']]['module_file'] . '/blocks/' . $_row['file_name']; } unset($block_config); if (!empty($content) or defined('NV_IS_DRAG_BLOCK')) { $xtpl = null; $_row['template'] = empty($_row['template']) ? 'default' : $_row['template']; $_template = 'default'; if (!empty($module_info['theme']) and file_exists(NV_ROOTDIR . '/themes/' . $module_info['theme'] . '/layout/block.' . $_row['template'] . '.tpl')) { $xtpl = new XTemplate('block.' . $_row['template'] . '.tpl', NV_ROOTDIR . '/themes/' . $module_info['theme'] . '/layout'); $_template = $module_info['theme']; } elseif (!empty($global_config['module_theme']) and file_exists(NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/layout/block.' . $_row['template'] . '.tpl')) { $xtpl = new XTemplate('block.' . $_row['template'] . '.tpl', NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/layout'); $_template = $global_config['module_theme']; } elseif (!empty($global_config['site_theme']) and file_exists(NV_ROOTDIR . '/themes/' . $global_config['site_theme'] . '/layout/block.' . $_row['template'] . '.tpl')) { $xtpl = new XTemplate('block.' . $_row['template'] . '.tpl', NV_ROOTDIR . '/themes/' . $global_config['site_theme'] . '/layout'); $_template = $global_config['site_theme']; } elseif (file_exists(NV_ROOTDIR . '/themes/default/layout/block.' . $_row['template'] . '.tpl')) { $xtpl = new XTemplate('block.' . $_row['template'] . '.tpl', NV_ROOTDIR . '/themes/default/layout'); } if (!empty($xtpl)) { $xtpl->assign('BLOCK_ID', $_row['bid']); $xtpl->assign('BLOCK_TITLE', $_row['blockTitle']); $xtpl->assign('BLOCK_CONTENT', $content); $xtpl->assign('TEMPLATE', $_template); $xtpl->assign('NV_BASE_SITEURL', NV_BASE_SITEURL); $xtpl->parse('mainblock'); $content = $xtpl->text('mainblock'); } else { $content = $_row['blockTitle'] . '<br />' . $content . '<br />'; } if (defined('NV_IS_DRAG_BLOCK')) { $act_class = $_row['act'] ? '' : ' act0'; $act_title = $_row['act'] ? $lang_global['act_block'] : $lang_global['deact_block']; $act_icon = $_row['act'] ? 'fa fa-check-square-o' : 'fa fa-square-o'; $content = '<div class="portlet" id="bl_' . $_row['bid'] . '"> <div class="tool"> <a href="javascript:void(0)" class="block_content" name="' . $_row['bid'] . '" alt="' . $lang_global['edit_block'] . '" title="' . $lang_global['edit_block'] . '"><em class="fa fa-wrench"></em></a> <a href="javascript:void(0)" class="delblock" name="' . $_row['bid'] . '" alt="' . $lang_global['delete_block'] . '" title="' . $lang_global['delete_block'] . '"><em class="fa fa-trash"></em></a> <a href="javascript:void(0)" class="actblock" name="' . $_row['bid'] . '" alt="' . $act_title . '" title="' . $act_title . '" data-act="' . $lang_global['act_block'] . '" data-deact="' . $lang_global['deact_block'] . '"><em class="' . $act_icon . '" data-act="fa fa-check-square-o" data-deact="fa fa-square-o"></em></a> <a href="javascript:void(0)" class="outgroupblock" name="' . $_row['bid'] . '" alt="' . $lang_global['outgroup_block'] . '" title="' . $lang_global['outgroup_block'] . '"><em class="fa fa-share-square-o"></em></a> </div> <div class="blockct' . $act_class . '">' . $content . '</div> </div>'; } $_posReal[$_row['position']] .= $content; } } } if (!empty($unact)) { $db->query('UPDATE ' . NV_BLOCKS_TABLE . '_groups SET act=0 WHERE bid IN (' . implode(',', $unact) . ')'); $nv_Cache->delMod('themes', NV_LANG_DATA); } } if (defined('NV_IS_DRAG_BLOCK')) { $array_keys = array_keys($_posReal); foreach ($array_keys as $__pos) { $__pos_name = str_replace(array('[', ']'), array('', ''), $__pos); $_posReal[$__pos] = '<div class="column" id="' . preg_replace('#\\[|\\]#', '', $__pos) . '">' . $_posReal[$__pos]; $_posReal[$__pos] .= '<a href="javascript:void(0);" class="add block_content" id="' . $__pos . '" title="' . $lang_global['add_block'] . ' ' . $__pos_name . '" alt="' . $lang_global['add_block'] . '"><em class="fa fa-plus"></em></a>'; $_posReal[$__pos] .= '</div>'; } } $sitecontent = str_replace(array_keys($_posReal), array_values($_posReal), $sitecontent); return $sitecontent; }
function nv_block_form_content($block_config) { global $db, $site_mods, $module_info, $module_name, $lang_module, $my_head, $user_info; $module = $block_config['module']; $filled = false; $answer_info = $old_answer_info = $form_info = array(); $form_info = $db->query('SELECT * FROM ' . NV_PREFIXLANG . '_' . $site_mods[$module]['module_data'] . ' WHERE status = 1 AND id = ' . $block_config['formid'])->fetch(); if (!empty($form_info)) { if ($form_info['start_time'] > NV_CURRENTTIME or $form_info['end_time'] > 0 and $form_info['end_time'] < NV_CURRENTTIME or !nv_user_in_groups($form_info['groups_view'])) { return ''; } else { // Lấy thông tin câu hỏi $question_info = $db->query("SELECT * FROM " . NV_PREFIXLANG . '_' . $site_mods[$module]['module_data'] . "_question WHERE fid = " . $block_config['formid'] . " AND status = 1 ORDER BY weight")->fetchAll(); // Trạng thái trả lời if (defined('NV_IS_USER')) { $sql = "SELECT * FROM " . NV_PREFIXLANG . '_' . $site_mods[$module]['module_data'] . "_answer WHERE fid = " . $block_config['formid'] . " AND who_answer = " . $user_info['userid']; $_rows = $db->query($sql)->fetch(); if ($_rows) { $filled = true; $form_info['filled'] = true; $answer_info = unserialize($_rows['answer']); } if (!empty($answer_info) and !$block_config['dis_form_answered']) { return ''; } } if (file_exists(NV_ROOTDIR . '/themes/' . $module_info['template'] . '/modules/' . $site_mods[$module]['module_file'] . '/block_form_content.tpl')) { $block_theme = $module_info['template']; } else { $block_theme = 'default'; } if ($module != $module_name) { $my_head .= "<script type=\"text/javascript\" src=\"" . NV_BASE_SITEURL . "js/jquery/jquery.validate.min.js\"></script>\n"; $my_head .= "<script type=\"text/javascript\" src=\"" . NV_BASE_SITEURL . "js/language/jquery.validator-" . NV_LANG_INTERFACE . ".js\"></script>\n"; $my_head .= "<script type=\"text/javascript\">\n"; $my_head .= "\$(document).ready(function(){\n\t\t\t\t\t\t\t\t\$('#question_form').validate({\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t });"; $my_head .= " </script>\n"; if (file_exists(NV_ROOTDIR . '/modules/' . $site_mods[$module]['module_file'] . '/language/' . NV_LANG_DATA . '.php')) { require_once NV_ROOTDIR . '/modules/' . $site_mods[$module]['module_file'] . '/language/' . NV_LANG_DATA . '.php'; } } else { return ''; } $xtpl = new XTemplate('block_form_content.tpl', NV_ROOTDIR . '/themes/' . $block_theme . '/modules/' . $site_mods[$module]['module_file']); $xtpl->assign('LANG', $lang_module); $xtpl->assign('FORM', $form_info); $xtpl->assign('NV_BASE_SITEURL', NV_BASE_SITEURL); $xtpl->assign('FORM_ACTION', NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module . '/' . $form_info['id'] . '-' . $form_info['alias']); if ($block_config['dis_form_info']) { $xtpl->parse('main.form_info'); } if ($form_info['question_display'] == 'question_display_left') { $xtpl->assign('FORM_LEFT', 'class="form-horizontal"'); } foreach ($question_info as $row) { $row['value'] = isset($answer_info[$row['qid']]) ? $answer_info[$row['qid']] : ''; $row['required'] = $row['required'] ? 'required' : ''; $xtpl->assign('QUESTION', $row); if ($row['required']) { $xtpl->parse('main.loop.required'); } if ($row['question_type'] == 'textbox' or $row['question_type'] == 'number') { if ($answer_info and !$row['user_editable'] and isset($form_info['filled'])) { $row['readonly'] = 'readonly="readonly"'; } $xtpl->assign('QUESTION', $row); $xtpl->parse('main.loop.textbox'); } elseif ($row['question_type'] == 'date') { $row['value'] = empty($row['value']) ? '' : date('d/m/Y', $row['value']); $row['datepicker'] = ($answer_info and !$row['user_editable'] and isset($form_info['filled'])) ? '' : 'datepicker'; $xtpl->assign('QUESTION', $row); $xtpl->parse('main.loop.date'); } elseif ($row['question_type'] == 'textarea') { if ($answer_info and !$row['user_editable'] and isset($form_info['filled'])) { $row['readonly'] = 'readonly'; } $row['value'] = nv_htmlspecialchars(nv_br2nl($row['value'])); $xtpl->assign('QUESTION', $row); $xtpl->parse('main.loop.textarea'); } elseif ($row['question_type'] == 'editor') { if (defined('NV_EDITOR')) { require_once NV_ROOTDIR . '/' . NV_EDITORSDIR . '/' . NV_EDITOR . '/nv.php'; } elseif (!nv_function_exists('nv_aleditor') and file_exists(NV_ROOTDIR . '/' . NV_EDITORSDIR . '/ckeditor/ckeditor_php5.php')) { define('NV_EDITOR', true); define('NV_IS_CKEDITOR', true); require_once NV_ROOTDIR . '/' . NV_EDITORSDIR . '/ckeditor/ckeditor_php5.php'; function nv_aleditor($textareaname, $width = '100%', $height = '450px', $val = '') { // Create class instance. $editortoolbar = array(array('Link', 'Unlink', 'Image', 'Table', 'Font', 'FontSize', 'RemoveFormat'), array('Bold', 'Italic', 'Underline', 'StrikeThrough', '-', 'Subscript', 'Superscript', '-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock', 'OrderedList', 'UnorderedList', '-', 'Outdent', 'Indent', 'TextColor', 'BGColor', 'Source')); $CKEditor = new CKEditor(); // Do not print the code directly to the browser, return it instead $CKEditor->returnOutput = true; $CKEditor->config['skin'] = 'kama'; $CKEditor->config['entities'] = false; // $CKEditor->config['enterMode'] = 2; $CKEditor->config['language'] = NV_LANG_INTERFACE; $CKEditor->config['toolbar'] = $editortoolbar; // Path to CKEditor directory, ideally instead of relative dir, use an // absolute path: // $CKEditor->basePath = '/ckeditor/' // If not set, CKEditor will try to detect the correct path. $CKEditor->basePath = NV_BASE_SITEURL . NV_EDITORSDIR . '/ckeditor/'; // Set global configuration (will be used by all instances of CKEditor). if (!empty($width)) { $CKEditor->config['width'] = strpos($width, '%') ? $width : intval($width); } if (!empty($height)) { $CKEditor->config['height'] = strpos($height, '%') ? $height : intval($height); } // Change default textarea attributes $CKEditor->textareaAttributes = array('cols' => 80, 'rows' => 10); $val = nv_unhtmlspecialchars($val); return $CKEditor->editor($textareaname, $val); } } if (defined('NV_EDITOR') and nv_function_exists('nv_aleditor')) { $row['value'] = nv_htmlspecialchars(nv_editor_br2nl($row['value'])); $edits = nv_aleditor('question[' . $row['qid'] . ']', '100%', '350px', $row['value']); $xtpl->assign('EDITOR', $edits); $xtpl->parse('main.loop.editor'); } else { $row['value'] = nv_htmlspecialchars(nv_br2nl($row['value'])); $row['class'] = ''; $xtpl->assign('QUESTION', $row); $xtpl->parse('main.loop.textarea'); } } elseif ($row['question_type'] == 'select') { $row['question_choices'] = unserialize($row['question_choices']); foreach ($row['question_choices'] as $key => $value) { $xtpl->assign('QUESTION_CHOICES', array('key' => $key, 'selected' => $key == $row['value'] ? ' selected="selected"' : '', "value" => $value)); $xtpl->parse('main.loop.select.loop'); } if ($answer_info and !$row['user_editable'] and isset($form_info['filled'])) { $row['readonly'] = 'readonly="readonly"'; } $xtpl->assign('QUESTION', $row); $xtpl->parse('main.loop.select'); } elseif ($row['question_type'] == 'radio') { $number = 0; $row['question_choices'] = unserialize($row['question_choices']); foreach ($row['question_choices'] as $key => $value) { $row['readonly'] = ''; if ($answer_info and !$row['user_editable'] and isset($form_info['filled'])) { $row['readonly'] = 'onclick="return false;"'; } $xtpl->assign('QUESTION_CHOICES', array('id' => $row['qid'] . '_' . $number++, 'key' => $key, 'checked' => $key == $row['value'] ? ' checked="checked"' : '', 'readonly' => $row['readonly'], "value" => $value)); $xtpl->parse('main.loop.radio'); } } elseif ($row['question_type'] == 'checkbox') { $row['readonly'] = ''; if ($answer_info and !$row['user_editable'] and isset($form_info['filled'])) { $row['readonly'] = 'onclick="return false;"'; } $number = 0; $row['question_choices'] = unserialize($row['question_choices']); $valuecheckbox = !empty($row['value']) ? explode(',', $row['value']) : array(); foreach ($row['question_choices'] as $key => $value) { $xtpl->assign('QUESTION_CHOICES', array('id' => $row['qid'] . '_' . $number++, 'key' => $key, 'checked' => in_array($key, $valuecheckbox) ? ' checked="checked"' : '', 'readonly' => $row['readonly'], "value" => $value)); $xtpl->parse('main.loop.checkbox'); } } elseif ($row['question_type'] == 'multiselect') { $valueselect = !empty($row['value']) ? explode(',', $row['value']) : array(); $row['question_choices'] = unserialize($row['question_choices']); foreach ($row['question_choices'] as $key => $value) { $xtpl->assign('QUESTION_CHOICES', array('key' => $key, 'selected' => in_array($key, $valueselect) ? ' selected="selected"' : '', "value" => $value)); $xtpl->parse('main.loop.multiselect.loop'); } if ($answer_info and !$row['user_editable'] and isset($form_info['filled'])) { $row['readonly'] = 'readonly="readonly"'; } $xtpl->assign('QUESTION', $row); $xtpl->parse('main.loop.multiselect'); } if ($form_info['question_display'] == 'question_display_left') { $xtpl->assign('LEFT', array('label' => 'class="col-sm-6 control-label"', 'div' => 'class="col-sm-18"')); } $xtpl->parse('main.loop'); } $xtpl->parse('main'); return $xtpl->text('main'); } } }
/** * @param string $module * @param integer $area * @param integer $id * @param int $allowed_comm * @param string $checkss * @param string $comment * @param int $sortcomm * @param string $base_url * @param boolean $form_login * @param int $status_comment * @return string */ function nv_theme_comment_module($module, $area, $id, $allowed_comm, $checkss, $comment, $sortcomm, $base_url, $form_login, $status_comment = '') { global $global_config, $module_file, $module_data, $module_config, $admin_info, $user_info, $lang_global, $client_info, $lang_module_comment, $module_name; $template = file_exists(NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/modules/comment/main.tpl') ? $global_config['module_theme'] : 'default'; $xtpl = new XTemplate('main.tpl', NV_ROOTDIR . '/themes/' . $template . '/modules/comment'); $xtpl->assign('LANG', $lang_module_comment); $xtpl->assign('GLANG', $lang_global); $xtpl->assign('TEMPLATE', $template); $xtpl->assign('CHECKSS_COMM', $checkss); $xtpl->assign('MODULE_COMM', $module); $xtpl->assign('MODULE_DATA', $module_data); $xtpl->assign('AREA_COMM', $area); $xtpl->assign('ID_COMM', $id); $xtpl->assign('ALLOWED_COMM', $allowed_comm); $xtpl->assign('BASE_URL_COMM', $base_url); if (defined('NV_COMM_ID')) { // Check call module js file if (file_exists(NV_ROOTDIR . '/themes/' . $template . '/js/comment.js')) { $xtpl->parse('main.header.jsfile'); } // Check call module css file if (file_exists(NV_ROOTDIR . '/themes/' . $template . '/css/comment.css')) { $xtpl->parse('main.header.cssfile'); } $xtpl->parse('main.header'); } // Order by comm for ($i = 0; $i <= 2; ++$i) { $xtpl->assign('OPTION', array('key' => $i, 'title' => $lang_module_comment['sortcomm_' . $i], 'selected' => $i == $sortcomm ? ' selected="selected"' : '')); $xtpl->parse('main.sortcomm'); } if (!empty($comment)) { $xtpl->assign('COMMENTCONTENT', $comment); $xtpl->parse('main.showContent'); } $allowed_comm = nv_user_in_groups($allowed_comm); if ($allowed_comm) { if (defined('NV_IS_USER')) { $xtpl->assign('NAME', $user_info['full_name']); $xtpl->assign('EMAIL', $user_info['email']); $xtpl->assign('DISABLED', ' disabled="disabled"'); } else { $xtpl->assign('NAME', ''); $xtpl->assign('EMAIL', ''); $xtpl->assign('DISABLED', ''); } $captcha = intval($module_config[$module]['captcha']); $show_captcha = true; if ($captcha == 0) { $show_captcha = false; } elseif ($captcha == 1 and defined('NV_IS_USER')) { $show_captcha = false; } elseif ($captcha == 2 and defined('NV_IS_MODADMIN')) { if (defined('NV_IS_SPADMIN')) { $show_captcha = false; } else { $adminscomm = explode(',', $module_config[$module]['adminscomm']); if (in_array($admin_info['admin_id'], $adminscomm)) { $show_captcha = false; } } } if ($show_captcha) { $xtpl->assign('N_CAPTCHA', $lang_global['securitycode']); $xtpl->assign('CAPTCHA_REFRESH', $lang_global['captcharefresh']); $xtpl->assign('GFX_NUM', NV_GFX_NUM); $xtpl->assign('GFX_WIDTH', NV_GFX_WIDTH); $xtpl->assign('GFX_WIDTH', NV_GFX_WIDTH); $xtpl->assign('GFX_HEIGHT', NV_GFX_HEIGHT); $xtpl->assign('CAPTCHA_REFR_SRC', NV_BASE_SITEURL . NV_FILES_DIR . '/images/refresh.png'); $xtpl->assign('SRC_CAPTCHA', NV_BASE_SITEURL . 'index.php?scaptcha=captcha&t=' . NV_CURRENTTIME); $xtpl->parse('main.allowed_comm.captcha'); } else { $xtpl->assign('GFX_NUM', 0); } if (!empty($status_comment)) { $status_comment = nv_base64_decode($status_comment); $xtpl->assign('STATUS_COMMENT', $status_comment); $xtpl->parse('main.allowed_comm.comment_result'); } $xtpl->parse('main.allowed_comm'); } elseif ($form_login) { $link_login = 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'] . '#formcomment'); $xtpl->assign('COMMENT_LOGIN', '<a title="' . $lang_global['loginsubmit'] . '" href="' . $link_login . '">' . $lang_module_comment['comment_login'] . '</a>'); $xtpl->parse('main.form_login'); } $xtpl->parse('main'); return $xtpl->text('main'); }
/** * nv_menu_top_menu() * * @param mixed $block_config * @return */ function nv_menu_top_menu($block_config) { global $db, $db_config, $global_config, $site_mods, $module_info, $module_name, $module_file, $module_data, $lang_global, $catid, $home; if (file_exists(NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/blocks/global.top_menu.tpl')) { $block_theme = $global_config['module_theme']; } elseif (file_exists(NV_ROOTDIR . '/themes/' . $global_config['site_theme'] . '/blocks/global.top_menu.tpl')) { $block_theme = $global_config['site_theme']; } else { $block_theme = 'default'; } $array_menu = array(); $sql = 'SELECT id, parentid, title, link, 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, '', 'menu'); foreach ($list as $row) { if (nv_user_in_groups($row['groups_view'])) { switch ($row['target']) { case 1: $row['target'] = ''; break; default: $row['target'] = ' onclick="this.target=\'_blank\'"'; } $array_menu[$row['parentid']][$row['id']] = array('id' => $row['id'], 'title' => $row['title'], 'title1' => 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), 'css' => $row['css'], 'active_type' => $row['active_type']); } } $xtpl = new XTemplate('global.top_menu.tpl', NV_ROOTDIR . '/themes/' . $block_theme . '/blocks'); $xtpl->assign('LANG', $lang_global); $xtpl->assign('NV_BASE_SITEURL', NV_BASE_SITEURL); $xtpl->assign('BLOCK_THEME', $block_theme); $xtpl->assign('THEME_SITE_HREF', NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA); $xtpl->assign('THEME_RSS_INDEX_HREF', NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&" . NV_NAME_VARIABLE . "=feeds"); $i = 1; foreach ($array_menu[0] as $id => $item) { $classcurrent = array(); if (isset($array_menu[$id])) { $classcurrent[] = 'dropdown'; foreach ($array_menu[$id] as $sid => $sitem) { if (isset($array_menu[$sid])) { foreach ($array_menu[$sid] as $sid2 => $sitem2) { $xtpl->assign('SUB2', $sitem2); $xtpl->parse('main.top_menu.sub.item.sub2.item2'); } $xtpl->parse('main.top_menu.sub.item.sub2'); } $xtpl->assign('SUB', $sitem); $xtpl->parse('main.top_menu.sub.item'); } $xtpl->parse('main.top_menu.sub'); $xtpl->parse('main.top_menu.has_sub'); } if (nv_menu_top_menu_check_current($item['link'], $item['active_type'])) { $classcurrent[] = 'active'; } if (!empty($item['class'])) { $classcurrent[] = $item['class']; } $item['current'] = empty($classcurrent) ? '' : ' class="' . implode(' ', $classcurrent) . '"'; $xtpl->assign('TOP_MENU', $item); $xtpl->parse('main.top_menu'); } // Active home menu if (!empty($home)) { $xtpl->parse('main.home_active'); } $xtpl->parse('main'); return $xtpl->text('main'); }
include NV_ROOTDIR . '/includes/header.php'; echo nv_admin_theme($contents); include NV_ROOTDIR . '/includes/footer.php'; die; } $contents = ''; $publtime = 0; $alias_made_up = change_alias($lang_module['made_up']); $alias_convention = change_alias($lang_module['convention']); $alias_collapse = change_alias($lang_module['collapse']); $alias_anniversary = change_alias($lang_module['anniversary']); $alias_family_tree = change_alias($lang_module['family_tree']); $array_relationships = array(1 => $lang_module['u_relationships_1'], 2 => $lang_module['u_relationships_2'], 3 => $lang_module['u_relationships_3']); $array_gender = array(0 => $lang_module['u_gender_0'], 1 => $lang_module['u_gender_1'], 2 => $lang_module['u_gender_2']); $array_status = array(0 => $lang_module['u_status_0'], 1 => $lang_module['u_status_1'], 2 => $lang_module['u_status_2']); if (nv_user_in_groups($global_array_fam[$fid]['groups_view'])) { $query = $db->query('SELECT * FROM ' . NV_PREFIXLANG . '_' . $module_data . '_' . $fid . ' WHERE alias = "' . $alias_url . '"'); $news_contents = $query->fetch(); if (defined('NV_IS_ADMIN') or $user_info['userid'] == $news_contents['admin_id']) { if ($news_contents['id'] > 0 and $array_op[2] == "Manager") { if ($nv_Request->get_string('submit', 'post') != "") { $post['title'] = $nv_Request->get_string('title', 'post', '', 1); $post['fid'] = $nv_Request->get_int('fid', 'post', 0); $post['cityid'] = $nv_Request->get_int('cityid', 'post', 0); $post['districtid'] = $nv_Request->get_int('districtid', 'post', 0); $post['wardid'] = $nv_Request->get_int('wardid', 'post', 0); $post['bodytext'] = $nv_Request->get_string('bodytext', 'post', ''); $post['bodytext'] = defined('NV_EDITOR') ? nv_nl2br($post['bodytext'], '') : nv_nl2br(nv_htmlspecialchars(strip_tags($post['bodytext'])), '<br />'); $post['bodyhtml'] = $post['bodytext']; $post['listfid'] = $post['fid']; $post['rule'] = $nv_Request->get_string('rule', 'post', '');
/** * @Project NUKEVIET 4.x * @Author VINADES.,JSC (contact@vinades.vn) * @Copyright (C) 2015 VINADES.,JSC. All rights reserved * @License GNU/GPL version 2 or any later version * @Createdate Sun, 10 May 2015 01:36:45 GMT */ if (!defined('NV_IS_MOD_BLOOD_BANK')) { die('Stop!!!'); } $page_title = $module_info['custom_title']; $key_words = $module_info['keywords']; $array_data = array(); $array_history = array(); if (!nv_user_in_groups($array_config['groups_view_member'])) { $redirect = '<meta http-equiv="Refresh" content="4;URL=' . nv_url_rewrite(NV_BASE_SITEURL . 'index.php', true) . '" />'; nv_info_die($lang_module['error_not_permission_title'], $lang_module['error_not_permission_title'], $lang_module['error_not_permission_content'] . $redirect); exit; } $result = $db->query('SELECT * FROM ' . NV_PREFIXLANG . '_' . $module_data . ' WHERE id=' . $id); if ($result->rowCount() > 0) { $array_data = $result->fetch(); } else { Header('Location: ' . nv_url_rewrite(NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name, true)); die; } $row['photo'] = ''; $result = $db->query('SELECT photo FROM ' . NV_USERS_GLOBALTABLE . ' WHERE userid=' . $array_data['userid']); if ($result->rowCount() > 0) { $array_data['photo'] = $result->fetchColumn();
if (!empty($array_tmp)) { foreach ($array_tmp as $f_key => $field) { foreach ($field as $key_lang => $lang_data) { if ($key_lang == NV_LANG_DATA) { $data_content['array_custom_lang'][$f_key] = $lang_data[0]; } } } unset($array_tmp); } } } } $page_title = $data_content[NV_LANG_DATA . '_title']; $description = $data_content[NV_LANG_DATA . '_hometext']; if (nv_user_in_groups($global_array_shops_cat[$catid]['groups_view'])) { $popup = $nv_Request->get_int('popup', 'post,get', 0); $time_set = $nv_Request->get_int($module_data . '_' . $op . '_' . $id, 'session'); if (empty($time_set)) { $nv_Request->set_Session($module_data . '_' . $op . '_' . $id, NV_CURRENTTIME); $sql = 'UPDATE ' . $db_config['prefix'] . '_' . $module_data . '_rows SET hitstotal=hitstotal+1 WHERE id=' . $id; $db->query($sql); } $catid = $data_content['listcatid']; $base_url_rewrite = nv_url_rewrite(NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=' . $global_array_shops_cat[$catid]['alias'] . '/' . $data_content[NV_LANG_DATA . '_alias'] . $global_config['rewrite_exturl'], true); if ($_SERVER['REQUEST_URI'] != $base_url_rewrite and !$popup) { Header('Location: ' . $base_url_rewrite); die; } // Lay don vi san pham $sql = $db->query('SELECT * FROM ' . $db_config['prefix'] . '_' . $module_data . '_units WHERE id = ' . $data_content['product_unit']);
* @Createdate 3-6-2010 0:14 */ if (!defined('NV_IS_MOD_SHOPS')) { die('Stop!!!'); } $id_files = $nv_Request->get_int('id_files', 'get', 0); $id_rows = $nv_Request->get_int('id_rows', 'get', 0); if (empty($id_files) or empty($id_rows)) { die('NO'); } $result = $db->query('SELECT path, download_groups FROM ' . $db_config['prefix'] . '_' . $module_data . '_files WHERE id=' . $id_files); list($path, $download_groups) = $result->fetch(3); if ($download_groups == '-1') { $download_groups = $pro_config['download_groups']; } if (nv_user_in_groups($download_groups)) { if (!empty($path)) { // Cap nhat luot download $db->query('UPDATE ' . $db_config['prefix'] . '_' . $module_data . '_files_rows SET download_hits=download_hits+1 WHERE id_rows=' . $id_rows . ' AND id_files=' . $id_files); if (nv_is_url($path)) { Header('Location: ' . $path); die; } else { $download = new download(NV_ROOTDIR . '/' . NV_UPLOADS_DIR . '/' . $module_upload . '/files/' . $path, NV_UPLOADS_REAL_DIR); $download->download_file(); exit; } } } else { die('NO'); }
/** * nv_blocks_get_content() * * @return */ function nv_blocks_content($sitecontent) { global $db, $module_info, $module_name, $op, $global_config, $lang_global, $sys_mods, $user_info, $client_info, $themeConfig; $_posAllowed = array(); foreach ($themeConfig['positions']['position'] as $_pos) { $_pos = trim((string) $_pos['tag']); unset($matches); if (preg_match('/^\\[([^\\]]+)\\]$/is', $_pos, $matches)) { $_posAllowed[] = $matches[1]; } } if (empty($_posAllowed)) { return $sitecontent; } //Tim trong noi dung trang cac doan ma phu hop voi cac nhom block tren $_posAllowed = implode('|', array_map('nv_preg_quote', $_posAllowed)); preg_match_all('/\\[(' . $_posAllowed . ')(\\d+)?\\]()/', $sitecontent, $_posReal); if (empty($_posReal[0])) { return $sitecontent; } $_posReal = array_combine($_posReal[0], $_posReal[3]); $cache_file = NV_LANG_DATA . '_' . $global_config['module_theme'] . '_' . $module_name . '_' . NV_CACHE_PREFIX . '.cache'; $blocks = array(); if (($cache = nv_get_cache('themes', $cache_file)) !== false) { $cache = unserialize($cache); if (isset($cache[$module_info['funcs'][$op]['func_id']])) { $blocks = $cache[$module_info['funcs'][$op]['func_id']]; } unset($cache); } else { $cache = array(); $in = array(); $list = $sys_mods[$module_name]['funcs']; foreach ($list as $row) { if ($row['show_func']) { $in[] = $row['func_id']; } } $_result = $db->query("SELECT t1.*, t2.func_id FROM " . NV_BLOCKS_TABLE . "_groups t1\n\t\t\t INNER JOIN " . NV_BLOCKS_TABLE . "_weight t2\n\t\t\t ON t1.bid = t2.bid\n\t\t\t WHERE t2.func_id IN (" . implode(',', $in) . ")\n\t\t\t AND t1.theme ='" . $global_config['module_theme'] . "'\n\t\t\t AND t1.active=1\n\t\t\t ORDER BY t2.weight ASC"); while ($_row = $_result->fetch()) { // Cau hinh block $block_config = !empty($_row['config']) ? unserialize($_row['config']) : array(); $block_config['bid'] = $_row['bid']; $block_config['module'] = $_row['module']; $block_config['title'] = $_row['title']; $block_config['block_name'] = substr($_row['file_name'], 0, -4); // Tieu de block $blockTitle = (!empty($_row['title']) and !empty($_row['link'])) ? "<a href=\"" . $_row['link'] . "\">" . $_row['title'] . "</a>" : $_row['title']; if (!isset($cache[$_row['func_id']])) { $cache[$_row['func_id']] = array(); } $cache[$_row['func_id']][] = array('bid' => $_row['bid'], 'position' => $_row['position'], 'module' => $_row['module'], 'blockTitle' => $blockTitle, 'file_name' => $_row['file_name'], 'template' => $_row['template'], 'exp_time' => $_row['exp_time'], 'hide_device' => $_row['hide_device'], 'groups_view' => $_row['groups_view'], 'all_func' => $_row['all_func'], 'block_config' => $block_config); } $_result->closeCursor(); if (isset($cache[$module_info['funcs'][$op]['func_id']])) { $blocks = $cache[$module_info['funcs'][$op]['func_id']]; } $cache = serialize($cache); nv_set_cache('themes', $cache_file, $cache); unset($cache, $in, $block_config, $blockTitle); } if (!empty($blocks)) { $unact = array(); $array_position = array_keys($_posReal); foreach ($blocks as $_row) { if ($_row['exp_time'] != 0 and $_row['exp_time'] <= NV_CURRENTTIME) { $unact[] = $_row['bid']; continue; } if ($client_info['is_mobile'] and ($_row['hide_device'] == 1 or $_row['hide_device'] == 3)) { //?n tr�n mobile continue; } elseif ($client_info['is_tablet'] and ($_row['hide_device'] == 2 or $_row['hide_device'] == 3)) { // ?n tr�n M�y t�nh b?ng continue; } //Kiem tra quyen xem block if (in_array($_row['position'], $array_position) and nv_user_in_groups($_row['groups_view'])) { $block_config = $_row['block_config']; $blockTitle = $_row['blockTitle']; $content = ''; if ($_row['module'] == 'theme' and file_exists(NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/blocks/' . $_row['file_name'])) { include NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/blocks/' . $_row['file_name']; } elseif (isset($sys_mods[$_row['module']]['module_file']) and !empty($sys_mods[$_row['module']]['module_file']) and file_exists(NV_ROOTDIR . '/modules/' . $sys_mods[$_row['module']]['module_file'] . '/blocks/' . $_row['file_name'])) { include NV_ROOTDIR . '/modules/' . $sys_mods[$_row['module']]['module_file'] . '/blocks/' . $_row['file_name']; } unset($block_config); if (!empty($content) or defined('NV_IS_DRAG_BLOCK')) { $xtpl = null; $_row['template'] = empty($_row['template']) ? 'default' : $_row['template']; $_template = 'default'; if (!empty($module_info['theme']) and file_exists(NV_ROOTDIR . '/themes/' . $module_info['theme'] . '/layout/block.' . $_row['template'] . '.tpl')) { $xtpl = new XTemplate('block.' . $_row['template'] . '.tpl', NV_ROOTDIR . '/themes/' . $module_info['theme'] . '/layout'); $_template = $module_info['theme']; } elseif (!empty($global_config['module_theme']) and file_exists(NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/layout/block.' . $_row['template'] . '.tpl')) { $xtpl = new XTemplate('block.' . $_row['template'] . '.tpl', NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/layout'); $_template = $global_config['module_theme']; } elseif (!empty($global_config['site_theme']) and file_exists(NV_ROOTDIR . '/themes/' . $global_config['site_theme'] . '/layout/block.' . $_row['template'] . '.tpl')) { $xtpl = new XTemplate('block.' . $_row['template'] . '.tpl', NV_ROOTDIR . '/themes/' . $global_config['site_theme'] . '/layout'); $_template = $global_config['site_theme']; } elseif (file_exists(NV_ROOTDIR . '/themes/default/layout/block.' . $_row['template'] . '.tpl')) { $xtpl = new XTemplate('block.' . $_row['template'] . '.tpl', NV_ROOTDIR . '/themes/default/layout'); } if (!empty($xtpl)) { $xtpl->assign('BLOCK_ID', $_row['bid']); $xtpl->assign('BLOCK_TITLE', $_row['blockTitle']); $xtpl->assign('BLOCK_CONTENT', $content); $xtpl->assign('TEMPLATE', $_template); $xtpl->assign('NV_BASE_SITEURL', NV_BASE_SITEURL); $xtpl->parse('mainblock'); $content = $xtpl->text('mainblock'); } else { $content = $_row['blockTitle'] . '<br />' . $content . '<br />'; } if (defined('NV_IS_DRAG_BLOCK')) { $content = '<div class="portlet" id="bl_' . $_row['bid'] . '"> <p> <a href="javascript:void(0)" class="block_content" name="' . $_row['bid'] . '"> <img style="border:none" src="' . NV_BASE_SITEURL . NV_FILES_DIR . '/images/edit.png" alt="' . $lang_global['edit_block'] . '"/> ' . $lang_global['edit_block'] . '</a> | <a href="javascript:void(0)" class="delblock" name="' . $_row['bid'] . '"> <img style="border:none" src="' . NV_BASE_SITEURL . NV_FILES_DIR . '/images/delete.png" alt="' . $lang_global['delete_block'] . '"/> ' . $lang_global['delete_block'] . '</a> | <a href="javascript:void(0)" class="outgroupblock" name="' . $_row['bid'] . '"> <img style="border:none" src="' . NV_BASE_SITEURL . NV_FILES_DIR . '/images/outgroup.png" alt="' . $lang_global['outgroup_block'] . '"/> ' . $lang_global['outgroup_block'] . '</a> </p> ' . $content . '</div>'; } $_posReal[$_row['position']] .= $content; } } } if (!empty($unact)) { $db->query('UPDATE ' . NV_BLOCKS_TABLE . '_groups SET active=0 WHERE bid IN (' . implode(',', $unact) . ')'); unlink($cache_file); } } if (defined('NV_IS_DRAG_BLOCK')) { $array_keys = array_keys($_posReal); foreach ($array_keys as $__pos) { $_posReal[$__pos] = '<div class="column" id="' . preg_replace('#\\[|\\]#', '', $__pos) . '">' . $_posReal[$__pos]; $_posReal[$__pos] .= ' <span><a class="block_content" id="' . $__pos . '" href="javascript:void(0)"><img style="border:none" src="' . NV_BASE_SITEURL . NV_FILES_DIR . '/images/add.png" alt="' . $lang_global['add_block'] . '"/> ' . $lang_global['add_block'] . '</a></span>'; $_posReal[$__pos] .= '</div>'; } } $sitecontent = str_replace(array_keys($_posReal), array_values($_posReal), $sitecontent); return $sitecontent; }
/** * nv_menu_navbar() * * @param mixed $block_config * @return */ function nv_menu_navbar($block_config) { global $db, $db_config, $global_config, $site_mods, $module_info, $module_name, $module_file, $module_data, $lang_global, $catid, $home; if (file_exists(NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/blocks/global.navbar.tpl')) { $block_theme = $global_config['module_theme']; } elseif (file_exists(NV_ROOTDIR . '/themes/' . $global_config['site_theme'] . '/blocks/global.navbar.tpl')) { $block_theme = $global_config['site_theme']; } else { $block_theme = 'default'; } $array_menu = array(); $sql = 'SELECT id, parentid, title, link, 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, '', 'menu'); foreach ($list as $row) { if (nv_user_in_groups($row['groups_view'])) { switch ($row['target']) { case 1: $row['target'] = ''; break; default: $row['target'] = ' onclick="this.target=\'_blank\'"'; } $array_menu[$row['parentid']][$row['id']] = array('id' => $row['id'], 'title' => 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), 'css' => $row['css'], 'active_type' => $row['active_type']); } } $xtpl = new XTemplate('global.navbar.tpl', NV_ROOTDIR . '/themes/' . $block_theme . '/blocks'); $xtpl->assign('LANG', $lang_global); $xtpl->assign('NV_BASE_SITEURL', NV_BASE_SITEURL); $xtpl->assign('THEME_SEARCH_SUBMIT_ONCLICK', "nv_search_submit('topmenu_search_query', 'topmenu_search_submit', " . NV_MIN_SEARCH_LENGTH . ", " . NV_MAX_SEARCH_LENGTH . ");"); $xtpl->assign('THEME_SEARCH_QUERY_MAX_LENGTH', NV_MAX_SEARCH_LENGTH); $i = 1; foreach ($array_menu[0] as $id => $item) { $classcurrent = array(); if (isset($array_menu[$id])) { $classcurrent[] = 'dropdown'; foreach ($array_menu[$id] as $sid => $sitem) { if (isset($array_menu[$sid])) { foreach ($array_menu[$sid] as $sid2 => $sitem2) { $xtpl->assign('SUB2', $sitem2); $xtpl->parse('main.navbar.sub.item.sub2.item2'); } $xtpl->parse('main.navbar.sub.item.sub2'); } $xtpl->assign('SUB', $sitem); $xtpl->parse('main.navbar.sub.item'); } $xtpl->parse('main.navbar.sub'); $xtpl->parse('main.navbar.has_sub'); } if (nv_menu_navbar_check_current($item['link'], $item['active_type'])) { $classcurrent[] = 'active'; } if (!empty($item['class'])) { $classcurrent[] = $item['class']; } $item['current'] = empty($classcurrent) ? '' : implode(' ', $classcurrent); $xtpl->assign('navbar', $item); $xtpl->parse('main.navbar'); } $xtpl->parse('main'); return $xtpl->text('main'); }