Index: t3lib/class.t3lib_svbase.php
===================================================================
--- t3lib/class.t3lib_svbase.php	(revision 8742)
+++ t3lib/class.t3lib_svbase.php	(revision )
@@ -1,29 +1,29 @@
 <?php
 /***************************************************************
-*  Copyright notice
-*
-*  (c) 1999-2010 Kasper Skårhøj (kasperYYYY@typo3.com)
-*  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!
-***************************************************************/
+ *  Copyright notice
+ *
+ *  (c) 1999-2010 Kasper Skårhøj (kasperYYYY@typo3.com)
+ *  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!
+ ***************************************************************/
 /**
  * Parent class for "Services" classes
  *
@@ -39,49 +39,49 @@
  *
  *  125: class t3lib_svbase
  *
- *              SECTION: Get service meta information
+ *			  SECTION: Get service meta information
- *  191:     function getServiceInfo()
+ *  191:	 function getServiceInfo()
- *  201:     function getServiceKey()
+ *  201:	 function getServiceKey()
- *  211:     function getServiceTitle()
+ *  211:	 function getServiceTitle()
- *  224:     function getServiceOption($optionName, $defaultValue='', $includeDefaultConfig=TRUE)
+ *  224:	 function getServiceOption($optionName, $defaultValue='', $includeDefaultConfig=TRUE)
  *
- *              SECTION: Error handling
+ *			  SECTION: Error handling
- *  259:     function devLog($msg, $severity=0, $dataVar=FALSE)
+ *  259:	 function devLog($msg, $severity=0, $dataVar=FALSE)
- *  273:     function errorPush($errNum=T3_ERR_SV_GENERAL, $errMsg='Unspecified error occured')
+ *  273:	 function errorPush($errNum=T3_ERR_SV_GENERAL, $errMsg='Unspecified error occured')
- *  288:     function errorPull()
+ *  288:	 function errorPull()
- *  300:     function getLastError()
+ *  300:	 function getLastError()
- *  315:     function getLastErrorMsg()
+ *  315:	 function getLastErrorMsg()
- *  330:     function getErrorMsgArray()
+ *  330:	 function getErrorMsgArray()
- *  348:     function getLastErrorArray()
+ *  348:	 function getLastErrorArray()
- *  357:     function resetErrors()
+ *  357:	 function resetErrors()
  *
- *              SECTION: General service functions
+ *			  SECTION: General service functions
- *  377:     function checkExec($progList)
+ *  377:	 function checkExec($progList)
- *  401:     function deactivateService()
+ *  401:	 function deactivateService()
  *
- *              SECTION: IO tools
+ *			  SECTION: IO tools
- *  427:     function checkInputFile ($absFile)
+ *  427:	 function checkInputFile ($absFile)
- *  448:     function readFile ($absFile, $length=0)
+ *  448:	 function readFile ($absFile, $length=0)
- *  473:     function writeFile ($content, $absFile='')
+ *  473:	 function writeFile ($content, $absFile='')
- *  499:     function tempFile ($filePrefix)
+ *  499:	 function tempFile ($filePrefix)
- *  517:     function registerTempFile ($absFile)
+ *  517:	 function registerTempFile ($absFile)
- *  527:     function unlinkTempFiles ()
+ *  527:	 function unlinkTempFiles ()
  *
- *              SECTION: IO input
+ *			  SECTION: IO input
- *  549:     function setInput ($content, $type='')
+ *  549:	 function setInput ($content, $type='')
- *  563:     function setInputFile ($absFile, $type='')
+ *  563:	 function setInputFile ($absFile, $type='')
- *  576:     function getInput ()
+ *  576:	 function getInput ()
- *  591:     function getInputFile ($createFile='')
+ *  591:	 function getInputFile ($createFile='')
  *
- *              SECTION: IO output
+ *			  SECTION: IO output
- *  616:     function setOutputFile ($absFile)
+ *  616:	 function setOutputFile ($absFile)
- *  626:     function getOutput ()
+ *  626:	 function getOutput ()
- *  640:     function getOutputFile ($absFile='')
+ *  640:	 function getOutputFile ($absFile='')
  *
- *              SECTION: Service implementation
+ *			  SECTION: Service implementation
- *  664:     function init()
+ *  664:	 function init()
- *  688:     function reset()
+ *  688:	 function reset()
- *  703:     function __destruct()
+ *  703:	 function __destruct()
  *
  * TOTAL FUNCTIONS: 30
  * (This index is automatically created/updated by the extension "extdeveval")
@@ -89,9 +89,6 @@
  */
 
 
