Follow-up to #15045: Trailing newlines after php closing tag. (Thanks to Nikolas...
[Packages/TYPO3.CMS.git] / typo3 / sysext / openid / class.tx_openid_mod_setup.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 2009-2010 Steffen Gebert <steffen@steffen-gebert.de>
6 * All rights reserved
7 *
8 * This script is part of the TYPO3 project. The TYPO3 project is
9 * free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * The GNU General Public License can be found at
15 * http://www.gnu.org/copyleft/gpl.html.
16 *
17 * This script is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * This copyright notice MUST APPEAR in all copies of the script!
23 ***************************************************************/
24 /**
25 * [CLASS/FUNCTION INDEX of SCRIPT]
26 */
27
28 /**
29 * This class is the OpenID return script for the TYPO3 Backend (used in the user-settings module).
30 *
31 * $Id$
32 *
33 * @author Steffen Gebert <steffen@steffen-gebert.de>
34 */
35 class tx_openid_mod_setup {
36
37 /**
38 * Checks weather BE user has access to change its OpenID identifier
39 *
40 * @param array $config: Configuration of the field
41 * @return boolean Whether it is allowed to modify the given field
42 */
43 public function accessLevelCheck(array $config) {
44 $setupConfig = $GLOBALS['BE_USER']->getTSConfigProp('setup.fields');
45 if (isset($setupConfig['tx_openid_openid.']['disabled']) && $setupConfig['tx_openid_openid.']['disabled']) {
46 return FALSE;
47 }
48 return TRUE;
49 }
50
51 /**
52 * Render OpenID identifier field for user setup
53 *
54 * @param array $config: Configuration of the field
55 * @param SC_mod_user_setup_index $parent: The calling parent object
56 * @return string HTML input field to change the OpenId
57 */
58 public function renderOpenID(array $parameters, SC_mod_user_setup_index $parent) {
59 $openid = $GLOBALS['BE_USER']->user['tx_openid_openid'];
60 return '<input id="field_tx_openid_openid"' .
61 $GLOBALS['TBE_TEMPLATE']->formWidth(20) .
62 ' type="text" name="data[be_users][tx_openid_openid]"' .
63 ' value="' . htmlspecialchars($openid) . '" />';
64 }
65 }
66
67 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/openid/class.tx_openid_mod_setup.php']) {
68 include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/openid/class.tx_openid_mod_setup.php']);
69 }
70 ?>