Main Page | Directories | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages | Examples

t3lib_userAuth Class Reference

Inherited by t3lib_userAuthGroup, and tslib_feUserAuth.

List of all members.

Public Member Functions

 start ()
 Starts a user session Typical configurations will: a) check if session cookie was set and if not, set one, b) check if a password/username was sent and if so, try to authenticate the user c) Lookup a session attached to a user and check timeout etc.
 check_authentication ()
 Checks if a submission of username and password is present.
 redirect ()
 Redirect to somewhere.
 logoff ()
 Log out current user! Removes the current session record, sets the internal ->user array to a blank string; Thereby the current user (if any) is effectively logged out!
 gc ()
 Garbage collector, removing old expired sessions.
 user_where_clause ()
 This returns the where-clause needed to select the user with respect flags like deleted, hidden, starttime, endtime.
 ipLockClause ()
 This returns the where-clause needed to lock a user to the IP address.
 ipLockClause_remoteIPNumber ($parts)
 Returns the IP address to lock to.
 hashLockClause ()
 This returns the where-clause needed to lock a user to a hash integer.
 hashLockClause_getHashInt ()
 Creates hash integer to lock user to.
 writeUC ($variable='')
 This writes $variable to the user-record.
 writelog ($type, $action, $error, $details_nr, $details, $data, $tablename, $recuid, $recpid)
 DUMMY: Writes to log database table (in some extension classes).
 checkLogFailures ()
 DUMMY: Check login failures (in some extension classes).
 unpack_uc ($theUC='')
 Sets $theUC as the internal variable ->uc IF $theUC is an array.
 pushModuleData ($module, $data, $noSave=0)
 Stores data for a module.
 getModuleData ($module, $type='')
 Gets module data for a module (from a loaded ->uc array).
 getSessionData ($key)
 Returns the session data stored for $key.
 setAndSaveSessionData ($key, $data)
 Sets the session data ($data) for $key and writes all session data (from ->user['ses_data']) to the database.
 setBeUserByUid ($uid)
 Raw initialization of the be_user with uid=$uid This will circumvent all login procedures and select a be_users record from the database and set the content of ->user to the record selected.
 setBeUserByName ($name)
 Raw initialization of the be_user with username=$name.

Public Attributes

 $global_database = ''
 $session_table = ''
 $name = ''
 $get_name = ''
 $user_table = ''
 $username_column = ''
 $userident_column = ''
 $userid_column = ''
 $lastLogin_column = ''
 $enablecolumns
 $formfield_uname = ''
 $formfield_uident = ''
 $formfield_chalvalue = ''
 $formfield_status = ''
 $security_level = ''
 $auth_include = ''
 $auth_timeout_field = 0
 $lifetime = 0
 $gc_time = 24
 $gc_probability = 1
 $writeStdLog = 0
 $writeAttemptLog = 0
 $sendNoCacheHeaders = 1
 $getFallBack = 0
 $hash_length = 32
 $getMethodEnabled = 0
 $lockIP = 4
 $lockHashKeyWords = 'useragent'
 $warningEmail = ''
 $warningPeriod = 3600
 $warningMax = 3
 $checkPid = 1
 $checkPid_value = 0
 $id
 $cookieId
 $loginSessionStarted = 0
 $user
 $get_URL_ID = ''
 $forceSetCookie = 0
 $dontSetCookie = 0


Member Function Documentation

t3lib_userAuth::check_authentication  ) 
 

Checks if a submission of username and password is present.

Returns:
string Returns "login" if login, "logout" if logout, or empty if $F_status was none of these values.

Definition at line 261 of file class.t3lib_userauth.php.

References checkLogFailures(), hashLockClause_getHashInt(), logoff(), section(), and writelog().

Referenced by start().

00261                                    {
00262 
00263          // The values fetched from input variables here are supposed to already BE slashed...
00264       if ($this->getMethodEnabled)  {
00265          $F_status = t3lib_div::_GP($this->formfield_status);
00266          $F_uname = t3lib_div::_GP($this->formfield_uname);
00267          $F_uident = t3lib_div::_GP($this->formfield_uident);
00268          $F_chalvalue = t3lib_div::_GP($this->formfield_chalvalue);
00269       } else {
00270          $F_status = t3lib_div::_POST($this->formfield_status);
00271          $F_uname = t3lib_div::_POST($this->formfield_uname);
00272          $F_uident = t3lib_div::_POST($this->formfield_uident);
00273          $F_chalvalue = t3lib_div::_POST($this->formfield_chalvalue);
00274       }
00275 
00276       switch ($F_status)   {
00277          case 'login':
00278             $refInfo=parse_url(t3lib_div::getIndpEnv('HTTP_REFERER'));
00279             $httpHost = t3lib_div::getIndpEnv('TYPO3_HOST_ONLY');
00280             if (!$this->getMethodEnabled && ($httpHost!=$refInfo['host'] && !$GLOBALS['TYPO3_CONF_VARS']['SYS']['doNotCheckReferer'])) {
00281                die('Error: This host address ("'.$httpHost.'") and the referer host ("'.$refInfo['host'].'") mismatches!<br />
00282                   It\'s possible that the environment variable HTTP_REFERER is not passed to the script because of a proxy.<br />
00283                   The site administrator can disable this check in the "All Configuration" section of the Install Tool (flag: TYPO3_CONF_VARS[SYS][doNotCheckReferer]).');
00284             }
00285             if ($F_uident && $F_uname) {
00286 
00287                   // Reset this flag
00288                $loginFailure=0;
00289 
00290                   // delete old user session if any
00291                $this->logoff();
00292 
00293                   // Look up the new user by the username:
00294                $dbres = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
00295                            '*',
00296                            $this->user_table,
00297                            ($this->checkPid ? 'pid IN ('.$GLOBALS['TYPO3_DB']->cleanIntList($this->checkPid_value).') AND ' : '').
00298                               $this->username_column.'="'.$GLOBALS['TYPO3_DB']->quoteStr($F_uname, $this->user_table).'" '.
00299                               $this->user_where_clause()
00300                      );
00301 
00302                   // Enter, if a user was found:
00303                if ($tempuser = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($dbres)) {
00304                      // Internal user record set (temporarily)
00305                   $this->user = $tempuser;
00306 
00307                      // Default: not OK - will be set true if password matches in the comparison hereafter
00308                   $OK = false;
00309 
00310                      // check the password
00311                   switch ($this->security_level)   {
00312                      case 'superchallenged':    // If superchallenged the password in the database ($tempuser[$this->userident_column]) must be a md5-hash of the original password.
00313                      case 'challenged':
00314                         if (!strcmp($F_uident,md5($tempuser[$this->username_column].':'.$tempuser[$this->userident_column].':'.$F_chalvalue)))  {
00315                            $OK = true;
00316                         };
00317                      break;
00318                      default: // normal
00319                         if (!strcmp($F_uident,$tempuser[$this->userident_column]))  {
00320                            $OK = true;
00321                         };
00322                      break;
00323                   }
00324 
00325                      // Write session-record in case user was verified OK
00326                   if ($OK) {
00327                         // Checking the domain (lockToDomain)
00328                      if ($this->user['lockToDomain'] && $this->user['lockToDomain']!=t3lib_div::getIndpEnv('HTTP_HOST'))   {
00329                            // Lock domain didn't match, so error:
00330                         if ($this->writeAttemptLog) {
00331                            $this->writelog(255,3,3,1,
00332                               "Login-attempt from %s (%s), username '%s', locked domain '%s' did not match '%s'!",
00333                               Array(t3lib_div::getIndpEnv('REMOTE_ADDR'),t3lib_div::getIndpEnv('REMOTE_HOST'),$F_uname,$this->user['lockToDomain'],t3lib_div::getIndpEnv('HTTP_HOST')));
00334                         }
00335                         $loginFailure=1;
00336                      } else {
00337                            // The loginsession is started.
00338                         $this->loginSessionStarted = 1;
00339 
00340                            // Inserting session record:
00341                         $insertFields = array(
00342                            'ses_id' => $this->id,
00343                            'ses_name' => $this->name,
00344                            'ses_iplock' => $this->user['disableIPlock'] ? '[DISABLED]' : $this->ipLockClause_remoteIPNumber($this->lockIP),
00345                            'ses_hashlock' => $this->hashLockClause_getHashInt(),
00346                            'ses_userid' => $tempuser[$this->userid_column],
00347                            'ses_tstamp' => $GLOBALS['EXEC_TIME']
00348                         );
00349                         $GLOBALS['TYPO3_DB']->exec_INSERTquery($this->session_table, $insertFields);
00350 
00351                            // Updating column carrying information about last login.
00352                         if ($this->lastLogin_column)  {
00353                            $GLOBALS['TYPO3_DB']->exec_UPDATEquery(
00354                                              $this->user_table,
00355                                              $this->userid_column.'="'.$GLOBALS['TYPO3_DB']->quoteStr($tempuser[$this->userid_column], $this->user_table).'"',
00356                                              array($this->lastLogin_column => $GLOBALS['EXEC_TIME'])
00357                                           );
00358                         }
00359                            // User logged in - write that to the log!
00360                         if ($this->writeStdLog) {
00361                            $this->writelog(255,1,0,1,
00362                               'User %s logged in from %s (%s)',
00363                               Array($this->user['username'],t3lib_div::getIndpEnv('REMOTE_ADDR'),t3lib_div::getIndpEnv('REMOTE_HOST')));
00364                         }
00365                      }
00366                   } else {
00367                         // Failed login attempt (wrong password) - write that to the log!
00368                      if ($this->writeAttemptLog) {
00369                         $this->writelog(255,3,3,1,
00370                            "Login-attempt from %s (%s), username '%s', password not accepted!",
00371                            Array(t3lib_div::getIndpEnv('REMOTE_ADDR'),t3lib_div::getIndpEnv('REMOTE_HOST'),$F_uname));
00372                      }
00373                      $loginFailure=1;
00374                   }
00375                      // Make sure to clear the user again!!
00376                   unset($this->user);
00377                } else {
00378                      // Failed login attempt (no username found)
00379                   if ($this->writeAttemptLog) {
00380                      $this->writelog(255,3,3,2,
00381                         "Login-attempt from %s (%s), username '%s' not found!!",
00382                         Array(t3lib_div::getIndpEnv('REMOTE_ADDR'),t3lib_div::getIndpEnv('REMOTE_HOST'),$F_uname));  // Logout written to log
00383                   }
00384                   $loginFailure=1;
00385                }
00386 
00387                   // If there were a login failure, check to see if a warning email should be sent:
00388                if ($loginFailure)   {
00389                   $this->checkLogFailures($this->warningEmail, $this->warningPeriod, $this->warningMax);
00390                }
00391             }
00392 
00393                // Return "login" - since this was the $F_status
00394             return 'login';
00395          break;
00396          case 'logout':
00397                // Just logout:
00398             if ($this->writeStdLog)    $this->writelog(255,2,0,2,'User %s logged out',Array($this->user['username']));  // Logout written to log
00399             $this->logoff();
00400 
00401                // Return "logout" - since this was the $F_status
00402             return 'logout';
00403          break;
00404       }
00405    }

