本文整理汇总了PHP中nv_get_cache函数的典型用法代码示例。如果您正苦于以下问题:PHP nv_get_cache函数的具体用法?PHP nv_get_cache怎么用?PHP nv_get_cache使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了nv_get_cache函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: nv_genealogy_anniversary
/**
* nv_message_page()
*
* @return
*/
function nv_genealogy_anniversary($block_config)
{
global $global_config, $site_mods, $db, $module_name, $lang_block;
$module = $block_config['module'];
if (!isset($site_mods[$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);
$anniversary = array();
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'];
$anniversary = $cache;
$is_show = true;
}
}
if (!$is_show) {
$date_array = getdate();
$dd = 0;
$mm = 0;
$yy = 0;
if ($dd == 0) {
$dd = $date_array['mday'];
}
if ($mm == 0) {
$mm = $date_array['mon'];
}
if ($yy == 0) {
$yy = $date_array['year'];
}
$al = convertSolar2Lunar($dd, $mm, $yy, 7.0);
$sql = 'SELECT * FROM ' . NV_PREFIXLANG . '_' . $site_mods[$module]['module_data'] . ' WHERE status=2 AND anniversary_mont = ' . $al[1] . ' ORDER BY rand() DESC';
if (($query = $db->query($sql)) !== false) {
while ($row = $query->fetch()) {
$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'];
$anniversary[] = $row;
$is_show = true;
}
}
}
if ($is_show) {
if (file_exists(NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/modules/genealogy/block.anniversary.tpl')) {
$block_theme = $global_config['module_theme'];
} elseif (file_exists(NV_ROOTDIR . '/themes/' . $global_config['site_theme'] . '/modules/genealogy/block.anniversary.tpl')) {
$block_theme = $global_config['site_theme'];
} else {
$block_theme = 'default';
}
$xtpl = new XTemplate('block.anniversary.tpl', NV_ROOTDIR . '/themes/' . $block_theme . '/modules/genealogy');
$xtpl->assign('LINK', $link);
$xtpl->assign('LANG', $lang_block);
$xtpl->assign('MONT', $al[1]);
$i = 0;
$n = count($anniversary);
foreach ($anniversary as $anniversary_i) {
$i++;
$xtpl->assign('ANNIVERSARY', $anniversary_i);
if ($i < $n) {
$xtpl->parse('main.anniversary.comma');
}
$xtpl->parse('main.anniversary');
$xtpl->parse('main.anniversary_list');
}
$xtpl->parse('main');
return $xtpl->text('main');
}
return '';
}
示例2: nv_product_center
/**
* 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');
}
示例3: nv_news_block_news
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');
}
示例4: nv_message_about
/**
* 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 "";
}
示例5: nv_message_page
/**
* 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 '';
}
示例6: nv_news_block_news
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');
}
示例7: nv_groups_list
/**
* 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;
}
}
示例8: NukevietChange_getContents
/**
* 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;
}
示例9: die
<?php
/**
* @Project NUKEVIET BLOG 4.x
* @Author PHAN TAN DUNG (phantandung92@gmail.com)
* @Copyright (C) 2014 PHAN TAN DUNG. All rights reserved
* @License GNU/GPL version 2 or any later version
* @Createdate Dec 11, 2013, 09:50:11 PM
*/
if (!defined('NV_IS_MOD_BLOG')) {
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($module_name, $cacheFile)) != false and filemtime($cacheFile) >= $pa) {
$url = unserialize($cache);
} else {
$sql = "SELECT title, alias, posttime FROM " . $BL->table_prefix . "_rows WHERE status=1 ORDER BY posttime DESC LIMIT 1000";
$result = $db->query($sql);
while (list($title, $alias, $posttime) = $result->fetch(3)) {
$url[] = array('link' => NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&" . NV_NAME_VARIABLE . "=" . $module_name . "&" . NV_OP_VARIABLE . "=" . $alias . $global_config['rewrite_exturl'], 'publtime' => $posttime);
}
$cache = serialize($url);
nv_set_cache($module_name, $cacheFile, $cache);
}
nv_xmlSitemap_generate($url);
die;
示例10: nv_blocks_content
/**
* 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");
//.........这里部分代码省略.........
示例11: nv_url_rewrite
if ($page > 1) {
$base_url_rewrite .= '/page-' . $page;
}
$base_url_rewrite = nv_url_rewrite($base_url_rewrite, true);
if ($_SERVER['REQUEST_URI'] != $base_url_rewrite and NV_MAIN_DOMAIN . $_SERVER['REQUEST_URI'] != $base_url_rewrite) {
Header('Location: ' . $base_url_rewrite);
die;
}
$set_view_page = ($page > 1 and substr($viewcat, 0, 13) == 'viewcat_main_') ? true : false;
if (!defined('NV_IS_MODADMIN') and $page < 5) {
if ($set_view_page) {
$cache_file = NV_LANG_DATA . '_' . $module_info['template'] . '_' . $op . '_' . $catid . '_page_' . $page . '_' . NV_CACHE_PREFIX . '.cache';
} else {
$cache_file = NV_LANG_DATA . '_' . $module_info['template'] . '_' . $op . '_' . $catid . '_' . $page . '_' . NV_CACHE_PREFIX . '.cache';
}
if (($cache = nv_get_cache($module_name, $cache_file)) != false) {
$contents = $cache;
}
}
$page_title = !empty($global_array_cat[$catid]['titlesite']) ? $global_array_cat[$catid]['titlesite'] : $global_array_cat[$catid]['title'];
$key_words = $global_array_cat[$catid]['keywords'];
$description = $global_array_cat[$catid]['description'];
$global_array_cat[$catid]['description'] = $global_array_cat[$catid]['descriptionhtml'];
if (!empty($global_array_cat[$catid]['image'])) {
$meta_property['og:image'] = NV_MY_DOMAIN . NV_BASE_SITEURL . NV_UPLOADS_DIR . '/' . $module_upload . '/' . $global_array_cat[$catid]['image'];
}
if (empty($contents)) {
$array_catpage = array();
$array_cat_other = array();
$base_url = $global_array_cat[$catid]['link'];
$show_no_image = $module_config[$module_name]['show_no_image'];
示例12: nv_block_headline
/**
* 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');
}
示例13: nv_tab_catid
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');
}
}
示例14: nv_url_rewrite
$content .= "<?xml-stylesheet type=\"text/xsl\" href=\"/themes/default/css/sitemapindex.xsl\" ?>\n";
$content .= "<sitemapindex xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\" xsi:schemaLocation=\"http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/siteindex.xsd\">\n";
for ($pages = 1; $pages <= $total_pages; ++$pages) {
$link = NV_MAIN_DOMAIN . nv_url_rewrite(NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=sitemap-image/page-' . $pages, true);
$content .= " <sitemap>\n";
$content .= " <loc>" . $link . "</loc>\n";
$content .= " </sitemap>\n";
}
$content .= "</sitemapindex>\n";
echo $content;
die;
} else {
$array_url = array();
$cacheFile = NV_LANG_DATA . '_sitemap_image_' . $page . '_' . NV_CACHE_PREFIX . '.cache';
$pa = NV_CURRENTTIME - 7200;
if (($cache = nv_get_cache($module_name, $cacheFile)) != false and filemtime(NV_ROOTDIR . '/' . NV_CACHEDIR . '/' . $module_name . '/' . $cacheFile) >= $pa) {
$array_url = unserialize($cache);
} 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;
}
示例15: die
<?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;