-
-
-
 define ('T3_ERR_SV_GENERAL', -1); // General error - something went wrong
 define ('T3_ERR_SV_NOT_AVAIL', -2); // During execution it showed that the service is not available and should be ignored. The service itself should call $this->setNonAvailable()
 define ('T3_ERR_SV_WRONG_SUBTYPE', -3); // passed subtype is not possible with this service
@@ -108,12 +105,6 @@
 // define ('T3_ERR_SV_serviceType_myerr, -100); // All errors with prefix T3_ERR_SV_[serviceType]_ and lower than -99 are service type dependent error
 
 
-
-
-
-
-
-
 /**
  * Parent class for "Services" classes
  *
@@ -126,17 +117,17 @@
 	/**
 	 * service description array
 	 */
-	var $info=array();
+	var $info = array();
 
 	/**
 	 * error stack
 	 */
-	var $error=array();
+	var $error = array();
 
 	/**
 	 * Defines if debug messages should be written with t3lib_div::devLog
 	 */
-	var $writeDevLog = false;
+	var $writeDevLog = FALSE;
 
 
 	/**
@@ -174,7 +165,6 @@
 	var $tempFiles = array();
 
 
-
 	/***************************************
 	 *
 	 *	 Get service meta information
@@ -220,24 +210,23 @@
 	 * @param	[type]		$includeDefaultConfig: ...
 	 * @return	mixed		configuration value for the service
 	 */