t3lib_userAuth::checkLogFailures  ) 
 

DUMMY: Check login failures (in some extension classes).

Returns:
void

Definition at line 567 of file class.t3lib_userauth.php.

Referenced by check_authentication().

00567                                  {
00568    }

t3lib_userAuth::gc  ) 
 

Garbage collector, removing old expired sessions.

Returns:
void

Definition at line 441 of file class.t3lib_userauth.php.

Referenced by start().

00441                  {
00442       $GLOBALS['TYPO3_DB']->exec_DELETEquery(
00443                $this->session_table,
00444                'ses_tstamp < '.intval(time()-($this->gc_time*60*60)).'
00445                   AND ses_name = "'.$GLOBALS['TYPO3_DB']->quoteStr($this->name, $this->session_table).'"'
00446             );
00447    }

t3lib_userAuth::getModuleData module,
type = ''
 

Gets module data for a module (from a loaded ->uc array).

Parameters:
string $module is the name of the module ($MCONF['name'])
string If $type = 'ses' then module data is returned only if it was stored in the current session, otherwise data from a previous session will be returned (if available).
Returns:
mixed The module data if available: $this->uc['moduleData'][$module];

Definition at line 605 of file class.t3lib_userauth.php.

00605                                              {
00606       if ($type!='ses' || $this->uc['moduleSessionID'][$module]==$this->id) {
00607          return $this->uc['moduleData'][$module];
00608       }
00609    }

t3lib_userAuth::getSessionData key  ) 
 

Returns the session data stored for $key.

The data will last only for this login session since it is stored in the session table.

Parameters:
string Pointer to an associative key in the session data array which is stored serialized in the field "ses_data" of the session table.
Returns:
mixed

Definition at line 618 of file class.t3lib_userauth.php.

00618                                  {
00619       $sesDat = unserialize($this->user['ses_data']);
00620       return $sesDat[$key];
00621    }

t3lib_userAuth::hashLockClause  ) 
 

This returns the where-clause needed to lock a user to a hash integer.

Returns:
string private

Definition at line 508 of file class.t3lib_userauth.php.

00508                               {
00509       $wherePart = 'AND '.$this->session_table.'.ses_hashlock='.intval($this->hashLockClause_getHashInt());
00510       return $wherePart;
00511    }

t3lib_userAuth::hashLockClause_getHashInt  ) 
 

Creates hash integer to lock user to.

Depends on configured keywords

