Bug #16588 » 4272_03.diff
t3lib/utility/class.t3lib_utility_phpoptions.php (revision 0) | ||
---|---|---|
<?php
|
||
/***************************************************************
|
||
* Copyright notice
|
||
*
|
||
* (c) 2010 Christian Kuhn <lolli@schwarzbu.ch>
|
||
* 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 <lolli@schwarzbu.ch>
|
||
* @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);
|
||
}
|
||
}
|
||
?>
|
t3lib/class.t3lib_htmlmail.php (working copy) | ||
---|---|---|
$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,
|
t3lib/core_autoload.php (working copy) | ||
---|---|---|
'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',
|
typo3/sysext/indexed_search/class.external_parser.php (working copy) | ||
---|---|---|
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:
|
||
... | ... | |
// 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);
|
||
... | ... | |
// 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);
|
||
... | ... | |
// 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);
|
||
... | ... | |
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);
|
||
... | ... | |
// 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);
|
typo3/sysext/install/mod/class.tx_install.php (working copy) | ||
---|---|---|
}
|
||
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']) {
|
||
... | ... | |
// *****************
|
||
// Safe mode related
|
||
// *****************
|
||
if (ini_get('safe_mode')) {
|
||
if (t3lib_utility_PHPOptions::isSafeModeEnabled()) {
|
||
$this->message($ext, 'Safe mode turned on', '
|
||
<p>
|
||
<em>safe_mode=' . ini_get('safe_mode') . '</em>
|
||
... | ... | |
} 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', '
|
||
<p>
|
||
<em>sql.safe_mode=' . ini_get('sql.safe_mode') . '</em>
|
typo3/sysext/rtehtmlarea/pi1/class.tx_rtehtmlarea_pi1.php (working copy) | ||
---|---|---|
$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)) {
|