--- nfo/php/libs/org.netfrag.flib/Tracker/User.php 2004/11/17 16:14:47 1.22 +++ nfo/php/libs/org.netfrag.flib/Tracker/User.php 2005/08/11 14:08:11 1.23 @@ -3,6 +3,7 @@ * This file contains the Tracker::User module. * * @author Andreas Motl + * @author Sebastian Utz * @package org.netfrag.flib * @name Tracker::User * @@ -10,9 +11,12 @@ // ----------------------------------------------------------------------------- -// $Id: User.php,v 1.22 2004/11/17 16:14:47 jonen Exp $ +// $Id: User.php,v 1.23 2005/08/11 14:08:11 jonen Exp $ // ----------------------------------------------------------------------------- // $Log: User.php,v $ +// Revision 1.23 2005/08/11 14:08:11 jonen +// + added functions relating to TerminalUser +// // Revision 1.22 2004/11/17 16:14:47 jonen // + minor changes related to utf8 encoding // @@ -236,6 +240,15 @@ return $data; } + function createTerminalUser() { + if($this->isLoggedOn) { return; } + //$this->_save(); + //$attr = $this->pObject->getResult(); + //print DumpVar($attr); + $data = $this->_createTerminalUser(); + return $data; + } + function _create($result) { global $site; //print "saving to backend: " . dumpVar($result) . "
"; @@ -281,6 +294,33 @@ //$this->_init($objectId); } + function _createTerminalUser() { + global $site; + //print "saving to backend: " . dumpVar($result) . "
"; + if(!$this->pObject) { + $rpcinfo = $this->site->configuration->get("rpcinfo"); + $backend = mkObject('DataSource::Proxy::XMLRPC', $rpcinfo); + //$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 ) ); + //$response = $pObject->getResult(); + $response = $backend->send('createTerminalUser', array('terminalID' => $site->session->get('validTerminal')), array( utf8 => 1) ); + } else { + $response = $this->pObject->backend->send('createTerminalUser', array('terminalID' => $site->session->get('validTerminal')), array( utf8 => 1) ); + } + //print "response: " . Dumper($response) . "
"; + $objectId = $response[oid]; + if($objectId) { + return $response; + } elseif($response[error]) { + $site->session->set('site_error', $response[error]); + } else { + // TODO: handle this with a generic rpc-debug/pending function + $site->session->set('login_error', 'rpc_error'); + $site->redirect( getlink('/pub/login/') ); + } + //$this->_init($objectId); + } + + function get($attr) { $this->_doDataReady(); $deep = new Data_Deep($this->data); @@ -333,6 +373,17 @@ return 1; } + //===== function terminallogin ========================= + function loginTerminalUser($data) { + // store 1st priority user-data to state + $this->state[id] = $data[oid]; + $this->state[guid] = $data[guid]; + $this->state[status] = $this->meta[logontoken]; + $this->_saveState(); + $this->site->log( get_class($this) . "->terminalUser-login ok", PEAR_LOG_NOTICE ); + return 1; + } + function exists($string) { connectdb(); $sql = "SELECT uname FROM td_users WHERE uname='$string'";