Returns:
integer Hash integer private

Definition at line 519 of file class.t3lib_userauth.php.

Referenced by check_authentication().

00519                                           {
00520       $hashStr = '';
00521 
00522       if (t3lib_div::inList($this->lockHashKeyWords,'useragent')) $hashStr.=':'.t3lib_div::getIndpEnv('HTTP_USER_AGENT');
00523 
00524       return t3lib_div::md5int($hashStr);
00525    }

t3lib_userAuth::ipLockClause  ) 
 

This returns the where-clause needed to lock a user to the IP address.

Returns:
string private

Definition at line 469 of file class.t3lib_userauth.php.

00469                            {
00470       if ($this->lockIP)   {
00471          $wherePart = 'AND (
00472             '.$this->session_table.'.ses_iplock="'.$GLOBALS['TYPO3_DB']->quoteStr($this->ipLockClause_remoteIPNumber($this->lockIP),$this->session_table).'"
00473             OR '.$this->session_table.'.ses_iplock="[DISABLED]"
00474             )';
00475          return $wherePart;
00476       }
00477    }

t3lib_userAuth::ipLockClause_remoteIPNumber parts  ) 
 

Returns the IP address to lock to.

The IP address may be partial based on $parts.

Parameters:
integer 1-4: Indicates how many parts of the IP address to return. 4 means all, 1 means only first number.
Returns:
string (Partial) IP address for REMOTE_ADDR private

Definition at line 487 of file class.t3lib_userauth.php.

References $a.

00487                                                 {
00488       $IP = t3lib_div::getIndpEnv('REMOTE_ADDR');
00489 
00490       if ($parts>=4) {
00491          return $IP;
00492       } else {
00493          $parts = t3lib_div::intInRange($parts,1,3);
00494          $IPparts = explode('.',$IP);
00495          for($a=4;$a>$parts;$a--)   {
00496             unset($IPparts[$a-1]);
00497          }
00498          return implode('.',$IPparts);
00499       }
00500    }

t3lib_userAuth::logoff  ) 
 

Log out current user! Removes the current session record, sets the internal ->user array to a blank string; Thereby the current user (if any) is effectively logged out!

Returns:
void

Definition at line 426 of file class.t3lib_userauth.php.

Referenced by check_authentication(), and start().

00426                      {
00427       $GLOBALS['TYPO3_DB']->exec_DELETEquery(
00428                $this->session_table,
00429                'ses_id = "'.$GLOBALS['TYPO3_DB']->quoteStr($this->id, $this->session_table).'"
00430                   AND ses_name = "'.$GLOBALS['TYPO3_DB']->quoteStr($this->name, $this->session_table).'"'
00431             );
00432       $this->user = "";
00433    }

t3lib_userAuth::pushModuleData module,
data,
noSave = 0
 

Stores data for a module.

The data is stored with the session id so you can even check upon retrieval if the module data is from a previous session or from the current session.

Parameters:
string $module is the name of the module ($MCONF['name'])
mixed $data is the data you want to store for that module (array, string, ...)
boolean If $noSave is set, then the ->uc array (which carries all kinds of user data) is NOT written immediately, but must be written by some subsequent call.
Returns:
void

Definition at line 592 of file class.t3lib_userauth.php.

References writeUC().

00592                                                       {
00593       $this->uc['moduleData'][$module] = $data;
00594       $this->uc['moduleSessionID'][$module] = $this->id;
00595       if (!$noSave) $this->writeUC();
00596    }

t3lib_userAuth::redirect  ) 
 

Redirect to somewhere.

Obsolete, depreciated etc.

Returns:
void

Definition at line 413 of file class.t3lib_userauth.php.

Referenced by start().

00413                        {
00414       if (!$this->userid && $this->auth_url) {   // if no userid AND an include-document for login is given
00415          include ($this->auth_include);
00416          exit;
00417       }
00418    }

t3lib_userAuth::setAndSaveSessionData key,
data
 

Sets the session data ($data) for $key and writes all session data (from ->user['ses_data']) to the database.

The data will last only for this login session since it is stored in the session table.

Parameters:
string Pointer to an associative key in the session data array which is stored serialized in the field "ses_data" of the session table.
mixed The variable to store in index $key
Returns:
void

Definition at line 631 of file class.t3lib_userauth.php.

00631                                                 {
00632       $sesDat = unserialize($this->user['ses_data']);
00633       $sesDat[$key] = $data;
00634       $this->user['ses_data'] = serialize($sesDat);
00635 
00636       $GLOBALS['TYPO3_DB']->exec_UPDATEquery($this->session_table, 'ses_id="'.$GLOBALS['TYPO3_DB']->quoteStr($this->user['ses_id'], $this->session_table).'"', array('ses_data' => $this->user['ses_data']));
00637    }

