<?php

/*
 * Copyright (C) xgcms.com
 */

class member_access extends base_model{
	
	function __construct(&$conf) {
		parent::__construct($conf);
		$this->table = 'member_access';
		$this->primarykey = array('uid');
		$this->maxcol = 'uid';
		$this->conf['cache']['enable'] = FALSE;
	}
	
	/*
	$arr = array(
		'uid'=>1,
		'allowread'=>0,
		'allowthread'=>0,
		'allowpost'=>0,
		'allowattach'=>0,
		'expiry'=>0
	);
	*/
	
	// 初始化权限
	public function init($uid) {
		$arr = array(
			'uid'=>$uid,
			'allowread'=>1,
			'allowthread'=>1,
			'allowpost'=>1,
			'allowreply'=>1,
			'allowattach'=>1,
			'allowdown'=>1,
			'expiry'=>0
		);
		$user = $this->member->read($uid);
		$user['accesson'] = 1;
		$this->member->update($uid, $user);
		$this->create($arr);
	}
	

	public function _delete($uid) {
		$return = $this->delete($uid);
		if($return) {
			$this->count('-1');
		}
		return $return;
	}
}
?>