Index: t3lib/utility/class.t3lib_utility_phpoptions.php =================================================================== --- t3lib/utility/class.t3lib_utility_phpoptions.php (revision 0) +++ t3lib/utility/class.t3lib_utility_phpoptions.php (revision 0) @@ -0,0 +1,65 @@ + + * All rights reserved + * + * This script is part of the TYPO3 project. The TYPO3 project is + * free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * The GNU General Public License can be found at + * http://www.gnu.org/copyleft/gpl.html. + * A copy is found in the textfile GPL.txt and important notices to the license + * from the author is found in LICENSE.txt distributed with these scripts. + * + * + * This script is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This copyright notice MUST APPEAR in all copies of the script! + ***************************************************************/ + +/** + * Class to handle php environment specific options / functions + * + * $Id$ + * + * @author Christian Kuhn + * @package TYPO3 + * @subpackage t3lib + */ +final class t3lib_utility_PHPOptions { + /** + * Check if php safe_mode is enabled + * + * @return mixed TRUE if safe_mode is enabled, FALSE if disabled and NULL when an invalid value is used + */ + public static function isSafeModeEnabled() { + return self::getIniValueBoolean('safe_mode'); + } + + /** + * Check if php sql.safe_mode is enabled + * + * @return mixed TRUE if sql.safe_mode is enabled, FALSE if disabled and NULL when an invalid value is used + */ + public static function isSqlSafeModeEnabled() { + return self::getIniValueBoolean('sql.safe_mode'); + } + + /** + * Cast a on/off php ini value to boolean + * + * @return mixed TRUE if the given option is enabled, FALSE if disabled and NULL when invalid value is used + */ + public static function getIniValueBoolean($configOption) { + return filter_var(ini_get('safe_mode'), FILTER_VALIDATE_BOOLEAN, FILTER_REQUIRE_SCALAR | FILTER_NULL_ON_FAILURE); + } +} +?> Index: t3lib/class.t3lib_htmlmail.php =================================================================== --- t3lib/class.t3lib_htmlmail.php (revision 8941) +++ t3lib/class.t3lib_htmlmail.php (working copy) @@ -732,7 +732,7 @@ $recipient = t3lib_div::normalizeMailAddress($this->recipient); // If safe mode is on, the fifth parameter to mail is not allowed, so the fix wont work on unix with safe_mode=On - $returnPathPossible = (!ini_get('safe_mode') && $this->forceReturnPath); + $returnPathPossible = (!t3lib_utility_PHPOptions::isSafeModeEnabled() && $this->forceReturnPath); if ($returnPathPossible) { $mailWasSent = t3lib_utility_Mail::mail($recipient, $this->subject, Index: t3lib/core_autoload.php =================================================================== --- t3lib/core_autoload.php (revision 8941) +++ t3lib/core_autoload.php (working copy) @@ -133,6 +133,7 @@ 't3lib_utility_client' => PATH_t3lib . 'utility/class.t3lib_utility_client.php', 't3lib_utility_http' => PATH_t3lib . 'utility/class.t3lib_utility_http.php', 't3lib_utility_mail' => PATH_t3lib . 'utility/class.t3lib_utility_mail.php', + 't3lib_utility_phpoptions' => PATH_t3lib . 'utility/class.t3lib_utility_phpoptions.php', 't3lib_utility_debug' => PATH_t3lib . 'utility/class.t3lib_utility_debug.php', 't3lib_spritemanager' => PATH_t3lib . 'class.t3lib_spritemanager.php', 't3lib_spritemanager_spritegenerator' => PATH_t3lib . 'spritemanager/class.t3lib_spritemanager_spritegenerator.php', Index: typo3/sysext/indexed_search/class.external_parser.php =================================================================== --- typo3/sysext/indexed_search/class.external_parser.php (revision 8941) +++ typo3/sysext/indexed_search/class.external_parser.php (working copy) @@ -116,13 +116,15 @@ return FALSE; } + $safeModeEnabled = t3lib_utility_PHPOptions::isSafeModeEnabled(); + // Switch on file extension: switch($extension) { case 'pdf': // PDF if ($indexerConfig['pdftools']) { $pdfPath = rtrim($indexerConfig['pdftools'], '/').'/'; - if (ini_get('safe_mode') || (@is_file($pdfPath.'pdftotext'.$exe) && @is_file($pdfPath.'pdfinfo'.$exe))) { + if ($safeModeEnabled || (@is_file($pdfPath . 'pdftotext' . $exe) && @is_file($pdfPath . 'pdfinfo' . $exe))) { $this->app['pdfinfo'] = $pdfPath.'pdfinfo'.$exe; $this->app['pdftotext'] = $pdfPath.'pdftotext'.$exe; // PDF mode: @@ -135,7 +137,7 @@ // Catdoc if ($indexerConfig['catdoc']) { $catdocPath = rtrim($indexerConfig['catdoc'], '/').'/'; - if (ini_get('safe_mode') || @is_file($catdocPath.'catdoc'.$exe)) { + if ($safeModeEnabled || @is_file($catdocPath . 'catdoc' . $exe)) { $this->app['catdoc'] = $catdocPath.'catdoc'.$exe; $extOK = TRUE; } else $this->pObj->log_setTSlogMessage(sprintf($this->sL('LLL:EXT:indexed_search/locallang.xml:catdocNotFound'), $catdocPath), 3); @@ -146,7 +148,7 @@ // ppthtml if ($indexerConfig['ppthtml']) { $ppthtmlPath = rtrim($indexerConfig['ppthtml'], '/').'/'; - if (ini_get('safe_mode') || @is_file($ppthtmlPath.'ppthtml'.$exe)){ + if ($safeModeEnabled || @is_file($ppthtmlPath . 'ppthtml' . $exe)) { $this->app['ppthtml'] = $ppthtmlPath.'ppthtml'.$exe; $extOK = TRUE; } else $this->pObj->log_setTSlogMessage(sprintf($this->sL('LLL:EXT:indexed_search/locallang.xml:ppthtmlNotFound'), $ppthtmlPath), 3); @@ -156,7 +158,7 @@ // Xlhtml if ($indexerConfig['xlhtml']) { $xlhtmlPath = rtrim($indexerConfig['xlhtml'], '/').'/'; - if (ini_get('safe_mode') || @is_file($xlhtmlPath.'xlhtml'.$exe)){ + if ($safeModeEnabled || @is_file($xlhtmlPath . 'xlhtml' . $exe)) { $this->app['xlhtml'] = $xlhtmlPath.'xlhtml'.$exe; $extOK = TRUE; } else $this->pObj->log_setTSlogMessage(sprintf($this->sL('LLL:EXT:indexed_search/locallang.xml:xlhtmlNotFound'), $xlhtmlPath), 3); @@ -170,7 +172,7 @@ case 'odt': // Oasis OpenDocument Text if ($indexerConfig['unzip']) { $unzipPath = rtrim($indexerConfig['unzip'], '/').'/'; - if (ini_get('safe_mode') || @is_file($unzipPath.'unzip'.$exe)) { + if ($safeModeEnabled || @is_file($unzipPath . 'unzip' . $exe)) { $this->app['unzip'] = $unzipPath.'unzip'.$exe; $extOK = TRUE; } else $this->pObj->log_setTSlogMessage(sprintf($this->sL('LLL:EXT:indexed_search/locallang.xml:unzipNotFound'), $unzipPath), 3); @@ -180,7 +182,7 @@ // Catdoc if ($indexerConfig['unrtf']) { $unrtfPath = rtrim($indexerConfig['unrtf'], '/').'/'; - if (ini_get('safe_mode') || @is_file($unrtfPath.'unrtf'.$exe)) { + if ($safeModeEnabled || @is_file($unrtfPath . 'unrtf' . $exe)) { $this->app['unrtf'] = $unrtfPath.'unrtf'.$exe; $extOK = TRUE; } else $this->pObj->log_setTSlogMessage(sprintf($this->sL('LLL:EXT:indexed_search/locallang.xml:unrtfNotFound'), $unrtfPath), 3); Index: typo3/sysext/install/mod/class.tx_install.php =================================================================== --- typo3/sysext/install/mod/class.tx_install.php (revision 8941) +++ typo3/sysext/install/mod/class.tx_install.php (working copy) @@ -1281,7 +1281,7 @@ } asort($paths); - if (ini_get('safe_mode')) { + if (t3lib_utility_PHPOptions::isSafeModeEnabled()) { $paths=array(ini_get('safe_mode_exec_dir'),'/usr/local/php/bin/'); } if ($this->INSTALL['checkIM']['lzw']) { @@ -2411,7 +2411,7 @@ // ***************** // Safe mode related // ***************** - if (ini_get('safe_mode')) { + if (t3lib_utility_PHPOptions::isSafeModeEnabled()) { $this->message($ext, 'Safe mode turned on', '

