3 |
// $Id$ |
// $Id$ |
4 |
// ----------------------------------------------------------------------------- |
// ----------------------------------------------------------------------------- |
5 |
// $Log$ |
// $Log$ |
6 |
|
// Revision 1.12 2003/03/03 21:20:47 joko |
7 |
|
// mungled the namespaces |
8 |
|
// |
9 |
|
// Revision 1.11 2003/02/14 14:22:06 joko |
10 |
|
// + always (re-)tries to connect |
11 |
|
// |
12 |
|
// Revision 1.10 2003/02/13 21:58:39 joko |
13 |
|
// + caching mechanisms more configurable now |
14 |
|
// |
15 |
|
// Revision 1.9 2003/02/09 17:46:26 joko |
16 |
|
// + now utilizing DesignPattern::RemoteProxy and Data::Deep |
17 |
|
// |
18 |
|
// Revision 1.8 2002/12/28 01:16:42 jonen |
19 |
|
// + added clear of $this->state[autologout] at 'hadTimeout()' |
20 |
|
// |
21 |
// Revision 1.7 2002/12/23 11:32:28 jonen |
// Revision 1.7 2002/12/23 11:32:28 jonen |
22 |
// + added inserting of uservars on '_create' to frontend db(needed to login user after create!) |
// + added inserting of uservars on '_create' to frontend db(needed to login user after create!) |
23 |
// + added hard link to page 'pub/register', TODO: move this out here |
// + added hard link to page 'pub/register', TODO: move this out here |
117 |
|
|
118 |
|
|
119 |
function _loadData() { |
function _loadData() { |
120 |
$this->pObject = new ProxyObject($this->getUserGuid(), array( remote => 1, classname => "NetPerson", guid => 1) ); |
$this->meta[data_ready] = 1; |
121 |
|
//$this->pObject = new ProxyObject($this->getUserGuid(), array( remote => 1, classname => "NetPerson", guid => 1) ); |
122 |
|
$rpcinfo = $this->site->configuration->get("rpcinfo"); |
123 |
|
$this->pObject = mkObject('DesignPattern::RemoteProxy', $this->getUserGuid(), array( remote => 1, classname => "NetPerson", guid => 1, rpcinfo => $rpcinfo, cache => array( db => 1, session => 1 ), connect => 1 ) ); |
124 |
if ($this->getUserGuid()) { |
if ($this->getUserGuid()) { |
125 |
$this->data = $this->pObject->getAttributes(); |
$this->data = $this->pObject->getAttributes(); |
126 |
} |
} |
|
$this->meta[data_ready] = 1; |
|
127 |
} |
} |
128 |
|
|
129 |
function _saveData($newRawData) { |
function _saveData($newRawData) { |
180 |
//$this->_init($objectId); |
//$this->_init($objectId); |
181 |
} |
} |
182 |
|
|
|
function _getHKR($key) { |
|
|
$attr_arr = split('\.', $key); |
|
|
$attr_hkr = '["' . join('"]["', $attr_arr) . '"]'; |
|
|
return $attr_hkr; |
|
|
} |
|
|
|
|
183 |
function get($attr) { |
function get($attr) { |
184 |
$this->_doDataReady(); |
$this->_doDataReady(); |
185 |
$hkr = $this->_getHKR($attr); |
$deep = new Data_Deep($this->data); |
186 |
$evalstr = 'return $this->data' . $hkr . ';'; |
return $deep->get($attr); |
|
$val = eval($evalstr); |
|
|
return $val; |
|
187 |
} |
} |
188 |
function set($attr, $val) { |
function set($attr, $val) { |
189 |
$this->_doDataReady(); |
$this->_doDataReady(); |
190 |
$hkr = $this->_getHKR($attr); |
$deep = new Data_Deep($this->data); |
191 |
$evalstr = '$this->data' . $hkr . ' = \'' . $val . '\';'; |
$deep->set($attr, $val); |
|
eval($evalstr); |
|
192 |
} |
} |
193 |
|
|
194 |
function isLoggedOn() { |
function isLoggedOn() { |
214 |
$this->state[guid] = $row[guid]; |
$this->state[guid] = $row[guid]; |
215 |
$this->state[status] = $this->meta[logontoken]; |
$this->state[status] = $this->meta[logontoken]; |
216 |
$this->_saveState(); |
$this->_saveState(); |
217 |
$this->site->log( get_class($this) . "->login ok", LOG_DEBUG ); |
$this->site->log( get_class($this) . "->login ok", PEAR_LOG_NOTICE ); |
218 |
return 1; |
return 1; |
219 |
} else { |
} else { |
220 |
return 0; |
return 0; |
262 |
// get information about user from site |
// get information about user from site |
263 |
$userid = $this->getUserId(); |
$userid = $this->getUserId(); |
264 |
|
|
265 |
$this->site->log( get_class($this) . "->logout: userid $userid", LOG_DEBUG ); |
$this->site->log( get_class($this) . "->logout: userid $userid", PEAR_LOG_NOTICE ); |
266 |
|
|
267 |
// get information about session from php |
// get information about session from php |
268 |
$session_id = session_id(); |
$session_id = session_id(); |
357 |
} |
} |
358 |
|
|
359 |
function hadTimeout() { |
function hadTimeout() { |
360 |
if ($this->state[autologout]) { return 1; } |
if ($this->state[autologout]) { $this->state[autologout] = ''; return 1; } |
361 |
} |
} |
362 |
|
|
363 |
} |
} |