t3lib_userAuth::setBeUserByName name  ) 
 

Raw initialization of the be_user with username=$name.

Parameters:
string The username to look up.
Returns:
void
See also:
t3lib_userAuth::setBeUserByUid()

Definition at line 663 of file class.t3lib_userauth.php.

Referenced by t3lib_beUserAuth::checkCLIuser().

00663                                     {
00664       $dbres = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', $this->user_table, 'username="'.$GLOBALS['TYPO3_DB']->quoteStr($name, $this->user_table).'" '.$this->user_where_clause());
00665       $this->user = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($dbres);
00666    }

t3lib_userAuth::setBeUserByUid uid  ) 
 

Raw initialization of the be_user with uid=$uid This will circumvent all login procedures and select a be_users record from the database and set the content of ->user to the record selected.

Thus the BE_USER object will appear like if a user was authenticated - however without a session id and the fields from the session table of course. Will check the users for disabled, start/endtime, etc. ($this->user_where_clause())

Parameters:
integer The UID of the backend user to set in ->user
Returns:
void integer 'uid' of be_users record to select and set.

Definition at line 650 of file class.t3lib_userauth.php.

00650                                  {
00651       $dbres = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', $this->user_table, 'uid="'.intval($uid).'" '.$this->user_where_clause());
00652       $this->user = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($dbres);
00653    }

t3lib_userAuth::start  ) 
 

Starts a user session Typical configurations will: a) check if session cookie was set and if not, set one, b) check if a password/username was sent and if so, try to authenticate the user c) Lookup a session attached to a user and check timeout etc.

d) Garbage collection, setting of no-cache headers. If a user is authenticated the database record of the user (array) will be set in the ->user internal variable.

Returns:
void

Definition at line 159 of file class.t3lib_userauth.php.

References $id, check_authentication(), gc(), header(), logoff(), and redirect().

