TYPO3 CMS  TYPO3_6-2
SplitStorage.php
Go to the documentation of this file.
1 <?php
3 
23 
28  public function __construct() {
29  if (session_id() === '') {
30  session_start();
31  }
32  }
33 
40  public function get() {
41  $result = NULL;
42  list($keyId, $keyPart1) = $_SESSION['tx_rsaauth_key'];
43  if (\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($keyId)) {
44  // Remove expired keys (more than 30 minutes old)
45  $GLOBALS['TYPO3_DB']->exec_DELETEquery('tx_rsaauth_keys', 'crdate<' . ($GLOBALS['EXEC_TIME'] - 30 * 60));
46  // Get our value
47  $row = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow('key_value', 'tx_rsaauth_keys', 'uid=' . $keyId);
48  if (is_array($row)) {
49  $result = $keyPart1 . $row['key_value'];
50  }
51  }
52  return $result;
53  }
54 
62  public function put($key) {
63  if ($key == NULL) {
64  // Remove existing key
65  list($keyId) = $_SESSION['tx_rsaauth_key'];
66  if (\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($keyId)) {
67  $GLOBALS['TYPO3_DB']->exec_DELETEquery('tx_rsaauth_keys', 'uid=' . $keyId);
68  unset($_SESSION['tx_rsaauth_key']);
69  }
70  } else {
71  // Add key
72  // Get split point. First part is always smaller than the second
73  // because it goes to the file system
74  $keyLength = strlen($key);
75  $splitPoint = rand((int)($keyLength / 10), (int)($keyLength / 2));
76  // Get key parts
77  $keyPart1 = substr($key, 0, $splitPoint);
78  $keyPart2 = substr($key, $splitPoint);
79  // Store part of the key in the database
80  //
81  // Notice: we may not use TCEmain below to insert key part into the
82  // table because TCEmain requires a valid BE user!
83  $time = $GLOBALS['EXEC_TIME'];
84  $GLOBALS['TYPO3_DB']->exec_INSERTquery('tx_rsaauth_keys', array(
85  'pid' => 0,
86  'crdate' => $time,
87  'key_value' => $keyPart2
88  ));
89  $keyId = $GLOBALS['TYPO3_DB']->sql_insert_id();
90  // Store another part in session
91  $_SESSION['tx_rsaauth_key'] = array($keyId, $keyPart1);
92  }
93  // Remove expired keys (more than 30 minutes old)
94  $GLOBALS['TYPO3_DB']->exec_DELETEquery('tx_rsaauth_keys', 'crdate<' . ($GLOBALS['EXEC_TIME'] - 30 * 60));
95  }
96 
97 }
if($list_of_literals) if(!empty($literals)) if(!empty($literals)) $result
Analyse literals to prepend the N char to them if their contents aren&#39;t numeric.
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]