-	function getServiceOption($optionName, $defaultValue='', $includeDefaultConfig=TRUE) {
+	function getServiceOption($optionName, $defaultValue = '', $includeDefaultConfig = TRUE) {
 		$config = NULL;
 
 		$svOptions = $GLOBALS['TYPO3_CONF_VARS']['SVCONF'][$this->info['serviceType']];
 
-		if(isset($svOptions[$this->info['serviceKey']][$optionName])) {
+		if (isset($svOptions[$this->info['serviceKey']][$optionName])) {
 			$config = $svOptions[$this->info['serviceKey']][$optionName];
-		} elseif($includeDefaultConfig AND isset($svOptions['default'][$optionName])) {
+		} elseif ($includeDefaultConfig && isset($svOptions['default'][$optionName])) {
 			$config = $svOptions['default'][$optionName];
 		}
-		if(!isset($config)) {
+		if (!isset($config)) {
 			$config = $defaultValue;
 		}
 		return $config;
 	}
 
 
-
 	/***************************************
 	 *
 	 *	 Error handling
@@ -253,8 +242,8 @@
 	 * @param	array		Additional data you want to pass to the logger.
 	 * @return	void
 	 */
-	function devLog($msg, $severity=0, $dataVar=FALSE) {
+	function devLog($msg, $severity = 0, $dataVar = FALSE) {
-		if($this->writeDevLog) {
+		if ($this->writeDevLog) {
 			t3lib_div::devLog($msg, $this->info['serviceKey'], $severity, $dataVar);
 		}
 	}
@@ -267,11 +256,11 @@
 	 * @param	string		error number (see T3_ERR_SV_* constants)
 	 * @return	void
 	 */
-	function errorPush($errNum=T3_ERR_SV_GENERAL, $errMsg='Unspecified error occured') {
+	function errorPush($errNum = T3_ERR_SV_GENERAL, $errMsg = 'Unspecified error occured') {
-		array_push($this->error, array('nr'=>$errNum, 'msg'=>$errMsg));
+		array_push($this->error, array('nr' => $errNum, 'msg' => $errMsg));
 
 		if (is_object($GLOBALS['TT'])) {
-			$GLOBALS['TT']->setTSlogMessage($errMsg,2);
+			$GLOBALS['TT']->setTSlogMessage($errMsg, 2);
 		}
 
 	}
@@ -295,7 +284,7 @@
 	 * @return	string		error number
 	 */
 	function getLastError() {
-		if(count($this->error)) {
+		if (count($this->error)) {
 			$error = end($this->error);
 			return $error['nr'];
 		} else {
@@ -310,7 +299,7 @@
 	 * @return	string		error message
 	 */
 	function getLastErrorMsg() {
-		if(count($this->error)) {
+		if (count($this->error)) {
 			$error = end($this->error);
 			return $error['msg'];
 		} else {
@@ -327,9 +316,9 @@
 	function getErrorMsgArray() {
 		$errArr = array();
 
-		if(count($this->error)) {
+		if (count($this->error)) {
 			reset($this->error);
-			foreach($this->error as $error) {
+			foreach ($this->error as $error) {
 				$errArr[] = $error['msg'];
 			}
 		}
@@ -352,11 +341,10 @@
 	 * @return	void
 	 */
 	function resetErrors() {
-		$this->error=array();
+		$this->error = array();
 	}
 
 
-
 	/***************************************
 	 *
 	 *	 General service functions
@@ -364,7 +352,6 @@
 	 ***************************************/
 
 
-
 	/**
 	 * check the availability of external programs
 	 *
@@ -375,10 +362,10 @@
 		$ret = TRUE;
 
 		$progList = t3lib_div::trimExplode(',', $progList, 1);
-		foreach($progList as $prog) {
+		foreach ($progList as $prog) {
 			if (!t3lib_exec::checkCommand($prog)) {
 					// program not found
-				$this->errorPush('External program not found: '.$prog, T3_ERR_SV_PROG_NOT_FOUND);
+				$this->errorPush('External program not found: ' . $prog, T3_ERR_SV_PROG_NOT_FOUND);
 				$ret = FALSE;
 			}
 		}
@@ -396,13 +383,6 @@
 	}
 
 
-
-
-
-
-
-
-
 	/***************************************
 	 *
 	 *	 IO tools
@@ -410,22 +390,21 @@
 	 ***************************************/
 
 
-
 	/**
 	 * Check if a file exists and is readable.
 	 *
 	 * @param	string		File name with absolute path.
 	 * @return	string		File name or FALSE.
 	 */
-	function checkInputFile ($absFile)	{
+	function checkInputFile($absFile) {
-		if(t3lib_div::isAllowedAbsPath($absFile) && @is_file($absFile)) {
+		if (t3lib_div::isAllowedAbsPath($absFile) && @is_file($absFile)) {
-			if(@is_readable($absFile)) {
+			if (@is_readable($absFile)) {
 				return $absFile;
 			} else {
-				$this->errorPush(T3_ERR_SV_FILE_READ, 'File is not readable: '.$absFile);
+				$this->errorPush(T3_ERR_SV_FILE_READ, 'File is not readable: ' . $absFile);
 			}
 		} else {
-			$this->errorPush(T3_ERR_SV_FILE_NOT_FOUND, 'File not found: '.$absFile);
+			$this->errorPush(T3_ERR_SV_FILE_NOT_FOUND, 'File not found: ' . $absFile);
 		}
 		return FALSE;
 	}
@@ -438,13 +417,13 @@
 	 * @param	integer		Maximum length to read. If empty the whole file will be read.
 	 * @return	string		$content or FALSE
 	 */
-	function readFile ($absFile, $length=0)	{
+	function readFile($absFile, $length = 0) {
 		$out = FALSE;
 
 		if ($this->checkInputFile($absFile)) {
 			$out = file_get_contents($absFile);
-			if ($out===FALSE)	{
+			if ($out === FALSE) {
-				$this->errorPush(T3_ERR_SV_FILE_READ, 'Can not read from file: '.$absFile);
+				$this->errorPush(T3_ERR_SV_FILE_READ, 'Can not read from file: ' . $absFile);
 			}
 		}
 		return $out;
@@ -458,19 +437,19 @@
 	 * @param	string		File name to write into. If empty a temp file will be created.
 	 * @return	string		File name or FALSE
 	 */
-	function writeFile ($content, $absFile='')	{
+	function writeFile($content, $absFile = '') {
 		$ret = TRUE;
 
 		if (!$absFile) {
 			$absFile = $this->tempFile($this->prefixId);
 		}
 
-		if($absFile && t3lib_div::isAllowedAbsPath($absFile)) {
+		if ($absFile && t3lib_div::isAllowedAbsPath($absFile)) {
-			if ($fd = @fopen($absFile,'wb')) {
+			if ($fd = @fopen($absFile, 'wb')) {
 				@fwrite($fd, $content);
 				@fclose($fd);
 			} else {
-				$this->errorPush(T3_ERR_SV_FILE_WRITE, 'Can not write to file: '.$absFile);
+				$this->errorPush(T3_ERR_SV_FILE_WRITE, 'Can not write to file: ' . $absFile);
 				$absFile = FALSE;
 			}
 		}
@@ -484,11 +463,11 @@
 	 * @param	string		File prefix.
 	 * @return	string		File name or FALSE
 	 */
-	function tempFile ($filePrefix)	{
+	function tempFile($filePrefix) {
 		$absFile = t3lib_div::tempnam($filePrefix);
-		if($absFile) {
+		if ($absFile) {
 			$ret = TRUE;
-			$this->registerTempFile ($absFile);
+			$this->registerTempFile($absFile);
 		} else {
 			$ret = FALSE;
 			$this->errorPush(T3_ERR_SV_FILE_WRITE, 'Can not create temp file.');
@@ -502,7 +481,7 @@
 	 * @param	string		File name with absolute path.
 	 * @return	void
 	 */
-	function registerTempFile ($absFile)	{
+	function registerTempFile($absFile) {
 		$this->tempFiles[] = $absFile;
 	}
 
@@ -512,7 +491,7 @@
 	 * @param	string		File name with absolute path.
 	 * @return	void
 	 */
-	function unlinkTempFiles ()	{
+	function unlinkTempFiles() {
 		foreach ($this->tempFiles as $absFile) {
 			t3lib_div::unlink_tempfile($absFile);
 		}
@@ -534,7 +513,7 @@
 	 * @param	string		The type of the input content (or file). Might be the same as the service subtypes.
 	 * @return	void
 	 */
-	function setInput ($content, $type='') {
+	function setInput($content, $type = '') {
 		$this->inputContent = $content;
 		$this->inputFile = '';
 		$this->inputType = $type;
@@ -548,7 +527,7 @@
 	 * @param	string		The type of the input content (or file). Might be the same as the service subtypes.
 	 * @return	void
 	 */
-	function setInputFile ($absFile, $type='') {
+	function setInputFile($absFile, $type = '') {
 		$this->inputContent = '';
 		$this->inputFile = $absFile;
 		$this->inputType = $type;
@@ -561,8 +540,8 @@
 	 *
 	 * @return	mixed
 	 */
-	function getInput () {
+	function getInput() {
-		if ($this->inputContent=='') {
+		if ($this->inputContent == '') {
 			$this->inputContent = $this->readFile($this->inputFile);
 		}
 		return $this->inputContent;
@@ -576,8 +555,8 @@
 	 * @param	string		File name. If empty a temp file will be created.
 	 * @return	string		File name or FALSE if no input or file error.
 	 */
-	function getInputFile ($createFile='') {
+	function getInputFile($createFile = '') {
-		if($this->inputFile) {
+		if ($this->inputFile) {
 			$this->inputFile = $this->checkInputFile($this->inputFile);
 		} elseif ($this->inputContent) {
 			$this->inputFile = $this->writeFile($this->inputContent, $createFile);
@@ -586,8 +565,6 @@
 	}
 
 
-
-
 	/***************************************
 	 *
 	 *	 IO output
@@ -601,7 +578,7 @@
 	 * @param	string		file name
 	 * @return	void
 	 */
-	function setOutputFile ($absFile) {
+	function setOutputFile($absFile) {
 		$this->outputFile = $absFile;
 	}
 
@@ -611,7 +588,7 @@
 	 *
 	 * @return	mixed
 	 */
-	function getOutput () {
+	function getOutput() {
 		if ($this->outputFile) {
 			$this->out = $this->readFile($this->outputFile);
 		}
@@ -625,7 +602,7 @@
 	 * @param	string		Absolute filename to write to
 	 * @return	mixed
 	 */
-	function getOutputFile ($absFile='') {
+	function getOutputFile($absFile = '') {
 		if (!$this->outputFile) {
 			$this->outputFile = $this->writeFile($this->out, $absFile);
 		}
@@ -633,8 +610,6 @@
 	}
 
 
-
-
 	/***************************************
 	 *
 	 *	 Service implementation
@@ -649,10 +624,10 @@
 	 *
 	 * @return	boolean		TRUE if the service is available
 	 */
-	function init()	{
+	function init() {
-		// do not work :-(  but will not hurt
+			// do not work :-(  but will not hurt
 		register_shutdown_function(array(&$this, '__destruct'));
-		// look in makeInstanceService()
+			// look in makeInstanceService()
 
 		$this->reset();
 
@@ -663,7 +638,7 @@
 			}
 		}
 
-		return ($this->getLastError() === true);
+		return ($this->getLastError() === TRUE);
 	}
 
 
@@ -673,7 +648,7 @@
 	 *
 	 * @return	void
 	 */
-	function reset()	{
+	function reset() {
 		$this->unlinkTempFiles();
 		$this->resetErrors();
 		$this->out = '';
@@ -701,10 +676,10 @@
 }
 
 /**
- // Does not make sense, because this class is always extended by the service classes..
+// Does not make sense, because this class is always extended by the service classes..
 if (defined("TYPO3_MODE") && $TYPO3_CONF_VARS[TYPO3_MODE]["XCLASS"]["t3lib/class.t3lib_svbase.php"])	{
-	include_once($TYPO3_CONF_VARS[TYPO3_MODE]["XCLASS"]["t3lib/class.t3lib_svbase.php"]);
+include_once($TYPO3_CONF_VARS[TYPO3_MODE]["XCLASS"]["t3lib/class.t3lib_svbase.php"]);
 }
-*/
+ */
 
 ?>
\ No newline at end of file