00159                     {
00160 
00161          // Init vars.
00162       $mode='';
00163       $new_id = false;           // Default: not a new session
00164       $id = isset($_COOKIE[$this->name]) ? stripslashes($_COOKIE[$this->name]) : '';   // $id is set to ses_id if cookie is present. Else set to false, which will start a new session
00165       $this->hash_length = t3lib_div::intInRange($this->hash_length,6,32);
00166 
00167          // If fallback to get mode....
00168       if (!$id && $this->getFallBack && $this->get_name) {
00169          $id = isset($_GET[$this->get_name]) ? t3lib_div::_GET($this->get_name) : '';
00170          if (strlen($id)!=$this->hash_length)   $id='';
00171          $mode='get';
00172       }
00173       $this->cookieId = $id;
00174 
00175       if (!$id)   {              // If new session...
00176          $id = substr(md5(uniqid('')),0,$this->hash_length);      // New random session-$id is made
00177          $new_id = true;            // New session
00178       }
00179          // Internal var 'id' is set
00180       $this->id = $id;
00181       if ($mode=='get' && $this->getFallBack && $this->get_name)  {  // If fallback to get mode....
00182          $this->get_URL_ID = '&'.$this->get_name.'='.$id;
00183       }
00184       $this->user = '';          // Make certain that NO user is set initially
00185 
00186          // Setting cookies
00187         if (($new_id || $this->forceSetCookie) && $this->lifetime==0 ) {      // If new session and the cookie is a sessioncookie, we need to set it only once!
00188           if (!$this->dontSetCookie)   SetCookie($this->name, $id, 0, '/');      // Cookie is set
00189         }
00190         if ($this->lifetime > 0) {     // If it is NOT a session-cookie, we need to refresh it.
00191           if (!$this->dontSetCookie)   SetCookie($this->name, $id, time()+$this->lifetime, '/');
00192         }
00193 
00194          // Check to see if anyone has submitted login-information and if so register the user with the session. $this->user[uid] may be used to write log...
00195       if ($this->formfield_status)  {
00196          $this->check_authentication();
00197       }
00198       unset($this->user);           // Make certain that NO user is set initially. ->check_authentication may have set a session-record which will provide us with a user record in the next section:
00199 
00200 
00201          // The session_id is used to find user in the database. Two tables are joined: The session-table with user_id of the session and the usertable with its primary key
00202       $dbres = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
00203                   '*',
00204                   $this->session_table.','.$this->user_table,
00205                   $this->session_table.'.ses_id = "'.$GLOBALS['TYPO3_DB']->quoteStr($this->id, $this->session_table).'"
00206                      AND '.$this->session_table.'.ses_name = "'.$GLOBALS['TYPO3_DB']->quoteStr($this->name, $this->session_table).'"
00207                      AND '.$this->session_table.'.ses_userid = '.$this->user_table.'.'.$this->userid_column.'
00208                      '.$this->ipLockClause().'
00209                      '.$this->hashLockClause().'
00210                      '.$this->user_where_clause()
00211                );
00212 
00213       if ($this->user = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($dbres))  {
00214             // A user was found
00215          if (is_string($this->auth_timeout_field)) {
00216             $timeout = intval($this->user[$this->auth_timeout_field]);     // Get timeout-time from usertable
00217          } else {
00218             $timeout = intval($this->auth_timeout_field);               // Get timeout from object
00219          }
00220             // If timeout > 0 (true) and currenttime has not exceeded the latest sessions-time plus the timeout in seconds then accept user
00221             // Option later on: We could check that last update was at least x seconds ago in order not to update twice in a row if one script redirects to another...
00222          if ($timeout>0 && ($GLOBALS['EXEC_TIME'] < ($this->user['ses_tstamp']+$timeout)))   {
00223                $GLOBALS['TYPO3_DB']->exec_UPDATEquery(
00224                                  $this->session_table,
00225                                  'ses_id="'.$GLOBALS['TYPO3_DB']->quoteStr($this->id, $this->session_table).'"
00226                                     AND ses_name="'.$GLOBALS['TYPO3_DB']->quoteStr($this->name, $this->session_table).'"',
00227                                  array('ses_tstamp' => $GLOBALS['EXEC_TIME'])
00228                               );
00229                $this->user['ses_tstamp'] = $GLOBALS['EXEC_TIME']; // Make sure that the timestamp is also updated in the array
00230          } else {
00231             $this->user = '';
00232             $this->logoff();     // delete any user set...
00233          }
00234       } else {
00235          $this->logoff();     // delete any user set...
00236       }
00237 
00238       $this->redirect();      // If any redirection (inclusion of file) then it will happen in this function
00239 
00240          // Set all posible headers that could ensure that the script is not cached on the client-side
00241       if ($this->sendNoCacheHeaders)   {
00242          header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
00243          header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
00244          header('Expires: 0');
00245          header('Cache-Control: no-cache, must-revalidate');
00246          header('Pragma: no-cache');
00247       }
00248 
00249          // If we're lucky we'll get to clean up old sessions....
00250       if ((rand()%100) <= $this->gc_probability) {
00251          $this->gc();
00252       }
00253    }

t3lib_userAuth::unpack_uc theUC = ''  ) 
 

Sets $theUC as the internal variable ->uc IF $theUC is an array.

If $theUC is false, the 'uc' content from the ->user array will be unserialized and restored in ->uc

Parameters:
mixed If an array, then set as ->uc, otherwise load from user record
Returns:
void

Definition at line 576 of file class.t3lib_userauth.php.

Referenced by t3lib_beUserAuth::backendSetUC().

00576                                  {
00577       if (!$theUC)   $theUC=unserialize($this->user['uc']);
00578       if (is_array($theUC))   {
00579          $this->uc=$theUC;
00580       }
00581    }

t3lib_userAuth::user_where_clause  ) 
 

This returns the where-clause needed to select the user with respect flags like deleted, hidden, starttime, endtime.

Returns:
string private

Definition at line 455 of file class.t3lib_userauth.php.

00455                                  {
00456       return  (($this->enablecolumns['rootLevel']) ? 'AND '.$this->user_table.'.pid=0 ' : '').
00457             (($this->enablecolumns['disabled']) ? ' AND NOT '.$this->user_table.'.'.$this->enablecolumns['disabled'] : '').
00458             (($this->enablecolumns['deleted']) ? ' AND NOT '.$this->user_table.'.'.$this->enablecolumns['deleted'] : '').
00459             (($this->enablecolumns['starttime']) ? ' AND ('.$this->user_table.'.'.$this->enablecolumns['starttime'].'<='.time().')' : '').
00460             (($this->enablecolumns['endtime']) ? ' AND ('.$this->user_table.'.'.$this->enablecolumns['endtime'].'=0 OR '.$this->user_table.'.'.$this->enablecolumns['endtime'].'>'.time().')' : '');
00461    }

t3lib_userAuth::writelog type,
action,
error,
details_nr,
details,
data,
tablename,
recuid,
recpid
 

DUMMY: Writes to log database table (in some extension classes).

