Fixed bug #14050: CleanUp - CGL format of t3lib files - t3lib_admin
authorSteffen Kamper <info@sk-typo3.de>
Tue, 23 Nov 2010 22:36:24 +0000 (22:36 +0000)
committerSteffen Kamper <info@sk-typo3.de>
Tue, 23 Nov 2010 22:36:24 +0000 (22:36 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@9516 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
t3lib/class.t3lib_admin.php

index 105dcce..48f81f8 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 2010-11-23  Steffen Kamper  <steffen@typo3.org>
 
 2010-11-23  Steffen Kamper  <steffen@typo3.org>
 
+       * Fixed bug #14050: CleanUp - CGL format of t3lib files - t3lib_admin
+       * Fixed bug #14050: CleanUp - CGL format of t3lib files - gzip_encode
        * Fixed bug #14050: CleanUp - CGL format of t3lib files - t3lib_div
        * Follow-up to #16495: conf.php files aren't corrected when installing extensions
 
        * Fixed bug #14050: CleanUp - CGL format of t3lib files - t3lib_div
        * Follow-up to #16495: conf.php files aren't corrected when installing extensions
 
index 948c352..d5c4a27 100644 (file)
@@ -1,29 +1,29 @@
 <?php
 /***************************************************************
 <?php
 /***************************************************************
-*  Copyright notice
-*
-*  (c) 1999-2010 Kasper Skårhøj (kasperYYYY@typo3.com)
-*  All rights reserved
-*
-*  This script is part of the TYPO3 project. The TYPO3 project is
-*  free software; you can redistribute it and/or modify
-*  it under the terms of the GNU General Public License as published by
-*  the Free Software Foundation; either version 2 of the License, or
-*  (at your option) any later version.
-*
-*  The GNU General Public License can be found at
-*  http://www.gnu.org/copyleft/gpl.html.
-*  A copy is found in the textfile GPL.txt and important notices to the license
-*  from the author is found in LICENSE.txt distributed with these scripts.
-*
-*
-*  This script is distributed in the hope that it will be useful,
-*  but WITHOUT ANY WARRANTY; without even the implied warranty of
-*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-*  GNU General Public License for more details.
-*
-*  This copyright notice MUST APPEAR in all copies of the script!
-***************************************************************/
+ *  Copyright notice
+ *
+ *  (c) 1999-2010 Kasper Skårhøj (kasperYYYY@typo3.com)
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *  A copy is found in the textfile GPL.txt and important notices to the license
+ *  from the author is found in LICENSE.txt distributed with these scripts.
+ *
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
 /**
  * Contains a class for evaluation of database integrity according to $TCA
  * Most of these functions are considered obsolete!
 /**
  * Contains a class for evaluation of database integrity according to $TCA
  * Most of these functions are considered obsolete!
  *
  *
  *   93: class t3lib_admin
  *
  *
  *   93: class t3lib_admin
- *  128:     function genTree($theID, $depthData, $versions=FALSE)
- *  217:     function genTree_records($theID, $depthData, $table='', $versions=FALSE)
- *  292:     function genTreeStatus()
- *  315:     function lostRecords($pid_list)
- *  346:     function fixLostRecord($table,$uid)
- *  367:     function countRecords($pid_list)
- *  395:     function getGroupFields($mode)
- *  429:     function getFileFields($uploadfolder)
- *  452:     function getDBFields($theSearchTable)
- *  480:     function selectNonEmptyRecordsWithFkeys($fkey_arrays)
- *  569:     function testFileRefs ()
- *  620:     function testDBRefs($theArray)
- *  658:     function whereIsRecordReferenced($searchTable,$id)
- *  695:     function whereIsFileReferenced($uploadfolder,$filename)
+ *  128:        function genTree($theID, $depthData, $versions=FALSE)
+ *  217:        function genTree_records($theID, $depthData, $table='', $versions=FALSE)
+ *  292:        function genTreeStatus()
+ *  315:        function lostRecords($pid_list)
+ *  346:        function fixLostRecord($table,$uid)
+ *  367:        function countRecords($pid_list)
+ *  395:        function getGroupFields($mode)
+ *  429:        function getFileFields($uploadfolder)
+ *  452:        function getDBFields($theSearchTable)
+ *  480:        function selectNonEmptyRecordsWithFkeys($fkey_arrays)
+ *  569:        function testFileRefs ()
+ *  620:        function testDBRefs($theArray)
+ *  658:        function whereIsRecordReferenced($searchTable,$id)
+ *  695:        function whereIsFileReferenced($uploadfolder,$filename)
  *
  * TOTAL FUNCTIONS: 14
  * (This index is automatically created/updated by the extension "extdeveval")
  *
  * TOTAL FUNCTIONS: 14
  * (This index is automatically created/updated by the extension "extdeveval")
  */
 
 
  */
 
 
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
 /**
  * This class holds functions used by the TYPO3 backend to check the integrity of the database (The DBint module, 'lowlevel' extension)
  *
 /**
  * This class holds functions used by the TYPO3 backend to check the integrity of the database (The DBint module, 'lowlevel' extension)
  *
  * @subpackage t3lib
  */
 class t3lib_admin {
  * @subpackage t3lib
  */
 class t3lib_admin {
-       var $genTree_includeDeleted = TRUE;             // if set, genTree() includes deleted pages. This is default.
-       var $genTree_includeVersions = TRUE;            // if set, genTree() includes verisonized pages/records. This is default.
-       var $genTree_includeRecords = FALSE;            // if set, genTree() includes records from pages.
-       var $perms_clause = '';                         // extra where-clauses for the tree-selection
-       var $genTree_makeHTML = 0;                      // if set, genTree() generates HTML, that visualizes the tree.
+       var $genTree_includeDeleted = TRUE; // if set, genTree() includes deleted pages. This is default.
+       var $genTree_includeVersions = TRUE; // if set, genTree() includes verisonized pages/records. This is default.
+       var $genTree_includeRecords = FALSE; // if set, genTree() includes records from pages.
+       var $perms_clause = ''; // extra where-clauses for the tree-selection
+       var $genTree_makeHTML = 0; // if set, genTree() generates HTML, that visualizes the tree.
 
                // internal
 
                // internal
-       var $page_idArray = Array();            // Will hod id/rec pais from genTree()
-       var $rec_idArray = Array();
-       var $getTree_HTML = '';                 // Will hold the HTML-code visualising the tree. genTree()
+       var $page_idArray = array(); // Will hod id/rec pais from genTree()
+       var $rec_idArray = array();
+       var $getTree_HTML = ''; // Will hold the HTML-code visualising the tree. genTree()
        var $backPath = '';
 
                // internal
        var $backPath = '';
 
                // internal
-       var $checkFileRefs = Array();
-       var $checkSelectDBRefs = Array();       // From the select-fields
-       var $checkGroupDBRefs = Array();        // From the group-fields
+       var $checkFileRefs = array();
+       var $checkSelectDBRefs = array(); // From the select-fields
+       var $checkGroupDBRefs = array(); // From the group-fields
 
 
-       var $recStats = Array(
+       var $recStats = array(
                'allValid' => array(),
                'published_versions' => array(),
                'deleted' => array(),
        );
                'allValid' => array(),
                'published_versions' => array(),
                'deleted' => array(),
        );
-       var $lRecords = Array();
+       var $lRecords = array();
        var $lostPagesList = '';
 
 
        var $lostPagesList = '';
 
 
@@ -125,21 +107,21 @@ class t3lib_admin {
         * @param       boolean         Internal variable, don't set from outside!
         * @return      void
         */
         * @param       boolean         Internal variable, don't set from outside!
         * @return      void
         */
-       function genTree($theID, $depthData, $versions=FALSE)   {
+       function genTree($theID, $depthData, $versions = FALSE) {
 
 
-               if ($versions)  {
+               if ($versions) {
                        $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
                        $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
-                               'uid,title,doktype,deleted,t3ver_wsid,t3ver_id,t3ver_count,t3ver_swapmode'.(t3lib_extMgm::isLoaded('cms')?',hidden':''),
+                               'uid,title,doktype,deleted,t3ver_wsid,t3ver_id,t3ver_count,t3ver_swapmode' . (t3lib_extMgm::isLoaded('cms') ? ',hidden' : ''),
                                'pages',
                                'pages',
-                               'pid=-1 AND t3ver_oid='.intval($theID).' '.((!$this->genTree_includeDeleted)?'AND deleted=0':'').$this->perms_clause,
+                                       'pid=-1 AND t3ver_oid=' . intval($theID) . ' ' . ((!$this->genTree_includeDeleted) ? 'AND deleted=0' : '') . $this->perms_clause,
                                '',
                                'sorting'
                        );
                } else {
                        $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
                                '',
                                'sorting'
                        );
                } else {
                        $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
-                               'uid,title,doktype,deleted'.(t3lib_extMgm::isLoaded('cms')?',hidden':''),
+                               'uid,title,doktype,deleted' . (t3lib_extMgm::isLoaded('cms') ? ',hidden' : ''),
                                'pages',
                                'pages',
-                               'pid='.intval($theID).' '.((!$this->genTree_includeDeleted)?'AND deleted=0':'').$this->perms_clause,
+                                       'pid=' . intval($theID) . ' ' . ((!$this->genTree_includeDeleted) ? 'AND deleted=0' : '') . $this->perms_clause,
                                '',
                                'sorting'
                        );
                                '',
                                'sorting'
                        );
@@ -148,50 +130,58 @@ class t3lib_admin {
                        // Traverse the records selected:
                $a = 0;
                $c = $GLOBALS['TYPO3_DB']->sql_num_rows($res);
                        // Traverse the records selected:
                $a = 0;
                $c = $GLOBALS['TYPO3_DB']->sql_num_rows($res);
-               while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))      {
+               while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
 
                                // Prepare the additional label used in the HTML output in case of versions:
 
                                // Prepare the additional label used in the HTML output in case of versions:
-                       if ($versions)  {
-                               $versionLabel = '[v1.'.$row['t3ver_id'].'; WS#'.$row['t3ver_wsid'].']';
-                       } else $versionLabel='';
+                       if ($versions) {
+                               $versionLabel = '[v1.' . $row['t3ver_id'] . '; WS#' . $row['t3ver_wsid'] . ']';
+                       } else {
+                               $versionLabel = '';
+                       }
 
                        $a++;
                        $newID = $row['uid'];
 
                                // Build HTML output:
 
                        $a++;
                        $newID = $row['uid'];
 
                                // Build HTML output:
-                       if ($this->genTree_makeHTML)    {
-                               $this->genTree_HTML.=LF.'<div><span class="nobr">';
+                       if ($this->genTree_makeHTML) {
+                               $this->genTree_HTML .= LF . '<div><span class="nobr">';
                                $PM = 'join';
                                $PM = 'join';
-                               $LN = ($a==$c)?'blank':'line';
-                               $BTM = ($a==$c)?'bottom':'';
-                               $this->genTree_HTML.= $depthData.
-                                       '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/ol/'.$PM.$BTM.'.gif','width="18" height="16"').' align="top" alt="" />'.
-                                       $versionLabel.
-                                       t3lib_iconWorks::getSpriteIconForRecord('pages', $row) .
-                                       htmlspecialchars($row['uid'].': '.t3lib_div::fixed_lgd_cs(strip_tags($row['title']),50)).'</span></div>';
+                               $LN = ($a == $c) ? 'blank' : 'line';
+                               $BTM = ($a == $c) ? 'bottom' : '';
+                               $this->genTree_HTML .= $depthData .
+                                               '<img' . t3lib_iconWorks::skinImg($this->backPath, 'gfx/ol/' . $PM . $BTM . '.gif', 'width="18" height="16"') . ' align="top" alt="" />' .
+                                               $versionLabel .
+                                               t3lib_iconWorks::getSpriteIconForRecord('pages', $row) .
+                                               htmlspecialchars($row['uid'] . ': ' . t3lib_div::fixed_lgd_cs(strip_tags($row['title']), 50)) . '</span></div>';
                        }
 
                                // Register various data for this item:
                        }
 
                                // Register various data for this item:
-                       $this->page_idArray[$newID]=$row;
+                       $this->page_idArray[$newID] = $row;
 
                        $this->recStats['all_valid']['pages'][$newID] = $newID;
 
                        $this->recStats['all_valid']['pages'][$newID] = $newID;
-#                      if ($versions)  $this->recStats['versions']['pages'][$newID] = $newID;
-                       if ($row['deleted'])    $this->recStats['deleted']['pages'][$newID] = $newID;
-                       if ($versions && $row['t3ver_count']>=1) {
+                       #                       if ($versions)  $this->recStats['versions']['pages'][$newID] = $newID;
+                       if ($row['deleted']) {
+                               $this->recStats['deleted']['pages'][$newID] = $newID;
+                       }
+                       if ($versions && $row['t3ver_count'] >= 1) {
                                $this->recStats['published_versions']['pages'][$newID] = $newID;
                        }
 
                                $this->recStats['published_versions']['pages'][$newID] = $newID;
                        }
 
-                       if ($row['deleted']) {$this->recStat['deleted']++;}
-                       if ($row['hidden']) {$this->recStat['hidden']++;}
+                       if ($row['deleted']) {
+                               $this->recStat['deleted']++;
+                       }
+                       if ($row['hidden']) {
+                               $this->recStat['hidden']++;
+                       }
                        $this->recStat['doktype'][$row['doktype']]++;
 
                                // Create the HTML code prefix for recursive call:
                        $this->recStat['doktype'][$row['doktype']]++;
 
                                // Create the HTML code prefix for recursive call:
-                       $genHTML =  $depthData.'<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/ol/'.$LN.'.gif','width="18" height="16"').' align="top" alt="" />'.$versionLabel;
+                       $genHTML = $depthData . '<img' . t3lib_iconWorks::skinImg($this->backPath, 'gfx/ol/' . $LN . '.gif', 'width="18" height="16"') . ' align="top" alt="" />' . $versionLabel;
 
                                // If all records should be shown, do so:
 
                                // If all records should be shown, do so:
-                       if ($this->genTree_includeRecords)      {
-                               foreach($GLOBALS['TCA'] as $tableName => $cfg)  {
-                                       if ($tableName!='pages') {
+                       if ($this->genTree_includeRecords) {
+                               foreach ($GLOBALS['TCA'] as $tableName => $cfg) {
+                                       if ($tableName != 'pages') {
                                                $this->genTree_records($newID, $this->genTree_HTML ? $genHTML : '', $tableName);
                                        }
                                }
                                                $this->genTree_records($newID, $this->genTree_HTML ? $genHTML : '', $tableName);
                                        }
                                }
@@ -201,7 +191,7 @@ class t3lib_admin {
                        $this->genTree($newID, $this->genTree_HTML ? $genHTML : '');
 
                                // If versions are included in the tree, add those now:
                        $this->genTree($newID, $this->genTree_HTML ? $genHTML : '');
 
                                // If versions are included in the tree, add those now:
-                       if ($this->genTree_includeVersions)     {
+                       if ($this->genTree_includeVersions) {
                                $this->genTree($newID, $this->genTree_HTML ? $genHTML : '', TRUE);
                        }
                }
                                $this->genTree($newID, $this->genTree_HTML ? $genHTML : '', TRUE);
                        }
                }
@@ -214,70 +204,73 @@ class t3lib_admin {
         * @param       [type]          $versions: ...
         * @return      [type]          ...
         */
         * @param       [type]          $versions: ...
         * @return      [type]          ...
         */
-       function genTree_records($theID, $depthData, $table='', $versions=FALSE)        {
+       function genTree_records($theID, $depthData, $table = '', $versions = FALSE) {
                global $TCA;
 
                global $TCA;
 
-               if ($versions)  {
+               if ($versions) {
                                // Select all records from table pointing to this page:
                        $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
                                t3lib_BEfunc::getCommonSelectFields($table),
                                $table,
                                // Select all records from table pointing to this page:
                        $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
                                t3lib_BEfunc::getCommonSelectFields($table),
                                $table,
-                               'pid=-1 AND t3ver_oid='.intval($theID).
-                                       (!$this->genTree_includeDeleted?t3lib_BEfunc::deleteClause($table):'')
+                                       'pid=-1 AND t3ver_oid=' . intval($theID) .
+                                                       (!$this->genTree_includeDeleted ? t3lib_BEfunc::deleteClause($table) : '')
                        );
                } else {
                                // Select all records from table pointing to this page:
                        $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
                                t3lib_BEfunc::getCommonSelectFields($table),
                                $table,
                        );
                } else {
                                // Select all records from table pointing to this page:
                        $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
                                t3lib_BEfunc::getCommonSelectFields($table),
                                $table,
-                               'pid='.intval($theID).
-                                       (!$this->genTree_includeDeleted?t3lib_BEfunc::deleteClause($table):'')
+                                       'pid=' . intval($theID) .
+                                                       (!$this->genTree_includeDeleted ? t3lib_BEfunc::deleteClause($table) : '')
                        );
                }
 
                        // Traverse selected:
                $a = 0;
                $c = $GLOBALS['TYPO3_DB']->sql_num_rows($res);
                        );
                }
 
                        // Traverse selected:
                $a = 0;
                $c = $GLOBALS['TYPO3_DB']->sql_num_rows($res);
-               while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))      {
+               while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
 
                                // Prepare the additional label used in the HTML output in case of versions:
 
                                // Prepare the additional label used in the HTML output in case of versions:
-                       if ($versions)  {
-                               $versionLabel = '[v1.'.$row['t3ver_id'].'; WS#'.$row['t3ver_wsid'].']';
-                       } else $versionLabel='';
+                       if ($versions) {
+                               $versionLabel = '[v1.' . $row['t3ver_id'] . '; WS#' . $row['t3ver_wsid'] . ']';
+                       } else {
+                               $versionLabel = '';
+                       }
 
                        $a++;
                        $newID = $row['uid'];
 
                                // Build HTML output:
 
                        $a++;
                        $newID = $row['uid'];
 
                                // Build HTML output:
-                       if ($this->genTree_makeHTML)    {
-                               $this->genTree_HTML.=LF.'<div><span class="nobr">';
+                       if ($this->genTree_makeHTML) {
+                               $this->genTree_HTML .= LF . '<div><span class="nobr">';
                                $PM = 'join';
                                $PM = 'join';
-                               $LN = ($a==$c)?'blank':'line';
-                               $BTM = ($a==$c)?'bottom':'';
-                               $this->genTree_HTML.= $depthData.
-                                       '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/ol/'.$PM.$BTM.'.gif','width="18" height="16"').' align="top" alt="" />'.
-                                       $versionLabel.
-                                       t3lib_iconWorks::getSpriteIconForRecord($table, $row, array('title'=> $table)) . htmlspecialchars($row['uid'] . ': ' . t3lib_BEfunc::getRecordTitle($table,$row)) . '</span></div>';
+                               $LN = ($a == $c) ? 'blank' : 'line';
+                               $BTM = ($a == $c) ? 'bottom' : '';
+                               $this->genTree_HTML .= $depthData .
+                                               '<img' . t3lib_iconWorks::skinImg($this->backPath, 'gfx/ol/' . $PM . $BTM . '.gif', 'width="18" height="16"') . ' align="top" alt="" />' .
+                                               $versionLabel .
+                                               t3lib_iconWorks::getSpriteIconForRecord($table, $row, array('title' => $table)) . htmlspecialchars($row['uid'] . ': ' . t3lib_BEfunc::getRecordTitle($table, $row)) . '</span></div>';
                        }
 
                                // Register various data for this item:
                        }
 
                                // Register various data for this item:
