<?php
if(!defined('MOD'))  die("access die");
checkAdminReferer();
if($_GET['dir'] != 'channel'){
	$html=new html(R_P."/");
	$html->createhtmlob(W_P."index.php","index.html");
	qbase::showmsg("网站首页生成成功",'default',"index.php?action=home");
}else{
	$index = intval($_GET['index']);
	if(count($channel) <= $index){
		qbase::showmsg("网站各个频道首页生成成功",'default',"index.php?action=home");
	}
	$item = array_pop(array_slice($channel, $index, 1));
	while(intval($item['is_html']) == 0){
		$index++;
		$item = array_slice($channel, $index, 1);
		if(empty($item)){
			qbase::showmsg("网站各个频道首页生成成功",'default',"index.php?action=home");
		}
	}

	$html=new html(R_P."/" . $item['channeldir']);
	$html->createhtmlob(W_P."index.php?mod={$item['channelid']}&ac=index","index.html");
	$index++;
	qbase::showmsg("{$item['channelname']}频道首页生成成功",'default',"system.php?sys=html&action=all&dir=channel&index={$index}");
}
?>