‪TYPO3CMS  9.5
ExtensionManagerConfigurationUtility.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 
19 
26 {
30  protected ‪$extConf = [];
31 
35  public function ‪__construct()
36  {
37  trigger_error(self::class . ' is obsolete and will be removed in TYPO3 v10.0.', E_USER_DEPRECATED);
38  }
39 
43  private function ‪init()
44  {
45  $requestSetup = $this->‪processPostData((array)$_REQUEST['data']);
46  ‪$extConf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get('saltedpasswords');
47  $this->extConf['BE'] = array_merge((array)‪$extConf['BE'], (array)$requestSetup['BE']);
48  $this->extConf['FE'] = array_merge((array)‪$extConf['FE'], (array)$requestSetup['FE']);
49  $this->‪getLanguageService()->includeLLFile('EXT:saltedpasswords/Resources/Private/Language/locallang.xlf');
50  }
51 
59  protected function ‪buildHashMethodSelector(array $params, $disposal)
60  {
61  $this->‪init();
62  $propertyName = $params['propertyName'];
63  $unknownVariablePleaseRenameMe = '\'' . substr(md5($propertyName), 0, 10) . '\'';
64  $pField = '';
66  foreach ($registeredMethods as $class => $reference) {
67  $classInstance = GeneralUtility::makeInstance($reference);
68  if ($classInstance instanceof \‪TYPO3\CMS\Core\Crypto\PasswordHashing\‪PasswordHashInterface && $classInstance->‪isAvailable()) {
69  $sel = $this->extConf[$disposal]['saltedPWHashingMethod'] == $class ? ' selected="selected" ' : '';
70  $label = 'ext.saltedpasswords.title.' . strtolower(end(explode('\\', $class)));
71  $pField .= '<option value="' . htmlspecialchars($class) . '"' . $sel . '>' . ‪$GLOBALS['LANG']->getLL($label) . '</option>';
72  }
73  }
74  $pField = '<select class="form-control" id="' . $propertyName . '" name="' . $params['fieldName'] .
75  '" onChange="uFormUrl(' . $unknownVariablePleaseRenameMe . ')">' . $pField . '</select>';
76  return $pField;
77  }
78 
86  public function ‪buildHashMethodSelectorFE(array $params)
87  {
88  return $this->‪buildHashMethodSelector($params, 'FE');
89  }
90 
98  public function ‪buildHashMethodSelectorBE(array $params)
99  {
100  return $this->‪buildHashMethodSelector($params, 'BE');
101  }
102 
110  protected function ‪processPostData(array $postArray = [])
111  {
112  foreach ($postArray as $key => $value) {
113  // @todo Explain
114  $parts = explode('.', $key, 2);
115  if (count($parts) == 2) {
116  // @todo Explain
117  $value = $this->‪processPostData([$parts[1] => $value]);
118  $postArray[$parts[0] . '.'] = array_merge((array)$postArray[$parts[0] . '.'], $value);
119  } else {
120  // @todo Explain
121  $postArray[$parts[0]] = $value;
122  }
123  }
124  return $postArray;
125  }
126 
130  protected function ‪getLanguageService()
131  {
132  return ‪$GLOBALS['LANG'];
133  }
134 }
‪TYPO3\CMS\Core\Crypto\PasswordHashing\ExtensionManagerConfigurationUtility\processPostData
‪array processPostData(array $postArray=[])
Definition: ExtensionManagerConfigurationUtility.php:109
‪TYPO3\CMS\Core\Configuration\ExtensionConfiguration
Definition: ExtensionConfiguration.php:42
‪TYPO3\CMS\Core\Crypto\PasswordHashing\ExtensionManagerConfigurationUtility\getLanguageService
‪TYPO3 CMS Core Localization LanguageService getLanguageService()
Definition: ExtensionManagerConfigurationUtility.php:129
‪TYPO3\CMS\Core\Crypto\PasswordHashing
Definition: AbstractComposedSalt.php:3
‪TYPO3\CMS\Core\Crypto\PasswordHashing\ExtensionManagerConfigurationUtility\buildHashMethodSelectorBE
‪string buildHashMethodSelectorBE(array $params)
Definition: ExtensionManagerConfigurationUtility.php:97
‪TYPO3
‪TYPO3\CMS\Core\Crypto\PasswordHashing\ExtensionManagerConfigurationUtility\init
‪init()
Definition: ExtensionManagerConfigurationUtility.php:42
‪TYPO3\CMS\Core\Crypto\PasswordHashing\ExtensionManagerConfigurationUtility\__construct
‪__construct()
Definition: ExtensionManagerConfigurationUtility.php:34
‪TYPO3\CMS\Core\Crypto\PasswordHashing\ExtensionManagerConfigurationUtility\buildHashMethodSelectorFE
‪string buildHashMethodSelectorFE(array $params)
Definition: ExtensionManagerConfigurationUtility.php:85
‪TYPO3\CMS\Core\Crypto\PasswordHashing\ExtensionManagerConfigurationUtility
Definition: ExtensionManagerConfigurationUtility.php:26
‪TYPO3\CMS\Core\Crypto\PasswordHashing\ExtensionManagerConfigurationUtility\$extConf
‪array $extConf
Definition: ExtensionManagerConfigurationUtility.php:29
‪TYPO3\CMS\Core\Crypto\PasswordHashing\PasswordHashFactory\getRegisteredSaltedHashingMethods
‪static array getRegisteredSaltedHashingMethods()
Definition: PasswordHashFactory.php:145
‪TYPO3\CMS\Core\Crypto\PasswordHashing\ExtensionManagerConfigurationUtility\buildHashMethodSelector
‪string buildHashMethodSelector(array $params, $disposal)
Definition: ExtensionManagerConfigurationUtility.php:58
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:5
‪TYPO3\CMS\Core\Crypto\PasswordHashing\PasswordHashInterface\isAvailable
‪bool isAvailable()
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:45
‪TYPO3\CMS\Core\Crypto\PasswordHashing\PasswordHashInterface
Definition: PasswordHashInterface.php:23