Major cleanup of the code and the phpdoc comments.
authortmaroschik <tmaroschik@735d13b6-9817-0410-8766-e36946ffe9aa>
Mon, 30 Jan 2012 12:00:38 +0000 (12:00 +0000)
committertmaroschik <tmaroschik@735d13b6-9817-0410-8766-e36946ffe9aa>
Mon, 30 Jan 2012 12:00:38 +0000 (12:00 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Extensions/identity/trunk@56992 735d13b6-9817-0410-8766-e36946ffe9aa

24 files changed:
Classes/Compat/interface.t3lib_db_postprocessqueryhook.php [deleted file]
Classes/Compat/interface.t3lib_db_preprocessqueryhook.php [deleted file]
Classes/Configuration/Check.php
Classes/Configuration/IdentityProviderInterface.php
Classes/Hooks/class.tx_identity_em_hook.php
Classes/Hooks/class.tx_identity_t3lib_db_preprocess.php
Classes/Hooks/class.tx_identity_tcemain_hook.php
Classes/Install/Installer.php
Classes/Map.php
Classes/Provider/AbstractUuid.php
Classes/Provider/RecordUuid.php
Classes/Provider/StaticRecordUuid.php
Classes/ProviderInterface.php
Classes/Utility/Algorithms.php
Classes/Utility/ExtensionManager.php
Classes/Utility/FieldDefinitions.php
Classes/Xclass/class.ux_t3lib_db.php [deleted file]
Classes/Xclass/class.ux_t3lib_install.php [deleted file]
Classes/Xclass/class.ux_tx_install.php [deleted file]
class.ext_update.php
ext_autoload.php
ext_emconf.php
ext_localconf.php
ext_tables.php

diff --git a/Classes/Compat/interface.t3lib_db_postprocessqueryhook.php b/Classes/Compat/interface.t3lib_db_postprocessqueryhook.php
deleted file mode 100644 (file)
index 69e14fc..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-<?php
-/***************************************************************
- *  Copyright notice
- *
- *  (c) 2011 Xavier Perseguers <typo3@perseguers.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!
- ***************************************************************/
-
-
-/**
- * Interface for classes which hook into t3lib_DB and do additional processing
- * after a query has been executed.
- *
- * @author     Xavier Perseguers <typo3@perseguers.ch>
- * @package TYPO3
- * @subpackage t3lib
- */
-interface t3lib_DB_postProcessQueryHook {
-
-       /**
-        * Post-processor for the exec_INSERTquery method.
-        *
-        * @param string $table Database table name
-        * @param array $fieldsValues Field values as key => value pairs
-        * @param string/array $noQuoteFields List/array of keys NOT to quote
-        * @param t3lib_DB $parentObject
-        * @return void
-        */
-       public function exec_INSERTquery_postProcessAction(&$table, array &$fieldsValues, &$noQuoteFields, t3lib_DB $parentObject);
-
-       /**
-        * Post-processor for the exec_INSERTmultipleRows method.
-        *
-        * @param string $table Database table name
-        * @param array $fields Field names
-        * @param array $rows Table rows
-        * @param string/array $noQuoteFields List/array of keys NOT to quote
-        * @param t3lib_DB $parentObject
-        * @return void
-        */
-       public function exec_INSERTmultipleRows_postProcessAction(&$table, array &$fields, array &$rows, &$noQuoteFields, t3lib_DB $parentObject);
-
-       /**
-        * Post-processor for the exec_UPDATEquery method.
-        *
-        * @param string $table Database table name
-        * @param string $where WHERE clause
-        * @param array $fieldsValues Field values as key => value pairs
-        * @param string/array $noQuoteFields List/array of keys NOT to quote
-        * @param t3lib_DB $parentObject
-        * @return void
-        */
-       public function exec_UPDATEquery_postProcessAction(&$table, &$where, array &$fieldsValues, &$noQuoteFields, t3lib_DB $parentObject);
-
-       /**
-        * Post-processor for the exec_DELETEquery method.
-        *
-        * @param string $table Database table name
-        * @param string $where WHERE clause
-        * @param t3lib_DB $parentObject
-        * @return void
-        */
-       public function exec_DELETEquery_postProcessAction(&$table, &$where, t3lib_DB $parentObject);
-
-       /**
-        * Post-processor for the exec_TRUNCATEquery method.
-        *
-        * @param string $table Database table name
-        * @param t3lib_DB $parentObject
-        * @return void
-        */
-       public function exec_TRUNCATEquery_postProcessAction(&$table, t3lib_DB $parentObject);
-
-}
-
-?>
\ No newline at end of file
diff --git a/Classes/Compat/interface.t3lib_db_preprocessqueryhook.php b/Classes/Compat/interface.t3lib_db_preprocessqueryhook.php
deleted file mode 100644 (file)
index 09d74ea..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-<?php
-/***************************************************************
- *  Copyright notice
- *
- *  (c) 2011 Xavier Perseguers <typo3@perseguers.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!
- ***************************************************************/
-
-
-/**
- * Interface for classes which hook into t3lib_DB and do additional processing
- * before a query has been executed.
- *
- * @author     Xavier Perseguers <typo3@perseguers.ch>
- * @package TYPO3
- * @subpackage t3lib
- */
-interface t3lib_DB_preProcessQueryHook {
-
-       /**
-        * Pre-processor for the INSERTquery method.
-        *
-        * @param string $table Database table name
-        * @param array $fieldsValues Field values as key => value pairs
-        * @param string/array $noQuoteFields List/array of keys NOT to quote
-        * @param t3lib_DB $parentObject
-        * @return void
-        */
-       public function INSERTquery_preProcessAction(&$table, array &$fieldsValues, &$noQuoteFields, t3lib_DB $parentObject);
-
-       /**
-        * Pre-processor for the INSERTmultipleRows method.
-        *
-        * @param string $table Database table name
-        * @param array $fields Field names
-        * @param array $rows Table rows
-        * @param string/array $noQuoteFields List/array of keys NOT to quote
-        * @param t3lib_DB $parentObject
-        * @return void
-        */
-       public function INSERTmultipleRows_preProcessAction(&$table, array &$fields, array &$rows, &$noQuoteFields, t3lib_DB $parentObject);
-
-       /**
-        * Pre-processor for the UPDATEquery method.
-        *
-        * @param string $table Database table name
-        * @param string $where WHERE clause
-        * @param array $fieldsValues Field values as key => value pairs
-        * @param string/array $noQuoteFields List/array of keys NOT to quote
-        * @param t3lib_DB $parentObject
-        * @return void
-        */
-       public function UPDATEquery_preProcessAction(&$table, &$where, array &$fieldsValues, &$noQuoteFields, t3lib_DB $parentObject);
-
-       /**
-        * Pre-processor for the DELETEquery method.
-        *
-        * @param string $table Database table name
-        * @param string $where WHERE clause
-        * @param t3lib_DB $parentObject
-        * @return void
-        */
-       public function DELETEquery_preProcessAction(&$table, &$where, t3lib_DB $parentObject);
-
-       /**
-        * Pre-processor for the TRUNCATEquery method.
-        *
-        * @param string $table Database table name
-        * @param t3lib_DB $parentObject
-        * @return void
-        */
-       public function TRUNCATEquery_preProcessAction(&$table, t3lib_DB $parentObject);
-
-}
-
-?>
\ No newline at end of file
index c18e64b..9fe8859 100644 (file)
  *  This copyright notice MUST APPEAR in all copies of the script!
  ***************************************************************/
 
-
+/**
+ * A class that checks the configuration of the identity extension.
+ *
+ * @author Thomas Maroschik <tmaroschik@dfau.de>
+ *
+ * @package TYPO3
+ * @subpackage identity
+ */
 class Tx_Identity_Configuration_Check implements t3lib_Singleton {
 
        /**
@@ -37,9 +44,7 @@ class Tx_Identity_Configuration_Check implements t3lib_Singleton {
         * @throws InvalidArgumentException when there is an error in the table specific configuration
         */
        public function checkTableSpecificIdentityProviderConfiguration($table, $identityProvider) {
-
                $this->checkIdentityProviderConfiguration($identityProvider);
-
                if (!isset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['identity'][Tx_Identity_Configuration_IdentityProviderInterface::PROVIDERS_LIST][$identityProvider])) {
                        throw new InvalidArgumentException(
                                'The identity provider "' . $identityProvider .
@@ -67,11 +72,8 @@ class Tx_Identity_Configuration_Check implements t3lib_Singleton {
         * @throws InvalidArgumentException when there is an errer in the default configuration
         */
        public function checkDefaultIdentityProviderConfiguration($defaultProvider) {
-
                $this->checkIdentityProviderConfiguration($defaultProvider);
-
                if (!isset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['identity'][Tx_Identity_Configuration_IdentityProviderInterface::PROVIDERS_LIST][$defaultProvider])) {
-
                        throw new InvalidArgumentException(
                                'The default identity provider "' . $defaultProvider .
                                '" defined in $GLOBALS[\'TYPO3_CONF_VARS\'][\'EXTCONF\'][\'identity\'][Tx_Identity_Configuration_IdentityProviderInterface::DEFAULT_PROVIDER]' .
@@ -79,9 +81,7 @@ class Tx_Identity_Configuration_Check implements t3lib_Singleton {
                                '$GLOBALS[\'TYPO3_CONF_VARS\'][\'EXTCONF\'][\'identity\'][Tx_Identity_Configuration_IdentityProviderInterface::PROVIDERS_LIST]',
                                1300104323
                        );
-
                }
-
        }
 
        /**
@@ -91,19 +91,14 @@ class Tx_Identity_Configuration_Check implements t3lib_Singleton {
         * @throws InvalidArgumentException when there is an error in the provider configuration
         */
        public function checkIdentityProviderConfiguration($identityProvider) {
-
                if (!isset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['identity'][Tx_Identity_Configuration_IdentityProviderInterface::PROVIDERS_LIST][$identityProvider])) {
-
                        throw new InvalidArgumentException(
                                'The identity provider "' . $identityProvider .
                                '" is not defined in $GLOBALS[\'TYPO3_CONF_VARS\'][\'EXTCONF\'][\'identity\'][Tx_Identity_Configuration_IdentityProviderInterface::PROVIDERS_LIST][\'' . $table . '\']',
                                1300109077
                        );
-
                }
-
                if (!isset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['identity'][Tx_Identity_Configuration_IdentityProviderInterface::PROVIDERS_LIST][$identityProvider][Tx_Identity_Configuration_IdentityProviderInterface::IDENTITY_FIELD])) {
-
                        throw new InvalidArgumentException(
                                'The identity provider "' . $identityProvider .
                                '" defined in $GLOBALS[\'TYPO3_CONF_VARS\'][\'EXTCONF\'][\'identity\'][Tx_Identity_Configuration_IdentityProviderInterface::PROVIDERS_LIST][\'' . $table . '\']' .
@@ -112,11 +107,8 @@ class Tx_Identity_Configuration_Check implements t3lib_Singleton {
                                ,
                                1300110713
                        );
-
                }
-
                if (!isset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['identity'][Tx_Identity_Configuration_IdentityProviderInterface::PROVIDERS_LIST][$identityProvider][Tx_Identity_Configuration_IdentityProviderInterface::IDENTITY_FIELD_CREATE_CLAUSE])) {
-
                        throw new InvalidArgumentException(
                                'The identity provider "' . $identityProvider .
                                '" defined in $GLOBALS[\'TYPO3_CONF_VARS\'][\'EXTCONF\'][\'identity\'][Tx_Identity_Configuration_IdentityProviderInterface::PROVIDERS_LIST][\'' . $table . '\']' .
@@ -125,11 +117,8 @@ class Tx_Identity_Configuration_Check implements t3lib_Singleton {
                                ,
                                1300103750
                        );
-
                }
-
                if (!isset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['identity'][Tx_Identity_Configuration_IdentityProviderInterface::PROVIDERS_LIST][$identityProvider][Tx_Identity_Configuration_IdentityProviderInterface::PROVIDER_CLASS])) {
-
                        throw new InvalidArgumentException(
                                'The identity provider "' . $identityProvider .
                                '" defined in $GLOBALS[\'TYPO3_CONF_VARS\'][\'EXTCONF\'][\'identity\'][Tx_Identity_Configuration_IdentityProviderInterface::PROVIDERS_LIST][\'' . $table . '\']' .
@@ -138,16 +127,11 @@ class Tx_Identity_Configuration_Check implements t3lib_Singleton {
                                ,
                                1300109191
                        );
-
                }
-
        }
 
 }
 
-
 if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['EXT:identity/Class/Configuration/Check.php'])) {
        include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['EXT:identity/Class/Configuration/Check.php']);
-}
-
-?>
\ No newline at end of file
+}
\ No newline at end of file
index 7f6b946..aa445fb 100644 (file)
  *  This copyright notice MUST APPEAR in all copies of the script!
  ***************************************************************/
 
