<?php
class AdmajaxAction extends AdmincomAction{
	public function tagname(){
		$tagname=$_POST['tagname'];
		$id=$_POST['id'];
		$tag=M('topic_tag');
		$data['id']=$id;
		$data['title']=$tagname;
		$ok=$tag->save($data);
		if($ok)
			echo "更名成功";
		else
			echo '失败';
    }
	public function changeblog()
	{
		$id=$_POST['id'];
		$topic=M('topic');
		$ok=FALSE;
		$rs=$topic->find($id);
		if($rs)
		{
			$da=array();
			if($rs['status']==1)
			{
				$da['status']=0;
				$ok=$topic->where('id='.$id)->save($da);
				if($rs['parentid']==0)
				{
					$types=$rs['parentid']==0?1:2;
					delUserScore($rs['userid'],$types,getUserAccount()."未审核微博id=".$id.",parentid=".$rs['parentid']);
				}
				else
				{
					$types=$rs['parentid']==0?1:2;
					addUserScore($rs['userid'],$types,getUserAccount()."审核微博id=".$id.",parentid=".$rs['parentid']);
				}	
			}
			else
			{
				$da['status']=1;
				$ok=$topic->where('id='.$id)->save($da);	
			}
			if($ok)
				echo "<option>更改成功</option>";
			else
				echo "<option>更改失败</option>";
		}
	}
}
?>