safe_mode=' . ini_get('safe_mode') . ' @@ -2491,7 +2491,7 @@ } else { $this->message($ext, 'safe_mode: off',"",-1); } - if (ini_get('sql.safe_mode')) { + if (t3lib_utility_PHPOptions::isSqlSafeModeEnabled()) { $this->message($ext, 'sql.safe_mode is enabled', '

sql.safe_mode=' . ini_get('sql.safe_mode') . ' Index: typo3/sysext/rtehtmlarea/pi1/class.tx_rtehtmlarea_pi1.php =================================================================== --- typo3/sysext/rtehtmlarea/pi1/class.tx_rtehtmlarea_pi1.php (revision 8941) +++ typo3/sysext/rtehtmlarea/pi1/class.tx_rtehtmlarea_pi1.php (working copy) @@ -72,7 +72,7 @@ $this->pspell_is_available = in_array('pspell', get_loaded_extensions()); $this->AspellDirectory = trim($GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$this->extKey]['plugins']['SpellChecker']['AspellDirectory'])? trim($GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$this->extKey]['plugins']['SpellChecker']['AspellDirectory']) : '/usr/bin/aspell'; $this->forceCommandMode = (trim($GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$this->extKey]['plugins']['SpellChecker']['forceCommandMode']))? trim($GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$this->extKey]['plugins']['SpellChecker']['forceCommandMode']) : 0; - $safe_mode_is_enabled = ini_get('safe_mode'); + $safe_mode_is_enabled = t3lib_utility_PHPOptions::isSafeModeEnabled(); if($safe_mode_is_enabled && !$this->pspell_is_available ) echo('Configuration problem: Spell checking cannot be performed'); if($safe_mode_is_enabled && $this->forceCommandMode) echo('Configuration problem: Spell checking cannot be performed in command mode'); if(!$safe_mode_is_enabled && (!$this->pspell_is_available || $this->forceCommandMode)) {