Parameters:
integer $type: denotes which module that has submitted the entry. This is the current list: 1=tce_db; 2=tce_file; 3=system (eg. sys_history save); 4=modules; 254=Personal settings changed; 255=login / out action: 1=login, 2=logout, 3=failed login (+ errorcode 3), 4=failure_warning_email sent
integer 
action
denotes which specific operation that wrote the entry (eg. 'delete', 'upload', 'update' and so on...). Specific for each
type. Also used to trigger update of the interface. (see the log-module for the meaning of each number !!)
integer $error: flag. 0 = message, 1 = error (user problem), 2 = System Error (which should not happen), 3 = security notice (admin)
integer 
details_nr
The message number. Specific for each
type and $action. in the future this will make it possible to translate errormessages to other languages
string $details: Default text that follows the message
array $data: Data that follows the log. Might be used to carry special information. If an array the first 5 entries (0-4) will be sprintf'ed the details-text...
string 
tablename
Special field used by tce_main.php. These (
tablename, $recuid, $recpid) holds the reference to the record which the log-entry is about. (Was used in attic status.php to update the interface.)
integer 
recuid
Special field used by tce_main.php. These (
tablename, $recuid, $recpid) holds the reference to the record which the log-entry is about. (Was used in attic status.php to update the interface.)
integer 
recpid
Special field used by tce_main.php. These (
tablename, $recuid, $recpid) holds the reference to the record which the log-entry is about. (Was used in attic status.php to update the interface.)
Returns:
void
See also:
t3lib_userauthgroup::writelog()

Definition at line 558 of file class.t3lib_userauth.php.

Referenced by check_authentication().

00558                                                                                                    {
00559    }

t3lib_userAuth::writeUC variable = ''  ) 
 

This writes $variable to the user-record.

This is a way of providing session-data. You can fetch the data again through $this->uc in this class! If $variable is not an array, $this->uc is saved!

Parameters:
array An array you want to store for the user as session data. If $variable is not supplied (is blank string), the internal variable, ->uc, is stored by default
Returns:
void

Definition at line 535 of file class.t3lib_userauth.php.

Referenced by t3lib_beUserAuth::backendSetUC(), and pushModuleData().

00535                                     {
00536       if (is_array($this->user) && $this->user['uid'])   {
00537          if (!is_array($variable)) { $variable = $this->uc; }
00538 
00539          $GLOBALS['TYPO3_DB']->exec_UPDATEquery($this->user_table, 'uid='.intval($this->user['uid']), array('uc' => serialize($variable)));
00540       }
00541    }


Member Data Documentation

t3lib_userAuth::$auth_include = ''
 

Reimplemented in tslib_feUserAuth, and t3lib_beUserAuth.

Definition at line 115 of file class.t3lib_userauth.php.

t3lib_userAuth::$auth_timeout_field = 0
 

Reimplemented in tslib_feUserAuth, and t3lib_beUserAuth.

Definition at line 117 of file class.t3lib_userauth.php.

t3lib_userAuth::$checkPid = 1
 

Definition at line 133 of file class.t3lib_userauth.php.

t3lib_userAuth::$checkPid_value = 0
 

Definition at line 134 of file class.t3lib_userauth.php.

t3lib_userAuth::$cookieId
 

Definition at line 138 of file class.t3lib_userauth.php.

t3lib_userAuth::$dontSetCookie = 0
 

Definition at line 145 of file class.t3lib_userauth.php.

t3lib_userAuth::$enablecolumns
 

Initial value:

 Array (
      'rootLevel' => '',         // Boolean: If true, 'AND pid=0' will be a part of the query...
      'disabled' => '',
      'starttime' => '',
      'endtime' => '',
      'deleted' => ''
   )

Reimplemented in tslib_feUserAuth, and t3lib_beUserAuth.

Definition at line 101 of file class.t3lib_userauth.php.

t3lib_userAuth::$forceSetCookie = 0
 

Definition at line 144 of file class.t3lib_userauth.php.

t3lib_userAuth::$formfield_chalvalue = ''
 

Reimplemented in tslib_feUserAuth, and t3lib_beUserAuth.

Definition at line 111 of file class.t3lib_userauth.php.

t3lib_userAuth::$formfield_status = ''
 

Reimplemented in tslib_feUserAuth, and t3lib_beUserAuth.

Definition at line 112 of file class.t3lib_userauth.php.

t3lib_userAuth::$formfield_uident = ''
 

Reimplemented in tslib_feUserAuth, and t3lib_beUserAuth.

Definition at line 110 of file class.t3lib_userauth.php.

t3lib_userAuth::$formfield_uname = ''
 

