summaryrefslogtreecommitdiffstats
path: root/lib/model/User.php
blob: 693aeb7437012c44fbb0fa096c66224e63458e58 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php

/**
 * Subclass for representing a row from the 'user' table.
 *
 * 
 *
 * @package lib.model
 */ 
class User extends BaseUser
{
	public function setPassword($password)
	{
		if($password=='')
			return false;
		$salt = md5(rand(100000, 999999).$this->getNickname().$this->getFirstName());
		$this->setSalt($salt);
		$this->setSha1Password(sha1($salt.$password));
	}

	public function setPassword2($password)
	{
		if($password!='')
			$this->setPassword($password);
	}

	public function getFullName()
	{
		return $this->getFirstName()." ".$this->getLastName();
	}

	public function __toString()
	{
		return $this->getNickname();
	}
}