function nv_block_album_new($block_config) { global $module_photo_category, $module_info, $site_mods, $module_config, $global_config, $db; $module = $block_config['module']; $mod_data = $site_mods[$module]['module_data']; $mod_file = $site_mods[$module]['module_file']; $db->sqlreset()->select('a.album_id, a.category_id, a.name, a.alias, a.capturelocal, a.description, a.num_photo, a.date_added, r.file, r.thumb')->from(NV_PREFIXLANG . '_' . $mod_data . '_album a LEFT JOIN ' . NV_PREFIXLANG . '_' . $mod_data . '_rows r ON ( a.album_id = r.album_id )')->where('a.status= 1 AND r.defaults = 1')->order('a.date_added DESC')->limit($block_config['numrow']); $list = nv_db_cache($db->sql(), 'album_id', $module); if (!empty($list)) { if (file_exists(NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/modules/photo/block_album_new.tpl')) { $block_theme = $global_config['module_theme']; } else { $block_theme = 'default'; } $xtpl = new XTemplate('block_album_new.tpl', NV_ROOTDIR . '/themes/' . $block_theme . '/modules/photo'); foreach ($list as $album) { $album['link'] = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module . '&' . NV_OP_VARIABLE . '=' . $module_photo_category[$album['category_id']]['alias'] . '/' . $album['alias'] . '-' . $album['album_id'] . $global_config['rewrite_exturl']; $album['description'] = strip_tags(nv_clean60($album['description'], 100)); $album['datePublished'] = date('Y-m-d', $album['date_added']); $album['thumb'] = creat_thumbs($album['album_id'], $album['file'], $module, 270, 210, 90); $album['file'] = NV_BASE_SITEURL . NV_UPLOADS_DIR . '/' . $module . '/images/' . $album['file']; $xtpl->assign('ALBUM', $album); $xtpl->parse('main.loop_album'); } $xtpl->parse('main'); return $xtpl->text('main'); } }
function nv_block_config_form_content($module, $data_block, $lang_block) { global $site_mods; $html = ''; $html .= '<tr>'; $html .= '<td>' . $lang_block['formid'] . '</td>'; $html .= '<td><select name="config_formid" class="form-control">'; $html .= '<option value="0"> -- </option>'; $sql = 'SELECT * FROM ' . NV_PREFIXLANG . '_' . $site_mods[$module]['module_data'] . ' WHERE status = 1 ORDER BY weight ASC'; $list = nv_db_cache($sql, '', $module); foreach ($list as $l) { $html .= '<option value="' . $l['id'] . '" ' . ($data_block['formid'] == $l['id'] ? ' selected="selected"' : '') . '>' . $l['title'] . '</option>'; } $html .= '</select>'; $html .= '</tr>'; $html .= '<tr>'; $html .= '<td>' . $lang_block['dis_form_info'] . '</td>'; $ck = $data_block['dis_form_info'] ? 'checked="checked"' : ''; $html .= '<td><input type="checkbox" name="config_dis_form_info" value="1" ' . $ck . ' /></td>'; $html .= '</tr>'; $html .= '<tr>'; $html .= '<td>' . $lang_block['dis_form_answered'] . '</td>'; $ck = $data_block['dis_form_answered'] ? 'checked="checked"' : ''; $html .= '<td><input type="checkbox" name="config_dis_form_answered" value="1" ' . $ck . ' /></td>'; $html .= '</tr>'; return $html; }
/** * nv_mod_down_config() * * @return */ function nv_mod_down_config() { global $module_name, $module_data, $module_name; $sql = "SELECT config_name,config_value FROM " . NV_PREFIXLANG . "_" . $module_data . "_config"; $list = nv_db_cache($sql); $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_weather_blocks($block_config) { global $global_config, $site_mods, $db, $module_name; $module = $block_config['module']; $array_th = array(); $sql = 'SELECT * FROM ' . NV_PREFIXLANG . '_weather WHERE status = 1 ORDER BY weight ASC'; $list = nv_db_cache($sql, '', $module); if (file_exists(NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/modules/weather/block.weather.tpl')) { $block_theme = $global_config['module_theme']; } elseif (file_exists(NV_ROOTDIR . '/themes/' . $global_config['site_theme'] . '/modules/weather/block.weather.tpl')) { $block_theme = $global_config['site_theme']; } else { $block_theme = 'default'; } $xtpl = new XTemplate('block.weather.tpl', NV_ROOTDIR . '/themes/' . $block_theme . '/modules/weather'); $xtpl->assign('TEMPLATE', $block_theme); $xtpl->assign('CODE', $block_config['location']); $xtpl->assign('NUM_DAY', $block_config['numday']); foreach ($list as $row) { $block_config['location'] == $row['location_code'] ? $row['selected'] = ' selected="selected"' : ($row['selected'] = ''); $xtpl->assign('ROW', $row); $xtpl->parse('main.loop'); } $xtpl->parse('main'); return $xtpl->text('main'); }
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; }
/** * nv_block_config_filter_product_cat() * * @param mixed $module * @param mixed $data_block * @param mixed $lang_block * @return */ function nv_block_config_filter_product_cat($module, $data_block, $lang_block) { global $db_config, $site_mods; $html = ''; $html .= "<tr>"; $html .= "\t<td>" . $lang_block['content'] . "</td>"; $sql = 'SELECT * FROM ' . $db_config['prefix'] . '_' . $site_mods[$module]['module_data'] . '_group WHERE parentid = 0 ORDER BY weight'; $list = nv_db_cache($sql, '', $module); $array_style = array('checkbox' => 'Checkbox', 'label' => 'Label', 'image' => 'Image'); $html .= "\t<td><div class=\"row\">"; foreach ($list as $l) { $html .= "<div class=\"col-sm-6\">"; $html .= $l[NV_LANG_DATA . '_title']; $html .= "</div>"; $html .= "<div class=\"col-sm-18\">"; foreach ($array_style as $key => $style) { $ck = $data_block['group_style'][$l['groupid']] == $key ? 'checked="checked"' : ''; $html .= "<label><input type=\"radio\" name=\"config_group_style[" . $l['groupid'] . "]\" value=\"" . $key . "\" " . $ck . " />" . $style . "</label> "; } $html .= "</div>"; } $html .= " </div></td>"; $html .= "</tr>"; return $html; }
/** * nv_page_list() * * @return */ function nv_page_list($block_config) { global $global_config, $site_mods, $db, $module_name; $module = $block_config['module']; if (!isset($site_mods[$module])) { return ''; } $db->sqlreset()->select('id, title, phone,phone1,image')->from(NV_PREFIXLANG . '_' . $site_mods[$module]['module_data'])->where('status = 1')->order('weight ASC')->limit($block_config['numrow']); $list = nv_db_cache($db->sql(), 'id', $module); if (!empty($list)) { if (file_exists(NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/modules/nhan-vien/block.nhanvien.tpl')) { $block_theme = $global_config['module_theme']; } elseif (file_exists(NV_ROOTDIR . '/themes/' . $global_config['site_theme'] . '/modules/nhan-vien/block.nhanvien.tpl')) { $block_theme = $global_config['site_theme']; } else { $block_theme = 'default'; } $xtpl = new XTemplate('block.nhanvien.tpl', NV_ROOTDIR . '/themes/' . $block_theme . '/modules/nhan-vien'); foreach ($list as $l) { $l['img'] = NV_BASE_SITEURL . NV_UPLOADS_DIR . '/' . $site_mods[$module]['module_upload'] . '/' . $l['image']; $xtpl->assign('ROW', $l); $xtpl->parse('main.loop'); } $xtpl->parse('main'); return $xtpl->text('main'); } else { return ''; } }
function nv_mod_down_config($module_data) { global $site_mods, $module_info; $sql = "SELECT `config_name`,`config_value` FROM `" . NV_PREFIXLANG . "_" . $module_data . "_config`"; $list = nv_db_cache($sql); $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_set_allow($download_config['who_addfile'], $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_set_allow($download_config['who_upload'], $download_config['groups_upload']); } else { $download_config['is_upload_allow'] = false; } $download_config['is_autocomment_allow'] = nv_set_allow($download_config['who_autocomment'], $download_config['groups_autocomment']); return $download_config; }
function nv_block_config_tab_catid($module, $data_block, $lang_block) { global $site_mods; $html = ''; $html .= '<tr>'; $html .= '<td>' . $lang_block['config_catid'] . '</td>'; $html .= '<td><select name="config_catid" class="form-control w200">'; $html .= '<option value="0"> --- Chọn chuyên mục --- </option>'; $sql = 'SELECT * FROM ' . NV_PREFIXLANG . '_' . $site_mods[$module]['module_data'] . '_cat ORDER BY sort ASC'; $list = nv_db_cache($sql, '', $module); foreach ($list as $l) { $xtitle_i = ""; if ($l['lev'] > 0) { $xtitle_i .= " |"; for ($i = 1; $i <= $l['lev']; ++$i) { $xtitle_i .= "---"; } $xtitle_i .= "> "; } $xtitle_i .= $l['title'] . '-' . $l['catid']; $html .= '<option value="' . $l['catid'] . '" ' . ($data_block['config_catid'] == $l['catid'] ? ' selected="selected"' : '') . '>' . $xtitle_i . '</option>'; } $html .= '</select>'; $html .= '</td>'; $html .= '</tr>'; $html .= '<tr>'; $html .= '<td>' . $lang_block['config_numrow'] . '</td>'; $html .= '<td><input type="text" class="form-control w200" name="config_numrow" size="5" value="' . $data_block['config_numrow'] . '"/></td>'; $html .= '</tr>'; $html .= '<tr>'; $html .= '<td>' . $lang_block['config_numcut'] . '</td>'; $html .= '<td><input type="text" class="form-control w200" name="config_numcut" size="5" value="' . $data_block['config_numcut'] . '"/></td>'; $html .= '</tr>'; return $html; }
/** * nv_page_list() * * @return */ function nv_page_list($block_config) { global $global_config, $site_mods, $db, $module_name; $module = $block_config['module']; if (!isset($site_mods[$module])) { return ''; } $db->sqlreset()->select('id, title, alias')->from(NV_PREFIXLANG . '_' . $site_mods[$module]['module_data'])->where('status = 1')->order('weight ASC')->limit($block_config['numrow']); $list = nv_db_cache($db->sql(), 'id', $module); if (!empty($list)) { if (file_exists(NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/modules/page/block.page_list.tpl')) { $block_theme = $global_config['module_theme']; } elseif (file_exists(NV_ROOTDIR . '/themes/' . $global_config['site_theme'] . '/modules/page/block.page_list.tpl')) { $block_theme = $global_config['site_theme']; } else { $block_theme = 'default'; } $xtpl = new XTemplate('block.page_list.tpl', NV_ROOTDIR . '/themes/' . $block_theme . '/modules/page'); foreach ($list as $l) { $l['title_clean60'] = nv_clean60($l['title'], $block_config['title_length']); $l['link'] = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module . '&' . NV_OP_VARIABLE . '=' . $l['alias'] . $global_config['rewrite_exturl']; $xtpl->assign('ROW', $l); $xtpl->parse('main.loop'); } $xtpl->parse('main'); return $xtpl->text('main'); } else { return ''; } }
/** * nv_product_center() * * @return */ function nv_product_center($block_config) { global $module_name, $lang_module, $module_info, $module_file, $global_array_shops_cat, $db, $module_data, $db_config, $pro_config, $global_config, $site_mods; $module = $block_config['module']; $num_view = 5; $num = 30; $array = array(); $xtpl = new XTemplate('block.product_center.tpl', NV_ROOTDIR . '/themes/' . $module_info['template'] . '/modules/' . $module_file); $xtpl->assign('LANG', $lang_module); $xtpl->assign('THEME_TEM', NV_BASE_SITEURL . 'themes/' . $module_info['template']); $xtpl->assign('WIDTH', $pro_config['homewidth']); $xtpl->assign('NUMVIEW', $num_view); $cache_file = NV_LANG_DATA . '_block_module_product_center_' . NV_CACHE_PREFIX . '.cache'; if (($cache = nv_get_cache($module_name, $cache_file)) != false) { $array = unserialize($cache); } else { $db->sqlreset()->select('bid')->from($db_config['prefix'] . '_' . $module_data . '_block_cat')->order('weight ASC')->limit(1); $result = $db->query($db->sql()); $bid = $result->fetchColumn(); $db->sqlreset()->select('t1.id, t1.listcatid, t1.' . NV_LANG_DATA . '_title AS title, t1.' . NV_LANG_DATA . '_alias AS alias, t1.homeimgfile, t1.homeimgthumb , t1.homeimgalt, t1.showprice, t1.discount_id')->from($db_config['prefix'] . '_' . $module_data . '_rows t1')->join('INNER JOIN ' . $db_config['prefix'] . '_' . $module_data . '_block t2 ON t1.id = t2.id')->where('t2.bid= ' . $bid . ' AND t1.status =1')->order('t1.id DESC')->limit($num); $array = nv_db_cache($db->sql(), 'id', $module_name); $cache = serialize($array); nv_set_cache($module_name, $cache_file, $cache); } foreach ($array as $row) { $link = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=' . $global_array_shops_cat[$row['listcatid']]['alias'] . '/' . $row['alias'] . $global_config['rewrite_exturl']; if ($row['homeimgthumb'] == 1) { $src_img = NV_BASE_SITEURL . NV_FILES_DIR . '/' . $site_mods[$module]['module_upload'] . '/' . $row['homeimgfile']; } elseif ($row['homeimgthumb'] == 2) { $src_img = NV_BASE_SITEURL . NV_UPLOADS_DIR . '/' . $site_mods[$module]['module_upload'] . '/' . $row['homeimgfile']; } elseif ($row['homeimgthumb'] == 3) { $src_img = $row['homeimgfile']; } else { $src_img = NV_BASE_SITEURL . 'themes/' . $global_config['site_theme'] . '/images/shops/no-image.jpg'; } $xtpl->assign('LINK', $link); $xtpl->assign('TITLE', $row['title']); $xtpl->assign('TITLE0', nv_clean60($row['title'], 30)); $xtpl->assign('SRC_IMG', $src_img); if ($pro_config['active_price'] == '1') { if ($row['showprice'] == '1') { $price = nv_get_price($row['id'], $pro_config['money_unit']); $xtpl->assign('PRICE', $price); if ($row['discount_id'] and $price['discount_percent'] > 0) { $xtpl->parse('main.items.price.discounts'); } else { $xtpl->parse('main.items.price.no_discounts'); } $xtpl->parse('main.items.price'); } else { $xtpl->parse('main.items.contact'); } } $xtpl->parse('main.items'); } $xtpl->parse('main'); return $xtpl->text('main'); }
/** * 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_news_groups_multi_tabs($block_config) { global $module_array_cat, $module_info, $site_mods, $module_config, $global_config, $db; $module = $block_config['module']; $show_no_image = $module_config[$module]['show_no_image']; $blockwidth = $module_config[$module]['blockwidth']; if (empty($block_config['blockid'])) { return ''; } $blockid = implode(',', $block_config['blockid']); if (file_exists(NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/modules/news/block_groups_multi_tabs.tpl')) { $block_theme = $global_config['module_theme']; } else { $block_theme = 'default'; } $xtpl = new XTemplate('block_groups_multi_tabs.tpl', NV_ROOTDIR . '/themes/' . $block_theme . '/modules/news'); $n = 0; $sql = 'SELECT bid, title FROM ' . NV_PREFIXLANG . '_' . $site_mods[$module]['module_data'] . '_block_cat WHERE bid IN ( ' . $blockid . ' ) ORDER BY weight ASC'; $result = $db->query($sql); while ($data = $result->fetch()) { $n++; if ($n == 1) { $data['active'] = 'active'; } $xtpl->assign('BLOCK_INFO', $data); $xtpl->parse('main.group_info'); $db->sqlreset()->select('t1.id, t1.catid, t1.title, t1.alias, t1.homeimgfile, t1.homeimgthumb,t1.hometext,t1.publtime')->from(NV_PREFIXLANG . '_' . $site_mods[$module]['module_data'] . '_rows t1')->join('INNER JOIN ' . NV_PREFIXLANG . '_' . $site_mods[$module]['module_data'] . '_block t2 ON t1.id = t2.id')->where('t2.bid= ' . $data['bid'] . ' AND t1.status= 1')->order('t2.weight ASC')->limit($block_config['numrow']); $list = nv_db_cache($db->sql(), '', $module); if (!empty($list)) { foreach ($list as $l) { $l['link'] = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module . '&' . NV_OP_VARIABLE . '=' . $module_array_cat[$l['catid']]['alias'] . '/' . $l['alias'] . '-' . $l['id'] . $global_config['rewrite_exturl']; if ($l['homeimgthumb'] == 1) { $l['thumb'] = NV_BASE_SITEURL . NV_FILES_DIR . '/' . $site_mods[$module]['module_upload'] . '/' . $l['homeimgfile']; } elseif ($l['homeimgthumb'] == 2) { $l['thumb'] = NV_BASE_SITEURL . NV_UPLOADS_DIR . '/' . $site_mods[$module]['module_upload'] . '/' . $l['homeimgfile']; } elseif ($l['homeimgthumb'] == 3) { $l['thumb'] = $l['homeimgfile']; } elseif (!empty($show_no_image)) { $l['thumb'] = NV_BASE_SITEURL . $show_no_image; } else { $l['thumb'] = ''; } $l['bid'] = $data['bid']; $l['blockwidth'] = $blockwidth; $l['title'] = nv_clean60($l['title'], $block_config['title_length']); $xtpl->assign('ROW', $l); if (!empty($l['thumb'])) { $xtpl->parse('main.group_content.loop.img'); } $xtpl->parse('main.group_content.loop'); } $xtpl->parse('main.group_content'); } } $xtpl->parse('main'); return $xtpl->text('main'); }
function nv_news_block_newscenter($block_config) { global $module_data, $module_name, $module_file, $global_array_cat, $global_config, $lang_module, $db, $module_config, $module_info; $module_name = 'news'; $module_data = 'news'; $xtpl = new XTemplate('block_newscenter.tpl', NV_ROOTDIR . '/themes/' . $module_info['template'] . '/blocks'); $xtpl->assign('lang', $lang_module); $xtpl->assign('NV_BASE_SITEURL', NV_BASE_SITEURL); $db->sqlreset()->select('id, catid, publtime, title, alias, hometext, homeimgthumb, homeimgfile')->from(NV_PREFIXLANG . '_' . $module_data . '_rows')->where('status= 1')->order('publtime DESC')->limit(5); $list = nv_db_cache($db->sql(), 'id', $module_name); $i = 1; foreach ($list as $row) { $row['publtime'] = nv_date('m/d/Y', $row['publtime']); $row['link'] = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=' . $global_array_cat[$row['catid']]['alias'] . '/' . $row['alias'] . '-' . $row['id'] . $global_config['rewrite_exturl']; $row['title0'] = nv_clean60(strip_tags($row['title']), $i == 1 ? 50 : 30); $row['hometext'] = nv_clean60(strip_tags($row['hometext']), 260); $image = NV_UPLOADS_REAL_DIR . '/' . $module_name . '/' . $row['homeimgfile']; if ($row['homeimgfile'] != '' and file_exists($image)) { if ($i == 1) { $width = 570; $height = 490; } else { $width = 270; $height = 230; } $row['imgsource'] = NV_BASE_SITEURL . NV_UPLOADS_DIR . '/' . $module_name . '/' . $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'; $_image = new image($image, NV_MAX_WIDTH, NV_MAX_HEIGHT); $_image->cropFromCenter($width, $height); $_image->save(NV_ROOTDIR . '/' . NV_TEMP_DIR, $basename); if (file_exists(NV_ROOTDIR . '/' . NV_TEMP_DIR . '/' . $basename)) { $row['imgsource'] = NV_BASE_SITEURL . NV_TEMP_DIR . '/' . $basename; } } } } elseif (nv_is_url($row['homeimgfile'])) { $row['imgsource'] = $row['homeimgfile']; } elseif (!empty($module_config[$module_name]['show_no_image'])) { $row['imgsource'] = NV_BASE_SITEURL . $module_config[$module_name]['show_no_image']; } else { $row['imgsource'] = NV_BASE_SITEURL . 'themes/' . $global_config['site_theme'] . '/images/no-image.png'; } $xtpl->assign('main' . $i, $row); ++$i; } $xtpl->parse('main'); return $xtpl->text('main'); }
/** * initial_config_data() * * @return */ function initial_config_data() { global $module_data; $sql = "SELECT config_name, config_value FROM " . NV_PREFIXLANG . "_" . $module_data . "_config"; $list = nv_db_cache($sql); $module_setting = array(); foreach ($list as $values) { $module_setting[$values['config_name']] = $values['config_value']; } return $module_setting; }
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'); } } }
function nv_department_info($block_config) { global $global_config, $site_mods, $db, $module_name, $lang_module; $module = $block_config['module']; $module_data = $site_mods[$module]['module_data']; if ($module != $module_name) { $lang_temp = $lang_module; if (file_exists(NV_ROOTDIR . '/modules/' . $module . '/language/' . $global_config['site_lang'] . '.php')) { require NV_ROOTDIR . '/modules/' . $module . '/language/' . $global_config['site_lang'] . '.php'; } $lang_module = $lang_module + $lang_temp; unset($lang_temp); } if (file_exists(NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/modules/' . $module . '/block.department.tpl')) { $block_theme = $global_config['module_theme']; } elseif (file_exists(NV_ROOTDIR . '/themes/' . $global_config['site_theme'] . '/modules/' . $module . '/block.department.tpl')) { $block_theme = $global_config['site_theme']; } else { $block_theme = 'default'; } //Danh sach cac bo phan $sql = 'SELECT id, full_name, phone, fax, email, yahoo, skype, note FROM ' . NV_PREFIXLANG . '_' . $module_data . '_department WHERE act=1 AND id=' . $block_config['departmentid']; $array_department = nv_db_cache($sql, 'id', $module); $xtpl = new XTemplate('block.department.tpl', NV_ROOTDIR . '/themes/' . $block_theme . '/modules/' . $module); $xtpl->assign('LANG', $lang_module); if (!empty($array_department)) { foreach ($array_department as $value => $row) { if (!empty($row)) { $xtpl->assign('DEPARTMENT', $row); if (!empty($row['phone'])) { $xtpl->parse('main.phone'); } if (!empty($row['fax'])) { $xtpl->parse('main.fax'); } if (!empty($row['email'])) { $xtpl->parse('main.email'); } if (!empty($row['yahoo'])) { $xtpl->parse('main.yahoo'); } if (!empty($row['skype'])) { $xtpl->parse('main.skype'); } } else { return ''; } } } $xtpl->parse('main'); return $xtpl->text('main'); }
/** * nv_siteinfo_getmodules() * * @return */ function nv_siteinfo_getmodules() { global $db_config; $sql = "SELECT DISTINCT `module_name` FROM `" . $db_config['prefix'] . "_logs`"; $result = nv_db_cache($sql, 'module_name'); $array_modules = array(); if (!empty($result)) { foreach ($result as $row) { $array_modules[] = $row['module_name']; } } return $array_modules; }
function nv_block_news_cat($block_config) { global $module_array_cat, $module_info, $site_mods, $module_config, $global_config, $db; $module = $block_config['module']; $show_no_image = $module_config[$module]['show_no_image']; $blockwidth = $module_config[$module]['blockwidth']; if (empty($block_config['catid'])) { return ''; } $catid = implode(',', $block_config['catid']); $db->sqlreset()->select('id, catid, title, alias, homeimgfile, homeimgthumb, hometext, publtime')->from(NV_PREFIXLANG . '_' . $site_mods[$module]['module_data'] . '_rows')->where('status= 1 AND catid IN(' . $catid . ')')->order('publtime DESC')->limit($block_config['numrow']); $list = nv_db_cache($db->sql(), '', $module); if (!empty($list)) { if (file_exists(NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/modules/news/block_news_cat.tpl')) { $block_theme = $global_config['module_theme']; } else { $block_theme = 'default'; } $xtpl = new XTemplate('block_news_cat.tpl', NV_ROOTDIR . '/themes/' . $block_theme . '/modules/news'); foreach ($list as $l) { $l['link'] = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module . '&' . NV_OP_VARIABLE . '=' . $module_array_cat[$l['catid']]['alias'] . '/' . $l['alias'] . '-' . $l['id'] . $global_config['rewrite_exturl']; if ($l['homeimgthumb'] == 1) { $l['thumb'] = NV_BASE_SITEURL . NV_FILES_DIR . '/' . $site_mods[$module]['module_upload'] . '/' . $l['homeimgfile']; } elseif ($l['homeimgthumb'] == 2) { $l['thumb'] = NV_BASE_SITEURL . NV_UPLOADS_DIR . '/' . $site_mods[$module]['module_upload'] . '/' . $l['homeimgfile']; } elseif ($l['homeimgthumb'] == 3) { $l['thumb'] = $l['homeimgfile']; } elseif (!empty($show_no_image)) { $l['thumb'] = NV_BASE_SITEURL . $show_no_image; } else { $l['thumb'] = ''; } $l['blockwidth'] = $blockwidth; $l['hometext'] = nv_clean60($l['hometext'], $block_config['tooltip_length'], true); if (!$block_config['showtooltip']) { $xtpl->assign('TITLE', 'title="' . $l['title'] . '"'); } $xtpl->assign('ROW', $l); if (!empty($l['thumb'])) { $xtpl->parse('main.loop.img'); } $xtpl->parse('main.loop'); } if ($block_config['showtooltip']) { $xtpl->assign('TOOLTIP_POSITION', $block_config['tooltip_position']); $xtpl->parse('main.tooltip'); } $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`, `who_view`, `groups_view`, `publ_time`, `exp_time` \n FROM `" . NV_PREFIXLANG . "_" . $site_mods['voting']['module_data'] . "` \n 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_set_allow($current_voting['who_view'], $current_voting['groups_view'])) { $sql = "SELECT `id`, `vid`, `title`, `url` FROM `" . NV_PREFIXLANG . "_" . $site_mods['voting']['module_data'] . "_rows` \n 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'); } } $xtpl->parse('main'); return $xtpl->text('main'); } } }
function nv_block_news_groups($block_config) { global $module_array_cat, $module_info, $site_mods, $module_config, $global_config, $db; $module = 'news'; $show_no_image = $module_config[$module]['show_no_image']; $blockwidth = $module_config[$module]['blockwidth']; $db->sqlreset()->select('t1.id, t1.catid, t1.title, t1.alias, t1.homeimgfile, t1.homeimgthumb,t1.hometext,t1.publtime')->from(NV_PREFIXLANG . '_' . $site_mods[$module]['module_data'] . '_rows t1')->join('INNER JOIN ' . NV_PREFIXLANG . '_' . $site_mods[$module]['module_data'] . '_block t2 ON t1.id = t2.id')->where('t2.bid= ' . $block_config['blockid'] . ' AND t1.status= 1')->order('t2.weight DESC')->limit($block_config['numrow']); $list = nv_db_cache($db->sql(), '', $module); if (!empty($list)) { if ($block_config['style'] == 'bellow_nav') { $block_file = 'block_groups_bellow_nav.tpl'; } else { $block_file = 'block_groups_body.tpl'; } if (file_exists(NV_ROOTDIR . '/themes/' . $module_info['template'] . '/blocks/' . $block_file)) { $block_theme = $module_info['template']; } else { $block_theme = 'default'; } $xtpl = new XTemplate($block_file, NV_ROOTDIR . '/themes/' . $block_theme . '/blocks'); $xtpl->assign('BLOCK_CONFIG', $block_config); foreach ($list as $l) { $l['link'] = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module . '&' . NV_OP_VARIABLE . '=' . $module_array_cat[$l['catid']]['alias'] . '/' . $l['alias'] . '-' . $l['id'] . $global_config['rewrite_exturl']; if ($l['homeimgthumb'] == 1) { $l['thumb'] = NV_BASE_SITEURL . NV_FILES_DIR . '/' . $module . '/' . $l['homeimgfile']; } elseif ($l['homeimgthumb'] == 2) { $l['thumb'] = NV_BASE_SITEURL . NV_UPLOADS_DIR . '/' . $module . '/' . $l['homeimgfile']; } elseif ($l['homeimgthumb'] == 3) { $l['thumb'] = $l['homeimgfile']; } elseif (!empty($show_no_image)) { $l['thumb'] = NV_BASE_SITEURL . $show_no_image; } else { $l['thumb'] = ''; } $l['blockwidth'] = $blockwidth; if ($block_config['style'] == 'block_body') { $l['hometext'] = nv_clean60($l['hometext'], 80); $l['title0'] = nv_clean60($l['title'], 35); } $xtpl->assign('ROW', $l); if (!empty($l['thumb'])) { $xtpl->parse('main.loop.img'); } $xtpl->parse('main.loop'); } $xtpl->assign('BLOCK_NAME', $block_config['title']); $xtpl->parse('main'); return $xtpl->text('main'); } }
/** * nv_pro_catalogs() * * @param mixed $block_config * @return */ function nv_pro_catalogs($block_config) { global $site_mods, $global_config, $module_config, $module_name, $module_info, $global_array_shops_cat, $db, $db_config, $array_cat_shops; $module = $block_config['module']; $mod_data = $site_mods[$module]['module_data']; $mod_file = $site_mods[$module]['module_file']; $pro_config = $module_config[$module]; $array_cat_shops = array(); $block_tpl_name = "block.catalogsv.tpl"; if (file_exists(NV_ROOTDIR . "/themes/" . $global_config['site_theme'] . "/modules/" . $mod_file . "/" . $block_tpl_name)) { $block_theme = $global_config['site_theme']; } else { $block_theme = "default"; } if ($module != $module_name) { $sql = "SELECT catid, parentid, lev, " . NV_LANG_DATA . "_title AS title, " . NV_LANG_DATA . "_alias AS alias, viewcat, numsubcat, subcatid, numlinks, " . NV_LANG_DATA . "_description AS description, inhome, " . NV_LANG_DATA . "_keywords AS keywords, groups_view FROM " . $db_config['prefix'] . "_" . $mod_data . "_catalogs ORDER BY sort ASC"; $list = nv_db_cache($sql, "catid", $module); foreach ($list as $row) { $array_cat_shops[$row['catid']] = array("catid" => $row['catid'], "parentid" => $row['parentid'], "title" => $row['title'], "alias" => $row['alias'], "link" => NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&" . NV_NAME_VARIABLE . "=" . $module . "&" . NV_OP_VARIABLE . "=" . $row['alias'], "viewcat" => $row['viewcat'], "numsubcat" => $row['numsubcat'], "subcatid" => $row['subcatid'], "numlinks" => $row['numlinks'], "description" => $row['description'], "inhome" => $row['inhome'], "keywords" => $row['keywords'], "groups_view" => $row['groups_view'], 'lev' => $row['lev']); } unset($list, $row); } else { $array_cat_shops = $global_array_shops_cat; } $xtpl = new XTemplate($block_tpl_name, NV_ROOTDIR . "/themes/" . $block_theme . "/modules/" . $mod_file); $xtpl->assign('TEMPLATE', $block_theme); $xtpl->assign('ID', $block_config['bid']); $cut_num = $block_config['cut_num']; $html = ""; foreach ($array_cat_shops as $cat) { if ($cat['parentid'] == 0) { if ($cat['inhome'] == '1') { $html .= "<li>\n"; $html .= "<a title=\"" . $cat['title'] . "\" href=\"" . $cat['link'] . "\">" . nv_clean60($cat['title'], $cut_num) . "</a>\n"; if (!empty($cat['subcatid'])) { $html .= "<span class=\"arrow expand\">+</span>"; $html .= html_viewsub($cat['subcatid'], $block_config); } $html .= "</li>\n"; } } } $xtpl->assign('CONTENT', $html); $xtpl->parse('main'); return $xtpl->text('main'); }
function nv_block_config_tophits_blocks($module, $data_block, $lang_block) { global $site_mods; $html = ''; $html .= '<tr>'; $html .= ' <td>' . $lang_block['number_day'] . '</td>'; $html .= ' <td><input type="text" name="config_number_day" class="form-control w100" size="5" value="' . $data_block['number_day'] . '"/></td>'; $html .= '</tr>'; $html .= '<tr>'; $html .= ' <td>' . $lang_block['numrow'] . '</td>'; $html .= ' <td><input type="text" name="config_numrow" class="form-control w100" size="5" value="' . $data_block['numrow'] . '"/></td>'; $html .= '</tr>'; $html .= '<tr>'; $html .= '<td>' . $lang_block['showtooltip'] . '</td>'; $html .= '<td>'; $html .= '<input type="checkbox" value="1" name="config_showtooltip" ' . ($data_block['showtooltip'] == 1 ? 'checked="checked"' : '') . ' /><br /><br />'; $tooltip_position = array('top' => $lang_block['tooltip_position_top'], 'bottom' => $lang_block['tooltip_position_bottom'], 'left' => $lang_block['tooltip_position_left'], 'right' => $lang_block['tooltip_position_right']); $html .= '<span class="text-middle pull-left">' . $lang_block['tooltip_position'] . ' </span><select name="config_tooltip_position" class="form-control w100 pull-left">'; foreach ($tooltip_position as $key => $value) { $html .= '<option value="' . $key . '" ' . ($data_block['tooltip_position'] == $key ? 'selected="selected"' : '') . '>' . $value . '</option>'; } $html .= '</select>'; $html .= ' <span class="text-middle pull-left">' . $lang_block['tooltip_length'] . ' </span><input type="text" class="form-control w100 pull-left" name="config_tooltip_length" size="5" value="' . $data_block['tooltip_length'] . '"/>'; $html .= '</td>'; $html .= '</tr>'; $html .= '<tr>'; $html .= '<td>' . $lang_block['nocatid'] . '</td>'; $sql = 'SELECT * FROM ' . NV_PREFIXLANG . '_' . $site_mods[$module]['module_data'] . '_cat ORDER BY sort ASC'; $list = nv_db_cache($sql, '', $module); $html .= '<td>'; $html .= '<div style="height: 200px; overflow: auto">'; foreach ($list as $l) { $xtitle_i = ''; if ($l['lev'] > 0) { for ($i = 1; $i <= $l['lev']; ++$i) { $xtitle_i .= ' '; } } $html .= $xtitle_i . '<label><input type="checkbox" name="config_nocatid[]" value="' . $l['catid'] . '" ' . (in_array($l['catid'], $data_block['nocatid']) ? ' checked="checked"' : '') . '</input>' . $l['title'] . '</label><br />'; } $html .= '</div>'; $html .= '</td>'; $html .= '</tr>'; return $html; }
function nv_bdown_news($block_config) { global $db, $module_info, $site_mods, $global_config; $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_db_cache($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_db_cache($db->sql(), 'id', $module); if (!empty($list)) { if (file_exists(NV_ROOTDIR . '/themes/' . $module_info['template'] . '/modules/' . $file . '/block_new_files.tpl')) { $block_theme = $module_info['template']; } 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'); } } }
function nv_bdown_news($block_config) { global $db, $module_info, $site_mods; $module = $block_config['module']; $file = $site_mods[$module]['module_file']; // Lay thong tin phan quyen $sql = "SELECT `id`, `alias`, `who_view`, `groups_view` FROM `" . NV_PREFIXLANG . "_" . $site_mods[$module]['module_data'] . "_categories` WHERE `status`=1"; $_tmp = nv_db_cache($sql, 'id', $module); $list_cat = array(); if ($_tmp) { foreach ($_tmp as $row) { if (nv_set_allow($row['who_view'], $row['groups_view'])) { $list_cat[$row['id']] = $row['alias']; } } } unset($_tmp, $sql); if ($list_cat) { $sql = "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 BY `updatetime` DESC LIMIT 0 , " . $block_config['numrow']; $list = nv_db_cache($sql, 'id', $module); if (!empty($list)) { if (file_exists(NV_ROOTDIR . "/themes/" . $module_info['template'] . "/modules/" . $file . "/block_new_files.tpl")) { $block_theme = $module_info['template']; } 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']; $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'); } } }
function nv_block_config_news_category($module, $data_block, $lang_block) { global $site_mods; $module = 'news'; $html .= '<tr>'; $html .= '<td>' . $lang_block['catid'] . '</td>'; $html .= '<td><select name="config_catid" class="form-control w200">'; $html .= '<option value="0"> -- </option>'; $sql = 'SELECT * FROM ' . NV_PREFIXLANG . '_' . $site_mods[$module]['module_data'] . '_cat ORDER BY sort ASC'; $list = nv_db_cache($sql, '', $module); foreach ($list as $l) { $xtitle_i = ''; if ($l['lev'] > 0) { for ($i = 1; $i <= $l['lev']; ++$i) { $xtitle_i .= ' '; } } $html_input .= '<input type="hidden" id="config_catid_' . $l['catid'] . '" value="' . NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module . '&' . NV_OP_VARIABLE . '=' . $l['alias'] . '" />'; $html .= '<option alt="' . $linksite . '" value="' . $l['catid'] . '" ' . ($data_block['catid'] == $l['catid'] ? ' selected="selected"' : '') . '>' . $xtitle_i . $l['title'] . '</option>'; } $html .= '</select>'; $html .= $html_input; $html .= '<script type="text/javascript">'; $html .= ' $("select[name=config_catid]").change(function() {'; $html .= ' $("input[name=title]").val($("select[name=config_catid] option:selected").text());'; $html .= ' $("input[name=link]").val($("#config_catid_" + $("select[name=config_catid]").val()).val());'; $html .= ' });'; $html .= '</script>'; $html .= '</tr>'; $html .= '<tr>'; $html .= '<td>' . $lang_block['title_length'] . '</td>'; $html .= '<td>'; $html .= "<select name=\"config_title_length\" class=\"form-control w200\">\n"; $html .= "<option value=\"\">" . $lang_block['title_length'] . "</option>\n"; for ($i = 0; $i < 100; ++$i) { $html .= "<option value=\"" . $i . "\" " . ($data_block['title_length'] == $i ? " selected=\"selected\"" : "") . ">" . $i . "</option>\n"; } $html .= "</select>\n"; $html .= '</td>'; $html .= '</tr>'; return $html; }
/** * nv_db_mods() * * @return */ function nv_site_mods() { global $db, $admin_info; $site_mods = array(); $sql = "SELECT * FROM `" . NV_MODULES_TABLE . "` ORDER BY `weight` ASC"; $list = nv_db_cache($sql, '', 'modules'); foreach ($list as $row) { $allowed = false; if (defined('NV_IS_SPADMIN')) { $allowed = true; } elseif (defined('NV_IS_ADMIN') and !empty($row['admins']) and in_array($admin_info['admin_id'], explode(",", $row['admins']))) { $allowed = true; } if ($allowed) { $row['title'] = $db->unfixdb($row['title']); $site_mods[$row['title']] = array('module_file' => $db->unfixdb($row['module_file']), 'module_data' => $db->unfixdb($row['module_data']), 'custom_title' => empty($row['admin_title']) ? $row['custom_title'] : $row['admin_title'], 'main_file' => $row['main_file'], 'admin_file' => $row['admin_file'], 'theme' => $db->unfixdb($row['theme']), 'keywords' => $row['keywords'], 'groups_view' => $row['groups_view'], 'in_menu' => intval($row['in_menu']), 'submenu' => intval($row['submenu']), 'act' => intval($row['act']), 'admins' => $row['admins'], 'rss' => $row['rss']); } } return $site_mods; }
function nv_block_news_groups($block_config) { global $module_array_cat, $module_info, $site_mods; $module = $block_config['module']; $sql = "SELECT t1.id, t1.catid, t1.title, t1.alias, t1.homeimgfile, t1.homeimgthumb,t1.hometext,t1.publtime FROM `" . NV_PREFIXLANG . "_" . $site_mods[$module]['module_data'] . "_rows` as t1 INNER JOIN `" . NV_PREFIXLANG . "_" . $site_mods[$module]['module_data'] . "_block` AS t2 ON t1.id = t2.id WHERE t2.bid= " . $block_config['blockid'] . " AND t1.status= 1 ORDER BY t2.weight ASC LIMIT 0 , " . $block_config['numrow']; $list = nv_db_cache($sql, '', $module); $i = 1; if (!empty($list)) { if (file_exists(NV_ROOTDIR . "/themes/" . $module_info['template'] . "/modules/news/block_groups.tpl")) { $block_theme = $module_info['template']; } else { $block_theme = "default"; } $xtpl = new XTemplate("block_groups.tpl", NV_ROOTDIR . "/themes/" . $block_theme . "/modules/news"); foreach ($list as $l) { $l['link'] = NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&" . NV_NAME_VARIABLE . "=" . $module . "&" . NV_OP_VARIABLE . "=" . $module_array_cat[$l['catid']]['alias'] . "/" . $l['alias'] . "-" . $l['id']; $l['thumb'] = ""; if (!empty($l['homeimgthumb'])) { $array_img = array(); $array_img = explode("|", $l['homeimgthumb']); if ($array_img[0] != "" and file_exists(NV_ROOTDIR . '/' . NV_FILES_DIR . '/' . $module . '/' . $array_img[0])) { $imgurl = NV_BASE_SITEURL . NV_FILES_DIR . '/' . $module . '/' . $array_img[0]; $l['thumb'] = $imgurl; } } elseif (nv_is_url($l['homeimgfile'])) { $l['thumb'] = $l['homeimgfile']; } $xtpl->assign('ROW', $l); if (!empty($l['thumb'])) { $xtpl->parse('main.loop.img'); } $xtpl->assign('bg', ++$i % 2 ? "bg" : ""); $xtpl->parse('main.loop'); } $xtpl->parse('main'); return $xtpl->text('main'); } }
function nv_block_config_menu($module, $data_block, $lang_block) { $html = ''; $html .= "<tr>"; $html .= "\t<td>" . $lang_block['menu'] . "</td>"; $html .= "\t<td><select name=\"menuid\" class=\"w300 form-control\">\n"; $sql = "SELECT * FROM " . NV_PREFIXLANG . "_menu ORDER BY id DESC"; $list = nv_db_cache($sql, 'id', $module); foreach ($list as $l) { $sel = $data_block['menuid'] == $l['id'] ? ' selected' : ''; $html .= "<option value=\"" . $l['id'] . "\" " . $sel . ">" . $l['title'] . "</option>\n"; } $html .= "\t</select></td>\n"; $html .= "</tr>"; $html .= "<tr>"; $html .= "<td>"; $html .= $lang_block['title_length']; $html .= "</td>"; $html .= "<td>"; $html .= "<input type=\"text\" class=\"form-control w100\" name=\"config_title_length\" value=\"" . $data_block['title_length'] . "\"/>"; $html .= "</td>"; $html .= "</tr>"; return $html; }
define('NV_LANGUAGE_GLOBALTABLE', $db_config['prefix'] . '_language'); define('NV_BANNERS_CLIENTS_GLOBALTABLE', $db_config['prefix'] . '_banners_clients'); define('NV_BANNERS_PLANS_GLOBALTABLE', $db_config['prefix'] . '_banners_plans'); define('NV_BANNERS_ROWS_GLOBALTABLE', $db_config['prefix'] . '_banners_rows'); define('NV_BANNERS_CLICK_GLOBALTABLE', $db_config['prefix'] . '_banners_click'); define('NV_CONFIG_GLOBALTABLE', $db_config['prefix'] . '_config'); define('NV_CRONJOBS_GLOBALTABLE', $db_config['prefix'] . '_cronjobs'); define('NV_PREFIXLANG', $db_config['prefix'] . '_' . NV_LANG_DATA); define('NV_MODULES_TABLE', NV_PREFIXLANG . '_modules'); define('NV_BLOCKS_TABLE', NV_PREFIXLANG . '_blocks'); define('NV_MODFUNCS_TABLE', NV_PREFIXLANG . '_modfuncs'); define('NV_COUNTER_TABLE', NV_PREFIXLANG . '_counter'); define('NV_SEARCHKEYS_TABLE', NV_PREFIXLANG . '_searchkeys'); define('NV_REFSTAT_TABLE', NV_PREFIXLANG . '_referer_stats'); $sql = "SELECT `module`, `config_name`, `config_value` FROM `" . NV_CONFIG_GLOBALTABLE . "` WHERE `lang`='" . NV_LANG_DATA . "' ORDER BY `module` ASC"; $list = nv_db_cache($sql, '', 'settings'); foreach ($list as $row) { if ($row['module'] == "global") { $global_config[$row['config_name']] = $row['config_value']; } else { $module_config[$row['module']][$row['config_name']] = $row['config_value']; } } if ($global_config['is_url_rewrite']) { $check_rewrite_file = nv_check_rewrite_file(); if (!$check_rewrite_file) { $global_config['is_url_rewrite'] = 0; } if (empty($global_config['is_url_rewrite'])) { $db->sql_query("UPDATE `" . NV_CONFIG_GLOBALTABLE . "` SET `config_value`= '0' WHERE `module`='global' AND `config_name` = 'is_url_rewrite'"); nv_delete_all_cache();