+/**
+ * An interface that supports the configuration of ext:identity by delivering some
+ * constants, that can be used in configuration arrays as keys.
+ *
+ * @author Thomas Maroschik <tmaroschik@dfau.de>
+ *
+ * @package TYPO3
+ * @subpackage identity
+ */
 interface Tx_Identity_Configuration_IdentityProviderInterface {
 
        const KEY                                                       = 'identityProvider';
@@ -34,6 +43,5 @@ interface Tx_Identity_Configuration_IdentityProviderInterface {
        const IDENTITY_FIELD                            = 'identityField';
        const IDENTITY_FIELD_CREATE_CLAUSE      = 'identityFieldCreateClause';
        const PROVIDER_CLASS                            = 'providerClass';
-}
 
-?>
\ No newline at end of file
+}
\ No newline at end of file
index 2b29f9e..b803cb0 100644 (file)
@@ -113,11 +113,9 @@ class tx_identity_em_hook implements tx_em_Index_CheckDatabaseUpdatesHook, Tx_In
                // Do nothing here as we don't need to
                return;
        }
-}
 
+}
 
 if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/identity/Classes/Hooks/class.tx_identity_em_hook.php'])) {
        include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/identity/Classes/Hooks/class.tx_identity_em_hook.php']);
-}
-
-?>
\ No newline at end of file
+}
\ No newline at end of file
index bfedafe..2b29e41 100644 (file)
@@ -1,5 +1,38 @@
 <?php
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2011 Thomas Maroschik <tmaroschik@dfau.de>
+ *  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!
+ ***************************************************************/
 
+/**
+ * Hooks for TYPO3 DB Preprocessing.
+ *
+ * @author Thomas Maroschik <tmaroschik@dfau.de>
+ *
+ * @package TYPO3
+ * @subpackage identity
+ */
 class tx_identity_t3lib_db_preprocess implements t3lib_DB_preProcessQueryHook {
 
        /**
@@ -90,5 +123,5 @@ class tx_identity_t3lib_db_preprocess implements t3lib_DB_preProcessQueryHook {
        public function TRUNCATEquery_preProcessAction(&$table, t3lib_DB $parentObject) {
                // Do nothing
        }
-}
-?>
\ No newline at end of file
+
+}
\ No newline at end of file
index 7f083e0..c13ff0f 100644 (file)
@@ -1,11 +1,44 @@
 <?php
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2011 Thomas Maroschik <tmaroschik@dfau.de>
+ *  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!
+ ***************************************************************/
 
+/**
+ * Hooks for TYPO3 TCEMain.
+ *
+ * @author Thomas Maroschik <tmaroschik@dfau.de>
+ *
+ * @package TYPO3
+ * @subpackage identity
+ */
 class tx_identity_tcemain_hook {
+
        public function processDatamap_afterAllOperations($parent) {
                /** @var $identityMap Tx_Identity_Map */
                $identityMap = t3lib_div::makeInstance('Tx_Identity_Map');
-//             $identityMap->rebuild();
                $identityMap->commit();
        }
-}
-?>
\ No newline at end of file
+
+}
\ No newline at end of file
index 6c2d8c0..c5b6f00 100644 (file)
  *
  *  This copyright notice MUST APPEAR in all copies of the script!
  ***************************************************************/
