<?php
//pre_common_admincp_group	转换管理组权限设置

truncatetable('common_admingroup');
$query = $xc->db['source']->query("SELECT * FROM {$source_tablepre}admingroups") or die("检索数据表 '{$source_tablepre}admingroups' 错误！请将表 '{$source_tablepre}admingroups' 字段类型为 nText 的改为 Text 类型。");

while ($a = $xc->db['source']->fetch_assoc($query)) {
	
	$a = daddslashes(array_change_key_case($a));
	$admingid				= $a['admingid'];
	$alloweditpost			= $a['alloweditpost'];
	$alloweditpoll			= $a['alloweditpoll'];
	$allowstickthread		= $a['allowstickthread'];
	$allowmodpost			= $a['allowmodpost'];
	$allowdelpost			= $a['allowdelpost'];
	$allowmassprune			= $a['allowmassprune'];
	$allowrefund			= $a['allowrefund'];
	$allowcensorword		= $a['allowcensorword'];
	$allowviewip			= $a['allowviewip'];
	$allowbanip				= $a['allowbanip'];
	$allowedituser			= $a['allowedituser'];
	$allowmoduser			= $a['allowmoduser'];
	$allowbanuser			= $a['allowbanuser'];
	$allowbanvisituser		= 1;
	$allowpostannounce		= $a['allowpostannounce'];
	$allowviewlog			= $a['allowviewlog'];
	$allowbanpost			= 1;
	$supe_allowpushthread	= 0;
	$allowhighlightthread	= 1;
	$allowdigestthread		= 3;
	$allowstampthread		= 1;
	$allowstamplist		= 1;
	$allowcopythread		= 1;
	$allowmergethread		= 1;
	$allowsplitthread		= 1;
	$allowrepairthread		= 1;
	$allowwarnpost		= 1;
	$allowviewreport		= 1;
	$alloweditforum		= 1;
	$allowremovereward		= 1;
	$allowedittrade = $admingid == 1 ?  1 : 0;
	$alloweditactivity = $admingid == 1 ?  1 : 0;
	$allowstickreply = $admingid == 1 ?  1 : 0;
	$allowmanagearticle = $admingid == 1 ?  1 : 0;
	$allowaddtopic = $admingid == 1 ?  1 : 0;
	$allowmanagetopic = $admingid == 1 ?  1 : 0;
	$allowdiy = $admingid == 1 ?  1 : 0;
	$allowclearrecycle = $admingid == 1 ?  1 : 0;
	$allowmanagetag = $admingid == 1 ?  1 : 0;
	$alloweditusertag = 0;
	$managefeed = $admingid == 1 ?  1 : 0;
	$managedoing = $admingid == 1 ?  1 : 0;
	$manageshare = $admingid == 1 ?  1 : 0;
	$manageblog = $admingid == 1 ?  1 : 0;
	$managealbum = $admingid == 1 ?  1 : 0;
	$managecomment = $admingid == 1 ?  1 : 0;
	$managemagiclog = $admingid == 1 ?  1 : 0;
	$managereport = $admingid == 1 ?  1 : 0;
	$managehotuser = $admingid == 1 ?  1 : 0;
	$managedefaultuser = $admingid == 1 ?  1 : 0;
	$managevideophoto = $admingid == 1 ?  1 : 0;
	$managemagic = $admingid == 1 ?  1 : 0;
	$manageclick = $admingid == 1 ?  1 : 0;
	$allowmanagecollection = $admingid == 1 ?  1 : 0;

	$fields1 = array('admingid', 'alloweditpost', 'alloweditpoll', 'allowstickthread', 'allowmodpost', 'allowdelpost', 'allowmassprune', 'allowrefund', 'allowcensorword', 'allowviewip', 'allowbanip', 'allowedituser', 'allowmoduser', 'allowbanuser', 'allowbanvisituser', 'allowpostannounce', 'allowviewlog', 'allowbanpost', 'supe_allowpushthread', 'allowhighlightthread', 'allowdigestthread',  'allowstampthread', 'allowstamplist', 'allowcopythread', 'allowmergethread', 'allowsplitthread', 'allowrepairthread', 'allowwarnpost', 'allowviewreport', 'alloweditforum', 'allowremovereward', 'allowedittrade', 'alloweditactivity', 'allowstickreply', 'allowmanagearticle', 'allowaddtopic', 'allowmanagetopic', 'allowdiy', 'allowclearrecycle', 'allowmanagetag', 'alloweditusertag', 'managefeed', 'managedoing', 'manageshare', 'manageblog', 'managealbum', 'managecomment', 'managemagiclog', 'managereport', 'managehotuser', 'managedefaultuser', 'managevideophoto', 'managemagic', 'manageclick', 'allowmanagecollection');
	$query1 = getinsertsql("{$discuz_tablepre}common_admingroup", $fields1);
	if ($xc->db['discuz']->query($query1)) {
		$convertedrows ++;
	} else {
		reportlog("插入 DZ 管理组权限设置出错 admingid = $admingid");
	}
	$totalrows ++;
}

?>