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