<?php
//14、转换用户主题收藏

truncatetable('home_favorite');

$query = $xc->db['source']->query("SELECT f.*, t.fid, t.posterid, t.title, t.tid FROM {$source_tablepre}favorites f, {$source_tablepre}topics t where f.tid=t.tid") or die("检索数据表 '{$source_tablepre}favorites' 错误！请将表 '{$source_tablepre}favorites' 字段类型为 nText 的改为 Text 类型。");

while ($f = $xc->db['source']->fetch_array($query)) {
	
	$f = daddslashes(array_change_key_case($f));

	$uid = $f['uid'];
	$id  = $f['tid'];
	$idtype	= 'tid';
	$spaceuid=  $f['posterid'];
	$title	= $f['title'];
	$description	= '';
	$dateline		= '';

	$fields1 = array('favid', 'uid', 'id','idtype', 'spaceuid', 'title', 'description', 'dateline');
	$query1 = getinsertsql("{$discuz_tablepre}home_favorite", $fields1);
	if ($xc->db['discuz']->query($query1)) {
		$convertedrows ++;
	} else {
		reportlog("插入 DZ 主题收藏数据出错 uid = $uid tid = $tid");
	}
	$totalrows ++;
}

?>