/[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.2 by joko, Tue Dec 3 16:47:22 2002 UTC revision 1.6 by jonen, Wed Dec 18 22:46:06 2002 UTC
# Line 3  Line 3 
3  //    $Id$  //    $Id$
4  //    -----------------------------------------------------------------------------  //    -----------------------------------------------------------------------------
5  //    $Log$  //    $Log$
6    //    Revision 1.6  2002/12/18 22:46:06  jonen
7    //    + added function 'getUserGuid()'
8    //       (returns user's 'guid' read from database at function 'login()'  (now))
9    //    + function '_loadData()' loads user remote now via 'getUserGuid()'
10    //
11    //    Revision 1.5  2002/12/12 21:34:32  joko
12    //    + fix in 'function update': invalidate data only if it's not for caching purposes
13    //
14    //    Revision 1.4  2002/12/06 04:10:28  joko
15    //    + replaced 'xyzCache' through 'xyzProxy'
16    //
17    //    Revision 1.3  2002/12/04 07:42:54  jonen
18    //    + changes according to backend schema change
19    //
20  //    Revision 1.2  2002/12/03 16:47:22  joko  //    Revision 1.2  2002/12/03 16:47:22  joko
21  //    - function preLogout()  //    - function preLogout()
22  //    + function preLogout($autologout = 0)  //    + function preLogout($autologout = 0)
# Line 84  class User { Line 98  class User {
98    
99    
100    function _loadData() {    function _loadData() {
101      $this->pObject = new ProxyObject($this->state[id]);      $this->pObject = new ProxyObject($this->getUserGuid(), array( remote => 1, classname => "NetPerson", guid => 1) );
102      if ($this->state[id]) {      if ($this->getUserGuid()) {
103        $this->data = $this->pObject->getAttributes();        $this->data = $this->pObject->getAttributes();
104      }      }
105      $this->meta[data_ready] = 1;      $this->meta[data_ready] = 1;
# Line 100  class User { Line 114  class User {
114    
115      $this->_save("cache");      $this->_save("cache");
116            
117      //$this->pObject->flushCache();     // done in "pObject->save"      //$this->pObject->flushProxy();     // done in "pObject->save"
118            
119    }    }
120        
121    function _save($type = '') {    function _save($type = '') {
122    //print Dumper($this->data);
123      $this->pObject->save($this->data, $type);      $this->pObject->save($this->data, $type);
124      $this->meta[data_ready] = 0;      // invalidate data only if it's not for caching purposes
125        if ($type != 'cache') {
126          $this->meta[data_ready] = 0;
127        }
128    }    }
129        
130    function save() {    function save() {
# Line 159  class User { Line 177  class User {
177    function login($user,$passwd) {    function login($user,$passwd) {
178          connectdb();          connectdb();
179          //$sql = "SELECT * FROM td_users WHERE uname='$user'";          //$sql = "SELECT * FROM td_users WHERE uname='$user'";
180          $sql = "SELECT user_oid, uname, pass FROM td_users WHERE uname='$user'";          $sql = "SELECT user_oid, guid, uname, pass FROM td_users WHERE uname='$user'";
181          if ($res=send_sql($sql)) {          if ($res=send_sql($sql)) {
182                  $row = mysql_fetch_array($res,MYSQL_ASSOC);                  $row = mysql_fetch_array($res,MYSQL_ASSOC);
183                  if (!is_array($row)) { return 0; }                  if (!is_array($row)) { return 0; }
# Line 168  class User { Line 186  class User {
186        //return $uservars_db;        //return $uservars_db;
187        // store 1st priority user-data to state        // store 1st priority user-data to state
188          $this->state[id] = $row[user_oid];          $this->state[id] = $row[user_oid];
189            $this->state[guid] = $row[guid];
190          $this->state[status] = $this->meta[logontoken];          $this->state[status] = $this->meta[logontoken];
191          $this->_saveState();          $this->_saveState();
192        $this->site->log( get_class($this) . "->login ok", LOG_DEBUG );        $this->site->log( get_class($this) . "->login ok", LOG_DEBUG );
# Line 191  class User { Line 210  class User {
210    }    }
211        
212    
213    function update(&$uservars) {    function update($vars) {
214      $this->setPostVars($uservars);      $this->setPostVars($vars);
215      $data = $this->_transformInputData($uservars);  //print Dumper($vars);
216        $data = $this->_transformInputData($vars);
217      $this->_saveData($data);      $this->_saveData($data);
218    }    }
219    
# Line 213  class User { Line 233  class User {
233      global $site;      global $site;
234    
235      // get information about user from site      // get information about user from site
236        $userid = $this->state[id];        $userid = $this->getUserId();
237    
238        $this->site->log( get_class($this) . "->logout: userid $userid", LOG_DEBUG );        $this->site->log( get_class($this) . "->logout: userid $userid", LOG_DEBUG );
239            
# Line 247  class User { Line 267  class User {
267    function getAccountSum() {    function getAccountSum() {
268      // store additional user-data to state      // store additional user-data to state
269        if (!$this->state[accountSum]) {        if (!$this->state[accountSum]) {
270          $this->state[accountSum] = $this->get("financeInfo.accountSum");          $this->state[accountSum] = $this->get("account.amount");
271          $this->_saveState();          $this->_saveState();
272        }        }
273        return $this->state[accountSum];        return $this->state[accountSum];
# Line 256  class User { Line 276  class User {
276    function getAccountCurrency() {    function getAccountCurrency() {
277      // store additional user-data to state      // store additional user-data to state
278        if (!$this->state[accountCurrency]) {        if (!$this->state[accountCurrency]) {
279          $this->state[accountCurrency] = $this->get("financeInfo.currency");          $this->state[accountCurrency] = $this->get("account.currency");
280          $this->_saveState();          $this->_saveState();
281        }        }
282        //print "state: " . $this->get("financeInfo.currency") . "<br>";        //print "state: " . $this->get("financeInfo.currency") . "<br>";
# Line 292  class User { Line 312  class User {
312      return $this->state[id];      return $this->state[id];
313    }    }
314    
315      function getUserGuid() {
316        return $this->state[guid];
317      }
318    
319    function getPostVars() {    function getPostVars() {
320      return $this->state[postvars];      return $this->state[postvars];

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.6

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