<?php
/*************************************************************\
+-------------------------------------------------------------+
| 通灵佛教网在线烧香程序 System                                 |
| Copyright (c) 2003-2010 Alfred China                        |
| All rights reserved.                                        |
+-------------------------------------------------------------+
\*************************************************************/
require_once('chk.php');
$pagepermission = 51;
require_once('netgou.php');
include_once ng_dir."/include/ngcache.php";

if ($REQUEST_METHOD == "POST") {

	if ($mode == "upcache") {
	
		updatecache_ngall();
		showmsg("网站缓存更新成功","ng_cache.php");
		
	}elseif($mode == "uplf") {
		
		updatecache_alllf();
		showmsg("礼佛数据更新成功","ng_cache.php");

	}
}

if($mode == "upnews") {
		
	!$page && $page=1;
	!$percount && $percount=100;
	$start=($page-1)*$percount;
	$nextnum = $start+$percount;
	$page++;
	$up_url="ng_cache.php?mode=upnews&page=$page&percount=$percount";
	$pros = ng_query("SELECT productid FROM $sql_tbl[products] ORDER BY productid DESC LIMIT $start,$percount");
		
	if($pros){
		foreach ($pros as $k=>$v) {
			ng_update_product($v["productid"]);
		}
	}else{
		showmsg("商品数据更新成功","ng_cache.php");
	}
	$showstart = $start+1;
	showmsg("更新第".$showstart."-".$nextnum."件商品",$up_url);	
}

$ng_obstart && function_exists('ob_gzhandler') ? ob_start('ob_gzhandler') : ob_start();
$ng_obstart ? $ng_gzip="Gzip enabled":$ng_gzip="Gzip disabled";

require_once PrintTemp('ng_cache');
require_once "./footer.php";

$output=str_replace(array('<!--<!--<!---->','<!--<!---->','<!---->'),array('','',''),ob_get_contents());
ob_end_clean();
echo $output;
flush;
exit;
?>