/** * 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_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']; 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_set_cache($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_news($block_config, $mod_data) { global $module_array_cat, $module_info, $db, $module_config; $module = $block_config['module']; $blockwidth = $module_config[$module]['blockwidth']; $array_block_news = array(); $cache_file = NV_LANG_DATA . "_" . $module . "_block_news_" . NV_CACHE_PREFIX . ".cache"; if (($cache = nv_get_cache($cache_file)) != false) { $array_block_news = unserialize($cache); } else { $numrow = isset($block_config['numrow']) ? $block_config['numrow'] : 20; $sql = "SELECT id, catid, publtime, exptime, title, alias, homeimgthumb, homeimgfile FROM `" . NV_PREFIXLANG . "_" . $mod_data . "_rows` WHERE `status`= 1 ORDER BY `publtime` DESC LIMIT 0 , " . $numrow; $result = $db->sql_query($sql); while (list($id, $catid, $publtime, $exptime, $title, $alias, $homeimgthumb, $homeimgfile) = $db->sql_fetchrow($result)) { $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; if (!empty($homeimgthumb)) { $array_img = explode("|", $homeimgthumb); } else { $array_img = array("", ""); } 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]; } elseif (nv_is_url($homeimgfile)) { $imgurl = $homeimgfile; } elseif ($homeimgfile != "" and file_exists(NV_UPLOADS_REAL_DIR . '/' . $module . '/' . $homeimgfile)) { $imgurl = NV_BASE_SITEURL . NV_UPLOADS_DIR . '/' . $module . '/' . $homeimgfile; } else { $imgurl = ""; } $array_block_news[] = array('id' => $id, 'title' => $title, 'link' => $link, 'imgurl' => $imgurl, 'width' => $blockwidth); } $cache = serialize($array_block_news); nv_set_cache($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/"); $a = 1; foreach ($array_block_news as $array_news) { $xtpl->assign('blocknews', $array_news); if (!empty($array_news['imgurl'])) { $xtpl->parse('main.newloop.imgblock'); } $xtpl->parse('main.newloop'); $xtpl->assign('BACKGROUND', $a % 2 ? 'bg ' : ''); ++$a; } $xtpl->parse('main'); return $xtpl->text('main'); }
/** * nv_groups_list() * * @return */ function nv_groups_list() { $cache_file = NV_LANG_DATA . '_groups_list_' . NV_CACHE_PREFIX . '.cache'; if (($cache = nv_get_cache('users', $cache_file)) != false) { return unserialize($cache); } else { global $db, $db_config, $global_config, $lang_global; $groups = array(); $result = $db->query('SELECT group_id, title, idsite FROM ' . NV_GROUPS_GLOBALTABLE . ' WHERE (idsite = ' . $global_config['idsite'] . ' OR (idsite =0 AND siteus = 1)) ORDER BY idsite, weight'); while ($row = $result->fetch()) { if ($row['group_id'] < 9) { $row['title'] = $lang_global['level' . $row['group_id']]; } $groups[$row['group_id']] = ($global_config['idsite'] > 0 and empty($row['idsite'])) ? '<strong>' . $row['title'] . '</strong>' : $row['title']; } nv_set_cache('users', $cache_file, serialize($groups)); return $groups; } }
$featured = $item['id']; } } if ($featured) { $db->where('status= 1 AND inhome=1 AND id!=' . $featured); } else { $db->where('status= 1 AND inhome=1'); } $db->select('id, listcatid, topicid, admin_id, author, sourceid, addtime, edittime, publtime, title, alias, hometext, homeimgfile, homeimgalt, homeimgthumb, allowed_rating, hitstotal, hitscm, total_rating, click_rating')->order($order_by)->limit($per_page)->offset(($page - 1) * $per_page); $results = $db->query($db->sql()); while ($item = $results->fetch()) { $item['imghome'] = ''; $item['newday'] = $global_array_cat[$catid]['newday']; $item['link'] = $global_array_cat[$catid]['link'] . '/' . $item['alias'] . '-' . $item['id'] . $global_config['rewrite_exturl']; $array_catpage[] = $item; } $viewcat = 'viewcat_list_new'; $generate_page = nv_alias_page($page_title, $base_url, $num_items, $per_page, $page); $contents = call_user_func($viewcat, $array_catpage, $catid, ($page - 1) * $per_page, $generate_page); } if (!defined('NV_IS_MODADMIN') and $contents != '' and $cache_file != '') { nv_set_cache($module_name, $cache_file, $contents); } } if ($page > 1) { $page_title .= ' ' . NV_TITLEBAR_DEFIS . ' ' . $lang_global['page'] . ' ' . $page; $description .= ' ' . $page; } include NV_ROOTDIR . '/includes/header.php'; echo nv_site_theme($contents); include NV_ROOTDIR . '/includes/footer.php';
/** * nv_blocks_get_content() * * @return */ function nv_blocks_content($sitecontent) { global $db, $module_info, $module_name, $op, $global_config, $lang_global, $site_mods, $user_info, $themeConfig; $_posAllowed = array(); foreach ($themeConfig['positions']['position'] as $_pos) { $_pos = trim((string) $_pos['tag']); unset($matches); if (preg_match("/^\\[([^\\]]+)\\]\$/is", $_pos, $matches)) { $_posAllowed[] = $matches[1]; } } if (empty($_posAllowed)) { return $sitecontent; } //Tim trong noi dung trang cac doan ma phu hop voi cac nhom block tren $_posAllowed = implode("|", array_map("nv_preg_quote", $_posAllowed)); preg_match_all("/\\[(" . $_posAllowed . ")(\\d+)?\\]()/", $sitecontent, $_posReal); if (empty($_posReal[0])) { return $sitecontent; } $_posReal = array_combine($_posReal[0], $_posReal[3]); $cache_file = NV_LANG_DATA . "_themes_" . $global_config['module_theme'] . "_" . $module_name . "_" . NV_CACHE_PREFIX . ".cache"; $blocks = array(); if (($cache = nv_get_cache($cache_file)) !== false) { $cache = unserialize($cache); if (isset($cache[$module_info['funcs'][$op]['func_id']])) { $blocks = $cache[$module_info['funcs'][$op]['func_id']]; } unset($cache); } else { $cache = array(); $in = array(); $sql = "SELECT * FROM `" . NV_MODULES_TABLE . "` AS m LEFT JOIN `" . NV_MODFUNCS_TABLE . "` AS f ON m.title=f.in_module WHERE m.act = 1 ORDER BY m.weight, f.subweight"; $list = nv_db_cache($sql, '', 'modules'); foreach ($list as $row) { $row['title'] = $db->unfixdb($row['title']); if ($row['title'] == $module_name and $row['show_func']) { $in[] = $row['func_id']; } } $_result = $db->sql_query("SELECT t1.*, t2.func_id FROM `" . NV_BLOCKS_TABLE . "_groups` AS t1 \n\t\t INNER JOIN `" . NV_BLOCKS_TABLE . "_weight` AS t2 \n\t\t ON t1.bid = t2.bid \n\t\t WHERE t2.func_id IN (" . implode(",", $in) . ") \n\t\t AND t1.theme ='" . $global_config['module_theme'] . "' \n\t\t AND t1.active=1 \n\t\t ORDER BY t2.weight ASC"); while ($_row = $db->sql_fetch_assoc($_result)) { $_row['module'] = $db->unfixdb($_row['module']); $_row['file_name'] = $db->unfixdb($_row['file_name']); $_row['template'] = $db->unfixdb($_row['template']); $_row['position'] = $db->unfixdb($_row['position']); // Cau hinh block $block_config = !empty($_row['config']) ? unserialize($_row['config']) : array(); $block_config['bid'] = $_row['bid']; $block_config['module'] = $_row['module']; $block_config['title'] = $_row['title']; $block_config['block_name'] = substr($_row['file_name'], 0, -4); // Tieu de block $blockTitle = (!empty($_row['title']) and !empty($_row['link'])) ? "<a href=\"" . $_row['link'] . "\">" . $_row['title'] . "</a>" : $_row['title']; if (!isset($cache[$_row['func_id']])) { $cache[$_row['func_id']] = array(); } $cache[$_row['func_id']][] = array('bid' => $_row['bid'], 'position' => $_row['position'], 'module' => $_row['module'], 'blockTitle' => $blockTitle, 'file_name' => $_row['file_name'], 'template' => $_row['template'], 'exp_time' => $_row['exp_time'], 'groups_view' => $_row['groups_view'], 'all_func' => $_row['all_func'], 'block_config' => $block_config); } if (isset($cache[$module_info['funcs'][$op]['func_id']])) { $blocks = $cache[$module_info['funcs'][$op]['func_id']]; } $db->sql_freeresult($_result); $cache = serialize($cache); nv_set_cache($cache_file, $cache); unset($cache, $in, $block_config, $blockTitle); } if (!empty($blocks)) { $unact = array(); $array_position = array_keys($_posReal); foreach ($blocks as $_row) { if ($_row['exp_time'] != 0 and $_row['exp_time'] <= NV_CURRENTTIME) { $unact[] = $_row['bid']; continue; } //Kiem tra quyen xem block if (in_array($_row['position'], $array_position) and nv_setBlockAllowed($_row['groups_view'])) { $block_config = $_row['block_config']; $blockTitle = $_row['blockTitle']; $content = ""; if ($_row['module'] == "global" and file_exists(NV_ROOTDIR . "/includes/blocks/" . $_row['file_name'])) { include NV_ROOTDIR . "/includes/blocks/" . $_row['file_name']; } elseif (isset($site_mods[$_row['module']]['module_file']) and !empty($site_mods[$_row['module']]['module_file']) and file_exists(NV_ROOTDIR . "/modules/" . $site_mods[$_row['module']]['module_file'] . "/blocks/" . $_row['file_name'])) { include NV_ROOTDIR . "/modules/" . $site_mods[$_row['module']]['module_file'] . "/blocks/" . $_row['file_name']; } unset($block_config); if (!empty($content) or defined('NV_IS_DRAG_BLOCK')) { $xtpl = null; $_row['template'] = empty($_row['template']) ? "default" : $_row['template']; $_template = 'default'; if (!empty($module_info['theme']) and file_exists(NV_ROOTDIR . "/themes/" . $module_info['theme'] . "/layout/block." . $_row['template'] . ".tpl")) { $xtpl = new XTemplate("block." . $_row['template'] . ".tpl", NV_ROOTDIR . "/themes/" . $module_info['theme'] . "/layout"); $_template = $module_info['theme']; } elseif (!empty($global_config['module_theme']) and file_exists(NV_ROOTDIR . "/themes/" . $global_config['module_theme'] . "/layout/block." . $_row['template'] . ".tpl")) { $xtpl = new XTemplate("block." . $_row['template'] . ".tpl", NV_ROOTDIR . "/themes/" . $global_config['module_theme'] . "/layout"); $_template = $global_config['module_theme']; } elseif (!empty($global_config['site_theme']) and file_exists(NV_ROOTDIR . "/themes/" . $global_config['site_theme'] . "/layout/block." . $_row['template'] . ".tpl")) { $xtpl = new XTemplate("block." . $_row['template'] . ".tpl", NV_ROOTDIR . "/themes/" . $global_config['site_theme'] . "/layout"); $_template = $global_config['site_theme']; } elseif (file_exists(NV_ROOTDIR . "/themes/default/layout/block." . $_row['template'] . ".tpl")) { $xtpl = new XTemplate("block." . $_row['template'] . ".tpl", NV_ROOTDIR . "/themes/default/layout"); } if (!empty($xtpl)) { $xtpl->assign('BLOCK_TITLE', $_row['blockTitle']); $xtpl->assign('BLOCK_CONTENT', $content); $xtpl->assign('TEMPLATE', $_template); $xtpl->assign('NV_BASE_SITEURL', NV_BASE_SITEURL); $xtpl->parse('mainblock'); $content = $xtpl->text('mainblock'); } else { $content = $_row['blockTitle'] . "<br />" . $content . "<br />"; } if (defined('NV_IS_DRAG_BLOCK')) { $content = '<div class="portlet" id="bl_' . $_row['bid'] . '"> <p> <a href="javascript:void(0)" class="block_content" name="' . $_row['bid'] . '"> <img style="border:none" src="' . NV_BASE_SITEURL . 'images/edit.png" alt="' . $lang_global['edit_block'] . '"/> ' . $lang_global['edit_block'] . '</a> | <a href="javascript:void(0)" class="delblock" name="' . $_row['bid'] . '"> <img style="border:none" src="' . NV_BASE_SITEURL . 'images/delete.png" alt="' . $lang_global['delete_block'] . '"/> ' . $lang_global['delete_block'] . '</a> | <a href="javascript:void(0)" class="outgroupblock" name="' . $_row['bid'] . '"> <img style="border:none" src="' . NV_BASE_SITEURL . 'images/outgroup.png" alt="' . $lang_global['outgroup_block'] . '"/> ' . $lang_global['outgroup_block'] . '</a> </p> ' . $content . '</div>'; } $_posReal[$_row['position']] .= $content; } } } if (!empty($unact)) { $sql = "UPDATE `" . NV_BLOCKS_TABLE . "_groups` SET `active`='0' WHERE `bid`IN (" . implode(",", $unact) . ") LIMIT " . sizeof($unact); $db->sql_query($sql); unlink($cache_file); } } if (defined('NV_IS_DRAG_BLOCK')) { $array_keys = array_keys($_posReal); foreach ($array_keys as $__pos) { $_posReal[$__pos] = '<div class="column" id="' . preg_replace('#\\[|\\]#', '', $__pos) . '">' . $_posReal[$__pos]; $_posReal[$__pos] .= ' <span><a class="block_content" id="' . $__pos . '" href="javascript:void(0)"><img style="border:none" src="' . NV_BASE_SITEURL . 'images/add.png" alt="' . $lang_global['add_block'] . '"/> ' . $lang_global['add_block'] . '</a></span>'; $_posReal[$__pos] .= '</div>'; } } $sitecontent = str_replace(array_keys($_posReal), array_values($_posReal), $sitecontent); return $sitecontent; }
$item['link'] = $global_array_cat[$item['catid']]['link'] . "/" . $item['alias'] . "-" . $item['id']; $array_catpage[] = $item; } $viewcat = "viewcat_grid_new"; $generate_page = nv_alias_page($page_title, $base_url, $all_page, $per_page, $page); $contents = call_user_func($viewcat, $array_catpage, 0, $generate_page); } elseif ($viewcat == "viewcat_list_new" or $viewcat == "viewcat_list_old") { $order_by = $viewcat == "viewcat_list_new" ? "ORDER BY `publtime` DESC" : "ORDER BY `publtime` ASC"; $sql = "SELECT SQL_CALC_FOUND_ROWS `id`, `catid`, `topicid`, `admin_id`, `author`, `sourceid`, `addtime`, `edittime`, `publtime`, `title`, `alias`, `hometext`, `homeimgfile`, `homeimgalt`, `homeimgthumb`, `allowed_rating`, `hitstotal`, `hitscm`, `total_rating`, `click_rating`, `keywords` FROM `" . NV_PREFIXLANG . "_" . $module_data . "_rows` WHERE `status`= 1 AND `inhome`='1' " . $order_by . " LIMIT " . ($page - 1) * $per_page . "," . $per_page; $result = $db->sql_query($sql); $result_all = $db->sql_query("SELECT FOUND_ROWS()"); list($all_page) = $db->sql_fetchrow($result_all); while ($item = $db->sql_fetch_assoc($result)) { $item['imghome'] = ""; $item['link'] = $global_array_cat[$item['catid']]['link'] . "/" . $item['alias'] . "-" . $item['id']; $array_catpage[] = $item; } $viewcat = "viewcat_list_new"; $generate_page = nv_alias_page($page_title, $base_url, $all_page, $per_page, $page); $contents = call_user_func($viewcat, $array_catpage, 0, ($page - 1) * $per_page, $generate_page); } if (!defined('NV_IS_MODADMIN') and $contents != "" and $cache_file != "") { nv_set_cache($cache_file, $contents); } } if ($page > 1) { $page_title .= ' ' . NV_TITLEBAR_DEFIS . ' ' . $lang_global['page'] . ' ' . $page; } include NV_ROOTDIR . "/includes/header.php"; echo nv_site_theme($contents); include NV_ROOTDIR . "/includes/footer.php";
/** * nv_block_headline() * * @return */ function nv_block_headline() { global $module_name, $module_data, $db, $my_head, $my_footer, $module_info, $module_file, $global_array_cat; $array_bid_content = array(); $cache_file = NV_LANG_DATA . "_" . $module_name . "_block_headline_" . NV_CACHE_PREFIX . ".cache"; if (($cache = nv_get_cache($cache_file)) != false) { $array_bid_content = unserialize($cache); } else { $id = 0; $sql = "SELECT `bid`, `title`, `number` FROM `" . NV_PREFIXLANG . "_" . $module_data . "_block_cat` ORDER BY `weight` ASC LIMIT 0, 2"; $result = $db->sql_query($sql); while (list($bid, $titlebid, $numberbid) = $db->sql_fetchrow($result)) { ++$id; $array_bid_content[$id] = array("id" => $id, "bid" => $bid, "title" => $titlebid, "number" => $numberbid); } foreach ($array_bid_content as $i => $array_bid) { $sql = "SELECT t1.id, t1.catid, t1.title, t1.alias, t1.homeimgfile, t1.homeimgalt FROM `" . NV_PREFIXLANG . "_" . $module_data . "_rows` as t1 INNER JOIN `" . NV_PREFIXLANG . "_" . $module_data . "_block` AS t2 ON t1.id = t2.id WHERE t2.bid= " . $array_bid['bid'] . " AND t1.status= 1 AND t1.inhome='1' ORDER BY t2.weight ASC LIMIT 0 , " . $array_bid['number']; $result = $db->sql_query($sql); $array_content = array(); while (list($id, $catid_i, $title, $alias, $homeimgfile, $homeimgalt) = $db->sql_fetchrow($result)) { $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; $array_content[] = array('title' => $title, 'link' => $link, 'homeimgfile' => $homeimgfile, 'homeimgalt' => $homeimgalt); } $array_bid_content[$i]['content'] = $array_content; } $cache = serialize($array_bid_content); nv_set_cache($cache_file, $cache); } $xtpl = new XTemplate("block_headline.tpl", NV_ROOTDIR . "/themes/" . $module_info['template'] . "/modules/" . $module_file); $xtpl->assign('PIX_IMG', NV_BASE_SITEURL . 'images/pix.gif'); $xtpl->assign('NV_BASE_SITEURL', NV_BASE_SITEURL); $xtpl->assign('TEMPLATE', $module_info['template']); $images = array(); if (!empty($array_bid_content[1]['content'])) { $hot_news = $array_bid_content[1]['content']; $a = 0; foreach ($hot_news as $hot_news_i) { if (!empty($hot_news_i['homeimgfile']) and file_exists(NV_UPLOADS_REAL_DIR . '/' . $module_name . '/' . $hot_news_i['homeimgfile'])) { $images_url = NV_BASE_SITEURL . NV_UPLOADS_DIR . '/' . $module_name . '/' . $hot_news_i['homeimgfile']; } elseif (nv_is_url($hot_news_i['homeimgfile'])) { $images_url = $hot_news_i['homeimgfile']; } if (!empty($images_url)) { $hot_news_i['image_alt'] = !empty($hot_news_i['homeimgalt']) ? $hot_news_i['homeimgalt'] : $hot_news_i['title']; $hot_news_i['imgID'] = $a; $images[] = $images_url; $xtpl->assign('HOTSNEWS', $hot_news_i); $xtpl->parse('main.hots_news_img.loop'); ++$a; } } $xtpl->parse('main.hots_news_img'); } foreach ($array_bid_content as $i => $array_bid) { $xtpl->assign('TAB_TITLE', $array_bid); $xtpl->parse('main.loop_tabs_title'); $content_bid = $array_bid['content']; if (!empty($content_bid)) { foreach ($content_bid as $lastest) { $xtpl->assign('LASTEST', $lastest); $xtpl->parse('main.loop_tabs_content.content.loop'); } $xtpl->parse('main.loop_tabs_content.content'); } $xtpl->parse('main.loop_tabs_content'); } if (empty($my_head) or !preg_match("/jquery\\.imgpreload\\.min\\.js[^>]+>/", $my_head)) { $my_head .= "<script type=\"text/javascript\" src=\"" . NV_BASE_SITEURL . "js/jquery/jquery.imgpreload.min.js\"></script>\n"; } $my_footer .= "<script type=\"text/javascript\" src=\"" . NV_BASE_SITEURL . "themes/" . $module_info['template'] . "/js/contentslider.js\"></script>\n"; $my_footer .= "<script type=\"text/javascript\" src=\"" . NV_BASE_SITEURL . "js/ui/jquery.ui.core.min.js\"></script>\n"; $my_footer .= "<script type=\"text/javascript\" src=\"" . NV_BASE_SITEURL . "js/ui/jquery.ui.tabs.min.js\"></script>\n"; $my_footer .= "<script type=\"text/javascript\">\n//<![CDATA[\n"; $my_footer .= '$(document).ready(function(){var b=["' . implode('","', $images) . '"];$.imgpreload(b,function(){for(var c=b.length,a=0;a<c;a++)$("#slImg"+a).attr("src",b[a]);featuredcontentslider.init({id:"slider1",contentsource:["inline",""],toc:"#increment",nextprev:[" "," "],revealtype:"click",enablefade:[true,0.2],autorotate:[true,3E3],onChange:function(){}});$("#tabs").tabs({ajaxOptions:{error:function(e,f,g,d){$(d.hash).html("Couldnt load this tab.")}}});$("#topnews").show()})});'; $my_footer .= "\n//]]>\n</script>\n"; $my_footer .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"" . NV_BASE_SITEURL . "themes/" . $module_info['template'] . "/css/contentslider.css\" />\n"; $xtpl->parse('main'); return $xtpl->text('main'); }
} else { $db->sqlreset()->select('album_id, category_id, name, alias, meta_title')->from(NV_PREFIXLANG . '_' . $module_data . '_album')->where('status=1')->order('date_added ASC')->limit($per_page)->offset(($page - 1) * $per_page); $albums = $db->query($db->sql()); while ($album = $albums->fetch()) { $album['link'] = NV_MAIN_DOMAIN . nv_url_rewrite($global_photo_cat[$album['category_id']]['link'] . '/' . $album['alias'] . '-' . $album['album_id'] . $global_config['rewrite_exturl'], true); $album['photo'] = array(); $db->sqlreset()->select('row_id, file')->from(NV_PREFIXLANG . '_' . $module_data . '_rows')->where('status=1 AND album_id=' . $album['album_id']); $photo = $db->query($db->sql()); while ($row = $photo->fetch()) { $album['photo'][] = array('image' => NV_MAIN_DOMAIN . NV_BASE_SITEURL . NV_UPLOADS_DIR . '/' . $module_name . '/images/' . $row['file'], 'row_id' => $row['row_id']); } $photo->closeCursor(); $array_url[] = $album; } $cache = serialize($array_url); nv_set_cache($module_name, $cacheFile, $cache); } $content = ""; $content .= "<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\" xmlns:xhtml=\"http://www.w3.org/1999/xhtml\" xmlns:image=\"http://www.google.com/schemas/sitemap-image/1.1\">\n"; foreach ($array_url as $data) { $content .= "<url>\n"; $content .= " <loc>" . $data['link'] . "</loc>\n"; foreach ($data['photo'] as $array) { $content .= " <image:image>\n"; $content .= " <image:loc>" . $array['image'] . "</image:loc>\n"; $content .= " <image:title>" . $data['name'] . " " . $array['row_id'] . "</image:title>\n"; $content .= " <image:caption>" . $data['meta_title'] . " " . $array['row_id'] . "</image:caption>\n"; $content .= " </image:image>\n"; } $content .= "</url>\n"; }
<?php /** * @Project NUKEVIET 3.x * @Author VINADES.,JSC (contact@vinades.vn) * @Copyright (C) 2012 VINADES.,JSC. All rights reserved * @Createdate 4/12/2010, 1:27 */ if (!defined('NV_IS_MOD_DOWNLOAD')) { die('Stop!!!'); } $url = array(); $cacheFile = NV_ROOTDIR . "/" . NV_CACHEDIR . "/" . NV_LANG_DATA . "_" . $module_name . "_Sitemap.cache"; $pa = NV_CURRENTTIME - 7200; if (($cache = nv_get_cache($cacheFile)) != false and filemtime($cacheFile) >= $pa) { $url = unserialize($cache); } else { $list_cats = nv_list_cats(); $in = array_keys($list_cats); $in = implode(",", $in); $sql = "SELECT `catid`, `alias`, `uploadtime` FROM `" . NV_PREFIXLANG . "_" . $module_data . "` WHERE `catid` IN (" . $in . ") AND `status`=1 ORDER BY `uploadtime` DESC LIMIT 1000"; $result = $db->sql_query($sql); while (list($cid, $alias, $publtime) = $db->sql_fetchrow($result)) { $url[] = array('link' => NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&" . NV_NAME_VARIABLE . "=" . $module_name . "&" . NV_OP_VARIABLE . "=" . $list_cats[$cid]['alias'] . "/" . $alias, 'publtime' => $publtime); } $cache = serialize($url); nv_set_cache($cacheFile, $cache); } nv_xmlSitemap_generate($url); die;
function nv_block_headline($block_config) { global $module_name, $module_data, $db, $my_head, $my_footer, $module_info, $module_file, $module_upload, $global_array_cat, $global_config; $array_bid_content = array(); $cache_file = NV_LANG_DATA . '_block_headline_' . NV_CACHE_PREFIX . '.cache'; if (($cache = nv_get_cache($module_name, $cache_file)) != false) { $array_bid_content = unserialize($cache); } else { $id = 0; $db->sqlreset()->select('bid, title, numbers')->from(NV_PREFIXLANG . '_' . $module_data . '_block_cat')->order('weight ASC')->limit(2); $result = $db->query($db->sql()); while (list($bid, $titlebid, $numberbid) = $result->fetch(3)) { ++$id; $array_bid_content[$id] = array('id' => $id, 'bid' => $bid, 'title' => $titlebid, 'number' => $numberbid); } foreach ($array_bid_content as $i => $array_bid) { $db->sqlreset()->select('t1.id, t1.catid, t1.title, t1.alias, t1.homeimgfile, t1.homeimgalt, t1.hometext')->from(NV_PREFIXLANG . '_' . $module_data . '_rows t1')->join('INNER JOIN ' . NV_PREFIXLANG . '_' . $module_data . '_block t2 ON t1.id = t2.id')->where('t2.bid=' . $array_bid['bid'])->order('t2.weight ASC')->limit($array_bid['number']); $result = $db->query($db->sql()); $array_content = array(); while (list($id, $catid_i, $title, $alias, $homeimgfile, $homeimgalt, $hometext) = $result->fetch(3)) { $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 . $global_config['rewrite_exturl']; $array_content[] = array('title' => $title, 'link' => $link, 'homeimgfile' => $homeimgfile, 'homeimgalt' => $homeimgalt, 'hometext' => $hometext); } $array_bid_content[$i]['content'] = $array_content; } $cache = serialize($array_bid_content); nv_set_cache($module_name, $cache_file, $cache); } $xtpl = new XTemplate('block_headline.tpl', NV_ROOTDIR . '/themes/' . $module_info['template'] . '/modules/' . $module_file); $xtpl->assign('PIX_IMG', NV_BASE_SITEURL . 'images/pix.gif'); $xtpl->assign('NV_BASE_SITEURL', NV_BASE_SITEURL); $xtpl->assign('TEMPLATE', $module_info['template']); $images = array(); if (!empty($array_bid_content[1]['content'])) { $hot_news = $array_bid_content[1]['content']; $a = 0; foreach ($hot_news as $hot_news_i) { if (!empty($hot_news_i['homeimgfile']) and file_exists(NV_UPLOADS_REAL_DIR . '/' . $module_upload . '/' . $hot_news_i['homeimgfile'])) { $images_url = NV_BASE_SITEURL . NV_UPLOADS_DIR . '/' . $module_upload . '/' . $hot_news_i['homeimgfile']; } elseif (nv_is_url($hot_news_i['homeimgfile'])) { $images_url = $hot_news_i['homeimgfile']; } if (!empty($images_url)) { $hot_news_i['image_alt'] = !empty($hot_news_i['homeimgalt']) ? $hot_news_i['homeimgalt'] : $hot_news_i['title']; $hot_news_i['imgID'] = $a; $images[] = $images_url; $xtpl->assign('HOTSNEWS', $hot_news_i); $xtpl->parse('main.hots_news_img.loop'); ++$a; } } $xtpl->parse('main.hots_news_img'); } foreach ($array_bid_content as $i => $array_bid) { $xtpl->assign('TAB_TITLE', $array_bid); $xtpl->parse('main.loop_tabs_title'); $content_bid = $array_bid['content']; if (!empty($content_bid)) { foreach ($content_bid as $lastest) { if (!empty($lastest['homeimgfile']) and file_exists(NV_UPLOADS_REAL_DIR . '/' . $module_upload . '/' . $lastest['homeimgfile'])) { $lastest['homeimgfile'] = NV_BASE_SITEURL . NV_UPLOADS_DIR . '/' . $module_upload . '/' . $lastest['homeimgfile']; } elseif (nv_is_url($lastest['homeimgfile'])) { $lastest['homeimgfile'] = $lastest['homeimgfile']; } else { $lastest['homeimgfile'] = ''; } if (!$block_config['showtooltip']) { $xtpl->assign('TITLE', 'title="' . $lastest['title'] . '"'); } $lastest['hometext'] = nv_clean60($lastest['hometext'], $block_config['tooltip_length'], true); $xtpl->assign('LASTEST', $lastest); $xtpl->parse('main.loop_tabs_content.content.loop'); } $xtpl->parse('main.loop_tabs_content.content'); } $xtpl->parse('main.loop_tabs_content'); } if ($block_config['showtooltip']) { $xtpl->assign('TOOLTIP_POSITION', $block_config['tooltip_position']); $xtpl->parse('main.tooltip'); } if (empty($my_head) or !preg_match("/jquery\\.imgpreload\\.min\\.js[^>]+>/", $my_head)) { $my_head .= "<script type=\"text/javascript\" src=\"" . NV_BASE_SITEURL . "js/jquery/jquery.imgpreload.min.js\"></script>\n"; } $my_footer .= "<script type=\"text/javascript\" src=\"" . NV_BASE_SITEURL . "themes/" . $module_info['template'] . "/js/contentslider.js\"></script>\n"; $my_footer .= "<script type=\"text/javascript\" src=\"" . NV_BASE_SITEURL . "js/ui/jquery.ui.core.min.js\"></script>\n"; $my_footer .= "<script type=\"text/javascript\" src=\"" . NV_BASE_SITEURL . "js/ui/jquery.ui.tabs.min.js\"></script>\n"; $my_footer .= "<script type=\"text/javascript\">\n//<![CDATA[\n"; $my_footer .= '$(document).ready(function(){var b=["' . implode('","', $images) . '"];$.imgpreload(b,function(){for(var c=b.length,a=0;a<c;a++)$("#slImg"+a).attr("src",b[a]);featuredcontentslider.init({id:"slider1",contentsource:["inline",""],toc:"#increment",nextprev:[" "," "],revealtype:"click",enablefade:[true,0.2],autorotate:[true,3E3],onChange:function(){}});$("#tabs").tabs({ajaxOptions:{error:function(e,f,g,d){$(d.hash).html("Couldnt load this tab.")}}});$("#topnews").show()})});'; $my_footer .= "\n//]]>\n</script>\n"; $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_db_cache($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_get_cache($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_set_cache($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_db_cache($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'); }
function nv_tab_catid($block_config) { global $module_array_cat, $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']; $numrow = !empty($block_config['config_numrow']) ? $block_config['config_numrow'] : 6; $show_no_image = $module_config[$module]['show_no_image']; if (isset($module_array_cat[$block_config['config_catid']]) && !empty($module_array_cat[$block_config['config_catid']])) { if (file_exists(NV_ROOTDIR . '/themes/' . $module_info['template'] . '/modules/' . $mod_file . '/block_tab_catid.tpl')) { $block_theme = $module_info['template']; } else { $block_theme = 'default'; } $xtpl = new XTemplate('block_tab_catid.tpl', NV_ROOTDIR . '/themes/' . $block_theme . '/modules/' . $mod_file); $xtpl->assign('NV_BASE_SITEURL', NV_BASE_SITEURL); $xtpl->assign('TEMPLATE', $block_theme); if (!defined('LOAD_SCRIPT_TAB')) { $xtpl->parse('main.load_script_tab'); define('LOAD_SCRIPT_TAB', true); } $cat_news = $module_array_cat[$block_config['config_catid']]; $array_cat = getParentSub($cat_news['catid']); $data_content = array(); $cache_file = NV_LANG_DATA . '_' . md5(implode(',', $array_cat)) . '_' . NV_CACHE_PREFIX . '.cache'; if (($cache = nv_get_cache($module, $cache_file)) != false) { $data_content = unserialize($cache); } else { foreach ($array_cat as $_catid) { if ($module_array_cat[$_catid]['parentid'] == 0) { $where = 'WHERE status= 1 AND catid IN ( ' . implode(',', $array_cat) . ' )'; } else { $where = 'WHERE status= 1 AND catid=' . $_catid; } $result = $db->query('SELECT id, catid, title, alias, homeimgfile, homeimgthumb, homeimgalt, publtime FROM ' . NV_PREFIXLANG . '_' . $mod_data . '_rows ' . $where . ' ORDER BY publtime DESC LIMIT ' . intval($numrow)); $data = array(); while ($l = $result->fetch()) { $l['title_cut'] = nv_clean60($l['title'], $block_config['config_numcut']); $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'] = creat_thumbs($l['id'], $l['homeimgfile'], $module, 100, 100); } elseif ($l['homeimgthumb'] == 3) { $l['thumb'] = $l['homeimgfile']; } elseif (!empty($show_no_image)) { $l['thumb'] = NV_BASE_SITEURL . $show_no_image; } else { $l['thumb'] = ''; } $data[] = $l; } $data_content[$_catid] = array('catid' => $_catid, 'title' => $module_array_cat[$_catid]['title'], 'alias' => $module_array_cat[$_catid]['alias'], 'content' => $data); } $cache = serialize($data_content); nv_set_cache($module, $cache_file, $cache); } $xtpl->assign('TAB_TOTAL', count($data_content)); $xtpl->assign('TAB_NAME', $block_config['config_catid']); if (!empty($data_content)) { $a = 0; foreach ($data_content as $_catid => $data) { $xtpl->assign('NUM', $a); $xtpl->assign('CAT', $data); $xtpl->parse('main.loopcat'); $b = 1; foreach ($data['content'] as $loop) { if ($b % 3 == 0) { $xtpl->parse('main.loop.loopcontent.clear'); } $loop['style'] = $a == 0 ? 'display: block' : 'display: none'; $xtpl->assign('LOOP', $loop); $xtpl->parse('main.loop.loopcontent'); ++$b; } $xtpl->parse('main.loop'); ++$a; } } $xtpl->parse('main'); return $xtpl->text('main'); } }
/** * NukevietChange_getContents() * * @param bool $refresh * @return */ function NukevietChange_getContents($refresh = false) { global $global_config; $url = "http://code.google.com/feeds/p/nuke-viet/svnchanges/basic"; $xmlfile = "nukevietGoogleCode.cache"; $load = false; $p = NV_CURRENTTIME - 18000; $p2 = NV_CURRENTTIME - 120; if (!file_exists(NV_ROOTDIR . "/" . NV_CACHEDIR . "/" . $xmlfile)) { $load = true; } else { $filemtime = @filemtime(NV_ROOTDIR . "/" . NV_CACHEDIR . "/" . $xmlfile); if ($filemtime < $p) { $load = true; } elseif ($refresh and $filemtime < $p2) { $load = true; } } if ($load) { include NV_ROOTDIR . '/includes/class/geturl.class.php'; $UrlGetContents = new UrlGetContents($global_config); $content = $UrlGetContents->get($url); if (!empty($content)) { if (nv_function_exists('mb_convert_encoding')) { $content = mb_convert_encoding($content, "utf-8"); } $content = simplexml_load_string($content); $content = nv_object2array($content); if (!empty($content)) { $code = array(); $code['updated'] = strtotime($content['updated']); $code['link'] = $content['link'][0]['@attributes']['href']; $code['entry'] = array(); if (isset($content['entry']) and !empty($content['entry'])) { foreach ($content['entry'] as $entry) { unset($matches); $cont = $entry['content']; preg_match_all("/(modify|add|delete)[^a-z0-9\\/\\.\\-\\_]+(\\/trunk\\/nukeviet\\/)([a-z0-9\\/\\.\\-\\_]+)/mi", $cont, $matches, PREG_SET_ORDER); $cont = array(); if (!empty($matches)) { foreach ($matches as $matche) { $key = strtolower($matche[1]); if (!isset($cont[$key])) { $cont[$key] = array(); } $cont[$key][] = $matche[3]; } } unset($matches2); preg_match("/Revision[\\s]+([\\d]*)[\\s]*\\:[\\s]+(.*?)/Uis", $entry['title'], $matches2); $code['entry'][] = array('updated' => strtotime($entry['updated']), 'title' => $matches2[2], 'id' => $matches2[1], 'link' => $entry['link']['@attributes']['href'], 'author' => $entry['author']['name'], 'content' => $cont); } nv_set_cache($xmlfile, serialize($code)); return $code; } } } } $content = nv_get_cache($xmlfile); if (!$content) { return false; } $content = unserialize($content); return $content; }
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'); }
$id++; $array_bid_content[$id] = array("id" => $id, "bid" => $bid, "title" => $titlebid, "number" => $numberbid); } foreach ($array_bid_content as $i => $array_bid) { $sql = "SELECT t1.id, t1.listcatid, t1.title, t1.alias, t1.homeimgfile, t1.homeimgalt FROM `" . NV_PREFIXLANG . "_" . $module_data . "_rows` as t1 INNER JOIN `" . NV_PREFIXLANG . "_" . $module_data . "_block` AS t2 ON t1.id = t2.id WHERE t2.bid= " . $array_bid['bid'] . " AND t1.status= 1 AND t1.inhome='1' and t1.publtime < " . NV_CURRENTTIME . " AND (t1.exptime=0 OR t1.exptime >" . NV_CURRENTTIME . ") ORDER BY t2.weight ASC LIMIT 0 , " . $array_bid['number']; $result = $db->sql_query($sql); $array_content = array(); while (list($id, $listcatid, $title, $alias, $homeimgfile, $homeimgalt) = $db->sql_fetchrow($result)) { $arr_catid = explode(',', $listcatid); $link = NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&" . NV_NAME_VARIABLE . "=" . $module_name . "&" . NV_OP_VARIABLE . "=" . $global_array_cat[$arr_catid[0]]['alias'] . "/" . $alias . "-" . $id; $array_content[] = array('title' => $title, 'link' => $link, 'homeimgfile' => $homeimgfile, 'homeimgalt' => $homeimgalt); } $array_bid_content[$i]['content'] = $array_content; } $cache = serialize($array_bid_content); nv_set_cache($cache_file, $cache); } $my_head .= "<script type=\"text/javascript\" src=\"" . NV_BASE_SITEURL . "themes/" . $module_info['template'] . "/js/contentslider.js\"></script>\n"; $my_head .= "<script type=\"text/javascript\" src=\"" . NV_BASE_SITEURL . "js/ui/jquery.ui.core.js\"></script>\n"; $my_head .= "<script type=\"text/javascript\" src=\"" . NV_BASE_SITEURL . "js/ui/jquery.ui.widget.js\"></script>\n"; $my_head .= "<script type=\"text/javascript\" src=\"" . NV_BASE_SITEURL . "js/ui/jquery.ui.tabs.js\"></script>\n"; $my_head .= "<script type=\"text/javascript\">\n"; $my_head .= "jQuery(document).ready(function(){\n"; $my_head .= "\t\$(\"#tabs\").tabs({\n"; $my_head .= "\t\tajaxOptions: {\n"; $my_head .= "\t\t\terror: function(xhr, status, index, anchor){\n"; $my_head .= "\t\t\t\$(anchor.hash).html(\"Couldn't load this tab.\");\n"; $my_head .= "\t\t\t}\n"; $my_head .= "\t\t}\n"; $my_head .= "\t});\n"; $my_head .= "});\n";
/** * nv_db_cache() * * @param mixed $sql * @return */ function nv_db_cache($sql, $key = '', $modname = '') { global $db, $module_name; $list = array(); if (empty($sql)) { return $list; } if (empty($modname)) { $modname = $module_name; } $cache_file = NV_LANG_DATA . "_" . $modname . "_" . md5($sql) . "_" . NV_CACHE_PREFIX . ".cache"; if (($cache = nv_get_cache($cache_file)) != false) { $list = unserialize($cache); } else { if (($result = $db->sql_query($sql)) !== false) { $a = 0; while ($row = $db->sql_fetch_assoc($result)) { $key2 = (!empty($key) and isset($row[$key])) ? $row[$key] : $a; $list[$key2] = $row; $a++; } $db->sql_freeresult($result); $cache = serialize($list); nv_set_cache($cache_file, $cache); } } return $list; }
if (($cache = nv_get_cache('modules', $cache_file)) != false) { $module_info['layout_funcs'] = unserialize($cache); } else { $module_info['layout_funcs'] = array(); $sth = $db->prepare('SELECT f.func_name, t.layout FROM ' . NV_MODFUNCS_TABLE . ' f INNER JOIN ' . NV_PREFIXLANG . '_modthemes t ON f.func_id=t.func_id WHERE f.in_module = :module AND t.theme= :theme'); $sth->bindParam(':module', $module_name, PDO::PARAM_STR); $sth->bindParam(':theme', $global_config['module_theme'], PDO::PARAM_STR); $sth->execute(); while ($row = $sth->fetch()) { $module_info['layout_funcs'][$row['func_name']] = $row['layout']; } $sth->closeCursor(); $cache = serialize($module_info['layout_funcs']); nv_set_cache('modules', $cache_file, $cache); } // Doc file cau hinh giao dien $themeConfig = nv_object2array(simplexml_load_file(NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/config.ini')); require NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/theme.php'; // Ket noi ngon ngu theo theme if (file_exists(NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/language/' . NV_LANG_INTERFACE . '.php')) { require NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/language/' . NV_LANG_INTERFACE . '.php'; } elseif (file_exists(NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/language/en.php')) { require NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/language/en.php'; } // Xac dinh template module $module_info['template'] = $global_config['module_theme']; if (!file_exists(NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/modules/' . $module_file)) { if (file_exists(NV_ROOTDIR . '/themes/default/modules/' . $module_file)) { $module_info['template'] = 'default';
/** * nv_db_cache() * * @param mixed $sql * @param mixed $key * @param mixed $modname * @param mixed $lang * @return */ function nv_db_cache($sql, $key = '', $modname = '', $lang = NV_LANG_DATA) { global $db, $module_name, $global_config; $list = array(); if (empty($sql)) { return $list; } if (empty($modname)) { $modname = $module_name; } $cache_file = $lang . '_' . md5($sql) . '_' . NV_CACHE_PREFIX . '.cache'; if (($cache = nv_get_cache($modname, $cache_file)) != false) { $list = unserialize($cache); } else { if (($result = $db->query($sql)) !== false) { $a = 0; while ($row = $result->fetch()) { $key2 = (!empty($key) and isset($row[$key])) ? $row[$key] : $a; $list[$key2] = $row; ++$a; } $result->closeCursor(); $cache = serialize($list); nv_set_cache($modname, $cache_file, $cache); } } return $list; }
/** * nv_blocks_get_content() * * @return */ function nv_blocks_content($sitecontent) { global $db, $module_info, $module_name, $op, $global_config, $lang_global, $sys_mods, $user_info, $client_info, $themeConfig; $_posAllowed = array(); foreach ($themeConfig['positions']['position'] as $_pos) { $_pos = trim((string) $_pos['tag']); unset($matches); if (preg_match('/^\\[([^\\]]+)\\]$/is', $_pos, $matches)) { $_posAllowed[] = $matches[1]; } } if (empty($_posAllowed)) { return $sitecontent; } //Tim trong noi dung trang cac doan ma phu hop voi cac nhom block tren $_posAllowed = implode('|', array_map('nv_preg_quote', $_posAllowed)); preg_match_all('/\\[(' . $_posAllowed . ')(\\d+)?\\]()/', $sitecontent, $_posReal); if (empty($_posReal[0])) { return $sitecontent; } $_posReal = array_combine($_posReal[0], $_posReal[3]); $cache_file = NV_LANG_DATA . '_' . $global_config['module_theme'] . '_' . $module_name . '_' . NV_CACHE_PREFIX . '.cache'; $blocks = array(); if (($cache = nv_get_cache('themes', $cache_file)) !== false) { $cache = unserialize($cache); if (isset($cache[$module_info['funcs'][$op]['func_id']])) { $blocks = $cache[$module_info['funcs'][$op]['func_id']]; } unset($cache); } else { $cache = array(); $in = array(); $list = $sys_mods[$module_name]['funcs']; foreach ($list as $row) { if ($row['show_func']) { $in[] = $row['func_id']; } } $_result = $db->query("SELECT t1.*, t2.func_id FROM " . NV_BLOCKS_TABLE . "_groups t1\n\t\t\t INNER JOIN " . NV_BLOCKS_TABLE . "_weight t2\n\t\t\t ON t1.bid = t2.bid\n\t\t\t WHERE t2.func_id IN (" . implode(',', $in) . ")\n\t\t\t AND t1.theme ='" . $global_config['module_theme'] . "'\n\t\t\t AND t1.active=1\n\t\t\t ORDER BY t2.weight ASC"); while ($_row = $_result->fetch()) { // Cau hinh block $block_config = !empty($_row['config']) ? unserialize($_row['config']) : array(); $block_config['bid'] = $_row['bid']; $block_config['module'] = $_row['module']; $block_config['title'] = $_row['title']; $block_config['block_name'] = substr($_row['file_name'], 0, -4); // Tieu de block $blockTitle = (!empty($_row['title']) and !empty($_row['link'])) ? "<a href=\"" . $_row['link'] . "\">" . $_row['title'] . "</a>" : $_row['title']; if (!isset($cache[$_row['func_id']])) { $cache[$_row['func_id']] = array(); } $cache[$_row['func_id']][] = array('bid' => $_row['bid'], 'position' => $_row['position'], 'module' => $_row['module'], 'blockTitle' => $blockTitle, 'file_name' => $_row['file_name'], 'template' => $_row['template'], 'exp_time' => $_row['exp_time'], 'hide_device' => $_row['hide_device'], 'groups_view' => $_row['groups_view'], 'all_func' => $_row['all_func'], 'block_config' => $block_config); } $_result->closeCursor(); if (isset($cache[$module_info['funcs'][$op]['func_id']])) { $blocks = $cache[$module_info['funcs'][$op]['func_id']]; } $cache = serialize($cache); nv_set_cache('themes', $cache_file, $cache); unset($cache, $in, $block_config, $blockTitle); } if (!empty($blocks)) { $unact = array(); $array_position = array_keys($_posReal); foreach ($blocks as $_row) { if ($_row['exp_time'] != 0 and $_row['exp_time'] <= NV_CURRENTTIME) { $unact[] = $_row['bid']; continue; } if ($client_info['is_mobile'] and ($_row['hide_device'] == 1 or $_row['hide_device'] == 3)) { //?n tr�n mobile continue; } elseif ($client_info['is_tablet'] and ($_row['hide_device'] == 2 or $_row['hide_device'] == 3)) { // ?n tr�n M�y t�nh b?ng continue; } //Kiem tra quyen xem block if (in_array($_row['position'], $array_position) and nv_user_in_groups($_row['groups_view'])) { $block_config = $_row['block_config']; $blockTitle = $_row['blockTitle']; $content = ''; if ($_row['module'] == 'theme' and file_exists(NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/blocks/' . $_row['file_name'])) { include NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/blocks/' . $_row['file_name']; } elseif (isset($sys_mods[$_row['module']]['module_file']) and !empty($sys_mods[$_row['module']]['module_file']) and file_exists(NV_ROOTDIR . '/modules/' . $sys_mods[$_row['module']]['module_file'] . '/blocks/' . $_row['file_name'])) { include NV_ROOTDIR . '/modules/' . $sys_mods[$_row['module']]['module_file'] . '/blocks/' . $_row['file_name']; } unset($block_config); if (!empty($content) or defined('NV_IS_DRAG_BLOCK')) { $xtpl = null; $_row['template'] = empty($_row['template']) ? 'default' : $_row['template']; $_template = 'default'; if (!empty($module_info['theme']) and file_exists(NV_ROOTDIR . '/themes/' . $module_info['theme'] . '/layout/block.' . $_row['template'] . '.tpl')) { $xtpl = new XTemplate('block.' . $_row['template'] . '.tpl', NV_ROOTDIR . '/themes/' . $module_info['theme'] . '/layout'); $_template = $module_info['theme']; } elseif (!empty($global_config['module_theme']) and file_exists(NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/layout/block.' . $_row['template'] . '.tpl')) { $xtpl = new XTemplate('block.' . $_row['template'] . '.tpl', NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/layout'); $_template = $global_config['module_theme']; } elseif (!empty($global_config['site_theme']) and file_exists(NV_ROOTDIR . '/themes/' . $global_config['site_theme'] . '/layout/block.' . $_row['template'] . '.tpl')) { $xtpl = new XTemplate('block.' . $_row['template'] . '.tpl', NV_ROOTDIR . '/themes/' . $global_config['site_theme'] . '/layout'); $_template = $global_config['site_theme']; } elseif (file_exists(NV_ROOTDIR . '/themes/default/layout/block.' . $_row['template'] . '.tpl')) { $xtpl = new XTemplate('block.' . $_row['template'] . '.tpl', NV_ROOTDIR . '/themes/default/layout'); } if (!empty($xtpl)) { $xtpl->assign('BLOCK_ID', $_row['bid']); $xtpl->assign('BLOCK_TITLE', $_row['blockTitle']); $xtpl->assign('BLOCK_CONTENT', $content); $xtpl->assign('TEMPLATE', $_template); $xtpl->assign('NV_BASE_SITEURL', NV_BASE_SITEURL); $xtpl->parse('mainblock'); $content = $xtpl->text('mainblock'); } else { $content = $_row['blockTitle'] . '<br />' . $content . '<br />'; } if (defined('NV_IS_DRAG_BLOCK')) { $content = '<div class="portlet" id="bl_' . $_row['bid'] . '"> <p> <a href="javascript:void(0)" class="block_content" name="' . $_row['bid'] . '"> <img style="border:none" src="' . NV_BASE_SITEURL . NV_FILES_DIR . '/images/edit.png" alt="' . $lang_global['edit_block'] . '"/> ' . $lang_global['edit_block'] . '</a> | <a href="javascript:void(0)" class="delblock" name="' . $_row['bid'] . '"> <img style="border:none" src="' . NV_BASE_SITEURL . NV_FILES_DIR . '/images/delete.png" alt="' . $lang_global['delete_block'] . '"/> ' . $lang_global['delete_block'] . '</a> | <a href="javascript:void(0)" class="outgroupblock" name="' . $_row['bid'] . '"> <img style="border:none" src="' . NV_BASE_SITEURL . NV_FILES_DIR . '/images/outgroup.png" alt="' . $lang_global['outgroup_block'] . '"/> ' . $lang_global['outgroup_block'] . '</a> </p> ' . $content . '</div>'; } $_posReal[$_row['position']] .= $content; } } } if (!empty($unact)) { $db->query('UPDATE ' . NV_BLOCKS_TABLE . '_groups SET active=0 WHERE bid IN (' . implode(',', $unact) . ')'); unlink($cache_file); } } if (defined('NV_IS_DRAG_BLOCK')) { $array_keys = array_keys($_posReal); foreach ($array_keys as $__pos) { $_posReal[$__pos] = '<div class="column" id="' . preg_replace('#\\[|\\]#', '', $__pos) . '">' . $_posReal[$__pos]; $_posReal[$__pos] .= ' <span><a class="block_content" id="' . $__pos . '" href="javascript:void(0)"><img style="border:none" src="' . NV_BASE_SITEURL . NV_FILES_DIR . '/images/add.png" alt="' . $lang_global['add_block'] . '"/> ' . $lang_global['add_block'] . '</a></span>'; $_posReal[$__pos] .= '</div>'; } } $sitecontent = str_replace(array_keys($_posReal), array_values($_posReal), $sitecontent); return $sitecontent; }
/** * nv_get_rss() * * @param mixed $url * @return */ function nv_get_rss($url) { global $global_config; $array_data = array(); $cache_file = NV_LANG_DATA . "_rss_" . md5($url) . "_" . NV_CACHE_PREFIX . ".cache"; if (file_exists(NV_ROOTDIR . "/" . NV_CACHEDIR . "/" . $cache_file) and filemtime(NV_ROOTDIR . "/" . NV_CACHEDIR . "/" . $cache_file) > NV_CURRENTTIME - 1200) { if (($cache = nv_get_cache($cache_file)) != false) { $array_data = unserialize($cache); } } if (empty($array_data)) { include_once NV_ROOTDIR . "/includes/class/geturl.class.php"; $getContent = new UrlGetContents($global_config); $xml_source = $getContent->get($url); $allowed_html_tags = array_map("trim", explode(",", NV_ALLOWED_HTML_TAGS)); $allowed_html_tags = "<" . implode("><", $allowed_html_tags) . ">"; if ($xml = simplexml_load_string($xml_source)) { $a = 0; if (isset($xml->channel)) { foreach ($xml->channel->item as $item) { $array_data[$a]['title'] = strip_tags($item->title); $array_data[$a]['description'] = strip_tags($item->description, $allowed_html_tags); $array_data[$a]['link'] = strip_tags($item->link); $array_data[$a]['pubDate'] = nv_date("l - d/m/Y H:i", strtotime($item->pubDate)); ++$a; } } elseif (isset($xml->entry)) { foreach ($xml->entry as $item) { $urlAtt = $item->link->attributes(); $url = $urlAtt['href']; $array_data[$a]['title'] = strip_tags($item->title); $array_data[$a]['description'] = strip_tags($item->content, $allowed_html_tags); $array_data[$a]['link'] = strip_tags($urlAtt['href']); $array_data[$a]['pubDate'] = nv_date("l - d/m/Y H:i", strtotime($item->updated)); ++$a; } } } $cache = serialize($array_data); nv_set_cache($cache_file, $cache); } return $array_data; }