⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 db_layout.php

📁 Typo3, 开源里边最强大的
💻 PHP
📖 第 1 页 / 共 4 页
字号:
				1 => $LANG->getLL('m_function_1'),				0 => $LANG->getLL('m_function_0'),				2 => $LANG->getLL('m_function_2'),				3 => $LANG->getLL('pageInformation')			),			'language' => array(				0 => $LANG->getLL('m_default')			)		);			 // First, select all pages_language_overlay records on the current page. Each represents a possibility for a language on the page. Add these to language selector.		$res = $this->exec_languageQuery($this->id);		while($lrow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))	{			if ($GLOBALS['BE_USER']->checkLanguageAccess($lrow['uid']))	{				$this->MOD_MENU['language'][$lrow['uid']]=($lrow['hidden']?'('.$lrow['title'].')':$lrow['title']);			}		}			// Find if there are ANY languages at all (and if not, remove the language option from function menu).		$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid', 'sys_language', ($BE_USER->isAdmin()?'':'hidden=0'));		if (!$GLOBALS['TYPO3_DB']->sql_num_rows($res))	{			unset($this->MOD_MENU['function']['2']);		}			// page/be_user TSconfig settings and blinding of menu-items		$this->modSharedTSconfig = t3lib_BEfunc::getModTSconfig($this->id, 'mod.SHARED');		$this->modTSconfig = t3lib_BEfunc::getModTSconfig($this->id,'mod.'.$this->MCONF['name']);		if ($this->modTSconfig['properties']['QEisDefault'])	ksort($this->MOD_MENU['function']);		$this->MOD_MENU['function'] = t3lib_BEfunc::unsetMenuItems($this->modTSconfig['properties'],$this->MOD_MENU['function'],'menu.function');			// Remove QuickEdit as option if page type is not...		if (!t3lib_div::inList($TYPO3_CONF_VARS['FE']['content_doktypes'].',6',$this->pageinfo['doktype']))	{			unset($this->MOD_MENU['function'][0]);		}			// Setting alternative default label:		if (($this->modSharedTSconfig['properties']['defaultLanguageLabel'] || $this->modTSconfig['properties']['defaultLanguageLabel']) && isset($this->MOD_MENU['language'][0]))	{			$this->MOD_MENU['language'][0] = $this->modTSconfig['properties']['defaultLanguageLabel'] ? $this->modSharedTSconfig['properties']['defaultLanguageLabel'] : $this->modSharedTSconfig['properties']['defaultLanguageLabel'];		}			// Clean up settings		$this->MOD_SETTINGS = t3lib_BEfunc::getModuleData($this->MOD_MENU, t3lib_div::_GP('SET'), $this->MCONF['name']);			// For all elements to be shown in draft workspaces:		if ($GLOBALS['BE_USER']->workspace!=0)	{			$this->MOD_SETTINGS['tt_content_showHidden'] = 1;		}	}	/**	 * Clears page cache for the current id, $this->id	 *	 * @return	void	 */	function clearCache()	{		if ($this->clear_cache)	{			$tce = t3lib_div::makeInstance('t3lib_TCEmain');			$tce->stripslashes_values=0;			$tce->start(Array(),Array());			$tce->clear_cacheCmd($this->id);		}	}	/**	 * Main function.	 * Creates some general objects and calls other functions for the main rendering of module content.	 *	 * @return	void	 */	function main()	{		global $BE_USER,$LANG,$BACK_PATH;		// Access check...		// The page will show only if there is a valid page and if this page may be viewed by the user		$access = is_array($this->pageinfo) ? 1 : 0;		if ($this->id && $access)	{				// Initialize permission settings:			$this->CALC_PERMS = $BE_USER->calcPerms($this->pageinfo);			$this->EDIT_CONTENT = ($this->CALC_PERMS&16) ? 1 : 0;				// Start document template object:			$this->doc = t3lib_div::makeInstance('mediumDoc');			$this->doc->backPath = $BACK_PATH;			$this->doc->docType='xhtml_trans';				// JavaScript:			$this->doc->JScode = '<script type="text/javascript" src="'.$BACK_PATH.'../t3lib/jsfunc.updateform.js"></script>';			$this->doc->JScode.= $this->doc->wrapScriptTags('				if (top.fsMod) top.fsMod.recentIds["web"] = '.intval($this->id).';				if (top.fsMod) top.fsMod.navFrameHighlightedID["web"] = "pages'.intval($this->id).'_"+top.fsMod.currentBank; '.intval($this->id).';				function jumpToUrl(URL,formEl)	{	//					if (document.editform && TBE_EDITOR.isFormChanged)	{	// Check if the function exists... (works in all browsers?)						if (!TBE_EDITOR.isFormChanged())	{	//							window.location.href = URL;						} else if (formEl) {							if (formEl.type=="checkbox") formEl.checked = formEl.checked ? 0 : 1;						}					} else window.location.href = URL;				}			'.($this->popView ? t3lib_BEfunc::viewOnClick($this->id,$BACK_PATH,t3lib_BEfunc::BEgetRootLine($this->id)) : '').'				function deleteRecord(table,id,url)	{	//					if (confirm('.$LANG->JScharCode($LANG->getLL('deleteWarning')).'))	{						window.location.href = "'.$BACK_PATH.'tce_db.php?cmd["+table+"]["+id+"][delete]=1&redirect="+escape(url)+"&vC='.$BE_USER->veriCode().'&prErr=1&uPT=1";					}					return false;				}			');				// Setting doc-header			$this->doc->form='<form action="'.htmlspecialchars('db_layout.php?id='.$this->id.'&imagemode='.$this->imagemode).'" method="post">';				// Creating the top function menu:			$this->topFuncMenu = t3lib_BEfunc::getFuncMenu($this->id,'SET[function]',$this->MOD_SETTINGS['function'],$this->MOD_MENU['function'],'db_layout.php','').						(count($this->MOD_MENU['language'])>1 ? '<br />'.t3lib_BEfunc::getFuncMenu($this->id,'SET[language]',$this->current_sys_language,$this->MOD_MENU['language'],'db_layout.php','') : '');				// Creating the top edit page icon:			if ($this->CALC_PERMS&2)	{				$params='&edit[pages]['.$this->id.']=edit';				$this->editIcon='<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::editOnClick($params,$BACK_PATH)).'"><img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/edit2.gif','width="11" height="12"').' vspace="2" align="top" title="'.$LANG->getLL('editPageProperties',1).'" alt="" /></a>';			} else {				$this->editIcon='';			}				// Find columns			$modTSconfig_SHARED = t3lib_BEfunc::getModTSconfig($this->id,'mod.SHARED');		// SHARED page-TSconfig settings.			$this->colPosList = strcmp(trim($this->modTSconfig['properties']['tt_content.']['colPos_list']),'') ? trim($this->modTSconfig['properties']['tt_content.']['colPos_list']) : $modTSconfig_SHARED['properties']['colPos_list'];			$this->colPosList = strcmp($this->colPosList,'')?$this->colPosList:'1,0,2,3';			$this->colPosList = implode(',',array_unique(t3lib_div::intExplode(',',$this->colPosList)));		// Removing duplicates, if any				// Render the primary module content:			if ($this->MOD_SETTINGS['function']==0)	{				$this->renderQuickEdit();	// QuickEdit			} else {				$this->renderListContent();	// All other listings			}				// ShortCut			if ($BE_USER->mayMakeShortcut())	{				$this->content.=$this->doc->spacer(20).$this->doc->section('',$this->doc->makeShortcutIcon('id,edit_record,pointer,new_unique_uid,search_field,search_levels,showLimit',implode(',',array_keys($this->MOD_MENU)),$this->MCONF['name']));			}				// Ending page:			$this->content.=$this->doc->spacer(10);			$this->content.=$this->doc->endPage();		} else {				// If no access or id value, create empty document:			$this->doc = t3lib_div::makeInstance('mediumDoc');			$this->doc->docType='xhtml_trans';			$this->doc->backPath = $BACK_PATH;			$this->doc->JScode = $this->doc->wrapScriptTags('				if (top.fsMod) top.fsMod.recentIds["web"] = '.intval($this->id).';			');			$this->content=$this->doc->startPage($LANG->getLL('title'));			$this->content.=$this->doc->section($LANG->getLL('clickAPage_header'),$LANG->getLL('clickAPage_content'),0,1);			$this->content.= t3lib_BEfunc::cshItem($this->descrTable,'',$BACK_PATH,'<br/><br/>');			$this->content.=$this->doc->endPage();		}	}	/**	 * Rendering the quick-edit view.	 *	 * @return	void	 */	function renderQuickEdit()	{		global $LANG,$BE_USER,$BACK_PATH;			// Alternative form tag; Quick Edit submits its content to tce_db.php.		$this->doc->form='<form action="'.htmlspecialchars($BACK_PATH.'tce_db.php?&prErr=1&uPT=1').'" method="post" enctype="'.$GLOBALS['TYPO3_CONF_VARS']['SYS']['form_enctype'].'" name="editform" onsubmit="return TBE_EDITOR.checkSubmit(1);">';			// Setting up the context sensitive menu:		$CMparts = $this->doc->getContextMenuCode();		$this->doc->JScode.= $CMparts[0];		$this->doc->bodyTagAdditions = $CMparts[1];		$this->doc->postCode.= $CMparts[2];			// Set the edit_record value for internal use in this function:		$edit_record = $this->edit_record;			// If a command to edit all records in a column is issue, then select all those elements, and redirect to alt_doc.php:		if (substr($edit_record,0,9)=='_EDIT_COL')	{			$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(						'*',						'tt_content',						'pid='.intval($this->id).' AND colPos='.intval(substr($edit_record,10)).' AND sys_language_uid='.intval($this->current_sys_language).								($this->MOD_SETTINGS['tt_content_showHidden'] ? '' : t3lib_BEfunc::BEenableFields('tt_content')).								t3lib_BEfunc::deleteClause('tt_content').								t3lib_BEfunc::versioningPlaceholderClause('tt_content'),						'',						'sorting'					);			$idListA = array();			while($cRow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))	{				$idListA[] = $cRow['uid'];			}			$url = $BACK_PATH.'alt_doc.php?edit[tt_content]['.implode(',',$idListA).']=edit&returnUrl='.rawurlencode($this->local_linkThisScript(array('edit_record'=>'')));			header('Location: '.t3lib_div::locationHeaderUrl($url));			exit;		}			// If the former record edited was the creation of a NEW record, this will look up the created records uid:		if ($this->new_unique_uid)	{			$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'sys_log', 'userid='.intval($BE_USER->user['uid']).' AND NEWid='.$GLOBALS['TYPO3_DB']->fullQuoteStr($this->new_unique_uid, 'sys_log'));			$sys_log_row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);			if (is_array($sys_log_row))	{				$edit_record=$sys_log_row['tablename'].':'.$sys_log_row['recuid'];			}		}			// Creating the selector box, allowing the user to select which element to edit:		$opt=array();		$is_selected=0;		$languageOverlayRecord='';		if ($this->current_sys_language)	{			list($languageOverlayRecord) = t3lib_BEfunc::getRecordsByField('pages_language_overlay','pid',$this->id,'AND sys_language_uid='.intval($this->current_sys_language));		}		if (is_array($languageOverlayRecord))	{			$inValue = 'pages_language_overlay:'.$languageOverlayRecord['uid'];			$is_selected+=intval($edit_record==$inValue);			$opt[]='<option value="'.$inValue.'"'.($edit_record==$inValue?' selected="selected"':'').'>[ '.$LANG->getLL('editLanguageHeader',1).' ]</option>';		} else {			$inValue = 'pages:'.$this->id;			$is_selected+=intval($edit_record==$inValue);			$opt[]='<option value="'.$inValue.'"'.($edit_record==$inValue?' selected="selected"':'').'>[ '.$LANG->getLL('editPageProperties',1).' ]</option>';		}			// Selecting all content elements from this language and allowed colPos:		$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(					'*',					'tt_content',					'pid='.intval($this->id).' AND sys_language_uid='.intval($this->current_sys_language).' AND colPos IN ('.$this->colPosList.')'.							($this->MOD_SETTINGS['tt_content_showHidden'] ? '' : t3lib_BEfunc::BEenableFields('tt_content')).							t3lib_Befunc::deleteClause('tt_content').							t3lib_BEfunc::versioningPlaceholderClause('tt_content'),					'',					'colPos,sorting'				);		$colPos='';		$first=1;		$prev=$this->id;	// Page is the pid if no record to put this after.		while($cRow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))	{			t3lib_BEfunc::workspaceOL('tt_content', $cRow);			if ($first)	{				if (!$edit_record)	{					$edit_record='tt_content:'.$cRow['uid'];				}				$first = 0;			}			if (strcmp($cRow['colPos'],$colPos))	{				$colPos=$cRow['colPos'];				$opt[]='<option value=""></option>';				$opt[]='<option value="_EDIT_COL:'.$colPos.'">__'.$LANG->sL(t3lib_BEfunc::getLabelFromItemlist('tt_content','colPos',$colPos),1).':__</option>';			}			$inValue = 'tt_content:'.$cRow['uid'];			$is_selected+=intval($edit_record==$inValue);			$opt[]='<option value="'.$inValue.'"'.($edit_record==$inValue?' selected="selected"':'').'>'.htmlspecialchars(t3lib_div::fixed_lgd_cs($cRow['header']?$cRow['header']:'['.$LANG->sL('LLL:EXT:lang/locallang_core.php:labels.no_title').'] '.strip_tags($cRow['bodytext']),$BE_USER->uc['titleLen'])).'</option>';			$prev=-$cRow['uid'];		}			// If edit_record is not set (meaning, no content elements was found for this language) we simply set it to create a new element:		if (!$edit_record)	{			$edit_record='tt_content:new/'.$prev.'/'.$colPos;			$inValue = 'tt_content:new/'.$prev.'/'.$colPos;			$is_selected+=intval($edit_record==$inValue);			$opt[]='<option value="'.$inValue.'"'.($edit_record==$inValue?' selected="selected"':'').'>[ '.$LANG->getLL('newLabel',1).' ]</option>';		}			// If none is yet selected...		if (!$is_selected)	{			$opt[]='<option value=""></option>';			$opt[]='<option value="'.$edit_record.'"  selected="selected">[ '.$LANG->getLL('newLabel',1).' ]</option>';		}			// Splitting the edit-record cmd value into table/uid:		$eRParts = explode(':',$edit_record);			// Delete-button flag?		$deleteButton = (t3lib_div::testInt($eRParts[1]) && $edit_record && (($eRParts[0]!='pages'&&$this->EDIT_CONTENT) || ($eRParts[0]=='pages'&&($this->CALC_PERMS&4))));			// If undo-button should be rendered (depends on available items in sys_history)		$undoButton=0;		$undoRes = $GLOBALS['TYPO3_DB']->exec_SELECTquery('tstamp', 'sys_history', 'tablename='.$GLOBALS['TYPO3_DB']->fullQuoteStr($eRParts[0], 'sys_history').' AND recuid='.intval($eRParts[1]), '', 'tstamp DESC', '1');		if ($undoButtonR = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($undoRes))	{			$undoButton=1;		}			// Setting up the Return URL for coming back to THIS script (if links take the user to another script)		$R_URL_parts = parse_url(t3lib_div::getIndpEnv('REQUEST_URI'));		$R_URL_getvars = t3lib_div::_GET();		unset($R_URL_getvars['popView']);		unset($R_URL_getvars['new_unique_uid']);		$R_URL_getvars['edit_record']=$edit_record;		$R_URI = $R_URL_parts['path'].'?'.t3lib_div::implodeArrayForUrl('',$R_URL_getvars);			// Setting close url/return url for exiting this script:		$closeUrl = $this->local_linkThisScript(array('SET'=>array('function'=>1)));	// Goes to 'Columns' view if close is pressed (default)		if ($BE_USER->uc['condensedMode'])	{			$closeUrl = $BACK_PATH.'alt_db_navframe.php';		}		if ($this->returnUrl)	{			$closeUrl = $this->returnUrl;		}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -