More work on import/export + removal of "lower" range limit for endtimes on core...
authorKasper Skårhøj <kasper@typo3.org>
Thu, 13 Jan 2005 21:33:01 +0000 (21:33 +0000)
committerKasper Skårhøj <kasper@typo3.org>
Thu, 13 Jan 2005 21:33:01 +0000 (21:33 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@530 709f56b5-9817-0410-a4d7-c38de5d9e867

t3lib/stddb/tbl_be.php
typo3/sysext/cms/ext_tables.php
typo3/sysext/cms/tbl_cms.php
typo3/sysext/cms/tbl_tt_content.php
typo3/sysext/cms/tslib/class.tslib_pibase.php
typo3/sysext/impexp/app/index.php
typo3/sysext/impexp/class.tx_impexp.php
typo3/sysext/impexp/doc/TODO.txt

index 84f09f6..0d30128 100755 (executable)
@@ -265,7 +265,6 @@ $TCA['be_users'] = Array (
                                'default' => '0',
                                'range' => Array (
                                        'upper' => mktime(0,0,0,12,31,2020),
                                'default' => '0',
                                'range' => Array (
                                        'upper' => mktime(0,0,0,12,31,2020),
-                                       'lower' => mktime(0,0,0,date('m')-1,date('d'),date('Y'))
                                )
                        )
                ),
                                )
                        )
                ),
index b09fe53..85f7fd1 100755 (executable)
@@ -122,7 +122,6 @@ if (TYPO3_MODE=='BE')       {
                                'default' => '0',
                                'range' => Array (
                                        'upper' => mktime(0,0,0,12,31,2020),
                                'default' => '0',
                                'range' => Array (
                                        'upper' => mktime(0,0,0,12,31,2020),
-                                       'lower' => mktime(0,0,0,date('m')-1,date('d'),date('Y'))
                                )
                        )
                ),
                                )
                        )
                ),
index 40477b8..097d8a7 100755 (executable)
@@ -243,7 +243,6 @@ $TCA['fe_users'] = Array (
                                'default' => '0',
                                'range' => Array (
                                        'upper' => mktime(0,0,0,12,31,2020),
                                'default' => '0',
                                'range' => Array (
                                        'upper' => mktime(0,0,0,12,31,2020),
-                                       'lower' => mktime(0,0,0,date('m')-1,date('d'),date('Y'))
                                )
                        )
                ),
                                )
                        )
                ),
@@ -458,7 +457,6 @@ $TCA['pages_language_overlay'] = Array (
                                'default' => '0',
                                'range' => Array (
                                        'upper' => mktime(0,0,0,12,31,2020),
                                'default' => '0',
                                'range' => Array (
                                        'upper' => mktime(0,0,0,12,31,2020),
-                                       'lower' => mktime(0,0,0,date('m')-1,date('d'),date('Y'))
                                )
                        )
                ),
                                )
                        )
                ),
@@ -637,7 +635,6 @@ $TCA['sys_template'] = Array (
                                'default' => '0',
                                'range' => Array (
                                        'upper' => mktime(0,0,0,12,31,2020),
                                'default' => '0',
                                'range' => Array (
                                        'upper' => mktime(0,0,0,12,31,2020),
-                                       'lower' => mktime(0,0,0,date('m')-1,date('d'),date('Y'))
                                )
                        )
                ),
                                )
                        )
                ),
index ccbc857..f9dd6df 100755 (executable)
@@ -102,7 +102,6 @@ $TCA['tt_content'] = Array (
                                'default' => '0',
                                'range' => Array (
                                        'upper' => mktime(0,0,0,12,31,2020),
                                'default' => '0',
                                'range' => Array (
                                        'upper' => mktime(0,0,0,12,31,2020),
-                                       'lower' => mktime(0,0,0,date('m')-1,date('d'),date('Y'))
                                )
                        )
                ),
                                )
                        )
                ),