-                       $this->rec_idArray[$table][$newID]=$row;
+                       $this->rec_idArray[$table][$newID] = $row;
 
                        $this->recStats['all_valid'][$table][$newID] = $newID;
 
                        $this->recStats['all_valid'][$table][$newID] = $newID;
-#                      $this->recStats[$versions?'versions':'live'][$table][$newID] = $newID;
-                       if ($row['deleted'])    $this->recStats['deleted'][$table][$newID] = $newID;
-                       if ($versions && $row['t3ver_count']>=1 && $row['t3ver_wsid']==0) {
+                       #                       $this->recStats[$versions?'versions':'live'][$table][$newID] = $newID;
+                       if ($row['deleted']) {
+                               $this->recStats['deleted'][$table][$newID] = $newID;
+                       }
+                       if ($versions && $row['t3ver_count'] >= 1 && $row['t3ver_wsid'] == 0) {
                                $this->recStats['published_versions'][$table][$newID] = $newID;
                        }
 
                                $this->recStats['published_versions'][$table][$newID] = $newID;
                        }
 
-#                      if ($row['deleted']) {$this->recStat['deleted']++;}
-#                      if ($row['hidden']) {$this->recStat['hidden']++;}
-
+                       #                       if ($row['deleted']) {$this->recStat['deleted']++;}
+                       #                       if ($row['hidden']) {$this->recStat['hidden']++;}
 
 
                                // Select all versions of this record:
                        if ($this->genTree_includeVersions && $TCA[$table]['ctrl']['versioningWS']) {
 
 
                                // Select all versions of this record:
                        if ($this->genTree_includeVersions && $TCA[$table]['ctrl']['versioningWS']) {
-                               $genHTML =  $depthData.'<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/ol/'.$LN.'.gif','width="18" height="16"').' align="top" alt="" />';
+                               $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);
                        }
 
                                $this->genTree_records($newID, $genHTML, $table, TRUE);
                        }
