1. 程式人生 > >phpcms v9會員投稿不能刪除問題處理

phpcms v9會員投稿不能刪除問題處理

修改phpcms/modules/member/content.php中delete函式

public function delete(){
		$id = intval($_GET['id']);
		if(!$id){
			return false;
		}
		//判斷該文章是否待審,並且屬於該會員
		$username = param::get_cookie('_username');
		$userid = param::get_cookie('_userid');
		$siteid = get_siteid();
		$catid = intval($_GET['catid']);
		$siteids = getcache('category_content', 'commons');
		$siteid = $siteids[$catid];
		$CATEGORYS = getcache('category_content_'.$siteid, 'commons');
		$category = $CATEGORYS[$catid];
		if(!$category){
			showmessage(L('operation_failure'), HTTP_REFERER); 
		}
		$modelid = $category['modelid'];
		$checkid = 'c-'.$id.'-'.$modelid;
		$where = " checkid='$checkid' and username='$username' and status!=99 ";
		$check_pushed_db = pc_base::load_model('content_check_model');
		$array = $check_pushed_db->get_one($where);
		if(!$array){
			showmessage(L('operation_failure'), HTTP_REFERER); 
		}else{
			$content_db = pc_base::load_model('content_model');
			$content_db->set_model($modelid);
			$table_name = $content_db->table_name;
			$content_db->delete_content($id); //刪除文章
			$check_pushed_db->delete(array('checkid'=>$checkid));//刪除對應投稿表
			showmessage(L('operation_success'), HTTP_REFERER); 
		}
	}