<?php
/*
用户控制中心模型
*/
class  MemberModel extends DBModel {
	public function Init(){
		$this->_User = new UsersModel();
	}
	public function editmyself($POST){
		$data = array();
		$data['email'] = $POST['email'];
		$data['gender'] = $POST['gender'];
		return $this->_DB->update(VODCMS_MEMBERS, $data, array('uid'=>(int)$POST['uid']));
	}
	public function modfypass($POST){
		if ($POST['pass2'] != $POST['pass3']){
			$this->error = _('两次密码输入不一致!');
			return false;
		}
		$data = array();
		$row = $this->_User->getRow($POST['uid']);
		if ($row['password'] != md5($POST['pass'])){
			$this->error = _('旧密码不正确!');
			return false;
		}
		$data['password'] = md5($POST['pass2']);
		$config = $GLOBALS['config'];
		if ($config['ucenter'] == 1){
			$ucenter = new ucenter();
			$ucenter->modify($row['username'], $POST['pass'], $POST['pass2'],$row['email'], 1);
		}
		return $this->_DB->update(VODCMS_MEMBERS, $data, array('uid'=>(int)$POST['uid']));
	}
}