Documentation TYPO3 par Ameos

index.php

00001 <?php
00002 /***************************************************************
00003 *  Copyright notice
00004 *
00005 *  (c) 1999-2005 Kasper Skaarhoj (kasperYYYY@typo3.com)
00006 *  All rights reserved
00007 *
00008 *  This script is part of the TYPO3 project. The TYPO3 project is
00009 *  free software; you can redistribute it and/or modify
00010 *  it under the terms of the GNU General Public License as published by
00011 *  the Free Software Foundation; either version 2 of the License, or
00012 *  (at your option) any later version.
00013 *
00014 *  The GNU General Public License can be found at
00015 *  http://www.gnu.org/copyleft/gpl.html.
00016 *  A copy is found in the textfile GPL.txt and important notices to the license
00017 *  from the author is found in LICENSE.txt distributed with these scripts.
00018 *
00019 *
00020 *  This script is distributed in the hope that it will be useful,
00021 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00022 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00023 *  GNU General Public License for more details.
00024 *
00025 *  This copyright notice MUST APPEAR in all copies of the script!
00026 ***************************************************************/
00111 unset($MCONF);
00112 require ('conf.php');
00113 require ($BACK_PATH.'init.php');
00114 require ($BACK_PATH.'template.php');
00115 $LANG->includeLLFile('EXT:impexp/app/locallang.php');
00116 require_once (PATH_t3lib.'class.t3lib_scbase.php');
00117 require_once (t3lib_extMgm::extPath('impexp').'class.tx_impexp.php');
00118 require_once (PATH_t3lib.'class.t3lib_browsetree.php');
00119 require_once (PATH_t3lib.'class.t3lib_pagetree.php');
00120 
00121 require_once (PATH_t3lib.'class.t3lib_basicfilefunc.php');
00122 require_once (PATH_t3lib.'class.t3lib_extfilefunc.php');
00123 
00124 t3lib_extMgm::isLoaded('impexp',1);
00125 
00126 
00127 
00128 
00129 
00137 class localPageTree extends t3lib_browseTree {
00138 
00144         function localPageTree() {
00145                 $this->init();
00146         }
00147 
00155         function wrapTitle($title,$v)   {
00156                 $title = (!strcmp(trim($title),'')) ? '<em>['.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.no_title',1).']</em>' : htmlspecialchars($title);
00157                 return $title;
00158         }
00159 
00168         function PM_ATagWrap($icon,$cmd,$bMark='')      {
00169                 return $icon;
00170         }
00171 
00179         function wrapIcon($icon,$row)   {
00180                 return $icon;
00181         }
00182 
00188         function permsC()       {
00189                 return $this->BE_USER->getPagePermsClause(1);
00190         }
00191 
00199         function ext_tree($pid, $clause='')     {
00200 
00201                         // Initialize:
00202                 $this->init(' AND '.$this->permsC().$clause);
00203 
00204                         // Get stored tree structure:
00205                 $this->stored = unserialize($this->BE_USER->uc['browseTrees']['browsePages']);
00206 
00207                         // PM action:
00208                 $PM = t3lib_div::intExplode('_',t3lib_div::_GP('PM'));
00209 
00210                         // traverse mounts:
00211                 $titleLen = intval($this->BE_USER->uc['titleLen']);
00212                 $treeArr = array();
00213 
00214                 $idx = 0;
00215 
00216                         // Set first:
00217                 $this->bank = $idx;
00218                 $isOpen = $this->stored[$idx][$pid] || $this->expandFirst;
00219 
00220                 $curIds = $this->ids;   // save ids
00221                 $this->reset();
00222                 $this->ids = $curIds;
00223 
00224                         // Set PM icon:
00225                 $cmd = $this->bank.'_'.($isOpen?'0_':'1_').$pid;
00226                 $icon = '<img'.t3lib_iconWorks::skinImg($this->backPath,'t3lib/gfx/ol/'.($isOpen?'minus':'plus').'only.gif','width="18" height="16"').' align="top" alt="" />';
00227                 $firstHtml = $this->PM_ATagWrap($icon,$cmd);
00228 
00229                 if ($pid>0)     {
00230                         $rootRec = t3lib_befunc::getRecord('pages',$pid);
00231                         $firstHtml.= $this->wrapIcon(t3lib_iconWorks::getIconImage('pages',$rootRec,$this->backPath,'align="top"'),$rootRec);
00232                 } else {
00233                         $rootRec = array(
00234                                 'title' => $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'],
00235                                 'uid' => 0
00236                         );
00237                         $firstHtml.= $this->wrapIcon('<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/i/_icon_website.gif','width="18" height="16"').' align="top" alt="" />',$rootRec);
00238                 }
00239                 $this->tree[] = array('HTML'=>$firstHtml, 'row'=>$rootRec);
00240                 if ($isOpen)    {
00241                                 // Set depth:
00242                         $depthD = '<img'.t3lib_iconWorks::skinImg($this->backPath,'t3lib/gfx/ol/blank.gif','width="18" height="16"').' align="top" alt="" />';
00243                         if ($this->addSelfId)   $this->ids[] = $pid;
00244                         $this->getTree($pid,999,$depthD);
00245 
00246                         $idH = array();
00247                         $idH[$pid]['uid'] = $pid;
00248                         if (count($this->buffer_idH))   $idH[$pid]['subrow'] = $this->buffer_idH;
00249                         $this->buffer_idH = $idH;
00250 
00251                 }
00252 
00253                         // Add tree:
00254                 $treeArr = array_merge($treeArr,$this->tree);
00255 
00256                 return $treeArr;
00257         }
00258 }
00259 
00260 
00261 
00262 
00263 
00264 
00265 
00266 
00267 
00268 
00269 
00270 
00271 
00272 
00280 class SC_mod_tools_log_index extends t3lib_SCbase {
00281 
00282         var $pageinfo;                  // array containing the current page.
00283 
00289         function main() {
00290                 global $BE_USER,$LANG,$BACK_PATH;
00291 
00292                         // Start document template object:
00293                 $this->doc = t3lib_div::makeInstance('mediumDoc');
00294                 $this->doc->backPath = $BACK_PATH;
00295                 $this->doc->docType = 'xhtml_trans';
00296 
00297                                 // JavaScript
00298                 $this->doc->JScode = $this->doc->wrapScriptTags('
00299                         script_ended = 0;
00300                         function jumpToUrl(URL) {       //
00301                                 document.location = URL;
00302                         }
00303                 ');
00304 
00305                         // Set up JS for dynamic tab menu
00306                 $this->doc->JScode .= $this->doc->getDynTabMenuJScode();
00307 
00308                 $this->doc->postCode = $this->doc->wrapScriptTags('
00309                         script_ended = 1;
00310                         if (top.fsMod) top.fsMod.recentIds["web"] = '.intval($this->id).';
00311                 ');
00312                 $this->doc->form = '<form action="index.php" method="post" enctype="'.$GLOBALS['TYPO3_CONF_VARS']['SYS']['form_enctype'].'"><input type="hidden" name="id" value="'.$this->id.'" />';
00313 
00314                 $this->content.= $this->doc->startPage($LANG->getLL('title'));
00315                 $this->content.= $this->doc->header($LANG->getLL('title'));
00316                 $this->content.= $this->doc->spacer(5);
00317 
00318                         // Input data grabbed:
00319                 $inData = t3lib_div::_GP('tx_impexp');
00320 
00321                 $this->checkUpload();
00322 
00323                 switch((string)$inData['action'])       {
00324                         case 'export':
00325 
00326                                         // Finally: If upload went well, set the new file as the thumbnail in the $inData array:
00327                                 if (is_object($this->fileProcessor) && $this->fileProcessor->internalUploadMap[1])      {
00328                                         $inData['meta']['thumbnail'] = md5($this->fileProcessor->internalUploadMap[1]);
00329                                 }
00330 
00331                                         // Call export interface
00332                                 $this->exportData($inData);
00333                         break;
00334                         case 'import':
00335 
00336                                         // Finally: If upload went well, set the new file as the import file:
00337                                 if (is_object($this->fileProcessor) && $this->fileProcessor->internalUploadMap[1])      {
00338                                         $fI = pathinfo($this->fileProcessor->internalUploadMap[1]);
00339                                         if (t3lib_div::inList('t3d,xml',strtolower($fI['extension'])))  {       // Only allowed extensions....
00340                                                 $inData['file'] = $this->fileProcessor->internalUploadMap[1];
00341                                         }
00342                                 }
00343 
00344                                         // Call import interface:
00345                                 $this->importData($inData);
00346                         break;
00347                 }
00348 
00349                 if ($BE_USER->mayMakeShortcut())        {
00350                         $this->content.=$this->doc->spacer(20).$this->doc->section('',$this->doc->makeShortcutIcon('tx_impexp','',$this->MCONF['name']));
00351                 }
00352         }
00353 
00359         function printContent() {
00360 
00361                 $this->content.= $this->doc->spacer(20);
00362                 $this->content.= $this->doc->endPage();
00363                 echo $this->content;
00364         }
00365 
00366 
00367 
00368 
00369 
00370 
00371 
00372 
00373 
00374 
00375         /**************************
00376          *
00377          * EXPORT FUNCTIONS
00378          *
00379          **************************/
00380 
00387         function exportData($inData)    {
00388                 global $TCA, $LANG;
00389 
00390                         // BUILDING EXPORT DATA:
00391 
00392                         // Processing of InData array values:
00393                 $inData['pagetree']['maxNumber'] = t3lib_div::intInRange($inData['pagetree']['maxNumber'],1,10000,100);
00394                 $inData['listCfg']['maxNumber'] = t3lib_div::intInRange($inData['listCfg']['maxNumber'],1,10000,100);
00395                 $inData['maxFileSize'] = t3lib_div::intInRange($inData['maxFileSize'],1,10000,1000);
00396                 $inData['filename'] = trim(ereg_replace('[^[:alnum:]./_-]*','',ereg_replace('\.(t3d|xml)$','',$inData['filename'])));
00397                 if (strlen($inData['filename']))        {
00398                         $inData['filename'].= $inData['filetype']=='xml' ? '.xml' : '.t3d';
00399                 }
00400 
00401                         // Set exclude fields in export object:
00402                 if (!is_array($inData['exclude']))      {
00403                         $inData['exclude'] = array();
00404                 }
00405 
00406 
00407                         // Saving/Loading/Deleting presets:
00408                 $this->processPresets($inData);
00409 
00410                         // Create export object and configure it:
00411                 $this->export = t3lib_div::makeInstance('tx_impexp');
00412                 $this->export->init(0,'export');
00413                 $this->export->setCharset($LANG->charSet);
00414 
00415                 $this->export->maxFileSize = $inData['maxFileSize']*1024;
00416                 $this->export->excludeMap = (array)$inData['exclude'];
00417                 $this->export->softrefCfg = (array)$inData['softrefCfg'];
00418                 $this->export->extensionDependencies = (array)$inData['extension_dep'];
00419                 $this->export->showStaticRelations = $inData['showStaticRelations'];
00420 
00421                 $this->export->includeExtFileResources = !$inData['excludeHTMLfileResources'];
00422 #debug($inData);
00423                         // Static tables:
00424                 if (is_array($inData['external_static']['tables']))     {
00425                         $this->export->relStaticTables = $inData['external_static']['tables'];
00426                 }
00427 
00428                         // Configure which tables external relations are included for:
00429                 if (is_array($inData['external_ref']['tables']))        {
00430                         $this->export->relOnlyTables = $inData['external_ref']['tables'];
00431                 }
00432                 $this->export->setHeaderBasics();
00433 
00434                         // Meta data setting:
00435                 $this->export->setMetaData(
00436                         $inData['meta']['title'],
00437                         $inData['meta']['description'],
00438                         $inData['meta']['notes'],
00439                         $GLOBALS['BE_USER']->user['username'],
00440                         $GLOBALS['BE_USER']->user['realName'],
00441                         $GLOBALS['BE_USER']->user['email']
00442                 );
00443                 if ($inData['meta']['thumbnail'])       {
00444                         $tempDir = $this->userTempFolder();
00445                         if ($tempDir)   {
00446                                 $thumbnails = t3lib_div::getFilesInDir($tempDir,'png,gif,jpg',1);
00447                                 $theThumb = $thumbnails[$inData['meta']['thumbnail']];
00448                                 if ($theThumb)  {
00449                                         $this->export->addThumbnail($theThumb);
00450                                 }
00451                         }
00452                 }
00453 
00454 
00455                         // Configure which records to export
00456                 if (is_array($inData['record']))        {
00457                         foreach($inData['record'] as $ref)      {
00458                                 $rParts = explode(':',$ref);
00459                                 $this->export->export_addRecord($rParts[0],t3lib_BEfunc::getRecord($rParts[0],$rParts[1]));
00460                         }
00461                 }
00462 
00463                         // Configure which tables to export
00464                 if (is_array($inData['list']))  {
00465                         foreach($inData['list'] as $ref)        {
00466                                 $rParts = explode(':',$ref);
00467                                 if ($GLOBALS['BE_USER']->check('tables_select',$rParts[0]))     {
00468                                         $res = $this->exec_listQueryPid($rParts[0],$rParts[1],t3lib_div::intInRange($inData['listCfg']['maxNumber'],1));
00469                                         while($subTrow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))   {
00470                                                 $this->export->export_addRecord($rParts[0],$subTrow);
00471                                         }
00472                                 }
00473                         }
00474                 }
00475 
00476                         // Pagetree
00477                 if (isset($inData['pagetree']['id']))   {
00478                         if ($inData['pagetree']['levels']==-1)  {       // Based on click-expandable tree
00479                                 $pagetree = t3lib_div::makeInstance('localPageTree');
00480 
00481                                 $tree = $pagetree->ext_tree($inData['pagetree']['id'],$this->filterPageIds($this->export->excludeMap));
00482                                 $this->treeHTML = $pagetree->printTree($tree);
00483 
00484                                 $idH = $pagetree->buffer_idH;
00485 #                               debug($pagetree->buffer_idH);
00486                         } elseif ($inData['pagetree']['levels']==-2)    {       // Only tables on page
00487                                 $this->addRecordsForPid($inData['pagetree']['id'],$inData['pagetree']['tables'],$inData['pagetree']['maxNumber']);
00488                         } else {        // Based on depth
00489                                         // Drawing tree:
00490                                         // If the ID is zero, export root
00491                                 if (!$inData['pagetree']['id'] && $GLOBALS['BE_USER']->isAdmin())       {
00492                                         $sPage = array(
00493                                                 'uid' => 0,
00494                                                 'title' => 'ROOT'
00495                                         );
00496                                 } else {
00497                                         $sPage = t3lib_BEfunc::getRecord('pages',$inData['pagetree']['id'],'*',' AND '.$this->perms_clause);
00498                                 }
00499                                 if (is_array($sPage))   {
00500                                         $pid = $inData['pagetree']['id'];
00501                                         $tree = t3lib_div::makeInstance('t3lib_pageTree');
00502                                         $tree->init('AND '.$this->perms_clause.$this->filterPageIds($this->export->excludeMap));
00503 
00504                                         $HTML = t3lib_iconWorks::getIconImage('pages',$sPage,$GLOBALS['BACK_PATH'],'align="top"');
00505                                         $tree->tree[] = Array('row'=>$sPage,'HTML'=>$HTML);
00506                                         $tree->buffer_idH = array();
00507                                         if ($inData['pagetree']['levels']>0)    {
00508                                                 $tree->getTree($pid,$inData['pagetree']['levels'],'');
00509                                         }
00510 
00511                                         $idH = array();
00512                                         $idH[$pid]['uid'] = $pid;
00513                                         if (count($tree->buffer_idH))   {
00514                                                 $idH[$pid]['subrow'] = $tree->buffer_idH;
00515                                         }
00516 
00517                                         $pagetree = t3lib_div::makeInstance('localPageTree');
00518                                         $this->treeHTML = $pagetree->printTree($tree->tree);
00519 #debug($idH);
00520                                 }
00521                         }
00522                                 // In any case we should have a multi-level array, $idH, with the page structure here (and the HTML-code loaded into memory for nice display...)
00523                         if (is_array($idH))     {
00524                                 $flatList = $this->export->setPageTree($idH);   // Sets the pagetree and gets a 1-dim array in return with the pages (in correct submission order BTW...)
00525                                 reset($flatList);
00526                                 while(list($k)=each($flatList)) {
00527                                         $this->export->export_addRecord('pages',t3lib_BEfunc::getRecord('pages',$k));
00528                                         $this->addRecordsForPid($k,$inData['pagetree']['tables'],$inData['pagetree']['maxNumber']);
00529                                 }
00530                         }
00531                 }
00532 
00533                         // After adding ALL records we set relations:
00534 #               debug($this->export->relOnlyTables);
00535 #               if (count($this->export->relOnlyTables))        {
00536                         for($a=0;$a<10;$a++)    {
00537                                 $addR = $this->export->export_addDBRelations($a);
00538                                 if (!count($addR)) break;
00539                         }
00540 #               }
00541 
00542                         // Finally files are added:
00543                 $this->export->export_addFilesFromRelations();  // MUST be after the DBrelations are set so that files from ALL added records are included!
00544 #debug($this->export->dat['header']);
00545                         // If the download button is clicked, return file
00546                 if ($inData['download_export'] || $inData['save_export'])       {
00547                         switch((string)$inData['filetype'])     {
00548                                 case 'xml':
00549                                         $out = $this->export->compileMemoryToFileContent('xml');
00550                                         $fExt = '.xml';
00551                                 break;
00552                                 case 't3d':
00553                                         $this->export->dontCompress = 1;
00554                                 default:
00555                                         $out = $this->export->compileMemoryToFileContent();
00556                                         $fExt = ($this->export->doOutputCompress()?'-z':'').'.t3d';
00557                                 break;
00558                         }
00559 
00560                                 // Filename:
00561                         $dlFile = $inData['filename'] ? $inData['filename'] : 'T3D_'.substr(ereg_replace('[^[:alnum:]_]','-',$inData['download_export_name']),0,20).'_'.date('d-m-H-i-s').$fExt;
00562 
00563                                 // Export for download:
00564                         if ($inData['download_export']) {
00565                                 $mimeType = 'application/octet-stream';
00566                                 Header('Content-Type: '.$mimeType);
00567                                 Header('Content-Length: '.strlen($out));
00568                                 Header('Content-Disposition: attachment; filename='.basename($dlFile));
00569 
00570                                 echo $out;
00571                                 exit;
00572                         }
00573 
00574                                 // Export by saving:
00575                         if ($inData['save_export'])     {
00576                                 $savePath = $this->userSaveFolder();
00577                                 $fullName = $savePath.$dlFile;
00578 
00579                                 if (t3lib_div::isAllowedAbsPath($savePath) && @is_dir(dirname($fullName)) && t3lib_div::isAllowedAbsPath($fullName))    {
00580                                         t3lib_div::writeFile($fullName, $out);
00581                                         $this->content.= $this->doc->section($LANG->getLL('exportdata_savedFile'),sprintf($LANG->getLL('exportdata_savedInSBytes',1), substr($savePath.$dlFile,strlen(PATH_site)), t3lib_div::formatSize(strlen($out))),0,1);
00582                                 } else {
00583                                         $this->content.= $this->doc->section($LANG->getLL('exportdata_problemsSavingFile'),sprintf($LANG->getLL('exportdata_badPathS',1),$fullName),0,1,2);
00584                                 }
00585                         }
00586                 }
00587 
00588 
00589                         // OUTPUT to BROWSER:
00590                         // Now, if we didn't make download file, show configuration form based on export:
00591                 $menuItems = array();
00592 
00593                         // Export configuration
00594                 $row = array();
00595                 $this->makeConfigurationForm($inData, $row);
00596                 $menuItems[] = array(
00597                         'label' => $LANG->getLL('tableselec_configuration'),
00598                         'content' => '
00599                                 <table border="0" cellpadding="1" cellspacing="1">
00600                                         '.implode('
00601                                         ',$row).'
00602                                 </table>
00603                         '
00604                 );
00605 
00606                         // File options
00607                 $row = array();
00608                 $this->makeSaveForm($inData, $row);
00609                 $menuItems[] = array(
00610                         'label' => $LANG->getLL('exportdata_filePreset'),
00611                         'content' => '
00612                                 <table border="0" cellpadding="1" cellspacing="1">
00613                                         '.implode('
00614                                         ',$row).'
00615                                 </table>
00616                         '
00617                 );
00618 
00619                         // File options
00620                 $row = array();
00621                 $this->makeAdvancedOptionsForm($inData, $row);
00622                 $menuItems[] = array(
00623                         'label' => $LANG->getLL('exportdata_advancedOptions'),
00624                         'content' => '
00625                                 <table border="0" cellpadding="1" cellspacing="1">
00626                                         '.implode('
00627                                         ',$row).'
00628                                 </table>
00629                         '
00630                 );
00631 
00632                         // Generate overview:
00633                 $overViewContent = $this->export->displayContentOverview();
00634 
00635                         // Print errors that might be:
00636                 $errors = $this->export->printErrorLog();
00637                 $menuItems[] = array(
00638                         'label' => $LANG->getLL('exportdata_messages'),
00639                         'content' => $errors,
00640                         'stateIcon' => $errors ? 2 : 0
00641                 );
00642 
00643                         // Add hidden fields and create tabs:
00644                 $content = $this->doc->getDynTabMenu($menuItems,'tx_impexp_export',-1);
00645                 $content.= '<input type="hidden" name="tx_impexp[action]" value="export" />';
00646                 $this->content.= $this->doc->section('',$content,0,1);
00647 
00648                         // Output Overview:
00649                 $this->content.= $this->doc->section($LANG->getLL('execlistqu_structureToBeExported'),$overViewContent,0,1);
00650 
00651         }
00652 
00661         function addRecordsForPid($k, $tables, $maxNumber)      {
00662                 global $TCA;
00663 
00664                 if (is_array($tables))  {
00665                         reset($TCA);
00666                         while(list($table)=each($TCA))  {
00667                                 if ($table!='pages' && (in_array($table,$tables) || in_array('_ALL',$tables)))  {
00668                                         if ($GLOBALS['BE_USER']->check('tables_select',$table) && !$TCA[$table]['ctrl']['is_static'])   {
00669                                                 $res = $this->exec_listQueryPid($table,$k,t3lib_div::intInRange($maxNumber,1));
00670                                                 while($subTrow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))   {
00671                                                         $this->export->export_addRecord($table,$subTrow);
00672                                                 }
00673                                         }
00674                                 }
00675                         }
00676                 }
00677         }
00678 
00687         function exec_listQueryPid($table,$pid,$limit)  {
00688                 global $TCA, $LANG;
00689 
00690                 $orderBy = $TCA[$table]['ctrl']['sortby'] ? 'ORDER BY '.$TCA[$table]['ctrl']['sortby'] : $TCA[$table]['ctrl']['default_sortby'];
00691                 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
00692                                 '*',
00693                                 $table,
00694                                 'pid='.intval($pid).
00695                                         t3lib_BEfunc::deleteClause($table),
00696                                 '',
00697                                 $GLOBALS['TYPO3_DB']->stripOrderBy($orderBy),
00698                                 $limit
00699                         );
00700 
00701                         // Warning about hitting limit:
00702                 if ($GLOBALS['TYPO3_DB']->sql_num_rows($res) == $limit) {
00703                         $this->content.= $this->doc->section($LANG->getLL('execlistqu_maxNumberLimit'),sprintf($LANG->getLL('makeconfig_anSqlQueryReturned',1),$limit),0,1, 2);
00704                 }
00705 
00706                 return $res;
00707         }
00708 
00716         function makeConfigurationForm($inData, &$row)  {
00717                 global $LANG;
00718 
00719                 $nameSuggestion = '';
00720 
00721                         // Page tree export options:
00722                 if (isset($inData['pagetree']['id']))   {
00723 
00724                         $nameSuggestion.= 'tree_PID'.$inData['pagetree']['id'].'_L'.$inData['pagetree']['levels'];
00725 
00726                         $row[] = '
00727                                 <tr class="tableheader bgColor5">
00728                                         <td colspan="2">'.$LANG->getLL('makeconfig_exportPagetreeConfiguration',1).t3lib_BEfunc::cshItem('xMOD_tx_impexp', 'pageTreeCfg', $GLOBALS['BACK_PATH'],'').'</td>
00729                                 </tr>';
00730 
00731                         $row[] = '
00732                                 <tr class="bgColor4">
00733                                         <td><strong>'.$LANG->getLL('makeconfig_pageId',1).'</strong></td>
00734                                         <td>'.htmlspecialchars($inData['pagetree']['id']).
00735                                                 '<input type="hidden" value="'.htmlspecialchars($inData['pagetree']['id']).'" name="tx_impexp[pagetree][id]" /></td>
00736                                 </tr>';
00737 
00738                         $row[] = '
00739                                 <tr class="bgColor4">
00740                                         <td><strong>'.$LANG->getLL('makeconfig_tree',1).'</strong>'.t3lib_BEfunc::cshItem('xMOD_tx_impexp', 'pageTreeDisplay', $GLOBALS['BACK_PATH'],'').'</td>
00741                                         <td>'.($this->treeHTML ? $this->treeHTML : $LANG->getLL('makeconfig_noTreeExportedOnly',1)).'</td>
00742                                 </tr>';
00743 
00744                         $opt = array(
00745                                 '-2' => $LANG->getLL('makeconfig_tablesOnThisPage'),
00746                                 '-1' => $LANG->getLL('makeconfig_expandedTree'),
00747                                 '0' => $LANG->getLL('makeconfig_onlyThisPage'),
00748                                 '1' => $LANG->getLL('makeconfig_1Level'),
00749                                 '2' => $LANG->getLL('makeconfig_2Levels'),
00750                                 '3' => $LANG->getLL('makeconfig_3Levels'),
00751                                 '4' => $LANG->getLL('makeconfig_4Levels'),
00752                                 '999' => $LANG->getLL('makeconfig_infinite')
00753                         );
00754                         $row[] = '
00755                                 <tr class="bgColor4">
00756                                         <td><strong>'.$LANG->getLL('makeconfig_levels',1).'</strong>'.t3lib_BEfunc::cshItem('xMOD_tx_impexp', 'pageTreeMode', $GLOBALS['BACK_PATH'],'').'</td>
00757                                         <td>'.$this->renderSelectBox('tx_impexp[pagetree][levels]',$inData['pagetree']['levels'],$opt).'</td>
00758                                 </tr>';
00759 
00760                         $row[] = '
00761                                 <tr class="bgColor4">
00762                                         <td><strong>'.$LANG->getLL('makeconfig_includeTables',1).'</strong>'.t3lib_BEfunc::cshItem('xMOD_tx_impexp', 'pageTreeRecordLimit', $GLOBALS['BACK_PATH'],'').'</td>
00763                                         <td>'.$this->tableSelector('tx_impexp[pagetree][tables]',$inData['pagetree']['tables'],'pages').'<br/>
00764                                                 '.$LANG->getLL('makeconfig_maxNumberOfRecords',1).'<br/>
00765                                                 <input type="text" name="tx_impexp[pagetree][maxNumber]" value="'.htmlspecialchars($inData['pagetree']['maxNumber']).'"'.$this->doc->formWidth(10).' /><br/>
00766                                         </td>
00767                                 </tr>';
00768                 }
00769 
00770                         // Single record export:
00771                 if (is_array($inData['record']))        {
00772                         $row[] = '
00773                                 <tr class="tableheader bgColor5">
00774                                         <td colspan="2">'.$LANG->getLL('makeconfig_exportSingleRecord',1).t3lib_BEfunc::cshItem('xMOD_tx_impexp', 'singleRecord', $GLOBALS['BACK_PATH'],'').'</td>
00775                                 </tr>';
00776                         foreach($inData['record'] as $ref)      {
00777                                 $rParts = explode(':', $ref);
00778                                 $tName = $rParts[0];
00779                                 $rUid = $rParts[1];
00780                                 $nameSuggestion.= $tName.'_'.$rUid;
00781                                 $rec = t3lib_BEfunc::getRecord($tName,$rUid);
00782 
00783                                 $row[] = '
00784                                 <tr class="bgColor4">
00785                                         <td><strong>'.$LANG->getLL('makeconfig_record',1).'</strong></td>
00786                                         <td>'.t3lib_iconworks::getIconImage($tName,$rec,$GLOBALS['BACK_PATH'],' align="top"').
00787                                                 t3lib_BEfunc::getRecordTitle($tName,$rec,1).
00788                                                 '<input type="hidden" name="tx_impexp[record][]" value="'.htmlspecialchars($tName.':'.$rUid).'" /></td>
00789                                 </tr>';
00790                         }
00791                 }
00792 
00793                         // Single tables/pids:
00794                 if (is_array($inData['list']))  {
00795                         $row[] = '
00796                                 <tr class="tableheader bgColor5">
00797                                         <td colspan="2">'.$LANG->getLL('makeconfig_exportTablesFromPages',1).'</td>
00798                                 </tr>';
00799 
00800                         $tblList = '';
00801                         foreach($inData['list'] as $ref)        {
00802                                 $rParts = explode(':', $ref);
00803                                 $tName = $rParts[0];
00804 
00805                                 if ($GLOBALS['BE_USER']->check('tables_select',$tName)) {
00806                                         $rec = t3lib_BEfunc::getRecord('pages', $rParts[1]);
00807                                         $tblList.='Table "'.$tName.'" from '.t3lib_iconworks::getIconImage('pages',$rec,$GLOBALS['BACK_PATH'],' align="top"').
00808                                         t3lib_BEfunc::getRecordTitle('pages',$rec,1).
00809                                         '<input type="hidden" name="tx_impexp[list][]" value="'.htmlspecialchars($ref).'" /><br/>';
00810                                 }
00811                         }
00812                         $row[] = '
00813                         <tr class="bgColor4">
00814                                 <td><strong>'.$LANG->getLL('makeconfig_tablePids',1).'</strong>'.t3lib_BEfunc::cshItem('xMOD_tx_impexp', 'tableList', $GLOBALS['BACK_PATH'],'').'</td>
00815                                 <td>'.$tblList.'</td>
00816                         </tr>';
00817 
00818                         $row[] = '
00819                                 <tr class="bgColor4">
00820                                         <td><strong>'.$LANG->getLL('makeconfig_maxNumberOfRecords',1).t3lib_BEfunc::cshItem('xMOD_tx_impexp', 'tableListMaxNumber', $GLOBALS['BACK_PATH'],'').'</strong></td>
00821                                         <td>
00822                                                 <input type="text" name="tx_impexp[listCfg][maxNumber]" value="'.htmlspecialchars($inData['listCfg']['maxNumber']).'"'.$this->doc->formWidth(10).' /><br/>
00823                                         </td>
00824                                 </tr>';
00825                 }
00826 
00827 
00828                 $row[] = '
00829                         <tr class="tableheader bgColor5">
00830                                 <td colspan="2">'.$LANG->getLL('makeconfig_relationsAndExclusions',1).'</td>
00831                         </tr>';
00832 
00833                         // Add relation selector:
00834                 $row[] = '
00835                                 <tr class="bgColor4">
00836                                         <td><strong>'.$LANG->getLL('makeconfig_includeRelationsToTables',1).'</strong>'.t3lib_BEfunc::cshItem('xMOD_tx_impexp', 'inclRelations', $GLOBALS['BACK_PATH'],'').'</td>
00837                                         <td>'.$this->tableSelector('tx_impexp[external_ref][tables]',$inData['external_ref']['tables']).'</td>
00838                                 </tr>';
00839 
00840                         // Add static relation selector:
00841                 $row[] = '
00842                                 <tr class="bgColor4">
00843                                         <td><strong>'.$LANG->getLL('makeconfig_useStaticRelationsFor',1).'</strong>'.t3lib_BEfunc::cshItem('xMOD_tx_impexp', 'staticRelations', $GLOBALS['BACK_PATH'],'').'</td>
00844                                         <td>'.$this->tableSelector('tx_impexp[external_static][tables]',$inData['external_static']['tables']).'<br/>
00845                                                 '.$LANG->getLL('makeconfig_showStaticRelations',1).' <input type="checkbox" name="tx_impexp[showStaticRelations]" value="1"'.($inData['showStaticRelations'] ? ' checked="checked"' : '').' />
00846                                                 </td>
00847                                 </tr>';
00848 
00849                         // Exclude:
00850                 $excludeHiddenFields = '';
00851                 if (is_array($inData['exclude']))       {
00852                         foreach($inData['exclude'] as $key => $value)   {
00853                                 $excludeHiddenFields.= '<input type="hidden" name="tx_impexp[exclude]['.$key.']" value="1" />';
00854                         }
00855                 }
00856                 $row[] = '
00857                                 <tr class="bgColor4">
00858                                         <td><strong>'.$LANG->getLL('makeconfig_excludeElements',1).'</strong>'.t3lib_BEfunc::cshItem('xMOD_tx_impexp', 'excludedElements', $GLOBALS['BACK_PATH'],'').'</td>
00859                                         <td>'.$excludeHiddenFields.'
00860                                         '.(count($inData['exclude']) ? '<em>'.implode(', ',array_keys($inData['exclude'])).'</em><hr/>'.$LANG->getLL('makeconfig_clearAllExclusions',1).' <input type="checkbox" name="tx_impexp[exclude]" value="1" />' : $LANG->getLL('makeconfig_noExcludedElementsYet',1)).'
00861                                         </td>
00862                                 </tr>';
00863 
00864 
00865                         // Add buttons:
00866                 $row[] = '
00867                                 <tr class="bgColor4">
00868                                         <td>&nbsp;</td>
00869                                         <td>
00870                                                 <input type="submit" value="'.$LANG->getLL('makeadvanc_update',1).'" />
00871                                                 <input type="hidden" name="tx_impexp[download_export_name]" value="'.substr($nameSuggestion,0,30).'" />
00872                                         </td>
00873                                 </tr>';
00874 
00875         }
00876 
00884         function makeAdvancedOptionsForm($inData, &$row)        {
00885                 global $LANG;
00886 
00887                         // Soft references
00888                 $row[] = '
00889                         <tr class="tableheader bgColor5">
00890                                 <td colspan="2">'.$LANG->getLL('makeadvanc_softReferences',1).'</td>
00891                         </tr>';
00892                 $row[] = '
00893                                 <tr class="bgColor4">
00894                                         <td><strong>'.$LANG->getLL('makeadvanc_excludeHtmlCssFile',1).'</strong>'.t3lib_BEfunc::cshItem('xMOD_tx_impexp', 'htmlCssResources', $GLOBALS['BACK_PATH'],'').'</td>
00895                                         <td><input type="checkbox" name="tx_impexp[excludeHTMLfileResources]" value="1"'.($inData['excludeHTMLfileResources'] ? ' checked="checked"' : '').' /></td>
00896                                 </tr>';
00897 
00898 
00899                         // Extensions
00900                 $row[] = '
00901                         <tr class="tableheader bgColor5">
00902                                 <td colspan="2">'.$LANG->getLL('makeadvanc_extensionDependencies',1).'</td>
00903                         </tr>';
00904                 $row[] = '
00905                                 <tr class="bgColor4">
00906                                         <td><strong>'.$LANG->getLL('makeadvanc_selectExtensionsThatThe',1).'</strong>'.t3lib_BEfunc::cshItem('xMOD_tx_impexp', 'extensionDependencies', $GLOBALS['BACK_PATH'],'').'</td>
00907                                         <td>'.$this->extensionSelector('tx_impexp[extension_dep]',$inData['extension_dep']).'</td>
00908                                 </tr>';
00909 
00910 
00911 
00912                         // Add buttons:
00913                 $row[] = '
00914                                 <tr class="bgColor4">
00915                                         <td>&nbsp;</td>
00916                                         <td>
00917                                                 <input type="submit" value="'.$LANG->getLL('makesavefo_update',1).'" />
00918                                                 <input type="hidden" name="tx_impexp[download_export_name]" value="'.substr($nameSuggestion,0,30).'" />
00919                                         </td>
00920                                 </tr>';
00921 
00922 
00923         }
00924 
00932         function makeSaveForm($inData, &$row)   {
00933                 global $LANG;
00934 
00935                         // Presets:
00936                 $row[] = '
00937                         <tr class="tableheader bgColor5">
00938                                 <td colspan="2">'.$LANG->getLL('makesavefo_presets',1).'</td>
00939                         </tr>';
00940 
00941                 $opt = array('');
00942                 $presets = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
00943                                                 '*',
00944                                                 'tx_impexp_presets',
00945                                                 '(public>0 || user_uid='.intval($GLOBALS['BE_USER']->user['uid']).')'.
00946                                                         ($inData['pagetree']['id'] ? ' AND (item_uid='.intval($inData['pagetree']['id']).' OR item_uid=0)' : '')
00947 
00948                                         );
00949                 if (is_array($presets)) {
00950                         foreach($presets as $presetCfg) {
00951                                 $opt[$presetCfg['uid']] = $presetCfg['title'].' ['.$presetCfg['uid'].']'.
00952                                                                                         ($presetCfg['public'] ? ' [Public]' : '').
00953                                                                                         ($presetCfg['user_uid']===$GLOBALS['BE_USER']->user['uid'] ? ' [Own]' : '');
00954                         }
00955                 }
00956 
00957                 $row[] = '
00958                                 <tr class="bgColor4">
00959                                         <td><strong>'.$LANG->getLL('makesavefo_presets',1).'</strong>'.t3lib_BEfunc::cshItem('xMOD_tx_impexp', 'presets', $GLOBALS['BACK_PATH'],'').'</td>
00960                                         <td>
00961                                                 '.$LANG->getLL('makesavefo_selectPreset',1).'<br/>
00962                                                 '.$this->renderSelectBox('preset[select]','',$opt).'
00963                                                 <br/>
00964                                                 <input type="submit" value="'.$LANG->getLL('makesavefo_load',1).'" name="preset[load]" />
00965                                                 <input type="submit" value="'.$LANG->getLL('makesavefo_save',1).'" name="preset[save]" onclick="return confirm(\''.$LANG->getLL('makesavefo_areYouSure',1).'\');" />
00966                                                 <input type="submit" value="'.$LANG->getLL('makesavefo_delete',1).'" name="preset[delete]" onclick="return confirm(\''.$LANG->getLL('makesavefo_areYouSure',1).'\');" />
00967                                                 <input type="submit" value="'.$LANG->getLL('makesavefo_merge',1).'" name="preset[merge]" onclick="return confirm(\''.$LANG->getLL('makesavefo_areYouSure',1).'\');" />
00968                                                 <br/>
00969                                                 '.$LANG->getLL('makesavefo_titleOfNewPreset',1).'
00970                                                 <input type="text" name="tx_impexp[preset][title]" value="'.htmlspecialchars($inData['preset']['title']).'"'.$this->doc->formWidth(30).' /><br/>
00971                                                 '.$LANG->getLL('makesavefo_public',1).'
00972                                                 <input type="checkbox" name="tx_impexp[preset][public]" value="1"'.($inData['preset']['public'] ? ' checked="checked"' : '').' /><br/>
00973                                         </td>
00974                                 </tr>';
00975 
00976                         // Output options:
00977                 $row[] = '
00978                         <tr class="tableheader bgColor5">
00979                                 <td colspan="2">'.$LANG->getLL('makesavefo_outputOptions',1).'</td>
00980                         </tr>';
00981 
00982                         // Meta data:
00983                 $tempDir = $this->userTempFolder();
00984                 if ($tempDir)   {
00985                         $thumbnails = t3lib_div::getFilesInDir($tempDir,'png,gif,jpg');
00986                         array_unshift($thumbnails,'');
00987                 } else $thumbnails = FALSE;
00988                 $row[] = '
00989                                 <tr class="bgColor4">
00990                                         <td><strong>'.$LANG->getLL('makesavefo_metaData',1).'</strong>'.t3lib_BEfunc::cshItem('xMOD_tx_impexp', 'metadata', $GLOBALS['BACK_PATH'],'').'</td>
00991                                         <td>
00992                                                         '.$LANG->getLL('makesavefo_title',1).' <br/>
00993                                                         <input type="text" name="tx_impexp[meta][title]" value="'.htmlspecialchars($inData['meta']['title']).'"'.$this->doc->formWidth(30).' /><br/>
00994                                                         '.$LANG->getLL('makesavefo_description',1).' <br/>
00995                                                         <input type="text" name="tx_impexp[meta][description]" value="'.htmlspecialchars($inData['meta']['description']).'"'.$this->doc->formWidth(30).' /><br/>
00996                                                         '.$LANG->getLL('makesavefo_notes',1).' <br/>
00997                                                         <textarea name="tx_impexp[meta][notes]"'.$this->doc->formWidth(30,1).'>'.t3lib_div::formatForTextarea($inData['meta']['notes']).'</textarea><br/>
00998                                                         '.(is_array($thumbnails) ? '
00999                                                         '.$LANG->getLL('makesavefo_thumbnail',1).'<br/>
01000                                                         '.$this->renderSelectBox('tx_impexp[meta][thumbnail]',$inData['meta']['thumbnail'],$thumbnails).'<br/>
01001                                                         '.($inData['meta']['thumbnail'] ? '<img src="'.$this->doc->backPath.'../'.substr($tempDir,strlen(PATH_site)).$thumbnails[$inData['meta']['thumbnail']].'" vspace="5" style="border: solid black 1px;" alt="" /><br/>' : '').'
01002                                                         '.$LANG->getLL('makesavefo_uploadThumbnail',1).'<br/>
01003                                                         <input type="file" name="upload_1" '.$this->doc->formWidth(30).' size="30" /><br/>
01004                                                                 <input type="hidden" name="file[upload][1][target]" value="'.htmlspecialchars($tempDir).'" />
01005                                                                 <input type="hidden" name="file[upload][1][data]" value="1" /><br />
01006                                                         ' : '').'
01007                                                 </td>
01008                                 </tr>';
01009 
01010                         // Add file options:
01011                 $savePath = $this->userSaveFolder();
01012                 $opt = array();
01013                 if ($this->export->compress)    {
01014                         $opt['t3d_compressed'] = $LANG->getLL('makesavefo_t3dFileCompressed');
01015                 }
01016                 $opt['t3d'] = $LANG->getLL('makesavefo_t3dFile');
01017                 $opt['xml'] = $LANG->getLL('makesavefo_xml');
01018                 $row[] = '
01019                                 <tr class="bgColor4">
01020                                         <td><strong>'.$LANG->getLL('makesavefo_fileFormat',1).'</strong>'.t3lib_BEfunc::cshItem('xMOD_tx_impexp', 'fileFormat', $GLOBALS['BACK_PATH'],'').'</td>
01021                                         <td>'.$this->renderSelectBox('tx_impexp[filetype]',$inData['filetype'],$opt).'<br/>
01022                                                 '.$LANG->getLL('makesavefo_maxSizeOfFiles',1).'<br/>
01023                                                 <input type="text" name="tx_impexp[maxFileSize]" value="'.htmlspecialchars($inData['maxFileSize']).'"'.$this->doc->formWidth(10).' /><br/>
01024                                                 '.($savePath ? sprintf($LANG->getLL('makesavefo_filenameSavedInS',1),substr($savePath,strlen(PATH_site))).'<br/>
01025                                                 <input type="text" name="tx_impexp[filename]" value="'.htmlspecialchars($inData['filename']).'"'.$this->doc->formWidth(30).' /><br/>' : '').'
01026                                         </td>
01027                                 </tr>';
01028 
01029 
01030                         // Add buttons:
01031                 $row[] = '
01032                                 <tr class="bgColor4">
01033                                         <td>&nbsp;</td>
01034                                         <td><input type="submit" value="'.$LANG->getLL('makesavefo_update',1).'" /> - <input type="submit" value="'.$LANG->getLL('makesavefo_downloadExport',1).'" name="tx_impexp[download_export]" />'.
01035                                                 ($savePath ? ' - <input type="submit" value="'.$LANG->getLL('importdata_saveToFilename',1).'" name="tx_impexp[save_export]" />' : '').'</td>
01036                                 </tr>';
01037         }
01038 
01039 
01040 
01041 
01042 
01043 
01044 
01045 
01046 
01047 
01048 
01049 
01050 
01051         /**************************
01052          *
01053          * IMPORT FUNCTIONS
01054          *
01055          **************************/
01056 
01063         function importData($inData)    {
01064                 global $TCA,$LANG,$BE_USER;
01065 
01066                 $this->pageinfo = t3lib_BEfunc::readPageAccess($this->id,$this->perms_clause);
01067                 $access = is_array($this->pageinfo) ? 1 : 0;
01068 
01069                 if (($this->id && $access) || ($BE_USER->user['admin'] && !$this->id))  {
01070                         if ($BE_USER->user['admin'] && !$this->id)      {
01071                                 $this->pageinfo=array('title' => '[root-level]','uid'=>0,'pid'=>0);
01072                         }
01073 
01074                         $headerSection = $this->doc->getHeader('pages',$this->pageinfo,$this->pageinfo['_thePath']).'<br />'.$LANG->sL('LLL:EXT:lang/locallang_core.php:labels.path').': '.t3lib_div::fixed_lgd_cs($this->pageinfo['_thePath'],-50);
01075                         $this->content.= $this->doc->section('',$headerSection);
01076 
01077                         if ($inData['new_import'])      {
01078                                 unset($inData['import_mode']);
01079                         }
01080 
01081                         $import = t3lib_div::makeInstance('tx_impexp');
01082                         $import->init(0,'import');
01083                         $import->update = $inData['do_update'];
01084                         $import->import_mode = $inData['import_mode'];
01085                         $import->enableLogging = $inData['enableLogging'];
01086                         $import->global_ignore_pid = $inData['global_ignore_pid'];
01087                         $import->force_all_UIDS = $inData['force_all_UIDS'];
01088                         $import->showDiff = !$inData['notShowDiff'];
01089                         $import->allowPHPScripts = $inData['allowPHPScripts'];
01090                         $import->softrefInputValues = $inData['softrefInputValues'];
01091 
01092 
01093                                 // OUTPUT creation:
01094                         $menuItems = array();
01095 
01096 
01097                                 // Make input selector:
01098                         $path = 'fileadmin/';   // must have trailing slash.
01099                         $filesInDir = t3lib_div::getFilesInDir(PATH_site.$path,'t3d,xml',1,1);
01100                         if (is_dir(PATH_site.$path.'export/'))  {
01101                                 $filesInDir = array_merge($filesInDir, t3lib_div::getFilesInDir(PATH_site.$path.'export/','t3d,xml',1,1));
01102                         }
01103                         $tempFolder = $this->userTempFolder();
01104                         if ($tempFolder)        {
01105                                 $temp_filesInDir = t3lib_div::getFilesInDir($tempFolder,'t3d,xml',1,1);
01106                                 $filesInDir = array_merge($filesInDir, $temp_filesInDir);
01107                         }
01108 
01109                                 // Configuration
01110                         $row = array();
01111                         $opt = array('');
01112                         foreach($filesInDir as $file)   {
01113                                 $opt[$file] = substr($file,strlen(PATH_site));
01114                         }
01115 
01116                         $row[] = '<tr class="bgColor5">
01117                                         <td colspan="2"><strong>'.$LANG->getLL('importdata_selectFileToImport',1).'</strong></td>
01118                                 </tr>';
01119 
01120                         $row[] = '<tr class="bgColor4">
01121                                 <td><strong>'.$LANG->getLL('importdata_file',1).'</strong>'.t3lib_BEfunc::cshItem('xMOD_tx_impexp', 'importFile', $GLOBALS['BACK_PATH'],'').'</td>
01122                                 <td>'.
01123                                         $this->renderSelectBox('tx_impexp[file]',$inData['file'],$opt).'<br />'.sprintf($LANG->getLL('importdata_fromPathS',1),$path).
01124                                         (!$import->compress ? '<br /><span class="typo3-red">'.$LANG->getLL('importdata_noteNoDecompressorAvailable',1).'</span>':'').
01125                                 '</td>
01126                                 </tr>';
01127 
01128                         $row[] = '<tr class="bgColor5">
01129                                         <td colspan="2"><strong>'.$LANG->getLL('importdata_importOptions',1).'</strong></td>
01130                                 </tr>';
01131 
01132                         $row[] = '<tr class="bgColor4">
01133                                 <td><strong>'.$LANG->getLL('importdata_update',1).'</strong>'.t3lib_BEfunc::cshItem('xMOD_tx_impexp', 'update', $GLOBALS['BACK_PATH'],'').'</td>
01134                                 <td>
01135                                         <input type="checkbox" name="tx_impexp[do_update]" value="1"'.($inData['do_update'] ? ' checked="checked"' : '').' />
01136                                         '.$LANG->getLL('importdata_updateRecords',1).'<br/>
01137                                 <em>('.$LANG->getLL('importdata_thisOptionRequiresThat',1).')</em>'.
01138                                 ($inData['do_update'] ?
01139                                 '       <hr/>
01140                                         <input type="checkbox" name="tx_impexp[global_ignore_pid]" value="1"'.($inData['global_ignore_pid'] ? ' checked="checked"' : '').' />
01141                                         '.$LANG->getLL('importdata_ignorePidDifferencesGlobally',1).'<br/>
01142                                         <em>('.$LANG->getLL('importdata_ifYouSetThis',1).')</em>
01143                                         ' : ''
01144                                 ).'</td>
01145                                 </tr>';
01146 
01147                         $row[] = '<tr class="bgColor4">
01148                                 <td><strong>'.$LANG->getLL('importdata_options',1).'</strong>'.t3lib_BEfunc::cshItem('xMOD_tx_impexp', 'options', $GLOBALS['BACK_PATH'],'').'</td>
01149                                 <td>
01150                                         <input type="checkbox" name="tx_impexp[notShowDiff]" value="1"'.($inData['notShowDiff'] ? ' checked="checked"' : '').' />
01151                                         '.$LANG->getLL('importdata_doNotShowDifferences',1).'<br/>
01152                                         <em>('.$LANG->getLL('importdata_greenValuesAreFrom',1).')</em>
01153                                         <br/><br/>
01154 
01155                                         '.($GLOBALS['BE_USER']->isAdmin() ? '
01156                                         <input type="checkbox" name="tx_impexp[allowPHPScripts]" value="1"'.($inData['allowPHPScripts'] ? ' checked="checked"' : '').' />
01157                                         '.$LANG->getLL('importdata_allowToWriteBanned',1).'<br/>' : '').
01158 
01159                                         (!$inData['do_update'] && $GLOBALS['BE_USER']->isAdmin() ? '
01160                                         <br/>
01161                                         <input type="checkbox" name="tx_impexp[force_all_UIDS]" value="1"'.($inData['force_all_UIDS'] ? ' checked="checked"' : '').' />
01162                                         <span class="typo3-red">'.$LANG->getLL('importdata_force_all_UIDS',1).'</span><br/>
01163                                         <em>('.$LANG->getLL('importdata_force_all_UIDS_descr',1).')</em>' : '').
01164                                         '
01165                                 </td>
01166                                 </tr>';
01167 
01168                         $row[] = '<tr class="bgColor4">
01169                                 <td><strong>'.$LANG->getLL('importdata_action',1).'</strong>'.t3lib_BEfunc::cshItem('xMOD_tx_impexp', 'action', $GLOBALS['BACK_PATH'],'').'</td>
01170                                 <td>'.
01171                                         (!$inData['import_file'] ? '<input type="submit" value="'.$LANG->getLL('importdata_preview',1).'" />'.($inData['file'] ? ' - <input type="submit" value="'.($inData['do_update']?$LANG->getLL('importdata_update_299e',1):$LANG->getLL('importdata_import',1)).'" name="tx_impexp[import_file]" onclick="return confirm(\''.$LANG->getLL('importdata_areYouSure',1).'\');" />':''):'<input type="submit" name="tx_impexp[new_import]" value="'.$LANG->getLL('importdata_newImport',1).'" />').'
01172                                         <input type="hidden" name="tx_impexp[action]" value="import" /></td>
01173                                 </tr>';
01174 
01175                         $row[] = '<tr class="bgColor4">
01176                                 <td><strong>'.$LANG->getLL('importdata_enableLogging',1).'</strong>'.t3lib_BEfunc::cshItem('xMOD_tx_impexp', 'enableLogging', $GLOBALS['BACK_PATH'],'').'</td>
01177                                 <td>
01178                                         <input type="checkbox" name="tx_impexp[enableLogging]" value="1"'.($inData['enableLogging'] ? ' checked="checked"' : '').' />
01179                                         '.$LANG->getLL('importdata_writeIndividualDbActions',1).'<br/>
01180                                         <em>('.$LANG->getLL('importdata_thisIsDisabledBy',1).')</em>
01181                                 </td>
01182                                 </tr>';
01183 
01184                         $menuItems[] = array(
01185                                 'label' => $LANG->getLL('importdata_import',1),
01186                                 'content' => '
01187                                         <table border="0" cellpadding="1" cellspacing="1">
01188                                                 '.implode('
01189                                                 ',$row).'
01190                                         </table>
01191                                 '
01192                         );
01193 
01194                                 // Upload file:
01195                         $tempFolder = $this->userTempFolder();
01196                         if ($tempFolder)        {
01197                                 $row = array();
01198 
01199                                 $row[] = '<tr class="bgColor5">
01200                                                 <td colspan="2"><strong>'.$LANG->getLL('importdata_uploadFileFromLocal',1).'</strong></td>
01201                                         </tr>';
01202 
01203                                 $row[] = '<tr class="bgColor4">
01204                                                 <td>'.$LANG->getLL('importdata_browse',1).t3lib_BEfunc::cshItem('xMOD_tx_impexp', 'upload', $GLOBALS['BACK_PATH'],'').'</td>
01205                                                 <td>
01206 
01207                                                                 <input type="file" name="upload_1"'.$this->doc->formWidth(35).' size="40" />
01208                                                                 <input type="hidden" name="file[upload][1][target]" value="'.htmlspecialchars($tempFolder).'" />
01209                                                                 <input type="hidden" name="file[upload][1][data]" value="1" /><br />
01210 
01211                                                                 <input type="submit" name="_upload" value="'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:file_upload.php.submit',1).'" />
01212                                                                 <input type="checkbox" name="overwriteExistingFiles" value="1" checked="checked" /> '.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_misc.php:overwriteExistingFiles',1).'
01213                                                 </td>
01214                                         </tr>';
01215 
01216                                 if (t3lib_div::_POST('_upload'))        {
01217                                         $row[] = '<tr class="bgColor4">
01218                                                         <td>'.$LANG->getLL('importdata_uploadStatus',1).'</td>
01219                                                         <td>'.($this->fileProcessor->internalUploadMap[1] ? $LANG->getLL('importdata_success',1).' '.substr($this->fileProcessor->internalUploadMap[1],strlen(PATH_site)) : '<span class="typo3-red">'.$LANG->getLL('importdata_failureNoFileUploaded',1).'</span>').'</td>
01220                                                 </tr>';
01221                                 }
01222 
01223                                 $menuItems[] = array(
01224                                         'label' => $LANG->getLL('importdata_upload'),
01225                                         'content' => '
01226                                                 <table border="0" cellpadding="1" cellspacing="1">
01227                                                         '.implode('
01228                                                         ',$row).'
01229                                                 </table>
01230                                         '
01231                                 );
01232                         }
01233 
01234 
01235                                 // Perform import or preview depending:
01236                         $overviewContent = '';
01237                         $inFile = t3lib_div::getFileAbsFileName($inData['file']);
01238                         if ($inFile && @is_file($inFile))       {
01239                                 $trow = array();
01240                                 if ($import->loadFile($inFile,1))       {
01241 
01242                                         if ($inData['import_file'])     {
01243                                                 $import->importData($this->id);
01244                                                 t3lib_BEfunc::getSetUpdateSignal('updatePageTree');
01245                                         }
01246 
01247                                         $import->display_import_pid_record = $this->pageinfo;
01248                                         $overviewContent = $import->displayContentOverview();
01249                                 }
01250 
01251                                         // Meta data output:
01252                                 $trow[] = '<tr class="bgColor5">
01253                                                 <td colspan="2"><strong>'.$LANG->getLL('importdata_metaData',1).'</strong></td>
01254                                         </tr>';
01255 
01256                                 $opt = array('');
01257                                 foreach($filesInDir as $file)   {
01258                                         $opt[$file] = substr($file,strlen(PATH_site));
01259                                 }
01260 
01261                                 $trow[] = '<tr class="bgColor4">
01262                                         <td><strong>'.$LANG->getLL('importdata_title',1).'</strong></td>
01263                                         <td width="95%">'.nl2br(htmlspecialchars($import->dat['header']['meta']['title'])).'</td>
01264                                         </tr>';
01265 
01266                                 $trow[] = '<tr class="bgColor4">
01267                                         <td><strong>'.$LANG->getLL('importdata_description',1).'</strong></td>
01268                                         <td width="95%">'.nl2br(htmlspecialchars($import->dat['header']['meta']['description'])).'</td>
01269                                         </tr>';
01270 
01271                                 $trow[] = '<tr class="bgColor4">
01272                                         <td><strong>'.$LANG->getLL('importdata_notes',1).'</strong></td>
01273                                         <td width="95%">'.nl2br(htmlspecialchars($import->dat['header']['meta']['notes'])).'</td>
01274                                         </tr>';
01275 
01276                                 $trow[] = '<tr class="bgColor4">
01277                                         <td><strong>'.$LANG->getLL('importdata_packager',1).'</strong></td>
01278                                         <td width="95%">'.nl2br(htmlspecialchars($import->dat['header']['meta']['packager_name'].' ('.$import->dat['header']['meta']['packager_username'].')')).'<br/>
01279                                                 '.$LANG->getLL('importdata_email',1).' '.$import->dat['header']['meta']['packager_email'].'</td>
01280                                         </tr>';
01281 
01282                                         // Thumbnail icon:
01283                                 if (is_array($import->dat['header']['thumbnail']))      {
01284                                         $pI = pathinfo($import->dat['header']['thumbnail']['filename']);
01285                                         if (t3lib_div::inList('gif,jpg,png,jpeg',strtolower($pI['extension']))) {
01286 
01287                                                         // Construct filename and write it:
01288                                                 $fileName = PATH_site.
01289                                                                         'typo3temp/importthumb.'.$pI['extension'];
01290                                                 t3lib_div::writeFile($fileName, $import->dat['header']['thumbnail']['content']);
01291 
01292                                                         // Check that the image really is an image and not a malicious PHP script...
01293                                                 if (getimagesize($fileName))    {
01294                                                                 // Create icon tag:
01295                                                         $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="" />';
01296 
01297                                                         $trow[] = '<tr class="bgColor4">
01298                                                                 <td><strong>'.$LANG->getLL('importdata_icon',1).'</strong></td>
01299                                                                 <td>'.$iconTag.'</td>
01300                                                                 </tr>';
01301                                                 } else {
01302                                                         t3lib_div::unlink_tempfile($fileName);
01303                                                 }
01304                                         }
01305                                 }
01306 
01307                                 $menuItems[] = array(
01308                                         'label' => $LANG->getLL('importdata_metaData_1387'),
01309                                         'content' => '
01310                                                 <table border="0" cellpadding="1" cellspacing="1">
01311                                                         '.implode('
01312                                                         ',$trow).'
01313                                                 </table>
01314                                         '
01315                                 );
01316                         }
01317 
01318                                 // Print errors that might be:
01319                         $errors = $import->printErrorLog();
01320                         $menuItems[] = array(
01321                                 'label' => $LANG->getLL('importdata_messages'),
01322                                 'content' => $errors,
01323                                 'stateIcon' => $errors ? 2 : 0
01324                         );
01325 
01326                                 // Output tabs:
01327                         $content = $this->doc->getDynTabMenu($menuItems,'tx_impexp_import',-1);
01328                         $this->content.= $this->doc->section('',$content,0,1);
01329 
01330 
01331                                 // Print overview:
01332                         if ($overviewContent) {
01333                                 $this->content.= $this->doc->section($inData['import_file'] ? $LANG->getLL('importdata_structureHasBeenImported',1) : $LANG->getLL('filterpage_structureToBeImported',1), $overviewContent, 0, 1);
01334                         }
01335                 }
01336         }
01337 
01338 
01339 
01340 
01341 
01342 
01343 
01344 
01345 
01346 
01347 
01348 
01349 
01350         /****************************
01351          *
01352          * Preset functions
01353          *
01354          ****************************/
01355 
01362         function processPresets(&$inData)       {
01363 
01364                 $presetData = t3lib_div::_GP('preset');
01365                 $err = FALSE;
01366 
01367                         // Save preset
01368                 if (isset($presetData['save'])) {
01369                         $preset = $this->getPreset($presetData['select']);
01370                         if (is_array($preset))  {       // Update existing
01371                                 if ($GLOBALS['BE_USER']->isAdmin() || $preset['user_uid'] === $GLOBALS['BE_USER']->user['uid']) {
01372                                         $fields_values = array(
01373                                                 'public' => $inData['preset']['public'],
01374                                                 'title' => $inData['preset']['title'],
01375                                                 'item_uid' => $inData['pagetree']['id'],
01376                                                 'preset_data' => serialize($inData)
01377                                         );
01378                                         $GLOBALS['TYPO3_DB']->exec_UPDATEquery('tx_impexp_presets','uid='.intval($preset['uid']),$fields_values);
01379                                         $msg = 'Preset #'.$preset['uid'].' saved!';
01380                                 } else {
01381                                         $msg = 'ERROR: The preset was not saved because you were not the owner of it!';
01382                                         $err = TRUE;
01383                                 }
01384                         } else {        // Insert new:
01385                                 $fields_values = array(
01386                                         'user_uid' => $GLOBALS['BE_USER']->user['uid'],
01387                                         'public' => $inData['preset']['public'],
01388                                         'title' => $inData['preset']['title'],
01389                                         'item_uid' => $inData['pagetree']['id'],
01390                                         'preset_data' => serialize($inData)
01391                                 );
01392                                 $GLOBALS['TYPO3_DB']->exec_INSERTquery('tx_impexp_presets',$fields_values);
01393                                 $msg = 'New preset "'.$inData['preset']['title'].'" is created';
01394                         }
01395                 }
01396 
01397                         // Delete preset:
01398                 if (isset($presetData['delete']))       {
01399                         $preset = $this->getPreset($presetData['select']);
01400                         if (is_array($preset))  {       // Update existing
01401                                 if ($GLOBALS['BE_USER']->isAdmin() || $preset['user_uid'] === $GLOBALS['BE_USER']->user['uid']) {
01402                                         $GLOBALS['TYPO3_DB']->exec_DELETEquery('tx_impexp_presets','uid='.intval($preset['uid']));
01403                                         $msg = 'Preset #'.$preset['uid'].' deleted!';
01404                                 } else {
01405                                         $msg = 'ERROR: You were not the owner of the preset so you could not delete it.';
01406                                         $err = TRUE;
01407                                 }
01408                         } else {
01409                                 $msg = 'ERROR: No preset selected for deletion.';
01410                                 $err = TRUE;
01411                         }
01412                 }
01413 
01414                         // Load preset
01415                 if (isset($presetData['load']) || isset($presetData['merge']))  {
01416                         $preset = $this->getPreset($presetData['select']);
01417                         if (is_array($preset))  {       // Update existing
01418                                 $inData_temp = unserialize($preset['preset_data']);
01419                                 if (is_array($inData_temp))     {
01420                                         if (isset($presetData['merge']))        {
01421 
01422                                                         // Merge records in:
01423                                                 if (is_array($inData_temp['record']))   {
01424                                                         $inData['record'] = array_merge((array)$inData['record'], $inData_temp['record']);
01425                                                 }
01426 
01427                                                         // Merge lists in:
01428                                                 if (is_array($inData_temp['list']))     {
01429                                                         $inData['list'] = array_merge((array)$inData['list'], $inData_temp['list']);
01430                                                 }
01431                                         } else {
01432                                                 $msg = 'Preset #'.$preset['uid'].' loaded!';
01433                                                 $inData = $inData_temp;
01434                                         }
01435                                 } else {
01436                                         $msg = 'ERROR: No configuratio data found in preset record!';
01437                                         $err = TRUE;
01438                                 }
01439                         } else {
01440                                 $msg = 'ERROR: No preset selected for loading.';
01441                                 $err = TRUE;
01442                         }
01443                 }
01444 
01445                         // Show message:
01446                 if (strlen($msg))       {
01447                         $this->content.= $this->doc->section('Presets',$msg,0,1,$err ? 3 : 1);
01448                 }
01449         }
01450 
01457         function getPreset($uid)        {
01458                 list($preset) = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('*','tx_impexp_presets','uid='.intval($uid));
01459                 return $preset;
01460         }
01461 
01462 
01463 
01464 
01465 
01466 
01467 
01468 
01469 
01470 
01471 
01472         /****************************
01473          *
01474          * Helper functions
01475          *
01476          ****************************/
01477 
01483         function userTempFolder()       {
01484                 global $FILEMOUNTS;
01485 
01486                 foreach($FILEMOUNTS as $filePathInfo)   {
01487                         $tempFolder = $filePathInfo['path'].'_temp_/';
01488                         if (@is_dir($tempFolder))       {
01489                                 return $tempFolder;
01490                         }
01491                 }
01492         }
01493 
01499         function userSaveFolder()       {
01500                 global $FILEMOUNTS;
01501 
01502                 reset($FILEMOUNTS);
01503                 $filePathInfo = current($FILEMOUNTS);
01504 
01505                 if (is_array($filePathInfo))    {
01506                         $tempFolder = $filePathInfo['path'].'export/';
01507                         if (!@is_dir($tempFolder))      {
01508                                 $tempFolder = $filePathInfo['path'];
01509                                 if (!@is_dir($tempFolder))      {
01510                                         return FALSE;
01511                                 }
01512                         }
01513                         return $tempFolder;
01514                 }
01515         }
01516 
01522         function checkUpload()  {
01523                 global $FILEMOUNTS,$TYPO3_CONF_VARS,$BE_USER;
01524 
01525                 $file = t3lib_div::_GP('file');
01526 
01527                         // Initializing:
01528                 $this->fileProcessor = t3lib_div::makeInstance('t3lib_extFileFunctions');
01529                 $this->fileProcessor->init($FILEMOUNTS, $TYPO3_CONF_VARS['BE']['fileExtensions']);
01530                 $this->fileProcessor->init_actionPerms($BE_USER->user['fileoper_perms']);
01531                 $this->fileProcessor->dontCheckForUnique = t3lib_div::_GP('overwriteExistingFiles') ? 1 : 0;
01532 
01533                         // Checking referer / executing:
01534                 $refInfo = parse_url(t3lib_div::getIndpEnv('HTTP_REFERER'));
01535                 $httpHost = t3lib_div::getIndpEnv('TYPO3_HOST_ONLY');
01536                 if ($httpHost!=$refInfo['host'] && $this->vC!=$BE_USER->veriCode() && !$TYPO3_CONF_VARS['SYS']['doNotCheckReferer'])    {
01537                         $this->fileProcessor->writeLog(0,2,1,'Referer host "%s" and server host "%s" did not match!',array($refInfo['host'],$httpHost));
01538                 } else {
01539                         $this->fileProcessor->start($file);
01540                         $this->fileProcessor->processData();
01541                 }
01542         }
01543 
01552         function renderSelectBox($prefix,$value,$optValues)     {
01553                 $opt = array();
01554                 $isSelFlag = 0;
01555                 reset($optValues);
01556                 while(list($k,$v) = each($optValues))   {
01557                         $sel = (!strcmp($k,$value) ? ' selected="selected"' : '');
01558                         if ($sel)       $isSelFlag++;
01559                         $opt[] = '<option value="'.htmlspecialchars($k).'"'.$sel.'>'.htmlspecialchars($v).'</option>';
01560                 }
01561                 if (!$isSelFlag && strcmp('',$value))   {
01562                         $opt[] = '<option value="'.htmlspecialchars($value).'" selected="selected">'.htmlspecialchars("['".$value."']").'</option>';
01563                 }
01564                 return '<select name="'.$prefix.'">'.implode('',$opt).'</select>';
01565         }
01566 
01575         function tableSelector($prefix,$value,$excludeList='')  {
01576                 global $TCA, $LANG;
01577 
01578                 reset($TCA);
01579                 $optValues = array();
01580 
01581                 if (!t3lib_div::inList($excludeList,'_ALL'))    {
01582                         $optValues['_ALL'] = '['.$LANG->getLL('ALL_tables').']';
01583                 }
01584 
01585                 while(list($table) = each($TCA))        {
01586                         if ($GLOBALS['BE_USER']->check('tables_select',$table) && !t3lib_div::inList($excludeList,$table))      {
01587                                 $optValues[$table] = $table;
01588                         }
01589                 }
01590 
01591                         // make box:
01592                 $opt = array();
01593                 $opt[] = '<option value=""></option>';
01594                 reset($optValues);
01595                 while(list($k,$v)=each($optValues))     {
01596                         if (is_array($value))   {
01597                                 $sel = in_array($k,$value)?' selected="selected"':'';
01598                         }
01599                         $opt[] = '<option value="'.htmlspecialchars($k).'"'.$sel.'>'.htmlspecialchars($v).'</option>';
01600                 }
01601                 return '<select name="'.$prefix.'[]" multiple="multiple" size="'.t3lib_div::intInRange(count($opt),5,10).'">'.implode('',$opt).'</select>';
01602         }
01603 
01611         function extensionSelector($prefix,$value)      {
01612                 global $TYPO3_LOADED_EXT;
01613 
01614                 $extTrav = array_keys($TYPO3_LOADED_EXT);
01615 
01616                         // make box:
01617                 $opt = array();
01618                 $opt[] = '<option value=""></option>';
01619                 foreach($extTrav as $v) {
01620                         if ($v!=='_CACHEFILE')  {
01621                                 if (is_array($value))   {
01622                                         $sel = in_array($v,$value)?' selected="selected"':'';
01623                                 }
01624                                 $opt[] = '<option value="'.htmlspecialchars($v).'"'.$sel.'>'.htmlspecialchars($v).'</option>';
01625                         }
01626                 }
01627                 return '<select name="'.$prefix.'[]" multiple="multiple" size="'.t3lib_div::intInRange(count($opt),5,10).'">'.implode('',$opt).'</select>';
01628         }
01629 
01636         function filterPageIds($exclude)        {
01637 
01638                         // Get keys:
01639                 $exclude = array_keys($exclude);
01640 
01641                         // Traverse
01642                 $pageIds = array();
01643                 foreach($exclude as $element)   {
01644                         list($table,$uid) = explode(':', $element);
01645                         if ($table==='pages')   {
01646                                 $pageIds[] = intval($uid);
01647                         }
01648                 }
01649 
01650                         // Add to clause:
01651                 if (count($pageIds))    {
01652                         return ' AND uid NOT IN ('.implode(',', $pageIds).')';
01653                 }
01654         }
01655 }
01656 
01657 // Include extension?
01658 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/impexp/app/index.php'])        {
01659         include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/impexp/app/index.php']);
01660 }
01661 
01662 
01663 
01664 
01665 
01666 
01667 
01668 
01669 
01670 
01671 
01672 
01673 // Make instance:
01674 $SOBE = t3lib_div::makeInstance('SC_mod_tools_log_index');
01675 $SOBE->init();
01676 $SOBE->main();
01677 $SOBE->printContent();
01678 ?>


Généré par Les spécialistes TYPO3 avec  doxygen 1.4.6