Reimplemented in tslib_feUserAuth, and t3lib_beUserAuth.

Definition at line 109 of file class.t3lib_userauth.php.

t3lib_userAuth::$gc_probability = 1
 

Definition at line 120 of file class.t3lib_userauth.php.

t3lib_userAuth::$gc_time = 24
 

Definition at line 119 of file class.t3lib_userauth.php.

t3lib_userAuth::$get_name = ''
 

Reimplemented in tslib_feUserAuth.

Definition at line 93 of file class.t3lib_userauth.php.

t3lib_userAuth::$get_URL_ID = ''
 

Definition at line 142 of file class.t3lib_userauth.php.

t3lib_userAuth::$getFallBack = 0
 

Reimplemented in tslib_feUserAuth.

Definition at line 124 of file class.t3lib_userauth.php.

t3lib_userAuth::$getMethodEnabled = 0
 

Reimplemented in tslib_feUserAuth.

Definition at line 126 of file class.t3lib_userauth.php.

t3lib_userAuth::$global_database = ''
 

Definition at line 90 of file class.t3lib_userauth.php.

t3lib_userAuth::$hash_length = 32
 

Reimplemented in tslib_feUserAuth.

Definition at line 125 of file class.t3lib_userauth.php.

t3lib_userAuth::$id
 

Definition at line 137 of file class.t3lib_userauth.php.

Referenced by start().

t3lib_userAuth::$lastLogin_column = ''
 

Reimplemented in tslib_feUserAuth, and t3lib_beUserAuth.

Definition at line 99 of file class.t3lib_userauth.php.

t3lib_userAuth::$lifetime = 0
 

Reimplemented in tslib_feUserAuth, and t3lib_beUserAuth.

Definition at line 118 of file class.t3lib_userauth.php.

t3lib_userAuth::$lockHashKeyWords = 'useragent'
 

Definition at line 128 of file class.t3lib_userauth.php.

t3lib_userAuth::$lockIP = 4
 

Definition at line 127 of file class.t3lib_userauth.php.

t3lib_userAuth::$loginSessionStarted = 0
 

Definition at line 139 of file class.t3lib_userauth.php.

t3lib_userAuth::$name = ''
 

Reimplemented in tslib_feUserAuth, and t3lib_beUserAuth.

Definition at line 92 of file class.t3lib_userauth.php.

t3lib_userAuth::$security_level = ''
 

Reimplemented in tslib_feUserAuth, and t3lib_beUserAuth.

Definition at line 113 of file class.t3lib_userauth.php.

t3lib_userAuth::$sendNoCacheHeaders = 1
 

Reimplemented in tslib_feUserAuth.

Definition at line 123 of file class.t3lib_userauth.php.

t3lib_userAuth::$session_table = ''
 

Reimplemented in tslib_feUserAuth, and t3lib_beUserAuth.

Definition at line 91 of file class.t3lib_userauth.php.

t3lib_userAuth::$user
 

Definition at line 141 of file class.t3lib_userauth.php.

t3lib_userAuth::$user_table = ''
 

Reimplemented in tslib_feUserAuth, and t3lib_beUserAuth.

Definition at line 95 of file class.t3lib_userauth.php.

t3lib_userAuth::$userid_column = ''
 

Reimplemented in tslib_feUserAuth, and t3lib_beUserAuth.

Definition at line 98 of file class.t3lib_userauth.php.

t3lib_userAuth::$userident_column = ''
 

Reimplemented in tslib_feUserAuth, and t3lib_beUserAuth.

Definition at line 97 of file class.t3lib_userauth.php.

t3lib_userAuth::$username_column = ''
 

Reimplemented in tslib_feUserAuth, and t3lib_beUserAuth.

Definition at line 96 of file class.t3lib_userauth.php.

t3lib_userAuth::$warningEmail = ''
 

Definition at line 130 of file class.t3lib_userauth.php.

t3lib_userAuth::$warningMax = 3
 

Definition at line 132 of file class.t3lib_userauth.php.

t3lib_userAuth::$warningPeriod = 3600
 

Definition at line 131 of file class.t3lib_userauth.php.

t3lib_userAuth::$writeAttemptLog = 0
 

Reimplemented in t3lib_beUserAuth.

Definition at line 122 of file class.t3lib_userauth.php.

t3lib_userAuth::$writeStdLog = 0
 

Reimplemented in t3lib_beUserAuth.

Definition at line 121 of file class.t3lib_userauth.php.


The documentation for this class was generated from the following file:
Generated on Sun Oct 3 01:07:31 2004 for TYPO3core 3.7.0 dev by  doxygen 1.3.8-20040913