TYPO3 API  SVNRelease
class.tx_rsaauth_backendwarnings.php
Go to the documentation of this file.
00001 <?php
00002 /***************************************************************
00003 *  Copyright notice
00004 *
00005 *  (c) 2009-2011 Dmitry Dulepov <dmitry@typo3.org>
00006 *  All rights reserved
00007 *
00008 *  This script is part of the TYPO3 project. The TYPO3 project is
00009 *  free software; you can redistribute it and/or modify
00010 *  it under the terms of the GNU General Public License as published by
00011 *  the Free Software Foundation; either version 2 of the License, or
00012 *  (at your option) any later version.
00013 *
00014 *  The GNU General Public License can be found at
00015 *  http://www.gnu.org/copyleft/gpl.html.
00016 *
00017 *  This script is distributed in the hope that it will be useful,
00018 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00019 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020 *  GNU General Public License for more details.
00021 *
00022 *  This copyright notice MUST APPEAR in all copies of the script!
00023 ***************************************************************/
00024 
00025 /**
00026  * [CLASS/FUNCTION INDEX of SCRIPT]
00027  *
00028  * $Id: class.tx_rsaauth_backendwarnings.php 10120 2011-01-18 20:03:36Z ohader $
00029  */
00030 
00031 require_once(t3lib_extMgm::extPath('rsaauth', 'sv1/backends/class.tx_rsaauth_backendfactory.php'));
00032 
00033 /**
00034  * This class contains a hook to the backend warnings collection. It checks
00035  * RSA configuration and create a warning if the configuration is wrong.
00036  *
00037  * @author  Dmitry Dulepov <dmitry@typo3.org>
00038  * @package TYPO3
00039  * @subpackage  tx_rsaauth
00040  */
00041 
00042 class tx_rsaauth_backendwarnings {
00043 
00044     /**
00045      * Checks RSA configuration and creates warnings if necessary.
00046      *
00047      * @param   array   $warnings   Warnings
00048      * @return  void
00049      * @see t3lib_BEfunc::displayWarningMessages()
00050      */
00051     public function displayWarningMessages_postProcess(array &$warnings) {
00052         $backend = tx_rsaauth_backendfactory::getBackend();
00053         if ($backend instanceof tx_rsaauth_cmdline_backend) {
00054 
00055             // Not using the PHP extension!
00056             $warnings['rsaauth_cmdline'] = $GLOBALS['LANG']->sL('LLL:EXT:rsaauth/hooks/locallang.xml:hook_using_cmdline');
00057 
00058             // Check the path
00059             $extconf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['rsaauth']);
00060             $path = trim($extconf['temporaryDirectory']);
00061             if ($path == '') {
00062                 // Path is empty
00063                 $warnings['rsaauth'] = $GLOBALS['LANG']->sL('LLL:EXT:rsaauth/hooks/locallang.xml:hook_empty_directory');
00064             }
00065             elseif (!t3lib_div::isAbsPath($path)) {
00066                 // Path is not absolute
00067                 $warnings['rsaauth'] = $GLOBALS['LANG']->sL('LLL:EXT:rsaauth/hooks/locallang.xml:hook_directory_not_absolute');
00068             }
00069             elseif (!@is_dir($path)) {
00070                 // Path does not represent a directory
00071                 $warnings['rsaauth'] = $GLOBALS['LANG']->sL('LLL:EXT:rsaauth/hooks/locallang.xml:hook_directory_not_exist');
00072             }
00073             elseif (!@is_writable($path)) {
00074                 // Directory is not writable
00075                 $warnings['rsaauth'] = $GLOBALS['LANG']->sL('LLL:EXT:rsaauth/hooks/locallang.xml:hook_directory_not_writable');
00076             }
00077             elseif (substr($path, 0, strlen(PATH_site)) == PATH_site) {
00078                 // Directory is inside the site root
00079                 $warnings['rsaauth'] = $GLOBALS['LANG']->sL('LLL:EXT:rsaauth/hooks/locallang.xml:hook_directory_inside_siteroot');
00080             }
00081         }
00082     }
00083 
00084 }
00085 
00086 if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/rsaauth/hooks/class.tx_rsaauth_backendwarnings.php'])) {
00087     include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/rsaauth/hooks/class.tx_rsaauth_backendwarnings.php']);
00088 }
00089 
00090 ?>