TYPO3 CMS  TYPO3_7-6
Evaluator.php
Go to the documentation of this file.
1 <?php
3 
4 /*
5  * This file is part of the TYPO3 CMS project.
6  *
7  * It is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU General Public License, either version 2
9  * of the License, or any later version.
10  *
11  * For the full copyright and license information, please read the
12  * LICENSE.txt file that was distributed with this source code.
13  *
14  * The TYPO3 project - inspiring people to share!
15  */
16 
21 class Evaluator
22 {
30  protected $mode = null;
31 
38  public function returnFieldJS()
39  {
40  return 'return value;';
41  }
42 
51  public function evaluateFieldValue($value, $is_in, &$set)
52  {
54  if ($isEnabled) {
55  $isMD5 = preg_match('/[0-9abcdef]{32,32}/', $value);
56  $hashingMethod = substr($value, 0, 2);
57  $isDeprecatedSaltedHash = ($hashingMethod === 'C$' || $hashingMethod === 'M$');
59  $objInstanceSaltedPW = \TYPO3\CMS\Saltedpasswords\Salt\SaltFactory::getSaltingInstance(null, $this->mode);
60  if ($isMD5) {
61  $set = true;
62  $value = 'M' . $objInstanceSaltedPW->getHashedPassword($value);
63  } else {
64  // Determine method used for the (possibly) salted hashed password
65  $tempValue = $isDeprecatedSaltedHash ? substr($value, 1) : $value;
66  $tempObjInstanceSaltedPW = \TYPO3\CMS\Saltedpasswords\Salt\SaltFactory::getSaltingInstance($tempValue);
67  if (!is_object($tempObjInstanceSaltedPW)) {
68  $set = true;
69  $value = $objInstanceSaltedPW->getHashedPassword($value);
70  }
71  }
72  }
73  return $value;
74  }
75 }
static getSaltingInstance($saltedHash='', $mode=TYPO3_MODE)
Definition: SaltFactory.php:82