<?php
/*
空间记录表：pre_home_doing
*/
if($start <= 1){
	truncatetable('home_doing');
}

$maxrid = $xc->db['source']->result($xc->db['source']->query("SELECT max(mid) FROM {$source_tablepre}weibo_content"), 0);

if($start < $maxrid){
	$converted = 1;
}

$query = $xc->db['source']->query("SELECT * FROM {$source_tablepre}weibo_content WHERE mid >= $start AND mid < $start + $rpp") or dexit();
while ($record	=	$xc->db['source']->fetch_array($query)) {
	$record		=	daddslashes($record);

	$doid		=	$record['mid'];
	$uid		=	$record['uid'];
	$username	=	getusername($uid);
	$from		=	'';
	$dateline	=	$record['postdate'];
	if($record['type'] != 0) {
		continue;
	} else {
		$message	=	formatstr(convertbbcode($record['content']));
	}
	$ip			=	'';
	$replynum	=	$record['replies'];

	$field1		=	array('doid','uid','username','`from`','dateline','message','ip','replynum');
	$query1		=	getinsertsql("{$discuz_tablepre}home_doing", $field1);

	if ($xc->db['discuz']->query($query1)) {
		$convertedrows ++;
	} else {
		reportlog("无法转换空间记录 id = $doid ，SQL 语句如下 ：<br><textarea rows=\"3\" style=\"width: 100%;\">".$sql."</textarea>");
	}
	$converted = 1;
	$totalrows ++;
}
?>