Beispiel #1
0
	function _populateCCUsers(){
		global $db_conn;

		if(intval($this->id) <= 0){
			$this->error = "SI_Project::_populateCCUsers(): Project ID not set!";
			return FALSE;
		}

		$this->ccs = array();

		$sql = 'SELECT user_id FROM project_cc
		WHERE project_id = '.intval($this->id);

		$result = $db_conn->query($sql);
		if($result === FALSE){
			$this->error = "SI_Project::_populateCCUsers(): ".$db_conn->getLastError()."\n";
			return FALSE;
		}

		$ids = array();
		while($row = $result->fetchArray(MYSQL_ASSOC)){
			$ids[] = $row['user_id'];
		}

		if(count($ids) > 0){
			$user = new SI_User();
			$users = $user->retrieveSet("WHERE u.id IN (".implode(', ', $ids).")");
			if($users === FALSE){
				$this->error = "SI_Project::_populateCCUsers(): ".$user->getLastError()."\n";
				return FALSE;
			}
			$this->ccs = $users;
		}

		return TRUE;

	}
Beispiel #2
0
	function getUserByLogin($email, $password){
		global $db_conn;
		
		if(empty($email) || empty($password)){
			$this->error = "Both Email and Password are required!";
			return FALSE;
		}
		
		$users = SI_User::retrieveSet("email = '".$db_conn->escapeString($email)."' AND password = '******' AND u.active = 'Y' AND u.deleted = 'N'");
		if(is_object($users[0]) && is_a($users[0], 'SI_User')){
			$users[0]->last_login_ts = time();
			$users[0]->_updateLastLogin();
			return $users[0];
		}else{
			$this->error = "Username and password do not match any current accounts";
			return FALSE;
		}
	}