13 |
// $Id$ |
// $Id$ |
14 |
// ----------------------------------------------------------------------------- |
// ----------------------------------------------------------------------------- |
15 |
// $Log$ |
// $Log$ |
16 |
|
// Revision 1.21 2004/11/03 14:13:21 jonen |
17 |
|
// small changes at create function |
18 |
|
// |
19 |
|
// Revision 1.20 2004/10/07 14:08:51 jonen |
20 |
|
// + bufix related to save new-registered user-data |
21 |
|
// |
22 |
|
// Revision 1.19 2004/06/22 09:18:47 jonen |
23 |
|
// removed debug dumps |
24 |
|
// |
25 |
|
// Revision 1.17 2004/06/07 16:54:53 joko |
26 |
|
// modified cache-key |
27 |
|
// added cache-control |
28 |
|
// |
29 |
// Revision 1.16 2004/05/06 13:02:09 jonen |
// Revision 1.16 2004/05/06 13:02:09 jonen |
30 |
// + added/modified functions related to User-Messages |
// + added/modified functions related to User-Messages |
31 |
// |
// |
165 |
//$this->pObject = new ProxyObject($this->getUserGuid(), array( remote => 1, classname => "NetPerson", guid => 1) ); |
//$this->pObject = new ProxyObject($this->getUserGuid(), array( remote => 1, classname => "NetPerson", guid => 1) ); |
166 |
$rpcinfo = $this->site->configuration->get("rpcinfo"); |
$rpcinfo = $this->site->configuration->get("rpcinfo"); |
167 |
//$this->pObject = mkObject('DesignPattern::RemoteProxy', $this->getUserGuid(), array( remote => 1, classname => "NetPerson", guid => 1, rpcinfo => $rpcinfo, cache => array( db => 1, session => 1 ), connect => 1 ) ); |
//$this->pObject = mkObject('DesignPattern::RemoteProxy', $this->getUserGuid(), array( remote => 1, classname => "NetPerson", guid => 1, rpcinfo => $rpcinfo, cache => array( db => 1, session => 1 ), connect => 1 ) ); |
168 |
$this->pObject = mkObject('DesignPattern::RemoteProxy', $this->getUserGuid(), array( key => 1, command => 'getUser', query => $this->getUserGuid(), remote => 1, rpcinfo => $rpcinfo, cache => array( db => 1, session => 1 ), connect => 1 ) ); |
$cache_key = $this->getUserGuid() . "_user"; |
169 |
|
$this->pObject = mkObject('DesignPattern::RemoteProxy', $cache_key, array( key => 1, command => 'getUser', query => $this->getUserGuid(), remote => 1, rpcinfo => $rpcinfo, cache => array( db => 1, session => 1 ), connect => 1 ) ); |
170 |
if ($this->getUserGuid()) { |
if ($this->getUserGuid()) { |
171 |
$this->data = $this->pObject->getResult(); |
$this->data = $this->pObject->getResult(); |
172 |
} |
} |
181 |
} |
} |
182 |
|
|
183 |
$this->_save("cache"); |
$this->_save("cache"); |
184 |
|
//$this->_save("commit"); |
185 |
|
|
186 |
//$this->pObject->flushProxy(); // done in "pObject->save" |
//$this->pObject->flushProxy(); // done in "pObject->save" |
187 |
|
|
196 |
$args = array( 'guid' => $this->data[guid], 'data' => $this->data ); |
$args = array( 'guid' => $this->data[guid], 'data' => $this->data ); |
197 |
$this->pObject->backend->send('saveUser', $args, array( utf8 => 1) ); |
$this->pObject->backend->send('saveUser', $args, array( utf8 => 1) ); |
198 |
$this->_save_local(); |
$this->_save_local(); |
199 |
|
$this->refresh(); |
200 |
} |
} |
201 |
// invalidate data only if it's not for caching purposes |
// invalidate data only if it's not for caching purposes |
202 |
if ($type != 'cache') { |
if ($type != 'cache') { |
218 |
} |
} |
219 |
|
|
220 |
function create() { |
function create() { |
221 |
$this->_save(); |
// How THIS can function??? we will fool ourselves... |
222 |
$attr = $this->pObject->getResult(); |
//$this->_save(); |
223 |
//print DumpVar($attr); |
//$attr = $this->pObject->getResult(); |
224 |
$this->_create($attr); |
$this->_create($this->data); |
225 |
} |
} |
226 |
|
|
227 |
function createGuest() { |
function createGuest() { |
248 |
} |
} |
249 |
else { |
else { |
250 |
// TODO: handle this with a generic rpc-debug/pending function |
// TODO: handle this with a generic rpc-debug/pending function |
251 |
$site->session->set('register_error', 'rpc_error'); |
$site->session->set('commit_error', array( form => getlt('page/register/notify/rpc_error') )); |
252 |
$site->redirect( getlink('/pub/register/') ); |
$site->redirect( getlink('/pub/register/') ); |
253 |
} |
} |
254 |
//$this->_init($objectId); |
//$this->_init($objectId); |
258 |
global $site; |
global $site; |
259 |
//print "saving to backend: " . dumpVar($result) . "<br>"; |
//print "saving to backend: " . dumpVar($result) . "<br>"; |
260 |
if(!$this->pObject) { |
if(!$this->pObject) { |
261 |
|
$cache_key = php::CreateGUID() . "_guest"; |
262 |
$rpcinfo = $this->site->configuration->get("rpcinfo"); |
$rpcinfo = $this->site->configuration->get("rpcinfo"); |
263 |
$pObject = mkObject('DesignPattern::RemoteProxy', 'guest', array( key => 1, command => 'createGuestUser', '', remote => 1, rpcinfo => $rpcinfo, cache => array( db => 1, session => 1 ), connect => 1 ) ); |
$pObject = mkObject('DesignPattern::RemoteProxy', $cache_key, array( key => 1, command => 'createGuestUser', '', remote => 1, rpcinfo => $rpcinfo, cache => array( db => 1, session => 1 ), connect => 1 ) ); |
264 |
$response = $pObject->getResult(); |
$response = $pObject->getResult(); |
265 |
} else { |
} else { |
266 |
$response = $this->pObject->backend->send('createGuestUser'); |
$response = $this->pObject->backend->send('createGuestUser'); |
421 |
} |
} |
422 |
|
|
423 |
function refresh() { |
function refresh() { |
424 |
if ($this->pObject) {$this->pObject->flushState();} |
if ($this->pObject) {$this->pObject->flush();} |
425 |
$this->meta[data_ready] = 0; |
$this->meta[data_ready] = 0; |
426 |
} |
} |
427 |
|
|