[TASK] Re-work/simplify copyright header in PHP files - Part 2
[Packages/TYPO3.CMS.git] / typo3 / sysext / openid / Classes / OpenidModuleSetup.php
1 <?php
2 namespace TYPO3\CMS\Openid;
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 use TYPO3\CMS\Backend\Utility\BackendUtility;
17 use TYPO3\CMS\Core\Utility\GeneralUtility;
18
19 /**
20 * This class is the OpenID return script for the TYPO3 Backend (used in the user-settings module).
21 *
22 * @author Steffen Gebert <steffen@steffen-gebert.de>
23 */
24 class OpenidModuleSetup {
25
26 /**
27 * Checks weather BE user has access to change its OpenID identifier
28 *
29 * @param array $config: Configuration of the field
30 * @return boolean Whether it is allowed to modify the given field
31 */
32 public function accessLevelCheck(array $config) {
33 $setupConfig = $GLOBALS['BE_USER']->getTSConfigProp('setup.fields');
34 if (isset($setupConfig['tx_openid_openid.']['disabled']) && $setupConfig['tx_openid_openid.']['disabled']) {
35 return FALSE;
36 }
37 return TRUE;
38 }
39
40 /**
41 * Render OpenID identifier field for user setup
42 *
43 * @param array $parameters Configuration of the field
44 * @param \TYPO3\CMS\Setup\Controller\SetupModuleController $parent: The calling parent object
45 * @return string HTML input field to change the OpenId
46 */
47 public function renderOpenID(array $parameters, \TYPO3\CMS\Setup\Controller\SetupModuleController $parent) {
48 $openid = $GLOBALS['BE_USER']->user['tx_openid_openid'];
49 $add = htmlspecialchars(
50 $GLOBALS['LANG']->sL('LLL:EXT:openid/Resources/Private/Language/Wizard.xlf:addopenid')
51 );
52
53 return '<input id="field_tx_openid_openid"' .
54 $GLOBALS['TBE_TEMPLATE']->formWidth(20) .
55 ' type="text" name="data[be_users][tx_openid_openid]"' .
56 ' value="' . htmlspecialchars($openid) . '" />' .
57 '&nbsp;&nbsp;<a href="#" onclick="' .
58 'vHWin=window.open(' . GeneralUtility::quoteJSvalue(BackendUtility::getModuleUrl('wizard_openid') . '&P[itemName]=data%5Bbe_users%5D%5Btx_openid_openid%5D') .
59 ',null,\'width=600,height=400,status=0,menubar=0,scrollbars=0\');' .
60 'vHWin.focus();return false;' .
61 '">' .
62 '<img src="../typo3/sysext/openid/ext_icon.gif" alt="' . $add . '" title="' . $add . '"/>' .
63 '</a>';
64 }
65
66 }