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