/[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.4 by joko, Fri Dec 6 04:10:28 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  //    Revision 1.4  2002/12/06 04:10:28  joko
15  //    + replaced 'xyzCache' through 'xyzProxy'  //    + replaced 'xyzCache' through 'xyzProxy'
16  //  //
# Line 90  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 111  class User { Line 119  class User {
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 165  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 174  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 197  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 219  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 298  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.4  
changed lines
  Added in v.1.6

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