index 4bc79bd..79a7356 100755 (executable)
@@ -1203,7 +1203,7 @@ class tslib_pibase {
         * @return      string          The content.
         */
        function pi_getFFvalue($T3FlexForm_array,$fieldName,$sheet='sDEF',$lang='lDEF',$value='vDEF')   {
         * @return      string          The content.
         */
        function pi_getFFvalue($T3FlexForm_array,$fieldName,$sheet='sDEF',$lang='lDEF',$value='vDEF')   {
-               $sheetArray = $T3FlexForm_array['data'][$sheet][$lang];
+               $sheetArray = (array)$T3FlexForm_array['data'][$sheet][$lang];
                if (is_array($sheetArray))      {
                        return $this->pi_getFFvalueFromSheetArray($sheetArray,explode('/',$fieldName),$value);
                }
                if (is_array($sheetArray))      {
                        return $this->pi_getFFvalueFromSheetArray($sheetArray,explode('/',$fieldName),$value);
                }
index b7dfd18..0cc673e 100755 (executable)
@@ -192,12 +192,13 @@ class localPageTree extends t3lib_browseTree {
         * Tree rendering
         *
         * @param       integer         PID value
         * Tree rendering
         *
         * @param       integer         PID value
+        * @param       string          Additional where clause
         * @return      array           Array of tree elements
         */
         * @return      array           Array of tree elements
         */
-       function ext_tree($pid) {
+       function ext_tree($pid, $clause='')     {
 
                        // Initialize:
 
                        // Initialize:
-               $this->init(' AND '.$this->permsC());
+               $this->init(' AND '.$this->permsC().$clause);
 
                        // Get stored tree structure:
                $this->stored = unserialize($this->BE_USER->uc['browseTrees']['browsePages']);
 
                        // Get stored tree structure:
                $this->stored = unserialize($this->BE_USER->uc['browseTrees']['browsePages']);
@@ -221,23 +222,23 @@ class localPageTree extends t3lib_browseTree {
 
                        // Set PM icon:
                $cmd = $this->bank.'_'.($isOpen?'0_':'1_').$pid;
 
                        // Set PM icon:
                $cmd = $this->bank.'_'.($isOpen?'0_':'1_').$pid;
-               $icon = '<img src="'.$this->backPath.'t3lib/gfx/ol/'.($isOpen?'minus':'plus').'only.gif" width="18" height="16" align="top" border="0" alt="" />';
+               $icon = '<img'.t3lib_iconWorks::skinImg($this->backPath,'t3lib/gfx/ol/'.($isOpen?'minus':'plus').'only.gif','width="18" height="16"').' align="top" alt="" />';
                $firstHtml = $this->PM_ATagWrap($icon,$cmd);
 
                if ($pid>0)     {
                        $rootRec = t3lib_befunc::getRecord('pages',$pid);
                $firstHtml = $this->PM_ATagWrap($icon,$cmd);
 
                if ($pid>0)     {
                        $rootRec = t3lib_befunc::getRecord('pages',$pid);
-                       $firstHtml.= $this->wrapIcon('<img src="'.$this->backPath.t3lib_iconWorks::getIcon('pages',$rootRec).'" width="18" height="16" align="top" alt="" />',$rootRec);
+                       $firstHtml.= $this->wrapIcon(t3lib_iconWorks::getIconImage('pages',$rootRec,$this->backPath,'align="top"'),$rootRec);
                } else {
                        $rootRec = array(
                                'title' => $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'],
                                'uid' => 0
                        );
                } else {
                        $rootRec = array(
                                'title' => $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'],
                                'uid' => 0
                        );
-                       $firstHtml.= $this->wrapIcon('<img src="'.$this->backPath.'gfx/i/_icon_website.gif" width="18" height="16" align="top" alt="" />',$rootRec);
+                       $firstHtml.= $this->wrapIcon('<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/i/_icon_website.gif','width="18" height="16"').' align="top" alt="" />',$rootRec);
                }
                $this->tree[] = array('HTML'=>$firstHtml, 'row'=>$rootRec);
                if ($isOpen)    {
                                // Set depth:
                }
                $this->tree[] = array('HTML'=>$firstHtml, 'row'=>$rootRec);
                if ($isOpen)    {
                                // Set depth:
-                       $depthD = '<img src="'.$this->backPath.'t3lib/gfx/ol/blank.gif" width="18" height="16" align="top" alt="" />';
+                       $depthD = '<img'.t3lib_iconWorks::skinImg($this->backPath,'t3lib/gfx/ol/blank.gif','width="18" height="16"').' align="top" alt="" />';
                        if ($this->addSelfId)   $this->ids[] = $pid;
                        $this->getTree($pid,999,$depthD);
 
                        if ($this->addSelfId)   $this->ids[] = $pid;
                        $this->getTree($pid,999,$depthD);
 
@@ -331,6 +332,14 @@ class SC_mod_tools_log_index extends t3lib_SCbase {
                        break;
                        case 'import':
 
                        break;
                        case 'import':
 
+                                       // Finally: If upload went well, set the new file as the import file:
+                               if (is_object($this->fileProcessor) && $this->fileProcessor->internalUploadMap[1])      {
+                                       $fI = pathinfo($this->fileProcessor->internalUploadMap[1]);
+                                       if (t3lib_div::inList('t3d,xml',strtolower($fI['extension'])))  {       // Only allowed extensions....
+                                               $inData['file'] = $this->fileProcessor->internalUploadMap[1];
+                                       }
+                               }
+
                                        // Call import interface:
                                $this->importData($inData);
                        break;
                                        // Call import interface:
                                $this->importData($inData);
                        break;
@@ -408,7 +417,7 @@ class SC_mod_tools_log_index extends t3lib_SCbase {
                $this->export->extensionDependencies = (array)$inData['extension_dep'];
                $this->export->showStaticRelations = $inData['showStaticRelations'];
 
                $this->export->extensionDependencies = (array)$inData['extension_dep'];
                $this->export->showStaticRelations = $inData['showStaticRelations'];
 
-               $this->export->includeHTMLfileResources = $inData['includeHTMLfileResources'];
+               $this->export->includeExtFileResources = !$inData['excludeHTMLfileResources'];
 #debug($inData);
                        // Static tables:
                if (is_array($inData['external_static']['tables']))     {
 #debug($inData);
                        // Static tables:
                if (is_array($inData['external_static']['tables']))     {
@@ -467,7 +476,8 @@ class SC_mod_tools_log_index extends t3lib_SCbase {
                if (isset($inData['pagetree']['id']))   {
                        if ($inData['pagetree']['levels']==-1)  {       // Based on click-expandable tree
                                $pagetree = t3lib_div::makeInstance('localPageTree');
                if (isset($inData['pagetree']['id']))   {
                        if ($inData['pagetree']['levels']==-1)  {       // Based on click-expandable tree
                                $pagetree = t3lib_div::makeInstance('localPageTree');
-                               $tree = $pagetree->ext_tree($inData['pagetree']['id']);
+
+                               $tree = $pagetree->ext_tree($inData['pagetree']['id'],$this->filterPageIds($this->export->excludeMap));
                                $this->treeHTML = $pagetree->printTree($tree);
 
                                $idH = $pagetree->buffer_idH;
                                $this->treeHTML = $pagetree->printTree($tree);
 
                                $idH = $pagetree->buffer_idH;
@@ -488,9 +498,9 @@ class SC_mod_tools_log_index extends t3lib_SCbase {
                                if (is_array($sPage))   {
                                        $pid = $inData['pagetree']['id'];
                                        $tree = t3lib_div::makeInstance('t3lib_pageTree');
                                if (is_array($sPage))   {
                                        $pid = $inData['pagetree']['id'];
                                        $tree = t3lib_div::makeInstance('t3lib_pageTree');
-                                       $tree->init('AND '.$this->perms_clause);
+                                       $tree->init('AND '.$this->perms_clause.$this->filterPageIds($this->export->excludeMap));
 
 
-                                       $HTML = '<img src="'.$GLOBALS['BACK_PATH'].t3lib_iconWorks::getIcon('pages',$sPage).'" width="18" height="16" align="top" alt="" />';
+                                       $HTML = t3lib_iconWorks::getIconImage('pages',$sPage,$GLOBALS['BACK_PATH'],'align="top"');
                                        $tree->tree[] = Array('row'=>$sPage,'HTML'=>$HTML);
                                        $tree->buffer_idH = array();
                                        if ($inData['pagetree']['levels']>0)    {
                                        $tree->tree[] = Array('row'=>$sPage,'HTML'=>$HTML);
                                        $tree->buffer_idH = array();
                                        if ($inData['pagetree']['levels']>0)    {
@@ -503,10 +513,8 @@ class SC_mod_tools_log_index extends t3lib_SCbase {
                                                $idH[$pid]['subrow'] = $tree->buffer_idH;
                                        }
 
                                                $idH[$pid]['subrow'] = $tree->buffer_idH;
                                        }
 
-
                                        $pagetree = t3lib_div::makeInstance('localPageTree');
                                        $this->treeHTML = $pagetree->printTree($tree->tree);
                                        $pagetree = t3lib_div::makeInstance('localPageTree');
                                        $this->treeHTML = $pagetree->printTree($tree->tree);
-
 #debug($idH);
                                }
                        }
 #debug($idH);
                                }
                        }
@@ -555,7 +563,9 @@ class SC_mod_tools_log_index extends t3lib_SCbase {
                        if ($inData['download_export']) {
                                $mimeType = 'application/octet-stream';
                                Header('Content-Type: '.$mimeType);
                        if ($inData['download_export']) {
                                $mimeType = 'application/octet-stream';
                                Header('Content-Type: '.$mimeType);
+                               Header('Content-Length: '.strlen($out));
                                Header('Content-Disposition: attachment; filename='.basename($dlFile));
                                Header('Content-Disposition: attachment; filename='.basename($dlFile));
+
                                echo $out;
                                exit;
                        }
                                echo $out;
                                exit;
                        }
@@ -874,8 +884,8 @@ class SC_mod_tools_log_index extends t3lib_SCbase {
                        </tr>';
                $row[] = '
                                <tr class="bgColor4">
                        </tr>';
                $row[] = '
                                <tr class="bgColor4">
-                                       <td><strong>Include HTML file resources:</strong></td>
-                                       <td><input type="checkbox" name="tx_impexp[includeHTMLfileResources]" value="1"'.($inData['includeHTMLfileResources'] ? ' checked="checked"' : '').' /></td>
+                                       <td><strong>Exclude HTML/CSS file resources:</strong></td>
+                                       <td><input type="checkbox" name="tx_impexp[excludeHTMLfileResources]" value="1"'.($inData['excludeHTMLfileResources'] ? ' checked="checked"' : '').' /></td>
                                </tr>';
 
 
                                </tr>';
 
 
@@ -944,9 +954,9 @@ class SC_mod_tools_log_index extends t3lib_SCbase {
                                                '.$this->renderSelectBox('preset[select]','',$opt).'
                                                <br/>
                                                <input type="submit" value="Load" name="preset[load]" />
                                                '.$this->renderSelectBox('preset[select]','',$opt).'
                                                <br/>
                                                <input type="submit" value="Load" name="preset[load]" />
-                                               <input type="submit" value="Save" name="preset[save]" />
-                                               <input type="submit" value="Delete" name="preset[delete]" />
-                                               <input type="submit" value="Merge" name="preset[merge]" />
+                                               <input type="submit" value="Save" name="preset[save]" onclick="return confirm(\''.htmlspecialchars('Are you sure?').'\');" />
+                                               <input type="submit" value="Delete" name="preset[delete]" onclick="return confirm(\''.htmlspecialchars('Are you sure?').'\');" />
+                                               <input type="submit" value="Merge" name="preset[merge]" onclick="return confirm(\''.htmlspecialchars('Are you sure?').'\');" />
                                                <br/>
                                                Title of new preset:
                                                <input type="text" name="tx_impexp[preset][title]" value="'.htmlspecialchars($inData['preset']['title']).'"'.$this->doc->formWidth(30).' /><br/>
                                                <br/>
                                                Title of new preset:
                                                <input type="text" name="tx_impexp[preset][title]" value="'.htmlspecialchars($inData['preset']['title']).'"'.$this->doc->formWidth(30).' /><br/>
@@ -1066,7 +1076,7 @@ class SC_mod_tools_log_index extends t3lib_SCbase {
                        $import->import_mode = $inData['import_mode'];
                        $import->enableLogging = $inData['enableLogging'];
                        $import->global_ignore_pid = $inData['global_ignore_pid'];
                        $import->import_mode = $inData['import_mode'];
                        $import->enableLogging = $inData['enableLogging'];
                        $import->global_ignore_pid = $inData['global_ignore_pid'];
-                       $import->showDiff = $inData['showDiff'];
+                       $import->showDiff = !$inData['notShowDiff'];
                        $import->allowPHPScripts = $inData['allowPHPScripts'];
                        $import->softrefInputValues = $inData['softrefInputValues'];
 
                        $import->allowPHPScripts = $inData['allowPHPScripts'];
                        $import->softrefInputValues = $inData['softrefInputValues'];
 
@@ -1129,8 +1139,8 @@ class SC_mod_tools_log_index extends t3lib_SCbase {
                        $row[] = '<tr class="bgColor4">
                                <td><strong>Options:</strong></td>
                                <td>
                        $row[] = '<tr class="bgColor4">
                                <td><strong>Options:</strong></td>
                                <td>
-                                       <input type="checkbox" name="tx_impexp[showDiff]" value="1"'.($inData['showDiff'] ? ' checked="checked"' : '').' />
-                                       Show differences in records<br/>
+                                       <input type="checkbox" name="tx_impexp[notShowDiff]" value="1"'.($inData['notShowDiff'] ? ' checked="checked"' : '').' />
+                                       Do not show differences in records<br/>
                                        <em>(Green values are from the import file, red values from the current database record and black values are similar in both versions.)</em>
                                        <br/><br/>
 
                                        <em>(Green values are from the import file, red values from the current database record and black values are similar in both versions.)</em>
                                        <br/><br/>
 
@@ -1188,6 +1198,13 @@ class SC_mod_tools_log_index extends t3lib_SCbase {
                                                </td>
                                        </tr>';
 
                                                </td>
                                        </tr>';
 
+                               if (t3lib_div::_POST('file'))   {
+                                       $row[] = '<tr class="bgColor4">
+                                                       <td>Upload status:</td>
+                                                       <td>'.($this->fileProcessor->internalUploadMap[1] ? 'Success: '.substr($this->fileProcessor->internalUploadMap[1],strlen(PATH_site)) : '<span class="typo3-red">Failure: No file uploaded - was it too big? Check system log.</span>').'</td>
+                                               </tr>';
+                               }
+
                                $menuItems[] = array(
                                        'label' => 'Upload',
                                        'content' => '
                                $menuItems[] = array(
                                        'label' => 'Upload',
                                        'content' => '
@@ -1204,7 +1221,7 @@ class SC_mod_tools_log_index extends t3lib_SCbase {
                        $overviewContent = '';
                        $inFile = t3lib_div::getFileAbsFileName($inData['file']);
                        if ($inFile && @is_file($inFile))       {
                        $overviewContent = '';
                        $inFile = t3lib_div::getFileAbsFileName($inData['file']);
                        if ($inFile && @is_file($inFile))       {
-                               $row = array();
+                               $trow = array();
                                if ($import->loadFile($inFile,1))       {
 
                                        if ($inData['import_file'])     {
                                if ($import->loadFile($inFile,1))       {
 
                                        if ($inData['import_file'])     {
@@ -1217,7 +1234,7 @@ class SC_mod_tools_log_index extends t3lib_SCbase {
                                }
 
                                        // Meta data output:
                                }
 
                                        // Meta data output:
-                               $row[] = '<tr class="bgColor5">
+                               $trow[] = '<tr class="bgColor5">
                                                <td colspan="2"><strong>Meta data:</strong></td>
                                        </tr>';
 
                                                <td colspan="2"><strong>Meta data:</strong></td>
                                        </tr>';
 
@@ -1226,24 +1243,24 @@ class SC_mod_tools_log_index extends t3lib_SCbase {
                                        $opt[$file] = substr($file,strlen(PATH_site));
                                }
 
                                        $opt[$file] = substr($file,strlen(PATH_site));
                                }
 
-                               $row[] = '<tr class="bgColor4">
+                               $trow[] = '<tr class="bgColor4">
                                        <td><strong>Title:</strong></td>
                                        <td><strong>Title:</strong></td>
-                                       <td>'.nl2br(htmlspecialchars($import->dat['header']['meta']['title'])).'</td>
+                                       <td width="95%">'.nl2br(htmlspecialchars($import->dat['header']['meta']['title'])).'</td>
                                        </tr>';
 
                                        </tr>';
 
-                               $row[] = '<tr class="bgColor4">
+                               $trow[] = '<tr class="bgColor4">
                                        <td><strong>Description:</strong></td>
                                        <td><strong>Description:</strong></td>
-                                       <td>'.nl2br(htmlspecialchars($import->dat['header']['meta']['description'])).'</td>
+                                       <td width="95%">'.nl2br(htmlspecialchars($import->dat['header']['meta']['description'])).'</td>
                                        </tr>';
 
                                        </tr>';
 
-                               $row[] = '<tr class="bgColor4">
+                               $trow[] = '<tr class="bgColor4">
                                        <td><strong>Notes:</strong></td>
                                        <td><strong>Notes:</strong></td>
-                                       <td>'.nl2br(htmlspecialchars($import->dat['header']['meta']['notes'])).'</td>
+                                       <td width="95%">'.nl2br(htmlspecialchars($import->dat['header']['meta']['notes'])).'</td>
                                        </tr>';
 
                                        </tr>';
 
-                               $row[] = '<tr class="bgColor4">
+                               $trow[] = '<tr class="bgColor4">
                                        <td><strong>Packager:</strong></td>
                                        <td><strong>Packager:</strong></td>
-                                       <td>'.nl2br(htmlspecialchars($import->dat['header']['meta']['packager_name'].' ('.$import->dat['header']['meta']['packager_username'].')')).'<br/>
+                                       <td width="95%">'.nl2br(htmlspecialchars($import->dat['header']['meta']['packager_name'].' ('.$import->dat['header']['meta']['packager_username'].')')).'<br/>
                                                Email: '.$import->dat['header']['meta']['packager_email'].'</td>
                                        </tr>';
 
                                                Email: '.$import->dat['header']['meta']['packager_email'].'</td>
                                        </tr>';
 
@@ -1262,7 +1279,7 @@ class SC_mod_tools_log_index extends t3lib_SCbase {
                                                                // Create icon tag:
                                                        $iconTag = '<img src="'.$this->doc->backPath.'../'.substr($fileName,strlen(PATH_site)).'" '.$import->dat['header']['thumbnail']['imgInfo'][3].' vspace="5" style="border: solid black 1px;" alt="" />';
 
                                                                // Create icon tag:
                                                        $iconTag = '<img src="'.$this->doc->backPath.'../'.substr($fileName,strlen(PATH_site)).'" '.$import->dat['header']['thumbnail']['imgInfo'][3].' vspace="5" style="border: solid black 1px;" alt="" />';
 
-                                                       $row[] = '<tr class="bgColor4">
+                                                       $trow[] = '<tr class="bgColor4">
                                                                <td><strong>Icon:</strong></td>
                                                                <td>'.$iconTag.'</td>
                                                                </tr>';
                                                                <td><strong>Icon:</strong></td>
                                                                <td>'.$iconTag.'</td>
                                                                </tr>';
@@ -1277,12 +1294,19 @@ class SC_mod_tools_log_index extends t3lib_SCbase {
                                        'content' => '
                                                <table border="0" cellpadding="1" cellspacing="1">
                                                        '.implode('
                                        'content' => '
                                                <table border="0" cellpadding="1" cellspacing="1">
                                                        '.implode('
-                                                       ',$row).'
+                                                       ',$trow).'
                                                </table>
                                        '
                                );
                        }
 
                                                </table>
                                        '
                                );
                        }
 
+                               // Print errors that might be:
+                       $errors = $import->printErrorLog();
+                       $menuItems[] = array(
+                               'label' => 'Messages',
+                               'content' => $errors,
+                               'stateIcon' => $errors ? 2 : 0
+                       );
 
                                // Output tabs:
                        $content = $this->doc->getDynTabMenu($menuItems,'tx_impexp_import',-1);
 
                                // Output tabs:
                        $content = $this->doc->getDynTabMenu($menuItems,'tx_impexp_import',-1);
@@ -1293,10 +1317,6 @@ class SC_mod_tools_log_index extends t3lib_SCbase {
                        if ($overviewContent) {
                                $this->content.= $this->doc->section($inData['import_file'] ? 'Structure has been imported:' : 'Structure to be imported:', $overviewContent, 0, 1);
                        }
                        if ($overviewContent) {
                                $this->content.= $this->doc->section($inData['import_file'] ? 'Structure has been imported:' : 'Structure to be imported:', $overviewContent, 0, 1);
                        }
-                       $errors = $import->printErrorLog();
-                       if ($errors)    {
-                               $this->content.= $this->doc->section('Messages:', $errors, 0, 1);
-                       }
                }
        }
 
                }
        }
 
@@ -1583,13 +1603,41 @@ class SC_mod_tools_log_index extends t3lib_SCbase {
                $opt = array();
                $opt[] = '<option value=""></option>';
                foreach($extTrav as $v) {
                $opt = array();
                $opt[] = '<option value=""></option>';
                foreach($extTrav as $v) {
-                       if (is_array($value))   {
-                               $sel = in_array($v,$value)?' selected="selected"':'';
+                       if ($v!=='_CACHEFILE')  {
+                               if (is_array($value))   {
+                                       $sel = in_array($v,$value)?' selected="selected"':'';
+                               }
+                               $opt[] = '<option value="'.htmlspecialchars($v).'"'.$sel.'>'.htmlspecialchars($v).'</option>';
                        }
                        }
-                       $opt[] = '<option value="'.htmlspecialchars($v).'"'.$sel.'>'.htmlspecialchars($v).'</option>';
                }
                return '<select name="'.$prefix.'[]" multiple="multiple" size="'.t3lib_div::intInRange(count($opt),5,10).'">'.implode('',$opt).'</select>';
        }
                }
                return '<select name="'.$prefix.'[]" multiple="multiple" size="'.t3lib_div::intInRange(count($opt),5,10).'">'.implode('',$opt).'</select>';
        }
+
+       /**
+        * Filter page IDs by traversing exclude array, finding all excluded pages (if any) and making an AND NOT IN statement for the select clause.
+        *
+        * @param       array   Exclude array from import/export object.
+        * @return      string  AND where clause part to filter out page uids.
+        */
+       function filterPageIds($exclude)        {
+
+                       // Get keys:
+               $exclude = array_keys($exclude);
+
+                       // Traverse
+               $pageIds = array();
+               foreach($exclude as $element)   {
+                       list($table,$uid) = explode(':', $element);
+                       if ($table==='pages')   {
+                               $pageIds[] = intval($uid);
+                       }
+               }
+
+                       // Add to clause:
+               if (count($pageIds))    {
+                       return ' AND uid NOT IN ('.implode(',', $pageIds).')';
+               }
+       }
 }
 
 // Include extension?
 }
 
 // Include extension?
index 355ead2..0caee2c 100755 (executable)
@@ -206,6 +206,7 @@ class tx_impexp {
 
        var $mode = '';                                                 // Whether "import" or "export" mode of object. Set through init() function
        var $update = FALSE;                                    // Updates all records that has same UID instead of creating new!
 
        var $mode = '';                                                 // Whether "import" or "export" mode of object. Set through init() function
        var $update = FALSE;                                    // Updates all records that has same UID instead of creating new!
+       var $doesImport = FALSE;                                // Is set by importData() when an import has been done.
 
                // Configuration, import
        var $display_import_pid_record = '';            // If set to a page-record, then the preview display of the content will expect this page-record to be the target for the import and accordingly display validation information. This triggers the visual view of the import/export memory to validate if import is possible
 
                // Configuration, import
        var $display_import_pid_record = '';            // If set to a page-record, then the preview display of the content will expect this page-record to be the target for the import and accordingly display validation information. This triggers the visual view of the import/export memory to validate if import is possible
@@ -228,7 +229,8 @@ class tx_impexp {
        var $softrefCfg = array();              // Soft Reference Token ID modes.
        var $extensionDependencies = array();           // Listing extension dependencies.
        var $dontCompress = 0;                  // Set  by user: If set, compression in t3d files is disabled
        var $softrefCfg = array();              // Soft Reference Token ID modes.
        var $extensionDependencies = array();           // Listing extension dependencies.
        var $dontCompress = 0;                  // Set  by user: If set, compression in t3d files is disabled
-       var $includeHTMLfileResources = 0;      // Boolean, if set, HTML file resources are included.
+       var $includeExtFileResources = 0;       // Boolean, if set, HTML file resources are included.
+       var $extFileResourceExtensions = 'html,htm,css';        // Files with external media (HTML/css style references inside)
 
                // Internal, dynamic:
        var $import_mapId = array();            // After records are written this array is filled with [table][original_uid] = [new_uid]
 
                // Internal, dynamic:
        var $import_mapId = array();            // After records are written this array is filled with [table][original_uid] = [new_uid]
@@ -820,42 +822,48 @@ class tx_impexp {
                                                }
                                        }
 
                                                }
                                        }
 
-                                               // HTML with media?
+                                               // Files with external media?
+                                               // This is only done with files grabbed by a softreference parser since it is deemed improbable that hard-referenced files should undergo this treatment.
                                        $html_fI = pathinfo(basename($fI['ID_absFile']));
                                        $html_fI = pathinfo(basename($fI['ID_absFile']));
-                                       if ($this->includeHTMLfileResources && t3lib_div::inList('html,htm',strtolower($html_fI['extension']))) {
+                                       if ($this->includeExtFileResources && t3lib_div::inList($this->extFileResourceExtensions,strtolower($html_fI['extension'])))    {
                                                $uniquePrefix = '###'.md5(time()).'###';
                                                $uniquePrefix = '###'.md5(time()).'###';
-                                               $htmlParser = t3lib_div::makeInstance('t3lib_parsehtml');
-                                               $prefixedMedias = explode($uniquePrefix,$htmlParser->prefixResourcePath($uniquePrefix,$fileRec['content'],array(),$uniquePrefix));
+
+                                               if (strtolower($html_fI['extension'])==='css')  {
+                                                       $prefixedMedias = explode($uniquePrefix, eregi_replace('(url[[:space:]]*\([[:space:]]*["\']?)([^"\')]*)(["\']?[[:space:]]*\))', '\1'.$uniquePrefix.'\2'.$uniquePrefix.'\3', $fileRec['content']));
+                                               } else {        // html, htm:
+                                                       $htmlParser = t3lib_div::makeInstance('t3lib_parsehtml');
+                                                       $prefixedMedias = explode($uniquePrefix, $htmlParser->prefixResourcePath($uniquePrefix,$fileRec['content'],array(),$uniquePrefix));
+                                               }
 
                                                $htmlResourceCaptured = FALSE;
                                                foreach($prefixedMedias as $k => $v)    {
                                                        if ($k%2)       {
 
                                                $htmlResourceCaptured = FALSE;
                                                foreach($prefixedMedias as $k => $v)    {
                                                        if ($k%2)       {
-                                                               $HTMLres_absPath = t3lib_div::resolveBackPath(dirname($fI['ID_absFile']).'/'.$v);
-                                                               $HTMLres_absPath = t3lib_div::getFileAbsFileName($HTMLres_absPath);
-                                                               if ($HTMLres_absPath && t3lib_div::isFirstPartOfStr($HTMLres_absPath,PATH_site.$this->fileadminFolderName.'/') && @is_file($HTMLres_absPath))   {
+                                                               $EXTres_absPath = t3lib_div::resolveBackPath(dirname($fI['ID_absFile']).'/'.$v);
+                                                               $EXTres_absPath = t3lib_div::getFileAbsFileName($EXTres_absPath);
+                                                               if ($EXTres_absPath && t3lib_div::isFirstPartOfStr($EXTres_absPath,PATH_site.$this->fileadminFolderName.'/') && @is_file($EXTres_absPath))      {
 
                                                                        $htmlResourceCaptured = TRUE;
 
                                                                        $htmlResourceCaptured = TRUE;
-                                                                       $HTMLres_ID = md5($HTMLres_absPath);
-                                                                       $this->dat['header']['files'][$fI['ID']]['HTML_RES_ID'][] = $HTMLres_ID;
-                                                                       $prefixedMedias[$k] = '{HTML_RES_ID:'.$HTMLres_ID.'}';
+                                                                       $EXTres_ID = md5($EXTres_absPath);
+                                                                       $this->dat['header']['files'][$fI['ID']]['EXT_RES_ID'][] = $EXTres_ID;
+                                                                       $prefixedMedias[$k] = '{EXT_RES_ID:'.$EXTres_ID.'}';
 
                                                                                // Add file to memory if it is not set already:
 
                                                                                // Add file to memory if it is not set already:
-                                                                       if (!isset($this->dat['header']['files'][$HTMLres_ID]))         {
+                                                                       if (!isset($this->dat['header']['files'][$EXTres_ID]))          {
                                                                                $fileRec = array();
                                                                                $fileRec = array();
-                                                                               $fileRec['filesize'] = filesize($HTMLres_absPath);
-                                                                               $fileRec['filename'] = basename($HTMLres_absPath);
-                                                                               $fileRec['filemtime'] = filemtime($HTMLres_absPath);
-                                                                               $fileRec['record_ref'] = '_HTML_PARENT_:'.$fI['ID'];
+                                                                               $fileRec['filesize'] = filesize($EXTres_absPath);
+                                                                               $fileRec['filename'] = basename($EXTres_absPath);
+                                                                               $fileRec['filemtime'] = filemtime($EXTres_absPath);
+                                                                               $fileRec['record_ref'] = '_EXT_PARENT_:'.$fI['ID'];
 
                                                                                $fileRec['parentRelFileName'] = $v;             // Media relative to the HTML file.
 
                                                                                        // Setting this data in the header
 
                                                                                $fileRec['parentRelFileName'] = $v;             // Media relative to the HTML file.
 
                                                                                        // Setting this data in the header
-                                                                               $this->dat['header']['files'][$HTMLres_ID] = $fileRec;
+                                                                               $this->dat['header']['files'][$EXTres_ID] = $fileRec;
 
                                                                                        // ... and finally add the heavy stuff:
 
                                                                                        // ... and finally add the heavy stuff:
-                                                                               $fileRec['content'] = t3lib_div::getUrl($HTMLres_absPath);
+                                                                               $fileRec['content'] = t3lib_div::getUrl($EXTres_absPath);
                                                                                $fileRec['content_md5'] = md5($fileRec['content']);
                                                                                $fileRec['content_md5'] = md5($fileRec['content']);
-                                                                               $this->dat['files'][$HTMLres_ID] = $fileRec;
+                                                                               $this->dat['files'][$EXTres_ID] = $fileRec;
                                                                        }
                                                                }
                                                        }
                                                                        }
                                                                }
                                                        }
@@ -867,7 +875,7 @@ class tx_impexp {
                                        }
                                }
 
                                        }
                                }
 
-                       } else  $this->error($fI['ID_absFile'].' was larger than the maxFileSize ('.t3lib_div::formatSize($this->maxFileSize).')! Skipping.');
+                       } else  $this->error($fI['ID_absFile'].' was larger ('.t3lib_div::formatSize(filesize($fI['ID_absFile'])).') than the maxFileSize ('.t3lib_div::formatSize($this->maxFileSize).')! Skipping.');
                } else $this->error($fI['ID_absFile'].' was not a file! Skipping.');
        }
 
                } else $this->error($fI['ID_absFile'].' was not a file! Skipping.');
        }
 
@@ -1371,6 +1379,9 @@ class tx_impexp {
         */
        function importData($pid)       {
 
         */
        function importData($pid)       {
 
+                       // Set this flag to indicate that an import is being/has been done.
+               $this->doesImport = 1;
+
                        // Initialize:
                        // These vars MUST last for the whole section not being cleared. They are used by the method setRelations() which are called at the end of the import session.
                $this->import_mapId = array();
                        // Initialize:
                        // These vars MUST last for the whole section not being cleared. They are used by the method setRelations() which are called at the end of the import session.
                $this->import_mapId = array();
@@ -2178,8 +2189,8 @@ class tx_impexp {
                                                if ($this->dat['header']['files'][$fileHeaderInfo['RTE_ORIG_ID']])      {
 
                                                                // Write the copy and original RTE file to the respective filenames:
                                                if ($this->dat['header']['files'][$fileHeaderInfo['RTE_ORIG_ID']])      {
 
                                                                // Write the copy and original RTE file to the respective filenames:
-                                                       $this->writeFileVerify($copyDestName, $cfg['file_ID']);
-                                                       $this->writeFileVerify($origDestName, $fileHeaderInfo['RTE_ORIG_ID']);
+                                                       $this->writeFileVerify($copyDestName, $cfg['file_ID'], TRUE);
+                                                       $this->writeFileVerify($origDestName, $fileHeaderInfo['RTE_ORIG_ID'], TRUE);
 
                                                                // Return the relative path of the copy file name:
                                                        return substr($copyDestName, strlen(PATH_site));
 
                                                                // Return the relative path of the copy file name:
                                                        return substr($copyDestName, strlen(PATH_site));
@@ -2227,7 +2238,7 @@ class tx_impexp {
                        $fileHeaderInfo = $this->dat['header']['files'][$fileID];
                        $updMode = $this->update && $this->import_mapId[$table][$uid]===$uid && $this->import_mode[$table.':'.$uid]!=='as_new';
                                // Create new name for file:
                        $fileHeaderInfo = $this->dat['header']['files'][$fileID];
                        $updMode = $this->update && $this->import_mapId[$table][$uid]===$uid && $this->import_mode[$table.':'.$uid]!=='as_new';
                                // Create new name for file:
-                       if ($updMode)   {       // Must has same ID in map array (just for security, is not really needed) and NOT be set "as_new".
+                       if ($updMode)   {       // Must have same ID in map array (just for security, is not really needed) and NOT be set "as_new".
                                $newName = PATH_site.$dirPrefix.$fileName;
                        } else {
                                        // Create unique filename:
                                $newName = PATH_site.$dirPrefix.$fileName;
                        } else {
                                        // Create unique filename:
@@ -2239,16 +2250,16 @@ class tx_impexp {
                                // Write main file:
                        if ($this->writeFileVerify($newName, $fileID))  {
 
                                // Write main file:
                        if ($this->writeFileVerify($newName, $fileID))  {
 
-                                       // If the resource was an HTML file with resources attached, we will write those as well!
-                               if (is_array($fileHeaderInfo['HTML_RES_ID']))   {
-#debug($fileHeaderInfo['HTML_RES_ID']);
+                                       // If the resource was an HTML/CSS file with resources attached, we will write those as well!
+                               if (is_array($fileHeaderInfo['EXT_RES_ID']))    {
+#debug($fileHeaderInfo['EXT_RES_ID']);
                                        $tokenizedContent = $this->dat['files'][$fileID]['tokenizedContent'];
                                        $tokenSubstituted = FALSE;
 
                                        $fileProcObj = &$this->getFileProcObj();
 
                                        if ($updMode)   {
                                        $tokenizedContent = $this->dat['files'][$fileID]['tokenizedContent'];
                                        $tokenSubstituted = FALSE;
 
                                        $fileProcObj = &$this->getFileProcObj();
 
                                        if ($updMode)   {
-                                               foreach($fileHeaderInfo['HTML_RES_ID'] as $res_fileID)  {
+                                               foreach($fileHeaderInfo['EXT_RES_ID'] as $res_fileID)   {
                                                        if ($this->dat['files'][$res_fileID]['filename'])       {
 
                                                                        // Resolve original filename:
                                                        if ($this->dat['files'][$res_fileID]['filename'])       {
 
                                                                        // Resolve original filename:
@@ -2262,7 +2273,7 @@ class tx_impexp {
                                                                        } else $this->error('ERROR: Could not create file in directory "'.$destDir.'"');
                                                                } else $this->error('ERROR: Could not resolve path for "'.$relResourceFileName.'"');
 
                                                                        } else $this->error('ERROR: Could not create file in directory "'.$destDir.'"');
                                                                } else $this->error('ERROR: Could not resolve path for "'.$relResourceFileName.'"');
 
-                                                               $tokenizedContent = str_replace('{HTML_RES_ID:'.$res_fileID.'}', $relResourceFileName, $tokenizedContent);
+                                                               $tokenizedContent = str_replace('{EXT_RES_ID:'.$res_fileID.'}', $relResourceFileName, $tokenizedContent);
                                                                $tokenSubstituted = TRUE;
                                                        }
                                                }
                                                                $tokenSubstituted = TRUE;
                                                        }
                                                }
@@ -2270,13 +2281,13 @@ class tx_impexp {
                                                        // Create the resouces directory name (filename without extension, suffixed "_FILES")
                                                $resourceDir = dirname($newName).'/'.ereg_replace('\.[^.]*$','',basename($newName)).'_FILES';
                                                if (t3lib_div::mkdir($resourceDir))     {
                                                        // Create the resouces directory name (filename without extension, suffixed "_FILES")
                                                $resourceDir = dirname($newName).'/'.ereg_replace('\.[^.]*$','',basename($newName)).'_FILES';
                                                if (t3lib_div::mkdir($resourceDir))     {
-                                                       foreach($fileHeaderInfo['HTML_RES_ID'] as $res_fileID)  {
+                                                       foreach($fileHeaderInfo['EXT_RES_ID'] as $res_fileID)   {
                                                                if ($this->dat['files'][$res_fileID]['filename'])       {
                                                                        $absResourceFileName = $fileProcObj->getUniqueName($this->dat['files'][$res_fileID]['filename'], $resourceDir);
                                                                        $relResourceFileName = substr($absResourceFileName, strlen(dirname($resourceDir))+1);
                                                                        $this->writeFileVerify($absResourceFileName, $res_fileID);
 
                                                                if ($this->dat['files'][$res_fileID]['filename'])       {
                                                                        $absResourceFileName = $fileProcObj->getUniqueName($this->dat['files'][$res_fileID]['filename'], $resourceDir);
                                                                        $relResourceFileName = substr($absResourceFileName, strlen(dirname($resourceDir))+1);
                                                                        $this->writeFileVerify($absResourceFileName, $res_fileID);
 
-                                                                       $tokenizedContent = str_replace('{HTML_RES_ID:'.$res_fileID.'}', $relResourceFileName, $tokenizedContent);
+                                                                       $tokenizedContent = str_replace('{EXT_RES_ID:'.$res_fileID.'}', $relResourceFileName, $tokenizedContent);
                                                                        $tokenSubstituted = TRUE;
                                                                }
                                                        }
                                                                        $tokenSubstituted = TRUE;
                                                                }
                                                        }
@@ -2299,13 +2310,14 @@ class tx_impexp {
         *
         * @param       string          Absolute filename inside PATH_site to write to
         * @param       string          File ID from import memory
         *
         * @param       string          Absolute filename inside PATH_site to write to
         * @param       string          File ID from import memory
+        * @param       boolean         Bypasses the checking against filemounts - only for RTE files!
         * @return      boolean         Returns true if it went well. Notice that the content of the file is read again, and md5 from import memory is validated.
         */
         * @return      boolean         Returns true if it went well. Notice that the content of the file is read again, and md5 from import memory is validated.
         */
-       function writeFileVerify($fileName, $fileID   {
+       function writeFileVerify($fileName, $fileID, $bypassMountCheck=FALSE)   {
                $fileProcObj = &$this->getFileProcObj();
 
                if ($fileProcObj->actionPerms['newFile'])       {
                $fileProcObj = &$this->getFileProcObj();
 
                if ($fileProcObj->actionPerms['newFile'])       {
-                       if ($fileProcObj->checkPathAgainstMounts($fileName))    {       // Just for security, check again. Should actually not be necessary.
+                       if ($fileProcObj->checkPathAgainstMounts($fileName) || $bypassMountCheck)       {       // Just for security, check again. Should actually not be necessary.
                                $fI = t3lib_div::split_fileref($fileName);
                                if ($fileProcObj->checkIfAllowed($fI['fileext'], $fI['path'], $fI['file']) || ($this->allowPHPScripts && $GLOBALS['BE_USER']->isAdmin())) {
                                        if (t3lib_div::getFileAbsFileName($fileName))   {
                                $fI = t3lib_div::split_fileref($fileName);
                                if ($fileProcObj->checkIfAllowed($fI['fileext'], $fI['path'], $fI['file']) || ($this->allowPHPScripts && $GLOBALS['BE_USER']->isAdmin())) {
                                        if (t3lib_div::getFileAbsFileName($fileName))   {
@@ -2629,16 +2641,16 @@ class tx_impexp {
                                        <td>Message:</td>
                                        '.($this->update ? '<td>Update Mode:</td>' : '').'
                                        '.($this->update ? '<td>Current Path:</td>' : '').'
                                        <td>Message:</td>
                                        '.($this->update ? '<td>Update Mode:</td>' : '').'
                                        '.($this->update ? '<td>Current Path:</td>' : '').'
-                                       '.($this->showDiff ? '<td>Diff:</td>' : '').'
+                                       '.($this->showDiff ? '<td>Result:</td>' : '').'
                                </tr>';
 
                                foreach($lines as $r)   {
                                        $rows[] = '
                                </tr>';
 
                                foreach($lines as $r)   {
                                        $rows[] = '
-                                       <tr bgcolor="'.$r['bgColor'].'">
+                                       <tr class="'.$r['class'].'">
                                                <td>'.$this->renderControls($r).'</td>
                                                <td nowrap="nowrap">'.$r['preCode'].$r['title'].'</td>
                                                <td nowrap="nowrap">'.t3lib_div::formatSize($r['size']).'</td>
                                                <td>'.$this->renderControls($r).'</td>
                                                <td nowrap="nowrap">'.$r['preCode'].$r['title'].'</td>
                                                <td nowrap="nowrap">'.t3lib_div::formatSize($r['size']).'</td>
-                                               <td nowrap="nowrap">'.($r['msg']?'<span class="typo3-red">'.$r['msg'].'</span>':'').'</td>
+                                               <td nowrap="nowrap">'.($r['msg'] && !$this->doesImport ? '<span class="typo3-red">'.htmlspecialchars($r['msg']).'</span>' : '').'</td>
                                                '.($this->update ? '<td nowrap="nowrap">'.$r['updateMode'].'</td>' : '').'
                                                '.($this->update ? '<td nowrap="nowrap">'.$r['updatePath'].'</td>' : '').'
                                                '.($this->showDiff ? '<td>'.$r['showDiffContent'].'</td>' : '').'
                                                '.($this->update ? '<td nowrap="nowrap">'.$r['updateMode'].'</td>' : '').'
                                                '.($this->update ? '<td nowrap="nowrap">'.$r['updatePath'].'</td>' : '').'
                                                '.($this->showDiff ? '<td>'.$r['showDiffContent'].'</td>' : '').'
@@ -2670,15 +2682,15 @@ class tx_impexp {
                                                <td>Message:</td>
                                                '.($this->update ? '<td>Update Mode:</td>' : '').'
                                                '.($this->update ? '<td>Current Path:</td>' : '').'
                                                <td>Message:</td>
                                                '.($this->update ? '<td>Update Mode:</td>' : '').'
                                                '.($this->update ? '<td>Current Path:</td>' : '').'
-                                               '.($this->showDiff ? '<td>Diff:</td>' : '').'
+                                               '.($this->showDiff ? '<td>Result:</td>' : '').'
                                        </tr>';
 
                                        foreach($lines as $r)   {
                                        </tr>';
 
                                        foreach($lines as $r)   {
-                                               $rows[] = '<tr bgcolor="'.$r['bgColor'].'">
+                                               $rows[] = '<tr class="'.$r['class'].'">
                                                        <td>'.$this->renderControls($r).'</td>
                                                        <td nowrap="nowrap">'.$r['preCode'].$r['title'].'</td>
                                                        <td nowrap="nowrap">'.t3lib_div::formatSize($r['size']).'</td>
                                                        <td>'.$this->renderControls($r).'</td>
                                                        <td nowrap="nowrap">'.$r['preCode'].$r['title'].'</td>
                                                        <td nowrap="nowrap">'.t3lib_div::formatSize($r['size']).'</td>
-                                                       <td nowrap="nowrap">'.($r['msg']?'<span class="typo3-red">'.$r['msg'].'</span>':'').'</td>
+                                                       <td nowrap="nowrap">'.($r['msg'] && !$this->doesImport ? '<span class="typo3-red">'.htmlspecialchars($r['msg']).'</span>' : '').'</td>
                                                        '.($this->update ? '<td nowrap="nowrap">'.$r['updateMode'].'</td>' : '').'
                                                        '.($this->update ? '<td nowrap="nowrap">'.$r['updatePath'].'</td>' : '').'
                                                        '.($this->showDiff ? '<td>'.$r['showDiffContent'].'</td>' : '').'
                                                        '.($this->update ? '<td nowrap="nowrap">'.$r['updateMode'].'</td>' : '').'
                                                        '.($this->update ? '<td nowrap="nowrap">'.$r['updatePath'].'</td>' : '').'
                                                        '.($this->showDiff ? '<td>'.$r['showDiffContent'].'</td>' : '').'
@@ -2859,8 +2871,16 @@ class tx_impexp {
 
                        $pInfo['preCode'] = $preCode.t3lib_iconworks::getIconImage($table,$this->dat['records'][$table.':'.$uid]['data'],$GLOBALS['BACK_PATH'],'align="top" title="'.htmlspecialchars($table.':'.$uid).'"');
                        $pInfo['title'] = htmlspecialchars($record['title']);
 
                        $pInfo['preCode'] = $preCode.t3lib_iconworks::getIconImage($table,$this->dat['records'][$table.':'.$uid]['data'],$GLOBALS['BACK_PATH'],'align="top" title="'.htmlspecialchars($table.':'.$uid).'"');
                        $pInfo['title'] = htmlspecialchars($record['title']);
+
+                               // View page:
+                       if ($table==='pages')   {
+                               $viewID = $this->mode === 'export' ? $uid : ($this->doesImport ? $this->import_mapId['pages'][$uid] : 0);
+                               if ($viewID)    {
+                                       $pInfo['title'] = '<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::viewOnClick($viewID, $GLOBALS['BACK_PATH'])).'return false;">'.$pInfo['title'].'</a>';
+                               }
+                       }
                }
                }
-               $pInfo['bgColor'] = $table=='pages' ? t3lib_div::modifyHTMLColor($GLOBALS['TBE_TEMPLATE']->bgColor4,-10,-10,-10) : t3lib_div::modifyHTMLColor($GLOBALS['TBE_TEMPLATE']->bgColor4,20,20,20);
+               $pInfo['class'] = $table=='pages' ? 'bgColor4-20' : 'bgColor4';
                $pInfo['type'] = 'record';
                $pInfo['size'] = $record['size'];
                $lines[] = $pInfo;
                $pInfo['type'] = 'record';
                $pInfo['size'] = $record['size'];
                $lines[] = $pInfo;
@@ -2881,7 +2901,7 @@ class tx_impexp {
                        $preCode_B = $preCode.'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
                        foreach($record['softrefs'] as $info)   {
                                $pInfo = array();
                        $preCode_B = $preCode.'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
                        foreach($record['softrefs'] as $info)   {
                                $pInfo = array();
-                               $pInfo['preCode'] = $preCode_A.'<img src="'.$GLOBALS['BACK_PATH'].'t3lib/gfx/rel_softref.png" width="13" height="12" align="top" alt="" />';
+                               $pInfo['preCode'] = $preCode_A.'<img'.t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'],'t3lib/gfx/rel_softref.png','width="13" height="12"').' align="top" alt="" />';
                                $pInfo['title'] = '<em>'.$info['field'].', "'.$info['spKey'].'" </em>: <span title="'.htmlspecialchars($info['matchString']).'">'.htmlspecialchars(t3lib_div::fixed_lgd_cs($info['matchString'],60)).'</span>';
                                if ($info['subst']['type'])     {
                                        if (strlen($info['subst']['title']))    {
                                $pInfo['title'] = '<em>'.$info['field'].', "'.$info['spKey'].'" </em>: <span title="'.htmlspecialchars($info['matchString']).'">'.htmlspecialchars(t3lib_div::fixed_lgd_cs($info['matchString'],60)).'</span>';
                                if ($info['subst']['type'])     {
                                        if (strlen($info['subst']['title']))    {
@@ -2897,11 +2917,11 @@ class tx_impexp {
                                }
                                $pInfo['ref'] = 'SOFTREF';
                                $pInfo['size'] = '';
                                }
                                $pInfo['ref'] = 'SOFTREF';
                                $pInfo['size'] = '';
-                               $pInfo['bgColor'] = t3lib_div::modifyHTMLColor($GLOBALS['TBE_TEMPLATE']->bgColor4,0,-20,-40);
+                               $pInfo['class'] = 'bgColor3';
                                $pInfo['type'] = 'softref';
                                $pInfo['_softRefInfo'] = $info;
                                $pInfo['type'] = 'softref';
                                $pInfo['type'] = 'softref';
                                $pInfo['_softRefInfo'] = $info;
                                $pInfo['type'] = 'softref';
-                               if ($info['error'])     {
+                               if ($info['error'] && !t3lib_div::inList('editable,exclude',$this->softrefCfg[$info['subst']['tokenID']]['mode']))      {
                                        $pInfo['msg'].= $info['error'];
                                }
                                $lines[] = $pInfo;
                                        $pInfo['msg'].= $info['error'];
                                }
                                $lines[] = $pInfo;
@@ -2909,13 +2929,13 @@ class tx_impexp {
                                        // Add relations:
                                if ($info['subst']['type'] == 'db')     {
                                        list($tempTable, $tempUid) = explode(':', $info['subst']['recordRef']);
                                        // Add relations:
                                if ($info['subst']['type'] == 'db')     {
                                        list($tempTable, $tempUid) = explode(':', $info['subst']['recordRef']);
-                                       $this->addRelations(array(array('table' => $tempTable, 'id' => $tempUid, 'tokenID' => $info['subst']['tokenID'])),$lines,$preCode_B,array(), t3lib_div::modifyHTMLColor($GLOBALS['TBE_TEMPLATE']->bgColor4,0,-30,-50));
+                                       $this->addRelations(array(array('table' => $tempTable, 'id' => $tempUid, 'tokenID' => $info['subst']['tokenID'])),$lines,$preCode_B,array(), '');
                                }
 
                                        // Add files:
                                if ($info['subst']['type'] == 'file')   {
 #debug($info);
                                }
 
                                        // Add files:
                                if ($info['subst']['type'] == 'file')   {
 #debug($info);
-                                       $this->addFiles(array($info['file_ID']),$lines,$preCode_B, t3lib_div::modifyHTMLColor($GLOBALS['TBE_TEMPLATE']->bgColor4,0,-30,-50),$info['subst']['tokenID']);
+                                       $this->addFiles(array($info['file_ID']),$lines,$preCode_B, '', $info['subst']['tokenID']);
                                }
                        }
                }
                                }
                        }
                }
@@ -2928,12 +2948,12 @@ class tx_impexp {
         * @param       array           Output lines array (is passed by reference and modified)
         * @param       string          Pre-HTML code
         * @param       array           Recursivity check stack
         * @param       array           Output lines array (is passed by reference and modified)
         * @param       string          Pre-HTML code
         * @param       array           Recursivity check stack
-        * @param       string          Alternative HTML color to use.
+        * @param       string          Alternative HTML color class to use.
         * @return      void
         * @access private
         * @see singleRecordLines()
         */
         * @return      void
         * @access private
         * @see singleRecordLines()
         */
-       function addRelations($rels,&$lines,$preCode,$recurCheck=array(),$htmlColor='') {
+       function addRelations($rels,&$lines,$preCode,$recurCheck=array(),$htmlColorClass='')    {
 
                foreach($rels as $dat)  {
                        $table = $dat['table'];
 
                foreach($rels as $dat)  {
                        $table = $dat['table'];
@@ -2951,13 +2971,20 @@ class tx_impexp {
                                                        $Iprepend = '_static';
                                                        $staticFixed = TRUE;
                                                } else {
                                                        $Iprepend = '_static';
                                                        $staticFixed = TRUE;
                                                } else {
+                                                       $doesRE = $this->doesRecordExist($table,$uid);
+                                                       $lostPath = $this->getRecordPath($table==='pages' ? $doesRE['uid'] : $doesRE['pid']);
+
                                                        $pInfo['title'] = htmlspecialchars($pInfo['ref']);
                                                        $pInfo['title'] = htmlspecialchars($pInfo['ref']);
-                                                       $pInfo['msg'] = 'LOST RELATION'.(!$this->doesRecordExist($table,$uid) ? ' (Record not found!)' : '');
+                                                       $pInfo['title'] = '<span title="'.htmlspecialchars($lostPath).'">'.$pInfo['title'].'</span>';
+
+                                                       $pInfo['msg'] = 'LOST RELATION'.(!$doesRE ? ' (Record not found!)' : ' (Path: '.$lostPath.')');
                                                        $Iprepend = '_lost';
        #                                               debug('MISSING relation: '.$table.':'.$uid,1);
                                                }
                                        } else {
                                                $pInfo['title'] = htmlspecialchars($record['title']);
                                                        $Iprepend = '_lost';
        #                                               debug('MISSING relation: '.$table.':'.$uid,1);
                                                }
                                        } else {
                                                $pInfo['title'] = htmlspecialchars($record['title']);
+                                               $pInfo['title'] = '<span title="'.htmlspecialchars($this->getRecordPath($table==='pages' ? $record['uid'] : $record['pid'])).'">'.$pInfo['title'].'</span>';
+
                                        #       $pInfo['size'] = $record['size'];
                                        }
                                } else {        // Negative values in relation fields. This is typically sys_language fields, fe_users fields etc. They are static values. They CAN theoretically be negative pointers to uids in other tables but this is so rarely used that it is not supported
                                        #       $pInfo['size'] = $record['size'];
                                        }
                                } else {        // Negative values in relation fields. This is typically sys_language fields, fe_users fields etc. They are static values. They CAN theoretically be negative pointers to uids in other tables but this is so rarely used that it is not supported
@@ -2965,14 +2992,14 @@ class tx_impexp {
                                        $staticFixed = TRUE;
                                }
 
                                        $staticFixed = TRUE;
                                }
 
-                               $pInfo['preCode'] = $preCode.'&nbsp;&nbsp;&nbsp;&nbsp;<img src="'.$GLOBALS['BACK_PATH'].'t3lib/gfx/rel_db'.$Iprepend.'.gif" width="13" height="12" align="top" title="'.$pInfo['ref'].'" alt="" />';
-                               $pInfo['bgColor'] = $htmlColor ? $htmlColor : t3lib_div::modifyHTMLColor($GLOBALS['TBE_TEMPLATE']->bgColor4,10,10,10);
+                               $pInfo['preCode'] = $preCode.'&nbsp;&nbsp;&nbsp;&nbsp;<img'.t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'],'t3lib/gfx/rel_db'.$Iprepend.'.gif','width="13" height="12"').' align="top" title="'.htmlspecialchars($pInfo['ref']).'" alt="" />';
+                               $pInfo['class'] = $htmlColorClass ? $htmlColorClass : 'bgColor3';
                                $pInfo['type'] = 'rel';
 
                                if (!$staticFixed || $this->showStaticRelations)        {
                                        $lines[] = $pInfo;
                                        if (is_array($record) && is_array($record['rels']))     {
                                $pInfo['type'] = 'rel';
 
                                if (!$staticFixed || $this->showStaticRelations)        {
                                        $lines[] = $pInfo;
                                        if (is_array($record) && is_array($record['rels']))     {
-                                               $this->addRelations($record['rels'], $lines, $preCode.'&nbsp;&nbsp;', array_merge($recurCheck,array($pInfo['ref'])), $htmlColor);
+                                               $this->addRelations($record['rels'], $lines, $preCode.'&nbsp;&nbsp;', array_merge($recurCheck,array($pInfo['ref'])), $htmlColorClass);
                                        }
                                }
                        } else $this->error($pInfo['ref'].' was recursive...');
                                        }
                                }
                        } else $this->error($pInfo['ref'].' was recursive...');
@@ -2985,13 +3012,13 @@ class tx_impexp {
         * @param       array           Array of file IDs
         * @param       array           Output lines array (is passed by reference and modified)
         * @param       string          Pre-HTML code
         * @param       array           Array of file IDs
         * @param       array           Output lines array (is passed by reference and modified)
         * @param       string          Pre-HTML code
-        * @param       string          Alternative HTML color to use.
+        * @param       string          Alternative HTML color class to use.
         * @param       string          Token ID if this is a softreference (in which case it only makes sense with a single element in the $rels array!)
         * @return      void
         * @access private
         * @see singleRecordLines()
         */
         * @param       string          Token ID if this is a softreference (in which case it only makes sense with a single element in the $rels array!)
         * @return      void
         * @access private
         * @see singleRecordLines()
         */
-       function addFiles($rels,&$lines,$preCode,$htmlColor='',$tokenID='')     {
+       function addFiles($rels,&$lines,$preCode,$htmlColorClass='',$tokenID='')        {
 
                foreach($rels as $ID)   {
 
 
                foreach($rels as $ID)   {
 
@@ -3006,24 +3033,29 @@ class tx_impexp {
                                        return;
                                }
                        }
                                        return;
                                }
                        }
-                       $pInfo['preCode'] = $preCode.'&nbsp;&nbsp;&nbsp;&nbsp;<img src="'.$GLOBALS['BACK_PATH'].'t3lib/gfx/rel_file.gif" width="13" height="12" align="top" alt="" />';
+                       $pInfo['preCode'] = $preCode.'&nbsp;&nbsp;&nbsp;&nbsp;<img'.t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'],'t3lib/gfx/rel_file.gif','width="13" height="12"').' align="top" alt="" />';
                        $pInfo['title'] = htmlspecialchars($fI['filename']);
                        $pInfo['ref'] = 'FILE';
                        $pInfo['size'] = $fI['filesize'];
                        $pInfo['title'] = htmlspecialchars($fI['filename']);
                        $pInfo['ref'] = 'FILE';
                        $pInfo['size'] = $fI['filesize'];
-                       $pInfo['bgColor'] = $htmlColor ? $htmlColor : t3lib_div::modifyHTMLColorAll($GLOBALS['TBE_TEMPLATE']->bgColor4,10);
+                       $pInfo['class'] = $htmlColorClass ? $htmlColorClass : 'bgColor3';
                        $pInfo['type'] = 'file';
 
                                // If import mode and there is a non-RTE softreference, check the destination directory:
                        if ($this->mode==='import' && $tokenID && !$fI['RTE_ORIG_ID'])  {
                        $pInfo['type'] = 'file';
 
                                // If import mode and there is a non-RTE softreference, check the destination directory:
                        if ($this->mode==='import' && $tokenID && !$fI['RTE_ORIG_ID'])  {
-                               $testDirPrefix = dirname($fI['relFileName']).'/';
-                               $testDirPrefix2 = $this->verifyFolderAccess($testDirPrefix);
+                               if (isset($fI['parentRelFileName']))    {
+                                       $pInfo['msg'] = 'Seems like this file is already referenced from within an HTML/CSS file. That takes precedence. ';
+                               } else {
+                                       $testDirPrefix = dirname($fI['relFileName']).'/';
+                                       $testDirPrefix2 = $this->verifyFolderAccess($testDirPrefix);
 
 
-                               if (!$testDirPrefix2)   {
-                                       $pInfo['msg'] = 'ERROR: There are no available filemounts to write file in! ';
-                               } elseif (strcmp($testDirPrefix,$testDirPrefix2))       {
-                                       $pInfo['msg'] = 'File will be attempted written to "'.$testDirPrefix2.'". ';
+                                       if (!$testDirPrefix2)   {
+                                               $pInfo['msg'] = 'ERROR: There are no available filemounts to write file in! ';
+                                       } elseif (strcmp($testDirPrefix,$testDirPrefix2))       {
+                                               $pInfo['msg'] = 'File will be attempted written to "'.$testDirPrefix2.'". ';
+                                       }
                                }
 
                                }
 
+
                                        // Check if file exists:
                                if (@file_exists(PATH_site.$fI['relFileName'])) {
                                        if ($this->update)      {
                                        // Check if file exists:
                                if (@file_exists(PATH_site.$fI['relFileName'])) {
                                        if ($this->update)      {
@@ -3060,35 +3092,35 @@ class tx_impexp {
 
                                $pInfo['showDiffContent'] = substr($this->fileIDMap[$ID],strlen(PATH_site));
 
 
                                $pInfo['showDiffContent'] = substr($this->fileIDMap[$ID],strlen(PATH_site));
 
-                               $pInfo['preCode'] = $preCode.'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img src="'.$GLOBALS['BACK_PATH'].'t3lib/gfx/rel_file.gif" width="13" height="12" align="top" alt="" />';
+                               $pInfo['preCode'] = $preCode.'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img'.t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'],'t3lib/gfx/rel_file.gif','width="13" height="12"').' align="top" alt="" />';
                                $pInfo['title'] = htmlspecialchars($fI['filename']).' <em>(Original)</em>';
                                $pInfo['ref'] = 'FILE';
                                $pInfo['size'] = $fI['filesize'];
                                $pInfo['title'] = htmlspecialchars($fI['filename']).' <em>(Original)</em>';
                                $pInfo['ref'] = 'FILE';
                                $pInfo['size'] = $fI['filesize'];
-                               $pInfo['bgColor'] = $htmlColor ? $htmlColor : t3lib_div::modifyHTMLColorAll($GLOBALS['TBE_TEMPLATE']->bgColor4,10);
+                               $pInfo['class'] = $htmlColorClass ? $htmlColorClass : 'bgColor3';
                                $pInfo['type'] = 'file';
                                $lines[] = $pInfo;
                                unset($this->remainHeader['files'][$ID]);
                        }
 
                                $pInfo['type'] = 'file';
                                $lines[] = $pInfo;
                                unset($this->remainHeader['files'][$ID]);
                        }
 
-                               // HTML resources:
-                       if (is_array($fI['HTML_RES_ID']))       {
-                               foreach($fI['HTML_RES_ID'] as $ID)      {
+                               // External resources:
+                       if (is_array($fI['EXT_RES_ID']))        {
+                               foreach($fI['EXT_RES_ID'] as $ID)       {
                                        $pInfo = array();
                                        $fI = $this->dat['header']['files'][$ID];
                                        if (!is_array($fI))     {
                                        $pInfo = array();
                                        $fI = $this->dat['header']['files'][$ID];
                                        if (!is_array($fI))     {
-                                               $pInfo['msg'] = 'MISSING HTML resource FILE: '.$ID;
-                                               $this->error('MISSING HTML resource FILE: '.$ID,1);
+                                               $pInfo['msg'] = 'MISSING External Resource FILE: '.$ID;
+                                               $this->error('MISSING External Resource FILE: '.$ID,1);
                                        } else {
                                                $pInfo['updatePath'] = $fI['parentRelFileName'];
                                        }
 
                                        $pInfo['showDiffContent'] = substr($this->fileIDMap[$ID],strlen(PATH_site));
 
                                        } else {
                                                $pInfo['updatePath'] = $fI['parentRelFileName'];
                                        }
 
                                        $pInfo['showDiffContent'] = substr($this->fileIDMap[$ID],strlen(PATH_site));
 
-                                       $pInfo['preCode'] = $preCode.'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img src="'.$GLOBALS['BACK_PATH'].'t3lib/gfx/rel_file.gif" width="13" height="12" align="top" alt="" />';
+                                       $pInfo['preCode'] = $preCode.'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img'.t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'],'t3lib/gfx/rel_file.gif','width="13" height="12"').' align="top" alt="" />';
                                        $pInfo['title'] = htmlspecialchars($fI['filename']).' <em>(Resource)</em>';
                                        $pInfo['ref'] = 'FILE';
                                        $pInfo['size'] = $fI['filesize'];
                                        $pInfo['title'] = htmlspecialchars($fI['filename']).' <em>(Resource)</em>';
                                        $pInfo['ref'] = 'FILE';
                                        $pInfo['size'] = $fI['filesize'];
-                                       $pInfo['bgColor'] = $htmlColor ? $htmlColor : t3lib_div::modifyHTMLColorAll($GLOBALS['TBE_TEMPLATE']->bgColor4,10);
+                                       $pInfo['class'] = $htmlColorClass ? $htmlColorClass : 'bgColor3';
                                        $pInfo['type'] = 'file';
                                        $lines[] = $pInfo;
                                        unset($this->remainHeader['files'][$ID]);
                                        $pInfo['type'] = 'file';
                                        $lines[] = $pInfo;
                                        unset($this->remainHeader['files'][$ID]);
@@ -3398,7 +3430,7 @@ class tx_impexp {
                                $output = 'Match';
                        }
 
                                $output = 'Match';
                        }
 
-                       return $output.' ['.$table.':'.$databaseRecord['uid'].']';
+                       return '<b class="nobr">['.htmlspecialchars($table.':'.$databaseRecord['uid'].' => '.$importRecord['uid']).']:</b> '.$output;
                }
 
 
                }
 
 
index 054e138..476739b 100755 (executable)
@@ -1,7 +1,14 @@
 General:
 - Add an "alias" field to tt_content elements (unique for the PAGE like the "pid" field). [I'm not clear anymore about what this should be used for... - maybe anchors in links to content elements? I guess so...]
 General:
 - Add an "alias" field to tt_content elements (unique for the PAGE like the "pid" field). [I'm not clear anymore about what this should be used for... - maybe anchors in links to content elements? I guess so...]
+- Cronjob script which can export selected presets?
+
+Export of files:
 - Include all files from a path like fileadmin/xxx/
 
 - Include all files from a path like fileadmin/xxx/
 
+Import of files:
+- Optional folder to import files in (fileadmin/)
+- If file exists on import, optional if it should be written?
+
 IMPORT:
 - Better logging to system
 
 IMPORT:
 - Better logging to system