00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
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
00202 $this->init(' AND '.$this->permsC().$clause);
00203
00204
00205 $this->stored = unserialize($this->BE_USER->uc['browseTrees']['browsePages']);
00206
00207
00208 $PM = t3lib_div::intExplode('_',t3lib_div::_GP('PM'));
00209
00210
00211 $titleLen = intval($this->BE_USER->uc['titleLen']);
00212 $treeArr = array();
00213
00214 $idx = 0;
00215
00216
00217 $this->bank = $idx;
00218 $isOpen = $this->stored[$idx][$pid] || $this->expandFirst;
00219
00220 $curIds = $this->ids;
00221 $this->reset();
00222 $this->ids = $curIds;
00223
00224
00225 $cmd = $this->bank.'_'.($isOpen?'0_':'1_').$pid;
00226 $icon = '<img'.t3lib_iconWorks::skinImg($this->backPath,'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::getRecordWSOL('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
00242 $depthD = '<img'.t3lib_iconWorks::skinImg($this->backPath,'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
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;
00283
00289 function main() {
00290 global $BE_USER,$LANG,$BACK_PATH;
00291
00292
00293 $this->doc = t3lib_div::makeInstance('mediumDoc');
00294 $this->doc->backPath = $BACK_PATH;
00295 $this->doc->docType = 'xhtml_trans';
00296
00297
00298 $this->doc->JScode = $this->doc->wrapScriptTags('
00299 script_ended = 0;
00300 function jumpToUrl(URL) {
00301 window.location.href = URL;
00302 }
00303 ');
00304
00305
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="'.htmlspecialchars($GLOBALS['MCONF']['_']).'" 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
00319 $inData = t3lib_div::_GP('tx_impexp');
00320
00321 $this->checkUpload();
00322
00323 switch((string)$inData['action']) {
00324 case 'export':
00325
00326
00327 if (is_object($this->fileProcessor) && $this->fileProcessor->internalUploadMap[1]) {
00328 $inData['meta']['thumbnail'] = md5($this->fileProcessor->internalUploadMap[1]);
00329 }
00330
00331
00332 $this->exportData($inData);
00333 break;
00334 case 'import':
00335
00336
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']))) {
00340 $inData['file'] = $this->fileProcessor->internalUploadMap[1];
00341 }
00342 }
00343
00344
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
00378
00379
00380
00387 function exportData($inData) {
00388 global $TCA, $LANG;
00389
00390
00391
00392
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
00402 if (!is_array($inData['exclude'])) {
00403 $inData['exclude'] = array();
00404 }
00405
00406
00407
00408 $this->processPresets($inData);
00409
00410
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
00424 if (is_array($inData['external_static']['tables'])) {
00425 $this->export->relStaticTables = $inData['external_static']['tables'];
00426 }
00427
00428
00429 if (is_array($inData['external_ref']['tables'])) {
00430 $this->export->relOnlyTables = $inData['external_ref']['tables'];
00431 }
00432 $this->export->setHeaderBasics();
00433
00434
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
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
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
00477 if (isset($inData['pagetree']['id'])) {
00478 if ($inData['pagetree']['levels']==-1) {
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) {
00487 $this->addRecordsForPid($inData['pagetree']['id'],$inData['pagetree']['tables'],$inData['pagetree']['maxNumber']);
00488 } else {
00489
00490
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::getRecordWSOL('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
00523 if (is_array($idH)) {
00524 $flatList = $this->export->setPageTree($idH);
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
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
00543 $this->export->export_addFilesFromRelations();
00544 #debug($this->export->dat['header']);
00545
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
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
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
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
00590
00591 $menuItems = array();
00592
00593
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
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
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
00633 $overViewContent = $this->export->displayContentOverview();
00634
00635
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
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
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 t3lib_BEfunc::versioningPlaceholderClause($table),
00697 '',
00698 $GLOBALS['TYPO3_DB']->stripOrderBy($orderBy),
00699 $limit
00700 );
00701
00702
00703 if ($GLOBALS['TYPO3_DB']->sql_num_rows($res) == $limit) {
00704 $this->content.= $this->doc->section($LANG->getLL('execlistqu_maxNumberLimit'),sprintf($LANG->getLL('makeconfig_anSqlQueryReturned',1),$limit),0,1, 2);
00705 }
00706
00707 return $res;
00708 }
00709
00717 function makeConfigurationForm($inData, &$row) {
00718 global $LANG;
00719
00720 $nameSuggestion = '';
00721
00722
00723 if (isset($inData['pagetree']['id'])) {
00724
00725 $nameSuggestion.= 'tree_PID'.$inData['pagetree']['id'].'_L'.$inData['pagetree']['levels'];
00726
00727 $row[] = '
00728 <tr class="tableheader bgColor5">
00729 <td colspan="2">'.$LANG->getLL('makeconfig_exportPagetreeConfiguration',1).t3lib_BEfunc::cshItem('xMOD_tx_impexp', 'pageTreeCfg', $GLOBALS['BACK_PATH'],'').'</td>
00730 </tr>';
00731
00732 $row[] = '
00733 <tr class="bgColor4">
00734 <td><strong>'.$LANG->getLL('makeconfig_pageId',1).'</strong></td>
00735 <td>'.htmlspecialchars($inData['pagetree']['id']).
00736 '<input type="hidden" value="'.htmlspecialchars($inData['pagetree']['id']).'" name="tx_impexp[pagetree][id]" /></td>
00737 </tr>';
00738
00739 $row[] = '
00740 <tr class="bgColor4">
00741 <td><strong>'.$LANG->getLL('makeconfig_tree',1).'</strong>'.t3lib_BEfunc::cshItem('xMOD_tx_impexp', 'pageTreeDisplay', $GLOBALS['BACK_PATH'],'').'</td>
00742 <td>'.($this->treeHTML ? $this->treeHTML : $LANG->getLL('makeconfig_noTreeExportedOnly',1)).'</td>
00743 </tr>';
00744
00745 $opt = array(
00746 '-2' => $LANG->getLL('makeconfig_tablesOnThisPage'),
00747 '-1' => $LANG->getLL('makeconfig_expandedTree'),
00748 '0' => $LANG->getLL('makeconfig_onlyThisPage'),
00749 '1' => $LANG->getLL('makeconfig_1Level'),
00750 '2' => $LANG->getLL('makeconfig_2Levels'),
00751 '3' => $LANG->getLL('makeconfig_3Levels'),
00752 '4' => $LANG->getLL('makeconfig_4Levels'),
00753 '999' => $LANG->getLL('makeconfig_infinite')
00754 );
00755 $row[] = '
00756 <tr class="bgColor4">
00757 <td><strong>'.$LANG->getLL('makeconfig_levels',1).'</strong>'.t3lib_BEfunc::cshItem('xMOD_tx_impexp', 'pageTreeMode', $GLOBALS['BACK_PATH'],'').'</td>
00758 <td>'.$this->renderSelectBox('tx_impexp[pagetree][levels]',$inData['pagetree']['levels'],$opt).'</td>
00759 </tr>';
00760
00761 $row[] = '
00762 <tr class="bgColor4">
00763 <td><strong>'.$LANG->getLL('makeconfig_includeTables',1).'</strong>'.t3lib_BEfunc::cshItem('xMOD_tx_impexp', 'pageTreeRecordLimit', $GLOBALS['BACK_PATH'],'').'</td>
00764 <td>'.$this->tableSelector('tx_impexp[pagetree][tables]',$inData['pagetree']['tables'],'pages').'<br/>
00765 '.$LANG->getLL('makeconfig_maxNumberOfRecords',1).'<br/>
00766 <input type="text" name="tx_impexp[pagetree][maxNumber]" value="'.htmlspecialchars($inData['pagetree']['maxNumber']).'"'.$this->doc->formWidth(10).' /><br/>
00767 </td>
00768 </tr>';
00769 }
00770
00771
00772 if (is_array($inData['record'])) {
00773 $row[] = '
00774 <tr class="tableheader bgColor5">
00775 <td colspan="2">'.$LANG->getLL('makeconfig_exportSingleRecord',1).t3lib_BEfunc::cshItem('xMOD_tx_impexp', 'singleRecord', $GLOBALS['BACK_PATH'],'').'</td>
00776 </tr>';
00777 foreach($inData['record'] as $ref) {
00778 $rParts = explode(':', $ref);
00779 $tName = $rParts[0];
00780 $rUid = $rParts[1];
00781 $nameSuggestion.= $tName.'_'.$rUid;
00782 $rec = t3lib_BEfunc::getRecordWSOL($tName,$rUid);
00783
00784 $row[] = '
00785 <tr class="bgColor4">
00786 <td><strong>'.$LANG->getLL('makeconfig_record',1).'</strong></td>
00787 <td>'.t3lib_iconworks::getIconImage($tName,$rec,$GLOBALS['BACK_PATH'],' align="top"').
00788 t3lib_BEfunc::getRecordTitle($tName,$rec,TRUE).
00789 '<input type="hidden" name="tx_impexp[record][]" value="'.htmlspecialchars($tName.':'.$rUid).'" /></td>
00790 </tr>';
00791 }
00792 }
00793
00794
00795 if (is_array($inData['list'])) {
00796 $row[] = '
00797 <tr class="tableheader bgColor5">
00798 <td colspan="2">'.$LANG->getLL('makeconfig_exportTablesFromPages',1).'</td>
00799 </tr>';
00800
00801 $tblList = '';
00802 foreach($inData['list'] as $ref) {
00803 $rParts = explode(':', $ref);
00804 $tName = $rParts[0];
00805
00806 if ($GLOBALS['BE_USER']->check('tables_select',$tName)) {
00807 $rec = t3lib_BEfunc::getRecordWSOL('pages', $rParts[1]);
00808 $tblList.='Table "'.$tName.'" from '.t3lib_iconworks::getIconImage('pages',$rec,$GLOBALS['BACK_PATH'],' align="top"').
00809 t3lib_BEfunc::getRecordTitle('pages',$rec,TRUE).
00810 '<input type="hidden" name="tx_impexp[list][]" value="'.htmlspecialchars($ref).'" /><br/>';
00811 }
00812 }
00813 $row[] = '
00814 <tr class="bgColor4">
00815 <td><strong>'.$LANG->getLL('makeconfig_tablePids',1).'</strong>'.t3lib_BEfunc::cshItem('xMOD_tx_impexp', 'tableList', $GLOBALS['BACK_PATH'],'').'</td>
00816 <td>'.$tblList.'</td>
00817 </tr>';
00818
00819 $row[] = '
00820 <tr class="bgColor4">
00821 <td><strong>'.$LANG->getLL('makeconfig_maxNumberOfRecords',1).t3lib_BEfunc::cshItem('xMOD_tx_impexp', 'tableListMaxNumber', $GLOBALS['BACK_PATH'],'').'</strong></td>
00822 <td>
00823 <input type="text" name="tx_impexp[listCfg][maxNumber]" value="'.htmlspecialchars($inData['listCfg']['maxNumber']).'"'.$this->doc->formWidth(10).' /><br/>
00824 </td>
00825 </tr>';
00826 }
00827
00828
00829 $row[] = '
00830 <tr class="tableheader bgColor5">
00831 <td colspan="2">'.$LANG->getLL('makeconfig_relationsAndExclusions',1).'</td>
00832 </tr>';
00833
00834
00835 $row[] = '
00836 <tr class="bgColor4">
00837 <td><strong>'.$LANG->getLL('makeconfig_includeRelationsToTables',1).'</strong>'.t3lib_BEfunc::cshItem('xMOD_tx_impexp', 'inclRelations', $GLOBALS['BACK_PATH'],'').'</td>
00838 <td>'.$this->tableSelector('tx_impexp[external_ref][tables]',$inData['external_ref']['tables']).'</td>
00839 </tr>';
00840
00841
00842 $row[] = '
00843 <tr class="bgColor4">
00844 <td><strong>'.$LANG->getLL('makeconfig_useStaticRelationsFor',1).'</strong>'.t3lib_BEfunc::cshItem('xMOD_tx_impexp', 'staticRelations', $GLOBALS['BACK_PATH'],'').'</td>
00845 <td>'.$this->tableSelector('tx_impexp[external_static][tables]',$inData['external_static']['tables']).'<br/>
00846 <label for="checkShowStaticRelations">'.$LANG->getLL('makeconfig_showStaticRelations',1).'</label> <input type="checkbox" name="tx_impexp[showStaticRelations]" id="checkShowStaticRelations" value="1"'.($inData['showStaticRelations'] ? ' checked="checked"' : '').' />
00847 </td>
00848 </tr>';
00849
00850
00851 $excludeHiddenFields = '';
00852 if (is_array($inData['exclude'])) {
00853 foreach($inData['exclude'] as $key => $value) {
00854 $excludeHiddenFields.= '<input type="hidden" name="tx_impexp[exclude]['.$key.']" value="1" />';
00855 }
00856 }
00857 $row[] = '
00858 <tr class="bgColor4">
00859 <td><strong>'.$LANG->getLL('makeconfig_excludeElements',1).'</strong>'.t3lib_BEfunc::cshItem('xMOD_tx_impexp', 'excludedElements', $GLOBALS['BACK_PATH'],'').'</td>
00860 <td>'.$excludeHiddenFields.'
00861 '.(count($inData['exclude']) ? '<em>'.implode(', ',array_keys($inData['exclude'])).'</em><hr/><label for="checkExclude">'.$LANG->getLL('makeconfig_clearAllExclusions',1).'</label> <input type="checkbox" name="tx_impexp[exclude]" id="checkExclude" value="1" />' : $LANG->getLL('makeconfig_noExcludedElementsYet',1)).'
00862 </td>
00863 </tr>';
00864
00865
00866
00867 $row[] = '
00868 <tr class="bgColor4">
00869 <td> </td>
00870 <td>
00871 <input type="submit" value="'.$LANG->getLL('makeadvanc_update',1).'" />
00872 <input type="hidden" name="tx_impexp[download_export_name]" value="'.substr($nameSuggestion,0,30).'" />
00873 </td>
00874 </tr>';
00875
00876 }
00877
00885 function makeAdvancedOptionsForm($inData, &$row) {
00886 global $LANG;
00887
00888
00889 $row[] = '
00890 <tr class="tableheader bgColor5">
00891 <td colspan="2">'.$LANG->getLL('makeadvanc_softReferences',1).'</td>
00892 </tr>';
00893 $row[] = '
00894 <tr class="bgColor4">
00895 <td><label for="checkExcludeHTMLfileResources"><strong>'.$LANG->getLL('makeadvanc_excludeHtmlCssFile',1).'</strong></label>'.t3lib_BEfunc::cshItem('xMOD_tx_impexp', 'htmlCssResources', $GLOBALS['BACK_PATH'],'').'</td>
00896 <td><input type="checkbox" name="tx_impexp[excludeHTMLfileResources]" id="checkExcludeHTMLfileResources" value="1"'.($inData['excludeHTMLfileResources'] ? ' checked="checked"' : '').' /></td>
00897 </tr>';
00898
00899
00900
00901 $row[] = '
00902 <tr class="tableheader bgColor5">
00903 <td colspan="2">'.$LANG->getLL('makeadvanc_extensionDependencies',1).'</td>
00904 </tr>';
00905 $row[] = '
00906 <tr class="bgColor4">
00907 <td><strong>'.$LANG->getLL('makeadvanc_selectExtensionsThatThe',1).'</strong>'.t3lib_BEfunc::cshItem('xMOD_tx_impexp', 'extensionDependencies', $GLOBALS['BACK_PATH'],'').'</td>
00908 <td>'.$this->extensionSelector('tx_impexp[extension_dep]',$inData['extension_dep']).'</td>
00909 </tr>';
00910
00911
00912
00913
00914 $row[] = '
00915 <tr class="bgColor4">
00916 <td> </td>
00917 <td>
00918 <input type="submit" value="'.$LANG->getLL('makesavefo_update',1).'" />
00919 <input type="hidden" name="tx_impexp[download_export_name]" value="'.substr($nameSuggestion,0,30).'" />
00920 </td>
00921 </tr>';
00922
00923
00924 }
00925
00933 function makeSaveForm($inData, &$row) {
00934 global $LANG;
00935
00936
00937 $row[] = '
00938 <tr class="tableheader bgColor5">
00939 <td colspan="2">'.$LANG->getLL('makesavefo_presets',1).'</td>
00940 </tr>';
00941
00942 $opt = array('');
00943 $presets = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
00944 '*',
00945 'tx_impexp_presets',
00946 '(public>0 || user_uid='.intval($GLOBALS['BE_USER']->user['uid']).')'.
00947 ($inData['pagetree']['id'] ? ' AND (item_uid='.intval($inData['pagetree']['id']).' OR item_uid=0)' : '')
00948
00949 );
00950 if (is_array($presets)) {
00951 foreach($presets as $presetCfg) {
00952 $opt[$presetCfg['uid']] = $presetCfg['title'].' ['.$presetCfg['uid'].']'.
00953 ($presetCfg['public'] ? ' [Public]' : '').
00954 ($presetCfg['user_uid']===$GLOBALS['BE_USER']->user['uid'] ? ' [Own]' : '');
00955 }
00956 }
00957
00958 $row[] = '
00959 <tr class="bgColor4">
00960 <td><strong>'.$LANG->getLL('makesavefo_presets',1).'</strong>'.t3lib_BEfunc::cshItem('xMOD_tx_impexp', 'presets', $GLOBALS['BACK_PATH'],'').'</td>
00961 <td>
00962 '.$LANG->getLL('makesavefo_selectPreset',1).'<br/>
00963 '.$this->renderSelectBox('preset[select]','',$opt).'
00964 <br/>
00965 <input type="submit" value="'.$LANG->getLL('makesavefo_load',1).'" name="preset[load]" />
00966 <input type="submit" value="'.$LANG->getLL('makesavefo_save',1).'" name="preset[save]" onclick="return confirm(\''.$LANG->getLL('makesavefo_areYouSure',1).'\');" />
00967 <input type="submit" value="'.$LANG->getLL('makesavefo_delete',1).'" name="preset[delete]" onclick="return confirm(\''.$LANG->getLL('makesavefo_areYouSure',1).'\');" />
00968 <input type="submit" value="'.$LANG->getLL('makesavefo_merge',1).'" name="preset[merge]" onclick="return confirm(\''.$LANG->getLL('makesavefo_areYouSure',1).'\');" />
00969 <br/>
00970 '.$LANG->getLL('makesavefo_titleOfNewPreset',1).'
00971 <input type="text" name="tx_impexp[preset][title]" value="'.htmlspecialchars($inData['preset']['title']).'"'.$this->doc->formWidth(30).' /><br/>
00972 <label for="checkPresetPublic">'.$LANG->getLL('makesavefo_public',1).'</label>
00973 <input type="checkbox" name="tx_impexp[preset][public]" id="checkPresetPublic" value="1"'.($inData['preset']['public'] ? ' checked="checked"' : '').' /><br/>
00974 </td>
00975 </tr>';
00976
00977
00978 $row[] = '
00979 <tr class="tableheader bgColor5">
00980 <td colspan="2">'.$LANG->getLL('makesavefo_outputOptions',1).'</td>
00981 </tr>';
00982
00983
00984 $tempDir = $this->userTempFolder();
00985 if ($tempDir) {
00986 $thumbnails = t3lib_div::getFilesInDir($tempDir,'png,gif,jpg');
00987 array_unshift($thumbnails,'');
00988 } else $thumbnails = FALSE;
00989 $row[] = '
00990 <tr class="bgColor4">
00991 <td><strong>'.$LANG->getLL('makesavefo_metaData',1).'</strong>'.t3lib_BEfunc::cshItem('xMOD_tx_impexp', 'metadata', $GLOBALS['BACK_PATH'],'').'</td>
00992 <td>
00993 '.$LANG->getLL('makesavefo_title',1).' <br/>
00994 <input type="text" name="tx_impexp[meta][title]" value="'.htmlspecialchars($inData['meta']['title']).'"'.$this->doc->formWidth(30).' /><br/>
00995 '.$LANG->getLL('makesavefo_description',1).' <br/>
00996 <input type="text" name="tx_impexp[meta][description]" value="'.htmlspecialchars($inData['meta']['description']).'"'.$this->doc->formWidth(30).' /><br/>
00997 '.$LANG->getLL('makesavefo_notes',1).' <br/>
00998 <textarea name="tx_impexp[meta][notes]"'.$this->doc->formWidth(30,1).'>'.t3lib_div::formatForTextarea($inData['meta']['notes']).'</textarea><br/>
00999 '.(is_array($thumbnails) ? '
01000 '.$LANG->getLL('makesavefo_thumbnail',1).'<br/>
01001 '.$this->renderSelectBox('tx_impexp[meta][thumbnail]',$inData['meta']['thumbnail'],$thumbnails).'<br/>
01002 '.($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/>' : '').'
01003 '.$LANG->getLL('makesavefo_uploadThumbnail',1).'<br/>
01004 <input type="file" name="upload_1" '.$this->doc->formWidth(30).' size="30" /><br/>
01005 <input type="hidden" name="file[upload][1][target]" value="'.htmlspecialchars($tempDir).'" />
01006 <input type="hidden" name="file[upload][1][data]" value="1" /><br />
01007 ' : '').'
01008 </td>
01009 </tr>';
01010
01011
01012 $savePath = $this->userSaveFolder();
01013 $opt = array();
01014 if ($this->export->compress) {
01015 $opt['t3d_compressed'] = $LANG->getLL('makesavefo_t3dFileCompressed');
01016 }
01017 $opt['t3d'] = $LANG->getLL('makesavefo_t3dFile');
01018 $opt['xml'] = $LANG->getLL('makesavefo_xml');
01019 $row[] = '
01020 <tr class="bgColor4">
01021 <td><strong>'.$LANG->getLL('makesavefo_fileFormat',1).'</strong>'.t3lib_BEfunc::cshItem('xMOD_tx_impexp', 'fileFormat', $GLOBALS['BACK_PATH'],'').'</td>
01022 <td>'.$this->renderSelectBox('tx_impexp[filetype]',$inData['filetype'],$opt).'<br/>
01023 '.$LANG->getLL('makesavefo_maxSizeOfFiles',1).'<br/>
01024 <input type="text" name="tx_impexp[maxFileSize]" value="'.htmlspecialchars($inData['maxFileSize']).'"'.$this->doc->formWidth(10).' /><br/>
01025 '.($savePath ? sprintf($LANG->getLL('makesavefo_filenameSavedInS',1),substr($savePath,strlen(PATH_site))).'<br/>
01026 <input type="text" name="tx_impexp[filename]" value="'.htmlspecialchars($inData['filename']).'"'.$this->doc->formWidth(30).' /><br/>' : '').'
01027 </td>
01028 </tr>';
01029
01030
01031
01032 $row[] = '
01033 <tr class="bgColor4">
01034 <td> </td>
01035 <td><input type="submit" value="'.$LANG->getLL('makesavefo_update',1).'" /> - <input type="submit" value="'.$LANG->getLL('makesavefo_downloadExport',1).'" name="tx_impexp[download_export]" />'.
01036 ($savePath ? ' - <input type="submit" value="'.$LANG->getLL('importdata_saveToFilename',1).'" name="tx_impexp[save_export]" />' : '').'</td>
01037 </tr>';
01038 }
01039
01040
01041
01042
01043
01044
01045
01046
01047
01048
01049
01050
01051
01052
01053
01054
01055
01056
01057
01064 function importData($inData) {
01065 global $TCA,$LANG,$BE_USER;
01066
01067 $this->pageinfo = t3lib_BEfunc::readPageAccess($this->id,$this->perms_clause);
01068 $access = is_array($this->pageinfo) ? 1 : 0;
01069
01070 if (($this->id && $access) || ($BE_USER->user['admin'] && !$this->id)) {
01071 if ($BE_USER->user['admin'] && !$this->id) {
01072 $this->pageinfo=array('title' => '[root-level]','uid'=>0,'pid'=>0);
01073 }
01074
01075 $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);
01076 $this->content.= $this->doc->section('',$headerSection);
01077
01078 if ($inData['new_import']) {
01079 unset($inData['import_mode']);
01080 }
01081
01082 $import = t3lib_div::makeInstance('tx_impexp');
01083 $import->init(0,'import');
01084 $import->update = $inData['do_update'];
01085 $import->import_mode = $inData['import_mode'];
01086 $import->enableLogging = $inData['enableLogging'];
01087 $import->global_ignore_pid = $inData['global_ignore_pid'];
01088 $import->force_all_UIDS = $inData['force_all_UIDS'];
01089 $import->showDiff = !$inData['notShowDiff'];
01090 $import->allowPHPScripts = $inData['allowPHPScripts'];
01091 $import->softrefInputValues = $inData['softrefInputValues'];
01092
01093
01094
01095 $menuItems = array();
01096
01097
01098
01099 $path = 'fileadmin/';
01100 $filesInDir = t3lib_div::getFilesInDir(PATH_site.$path,'t3d,xml',1,1);
01101 if (is_dir(PATH_site.$path.'export/')) {
01102 $filesInDir = array_merge($filesInDir, t3lib_div::getFilesInDir(PATH_site.$path.'export/','t3d,xml',1,1));
01103 }
01104 $tempFolder = $this->userTempFolder();
01105 if ($tempFolder) {
01106 $temp_filesInDir = t3lib_div::getFilesInDir($tempFolder,'t3d,xml',1,1);
01107 $filesInDir = array_merge($filesInDir, $temp_filesInDir);
01108 }
01109
01110
01111 $row = array();
01112 $opt = array('');
01113 foreach($filesInDir as $file) {
01114 $opt[$file] = substr($file,strlen(PATH_site));
01115 }
01116
01117 $row[] = '<tr class="bgColor5">
01118 <td colspan="2"><strong>'.$LANG->getLL('importdata_selectFileToImport',1).'</strong></td>
01119 </tr>';
01120
01121 $row[] = '<tr class="bgColor4">
01122 <td><strong>'.$LANG->getLL('importdata_file',1).'</strong>'.t3lib_BEfunc::cshItem('xMOD_tx_impexp', 'importFile', $GLOBALS['BACK_PATH'],'').'</td>
01123 <td>'.
01124 $this->renderSelectBox('tx_impexp[file]',$inData['file'],$opt).'<br />'.sprintf($LANG->getLL('importdata_fromPathS',1),$path).
01125 (!$import->compress ? '<br /><span class="typo3-red">'.$LANG->getLL('importdata_noteNoDecompressorAvailable',1).'</span>':'').
01126 '</td>
01127 </tr>';
01128
01129 $row[] = '<tr class="bgColor5">
01130 <td colspan="2"><strong>'.$LANG->getLL('importdata_importOptions',1).'</strong></td>
01131 </tr>';
01132
01133 $row[] = '<tr class="bgColor4">
01134 <td><strong>'.$LANG->getLL('importdata_update',1).'</strong>'.t3lib_BEfunc::cshItem('xMOD_tx_impexp', 'update', $GLOBALS['BACK_PATH'],'').'</td>
01135 <td>
01136 <input type="checkbox" name="tx_impexp[do_update]" id="checkDo_update" value="1"'.($inData['do_update'] ? ' checked="checked"' : '').' />
01137 <label for="checkDo_update">'.$LANG->getLL('importdata_updateRecords',1).'</label><br/>
01138 <em>('.$LANG->getLL('importdata_thisOptionRequiresThat',1).')</em>'.
01139 ($inData['do_update'] ?
01140 ' <hr/>
01141 <input type="checkbox" name="tx_impexp[global_ignore_pid]" id="checkGlobal_ignore_pid" value="1"'.($inData['global_ignore_pid'] ? ' checked="checked"' : '').' />
01142 <label for="checkGlobal_ignore_pid">'.$LANG->getLL('importdata_ignorePidDifferencesGlobally',1).'</label><br/>
01143 <em>('.$LANG->getLL('importdata_ifYouSetThis',1).')</em>
01144 ' : ''
01145 ).'</td>
01146 </tr>';
01147
01148 $row[] = '<tr class="bgColor4">
01149 <td><strong>'.$LANG->getLL('importdata_options',1).'</strong>'.t3lib_BEfunc::cshItem('xMOD_tx_impexp', 'options', $GLOBALS['BACK_PATH'],'').'</td>
01150 <td>
01151 <input type="checkbox" name="tx_impexp[notShowDiff]" id="checkNotShowDiff" value="1"'.($inData['notShowDiff'] ? ' checked="checked"' : '').' />
01152 <label for="checkNotShowDiff">'.$LANG->getLL('importdata_doNotShowDifferences',1).'</label><br/>
01153 <em>('.$LANG->getLL('importdata_greenValuesAreFrom',1).')</em>
01154 <br/><br/>
01155
01156 '.($GLOBALS['BE_USER']->isAdmin() ? '
01157 <input type="checkbox" name="tx_impexp[allowPHPScripts]" id="checkAllowPHPScripts" value="1"'.($inData['allowPHPScripts'] ? ' checked="checked"' : '').' />
01158 <label for="checkAllowPHPScripts">'.$LANG->getLL('importdata_allowToWriteBanned',1).'</label><br/>' : '').
01159
01160 (!$inData['do_update'] && $GLOBALS['BE_USER']->isAdmin() ? '
01161 <br/>
01162 <input type="checkbox" name="tx_impexp[force_all_UIDS]" id="checkForce_all_UIDS" value="1"'.($inData['force_all_UIDS'] ? ' checked="checked"' : '').' />
01163 <label for="checkForce_all_UIDS"><span class="typo3-red">'.$LANG->getLL('importdata_force_all_UIDS',1).'</span></label><br/>
01164 <em>('.$LANG->getLL('importdata_force_all_UIDS_descr',1).')</em>' : '').
01165 '
01166 </td>
01167 </tr>';
01168
01169 $row[] = '<tr class="bgColor4">
01170 <td><strong>'.$LANG->getLL('importdata_action',1).'</strong>'.t3lib_BEfunc::cshItem('xMOD_tx_impexp', 'action', $GLOBALS['BACK_PATH'],'').'</td>
01171 <td>'.
01172 (!$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).'" />').'
01173 <input type="hidden" name="tx_impexp[action]" value="import" /></td>
01174 </tr>';
01175
01176 $row[] = '<tr class="bgColor4">
01177 <td><strong>'.$LANG->getLL('importdata_enableLogging',1).'</strong>'.t3lib_BEfunc::cshItem('xMOD_tx_impexp', 'enableLogging', $GLOBALS['BACK_PATH'],'').'</td>
01178 <td>
01179 <input type="checkbox" name="tx_impexp[enableLogging]" id="checkEnableLogging" value="1"'.($inData['enableLogging'] ? ' checked="checked"' : '').' />
01180 <label for="checkEnableLogging">'.$LANG->getLL('importdata_writeIndividualDbActions',1).'</label><br/>
01181 <em>('.$LANG->getLL('importdata_thisIsDisabledBy',1).')</em>
01182 </td>
01183 </tr>';
01184
01185 $menuItems[] = array(
01186 'label' => $LANG->getLL('importdata_import',1),
01187 'content' => '
01188 <table border="0" cellpadding="1" cellspacing="1">
01189 '.implode('
01190 ',$row).'
01191 </table>
01192 '
01193 );
01194
01195
01196 $tempFolder = $this->userTempFolder();
01197 if ($tempFolder) {
01198 $row = array();
01199
01200 $row[] = '<tr class="bgColor5">
01201 <td colspan="2"><strong>'.$LANG->getLL('importdata_uploadFileFromLocal',1).'</strong></td>
01202 </tr>';
01203
01204 $row[] = '<tr class="bgColor4">
01205 <td>'.$LANG->getLL('importdata_browse',1).t3lib_BEfunc::cshItem('xMOD_tx_impexp', 'upload', $GLOBALS['BACK_PATH'],'').'</td>
01206 <td>
01207
01208 <input type="file" name="upload_1"'.$this->doc->formWidth(35).' size="40" />
01209 <input type="hidden" name="file[upload][1][target]" value="'.htmlspecialchars($tempFolder).'" />
01210 <input type="hidden" name="file[upload][1][data]" value="1" /><br />
01211
01212 <input type="submit" name="_upload" value="'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:file_upload.php.submit',1).'" />
01213 <input type="checkbox" name="overwriteExistingFiles" id="checkOverwriteExistingFiles" value="1" checked="checked" /> <label for="checkOverwriteExistingFiles">'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_misc.php:overwriteExistingFiles',1).'</label>
01214 </td>
01215 </tr>';
01216
01217 if (t3lib_div::_POST('_upload')) {
01218 $row[] = '<tr class="bgColor4">
01219 <td>'.$LANG->getLL('importdata_uploadStatus',1).'</td>
01220 <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>
01221 </tr>';
01222 }
01223
01224 $menuItems[] = array(
01225 'label' => $LANG->getLL('importdata_upload'),
01226 'content' => '
01227 <table border="0" cellpadding="1" cellspacing="1">
01228 '.implode('
01229 ',$row).'
01230 </table>
01231 '
01232 );
01233 }
01234
01235
01236
01237 $overviewContent = '';
01238 $extensionInstallationMessage = '';
01239 $emURL = '';
01240 $inFile = t3lib_div::getFileAbsFileName($inData['file']);
01241 if ($inFile && @is_file($inFile)) {
01242 $trow = array();
01243 if ($import->loadFile($inFile,1)) {
01244
01245
01246 $extKeysToInstall = array();
01247 if (is_array($import->dat['header']['extensionDependencies'])) {
01248 foreach($import->dat['header']['extensionDependencies'] as $extKey) {
01249 if (!t3lib_extMgm::isLoaded($extKey)) {
01250 $extKeysToInstall[] = $extKey;
01251 }
01252 }
01253 }
01254
01255 if (count($extKeysToInstall)) {
01256 $passParams = t3lib_div::_POST('tx_impexp');
01257 unset($passParams['import_mode']);
01258 unset($passParams['import_file']);
01259
01260 $thisScriptUrl = t3lib_div::getIndpEnv('REQUEST_URI').'?M=xMOD_tximpexp&id='.$this->id.t3lib_div::implodeArrayForUrl('tx_impexp',$passParams);
01261 $emURL = $this->doc->backPath.'mod/tools/em/index.php?CMD[requestInstallExtensions]='.implode(',',$extKeysToInstall).'&returnUrl='.rawurlencode($thisScriptUrl);
01262 $extensionInstallationMessage = 'Before you can install this T3D file you need to install the extensions "'.implode('", "',$extKeysToInstall).'". Clicking Import will first take you to the Extension Manager so these dependencies can be resolved.';
01263 }
01264
01265 if ($inData['import_file']) {
01266 if (!count($extKeysToInstall)) {
01267 $import->importData($this->id);
01268 t3lib_BEfunc::getSetUpdateSignal('updatePageTree');
01269 } else {
01270 header('Location: '.t3lib_div::locationHeaderUrl($emURL));
01271 exit;
01272 }
01273 }
01274
01275 $import->display_import_pid_record = $this->pageinfo;
01276 $overviewContent = $import->displayContentOverview();
01277 }
01278
01279
01280 $trow[] = '<tr class="bgColor5">
01281 <td colspan="2"><strong>'.$LANG->getLL('importdata_metaData',1).'</strong></td>
01282 </tr>';
01283
01284 $opt = array('');
01285 foreach($filesInDir as $file) {
01286 $opt[$file] = substr($file,strlen(PATH_site));
01287 }
01288
01289 $trow[] = '<tr class="bgColor4">
01290 <td><strong>'.$LANG->getLL('importdata_title',1).'</strong></td>
01291 <td width="95%">'.nl2br(htmlspecialchars($import->dat['header']['meta']['title'])).'</td>
01292 </tr>';
01293
01294 $trow[] = '<tr class="bgColor4">
01295 <td><strong>'.$LANG->getLL('importdata_description',1).'</strong></td>
01296 <td width="95%">'.nl2br(htmlspecialchars($import->dat['header']['meta']['description'])).'</td>
01297 </tr>';
01298
01299 $trow[] = '<tr class="bgColor4">
01300 <td><strong>'.$LANG->getLL('importdata_notes',1).'</strong></td>
01301 <td width="95%">'.nl2br(htmlspecialchars($import->dat['header']['meta']['notes'])).'</td>
01302 </tr>';
01303
01304 $trow[] = '<tr class="bgColor4">
01305 <td><strong>'.$LANG->getLL('importdata_packager',1).'</strong></td>
01306 <td width="95%">'.nl2br(htmlspecialchars($import->dat['header']['meta']['packager_name'].' ('.$import->dat['header']['meta']['packager_username'].')')).'<br/>
01307 '.$LANG->getLL('importdata_email',1).' '.$import->dat['header']['meta']['packager_email'].'</td>
01308 </tr>';
01309
01310
01311 if (is_array($import->dat['header']['thumbnail'])) {
01312 $pI = pathinfo($import->dat['header']['thumbnail']['filename']);
01313 if (t3lib_div::inList('gif,jpg,png,jpeg',strtolower($pI['extension']))) {
01314
01315
01316 $fileName = PATH_site.
01317 'typo3temp/importthumb.'.$pI['extension'];
01318 t3lib_div::writeFile($fileName, $import->dat['header']['thumbnail']['content']);
01319
01320
01321 if (getimagesize($fileName)) {
01322
01323 $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="" />';
01324
01325 $trow[] = '<tr class="bgColor4">
01326 <td><strong>'.$LANG->getLL('importdata_icon',1).'</strong></td>
01327 <td>'.$iconTag.'</td>
01328 </tr>';
01329 } else {
01330 t3lib_div::unlink_tempfile($fileName);
01331 }
01332 }
01333 }
01334
01335 $menuItems[] = array(
01336 'label' => $LANG->getLL('importdata_metaData_1387'),
01337 'content' => '
01338 <table border="0" cellpadding="1" cellspacing="1">
01339 '.implode('
01340 ',$trow).'
01341 </table>
01342 '
01343 );
01344 }
01345
01346
01347 $errors = $import->printErrorLog();
01348 $menuItems[] = array(
01349 'label' => $LANG->getLL('importdata_messages'),
01350 'content' => $errors,
01351 'stateIcon' => $errors ? 2 : 0
01352 );
01353
01354
01355 $content = $this->doc->getDynTabMenu($menuItems,'tx_impexp_import',-1);
01356 if ($extensionInstallationMessage) {
01357 $content = '<div style="border: 1px black solid; margin: 10px 10px 10px 10px; padding: 10px 10px 10px 10px;">'.$this->doc->icons(1).htmlspecialchars($extensionInstallationMessage).'</div>'.$content;
01358 }
01359 $this->content.= $this->doc->section('',$content,0,1);
01360
01361
01362
01363 if ($overviewContent) {
01364 $this->content.= $this->doc->section($inData['import_file'] ? $LANG->getLL('importdata_structureHasBeenImported',1) : $LANG->getLL('filterpage_structureToBeImported',1), $overviewContent, 0, 1);
01365 }
01366 }
01367 }
01368
01369
01370
01371
01372
01373
01374
01375
01376
01377
01378
01379
01380
01381
01382
01383
01384
01385
01386
01393 function processPresets(&$inData) {
01394
01395 $presetData = t3lib_div::_GP('preset');
01396 $err = FALSE;
01397
01398
01399 if (isset($presetData['save'])) {
01400 $preset = $this->getPreset($presetData['select']);
01401 if (is_array($preset)) {
01402 if ($GLOBALS['BE_USER']->isAdmin() || $preset['user_uid'] === $GLOBALS['BE_USER']->user['uid']) {
01403 $fields_values = array(
01404 'public' => $inData['preset']['public'],
01405 'title' => $inData['preset']['title'],
01406 'item_uid' => $inData['pagetree']['id'],
01407 'preset_data' => serialize($inData)
01408 );
01409 $GLOBALS['TYPO3_DB']->exec_UPDATEquery('tx_impexp_presets','uid='.intval($preset['uid']),$fields_values);
01410 $msg = 'Preset #'.$preset['uid'].' saved!';
01411 } else {
01412 $msg = 'ERROR: The preset was not saved because you were not the owner of it!';
01413 $err = TRUE;
01414 }
01415 } else {
01416 $fields_values = array(
01417 'user_uid' => $GLOBALS['BE_USER']->user['uid'],
01418 'public' => $inData['preset']['public'],
01419 'title' => $inData['preset']['title'],
01420 'item_uid' => $inData['pagetree']['id'],
01421 'preset_data' => serialize($inData)
01422 );
01423 $GLOBALS['TYPO3_DB']->exec_INSERTquery('tx_impexp_presets',$fields_values);
01424 $msg = 'New preset "'.$inData['preset']['title'].'" is created';
01425 }
01426 }
01427
01428
01429 if (isset($presetData['delete'])) {
01430 $preset = $this->getPreset($presetData['select']);
01431 if (is_array($preset)) {
01432 if ($GLOBALS['BE_USER']->isAdmin() || $preset['user_uid'] === $GLOBALS['BE_USER']->user['uid']) {
01433 $GLOBALS['TYPO3_DB']->exec_DELETEquery('tx_impexp_presets','uid='.intval($preset['uid']));
01434 $msg = 'Preset #'.$preset['uid'].' deleted!';
01435 } else {
01436 $msg = 'ERROR: You were not the owner of the preset so you could not delete it.';
01437 $err = TRUE;
01438 }
01439 } else {
01440 $msg = 'ERROR: No preset selected for deletion.';
01441 $err = TRUE;
01442 }
01443 }
01444
01445
01446 if (isset($presetData['load']) || isset($presetData['merge'])) {
01447 $preset = $this->getPreset($presetData['select']);
01448 if (is_array($preset)) {
01449 $inData_temp = unserialize($preset['preset_data']);
01450 if (is_array($inData_temp)) {
01451 if (isset($presetData['merge'])) {
01452
01453
01454 if (is_array($inData_temp['record'])) {
01455 $inData['record'] = array_merge((array)$inData['record'], $inData_temp['record']);
01456 }
01457
01458
01459 if (is_array($inData_temp['list'])) {
01460 $inData['list'] = array_merge((array)$inData['list'], $inData_temp['list']);
01461 }
01462 } else {
01463 $msg = 'Preset #'.$preset['uid'].' loaded!';
01464 $inData = $inData_temp;
01465 }
01466 } else {
01467 $msg = 'ERROR: No configuratio data found in preset record!';
01468 $err = TRUE;
01469 }
01470 } else {
01471 $msg = 'ERROR: No preset selected for loading.';
01472 $err = TRUE;
01473 }
01474 }
01475
01476
01477 if (strlen($msg)) {
01478 $this->content.= $this->doc->section('Presets',$msg,0,1,$err ? 3 : 1);
01479 }
01480 }
01481
01488 function getPreset($uid) {
01489 list($preset) = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('*','tx_impexp_presets','uid='.intval($uid));
01490 return $preset;
01491 }
01492
01493
01494
01495
01496
01497
01498
01499
01500
01501
01502
01503
01504
01505
01506
01507
01508
01514 function userTempFolder() {
01515 global $FILEMOUNTS;
01516
01517 foreach($FILEMOUNTS as $filePathInfo) {
01518 $tempFolder = $filePathInfo['path'].'_temp_/';
01519 if (@is_dir($tempFolder)) {
01520 return $tempFolder;
01521 }
01522 }
01523 }
01524
01530 function userSaveFolder() {
01531 global $FILEMOUNTS;
01532
01533 reset($FILEMOUNTS);
01534 $filePathInfo = current($FILEMOUNTS);
01535
01536 if (is_array($filePathInfo)) {
01537 $tempFolder = $filePathInfo['path'].'export/';
01538 if (!@is_dir($tempFolder)) {
01539 $tempFolder = $filePathInfo['path'];
01540 if (!@is_dir($tempFolder)) {
01541 return FALSE;
01542 }
01543 }
01544 return $tempFolder;
01545 }
01546 }
01547
01553 function checkUpload() {
01554 global $FILEMOUNTS,$TYPO3_CONF_VARS,$BE_USER;
01555
01556 $file = t3lib_div::_GP('file');
01557
01558
01559 $this->fileProcessor = t3lib_div::makeInstance('t3lib_extFileFunctions');
01560 $this->fileProcessor->init($FILEMOUNTS, $TYPO3_CONF_VARS['BE']['fileExtensions']);
01561 $this->fileProcessor->init_actionPerms($BE_USER->user['fileoper_perms']);
01562 $this->fileProcessor->dontCheckForUnique = t3lib_div::_GP('overwriteExistingFiles') ? 1 : 0;
01563
01564
01565 $refInfo = parse_url(t3lib_div::getIndpEnv('HTTP_REFERER'));
01566 $httpHost = t3lib_div::getIndpEnv('TYPO3_HOST_ONLY');
01567 if ($httpHost!=$refInfo['host'] && $this->vC!=$BE_USER->veriCode() && !$TYPO3_CONF_VARS['SYS']['doNotCheckReferer']) {
01568 $this->fileProcessor->writeLog(0,2,1,'Referer host "%s" and server host "%s" did not match!',array($refInfo['host'],$httpHost));
01569 } else {
01570 $this->fileProcessor->start($file);
01571 $this->fileProcessor->processData();
01572 }
01573 }
01574
01583 function renderSelectBox($prefix,$value,$optValues) {
01584 $opt = array();
01585 $isSelFlag = 0;
01586 reset($optValues);
01587 while(list($k,$v) = each($optValues)) {
01588 $sel = (!strcmp($k,$value) ? ' selected="selected"' : '');
01589 if ($sel) $isSelFlag++;
01590 $opt[] = '<option value="'.htmlspecialchars($k).'"'.$sel.'>'.htmlspecialchars($v).'</option>';
01591 }
01592 if (!$isSelFlag && strcmp('',$value)) {
01593 $opt[] = '<option value="'.htmlspecialchars($value).'" selected="selected">'.htmlspecialchars("['".$value."']").'</option>';
01594 }
01595 return '<select name="'.$prefix.'">'.implode('',$opt).'</select>';
01596 }
01597
01606 function tableSelector($prefix,$value,$excludeList='') {
01607 global $TCA, $LANG;
01608
01609 reset($TCA);
01610 $optValues = array();
01611
01612 if (!t3lib_div::inList($excludeList,'_ALL')) {
01613 $optValues['_ALL'] = '['.$LANG->getLL('ALL_tables').']';
01614 }
01615
01616 while(list($table) = each($TCA)) {
01617 if ($GLOBALS['BE_USER']->check('tables_select',$table) && !t3lib_div::inList($excludeList,$table)) {
01618 $optValues[$table] = $table;
01619 }
01620 }
01621
01622
01623 $opt = array();
01624 $opt[] = '<option value=""></option>';
01625 reset($optValues);
01626 while(list($k,$v)=each($optValues)) {
01627 if (is_array($value)) {
01628 $sel = in_array($k,$value)?' selected="selected"':'';
01629 }
01630 $opt[] = '<option value="'.htmlspecialchars($k).'"'.$sel.'>'.htmlspecialchars($v).'</option>';
01631 }
01632 return '<select name="'.$prefix.'[]" multiple="multiple" size="'.t3lib_div::intInRange(count($opt),5,10).'">'.implode('',$opt).'</select>';
01633 }
01634
01642 function extensionSelector($prefix,$value) {
01643 global $TYPO3_LOADED_EXT;
01644
01645 $extTrav = array_keys($TYPO3_LOADED_EXT);
01646
01647
01648 $opt = array();
01649 $opt[] = '<option value=""></option>';
01650 foreach($extTrav as $v) {
01651 if ($v!=='_CACHEFILE') {
01652 if (is_array($value)) {
01653 $sel = in_array($v,$value)?' selected="selected"':'';
01654 }
01655 $opt[] = '<option value="'.htmlspecialchars($v).'"'.$sel.'>'.htmlspecialchars($v).'</option>';
01656 }
01657 }
01658 return '<select name="'.$prefix.'[]" multiple="multiple" size="'.t3lib_div::intInRange(count($opt),5,10).'">'.implode('',$opt).'</select>';
01659 }
01660
01667 function filterPageIds($exclude) {
01668
01669
01670 $exclude = array_keys($exclude);
01671
01672
01673 $pageIds = array();
01674 foreach($exclude as $element) {
01675 list($table,$uid) = explode(':', $element);
01676 if ($table==='pages') {
01677 $pageIds[] = intval($uid);
01678 }
01679 }
01680
01681
01682 if (count($pageIds)) {
01683 return ' AND uid NOT IN ('.implode(',', $pageIds).')';
01684 }
01685 }
01686 }
01687
01688
01689 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/impexp/app/index.php']) {
01690 include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/impexp/app/index.php']);
01691 }
01692
01693
01694
01695
01696
01697
01698
01699
01700
01701
01702
01703
01704
01705 $SOBE = t3lib_div::makeInstance('SC_mod_tools_log_index');
01706 $SOBE->init();
01707 $SOBE->main();
01708 $SOBE->printContent();
01709 ?>