📄 index.php
字号:
foreach($filesInDir as $file) { $opt[$file] = substr($file,strlen(PATH_site)); } $trow[] = '<tr class="bgColor4"> <td><strong>'.$LANG->getLL('importdata_title',1).'</strong></td> <td width="95%">'.nl2br(htmlspecialchars($import->dat['header']['meta']['title'])).'</td> </tr>'; $trow[] = '<tr class="bgColor4"> <td><strong>'.$LANG->getLL('importdata_description',1).'</strong></td> <td width="95%">'.nl2br(htmlspecialchars($import->dat['header']['meta']['description'])).'</td> </tr>'; $trow[] = '<tr class="bgColor4"> <td><strong>'.$LANG->getLL('importdata_notes',1).'</strong></td> <td width="95%">'.nl2br(htmlspecialchars($import->dat['header']['meta']['notes'])).'</td> </tr>'; $trow[] = '<tr class="bgColor4"> <td><strong>'.$LANG->getLL('importdata_packager',1).'</strong></td> <td width="95%">'.nl2br(htmlspecialchars($import->dat['header']['meta']['packager_name'].' ('.$import->dat['header']['meta']['packager_username'].')')).'<br/> '.$LANG->getLL('importdata_email',1).' '.$import->dat['header']['meta']['packager_email'].'</td> </tr>'; // Thumbnail icon: if (is_array($import->dat['header']['thumbnail'])) { $pI = pathinfo($import->dat['header']['thumbnail']['filename']); if (t3lib_div::inList('gif,jpg,png,jpeg',strtolower($pI['extension']))) { // Construct filename and write it: $fileName = PATH_site. 'typo3temp/importthumb.'.$pI['extension']; t3lib_div::writeFile($fileName, $import->dat['header']['thumbnail']['content']); // Check that the image really is an image and not a malicious PHP script... if (getimagesize($fileName)) { // Create icon tag: $iconTag = '<img src="'.$this->doc->backPath.'../'.substr($fileName,strlen(PATH_site)).'" '.$import->dat['header']['thumbnail']['imgInfo'][3].' vspace="5" style="border: solid black 1px;" alt="" />'; $trow[] = '<tr class="bgColor4"> <td><strong>'.$LANG->getLL('importdata_icon',1).'</strong></td> <td>'.$iconTag.'</td> </tr>'; } else { t3lib_div::unlink_tempfile($fileName); } } } $menuItems[] = array( 'label' => $LANG->getLL('importdata_metaData_1387'), 'content' => ' <table border="0" cellpadding="1" cellspacing="1"> '.implode(' ',$trow).' </table> ' ); } // Print errors that might be: $errors = $import->printErrorLog(); $menuItems[] = array( 'label' => $LANG->getLL('importdata_messages'), 'content' => $errors, 'stateIcon' => $errors ? 2 : 0 ); // Output tabs: $content = $this->doc->getDynTabMenu($menuItems,'tx_impexp_import',-1); if ($extensionInstallationMessage) { $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; } $this->content.= $this->doc->section('',$content,0,1); // Print overview: if ($overviewContent) { $this->content.= $this->doc->section($inData['import_file'] ? $LANG->getLL('importdata_structureHasBeenImported',1) : $LANG->getLL('filterpage_structureToBeImported',1), $overviewContent, 0, 1); } } } /**************************** * * Preset functions * ****************************/ /** * Manipulate presets * * @param array In data array, passed by reference! * @return void */ function processPresets(&$inData) { $presetData = t3lib_div::_GP('preset'); $err = FALSE; // Save preset if (isset($presetData['save'])) { $preset = $this->getPreset($presetData['select']); if (is_array($preset)) { // Update existing if ($GLOBALS['BE_USER']->isAdmin() || $preset['user_uid'] === $GLOBALS['BE_USER']->user['uid']) { $fields_values = array( 'public' => $inData['preset']['public'], 'title' => $inData['preset']['title'], 'item_uid' => $inData['pagetree']['id'], 'preset_data' => serialize($inData) ); $GLOBALS['TYPO3_DB']->exec_UPDATEquery('tx_impexp_presets','uid='.intval($preset['uid']),$fields_values); $msg = 'Preset #'.$preset['uid'].' saved!'; } else { $msg = 'ERROR: The preset was not saved because you were not the owner of it!'; $err = TRUE; } } else { // Insert new: $fields_values = array( 'user_uid' => $GLOBALS['BE_USER']->user['uid'], 'public' => $inData['preset']['public'], 'title' => $inData['preset']['title'], 'item_uid' => $inData['pagetree']['id'], 'preset_data' => serialize($inData) ); $GLOBALS['TYPO3_DB']->exec_INSERTquery('tx_impexp_presets',$fields_values); $msg = 'New preset "'.$inData['preset']['title'].'" is created'; } } // Delete preset: if (isset($presetData['delete'])) { $preset = $this->getPreset($presetData['select']); if (is_array($preset)) { // Update existing if ($GLOBALS['BE_USER']->isAdmin() || $preset['user_uid'] === $GLOBALS['BE_USER']->user['uid']) { $GLOBALS['TYPO3_DB']->exec_DELETEquery('tx_impexp_presets','uid='.intval($preset['uid'])); $msg = 'Preset #'.$preset['uid'].' deleted!'; } else { $msg = 'ERROR: You were not the owner of the preset so you could not delete it.'; $err = TRUE; } } else { $msg = 'ERROR: No preset selected for deletion.'; $err = TRUE; } } // Load preset if (isset($presetData['load']) || isset($presetData['merge'])) { $preset = $this->getPreset($presetData['select']); if (is_array($preset)) { // Update existing $inData_temp = unserialize($preset['preset_data']); if (is_array($inData_temp)) { if (isset($presetData['merge'])) { // Merge records in: if (is_array($inData_temp['record'])) { $inData['record'] = array_merge((array)$inData['record'], $inData_temp['record']); } // Merge lists in: if (is_array($inData_temp['list'])) { $inData['list'] = array_merge((array)$inData['list'], $inData_temp['list']); } } else { $msg = 'Preset #'.$preset['uid'].' loaded!'; $inData = $inData_temp; } } else { $msg = 'ERROR: No configuratio data found in preset record!'; $err = TRUE; } } else { $msg = 'ERROR: No preset selected for loading.'; $err = TRUE; } } // Show message: if (strlen($msg)) { $this->content.= $this->doc->section('Presets',$msg,0,1,$err ? 3 : 1); } } /** * Get single preset record * * @param integer Preset record * @return array Preset record, if any (otherwise false) */ function getPreset($uid) { list($preset) = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('*','tx_impexp_presets','uid='.intval($uid)); return $preset; } /**************************** * * Helper functions * ****************************/ /** * Returns first temporary folder of the user account (from $FILEMOUNTS) * * @return string Absolute path to first "_temp_" folder of the current user, otherwise blank. */ function userTempFolder() { global $FILEMOUNTS; foreach($FILEMOUNTS as $filePathInfo) { $tempFolder = $filePathInfo['path'].'_temp_/'; if (@is_dir($tempFolder)) { return $tempFolder; } } } /** * Returns folder where user can save export files. * * @return string Absolute path to folder where export files can be saved. */ function userSaveFolder() { global $FILEMOUNTS; reset($FILEMOUNTS); $filePathInfo = current($FILEMOUNTS); if (is_array($filePathInfo)) { $tempFolder = $filePathInfo['path'].'export/'; if (!@is_dir($tempFolder)) { $tempFolder = $filePathInfo['path']; if (!@is_dir($tempFolder)) { return FALSE; } } return $tempFolder; } } /** * Check if a file has been uploaded * * @return void */ function checkUpload() { global $FILEMOUNTS,$TYPO3_CONF_VARS,$BE_USER; $file = t3lib_div::_GP('file'); // Initializing: $this->fileProcessor = t3lib_div::makeInstance('t3lib_extFileFunctions'); $this->fileProcessor->init($FILEMOUNTS, $TYPO3_CONF_VARS['BE']['fileExtensions']); $this->fileProcessor->init_actionPerms($BE_USER->user['fileoper_perms']); $this->fileProcessor->dontCheckForUnique = t3lib_div::_GP('overwriteExistingFiles') ? 1 : 0; // Checking referer / executing: $refInfo = parse_url(t3lib_div::getIndpEnv('HTTP_REFERER')); $httpHost = t3lib_div::getIndpEnv('TYPO3_HOST_ONLY'); if ($httpHost!=$refInfo['host'] && $this->vC!=$BE_USER->veriCode() && !$TYPO3_CONF_VARS['SYS']['doNotCheckReferer']) { $this->fileProcessor->writeLog(0,2,1,'Referer host "%s" and server host "%s" did not match!',array($refInfo['host'],$httpHost)); } else { $this->fileProcessor->start($file); $this->fileProcessor->processData(); } } /** * Makes a selector-box from optValues * * @param string Form element name * @param string Current value * @param array Options to display (key/value pairs) * @return string HTML select element */ function renderSelectBox($prefix,$value,$optValues) { $opt = array(); $isSelFlag = 0; reset($optValues); while(list($k,$v) = each($optValues)) { $sel = (!strcmp($k,$value) ? ' selected="selected"' : ''); if ($sel) $isSelFlag++; $opt[] = '<option value="'.htmlspecialchars($k).'"'.$sel.'>'.htmlspecialchars($v).'</option>'; } if (!$isSelFlag && strcmp('',$value)) { $opt[] = '<option value="'.htmlspecialchars($value).'" selected="selected">'.htmlspecialchars("['".$value."']").'</option>'; } return '<select name="'.$prefix.'">'.implode('',$opt).'</select>'; } /** * Returns a selector-box with TCA tables * * @param string Form element name prefix * @param array The current values selected * @param string Table names (and the string "_ALL") to exclude. Comma list * @return string HTML select element */ function tableSelector($prefix,$value,$excludeList='') { global $TCA, $LANG; reset($TCA); $optValues = array(); if (!t3lib_div::inList($excludeList,'_ALL')) { $optValues['_ALL'] = '['.$LANG->getLL('ALL_tables').']'; } while(list($table) = each($TCA)) { if ($GLOBALS['BE_USER']->check('tables_select',$table) && !t3lib_div::inList($excludeList,$table)) { $optValues[$table] = $table; } } // make box: $opt = array(); $opt[] = '<option value=""></option>'; reset($optValues); while(list($k,$v)=each($optValues)) { if (is_array($value)) { $sel = in_array($k,$value)?' selected="selected"':''; } $opt[] = '<option value="'.htmlspecialchars($k).'"'.$sel.'>'.htmlspecialchars($v).'</option>'; } return '<select name="'.$prefix.'[]" multiple="multiple" size="'.t3lib_div::intInRange(count($opt),5,10).'">'.implode('',$opt).'</select>'; } /** * Returns a selector-box with loaded extension keys * * @param string Form element name prefix * @param array The current values selected * @return string HTML select element */ function extensionSelector($prefix,$value) { global $TYPO3_LOADED_EXT; $extTrav = array_keys($TYPO3_LOADED_EXT); // make box: $opt = array(); $opt[] = '<option value=""></option>'; foreach($extTrav as $v) { if ($v!=='_CACHEFILE') { if (is_array($value)) { $sel = in_array($v,$value)?' selected="selected"':''; } $opt[] = '<option value="'.htmlspecialchars($v).'"'.$sel.'>'.htmlspecialchars($v).'</option>'; } } return '<select name="'.$prefix.'[]" multiple="multiple" size="'.t3lib_div::intInRange(count($opt),5,10).'">'.implode('',$opt).'</select>'; } /** * Filter page IDs by traversing exclude array, finding all excluded pages (if any) and making an AND NOT IN statement for the select clause. * * @param array Exclude array from import/export object. * @return string AND where clause part to filter out page uids. */ function filterPageIds($exclude) { // Get keys: $exclude = array_keys($exclude); // Traverse $pageIds = array(); foreach($exclude as $element) { list($table,$uid) = explode(':', $element); if ($table==='pages') { $pageIds[] = intval($uid); } } // Add to clause: if (count($pageIds)) { return ' AND uid NOT IN ('.implode(',', $pageIds).')'; } }}// Include extension?if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/impexp/app/index.php']) { include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/impexp/app/index.php']);}// Make instance:$SOBE = t3lib_div::makeInstance('SC_mod_tools_log_index');$SOBE->init();$SOBE->main();$SOBE->printContent();?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -