From 58e0956fc0d8e00e813dbb9d593a4f4257019476 Mon Sep 17 00:00:00 2001 From: Steffen Kamper Date: Wed, 24 Nov 2010 22:22:16 +0000 Subject: [PATCH] Fixed bug #14050: CleanUp - CGL format of t3lib files - t3lib_formprotection_directory git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@9602 709f56b5-9817-0410-a4d7-c38de5d9e867 --- ChangeLog | 1 + .../class.t3lib_formprotection_abstract.php | 85 ++++++++++--------- ...b_formprotection_backendformprotection.php | 76 ++++++++--------- .../class.t3lib_formprotection_factory.php | 65 +++++++------- ...rmprotection_installtoolformprotection.php | 60 ++++++------- 5 files changed, 145 insertions(+), 142 deletions(-) diff --git a/ChangeLog b/ChangeLog index ef7643bc8686..966e10f114fc 100755 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,6 @@ 2010-11-24 Steffen Kamper + * Fixed bug #14050: CleanUp - CGL format of t3lib files - t3lib_formprotection_directory * Fixed bug #14050: CleanUp - CGL format of t3lib files - t3lib_extjs_directory * Fixed bug #14050: CleanUp - CGL format of t3lib files - t3lib_error_directory * Fixed bug #14050: CleanUp - CGL format of t3lib files - t3lib_db_directory diff --git a/t3lib/formprotection/class.t3lib_formprotection_abstract.php b/t3lib/formprotection/class.t3lib_formprotection_abstract.php index a7b92eb91b43..28014b04e3a7 100644 --- a/t3lib/formprotection/class.t3lib_formprotection_abstract.php +++ b/t3lib/formprotection/class.t3lib_formprotection_abstract.php @@ -1,26 +1,26 @@ -* 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. -* -* 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) 2010 Oliver Klee + * 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. + * + * 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 t3lib_formprotection_Abstract. @@ -94,16 +94,16 @@ abstract class t3lib_formprotection_Abstract { * Note: This function does not persist the tokens. * * @param string $formName - * the name of the form, for example a table name like "tt_content", - * or some other identifier like "install_tool_password", must not be - * empty + * the name of the form, for example a table name like "tt_content", + * or some other identifier like "install_tool_password", must not be + * empty * @param string $action - * the name of the action of the form, for example "new", "delete" or - * "edit", may also be empty + * the name of the action of the form, for example "new", "delete" or + * "edit", may also be empty * @param string $formInstanceName - * a string used to differentiate two instances of the same form, - * form example a record UID or a comma-separated list of UIDs, - * may also be empty + * a string used to differentiate two instances of the same form, + * form example a record UID or a comma-separated list of UIDs, + * may also be empty * * @return string the 32-character hex ID of the generated token */ @@ -142,20 +142,20 @@ abstract class t3lib_formprotection_Abstract { * FALSE the second time. * * @param string $tokenId - * a form token to check, may also be empty or utterly misformed + * a form token to check, may also be empty or utterly misformed * @param string $formName - * the name of the form to check, for example "tt_content", - * may also be empty or utterly misformed + * the name of the form to check, for example "tt_content", + * may also be empty or utterly misformed * @param string $action - * the action of the form to check, for example "edit", - * may also be empty or utterly misformed + * the action of the form to check, for example "edit", + * may also be empty or utterly misformed * @param string $formInstanceName - * the instance name of the form to check, for example "42" or "foo" - * or "31,42", may also be empty or utterly misformed + * the instance name of the form to check, for example "42" or "foo" + * or "31,42", may also be empty or utterly misformed * * @return boolean - * TRUE if $tokenId, $formName, $action and $formInstanceName match - * and the token has not been used yet, FALSE otherwise + * TRUE if $tokenId, $formName, $action and $formInstanceName match + * and the token has not been used yet, FALSE otherwise */ public function validateToken( $tokenId, $formName, $action = '', $formInstanceName = '' @@ -163,8 +163,8 @@ abstract class t3lib_formprotection_Abstract { if (isset($this->tokens[$tokenId])) { $token = $this->tokens[$tokenId]; $isValid = ($token['formName'] == $formName) - && ($token['action'] == $action) - && ($token['formInstanceName'] == $formInstanceName); + && ($token['action'] == $action) + && ($token['formInstanceName'] == $formInstanceName); $this->dropToken($tokenId); } else { $isValid = FALSE; @@ -192,7 +192,7 @@ abstract class t3lib_formprotection_Abstract { * Retrieves all saved tokens. * * @return array - * the saved tokens, will be empty if no tokens have been saved + * the saved tokens, will be empty if no tokens have been saved */ abstract protected function retrieveTokens(); @@ -212,7 +212,7 @@ abstract class t3lib_formprotection_Abstract { * Note: This function does not persist the tokens. * * @param string $tokenId - * the 32-character ID of an existing token, must not be empty + * the 32-character ID of an existing token, must not be empty * * @return void */ @@ -244,4 +244,5 @@ abstract class t3lib_formprotection_Abstract { } } } + ?> \ No newline at end of file diff --git a/t3lib/formprotection/class.t3lib_formprotection_backendformprotection.php b/t3lib/formprotection/class.t3lib_formprotection_backendformprotection.php index 046c53a75ff8..dc9507d3f01a 100644 --- a/t3lib/formprotection/class.t3lib_formprotection_backendformprotection.php +++ b/t3lib/formprotection/class.t3lib_formprotection_backendformprotection.php @@ -1,26 +1,26 @@ -* 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. -* -* 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) 2010 Oliver Klee + * 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. + * + * 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 t3lib_formprotection_BackendFormProtection. @@ -36,12 +36,12 @@ * *
  * $formToken = t3lib_formprotection_Factory::get(
- *     t3lib_formprotection_Factory::TYPE_BACK_END
+ *	 t3lib_formprotection_Factory::TYPE_BACK_END
  * )->generateToken(
- *     'BE user setup', 'edit'
+ *	 'BE user setup', 'edit'
  * );
  * $this->content .= '';
