[TASK] Remove global declarations inside methods
authorXavier Perseguers <typo3@perseguers.ch>
Wed, 13 Apr 2011 20:04:07 +0000 (22:04 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Sun, 17 Apr 2011 12:55:56 +0000 (14:55 +0200)
Global declaration such as global $TCA or global $BE_USER should
be changed to $GLOBALS['TCA'], $GLOBALS['BE_USER'], ...

Change-Id: I68f801ff6934a7e16db78cb3f10d1c2b64aef351
Fixes: #25334
Reviewed-on: http://review.typo3.org/1446
Reviewed-by: Steffen Gebert
Tested-by: Steffen Gebert
Reviewed-by: Susanne Moog
Tested-by: Susanne Moog
Tested-by: Christian Kuhn
Reviewed-by: Christian Kuhn
106 files changed:
t3lib/class.t3lib_admin.php
t3lib/class.t3lib_basicfilefunc.php
t3lib/class.t3lib_befunc.php
t3lib/class.t3lib_clipboard.php
t3lib/class.t3lib_db.php
t3lib/class.t3lib_div.php
t3lib/class.t3lib_extmgm.php
t3lib/class.t3lib_extobjbase.php
t3lib/class.t3lib_fullsearch.php
t3lib/class.t3lib_iconworks.php
t3lib/class.t3lib_loaddbgroup.php
t3lib/class.t3lib_page.php
t3lib/class.t3lib_parsehtml_proc.php
t3lib/class.t3lib_positionmap.php
t3lib/class.t3lib_querygenerator.php
t3lib/class.t3lib_recordlist.php
t3lib/class.t3lib_refindex.php
t3lib/class.t3lib_scbase.php
t3lib/class.t3lib_softrefproc.php
t3lib/class.t3lib_tceforms.php
t3lib/class.t3lib_tceforms_inline.php
t3lib/class.t3lib_tcemain.php
t3lib/class.t3lib_transferdata.php
t3lib/class.t3lib_transl8tools.php
t3lib/class.t3lib_treeview.php
t3lib/class.t3lib_userauthgroup.php
t3lib/stddb/tables.php
typo3/alt_clickmenu.php
typo3/alt_db_navframe.php
typo3/alt_doc.php
typo3/alt_doc_nodoc.php
typo3/alt_file_navframe.php
typo3/alt_intro.php
typo3/alt_menu.php
typo3/alt_shortcut.php
typo3/alt_topmenu_dummy.php
typo3/backend.php
typo3/class.alt_menu_functions.inc
typo3/class.browse_links.php
typo3/class.db_list.inc
typo3/class.db_list_extra.inc
typo3/class.show_rechis.inc
typo3/classes/class.shortcutmenu.php
typo3/classes/class.typo3_tcefile.php
typo3/db_new.php
typo3/file_edit.php
typo3/file_newfolder.php
typo3/file_rename.php
typo3/index.php
typo3/init.php
typo3/js/livesearch.js
typo3/logout.php
typo3/move_el.php
typo3/show_item.php
typo3/show_rechis.php
typo3/sysext/belog/class.tx_belog_webinfo.php
typo3/sysext/belog/mod/index.php
typo3/sysext/beuser/class.tx_beuser.php
typo3/sysext/cms/classes/class.tx_cms_backendlayout.php
typo3/sysext/cms/layout/class.tx_cms_layout.php
typo3/sysext/cms/layout/db_layout.php
typo3/sysext/cms/layout/db_new_content_el.php
typo3/sysext/cms/tslib/class.tslib_content.php
typo3/sysext/cms/tslib/class.tslib_eidtools.php
typo3/sysext/cms/tslib/class.tslib_fe.php
typo3/sysext/cms/tslib/class.tslib_fetce.php
typo3/sysext/cms/tslib/media/scripts/wapversionLib.inc
typo3/sysext/cms/tslib/media/scripts/xmlversionLib.inc
typo3/sysext/em/classes/extensions/class.tx_em_extensions_details.php
typo3/sysext/em/classes/index.php
typo3/sysext/extra_page_cm_options/class.tx_extrapagecmoptions.php
typo3/sysext/filelist/mod1/file_list.php
typo3/sysext/func/mod1/index.php
typo3/sysext/impexp/app/index.php
typo3/sysext/impexp/class.tx_impexp.php
typo3/sysext/impexp/class.tx_impexp_clickmenu.php
typo3/sysext/indexed_search/modfunc2/class.tx_indexedsearch_modfunc2.php
typo3/sysext/info/mod1/index.php
typo3/sysext/install/mod/class.tx_install.php
typo3/sysext/lang/lang.php
typo3/sysext/linkvalidator/classes/class.tx_linkvalidator_processor.php
typo3/sysext/lowlevel/class.tx_lowlevel_cleaner.php
typo3/sysext/lowlevel/dbint/index.php
typo3/sysext/perm/mod1/index.php
typo3/sysext/recordlist/mod1/index.php
typo3/sysext/recycler/classes/helper/class.tx_recycler_helper.php
typo3/sysext/recycler/mod1/index.php
typo3/sysext/rtehtmlarea/class.tx_rtehtmlarea_base.php
typo3/sysext/rtehtmlarea/mod3/class.tx_rtehtmlarea_browse_links.php
typo3/sysext/rtehtmlarea/mod4/class.tx_rtehtmlarea_select_image.php
typo3/sysext/rtehtmlarea/mod5/class.tx_rtehtmlarea_user.php
typo3/sysext/rtehtmlarea/mod6/class.tx_rtehtmlarea_parse_html.php
typo3/sysext/setup/mod/index.php
typo3/sysext/statictemplates/media/scripts/wapversionLib.inc
typo3/sysext/statictemplates/media/scripts/xmlversionLib.inc
typo3/sysext/tsconfig_help/mod1/index.php
typo3/sysext/tstemplate_analyzer/class.tx_tstemplateanalyzer.php
typo3/sysext/tstemplate_ceditor/class.tx_tstemplateceditor.php
typo3/sysext/tstemplate_info/class.tx_tstemplateinfo.php
typo3/sysext/tstemplate_objbrowser/class.tx_tstemplateobjbrowser.php
typo3/sysext/viewpage/view/index.php
typo3/tce_db.php
typo3/template.php
typo3/view_help.php
typo3/wizard_edit.php
typo3/wizard_rte.php

index 5ba4819..6863ed6 100644 (file)
@@ -25,7 +25,7 @@
  *  This copyright notice MUST APPEAR in all copies of the script!
  ***************************************************************/
 /**
- * Contains a class for evaluation of database integrity according to $TCA
+ * Contains a class for evaluation of database integrity according to $GLOBALS['TCA']
  * Most of these functions are considered obsolete!
  *
  * Revised for TYPO3 3.6 July/2003 by Kasper Skårhøj
@@ -230,8 +230,6 @@ class t3lib_admin {
         * @return      void
         */
        function genTree_records($theID, $depthData, $table = '', $versions = FALSE) {
-               global $TCA;
-
                if ($versions) {
                                // Select all records from table pointing to this page:
                        $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
@@ -294,7 +292,7 @@ class t3lib_admin {
 
 
                                // Select all versions of this record:
-                       if ($this->genTree_includeVersions && $TCA[$table]['ctrl']['versioningWS']) {
+                       if ($this->genTree_includeVersions && $GLOBALS['TCA'][$table]['ctrl']['versioningWS']) {
                                $genHTML = $depthData . '<img' . t3lib_iconWorks::skinImg($this->backPath, 'gfx/ol/' . $LN . '.gif', 'width="18" height="16"') . ' align="top" alt="" />';
 
                                $this->genTree_records($newID, $genHTML, $table, TRUE);
@@ -327,26 +325,25 @@ class t3lib_admin {
         * @return      void
         */
        function lostRecords($pid_list) {
-               global $TCA;
                $this->lostPagesList = '';
                if ($pid_list) {
-                       foreach ($TCA as $table => $tableConf) {
+                       foreach ($GLOBALS['TCA'] as $table => $tableConf) {
                                t3lib_div::loadTCA($table);
 
                                $pid_list_tmp = $pid_list;
-                               if (!isset($TCA[$table]['ctrl']['versioningWS']) || !$TCA[$table]['ctrl']['versioningWS']) {
+                               if (!isset($GLOBALS['TCA'][$table]['ctrl']['versioningWS']) || !$GLOBALS['TCA'][$table]['ctrl']['versioningWS']) {
                                                // Remove preceding "-1," for non-versioned tables
                                        $pid_list_tmp = preg_replace('/^\-1,/', '', $pid_list_tmp);
                                }
 
                                $garbage = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
-                                       'uid,pid,' . $TCA[$table]['ctrl']['label'],
+                                       'uid,pid,' . $GLOBALS['TCA'][$table]['ctrl']['label'],
                                        $table,
                                                'pid NOT IN (' . $pid_list_tmp . ')'
                                );
                                $lostIdList = array();
                                while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($garbage)) {
-                                       $this->lRecords[$table][$row['uid']] = array('uid' => $row['uid'], 'pid' => $row['pid'], 'title' => strip_tags($row[$TCA[$table]['ctrl']['label']]));
+                                       $this->lRecords[$table][$row['uid']] = array('uid' => $row['uid'], 'pid' => $row['pid'], 'title' => strip_tags($row[$GLOBALS['TCA'][$table]['ctrl']['label']]));
                                        $lostIdList[] = $row['uid'];
                                }
                                if ($table == 'pages') {
@@ -381,21 +378,20 @@ class t3lib_admin {
        }
 
        /**
-        * Counts records from $TCA-tables that ARE attached to an existing page.
+        * Counts records from $GLOBALS['TCA']-tables that ARE attached to an existing page.
         *
         * @param       string          list of pid's (page-record uid's). This list is probably made by genTree()
-        * @return      array           an array with the number of records from all $TCA-tables that are attached to a PID in the pid-list.
+        * @return      array           an array with the number of records from all $GLOBALS['TCA']-tables that are attached to a PID in the pid-list.
         */
        function countRecords($pid_list) {
-               global $TCA;
                $list = array();
                $list_n = array();
                if ($pid_list) {
-                       foreach ($TCA as $table => $tableConf) {
+                       foreach ($GLOBALS['TCA'] as $table => $tableConf) {
                                t3lib_div::loadTCA($table);
 
                                $pid_list_tmp = $pid_list;
-                               if (!isset($TCA[$table]['ctrl']['versioningWS']) || !$TCA[$table]['ctrl']['versioningWS']) {
+                               if (!isset($GLOBALS['TCA'][$table]['ctrl']['versioningWS']) || !$GLOBALS['TCA'][$table]['ctrl']['versioningWS']) {
                                                // Remove preceding "-1," for non-versioned tables
                                        $pid_list_tmp = preg_replace('/^\-1,/', '', $pid_list_tmp);
                                }
@@ -421,11 +417,10 @@ class t3lib_admin {
         * @return      array           An array with all fields listed that somehow are references to other records (foreign-keys) or files
         */
        function getGroupFields($mode) {
-               global $TCA;
                $result = array();
-               foreach ($TCA as $table => $tableConf) {
+               foreach ($GLOBALS['TCA'] as $table => $tableConf) {
                        t3lib_div::loadTCA($table);
-                       $cols = $TCA[$table]['columns'];
+                       $cols = $GLOBALS['TCA'][$table]['columns'];
                        foreach ($cols as $field => $config) {
                                if ($config['config']['type'] == 'group') {
                                        if (
@@ -453,11 +448,10 @@ class t3lib_admin {
         * @return      array           An array with all fields listed that have references to files in the $uploadfolder
         */
        function getFileFields($uploadfolder) {
-               global $TCA;
                $result = array();
-               foreach ($TCA as $table => $tableConf) {
+               foreach ($GLOBALS['TCA'] as $table => $tableConf) {
                        t3lib_div::loadTCA($table);
-                       $cols = $TCA[$table]['columns'];
+                       $cols = $GLOBALS['TCA'][$table]['columns'];
                        foreach ($cols as $field => $config) {
                                if ($config['config']['type'] == 'group' && $config['config']['internal_type'] == 'file' && $config['config']['uploadfolder'] == $uploadfolder) {
                                        $result[] = array($table, $field);
@@ -468,18 +462,17 @@ class t3lib_admin {
        }
 
        /**
-        * Returns an array with arrays of table/field pairs which are allowed to hold references to the input table name - according to $TCA
+        * Returns an array with arrays of table/field pairs which are allowed to hold references to the input table name - according to $GLOBALS['TCA']
         *
         * @param       string          Table name
         * @return      array
         */
        function getDBFields($theSearchTable) {
-               global $TCA;
                $result = array();
-               reset($TCA);
-               foreach ($TCA as $table => $tableConf) {
+               reset($GLOBALS['TCA']);
+               foreach ($GLOBALS['TCA'] as $table => $tableConf) {
                        t3lib_div::loadTCA($table);
-                       $cols = $TCA[$table]['columns'];
+                       $cols = $GLOBALS['TCA'][$table]['columns'];
                        foreach ($cols as $field => $config) {
                                if ($config['config']['type'] == 'group' && $config['config']['internal_type'] == 'db') {
                                        if (trim($config['config']['allowed']) == '*' || strstr($config['config']['allowed'], $theSearchTable)) {
@@ -501,10 +494,9 @@ class t3lib_admin {
         * @see getGroupFields()
         */
        function selectNonEmptyRecordsWithFkeys($fkey_arrays) {
-               global $TCA;
                if (is_array($fkey_arrays)) {
                        foreach ($fkey_arrays as $table => $field_list) {
-                               if ($TCA[$table] && trim($field_list)) {
+                               if ($GLOBALS['TCA'][$table] && trim($field_list)) {
                                        t3lib_div::loadTCA($table);
                                        $fieldArr = explode(',', $field_list);
 
@@ -533,7 +525,7 @@ class t3lib_admin {
                                        while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($mres)) {
                                                foreach ($fieldArr as $field) {
                                                        if (trim($row[$field])) {
-                                                               $fieldConf = $TCA[$table]['columns'][$field]['config'];
+                                                               $fieldConf = $GLOBALS['TCA'][$table]['columns'][$field]['config'];
                                                                if ($fieldConf['type'] == 'group') {
                                                                        if ($fieldConf['internal_type'] == 'file') {
                                                                                        // files...
@@ -672,10 +664,9 @@ class t3lib_admin {
         * @return      string          HTML Error message
         */
        function testDBRefs($theArray) {
-               global $TCA;
                $result = '';
                foreach ($theArray as $table => $dbArr) {
-                       if ($TCA[$table]) {
+                       if ($GLOBALS['TCA'][$table]) {
                                $idlist = array_keys($dbArr);
 
                                $theList = implode(',', $idlist);
@@ -707,7 +698,6 @@ class t3lib_admin {
         * @return      array           Array with other arrays containing information about where references was found
         */
        function whereIsRecordReferenced($searchTable, $id) {
-               global $TCA;
                $fileFields = $this->getDBFields($searchTable); // Gets tables / Fields that reference to files...
                $theRecordList = array();
                foreach ($fileFields as $info) {
@@ -715,13 +705,13 @@ class t3lib_admin {
                        $field = $info[1];
                        t3lib_div::loadTCA($table);
                        $mres = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
-                               'uid,pid,' . $TCA[$table]['ctrl']['label'] . ',' . $field,
+                               'uid,pid,' . $GLOBALS['TCA'][$table]['ctrl']['label'] . ',' . $field,
                                $table,
                                        $field . ' LIKE \'%' . $GLOBALS['TYPO3_DB']->quoteStr($id, $table) . '%\''
                        );
                        while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($mres)) {
                                        // Now this is the field, where the reference COULD come from. But we're not garanteed, so we must carefully examine the data.
-                               $fieldConf = $TCA[$table]['columns'][$field]['config'];
+                               $fieldConf = $GLOBALS['TCA'][$table]['columns'][$field]['config'];
                                $allowedTables = ($fieldConf['type'] == 'group') ? $fieldConf['allowed'] : $fieldConf['foreign_table'];
                                /** @var $dbAnalysis t3lib_loadDBGroup */
                                $dbAnalysis = t3lib_div::makeInstance('t3lib_loadDBGroup');
@@ -745,14 +735,13 @@ class t3lib_admin {
         * @return      array           Array with other arrays containing information about where references was found
         */
        function whereIsFileReferenced($uploadfolder, $filename) {
-               global $TCA;
                $fileFields = $this->getFileFields($uploadfolder); // Gets tables / Fields that reference to files...
                $theRecordList = array();
                foreach ($fileFields as $info) {
                        $table = $info[0];
                        $field = $info[1];
                        $mres = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
-                               'uid,pid,' . $TCA[$table]['ctrl']['label'] . ',' . $field,
+                               'uid,pid,' . $GLOBALS['TCA'][$table]['ctrl']['label'] . ',' . $field,
                                $table,
                                        $field . ' LIKE \'%' . $GLOBALS['TYPO3_DB']->quoteStr($filename, $table) . '%\''
                        );
index c63e32c..3a5a57e 100644 (file)
@@ -121,7 +121,7 @@ class t3lib_basicFileFunctions {
         *  Example:
         *       $basicff->init($GLOBALS['FILEMOUNTS'],$TYPO3_CONF_VARS['BE']['fileExtensions']);
         *
-        * @param       array           Contains the paths of the file mounts for the current BE user. Normally $GLOBALS['FILEMOUNTS'] is passed. This variable is set during backend user initialization; $FILEMOUNTS = $BE_USER->returnFilemounts(); (see typo3/init.php)
+        * @param       array           Contains the paths of the file mounts for the current BE user. Normally $GLOBALS['FILEMOUNTS'] is passed. This variable is set during backend user initialization; $FILEMOUNTS = $GLOBALS['BE_USER']->returnFilemounts(); (see typo3/init.php)
         * @param       array           Array with information about allowed and denied file extensions. Typically passed: $TYPO3_CONF_VARS['BE']['fileExtensions']
         * @return      void
         * @see typo3/init.php, t3lib_userAuthGroup::returnFilemounts()
index 21f8c28..1a7f572 100644 (file)
@@ -190,19 +190,18 @@ final class t3lib_BEfunc {
 
 
        /**
-        * Returns the WHERE clause " AND NOT [tablename].[deleted-field]" if a deleted-field is configured in $TCA for the tablename, $table
-        * This function should ALWAYS be called in the backend for selection on tables which are configured in TCA since it will ensure consistent selection of records, even if they are marked deleted (in which case the system must always treat them as non-existent!)
+        * Returns the WHERE clause " AND NOT [tablename].[deleted-field]" if a deleted-field is configured in $GLOBALS['TCA'] for the tablename, $table
+        * This function should ALWAYS be called in the backend for selection on tables which are configured in $GLOBALS['TCA'] since it will ensure consistent selection of records, even if they are marked deleted (in which case the system must always treat them as non-existent!)
         * In the frontend a function, ->enableFields(), is known to filter hidden-field, start- and endtime and fe_groups as well. But that is a job of the frontend, not the backend. If you need filtering on those fields as well in the backend you can use ->BEenableFields() though.
         * Usage: 71
         *
-        * @param       string          Table name present in $TCA
+        * @param       string          Table name present in $GLOBALS['TCA']
         * @param       string          Table alias if any
         * @return      string          WHERE clause for filtering out deleted records, eg " AND tablename.deleted=0"
         */
        public static function deleteClause($table, $tableAlias = '') {
-               global $TCA;
-               if ($TCA[$table]['ctrl']['delete']) {
-                       return ' AND ' . ($tableAlias ? $tableAlias : $table) . '.' . $TCA[$table]['ctrl']['delete'] . '=0';
+               if ($GLOBALS['TCA'][$table]['ctrl']['delete']) {
+                       return ' AND ' . ($tableAlias ? $tableAlias : $table) . '.' . $GLOBALS['TCA'][$table]['ctrl']['delete'] . '=0';
                } else {
                        return '';
                }
@@ -213,10 +212,10 @@ final class t3lib_BEfunc {
         * You can set $field to a list of fields (default is '*')
         * Additional WHERE clauses can be added by $where (fx. ' AND blabla = 1')
         * Will automatically check if records has been deleted and if so, not return anything.
-        * $table must be found in $TCA
+        * $table must be found in $GLOBALS['TCA']
         * Usage: 99
         *
-        * @param       string          Table name present in $TCA
+        * @param       string          Table name present in $GLOBALS['TCA']
         * @param       integer         UID of record
         * @param       string          List of fields to select
         * @param       string          Additional WHERE clause, eg. " AND blablabla = 0"
@@ -241,7 +240,7 @@ final class t3lib_BEfunc {
        /**
         * Like getRecord(), but overlays workspace version if any.
         *
-        * @param       string          Table name present in $TCA
+        * @param       string          Table name present in $GLOBALS['TCA']
         * @param       integer         UID of record
         * @param       string          List of fields to select
         * @param       string          Additional WHERE clause, eg. " AND blablabla = 0"
@@ -272,7 +271,7 @@ final class t3lib_BEfunc {
        /**
         * Returns the first record found from $table with $where as WHERE clause
         * This function does NOT check if a record has the deleted flag set.
-        * $table does NOT need to be configured in $TCA
+        * $table does NOT need to be configured in $GLOBALS['TCA']
         * The query used is simply this:
         * $query = 'SELECT '.$fields.' FROM '.$table.' WHERE '.$where;
         * Usage: 5 (ext: sys_todos)
@@ -297,7 +296,7 @@ final class t3lib_BEfunc {
         * If no records were selected, the function returns nothing
         * Usage: 8
         *
-        * @param       string          Table name present in $TCA
+        * @param       string          Table name present in $GLOBALS['TCA']
         * @param       string          Field to select on
         * @param       string          Value that $theField must match
         * @param       string          Optional additional WHERE clauses put in the end of the query. DO NOT PUT IN GROUP BY, ORDER BY or LIMIT!
@@ -308,8 +307,7 @@ final class t3lib_BEfunc {
         * @return      mixed           Multidimensional array with selected records (if any is selected)
         */
        public static function getRecordsByField($theTable, $theField, $theValue, $whereClause = '', $groupBy = '', $orderBy = '', $limit = '', $useDeleteClause = TRUE) {
-               global $TCA;
-               if (is_array($TCA[$theTable])) {
+               if (is_array($GLOBALS['TCA'][$theTable])) {
                        $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
                                '*',
                                $theTable,
@@ -381,7 +379,7 @@ final class t3lib_BEfunc {
         * $GLOBALS["SIM_ACCESS_TIME"] is used for date.
         * Usage: 5
         *
-        * @param       string          $table is the table from which to return enableFields WHERE clause. Table name must have a 'ctrl' section in $TCA.
+        * @param       string          $table is the table from which to return enableFields WHERE clause. Table name must have a 'ctrl' section in $GLOBALS['TCA'].
         * @param       boolean         $inv means that the query will select all records NOT VISIBLE records (inverted selection)
         * @return      string          WHERE clause part
         */
@@ -416,7 +414,7 @@ final class t3lib_BEfunc {
        /**
         * Fetches the localization for a given record.
         *
-        * @param       string          $table: Table name present in $TCA
+        * @param       string          $table: Table name present in $GLOBALS['TCA']
         * @param       integer         $uid: The uid of the record
         * @param       integer         $language: The uid of the language record in sys_language
         * @param       string          $andWhereClause: Optional additional WHERE clause (default: '')
@@ -556,13 +554,12 @@ final class t3lib_BEfunc {
         * @return      void
         */
        public static function openPageTree($pid, $clearExpansion) {
-               global $BE_USER;
 
                        // Get current expansion data:
                if ($clearExpansion) {
                        $expandedPages = array();
                } else {
-                       $expandedPages = unserialize($BE_USER->uc['browseTrees']['browsePages']);
+                       $expandedPages = unserialize($GLOBALS['BE_USER']->uc['browseTrees']['browsePages']);
                }
 
                        // Get rootline:
@@ -570,7 +567,7 @@ final class t3lib_BEfunc {
 
                        // First, find out what mount index to use (if more than one DB mount exists):
                $mountIndex = 0;
-               $mountKeys = array_flip($BE_USER->returnWebmounts());
+               $mountKeys = array_flip($GLOBALS['BE_USER']->returnWebmounts());
                foreach ($rL as $rLDat) {
                        if (isset($mountKeys[$rLDat['uid']])) {
                                $mountIndex = $mountKeys[$rLDat['uid']];
@@ -584,8 +581,8 @@ final class t3lib_BEfunc {
                }
 
                        // Write back:
-               $BE_USER->uc['browseTrees']['browsePages'] = serialize($expandedPages);
-               $BE_USER->writeUC();
+               $GLOBALS['BE_USER']->uc['browseTrees']['browsePages'] = serialize($expandedPages);
+               $GLOBALS['BE_USER']->writeUC();
        }
 
        /**
@@ -642,20 +639,19 @@ final class t3lib_BEfunc {
         * @return      array           Array of arrays with excludeFields (fieldname, table:fieldname) from all TCA entries and from FlexForms (fieldname, table:extkey;sheetname;fieldname)
         */
        public static function getExcludeFields() {
-               global $TCA;
                        // All TCA keys:
                $theExcludeArray = Array();
-               $tc_keys = array_keys($TCA);
+               $tc_keys = array_keys($GLOBALS['TCA']);
                foreach ($tc_keys as $table) {
                                // Load table
                        t3lib_div::loadTCA($table);
                                // All field names configured:
-                       if (is_array($TCA[$table]['columns'])) {
-                               $f_keys = array_keys($TCA[$table]['columns']);
+                       if (is_array($GLOBALS['TCA'][$table]['columns'])) {
+                               $f_keys = array_keys($GLOBALS['TCA'][$table]['columns']);
                                foreach ($f_keys as $field) {
-                                       if ($TCA[$table]['columns'][$field]['exclude']) {
+                                       if ($GLOBALS['TCA'][$table]['columns'][$field]['exclude']) {
                                                        // Get Human Readable names of fields and table:
-                                               $Fname = $GLOBALS['LANG']->sl($TCA[$table]['ctrl']['title']) . ': ' . $GLOBALS['LANG']->sl($TCA[$table]['columns'][$field]['label']);
+                                               $Fname = $GLOBALS['LANG']->sl($GLOBALS['TCA'][$table]['ctrl']['title']) . ': ' . $GLOBALS['LANG']->sl($GLOBALS['TCA'][$table]['columns'][$field]['label']);
                                                        // add entry:
                                                $theExcludeArray[] = Array($Fname, $table . ':' . $field);
                                        }
@@ -702,10 +698,9 @@ final class t3lib_BEfunc {
         * Returns an array with explicit Allow/Deny fields.
         * Used for listing these field/value pairs in be_groups forms
         *
-        * @return      array           Array with information from all of $TCA
+        * @return      array           Array with information from all of $GLOBALS['TCA']
         */
        public static function getExplicitAuthFieldValues() {
-               global $TCA;
 
                        // Initialize:
                $adLabel = array(
@@ -715,23 +710,23 @@ final class t3lib_BEfunc {
 
                        // All TCA keys:
                $allowDenyOptions = Array();
-               $tc_keys = array_keys($TCA);
+               $tc_keys = array_keys($GLOBALS['TCA']);
                foreach ($tc_keys as $table) {
 
                                // Load table
                        t3lib_div::loadTCA($table);
 
                                // All field names configured:
-                       if (is_array($TCA[$table]['columns'])) {
-                               $f_keys = array_keys($TCA[$table]['columns']);
+                       if (is_array($GLOBALS['TCA'][$table]['columns'])) {
+                               $f_keys = array_keys($GLOBALS['TCA'][$table]['columns']);
                                foreach ($f_keys as $field) {
-                                       $fCfg = $TCA[$table]['columns'][$field]['config'];
+                                       $fCfg = $GLOBALS['TCA'][$table]['columns'][$field]['config'];
                                        if ($fCfg['type'] == 'select' && $fCfg['authMode']) {
 
                                                        // Check for items:
                                                if (is_array($fCfg['items'])) {
                                                                // Get Human Readable names of fields and table:
-                                                       $allowDenyOptions[$table . ':' . $field]['tableFieldLabel'] = $GLOBALS['LANG']->sl($TCA[$table]['ctrl']['title']) . ': ' . $GLOBALS['LANG']->sl($TCA[$table]['columns'][$field]['label']);
+                                                       $allowDenyOptions[$table . ':' . $field]['tableFieldLabel'] = $GLOBALS['LANG']->sl($GLOBALS['TCA'][$table]['ctrl']['title']) . ': ' . $GLOBALS['LANG']->sl($GLOBALS['TCA'][$table]['columns'][$field]['label']);
 
                                                                // Check for items:
                                                        foreach ($fCfg['items'] as $iVal) {
@@ -797,7 +792,7 @@ final class t3lib_BEfunc {
        }
 
        /**
-        * Determines whether a table is localizable and has the languageField and transOrigPointerField set in $TCA.
+        * Determines whether a table is localizable and has the languageField and transOrigPointerField set in $GLOBALS['TCA'].
         *
         * @param       string          $table: The table to check
         * @return      boolean         Whether a table is localizable
@@ -812,9 +807,9 @@ final class t3lib_BEfunc {
        }
 
        /**
-        * Returns the value of the property localizationMode in the given $config array ($TCA[<table>]['columns'][<field>]['config']).
+        * Returns the value of the property localizationMode in the given $config array ($GLOBALS['TCA'][<table>]['columns'][<field>]['config']).
         * If the table is prepared for localization and no localizationMode is set, 'select' is returned by default.
-        * If the table is not prepared for localization or not defined at all in $TCA, false is returned.
+        * If the table is not prepared for localization or not defined at all in $GLOBALS['TCA'], false is returned.
         *
         * @param       string          $table: The name of the table to lookup in TCA
         * @param       mixed           $fieldOrConfig: The fieldname (string) or the configuration of the field to check (array)
@@ -844,7 +839,7 @@ final class t3lib_BEfunc {
         * Usage: 21
         *
         * @param       integer         Page uid for which to check read-access
-        * @param       string          $perms_clause is typically a value generated with $BE_USER->getPagePermsClause(1);
+        * @param       string          $perms_clause is typically a value generated with $GLOBALS['BE_USER']->getPagePermsClause(1);
         * @return      array           Returns page record if OK, otherwise false.
         */
        public static function readPageAccess($id, $perms_clause) {
@@ -881,16 +876,14 @@ final class t3lib_BEfunc {
         * @return      array
         */
        public static function getTCAtypes($table, $rec, $useFieldNameAsKey = 0) {
-               global $TCA;
-
                t3lib_div::loadTCA($table);
-               if ($TCA[$table]) {
+               if ($GLOBALS['TCA'][$table]) {
 
                                // Get type value:
                        $fieldValue = self::getTCAtypeValue($table, $rec);
 
                                // Get typesConf
-                       $typesConf = $TCA[$table]['types'][$fieldValue];
+                       $typesConf = $GLOBALS['TCA'][$table]['types'][$fieldValue];
 
                                // Get fields list and traverse it
                        $fieldList = explode(',', $typesConf['showitem']);
@@ -899,7 +892,7 @@ final class t3lib_BEfunc {
                                // Traverse fields in types config and parse the configuration into a nice array:
                        foreach ($fieldList as $k => $v) {
                                list($pFieldName, $pAltTitle, $pPalette, $pSpec) = t3lib_div::trimExplode(';', $v);
-                               $defaultExtras = is_array($TCA[$table]['columns'][$pFieldName]) ? $TCA[$table]['columns'][$pFieldName]['defaultExtras'] : '';
+                               $defaultExtras = is_array($GLOBALS['TCA'][$table]['columns'][$pFieldName]) ? $GLOBALS['TCA'][$table]['columns'][$pFieldName]['defaultExtras'] : '';
                                $specConfParts = self::getSpecConfParts($pSpec, $defaultExtras);
 
                                $fieldList[$k] = array(
@@ -923,9 +916,9 @@ final class t3lib_BEfunc {
        }
 
        /**
-        * Returns the "type" value of $rec from $table which can be used to look up the correct "types" rendering section in $TCA
-        * If no "type" field is configured in the "ctrl"-section of the $TCA for the table, zero is used.
-        * If zero is not an index in the "types" section of $TCA for the table, then the $fieldValue returned will default to 1 (no matter if that is an index or not)
+        * Returns the "type" value of $rec from $table which can be used to look up the correct "types" rendering section in $GLOBALS['TCA']
+        * If no "type" field is configured in the "ctrl"-section of the $GLOBALS['TCA'] for the table, zero is used.
+        * If zero is not an index in the "types" section of $GLOBALS['TCA'] for the table, then the $fieldValue returned will default to 1 (no matter if that is an index or not)
         * Usage: 7
         *
         * @param       string          Table name present in TCA
@@ -934,14 +927,13 @@ final class t3lib_BEfunc {
         * @see getTCAtypes()
         */
        public static function getTCAtypeValue($table, $rec) {
-               global $TCA;
 
                        // If no field-value, set it to zero. If there is no type matching the field-value (which now may be zero...) test field-value '1' as default.
                t3lib_div::loadTCA($table);
-               if ($TCA[$table]) {
-                       $field = $TCA[$table]['ctrl']['type'];
+               if ($GLOBALS['TCA'][$table]) {
+                       $field = $GLOBALS['TCA'][$table]['ctrl']['type'];
                        $fieldValue = $field ? ($rec[$field] ? $rec[$field] : 0) : 0;
-                       if (!is_array($TCA[$table]['types'][$fieldValue])) {
+                       if (!is_array($GLOBALS['TCA'][$table]['types'][$fieldValue])) {
                                $fieldValue = 1;
                        }
                        return $fieldValue;
@@ -949,7 +941,7 @@ final class t3lib_BEfunc {
        }
 
        /**
-        * Parses a part of the field lists in the "types"-section of $TCA arrays, namely the "special configuration" at index 3 (position 4)
+        * Parses a part of the field lists in the "types"-section of $GLOBALS['TCA'] arrays, namely the "special configuration" at index 3 (position 4)
         * Elements are splitted by ":" and within those parts, parameters are splitted by "|".
         * Everything is returned in an array and you should rather see it visually than listen to me anymore now...  Check out example in Inside TYPO3
         * Usage: 5
@@ -1705,19 +1697,18 @@ final class t3lib_BEfunc {
         * @param       string          $field is pointing to the field with the list of image files
         * @param       string          Back path prefix for image tag src="" field
         * @param       string          Optional: $thumbScript os by default 'thumbs.php' if you don't set it otherwise
-        * @param       string          Optional: $uploaddir is the directory relative to PATH_site where the image files from the $field value is found (Is by default set to the entry in $TCA for that field! so you don't have to!)
+        * @param       string          Optional: $uploaddir is the directory relative to PATH_site where the image files from the $field value is found (Is by default set to the entry in $GLOBALS['TCA'] for that field! so you don't have to!)
         * @param       boolean         If set, uploaddir is NOT prepended with "../"
         * @param       string          Optional: $tparams is additional attributes for the image tags
         * @param       integer         Optional: $size is [w]x[h] of the thumbnail. 56 is default.
         * @return      string          Thumbnail image tag.
         */
        public static function thumbCode($row, $table, $field, $backPath, $thumbScript = '', $uploaddir = NULL, $abs = 0, $tparams = '', $size = '') {
-               global $TCA;
                        // Load table.
                t3lib_div::loadTCA($table);
 
                        // Find uploaddir automatically
-               $uploaddir = (is_null($uploaddir)) ? $TCA[$table]['columns'][$field]['config']['uploadfolder'] : $uploaddir;
+               $uploaddir = (is_null($uploaddir)) ? $GLOBALS['TCA'][$table]['columns'][$field]['config']['uploadfolder'] : $uploaddir;
                $uploaddir = preg_replace('#/$#', '', $uploaddir);
 
                        // Set thumbs-script:
@@ -1834,11 +1825,10 @@ final class t3lib_BEfunc {
         * @return      string
         */
        public static function titleAttribForPages($row, $perms_clause = '', $includeAttrib = 1) {
-               global $TCA, $LANG;
                $parts = array();
                $parts[] = 'id=' . $row['uid'];
                if ($row['alias']) {
-                       $parts[] = $LANG->sL($TCA['pages']['columns']['alias']['label']) . ' ' . $row['alias'];
+                       $parts[] = $GLOBALS['LANG']->sL($GLOBALS['TCA']['pages']['columns']['alias']['label']) . ' ' . $row['alias'];
                }
                if ($row['pid'] < 0) {
                        $parts[] = 'v#1.' . $row['t3ver_id'];
@@ -1863,7 +1853,7 @@ final class t3lib_BEfunc {
                }
 
                if ($row['doktype'] == t3lib_pageSelect::DOKTYPE_LINK) {
-                       $parts[] = $LANG->sL($TCA['pages']['columns']['url']['label']) . ' ' . $row['url'];
+                       $parts[] = $GLOBALS['LANG']->sL($GLOBALS['TCA']['pages']['columns']['url']['label']) . ' ' . $row['url'];
                } elseif ($row['doktype'] == t3lib_pageSelect::DOKTYPE_SHORTCUT) {
                        if ($perms_clause) {
                                $label = self::getRecordPath(intval($row['shortcut']), $perms_clause, 20);
@@ -1872,10 +1862,10 @@ final class t3lib_BEfunc {
                                $label = $lRec['title'];
                        }
                        if ($row['shortcut_mode'] != t3lib_pageSelect::SHORTCUT_MODE_NONE) {
-                               $label .= ', ' . $LANG->sL($TCA['pages']['columns']['shortcut_mode']['label']) . ' ' .
-                                               $LANG->sL(self::getLabelFromItemlist('pages', 'shortcut_mode', $row['shortcut_mode']));
+                               $label .= ', ' . $GLOBALS['LANG']->sL($GLOBALS['TCA']['pages']['columns']['shortcut_mode']['label']) . ' ' .
+                                               $GLOBALS['LANG']->sL(self::getLabelFromItemlist('pages', 'shortcut_mode', $row['shortcut_mode']));
                        }
-                       $parts[] = $LANG->sL($TCA['pages']['columns']['shortcut']['label']) . ' ' . $label;
+                       $parts[] = $GLOBALS['LANG']->sL($GLOBALS['TCA']['pages']['columns']['shortcut']['label']) . ' ' . $label;
                } elseif ($row['doktype'] == t3lib_pageSelect::DOKTYPE_MOUNTPOINT) {
                        if ($perms_clause) {
                                $label = self::getRecordPath(intval($row['mount_pid']), $perms_clause, 20);
@@ -1883,35 +1873,35 @@ final class t3lib_BEfunc {
                                $lRec = self::getRecordWSOL('pages', intval($row['mount_pid']), 'title');
                                $label = $lRec['title'];
                        }
-                       $parts[] = $LANG->sL($TCA['pages']['columns']['mount_pid']['label']) . ' ' . $label;
+                       $parts[] = $GLOBALS['LANG']->sL($GLOBALS['TCA']['pages']['columns']['mount_pid']['label']) . ' ' . $label;
                        if ($row['mount_pid_ol']) {
-                               $parts[] = $LANG->sL($TCA['pages']['columns']['mount_pid_ol']['label']);
+                               $parts[] = $GLOBALS['LANG']->sL($GLOBALS['TCA']['pages']['columns']['mount_pid_ol']['label']);
                        }
                }
                if ($row['nav_hide']) {
-                       $parts[] = rtrim($LANG->sL($TCA['pages']['columns']['nav_hide']['label']), ':');
+                       $parts[] = rtrim($GLOBALS['LANG']->sL($GLOBALS['TCA']['pages']['columns']['nav_hide']['label']), ':');
                }
                if ($row['hidden']) {
-                       $parts[] = $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.hidden');
+                       $parts[] = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.hidden');
                }
                if ($row['starttime']) {
-                       $parts[] = $LANG->sL($TCA['pages']['columns']['starttime']['label']) . ' ' . self::dateTimeAge($row['starttime'], -1, 'date');
+                       $parts[] = $GLOBALS['LANG']->sL($GLOBALS['TCA']['pages']['columns']['starttime']['label']) . ' ' . self::dateTimeAge($row['starttime'], -1, 'date');
                }
                if ($row['endtime']) {
-                       $parts[] = $LANG->sL($TCA['pages']['columns']['endtime']['label']) . ' ' . self::dateTimeAge($row['endtime'], -1, 'date');
+                       $parts[] = $GLOBALS['LANG']->sL($GLOBALS['TCA']['pages']['columns']['endtime']['label']) . ' ' . self::dateTimeAge($row['endtime'], -1, 'date');
                }
                if ($row['fe_group']) {
                        $fe_groups = array();
                        foreach (t3lib_div::intExplode(',', $row['fe_group']) as $fe_group) {
                                if ($fe_group < 0) {
-                                       $fe_groups[] = $LANG->sL(self::getLabelFromItemlist('pages', 'fe_group', $fe_group));
+                                       $fe_groups[] = $GLOBALS['LANG']->sL(self::getLabelFromItemlist('pages', 'fe_group', $fe_group));
                                } else {
                                        $lRec = self::getRecordWSOL('fe_groups', $fe_group, 'title');
                                        $fe_groups[] = $lRec['title'];
                                }
                        }
                        $label = implode(', ', $fe_groups);
-                       $parts[] = $LANG->sL($TCA['pages']['columns']['fe_group']['label']) . ' ' . $label;
+                       $parts[] = $GLOBALS['LANG']->sL($GLOBALS['TCA']['pages']['columns']['fe_group']['label']) . ' ' . $label;
                }
                $out = htmlspecialchars(implode(' - ', $parts));
                return $includeAttrib ? 'title="' . $out . '"' : $out;
@@ -1980,23 +1970,22 @@ final class t3lib_BEfunc {
        }
 
        /**
-        * Returns the label of the first found entry in an "items" array from $TCA (tablename = $table/fieldname = $col) where the value is $key
+        * Returns the label of the first found entry in an "items" array from $GLOBALS['TCA'] (tablename = $table/fieldname = $col) where the value is $key
         * Usage: 9
         *
-        * @param       string          Table name, present in $TCA
-        * @param       string          Field name, present in $TCA
+        * @param       string          Table name, present in $GLOBALS['TCA']
+        * @param       string          Field name, present in $GLOBALS['TCA']
         * @param       string          items-array value to match
         * @return      string          Label for item entry
         */
        public static function getLabelFromItemlist($table, $col, $key) {
-               global $TCA;
                        // Load full TCA for $table
                t3lib_div::loadTCA($table);
 
                        // Check, if there is an "items" array:
-               if (is_array($TCA[$table]) && is_array($TCA[$table]['columns'][$col]) && is_array($TCA[$table]['columns'][$col]['config']['items'])) {
+               if (is_array($GLOBALS['TCA'][$table]) && is_array($GLOBALS['TCA'][$table]['columns'][$col]) && is_array($GLOBALS['TCA'][$table]['columns'][$col]['config']['items'])) {
                                // Traverse the items-array...
-                       foreach ($TCA[$table]['columns'][$col]['config']['items'] as $k => $v) {
+                       foreach ($GLOBALS['TCA'][$table]['columns'][$col]['config']['items'] as $k => $v) {
                                        // ... and return the first found label where the value was equal to $key
                                if (!strcmp($v[1], $key)) {
                                        return $v[0];
@@ -2010,19 +1999,18 @@ final class t3lib_BEfunc {
         * If $printAllWrap is set (to a "wrap") then it's wrapped around the $col value IF THE COLUMN $col DID NOT EXIST in TCA!, eg. $printAllWrap = '<strong>|</strong>' and the fieldname was 'not_found_field' then the return value would be '<strong>not_found_field</strong>'
         * Usage: 17
         *
-        * @param       string          Table name, present in $TCA
+        * @param       string          Table name, present in $GLOBALS['TCA']
         * @param       string          Field name
         * @param       string          Wrap value - set function description
         * @return      string
         */
        public static function getItemLabel($table, $col, $printAllWrap = '') {
-               global $TCA;
                        // Load full TCA for $table
                t3lib_div::loadTCA($table);
                        // Check if column exists
-               if (is_array($TCA[$table]) && is_array($TCA[$table]['columns'][$col])) {
+               if (is_array($GLOBALS['TCA'][$table]) && is_array($GLOBALS['TCA'][$table]['columns'][$col])) {
                                // Re
-                       return $TCA[$table]['columns'][$col]['label'];
+                       return $GLOBALS['TCA'][$table]['columns'][$col]['label'];
                }
                if ($printAllWrap) {
                        $parts = explode('|', $printAllWrap);
@@ -2042,24 +2030,23 @@ final class t3lib_BEfunc {
         * @return      string
         */
        public static function getRecordTitle($table, $row, $prep = FALSE, $forceResult = TRUE) {
-               global $TCA;
-               if (is_array($TCA[$table])) {
+               if (is_array($GLOBALS['TCA'][$table])) {
 
                                // If configured, call userFunc
-                       if ($TCA[$table]['ctrl']['label_userFunc']) {
+                       if ($GLOBALS['TCA'][$table]['ctrl']['label_userFunc']) {
                                $params['table'] = $table;
                                $params['row'] = $row;
                                $params['title'] = '';
                                        //create NULL-reference
                                $null = NULL;
-                               t3lib_div::callUserFunction($TCA[$table]['ctrl']['label_userFunc'], $params, $null);
+                               t3lib_div::callUserFunction($GLOBALS['TCA'][$table]['ctrl']['label_userFunc'], $params, $null);
                                $t = $params['title'];
                        } else {
 
                                        // No userFunc: Build label
-                               $t = self::getProcessedValue($table, $TCA[$table]['ctrl']['label'], $row[$TCA[$table]['ctrl']['label']], 0, 0, FALSE, $row['uid'], $forceResult);
-                               if ($TCA[$table]['ctrl']['label_alt'] && ($TCA[$table]['ctrl']['label_alt_force'] || !strcmp($t, ''))) {
-                                       $altFields = t3lib_div::trimExplode(',', $TCA[$table]['ctrl']['label_alt'], 1);
+                               $t = self::getProcessedValue($table, $GLOBALS['TCA'][$table]['ctrl']['label'], $row[$GLOBALS['TCA'][$table]['ctrl']['label']], 0, 0, FALSE, $row['uid'], $forceResult);
+                               if ($GLOBALS['TCA'][$table]['ctrl']['label_alt'] && ($GLOBALS['TCA'][$table]['ctrl']['label_alt_force'] || !strcmp($t, ''))) {
+                                       $altFields = t3lib_div::trimExplode(',', $GLOBALS['TCA'][$table]['ctrl']['label_alt'], 1);
                                        $tA = array();
                                        if (!empty($t)) {
                                                $tA[] = $t;
@@ -2068,13 +2055,13 @@ final class t3lib_BEfunc {
                                                $t = trim(strip_tags($row[$fN]));
                                                if (strcmp($t, '')) {
                                                        $t = self::getProcessedValue($table, $fN, $t, 0, 0, FALSE, $row['uid']);
-                                                       if (!$TCA[$table]['ctrl']['label_alt_force']) {
+                                                       if (!$GLOBALS['TCA'][$table]['ctrl']['label_alt_force']) {
                                                                break;
                                                        }
                                                        $tA[] = $t;
                                                }
                                        }
-                                       if ($TCA[$table]['ctrl']['label_alt_force']) {
+                                       if ($GLOBALS['TCA'][$table]['ctrl']['label_alt_force']) {
                                                $t = implode(', ', $tA);
                                        }
                                }
@@ -2148,9 +2135,6 @@ final class t3lib_BEfunc {
         * @return      string
         */
        public static function getProcessedValue($table, $col, $value, $fixed_lgd_chars = 0, $defaultPassthrough = 0, $noRecordLookup = FALSE, $uid = 0, $forceResult = TRUE) {
-               global $TCA;
-               global $TYPO3_CONF_VARS;
-
                if ($col == 'uid') {
                                // no need to load TCA as uid is not in TCA-array
                        return $value;
@@ -2158,17 +2142,17 @@ final class t3lib_BEfunc {
                        // Load full TCA for $table
                t3lib_div::loadTCA($table);
                        // Check if table and field is configured:
-               if (is_array($TCA[$table]) && is_array($TCA[$table]['columns'][$col])) {
+               if (is_array($GLOBALS['TCA'][$table]) && is_array($GLOBALS['TCA'][$table]['columns'][$col])) {
                                // Depending on the fields configuration, make a meaningful output value.
-                       $theColConf = $TCA[$table]['columns'][$col]['config'];
+                       $theColConf = $GLOBALS['TCA'][$table]['columns'][$col]['config'];
 
                        /*****************
                         *HOOK: pre-processing the human readable output from a record
                         ****************/
-                       if (is_array($TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_befunc.php']['preProcessValue'])) {
+                       if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_befunc.php']['preProcessValue'])) {
                                        // create NULL-reference
                                $null = NULL;
-                               foreach ($TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_befunc.php']['preProcessValue'] as $_funcRef) {
+                               foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_befunc.php']['preProcessValue'] as $_funcRef) {
                                        t3lib_div::callUserFunction($_funcRef, $theColConf, $null);
                                }
                        }
@@ -2186,13 +2170,14 @@ final class t3lib_BEfunc {
                                                        if ($noRecordLookup) {
                                                                $MMfield = $theColConf['foreign_table'] . '.uid';
                                                        } else {
-                                                               $MMfields = array($theColConf['foreign_table'] . '.' . $TCA[$theColConf['foreign_table']]['ctrl']['label']);
-                                                               foreach (t3lib_div::trimExplode(',', $TCA[$theColConf['foreign_table']]['ctrl']['label_alt'], 1) as $f) {
+                                                               $MMfields = array($theColConf['foreign_table'] . '.' . $GLOBALS['TCA'][$theColConf['foreign_table']]['ctrl']['label']);
+                                                               foreach (t3lib_div::trimExplode(',', $GLOBALS['TCA'][$theColConf['foreign_table']]['ctrl']['label_alt'], 1) as $f) {
                                                                        $MMfields[] = $theColConf['foreign_table'] . '.' . $f;
                                                                }
                                                                $MMfield = join(',', $MMfields);
                                                        }
 
+                                                       /** @var $dbGroup t3lib_loadDBGroup */
                                                        $dbGroup = t3lib_div::makeInstance('t3lib_loadDBGroup');
                                                        $dbGroup->start($value, $theColConf['foreign_table'], $theColConf['MM'], $uid, $table, $theColConf);
                                                        $selectUids = $dbGroup->tableArray[$theColConf['foreign_table']];
@@ -2222,7 +2207,7 @@ final class t3lib_BEfunc {
                                        } else {
                                                $l = self::getLabelFromItemlist($table, $col, $value);
                                                $l = $GLOBALS['LANG']->sL($l);
-                                               if ($theColConf['foreign_table'] && !$l && $TCA[$theColConf['foreign_table']]) {
+                                               if ($theColConf['foreign_table'] && !$l && $GLOBALS['TCA'][$theColConf['foreign_table']]) {
                                                        if ($noRecordLookup) {
                                                                $l = $value;
                                                        } else {
@@ -2341,11 +2326,10 @@ final class t3lib_BEfunc {
         * @see getProcessedValue()
         */
        public static function getProcessedValueExtra($table, $fN, $fV, $fixed_lgd_chars = 0, $uid = 0, $forceResult = TRUE) {
-               global $TCA;
                $fVnew = self::getProcessedValue($table, $fN, $fV, $fixed_lgd_chars, 1, 0, $uid, $forceResult);
                if (!isset($fVnew)) {
-                       if (is_array($TCA[$table])) {
-                               if ($fN == $TCA[$table]['ctrl']['tstamp'] || $fN == $TCA[$table]['ctrl']['crdate']) {
+                       if (is_array($GLOBALS['TCA'][$table])) {
+                               if ($fN == $GLOBALS['TCA'][$table]['ctrl']['tstamp'] || $fN == $GLOBALS['TCA'][$table]['ctrl']['crdate']) {
                                        $fVnew = self::datetime($fV);
                                } elseif ($fN == 'pid') {
                                        $fVnew = self::getRecordPath($fV, '1=1', 20); // Fetches the path with no regard to the users permissions to select pages.
@@ -2374,48 +2358,47 @@ final class t3lib_BEfunc {
         * Returned as a list ready for query ($prefix can be set to eg. "pages." if you are selecting from the pages table and want the table name prefixed)
         * Usage: 3
         *
-        * @param       string          Table name, present in TCA
+        * @param       string          Table name, present in $GLOBALS['TCA']
         * @param       string          Table prefix
         * @param       array           Preset fields (must include prefix if that is used)
         * @return      string          List of fields.
         */
        public static function getCommonSelectFields($table, $prefix = '', $fields = array()) {
-               global $TCA;
                $fields[] = $prefix . 'uid';
-               $fields[] = $prefix . $TCA[$table]['ctrl']['label'];
+               $fields[] = $prefix . $GLOBALS['TCA'][$table]['ctrl']['label'];
 
-               if ($TCA[$table]['ctrl']['label_alt']) {
-                       $secondFields = t3lib_div::trimExplode(',', $TCA[$table]['ctrl']['label_alt'], 1);
+               if ($GLOBALS['TCA'][$table]['ctrl']['label_alt']) {
+                       $secondFields = t3lib_div::trimExplode(',', $GLOBALS['TCA'][$table]['ctrl']['label_alt'], 1);
                        foreach ($secondFields as $fieldN) {
                                $fields[] = $prefix . $fieldN;
                        }
                }
-               if ($TCA[$table]['ctrl']['versioningWS']) {
+               if ($GLOBALS['TCA'][$table]['ctrl']['versioningWS']) {
                        $fields[] = $prefix . 't3ver_id';
                        $fields[] = $prefix . 't3ver_state';
                        $fields[] = $prefix . 't3ver_wsid';
                        $fields[] = $prefix . 't3ver_count';
                }
 
-               if ($TCA[$table]['ctrl']['selicon_field']) {
-                       $fields[] = $prefix . $TCA[$table]['ctrl']['selicon_field'];
+               if ($GLOBALS['TCA'][$table]['ctrl']['selicon_field']) {
+                       $fields[] = $prefix . $GLOBALS['TCA'][$table]['ctrl']['selicon_field'];
                }
-               if ($TCA[$table]['ctrl']['typeicon_column']) {
-                       $fields[] = $prefix . $TCA[$table]['ctrl']['typeicon_column'];
+               if ($GLOBALS['TCA'][$table]['ctrl']['typeicon_column']) {
+                       $fields[] = $prefix . $GLOBALS['TCA'][$table]['ctrl']['typeicon_column'];
                }
 
-               if (is_array($TCA[$table]['ctrl']['enablecolumns'])) {
-                       if ($TCA[$table]['ctrl']['enablecolumns']['disabled']) {
-                               $fields[] = $prefix . $TCA[$table]['ctrl']['enablecolumns']['disabled'];
+               if (is_array($GLOBALS['TCA'][$table]['ctrl']['enablecolumns'])) {
+                       if ($GLOBALS['TCA'][$table]['ctrl']['enablecolumns']['disabled']) {
+                               $fields[] = $prefix . $GLOBALS['TCA'][$table]['ctrl']['enablecolumns']['disabled'];
                        }
-                       if ($TCA[$table]['ctrl']['enablecolumns']['starttime']) {
-                               $fields[] = $prefix . $TCA[$table]['ctrl']['enablecolumns']['starttime'];
+                       if ($GLOBALS['TCA'][$table]['ctrl']['enablecolumns']['starttime']) {
+                               $fields[] = $prefix . $GLOBALS['TCA'][$table]['ctrl']['enablecolumns']['starttime'];
                        }
-                       if ($TCA[$table]['ctrl']['enablecolumns']['endtime']) {
-                               $fields[] = $prefix . $TCA[$table]['ctrl']['enablecolumns']['endtime'];
+                       if ($GLOBALS['TCA'][$table]['ctrl']['enablecolumns']['endtime']) {
+                               $fields[] = $prefix . $GLOBALS['TCA'][$table]['ctrl']['enablecolumns']['endtime'];
                        }
-                       if ($TCA[$table]['ctrl']['enablecolumns']['fe_group']) {
-                               $fields[] = $prefix . $TCA[$table]['ctrl']['enablecolumns']['fe_group'];
+                       if ($GLOBALS['TCA'][$table]['ctrl']['enablecolumns']['fe_group']) {
+                               $fields[] = $prefix . $GLOBALS['TCA'][$table]['ctrl']['enablecolumns']['fe_group'];
                        }
                }
 
@@ -2490,7 +2473,7 @@ final class t3lib_BEfunc {
 
        /**
         * Returns help-text icon if configured for.
-        * TCA_DESCR must be loaded prior to this function and $BE_USER must
+        * TCA_DESCR must be loaded prior to this function and $GLOBALS['BE_USER'] must
         * have 'edit_showFieldHelp' set to 'icon', otherwise nothing is returned
         * Usage: 6
         *
@@ -2502,13 +2485,11 @@ final class t3lib_BEfunc {
         * @param       string          Table name
         * @param       string          Field name
         * @param       string          Back path
-        * @param       boolean         Force display of icon nomatter BE_USER setting for help
+        * @param       boolean         Force display of icon no matter BE_USER setting for help
         * @return      string          HTML content for a help icon/text
         */
        public static function helpTextIcon($table, $field, $BACK_PATH, $force = 0) {
-               global $TCA_DESCR, $BE_USER;
-
-               if (is_array($TCA_DESCR[$table]) && is_array($TCA_DESCR[$table]['columns'][$field]) && (isset($BE_USER->uc['edit_showFieldHelp']) || $force)) {
+               if (is_array($GLOBALS['TCA_DESCR'][$table]) && is_array($GLOBALS['TCA_DESCR'][$table]['columns'][$field]) && (isset($GLOBALS['BE_USER']->uc['edit_showFieldHelp']) || $force)) {
                        return self::wrapInHelp($table, $field);
                }
        }
@@ -2553,7 +2534,7 @@ final class t3lib_BEfunc {
 
        /**
         * Returns CSH help text (description), if configured for.
-        * TCA_DESCR must be loaded prior to this function and $BE_USER must have "edit_showFieldHelp" set to "text",
+        * $GLOBALS['TCA_DESCR'] must be loaded prior to this function and $GLOBALS['BE_USER'] must have "edit_showFieldHelp" set to "text",
         * otherwise nothing is returned
         * Will automatically call t3lib_BEfunc::helpTextIcon() to get the icon for the text.
         * Usage: 4
@@ -2655,17 +2636,15 @@ final class t3lib_BEfunc {
         * @see helpText(), helpTextIcon()
         */
        public static function cshItem($table, $field, $BACK_PATH, $wrap = '', $onlyIconMode = FALSE, $styleAttrib = '') {
-               global $TCA_DESCR, $LANG, $BE_USER;
-
-               if ($BE_USER->uc['edit_showFieldHelp']) {
-                       $LANG->loadSingleTableDescription($table);
+               if ($GLOBALS['BE_USER']->uc['edit_showFieldHelp']) {
+                       $GLOBALS['LANG']->loadSingleTableDescription($table);
 
-                       if (is_array($TCA_DESCR[$table])) {
+                       if (is_array($GLOBALS['TCA_DESCR'][$table])) {
                                        // Creating CSH icon and short description:
                                $fullText = self::helpText($table, $field, $BACK_PATH, '');
                                $icon = self::helpTextIcon($table, $field, $BACK_PATH);
 
-                               if ($fullText && !$onlyIconMode && $BE_USER->uc['edit_showFieldHelp'] == 'text') {
+                               if ($fullText && !$onlyIconMode && $GLOBALS['BE_USER']->uc['edit_showFieldHelp'] == 'text') {
 
                                                // Additional styles?
                                        $params = $styleAttrib ? ' style="' . $styleAttrib . '"' : '';
@@ -2678,7 +2657,7 @@ final class t3lib_BEfunc {
                                        </tr>
                                        </table>';
 
-                                       $output = $LANG->hscAndCharConv($fullText, FALSE);
+                                       $output = $GLOBALS['LANG']->hscAndCharConv($fullText, FALSE);
                                } else {
                                        $output = $icon;
 
@@ -2968,8 +2947,7 @@ final class t3lib_BEfunc {
         * @see t3lib_BEfunc::getUpdateSignalCode()
         */
        public static function setUpdateSignal($set = '', $params = '') {
-               global $BE_USER;
-               $modData = $BE_USER->getModuleData('t3lib_BEfunc::getUpdateSignal', 'ses');
+               $modData = $GLOBALS['BE_USER']->getModuleData('t3lib_BEfunc::getUpdateSignal', 'ses');
 
                if ($set) {
                        $modData[$set] = array(
@@ -2978,7 +2956,7 @@ final class t3lib_BEfunc {
                } else { // clear the module data
                        $modData = array();
                }
-               $BE_USER->pushModuleData('t3lib_BEfunc::getUpdateSignal', $modData);
+               $GLOBALS['BE_USER']->pushModuleData('t3lib_BEfunc::getUpdateSignal', $modData);
        }
 
 
@@ -3315,7 +3293,7 @@ final class t3lib_BEfunc {
         * Returns select statement for MM relations (as used by TCEFORMs etc)
         * Usage: 3
         *
-        * @param       array           Configuration array for the field, taken from $TCA
+        * @param       array           Configuration array for the field, taken from $GLOBALS['TCA']
         * @param       string          Field name
         * @param       array           TSconfig array from which to get further configuration settings for the field name
         * @param       string          Prefix string for the key "*foreign_table_where" from $fieldValue array
@@ -3324,11 +3302,9 @@ final class t3lib_BEfunc {
         * @see t3lib_transferData::renderRecord(), t3lib_TCEforms::foreignTable()
         */
        public static function exec_foreign_table_where_query($fieldValue, $field = '', $TSconfig = array(), $prefix = '') {
-               global $TCA;
-
                $foreign_table = $fieldValue['config'][$prefix . 'foreign_table'];
                t3lib_div::loadTCA($foreign_table);
-               $rootLevel = $TCA[$foreign_table]['ctrl']['rootLevel'];
+               $rootLevel = $GLOBALS['TCA'][$foreign_table]['ctrl']['rootLevel'];
 
                $fTWHERE = $fieldValue['config'][$prefix . 'foreign_table_where'];
                if (strstr($fTWHERE, '###REC_FIELD_')) {
@@ -3818,12 +3794,10 @@ final class t3lib_BEfunc {
         * @return      array           Array of versions of table/uid
         */
        public static function selectVersionsOfRecord($table, $uid, $fields = '*', $workspace = 0, $includeDeletedRecords = FALSE, $row = NULL) {
-               global $TCA;
-
                $realPid = 0;
                $outputRows = array();
 
-               if ($TCA[$table] && $TCA[$table]['ctrl']['versioningWS']) {
+               if ($GLOBALS['TCA'][$table] && $GLOBALS['TCA'][$table]['ctrl']['versioningWS']) {
 
                        if (is_array($row) && !$includeDeletedRecords) {
                                $row['_CURRENT_VERSION'] = TRUE;
@@ -3890,11 +3864,9 @@ final class t3lib_BEfunc {
         * @see t3lib_page::fixVersioningPid()
         */
        public static function fixVersioningPid($table, &$rr, $ignoreWorkspaceMatch = FALSE) {
-               global $TCA;
-
                if (t3lib_extMgm::isLoaded('version')) {
                                // Check that the input record is an offline version from a table that supports versioning:
-                       if (is_array($rr) && $rr['pid'] == -1 && $TCA[$table]['ctrl']['versioningWS']) {
+                       if (is_array($rr) && $rr['pid'] == -1 && $GLOBALS['TCA'][$table]['ctrl']['versioningWS']) {
 
                                        // Check values for t3ver_oid and t3ver_wsid:
                                if (isset($rr['t3ver_oid']) && isset($rr['t3ver_wsid'])) { // If "t3ver_oid" is already a field, just set this:
@@ -3934,7 +3906,6 @@ final class t3lib_BEfunc {
         * @see fixVersioningPid()
         */
        public static function workspaceOL($table, &$row, $wsid = -99, $unsetMovePointers = FALSE) {
-               global $TCA;
                if (t3lib_extMgm::isLoaded('version')) {
 
                        $previewMovePlaceholders = TRUE; // If this is false the placeholder is shown raw in the backend. I don't know if this move can be useful for users to toggle. Technically it can help debugging...
@@ -3961,7 +3932,7 @@ final class t3lib_BEfunc {
                                if (is_array($wsAlt)) {
 
                                                // Check if this is in move-state:
-                                       if ($previewMovePlaceholders && !$movePldSwap && ($table == 'pages' || (int) $TCA[$table]['ctrl']['versioningWS'] >= 2) && $unsetMovePointers) { // Only for WS ver 2... (moving)
+                                       if ($previewMovePlaceholders && !$movePldSwap && ($table == 'pages' || (int) $GLOBALS['TCA'][$table]['ctrl']['versioningWS'] >= 2) && $unsetMovePointers) { // Only for WS ver 2... (moving)
 
                                                        // If t3ver_state is not found, then find it... (but we like best if it is here...)
                                                if (!isset($wsAlt['t3ver_state'])) {
@@ -4022,9 +3993,7 @@ final class t3lib_BEfunc {
         * @see t3lib_page::movePlhOl()
         */
        public static function movePlhOL($table, &$row) {
-               global $TCA;
-
-               if ($table == 'pages' || (int) $TCA[$table]['ctrl']['versioningWS'] >= 2) { // Only for WS ver 2... (moving)
+               if ($table == 'pages' || (int) $GLOBALS['TCA'][$table]['ctrl']['versioningWS'] >= 2) { // Only for WS ver 2... (moving)
 
                                // If t3ver_move_id or t3ver_state is not found, then find it... (but we like best if it is here...)
                        if (!isset($row['t3ver_move_id']) || !isset($row['t3ver_state'])) {
@@ -4057,10 +4026,8 @@ final class t3lib_BEfunc {
         * @return      array           If found, return record, otherwise false
         */
        public static function getWorkspaceVersionOfRecord($workspace, $table, $uid, $fields = '*') {
-               global $TCA;
-
                if (t3lib_extMgm::isLoaded('version')) {
-                       if ($workspace !== 0 && $TCA[$table] && $TCA[$table]['ctrl']['versioningWS']) {
+                       if ($workspace !== 0 && $GLOBALS['TCA'][$table] && $GLOBALS['TCA'][$table]['ctrl']['versioningWS']) {
 
                                        // Select workspace version of record:
                                $row = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow(
@@ -4239,10 +4206,8 @@ final class t3lib_BEfunc {
         * @return      array           If found, the record, otherwise nothing.
         */
        public static function getMovePlaceholder($table, $uid, $fields = '*') {
-               global $TCA;
-
                $workspace = $GLOBALS['BE_USER']->workspace;
-               if ($workspace !== 0 && $TCA[$table] && (int) $TCA[$table]['ctrl']['versioningWS'] >= 2) {
+               if ($workspace !== 0 && $GLOBALS['TCA'][$table] && (int) $GLOBALS['TCA'][$table]['ctrl']['versioningWS'] >= 2) {
 
                                // Select workspace version of record:
                        $row = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow(
index 6e418cb..515adc7 100644 (file)
@@ -136,15 +136,13 @@ class t3lib_clipboard {
         * @return      void
         */
        function initializeClipboard() {
-               global $BE_USER;
-
                $this->backPath = $GLOBALS['BACK_PATH'];
 
                        // Get data
-               $clipData = $BE_USER->getModuleData('clipboard', $BE_USER->getTSConfigVal('options.saveClipboard') ? '' : 'ses');
+               $clipData = $GLOBALS['BE_USER']->getModuleData('clipboard', $GLOBALS['BE_USER']->getTSConfigVal('options.saveClipboard') ? '' : 'ses');
 
                        // NumberTabs
-               $clNP = $BE_USER->getTSConfigVal('options.clipboardNumberPads');
+               $clNP = $GLOBALS['BE_USER']->getTSConfigVal('options.clipboardNumberPads');
                if (t3lib_div::testInt($clNP) && $clNP >= 0) {
                        $this->numberTabs = t3lib_div::intInRange($clNP, 0, 20);
                }
@@ -288,8 +286,6 @@ class t3lib_clipboard {
         * @return      string          HTML output
         */
        function printClipboard() {
-               global $TBE_TEMPLATE, $LANG;
-
                $out = array();
                $elCount = count($this->elFromTable($this->fileMode ? '_FILE' : ''));
 
@@ -328,7 +324,7 @@ class t3lib_clipboard {
                if ($elCount) {
                        if ($GLOBALS['BE_USER']->jsConfirmation(4)) {
                                $js = "
-                       if(confirm(" . $GLOBALS['LANG']->JScharCode(sprintf($LANG->sL('LLL:EXT:lang/locallang_core.php:mess.deleteClip'), $elCount)) . ")){
+                       if(confirm(" . $GLOBALS['LANG']->JScharCode(sprintf($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:mess.deleteClip'), $elCount)) . ")){
                                window.location.href='" . $this->deleteUrl(0, $this->fileMode ? 1 : 0) . "&redirect='+top.rawurlencode(window.location.href);
                        }
                                        ";
@@ -352,7 +348,7 @@ class t3lib_clipboard {
                                '</td>
                                <td>' .
                                '<a href="' . htmlspecialchars($rmall_url) . '#clip_head">' .
-                               t3lib_iconWorks::getSpriteIcon('actions-document-close', array('title' => $LANG->sL('LLL:EXT:lang/locallang_core.php:buttons.clear', TRUE))) .
+                               t3lib_iconWorks::getSpriteIcon('actions-document-close', array('title' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:buttons.clear', TRUE))) .
                                '</a></td>
                        </tr>';
 
@@ -811,8 +807,7 @@ class t3lib_clipboard {
         * @access private
         */
        function saveClipboard() {
-               global $BE_USER;
-               $BE_USER->pushModuleData('clipboard', $this->clipData);
+               $GLOBALS['BE_USER']->pushModuleData('clipboard', $this->clipData);
        }
 
        /**
index 8b7d9ce..41a9b48 100644 (file)
@@ -277,7 +277,7 @@ class t3lib_DB {
         * Creates and executes a SELECT query, selecting fields ($select) from two/three tables joined
         * Use $mm_table together with $local_table or $foreign_table to select over two tables. Or use all three tables to select the full MM-relation.
         * The JOIN is done with [$local_table].uid <--> [$mm_table].uid_local  / [$mm_table].uid_foreign <--> [$foreign_table].uid
-        * The function is very useful for selecting MM-relations between tables adhering to the MM-format used by TCE (TYPO3 Core Engine). See the section on $TCA in Inside TYPO3 for more details.
+        * The function is very useful for selecting MM-relations between tables adhering to the MM-format used by TCE (TYPO3 Core Engine). See the section on $GLOBALS['TCA'] in Inside TYPO3 for more details.
         *
         * Usage: 12 (spec. ext. sys_action, sys_messages, sys_todos)
         *
index 3c94f64..7d47598 100644 (file)
@@ -4723,7 +4723,7 @@ final class t3lib_div {
 
 
        /**
-        * Loads the $TCA (Table Configuration Array) for the $table
+        * Loads the $GLOBALS['TCA'] (Table Configuration Array) for the $table
         *
         * Requirements:
         * 1) must be configured table (the ctrl-section configured),
@@ -4735,12 +4735,12 @@ final class t3lib_div {
         *
         * Usage: 84
         *
-        * @param       string          Table name for which to load the full TCA array part into the global $TCA
+        * @param       string          Table name for which to load the full TCA array part into $GLOBALS['TCA']
         * @return      void
         */
        public static function loadTCA($table) {
+                       //needed for inclusion of the dynamic config files.
                global $TCA;
-
                if (isset($TCA[$table])) {
                        $tca = &$TCA[$table];
                        if (!$tca['columns']) {
index db06417..95b7f33 100644 (file)
@@ -256,25 +256,25 @@ final class t3lib_extMgm {
         ***************************************/
 
        /**
-        * Adding fields to an existing table definition in $TCA
-        * Adds an array with $TCA column-configuration to the $TCA-entry for that table.
+        * Adding fields to an existing table definition in $GLOBALS['TCA']
+        * Adds an array with $GLOBALS['TCA'] column-configuration to the $GLOBALS['TCA']-entry for that table.
         * This function adds the configuration needed for rendering of the field in TCEFORMS - but it does NOT add the field names to the types lists!
         * So to have the fields displayed you must also call fx. addToAllTCAtypes or manually add the fields to the types list.
         * FOR USE IN ext_tables.php FILES
         * Usage: 4
         *
-        * @param       string          $table is the table name of a table already present in $TCA with a columns section
+        * @param       string          $table is the table name of a table already present in $GLOBALS['TCA'] with a columns section
         * @param       array           $columnArray is the array with the additional columns (typical some fields an extension wants to add)
         * @param       boolean         If $addTofeInterface is true the list of fields are also added to the fe_admin_fieldList.
         * @return      void
         */
        public static function addTCAcolumns($table, $columnArray, $addTofeInterface = 0) {
-               global $TCA;
                t3lib_div::loadTCA($table);
-               if (is_array($columnArray) && is_array($TCA[$table]) && is_array($TCA[$table]['columns'])) {
-                       $TCA[$table]['columns'] = array_merge($TCA[$table]['columns'], $columnArray); // Candidate for t3lib_div::array_merge() if integer-keys will some day make trouble...
+               if (is_array($columnArray) && is_array($GLOBALS['TCA'][$table]) && is_array($GLOBALS['TCA'][$table]['columns'])) {
+                                // Candidate for t3lib_div::array_merge() if integer-keys will some day make trouble...
+                       $GLOBALS['TCA'][$table]['columns'] = array_merge($GLOBALS['TCA'][$table]['columns'], $columnArray);
                        if ($addTofeInterface) {
-                               $TCA[$table]['feInterface']['fe_admin_fieldList'] .= ',' . implode(',', array_keys($columnArray));
+                               $GLOBALS['TCA'][$table]['feInterface']['fe_admin_fieldList'] .= ',' . implode(',', array_keys($columnArray));
                        }
                }
        }
@@ -609,7 +609,7 @@ final class t3lib_extMgm {
         * Generates an array of fields/items with additional information such as e.g. the name of the palette.
         *
         * @param       string          $itemList: List of fields/items to be splitted up
-        *                                               (this mostly reflects the data in $TCA[<table>]['types'][<type>]['showitem'])
+        *                                               (this mostly reflects the data in $GLOBALS['TCA'][<table>]['types'][<type>]['showitem'])
         * @return      array           An array with the names of the fields/items as keys and additional information
         */
        protected static function explodeItemList($itemList) {
@@ -647,8 +647,8 @@ final class t3lib_extMgm {
         * @see         explodeItemList
         * @param       array           $items: The array of fields/items with optional additional information
         * @param       boolean         $useRawData: Use raw data instead of building by using the details (default: false)
-        * @return      string          The list of fields/items which gets used for $TCA[<table>]['types'][<type>]['showitem']
-        *                                               or $TCA[<table>]['palettes'][<palette>]['showitem'] in most cases
+        * @return      string          The list of fields/items which gets used for $GLOBALS['TCA'][<table>]['types'][<type>]['showitem']
+        *                                               or $GLOBALS['TCA'][<table>]['palettes'][<palette>]['showitem'] in most cases
         */
        protected static function generateItemList(array $items, $useRawData = FALSE) {
                $itemParts = array();
@@ -679,9 +679,7 @@ final class t3lib_extMgm {
         * @return      void
         */
        public static function allowTableOnStandardPages($table) {
-               global $PAGES_TYPES;
-
-               $PAGES_TYPES['default']['allowedTables'] .= ',' . $table;
+               $GLOBALS['PAGES_TYPES']['default']['allowedTables'] .= ',' . $table;
        }
 
        /**
@@ -696,13 +694,12 @@ final class t3lib_extMgm {
         * @return      void
         */
        public static function addModule($main, $sub = '', $position = '', $path = '') {
-               global $TBE_MODULES;
-
-               if (isset($TBE_MODULES[$main]) && $sub) { // If there is already a main module by this name:
+               if (isset($GLOBALS['TBE_MODULES'][$main]) && $sub) {
+                       // if there is already a main module by this name:
 
                                // Adding the submodule to the correct position:
                        list($place, $modRef) = t3lib_div::trimExplode(':', $position, 1);
-                       $mods = t3lib_div::trimExplode(',', $TBE_MODULES[$main], 1);
+                       $mods = t3lib_div::trimExplode(',', $GLOBALS['TBE_MODULES'][$main], 1);
                        if (!in_array($sub, $mods)) {
                                switch (strtolower($place)) {
                                        case 'after':
@@ -737,19 +734,19 @@ final class t3lib_extMgm {
                                }
                        }
                                // Re-inserting the submodule list:
-                       $TBE_MODULES[$main] = implode(',', $mods);
+                       $GLOBALS['TBE_MODULES'][$main] = implode(',', $mods);
                } else { // Create new main modules with only one submodule, $sub (or none if $sub is blank)
-                       $TBE_MODULES[$main] = $sub;
+                       $GLOBALS['TBE_MODULES'][$main] = $sub;
                }
 
                        // Adding path:
                if ($path) {
-                       $TBE_MODULES['_PATHS'][$main . ($sub ? '_' . $sub : '')] = $path;
+                       $GLOBALS['TBE_MODULES']['_PATHS'][$main . ($sub ? '_' . $sub : '')] = $path;
                }
        }
 
        /**
-        * Adds a module path to TBE_MODULES for used with the module dispatcher, mod.php
+        * Adds a module path to $GLOBALS['TBE_MODULES'] for used with the module dispatcher, mod.php
         * Used only for modules that are not placed in the main/sub menu hierarchy by the traditional mechanism of addModule()
         * Examples for this is context menu functionality (like import/export) which runs as an independent module through mod.php
         * FOR USE IN ext_tables.php FILES
@@ -760,9 +757,7 @@ final class t3lib_extMgm {
         * @return      void
         */
        public static function addModulePath($name, $path) {
-               global $TBE_MODULES;
-
-               $TBE_MODULES['_PATHS'][$name] = $path;
+               $GLOBALS['TBE_MODULES']['_PATHS'][$name] = $path;
        }
 
        /**
@@ -782,8 +777,7 @@ final class t3lib_extMgm {
         * @see t3lib_SCbase::mergeExternalItems()
         */
        public static function insertModuleFunction($modname, $className, $classPath, $title, $MM_key = 'function', $WS = '') {
-               global $TBE_MODULES_EXT;
-               $TBE_MODULES_EXT[$modname]['MOD_MENU'][$MM_key][$className] = array(
+               $GLOBALS['TBE_MODULES_EXT'][$modname]['MOD_MENU'][$MM_key][$className] = array(
                        'name' => $className,
                        'path' => $classPath,
                        'title' => $title,
@@ -792,7 +786,7 @@ final class t3lib_extMgm {
        }
 
        /**
-        * Adds $content to the default Page TSconfig as set in $TYPO3_CONF_VARS[BE]['defaultPageTSconfig']
+        * Adds $content to the default Page TSconfig as set in $GLOBALS['TYPO3_CONF_VARS'][BE]['defaultPageTSconfig']
         * Prefixed with a [GLOBAL] line
         * FOR USE IN ext_tables.php/ext_localconf.php FILES
         * Usage: 5
@@ -801,12 +795,11 @@ final class t3lib_extMgm {
         * @return      void
         */
        public static function addPageTSConfig($content) {
-               global $TYPO3_CONF_VARS;
-               $TYPO3_CONF_VARS['BE']['defaultPageTSconfig'] .= "\n[GLOBAL]\n" . $content;
+               $GLOBALS['TYPO3_CONF_VARS']['BE']['defaultPageTSconfig'] .= "\n[GLOBAL]\n" . $content;
        }
 
        /**
-        * Adds $content to the default User TSconfig as set in $TYPO3_CONF_VARS[BE]['defaultUserTSconfig']
+        * Adds $content to the default User TSconfig as set in $GLOBALS['TYPO3_CONF_VARS'][BE]['defaultUserTSconfig']
         * Prefixed with a [GLOBAL] line
         * FOR USE IN ext_tables.php/ext_localconf.php FILES
         * Usage: 3
@@ -815,12 +808,11 @@ final class t3lib_extMgm {
         * @return      void
         */
        public static function addUserTSConfig($content) {
-               global $TYPO3_CONF_VARS;
-               $TYPO3_CONF_VARS['BE']['defaultUserTSconfig'] .= "\n[GLOBAL]\n" . $content;
+               $GLOBALS['TYPO3_CONF_VARS']['BE']['defaultUserTSconfig'] .= "\n[GLOBAL]\n" . $content;
        }
 
        /**
-        * Adds a reference to a locallang file with TCA_DESCR labels
+        * Adds a reference to a locallang file with $GLOBALS['TCA_DESCR'] labels
         * FOR USE IN ext_tables.php FILES
         * eg. t3lib_extMgm::addLLrefForTCAdescr('pages', 'EXT:lang/locallang_csh_pages.xml'); for the pages table or t3lib_extMgm::addLLrefForTCAdescr('_MOD_web_layout', 'EXT:cms/locallang_csh_weblayout.php'); for the Web > Page module.
         * Usage: 31
@@ -830,15 +822,14 @@ final class t3lib_extMgm {
         * @return      void
         */
        public static function addLLrefForTCAdescr($tca_descr_key, $file_ref) {
-               global $TCA_DESCR;
                if ($tca_descr_key) {
-                       if (!is_array($TCA_DESCR[$tca_descr_key])) {
-                               $TCA_DESCR[$tca_descr_key] = array();
+                       if (!is_array($GLOBALS['TCA_DESCR'][$tca_descr_key])) {
+                               $GLOBALS['TCA_DESCR'][$tca_descr_key] = array();
                        }
-                       if (!is_array($TCA_DESCR[$tca_descr_key]['refs'])) {
-                               $TCA_DESCR[$tca_descr_key]['refs'] = array();
+                       if (!is_array($GLOBALS['TCA_DESCR'][$tca_descr_key]['refs'])) {
+                               $GLOBALS['TCA_DESCR'][$tca_descr_key]['refs'] = array();
                        }
-                       $TCA_DESCR[$tca_descr_key]['refs'][] = $file_ref;
+                       $GLOBALS['TCA_DESCR'][$tca_descr_key]['refs'][] = $file_ref;
                }
        }
 
@@ -889,8 +880,6 @@ final class t3lib_extMgm {
         * @author      René Fritz <r.fritz@colorcube.de>
         */
        public static function addService($extKey, $serviceType, $serviceKey, $info) {
-               global $T3_SERVICES, $TYPO3_CONF_VARS;
-
                        // even not available services will be included to make it possible to give the admin a feedback of non-available services.
                        // but maybe it's better to move non-available services to a different array??
 
@@ -901,37 +890,42 @@ final class t3lib_extMgm {
 
                        $info['priority'] = max(0, min(100, $info['priority']));
 
-                       $T3_SERVICES[$serviceType][$serviceKey] = $info;
+                       $GLOBALS['T3_SERVICES'][$serviceType][$serviceKey] = $info;
 
-                       $T3_SERVICES[$serviceType][$serviceKey]['extKey'] = $extKey;
-                       $T3_SERVICES[$serviceType][$serviceKey]['serviceKey'] = $serviceKey;
-                       $T3_SERVICES[$serviceType][$serviceKey]['serviceType'] = $serviceType;
+                       $GLOBALS['T3_SERVICES'][$serviceType][$serviceKey]['extKey'] = $extKey;
+                       $GLOBALS['T3_SERVICES'][$serviceType][$serviceKey]['serviceKey'] = $serviceKey;
+                       $GLOBALS['T3_SERVICES'][$serviceType][$serviceKey]['serviceType'] = $serviceType;
 
 
                                // mapping a service key to a service type
                                // all service keys begin with tx_ - service types don't
                                // this way a selection of a special service key as service type is easy
-                       $T3_SERVICES[$serviceKey][$serviceKey] = &$T3_SERVICES[$serviceType][$serviceKey];
+                       $GLOBALS['T3_SERVICES'][$serviceKey][$serviceKey] = &$GLOBALS['T3_SERVICES'][$serviceType][$serviceKey];
 
 
-                               // change the priority (and other values) from TYPO3_CONF_VARS
-                               // $TYPO3_CONF_VARS['T3_SERVICES'][$serviceType][$serviceKey]['priority']
+                               // change the priority (and other values) from $GLOBALS['TYPO3_CONF_VARS']
+                               // $GLOBALS['TYPO3_CONF_VARS']['T3_SERVICES'][$serviceType][$serviceKey]['priority']
                                // even the activation is possible (a unix service might be possible on windows for some reasons)
-                       if (is_array($TYPO3_CONF_VARS['T3_SERVICES'][$serviceType][$serviceKey])) {
+                       if (is_array($GLOBALS['TYPO3_CONF_VARS']['T3_SERVICES'][$serviceType][$serviceKey])) {
 
-                                       // no check is done here - there might be configuration values only the service type knows about, so we pass everything
-                               $T3_SERVICES[$serviceType][$serviceKey] = array_merge($T3_SERVICES[$serviceType][$serviceKey], $TYPO3_CONF_VARS['T3_SERVICES'][$serviceType][$serviceKey]);
+                                       // no check is done here - there might be configuration values only the service type knows about, so
+                                       // we pass everything
+                               $GLOBALS['T3_SERVICES'][$serviceType][$serviceKey] = array_merge(
+                                       $GLOBALS['T3_SERVICES'][$serviceType][$serviceKey],
+                                       $GLOBALS['TYPO3_CONF_VARS']['T3_SERVICES'][$serviceType][$serviceKey]
+                               );
                        }
 
 
                                // OS check
                                // empty $os means 'not limited to one OS', therefore a check is not needed
-                       if ($T3_SERVICES[$serviceType][$serviceKey]['available'] && $T3_SERVICES[$serviceType][$serviceKey]['os'] != '') {
+                       if ($GLOBALS['T3_SERVICES'][$serviceType][$serviceKey]['available']
+                               && $GLOBALS['T3_SERVICES'][$serviceType][$serviceKey]['os'] != '') {
 
                                        // TYPO3_OS is not yet defined
                                $os_type = stristr(PHP_OS, 'win') && !stristr(PHP_OS, 'darwin') ? 'WIN' : 'UNIX';
 
-                               $os = t3lib_div::trimExplode(',', strtoupper($T3_SERVICES[$serviceType][$serviceKey]['os']));
+                               $os = t3lib_div::trimExplode(',', strtoupper($GLOBALS['T3_SERVICES'][$serviceType][$serviceKey]['os']));
 
                                if (!in_array($os_type, $os)) {
                                        self::deactivateService($serviceType, $serviceKey);
@@ -939,10 +933,10 @@ final class t3lib_extMgm {
                        }
 
                                // convert subtype list to array for quicker access
-                       $T3_SERVICES[$serviceType][$serviceKey]['serviceSubTypes'] = array();
+                       $GLOBALS['T3_SERVICES'][$serviceType][$serviceKey]['serviceSubTypes'] = array();
                        $serviceSubTypes = t3lib_div::trimExplode(',', $info['subtype']);
                        foreach ($serviceSubTypes as $subtype) {
-                               $T3_SERVICES[$serviceType][$serviceKey]['serviceSubTypes'][$subtype] = $subtype;
+                               $GLOBALS['T3_SERVICES'][$serviceType][$serviceKey]['serviceSubTypes'][$subtype] = $subtype;
                        }
                }
        }
@@ -957,8 +951,6 @@ final class t3lib_extMgm {
         * @author      René Fritz <r.fritz@colorcube.de>
         */
        public static function findService($serviceType, $serviceSubType = '', $excludeServiceKeys = array()) {
-               global $T3_SERVICES, $TYPO3_CONF_VARS;
-
                $serviceKey = FALSE;
                $serviceInfo = FALSE;
                $priority = 0;
@@ -968,8 +960,8 @@ final class t3lib_extMgm {
                        $excludeServiceKeys = t3lib_div::trimExplode(',', $excludeServiceKeys, 1);
                }
 
-               if (is_array($T3_SERVICES[$serviceType])) {
-                       foreach ($T3_SERVICES[$serviceType] as $key => $info) {
+               if (is_array($GLOBALS['T3_SERVICES'][$serviceType])) {
+                       foreach ($GLOBALS['T3_SERVICES'][$serviceType] as $key => $info) {
 
                                if (in_array($key, $excludeServiceKeys)) {
                                        continue;
@@ -1012,7 +1004,7 @@ final class t3lib_extMgm {
                }
 
                if ($serviceKey) {
-                       $serviceInfo = $T3_SERVICES[$serviceType][$serviceKey];
+                       $serviceInfo = $GLOBALS['T3_SERVICES'][$serviceType][$serviceKey];
                }
                return $serviceInfo;
        }
@@ -1026,10 +1018,8 @@ final class t3lib_extMgm {
         * @author      René Fritz <r.fritz@colorcube.de>
         */
        public static function deactivateService($serviceType, $serviceKey) {
-               global $T3_SERVICES;
-
                        // ... maybe it's better to move non-available services to a different array??
-               $T3_SERVICES[$serviceType][$serviceKey]['available'] = FALSE;
+               $GLOBALS['T3_SERVICES'][$serviceType][$serviceKey]['available'] = FALSE;
        }
 
 
@@ -1042,7 +1032,7 @@ final class t3lib_extMgm {
 
        /**
         * Adds an entry to the list of plugins in content elements of type "Insert plugin"
-        * Takes the $itemArray (label, value[,icon]) and adds to the items-array of $TCA[tt_content] elements with CType "listtype" (or another field if $type points to another fieldname)
+        * Takes the $itemArray (label, value[,icon]) and adds to the items-array of $GLOBALS['TCA'][tt_content] elements with CType "listtype" (or another field if $type points to another fieldname)
         * If the value (array pos. 1) is already found in that items-array, the entry is substituted, otherwise the input array is added to the bottom.
         * Use this function to add a frontend plugin to this list of plugin-types - or more generally use this function to add an entry to any selectorbox/radio-button set in the TCEFORMS
         * FOR USE IN ext_tables.php FILES
@@ -1053,22 +1043,20 @@ final class t3lib_extMgm {
         * @return      void
         */
        public static function addPlugin($itemArray, $type = 'list_type') {
-               global $TCA;
-
                $_EXTKEY = $GLOBALS['_EXTKEY'];
                if ($_EXTKEY && !$itemArray[2]) {
                        $itemArray[2] = self::extRelPath($_EXTKEY) . 'ext_icon.gif';
                }
 
                t3lib_div::loadTCA('tt_content');
-               if (is_array($TCA['tt_content']['columns']) && is_array($TCA['tt_content']['columns'][$type]['config']['items'])) {
-                       foreach ($TCA['tt_content']['columns'][$type]['config']['items'] as $k => $v) {
+               if (is_array($GLOBALS['TCA']['tt_content']['columns']) && is_array($GLOBALS['TCA']['tt_content']['columns'][$type]['config']['items'])) {
+                       foreach ($GLOBALS['TCA']['tt_content']['columns'][$type]['config']['items'] as $k => $v) {
                                if (!strcmp($v[1], $itemArray[1])) {
-                                       $TCA['tt_content']['columns'][$type]['config']['items'][$k] = $itemArray;
+                                       $GLOBALS['TCA']['tt_content']['columns'][$type]['config']['items'][$k] = $itemArray;
                                        return;
                                }
                        }
-                       $TCA['tt_content']['columns'][$type]['config']['items'][] = $itemArray;
+                       $GLOBALS['TCA']['tt_content']['columns'][$type]['config']['items'][] = $itemArray;
                }
        }
 
@@ -1084,11 +1072,10 @@ final class t3lib_extMgm {
         * @see addPlugin()
         */
        public static function addPiFlexFormValue($piKeyToMatch, $value, $CTypeToMatch = 'list') {
-               global $TCA;
                t3lib_div::loadTCA('tt_content');
 
-               if (is_array($TCA['tt_content']['columns']) && is_array($TCA['tt_content']['columns']['pi_flexform']['config']['ds'])) {
-                       $TCA['tt_content']['columns']['pi_flexform']['config']['ds'][$piKeyToMatch . ',' . $CTypeToMatch] = $value;
+               if (is_array($GLOBALS['TCA']['tt_content']['columns']) && is_array($GLOBALS['TCA']['tt_content']['columns']['pi_flexform']['config']['ds'])) {
+                       $GLOBALS['TCA']['tt_content']['columns']['pi_flexform']['config']['ds'][$piKeyToMatch . ',' . $CTypeToMatch] = $value;
                }
        }
 
@@ -1104,10 +1091,9 @@ final class t3lib_extMgm {
         * @return      void
         */
        public static function addToInsertRecords($table, $content_table = 'tt_content', $content_field = 'records') {
-               global $TCA;
                t3lib_div::loadTCA($content_table);
-               if (is_array($TCA[$content_table]['columns']) && isset($TCA[$content_table]['columns'][$content_field]['config']['allowed'])) {
-                       $TCA[$content_table]['columns'][$content_field]['config']['allowed'] .= ',' . $table;
+               if (is_array($GLOBALS['TCA'][$content_table]['columns']) && isset($GLOBALS['TCA'][$content_table]['columns'][$content_field]['config']['allowed'])) {
+                       $GLOBALS['TCA'][$content_table]['columns'][$content_field]['config']['allowed'] .= ',' . $table;
                }
        }
 
@@ -1123,7 +1109,7 @@ final class t3lib_extMgm {
         *               "CType" - a new content element type
         *               "header_layout" - an additional header type (added to the selection of layout1-5)
         *               "includeLib" - just includes the library for manual use somewhere in TypoScript.
-        *       (Remember that your $type definition should correspond to the column/items array in $TCA[tt_content] where you added the selector item for the element! See addPlugin() function)
+        *       (Remember that your $type definition should correspond to the column/items array in $GLOBALS['TCA'][tt_content] where you added the selector item for the element! See addPlugin() function)
         * FOR USE IN ext_localconf.php FILES
         * Usage: 2
         *
@@ -1135,7 +1121,6 @@ final class t3lib_extMgm {
         * @return      void
         */
        public static function addPItoST43($key, $classFile = '', $prefix = '', $type = 'list_type', $cached = 0) {
-               global $TYPO3_LOADED_EXT;
                $classFile = $classFile ? $classFile : 'pi/class.tx_' . str_replace('_', '', $key) . $prefix . '.php';
                $cN = self::getCN($key);
 
@@ -1143,7 +1128,7 @@ final class t3lib_extMgm {
                $pluginContent = trim('
 plugin.' . $cN . $prefix . ' = USER' . ($cached ? '' : '_INT') . '
 plugin.' . $cN . $prefix . ' {
-  includeLibs = ' . $TYPO3_LOADED_EXT[$key]['siteRelPath'] . $classFile . '
+  includeLibs = ' . $GLOBALS['TYPO3_LOADED_EXT'][$key]['siteRelPath'] . $classFile . '
   userFunc = ' . $cN . $prefix . '->main
 }');
                self::addTypoScript($key, 'setup', '
@@ -1190,7 +1175,7 @@ tt_content.' . $key . $prefix . ' {
 
        /**
         * Call this method to add an entry in the static template list found in sys_templates
-        * "static template files" are the modern equalent (provided from extensions) to the traditional records in "static_templates"
+        * "static template files" are the modern equivalent (provided from extensions) to the traditional records in "static_templates"
         * FOR USE IN ext_localconf.php FILES
         * Usage: 3
         *
@@ -1201,17 +1186,16 @@ tt_content.' . $key . $prefix . ' {
         * @see addTypoScript()
         */
        public static function addStaticFile($extKey, $path, $title) {
-               global $TCA;
                t3lib_div::loadTCA('sys_template');
-               if ($extKey && $path && is_array($TCA['sys_template']['columns'])) {
+               if ($extKey && $path && is_array($GLOBALS['TCA']['sys_template']['columns'])) {
                        $value = str_replace(',', '', 'EXT:' . $extKey . '/' . $path);
                        $itemArray = array(trim($title . ' (' . $extKey . ')'), $value);
-                       $TCA['sys_template']['columns']['include_static_file']['config']['items'][] = $itemArray;
+                       $GLOBALS['TCA']['sys_template']['columns']['include_static_file']['config']['items'][] = $itemArray;
                }
        }
 
        /**
-        * Adds $content to the default TypoScript setup code as set in $TYPO3_CONF_VARS[FE]['defaultTypoScript_setup']
+        * Adds $content to the default TypoScript setup code as set in $GLOBALS['TYPO3_CONF_VARS'][FE]['defaultTypoScript_setup']
         * Prefixed with a [GLOBAL] line
         * FOR USE IN ext_localconf.php FILES
         * Usage: 6
@@ -1220,12 +1204,11 @@ tt_content.' . $key . $prefix . ' {
         * @return      void
         */
        public static function addTypoScriptSetup($content) {
-               global $TYPO3_CONF_VARS;
-               $TYPO3_CONF_VARS['FE']['defaultTypoScript_setup'] .= "\n[GLOBAL]\n" . $content;
+               $GLOBALS['TYPO3_CONF_VARS']['FE']['defaultTypoScript_setup'] .= "\n[GLOBAL]\n" . $content;
        }
 
        /**
-        * Adds $content to the default TypoScript constants code as set in $TYPO3_CONF_VARS[FE]['defaultTypoScript_constants']
+        * Adds $content to the default TypoScript constants code as set in $GLOBALS['TYPO3_CONF_VARS'][FE]['defaultTypoScript_constants']
         * Prefixed with a [GLOBAL] line
         * FOR USE IN ext_localconf.php FILES
         * Usage: 0
@@ -1234,12 +1217,11 @@ tt_content.' . $key . $prefix . ' {
         * @return      void
         */
        public static function addTypoScriptConstants($content) {
-               global $TYPO3_CONF_VARS;
-               $TYPO3_CONF_VARS['FE']['defaultTypoScript_constants'] .= "\n[GLOBAL]\n" . $content;
+               $GLOBALS['TYPO3_CONF_VARS']['FE']['defaultTypoScript_constants'] .= "\n[GLOBAL]\n" . $content;
        }
 
        /**
-        * Adds $content to the default TypoScript code for either setup, constants or editorcfg as set in $TYPO3_CONF_VARS[FE]['defaultTypoScript_*']
+        * Adds $content to the default TypoScript code for either setup, constants or editorcfg as set in $GLOBALS['TYPO3_CONF_VARS'][FE]['defaultTypoScript_*']
         * (Basically this function can do the same as addTypoScriptSetup and addTypoScriptConstants - just with a little more hazzle, but also with some more options!)
         * FOR USE IN ext_localconf.php FILES
         * Usage: 7
@@ -1251,8 +1233,6 @@ tt_content.' . $key . $prefix . ' {
         * @return      void
         */
        public static function addTypoScript($key, $type, $content, $afterStaticUid = 0) {
-               global $TYPO3_CONF_VARS;
-
                if ($type == 'setup' || $type == 'editorcfg' || $type == 'constants') {
                        $content = '
 
@@ -1263,15 +1243,15 @@ tt_content.' . $key . $prefix . ' {
 
 ' . $content;
                        if ($afterStaticUid) {
-                               $TYPO3_CONF_VARS['FE']['defaultTypoScript_' . $type . '.'][$afterStaticUid] .= $content;
+                               $GLOBALS['TYPO3_CONF_VARS']['FE']['defaultTypoScript_' . $type . '.'][$afterStaticUid] .= $content;
                                        // If 'content (default)' is targeted, also add to other 'content rendering templates', eg. css_styled_content
-                               if ($afterStaticUid == 43 && is_array($TYPO3_CONF_VARS['FE']['contentRenderingTemplates'])) {
-                                       foreach ($TYPO3_CONF_VARS['FE']['contentRenderingTemplates'] as $templateName) {
-                                               $TYPO3_CONF_VARS['FE']['defaultTypoScript_' . $type . '.'][$templateName] .= $content;
+                               if ($afterStaticUid == 43 && is_array($GLOBALS['TYPO3_CONF_VARS']['FE']['contentRenderingTemplates'])) {
+                                       foreach ($GLOBALS['TYPO3_CONF_VARS']['FE']['contentRenderingTemplates'] as $templateName) {
+                                               $GLOBALS['TYPO3_CONF_VARS']['FE']['defaultTypoScript_' . $type . '.'][$templateName] .= $content;
                                        }
                                }
                        } else {
-                               $TYPO3_CONF_VARS['FE']['defaultTypoScript_' . $type] .= $content;
+                               $GLOBALS['TYPO3_CONF_VARS']['FE']['defaultTypoScript_' . $type] .= $content;
                        }
                }
        }
index 382f709..44f0bed 100644 (file)
@@ -179,8 +179,6 @@ class t3lib_extobjbase {
         * @see t3lib_SCbase::checkExtObj()
         */
        function init(&$pObj, $conf) {
-               global $LANG;
-
                $this->pObj = $pObj;
 
                        // Path of this script:
@@ -222,11 +220,10 @@ class t3lib_extobjbase {
         * @return      void
         */
        function incLocalLang() {
-               global $LANG;
                #if ($this->localLangFile && @is_file($this->thisPath.'/'.$this->localLangFile))        {
                #       include($this->thisPath.'/'.$this->localLangFile);
                if ($this->localLangFile && (@is_file($this->thisPath . '/' . $this->localLangFile) || @is_file($this->thisPath . '/' . substr($this->localLangFile, 0, -4) . '.xml'))) {
-                       $LOCAL_LANG = $LANG->includeLLFile($this->thisPath . '/' . $this->localLangFile, FALSE);
+                       $LOCAL_LANG = $GLOBALS['LANG']->includeLLFile($this->thisPath . '/' . $this->localLangFile, FALSE);
                        if (is_array($LOCAL_LANG)) {
                                $GLOBALS['LOCAL_LANG'] = t3lib_div::array_merge_recursive_overrule((array) $GLOBALS['LOCAL_LANG'], $LOCAL_LANG);
                        }
index 232e0b6..5649ed8 100644 (file)
@@ -357,8 +357,6 @@ class t3lib_fullsearch {
         * @return      [type]          ...
         */
        function queryMaker() {
-               global $TCA;
-
                $output = '';
                if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['t3lib_fullsearch'])) {
                        $this->hookArray = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['t3lib_fullsearch'];
@@ -386,7 +384,7 @@ class t3lib_fullsearch {
                $mQ = $GLOBALS['SOBE']->MOD_SETTINGS['search_query_makeQuery'];
 
                        // Make form elements:
-               if ($qGen->table && is_array($TCA[$qGen->table])) {
+               if ($qGen->table && is_array($GLOBALS['TCA'][$qGen->table])) {
                        if ($mQ) {
                                        // Show query
                                $qGen->enablePrefix = 1;
@@ -432,7 +430,6 @@ class t3lib_fullsearch {
         * @return      [type]          ...
         */
        function getQueryResultCode($mQ, $res, $table) {
-               global $TCA;
                $out = '';
                $cPR = array();
                switch ($mQ) {
@@ -444,7 +441,7 @@ class t3lib_fullsearch {
                        case 'all':
                                $rowArr = array();
                                while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
-                                       $rowArr[] = $this->resultRowDisplay($row, $TCA[$table], $table);
+                                       $rowArr[] = $this->resultRowDisplay($row, $GLOBALS['TCA'][$table], $table);
                                        $lrow = $row;
                                }
                                if (is_array($this->hookArray['beforeResultTable'])) {
@@ -453,7 +450,8 @@ class t3lib_fullsearch {
                                        }
                                }
                                if (count($rowArr)) {
-                                       $out .= '<table border="0" cellpadding="2" cellspacing="1" width="100%">' . $this->resultRowTitles($lrow, $TCA[$table], $table) . implode(LF, $rowArr) . '</table>';
+                                       $out .= '<table border="0" cellpadding="2" cellspacing="1" width="100%">' .
+                                                       $this->resultRowTitles($lrow, $GLOBALS['TCA'][$table], $table) . implode(LF, $rowArr) . '</table>';
                                }
                                if (!$out) {
                                        $out = '<em>No rows selected!</em>';
@@ -469,7 +467,7 @@ class t3lib_fullsearch {
                                                $rowArr[] = $this->csvValues(array_keys($row), ',', '');
                                                $first = 0;
                                        }
-                                       $rowArr[] = $this->csvValues($row, ',', '"', $TCA[$table], $table);
+                                       $rowArr[] = $this->csvValues($row, ',', '"', $GLOBALS['TCA'][$table], $table);
                                }
                                if (count($rowArr)) {
                                        $out .= '<textarea name="whatever" rows="20" wrap="off"' . $GLOBALS['SOBE']->doc->formWidthText($this->formW, '', 'off') . ' class="fixed-font">' . t3lib_div::formatForTextarea(implode(LF, $rowArr)) . '</textarea>';
@@ -581,7 +579,6 @@ class t3lib_fullsearch {
         * @return      [type]          ...
         */
        function search() {
-               global $TCA;
                $SET = $GLOBALS['SOBE']->MOD_SETTINGS;
                $swords = $SET['sword'];
 
@@ -589,10 +586,10 @@ class t3lib_fullsearch {
                $limit = 200;
                $showAlways = 0;
                if ($swords) {
-                       foreach ($TCA as $table => $value) {
+                       foreach ($GLOBALS['TCA'] as $table => $value) {
                                        // Get fields list
                                t3lib_div::loadTCA($table);
-                               $conf = $TCA[$table];
+                               $conf = $GLOBALS['TCA'][$table];
 
                                        // avoid querying tables with no columns
                                if (empty($conf['columns'])) {
@@ -699,11 +696,10 @@ class t3lib_fullsearch {
         * @return      [type]          ...
         */
        function getProcessedValueExtra($table, $fN, $fV, $conf, $splitString) {
-               global $TCA;
                        // Analysing the fields in the table.
-               if (is_array($TCA[$table])) {
+               if (is_array($GLOBALS['TCA'][$table])) {
                        t3lib_div::loadTCA($table);
-                       $fC = $TCA[$table]['columns'][$fN];
+                       $fC = $GLOBALS['TCA'][$table]['columns'][$fN];
                        $fields = $fC['config'];
                        $fields['exclude'] = $fC['exclude'];
                        if (is_array($fC) && $fC['label']) {
@@ -925,7 +921,6 @@ class t3lib_fullsearch {
                                        }
                                }
                        }
-                       global $TCA;
                        if (stristr($fieldSetup['allowed'], ',')) {
                                $from_table_Arr = explode(',', $fieldSetup['allowed']);
                                $useTablePrefix = 1;
@@ -965,13 +960,13 @@ class t3lib_fullsearch {
                                        $tablePrefix = $from_table . '_';
                                }
                                $counter = 1;
-                               if (is_array($TCA[$from_table])) {
+                               if (is_array($GLOBALS['TCA'][$from_table])) {
                                        t3lib_div::loadTCA($from_table);
-                                       $labelField = $TCA[$from_table]['ctrl']['label'];
-                                       $altLabelField = $TCA[$from_table]['ctrl']['label_alt'];
-                                       if ($TCA[$from_table]['columns'][$labelField]['config']['items']) {
-                                               reset($TCA[$from_table]['columns'][$labelField]['config']['items']);
-                                               while (list(, $labelArray) = each($TCA[$from_table]['columns'][$labelField]['config']['items'])) {
+                                       $labelField = $GLOBALS['TCA'][$from_table]['ctrl']['label'];
+                                       $altLabelField = $GLOBALS['TCA'][$from_table]['ctrl']['label_alt'];
+                                       if ($GLOBALS['TCA'][$from_table]['columns'][$labelField]['config']['items']) {
+                                               reset($GLOBALS['TCA'][$from_table]['columns'][$labelField]['config']['items']);
+                                               while (list(, $labelArray) = each($GLOBALS['TCA'][$from_table]['columns'][$labelField]['config']['items'])) {
                                                        if (substr($labelArray[0], 0, 4) == 'LLL:') {
                                                                $labelFieldSelect[$labelArray[1]] = $GLOBALS['LANG']->sL($labelArray[0]);
                                                        } else {
@@ -980,9 +975,9 @@ class t3lib_fullsearch {
                                                }
                                                $useSelectLabels = 1;
                                        }
-                                       if ($TCA[$from_table]['columns'][$altLabelField]['config']['items']) {
-                                               reset($TCA[$from_table]['columns'][$altLabelField]['config']['items']);
-                                               foreach ($TCA[$from_table]['columns'][$altLabelField]['config']['items'] as $altLabelArray) {
+                                       if ($GLOBALS['TCA'][$from_table]['columns'][$altLabelField]['config']['items']) {
+                                               reset($GLOBALS['TCA'][$from_table]['columns'][$altLabelField]['config']['items']);
+                                               foreach ($GLOBALS['TCA'][$from_table]['columns'][$altLabelField]['config']['items'] as $altLabelArray) {
                                                        if (substr($altLabelArray[0], 0, 4) == 'LLL:') {
                                                                $altLabelFieldSelect[$altLabelArray[1]] = $GLOBALS['LANG']->sL($altLabelArray[0]);
                                                        } else {
index 541bec4..3565d8e 100644 (file)
@@ -177,13 +177,11 @@ final class t3lib_iconWorks {
         * @see getIconImage()
         */
        public static function getIcon($table, $row = array(), $shaded = FALSE) {
-               global $TCA, $PAGES_TYPES, $ICON_TYPES;
-
                        // Flags:
                $doNotRenderUserGroupNumber = TRUE; // If set, then the usergroup number will NOT be printed unto the icon. NOTICE. the icon is generated only if a default icon for groups is not found... So effectively this is ineffective...
 
                        // Shadow:
-               if ($TCA[$table]['ctrl']['versioningWS']) {
+               if ($GLOBALS['TCA'][$table]['ctrl']['versioningWS']) {
                        switch ((int) $row['t3ver_state']) {
                                case 1:
                                        return 'gfx/i/shadow_hide.png';
@@ -207,15 +205,15 @@ final class t3lib_iconWorks {
                                $row['doktype'] = t3lib_pageSelect::DOKTYPE_HIDE_IN_MENU;
                        } // Workaround to change the icon if "Hide in menu" was set
 
-                       if (!$iconfile = $PAGES_TYPES[$row['doktype']]['icon']) {
-                               $iconfile = $PAGES_TYPES['default']['icon'];
+                       if (!$iconfile = $GLOBALS['PAGES_TYPES'][$row['doktype']]['icon']) {
+                               $iconfile = $GLOBALS['PAGES_TYPES']['default']['icon'];
                        }
-                       if ($row['module'] && $ICON_TYPES[$row['module']]['icon']) {
-                               $iconfile = $ICON_TYPES[$row['module']]['icon'];
+                       if ($row['module'] && $GLOBALS['ICON_TYPES'][$row['module']]['icon']) {
+                               $iconfile = $GLOBALS['ICON_TYPES'][$row['module']]['icon'];
                        }
                } else {
-                       if (!$iconfile = $TCA[$table]['ctrl']['typeicons'][$row[$TCA[$table]['ctrl']['typeicon_column']]]) {
-                               $iconfile = (($TCA[$table]['ctrl']['iconfile']) ? $TCA[$table]['ctrl']['iconfile'] : $table . '.gif');
+                       if (!$iconfile = $GLOBALS['TCA'][$table]['ctrl']['typeicons'][$row[$GLOBALS['TCA'][$table]['ctrl']['typeicon_column']]]) {
+                               $iconfile = (($GLOBALS['TCA'][$table]['ctrl']['iconfile']) ? $GLOBALS['TCA'][$table]['ctrl']['iconfile'] : $table . '.gif');
                        }
                }
 
@@ -242,8 +240,8 @@ final class t3lib_iconWorks {
                        // + $shaded which is also boolean!
 
                        // Icon state based on "enableFields":
-               if (is_array($TCA[$table]['ctrl']['enablecolumns'])) {
-                       $enCols = $TCA[$table]['ctrl']['enablecolumns'];
+               if (is_array($GLOBALS['TCA'][$table]['ctrl']['enablecolumns'])) {
+                       $enCols = $GLOBALS['TCA'][$table]['ctrl']['enablecolumns'];
                                // If "hidden" is enabled:
                        if ($enCols['disabled']) {
                                if ($row[$enCols['disabled']]) {
@@ -280,7 +278,7 @@ final class t3lib_iconWorks {
                }
 
                        // If "deleted" flag is set (only when listing records which are also deleted!)
-               if ($col = $row[$TCA[$table]['ctrl']['delete']]) {
+               if ($col = $row[$GLOBALS['TCA'][$table]['ctrl']['delete']]) {
                        $deleted = TRUE;
                }
                        // Detecting extendToSubpages (for pages only)
index d70609b..aea6a31 100644 (file)
@@ -801,8 +801,6 @@ class t3lib_loadDBGroup {
         * @see t3lib_transferdata::renderRecord()
         */
        function readyForInterface() {
-               global $TCA;
-
                if (!is_array($this->itemArray)) {
                        return FALSE;
                }
@@ -813,7 +811,7 @@ class t3lib_loadDBGroup {
 
                foreach ($this->itemArray as $key => $val) {
                        $theRow = $this->results[$val['table']][$val['id']];
-                       if ($theRow && is_array($TCA[$val['table']])) {
+                       if ($theRow && is_array($GLOBALS['TCA'][$val['table']])) {
                                $label = t3lib_div::fixed_lgd_cs(strip_tags(t3lib_BEfunc::getRecordTitle($val['table'], $theRow)), $titleLen);
                                $label = ($label) ? $label : '[...]';
                                $output[] = str_replace(',', '', $val['table'] . '_' . $val['id'] . '|' . rawurlencode($label));
index d04e799..8f3d692 100644 (file)
@@ -372,8 +372,6 @@ class t3lib_pageSelect {
         * @return      mixed           Returns the input record, possibly overlaid with a translation. But if $OLmode is "hideNonTranslated" then it will return false if no translation is found.
         */
        function getRecordOverlay($table, $row, $sys_language_content, $OLmode = '') {
-               global $TCA;
-
                if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_page.php']['getRecordOverlay'])) {
                        foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_page.php']['getRecordOverlay'] as $classRef) {
                                $hookObject = t3lib_div::getUserObj($classRef);
@@ -386,22 +384,27 @@ class t3lib_pageSelect {
                }
 
                if ($row['uid'] > 0 && $row['pid'] > 0) {
-                       if ($TCA[$table] && $TCA[$table]['ctrl']['languageField'] && $TCA[$table]['ctrl']['transOrigPointerField']) {
-                               if (!$TCA[$table]['ctrl']['transOrigPointerTable']) { // Will not be able to work with other tables (Just didn't implement it yet; Requires a scan over all tables [ctrl] part for first FIND the table that carries localization information for this table (which could even be more than a single table) and then use that. Could be implemented, but obviously takes a little more....)
+                       if ($GLOBALS['TCA'][$table] && $GLOBALS['TCA'][$table]['ctrl']['languageField']
+                               && $GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField']) {
+                               if (!$GLOBALS['TCA'][$table]['ctrl']['transOrigPointerTable']) {
+                                               // Will not be able to work with other tables (Just didn't implement it yet; Requires a scan
+                                               // over all tables [ctrl] part for first FIND the table that carries localization information for
+                                               // this table (which could even be more than a single table) and then use that. Could be
+                                               // implemented, but obviously takes a little more....)
 
                                                // Will try to overlay a record only if the sys_language_content value is larger than zero.
                                        if ($sys_language_content > 0) {
 
                                                        // Must be default language or [All], otherwise no overlaying:
-                                               if ($row[$TCA[$table]['ctrl']['languageField']] <= 0) {
+                                               if ($row[$GLOBALS['TCA'][$table]['ctrl']['languageField']] <= 0) {
 
                                                                // Select overlay record:
                                                        $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
                                                                '*',
                                                                $table,
                                                                'pid=' . intval($row['pid']) .
-                                                               ' AND ' . $TCA[$table]['ctrl']['languageField'] . '=' . intval($sys_language_content) .
-                                                               ' AND ' . $TCA[$table]['ctrl']['transOrigPointerField'] . '=' . intval($row['uid']) .
+                                                               ' AND ' . $GLOBALS['TCA'][$table]['ctrl']['languageField'] . '=' . intval($sys_language_content) .
+                                                               ' AND ' . $GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField'] . '=' . intval($row['uid']) .
                                                                $this->enableFields($table),
                                                                '',
                                                                '',
@@ -430,17 +433,19 @@ class t3lib_pageSelect {
                                                                                $row['_LOCALIZED_UID'] = $olrow['uid'];
                                                                        }
                                                                }
-                                                       } elseif ($OLmode === 'hideNonTranslated' && $row[$TCA[$table]['ctrl']['languageField']] == 0) { // Unset, if non-translated records should be hidden. ONLY done if the source record really is default language and not [All] in which case it is allowed.
+                                                       } elseif ($OLmode === 'hideNonTranslated' && $row[$GLOBALS['TCA'][$table]['ctrl']['languageField']] == 0) {
+                                                                       // Unset, if non-translated records should be hidden. ONLY done if the source record
+                                                                       // really is default language and not [All] in which case it is allowed.
                                                                unset($row);
                                                        }
 
                                                        // Otherwise, check if sys_language_content is different from the value of the record - that means a japanese site might try to display french content.
-                                               } elseif ($sys_language_content != $row[$TCA[$table]['ctrl']['languageField']]) {
+                                               } elseif ($sys_language_content != $row[$GLOBALS['TCA'][$table]['ctrl']['languageField']]) {
                                                        unset($row);
                                                }
                                        } else {
                                                        // When default language is displayed, we never want to return a record carrying another language!
-                                               if ($row[$TCA[$table]['ctrl']['languageField']] > 0) {
+                                               if ($row[$GLOBALS['TCA'][$table]['ctrl']['languageField']] > 0) {
                                                        unset($row);
                                                }
                                        }
@@ -857,9 +862,8 @@ class t3lib_pageSelect {
         * @return      mixed           Returns array (the record) if OK, otherwise blank/0 (zero)
         */
        function checkRecord($table, $uid, $checkPage = 0) {
-               global $TCA;
                $uid = intval($uid);
-               if (is_array($TCA[$table]) && $uid > 0) {
+               if (is_array($GLOBALS['TCA'][$table]) && $uid > 0) {
                        $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', $table, 'uid = ' . $uid . $this->enableFields($table));
                        $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
                        $GLOBALS['TYPO3_DB']->sql_free_result($res);
@@ -894,10 +898,9 @@ class t3lib_pageSelect {
         * @see getPage_noCheck()
         */
        function getRawRecord($table, $uid, $fields = '*', $noWSOL = FALSE) {
-               global $TCA;
                $uid = intval($uid);
                        // Excluding pages here so we can ask the function BEFORE TCA gets initialized. Support for this is followed up in deleteClause()...
-               if ((is_array($TCA[$table]) || $table == 'pages') && $uid > 0) {
+               if ((is_array($GLOBALS['TCA'][$table]) || $table == 'pages') && $uid > 0) {
                        $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery($fields, $table, 'uid = ' . $uid . $this->deleteClause($table));
                        $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
                        $GLOBALS['TYPO3_DB']->sql_free_result($res);
@@ -925,8 +928,7 @@ class t3lib_pageSelect {
         * @return      mixed           Returns array (the record) if found, otherwise nothing (void)
         */
        function getRecordsByField($theTable, $theField, $theValue, $whereClause = '', $groupBy = '', $orderBy = '', $limit = '') {
-               global $TCA;
-               if (is_array($TCA[$theTable])) {
+               if (is_array($GLOBALS['TCA'][$theTable])) {
                        $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
                                '*',
                                $theTable,
@@ -1033,26 +1035,25 @@ class t3lib_pageSelect {
        }
 
        /**
-        * Returns the "AND NOT deleted" clause for the tablename given IF $TCA configuration points to such a field.
+        * Returns the "AND NOT deleted" clause for the tablename given IF $GLOBALS['TCA'] configuration points to such a field.
         *
         * @param       string          Tablename
         * @return      string
         * @see enableFields()
         */
        function deleteClause($table) {
-               global $TCA;
                if (!strcmp($table, 'pages')) { // Hardcode for pages because TCA might not be loaded yet (early frontend initialization)
                        return ' AND pages.deleted=0';
                } else {
-                       return $TCA[$table]['ctrl']['delete'] ? ' AND ' . $table . '.' . $TCA[$table]['ctrl']['delete'] . '=0' : '';
+                       return $GLOBALS['TCA'][$table]['ctrl']['delete'] ? ' AND ' . $table . '.' . $GLOBALS['TCA'][$table]['ctrl']['delete'] . '=0' : '';
                }
        }
 
        /**
         * Returns a part of a WHERE clause which will filter out records with start/end times or hidden/fe_groups fields set to values that should de-select them according to the current time, preview settings or user login. Definitely a frontend function.
-        * Is using the $TCA arrays "ctrl" part where the key "enablefields" determines for each table which of these features applies to that table.
+        * Is using the $GLOBALS['TCA'] arrays "ctrl" part where the key "enablefields" determines for each table which of these features applies to that table.
         *
-        * @param       string          Table name found in the $TCA array
+        * @param       string          Table name found in the $GLOBALS['TCA'] array
         * @param       integer         If $show_hidden is set (0/1), any hidden-fields in records are ignored. NOTICE: If you call this function, consider what to do with the show_hidden parameter. Maybe it should be set? See tslib_cObj->enableFields where it's implemented correctly.
         * @param       array           Array you can pass where keys can be "disabled", "starttime", "endtime", "fe_group" (keys from "enablefields" in TCA) and if set they will make sure that part of the clause is not added. Thus disables the specific part of the clause. For previewing etc.
         * @param       boolean         If set, enableFields will be applied regardless of any versioning preview settings which might otherwise disable enableFields
@@ -1060,8 +1061,6 @@ class t3lib_pageSelect {
         * @see tslib_cObj::enableFields(), deleteClause()
         */
        function enableFields($table, $show_hidden = -1, $ignore_array = array(), $noVersionPreview = FALSE) {
-               global $TYPO3_CONF_VARS;
-
                if ($show_hidden == -1 && is_object($GLOBALS['TSFE'])) { // If show_hidden was not set from outside and if TSFE is an object, set it based on showHiddenPage and showHiddenRecords from TSFE
                        $show_hidden = $table == 'pages' ? $GLOBALS['TSFE']->showHiddenPage : $GLOBALS['TSFE']->showHiddenRecords;
                }
@@ -1105,14 +1104,14 @@ class t3lib_pageSelect {
 
                                                // Call hook functions for additional enableColumns
                                                // It is used by the extension ingmar_accessctrl which enables assigning more than one usergroup to content and page records
-                                       if (is_array($TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_page.php']['addEnableColumns'])) {
+                                       if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_page.php']['addEnableColumns'])) {
                                                $_params = array(
                                                        'table' => $table,
                                                        'show_hidden' => $show_hidden,
                                                        'ignore_array' => $ignore_array,
                                                        'ctrl' => $ctrl
                                                );
-                                               foreach ($TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_page.php']['addEnableColumns'] as $_funcRef) {
+                                               foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_page.php']['addEnableColumns'] as $_funcRef) {
                                                        $query .= t3lib_div::callUserFunction($_funcRef, $_params, $this);
                                                }
                                        }
@@ -1172,9 +1171,9 @@ class t3lib_pageSelect {
         * @see t3lib_BEfunc::fixVersioningPid(), versionOL(), getRootLine()
         */
        function fixVersioningPid($table, &$rr) {
-               global $TCA;
-
-               if ($this->versioningPreview && is_array($rr) && $rr['pid'] == -1 && ($table == 'pages' || $TCA[$table]['ctrl']['versioningWS'])) { // Have to hardcode it for "pages" table since TCA is not loaded at this moment!
+               if ($this->versioningPreview && is_array($rr) && $rr['pid'] == -1
+                       && ($table == 'pages' || $GLOBALS['TCA'][$table]['ctrl']['versioningWS'])) {
+                               // Have to hardcode it for "pages" table since TCA is not loaded at this moment!
 
                                // Check values for t3ver_oid and t3ver_wsid:
                        if (isset($rr['t3ver_oid']) && isset($rr['t3ver_wsid'])) { // If "t3ver_oid" is already a field, just set this:
@@ -1220,8 +1219,6 @@ class t3lib_pageSelect {
         * @see fixVersioningPid(), t3lib_BEfunc::workspaceOL()
         */
        function versionOL($table, &$row, $unsetMovePointers = FALSE, $bypassEnableFieldsCheck = FALSE) {
-               global $TCA;
-
                if ($this->versioningPreview && is_array($row)) {
                        $movePldSwap = $this->movePlhOL($table, $row); // will overlay any movePlhOL found with the real record, which in turn will be overlaid with its workspace version if any.
                        if ($wsAlt = $this->getWorkspaceVersionOfRecord($this->versioningWorkspaceId, $table, $row['uid'], implode(',', array_keys($row)), $bypassEnableFieldsCheck)) { // implode(',',array_keys($row)) = Using fields from original record to make sure no additional fields are selected. This is best for eg. getPageOverlay()
@@ -1281,9 +1278,8 @@ class t3lib_pageSelect {
         * @see t3lib_BEfunc::movePlhOl()
         */
        function movePlhOL($table, &$row) {
-               global $TCA;
-
-               if (($table == 'pages' || (int) $TCA[$table]['ctrl']['versioningWS'] >= 2) && (int) $row['t3ver_state'] === 3) { // Only for WS ver 2... (moving)
+               if (($table == 'pages' || (int) $GLOBALS['TCA'][$table]['ctrl']['versioningWS'] >= 2) && (int) $row['t3ver_state'] === 3) {
+                               // Only for WS ver 2... (moving)
 
                                // If t3ver_move_id is not found, then find it... (but we like best if it is here...)
                        if (!isset($row['t3ver_move_id'])) {
@@ -1317,11 +1313,9 @@ class t3lib_pageSelect {
         * @see t3lib_BEfunc::getMovePlaceholder()
         */
        function getMovePlaceholder($table, $uid, $fields = '*') {
-               global $TCA;
-
                if ($this->versioningPreview) {
                        $workspace = (int) $this->versioningWorkspaceId;
-                       if (($table == 'pages' || (int) $TCA[$table]['ctrl']['versioningWS'] >= 2) && $workspace !== 0) {
+                       if (($table == 'pages' || (int) $GLOBALS['TCA'][$table]['ctrl']['versioningWS'] >= 2) && $workspace !== 0) {
 
                                        // Select workspace version of record:
                                $row = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow(
@@ -1354,9 +1348,8 @@ class t3lib_pageSelect {
         * @see t3lib_befunc::getWorkspaceVersionOfRecord()
         */
        function getWorkspaceVersionOfRecord($workspace, $table, $uid, $fields = '*', $bypassEnableFieldsCheck = FALSE) {
-               global $TCA;
-
-               if ($workspace !== 0 && ($table == 'pages' || $TCA[$table]['ctrl']['versioningWS'])) { // Have to hardcode it for "pages" table since TCA is not loaded at this moment!
+               if ($workspace !== 0 && ($table == 'pages' || $GLOBALS['TCA'][$table]['ctrl']['versioningWS'])) {
+                               // Have to hardcode it for "pages" table since TCA is not loaded at this moment!
 
                                // Setting up enableFields for version record:
                        if ($table == 'pages') {
@@ -1421,7 +1414,8 @@ class t3lib_pageSelect {
                }
                else {
                        if ($wsid > 0) {
-                               $ws = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow('*', 'sys_workspace', 'uid=' . intval($wsid) . ' AND deleted=0'); // No $TCA yet!
+                                       // No $GLOBALS['TCA'] yet!
+                               $ws = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow('*', 'sys_workspace', 'uid=' . intval($wsid) . ' AND deleted=0');
                                if (!is_array($ws)) {
                                        return FALSE;
                                }
index c3cde12..c313a87 100644 (file)
@@ -150,7 +150,7 @@ class t3lib_parsehtml_proc extends t3lib_parsehtml {
         * @return      mixed           On success an array with various information is returned, otherwise a string with an error message
         * @see t3lib_TCEmain, t3lib_transferData
         */
-       function evalWriteFile($pArr, $currentRecord) {
+       public static function evalWriteFile($pArr, $currentRecord) {
 
                        // Write file configuration:
                if (is_array($pArr)) {
index 472bfce..2d8d20c 100644 (file)
@@ -117,10 +117,9 @@ class t3lib_positionMap {
         * @return      string          HTML code for the tree.
         */
        function positionTree($id, $pageinfo, $perms_clause, $R_URI) {
-               global $LANG, $BE_USER;
-
                $code = '';
                        // Make page tree object:
+               /** @var $t3lib_pageTree localPageTree */
                $t3lib_pageTree = t3lib_div::makeInstance('localPageTree');
                $t3lib_pageTree->init(' AND ' . $perms_clause);
                $t3lib_pageTree->addField('pid');
@@ -193,9 +192,14 @@ class t3lib_positionMap {
 
                                // The line with the icon and title:
                        $t_code = '<span class="nobr">' .
-                                         $dat['HTML'] .
-                                         $this->linkPageTitle($this->boldTitle(htmlspecialchars(t3lib_div::fixed_lgd_cs($dat['row']['title'], $BE_USER->uc['titleLen'])), $dat, $id), $dat['row']) .
-                                         '</span><br />';
+                               $dat['HTML'] .
+                               $this->linkPageTitle(
+                                       $this->boldTitle(
+                                               htmlspecialchars(t3lib_div::fixed_lgd_cs($dat['row']['title'], $GLOBALS['BE_USER']->uc['titleLen'])),
+                                               $dat,
+                                               $id),
+                                       $dat['row']
+                               ) . '</span><br />';
                        $code .= $t_code;
                }
 
@@ -300,8 +304,7 @@ class t3lib_positionMap {
         * @return      string          The localized label for "insert new page here"
         */
        function insertlabel() {
-               global $LANG;
-               return $LANG->getLL($this->l_insertNewPageHere, 1);
+               return $GLOBALS['LANG']->getLL($this->l_insertNewPageHere, 1);
        }
 
        /**
@@ -323,10 +326,9 @@ class t3lib_positionMap {
         * @return      boolean
         */
        function checkNewPageInPid($pid) {
-               global $BE_USER;
                if (!isset($this->checkNewPageCache[$pid])) {
                        $pidInfo = t3lib_BEfunc::getRecord('pages', $pid);
-                       $this->checkNewPageCache[$pid] = ($BE_USER->isAdmin() || $BE_USER->doesUserHaveAccess($pidInfo, 8));
+                       $this->checkNewPageCache[$pid] = ($GLOBALS['BE_USER']->isAdmin() || $GLOBALS['BE_USER']->doesUserHaveAccess($pidInfo, 8));
                }
                return $this->checkNewPageCache[$pid];
        }
index 0929003..c85fbae 100644 (file)
@@ -229,27 +229,26 @@ class t3lib_queryGenerator {
         * @return      [type]          ...
         */
        function makeFieldList() {
-               global $TCA;
                $fieldListArr = array();
-               if (is_array($TCA[$this->table])) {
+               if (is_array($GLOBALS['TCA'][$this->table])) {
                        t3lib_div::loadTCA($this->table);
-                       foreach ($TCA[$this->table]['columns'] as $fN => $value) {
+                       foreach ($GLOBALS['TCA'][$this->table]['columns'] as $fN => $value) {
                                $fieldListArr[] = $fN;
                        }
                        $fieldListArr[] = 'uid';
                        $fieldListArr[] = 'pid';
                        $fieldListArr[] = 'deleted';
-                       if ($TCA[$this->table]['ctrl']['tstamp']) {
-                               $fieldListArr[] = $TCA[$this->table]['ctrl']['tstamp'];
+                       if ($GLOBALS['TCA'][$this->table]['ctrl']['tstamp']) {
+                               $fieldListArr[] = $GLOBALS['TCA'][$this->table]['ctrl']['tstamp'];
                        }
-                       if ($TCA[$this->table]['ctrl']['crdate']) {
-                               $fieldListArr[] = $TCA[$this->table]['ctrl']['crdate'];
+                       if ($GLOBALS['TCA'][$this->table]['ctrl']['crdate']) {
+                               $fieldListArr[] = $GLOBALS['TCA'][$this->table]['ctrl']['crdate'];
                        }
-                       if ($TCA[$this->table]['ctrl']['cruser_id']) {
-                               $fieldListArr[] = $TCA[$this->table]['ctrl']['cruser_id'];
+                       if ($GLOBALS['TCA'][$this->table]['ctrl']['cruser_id']) {
+                               $fieldListArr[] = $GLOBALS['TCA'][$this->table]['ctrl']['cruser_id'];
                        }
-                       if ($TCA[$this->table]['ctrl']['sortby']) {
-                               $fieldListArr[] = $TCA[$this->table]['ctrl']['sortby'];
+                       if ($GLOBALS['TCA'][$this->table]['ctrl']['sortby']) {
+                               $fieldListArr[] = $GLOBALS['TCA'][$this->table]['ctrl']['sortby'];
                        }
                }
                return implode(',', $fieldListArr);
@@ -264,10 +263,9 @@ class t3lib_queryGenerator {
         * @return      [type]          ...
         */
        function init($name, $table, $fieldList = '') {
-               global $TCA;
 
                        // Analysing the fields in the table.
-               if (is_array($TCA[$table])) {
+               if (is_array($GLOBALS['TCA'][$table])) {
                        t3lib_div::loadTCA($table);
                        $this->name = $name;
                        $this->table = $table;
@@ -275,7 +273,7 @@ class t3lib_queryGenerator {
 
                        $fieldArr = t3lib_div::trimExplode(',', $this->fieldList, 1);
                        foreach ($fieldArr as $fN) {
-                               $fC = $TCA[$this->table]['columns'][$fN];
+                               $fC = $GLOBALS['TCA'][$this->table]['columns'][$fN];
                                $this->fields[$fN] = $fC['config'];
                                $this->fields[$fN]['exclude'] = $fC['exclude'];
                                if (is_array($fC) && $fC['label']) {
@@ -821,7 +819,6 @@ class t3lib_queryGenerator {
                                        }
                                }
                        }
-                       global $TCA;
                        if (stristr($fieldSetup['allowed'], ',')) {
                                $from_table_Arr = explode(',', $fieldSetup['allowed']);
                                $useTablePrefix = 1;
@@ -861,12 +858,12 @@ class t3lib_queryGenerator {
                                        $tablePrefix = $from_table . '_';
                                }
                                $counter = 1;
-                               if (is_array($TCA[$from_table])) {
+                               if (is_array($GLOBALS['TCA'][$from_table])) {
                                        t3lib_div::loadTCA($from_table);
-                                       $labelField = $TCA[$from_table]['ctrl']['label'];
-                                       $altLabelField = $TCA[$from_table]['ctrl']['label_alt'];
-                                       if ($TCA[$from_table]['columns'][$labelField]['config']['items']) {
-                                               foreach ($TCA[$from_table]['columns'][$labelField]['config']['items'] as $labelArray) {
+                                       $labelField = $GLOBALS['TCA'][$from_table]['ctrl']['label'];
+                                       $altLabelField = $GLOBALS['TCA'][$from_table]['ctrl']['label_alt'];
+                                       if ($GLOBALS['TCA'][$from_table]['columns'][$labelField]['config']['items']) {
+                                               foreach ($GLOBALS['TCA'][$from_table]['columns'][$labelField]['config']['items'] as $labelArray) {
                                                        if (substr($labelArray[0], 0, 4) == 'LLL:') {
                                                                $labelFieldSelect[$labelArray[1]] = $GLOBALS['LANG']->sL($labelArray[0]);
                                                        } else {
@@ -875,8 +872,8 @@ class t3lib_queryGenerator {
                                                }
                                                $useSelectLabels = 1;
                                        }
-                                       if ($TCA[$from_table]['columns'][$altLabelField]['config']['items']) {
-                                               foreach ($TCA[$from_table]['columns'][$altLabelField]['config']['items'] as $altLabelArray) {
+                                       if ($GLOBALS['TCA'][$from_table]['columns'][$altLabelField]['config']['items']) {
+                                               foreach ($GLOBALS['TCA'][$from_table]['columns'][$altLabelField]['config']['items'] as $altLabelArray) {
                                                        if (substr($altLabelArray[0], 0, 4) == 'LLL:') {
                                                                $altLabelFieldSelect[$altLabelArray[1]] = $GLOBALS['LANG']->sL($altLabelArray[0]);
                                                        } else {
@@ -1102,12 +1099,11 @@ class t3lib_queryGenerator {
         * @return      [type]          ...
         */
        function mkTableSelect($name, $cur) {
-               global $TCA;
                $out = '<select name="' . $name . '" onChange="submit();">';
                $out .= '<option value=""></option>';
-               foreach ($TCA as $tN => $value) {
+               foreach ($GLOBALS['TCA'] as $tN => $value) {
                        if ($GLOBALS['BE_USER']->check('tables_select', $tN)) {
-                               $out .= '<option value="' . $tN . '"' . ($tN == $cur ? ' selected' : '') . '>' . $GLOBALS['LANG']->sl($TCA[$tN]['ctrl']['title']) . '</option>';
+                               $out .= '<option value="' . $tN . '"' . ($tN == $cur ? ' selected' : '') . '>' . $GLOBALS['LANG']->sl($GLOBALS['TCA'][$tN]['ctrl']['title']) . '</option>';
                        }
                }
                $out .= '</select>';
@@ -1297,8 +1293,7 @@ class t3lib_queryGenerator {
         * @return      [type]          ...
         */
        function getLabelCol() {
-               global $TCA;
-               return $TCA[$this->table]['ctrl']['label'];
+               return $GLOBALS['TCA'][$this->table]['ctrl']['label'];
        }
 
        /**
index ab3dfe5..9ea3ed4 100644 (file)
@@ -343,7 +343,6 @@ class t3lib_recordList {
         * @return      void
         */
        function initializeLanguages() {
-               global $TCA, $LANG;
 
                        // Look up page overlays:
                $this->pageOverlays = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
index 36cebb6..d8a32cc 100644 (file)
@@ -170,14 +170,12 @@ class t3lib_refindex {
         * Returns array of arrays with an index of all references found in record from table/uid
         * If the result is used to update the sys_refindex table then ->WSOL must NOT be true (no workspace overlay anywhere!)
         *
-        * @param       string          Table name from $TCA
+        * @param       string          Table name from $GLOBALS['TCA']
         * @param       integer         Record UID
         * @return      array           Index Rows
         */
        function generateRefIndexData($table, $uid) {
-               global $TCA;
-
-               if (isset($TCA[$table])) {
+               if (isset($GLOBALS['TCA'][$table])) {
                                // Get raw record from DB:
                        $record = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow('*', $table, 'uid=' . intval($uid));
 
@@ -188,7 +186,7 @@ class t3lib_refindex {
                                $this->words = array();
 
                                        // Deleted:
-                               $deleted = $TCA[$table]['ctrl']['delete'] ? ($record[$TCA[$table]['ctrl']['delete']] ? 1 : 0) : 0;
+                               $deleted = (($GLOBALS['TCA'][$table]['ctrl']['delete'] && $record[$GLOBALS['TCA'][$table]['ctrl']['delete']]) ? 1 : 0);
 
                                        // Get all relations from record:
                                $dbrels = $this->getRelations($table, $record);
@@ -236,7 +234,7 @@ class t3lib_refindex {
 
                                        // Word indexing:
                                t3lib_div::loadTCA($table);
-                               foreach ($TCA[$table]['columns'] as $field => $conf) {
+                               foreach ($GLOBALS['TCA'][$table]['columns'] as $field => $conf) {
                                        if (t3lib_div::inList('input,text', $conf['config']['type']) && strcmp($record[$field], '') && !t3lib_div::testInt($record[$field])) {
                                                $this->words_strings[$field] = $record[$field];
                                        }
@@ -374,7 +372,6 @@ class t3lib_refindex {
         * @see export_addRecord()
         */
        function getRelations($table, $row, $onlyField = '') {
-               global $TCA;
 
                        // Load full table description
                t3lib_div::loadTCA($table);
@@ -385,8 +382,9 @@ class t3lib_refindex {
 
                $outRow = array();
                foreach ($row as $field => $value) {
-                       if (!in_array($field, $nonFields) && is_array($TCA[$table]['columns'][$field]) && (!$onlyField || $onlyField === $field)) {
-                               $conf = $TCA[$table]['columns'][$field]['config'];
+                       if (!in_array($field, $nonFields) && is_array($GLOBALS['TCA'][$table]['columns'][$field])
+                               && (!$onlyField || $onlyField === $field)) {
+                               $conf = $GLOBALS['TCA'][$table]['columns'][$field]['config'];
 
                                        // Add files
                                if ($result = $this->getRelations_procFiles($value, $conf, $uid)) {
@@ -891,8 +889,6 @@ class t3lib_refindex {
         * @return      array           Header and body status content
         */
        function updateIndex($testOnly, $cli_echo = FALSE) {
-               global $TCA, $TYPO3_DB;
-
                $errors = array();
                $tableNames = array();
                $recCount = 0;
@@ -907,12 +903,12 @@ class t3lib_refindex {
                }
 
                        // Traverse all tables:
-               foreach ($TCA as $tableName => $cfg) {
+               foreach ($GLOBALS['TCA'] as $tableName => $cfg) {
                        $tableNames[] = $tableName;
                        $tableCount++;
 
                                // Traverse all records in tables, including deleted records:
-                       $allRecs = $TYPO3_DB->exec_SELECTgetRows('uid', $tableName, '1=1'); //.t3lib_BEfunc::deleteClause($tableName)
+                       $allRecs = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('uid', $tableName, '1=1'); //.t3lib_BEfunc::deleteClause($tableName)
                        $uidList = array(0);
                        foreach ($allRecs as $recdat) {
                                $refIndexObj = t3lib_div::makeInstance('t3lib_refindex');
@@ -930,8 +926,9 @@ class t3lib_refindex {
                        }
 
                                // Searching lost indexes for this table:
-                       $where = 'tablename=' . $TYPO3_DB->fullQuoteStr($tableName, 'sys_refindex') . ' AND recuid NOT IN (' . implode(',', $uidList) . ')';
-                       $lostIndexes = $TYPO3_DB->exec_SELECTgetRows('hash', 'sys_refindex', $where);
+                       $where = 'tablename=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($tableName, 'sys_refindex') .
+                               ' AND recuid NOT IN (' . implode(',', $uidList) . ')';
+                       $lostIndexes = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('hash', 'sys_refindex', $where);
                        if (count($lostIndexes)) {
                                $Err = 'Table ' . $tableName . ' has ' . count($lostIndexes) . ' lost indexes which are now deleted';
                                $errors[] = $Err;
@@ -939,14 +936,16 @@ class t3lib_refindex {
                                        echo $Err . LF;
                                }
                                if (!$testOnly) {
-                                       $TYPO3_DB->exec_DELETEquery('sys_refindex', $where);
+                                       $GLOBALS['TYPO3_DB']->exec_DELETEquery('sys_refindex', $where);
                                }
                        }
                }
 
                        // Searching lost indexes for non-existing tables:
-               $where = 'tablename NOT IN (' . implode(',', $TYPO3_DB->fullQuoteArray($tableNames, 'sys_refindex')) . ')';
-               $lostTables = $TYPO3_DB->exec_SELECTgetRows('hash', 'sys_refindex', $where);
+               $where = 'tablename NOT IN (' .
+                               implode(',', $GLOBALS['TYPO3_DB']->fullQuoteArray($tableNames, 'sys_refindex')) .
+                                ')';
+               $lostTables = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('hash', 'sys_refindex', $where);
                if (count($lostTables)) {
                        $Err = 'Index table hosted ' . count($lostTables) . ' indexes for non-existing tables, now removed';
                        $errors[] = $Err;
@@ -954,7 +953,7 @@ class t3lib_refindex {
                                echo $Err . LF;
                        }
                        if (!$testOnly) {
-                               $TYPO3_DB->exec_DELETEquery('sys_refindex', $where);
+                               $GLOBALS['TYPO3_DB']->exec_DELETEquery('sys_refindex', $where);
                        }
                }
 
index e17483d..06ab6a9 100644 (file)
@@ -65,8 +65,8 @@
  *              require ('conf.php');
  *              require ($BACK_PATH.'init.php');
  *              require ($BACK_PATH.'template.php');
- *              $LANG->includeLLFile('EXT:prototype/locallang.php');
- *              $BE_USER->modAccess($MCONF,1);
+ *              $GLOBALS['LANG']->includeLLFile('EXT:prototype/locallang.php');
+ *              $GLOBALS['BE_USER']->modAccess($MCONF,1);
  *
  *                      // SC_mod_prototype EXTENDS THE CLASS t3lib_SCbase with a main() and printContent() function:
  *              class SC_mod_prototype extends t3lib_SCbase {
index f93d824..5092665 100644 (file)
@@ -663,7 +663,10 @@ class t3lib_softrefproc {
                                        $finalTagParts['filepath'] = rawurldecode($splitLinkParam[0]);
                                        $finalTagParts['query'] = $splitLinkParam[1];
                                }
-                       } else { // integer or alias (alias is without slashes or periods or commas, that is 'nospace,alphanum_x,lower,unique' according to definition in $TCA!)
+                       } else {
+                                       // integer or alias (alias is without slashes or periods or commas, that is
+                                       // 'nospace,alphanum_x,lower,unique' according to definition in $GLOBALS['TCA']!)
+
                                $finalTagParts['LINK_TYPE'] = 'page';
 
                                $link_params_parts = explode('#', $link_param);
index 16c5048..60973ed 100644 (file)
@@ -197,7 +197,7 @@ class t3lib_TCEforms {
        var $loadMD5_JS = 1;
        var $prevBorderStyle = '[nothing here...]'; // Something unique...
        var $allowUpload = 0; // If set direct upload fields will be shown
-       var $titleLen = 15; // @deprecated since TYPO3 4.1: $BE_USER->uc['titleLen'] but what is default??
+       var $titleLen = 15; // @deprecated since TYPO3 4.1: $GLOBALS['BE_USER']->uc['titleLen'] but what is default??
        var $defaultLanguageData = array(); // Array where records in the default language is stored. (processed by transferdata)
        var $defaultLanguageData_diff = array(); // Array where records in the default language is stored (raw without any processing. used for making diff)
        var $additionalPreviewLanguageData = array();
@@ -374,15 +374,14 @@ class t3lib_TCEforms {
         * @return      void
         */
        function initDefaultBEmode() {
-               global $BE_USER;
                $this->prependFormFieldNames = 'data';
                $this->formName = 'editform';
                $this->setNewBEDesign();
-               $this->docLarge = $BE_USER->uc['edit_wideDocument'] ? 1 : 0;
-               $this->edit_showFieldHelp = $BE_USER->uc['edit_showFieldHelp'];
+               $this->docLarge = ($GLOBALS['BE_USER']->uc['edit_wideDocument'] ? 1 : 0);
+               $this->edit_showFieldHelp = $GLOBALS['BE_USER']->uc['edit_showFieldHelp'];
 
-               $this->edit_docModuleUpload = $BE_USER->uc['edit_docModuleUpload'];
-               $this->titleLen = $BE_USER->uc['titleLen']; // @deprecated since TYPO3 4.1
+               $this->edit_docModuleUpload = $GLOBALS['BE_USER']->uc['edit_docModuleUpload'];
+               $this->titleLen = $GLOBALS['BE_USER']->uc['titleLen']; // @deprecated since TYPO3 4.1
 
                $this->inline->init($this);
                $this->suggest->init($this);
@@ -407,13 +406,11 @@ class t3lib_TCEforms {
         * @see getMainFields()
         */
        function getSoloField($table, $row, $theFieldToReturn) {
-               global $TCA;
-
-               if ($TCA[$table]) {
+               if ($GLOBALS['TCA'][$table]) {
                        t3lib_div::loadTCA($table);
                        $typeNum = $this->getRTypeNum($table, $row);
-                       if ($TCA[$table]['types'][$typeNum]) {
-                               $itemList = $TCA[$table]['types'][$typeNum]['showitem'];
+                       if ($GLOBALS['TCA'][$table]['types'][$typeNum]) {
+                               $itemList = $GLOBALS['TCA'][$table]['types'][$typeNum]['showitem'];
                                if ($itemList) {
                                        $fields = t3lib_div::trimExplode(',', $itemList, 1);
                                        $excludeElements = $this->excludeElements = $this->getExcludeElements($table, $row, $typeNum);
@@ -423,7 +420,7 @@ class t3lib_TCEforms {
 
                                                $theField = trim($parts[0]);
                                                if (!in_array($theField, $excludeElements) && !strcmp($theField, $theFieldToReturn)) {
-                                                       if ($TCA[$table]['columns'][$theField]) {
+                                                       if ($GLOBALS['TCA'][$table]['columns'][$theField]) {
                                                                $sField = $this->getSingleField($table, $theField, $row, $parts[1], 1, $parts[3], $parts[2]);
                                                                return $sField['ITEM'];
                                                        }
@@ -445,8 +442,6 @@ class t3lib_TCEforms {
         * @see getSoloField()
         */
        function getMainFields($table, $row, $depth = 0) {
-               global $TCA, $TYPO3_CONF_VARS;
-
                $this->renderDepth = $depth;
 
                        // Init vars:
@@ -467,13 +462,13 @@ class t3lib_TCEforms {
                        }
                }
 
-               if ($TCA[$table]) {
+               if ($GLOBALS['TCA'][$table]) {
 
                                // Load the full TCA for the table.
                        t3lib_div::loadTCA($table);
 
                                // Get dividers2tabs setting from TCA of the current table:
-                       $dividers2tabs =& $TCA[$table]['ctrl']['dividers2tabs'];
+                       $dividers2tabs =& $GLOBALS['TCA'][$table]['ctrl']['dividers2tabs'];
 
                                // Load the description content for the table.
                        if ($this->edit_showFieldHelp || $this->doLoadTableDescr($table)) {
@@ -483,8 +478,8 @@ class t3lib_TCEforms {
                        $typeNum = $this->getRTypeNum($table, $row);
 
                                // Find the list of fields to display:
-                       if ($TCA[$table]['types'][$typeNum]) {
-                               $itemList = $TCA[$table]['types'][$typeNum]['showitem'];
+                       if ($GLOBALS['TCA'][$table]['types'][$typeNum]) {
+                               $itemList = $GLOBALS['TCA'][$table]['types'][$typeNum]['showitem'];
                                if ($itemList) { // If such a list existed...
                                                // Explode the field list and possibly rearrange the order of the fields, if configured for
                                        $fields = t3lib_div::trimExplode(',', $itemList, 1);
@@ -536,7 +531,7 @@ class t3lib_TCEforms {
                                                        // Render the field:
                                                $theField = $parts[0];
                                                if (!in_array($theField, $excludeElements)) {
-                                                       if ($TCA[$table]['columns'][$theField]) {
+                                                       if ($GLOBALS['TCA'][$table]['columns'][$theField]) {
                                                                $sFieldPal = '';
 
                                                                if ($parts[2] && !isset($this->palettesRendered[$this->renderDepth][$table][$parts[2]])) {
@@ -576,7 +571,7 @@ class t3lib_TCEforms {
                                                        } elseif ($theField == '--palette--') {
                                                                if ($parts[2] && !isset($this->palettesRendered[$this->renderDepth][$table][$parts[2]])) {
                                                                                // render a 'header' if not collapsed
-                                                                       if ($TCA[$table]['palettes'][$parts[2]]['canNotCollapse'] AND $parts[1]) {
+                                                                       if ($GLOBALS['TCA'][$table]['palettes'][$parts[2]]['canNotCollapse'] && $parts[1]) {
                                                                                $out_array[$out_sheet][$out_pointer] .= $this->getPaletteFields($table, $row, $parts[2], $this->sL($parts[1]));
                                                                        } else {
                                                                                $out_array[$out_sheet][$out_pointer] .= $this->getPaletteFields($table, $row, $parts[2], '', '', $this->sL($parts[1]));
@@ -606,7 +601,7 @@ class t3lib_TCEforms {
                $this->resetSchemes();
 
                        // Rendering Main palettes, if any
-               $mParr = t3lib_div::trimExplode(',', $TCA[$table]['ctrl']['mainpalette']);
+               $mParr = t3lib_div::trimExplode(',', $GLOBALS['TCA'][$table]['ctrl']['mainpalette']);
                $i = 0;
                if (count($mParr)) {
                        foreach ($mParr as $mP) {
@@ -647,7 +642,9 @@ class t3lib_TCEforms {
                        if (count($parts) > 1) {
                                        // Unset the current level of tab menus:
                                $this->popFromDynNestedStack('tab', $tabIdentStringMD5 . '-' . ($out_sheet + 1));
-                               $dividersToTabsBehaviour = (isset($TCA[$table]['ctrl']['dividers2tabs']) ? $TCA[$table]['ctrl']['dividers2tabs'] : 1);
+                               $dividersToTabsBehaviour = (isset($GLOBALS['TCA'][$table]['ctrl']['dividers2tabs'])
+                                               ? $GLOBALS['TCA'][$table]['ctrl']['dividers2tabs']
+                                               : 1);
                                $output = $this->getDynTabMenu($parts, $tabIdentString, $dividersToTabsBehaviour);
 
                        } else {
@@ -681,8 +678,6 @@ class t3lib_TCEforms {
         * @return      string          TCEform elements in a string.
         */
        function getListedFields($table, $row, $list) {
-               global $TCA;
-
                t3lib_div::loadTCA($table);
                if ($this->edit_showFieldHelp || $this->doLoadTableDescr($table)) {
                        $GLOBALS['LANG']->loadSingleTableDescription($table);
@@ -696,7 +691,7 @@ class t3lib_TCEforms {
                        list($theField, $palFields) = preg_split('/\[|\]/', $theFieldC);
                        $theField = trim($theField);
                        $palFields = trim($palFields);
-                       if ($TCA[$table]['columns'][$theField]) {
+                       if ($GLOBALS['TCA'][$table]['columns'][$theField]) {
                                $parts = t3lib_div::trimExplode(';', $types_fieldConfig[$theField]['origString']);
                                $sField = $this->getSingleField($table, $theField, $row, $parts[1], 0, $parts[3], 0); // Don't sent palette pointer - there are no options anyways for a field-list.
                                $out .= $sField;
@@ -786,7 +781,6 @@ class t3lib_TCEforms {
         * @return      mixed           String (normal) or array (palettes)
         */
        function getSingleField($table, $field, $row, $altName = '', $palette = 0, $extra = '', $pal = 0) {
-               global $TCA, $BE_USER;
 
                        // Hook: getSingleField_preProcess
                foreach ($this->hookObjectsSingleField as $hookObj) {
@@ -802,11 +796,11 @@ class t3lib_TCEforms {
                $PA['extra'] = $extra;
                $PA['pal'] = $pal;
 
-                       // Make sure to load full $TCA array for the table:
+                       // Make sure to load full $GLOBALS['TCA'] array for the table:
                t3lib_div::loadTCA($table);
 
                        // Get the TCA configuration for the current field:
-               $PA['fieldConf'] = $TCA[$table]['columns'][$field];
+               $PA['fieldConf'] = $GLOBALS['TCA'][$table]['columns'][$field];
                $PA['fieldConf']['config']['form_type'] = $PA['fieldConf']['config']['form_type'] ? $PA['fieldConf']['config']['form_type'] : $PA['fieldConf']['config']['type']; // Using "form_type" locally in this script
 
                $skipThisField = $this->inline->skipField($table, $field, $row, $PA['fieldConf']['config']);
@@ -814,12 +808,12 @@ class t3lib_TCEforms {
                        // Now, check if this field is configured and editable (according to excludefields + other configuration)
                if (is_array($PA['fieldConf']) &&
                        !$skipThisField &&
-                       (!$PA['fieldConf']['exclude'] || $BE_USER->check('non_exclude_fields', $table . ':' . $field)) &&
+                       (!$PA['fieldConf']['exclude'] || $GLOBALS['BE_USER']->check('non_exclude_fields', $table . ':' . $field)) &&
                        $PA['fieldConf']['config']['form_type'] != 'passthrough' &&
                        ($this->RTEenabled || !$PA['fieldConf']['config']['showIfRTE']) &&
                        (!$PA['fieldConf']['displayCond'] || $this->isDisplayCondition($PA['fieldConf']['displayCond'], $row)) &&
-                       (!$TCA[$table]['ctrl']['languageField'] || $PA['fieldConf']['l10n_display'] || strcmp($PA['fieldConf']['l10n_mode'], 'exclude') || $row[$TCA[$table]['ctrl']['languageField']] <= 0) &&
-                       (!$TCA[$table]['ctrl']['languageField'] || !$this->localizationMode || $this->localizationMode === $PA['fieldConf']['l10n_cat'])
+                       (!$GLOBALS['TCA'][$table]['ctrl']['languageField'] || $PA['fieldConf']['l10n_display'] || strcmp($PA['fieldConf']['l10n_mode'], 'exclude') || $row[$GLOBALS['TCA'][$table]['ctrl']['languageField']] <= 0) &&
+                       (!$GLOBALS['TCA'][$table]['ctrl']['languageField'] || !$this->localizationMode || $this->localizationMode === $PA['fieldConf']['l10n_cat'])
                ) {
 
 
@@ -838,15 +832,18 @@ class t3lib_TCEforms {
                                $PA['itemFormElID'] = $this->prependFormFieldNames . '_' . $table . '_' . $row['uid'] . '_' . $field;
 
                                        // set field to read-only if configured for translated records to show default language content as readonly
-                               if ($PA['fieldConf']['l10n_display'] && t3lib_div::inList($PA['fieldConf']['l10n_display'], 'defaultAsReadonly') && $row[$TCA[$table]['ctrl']['languageField']] > 0) {
+                               if ($PA['fieldConf']['l10n_display']
+                                       && t3lib_div::inList($PA['fieldConf']['l10n_display'], 'defaultAsReadonly')
+                                       && $row[$GLOBALS['TCA'][$table]['ctrl']['languageField']] > 0) {
                                        $PA['fieldConf']['config']['readOnly'] = true;
                                        $PA['itemFormElValue'] = $this->defaultLanguageData[$table . ':' . $row['uid']][$field];
                                }
 
                                        // Create a JavaScript code line which will ask the user to save/update the form due to changing the element. This is used for eg. "type" fields and others configured with "requestUpdate"
                                if (
-                                       ($TCA[$table]['ctrl']['type'] && !strcmp($field, $TCA[$table]['ctrl']['type'])) ||
-                                       ($TCA[$table]['ctrl']['requestUpdate'] && t3lib_div::inList($TCA[$table]['ctrl']['requestUpdate'], $field))) {
+                                       ($GLOBALS['TCA'][$table]['ctrl']['type'] && !strcmp($field, $GLOBALS['TCA'][$table]['ctrl']['type']))
+                                       || ($GLOBALS['TCA'][$table]['ctrl']['requestUpdate']
+                                               && t3lib_div::inList($GLOBALS['TCA'][$table]['ctrl']['requestUpdate'], $field))) {
                                        if ($GLOBALS['BE_USER']->jsConfirmation(1)) {
                                                $alertMsgOnChange = 'if (confirm(TBE_EDITOR.labels.onChangeAlert) && TBE_EDITOR.checkSubmit(-1)){ TBE_EDITOR.submitForm() };';
                                        } else {
@@ -872,7 +869,9 @@ class t3lib_TCEforms {
                                                }
                                        }
                                                // onFocus attribute to add to the field:
-                                       $PA['onFocus'] = ($palJSfunc && !$BE_USER->uc['dontShowPalettesOnFocusInAB']) ? ' onfocus="' . htmlspecialchars($palJSfunc) . '"' : '';
+                                       $PA['onFocus'] = (($palJSfunc && !$GLOBALS['BE_USER']->uc['dontShowPalettesOnFocusInAB'])
+                                               ? ' onfocus="' . htmlspecialchars($palJSfunc) . '"'
+                                               : '');
 
                                                // Find item
                                        $item = '';
@@ -1498,7 +1497,6 @@ class t3lib_TCEforms {
         * @return      string          The HTML code for the TCEform field
         */
        function getSingleField_typeSelect($table, $field, $row, &$PA) {
-               global $TCA;
 
                        // Field configuration from TCA:
                $config = $PA['fieldConf']['config'];
@@ -1533,7 +1531,9 @@ class t3lib_TCEforms {
                foreach ($selItems as $tk => $p) {
 
                                // Checking languages and authMode:
-                       $languageDeny = $TCA[$table]['ctrl']['languageField'] && !strcmp($TCA[$table]['ctrl']['languageField'], $field) && !$GLOBALS['BE_USER']->checkLanguageAccess($p[1]);
+                       $languageDeny = $GLOBALS['TCA'][$table]['ctrl']['languageField']
+                               && !strcmp($GLOBALS['TCA'][$table]['ctrl']['languageField'], $field)
+                               && !$GLOBALS['BE_USER']->checkLanguageAccess($p[1]);
                        $authModeDeny = $config['form_type'] == 'select' && $config['authMode'] && !$GLOBALS['BE_USER']->checkAuthMode($table, $field, $p[1], $config['authMode']);
                        if (in_array($p[1], $removeItems) || $languageDeny || $authModeDeny) {
                                unset($selItems[$tk]);
@@ -3150,16 +3150,15 @@ class t3lib_TCEforms {
        /**
         * Calculate and return the current "types" pointer value for a record
         *
-        * @param       string          The table name. MUST be in $TCA
+        * @param       string          The table name. MUST be in $GLOBALS['TCA']
         * @param       array           The row from the table, should contain at least the "type" field, if applicable.
-        * @return      string          Return the "type" value for this record, ready to pick a "types" configuration from the $TCA array.
+        * @return      string          Return the "type" value for this record, ready to pick a "types" configuration from the $GLOBALS['TCA'] array.
         */
        function getRTypeNum($table, $row) {
-               global $TCA;
                        // If there is a "type" field configured...
-               if ($TCA[$table]['ctrl']['type']) {
-                       $typeFieldName = $TCA[$table]['ctrl']['type'];
-                       $typeFieldConfig = $TCA[$table]['columns'][$typeFieldName];
+               if ($GLOBALS['TCA'][$table]['ctrl']['type']) {
+                       $typeFieldName = $GLOBALS['TCA'][$table]['ctrl']['type'];
+                       $typeFieldConfig = $GLOBALS['TCA'][$table]['columns'][$typeFieldName];
                        $typeNum = $this->getLanguageOverlayRawValue($table, $row, $typeFieldName, $typeFieldConfig);
                        if (!strcmp($typeNum, '')) {
                                $typeNum = 0;
@@ -3169,7 +3168,8 @@ class t3lib_TCEforms {
                }
 
                $typeNum = (string) $typeNum; // Force to string. Necessary for eg '-1' to be recognized as a type value.
-               if (!$TCA[$table]['types'][$typeNum]) { // However, if the type "0" is not found in the "types" array, then default to "1" (for historical reasons)
+               if (!$GLOBALS['TCA'][$table]['types'][$typeNum]) {
+                               // However, if the type "0" is not found in the "types" array, then default to "1" (for historical reasons)
                        $typeNum = 1;
                }
 
@@ -3202,32 +3202,31 @@ class t3lib_TCEforms {
         * Producing an array of field names NOT to display in the form, based on settings from subtype_value_field, bitmask_excludelist_bits etc.
         * Notice, this list is in NO way related to the "excludeField" flag
         *
-        * @param       string          Table name, MUST be in $TCA
+        * @param       string          Table name, MUST be in $GLOBALS['TCA']
         * @param       array           A record from table.
         * @param       string          A "type" pointer value, probably the one calculated based on the record array.
         * @return      array           Array with fieldnames as values. The fieldnames are those which should NOT be displayed "anyways"
         * @see getMainFields()
         */
        function getExcludeElements($table, $row, $typeNum) {
-               global $TCA;
 
                        // Init:
                $excludeElements = array();
 
                        // If a subtype field is defined for the type
-               if ($TCA[$table]['types'][$typeNum]['subtype_value_field']) {
-                       $sTfield = $TCA[$table]['types'][$typeNum]['subtype_value_field'];
-                       if (trim($TCA[$table]['types'][$typeNum]['subtypes_excludelist'][$row[$sTfield]])) {
-                               $excludeElements = t3lib_div::trimExplode(',', $TCA[$table]['types'][$typeNum]['subtypes_excludelist'][$row[$sTfield]], 1);
+               if ($GLOBALS['TCA'][$table]['types'][$typeNum]['subtype_value_field']) {
+                       $sTfield = $GLOBALS['TCA'][$table]['types'][$typeNum]['subtype_value_field'];
+                       if (trim($GLOBALS['TCA'][$table]['types'][$typeNum]['subtypes_excludelist'][$row[$sTfield]])) {
+                               $excludeElements = t3lib_div::trimExplode(',', $GLOBALS['TCA'][$table]['types'][$typeNum]['subtypes_excludelist'][$row[$sTfield]], 1);
                        }
                }
 
                        // If a bitmask-value field has been configured, then find possible fields to exclude based on that:
-               if ($TCA[$table]['types'][$typeNum]['bitmask_value_field']) {
-                       $sTfield = $TCA[$table]['types'][$typeNum]['bitmask_value_field'];
+               if ($GLOBALS['TCA'][$table]['types'][$typeNum]['bitmask_value_field']) {
+                       $sTfield = $GLOBALS['TCA'][$table]['types'][$typeNum]['bitmask_value_field'];
                        $sTValue = t3lib_div::intInRange($row[$sTfield], 0);
-                       if (is_array($TCA[$table]['types'][$typeNum]['bitmask_excludelist_bits'])) {
-                               foreach ($TCA[$table]['types'][$typeNum]['bitmask_excludelist_bits'] as $bitKey => $eList) {
+                       if (is_array($GLOBALS['TCA'][$table]['types'][$typeNum]['bitmask_excludelist_bits'])) {
+                               foreach ($GLOBALS['TCA'][$table]['types'][$typeNum]['bitmask_excludelist_bits'] as $bitKey => $eList) {
                                        $bit = substr($bitKey, 1);
                                        if (t3lib_div::testInt($bit)) {
                                                $bit = t3lib_div::intInRange($bit, 0, 30);
@@ -3249,23 +3248,22 @@ class t3lib_TCEforms {
        /**
         * Finds possible field to add to the form, based on subtype fields.
         *
-        * @param       string          Table name, MUST be in $TCA
+        * @param       string          Table name, MUST be in $GLOBALS['TCA']
         * @param       array           A record from table.
         * @param       string          A "type" pointer value, probably the one calculated based on the record array.
         * @return      array           An array containing two values: 1) Another array containing fieldnames to add and 2) the subtype value field.
         * @see getMainFields()
         */
        function getFieldsToAdd($table, $row, $typeNum) {
-               global $TCA;
 
                        // Init:
                $addElements = array();
 
                        // If a subtype field is defined for the type
-               if ($TCA[$table]['types'][$typeNum]['subtype_value_field']) {
-                       $sTfield = $TCA[$table]['types'][$typeNum]['subtype_value_field'];
-                       if (trim($TCA[$table]['types'][$typeNum]['subtypes_addlist'][$row[$sTfield]])) {
-                               $addElements = t3lib_div::trimExplode(',', $TCA[$table]['types'][$typeNum]['subtypes_addlist'][$row[$sTfield]], 1);
+               if ($GLOBALS['TCA'][$table]['types'][$typeNum]['subtype_value_field']) {
+                       $sTfield = $GLOBALS['TCA'][$table]['types'][$typeNum]['subtype_value_field'];
+                       if (trim($GLOBALS['TCA'][$table]['types'][$typeNum]['subtypes_addlist'][$row[$sTfield]])) {
+                               $addElements = t3lib_div::trimExplode(',', $GLOBALS['TCA'][$table]['types'][$typeNum]['subtypes_addlist'][$row[$sTfield]], 1);
                        }
                }
                        // Return the return
@@ -3327,9 +3325,9 @@ class t3lib_TCEforms {
         * Overrides the TCA field configuration by TSconfig settings.
         *
         * Example TSconfig: TCEform.<table>.<field>.config.appearance.useSortable = 1
-        * This overrides the setting in $TCA[<table>]['columns'][<field>]['config']['appearance']['useSortable'].
+        * This overrides the setting in $GLOBALS['TCA'][<table>]['columns'][<field>]['config']['appearance']['useSortable'].
         *
-        * @param       array           $fieldConfig: TCA field configuration
+        * @param       array           $fieldConfig: $GLOBALS['TCA'] field configuration
         * @param       array           $TSconfig: TSconfig
         * @return      array           Changed TCA field configuration
         */
@@ -3344,7 +3342,7 @@ class t3lib_TCEforms {
                                                unset($TSconfig['config'][$key]);
                                        }
                                }
-                                       // Override TCA field config by remaining TSconfig['config']:
+                                       // Override $GLOBALS['TCA'] field config by remaining TSconfig['config']:
                                if (count($TSconfig['config'])) {
                                        $fieldConfig = t3lib_div::array_merge_recursive_overrule($fieldConfig, $TSconfig['config']);
                                }
@@ -3402,8 +3400,6 @@ class t3lib_TCEforms {
         * @return      array           The palette elements
         */
        public function loadPaletteElements($table, $row, $palette, $itemList = '') {
-               global $TCA;
-
                t3lib_div::loadTCA($table);
                $parts = array();
 
@@ -3413,8 +3409,8 @@ class t3lib_TCEforms {
                }
 
                        // Load the palette TCEform elements
-               if ($TCA[$table] && (is_array($TCA[$table]['palettes'][$palette]) || $itemList)) {
-                       $itemList = ($itemList ? $itemList : $TCA[$table]['palettes'][$palette]['showitem']);
+               if ($GLOBALS['TCA'][$table] && (is_array($GLOBALS['TCA'][$table]['palettes'][$palette]) || $itemList)) {
+                       $itemList = ($itemList ? $itemList : $GLOBALS['TCA'][$table]['palettes'][$palette]['showitem']);
                        if ($itemList) {
                                $fields = t3lib_div::trimExplode(',', $itemList, 1);
                                foreach ($fields as $info) {
@@ -3422,7 +3418,7 @@ class t3lib_TCEforms {
                                        $theField = $fieldParts[0];
                                        if ($theField === '--linebreak--') {
                                                $parts[]['NAME'] = '--linebreak--';
-                                       } elseif (!in_array($theField, $this->excludeElements) && $TCA[$table]['columns'][$theField]) {
+                                       } elseif (!in_array($theField, $this->excludeElements) && $GLOBALS['TCA'][$table]['columns'][$theField]) {
                                                $this->palFieldArr[$palette][] = $theField;
                                                $elem = $this->getSingleField($table, $theField, $row, $fieldParts[1], 1, '', $fieldParts[2]);
                                                if (is_array($elem)) {
@@ -3452,29 +3448,29 @@ class t3lib_TCEforms {
         * @return      void
         */
        function registerDefaultLanguageData($table, $rec) {
-               global $TCA;
 
                        // Add default language:
-               if ($TCA[$table]['ctrl']['languageField']
-                       && $rec[$TCA[$table]['ctrl']['languageField']] > 0
-                       && $TCA[$table]['ctrl']['transOrigPointerField']
-                       && intval($rec[$TCA[$table]['ctrl']['transOrigPointerField']]) > 0) {
+               if ($GLOBALS['TCA'][$table]['ctrl']['languageField']
+                       && $rec[$GLOBALS['TCA'][$table]['ctrl']['languageField']] > 0
+                       && $GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField']
+                       && intval($rec[$GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField']]) > 0) {
 
-                       $lookUpTable = $TCA[$table]['ctrl']['transOrigPointerTable'] ? $TCA[$table]['ctrl']['transOrigPointerTable'] : $table;
+                       $lookUpTable = $GLOBALS['TCA'][$table]['ctrl']['transOrigPointerTable'] ? $GLOBALS['TCA'][$table]['ctrl']['transOrigPointerTable'] : $table;
 
                                // Get data formatted:
-                       $this->defaultLanguageData[$table . ':' . $rec['uid']] = t3lib_BEfunc::getRecordWSOL($lookUpTable, intval($rec[$TCA[$table]['ctrl']['transOrigPointerField']]));
+                       $this->defaultLanguageData[$table . ':' . $rec['uid']] = t3lib_BEfunc::getRecordWSOL($lookUpTable, intval($rec[$GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField']]));
 
                                // Get data for diff:
-                       if ($TCA[$table]['ctrl']['transOrigDiffSourceField']) {
-                               $this->defaultLanguageData_diff[$table . ':' . $rec['uid']] = unserialize($rec[$TCA[$table]['ctrl']['transOrigDiffSourceField']]);
+                       if ($GLOBALS['TCA'][$table]['ctrl']['transOrigDiffSourceField']) {
+                               $this->defaultLanguageData_diff[$table . ':' . $rec['uid']] = unserialize($rec[$GLOBALS['TCA'][$table]['ctrl']['transOrigDiffSourceField']]);
                        }
 
                                // If there are additional preview languages, load information for them also:
                        $prLang = $this->getAdditionalPreviewLanguages();
                        foreach ($prLang as $prL) {
+                               /** @var $t8Tools t3lib_transl8tools */
                                $t8Tools = t3lib_div::makeInstance('t3lib_transl8tools');
-                               $tInfo = $t8Tools->translationInfo($lookUpTable, intval($rec[$TCA[$table]['ctrl']['transOrigPointerField']]), $prL['uid']);
+                               $tInfo = $t8Tools->translationInfo($lookUpTable, intval($rec[$GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField']]), $prL['uid']);
                                if (is_array($tInfo['translations'][$prL['uid']])) {
                                        $this->additionalPreviewLanguageData[$table . ':' . $rec['uid']][$prL['uid']] = t3lib_BEfunc::getRecordWSOL($table, intval($tInfo['translations'][$prL['uid']]['uid']));
                                }
@@ -3494,8 +3490,6 @@ class t3lib_TCEforms {
         * @return      string          Unprocessed field value merged with default language data if needed
         */
        function getLanguageOverlayRawValue($table, $row, $field, $fieldConf) {
-               global $TCA;
-
                $value = $row[$field];
 
                if (is_array($this->defaultLanguageData[$table . ':' . $row['uid']])) {
@@ -4343,10 +4337,9 @@ class t3lib_TCEforms {
         * @return      string          The hidden-field <input> tag.
         */
        function getSingleHiddenField($table, $field, $row) {
-               global $TCA;
                $item = '';
                t3lib_div::loadTCA($table);
-               if ($TCA[$table]['columns'][$field]) {
+               if ($GLOBALS['TCA'][$table]['columns'][$field]) {
 
                        $uid = $row['uid'];
                        $itemName = $this->prependFormFieldNames . '[' . $table . '][' . $uid . '][' . $field . ']';
@@ -4554,7 +4547,6 @@ class t3lib_TCEforms {
         * @return      array           The updated $item array
         */
        function addItems($items, $iArray) {
-               global $TCA;
                if (is_array($iArray)) {
                        foreach ($iArray as $value => $label) {
                                $items[] = array($this->sl($label), $value);
@@ -4575,8 +4567,6 @@ class t3lib_TCEforms {
         * @return      array           The modified $items array
         */
        function procItems($items, $iArray, $config, $table, $row, $field) {
-               global $TCA;
-
                $params = array();
                $params['items'] = &$items;
                $params['config'] = $config;
@@ -4599,7 +4589,6 @@ class t3lib_TCEforms {
         * @return      array           The $items array modified.
         */
        function addSelectOptionsToItemArray($items, $fieldValue, $TSconfig, $field) {
-               global $TCA;
 
                        // Values from foreign tables:
                if ($fieldValue['config']['foreign_table']) {
@@ -4639,11 +4628,11 @@ class t3lib_TCEforms {
                if ($fieldValue['config']['special']) {
                        switch ($fieldValue['config']['special']) {
                                case 'tables':
-                                       $temp_tc = array_keys($TCA);
+                                       $temp_tc = array_keys($GLOBALS['TCA']);
                                        $descr = '';
 
                                        foreach ($temp_tc as $theTableNames) {
-                                               if (!$TCA[$theTableNames]['ctrl']['adminOnly']) {
+                                               if (!$GLOBALS['TCA'][$theTableNames]['ctrl']['adminOnly']) {
 
                                                                // Icon:
                                                        $icon = t3lib_iconWorks::mapRecordTypeToSpriteIconName($theTableNames, array());
@@ -4658,7 +4647,7 @@ class t3lib_TCEforms {
 
                                                                // Item configuration:
                                                        $items[] = array(
-                                                               $this->sL($TCA[$theTableNames]['ctrl']['title']),
+                                                               $this->sL($GLOBALS['TCA'][$theTableNames]['ctrl']['title']),
                                                                $theTableNames,
                                                                $icon,
                                                                $helpText
@@ -4667,7 +4656,7 @@ class t3lib_TCEforms {
                                        }
                                break;
                                case 'pagetypes':
-                                       $theTypes = $TCA['pages']['columns']['doktype']['config']['items'];
+                                       $theTypes = $GLOBALS['TCA']['pages']['columns']['doktype']['config']['items'];
 
                                        foreach ($theTypes as $theTypeArrays) {
                                                        // Icon:
@@ -4851,7 +4840,6 @@ class t3lib_TCEforms {
         * @see addSelectOptionsToItemArray(), t3lib_BEfunc::exec_foreign_table_where_query()
         */
        function foreignTable($items, $fieldValue, $TSconfig, $field, $pFFlag = 0) {
-               global $TCA;
 
                        // Init:
                $pF = $pFFlag ? 'neg_' : '';
@@ -4871,8 +4859,8 @@ class t3lib_TCEforms {
                $lPrefix = $this->sL($fieldValue['config'][$pF . 'foreign_table_prefix']);
 
                        // Get icon field + path if any:
-               $iField = $TCA[$f_table]['ctrl']['selicon_field'];
-               $iPath = trim($TCA[$f_table]['ctrl']['selicon_field_path']);
+               $iField = $GLOBALS['TCA'][$f_table]['ctrl']['selicon_field'];
+               $iPath = trim($GLOBALS['TCA'][$f_table]['ctrl']['selicon_field_path']);
 
                        // Traverse the selected rows to add them:
                while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
@@ -5008,7 +4996,6 @@ class t3lib_TCEforms {
         * @return      string
         */
        function replaceTableWrap($arr, $rec, $table) {
-               global $TCA;
 
                        // Make "new"-label
                if (strstr($rec['uid'], 'NEW')) {
@@ -5076,7 +5063,7 @@ class t3lib_TCEforms {
                        $arr[$k] = str_replace('###PAGE_TITLE###', $pageTitle, $arr[$k]);
                        $arr[$k] = str_replace('###ID_NEW_INDICATOR###', $newLabel, $arr[$k]);
                        $arr[$k] = str_replace('###RECORD_LABEL###', $rLabel, $arr[$k]);
-                       $arr[$k] = str_replace('###TABLE_TITLE###', htmlspecialchars($this->sL($TCA[$table]['ctrl']['title'])), $arr[$k]);
+                       $arr[$k] = str_replace('###TABLE_TITLE###', htmlspecialchars($this->sL($GLOBALS['TCA'][$table]['ctrl']['title'])), $arr[$k]);
 
                        $arr[$k] = str_replace('###RECORD_ICON###', t3lib_iconWorks::getSpriteIconForRecord($table, $rec, array('title' => $this->getRecordPath($table, $rec))), $arr[$k]);
 
@@ -6015,19 +6002,18 @@ class t3lib_TCEforms {
         * @return      array           "default" row.
         */
        function getDefaultRecord($table, $pid = 0) {
-               global $TCA;
-               if ($TCA[$table]) {
+               if ($GLOBALS['TCA'][$table]) {
                        t3lib_div::loadTCA($table);
                        $row = array();
 
-                       if ($pid < 0 && $TCA[$table]['ctrl']['useColumnsForDefaultValues']) {
+                       if ($pid < 0 && $GLOBALS['TCA'][$table]['ctrl']['useColumnsForDefaultValues']) {
                                        // Fetches the previous record:
                                $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', $table, 'uid=' . abs($pid) . t3lib_BEfunc::deleteClause($table));
                                if ($drow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
                                                // Gets the list of fields to copy from the previous record.
-                                       $fArr = explode(',', $TCA[$table]['ctrl']['useColumnsForDefaultValues']);
+                                       $fArr = explode(',', $GLOBALS['TCA'][$table]['ctrl']['useColumnsForDefaultValues']);
                                        foreach ($fArr as $theF) {
-                                               if ($TCA[$table]['columns'][$theF]) {
+                                               if ($GLOBALS['TCA'][$table]['columns'][$theF]) {
                                                        $row[$theF] = $drow[$theF];
                                                }
                                        }
@@ -6035,7 +6021,7 @@ class t3lib_TCEforms {
                                $GLOBALS['TYPO3_DB']->sql_free_result($res);
                        }
 
-                       foreach ($TCA[$table]['columns'] as $field => $info) {
+                       foreach ($GLOBALS['TCA'][$table]['columns'] as $field => $info) {
                                if (isset($info['config']['default'])) {
                                        $row[$field] = $info['config']['default'];
                                }
@@ -6116,12 +6102,10 @@ class t3lib_TCEforms {
         * @return      boolean
         */
        function isPalettesCollapsed($table, $palette) {
-               global $TCA;
-
-               if ($TCA[$table]['ctrl']['canNotCollapse']) {
+               if ($GLOBALS['TCA'][$table]['ctrl']['canNotCollapse']) {
                        return 0;
                }
-               if (is_array($TCA[$table]['palettes'][$palette]) && $TCA[$table]['palettes'][$palette]['canNotCollapse']) {
+               if (is_array($GLOBALS['TCA'][$table]['palettes'][$palette]) && $GLOBALS['TCA'][$table]['palettes'][$palette]['canNotCollapse']) {
                        return 0;
                }
                return $this->palettesCollapsed;
@@ -6287,8 +6271,7 @@ class t3lib_TCEforms {
         * @return      boolean
         */
        function doLoadTableDescr($table) {
-               global $TCA;
-               return $TCA[$table]['interface']['always_description'];
+               return $GLOBALS['TCA'][$table]['interface']['always_description'];
        }
 
        /**
@@ -6339,14 +6322,13 @@ class t3lib_TCEforms {
         * @return      void
         */
        function getLanguageIcon($table, $row, $sys_language_uid) {
-               global $TCA, $LANG;
-
                $mainKey = $table . ':' . $row['uid'];
 
                if (!isset($this->cachedLanguageFlag[$mainKey])) {
                        t3lib_BEfunc::fixVersioningPid($table, $row);
                        list($tscPID, $thePidValue) = $this->getTSCpid($table, $row['uid'], $row['pid']);
 
+                       /** @var $t8Tools t3lib_transl8tools */
                        $t8Tools = t3lib_div::makeInstance('t3lib_transl8tools');
                        $this->cachedLanguageFlag[$mainKey] = $t8Tools->getSystemLanguages($tscPID, $this->backPath);
                }
index 2adf440..7ba55a2 100644 (file)
@@ -1027,45 +1027,43 @@ class t3lib_TCEforms_inline {
         * @return      void
         */
        protected function processAjaxRequestConstruct(&$ajaxArguments) {
-               global $SOBE, $BE_USER, $TYPO3_CONF_VARS;
-
                require_once(PATH_typo3 . 'template.php');
 
                $GLOBALS['LANG']->includeLLFile('EXT:lang/locallang_alt_doc.xml');
 
                        // Create a new anonymous object:
-               $SOBE = new stdClass();
-               $SOBE->MOD_MENU = array(
+               $GLOBALS['SOBE'] = new stdClass();
+               $GLOBALS['SOBE']->MOD_MENU = array(
                        'showPalettes' => '',
                        'showDescriptions' => '',
                        'disableRTE' => ''
                );
                        // Setting virtual document name
-               $SOBE->MCONF['name'] = 'xMOD_alt_doc.php';
+               $GLOBALS['SOBE']->MCONF['name'] = 'xMOD_alt_doc.php';
                        // CLEANSE SETTINGS
-               $SOBE->MOD_SETTINGS = t3lib_BEfunc::getModuleData(
-                       $SOBE->MOD_MENU,
+               $GLOBALS['SOBE']->MOD_SETTINGS = t3lib_BEfunc::getModuleData(
+                       $GLOBALS['SOBE']->MOD_MENU,
                        t3lib_div::_GP('SET'),
-                       $SOBE->MCONF['name']
+                       $GLOBALS['SOBE']->MCONF['name']
                );
                        // Create an instance of the document template object
-               $SOBE->doc = t3lib_div::makeInstance('template');
-               $SOBE->doc->backPath = $GLOBALS['BACK_PATH'];
+               $GLOBALS['SOBE']->doc = t3lib_div::makeInstance('template');
+               $GLOBALS['SOBE']->doc->backPath = $GLOBALS['BACK_PATH'];
                        // Initialize TCEforms (rendering the forms)
-               $SOBE->tceforms = t3lib_div::makeInstance('t3lib_TCEforms');
-               $SOBE->tceforms->inline = $this;
-               $SOBE->tceforms->RTEcounter = intval(array_shift($ajaxArguments));
-               $SOBE->tceforms->initDefaultBEMode();
-               $SOBE->tceforms->palettesCollapsed = !$SOBE->MOD_SETTINGS['showPalettes'];
-               $SOBE->tceforms->disableRTE = $SOBE->MOD_SETTINGS['disableRTE'];
-               $SOBE->tceforms->enableClickMenu = TRUE;
-               $SOBE->tceforms->enableTabMenu = TRUE;
+               $GLOBALS['SOBE']->tceforms = t3lib_div::makeInstance('t3lib_TCEforms');
+               $GLOBALS['SOBE']->tceforms->inline = $this;
+               $GLOBALS['SOBE']->tceforms->RTEcounter = intval(array_shift($ajaxArguments));
+               $GLOBALS['SOBE']->tceforms->initDefaultBEMode();
+               $GLOBALS['SOBE']->tceforms->palettesCollapsed = !$GLOBALS['SOBE']->MOD_SETTINGS['showPalettes'];
+               $GLOBALS['SOBE']->tceforms->disableRTE = $GLOBALS['SOBE']->MOD_SETTINGS['disableRTE'];
+               $GLOBALS['SOBE']->tceforms->enableClickMenu = TRUE;
+               $GLOBALS['SOBE']->tceforms->enableTabMenu = TRUE;
                        // Clipboard is initialized:
-               $SOBE->tceforms->clipObj = t3lib_div::makeInstance('t3lib_clipboard'); // Start clipboard
-               $SOBE->tceforms->clipObj->initializeClipboard(); // Initialize - reads the clipboard content from the user session
+               $GLOBALS['SOBE']->tceforms->clipObj = t3lib_div::makeInstance('t3lib_clipboard'); // Start clipboard
+               $GLOBALS['SOBE']->tceforms->clipObj->initializeClipboard(); // Initialize - reads the clipboard content from the user session
                        // Setting external variables:
-               if ($BE_USER->uc['edit_showFieldHelp'] != 'text' && $SOBE->MOD_SETTINGS['showDescriptions']) {
-                       $SOBE->tceforms->edit_showFieldHelp = 'text';
+               if ($GLOBALS['BE_USER']->uc['edit_showFieldHelp'] != 'text' && $GLOBALS['SOBE']->MOD_SETTINGS['showDescriptions']) {
+                       $GLOBALS['SOBE']->tceforms->edit_showFieldHelp = 'text';
                }
        }
 
index 3dee717..c651d0a 100644 (file)
@@ -340,6 +340,7 @@ class t3lib_TCEmain {
 
        protected $disableDeleteClause = FALSE; // Disable delete clause
        protected $checkModifyAccessListHookObjects;
+       protected $version_remapMMForVersionSwap_reg;
 
 
        /**
@@ -426,11 +427,10 @@ class t3lib_TCEmain {
         * @return      void
         */
        function setDefaultsFromUserTS($userTS) {
-               global $TCA;
                if (is_array($userTS)) {
                        foreach ($userTS as $k => $v) {
                                $k = substr($k, 0, -1);
-                               if ($k && is_array($v) && isset($TCA[$k])) {
+                               if ($k && is_array($v) && isset($GLOBALS['TCA'][$k])) {
                                        if (is_array($this->defaultValues[$k])) {
                                                $this->defaultValues[$k] = array_merge($this->defaultValues[$k], $v);
                                        } else {
@@ -575,7 +575,6 @@ class t3lib_TCEmain {
         * @return      void
         */
        public function process_datamap() {
-               global $TCA, $TYPO3_CONF_VARS;
                        // Keep versionized(!) relations here locally:
                $registerDBList = array();
 
@@ -587,8 +586,8 @@ class t3lib_TCEmain {
 
                        // First prepare user defined objects (if any) for hooks which extend this function:
                $hookObjectsArr = array();
-               if (is_array($TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processDatamapClass'])) {
-                       foreach ($TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processDatamapClass'] as $classRef) {
+               if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processDatamapClass'])) {
+                       foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processDatamapClass'] as $classRef) {
                                $hookObjectsArr[] = t3lib_div::getUserObj($classRef);
                        }
                }
@@ -603,7 +602,7 @@ class t3lib_TCEmain {
                        // Process the tables...
                foreach ($orderOfTables as $table) {
                        /* Check if
-                                  - table is set in $TCA,
+                                  - table is set in $GLOBALS['TCA'],
                                   - table is NOT readOnly
                                   - the table is set with content in the data-array (if not, there's nothing to process...)
                                   - permissions for tableaccess OK
@@ -613,7 +612,7 @@ class t3lib_TCEmain {
                                $id = 0;
                                $this->log($table, $id, 2, 0, 1, "Attempt to modify table '%s' without permission", 1, array($table));
                        }
-                       if (isset($TCA[$table]) && !$this->tableReadOnly($table) && is_array($this->datamap[$table]) && $modifyAccessList) {
+                       if (isset($GLOBALS['TCA'][$table]) && !$this->tableReadOnly($table) && is_array($this->datamap[$table]) && $modifyAccessList) {
                                if ($this->reverseOrder) {
                                        $this->datamap[$table] = array_reverse($this->datamap[$table], 1);
                                }
@@ -662,7 +661,12 @@ class t3lib_TCEmain {
                                                                        } else {
                                                                                $OK = 0;
                                                                        } // If not found in the substArray we must stop the process...
-                                                               } elseif ($pid_value >= 0 && $this->BE_USER->workspace !== 0 && $TCA[$table]['ctrl']['versioning_followPages']) { // PID points to page, the workspace is an offline space and the table follows page during versioning: This means we must check if the PID page has a version in the workspace with swapmode set to 0 (zero = page+content) and if so, change the pid to the uid of that version.
+                                                               } elseif ($pid_value >= 0 && $this->BE_USER->workspace !== 0
+                                                                       && $GLOBALS['TCA'][$table]['ctrl']['versioning_followPages']) {
+                                                                               // PID points to page, the workspace is an offline space and the table follows
+                                                                               // page during versioning: This means we must check if the PID page has a version
+                                                                               // in the workspace with swapmode set to 0 (zero = page+content) and if so, change
+                                                                               // the pid to the uid of that version.
                                                                        if ($WSdestPage = t3lib_BEfunc::getWorkspaceVersionOfRecord($this->BE_USER->workspace, 'pages', $pid_value, 'uid,t3ver_swapmode')) { // Looks for workspace version of page.
                                                                                if ($WSdestPage['t3ver_swapmode'] == 0) { // if swapmode is zero, then change pid value.
                                                                                        $pid_value = $WSdestPage['uid'];
@@ -673,7 +677,7 @@ class t3lib_TCEmain {
 
                                                                        // The $pid_value is now the numerical pid at this point
                                                                if ($OK) {
-                                                                       $sortRow = $TCA[$table]['ctrl']['sortby'];
+                                                                       $sortRow = $GLOBALS['TCA'][$table]['ctrl']['sortby'];
                                                                        if ($pid_value >= 0) { // Points to a page on which to insert the element, possibly in the top of the page
                                                                                if ($sortRow) { // If this table is sorted we better find the top sorting number
                                                                                        $fieldArray[$sortRow] = $this->getSortNumber($table, 0, $pid_value);
@@ -709,7 +713,7 @@ class t3lib_TCEmain {
                                                                                                $this->newlog('Stage for versioning root point and users access level did not allow for editing', 1);
                                                                                        }
                                                                                } else { // So, if no live records were allowed, we have to create a new version of this record:
-                                                                                       if ($TCA[$table]['ctrl']['versioningWS']) {
+                                                                                       if ($GLOBALS['TCA'][$table]['ctrl']['versioningWS']) {
                                                                                                $createNewVersion = TRUE;
                                                                                        } else {
                                                                                                $recordAccess = FALSE;
@@ -734,7 +738,9 @@ class t3lib_TCEmain {
                                                                        $propArr = $this->getRecordProperties($table, $id);
                                                                        $this->newlog("recordEditAccessInternals() check failed. [" . $this->BE_USER->errorMsg . "]", 1);
                                                                } else { // Here we fetch the PID of the record that we point to...
-                                                                       $tempdata = $this->recordInfo($table, $id, 'pid' . ($TCA[$table]['ctrl']['versioningWS'] ? ',t3ver_wsid,t3ver_stage' : ''));
+                                                                       $tempdata = $this->recordInfo($table, $id, 'pid' .
+                                                                               ($GLOBALS['TCA'][$table]['ctrl']['versioningWS'] ? ',t3ver_wsid,t3ver_stage' : '')
+                                                                       );
                                                                        $theRealPid = $tempdata['pid'];
 
                                                                                // Use the new id of the versionized record we're trying to write to:
@@ -755,6 +761,7 @@ class t3lib_TCEmain {
 
                                                                                        // Auto-creation of version: In offline workspace, test if versioning is enabled and look for workspace version of input record. If there is no versionized record found we will create one and save to that.
                                                                                if ($this->BE_USER->workspaceAllowAutoCreation($table, $id, $theRealPid)) {
+                                                                                       /** @var $tce t3lib_TCEmain */
                                                                                        $tce = t3lib_div::makeInstance('t3lib_TCEmain');
                                                                                        /* @var $tce t3lib_TCEmain  */
                                                                                        $tce->stripslashes_values = 0;
@@ -827,28 +834,28 @@ class t3lib_TCEmain {
 
                                                                // Setting system fields
                                                        if ($status == 'new') {
-                                                               if ($TCA[$table]['ctrl']['crdate']) {
-                                                                       $fieldArray[$TCA[$table]['ctrl']['crdate']] = $GLOBALS['EXEC_TIME'];
+                                                               if ($GLOBALS['TCA'][$table]['ctrl']['crdate']) {
+                                                                       $fieldArray[$GLOBALS['TCA'][$table]['ctrl']['crdate']] = $GLOBALS['EXEC_TIME'];
                                                                        if ($createNewVersion) {
-                                                                               $newVersion_placeholderFieldArray[$TCA[$table]['ctrl']['crdate']] = $GLOBALS['EXEC_TIME'];
+                                                                               $newVersion_placeholderFieldArray[$GLOBALS['TCA'][$table]['ctrl']['crdate']] = $GLOBALS['EXEC_TIME'];
                                                                        }
                                                                }
-                                                               if ($TCA[$table]['ctrl']['cruser_id']) {
-                                                                       $fieldArray[$TCA[$table]['ctrl']['cruser_id']] = $this->userid;
+                                                               if ($GLOBALS['TCA'][$table]['ctrl']['cruser_id']) {
+                                                                       $fieldArray[$GLOBALS['TCA'][$table]['ctrl']['cruser_id']] = $this->userid;
                                                                        if ($createNewVersion) {
-                                                                               $newVersion_placeholderFieldArray[$TCA[$table]['ctrl']['cruser_id']] = $this->userid;
+                                                                               $newVersion_placeholderFieldArray[$GLOBALS['TCA'][$table]['ctrl']['cruser_id']] = $this->userid;
                                                                        }
                                                                }
                                                        } elseif ($this->checkSimilar) { // Removing fields which are equal to the current value:
                                                                $fieldArray = $this->compareFieldArrayWithCurrentAndUnset($table, $id, $fieldArray);
                                                        }
-                                                       if ($TCA[$table]['ctrl']['tstamp'] && count($fieldArray)) {
-                                                               $fieldArray[$TCA[$table]['ctrl']['tstamp']] = $GLOBALS['EXEC_TIME'];
+                                                       if ($GLOBALS['TCA'][$table]['ctrl']['tstamp'] && count($fieldArray)) {
+                                                               $fieldArray[$GLOBALS['TCA'][$table]['ctrl']['tstamp']] = $GLOBALS['EXEC_TIME'];
                                                                if ($createNewVersion) {
-                                                                       $newVersion_placeholderFieldArray[$TCA[$table]['ctrl']['tstamp']] = $GLOBALS['EXEC_TIME'];
+                                                                       $newVersion_placeholderFieldArray[$GLOBALS['TCA'][$table]['ctrl']['tstamp']] = $GLOBALS['EXEC_TIME'];
                                                                }
                                                        }
-                                                       if ($TCA[$table]['ctrl']['versioningWS']) {
+                                                       if ($GLOBALS['TCA'][$table]['ctrl']['versioningWS']) {
                                                                $fieldArray['t3ver_stage'] = 0;
                                                        }
 
@@ -864,12 +871,15 @@ class t3lib_TCEmain {
                                                        if (is_array($fieldArray)) {
                                                                if ($status == 'new') {
                                                                        if ($createNewVersion) { // This creates a new version of the record with online placeholder and offline version
-                                                                               $versioningType = $table === 'pages' ? $this->BE_USER->workspaceVersioningTypeGetClosest(t3lib_div::intInRange($TYPO3_CONF_VARS['BE']['newPagesVersioningType'], -1, 1)) : -1;
+                                                                               $versioningType = ($table === 'pages'
+                                                                                       ? $this->BE_USER->workspaceVersioningTypeGetClosest(
+                                                                                               t3lib_div::intInRange($GLOBALS['TYPO3_CONF_VARS']['BE']['newPagesVersioningType'], -1, 1))
+                                                                                       : -1);
                                                                                if ($this->BE_USER->workspaceVersioningTypeAccess($versioningType)) {
                                                                                        $newVersion_placeholderFieldArray['t3ver_label'] = 'INITIAL PLACEHOLDER';
                                                                                        $newVersion_placeholderFieldArray['t3ver_state'] = 1; // Setting placeholder state value for temporary record
                                                                                        $newVersion_placeholderFieldArray['t3ver_wsid'] = $this->BE_USER->workspace; // Setting workspace - only so display of place holders can filter out those from other workspaces.
-                                                                                       $newVersion_placeholderFieldArray[$TCA[$table]['ctrl']['label']] = '[PLACEHOLDER, WS#' . $this->BE_USER->workspace . ']';
+                                                                                       $newVersion_placeholderFieldArray[$GLOBALS['TCA'][$table]['ctrl']['label']] = '[PLACEHOLDER, WS#' . $this->BE_USER->workspace . ']';
                                                                                        $this->insertDB($table, $id, $newVersion_placeholderFieldArray, FALSE); // Saving placeholder as 'original'
 
                                                                                                // For the actual new offline version, set versioning values to point to placeholder:
@@ -944,23 +954,23 @@ class t3lib_TCEmain {
         * @return      void
         */
        function placeholderShadowing($table, $id) {
-               global $TCA;
-
                t3lib_div::loadTCA($table);
                if ($liveRec = t3lib_BEfunc::getLiveVersionOfRecord($table, $id, '*')) {
                        if ((int) $liveRec['t3ver_state'] > 0) {
                                $justStoredRecord = t3lib_BEfunc::getRecord($table, $id);
                                $newRecord = array();
 
-                               $shadowCols = $TCA[$table]['ctrl']['shadowColumnsForNewPlaceholders'];
-                               $shadowCols .= ',' . $TCA[$table]['ctrl']['languageField'];
-                               $shadowCols .= ',' . $TCA[$table]['ctrl']['transOrigPointerField'];
-                               $shadowCols .= ',' . $TCA[$table]['ctrl']['type'];
-                               $shadowCols .= ',' . $TCA[$table]['ctrl']['label'];
+                               $shadowCols = $GLOBALS['TCA'][$table]['ctrl']['shadowColumnsForNewPlaceholders'];
+                               $shadowCols .= ',' . $GLOBALS['TCA'][$table]['ctrl']['languageField'];
+                               $shadowCols .= ',' . $GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField'];
+                               $shadowCols .= ',' . $GLOBALS['TCA'][$table]['ctrl']['type'];
+                               $shadowCols .= ',' . $GLOBALS['TCA'][$table]['ctrl']['label'];
 
                                $shadowColumns = array_unique(t3lib_div::trimExplode(',', $shadowCols, 1));
                                foreach ($shadowColumns as $fieldName) {
-                                       if (strcmp($justStoredRecord[$fieldName], $liveRec[$fieldName]) && isset($TCA[$table]['columns'][$fieldName]) && $fieldName !== 'uid' && $fieldName !== 'pid') {
+                                       if (strcmp($justStoredRecord[$fieldName], $liveRec[$fieldName])
+                                               && isset($GLOBALS['TCA'][$table]['columns'][$fieldName])
+                                               && $fieldName !== 'uid' && $fieldName !== 'pid') {
                                                $newRecord[$fieldName] = $justStoredRecord[$fieldName];
                                        }
                                }
@@ -987,7 +997,6 @@ class t3lib_TCEmain {
         * @return      array           Field Array
         */
        function fillInFieldArray($table, $id, $fieldArray, $incomingFieldArray, $realPid, $status, $tscPID) {
-               global $TCA;
 
                        // Initialize:
                t3lib_div::loadTCA($table);
@@ -1011,16 +1020,16 @@ class t3lib_TCEmain {
 
                                // Get original language record if available:
                        if (is_array($currentRecord)
-                               && $TCA[$table]['ctrl']['transOrigDiffSourceField']
-                               && $TCA[$table]['ctrl']['languageField']
-                               && $currentRecord[$TCA[$table]['ctrl']['languageField']] > 0
-                               && $TCA[$table]['ctrl']['transOrigPointerField']
-                               && intval($currentRecord[$TCA[$table]['ctrl']['transOrigPointerField']]) > 0) {
-
-                               $lookUpTable = $TCA[$table]['ctrl']['transOrigPointerTable'] ? $TCA[$table]['ctrl']['transOrigPointerTable'] : $table;
-                               $originalLanguageRecord = $this->recordInfo($lookUpTable, $currentRecord[$TCA[$table]['ctrl']['transOrigPointerField']], '*');
+                               && $GLOBALS['TCA'][$table]['ctrl']['transOrigDiffSourceField']
+                               && $GLOBALS['TCA'][$table]['ctrl']['languageField']
+                               && $currentRecord[$GLOBALS['TCA'][$table]['ctrl']['languageField']] > 0
+                               && $GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField']
+                               && intval($currentRecord[$GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField']]) > 0) {
+
+                               $lookUpTable = $GLOBALS['TCA'][$table]['ctrl']['transOrigPointerTable'] ? $GLOBALS['TCA'][$table]['ctrl']['transOrigPointerTable'] : $table;
+                               $originalLanguageRecord = $this->recordInfo($lookUpTable, $currentRecord[$GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField']], '*');
                                t3lib_BEfunc::workspaceOL($lookUpTable, $originalLanguageRecord);
-                               $originalLanguage_diffStorage = unserialize($currentRecord[$TCA[$table]['ctrl']['transOrigDiffSourceField']]);
+                               $originalLanguage_diffStorage = unserialize($currentRecord[$GLOBALS['TCA'][$table]['ctrl']['transOrigDiffSourceField']]);
                        }
                }
                $this->checkValue_currentRecord = $checkValueRecord;
@@ -1038,7 +1047,9 @@ class t3lib_TCEmain {
                        if (!in_array($table . '-' . $field, $this->exclude_array) && !$this->data_disableFields[$table][$id][$field]) { // The field must be editable.
 
                                        // Checking if a value for language can be changed:
-                               $languageDeny = $TCA[$table]['ctrl']['languageField'] && !strcmp($TCA[$table]['ctrl']['languageField'], $field) && !$this->BE_USER->checkLanguageAccess($fieldValue);
+                               $languageDeny = $GLOBALS['TCA'][$table]['ctrl']['languageField']
+                                       && !strcmp($GLOBALS['TCA'][$table]['ctrl']['languageField'], $field)
+                                       && !$this->BE_USER->checkLanguageAccess($fieldValue);
 
                                if (!$languageDeny) {
                                                // Stripping slashes - will probably be removed the day $this->stripslashes_values is removed as an option...
@@ -1089,7 +1100,7 @@ class t3lib_TCEmain {
                                                        // t3ver_label is not here because it CAN be edited as a regular field!
                                                break;
                                                default:
-                                                       if (isset($TCA[$table]['columns'][$field])) {
+                                                       if (isset($GLOBALS['TCA'][$table]['columns'][$field])) {
                                                                        // Evaluating the value
                                                                $res = $this->checkValue($table, $field, $fieldValue, $id, $status, $realPid, $tscPID);
                                                                if (isset($res['value'])) {
@@ -1097,7 +1108,7 @@ class t3lib_TCEmain {
                                                                }
 
                                                                        // Add the value of the original record to the diff-storage content:
-                                                               if ($this->updateModeL10NdiffData && $TCA[$table]['ctrl']['transOrigDiffSourceField']) {
+                                                               if ($this->updateModeL10NdiffData && $GLOBALS['TCA'][$table]['ctrl']['transOrigDiffSourceField']) {
                                                                        $originalLanguage_diffStorage[$field] = $this->updateModeL10NdiffDataClear ? '' : $originalLanguageRecord[$field];
                                                                        $diffStorageFlag = TRUE;
                                                                }
@@ -1114,7 +1125,8 @@ class t3lib_TCEmain {
                                                                        }
                                                                }
 
-                                                       } elseif ($TCA[$table]['ctrl']['origUid'] === $field) { // Allow value for original UID to pass by...
+                                                       } elseif ($GLOBALS['TCA'][$table]['ctrl']['origUid'] === $field) {
+                                                                       // Allow value for original UID to pass by...
                                                                $fieldArray[$field] = $fieldValue;
                                                        }
                                                break;
@@ -1123,8 +1135,9 @@ class t3lib_TCEmain {
                        } // Check exclude fields / disabled fields...
                }
                        // Add diff-storage information:
-               if ($diffStorageFlag && !isset($fieldArray[$TCA[$table]['ctrl']['transOrigDiffSourceField']])) { // If the field is set it would probably be because of an undo-operation - in which case we should not update the field of course...
-                       $fieldArray[$TCA[$table]['ctrl']['transOrigDiffSourceField']] = serialize($originalLanguage_diffStorage);
+               if ($diffStorageFlag && !isset($fieldArray[$GLOBALS['TCA'][$table]['ctrl']['transOrigDiffSourceField']])) {
+                               // If the field is set it would probably be because of an undo-operation - in which case we should not update the field of course...
+                       $fieldArray[$GLOBALS['TCA'][$table]['ctrl']['transOrigDiffSourceField']] = serialize($originalLanguage_diffStorage);
                }
 
                        // Checking for RTE-transformations of fields:
@@ -1214,7 +1227,6 @@ class t3lib_TCEmain {
         * @return      array           Returns the evaluated $value as key "value" in this array. Can be checked with isset($res['value']) ...
         */
        function checkValue($table, $field, $value, $id, $status, $realPid, $tscPID) {
-               global $TCA, $PAGES_TYPES;
                t3lib_div::loadTCA($table);
 
                $res = array(); // result array
@@ -1231,7 +1243,9 @@ class t3lib_TCEmain {
                        ;
                        if ($status == 'update') {
                                        // This checks 1) if we should check for disallowed tables and 2) if there are records from disallowed tables on the current page
-                               $onlyAllowedTables = isset($PAGES_TYPES[$value]['onlyAllowedTables']) ? $PAGES_TYPES[$value]['onlyAllowedTables'] : $PAGES_TYPES['default']['onlyAllowedTables'];
+                               $onlyAllowedTables = (isset($GLOBALS['PAGES_TYPES'][$value]['onlyAllowedTables'])
+                                       ? $GLOBALS['PAGES_TYPES'][$value]['onlyAllowedTables']
+                                       : $GLOBALS['PAGES_TYPES']['default']['onlyAllowedTables']);
                                if ($onlyAllowedTables) {
                                        $theWrongTables = $this->doesPageHaveUnallowedTables($id, $value);
                                        if ($theWrongTables) {
@@ -1248,7 +1262,7 @@ class t3lib_TCEmain {
                $curValue = $curValueRec[$field];
 
                        // Getting config for the field
-               $tcaFieldConf = $TCA[$table]['columns'][$field]['config'];
+               $tcaFieldConf = $GLOBALS['TCA'][$table]['columns'][$field]['config'];
 
                        // Preform processing:
                $res = $this->checkValue_SW($res, $value, $tcaFieldConf, $table, $id, $curValue, $status, $realPid, $recFID, $field, $this->uploadedFileArray[$table][$id][$field], $tscPID);
@@ -1257,12 +1271,12 @@ class t3lib_TCEmain {
        }
 
        /**
-        * Branches out evaluation of a field value based on its type as configured in TCA
+        * Branches out evaluation of a field value based on its type as configured in $GLOBALS['TCA']
         * Can be called for FlexForm pseudo fields as well, BUT must not have $field set if so.
         *
         * @param       array           The result array. The processed value (if any!) is set in the "value" key.
         * @param       string          The value to set.
-        * @param       array           Field configuration from TCA
+        * @param       array           Field configuration from $GLOBALS['TCA']
         * @param       string          Table name
         * @param       integer         Return UID
         * @param       [type]          $curValue: ...
@@ -2029,7 +2043,6 @@ class t3lib_TCEmain {
         * @return      string          Modified value (if not-unique). Will be the value appended with a number (until 100, then the function just breaks).
         */
        function getUnique($table, $field, $value, $id, $newPid = 0) {
-               global $TCA;
 
                        // Initialize:
                t3lib_div::loadTCA($table);
@@ -2043,7 +2056,7 @@ class t3lib_TCEmain {
                $whereAdd .= $this->deleteClause($table);
 
                        // If the field is configured in TCA, proceed:
-               if (is_array($TCA[$table]) && is_array($TCA[$table]['columns'][$field])) {
+               if (is_array($GLOBALS['TCA'][$table]) && is_array($GLOBALS['TCA'][$table]['columns'][$field])) {
 
                                // Look for a record which might already have the value:
                        $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid', $table, $field . '=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($value, $table) . ' AND uid!=' . intval($id) . $whereAdd);
@@ -2562,7 +2575,6 @@ class t3lib_TCEmain {
         * @return      void
         */
        public function process_cmdmap() {
-               global $TCA, $TYPO3_CONF_VARS;
 
                        // Editing frozen:
                if ($this->BE_USER->workspace !== 0 && $this->BE_USER->workspaceRec['freeze']) {
@@ -2572,8 +2584,8 @@ class t3lib_TCEmain {
 
                        // Hook initialization:
                $hookObjectsArr = array();
-               if (is_array($TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processCmdmapClass'])) {
-                       foreach ($TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processCmdmapClass'] as $classRef) {
+               if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processCmdmapClass'])) {
+                       foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processCmdmapClass'] as $classRef) {
                                $hookObj = t3lib_div::getUserObj($classRef);
                                if (method_exists($hookObj, 'processCmdmap_beforeStart')) {
                                        $hookObj->processCmdmap_beforeStart($this);
@@ -2593,7 +2605,7 @@ class t3lib_TCEmain {
                        } // FIXME: $id not set here (Comment added by Sebastian Kurfürst)
 
                                // Check basic permissions and circumstances:
-                       if (isset($TCA[$table]) && !$this->tableReadOnly($table) && is_array($this->cmdmap[$table]) && $modifyAccessList) {
+                       if (isset($GLOBALS['TCA'][$table]) && !$this->tableReadOnly($table) && is_array($this->cmdmap[$table]) && $modifyAccessList) {
 
                                        // Traverse the command map:
                                foreach ($this->cmdmap[$table] as $id => $incomingCmdArray) {
@@ -2698,11 +2710,9 @@ class t3lib_TCEmain {
         * @return      integer         ID of new record, if any
         */
        function copyRecord($table, $uid, $destPid, $first = 0, $overrideValues = array(), $excludeFields = '', $language = 0) {
-               global $TCA;
-
                $uid = $origUid = intval($uid);
-                       // Only copy if the table is defined in TCA, a uid is given and the record wasn't copied before:
-               if ($TCA[$table] && $uid && !$this->isRecordCopied($table, $uid)) {
+                       // Only copy if the table is defined in $GLOBALS['TCA'], a uid is given and the record wasn't copied before:
+               if ($GLOBALS['TCA'][$table] && $uid && !$this->isRecordCopied($table, $uid)) {
                        t3lib_div::loadTCA($table);
                        /*
                                   // In case the record to be moved turns out to be an offline version, we have to find the live version and work on that one (this case happens for pages with "branch" versioning type)
@@ -2732,8 +2742,8 @@ class t3lib_TCEmain {
 
                                                        // Initializing:
                                                $theNewID = uniqid('NEW');
-                                               $enableField = isset($TCA[$table]['ctrl']['enablecolumns']) ? $TCA[$table]['ctrl']['enablecolumns']['disabled'] : '';
-                                               $headerField = $TCA[$table]['ctrl']['label'];
+                                               $enableField = isset($GLOBALS['TCA'][$table]['ctrl']['enablecolumns']) ? $GLOBALS['TCA'][$table]['ctrl']['enablecolumns']['disabled'] : '';
+                                               $headerField = $GLOBALS['TCA'][$table]['ctrl']['label'];
 
                                                        // Getting default data:
                                                $defaultData = $this->newFieldArray($table);
@@ -2751,7 +2761,7 @@ class t3lib_TCEmain {
                                                        if (!in_array($field, $nonFields)) {
 
                                                                        // Get TCA configuration for the field:
-                                                               $conf = $TCA[$table]['columns'][$field]['config'];
+                                                               $conf = $GLOBALS['TCA'][$table]['columns'][$field]['config'];
 
                                                                        // Preparation/Processing of the value:
                                                                if ($field == 'pid') { // "pid" is hardcoded of course:
@@ -2760,15 +2770,15 @@ class t3lib_TCEmain {
                                                                        $value = $overrideValues[$field];
                                                                } elseif (isset($copyAfterFields[$field])) { // Copy-after value if available:
                                                                        $value = $copyAfterFields[$field];
-                                                               } elseif ($TCA[$table]['ctrl']['setToDefaultOnCopy'] && t3lib_div::inList($TCA[$table]['ctrl']['setToDefaultOnCopy'], $field)) { // Revert to default for some fields:
+                                                               } elseif ($GLOBALS['TCA'][$table]['ctrl']['setToDefaultOnCopy'] && t3lib_div::inList($GLOBALS['TCA'][$table]['ctrl']['setToDefaultOnCopy'], $field)) { // Revert to default for some fields:
                                                                        $value = $defaultData[$field];
                                                                } else {
                                                                                // Hide at copy may override:
-                                                                       if ($first && $field == $enableField && $TCA[$table]['ctrl']['hideAtCopy'] && !$this->neverHideAtCopy && !$tE['disableHideAtCopy']) {
+                                                                       if ($first && $field == $enableField && $GLOBALS['TCA'][$table]['ctrl']['hideAtCopy'] && !$this->neverHideAtCopy && !$tE['disableHideAtCopy']) {
                                                                                $value = 1;
                                                                        }
                                                                                // Prepend label on copy:
-                                                                       if ($first && $field == $headerField && $TCA[$table]['ctrl']['prependAtCopy'] && !$tE['disablePrependAtCopy']) {
+                                                                       if ($first && $field == $headerField && $GLOBALS['TCA'][$table]['ctrl']['prependAtCopy'] && !$tE['disablePrependAtCopy']) {
                                                                                $value = $this->getCopyHeader($table, $this->resolvePid($table, $destPid), $field, $this->clearPrefixFromValue($table, $value), 0);
                                                                        }
                                                                                // Processing based on the TCA config field type (files, references, flexforms...)
@@ -2780,18 +2790,18 @@ class t3lib_TCEmain {
                                                        }
                                                }
                                                        // Overriding values:
-                                               if ($TCA[$table]['ctrl']['editlock']) {
-                                                       $data[$table][$theNewID][$TCA[$table]['ctrl']['editlock']] = 0;
+                                               if ($GLOBALS['TCA'][$table]['ctrl']['editlock']) {
+                                                       $data[$table][$theNewID][$GLOBALS['TCA'][$table]['ctrl']['editlock']] = 0;
                                                }
 
                                                        // Setting original UID:
-                                               if ($TCA[$table]['ctrl']['origUid']) {
-                                                       $data[$table][$theNewID][$TCA[$table]['ctrl']['origUid']] = $uid;
+                                               if ($GLOBALS['TCA'][$table]['ctrl']['origUid']) {
+                                                       $data[$table][$theNewID][$GLOBALS['TCA'][$table]['ctrl']['origUid']] = $uid;
                                                }
 
                                                        // Do the copy by simply submitting the array through TCEmain:
                                                $copyTCE = t3lib_div::makeInstance('t3lib_TCEmain');
-                                               /* @var $copyTCE t3lib_TCEmain  */
+                                               /** @var $copyTCE t3lib_TCEmain  */
                                                $copyTCE->stripslashes_values = 0;
                                                $copyTCE->copyTree = $this->copyTree;
                                                $copyTCE->cachedTSconfig = $this->cachedTSconfig; // Copy forth the cached TSconfig
@@ -2898,7 +2908,6 @@ class t3lib_TCEmain {
         * @return      integer         The id of the new page, if applicable.
         */
        function copySpecificPage($uid, $destPid, $copyTablesArray, $first = 0) {
-               global $TCA;
 
                        // Copy the page itself:
                $theNewRootID = $this->copyRecord('pages', $uid, $destPid, $first);
@@ -2906,8 +2915,14 @@ class t3lib_TCEmain {
                        // If a new page was created upon the copy operation we will proceed with all the tables ON that page:
                if ($theNewRootID) {
                        foreach ($copyTablesArray as $table) {
-                               if ($table && is_array($TCA[$table]) && $table != 'pages') { // all records under the page is copied.
-                                       $mres = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid', $table, 'pid=' . intval($uid) . $this->deleteClause($table), '', ($TCA[$table]['ctrl']['sortby'] ? $TCA[$table]['ctrl']['sortby'] . ' DESC' : ''));
+                               if ($table && is_array($GLOBALS['TCA'][$table]) && $table != 'pages') { // all records under the page is copied.
+                                       $mres = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
+                                               'uid',
+                                               $table,
+                                               'pid=' . intval($uid) . $this->deleteClause($table),
+                                               '',
+                                               ($GLOBALS['TCA'][$table]['ctrl']['sortby'] ? $GLOBALS['TCA'][$table]['ctrl']['sortby'] . ' DESC' : '')
+                                       );
                                        while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($mres)) {
                                                $this->copyRecord($table, $row['uid'], $theNewRootID); // Copying each of the underlying records...
                                        }
@@ -2933,11 +2948,9 @@ class t3lib_TCEmain {
         * @return      integer         Returns the new ID of the record (if applicable)
         */
        function copyRecord_raw($table, $uid, $pid, $overrideArray = array()) {
-               global $TCA;
-
                $uid = intval($uid);
                        // Only copy if the table is defined in TCA, a uid is given and the record wasn't copied before:
-               if ($TCA[$table] && $uid && !$this->isRecordCopied($table, $uid)) {
+               if ($GLOBALS['TCA'][$table] && $uid && !$this->isRecordCopied($table, $uid)) {
                        t3lib_div::loadTCA($table);
                        if ($this->doesRecordExist($table, $uid, 'show')) {
 
@@ -2956,7 +2969,7 @@ class t3lib_TCEmain {
                                                if (!in_array($field, $nonFields)) {
 
                                                                // Get TCA configuration for the field:
-                                                       $conf = $TCA[$table]['columns'][$field]['config'];
+                                                       $conf = $GLOBALS['TCA'][$table]['columns'][$field]['config'];
                                                        if (is_array($conf)) {
                                                                        // Processing based on the TCA config field type (files, references, flexforms...)
                                                                $value = $this->copyRecord_procBasedOnFieldType($table, $uid, $field, $value, $row, $conf, $pid);
@@ -2971,8 +2984,8 @@ class t3lib_TCEmain {
                                        $row['pid'] = $pid;
 
                                                // Setting original UID:
-                                       if ($TCA[$table]['ctrl']['origUid']) {
-                                               $row[$TCA[$table]['ctrl']['origUid']] = $uid;
+                                       if ($GLOBALS['TCA'][$table]['ctrl']['origUid']) {
+                                               $row[$GLOBALS['TCA'][$table]['ctrl']['origUid']] = $uid;
                                        }
 
                                                // Do the copy by internal function
@@ -3002,8 +3015,6 @@ class t3lib_TCEmain {
         * @return      integer         Returns the new ID of the record (if applicable)
         */
        function insertNewCopyVersion($table, $fieldArray, $realPid) {
-               global $TCA;
-
                $id = uniqid('NEW');
 
                        // $fieldArray is set as current record.
@@ -3016,7 +3027,7 @@ class t3lib_TCEmain {
 
                        // Traverse record and input-process each value:
                foreach ($fieldArray as $field => $fieldValue) {
-                       if (isset($TCA[$table]['columns'][$field])) {
+                       if (isset($GLOBALS['TCA'][$table]['columns'][$field])) {
                                        // Evaluating the value.
                                $res = $this->checkValue($table, $field, $fieldValue, $id, 'new', $realPid, 0);
                                if (isset($res['value'])) {
@@ -3026,14 +3037,14 @@ class t3lib_TCEmain {
                }
 
                        // System fields being set:
-               if ($TCA[$table]['ctrl']['crdate']) {
-                       $fieldArray[$TCA[$table]['ctrl']['crdate']] = $GLOBALS['EXEC_TIME'];
+               if ($GLOBALS['TCA'][$table]['ctrl']['crdate']) {
+                       $fieldArray[$GLOBALS['TCA'][$table]['ctrl']['crdate']] = $GLOBALS['EXEC_TIME'];
                }
-               if ($TCA[$table]['ctrl']['cruser_id']) {
-                       $fieldArray[$TCA[$table]['ctrl']['cruser_id']] = $this->userid;
+               if ($GLOBALS['TCA'][$table]['ctrl']['cruser_id']) {
+                       $fieldArray[$GLOBALS['TCA'][$table]['ctrl']['cruser_id']] = $this->userid;
                }
-               if ($TCA[$table]['ctrl']['tstamp']) {
-                       $fieldArray[$TCA[$table]['ctrl']['tstamp']] = $GLOBALS['EXEC_TIME'];
+               if ($GLOBALS['TCA'][$table]['ctrl']['tstamp']) {
+                       $fieldArray[$GLOBALS['TCA'][$table]['ctrl']['tstamp']] = $GLOBALS['EXEC_TIME'];
                }
 
                        // Finally, insert record:
@@ -3064,7 +3075,6 @@ class t3lib_TCEmain {
         * @see copyRecord()
         */
        function copyRecord_procBasedOnFieldType($table, $uid, $field, $value, $row, $conf, $realDestPid, $language = 0) {
-               global $TCA;
 
                        // Process references and files, currently that means only the files, prepending absolute paths (so the TCEmain engine will detect the file as new and one that should be made into a copy)
                $value = $this->copyRecord_procFilesRefs($conf, $uid, $value);
@@ -3077,7 +3087,7 @@ class t3lib_TCEmain {
                        $localizeReferences = (isset($conf['foreign_table']) && t3lib_BEfunc::isTableLocalizable($conf['foreign_table']) && isset($conf['localizeReferencesAtParentLocalization']) && $conf['localizeReferencesAtParentLocalization']);
                        if ($conf['MM'] || $language > 0 && $localizeReferences) {
                                $dbAnalysis = t3lib_div::makeInstance('t3lib_loadDBGroup');
-                               /* @var $dbAnalysis t3lib_loadDBGroup */
+                               /** @var $dbAnalysis t3lib_loadDBGroup */
                                $dbAnalysis->start($value, $allowedTables, $conf['MM'], $uid, $table, $conf);
                                if (!$conf['MM']) {
                                                // Localize referenced records of select fields:
@@ -3116,7 +3126,8 @@ class t3lib_TCEmain {
                                        // Walk through the items, copy them and remember the new id:
                                foreach ($dbAnalysis->itemArray as $k => $v) {
                                                // If language is set and differs from original record, this isn't a copy action but a localization of our parent/ancestor:
-                                       if ($language > 0 && t3lib_BEfunc::isTableLocalizable($table) && $language != $row[$TCA[$table]['ctrl']['languageField']]) {
+                                       if ($language > 0 && t3lib_BEfunc::isTableLocalizable($table)
+                                               && $language != $row[$GLOBALS['TCA'][$table]['ctrl']['languageField']]) {
                                                        // If children should be localized when the parent gets localized the first time, just do it:
                                                if ($localizationMode != FALSE && isset($conf['behaviour']['localizeChildrenAtParentLocalization']) && $conf['behaviour']['localizeChildrenAtParentLocalization']) {
                                                        $newId = $this->localize($v['table'], $v['id'], $language);
@@ -3406,9 +3417,7 @@ class t3lib_TCEmain {
         * @return      void
         */
        function moveRecord($table, $uid, $destPid) {
-               global $TCA, $TYPO3_CONF_VARS;
-
-               if ($TCA[$table]) {
+               if ($GLOBALS['TCA'][$table]) {
 
                                // In case the record to be moved turns out to be an offline version,
                                // we have to find the live version and work on that one (this case
@@ -3453,8 +3462,8 @@ class t3lib_TCEmain {
                                                $recordWasMoved = FALSE;
 
                                                        // move the record via a hook, used e.g. for versioning
-                                               if (is_array($TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['moveRecordClass'])) {
-                                                       foreach ($TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['moveRecordClass'] as $classRef) {
+                                               if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['moveRecordClass'])) {
+                                                       foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['moveRecordClass'] as $classRef) {
                                                                $hookObj = t3lib_div::getUserObj($classRef);
                                                                if (method_exists($hookObj, 'moveRecord')) {
                                                                        $hookObj->moveRecord($table, $uid, $destPid, $propArr, $moveRec, $resolvedPid, $recordWasMoved, $this);
@@ -3491,9 +3500,7 @@ class t3lib_TCEmain {
         * @see moveRecord()
         */
        function moveRecord_raw($table, $uid, $destPid) {
-               global $TCA, $TYPO3_CONF_VARS;
-
-               $sortRow = $TCA[$table]['ctrl']['sortby'];
+               $sortRow = $GLOBALS['TCA'][$table]['ctrl']['sortby'];
                $origDestPid = $destPid;
                $resolvedPid = $this->resolvePid($table, $destPid); // This is the actual pid of the moving to destination
 
@@ -3507,16 +3514,16 @@ class t3lib_TCEmain {
 
                        // Prepare user defined objects (if any) for hooks which extend this function:
                $hookObjectsArr = array();
-               if (is_array($TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['moveRecordClass'])) {
-                       foreach ($TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['moveRecordClass'] as $classRef) {
+               if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['moveRecordClass'])) {
+                       foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['moveRecordClass'] as $classRef) {
                                $hookObjectsArr[] = t3lib_div::getUserObj($classRef);
                        }
                }
 
                        // Timestamp field:
                $updateFields = array();