📄 index.php
字号:
<?php/**************************************************************** Copyright notice** (c) 1999-2005 Kasper Skaarhoj (kasperYYYY@typo3.com)* All rights reserved** This script is part of the TYPO3 project. The TYPO3 project is* free software; you can redistribute it and/or modify* it under the terms of the GNU General Public License as published by* the Free Software Foundation; either version 2 of the License, or* (at your option) any later version.** The GNU General Public License can be found at* http://www.gnu.org/copyleft/gpl.html.* A copy is found in the textfile GPL.txt and important notices to the license* from the author is found in LICENSE.txt distributed with these scripts.*** This script is distributed in the hope that it will be useful,* but WITHOUT ANY WARRANTY; without even the implied warranty of* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the* GNU General Public License for more details.** This copyright notice MUST APPEAR in all copies of the script!***************************************************************//** * Import / Export module * * @author Kasper Skaarhoj <kasperYYYY@typo3.com> *//** * [CLASS/FUNCTION INDEX of SCRIPT] * * * * 137: class localPageTree extends t3lib_browseTree * 144: function localPageTree() * 155: function wrapTitle($title,$v) * 168: function PM_ATagWrap($icon,$cmd,$bMark='') * 179: function wrapIcon($icon,$row) * 188: function permsC() * 199: function ext_tree($pid, $clause='') * * * 280: class SC_mod_tools_log_index extends t3lib_SCbase * 289: function main() * 359: function printContent() * * SECTION: EXPORT FUNCTIONS * 387: function exportData($inData) * 661: function addRecordsForPid($k, $tables, $maxNumber) * 687: function exec_listQueryPid($table,$pid,$limit) * 717: function makeConfigurationForm($inData, &$row) * 885: function makeAdvancedOptionsForm($inData, &$row) * 933: function makeSaveForm($inData, &$row) * * SECTION: IMPORT FUNCTIONS * 1064: function importData($inData) * * SECTION: Preset functions * 1363: function processPresets(&$inData) * 1458: function getPreset($uid) * * SECTION: Helper functions * 1484: function userTempFolder() * 1500: function userSaveFolder() * 1523: function checkUpload() * 1553: function renderSelectBox($prefix,$value,$optValues) * 1576: function tableSelector($prefix,$value,$excludeList='') * 1612: function extensionSelector($prefix,$value) * 1637: function filterPageIds($exclude) * * TOTAL FUNCTIONS: 24 * (This index is automatically created/updated by the extension "extdeveval") * *//** * IMPORTING DATA: * * Incoming array has syntax: * GETvar 'id' = import page id (must be readable) * * file = (pointing to filename relative to PATH_site) * * * * [all relation fields are clear, but not files] * - page-tree is written first * - then remaining pages (to the root of import) * - then all other records are written either to related included pages or if not found to import-root (should be a sysFolder in most cases) * - then all internal relations are set and non-existing relations removed, relations to static tables preserved. * * EXPORTING DATA: * * Incoming array has syntax: * * file[] = file * dir[] = dir * list[] = table:pid * record[] = table:uid * * pagetree[id] = (single id) * pagetree[levels]=1,2,3, -1 = currently unpacked tree, -2 = only tables on page * pagetree[tables][]=table/_ALL * * external_ref[tables][]=table/_ALL */#unset($MCONF);#require ('conf.php');#require ($BACK_PATH.'init.php');#require ($BACK_PATH.'template.php');$LANG->includeLLFile('EXT:impexp/app/locallang.php');require_once (PATH_t3lib.'class.t3lib_scbase.php');require_once (t3lib_extMgm::extPath('impexp').'class.tx_impexp.php');require_once (PATH_t3lib.'class.t3lib_browsetree.php');require_once (PATH_t3lib.'class.t3lib_pagetree.php');require_once (PATH_t3lib.'class.t3lib_basicfilefunc.php');require_once (PATH_t3lib.'class.t3lib_extfilefunc.php');t3lib_extMgm::isLoaded('impexp',1);/** * Extension of the page tree class. Used to get the tree of pages to export. * * @author Kasper Skaarhoj <kasperYYYY@typo3.com> * @package TYPO3 * @subpackage tx_impexp */class localPageTree extends t3lib_browseTree { /** * Initialization * * @return void */ function localPageTree() { $this->init(); } /** * Wrapping title from page tree. * * @param string Title to wrap * @param mixed (See parent class) * @return string Wrapped title */ function wrapTitle($title,$v) { $title = (!strcmp(trim($title),'')) ? '<em>['.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.no_title',1).']</em>' : htmlspecialchars($title); return $title; } /** * Wrapping Plus/Minus icon * * @param string Icon HTML * @param mixed (See parent class) * @param mixed (See parent class) * @return string Icon HTML */ function PM_ATagWrap($icon,$cmd,$bMark='') { return $icon; } /** * Wrapping Icon * * @param string Icon HTML * @param array Record row (page) * @return string Icon HTML */ function wrapIcon($icon,$row) { return $icon; } /** * Select permissions * * @return string SQL where clause */ function permsC() { return $this->BE_USER->getPagePermsClause(1); } /** * Tree rendering * * @param integer PID value * @param string Additional where clause * @return array Array of tree elements */ function ext_tree($pid, $clause='') { // Initialize: $this->init(' AND '.$this->permsC().$clause); // Get stored tree structure: $this->stored = unserialize($this->BE_USER->uc['browseTrees']['browsePages']); // PM action: $PM = t3lib_div::intExplode('_',t3lib_div::_GP('PM')); // traverse mounts: $titleLen = intval($this->BE_USER->uc['titleLen']); $treeArr = array(); $idx = 0; // Set first: $this->bank = $idx; $isOpen = $this->stored[$idx][$pid] || $this->expandFirst; $curIds = $this->ids; // save ids $this->reset(); $this->ids = $curIds; // Set PM icon: $cmd = $this->bank.'_'.($isOpen?'0_':'1_').$pid; $icon = '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/ol/'.($isOpen?'minus':'plus').'only.gif','width="18" height="16"').' align="top" alt="" />'; $firstHtml = $this->PM_ATagWrap($icon,$cmd); if ($pid>0) { $rootRec = t3lib_befunc::getRecordWSOL('pages',$pid); $firstHtml.= $this->wrapIcon(t3lib_iconWorks::getIconImage('pages',$rootRec,$this->backPath,'align="top"'),$rootRec); } else { $rootRec = array( 'title' => $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'], 'uid' => 0 ); $firstHtml.= $this->wrapIcon('<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/i/_icon_website.gif','width="18" height="16"').' align="top" alt="" />',$rootRec); } $this->tree[] = array('HTML'=>$firstHtml, 'row'=>$rootRec); if ($isOpen) { // Set depth: $depthD = '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/ol/blank.gif','width="18" height="16"').' align="top" alt="" />'; if ($this->addSelfId) $this->ids[] = $pid; $this->getTree($pid,999,$depthD); $idH = array(); $idH[$pid]['uid'] = $pid; if (count($this->buffer_idH)) $idH[$pid]['subrow'] = $this->buffer_idH; $this->buffer_idH = $idH; } // Add tree: $treeArr = array_merge($treeArr,$this->tree); return $treeArr; }}/** * Main script class for the Import / Export facility * * @author Kasper Skaarhoj <kasperYYYY@typo3.com> * @package TYPO3 * @subpackage tx_impexp */class SC_mod_tools_log_index extends t3lib_SCbase { var $pageinfo; // array containing the current page. /** * Main module function * * @return void */ function main() { global $BE_USER,$LANG,$BACK_PATH; // Start document template object: $this->doc = t3lib_div::makeInstance('mediumDoc'); $this->doc->backPath = $BACK_PATH; $this->doc->docType = 'xhtml_trans'; // JavaScript $this->doc->JScode = $this->doc->wrapScriptTags(' script_ended = 0; function jumpToUrl(URL) { // window.location.href = URL; } '); // Set up JS for dynamic tab menu $this->doc->JScode .= $this->doc->getDynTabMenuJScode(); $this->doc->postCode = $this->doc->wrapScriptTags(' script_ended = 1; if (top.fsMod) top.fsMod.recentIds["web"] = '.intval($this->id).'; '); $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.'" />'; $this->content.= $this->doc->startPage($LANG->getLL('title')); $this->content.= $this->doc->header($LANG->getLL('title')); $this->content.= $this->doc->spacer(5); // Input data grabbed: $inData = t3lib_div::_GP('tx_impexp'); $this->checkUpload(); switch((string)$inData['action']) { case 'export': // Finally: If upload went well, set the new file as the thumbnail in the $inData array: if (is_object($this->fileProcessor) && $this->fileProcessor->internalUploadMap[1]) { $inData['meta']['thumbnail'] = md5($this->fileProcessor->internalUploadMap[1]); } // Call export interface $this->exportData($inData); break; case 'import': // Finally: If upload went well, set the new file as the import file: if (is_object($this->fileProcessor) && $this->fileProcessor->internalUploadMap[1]) { $fI = pathinfo($this->fileProcessor->internalUploadMap[1]); if (t3lib_div::inList('t3d,xml',strtolower($fI['extension']))) { // Only allowed extensions.... $inData['file'] = $this->fileProcessor->internalUploadMap[1]; } } // Call import interface: $this->importData($inData); break; } if ($BE_USER->mayMakeShortcut()) { $this->content.=$this->doc->spacer(20).$this->doc->section('',$this->doc->makeShortcutIcon('tx_impexp','',$this->MCONF['name'])); } } /** * Print the content * * @return void */ function printContent() { $this->content.= $this->doc->spacer(20); $this->content.= $this->doc->endPage(); echo $this->content; } /************************** * * EXPORT FUNCTIONS * **************************/ /** * Export part of module * * @param array Content of POST VAR tx_impexp[].. * @return void Setting content in $this->content */ function exportData($inData) { global $TCA, $LANG; // BUILDING EXPORT DATA: // Processing of InData array values: $inData['pagetree']['maxNumber'] = t3lib_div::intInRange($inData['pagetree']['maxNumber'],1,10000,100); $inData['listCfg']['maxNumber'] = t3lib_div::intInRange($inData['listCfg']['maxNumber'],1,10000,100); $inData['maxFileSize'] = t3lib_div::intInRange($inData['maxFileSize'],1,10000,1000); $inData['filename'] = trim(ereg_replace('[^[:alnum:]./_-]*','',ereg_replace('\.(t3d|xml)$','',$inData['filename']))); if (strlen($inData['filename'])) { $inData['filename'].= $inData['filetype']=='xml' ? '.xml' : '.t3d'; } // Set exclude fields in export object: if (!is_array($inData['exclude'])) { $inData['exclude'] = array(); } // Saving/Loading/Deleting presets: $this->processPresets($inData); // Create export object and configure it: $this->export = t3lib_div::makeInstance('tx_impexp'); $this->export->init(0,'export'); $this->export->setCharset($LANG->charSet); $this->export->maxFileSize = $inData['maxFileSize']*1024; $this->export->excludeMap = (array)$inData['exclude']; $this->export->softrefCfg = (array)$inData['softrefCfg']; $this->export->extensionDependencies = (array)$inData['extension_dep']; $this->export->showStaticRelations = $inData['showStaticRelations']; $this->export->includeExtFileResources = !$inData['excludeHTMLfileResources'];#debug($inData); // Static tables: if (is_array($inData['external_static']['tables'])) { $this->export->relStaticTables = $inData['external_static']['tables']; } // Configure which tables external relations are included for:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -