[BUGFIX] Fatal error when exporting from root
authorFrancois Suter <francois@typo3.org>
Sat, 5 Nov 2011 08:23:27 +0000 (09:23 +0100)
committerFrancois Suter <francois@typo3.org>
Fri, 18 Nov 2011 20:02:18 +0000 (21:02 +0100)
An uncaught exception happens when trying to export records from a
singe table view in List mode on the page tree root. This is due to
the tree root being handled as a normal page record.

With this patch the tree root is handled as it should. Some cleanup
(CGL) is also applied.

Change-Id: Ia5c46044f5040472846f3e7fb4adbf203e5e1e6a
Fixes: #31350
Releases: 4.7, 4.6, 4.5
Reviewed-on: http://review.typo3.org/6551
Reviewed-by: Philipp Gampe
Tested-by: Philipp Gampe
Reviewed-by: Georg Ringer
Reviewed-by: Steffen Ritter
Reviewed-by: Francois Suter
Tested-by: Francois Suter
typo3/sysext/impexp/app/index.php

index ec28ab9..e275f5d 100755 (executable)
@@ -813,16 +813,23 @@ class SC_mod_tools_log_index extends t3lib_SCbase {
                                        <td colspan="2">'.$LANG->getLL('makeconfig_exportTablesFromPages',1).'</td>
                                </tr>';
 
+                               // Display information about pages from which the export takes place
                        $tblList = '';
-                       foreach($inData['list'] as $ref)        {
-                               $rParts = explode(':', $ref);
-                               $tName = $rParts[0];
-
-                               if ($GLOBALS['BE_USER']->check('tables_select',$tName)) {
-                                       $rec = t3lib_BEfunc::getRecordWSOL('pages', $rParts[1]);
-                                       $tblList .= 'Table "' . $tName . '" from ' . t3lib_iconworks::getSpriteIconForRecord('pages', $rec) .
-                                       t3lib_BEfunc::getRecordTitle('pages', $rec, TRUE).
-                                       '<input type="hidden" name="tx_impexp[list][]" value="'.htmlspecialchars($ref).'" /><br/>';
+                       foreach ($inData['list'] as $reference) {
+                               $referenceParts = explode(':', $reference);
+                               $tableName = $referenceParts[0];
+
+                               if ($GLOBALS['BE_USER']->check('tables_select', $tableName)) {
+                                               // If the page is actually the root, handle it differently
+                                               // NOTE: we don't compare integers, because the number actually comes from the split string above
+                                       if ($referenceParts[1] === '0') {
+                                               $iconAndTitle = t3lib_iconWorks::getSpriteIcon('apps-pagetree-root') . $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'];
+                                       } else {
+                                               $record = t3lib_BEfunc::getRecordWSOL('pages', $referenceParts[1]);
+                                               $iconAndTitle = t3lib_iconworks::getSpriteIconForRecord('pages', $record) . t3lib_BEfunc::getRecordTitle('pages', $record, TRUE);
+                                       }
+                                       $tblList .= 'Table "' . $tableName . '" from ' . $iconAndTitle .
+                                       '<input type="hidden" name="tx_impexp[list][]" value="' . htmlspecialchars($reference) . '" /><br/>';
                                }
                        }
                        $row[] = '