[TASK] Use autoloader in rsaauth system extension
[Packages/TYPO3.CMS.git] / typo3 / sysext / rsaauth / hooks / class.tx_rsaauth_backendwarnings.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 2009-2011 Dmitry Dulepov <dmitry@typo3.org>
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
26 /**
27 * This class contains a hook to the backend warnings collection. It checks
28 * RSA configuration and create a warning if the configuration is wrong.
29 *
30 * @author Dmitry Dulepov <dmitry@typo3.org>
31 * @package TYPO3
32 * @subpackage tx_rsaauth
33 */
34
35 class tx_rsaauth_backendwarnings {
36
37 /**
38 * Checks RSA configuration and creates warnings if necessary.
39 *
40 * @param array $warnings Warnings
41 * @return void
42 * @see t3lib_BEfunc::displayWarningMessages()
43 */
44 public function displayWarningMessages_postProcess(array &$warnings) {
45 $backend = tx_rsaauth_backendfactory::getBackend();
46 if ($backend instanceof tx_rsaauth_cmdline_backend) {
47
48 // Not using the PHP extension!
49 $warnings['rsaauth_cmdline'] = $GLOBALS['LANG']->sL('LLL:EXT:rsaauth/hooks/locallang.xml:hook_using_cmdline');
50
51 // Check the path
52 $extconf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['rsaauth']);
53 $path = trim($extconf['temporaryDirectory']);
54 if ($path == '') {
55 // Path is empty
56 $warnings['rsaauth'] = $GLOBALS['LANG']->sL('LLL:EXT:rsaauth/hooks/locallang.xml:hook_empty_directory');
57 }
58 elseif (!t3lib_div::isAbsPath($path)) {
59 // Path is not absolute
60 $warnings['rsaauth'] = $GLOBALS['LANG']->sL('LLL:EXT:rsaauth/hooks/locallang.xml:hook_directory_not_absolute');
61 }
62 elseif (!@is_dir($path)) {
63 // Path does not represent a directory
64 $warnings['rsaauth'] = $GLOBALS['LANG']->sL('LLL:EXT:rsaauth/hooks/locallang.xml:hook_directory_not_exist');
65 }
66 elseif (!@is_writable($path)) {
67 // Directory is not writable
68 $warnings['rsaauth'] = $GLOBALS['LANG']->sL('LLL:EXT:rsaauth/hooks/locallang.xml:hook_directory_not_writable');
69 }
70 elseif (substr($path, 0, strlen(PATH_site)) == PATH_site) {
71 // Directory is inside the site root
72 $warnings['rsaauth'] = $GLOBALS['LANG']->sL('LLL:EXT:rsaauth/hooks/locallang.xml:hook_directory_inside_siteroot');
73 }
74 }
75 }
76
77 }
78
79 if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/rsaauth/hooks/class.tx_rsaauth_backendwarnings.php'])) {
80 include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/rsaauth/hooks/class.tx_rsaauth_backendwarnings.php']);
81 }
82
83 ?>