@@ -289,54 +282,50 @@ class t3lib_admin {
         *
         * @return      [type]          ...
         */
         *
         * @return      [type]          ...
         */
-       function genTreeStatus($root=0) {
-               $this->genTree_includeDeleted = TRUE;           // if set, genTree() includes deleted pages. This is default.
-               $this->genTree_includeVersions = TRUE;          // if set, genTree() includes verisonized pages/records. This is default.
-               $this->genTree_includeRecords = TRUE;           // if set, genTree() includes records from pages.
-               $this->perms_clause = '';                                       // extra where-clauses for the tree-selection
-               $this->genTree_makeHTML = 0;                            // if set, genTree() generates HTML, that visualizes the tree.
+       function genTreeStatus($root = 0) {
+               $this->genTree_includeDeleted = TRUE; // if set, genTree() includes deleted pages. This is default.
+               $this->genTree_includeVersions = TRUE; // if set, genTree() includes verisonized pages/records. This is default.
+               $this->genTree_includeRecords = TRUE; // if set, genTree() includes records from pages.
+               $this->perms_clause = ''; // extra where-clauses for the tree-selection
+               $this->genTree_makeHTML = 0; // if set, genTree() generates HTML, that visualizes the tree.
 
 
-               $this->genTree($root,'');
+               $this->genTree($root, '');
 
                return $this->recStats;
        }
 
 
 
                return $this->recStats;
        }
 
 
-
-
-
-
        /**
         * Fills $this->lRecords with the records from all tc-tables that are not attached to a PID in the pid-list.
         *
         * @param       string          list of pid's (page-record uid's). This list is probably made by genTree()
         * @return      void
         */
        /**
         * Fills $this->lRecords with the records from all tc-tables that are not attached to a PID in the pid-list.
         *
         * @param       string          list of pid's (page-record uid's). This list is probably made by genTree()
         * @return      void
         */
-       function lostRecords($pid_list) {
+       function lostRecords($pid_list) {
                global $TCA;
                global $TCA;
-               $this->lostPagesList='';
-               if ($pid_list)  {
+               $this->lostPagesList = '';
+               if ($pid_list) {
                        foreach ($TCA as $table => $tableConf) {
                                t3lib_div::loadTCA($table);
 
                                $pid_list_tmp = $pid_list;
                        foreach ($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($TCA[$table]['ctrl']['versioningWS']) || !$TCA[$table]['ctrl']['versioningWS']) {
                                                // Remove preceding "-1," for non-versioned tables
                                                // Remove preceding "-1," for non-versioned tables
-                                       $pid_list_tmp = preg_replace('/^\-1,/','',$pid_list_tmp);
+                                       $pid_list_tmp = preg_replace('/^\-1,/', '', $pid_list_tmp);
                                }
 
                                }
 
-                               $garbage = $GLOBALS['TYPO3_DB']->exec_SELECTquery (
-                                                               'uid,pid,'.$TCA[$table]['ctrl']['label'],
-                                                               $table,
-                                                               'pid NOT IN ('.$pid_list_tmp.')'
-                                                       );
+                               $garbage = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
+                                       'uid,pid,' . $TCA[$table]['ctrl']['label'],
+                                       $table,
+                                               'pid NOT IN (' . $pid_list_tmp . ')'
+                               );
                                $lostIdList = array();
                                $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']]) );
-                                       $lostIdList[]=$row['uid'];
+                               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']]));
+                                       $lostIdList[] = $row['uid'];
                                }
                                }
-                               if ($table=='pages')    {
-                                       $this->lostPagesList=implode(',',$lostIdList);
+                               if ($table == 'pages') {
+                                       $this->lostPagesList = implode(',', $lostIdList);
                                }
                        }
                }
                                }
                        }
                }
@@ -349,19 +338,21 @@ class t3lib_admin {
         * @param       integer         The uid of the record which will have the PID value set to 0 (zero)
         * @return      boolean         True if done.
         */
         * @param       integer         The uid of the record which will have the PID value set to 0 (zero)
         * @return      boolean         True if done.
         */
-       function fixLostRecord($table,$uid)     {
-               if ($table && $GLOBALS['TCA'][$table] && $uid && is_array($this->lRecords[$table][$uid]) && $GLOBALS['BE_USER']->user['admin']) {
+       function fixLostRecord($table, $uid) {
+               if ($table && $GLOBALS['TCA'][$table] && $uid && is_array($this->lRecords[$table][$uid]) && $GLOBALS['BE_USER']->user['admin']) {
 
                        $updateFields = array();
                        $updateFields['pid'] = 0;
 
                        $updateFields = array();
                        $updateFields['pid'] = 0;
-                       if ($GLOBALS['TCA'][$table]['ctrl']['enablecolumns']['disabled'])       {       // If possible a lost record restored is hidden as default
+                       if ($GLOBALS['TCA'][$table]['ctrl']['enablecolumns']['disabled']) { // If possible a lost record restored is hidden as default
                                $updateFields[$GLOBALS['TCA'][$table]['ctrl']['enablecolumns']['disabled']] = 1;
                        }
 
                                $updateFields[$GLOBALS['TCA'][$table]['ctrl']['enablecolumns']['disabled']] = 1;
                        }
 
-                       $GLOBALS['TYPO3_DB']->exec_UPDATEquery($table, 'uid='.intval($uid), $updateFields);
+                       $GLOBALS['TYPO3_DB']->exec_UPDATEquery($table, 'uid=' . intval($uid), $updateFields);
 
                        return TRUE;
 
                        return TRUE;
-               } else return FALSE;
+               } else {
+                       return FALSE;
+               }
        }
 
        /**
        }
 
        /**
@@ -370,26 +361,26 @@ class t3lib_admin {
         * @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.
         */
         * @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.
         */
-       function countRecords($pid_list)        {
+       function countRecords($pid_list) {
                global $TCA;
                global $TCA;
-               $list=Array();
-               $list_n=Array();
-               if ($pid_list)  {
+               $list = array();
+               $list_n = array();
+               if ($pid_list) {
                        foreach ($TCA as $table => $tableConf) {
                                t3lib_div::loadTCA($table);
 
                                $pid_list_tmp = $pid_list;
                        foreach ($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($TCA[$table]['ctrl']['versioningWS']) || !$TCA[$table]['ctrl']['versioningWS']) {
                                                // Remove preceding "-1," for non-versioned tables
                                                // Remove preceding "-1," for non-versioned tables
-                                       $pid_list_tmp = preg_replace('/^\-1,/','',$pid_list_tmp);
+                                       $pid_list_tmp = preg_replace('/^\-1,/', '', $pid_list_tmp);
                                }
 
                                }
 
-                               $count = $GLOBALS['TYPO3_DB']->exec_SELECTcountRows('uid', $table, 'pid IN ('.$pid_list_tmp.')');
+                               $count = $GLOBALS['TYPO3_DB']->exec_SELECTcountRows('uid', $table, 'pid IN (' . $pid_list_tmp . ')');
                                if ($count) {
                                        $list[$table] = $count;
                                }
 
                                if ($count) {
                                        $list[$table] = $count;
                                }
 
-                               $count = $GLOBALS['TYPO3_DB']->exec_SELECTcountRows('uid', $table, 'pid IN ('.$pid_list_tmp.')' . t3lib_BEfunc::deleteClause($table));
+                               $count = $GLOBALS['TYPO3_DB']->exec_SELECTcountRows('uid', $table, 'pid IN (' . $pid_list_tmp . ')' . t3lib_BEfunc::deleteClause($table));
                                if ($count) {
                                        $list_n[$table] = $count;
                                }
                                if ($count) {
                                        $list_n[$table] = $count;
                                }
@@ -404,27 +395,27 @@ class t3lib_admin {
         * @param       string          $mode = file, $mode = db, $mode = '' (all...)
         * @return      array           An array with all fields listed that somehow are references to other records (foreign-keys) or files
         */
         * @param       string          $mode = file, $mode = db, $mode = '' (all...)
         * @return      array           An array with all fields listed that somehow are references to other records (foreign-keys) or files
         */
-       function getGroupFields($mode)  {
+       function getGroupFields($mode) {
                global $TCA;
                global $TCA;
-               $result = Array();
+               $result = array();
                foreach ($TCA as $table => $tableConf) {
                        t3lib_div::loadTCA($table);
                        $cols = $TCA[$table]['columns'];
                        foreach ($cols as $field => $config) {
                foreach ($TCA as $table => $tableConf) {
                        t3lib_div::loadTCA($table);
                        $cols = $TCA[$table]['columns'];
                        foreach ($cols as $field => $config) {
-                               if ($config['config']['type']=='group') {
+                               if ($config['config']['type'] == 'group') {
                                        if (
                                        if (
-                                               ((!$mode||$mode=='file') && $config['config']['internal_type']=='file') ||
-                                               ((!$mode||$mode=='db') && $config['config']['internal_type']=='db')
-                                               )       {
-                                               $result[$table][]=$field;
+                                               ((!$mode || $mode == 'file') && $config['config']['internal_type'] == 'file') ||
+                                               ((!$mode || $mode == 'db') && $config['config']['internal_type'] == 'db')
+                                       ) {
+                                               $result[$table][] = $field;
                                        }
                                }
                                        }
                                }
-                               if ( (!$mode||$mode=='db') && $config['config']['type']=='select' && $config['config']['foreign_table'])        {
-                                       $result[$table][]=$field;
+                               if ((!$mode || $mode == 'db') && $config['config']['type'] == 'select' && $config['config']['foreign_table']) {
+                                       $result[$table][] = $field;
                                }
                        }
                                }
                        }
-                       if ($result[$table])    {
-                               $result[$table] = implode(',',$result[$table]);
+                       if ($result[$table]) {
+                               $result[$table] = implode(',', $result[$table]);
                        }
                }
                return $result;
                        }
                }
                return $result;
@@ -436,15 +427,15 @@ class t3lib_admin {
         * @param       string          Path to uploadfolder
         * @return      array           An array with all fields listed that have references to files in the $uploadfolder
         */
         * @param       string          Path to uploadfolder
         * @return      array           An array with all fields listed that have references to files in the $uploadfolder
         */
-       function getFileFields($uploadfolder)   {
+       function getFileFields($uploadfolder) {
                global $TCA;
                global $TCA;
-               $result = Array();
+               $result = array();
                foreach ($TCA as $table => $tableConf) {
                        t3lib_div::loadTCA($table);
                        $cols = $TCA[$table]['columns'];
                        foreach ($cols as $field => $config) {
                foreach ($TCA as $table => $tableConf) {
                        t3lib_div::loadTCA($table);
                        $cols = $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);
+                               if ($config['config']['type'] == 'group' && $config['config']['internal_type'] == 'file' && $config['config']['uploadfolder'] == $uploadfolder) {
+                                       $result[] = array($table, $field);
                                }
                        }
                }
                                }
                        }
                }
@@ -457,20 +448,20 @@ class t3lib_admin {
         * @param       string          Table name
         * @return      array
         */
         * @param       string          Table name
         * @return      array
         */
-       function getDBFields($theSearchTable)   {
+       function getDBFields($theSearchTable) {
                global $TCA;
                global $TCA;
-               $result = Array();
-               reset ($TCA);
+               $result = array();
+               reset($TCA);
                foreach ($TCA as $table => $tableConf) {
                        t3lib_div::loadTCA($table);
                        $cols = $TCA[$table]['columns'];
                        foreach ($cols as $field => $config) {
                foreach ($TCA as $table => $tableConf) {
                        t3lib_div::loadTCA($table);
                        $cols = $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))    {
-                                               $result[]=Array($table,$field);
+                               if ($config['config']['type'] == 'group' && $config['config']['internal_type'] == 'db') {
+                                       if (trim($config['config']['allowed']) == '*' || strstr($config['config']['allowed'], $theSearchTable)) {
+                                               $result[] = array($table, $field);
                                        }
                                        }
-                               } else if ($config['config']['type']=='select' && $config['config']['foreign_table']==$theSearchTable)  {
-                                       $result[]=Array($table,$field);
+                               } elseif ($config['config']['type'] == 'select' && $config['config']['foreign_table'] == $theSearchTable) {
+                                       $result[] = array($table, $field);
                                }
                        }
                }
                                }
                        }
                }
@@ -484,72 +475,72 @@ class t3lib_admin {
         * @return      void
         * @see getGroupFields()
         */
         * @return      void
         * @see getGroupFields()
         */
-       function selectNonEmptyRecordsWithFkeys($fkey_arrays)   {
+       function selectNonEmptyRecordsWithFkeys($fkey_arrays) {
                global $TCA;
                global $TCA;
-               if (is_array($fkey_arrays))     {
+               if (is_array($fkey_arrays)) {
                        foreach ($fkey_arrays as $table => $field_list) {
                        foreach ($fkey_arrays as $table => $field_list) {
-                               if ($TCA[$table] && trim($field_list))  {
+                               if ($TCA[$table] && trim($field_list)) {
                                        t3lib_div::loadTCA($table);
                                        t3lib_div::loadTCA($table);
-                                       $fieldArr = explode(',',$field_list);
+                                       $fieldArr = explode(',', $field_list);
 
 
-                                       if(t3lib_extMgm::isLoaded('dbal')) {
+                                       if (t3lib_extMgm::isLoaded('dbal')) {
                                                $fields = $GLOBALS['TYPO3_DB']->admin_get_fields($table);
                                                $field = array_shift($fieldArr);
                                                $fields = $GLOBALS['TYPO3_DB']->admin_get_fields($table);
                                                $field = array_shift($fieldArr);
-                                               $cl_fl = ($GLOBALS['TYPO3_DB']->MetaType($fields[$field]['type'],$table) == 'I' || $GLOBALS['TYPO3_DB']->MetaType($fields[$field]['type'],$table) == 'N' || $GLOBALS['TYPO3_DB']->MetaType($fields[$field]['type'],$table) == 'R') ?
-                                               $field.'!=0' : $field.'!=\'\'';
+                                               $cl_fl = ($GLOBALS['TYPO3_DB']->MetaType($fields[$field]['type'], $table) == 'I' || $GLOBALS['TYPO3_DB']->MetaType($fields[$field]['type'], $table) == 'N' || $GLOBALS['TYPO3_DB']->MetaType($fields[$field]['type'], $table) == 'R') ?
+                                                               $field . '!=0' : $field . '!=\'\'';
                                                foreach ($fieldArr as $field) {
                                                foreach ($fieldArr as $field) {
-                                                       $cl_fl .= ($GLOBALS['TYPO3_DB']->MetaType($fields[$field]['type'],$table) == 'I' || $GLOBALS['TYPO3_DB']->MetaType($fields[$field]['type'],$table) == 'N' || $GLOBALS['TYPO3_DB']->MetaType($fields[$field]['type'],$table) == 'R') ?
-                                                       ' OR '.$field.'!=0' : ' OR '.$field.'!=\'\'';
+                                                       $cl_fl .= ($GLOBALS['TYPO3_DB']->MetaType($fields[$field]['type'], $table) == 'I' || $GLOBALS['TYPO3_DB']->MetaType($fields[$field]['type'], $table) == 'N' || $GLOBALS['TYPO3_DB']->MetaType($fields[$field]['type'], $table) == 'R') ?
+                                                                       ' OR ' . $field . '!=0' : ' OR ' . $field . '!=\'\'';
                                                }
                                                unset($fields);
                                        }
                                        else {
                                                }
                                                unset($fields);
                                        }
                                        else {
-                                               $cl_fl = implode ('!=\'\' OR ',$fieldArr). '!=\'\'';
+                                               $cl_fl = implode('!=\'\' OR ', $fieldArr) . '!=\'\'';
                                        }
 
                                        }
 
-                                       $mres = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid,'.$field_list, $table, $cl_fl);
-                                       while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($mres))     {
+                                       $mres = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid,' . $field_list, $table, $cl_fl);
+                                       while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($mres)) {
                                                foreach ($fieldArr as $field) {
                                                foreach ($fieldArr as $field) {
-                                                       if (trim($row[$field]))         {
+                                                       if (trim($row[$field])) {
                                                                $fieldConf = $TCA[$table]['columns'][$field]['config'];
                                                                $fieldConf = $TCA[$table]['columns'][$field]['config'];
-                                                               if ($fieldConf['type']=='group')        {
-                                                                       if ($fieldConf['internal_type']=='file')        {
-                                                                               // files...
-                                                                               if ($fieldConf['MM'])   {
-                                                                                       $tempArr=array();
+                                                               if ($fieldConf['type'] == 'group') {
+                                                                       if ($fieldConf['internal_type'] == 'file') {
+                                                                                       // files...
+                                                                               if ($fieldConf['MM']) {
+                                                                                       $tempArr = array();
                                                                                        $dbAnalysis = t3lib_div::makeInstance('t3lib_loadDBGroup');
                                                                                        $dbAnalysis = t3lib_div::makeInstance('t3lib_loadDBGroup');
-                                                                                       $dbAnalysis->start('','files',$fieldConf['MM'],$row['uid']);
+                                                                                       $dbAnalysis->start('', 'files', $fieldConf['MM'], $row['uid']);
                                                                                        foreach ($dbAnalysis->itemArray as $somekey => $someval) {
                                                                                        foreach ($dbAnalysis->itemArray as $somekey => $someval) {
-                                                                                               if ($someval['id'])     {
-                                                                                                       $tempArr[]=$someval['id'];
+                                                                                               if ($someval['id']) {
+                                                                                                       $tempArr[] = $someval['id'];
                                                                                                }
                                                                                        }
                                                                                } else {
                                                                                                }
                                                                                        }
                                                                                } else {
-                                                                                       $tempArr = explode(',',trim($row[$field]));
+                                                                                       $tempArr = explode(',', trim($row[$field]));
                                                                                }
                                                                                foreach ($tempArr as $file) {
                                                                                        $file = trim($file);
                                                                                }
                                                                                foreach ($tempArr as $file) {
                                                                                        $file = trim($file);
-                                                                                       if ($file)      {
-                                                                                               $this->checkFileRefs[$fieldConf['uploadfolder']][$file]+=1;
+                                                                                       if ($file) {
+                                                                                               $this->checkFileRefs[$fieldConf['uploadfolder']][$file] += 1;
                                                                                        }
                                                                                }
                                                                        }
                                                                                        }
                                                                                }
                                                                        }
-                                                                       if ($fieldConf['internal_type']=='db')  {
-                                                                               // dbs - group
+                                                                       if ($fieldConf['internal_type'] == 'db') {
+                                                                                       // dbs - group
                                                                                $dbAnalysis = t3lib_div::makeInstance('t3lib_loadDBGroup');
                                                                                $dbAnalysis = t3lib_div::makeInstance('t3lib_loadDBGroup');
-                                                                               $dbAnalysis->start($row[$field],$fieldConf['allowed'],$fieldConf['MM'],$row['uid'], $table, $fieldConf);
+                                                                               $dbAnalysis->start($row[$field], $fieldConf['allowed'], $fieldConf['MM'], $row['uid'], $table, $fieldConf);
                                                                                foreach ($dbAnalysis->itemArray as $tempArr) {
                                                                                foreach ($dbAnalysis->itemArray as $tempArr) {
-                                                                                       $this->checkGroupDBRefs[$tempArr['table']][$tempArr['id']]+=1;
+                                                                                       $this->checkGroupDBRefs[$tempArr['table']][$tempArr['id']] += 1;
                                                                                }
                                                                        }
                                                                }
                                                                                }
                                                                        }
                                                                }
-                                                               if ($fieldConf['type']=='select' && $fieldConf['foreign_table'])        {
-                                                                       // dbs - select
+                                                               if ($fieldConf['type'] == 'select' && $fieldConf['foreign_table']) {
+                                                                               // dbs - select
                                                                        $dbAnalysis = t3lib_div::makeInstance('t3lib_loadDBGroup');
                                                                        $dbAnalysis = t3lib_div::makeInstance('t3lib_loadDBGroup');
-                                                                       $dbAnalysis->start($row[$field],$fieldConf['foreign_table'],$fieldConf['MM'],$row['uid'], $table, $fieldConf);
+                                                                       $dbAnalysis->start($row[$field], $fieldConf['foreign_table'], $fieldConf['MM'], $row['uid'], $table, $fieldConf);
                                                                        foreach ($dbAnalysis->itemArray as $tempArr) {
                                                                        foreach ($dbAnalysis->itemArray as $tempArr) {
-                                                                               if ($tempArr['id']>0)   {
-                                                                                       $this->checkGroupDBRefs[$fieldConf['foreign_table']][$tempArr['id']]+=1;
+                                                                               if ($tempArr['id'] > 0) {
+                                                                                       $this->checkGroupDBRefs[$fieldConf['foreign_table']][$tempArr['id']] += 1;
                                                                                }
                                                                        }
                                                                }
                                                                                }
                                                                        }
                                                                }
@@ -567,8 +558,8 @@ class t3lib_admin {
         *
         * @return      array           Report over files; keys are "moreReferences", "noReferences", "noFile", "error"
         */
         *
         * @return      array           Report over files; keys are "moreReferences", "noReferences", "noFile", "error"
         */
-       function testFileRefs ()        {
-               $output=Array();
+       function testFileRefs() {
+               $output = array();
                        // handle direct references with upload folder setting (workaround)
                $newCheckFileRefs = array();
                foreach ($this->checkFileRefs as $folder => $files) {
                        // handle direct references with upload folder setting (workaround)
                $newCheckFileRefs = array();
                foreach ($this->checkFileRefs as $folder => $files) {
@@ -595,48 +586,48 @@ class t3lib_admin {
                $this->checkFileRefs = $newCheckFileRefs;
 
                foreach ($this->checkFileRefs as $folder => $fileArr) {
                $this->checkFileRefs = $newCheckFileRefs;
 
                foreach ($this->checkFileRefs as $folder => $fileArr) {
-                       $path = PATH_site.$folder;
-                       if (@is_dir($path))     {
+                       $path = PATH_site . $folder;
+                       if (@is_dir($path)) {
                                $d = dir($path);
                                $d = dir($path);
-                               while($entry=$d->read()) {
-                                       if (@is_file($path.'/'.$entry)) {
-                                               if (isset($fileArr[$entry]))    {
-                                                       if ($fileArr[$entry] > 1)       {
-                                                               $temp = $this->whereIsFileReferenced($folder,$entry);
+                               while ($entry = $d->read()) {
+                                       if (@is_file($path . '/' . $entry)) {
+                                               if (isset($fileArr[$entry])) {
+                                                       if ($fileArr[$entry] > 1) {
+                                                               $temp = $this->whereIsFileReferenced($folder, $entry);
                                                                $tempList = '';
                                                                foreach ($temp as $inf) {
                                                                $tempList = '';
                                                                foreach ($temp as $inf) {
-                                                                       $tempList.='['.$inf['table'].']['.$inf['uid'].']['.$inf['field'].'] (pid:'.$inf['pid'].') - ';
+                                                                       $tempList .= '[' . $inf['table'] . '][' . $inf['uid'] . '][' . $inf['field'] . '] (pid:' . $inf['pid'] . ') - ';
                                                                }
                                                                }
-                                                               $output['moreReferences'][] = Array($path,$entry,$fileArr[$entry],$tempList);
+                                                               $output['moreReferences'][] = array($path, $entry, $fileArr[$entry], $tempList);
                                                        }
                                                        unset($fileArr[$entry]);
                                                } else {
                                                                // contains workaround for direct references
                                                        if (!strstr($entry, 'index.htm') && !preg_match('/^' . preg_quote($GLOBALS['TYPO3_CONF_VARS']['BE']['fileadminDir'], '/') . '/', $folder)) {
                                                        }
                                                        unset($fileArr[$entry]);
                                                } else {
                                                                // contains workaround for direct references
                                                        if (!strstr($entry, 'index.htm') && !preg_match('/^' . preg_quote($GLOBALS['TYPO3_CONF_VARS']['BE']['fileadminDir'], '/') . '/', $folder)) {
-                                                               $output['noReferences'][] = Array($path,$entry);
+                                                               $output['noReferences'][] = array($path, $entry);
                                                        }
                                                }
                                        }
                                }
                                $d->close();
                                                        }
                                                }
                                        }
                                }
                                $d->close();
-                               $tempCounter=0;
+                               $tempCounter = 0;
                                foreach ($fileArr as $file => $value) {
                                                // workaround for direct file references
                                        if (preg_match('/^' . preg_quote($GLOBALS['TYPO3_CONF_VARS']['BE']['fileadminDir'], '/') . '/', $folder)) {
                                                $file = $folder . '/' . $file;
                                                $folder = '';
                                foreach ($fileArr as $file => $value) {
                                                // workaround for direct file references
                                        if (preg_match('/^' . preg_quote($GLOBALS['TYPO3_CONF_VARS']['BE']['fileadminDir'], '/') . '/', $folder)) {
                                                $file = $folder . '/' . $file;
                                                $folder = '';
-                                               $path = substr(PATH_site, 0, - 1);
+                                               $path = substr(PATH_site, 0, -1);
                                        }
                                        }
-                                       $temp = $this->whereIsFileReferenced($folder,$file);
+                                       $temp = $this->whereIsFileReferenced($folder, $file);
                                        $tempList = '';
                                        foreach ($temp as $inf) {
                                        $tempList = '';
                                        foreach ($temp as $inf) {
-                                               $tempList.='['.$inf['table'].']['.$inf['uid'].']['.$inf['field'].'] (pid:'.$inf['pid'].') - ';
+                                               $tempList .= '[' . $inf['table'] . '][' . $inf['uid'] . '][' . $inf['field'] . '] (pid:' . $inf['pid'] . ') - ';
                                        }
                                        $tempCounter++;
                                        }
                                        $tempCounter++;
-                                       $output['noFile'][substr($path,-3).'_'.substr($file,0,3).'_'.$tempCounter] = Array($path,$file,$tempList);
+                                       $output['noFile'][substr($path, -3) . '_' . substr($file, 0, 3) . '_' . $tempCounter] = array($path, $file, $tempList);
                                }
                        } else {
                                }
                        } else {
-                               $output['error'][] = Array($path);
+                               $output['error'][] = array($path);
                        }
                }
                return $output;
                        }
                }
                return $output;
@@ -648,28 +639,28 @@ class t3lib_admin {
         * @param       array           Table with key/value pairs being table names and arrays with uid numbers
         * @return      string          HTML Error message
         */
         * @param       array           Table with key/value pairs being table names and arrays with uid numbers
         * @return      string          HTML Error message
         */
-       function testDBRefs($theArray)  {
+       function testDBRefs($theArray) {
                global $TCA;
                foreach ($theArray as $table => $dbArr) {
                global $TCA;
                foreach ($theArray as $table => $dbArr) {
-                       if ($TCA[$table])       {
+                       if ($TCA[$table]) {
                                $idlist = array_keys($dbArr);
 
                                $idlist = array_keys($dbArr);
 
-                               $theList = implode(',',$idlist);
-                               if ($theList)   {
-                                       $mres = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid', $table, 'uid IN ('.$theList.')'.t3lib_BEfunc::deleteClause($table));
-                                       while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($mres))      {
-                                               if (isset($dbArr[$row['uid']])) {
+                               $theList = implode(',', $idlist);
+                               if ($theList) {
+                                       $mres = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid', $table, 'uid IN (' . $theList . ')' . t3lib_BEfunc::deleteClause($table));
+                                       while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($mres)) {
+                                               if (isset($dbArr[$row['uid']])) {
                                                        unset ($dbArr[$row['uid']]);
                                                } else {
                                                        unset ($dbArr[$row['uid']]);
                                                } else {
-                                                       $result.='Strange Error. ...<br />';
+                                                       $result .= 'Strange Error. ...<br />';
                                                }
                                        }
                                        foreach ($dbArr as $theId => $theC) {
                                                }
                                        }
                                        foreach ($dbArr as $theId => $theC) {
-                                               $result.='There are '.$theC.' records pointing to this missing or deleted record; ['.$table.']['.$theId.']<br />';
+                                               $result .= 'There are ' . $theC . ' records pointing to this missing or deleted record; [' . $table . '][' . $theId . ']<br />';
                                        }
                                }
                        } else {
                                        }
                                }
                        } else {
-                               $result.='Codeerror. Table is not a table...<br />';
+                               $result .= 'Codeerror. Table is not a table...<br />';
                        }
                }
                return $result;
                        }
                }
                return $result;
@@ -682,28 +673,29 @@ class t3lib_admin {
         * @param       integer         Uid of database record
         * @return      array           Array with other arrays containing information about where references was found
         */
         * @param       integer         Uid of database record
         * @return      array           Array with other arrays containing information about where references was found
         */
-       function whereIsRecordReferenced($searchTable,$id)      {
+       function whereIsRecordReferenced($searchTable, $id) {
                global $TCA;
                global $TCA;
-               $fileFields = $this->getDBFields($searchTable); // Gets tables / Fields that reference to files...
-               $theRecordList=Array();
+               $fileFields = $this->getDBFields($searchTable); // Gets tables / Fields that reference to files...
+               $theRecordList = array();
                foreach ($fileFields as $info) {
                foreach ($fileFields as $info) {
-                       $table=$info[0];        $field=$info[1];
+                       $table = $info[0];
+                       $field = $info[1];
                        t3lib_div::loadTCA($table);
                        $mres = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
                        t3lib_div::loadTCA($table);
                        $mres = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
-                                                       'uid,pid,'.$TCA[$table]['ctrl']['label'].','.$field,
-                                                       $table,
-                                                       $field.' LIKE \'%'.$GLOBALS['TYPO3_DB']->quoteStr($id, $table).'%\''
-                                               );
-                       while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($mres))     {
+                               'uid,pid,' . $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'];
                                        // 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'];
-                               $allowedTables = ($fieldConf['type']=='group') ? $fieldConf['allowed'] : $fieldConf['foreign_table'];
+                               $allowedTables = ($fieldConf['type'] == 'group') ? $fieldConf['allowed'] : $fieldConf['foreign_table'];
 
                                $dbAnalysis = t3lib_div::makeInstance('t3lib_loadDBGroup');
 
                                $dbAnalysis = t3lib_div::makeInstance('t3lib_loadDBGroup');
-                               $dbAnalysis->start($row[$field],$allowedTables,$fieldConf['MM'],$row['uid'], $table, $fieldConf);
+                               $dbAnalysis->start($row[$field], $allowedTables, $fieldConf['MM'], $row['uid'], $table, $fieldConf);
                                foreach ($dbAnalysis->itemArray as $tempArr) {
                                foreach ($dbAnalysis->itemArray as $tempArr) {
-                                       if ($tempArr['table']==$searchTable && $tempArr['id']==$id)     {
-                                               $theRecordList[]=Array('table'=>$table,'uid'=>$row['uid'],'field'=>$field,'pid'=>$row['pid']);
+                                       if ($tempArr['table'] == $searchTable && $tempArr['id'] == $id) {
+                                               $theRecordList[] = array('table' => $table, 'uid' => $row['uid'], 'field' => $field, 'pid' => $row['pid']);
                                        }
                                }
                        }
                                        }
                                }
                        }
@@ -719,24 +711,25 @@ class t3lib_admin {
         * @param       string          Filename to search for
         * @return      array           Array with other arrays containing information about where references was found
         */
         * @param       string          Filename to search for
         * @return      array           Array with other arrays containing information about where references was found
         */
-       function whereIsFileReferenced($uploadfolder,$filename) {
+       function whereIsFileReferenced($uploadfolder, $filename) {
                global $TCA;
                global $TCA;
-               $fileFields = $this->getFileFields($uploadfolder);      // Gets tables / Fields that reference to files...
-               $theRecordList=Array();
+               $fileFields = $this->getFileFields($uploadfolder); // Gets tables / Fields that reference to files...
+               $theRecordList = array();
                foreach ($fileFields as $info) {
                foreach ($fileFields as $info) {
-                       $table=$info[0];        $field=$info[1];
+                       $table = $info[0];
+                       $field = $info[1];
                        $mres = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
                        $mres = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
-                                                       'uid,pid,'.$TCA[$table]['ctrl']['label'].','.$field,
-                                                       $table,
-                                                       $field.' LIKE \'%'.$GLOBALS['TYPO3_DB']->quoteStr($filename, $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.
-                               $tempArr = explode(',',trim($row[$field]));
+                               'uid,pid,' . $TCA[$table]['ctrl']['label'] . ',' . $field,
+                               $table,
+                                       $field . ' LIKE \'%' . $GLOBALS['TYPO3_DB']->quoteStr($filename, $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.
+                               $tempArr = explode(',', trim($row[$field]));
                                foreach ($tempArr as $file) {
                                        $file = trim($file);
                                foreach ($tempArr as $file) {
                                        $file = trim($file);
-                                       if ($file==$filename)   {
-                                               $theRecordList[]=Array('table'=>$table,'uid'=>$row['uid'],'field'=>$field,'pid'=>$row['pid']);
+                                       if ($file == $filename) {
+                                               $theRecordList[] = array('table' => $table, 'uid' => $row['uid'], 'field' => $field, 'pid' => $row['pid']);
                                        }
                                }
                        }
                                        }
                                }
                        }
@@ -746,7 +739,7 @@ class t3lib_admin {
 }
 
 
 }
 
 
-if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_admin.php'])    {
+if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_admin.php']) {
        include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_admin.php']);
 }
 ?>
\ No newline at end of file
        include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_admin.php']);
 }
 ?>
\ No newline at end of file