| 3 |
// $Id$ |
// $Id$ |
| 4 |
// ----------------------------------------------------------------------------- |
// ----------------------------------------------------------------------------- |
| 5 |
// $Log$ |
// $Log$ |
| 6 |
|
// Revision 1.6 2002/12/18 22:46:06 jonen |
| 7 |
|
// + added function 'getUserGuid()' |
| 8 |
|
// (returns user's 'guid' read from database at function 'login()' (now)) |
| 9 |
|
// + function '_loadData()' loads user remote now via 'getUserGuid()' |
| 10 |
|
// |
| 11 |
// Revision 1.5 2002/12/12 21:34:32 joko |
// Revision 1.5 2002/12/12 21:34:32 joko |
| 12 |
// + fix in 'function update': invalidate data only if it's not for caching purposes |
// + fix in 'function update': invalidate data only if it's not for caching purposes |
| 13 |
// |
// |
| 98 |
|
|
| 99 |
|
|
| 100 |
function _loadData() { |
function _loadData() { |
| 101 |
$this->pObject = new ProxyObject($this->state[id]); |
$this->pObject = new ProxyObject($this->getUserGuid(), array( remote => 1, classname => "NetPerson", guid => 1) ); |
| 102 |
if ($this->state[id]) { |
if ($this->getUserGuid()) { |
| 103 |
$this->data = $this->pObject->getAttributes(); |
$this->data = $this->pObject->getAttributes(); |
| 104 |
} |
} |
| 105 |
$this->meta[data_ready] = 1; |
$this->meta[data_ready] = 1; |
| 177 |
function login($user,$passwd) { |
function login($user,$passwd) { |
| 178 |
connectdb(); |
connectdb(); |
| 179 |
//$sql = "SELECT * FROM td_users WHERE uname='$user'"; |
//$sql = "SELECT * FROM td_users WHERE uname='$user'"; |
| 180 |
$sql = "SELECT user_oid, uname, pass FROM td_users WHERE uname='$user'"; |
$sql = "SELECT user_oid, guid, uname, pass FROM td_users WHERE uname='$user'"; |
| 181 |
if ($res=send_sql($sql)) { |
if ($res=send_sql($sql)) { |
| 182 |
$row = mysql_fetch_array($res,MYSQL_ASSOC); |
$row = mysql_fetch_array($res,MYSQL_ASSOC); |
| 183 |
if (!is_array($row)) { return 0; } |
if (!is_array($row)) { return 0; } |
| 186 |
//return $uservars_db; |
//return $uservars_db; |
| 187 |
// store 1st priority user-data to state |
// store 1st priority user-data to state |
| 188 |
$this->state[id] = $row[user_oid]; |
$this->state[id] = $row[user_oid]; |
| 189 |
|
$this->state[guid] = $row[guid]; |
| 190 |
$this->state[status] = $this->meta[logontoken]; |
$this->state[status] = $this->meta[logontoken]; |
| 191 |
$this->_saveState(); |
$this->_saveState(); |
| 192 |
$this->site->log( get_class($this) . "->login ok", LOG_DEBUG ); |
$this->site->log( get_class($this) . "->login ok", LOG_DEBUG ); |
| 233 |
global $site; |
global $site; |
| 234 |
|
|
| 235 |
// get information about user from site |
// get information about user from site |
| 236 |
$userid = $this->state[id]; |
$userid = $this->getUserId(); |
| 237 |
|
|
| 238 |
$this->site->log( get_class($this) . "->logout: userid $userid", LOG_DEBUG ); |
$this->site->log( get_class($this) . "->logout: userid $userid", LOG_DEBUG ); |
| 239 |
|
|
| 312 |
return $this->state[id]; |
return $this->state[id]; |
| 313 |
} |
} |
| 314 |
|
|
| 315 |
|
function getUserGuid() { |
| 316 |
|
return $this->state[guid]; |
| 317 |
|
} |
| 318 |
|
|
| 319 |
function getPostVars() { |
function getPostVars() { |
| 320 |
return $this->state[postvars]; |
return $this->state[postvars]; |