/[cvs]/nfo/php/libs/org.netfrag.flib/Tracker/User.php
ViewVC logotype

Diff of /nfo/php/libs/org.netfrag.flib/Tracker/User.php

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.16 by jonen, Thu May 6 13:02:09 2004 UTC revision 1.22 by jonen, Wed Nov 17 16:14:47 2004 UTC
# Line 13  Line 13 
13  //    $Id$  //    $Id$
14  //    -----------------------------------------------------------------------------  //    -----------------------------------------------------------------------------
15  //    $Log$  //    $Log$
16    //    Revision 1.22  2004/11/17 16:14:47  jonen
17    //    + minor changes related to utf8 encoding
18    //
19    //    Revision 1.21  2004/11/03 14:13:21  jonen
20    //     small changes at create function
21    //
22    //    Revision 1.20  2004/10/07 14:08:51  jonen
23    //    + bufix related to save new-registered user-data
24    //
25    //    Revision 1.19  2004/06/22 09:18:47  jonen
26    //    removed debug dumps
27    //
28    //    Revision 1.17  2004/06/07 16:54:53  joko
29    //    modified cache-key
30    //    added cache-control
31    //
32  //    Revision 1.16  2004/05/06 13:02:09  jonen  //    Revision 1.16  2004/05/06 13:02:09  jonen
33  //    + added/modified functions related to User-Messages  //    + added/modified functions related to User-Messages
34  //  //
# Line 152  class User { Line 168  class User {
168      //$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) );
169      $rpcinfo = $this->site->configuration->get("rpcinfo");      $rpcinfo = $this->site->configuration->get("rpcinfo");
170      //$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 ) );
171      $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";
172        $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 ) );
173       if ($this->getUserGuid()) {       if ($this->getUserGuid()) {
174        $this->data = $this->pObject->getResult();        $this->data = $this->pObject->getResult();
175      }      }
# Line 167  class User { Line 184  class User {
184      }      }
185    
186      $this->_save("cache");      $this->_save("cache");
187        //$this->_save("commit");
188            
189      //$this->pObject->flushProxy();     // done in "pObject->save"      //$this->pObject->flushProxy();     // done in "pObject->save"
190            
# Line 181  class User { Line 199  class User {
199        $args = array( 'guid' => $this->data[guid], 'data' => $this->data );        $args = array( 'guid' => $this->data[guid], 'data' => $this->data );
200        $this->pObject->backend->send('saveUser', $args, array( utf8 => 1) );        $this->pObject->backend->send('saveUser', $args, array( utf8 => 1) );
201        $this->_save_local();        $this->_save_local();
202          $this->refresh();
203      }      }
204      // invalidate data only if it's not for caching purposes      // invalidate data only if it's not for caching purposes
205      if ($type != 'cache') {      if ($type != 'cache') {
# Line 202  class User { Line 221  class User {
221    }    }
222        
223    function create() {    function create() {
224     $this->_save();      // How THIS can function??? we will fool ourselves...
225     $attr = $this->pObject->getResult();     //$this->_save();
226     //print DumpVar($attr);     //$attr = $this->pObject->getResult();
227     $this->_create($attr);     $this->_create($this->data);
228    }    }
229    
230    function createGuest() {    function createGuest() {
# Line 220  class User { Line 239  class User {
239    function _create($result) {    function _create($result) {
240      global $site;      global $site;
241      //print "saving to backend: " . dumpVar($result) . "<br>";      //print "saving to backend: " . dumpVar($result) . "<br>";
242      $response = $this->pObject->backend->send('createUser', array('data' => $result) );      $response = $this->pObject->backend->send('createUser', array('data' => $result), array( utf8 => 1) );
243      $objectId = $response[oid];      $objectId = $response[oid];
244      if($objectId) {      if($objectId) {
245          connectdb();          connectdb();
# Line 232  class User { Line 251  class User {
251            }            }
252            else {            else {
253              // TODO: handle this with a generic rpc-debug/pending function              // TODO: handle this with a generic rpc-debug/pending function
254        $site->session->set('register_error', 'rpc_error');        $site->session->set('commit_error', array( form => getlt('page/register/notify/rpc_error') ));
255        $site->redirect( getlink('/pub/register/') );        $site->redirect( getlink('/pub/register/') );
256            }            }
257      //$this->_init($objectId);      //$this->_init($objectId);
# Line 242  class User { Line 261  class User {
261      global $site;      global $site;
262      //print "saving to backend: " . dumpVar($result) . "<br>";      //print "saving to backend: " . dumpVar($result) . "<br>";
263      if(!$this->pObject) {      if(!$this->pObject) {
264          $cache_key = php::CreateGUID() . "_guest";
265        $rpcinfo = $this->site->configuration->get("rpcinfo");        $rpcinfo = $this->site->configuration->get("rpcinfo");
266        $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 ) );
267        $response = $pObject->getResult();        $response = $pObject->getResult();
268      } else {      } else {
269        $response = $this->pObject->backend->send('createGuestUser');        $response = $this->pObject->backend->send('createGuestUser');
# Line 404  class User { Line 424  class User {
424    }    }
425        
426    function refresh() {    function refresh() {
427      if ($this->pObject) {$this->pObject->flushState();}      if ($this->pObject) {$this->pObject->flush();}
428      $this->meta[data_ready] = 0;      $this->meta[data_ready] = 0;
429    }    }
430        

Legend:
Removed from v.1.16  
changed lines
  Added in v.1.22

MailToCvsAdmin">MailToCvsAdmin
ViewVC Help
Powered by ViewVC 1.1.26 RSS 2.0 feed