| 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 |
* |
* |
| 14 |
// $Id$ |
// $Id$ |
| 15 |
// ----------------------------------------------------------------------------- |
// ----------------------------------------------------------------------------- |
| 16 |
// $Log$ |
// $Log$ |
| 17 |
|
// Revision 1.23 2005/08/11 14:08:11 jonen |
| 18 |
|
// + added functions relating to TerminalUser |
| 19 |
|
// |
| 20 |
// Revision 1.22 2004/11/17 16:14:47 jonen |
// Revision 1.22 2004/11/17 16:14:47 jonen |
| 21 |
// + minor changes related to utf8 encoding |
// + minor changes related to utf8 encoding |
| 22 |
// |
// |
| 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>"; |
| 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); |
| 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'"; |