/** * 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_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'); }
/** * 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'); }
function nv_news_block_news($block_config, $mod_data) { global $module_array_cat, $module_info, $db, $module_config, $global_config, $site_mods; $module = $block_config['module']; $blockwidth = $module_config[$module]['blockwidth']; $show_no_image = $module_config[$module]['show_no_image']; $numrow = isset($block_config['numrow']) ? $block_config['numrow'] : 20; $cache_file = NV_LANG_DATA . '__block_news_' . $numrow . '_' . NV_CACHE_PREFIX . '.cache'; if (($cache = $nv_Cache->getItem($module, $cache_file)) != false) { $array_block_news = unserialize($cache); } else { $array_block_news = array(); $db->sqlreset()->select('id, catid, publtime, exptime, title, alias, homeimgthumb, homeimgfile, hometext')->from(NV_PREFIXLANG . '_' . $mod_data . '_rows')->where('status= 1')->order('publtime DESC')->limit($numrow); $result = $db->query($db->sql()); while (list($id, $catid, $publtime, $exptime, $title, $alias, $homeimgthumb, $homeimgfile, $hometext) = $result->fetch(3)) { $link = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module . '&' . NV_OP_VARIABLE . '=' . $module_array_cat[$catid]['alias'] . '/' . $alias . '-' . $id . $global_config['rewrite_exturl']; if ($homeimgthumb == 1) { $imgurl = NV_BASE_SITEURL . NV_FILES_DIR . '/' . $site_mods[$module]['module_upload'] . '/' . $homeimgfile; } elseif ($homeimgthumb == 2) { $imgurl = NV_BASE_SITEURL . NV_UPLOADS_DIR . '/' . $site_mods[$module]['module_upload'] . '/' . $homeimgfile; } elseif ($homeimgthumb == 3) { $imgurl = $homeimgfile; } elseif (!empty($show_no_image)) { $imgurl = NV_BASE_SITEURL . $show_no_image; } else { $imgurl = ''; } $array_block_news[] = array('id' => $id, 'title' => $title, 'link' => $link, 'imgurl' => $imgurl, 'width' => $blockwidth, 'hometext' => $hometext); } $cache = serialize($array_block_news); $nv_Cache->setItem($module, $cache_file, $cache); } if (file_exists(NV_ROOTDIR . '/themes/' . $module_info['template'] . '/modules/news/block_news.tpl')) { $block_theme = $module_info['template']; } else { $block_theme = 'default'; } $xtpl = new XTemplate('block_news.tpl', NV_ROOTDIR . '/themes/' . $block_theme . '/modules/news/'); foreach ($array_block_news as $array_news) { $array_news['hometext'] = nv_clean60($array_news['hometext'], $block_config['tooltip_length'], true); $xtpl->assign('blocknews', $array_news); if (!empty($array_news['imgurl'])) { $xtpl->parse('main.newloop.imgblock'); } if (!$block_config['showtooltip']) { $xtpl->assign('TITLE', 'title="' . $array_news['title'] . '"'); } $xtpl->parse('main.newloop'); } 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_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'); }
/** * nv_message_about() * * @return */ function nv_message_about() { global $global_config, $site_mods, $db, $module_name; if (!isset($site_mods['about'])) { return ""; } if ($module_name == 'about') { return ""; } $is_show = false; $pattern = "/^" . NV_LANG_DATA . "\\_about\\_([0-9]+)\\_" . NV_CACHE_PREFIX . "\\.cache\$/i"; $cache_files = nv_scandir(NV_ROOTDIR . "/" . NV_CACHEDIR, $pattern); if (($count = count($cache_files)) >= 1) { $num = rand(1, $count); $num--; $cache_file = $cache_files[$num]; if (($cache = nv_get_cache($cache_file)) != false) { $cache = unserialize($cache); $link = NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&" . NV_NAME_VARIABLE . "=about&" . NV_OP_VARIABLE . "=" . $cache['alias']; $title = $cache['page_title']; $bodytext = strip_tags($cache['contents']); $bodytext = nv_clean60($bodytext, 300); $is_show = true; } } if (!$is_show) { $sql = "SELECT `id`,`title`,`alias`,`bodytext`,`keywords`,`add_time`,`edit_time` FROM `" . NV_PREFIXLANG . "_" . $site_mods['about']['module_data'] . "` ORDER BY rand() DESC LIMIT 1"; if (($query = $db->sql_query($sql)) !== false) { if (($row = $db->sql_fetchrow($query)) !== false) { $link = NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&" . NV_NAME_VARIABLE . "=about&" . NV_OP_VARIABLE . "=" . $row['alias']; $title = $row['title']; $bodytext = $row['bodytext']; //$bodytext = strip_tags( $row['bodytext'] ); $bodytext = nv_clean60($bodytext, 300); $is_show = true; } } } if ($is_show) { if (file_exists(NV_ROOTDIR . "/themes/" . $global_config['module_theme'] . "/blocks/global.about.tpl")) { $block_theme = $global_config['module_theme']; } elseif (file_exists(NV_ROOTDIR . "/themes/" . $global_config['site_theme'] . "/blocks/global.about.tpl")) { $block_theme = $global_config['site_theme']; } else { $block_theme = "default"; } $xtpl = new XTemplate("global.about.tpl", NV_ROOTDIR . "/themes/" . $block_theme . "/blocks"); $xtpl->assign('LINK', $link); $xtpl->assign('TITLE', $title); $xtpl->assign('BODYTEXT', $bodytext); $xtpl->parse('main'); return $xtpl->text('main'); } return ""; }
/** * nv_message_page() * * @return */ function nv_message_page($block_config) { global $global_config, $site_mods, $db, $module_name; $module = $block_config['module']; if (!isset($site_mods[$module])) { return ''; } if ($module_name == $module) { return ''; } $is_show = false; $pattern = '/^' . NV_LANG_DATA . '\\_([a-zA-z0-9\\_\\-]+)\\_([0-9]+)\\_' . NV_CACHE_PREFIX . '\\.cache$/i'; $cache_files = nv_scandir(NV_ROOTDIR . '/' . NV_CACHEDIR . '/' . $module, $pattern); if (($count = sizeof($cache_files)) >= 1) { $num = rand(1, $count); --$num; $cache_file = $cache_files[$num]; if (($cache = nv_get_cache($module, $cache_file)) != false) { $cache = unserialize($cache); $link = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module . '&' . NV_OP_VARIABLE . '=' . $cache['alias'] . $global_config['rewrite_exturl']; $title = $cache['page_title']; $bodytext = strip_tags($cache['bodytext']); $is_show = true; } } if (!$is_show) { $sql = 'SELECT id,title,alias,bodytext,keywords,add_time,edit_time FROM ' . NV_PREFIXLANG . '_' . $site_mods[$module]['module_data'] . ' WHERE status=1 ORDER BY rand() DESC'; if (($query = $db->query($sql)) !== false) { if (($row = $query->fetch()) !== false) { $link = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module . '&' . NV_OP_VARIABLE . '=' . $row['alias'] . $global_config['rewrite_exturl']; $title = $row['title']; $bodytext = strip_tags($row['bodytext']); $bodytext = nv_clean60($bodytext, 300); $is_show = true; } } } if ($is_show) { if (file_exists(NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/modules/page/block.about.tpl')) { $block_theme = $global_config['module_theme']; } elseif (file_exists(NV_ROOTDIR . '/themes/' . $global_config['site_theme'] . '/modules/page/block.about.tpl')) { $block_theme = $global_config['site_theme']; } else { $block_theme = 'default'; } $xtpl = new XTemplate('block.about.tpl', NV_ROOTDIR . '/themes/' . $block_theme . '/modules/page'); $xtpl->assign('LINK', $link); $xtpl->assign('TITLE', $title); $xtpl->assign('BODYTEXT', $bodytext); $xtpl->parse('main'); return $xtpl->text('main'); } return ''; }
function BoldKeywordInStr($str, $keyword) { $str = nv_clean60($str, 300); $tmp = explode(" ", $keyword); foreach ($tmp as $k) { $tp = strtolower($k); $str = str_replace($tp, "<span class=\"keyword\">" . $tp . "</span>", $str); $tp = strtoupper($k); $str = str_replace($tp, "<span class=\"keyword\">" . $tp . "</span>", $str); $k[0] = strtoupper($k[0]); $str = str_replace($k, "<span class=\"keyword\">" . $k . "</span>", $str); } return $str; }
function BoldKeywordInStr($str, $keyword) { $str = nv_clean60($str, 300); if (!empty($keyword)) { $tmp = explode(' ', $keyword); foreach ($tmp as $k) { $tp = strtolower($k); $str = str_replace($tp, '<span class="keyword">' . $tp . '</span>', $str); $tp = strtoupper($k); $str = str_replace($tp, '<span class="keyword">' . $tp . '</span>', $str); $k[0] = strtoupper($k[0]); $str = str_replace($k, '<span class="keyword">' . $k . '</span>', $str); } } return $str; }
function draw_field_archives_sub($pid) { global $module_archives_field; $html = "<ul>"; foreach ($module_archives_field as $fieldid => $fieldinfo) { if ($fieldinfo['parentid'] == $pid) { $fieldinfo['title0'] = nv_clean60($fieldinfo['title'], 100); $html .= "<li>\n"; $html .= "\t<span class=\"folder\"><a href=\"" . $fieldinfo['link'] . "\" id=\"" . $fieldid . "\" title=\"" . $fieldinfo['title'] . "\" onclick=\"openlink(this)\" >" . $fieldinfo['title0'] . "" . "</a></span>\n"; if ($fieldinfo['numsubfield'] > 0) { $html .= draw_field_archives_sub($fieldid); } $html .= "</li>\n"; } } $html .= "</ul>"; return $html; }
function nv_weblink_sub_category($catid, $title_length) { global $global_array_cat; if (empty($catid)) { return ""; } else { $html = "<ul>\n"; foreach ($global_array_cat as $cat) { if ($cat['parentid'] == $catid) { $html .= "<li>\n"; $html .= "<a title=\"" . $global_array_cat[$cat['catid']]['title'] . "\" href=\"" . $global_array_cat[$cat['catid']]['link'] . "\">" . nv_clean60($global_array_cat[$cat['catid']]['title'], $title_length) . "</a>\n"; $html .= nv_weblink_sub_category($cat['catid'], $title_length); $html .= "</li>\n"; } } $html .= "</ul>\n"; return $html; } }
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'); } } }
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_archives_sub_category($list_sub, $title_length) { global $module_archives_cat; if (empty($list_sub)) { return ""; } else { $list = explode(",", $list_sub); $html = "<ul>\n"; foreach ($list as $catid) { $html .= "<li>\n"; $html .= "<a title=\"" . $module_archives_cat[$catid]['title'] . "\" href=\"" . $module_archives_cat[$catid]['link'] . "\">" . nv_clean60($module_archives_cat[$catid]['title'], $title_length) . "</a>\n"; if (!empty($module_archives_cat[$catid]['subcatid'])) { $html .= nv_archives_sub_category($module_archives_cat[$catid]['subcatid'], $title_length); } $html .= "</li>\n"; } $html .= "</ul>\n"; return $html; } }
function nv_comment_new($block_config) { global $db, $site_mods, $db_slave, $module_info, $global_config; $module = $block_config['module']; $mod_data = $site_mods[$module]['module_data']; $sql = "SELECT * FROM " . NV_PREFIXLANG . "_comment WHERE module = " . $db->quote($module) . " AND status=1 ORDER BY post_time DESC LIMIT " . $block_config['numrow']; $result = $db_slave->query($sql); $array_comment = array(); $array_news_id = array(); while ($comment = $result->fetch()) { $array_comment[] = $comment; $array_news_id[] = $comment['id']; } if (!empty($array_news_id)) { $result = $db_slave->query('SELECT t1.id, t1.alias AS alias_id, t2.alias AS alias_cat FROM ' . NV_PREFIXLANG . '_' . $mod_data . '_rows t1 INNER JOIN ' . NV_PREFIXLANG . '_' . $mod_data . '_cat t2 ON t1.catid = t2.catid WHERE t1.id IN (' . implode(',', array_unique($array_news_id)) . ') AND status = 1'); $array_news_id = array(); while ($row = $result->fetch()) { $array_news_id[$row['id']] = $row; } $mod_file = $site_mods[$module]['module_file']; if (file_exists(NV_ROOTDIR . '/themes/' . $module_info['template'] . '/modules/' . $mod_file . '/block_new_comment.tpl')) { $block_theme = $module_info['template']; } else { $block_theme = 'default'; } $xtpl = new XTemplate('block_new_comment.tpl', NV_ROOTDIR . '/themes/' . $block_theme . '/modules/' . $mod_file); $xtpl->assign('NV_BASE_SITEURL', NV_BASE_SITEURL); $xtpl->assign('TEMPLATE', $block_theme); foreach ($array_comment as $comment) { if (isset($array_news_id[$comment['id']])) { $comment['url_comment'] = nv_url_rewrite(NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module . '&' . NV_OP_VARIABLE . '=' . $array_news_id[$comment['id']]['alias_cat'] . '/' . $array_news_id[$comment['id']]['alias_id'] . '-' . $comment['id'] . $global_config['rewrite_exturl'], true); $comment['content'] = nv_clean60($comment['content'], $block_config['titlelength']); $comment['post_time'] = nv_date('d/m/Y H:i', $comment['post_time']); $xtpl->assign('COMMENT', $comment); $xtpl->parse('main.loop'); } } $xtpl->parse('main'); return $xtpl->text('main'); } }
/** * html_viewsub() * * @param mixed $list_sub * @return */ function html_viewsub($list_sub) { global $global_array_shops_cat, $cut_num; if (empty($list_sub)) { return ""; } else { $html = "<ul>\n"; $list = explode(",", $list_sub); foreach ($list as $catid) { if ($global_array_shops_cat[$catid]['inhome'] == '1') { $html .= "<li>\n"; $html .= "<a title=\"" . $global_array_shops_cat[$catid]['title'] . "\" href=\"" . $global_array_shops_cat[$catid]['link'] . "\">" . nv_clean60($global_array_shops_cat[$catid]['title'], $cut_num) . "</a>\n"; if (!empty($global_array_shops_cat[$catid]['subcatid'])) { $html .= html_viewsub($global_array_shops_cat[$catid]['subcatid']); } $html .= "</li>\n"; } } $html .= "</ul>\n"; return $html; } }
function nv_block_newarchives($block_config) { global $module_info, $global_config, $site_mods, $db; $module = $block_config['module']; $mod_data = $site_mods[$module]['module_data']; $mod_file = $site_mods[$module]['module_file']; if (file_exists(NV_ROOTDIR . "/themes/" . $global_config['site_theme'] . "/modules/" . $mod_file . "/block_newarchives.tpl")) { $block_theme = $global_config['site_theme']; } else { $block_theme = "default"; } $table = "" . NV_PREFIXLANG . "_" . $mod_data . "_rows"; $xtpl = new XTemplate("block_newarchives.tpl", NV_ROOTDIR . "/themes/" . $block_theme . "/modules/" . $mod_file); $xtpl->assign('NV_BASE_SITEURL', NV_BASE_SITEURL); $xtpl->assign('TEMPLATE', $block_theme); $xtpl->assign('id', $block_config['bid']); $xtpl->assign('height', $block_config['height']); if (!defined('JSMARQUEE')) { $xtpl->parse('main.jsmarquee'); define('JSMARQUEE', true); } //select data $sql = "SELECT id,title,alias,hometext,view,down FROM " . $table . " ORDER BY id DESC LIMIT 0," . $block_config['numrow']; $result = $db->query($sql); $i = 1; while ($row = $result->fetch()) { $row['linkview'] = NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&" . NV_NAME_VARIABLE . "=" . $module . "&" . NV_OP_VARIABLE . "=view/" . $row['alias'] . "-" . $row['id']; $row['hometext'] = nv_clean60($row['hometext'], $block_config['height']); $xtpl->assign('ROW', $row); if ($i < 3) { $xtpl->parse('main.loop.img'); } $xtpl->parse('main.loop'); $i++; } $xtpl->parse('main'); return $xtpl->text('main'); }
/** * nv_html_meta_tags() * * @param bool $html * @return */ function nv_html_meta_tags($html = true) { global $global_config, $db_config, $lang_global, $key_words, $description, $module_info, $home, $client_info, $op, $page_title, $canonicalUrl, $meta_property; $return = array(); $site_description = $home ? $global_config['site_description'] : (!empty($description) ? $description : (empty($module_info['description']) ? '' : $module_info['description'])); if (empty($site_description)) { $ds = array(); if (!empty($page_title)) { $ds[] = $page_title; } if ($op != 'main') { $ds[] = $module_info['funcs'][$op]['func_custom_name']; } $ds[] = $module_info['custom_title']; $ds[] = $client_info['selfurl']; $site_description = implode(' - ', $ds); } elseif ($site_description == 'no') { $site_description = ''; } if (!empty($site_description)) { $site_description = preg_replace(array('/<[^>]*>/', '/[\\r\\n\\t]+/'), ' ', $site_description); $site_description = trim(preg_replace('/[ ]+/', ' ', $site_description)); if ($global_config['description_length']) { $site_description = nv_clean60($site_description, $global_config['description_length'], true); } $return[] = array('name' => 'name', 'value' => 'description', 'content' => $site_description); } $kw = array(); if (!empty($key_words)) { if ($key_words != 'no') { $kw[] = $key_words; } } elseif (!empty($module_info['keywords'])) { $kw[] = $module_info['keywords']; } if ($home and !empty($global_config['site_keywords'])) { $kw[] = $global_config['site_keywords']; } if (!empty($kw)) { $kw = array_unique($kw); $key_words = implode(',', $kw); $key_words = preg_replace(array("/[ ]*\\,[ ]+/", "/[\\,]+/"), array(", ", ", "), $key_words); $key_words = nv_strtolower(strip_tags($key_words)); $return[] = array('name' => 'name', 'value' => 'keywords', 'content' => $key_words); $return[] = array('name' => 'name', 'value' => 'news_keywords', 'content' => $key_words); } $return[] = array('name' => 'http-equiv', 'value' => 'Content-Type', 'content' => "text/html; charset=" . $global_config['site_charset']); if ($global_config['idsite'] and file_exists(NV_ROOTDIR . '/' . NV_DATADIR . '/site_' . $global_config['idsite'] . '_metatags.xml')) { $file_metatags = NV_ROOTDIR . '/' . NV_DATADIR . '/site_' . $global_config['idsite'] . '_metatags.xml'; } else { $file_metatags = NV_ROOTDIR . '/' . NV_DATADIR . '/metatags.xml'; } if (file_exists($file_metatags)) { $mt = file_get_contents($file_metatags); $patters = array(); $patters['/\\{CONTENT\\-LANGUAGE\\}/'] = $lang_global['Content_Language']; $patters['/\\{LANGUAGE\\}/'] = $lang_global['LanguageName']; $patters['/\\{SITE\\_NAME\\}/'] = $global_config['site_name']; $patters['/\\{SITE\\_EMAIL\\}/'] = $global_config['site_email']; $mt = preg_replace(array_keys($patters), array_values($patters), $mt); $mt = preg_replace('/\\{(.*)\\}/', '', $mt); $mt = simplexml_load_string($mt); $mt = nv_object2array($mt); if ($mt['meta_item']) { if (isset($mt['meta_item'][0])) { $metatags = $mt['meta_item']; } else { $metatags[] = $mt['meta_item']; } foreach ($metatags as $meta) { if (($meta['group'] == 'http-equiv' or $meta['group'] == 'name' or $meta['group'] == 'property') and preg_match('/^[a-zA-Z0-9\\-\\_\\.\\:]+$/', $meta['value']) and preg_match("/^([^\\'\"]+)\$/", (string) $meta['content'])) { $return[] = array('name' => $meta['group'], 'value' => $meta['value'], 'content' => $meta['content']); } } } } $return[] = array('name' => 'name', 'value' => 'generator', 'content' => 'NukeViet v4.0'); if (defined('NV_IS_ADMIN')) { $return[] = array('name' => 'http-equiv', 'value' => 'refresh', 'content' => $global_config['admin_check_pass_time']); } if ($global_config['current_theme_type'] == 'r') { $return[] = array('name' => 'name', 'value' => 'viewport', 'content' => "width=device-width, initial-scale=1"); } if ($home) { $canonicalUrl = nv_url_rewrite(NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $global_config['site_home_module'], true); } elseif (empty($canonicalUrl)) { $canonicalUrl = str_replace(NV_MY_DOMAIN . '/', NV_MAIN_DOMAIN . '/', $client_info['selfurl']); } if (substr($canonicalUrl, 0, 4) != 'http') { if (substr($canonicalUrl, 0, 1) != '/') { $canonicalUrl = NV_BASE_SITEURL . $canonicalUrl; } $canonicalUrl = NV_MAIN_DOMAIN . $canonicalUrl; } //Open Graph protocol http://ogp.me if ($global_config['metaTagsOgp']) { if (empty($meta_property['og:title'])) { $meta_property['og:title'] = $page_title; } if (empty($meta_property['og:description'])) { $meta_property['og:description'] = $site_description; } if (empty($meta_property['og:type'])) { $meta_property['og:type'] = 'website'; } if (empty($meta_property['og:url'])) { $meta_property['og:url'] = $canonicalUrl; } $meta_property['og:site_name'] = $global_config['site_name']; foreach ($meta_property as $key => $value) { if (is_array($value)) { foreach ($value as $value_i) { if (!empty($value_i)) { $return[] = array('name' => 'property', 'value' => $key, 'content' => $value_i); } } } elseif (!empty($value)) { $return[] = array('name' => 'property', 'value' => $key, 'content' => $value); } } } else { foreach ($meta_property as $key => $value) { if (!preg_match('/^og\\:/', $key) and !empty($value)) { $return[] = array('name' => 'property', 'value' => $key, 'content' => $value); } } } if (!$html) { return $return; } $res = ""; foreach ($return as $link) { $res .= "<meta " . $link['name'] . "=\"" . $link['value'] . "\" content=\"" . $link['content'] . "\" />" . PHP_EOL; } return $res; }
$data['parentid'] = $nv_Request->get_int('parentid', 'post', 0); $data['title'] = nv_substr($nv_Request->get_title('title', 'post', '', 1), 0, 255); $data['title_custom'] = nv_substr($nv_Request->get_title('title_custom', 'post', '', 1), 0, 255); $data['keywords'] = nv_substr($nv_Request->get_title('keywords', 'post', '', 1), 0, 255); $data['alias'] = nv_substr($nv_Request->get_title('alias', 'post', '', 1), 0, 255); $data['description'] = $nv_Request->get_string('description', 'post', ''); $data['description'] = nv_nl2br(nv_htmlspecialchars(strip_tags($data['description'])), '<br />'); $data['descriptionhtml'] = $nv_Request->get_editor('descriptionhtml', '', NV_ALLOWED_HTML_TAGS); $data['viewdescriptionhtml'] = $nv_Request->get_int('viewdescriptionhtml', 'post', 0); $data['cat_allow_point'] = $nv_Request->get_int('cat_allow_point', 'post', 0); $data['cat_number_point'] = $nv_Request->get_int('cat_number_point', 'post', 0); $data['cat_number_product'] = $nv_Request->get_int('cat_number_product', 'post', 0); $data['alias'] = $data['alias'] == '' ? change_alias($data['title']) : change_alias($data['alias']); // Cat mo ta cho chinh xac if (strlen($data['description']) > 255) { $data['description'] = nv_clean60($data['description'], 250); } $_groups_post = $nv_Request->get_array('groups_view', 'post', array()); $data['groups_view'] = !empty($_groups_post) ? implode(',', nv_groups_post(array_intersect($_groups_post, array_keys($groups_list)))) : ''; if ($data['title'] == '') { $error = $lang_module['error_cat_name']; } $image = $nv_Request->get_string('image', 'post', ''); if (is_file(NV_DOCUMENT_ROOT . $image)) { $lu = strlen(NV_BASE_SITEURL . NV_UPLOADS_DIR . '/' . $module_upload . '/'); $data['image'] = substr($image, $lu); } else { $data['image'] = ''; } $data['form'] = $nv_Request->get_title('cat_form', 'post', ''); if (!in_array($data['form'], $cat_form_exit)) {
$result = $db->sql_query($sql); $result_all = $db->sql_query("SELECT FOUND_ROWS()"); list($numf) = $db->sql_fetchrow($result_all); $all_page = $numf ? $numf : 1; while (list($id, $listcatid, $admin_id, $title, $alias, $status, $publtime, $exptime, $is_notice) = $db->sql_fetchrow($result)) { if ($status == 0) { $status = $lang_module['status_0']; } elseif ($publtime <= NV_CURRENTTIME and ($exptime == 0 or $exptime > NV_CURRENTTIME)) { $status = $lang_module['status_1']; } elseif ($publtime > NV_CURRENTTIME) { $status = $lang_module['status_2']; } else { $status = $lang_module['status_3']; } $publtime = nv_date("H:i d/m/y", $publtime); $title = nv_clean60($title); $class = $a % 2 == 0 ? "" : " class=\"second\""; $catid_i = 0; if ($catid > 0) { $catid_i = $catid; } else { $listcatid_arr = explode(",", $listcatid); $catid_i = $listcatid_arr[0]; } // is notice if ($is_notice) { $is_notice = $lang_module['yes']; } else { $is_notice = $lang_module['no']; } $link = NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&" . NV_NAME_VARIABLE . "=" . $module_name . "&" . NV_OP_VARIABLE . "=" . $global_array_cat[$catid_i]['alias'] . "/" . $alias . "-" . $id;
function nv_block_album_new($block_config) { global $module_photo_category, $module_info, $site_mods, $module_config, $global_config, $db, $blockID; $module = $block_config['module']; $thumb_width = $module_config[$module]['cr_thumb_width']; $thumb_height = $module_config[$module]['cr_thumb_height']; $thumb_quality = $module_config[$module]['cr_thumb_quality']; $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, a.capturedate, 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/' . $mod_file . '/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/' . $mod_file); $xtpl->assign('BLOCK_ID', $blockID); foreach ($list as $album) { $album['name'] = nv_clean60($album['name'], $block_config['title_length']); $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']; $album['description'] = strip_tags(nv_clean60($album['description'], $block_config['des_length'])); $album['date_added'] = nv_date('d/m/Y', $album['date_added']); $album['capturedate'] = nv_date('d/m/Y', $album['capturedate']); $album['thumb'] = photos_thumbs($album['album_id'], $album['file'], $module, $thumb_width, $thumb_height, $thumb_quality); $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'); } }
/** * nv_relates_product() * * @param mixed $block_config * @return */ function nv_relates_product($block_config) { global $site_mods, $global_config, $lang_module, $module_config, $module_config, $module_name, $module_info, $global_array_shops_cat, $db_config, $my_head, $db, $pro_config, $money_config; $module = $block_config['module']; $mod_data = $site_mods[$module]['module_data']; $mod_file = $site_mods[$module]['module_file']; if (file_exists(NV_ROOTDIR . '/themes/' . $global_config['site_theme'] . '/modules/' . $mod_file . '/block.others_product.tpl')) { $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, typeprice FROM ' . $db_config['prefix'] . '_' . $mod_data . '_catalogs ORDER BY sort ASC'; $list = $nv_Cache->db($sql, 'catid', $module); foreach ($list as $row) { $global_array_shops_cat[$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'], 'typeprice' => $row['typeprice']); } unset($list, $row); // Css if (file_exists(NV_ROOTDIR . '/themes/' . $block_theme . '/css/' . $mod_file . '.css')) { $my_head .= '<link rel="StyleSheet" href="' . NV_BASE_SITEURL . 'themes/' . $block_theme . '/css/' . $mod_file . '.css" type="text/css" />'; } // Language if (file_exists(NV_ROOTDIR . '/modules/' . $mod_file . '/language/' . NV_LANG_DATA . '.php')) { require_once NV_ROOTDIR . '/modules/' . $mod_file . '/language/' . NV_LANG_DATA . '.php'; } $pro_config = $module_config[$module]; // Lay ty gia ngoai te $sql = 'SELECT code, currency, exchange, round, number_format FROM ' . $db_config['prefix'] . '_' . $mod_data . '_money_' . NV_LANG_DATA; $cache_file = NV_LANG_DATA . '_' . md5($sql) . '_' . NV_CACHE_PREFIX . '.cache'; if (($cache = $nv_Cache->getItem($module, $cache_file)) != false) { $money_config = unserialize($cache); } else { $money_config = array(); $result = $db->query($sql); while ($row = $result->fetch()) { $money_config[$row['code']] = array('code' => $row['code'], 'currency' => $row['currency'], 'exchange' => $row['exchange'], 'round' => $row['round'], 'number_format' => $row['number_format'], 'decimals' => $row['round'] > 1 ? $row['round'] : strlen($row['round']) - 2, 'is_config' => $row['code'] == $pro_config['money_unit'] ? 1 : 0); } $result->closeCursor(); $cache = serialize($money_config); $nv_Cache->setItem($module, $cache_file, $cache); } } $link = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module . '&' . NV_OP_VARIABLE . '='; $xtpl = new XTemplate('block.others_product.tpl', NV_ROOTDIR . '/themes/' . $block_theme . '/modules/' . $mod_file); $xtpl->assign('LANG', $lang_module); $xtpl->assign('WIDTH', $pro_config['homewidth']); $db->sqlreset()->select('t1.id, t1.listcatid, t1.' . NV_LANG_DATA . '_title AS title, t1.' . NV_LANG_DATA . '_alias AS alias, t1.addtime, t1.homeimgfile, t1.homeimgthumb, t1.product_price, t1.money_unit, t1.discount_id, t1.showprice')->from($db_config['prefix'] . '_' . $mod_data . '_rows t1')->join('INNER JOIN ' . $db_config['prefix'] . '_' . $mod_data . '_block t2 ON t1.id = t2.id')->where('t2.bid= ' . $block_config['blockid'] . ' AND t1.status =1')->order('t1.addtime DESC, t2.weight ASC')->limit($block_config['numrow']); $list = $nv_Cache->db($db->sql(), 'id', $module); $i = 1; $cut_num = $block_config['cut_num']; foreach ($list as $row) { 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 . $global_array_shops_cat[$row['listcatid']]['alias'] . '/' . $row['alias'] . $global_config['rewrite_exturl']); $xtpl->assign('title', nv_clean60($row['title'], $cut_num)); $xtpl->assign('src_img', $src_img); $xtpl->assign('time', nv_date('d-m-Y h:i:s A', $row['addtime'])); if ($pro_config['active_price'] == '1') { if ($row['showprice'] == '1') { $price = nv_get_price_tmp($module, $mod_data, $mod_file, $row['id']); //var_dump($price); die; $xtpl->assign('PRICE', $price); if ($row['discount_id'] and $price['discount_percent'] > 0) { $xtpl->parse('main.loop.price.discounts'); } else { $xtpl->parse('main.loop.price.no_discounts'); } $xtpl->parse('main.loop.price'); } else { $xtpl->parse('main.loop.contact'); } } $xtpl->parse('main.loop'); ++$i; } $xtpl->parse('main'); return $xtpl->text('main'); }
/** * wishlist() * * @param mixed $data_content * @param string $html_pages * @return */ function wishlist($data_content, $compare_id, $html_pages = '') { global $module_info, $lang_module, $module_file, $pro_config, $op, $array_displays, $array_wishlist_id, $module_name, $global_array_shops_cat, $global_array_group, $my_head; $xtpl = new XTemplate('wishlist.tpl', NV_ROOTDIR . '/themes/' . $module_info['template'] . '/modules/' . $module_file); $xtpl->assign('TEMPLATE', $module_info['template']); $xtpl->assign('NV_BASE_SITEURL', NV_BASE_SITEURL); $xtpl->assign('LANG', $lang_module); $xtpl->assign('CSS_PRODUCT_CODE', !empty($pro_config['show_product_code']) ? ' show-product-code' : ''); $xtpl->assign('num', 24 / $pro_config['per_row']); if (!empty($data_content)) { foreach ($data_content as $data_row) { $xtpl->assign('ID', $data_row['id']); $xtpl->assign('LINK', $data_row['link_pro']); $xtpl->assign('TITLE', $data_row['title']); $xtpl->assign('TITLE0', nv_clean60($data_row['title'], 40)); $xtpl->assign('IMG_SRC', $data_row['homeimgthumb']); $xtpl->assign('LINK_ORDER', $data_row['link_order']); $xtpl->assign('height', $pro_config['homeheight']); $xtpl->assign('width', $pro_config['homewidth']); $xtpl->assign('hometext', $data_row['hometext']); $xtpl->assign('PRODUCT_CODE', $data_row['product_code']); $newday = $data_row['publtime'] + 86400 * $data_row['newday']; if ($newday >= NV_CURRENTTIME) { $xtpl->parse('main.items.new'); } if ($pro_config['active_order'] == '1' and $pro_config['active_order_non_detail'] == '1') { if ($data_row['showprice'] == '1') { if ($data_row['product_number'] > 0) { // Kiem tra nhom bat buoc chon khi dat hang $listgroupid = GetGroupID($data_row['id']); $group_requie = 0; if (!empty($listgroupid) and !empty($global_array_group)) { foreach ($global_array_group as $groupinfo) { if ($groupinfo['in_order']) { $group_requie = 1; break; } } } $group_requie = $pro_config['active_order_popup'] ? 1 : $group_requie; $xtpl->assign('GROUP_REQUIE', $group_requie); $xtpl->parse('main.items.order'); } else { $xtpl->parse('main.items.product_empty'); } } } if ($pro_config['active_price'] == '1') { if ($data_row['showprice'] == '1') { $price = nv_get_price($data_row['id'], $pro_config['money_unit']); $xtpl->assign('PRICE', $price); if ($data_row['discount_id'] and $price['discount_percent'] > 0) { $xtpl->parse('main.items.price.discounts'); $xtpl->parse('main.items.price.discounts.standard'); } else { $xtpl->parse('main.items.price.no_discounts'); } $xtpl->parse('main.items.price'); } else { $xtpl->parse('main.items.contact'); } } if ($pro_config['active_tooltip'] == 1) { $xtpl->parse('main.items.tooltip'); } if (!empty($pro_config['show_product_code']) and !empty($data_row['product_code'])) { $xtpl->parse('main.items.product_code'); } if (defined('NV_IS_MODADMIN')) { $xtpl->assign('ADMINLINK', nv_link_edit_page($data_row['id']) . ' - ' . nv_link_delete_page($data_row['id'])); $xtpl->parse('main.items.adminlink'); } // Qua tang if ($pro_config['active_gift'] and !empty($data_row['gift_content']) and NV_CURRENTTIME >= $data_row['gift_from'] and NV_CURRENTTIME <= $data_row['gift_to']) { $xtpl->parse('main.items.gift'); } // So sanh san pham if ($pro_config['show_compare'] == 1) { if (!empty($compare_id)) { $ch = in_array($data_row['id'], $compare_id) ? ' checked="checked"' : ''; $xtpl->assign('ch', $ch); } $xtpl->parse('main.items.compare'); } if ($data_row['discount_id'] and $price['discount_percent'] > 0 and $data_row['showprice']) { $xtpl->parse('main.items.discounts'); } // Hien thi bieu tuong tich luy diem if ($pro_config['point_active'] and $global_array_shops_cat[$data_row['listcatid']]['cat_allow_point'] and !empty($global_array_shops_cat[$data_row['listcatid']]['cat_number_point'])) { $xtpl->assign('point', $global_array_shops_cat[$data_row['listcatid']]['cat_number_point']); $xtpl->assign('point_note', sprintf($lang_module['point_product_note'], $global_array_shops_cat[$data_row['listcatid']]['cat_number_point'])); $xtpl->parse('main.items.point'); } $xtpl->parse('main.items'); } if (!defined('MODAL_LOADED')) { $xtpl->parse('main.modal_loaded'); define('MODAL_LOADED', true); } if (!empty($html_pages)) { $xtpl->assign('generate_page', $html_pages); $xtpl->parse('main.pages'); } } $xtpl->parse('main'); return $xtpl->text('main'); }
function nv_news_block_news($block_config, $mod_data) { global $module_array_cat, $module_info, $db, $module_config, $global_config; $module = 'news'; $blockwidth = $module_config[$module]['blockwidth']; $show_no_image = $module_config[$module]['show_no_image']; $numrow = isset($block_config['numrow']) ? $block_config['numrow'] : 20; $cache_file = NV_LANG_DATA . '__block_news_' . $numrow . '_' . NV_CACHE_PREFIX . '.cache'; if (($cache = nv_get_cache($module, $cache_file)) != false) { $array_block_news = unserialize($cache); } else { $array_block_news = array(); $db->sqlreset()->select('id, catid, publtime, exptime, title, alias, homeimgthumb, homeimgfile, hometext')->from(NV_PREFIXLANG . '_' . $mod_data . '_rows')->where('status= 1')->order('publtime DESC')->limit($numrow); $result = $db->query($db->sql()); while (list($id, $catid, $publtime, $exptime, $title, $alias, $homeimgthumb, $homeimgfile, $hometext) = $result->fetch(3)) { $link = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module . '&' . NV_OP_VARIABLE . '=' . $module_array_cat[$catid]['alias'] . '/' . $alias . '-' . $id . $global_config['rewrite_exturl']; $array_block_news[] = array('id' => $id, 'title' => $title, 'link' => $link, 'homeimgfile' => $homeimgfile, 'width' => $blockwidth, 'hometext' => $hometext); } $cache = serialize($array_block_news); nv_set_cache($module, $cache_file, $cache); } if (file_exists(NV_ROOTDIR . '/themes/' . $module_info['template'] . '/blocks/block_news.tpl')) { $block_theme = $module_info['template']; } else { $block_theme = 'default'; } $xtpl = new XTemplate('block_news.tpl', NV_ROOTDIR . '/themes/' . $block_theme . '/blocks/'); $i = 1; foreach ($array_block_news as $array_news) { $array_news['hometext'] = nv_clean60($array_news['hometext'], 20); $image = NV_UPLOADS_REAL_DIR . '/' . $module . '/' . $array_news['homeimgfile']; if ($array_news['homeimgfile'] != '' and file_exists($image)) { if ($i == 1) { $width = 370; $height = 150; } else { $width = 170; $height = 115; } $array_news['imgurl'] = NV_BASE_SITEURL . NV_UPLOADS_DIR . '/' . $module_name . '/' . $array_news['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)) { $array_news['imgurl'] = 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)) { $array_news['imgurl'] = NV_BASE_SITEURL . NV_TEMP_DIR . '/' . $basename; } } } } elseif (nv_is_url($array_news['homeimgfile'])) { $array_news['imgurl'] = $array_news['homeimgfile']; } elseif (!empty($module_config[$module_name]['show_no_image'])) { $array_news['imgurl'] = NV_BASE_SITEURL . $module_config[$module_name]['show_no_image']; } else { $array_news['imgurl'] = NV_BASE_SITEURL . 'themes/' . $global_config['site_theme'] . '/images/no-image.png'; } $xtpl->assign('blocknews', $array_news); if ($i == 1) { $xtpl->parse('main.news_main'); } else { $array_news['title0'] = nv_clean60($array_news['title'], 40); $xtpl->assign('blocknews', $array_news); $xtpl->assign('FL', $i % 2 != 0 ? 'right' : 'left'); $xtpl->parse('main.newsloop'); } $i++; } $xtpl->parse('main'); return $xtpl->text('main'); }
function nv_block_videos_groups_tabs($block_config) { global $module_array_cat, $module_info, $site_mods, $module_config, $global_config, $db, $nv_Cache; $module = $block_config['module']; $show_no_image = $module_config[$module]['show_no_image']; if (empty($show_no_image)) { $show_no_image = 'themes/default/images/' . $module . '/' . 'video_placeholder.png'; } $blockwidth = $module_config[$module]['blockwidth']; if (file_exists(NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/modules/videos/block_groups_tabs.tpl')) { $block_theme = $global_config['module_theme']; } else { $block_theme = 'default'; } $xtpl = new XTemplate('block_groups_tabs.tpl', NV_ROOTDIR . '/themes/' . $block_theme . '/modules/videos'); $sql = 'SELECT * FROM ' . NV_PREFIXLANG . '_' . $site_mods[$module]['module_data'] . '_block_cat WHERE bid=' . $block_config['blockid']; $list = $nv_Cache->db($sql, '', $module); foreach ($list as $l) { $block_select = $l; } $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 ASC')->limit($block_config['numrow']); $list = $nv_Cache->db($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 or $l['homeimgthumb'] == 2) { $l['thumb'] = videos_thumbs($l['id'], $l['homeimgfile'], $module, $module_config[$module]['homewidth'], $module_config[$module]['homeheight'], 90); } 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['title'] = nv_clean60($l['title'], $block_config['title_length']); $xtpl->assign('ROW', $l); if (!empty($l['thumb'])) { $xtpl->parse('main.group.loop.img'); } $xtpl->parse('main.group.loop'); } $xtpl->assign('BLOCK_NAME', $block_select['title']); $xtpl->parse('main.group'); } $db->sqlreset()->select('*')->from(NV_PREFIXLANG . '_' . $site_mods[$module]['module_data'] . '_rows')->where('status= 1')->order('publtime DESC')->limit($block_config['numrow']); $last = $nv_Cache->db($db->sql(), '', $module); if (!empty($last)) { foreach ($last as $ls) { $ls['link'] = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module . '&' . NV_OP_VARIABLE . '=' . $module_array_cat[$ls['catid']]['alias'] . '/' . $ls['alias'] . '-' . $ls['id'] . $global_config['rewrite_exturl']; if ($ls['homeimgthumb'] == 1 or $ls['homeimgthumb'] == 2) { $ls['thumb'] = videos_thumbs($ls['id'], $ls['homeimgfile'], $module, $module_config[$module]['homewidth'], $module_config[$module]['homeheight'], 90); } elseif ($ls['homeimgthumb'] == 3) { $ls['thumb'] = $ls['homeimgfile']; } elseif (!empty($show_no_image)) { $ls['thumb'] = NV_BASE_SITEURL . $show_no_image; } else { $ls['thumb'] = ''; } $ls['blockwidth'] = $blockwidth; $ls['title'] = nv_clean60($ls['title'], $block_config['title_length']); $xtpl->assign('NEWS', $ls); if (!empty($ls['thumb'])) { $xtpl->parse('main.latest.loop.img'); } $xtpl->parse('main.latest.loop'); } $xtpl->parse('main.latest'); } $xtpl->parse('main'); return $xtpl->text('main'); }
function detail_theme($news_contents, $href_vid, $array_keyword, $related_new_array, $related_array, $content_comment, $array_user_playlist) { global $global_config, $module_info, $lang_module, $module_name, $module_file, $module_config, $lang_global, $user_info, $admin_info, $client_info; $xtpl = new XTemplate('detail.tpl', NV_ROOTDIR . '/themes/' . $module_info['template'] . '/modules/' . $module_file); $xtpl->assign('LANG_GLOBAL', $lang_global); $xtpl->assign('NV_BASE_SITEURL', NV_BASE_SITEURL); $xtpl->assign('TEMPLATE', $global_config['module_theme']); $xtpl->assign('MODULE_NAME', $module_name); $xtpl->assign('LANG', $lang_module); $xtpl->assign('IMGWIDTH', $module_config[$module_name]['homewidth']); $xtpl->assign('IMGHEIGHT', $module_config[$module_name]['homeheight']); $news_contents['addtime'] = nv_date('d/m/Y h:i:s', $news_contents['addtime']); $news_contents['publtime'] = humanTiming($news_contents['publtime']); $xtpl->assign('RAND_SS', rand(1000, 9999)); $xtpl->assign('NEWSID', $news_contents['id']); $xtpl->assign('NEWSCHECKSS', $news_contents['newscheckss']); $xtpl->assign('DETAIL', $news_contents); $xtpl->assign('SELFURL', $client_info['selfurl']); $xtpl->assign('USERLIST_OPS', $module_info['alias']['user-playlist']); if (!empty($module_config[$module_name]['jwplayer_logo_file']) and file_exists(NV_ROOTDIR . '/' . $module_config[$module_name]['jwplayer_logo_file'])) { $lu = strlen(NV_BASE_SITEURL); $module_config[$module_name]['jwplayer_logo_file'] = NV_BASE_SITEURL . $module_config[$module_name]['jwplayer_logo_file']; } $xtpl->assign('VIDEO_CONFIG', $module_config[$module_name]); if ($news_contents['allowed_send'] == 1) { $xtpl->assign('URL_SENDMAIL', $news_contents['url_sendmail']); $xtpl->parse('main.allowed_send'); } if (!empty($href_vid)) { if ($module_config[$module_name]['jwplayer_logo'] > 0 and !empty($module_config[$module_name]['jwplayer_logo_file'])) { $xtpl->parse('main.jwplayer.player_logo'); } $xtpl->parse('main.jwplayer'); $xtpl->parse('main.vid_jw_content'); } if ($news_contents['allowed_print'] == 1) { $xtpl->assign('URL_PRINT', $news_contents['url_print']); $xtpl->parse('main.allowed_print'); } if ($news_contents['allowed_save'] == 1) { $xtpl->assign('URL_SAVEFILE', $news_contents['url_savefile']); $xtpl->parse('main.allowed_save'); } if ($news_contents['allowed_rating'] == 1) { $xtpl->assign('LANGSTAR', $news_contents['langstar']); $xtpl->assign('STRINGRATING', $news_contents['stringrating']); $xtpl->assign('NUMBERRATING', $news_contents['numberrating']); if ($news_contents['disablerating'] == 1) { $xtpl->parse('main.allowed_rating.disablerating'); } if ($news_contents['numberrating'] >= $module_config[$module_name]['allowed_rating_point']) { $xtpl->parse('main.allowed_rating.data_rating'); } $xtpl->parse('main.allowed_rating'); } if (!empty($news_contents['bodytext'])) { $xtpl->parse('main.bodytext'); } if (!empty($news_contents['post_name'])) { $xtpl->parse('main.post_name'); } if (!empty($news_contents['author']) or !empty($news_contents['source'])) { if (!empty($news_contents['author'])) { $xtpl->parse('main.author.name'); } if (!empty($news_contents['source'])) { $xtpl->parse('main.author.source'); } $xtpl->parse('main.author'); } if (isset($news_contents['uploader_link']) and !empty($news_contents['uploader_link'])) { $xtpl->parse('main.uploader_link'); } else { $xtpl->parse('main.uploader'); } if ($news_contents['copyright'] == 1) { if (!empty($module_config[$module_name]['copyright'])) { $xtpl->assign('COPYRIGHT', $module_config[$module_name]['copyright']); $xtpl->parse('main.copyright'); } } if (!empty($array_keyword)) { $t = sizeof($array_keyword) - 1; foreach ($array_keyword as $i => $value) { $xtpl->assign('KEYWORD', $value['keyword']); $xtpl->assign('LINK_KEYWORDS', NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=tag/' . urlencode($value['alias'])); $xtpl->assign('SLASH', $t == $i ? '' : ', '); $xtpl->parse('main.keywords.loop'); } $xtpl->parse('main.keywords'); } if (defined('NV_IS_MODADMIN')) { $xtpl->assign('ADMINLINK', nv_link_edit_page($news_contents['id']) . ' ' . nv_link_delete_page($news_contents['id'], 1)); $xtpl->parse('main.adminlink'); } if ($module_config[$module_name]['socialbutton']) { global $meta_property; if (!empty($module_config[$module_name]['facebookappid'])) { $meta_property['fb:app_id'] = $module_config[$module_name]['facebookappid']; $meta_property['og:locale'] = NV_LANG_DATA == 'vi' ? 'vi_VN' : 'en_US'; } $xtpl->parse('main.socialbutton'); } if (!empty($related_new_array) or !empty($related_array)) { if (!empty($related_new_array)) { foreach ($related_new_array as $key => $related_new_array_i) { $related_new_array_i['hometext'] = nv_clean60($related_new_array_i['hometext'], $module_config[$module_name]['tooltip_length'], true); $newday = $related_new_array_i['time'] + 86400 * $related_new_array_i['newday']; if ($newday >= NV_CURRENTTIME) { $xtpl->parse('main.others.related_new.loop.newday'); } $related_new_array_i['time'] = humanTiming($related_new_array_i['time']); $xtpl->assign('RELATED_NEW', $related_new_array_i); if ($related_new_array_i['imghome'] != '') { if (!($related_new_array_i['homeimgthumb'] > 0)) { $xtpl->parse('main.others.related_new.loop.image.fix_size'); } $xtpl->parse('main.others.related_new.loop.image'); } $xtpl->parse('main.others.related_new.loop'); } unset($key); $xtpl->parse('main.others.related_new'); } if (!empty($related_array)) { foreach ($related_array as $related_array_i) { $related_array_i['hometext'] = nv_clean60($related_array_i['hometext'], $module_config[$module_name]['tooltip_length'], true); $newday = $related_array_i['time'] + 86400 * $related_array_i['newday']; if ($newday >= NV_CURRENTTIME) { $xtpl->parse('main.others.related.loop.newday'); } $related_array_i['time'] = humanTiming($related_array_i['time']); $xtpl->assign('RELATED', $related_array_i); if ($related_array_i['imghome'] != '') { $xtpl->parse('main.others.related.loop.image'); } $xtpl->parse('main.others.related.loop'); } $xtpl->parse('main.others.related'); } $xtpl->parse('main.others'); } if (!empty($array_user_playlist)) { foreach ($array_user_playlist as $array_user_playlist_i) { if ($array_user_playlist_i['status'] == 2) { $array_user_playlist_i['disabled'] = 'disabled=disabled'; } $xtpl->assign('USER_PLAYLIST', $array_user_playlist_i); $xtpl->parse('main.user_playlist.loop'); } $xtpl->parse('main.user_playlist'); } elseif ($user_info['userid'] > 0) { $xtpl->parse('main.user_create_newlist'); } else { $xtpl->parse('main.user_required'); } if (!empty($content_comment)) { $xtpl->assign('CONTENT_COMMENT', $content_comment); $xtpl->parse('main.comment'); } if ($news_contents['status'] != 1) { $xtpl->parse('main.no_public'); } $xtpl->parse('main'); return $xtpl->text('main'); }
while ($row = $db->sql_fetchrow($result)) { $image = array(NV_BASE_SITEURL . 'images/mail_new.gif', 12, 9); $status = "New"; $style = " style=\"font-weight:bold;cursor:pointer;white-space:nowrap;\""; if ($row['is_read'] == 1) { $image = array(NV_BASE_SITEURL . 'images/mail_old.gif', 12, 11); $status = $lang_module['tt1_row_title']; $style = " style=\"cursor:pointer;white-space:nowrap;\""; } if ($row['is_reply']) { $image = array(NV_BASE_SITEURL . 'images/mail_reply.gif', 13, 14); $status = $lang_module['tt2_row_title']; $style = " style=\"cursor:pointer;white-space:nowrap;\""; } $onclick = "onclick=\"location.href='" . NV_BASE_ADMINURL . "index.php?" . NV_NAME_VARIABLE . "=" . $module_name . "&" . NV_OP_VARIABLE . "=view&id=" . $row['id'] . "'\""; $xtpl->assign('ROW', array('class' => ++$a % 2 ? " class=\"second\"" : "", 'id' => $row['id'], 'sender_name' => $row['sender_name'], 'path' => $contact_allowed['view'][$row['cid']], 'title' => nv_clean60($row['title'], 60), 'time' => $row['send_time'] >= $currday ? nv_date("H:i", $row['send_time']) : nv_date("d/m/Y", $row['send_time']), 'style' => $style, 'onclick' => $onclick, 'status' => $status, 'image' => $image)); $xtpl->parse('main.data.row'); } $generate_page = nv_generate_page($base_url, $all_page, $per_page, $page); if (!empty($generate_page)) { $xtpl->assign('GENERATE_PAGE', $generate_page); $xtpl->parse('main.data.generate_page'); } } } if (empty($all_page)) { $xtpl->parse('main.empty'); } else { $xtpl->parse('main.data'); } $xtpl->parse('main');
/** * nv_detail_tags_theme() * * @param mixed $array * @param mixed $generate_page * @param mixed $cfg * @param mixed $page * @param mixed $total_pages * @param mixed $BL * @return */ function nv_detail_tags_theme($array, $generate_page, $cfg, $page, $total_pages, $BL) { global $lang_global, $lang_module, $module_file, $module_info, $my_head; // Nếu không có bài viết thì chỉ cần thông báo if (empty($array)) { return nv_message_theme($lang_module['noPost'], 3); } $my_head .= "<script type=\"text/javascript\" src=\"" . NV_BASE_SITEURL . "modules/" . $module_file . "/media/jwplayer.js\"></script>" . NV_EOL; if ($BL->setting['catViewType'] == 'type_blog') { // Kieu danh sach blog $xtpl = new XTemplate("list_blog.tpl", NV_ROOTDIR . "/themes/" . $module_info['template'] . "/modules/" . $module_file); } else { // Kieu danh sach tin tuc $xtpl = new XTemplate("list_news.tpl", NV_ROOTDIR . "/themes/" . $module_info['template'] . "/modules/" . $module_file); } $xtpl->assign('LANG', $lang_module); $xtpl->assign('GLANG', $lang_global); $xtpl->assign('PAGE_TOTAL', $total_pages); $xtpl->assign('PAGE_CURRENT', $page); // Có gọi lighlight js không $call_highlight = false; foreach ($array as $row) { $row['pubtime'] = str_replace(array(' AM ', ' PM '), array(' SA ', ' CH '), nv_date('g:i A d/m/Y', $row['pubtime'])); $row['numcomments'] = number_format($row['numcomments'], 0, ',', '.'); $row['linkComment'] = nv_url_rewrite($row['link'], true) . '#comment'; $row['icon'] = empty($BL->setting['iconClass' . $row['posttype']]) ? 'icon-pencil' : $BL->setting['iconClass' . $row['posttype']]; // Cat phan gioi thieu ngan gon if ($BL->setting['strCutHomeText']) { $row['hometext'] = nv_clean60($row['hometext'], $BL->setting['strCutHomeText']); } // Hinh anh mac dinh neu khong co anh mo ta if (empty($row['images'])) { if ($BL->setting['indexViewType'] == 'type_blog') { $row['images'] = NV_BASE_SITEURL . 'themes/' . $module_info['template'] . '/images/' . $module_file . '/comingsoon-large.jpg'; } else { $row['images'] = NV_BASE_SITEURL . 'themes/' . $module_info['template'] . '/images/' . $module_file . '/comingsoon-medium.jpg'; } } $xtpl->assign('ROW', $row); // Chi xuat media neu nhu kieu hien thi la danh sach dang blog if (!empty($row['mediavalue']) and $BL->setting['indexViewType'] == 'type_blog') { if (in_array($row['mediatype'], array(0, 1))) { // Kieu hinh anh $xtpl->parse('main.loop.media.image'); } elseif ($row['mediatype'] == 2) { // Kieu am thanh $xtpl->parse('main.loop.media.audio'); } elseif ($row['mediatype'] == 3) { // Kieu video $xtpl->parse('main.loop.media.video'); } elseif ($row['mediatype'] == 4) { // Kieu iframe $xtpl->parse('main.loop.media.iframe'); } $xtpl->parse('main.loop.media'); } // Xuất html, text if (!empty($row['fullpage'])) { $call_highlight = true; $xtpl->parse('main.loop.bodyhtml'); } else { $xtpl->parse('main.loop.hometext'); } $xtpl->parse('main.loop'); } if (!empty($generate_page)) { $xtpl->assign('GENERATE_PAGE', $generate_page); $xtpl->parse('main.generate_page'); } // Gọi framewokrs highlight nếu có full page if ($call_highlight == true) { $BL->callFrameWorks('highlight'); } $xtpl->parse('main'); return $xtpl->text('main'); }
while ($row = $result->fetch()) { $image = array(NV_BASE_SITEURL . NV_ASSETS_DIR . '/images/mail_new.gif', 12, 9); $status = 'New'; $style = " style=\"font-weight:bold;cursor:pointer;white-space:nowrap;\""; if ($row['is_read'] == 1) { $style = " style=\"cursor:pointer;white-space:nowrap;\""; if ($row['is_reply']) { $image = array(NV_BASE_SITEURL . NV_ASSETS_DIR . '/images/mail_reply.gif', 13, 14); $status = $lang_module['tt2_row_title']; } else { $image = array(NV_BASE_SITEURL . NV_ASSETS_DIR . '/images/mail_old.gif', 12, 11); $status = $lang_module['tt1_row_title']; } } $onclick = "onclick=\"location.href='" . NV_BASE_ADMINURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&" . NV_NAME_VARIABLE . "=" . $module_name . "&" . NV_OP_VARIABLE . "=view&id=" . $row['id'] . "'\""; $xtpl->assign('ROW', array('id' => $row['id'], 'sender_name' => $row['sender_name'], 'path' => $contact_allowed['view'][$row['cid']], 'cat' => $row['cat'], 'title' => nv_clean60($row['title'], 60), 'time' => $row['send_time'] >= $currday ? nv_date('H:i d/m/Y', $row['send_time']) : nv_date('d/m/Y', $row['send_time']), 'style' => $style, 'onclick' => $onclick, 'status' => $status, 'image' => $image)); $xtpl->parse('main.data.row'); } $generate_page = nv_generate_page($base_url, $num_items, $per_page, $page); if (!empty($generate_page)) { $xtpl->assign('GENERATE_PAGE', $generate_page); $xtpl->parse('main.data.generate_page'); } } } if (empty($num_items)) { $xtpl->parse('main.empty'); } else { $xtpl->parse('main.data'); } $xtpl->parse('main');
$admin_id = $row['admin_id']; if ($admin_id) { $sql = "SELECT `username`, `full_name` FROM `" . NV_USERS_GLOBALTABLE . "` WHERE `userid`=" . $admin_id; $result = $db->sql_query($sql); $numrows = $db->sql_numrows($result); if ($numrows != 1) { $admin_id = ""; } else { list($username, $full_name) = $db->sql_fetchrow($result); if (empty($full_name)) { $full_name = $username; } $admin_id = "<a href=\"" . NV_BASE_ADMINURL . "index.php?" . NV_NAME_VARIABLE . "=authors&id=" . $row['admin_id'] . "\">" . $full_name . "</a>"; } } $array[] = array('id' => (int) $row['id'], 'subject' => nv_clean60($row['subject'], 60), 'file' => $file, 'file_title' => $row['title'], 'post_name' => $post_name, 'post_email' => "<a href=\"mailto:" . $row['post_email'] . "\">" . $row['post_email'] . "</a>", 'post_ip' => $row['post_ip'], 'post_time' => nv_date("d/m/Y H:i", $row['post_time']), 'comment' => $row['comment'], 'admin_reply' => $row['admin_reply'], 'admin_id' => $admin_id, 'st' => $st, 'comments_of_file' => $comments_of_file, 'edit_href' => $edit_href); } if ($nv_Request->isset_request("fid", "get")) { $page_title = sprintf($lang_module['comment_of_file'], $array[0]['file_title']); } else { $page_title = $lang_module['comment_st' . $status]; } $generate_page = nv_generate_page($base_url, $all_page, $per_page, $page); $xtpl = new XTemplate("comment.tpl", NV_ROOTDIR . "/themes/" . $global_config['module_theme'] . "/modules/" . $module_file); $xtpl->assign('LANG', $lang_module); $xtpl->assign('GLANG', $lang_global); $xtpl->assign('COMMENT_STATUS0_HREF', NV_BASE_ADMINURL . "index.php?" . NV_NAME_VARIABLE . "=" . $module_name . "&" . NV_OP_VARIABLE . "=comment&status=0"); $xtpl->assign('COMMENT_STATUS1_HREF', NV_BASE_ADMINURL . "index.php?" . NV_NAME_VARIABLE . "=" . $module_name . "&" . NV_OP_VARIABLE . "=comment&status=1"); $xtpl->assign('COMMENT_STATUS2_HREF', NV_BASE_ADMINURL . "index.php?" . NV_NAME_VARIABLE . "=" . $module_name . "&" . NV_OP_VARIABLE . "=comment&status=2"); if (!empty($array)) { $a = 0;