/[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.18 by jonen, Tue Jun 22 09:15:50 2004 UTC revision 1.23 by jonen, Thu Aug 11 14:08:11 2005 UTC
# Line 3  Line 3 
3   * This file contains the Tracker::User module.   * This file contains the Tracker::User module.
4   *   *
5   * @author Andreas Motl <andreas.motl@ilo.de>   * @author Andreas Motl <andreas.motl@ilo.de>
6     * @author Sebastian Utz <su@rtme.net>
7   * @package org.netfrag.flib   * @package org.netfrag.flib
8   * @name Tracker::User   * @name Tracker::User
9   *   *
# Line 13  Line 14 
14  //    $Id$  //    $Id$
15  //    -----------------------------------------------------------------------------  //    -----------------------------------------------------------------------------
16  //    $Log$  //    $Log$
17  //    Revision 1.18  2004/06/22 09:15:50  jonen  //    Revision 1.23  2005/08/11 14:08:11  jonen
18  //    bugfix: use unique cache-keys at createGuest  //    + added functions relating to TerminalUser
19    //
20    //    Revision 1.22  2004/11/17 16:14:47  jonen
21    //    + minor changes related to utf8 encoding
22    //
23    //    Revision 1.21  2004/11/03 14:13:21  jonen
24    //     small changes at create function
25    //
26    //    Revision 1.20  2004/10/07 14:08:51  jonen
27    //    + bufix related to save new-registered user-data
28    //
29    //    Revision 1.19  2004/06/22 09:18:47  jonen
30    //    removed debug dumps
31  //  //
32  //    Revision 1.17  2004/06/07 16:54:53  joko  //    Revision 1.17  2004/06/07 16:54:53  joko
33  //    modified cache-key  //    modified cache-key
# Line 175  class User { Line 188  class User {
188      }      }
189    
190      $this->_save("cache");      $this->_save("cache");
191        //$this->_save("commit");
192            
193      //$this->pObject->flushProxy();     // done in "pObject->save"      //$this->pObject->flushProxy();     // done in "pObject->save"
194            
# Line 211  class User { Line 225  class User {
225    }    }
226        
227    function create() {    function create() {
228     $this->_save();      // How THIS can function??? we will fool ourselves...
229     $attr = $this->pObject->getResult();     //$this->_save();
230     //print DumpVar($attr);     //$attr = $this->pObject->getResult();
231     $this->_create($attr);     $this->_create($this->data);
232    }    }
233    
234    function createGuest() {    function createGuest() {
# Line 226  class User { Line 240  class User {
240     return $data;     return $data;
241    }    }
242    
243      function createTerminalUser() {
244        if($this->isLoggedOn) { return; }
245       //$this->_save();
246       //$attr = $this->pObject->getResult();
247       //print DumpVar($attr);
248       $data = $this->_createTerminalUser();
249       return $data;
250      }
251    
252    function _create($result) {    function _create($result) {
253      global $site;      global $site;
254      //print "saving to backend: " . dumpVar($result) . "<br>";      //print "saving to backend: " . dumpVar($result) . "<br>";
255      $response = $this->pObject->backend->send('createUser', array('data' => $result) );      $response = $this->pObject->backend->send('createUser', array('data' => $result), array( utf8 => 1) );
256      $objectId = $response[oid];      $objectId = $response[oid];
257      if($objectId) {      if($objectId) {
258          connectdb();          connectdb();
# Line 241  class User { Line 264  class User {
264            }            }
265            else {            else {
266              // TODO: handle this with a generic rpc-debug/pending function              // TODO: handle this with a generic rpc-debug/pending function
267        $site->session->set('register_error', 'rpc_error');        $site->session->set('commit_error', array( form => getlt('page/register/notify/rpc_error') ));
268        $site->redirect( getlink('/pub/register/') );        $site->redirect( getlink('/pub/register/') );
269            }            }
270      //$this->_init($objectId);      //$this->_init($objectId);
# Line 252  class User { Line 275  class User {
275      //print "saving to backend: " . dumpVar($result) . "<br>";      //print "saving to backend: " . dumpVar($result) . "<br>";
276      if(!$this->pObject) {      if(!$this->pObject) {
277        $cache_key = php::CreateGUID() . "_guest";        $cache_key = php::CreateGUID() . "_guest";
       print "guest_cache_key: $cache_key <br>";  
278        $rpcinfo = $this->site->configuration->get("rpcinfo");        $rpcinfo = $this->site->configuration->get("rpcinfo");
279        $pObject = mkObject('DesignPattern::RemoteProxy', $cache_key, 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 ) );
280        $response = $pObject->getResult();        $response = $pObject->getResult();
# Line 272  class User { Line 294  class User {
294      //$this->_init($objectId);      //$this->_init($objectId);
295    }    }
296    
297      function _createTerminalUser() {
298        global $site;
299        //print "saving to backend: " . dumpVar($result) . "<br>";
300        if(!$this->pObject) {
301          $rpcinfo = $this->site->configuration->get("rpcinfo");
302          $backend = mkObject('DataSource::Proxy::XMLRPC', $rpcinfo);
303          //$pObject = mkObject('DesignPattern::RemoteProxy', 'createTerminalUser', array( key => 1, command => 'createTerminalUser', array('terminalID' => $site->session->get('validTerminal'), ), remote => 1, rpcinfo => $rpcinfo, cache => array( db => 1, session => 0 ), connect => 1 ) );
304          //$response = $pObject->getResult();
305          $response = $backend->send('createTerminalUser', array('terminalID' => $site->session->get('validTerminal')), array( utf8 => 1) );
306        } else {
307          $response = $this->pObject->backend->send('createTerminalUser', array('terminalID' => $site->session->get('validTerminal')), array( utf8 => 1) );
308        }
309        //print "response: " . Dumper($response) . "<br>";
310        $objectId = $response[oid];
311        if($objectId) {
312          return $response;
313        } elseif($response[error]) {
314          $site->session->set('site_error', $response[error]);      
315              } else {
316                // TODO: handle this with a generic rpc-debug/pending function
317          $site->session->set('login_error', 'rpc_error');
318          $site->redirect( getlink('/pub/login/') );
319              }
320        //$this->_init($objectId);
321      }
322    
323    
324    function get($attr) {    function get($attr) {
325      $this->_doDataReady();      $this->_doDataReady();
326      $deep = new Data_Deep($this->data);      $deep = new Data_Deep($this->data);
# Line 324  class User { Line 373  class User {
373        return 1;        return 1;
374    }    }
375    
376      //===== function terminallogin =========================
377      function loginTerminalUser($data) {
378          // store 1st priority user-data to state
379            $this->state[id] = $data[oid];
380            $this->state[guid] = $data[guid];
381            $this->state[status] = $this->meta[logontoken];
382            $this->_saveState();
383          $this->site->log( get_class($this) . "->terminalUser-login ok", PEAR_LOG_NOTICE );
384          return 1;
385      }
386    
387    function exists($string) {    function exists($string) {
388          connectdb();          connectdb();
389          $sql = "SELECT uname FROM td_users WHERE uname='$string'";          $sql = "SELECT uname FROM td_users WHERE uname='$string'";

Legend:
Removed from v.1.18  
changed lines
  Added in v.1.23

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