<?php
/*
论坛公告：pre_forum_announcement
*/
truncatetable('forum_announcement');

$query = $xc->db['source']->query("SELECT * FROM {$source_tablepre}announce WHERE fid<0 ORDER BY aid ASC") or dexit();
while ($pwannounce 	= $xc->db['source']->fetch_array($query)) {
	$pwannounce		=	daddslashes($pwannounce);

	//$id			=	'';
	$author			=	$pwannounce['author'];
	$subject		=	cutstr(htmlspecialchars(trim(@strip_tags($pwannounce['subject']))), 250);
	$type			=	$pwannounce['url'] ? 1 : 0;
	$displayorder	=	$pwannounce['vieworder'];
	$starttime		=	$pwannounce['startdate'];
	$endtime		=	$pwannounce['enddate'];
	$message		=	$type == '1' ? $pwannounce['url'] : $pwannounce['content'];
	$groups			=	'';

	$field1			=	array('author','subject','type','displayorder','starttime','endtime','message','groups');
	$query1			=	getinsertsql("{$discuz_tablepre}forum_announcement", $field1);

	if ($xc->db['discuz']->query($query1)) {
		$convertedrows ++;
	} else {
		reportlog("转换论坛公告出错 subject=$subject");
	}
	$totalrows ++;
}
?>