+
 /**
- *
  * This Class groups together useful methods stolen from the Installer
+ *
+ * @author Fabien Udriot <fabien.udriot@ecodev.ch>
+ *
+ * @package TYPO3
+ * @subpackage identity
  */
 class Tx_Identity_Install_Installer implements t3lib_Singleton {
 
@@ -45,7 +50,6 @@ class Tx_Identity_Install_Installer implements t3lib_Singleton {
         */
        protected $deletedPrefixKey = 'zzz_deleted_';
 
-
        /**
         * Returns an array where every entry is a single SQL-statement. Input must be formatted like an ordinary MySQL-dump files.
         *
@@ -56,19 +60,15 @@ class Tx_Identity_Install_Installer implements t3lib_Singleton {
         */
        function getStatementArray($sqlcode, $removeNonSQL = 0, $query_regex = '') {
                $sqlcodeArr = explode(LF, $sqlcode);
-
-                       // Based on the assumption that the sql-dump has
+               // Based on the assumption that the sql-dump has
                $statementArray = array();
                $statementArrayPointer = 0;
-
                foreach ($sqlcodeArr as $line => $lineContent) {
                        $is_set = 0;
-
                                // auto_increment fields cannot have a default value!
                        if (stristr($lineContent, 'auto_increment')) {
                                $lineContent = preg_replace('/ default \'0\'/i', '', $lineContent);
                        }
-
                        if (!$removeNonSQL || (strcmp(trim($lineContent), '') && substr(trim($lineContent), 0, 1) != '#' && substr(trim($lineContent), 0, 2) != '--')) { // '--' is seen as mysqldump comments from server version 3.23.49
                                $statementArray[$statementArrayPointer] .= $lineContent;
                                $is_set = 1;
@@ -80,12 +80,10 @@ class Tx_Identity_Install_Installer implements t3lib_Singleton {
                                        }
                                }
                                $statementArrayPointer++;
-
                        } elseif ($is_set) {
                                $statementArray[$statementArrayPointer] .= LF;
                        }
                }
-
                return $statementArray;
        }
 
@@ -106,12 +104,10 @@ class Tx_Identity_Install_Installer implements t3lib_Singleton {
                $lines = t3lib_div::trimExplode(LF, $fileContent, 1);
                $table = '';
                $total = array();
-
                foreach ($lines as $value) {
                        if (substr($value, 0, 1) === '#') {
                                continue; // Ignore comments
                        }
-
                        if (!strlen($table)) {
                                $parts = t3lib_div::trimExplode(' ', $value, TRUE);
                                if (strtoupper($parts[0]) === 'CREATE' && strtoupper($parts[1]) === 'TABLE') {
@@ -126,8 +122,7 @@ class Tx_Identity_Install_Installer implements t3lib_Singleton {
                                        if (preg_match('/(ENGINE|TYPE)[ ]*=[ ]*([a-zA-Z]*)/', $value, $ttype)) {
                                                $total[$table]['extra']['ENGINE'] = $ttype[2];
                                        } // Otherwise, just do nothing: If table engine is not defined, just accept the system default.
-
-                                               // Set the collation, if specified
+                                       // Set the collation, if specified
                                        if (preg_match('/(COLLATE)[ ]*=[ ]*([a-zA-z0-9_-]+)/', $value, $tcollation)) {
                                                $total[$table]['extra']['COLLATE'] = $tcollation[2];
                                        } else {
@@ -144,10 +139,8 @@ class Tx_Identity_Install_Installer implements t3lib_Singleton {
                                        $lineV = preg_replace('/,$/', '', $value); // Strip trailing commas
                                        $lineV = str_replace('`', '', $lineV);
                                        $lineV = str_replace('  ', ' ', $lineV); // Remove double blanks
-
                                        $parts = explode(' ', $lineV, 2);
                                        if (!preg_match('/(PRIMARY|UNIQUE|FULLTEXT|INDEX|KEY)/', $parts[0])) { // Field definition
-
                                                        // Make sure there is no default value when auto_increment is set
                                                if (stristr($parts[1], 'auto_increment')) {
                                                        $parts[1] = preg_replace('/ default \'0\'/i', '', $parts[1]);
@@ -156,28 +149,21 @@ class Tx_Identity_Install_Installer implements t3lib_Singleton {
                                                if (stristr($parts[1], ' DEFAULT ')) {
                                                        $parts[1] = str_ireplace(' DEFAULT ', ' default ', $parts[1]);
                                                }
-
                                                        // Change order of "default" and "null" statements
                                                $parts[1] = preg_replace('/(.*) (default .*) (NOT NULL)/', '$1 $3 $2', $parts[1]);
                                                $parts[1] = preg_replace('/(.*) (default .*) (NULL)/', '$1 $3 $2', $parts[1]);
-
                                                $key = $parts[0];
                                                $total[$table]['fields'][$key] = $parts[1];
-
                                        } else { // Key definition
                                                $search = array('/UNIQUE (INDEX|KEY)/', '/FULLTEXT (INDEX|KEY)/', '/INDEX/');
                                                $replace = array('UNIQUE', 'FULLTEXT', 'KEY');
                                                $lineV = preg_replace($search, $replace, $lineV);
-
                                                if (preg_match('/PRIMARY|UNIQUE|FULLTEXT/', $parts[0])) {
                                                        $parts[1] = preg_replace('/^(KEY|INDEX) /', '', $parts[1]);
                                                }
-
                                                $newParts = explode(' ', $parts[1], 2);
                                                $key = $parts[0] == 'PRIMARY' ? $parts[0] : $newParts[0];
-
                                                $total[$table]['keys'][$key] = $lineV;
-
                                                        // This is a protection against doing something stupid: Only allow clearing of cache_* and index_* tables.
                                                if (preg_match('/^(cache|index)_/', $table)) {
                                                                // Suggest to truncate (clear) this table
@@ -206,12 +192,10 @@ class Tx_Identity_Install_Installer implements t3lib_Singleton {
                                $this->character_sets[$charset] = array(); // Add empty element to avoid that the check will be repeated
                        }
                }
-
                $collation = '';
                if (isset($this->character_sets[$charset]['Default collation'])) {
                        $collation = $this->character_sets[$charset]['Default collation'];
                }
-
                return $collation;
        }
 
@@ -226,14 +210,11 @@ class Tx_Identity_Install_Installer implements t3lib_Singleton {
         * @see getFieldDefinitions_fileContent()
         */
        function getFieldDefinitions_sqlContent_parseTypes(array &$total) {
-
                if ($GLOBALS['TYPO3_CONF_VARS']['SYS']['multiplyDBfieldSize'] >= 1 && $GLOBALS['TYPO3_CONF_VARS']['SYS']['multiplyDBfieldSize'] <= 5) {
                        $this->multiplySize = (double) $GLOBALS['TYPO3_CONF_VARS']['SYS']['multiplyDBfieldSize'];
                }
-
                $mSize = (double) $this->multiplySize;
                if ($mSize > 1) {
-
                                // Init SQL parser:
                        $sqlParser = t3lib_div::makeInstance('t3lib_sqlparser');
                        foreach ($total as $table => $cfg) {
@@ -241,12 +222,10 @@ class Tx_Identity_Install_Installer implements t3lib_Singleton {
                                        foreach ($cfg['fields'] as $fN => $fType) {
                                                $orig_fType = $fType;
                                                $fInfo = $sqlParser->parseFieldDef($fType);
-
                                                switch ($fInfo['fieldType']) {
                                                        case 'char':
                                                        case 'varchar':
                                                                $newSize = round($fInfo['value'] * $mSize);
-
                                                                if ($newSize <= 255) {
                                                                        $fInfo['value'] = $newSize;
                                                                } else {
@@ -279,7 +258,6 @@ class Tx_Identity_Install_Installer implements t3lib_Singleton {
                                                                $fInfo['fieldType'] = 'text';
                                                        break;
                                                }
-
                                                $total[$table]['fields'][$fN] = $sqlParser->compileFieldCfg($fInfo);
                                                if ($sqlParser->parse_error) {
                                                        throw new RuntimeException(
@@ -302,22 +280,17 @@ class Tx_Identity_Install_Installer implements t3lib_Singleton {
                $total = array();
                $tempKeys = array();
                $tempKeysPrefix = array();
-
                $GLOBALS['TYPO3_DB']->sql_select_db(TYPO3_db);
                echo $GLOBALS['TYPO3_DB']->sql_error();
-
                $tables = $GLOBALS['TYPO3_DB']->admin_get_tables(TYPO3_db);
                foreach ($tables as $tableName => $tableStatus) {
-
-                               // Fields:
+                       // Fields:
                        $fieldInformation = $GLOBALS['TYPO3_DB']->admin_get_fields($tableName);
                        foreach ($fieldInformation as $fN => $fieldRow) {
                                $total[$tableName]['fields'][$fN] = $this->assembleFieldDefinition($fieldRow);
                        }
-
-                               // Keys:
+                       // Keys:
                        $keyInformation = $GLOBALS['TYPO3_DB']->admin_get_keys($tableName);
-
                        foreach ($keyInformation as $keyRow) {
                                $keyName = $keyRow['Key_name'];
                                $colName = $keyRow['Column_name'];
@@ -339,14 +312,12 @@ class Tx_Identity_Install_Installer implements t3lib_Singleton {
                                }
                                $tempKeysPrefix[$tableName][$keyName] = $prefix;
                        }
-
-                               // Table status (storage engine, collaction, etc.)
+                       // Table status (storage engine, collaction, etc.)
                        if (is_array($tableStatus)) {
                                $tableExtraFields = array(
                                        'Engine' => 'ENGINE',
                                        'Collation' => 'COLLATE',
                                );
-
                                foreach ($tableExtraFields as $mysqlKey => $internalKey) {
                                        if (isset($tableStatus[$mysqlKey])) {
                                                $total[$tableName]['extra'][$internalKey] = $tableStatus[$mysqlKey];
@@ -354,8 +325,7 @@ class Tx_Identity_Install_Installer implements t3lib_Singleton {
                                }
                        }
                }
-
-                       // Compile key information:
+               // Compile key information:
                if (count($tempKeys)) {
                        foreach ($tempKeys as $table => $keyInf) {
                                foreach ($keyInf as $kName => $index) {
@@ -364,7 +334,6 @@ class Tx_Identity_Install_Installer implements t3lib_Singleton {
                                }
                        }
                }
-
                return $total;
        }
 
@@ -376,7 +345,6 @@ class Tx_Identity_Install_Installer implements t3lib_Singleton {
         */
        function assembleFieldDefinition(array $row) {
                $field = array($row['Type']);
-
                if ($row['Null'] == 'NO') {
                        $field[] = 'NOT NULL';
                }
@@ -389,7 +357,6 @@ class Tx_Identity_Install_Installer implements t3lib_Singleton {
                if ($row['Extra']) {
                        $field[] = $row['Extra'];
                }
-
                return implode(' ', $field);
        }
 
@@ -407,7 +374,6 @@ class Tx_Identity_Install_Installer implements t3lib_Singleton {
        function getDatabaseExtra(array $FDsrc, array $FDcomp, $onlyTableList = '', $ignoreNotNullWhenComparing = TRUE) {
                $extraArr = array();
                $diffArr = array();
-
                if (is_array($FDsrc)) {
                        foreach ($FDsrc as $table => $info) {
                                if (!strlen($onlyTableList) || t3lib_div::inList($onlyTableList, $table)) {
@@ -444,13 +410,11 @@ class Tx_Identity_Install_Installer implements t3lib_Singleton {
                                }
                        }
                }
-
                $output = array(
                        'extra' => $extraArr,
                        'diff' => $diffArr,
                        'diff_currentValues' => $diffArr_cur
                );
-
                return $output;
        }
 
@@ -539,9 +503,7 @@ class Tx_Identity_Install_Installer implements t3lib_Singleton {
                                                $extras = array();
                                                $extras_currentValue = array();
                                                $clear_table = FALSE;
-
                                                foreach ($info['extra'] as $fN => $fV) {
-
                                                                // Only consider statements which are missing in the database but don't remove existing properties
                                                        if (!$remove) {
                                                                if (!$info['whole_table']) { // If the whole table is created at once, we take care of this later by imploding all elements of $info['extra']
@@ -608,11 +570,9 @@ class Tx_Identity_Install_Installer implements t3lib_Singleton {
         * @return array
         */
        public function filterByIdentityField(array $statements) {
-
                $identityConfiguration = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['identity'];
                $identityProviders = $identityConfiguration[Tx_Identity_Configuration_IdentityProviderInterface::PROVIDERS_LIST];
                $identityField = $identityProviders['recordUuid'][Tx_Identity_Configuration_IdentityProviderInterface::IDENTITY_FIELD];
-
                $result = array();
                foreach ($statements as $key => $statement) {
                        if (strpos($statement, 'ADD ' . $identityField . ' ') !== FALSE ||
@@ -620,13 +580,14 @@ class Tx_Identity_Install_Installer implements t3lib_Singleton {
                                $result[$key] = $statement;
                        }
                }
-
                return $result;
        }
 
 
        protected $templateFilePath = 'typo3/sysext/install/Resources/Private/Templates/';
+
        protected $dbUpdateCheckboxPrefix = 'TYPO3_INSTALL[database_update]'; // Prefix for checkbox fields when updating database.
+
        protected $backPath = '../'; // Backpath (used for icons etc.)
 
        /**
@@ -695,7 +656,6 @@ class Tx_Identity_Install_Installer implements t3lib_Singleton {
                                        'checked' => ($checked ? 'checked="checked"' : ''),
                                        'string' => htmlspecialchars($string)
                                );
-
                                if ($iconDis) {
                                        $iconMarkers['backPath'] = $this->backPath;
                                        if (preg_match('/^TRUNCATE/i', $string)) {
@@ -728,7 +688,6 @@ class Tx_Identity_Install_Installer implements t3lib_Singleton {
                                        '###ICONAVAILABLE###',
                                        $iconSubpart
                                );
-
                                if (isset($currentValue[$key])) {
                                                // Get the subpart for current
                                        $currentSubpart = t3lib_parsehtml::getSubpart($rowsSubpart, '###CURRENT###');
@@ -752,7 +711,6 @@ class Tx_Identity_Install_Installer implements t3lib_Singleton {
                                        '###CURRENT###',
                                        $currentSubpart
                                );
-
                                $errorSubpart = '';
                                if (isset($this->databaseUpdateErrorMessages[$key])) {
                                                // Get the subpart for current
@@ -776,7 +734,6 @@ class Tx_Identity_Install_Installer implements t3lib_Singleton {
                                        '###ERROR###',
                                        $errorSubpart
                                );
-
                                        // Fill the markers in the subpart
                                $rowsSubpart = t3lib_parsehtml::substituteMarkerArray(
                                        $rowsSubpart,
@@ -785,7 +742,6 @@ class Tx_Identity_Install_Installer implements t3lib_Singleton {
                                        TRUE,
                                        FALSE
                                );
-
                                $rows[] = $rowsSubpart;
                        }
                                // Substitute the subpart for rows
@@ -794,12 +750,10 @@ class Tx_Identity_Install_Installer implements t3lib_Singleton {
                                '###ROWS###',
                                implode(LF, $rows)
                        );
-
                        if (count($warnings)) {
                                        // Get the subpart for warnings
                                $warningsSubpart = t3lib_parsehtml::getSubpart($content, '###WARNINGS###');
                                $warningItems = array();
-
                                foreach ($warnings as $warning) {
                                                // Get the subpart for single warning items
                                        $warningItemSubpart = t3lib_parsehtml::getSubpart($warningsSubpart, '###WARNINGITEM###');
index 9c930dd..08d7277 100644 (file)
  *
  * This is the base of the identity extension.
  * @api
+ *
+ * @author Thomas Maroschik <tmaroschik@dfau.de>
+ *
+ * @package TYPO3
+ * @subpackage identity
  */
 class Tx_Identity_Map implements t3lib_Singleton {
 
@@ -69,18 +74,19 @@ class Tx_Identity_Map implements t3lib_Singleton {
         * Initialize all defined identity providers
         */
        protected function initializeIdentityProviders() {
+               /** @var $identityConfigurationCheck Tx_Identity_Configuration_Check */
                $identityConfigurationCheck = t3lib_div::makeInstance('Tx_Identity_Configuration_Check');
                $identityConfiguration = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['identity'];
                $identityProviders = $identityConfiguration[Tx_Identity_Configuration_IdentityProviderInterface::PROVIDERS_LIST];
-
                foreach ($identityProviders as $identityProviderKey=>$identityProviderConfiguration) {
                        $identityConfigurationCheck->checkIdentityProviderConfiguration($identityProviderKey);
+                       /** @var $identityProvider Tx_Identity_ProviderInterface */
                        $identityProvider = t3lib_div::makeInstance($identityProviderConfiguration[Tx_Identity_Configuration_IdentityProviderInterface::PROVIDER_CLASS], $identityProviderKey);
                        if (!$identityProvider) {
-                               throw InvalidArgumentException('The provider class "' . $identityProviderConfiguration[Tx_Identity_Configuration_IdentityProviderInterface::PROVIDER_CLASS] . '" could not be loaded.', 1300109265);
+                               throw new InvalidArgumentException('The provider class "' . $identityProviderConfiguration[Tx_Identity_Configuration_IdentityProviderInterface::PROVIDER_CLASS] . '" could not be loaded.', 1300109265);
                        }
                        if (!$identityProvider instanceof Tx_Identity_ProviderInterface) {
-                               throw InvalidDataType('The provider class "' . $identityProviderConfiguration[Tx_Identity_Configuration_IdentityProviderInterface::PROVIDER_CLASS] . '" does not implement the "Tx_Identity_ProviderInterface".' , 1300110062);
+                               throw new InvalidDataType('The provider class "' . $identityProviderConfiguration[Tx_Identity_Configuration_IdentityProviderInterface::PROVIDER_CLASS] . '" does not implement the "Tx_Identity_ProviderInterface".' , 1300110062);
                        }
                        if (method_exists($identityProvider, 'injectDb')) {
                                $identityProvider->injectDb($GLOBALS['TYPO3_DB']);
@@ -100,15 +106,14 @@ class Tx_Identity_Map implements t3lib_Singleton {
         */
        protected function initializeDefaultIdentityProvider() {
                $identityConfigurationCheck = t3lib_div::makeInstance('Tx_Identity_Configuration_Check');
-
+               /** @var $identityConfigurationCheck Tx_Identity_Configuration_Check */
                if (!isset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['identity'][Tx_Identity_Configuration_IdentityProviderInterface::DEFAULT_PROVIDER])) {
-                       throw InvalidArgumentException(
+                       throw new InvalidArgumentException(
                                'There is no default identity provider defined in ' .
                                '$GLOBALS[\'TYPO3_CONF_VARS\'][\'EXTCONF\'][\'identity\'][Tx_Identity_Configuration_IdentityProviderInterface::DEFAULT_PROVIDER]',
                                1300104461
                        );
                }
-
                $defaultProviderKey = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['identity'][Tx_Identity_Configuration_IdentityProviderInterface::DEFAULT_PROVIDER];
                $identityConfigurationCheck->checkDefaultIdentityProviderConfiguration($defaultProviderKey);
                $this->defaultIdentityProvider = $this->identityProviders[$defaultProviderKey];
@@ -118,18 +123,14 @@ class Tx_Identity_Map implements t3lib_Singleton {
         * Initialize the table specific providers
         */
        protected function initializeTableSpecificIdentityProviders() {
+               /** @var $identityConfigurationCheck Tx_Identity_Configuration_Check */
                $identityConfigurationCheck = t3lib_div::makeInstance('Tx_Identity_Configuration_Check');
-
                if (isset($GLOBALS['TCA'])) {
                        foreach ($GLOBALS['TCA'] as $table=>$configuration) {
                                t3lib_div::loadTCA($table);
-                               $configuration = $GLOBALS['TCA'][$table];
-
                                if (isset($GLOBALS['TCA'][$table]['ctrl']['EXT']['identity'][Tx_Identity_Configuration_IdentityProviderInterface::KEY])) {
-
                                        $identityProviderKey = $GLOBALS['TCA'][$table]['ctrl']['EXT']['identity'][Tx_Identity_Configuration_IdentityProviderInterface::KEY];;
                                        $identityConfigurationCheck->checkTableSpecificIdentityProviderConfiguration($table, $identityProviderKey);
-
                                        $this->tableSpecificIdentityProviders[$table] = $this->identityProviders[$identityProviderKey];
                                }
                        }
@@ -142,6 +143,7 @@ class Tx_Identity_Map implements t3lib_Singleton {
         * Returns the identifier field for a resource location
         *
         * @param string $tablename
+        * @return string
         */
        public function getIdentifierFieldForResourceLocation($tablename) {
                $this->initializeObject();
@@ -164,7 +166,7 @@ class Tx_Identity_Map implements t3lib_Singleton {
         */
        public function getIdentifierForResourceLocation($tablename, $uid) {
                if (!$this->isApplicable($tablename)) {
-                       return;
+                       return NULL;
                }
                $this->initializeObject();
                if (isset($this->tableSpecificIdentityProviders[$tablename])) {
@@ -180,11 +182,11 @@ class Tx_Identity_Map implements t3lib_Singleton {
         * Requests a new identifier for a resource location
         *
         * @param string $tablename
-        * @return void
+        * @return mixed
         */
        public function getIdentifierForNewResourceLocation($tablename) {
                if (!$this->isApplicable($tablename)) {
-                       return;
+                       return NULL;
                }
                $this->initializeObject();
                if (isset($this->tableSpecificIdentityProviders[$tablename])) {
@@ -231,7 +233,6 @@ class Tx_Identity_Map implements t3lib_Singleton {
                        || $tablename === 'pages';
        }
 
-
        /**
         * Give all providers the chance to perform some kind of rebuild
         * @api
@@ -260,9 +261,6 @@ class Tx_Identity_Map implements t3lib_Singleton {
 
 }
 
-
 if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['EXT:uuid/Class/Registry.php'])) {
        include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['EXT:uuid/Class/Registry.php']);
-}
-
-?>
\ No newline at end of file
+}
\ No newline at end of file
index bbf91a9..edc5c92 100644 (file)
  *
  *  This copyright notice MUST APPEAR in all copies of the script!
  ***************************************************************/
-
+/**
+ * This class is the abstract implementation for a uuid identity provide
+ *
+ * @author Thomas Maroschik <tmaroschik@dfau.de>
+ *
+ * @package TYPO3
+ * @subpackage identity
+ */
 class Tx_Identity_Provider_AbstractUuid implements Tx_Identity_ProviderInterface {
 
        /**
@@ -81,8 +88,8 @@ class Tx_Identity_Provider_AbstractUuid implements Tx_Identity_ProviderInterface
                $this->providerKey = $providerKey;
 
                $this->version = class_exists('t3lib_utility_VersionNumber')
-                               ? t3lib_utility_VersionNumber::convertVersionNumberToInteger(TYPO3_version)
-                               : t3lib_div::int_from_ver(TYPO3_version);
+                       ? t3lib_utility_VersionNumber::convertVersionNumberToInteger(TYPO3_version)
+                       : t3lib_div::int_from_ver(TYPO3_version);
        }
 
        /**
@@ -441,7 +448,4 @@ class Tx_Identity_Provider_AbstractUuid implements Tx_Identity_ProviderInterface
                }
        }
 
-
-}
-
-?>
\ No newline at end of file
+}
\ No newline at end of file
index 0f835a6..2ea486f 100644 (file)
  *
  *  This copyright notice MUST APPEAR in all copies of the script!
  ***************************************************************/
-
+/**
+ * This class is the concrete implementation of the abstract uuid class for all non static records
+ *
+ * @author Thomas Maroschik <tmaroschik@dfau.de>
+ *
+ * @package TYPO3
+ * @subpackage identity
+ */
 class Tx_Identity_Provider_RecordUuid extends Tx_Identity_Provider_AbstractUuid {
 
-}
-
-?>
\ No newline at end of file
+}
\ No newline at end of file
index 47621e9..939bbc7 100644 (file)
  *
  *  This copyright notice MUST APPEAR in all copies of the script!
  ***************************************************************/
-
+/**
+ * This class is the concrete implementation of the abstract uuid class for all static records
+ *
+ * @author Thomas Maroschik <tmaroschik@dfau.de>
+ *
+ * @package TYPO3
+ * @subpackage identity
+ */
 class Tx_Identity_Provider_StaticRecordUuid extends Tx_Identity_Provider_AbstractUuid {
 
        /**
@@ -52,12 +59,10 @@ class Tx_Identity_Provider_StaticRecordUuid extends Tx_Identity_Provider_Abstrac
                                                 'foreign_tablename' => $tablename,
                                                 'foreign_uid' => $row['uid']
                                        );
-                                       $this->addToCache($uuid, $tablename, $uid);
+                                       $this->addToCache($uuid, $tablename, $row['uid']);
                                }
                        }
                }
        }
 
-}
-
-?>
\ No newline at end of file
+}
\ No newline at end of file
index e3feef0..30136aa 100644 (file)
  *
  *  This copyright notice MUST APPEAR in all copies of the script!
  ***************************************************************/
-
+/**
+ * This interface has to be implemented by every identity provider
+ * @api
+ */
 interface Tx_Identity_ProviderInterface {
 
        /**
@@ -66,6 +69,5 @@ interface Tx_Identity_ProviderInterface {
         * @return array [tablename, uid] the resource location
         */
        public function getResourceLocationForIdentifier($identifier);
-}
 
-?>
\ No newline at end of file
+}
\ No newline at end of file
index 1af18dc..813e03a 100644 (file)
  *
  *  This copyright notice MUST APPEAR in all copies of the script!
  ***************************************************************/
- /**
+/**
  * A utility class for various algorithms.
  *
- * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
+ * @author Thomas Maroschik <tmaroschik@dfau.de>
+ *
+ * @package TYPO3
+ * @subpackage identity
  */
 class Tx_Identity_Utility_Algorithms {
 
@@ -41,14 +44,18 @@ class Tx_Identity_Utility_Algorithms {
         * The algorithm used here, might not be completely random.
         *
         * @return string The universally unique id
-        * @author Unkown
+        * @author Unknown
         */
        static public function generateUUID() {
-               return sprintf( '%04x%04x-%04x-%04x-%04x-%04x%04x%04x',
-                       mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ),
-                       mt_rand( 0, 0x0fff ) | 0x4000,
-                       mt_rand( 0, 0x3fff ) | 0x8000,
-                       mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ) );
+               return sprintf('%04x%04x-%04x-%04x-%04x-%04x%04x%04x',
+                       mt_rand(0, 0xffff),
+                       mt_rand(0, 0xffff),
+                       mt_rand(0, 0xffff),
+                       mt_rand(0, 0x0fff) | 0x4000,
+                       mt_rand(0, 0x3fff) | 0x8000,
+                       mt_rand(0, 0xffff),
+                       mt_rand(0, 0xffff),
+                       mt_rand(0, 0xffff));
        }
 
        /**
@@ -74,73 +81,34 @@ class Tx_Identity_Utility_Algorithms {
         * @return string The unversally unique id
         * @throws InvalidArgumentException Throws an invalid argument exception, if the given namespace is not an uuid
         */
-   static public function generateUUIDv5($namespace, $name) {
-       // self::validateUUID($namespace);
-
-        // Get hexadecimal components of namespace
-        $nhex = str_replace(array('-','{','}'), '', $namespace);
-
-        // Binary Value
-        $nstr = '';
-
-        // Convert Namespace UUID to bits
-        for($i = 0;
-        $i < strlen($nhex);
-        $i+=2) {
-            $nstr .= chr(hexdec($nhex[$i].$nhex[$i+1]));
-        }
-
-        // Calculate hash value
-        $hash = sha1($nstr . $name);
-
-        return sprintf('%08s-%04s-%04x-%04x-%12s',
-
-                // 32 bits for "time_low"
-                substr($hash, 0, 8),
-
-                // 16 bits for "time_mid"
-                substr($hash, 8, 4),
-
-                // 16 bits for "time_hi_and_version",
-                // four most significant bits holds version number 5
-                (hexdec(substr($hash, 12, 4)) & 0x0fff) | 0x5000,
-
-                // 16 bits, 8 bits for "clk_seq_hi_res",
-                // 8 bits for "clk_seq_low",
-                // two most significant bits holds zero and one for variant DCE1.1
-                (hexdec(substr($hash, 16, 4)) & 0x3fff) | 0x8000,
-
-                // 48 bits for "node"
-                substr($hash, 20, 12)
-        );
-    }
-
-       /**
-        * Returns a string of random bytes.
-        *
-        * @param integer $count Number of bytes to generate
-        * @return string
-        * @author Karsten Dambekalns <karsten@typo3.org>
-        */
-       static public function generateRandomBytes($count) {
-               $bytes = '';
-
-                       // TODO: use TYPO3's internal API to retrieve random bytes
-               if (file_exists('/dev/urandom')) {
-                       $bytes = file_get_contents('/dev/urandom', NULL, NULL, NULL, $count);
-               }
-
-                       // urandom did not deliver (enough) data
-               if (strlen($bytes) < $count) {
-                       $randomState = microtime() . getmypid();
-                       while (strlen($bytes) < $count) {
-                               $randomState = md5(microtime() . mt_rand() . $randomState);
-                               $bytes .= md5(mt_rand() . $randomState, TRUE);
-                       }
-                       $bytes = substr($bytes, -$count, $count);
+       static public function generateUUIDv5($namespace, $name) {
+               // Get hexadecimal components of namespace
+               $nhex = str_replace(array('-', '{', '}'), '', $namespace);
+               // Binary Value
+               $nstr = '';
+               // Convert Namespace UUID to bits
+               for ($i = 0;
+                        $i < strlen($nhex);
+                        $i += 2) {
+                       $nstr .= chr(hexdec($nhex[$i] . $nhex[$i + 1]));
                }
-               return $bytes;
+               // Calculate hash value
+               $hash = sha1($nstr . $name);
+               return sprintf('%08s-%04s-%04x-%04x-%12s',
+                       // 32 bits for "time_low"
+                       substr($hash, 0, 8),
+                       // 16 bits for "time_mid"
+                       substr($hash, 8, 4),
+                       // 16 bits for "time_hi_and_version",
+                       // four most significant bits holds version number 5
+                               (hexdec(substr($hash, 12, 4)) & 0x0fff) | 0x5000,
+                       // 16 bits, 8 bits for "clk_seq_hi_res",
+                       // 8 bits for "clk_seq_low",
+                       // two most significant bits holds zero and one for variant DCE1.1
+                               (hexdec(substr($hash, 16, 4)) & 0x3fff) | 0x8000,
+                       // 48 bits for "node"
+                       substr($hash, 20, 12)
+               );
        }
 
-}
-?>
\ No newline at end of file
+}
\ No newline at end of file
index cc33f46..6b444f0 100644 (file)
  *  This copyright notice MUST APPEAR in all copies of the script!
  ***************************************************************/
 /**
- * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
+ * This class is responsible for the update message in extension manager.
+ *
+ * @author Fabien Udriot <fabien.udriot@ecodev.ch>
+ *
+ * @package TYPO3
+ * @subpackage identity
  */
 class Tx_Identity_Utility_ExtensionManager {
 
@@ -36,7 +41,6 @@ class Tx_Identity_Utility_ExtensionManager {
         */
        public function displayMessage(&$params, &$tsObj) {
                $out = '';
-
                if ($this->needsUpdate()) {
                        $out .= '
                        <div style="">
@@ -54,7 +58,6 @@ class Tx_Identity_Utility_ExtensionManager {
                                </div>
                        </div>
                        ';
-
                }
                else {
                        $out .= '
@@ -70,69 +73,57 @@ class Tx_Identity_Utility_ExtensionManager {
                        </div>
                        ';
                }
-
                return $out;
        }
-       
+
        /**
         * Check the database and tells whether it needs update
         *
         * @return boolean
         */
        protected function needsUpdate() {
-               
-                       // instantiate a light installer
-                       /* @var $installer Tx_Identity_Install_Installer */
+               // instantiate a light installer
+               /* @var $installer Tx_Identity_Install_Installer */
                $installer = t3lib_div::makeInstance('Tx_Identity_Install_Installer');
-
-                       // load the SQL files
+               // load the SQL files
                $tblFileContent = t3lib_div::getUrl(PATH_t3lib . 'stddb/tables.sql');
                foreach ($GLOBALS['TYPO3_LOADED_EXT'] as $loadedExtConf) {
                        if (is_array($loadedExtConf) && $loadedExtConf['ext_tables.sql']) {
                                $tblFileContent .= LF . LF . LF . LF . t3lib_div::getUrl($loadedExtConf['ext_tables.sql']);
                        }
                }
-
-
                $fileContent = implode(
                                LF, $installer->getStatementArray($tblFileContent, 1, '^CREATE TABLE ')
                );
-
-                       // get the table definitions
+               // get the table definitions
                $tableDefinitions = $installer->getFieldDefinitions_fileContent($fileContent);
                $fieldDefinitionsUtility = t3lib_div::makeInstance('Tx_Identity_Utility_FieldDefinitions');
                $tableDefinitions = $fieldDefinitionsUtility->insertIdentityColumn($tableDefinitions);
                if (!count($tableDefinitions)) {
                        die("Error: There were no 'CREATE TABLE' definitions in the provided file");
                }
-
-                       // get the current database definition
+               // get the current database definition
                $FDdb = $installer->getFieldDefinitions_database();
-
-                       // get a diff and check if a field uuid is missing somewhere
+               // get a diff and check if a field uuid is missing somewhere
                $diff = $installer->getDatabaseExtra($tableDefinitions, $FDdb);
                $update_statements = $installer->getUpdateSuggestions($diff);
                $update_statements['add'] = $installer->filterByIdentityField($update_statements['add']);
-
                return ! empty($update_statements['add']);
        }
-       
+
        /**
         * Remove statements that contains not a uuid statement
         *
         * @return boolean
         */
        protected function cleanUp($statements) {
-               
                $result = array();
                foreach ($statements as $key => $statement) {
                        if (strpos($statement, 'ADD uuid ') !== FALSE) {
                                $result[$key] = $statement;
                        }
                }
-               
                return $result;
        }
-}
 
-?>
\ No newline at end of file
+}
\ No newline at end of file
index 1408ed6..c35c82a 100644 (file)
@@ -182,5 +182,5 @@ class Tx_Identity_Utility_FieldDefinitions {
 
                return $identityFieldDefintions;
        }
-}
-?>
\ No newline at end of file
+
+}
\ No newline at end of file
diff --git a/Classes/Xclass/class.ux_t3lib_db.php b/Classes/Xclass/class.ux_t3lib_db.php
deleted file mode 100644 (file)
index d2284a2..0000000
+++ /dev/null
@@ -1,248 +0,0 @@
-<?php
-/***************************************************************
- *  Copyright notice
- *
- *  (c) 2011 Thomas Maroschik <tmaroschik@dfau.de>
- *  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!
- ***************************************************************/
-/**
- * Just a fallback, if identity extension is used in older typo3 versions
- *
- *
- * @author     Thomas Maroschik <tmaroschik@dfau.de>
- */
-class ux_t3lib_DB extends t3lib_DB {
-
-       /**
-        * @var t3lib_DB_preProcessQueryHook[]
-        */
-       protected $preProcessHookObjects = array();
-
-       /**
-        * @var t3lib_DB_postProcessQueryHook[]
-        */
-       protected $postProcessHookObjects = array();
-
-       /**
-        * Creates and executes an INSERT SQL-statement for $table from the array with field/value pairs $fields_values.
-        * Using this function specifically allows us to handle BLOB and CLOB fields depending on DB
-        * Usage count/core: 47
-        *
-        * @param       string          Table name
-        * @param       array           Field values as key=>value pairs. Values will be escaped internally. Typically you would fill an array like "$insertFields" with 'fieldname'=>'value' and pass it to this function as argument.
-        * @param       string/array            See fullQuoteArray()
-        * @return      pointer         MySQL result pointer / DBAL object
-        */
-       function exec_INSERTquery($table, $fields_values, $no_quote_fields = FALSE) {
-               $res = parent::exec_INSERTquery($table, $fields_values, $no_quote_fields);
-               foreach ($this->postProcessHookObjects as $hookObject) {
-                       $hookObject->exec_INSERTquery_postProcessAction($table, $fields_values, $no_quote_fields, $this);
-               }
-               return $res;
-       }
-
-       /**
-        * Creates and executes an INSERT SQL-statement for $table with multiple rows.
-        *
-        * @param       string          Table name
-        * @param       array           Field names
-        * @param       array           Table rows. Each row should be an array with field values mapping to $fields
-        * @param       string/array            See fullQuoteArray()
-        * @return      pointer         MySQL result pointer / DBAL object
-        */
-       public function exec_INSERTmultipleRows($table, array $fields, array $rows, $no_quote_fields = FALSE) {
-               $res = parent::exec_INSERTmultipleRows($table, $fields, $rows, $no_quote_fields);
-               foreach ($this->postProcessHookObjects as $hookObject) {
-                       $hookObject->exec_INSERTmultipleRows_postProcessAction($table, $fields, $rows, $no_quote_fields, $this);
-               }
-               return $res;
-       }
-
-       /**
-        * Creates and executes an UPDATE SQL-statement for $table where $where-clause (typ. 'uid=...') from the array with field/value pairs $fields_values.
-        * Using this function specifically allow us to handle BLOB and CLOB fields depending on DB
-        * Usage count/core: 50
-        *
-        * @param       string          Database tablename
-        * @param       string          WHERE clause, eg. "uid=1". NOTICE: You must escape values in this argument with $this->fullQuoteStr() yourself!
-        * @param       array           Field values as key=>value pairs. Values will be escaped internally. Typically you would fill an array like "$updateFields" with 'fieldname'=>'value' and pass it to this function as argument.
-        * @param       string/array            See fullQuoteArray()
-        * @return      pointer         MySQL result pointer / DBAL object
-        */
-       function exec_UPDATEquery($table, $where, $fields_values, $no_quote_fields = FALSE) {
-               $res = parent::exec_UPDATEquery($table, $where, $fields_values, $no_quote_fields);
-               foreach ($this->postProcessHookObjects as $hookObject) {
-                       $hookObject->exec_UPDATEquery_postProcessAction($table, $where, $fields_values, $no_quote_fields, $this);
-               }
-               return $res;
-       }
-
-       /**
-        * Creates and executes a DELETE SQL-statement for $table where $where-clause
-        * Usage count/core: 40
-        *
-        * @param       string          Database tablename
-        * @param       string          WHERE clause, eg. "uid=1". NOTICE: You must escape values in this argument with $this->fullQuoteStr() yourself!
-        * @return      pointer         MySQL result pointer / DBAL object
-        */
-       function exec_DELETEquery($table, $where) {
-               $res = parent::exec_DELETEquery($table, $where);
-               foreach ($this->postProcessHookObjects as $hookObject) {
-                       $hookObject->exec_DELETEquery_postProcessAction($table, $where, $this);
-               }
-               return $res;
-       }
-
-       /**
-        * Truncates a table.
-        *
-        * @param       string          Database tablename
-        * @return      mixed           Result from handler
-        */
-       public function exec_TRUNCATEquery($table) {
-               $res = parent::exec_TRUNCATEquery($table);
-               foreach ($this->postProcessHookObjects as $hookObject) {
-                       $hookObject->exec_TRUNCATEquery_postProcessAction($table, $this);
-               }
-               return $res;
-       }
-
-       /**
-        * Creates an INSERT SQL-statement for $table from the array with field/value pairs $fields_values.
-        * Usage count/core: 4
-        *
-        * @param       string          See exec_INSERTquery()
-        * @param       array           See exec_INSERTquery()
-        * @param       string/array            See fullQuoteArray()
-        * @return      string          Full SQL query for INSERT (unless $fields_values does not contain any elements in which case it will be false)
-        */
-       public function INSERTquery($table, $fields_values, $no_quote_fields = FALSE) {
-               if (is_array($fields_values) && count($fields_values)) {
-                       foreach ($this->preProcessHookObjects as $hookObject) {
-                               $hookObject->INSERTquery_preProcessAction($table, $fields_values, $no_quote_fields, $this);
-                       }
-               }
-               return parent::INSERTquery($table, $fields_values, $no_quote_fields);
-       }
-
-       /**
-        * Creates an INSERT SQL-statement for $table with multiple rows.
-        *
-        * @param       string          Table name
-        * @param       array           Field names
-        * @param       array           Table rows. Each row should be an array with field values mapping to $fields
-        * @param       string/array            See fullQuoteArray()
-        * @return      string          Full SQL query for INSERT (unless $rows does not contain any elements in which case it will be false)
-        */
-       public function INSERTmultipleRows($table, array $fields, array $rows, $no_quote_fields = FALSE) {
-                       // Table and fieldnames should be "SQL-injection-safe" when supplied to this
-                       // function (contrary to values in the arrays which may be insecure).
-               if (count($rows)) {
-                       foreach ($this->preProcessHookObjects as $hookObject) {
-                               $hookObject->INSERTmultipleRows_preProcessAction($table, $fields, $rows, $no_quote_fields, $this);
-                       }
-               }
-               return parent::INSERTmultipleRows($table, $fields, $rows, $no_quote_fields);
-       }
-
-       /**
-        * Creates an UPDATE SQL-statement for $table where $where-clause (typ. 'uid=...') from the array with field/value pairs $fields_values.
-        * Usage count/core: 6
-        *
-        * @param       string          See exec_UPDATEquery()
-        * @param       string          See exec_UPDATEquery()
-        * @param       array           See exec_UPDATEquery()
-        * @param       array           See fullQuoteArray()
-        * @return      string          Full SQL query for UPDATE
-        */
-       public function UPDATEquery($table, $where, $fields_values, $no_quote_fields = FALSE) {
-               if (is_string($where)) {
-                       foreach ($this->preProcessHookObjects as $hookObject) {
-                               $hookObject->UPDATEquery_preProcessAction($table, $where, $fields_values, $no_quote_fields, $this);
-                       }
-               }
-               return parent::UPDATEquery($table, $where, $fields_values, $no_quote_fields);
-       }
-
-       /**
-        * Creates a DELETE SQL-statement for $table where $where-clause
-        * Usage count/core: 3
-        *
-        * @param       string          See exec_DELETEquery()
-        * @param       string          See exec_DELETEquery()
-        * @return      string          Full SQL query for DELETE
-        */
-       public function DELETEquery($table, $where) {
-               if (is_string($where)) {
-                       foreach ($this->preProcessHookObjects as $hookObject) {
-                               $hookObject->DELETEquery_preProcessAction($table, $where, $this);
-                       }
-               }
-               return parent::DELETEquery($table, $where);
-       }
-
-       /**
-        * Creates a TRUNCATE TABLE SQL-statement
-        *
-        * @param       string          See exec_TRUNCATEquery()
-        * @return      string          Full SQL query for TRUNCATE TABLE
-        */
-       public function TRUNCATEquery($table) {
-               foreach ($this->preProcessHookObjects as $hookObject) {
-                       $hookObject->TRUNCATEquery_preProcessAction($table, $this);
-               }
-               return parent::TRUNCATEquery($table);
-       }
-
-       /**
-        * Connects to database for TYPO3 sites:
-        *
-        * @param string $host
-        * @param string $user
-        * @param string $password
-        * @param string $db
-        * @return      void
-        */
-       function connectDB($host = TYPO3_db_host, $user = TYPO3_db_username, $password = TYPO3_db_password, $db = TYPO3_db) {
-               parent::connectDB($host, $user, $password);
-                       // Prepare user defined objects (if any) for hooks which extend query methods
-               $this->preProcessHookObjects = array();
-               $this->postProcessHookObjects = array();
-               if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_db.php']['queryProcessors'])) {
-                       foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_db.php']['queryProcessors'] as $classRef) {
-                               $hookObject = t3lib_div::getUserObj($classRef);
-
-                               if (!($hookObject instanceof t3lib_DB_preProcessQueryHook || $hookObject instanceof t3lib_DB_postProcessQueryHook)) {
-                                       throw new UnexpectedValueException('$hookObject must either implement interface t3lib_DB_preProcessQueryHook or interface t3lib_DB_postProcessQueryHook', 1299158548);
-                               }
-                               if ($hookObject instanceof t3lib_DB_preProcessQueryHook) {
-                                       $this->preProcessHookObjects[] = $hookObject;
-                               }
-                               if ($hookObject instanceof t3lib_DB_postProcessQueryHook) {
-                                       $this->postProcessHookObjects[] = $hookObject;
-                               }
-                       }
-               }
-       }
-}
-
-?>
\ No newline at end of file
diff --git a/Classes/Xclass/class.ux_t3lib_install.php b/Classes/Xclass/class.ux_t3lib_install.php
deleted file mode 100644 (file)
index a8c166c..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-<?php
-
-class ux_t3lib_install extends t3lib_install {
-
-       /**
-        * Reads the field definitions for the input SQL-file string
-        *
-        * @param       string          Should be a string read from an SQL-file made with 'mysqldump [database_name] -d'
-        * @return      array           Array with information about table.
-        */
-       function getFieldDefinitions_fileContent($fileContent) {
-               $tableDefinitions = parent::getFieldDefinitions_fileContent($fileContent);
-               $fieldDefinitionsUtility = t3lib_div::makeInstance('Tx_Identity_Utility_FieldDefinitions');
-               $tableDefinitions = $fieldDefinitionsUtility->insertIdentityColumn($tableDefinitions);
-               return $tableDefinitions;
-       }
-}
-?>
\ No newline at end of file
diff --git a/Classes/Xclass/class.ux_tx_install.php b/Classes/Xclass/class.ux_tx_install.php
deleted file mode 100644 (file)
index 59a39e8..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-<?php
-
-class ux_tx_install extends tx_install {
-
-       /**
-        * Reads the field definitions for the input SQL-file string
-        *
-        * @param       string          Should be a string read from an SQL-file made with 'mysqldump [database_name] -d'
-        * @return      array           Array with information about table.
-        */
-       function getFieldDefinitions_fileContent($fileContent) {
-               global $TCA;
-               // Load TCA only if necessary
-               if (!is_array($TCA)) {
-                       $this->includeTCA();
-               }
-               $tableDefinitions = parent::getFieldDefinitions_fileContent($fileContent);
-               $fieldDefinitionsUtility = t3lib_div::makeInstance('Tx_Identity_Utility_FieldDefinitions');
-               $tableDefinitions = $fieldDefinitionsUtility->insertIdentityColumn($tableDefinitions);
-               return $tableDefinitions;
-       }
-}
-?>
\ No newline at end of file
index fc15645..c85053b 100644 (file)
  *
  *  This copyright notice MUST APPEAR in all copies of the script!
  * ************************************************************* */
-
 if (t3lib_extMgm::isLoaded('identity')) {
        require_once(t3lib_extMgm::extPath('identity') . 'Classes/Install/Installer.php');
 }
-
 /**
  * Class for updating identity
  *
- * @author             Fabien Udriot <fabien.udriot@ecodev.ch>
- * @package            TYPO3
- * @subpackage tx_templatedisplay
+ * @author Fabien Udriot <fabien.udriot@ecodev.ch>
  *
- * $Id: class.ext_update.php 567 2010-12-28 16:22:01Z fudriot $
+ * @package TYPO3
+ * @subpackage identity
  */
 class ext_update {
 
index c2298f8..0f49af2 100644 (file)
@@ -5,8 +5,8 @@
  * $Id: $
  */
 return array(
-       't3lib_db_preprocessqueryhook'  => t3lib_extMgm::extPath('identity', 'Classes/Compat/interface.t3lib_db_preprocessqueryhook.php'),
-       't3lib_db_postprocessqueryhook' => t3lib_extMgm::extPath('identity', 'Classes/Compat/interface.t3lib_db_postprocessqueryhook.php'),
+       't3lib_db_preprocessqueryhook' => PATH_t3lib . 'interfaces/interface.t3lib_db_preprocessqueryhook.php',
+       't3lib_db_postprocessqueryhook' => PATH_t3lib . 'interfaces/interface.t3lib_db_postprocessqueryhook.php',
        'tx_identity_map' =>  t3lib_extMgm::extPath('identity', 'Classes/Map.php'),
        'tx_identity_configuration_check' => t3lib_extMgm::extPath('identity', 'Classes/Configuration/Check.php'),
        'tx_identity_configuration_identityproviderinterface' => t3lib_extMgm::extPath('identity', 'Classes/Configuration/IdentityProviderInterface.php'),
index eaf0f9c..c764aaf 100644 (file)
@@ -1,23 +1,13 @@
 <?php
-########################################################################
-# Extension Manager/Repository config file for ext: "semantic"
-#
-# Auto generated by Extbase Kickstarter 2010-12-13
-#
-# Manual updates:
-# Only the data in the array - anything else is removed by next write.
-# "version" and "dependencies" must not be touched!
-########################################################################
-
 $EM_CONF[$_EXTKEY] = array(
        'title' => 'Identity',
        'description' => '',
        'category' => 'plugin',
        'author' => 'Thomas Maroschik, Fabien Udriot',
        'author_email' => 'tmaroschik@dfau.de, fabien.udriot@ecodev.ch',
-       'author_company' => '',
+       'author_company' => 'DFAU, Ecodev',
        'shy' => '',
-       'dependencies' => '',
+       'dependencies' => 'typo3',
        'conflicts' => '',
        'priority' => '',
        'module' => '',
index 10f3547..8348f0c 100644 (file)
@@ -30,12 +30,6 @@ if (!defined ('TYPO3_MODE')) {
        die ('Access denied.');
 }
 
-//$GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_install.php'] = t3lib_extMgm::extPath($_EXTKEY) . 'Classes/Xclass/class.ux_t3lib_install.php';
-//$GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/install/mod/class.tx_install.php'] = t3lib_extMgm::extPath($_EXTKEY) . 'Classes/Xclass/class.ux_tx_install.php';
-
-if (!interface_exists('t3lib_DB_preProcessQueryHook')) {
-       $GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_db.php'] = t3lib_extMgm::extPath($_EXTKEY) . 'Classes/Xclass/class.ux_t3lib_db.php';
-}
 $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processDatamapClass'][$_EXTKEY] = 'EXT:' . $_EXTKEY . '/Classes/Hooks/class.tx_identity_tcemain_hook.php:tx_identity_tcemain_hook';
 $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_db.php']['queryProcessors'][$_EXTKEY] = 'EXT:' . $_EXTKEY . '/Classes/Hooks/class.tx_identity_t3lib_db_preprocess.php:tx_identity_t3lib_db_preprocess';
 
index 8cf3fbf..85f7023 100644 (file)
@@ -36,4 +36,5 @@ foreach ($GLOBALS['TCA'] as $tablename=>$configuration) {
                $GLOBALS['TCA'][$tablename]['ctrl']['EXT']['identity'][Tx_Identity_Configuration_IdentityProviderInterface::KEY] = 'staticRecordUuid';
        }
 }
+
 ?>
\ No newline at end of file