+ *	 $formToken . '" />';
  * 
* * The three parameters $formName, $action and $formInstanceName can be @@ -54,9 +54,9 @@ * *
  * $formToken = t3lib_formprotection_Factory::get(
- *     t3lib_formprotection_Factory::TYPE_BACK_END
+ *	 t3lib_formprotection_Factory::TYPE_BACK_END
  * )->getFormProtection()->generateToken(
- *    'tt_content', 'edit', $uid
+ *	'tt_content', 'edit', $uid
  * );
  * 
* @@ -65,7 +65,7 @@ * *
  * t3lib_formprotection_Factory::get(
- *     t3lib_formprotection_Factory::TYPE_BACK_END
+ *	 t3lib_formprotection_Factory::TYPE_BACK_END
  * )->persistTokens();
  * 
* @@ -79,16 +79,16 @@ * *
  * if ($dataHasBeenSubmitted && t3lib_formprotection_Factory::get(
- *         t3lib_formprotection_Factory::TYPE_BACK_END
- *     )->validateToken(
- *         (string) t3lib_div::_POST('formToken'),
- *         'BE user setup', 'edit
- *     )
+ *		 t3lib_formprotection_Factory::TYPE_BACK_END
+ *	 )->validateToken(
+ *		 (string) t3lib_div::_POST('formToken'),
+ *		 'BE user setup', 'edit
+ *	 )
  * ) {
- *     // processes the data
+ *	 // processes the data
  * } else {
- *     // no need to do anything here as the BE form protection will create a
- *     // flash message for an invalid token
+ *	 // no need to do anything here as the BE form protection will create a
+ *	 // flash message for an invalid token
  * }
  * 
* @@ -122,7 +122,7 @@ class t3lib_formprotection_BackendFormProtection extends t3lib_formprotection_Ab if (!isset($GLOBALS['BE_USER'])) { throw new t3lib_error_Exception( 'A back-end form protection may only be instantiated if there' . - ' is an active back-end session.', + ' is an active back-end session.', 1285067843 ); } @@ -136,7 +136,7 @@ class t3lib_formprotection_BackendFormProtection extends t3lib_formprotection_Ab * @return void */ protected function createValidationErrorMessage() { - $message = t3lib_div::makeInstance( + $message = t3lib_div::makeInstance( 't3lib_FlashMessage', $GLOBALS['LANG']->sL( 'LLL:EXT:lang/locallang_core.xml:error.formProtection.tokenInvalid' @@ -151,7 +151,7 @@ class t3lib_formprotection_BackendFormProtection extends t3lib_formprotection_Ab * Retrieves all saved tokens. * * @return array - * the saved tokens as, will be empty if no tokens have been saved + * the saved tokens as, will be empty if no tokens have been saved */ protected function retrieveTokens() { $tokens = $GLOBALS['BE_USER']->getSessionData('formTokens'); diff --git a/t3lib/formprotection/class.t3lib_formprotection_factory.php b/t3lib/formprotection/class.t3lib_formprotection_factory.php index a731c5ecd336..c9070da661c9 100644 --- a/t3lib/formprotection/class.t3lib_formprotection_factory.php +++ b/t3lib/formprotection/class.t3lib_formprotection_factory.php @@ -1,26 +1,26 @@ -* 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. -* -* 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) 2010 Oliver Klee + * 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. + * + * 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 t3lib_formprotection_Factory. @@ -34,7 +34,7 @@ * *
  * $formProtection = t3lib_formprotection_Factory::get(
- *     't3lib_formProtection_BackEnd'
+ *	 't3lib_formProtection_BackEnd'
  * );
  * 
* @@ -42,7 +42,7 @@ * *
  * $formProtection = t3lib_formprotection_Factory::get(
- *     'tx_install_formprotection'
+ *	 'tx_install_formprotection'
  * );
  * $formProtection->injectInstallTool($this);
  * 
@@ -66,7 +66,8 @@ final class t3lib_formprotection_Factory { /** * Private constructor to prevent instantiation. */ - private function __construct() {} + private function __construct() { + } /** * Gets a form protection instance for the requested class $className. @@ -75,8 +76,8 @@ final class t3lib_formprotection_Factory { * existing instance will be returned. * * @param string $className - * the name of the class for which to return an instance, must be - * "t3lib_formProtection_BackEnd" or "t3lib_formprotection_InstallToolFormProtection" + * the name of the class for which to return an instance, must be + * "t3lib_formProtection_BackEnd" or "t3lib_formprotection_InstallToolFormProtection" * * @return t3lib_formprotection_Abstract the requested instance */ @@ -85,7 +86,7 @@ final class t3lib_formprotection_Factory { if (!class_exists($className, TRUE)) { throw new InvalidArgumentException( '$className must be the name of an existing class, but ' . - 'actually was "' . $className . '".', + 'actually was "' . $className . '".', 1285352962 ); } @@ -94,8 +95,8 @@ final class t3lib_formprotection_Factory { if (!$instance instanceof t3lib_formprotection_Abstract) { throw new InvalidArgumentException( '$className must be a subclass of ' . - 't3lib_formprotection_Abstract, but actually was "' . - $className . '".', + 't3lib_formprotection_Abstract, but actually was "' . + $className . '".', 1285353026 ); } @@ -111,10 +112,10 @@ final class t3lib_formprotection_Factory { * Note: This function is intended for testing purposes only. * * @param string $className - * the name of the class for which to set an instance, must be - * "t3lib_formProtection_BackEnd" or "t3lib_formprotection_InstallToolFormProtection" + * the name of the class for which to set an instance, must be + * "t3lib_formProtection_BackEnd" or "t3lib_formprotection_InstallToolFormProtection" * @param t3lib_formprotection_Abstract $instance - * the instance to set + * the instance to set * * @return void */ diff --git a/t3lib/formprotection/class.t3lib_formprotection_installtoolformprotection.php b/t3lib/formprotection/class.t3lib_formprotection_installtoolformprotection.php index a5019a81c130..7d0772ef82dc 100644 --- a/t3lib/formprotection/class.t3lib_formprotection_installtoolformprotection.php +++ b/t3lib/formprotection/class.t3lib_formprotection_installtoolformprotection.php @@ -1,26 +1,26 @@ -* 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. -* -* 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) 2010 Oliver Klee + * 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. + * + * 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 t3lib_formprotection_InstallToolFormProtection. @@ -37,7 +37,7 @@ * *
  * $formToken = $this->formProtection->generateToken(
- *    'installToolPassword', 'change'
+ *	'installToolPassword', 'change'
  * );
  * // then puts the generated form token in a hidden field in the template
  * 
@@ -60,14 +60,14 @@ * *
  * if ($dataHasBeenSubmitted && $this->formProtection()->validateToken(
- *     (string) $_POST['formToken'],
- *     'installToolPassword',
- *     'change'
+ *	 (string) $_POST['formToken'],
+ *	 'installToolPassword',
+ *	 'change'
  * ) {
- *     // processes the data
+ *	 // processes the data
  * } else {
- *     // no need to do anything here as the install tool form protection will
- *     // create an error message for an invalid token
+ *	 // no need to do anything here as the install tool form protection will
+ *	 // create an error message for an invalid token
  * }
  * 
* @@ -131,7 +131,7 @@ class t3lib_formprotection_InstallToolFormProtection extends t3lib_formProtectio protected function createValidationErrorMessage() { $this->installTool->addErrorMessage( 'Validating the security token of this form has failed. ' . - 'Please reload the form and submit it again.' + 'Please reload the form and submit it again.' ); } @@ -139,7 +139,7 @@ class t3lib_formprotection_InstallToolFormProtection extends t3lib_formProtectio * Retrieves all saved tokens. * * @return array - * the saved tokens, will be empty if no tokens have been saved + * the saved tokens, will be empty if no tokens have been saved */ protected function retrieveTokens() { if (isset($_SESSION['installToolFormTokens']) -- 2.20.1