Project

General

Profile

Bug #22410 » 14050_cleaning_t3lib_befunc.patch

Administrator Admin, 2010-11-24 00:31

View differences:

t3lib/class.t3lib_befunc.php (revision )
<?php
/***************************************************************
* Copyright notice
*
* (c) 1999-2010 Kasper Sk?rh?j (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!
***************************************************************/
* Copyright notice
*
* (c) 1999-2010 Kasper Sk?rh?j (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!
***************************************************************/
/**
* Standard functions available for the TYPO3 backend.
* You are encouraged to use this class in your own applications (Backend Modules)
......
*
* 185: class t3lib_BEfunc
*
* SECTION: SQL-related, selecting records, searching
* SECTION: SQL-related, selecting records, searching
* 206: function deleteClause($table,$tableAlias='')
* 206: function deleteClause($table,$tableAlias='')
* 230: function getRecord($table,$uid,$fields='*',$where='',$useDeleteClause=true)
* 230: function getRecord($table,$uid,$fields='*',$where='',$useDeleteClause=true)
* 253: function getRecordWSOL($table,$uid,$fields='*',$where='',$useDeleteClause=true)
* 253: function getRecordWSOL($table,$uid,$fields='*',$where='',$useDeleteClause=true)
* 286: function getRecordRaw($table,$where='',$fields='*')
* 286: function getRecordRaw($table,$where='',$fields='*')
* 309: function getRecordsByField($theTable,$theField,$theValue,$whereClause='',$groupBy='',$orderBy='',$limit='',$useDeleteClause=true)
* 309: function getRecordsByField($theTable,$theField,$theValue,$whereClause='',$groupBy='',$orderBy='',$limit='',$useDeleteClause=true)
* 342: function searchQuery($searchWords,$fields,$table='')
* 342: function searchQuery($searchWords,$fields,$table='')
* 357: function listQuery($field,$value)
* 357: function listQuery($field,$value)
* 369: function splitTable_Uid($str)
* 369: function splitTable_Uid($str)
* 384: function getSQLselectableList($in_list,$tablename,$default_tablename)
* 384: function getSQLselectableList($in_list,$tablename,$default_tablename)
* 412: function BEenableFields($table,$inv=0)
* 412: function BEenableFields($table,$inv=0)
*
* SECTION: SQL-related, DEPRECATED functions
* SECTION: SQL-related, DEPRECATED functions
* 476: function mm_query($select,$local_table,$mm_table,$foreign_table,$whereClause='',$groupBy='',$orderBy='',$limit='')
* 476: function mm_query($select,$local_table,$mm_table,$foreign_table,$whereClause='',$groupBy='',$orderBy='',$limit='')
* 498: function DBcompileInsert($table,$fields_values)
* 498: function DBcompileInsert($table,$fields_values)
* 512: function DBcompileUpdate($table,$where,$fields_values)
* 512: function DBcompileUpdate($table,$where,$fields_values)
*
* SECTION: Page tree, TCA related
* SECTION: Page tree, TCA related
* 542: function BEgetRootLine($uid,$clause='',$workspaceOL=FALSE)
* 542: function BEgetRootLine($uid,$clause='',$workspaceOL=FALSE)
* 598: function openPageTree($pid,$clearExpansion)
* 598: function openPageTree($pid,$clearExpansion)
* 643: function getRecordPath($uid, $clause, $titleLimit, $fullTitleLimit=0)
* 643: function getRecordPath($uid, $clause, $titleLimit, $fullTitleLimit=0)
* 686: function getExcludeFields()
* 686: function getExcludeFields()
* 716: function getExplicitAuthFieldValues()
* 716: function getExplicitAuthFieldValues()
* 787: function getSystemLanguages()
* 787: function getSystemLanguages()
* 812: function readPageAccess($id,$perms_clause)
* 812: function readPageAccess($id,$perms_clause)
* 843: function getTCAtypes($table,$rec,$useFieldNameAsKey=0)
* 843: function getTCAtypes($table,$rec,$useFieldNameAsKey=0)
* 896: function getTCAtypeValue($table,$rec)
* 896: function getTCAtypeValue($table,$rec)
* 919: function getSpecConfParts($str, $defaultExtras)
* 919: function getSpecConfParts($str, $defaultExtras)
* 950: function getSpecConfParametersFromArray($pArr)
* 950: function getSpecConfParametersFromArray($pArr)
* 978: function getFlexFormDS($conf,$row,$table,$fieldName='',$WSOL=TRUE)
* 978: function getFlexFormDS($conf,$row,$table,$fieldName='',$WSOL=TRUE)
*
* SECTION: Caching related
* SECTION: Caching related
* 1105: function storeHash($hash,$data,$ident)
* 1105: function storeHash($hash,$data,$ident)
* 1125: function getHash($hash)
* 1125: function getHash($hash)
*
* SECTION: TypoScript related
* SECTION: TypoScript related
* 1161: function getPagesTSconfig($id,$rootLine='',$returnPartArray=0)
* 1161: function getPagesTSconfig($id,$rootLine='',$returnPartArray=0)
* 1217: function updatePagesTSconfig($id,$pageTS,$TSconfPrefix,$impParams='')
* 1217: function updatePagesTSconfig($id,$pageTS,$TSconfPrefix,$impParams='')
* 1272: function implodeTSParams($p,$k='')
* 1272: function implodeTSParams($p,$k='')
*
* SECTION: Users / Groups related
* SECTION: Users / Groups related
* 1309: function getUserNames($fields='username,usergroup,usergroup_cached_list,uid',$where='')
* 1309: function getUserNames($fields='username,usergroup,usergroup_cached_list,uid',$where='')
* 1327: function getGroupNames($fields='title,uid', $where='')
* 1327: function getGroupNames($fields='title,uid', $where='')
* 1344: function getListGroupNames($fields='title,uid')
* 1344: function getListGroupNames($fields='title,uid')
* 1363: function blindUserNames($usernames,$groupArray,$excludeBlindedFlag=0)
* 1363: function blindUserNames($usernames,$groupArray,$excludeBlindedFlag=0)
* 1396: function blindGroupNames($groups,$groupArray,$excludeBlindedFlag=0)
* 1396: function blindGroupNames($groups,$groupArray,$excludeBlindedFlag=0)
*
* SECTION: Output related
* SECTION: Output related
* 1437: function daysUntil($tstamp)
* 1437: function daysUntil($tstamp)
* 1449: function date($tstamp)
* 1449: function date($tstamp)
* 1460: function datetime($value)
* 1460: function datetime($value)
* 1472: function time($value)
* 1472: function time($value)
* 1488: function calcAge($seconds,$labels = 'min|hrs|days|yrs')
* 1488: function calcAge($seconds,$labels = 'min|hrs|days|yrs')
* 1514: function dateTimeAge($tstamp,$prefix=1,$date='')
* 1514: function dateTimeAge($tstamp,$prefix=1,$date='')
* 1532: function titleAttrib($content='',$hsc=0)
* 1532: function titleAttrib($content='',$hsc=0)
* 1545: function titleAltAttrib($content)
* 1545: function titleAltAttrib($content)
* 1569: function thumbCode($row,$table,$field,$backPath,$thumbScript='',$uploaddir=NULL,$abs=0,$tparams='',$size='')
* 1569: function thumbCode($row,$table,$field,$backPath,$thumbScript='',$uploaddir=NULL,$abs=0,$tparams='',$size='')
* 1637: function getThumbNail($thumbScript,$theFile,$tparams='',$size='')
* 1637: function getThumbNail($thumbScript,$theFile,$tparams='',$size='')
* 1654: function titleAttribForPages($row,$perms_clause='',$includeAttrib=1)
* 1654: function titleAttribForPages($row,$perms_clause='',$includeAttrib=1)
* 1716: function getRecordIconAltText($row,$table='pages')
* 1716: function getRecordIconAltText($row,$table='pages')
* 1758: function getLabelFromItemlist($table,$col,$key)
* 1758: function getLabelFromItemlist($table,$col,$key)
* 1784: function getItemLabel($table,$col,$printAllWrap='')
* 1784: function getItemLabel($table,$col,$printAllWrap='')
* 1809: function getRecordTitle($table,$row,$prep=0)
* 1809: function getRecordTitle($table,$row,$prep=0)
* 1847: function getProcessedValue($table,$col,$value,$fixed_lgd_chars=0,$defaultPassthrough=0,$noRecordLookup=FALSE,$uid=0)
* 1847: function getProcessedValue($table,$col,$value,$fixed_lgd_chars=0,$defaultPassthrough=0,$noRecordLookup=FALSE,$uid=0)
* 2009: function getProcessedValueExtra($table,$fN,$fV,$fixed_lgd_chars=0,$uid=0)
* 2009: function getProcessedValueExtra($table,$fN,$fV,$fixed_lgd_chars=0,$uid=0)
* 2033: function getFileIcon($ext)
* 2033: function getFileIcon($ext)
* 2047: function getCommonSelectFields($table,$prefix='')
* 2047: function getCommonSelectFields($table,$prefix='')
* 2090: function makeConfigForm($configArray,$defaults,$dataPrefix)
* 2090: function makeConfigForm($configArray,$defaults,$dataPrefix)
*
* SECTION: Backend Modules API functions
* SECTION: Backend Modules API functions
* 2165: function helpTextIcon($table,$field,$BACK_PATH,$force=0)
* 2165: function helpTextIcon($table,$field,$BACK_PATH,$force=0)
* 2187: function helpText($table,$field,$BACK_PATH,$styleAttrib='')
* 2187: function helpText($table,$field,$BACK_PATH,$styleAttrib='')
* 2239: function cshItem($table,$field,$BACK_PATH,$wrap='',$onlyIconMode=FALSE, $styleAttrib='')
* 2239: function cshItem($table,$field,$BACK_PATH,$wrap='',$onlyIconMode=FALSE, $styleAttrib='')
* 2277: function editOnClick($params,$backPath='',$requestUri='')
* 2277: function editOnClick($params,$backPath='',$requestUri='')
* 2296: function viewOnClick($id,$backPath='',$rootLine='',$anchor='',$altUrl='',$additionalGetVars='',$switchFocus=TRUE)
* 2296: function viewOnClick($id,$backPath='',$rootLine='',$anchor='',$altUrl='',$additionalGetVars='',$switchFocus=TRUE)
* 2328: function getModTSconfig($id,$TSref)
* 2328: function getModTSconfig($id,$TSref)
* 2349: function getFuncMenu($mainParams,$elementName,$currentValue,$menuItems,$script='',$addparams='')
* 2349: function getFuncMenu($mainParams,$elementName,$currentValue,$menuItems,$script='',$addparams='')
* 2392: function getFuncCheck($mainParams,$elementName,$currentValue,$script='',$addparams='',$tagParams='')
* 2392: function getFuncCheck($mainParams,$elementName,$currentValue,$script='',$addparams='',$tagParams='')
* 2417: function getFuncInput($mainParams,$elementName,$currentValue,$size=10,$script="",$addparams="")
* 2417: function getFuncInput($mainParams,$elementName,$currentValue,$size=10,$script="",$addparams="")
* 2438: function unsetMenuItems($modTSconfig,$itemArray,$TSref)
* 2438: function unsetMenuItems($modTSconfig,$itemArray,$TSref)
* 2461: function getSetUpdateSignal($set='')
* 2461: function getSetUpdateSignal($set='')
* 2512: function getModuleData($MOD_MENU, $CHANGED_SETTINGS, $modName, $type='', $dontValidateList='', $setDefaultList='')
* 2512: function getModuleData($MOD_MENU, $CHANGED_SETTINGS, $modName, $type='', $dontValidateList='', $setDefaultList='')
*
* SECTION: Core
* SECTION: Core
* 2585: function compilePreviewKeyword($getVarsStr, $beUserUid, $ttl=172800)
* 2585: function compilePreviewKeyword($getVarsStr, $beUserUid, $ttl=172800)
* 2613: function lockRecords($table='',$uid=0,$pid=0)
* 2613: function lockRecords($table='',$uid=0,$pid=0)
* 2642: function isRecordLocked($table,$uid)
* 2642: function isRecordLocked($table,$uid)
* 2682: function exec_foreign_table_where_query($fieldValue,$field='',$TSconfig=array(),$prefix='')
* 2682: function exec_foreign_table_where_query($fieldValue,$field='',$TSconfig=array(),$prefix='')
* 2763: function getTCEFORM_TSconfig($table,$row)
* 2763: function getTCEFORM_TSconfig($table,$row)
* 2814: function getTSconfig_pidValue($table,$uid,$pid)
* 2814: function getTSconfig_pidValue($table,$uid,$pid)
* 2844: function getPidForModTSconfig($table,$uid,$pid)
* 2844: function getPidForModTSconfig($table,$uid,$pid)
* 2860: function getTSCpid($table,$uid,$pid)
* 2860: function getTSCpid($table,$uid,$pid)
* 2876: function firstDomainRecord($rootLine)
* 2876: function firstDomainRecord($rootLine)
* 2898: function getDomainStartPage($domain, $path='')
* 2898: function getDomainStartPage($domain, $path='')
* 2928: function RTEsetup($RTEprop,$table,$field,$type='')
* 2928: function RTEsetup($RTEprop,$table,$field,$type='')
* 2947: function &RTEgetObj()
* 2947: function &RTEgetObj()
* 2986: function &softRefParserObj($spKey)
* 2986: function &softRefParserObj($spKey)
* 3018: function explodeSoftRefParserList($parserList)
* 3018: function explodeSoftRefParserList($parserList)
* 3050: function isModuleSetInTBE_MODULES($modName)
* 3050: function isModuleSetInTBE_MODULES($modName)
* 3073: function referenceCount($table,$ref,$msg='')
* 3073: function referenceCount($table,$ref,$msg='')
*
* SECTION: Workspaces / Versioning
* SECTION: Workspaces / Versioning
* 3132: function selectVersionsOfRecord($table, $uid, $fields='*', $workspace=0)
* 3132: function selectVersionsOfRecord($table, $uid, $fields='*', $workspace=0)
* 3180: function fixVersioningPid($table,&$rr,$ignoreWorkspaceMatch=FALSE)
* 3180: function fixVersioningPid($table,&$rr,$ignoreWorkspaceMatch=FALSE)
* 3220: function workspaceOL($table,&$row,$wsid=-99)
* 3220: function workspaceOL($table,&$row,$wsid=-99)
* 3268: function getWorkspaceVersionOfRecord($workspace, $table, $uid, $fields='*')
* 3268: function getWorkspaceVersionOfRecord($workspace, $table, $uid, $fields='*')
* 3297: function getLiveVersionOfRecord($table,$uid,$fields='*')
* 3297: function getLiveVersionOfRecord($table,$uid,$fields='*')
* 3319: function isPidInVersionizedBranch($pid, $table='',$returnStage=FALSE)
* 3319: function isPidInVersionizedBranch($pid, $table='',$returnStage=FALSE)
* 3342: function versioningPlaceholderClause($table)
* 3342: function versioningPlaceholderClause($table)
* 3356: function countVersionsOfRecordsOnPage($workspace,$pageId, $allTables=FALSE)
* 3356: function countVersionsOfRecordsOnPage($workspace,$pageId, $allTables=FALSE)
* 3391: function wsMapId($table,$uid)
* 3391: function wsMapId($table,$uid)
*
* SECTION: Miscellaneous
* SECTION: Miscellaneous
* 3421: function typo3PrintError($header,$text,$js='',$head=1)
* 3421: function typo3PrintError($header,$text,$js='',$head=1)
* 3465: function TYPO3_copyRightNotice()
* 3465: function TYPO3_copyRightNotice()
* 3489: function displayWarningMessages()
* 3489: function displayWarningMessages()
* 3546: function getPathType_web_nonweb($path)
* 3546: function getPathType_web_nonweb($path)
* 3558: function ADMCMD_previewCmds($pageinfo)
* 3558: function ADMCMD_previewCmds($pageinfo)
* 3580: function processParams($params)
* 3580: function processParams($params)
* 3606: function getListOfBackendModules($name,$perms_clause,$backPath='',$script='index.php')
* 3606: function getListOfBackendModules($name,$perms_clause,$backPath='',$script='index.php')
*
* TOTAL FUNCTIONS: 99
* (This index is automatically created/updated by the extension "extdeveval")
......
*/
/**
* Standard functions available for the TYPO3 backend.
* Don't instantiate - call functions with "t3lib_BEfunc::" prefixed the function name.
......
final class t3lib_BEfunc {
/*******************************************
*
* SQL-related, selecting records, searching
......
* @param string Table alias if any
* @return string WHERE clause for filtering out deleted records, eg " AND tablename.deleted=0"
*/
public static function deleteClause($table,$tableAlias = '') {
public static function deleteClause($table, $tableAlias = '') {
global $TCA;
if ($TCA[$table]['ctrl']['delete']) {
return ' AND '.($tableAlias ? $tableAlias : $table).'.'.$TCA[$table]['ctrl']['delete'].'=0';
return ' AND ' . ($tableAlias ? $tableAlias : $table) . '.' . $TCA[$table]['ctrl']['delete'] . '=0';
} else {
return '';
}
......
* @param boolean Use the deleteClause to check if a record is deleted (default true)
* @return array Returns the row if found, otherwise nothing
*/
public static function getRecord($table, $uid, $fields = '*', $where = '', $useDeleteClause = true) {
public static function getRecord($table, $uid, $fields = '*', $where = '', $useDeleteClause = TRUE) {
if ($GLOBALS['TCA'][$table]) {
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
$fields,
$table,
'uid=' . intval($uid) . ($useDeleteClause ? self::deleteClause($table) : '') . $where
'uid=' . intval($uid) . ($useDeleteClause ? self::deleteClause($table) : '') . $where
);
$row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
$GLOBALS['TYPO3_DB']->sql_free_result($res);
......
* @param boolean Use the deleteClause to check if a record is deleted (default true)
* @return array Returns the row if found, otherwise nothing
*/
public static function getRecordWSOL($table, $uid, $fields = '*', $where = '', $useDeleteClause = true) {
public static function getRecordWSOL($table, $uid, $fields = '*', $where = '', $useDeleteClause = TRUE) {
if ($fields !== '*') {
$internalFields = t3lib_div::uniqueList($fields.',uid,pid'.($table == 'pages' ? ',t3ver_swapmode' : ''));
$internalFields = t3lib_div::uniqueList($fields . ',uid,pid' . ($table == 'pages' ? ',t3ver_swapmode' : ''));
$row = self::getRecord($table, $uid, $internalFields, $where, $useDeleteClause);
self::workspaceOL($table, $row);
if (is_array ($row)) {
if (is_array($row)) {
foreach (array_keys($row) as $key) {
if (!t3lib_div::inList($fields, $key) && $key{0} !== '_') {
unset ($row[$key]);
......
* @param boolean Use the deleteClause to check if a record is deleted (default true)
* @return mixed Multidimensional array with selected records (if any is selected)
*/
public static function getRecordsByField($theTable, $theField, $theValue, $whereClause = '', $groupBy = '', $orderBy = '', $limit = '', $useDeleteClause = true) {
public static function getRecordsByField($theTable, $theField, $theValue, $whereClause = '', $groupBy = '', $orderBy = '', $limit = '', $useDeleteClause = TRUE) {
global $TCA;
if (is_array($TCA[$theTable])) {
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
'*',
$theTable,
'*',
$theTable,
$theField.'='.$GLOBALS['TYPO3_DB']->fullQuoteStr($theValue, $theTable).
$theField . '=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($theValue, $theTable) .
($useDeleteClause ? self::deleteClause($theTable).' ' : '').
($useDeleteClause ? self::deleteClause($theTable) . ' ' : '') .
self::versioningPlaceholderClause($theTable) . ' ' .
$whereClause, // whereClauseMightContainGroupOrderBy
$whereClause, // whereClauseMightContainGroupOrderBy
$groupBy,
$orderBy,
$limit
);
$groupBy,
$orderBy,
$limit
);
$rows = array();
while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
$rows[] = $row;
}
$GLOBALS['TYPO3_DB']->sql_free_result($res);
if (count($rows)) return $rows;
if (count($rows)) {
return $rows;
}
}
}
}
}
/**
* Returns a WHERE clause which will make an AND search for the words in the $searchWords array in any of the fields in array $fields.
......
*/
public static function getSQLselectableList($in_list, $tablename, $default_tablename) {
$list = Array();
if ((string)trim($in_list)!='') {
if ((string) trim($in_list) != '') {
$tempItemArray = explode(',', trim($in_list));
foreach ($tempItemArray as $key => $val) {
$val = strrev($val);
$parts = explode('_', $val, 2);
if ((string)trim($parts[0])!='') {
if ((string) trim($parts[0]) != '') {
$theID = intval(strrev($parts[0]));
$theTable = trim($parts[1]) ? strrev(trim($parts[1])) : $default_tablename;
if ($theTable==$tablename) {$list[] = $theID;}
if ($theTable == $tablename) {
$list[] = $theID;
}
}
}
}
}
}
}
return implode(',', $list);
}
......
if (is_array($ctrl)) {
if (is_array($ctrl['enablecolumns'])) {
if ($ctrl['enablecolumns']['disabled']) {
$field = $table.'.'.$ctrl['enablecolumns']['disabled'];
$field = $table . '.' . $ctrl['enablecolumns']['disabled'];
$query[] = $field.'=0';
$query[] = $field . '=0';
$invQuery[] = $field.'!=0';
$invQuery[] = $field . '!=0';
}
if ($ctrl['enablecolumns']['starttime']) {
$field = $table.'.'.$ctrl['enablecolumns']['starttime'];
$field = $table . '.' . $ctrl['enablecolumns']['starttime'];
$query[] = '('.$field.'<='.$GLOBALS['SIM_ACCESS_TIME'].')';
$query[] = '(' . $field . '<=' . $GLOBALS['SIM_ACCESS_TIME'] . ')';
$invQuery[] = '('.$field.'!=0 AND '.$field.'>'.$GLOBALS['SIM_ACCESS_TIME'].')';
$invQuery[] = '(' . $field . '!=0 AND ' . $field . '>' . $GLOBALS['SIM_ACCESS_TIME'] . ')';
}
if ($ctrl['enablecolumns']['endtime']) {
$field = $table.'.'.$ctrl['enablecolumns']['endtime'];
$field = $table . '.' . $ctrl['enablecolumns']['endtime'];
$query[] = '('.$field.'=0 OR '.$field.'>'.$GLOBALS['SIM_ACCESS_TIME'].')';
$query[] = '(' . $field . '=0 OR ' . $field . '>' . $GLOBALS['SIM_ACCESS_TIME'] . ')';
$invQuery[] = '('.$field.'!=0 AND '.$field.'<='.$GLOBALS['SIM_ACCESS_TIME'].')';
$invQuery[] = '(' . $field . '!=0 AND ' . $field . '<=' . $GLOBALS['SIM_ACCESS_TIME'] . ')';
}
}
}
......
* @return mixed Multidimensional array with selected records; if none exist, false is returned
*/
public static function getRecordLocalization($table, $uid, $language, $andWhereClause = '') {
$recordLocalization = false;
$recordLocalization = FALSE;
if (self::isTableLocalizable($table)) {
$tcaCtrl = $GLOBALS['TCA'][$table]['ctrl'];
$recordLocalization = self::getRecordsByField(
$table,
$tcaCtrl['transOrigPointerField'],
$uid,
'AND '.$tcaCtrl['languageField'].'='.intval($language).($andWhereClause ? ' '.$andWhereClause : ''),
'AND ' . $tcaCtrl['languageField'] . '=' . intval($language) . ($andWhereClause ? ' ' . $andWhereClause : ''),
'',
'',
'1'
......
}
/*******************************************
*
* SQL-related, DEPRECATED functions
......
t3lib_div::logDeprecatedFunction();
$query = $GLOBALS['TYPO3_DB']->SELECTquery(
$select,
$select,
$local_table.','.$mm_table.($foreign_table?','.$foreign_table:''),
$local_table . ',' . $mm_table . ($foreign_table ? ',' . $foreign_table : ''),
$local_table.'.uid='.$mm_table.'.uid_local'.($foreign_table?' AND '.$foreign_table.'.uid='.$mm_table.'.uid_foreign':'').' '.
$local_table . '.uid=' . $mm_table . '.uid_local' . ($foreign_table ? ' AND ' . $foreign_table . '.uid=' . $mm_table . '.uid_foreign' : '') . ' ' .
$whereClause, // whereClauseMightContainGroupOrderBy
$whereClause, // whereClauseMightContainGroupOrderBy
$groupBy,
$orderBy,
$limit
);
$groupBy,
$orderBy,
$limit
);
return $query;
}
......
}
/*******************************************
*
* Page tree, TCA related
......
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
'pid,uid,title,TSconfig,is_siteroot,storage_pid,t3ver_oid,t3ver_wsid,t3ver_state,t3ver_swapmode,t3ver_stage,be_layout',
'pages',
'uid=' . intval($uid) . ' ' .
self::deleteClause('pages') . ' ' .
'uid=' . intval($uid) . ' ' .
self::deleteClause('pages') . ' ' .
$clause // whereClauseMightContainGroupOrderBy
$clause // whereClauseMightContainGroupOrderBy
);
$row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
......
// First, find out what mount index to use (if more than one DB mount exists):
$mountIndex = 0;
$mountKeys = array_flip($BE_USER->returnWebmounts());
foreach($rL as $rLDat) {
foreach ($rL as $rLDat) {
if (isset($mountKeys[$rLDat['uid']])) {
$mountIndex = $mountKeys[$rLDat['uid']];
break;
......
}
// Traverse rootline and open paths:
foreach($rL as $rLDat) {
foreach ($rL as $rLDat) {
$expandedPages[$mountIndex][$rLDat['uid']] = 1;
}
......
* @return mixed Path of record (string) OR array with short/long title if $fullTitleLimit is set.
*/
public static function getRecordPath($uid, $clause, $titleLimit, $fullTitleLimit = 0) {
if (!$titleLimit) { $titleLimit = 1000; }
if (!$titleLimit) {
$titleLimit = 1000;
}
$loopCheck = 100;
$output = $fullOutput = '/';
......
if ($record['uid'] === 0) {
continue;
}
if ($record['_ORIG_pid'] && $record['t3ver_swapmode'] > 0) { // Branch points
if ($record['_ORIG_pid'] && $record['t3ver_swapmode'] > 0) { // Branch points
$output = ' [#VEP#]' . $output; // Adding visual token - Versioning Entry Point - that tells that THIS position was where the versionized branch got connected to the main tree. I will have to find a better name or something...
$output = ' [#VEP#]' . $output; // Adding visual token - Versioning Entry Point - that tells that THIS position was where the versionized branch got connected to the main tree. I will have to find a better name or something...
}
$output = '/' . t3lib_div::fixed_lgd_cs(strip_tags($record['title']), $titleLimit) . $output;
if ($fullTitleLimit) {
......
// All TCA keys:
$theExcludeArray = Array();
$tc_keys = array_keys($TCA);
foreach($tc_keys as $table) {
foreach ($tc_keys as $table) {
// Load table
t3lib_div::loadTCA($table);
// All field names configured:
if (is_array($TCA[$table]['columns'])) {
$f_keys = array_keys($TCA[$table]['columns']);
foreach($f_keys as $field) {
foreach ($f_keys as $field) {
if ($TCA[$table]['columns'][$field]['exclude']) {
// Get Human Readable names of fields and table:
$Fname = $GLOBALS['LANG']->sl($TCA[$table]['ctrl']['title']).': '.$GLOBALS['LANG']->sl($TCA[$table]['columns'][$field]['label']);
$Fname = $GLOBALS['LANG']->sl($TCA[$table]['ctrl']['title']) . ': ' . $GLOBALS['LANG']->sl($TCA[$table]['columns'][$field]['label']);
// add entry:
$theExcludeArray[] = Array($Fname, $table.':'.$field);
$theExcludeArray[] = Array($Fname, $table . ':' . $field);
}
}
}
......
// All TCA keys:
$allowDenyOptions = Array();
$tc_keys = array_keys($TCA);
foreach($tc_keys as $table) {
foreach ($tc_keys as $table) {
// Load table
t3lib_div::loadTCA($table);
......
// All field names configured:
if (is_array($TCA[$table]['columns'])) {
$f_keys = array_keys($TCA[$table]['columns']);
foreach($f_keys as $field) {
foreach ($f_keys as $field) {
$fCfg = $TCA[$table]['columns'][$field]['config'];
if ($fCfg['type']=='select' && $fCfg['authMode']) {
if ($fCfg['type'] == 'select' && $fCfg['authMode']) {
// Check for items:
if (is_array($fCfg['items'])) {
// Get Human Readable names of fields and table:
$allowDenyOptions[$table.':'.$field]['tableFieldLabel'] = $GLOBALS['LANG']->sl($TCA[$table]['ctrl']['title']).': '.$GLOBALS['LANG']->sl($TCA[$table]['columns'][$field]['label']);
$allowDenyOptions[$table . ':' . $field]['tableFieldLabel'] = $GLOBALS['LANG']->sl($TCA[$table]['ctrl']['title']) . ': ' . $GLOBALS['LANG']->sl($TCA[$table]['columns'][$field]['label']);
// Check for items:
foreach($fCfg['items'] as $iVal) {
foreach ($fCfg['items'] as $iVal) {
if (strcmp($iVal[1], '')) { // Values '' is not controlled by this setting.
if (strcmp($iVal[1], '')) { // Values '' is not controlled by this setting.
// Find iMode:
$iMode = '';
switch((string)$fCfg['authMode']) {
switch ((string) $fCfg['authMode']) {
case 'explicitAllow':
$iMode = 'ALLOW';
break;
break;
case 'explicitDeny':
$iMode = 'DENY';
break;
break;
case 'individual':
if (!strcmp($iVal[4], 'EXPL_ALLOW')) {
$iMode = 'ALLOW';
} elseif (!strcmp($iVal[4], 'EXPL_DENY')) {
$iMode = 'DENY';
}
break;
break;
}
// Set iMode:
if ($iMode) {
$allowDenyOptions[$table.':'.$field]['items'][$iVal[1]] = array($iMode, $GLOBALS['LANG']->sl($iVal[0]), $adLabel[$iMode]);
$allowDenyOptions[$table . ':' . $field]['items'][$iVal[1]] = array($iMode, $GLOBALS['LANG']->sl($iVal[0]), $adLabel[$iMode]);
}
}
}
......
*
* @return array Array with languages (title, uid, flagIcon)
*/
public static function getSystemLanguages() {
public static function getSystemLanguages() {
$languages = t3lib_div::makeInstance('t3lib_transl8tools')->getSystemLanguages();
$sysLanguages = array();
foreach ($languages as $language) {
if($language['uid'] !== -1) {
if ($language['uid'] !== -1) {
$sysLanguages[] = array(
0 => htmlspecialchars($language['title']) . ' [' . $language['uid'] . ']',
1 => $language['uid'],
......
* @return boolean Whether a table is localizable
*/
public static function isTableLocalizable($table) {
$isLocalizable = false;
$isLocalizable = FALSE;
if (isset($GLOBALS['TCA'][$table]['ctrl']) && is_array($GLOBALS['TCA'][$table]['ctrl'])) {
$tcaCtrl = $GLOBALS['TCA'][$table]['ctrl'];
$isLocalizable = (isset($tcaCtrl['languageField']) && $tcaCtrl['languageField'] && isset($tcaCtrl['transOrigPointerField']) && $tcaCtrl['transOrigPointerField']);
......
* @return mixed If table is localizable, the set localizationMode is returned (if property is not set, 'select' is returned by default); if table is not localizable, false is returned
*/
public static function getInlineLocalizationMode($table, $fieldOrConfig) {
$localizationMode = false;
$localizationMode = FALSE;
if (is_array($fieldOrConfig) && count($fieldOrConfig)) {
$config = $fieldOrConfig;
} elseif (is_string($fieldOrConfig) && isset($GLOBALS['TCA'][$table]['columns'][$fieldOrConfig]['config'])) {
$config = $GLOBALS['TCA'][$table]['columns'][$fieldOrConfig]['config'];
}
if (is_array($config) && isset($config['type']) && $config['type']=='inline' && self::isTableLocalizable($table)) {
if (is_array($config) && isset($config['type']) && $config['type'] == 'inline' && self::isTableLocalizable($table)) {
$localizationMode = (isset($config['behaviour']['localizationMode']) && $config['behaviour']['localizationMode'] ? $config['behaviour']['localizationMode'] : 'select');
// The mode 'select' is not possible when child table is not localizable at all:
if ($localizationMode=='select' && !self::isTableLocalizable($config['foreign_table'])) {
if ($localizationMode == 'select' && !self::isTableLocalizable($config['foreign_table'])) {
$localizationMode = false;
$localizationMode = FALSE;
}
}
return $localizationMode;
......
* @return array Returns page record if OK, otherwise false.
*/
public static function readPageAccess($id, $perms_clause) {
if ((string)$id!='') {
if ((string) $id != '') {
$id = intval($id);
if (!$id) {
if ($GLOBALS['BE_USER']->isAdmin()) {
......
}
}
}
return false;
return FALSE;
}
/**
......
global $TCA;
t3lib_div::loadTCA($table);
if ($TCA[$table]) {
if ($TCA[$table]) {
// Get type value:
$fieldValue = self::getTCAtypeValue($table, $rec);
......
$altFieldList = array();
// Traverse fields in types config and parse the configuration into a nice array:
foreach($fieldList as $k => $v) {
foreach ($fieldList as $k => $v) {
list($pFieldName, $pAltTitle, $pPalette, $pSpec) = t3lib_div::trimExplode(';', $v);
$defaultExtras = is_array($TCA[$table]['columns'][$pFieldName]) ? $TCA[$table]['columns'][$pFieldName]['defaultExtras'] : '';
$specConfParts = self::getSpecConfParts($pSpec, $defaultExtras);
......
if ($TCA[$table]) {
$field = $TCA[$table]['ctrl']['type'];
$fieldValue = $field ? ($rec[$field] ? $rec[$field] : 0) : 0;
if (!is_array($TCA[$table]['types'][$fieldValue])) $fieldValue = 1;
if (!is_array($TCA[$table]['types'][$fieldValue])) {
$fieldValue = 1;
}
return $fieldValue;
}
}
......
* @param string The ['defaultExtras'] value from field configuration
* @return array
*/
public static function getSpecConfParts($str, $defaultExtras) {
public static function getSpecConfParts($str, $defaultExtras) {
// Add defaultExtras:
$specConfParts = t3lib_div::trimExplode(':', $defaultExtras.':'.$str, 1);
$specConfParts = t3lib_div::trimExplode(':', $defaultExtras . ':' . $str, 1);
$reg = array();
if (count($specConfParts)) {
foreach($specConfParts as $k2 => $v2) {
foreach ($specConfParts as $k2 => $v2) {
unset($specConfParts[$k2]);
if (preg_match('/(.*)\[(.*)\]/', $v2, $reg)) {
$specConfParts[trim($reg[1])] = array(
......
if (is_array($pArr)) {
foreach ($pArr as $k => $v) {
$parts = explode('=', $v, 2);
if (count($parts)==2) {
if (count($parts) == 2) {
$out[trim($parts[0])] = trim($parts[1]);
} else {
$out[$k] = $v;
......
global $TYPO3_CONF_VARS;
// Get pointer field etc from TCA-config:
$ds_pointerField = $conf['ds_pointerField'];
$ds_pointerField = $conf['ds_pointerField'];
$ds_array = $conf['ds'];
$ds_array = $conf['ds'];
$ds_tableField = $conf['ds_tableField'];
$ds_tableField = $conf['ds_tableField'];
$ds_searchParentField = $conf['ds_pointerField_searchParent'];
$ds_searchParentField = $conf['ds_pointerField_searchParent'];
// Find source value:
$dataStructArray = '';
if (is_array($ds_array)) { // If there is a data source array, that takes precedence
if (is_array($ds_array)) { // If there is a data source array, that takes precedence
// If a pointer field is set, take the value from that field in the $row array and use as key.
if ($ds_pointerField) {
if ($ds_pointerField) {
// Up to two pointer fields can be specified in a comma separated list.
$pointerFields = t3lib_div::trimExplode(',', $ds_pointerField);
if(count($pointerFields) == 2) { // If we have two pointer fields, the array keys should contain both field values separated by comma. The asterisk "*" catches all values. For backwards compatibility, it's also possible to specify only the value of the first defined ds_pointerField.
if (count($pointerFields) == 2) { // If we have two pointer fields, the array keys should contain both field values separated by comma. The asterisk "*" catches all values. For backwards compatibility, it's also possible to specify only the value of the first defined ds_pointerField.
if($ds_array[$row[$pointerFields[0]].','.$row[$pointerFields[1]]]) { // Check if we have a DS for the combination of both pointer fields values
if ($ds_array[$row[$pointerFields[0]] . ',' . $row[$pointerFields[1]]]) { // Check if we have a DS for the combination of both pointer fields values
$srcPointer = $row[$pointerFields[0]].','.$row[$pointerFields[1]];
$srcPointer = $row[$pointerFields[0]] . ',' . $row[$pointerFields[1]];
} elseif($ds_array[$row[$pointerFields[1]].',*']) { // Check if we have a DS for the value of the first pointer field suffixed with ",*"
} elseif ($ds_array[$row[$pointerFields[1]] . ',*']) { // Check if we have a DS for the value of the first pointer field suffixed with ",*"
$srcPointer = $row[$pointerFields[1]].',*';
$srcPointer = $row[$pointerFields[1]] . ',*';
} elseif($ds_array['*,'.$row[$pointerFields[1]]]) { // Check if we have a DS for the value of the second pointer field prefixed with "*,"
} elseif ($ds_array['*,' . $row[$pointerFields[1]]]) { // Check if we have a DS for the value of the second pointer field prefixed with "*,"
$srcPointer = '*,'.$row[$pointerFields[1]];
$srcPointer = '*,' . $row[$pointerFields[1]];
} elseif($ds_array[$row[$pointerFields[0]]]) { // Check if we have a DS for just the value of the first pointer field (mainly for backwards compatibility)
} elseif ($ds_array[$row[$pointerFields[0]]]) { // Check if we have a DS for just the value of the first pointer field (mainly for backwards compatibility)
$srcPointer = $row[$pointerFields[0]];
}
} else {
......
}
$srcPointer = isset($ds_array[$srcPointer]) ? $srcPointer : 'default';
} else $srcPointer = 'default';
} else {
$srcPointer = 'default';
}
// Get Data Source: Detect if it's a file reference and in that case read the file and parse as XML. Otherwise the value is expected to be XML.
if (substr($ds_array[$srcPointer], 0, 5)=='FILE:') {
if (substr($ds_array[$srcPointer], 0, 5) == 'FILE:') {
$file = t3lib_div::getFileAbsFileName(substr($ds_array[$srcPointer], 5));
if ($file && @is_file($file)) {
$dataStructArray = t3lib_div::xml2array(t3lib_div::getUrl($file));
} else $dataStructArray = 'The file "'.substr($ds_array[$srcPointer], 5).'" in ds-array key "'.$srcPointer.'" was not found ("'.$file.'")'; // Error message.
} else {
} else {
$dataStructArray = 'The file "' . substr($ds_array[$srcPointer], 5) . '" in ds-array key "' . $srcPointer . '" was not found ("' . $file . '")';
} // Error message.
} else {
$dataStructArray = t3lib_div::xml2array($ds_array[$srcPointer]);
}
} elseif ($ds_pointerField) { // If pointer field AND possibly a table/field is set:
} elseif ($ds_pointerField) { // If pointer field AND possibly a table/field is set:
// Value of field pointed to:
$srcPointer = $row[$ds_pointerField];
// Searching recursively back if 'ds_pointerField_searchParent' is defined (typ. a page rootline, or maybe a tree-table):
if ($ds_searchParentField && !$srcPointer) {
$rr = self::getRecord($table, $row['uid'], 'uid,' . $ds_searchParentField); // Get the "pid" field - we cannot know that it is in the input record! ###NOTE_A###
$rr = self::getRecord($table, $row['uid'], 'uid,' . $ds_searchParentField); // Get the "pid" field - we cannot know that it is in the input record! ###NOTE_A###
if ($WSOL) {
self::workspaceOL($table, $rr);
self::fixVersioningPid($table, $rr, TRUE); // Added "TRUE" 23/03/06 before 4.0. (Also to similar call below!). Reason: When t3lib_refindex is scanning the system in Live workspace all Pages with FlexForms will not find their inherited datastructure. Thus all references from workspaces are removed! Setting TRUE means that versioning PID doesn't check workspace of the record. I can't see that this should give problems anywhere. See more information inside t3lib_refindex!
self::fixVersioningPid($table, $rr, TRUE); // Added "TRUE" 23/03/06 before 4.0. (Also to similar call below!). Reason: When t3lib_refindex is scanning the system in Live workspace all Pages with FlexForms will not find their inherited datastructure. Thus all references from workspaces are removed! Setting TRUE means that versioning PID doesn't check workspace of the record. I can't see that this should give problems anywhere. See more information inside t3lib_refindex!
}
$uidAcc = array(); // Used to avoid looping, if any should happen.
$uidAcc = array(); // Used to avoid looping, if any should happen.
$subFieldPointer = $conf['ds_pointerField_searchParent_subField'];
while(!$srcPointer) {
while (!$srcPointer) {
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
'uid,'.$ds_pointerField.','.$ds_searchParentField.($subFieldPointer?','.$subFieldPointer:''),
'uid,' . $ds_pointerField . ',' . $ds_searchParentField . ($subFieldPointer ? ',' . $subFieldPointer : ''),
$table,
$table,
'uid=' . intval($newRecordPidValue ? $newRecordPidValue : $rr[$ds_searchParentField]) . self::deleteClause($table) ###NOTE_A###
'uid=' . intval($newRecordPidValue ? $newRecordPidValue : $rr[$ds_searchParentField]) . self::deleteClause($table) ###NOTE_A###
);
);
$newRecordPidValue = 0;
$rr = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
$GLOBALS['TYPO3_DB']->sql_free_result($res);
// break if no result from SQL db or if looping...
if (!is_array($rr) || isset($uidAcc[$rr['uid']])) break;
if (!is_array($rr) || isset($uidAcc[$rr['uid']])) {
break;
}
$uidAcc[$rr['uid']] = 1;
if ($WSOL) {
......
// If there is a srcPointer value:
if ($srcPointer) {
if (t3lib_div::testInt($srcPointer)) { // If integer, then its a record we will look up:
if (t3lib_div::testInt($srcPointer)) { // If integer, then its a record we will look up:
list($tName, $fName) = explode(':', $ds_tableField, 2);
if ($tName && $fName && is_array($GLOBALS['TCA'][$tName])) {
$dataStructRec = self::getRecord($tName, $srcPointer);
......
self::workspaceOL($tName, $dataStructRec);
}
$dataStructArray = t3lib_div::xml2array($dataStructRec[$fName]);
} else $dataStructArray = 'No tablename ('.$tName.') or fieldname ('.$fName.') was found an valid!';
} else {
$dataStructArray = 'No tablename (' . $tName . ') or fieldname (' . $fName . ') was found an valid!';
}
} else { // Otherwise expect it to be a file:
} else { // Otherwise expect it to be a file:
$file = t3lib_div::getFileAbsFileName($srcPointer);
if ($file && @is_file($file)) {
$dataStructArray = t3lib_div::xml2array(t3lib_div::getUrl($file));
} else $dataStructArray = 'The file "'.$srcPointer.'" was not found ("'.$file.'")'; // Error message.
} else {
$dataStructArray = 'The file "' . $srcPointer . '" was not found ("' . $file . '")';
} // Error message.
}
} else $dataStructArray = 'No source value in fieldname "'.$ds_pointerField.'"'; // Error message.
} else $dataStructArray = 'No proper configuration!';
} else {
$dataStructArray = 'No source value in fieldname "' . $ds_pointerField . '"';
} // Error message.
} else {
$dataStructArray = 'No proper configuration!';
}
// Hook for post-processing the Flexform DS. Introduces the possibility to configure Flexforms via TSConfig
if (is_array ($TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_befunc.php']['getFlexFormDSClass'])) {
if (is_array($TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_befunc.php']['getFlexFormDSClass'])) {
foreach ($TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_befunc.php']['getFlexFormDSClass'] as $classRef) {
$hookObj = t3lib_div::getUserObj($classRef);
if (method_exists($hookObj, 'getFlexFormDS_postProcessDS')) {
......
}
$flexForms = array();
$flexForms = array();
foreach ($GLOBALS['TCA'][$table]['columns'] as $tableField => $fieldConf) {
if (!empty($fieldConf['config']['type']) && !empty($fieldConf['config']['ds']) && $fieldConf['config']['type'] == 'flex') {
......
foreach ($fieldConf['config']['ds'] as $flexFormKey => $dataStruct) {
// Get extension identifier (uses second value if it's not empty, "list" or "*", else first one)
$identFields = t3lib_div::trimExplode(',', $flexFormKey);
$extIdent = $identFields[0];
$extIdent = $identFields[0];
if (!empty($identFields[1]) && $identFields[1] != 'list' && $identFields[1] != '*') {
$extIdent = $identFields[1];
}
......
$flexForms[$tableField][$extIdent] = array(
'title' => $title,
'ds' => $dataStruct,
'ds' => $dataStruct,
);
}
}
......
}
/*******************************************
*
* Caching related
......
'ident' => $ident,
'tstamp' => $GLOBALS['EXEC_TIME']
);
$GLOBALS['TYPO3_DB']->exec_DELETEquery('cache_hash', 'hash='.$GLOBALS['TYPO3_DB']->fullQuoteStr($hash, 'cache_hash'));
$GLOBALS['TYPO3_DB']->exec_DELETEquery('cache_hash', 'hash=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($hash, 'cache_hash'));
$GLOBALS['TYPO3_DB']->exec_INSERTquery('cache_hash', $insertFields);
}
}
......
* @return string
*/
public static function getHash($hash, $expTime = 0) {
$hashContent = null;
$hashContent = NULL;
if (TYPO3_UseCachingFramework) {
$contentHashCache = $GLOBALS['typo3CacheManager']->getCache('cache_hash');
$cacheEntry = $contentHashCache->get($hash);
......
} else {
$expTime = intval($expTime);
if ($expTime) {
$whereAdd = ' AND tstamp > '.(time()-$expTime);
$whereAdd = ' AND tstamp > ' . (time() - $expTime);
}
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('content', 'cache_hash', 'hash='.$GLOBALS['TYPO3_DB']->fullQuoteStr($hash, 'cache_hash').$whereAdd);
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('content', 'cache_hash', 'hash=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($hash, 'cache_hash') . $whereAdd);
$row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
$GLOBALS['TYPO3_DB']->sql_free_result($res);
$hashContent = (is_array($row) ? $row['content'] : null);
$hashContent = (is_array($row) ? $row['content'] : NULL);
}
return $hashContent;
}
/*******************************************
*
* TypoScript related
......
if (!is_array($rootLine)) {
$rootLine = self::BEgetRootLine($id, '', TRUE);
}
ksort($rootLine); // Order correctly
ksort($rootLine); // Order correctly
$TSdataArray = array();
$TSdataArray['defaultPageTSconfig'] = $GLOBALS['TYPO3_CONF_VARS']['BE']['defaultPageTSconfig']; // Setting default configuration:
$TSdataArray['defaultPageTSconfig'] = $GLOBALS['TYPO3_CONF_VARS']['BE']['defaultPageTSconfig']; // Setting default configuration:
foreach($rootLine as $k => $v) {
foreach ($rootLine as $k => $v) {
$TSdataArray['uid_'.$v['uid']] = $v['TSconfig'];
$TSdataArray['uid_' . $v['uid']] = $v['TSconfig'];
}
$TSdataArray = t3lib_TSparser::checkIncludeLines_array($TSdataArray);
if ($returnPartArray) {
......
*/
public static function updatePagesTSconfig($id, $pageTS, $TSconfPrefix, $impParams = '') {
$id = intval($id);
if (is_array($pageTS) && $id>0) {
if (is_array($pageTS) && $id > 0) {
if (!is_array($impParams)) {
$impParams = self::implodeTSParams(self::getPagesTSconfig($id));
}
$set = array();
foreach ($pageTS as $f => $v) {
$f = $TSconfPrefix.$f;
$f = $TSconfPrefix . $f;
if ((!isset($impParams[$f])&&trim($v)) || strcmp(trim($impParams[$f]), trim($v))) {
if ((!isset($impParams[$f]) && trim($v)) || strcmp(trim($impParams[$f]), trim($v))) {
$set[$f] = trim($v);
}
}
......
foreach ($set as $f => $v) {
$inserted = 0;
foreach ($TSlines as $ki => $kv) {
if (substr($kv, 0, strlen($f)+1)==$f.'=') {
if (substr($kv, 0, strlen($f) + 1) == $f . '=') {
$TSlines[$ki] = $f.'='.$v;
$TSlines[$ki] = $f . '=' . $v;
$inserted = 1;
break;
}
}
if (!$inserted) {
$TSlines = array_reverse($TSlines);
$TSlines[] = $f.'='.$v;
$TSlines[] = $f . '=' . $v;
$TSlines = array_reverse($TSlines);
}
}
......
// store those changes
$TSconf = implode(LF, $TSlines);
$GLOBALS['TYPO3_DB']->exec_UPDATEquery('pages', 'uid='.intval($id), array('TSconfig' => $TSconf));
$GLOBALS['TYPO3_DB']->exec_UPDATEquery('pages', 'uid=' . intval($id), array('TSconfig' => $TSconf));
}
}
}
......
if (is_array($val)) {
$implodeParams = array_merge($implodeParams, self::implodeTSParams($val, $k . $kb));
} else {
$implodeParams[$k.$kb] = $val;
$implodeParams[$k . $kb] = $val;
}
}
}
......
}
/*******************************************
*
* Users / Groups related
......
$be_user_Array = Array();
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery($fields, 'be_users', 'pid=0 ' . $where . self::deleteClause('be_users'), '', 'username');
while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
$be_user_Array[$row['uid']] = $row;
}
$GLOBALS['TYPO3_DB']->sql_free_result($res);
......
$be_group_Array = Array();
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery($fields, 'be_groups', 'pid=0 ' . $where . self::deleteClause('be_groups'), '', 'title');
while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
$be_group_Array[$row['uid']] = $row;
}
$GLOBALS['TYPO3_DB']->sql_free_result($res);
......
public static function getListGroupNames($fields = 'title, uid') {
$exQ = ' AND hide_in_lists=0';
if (!$GLOBALS['BE_USER']->isAdmin()) {
$exQ.=' AND uid IN ('.($GLOBALS['BE_USER']->user['usergroup_cached_list']?$GLOBALS['BE_USER']->user['usergroup_cached_list']:0).')';
$exQ .= ' AND uid IN (' . ($GLOBALS['BE_USER']->user['usergroup_cached_list'] ? $GLOBALS['BE_USER']->user['usergroup_cached_list'] : 0) . ')';
}
return self::getGroupNames($fields, $exQ);
}
......
foreach ($usernames as $uid => $row) {
$userN = $uid;
$set = 0;
if ($row['uid']!=$GLOBALS['BE_USER']->user['uid']) {
if ($row['uid'] != $GLOBALS['BE_USER']->user['uid']) {
foreach ($groupArray as $v) {
if ($v && t3lib_div::inList($row['usergroup_cached_list'], $v)) {
$userN = $row['username'];
......
$set = 1;
}
$usernames[$uid]['username'] = $userN;
if ($excludeBlindedFlag && !$set) {unset($usernames[$uid]);}
if ($excludeBlindedFlag && !$set) {
unset($usernames[$uid]);
}
}
}
}
}
return $usernames;
}
......
$set = 1;
}
$groups[$uid]['title'] = $groupN;
if ($excludeBlindedFlag && !$set) {unset($groups[$uid]);}
if ($excludeBlindedFlag && !$set) {
unset($groups[$uid]);
}
}
}
}
}
return $groups;
}
/*******************************************
*
* Output related
......
* @return integer
*/
public static function daysUntil($tstamp) {
$delta_t = $tstamp-$GLOBALS['EXEC_TIME'];
$delta_t = $tstamp - $GLOBALS['EXEC_TIME'];
return ceil($delta_t/(3600*24));
return ceil($delta_t / (3600 * 24));
}
/**
......
* @return string Formatted time
*/
public static function date($tstamp) {
return date($GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'], (int)$tstamp);
return date($GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'], (int) $tstamp);
}
/**
......
* @return string Formatted time
*/
public static function datetime($value) {
return date($GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'].' '.$GLOBALS['TYPO3_CONF_VARS']['SYS']['hhmm'], $value);
return date($GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'] . ' ' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['hhmm'], $value);
}
/**
......
* @return string Formatted time
*/
public static function time($value, $withSeconds = TRUE) {
$hh = floor($value/3600);
$hh = floor($value / 3600);
$min = floor(($value-$hh*3600)/60);
$min = floor(($value - $hh * 3600) / 60);
$sec = $value-$hh*3600-$min*60;
$sec = $value - $hh * 3600 - $min * 60;
$l = sprintf('%02d', $hh).':'.sprintf('%02d', $min);
$l = sprintf('%02d', $hh) . ':' . sprintf('%02d', $min);
if ($withSeconds) {
$l .= ':'.sprintf('%02d', $sec);
$l .= ':' . sprintf('%02d', $sec);
}
return $l;
}
......
public static function calcAge($seconds, $labels = 'min|hrs|days|yrs') {
$labelArr = explode('|', $labels);
$prefix = '';
if ($seconds<0) {$prefix = '-'; $seconds = abs($seconds);}
if ($seconds < 0) {
$prefix = '-';
$seconds = abs($seconds);
}
if ($seconds<3600) {
if ($seconds < 3600) {
$seconds = round ($seconds/60).' '.trim($labelArr[0]);
$seconds = round($seconds / 60) . ' ' . trim($labelArr[0]);
} elseif ($seconds<24*3600) {
} elseif ($seconds < 24 * 3600) {
$seconds = round ($seconds/3600).' '.trim($labelArr[1]);
$seconds = round($seconds / 3600) . ' ' . trim($labelArr[1]);
} elseif ($seconds<365*24*3600) {
} elseif ($seconds < 365 * 24 * 3600) {
$seconds = round ($seconds/(24*3600)).' '.trim($labelArr[2]);
$seconds = round($seconds / (24 * 3600)) . ' ' . trim($labelArr[2]);
} else {
$seconds = round ($seconds/(365*24*3600)).' '.trim($labelArr[3]);
$seconds = round($seconds / (365 * 24 * 3600)) . ' ' . trim($labelArr[3]);
}
return $prefix.$seconds;
return $prefix . $seconds;
}
/**
......
*/
public static function dateTimeAge($tstamp, $prefix = 1, $date = '') {
return $tstamp ?
($date=='date' ? self::date($tstamp) : self::datetime($tstamp)) .
($date == 'date' ? self::date($tstamp) : self::datetime($tstamp)) .
' (' . self::calcAge($prefix * ($GLOBALS['EXEC_TIME'] - $tstamp), $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.minutesHoursDaysYears')) . ')'
' (' . self::calcAge($prefix * ($GLOBALS['EXEC_TIME'] - $tstamp), $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.minutesHoursDaysYears')) . ')'
: '';
}
......
t3lib_div::logDeprecatedFunction();
global $CLIENT;
$attrib= ($CLIENT['BROWSER']=='net'&&$CLIENT['VERSION']<5)||$CLIENT['BROWSER']=='konqu' ? 'alt' : 'title';
$attrib = ($CLIENT['BROWSER'] == 'net' && $CLIENT['VERSION'] < 5) || $CLIENT['BROWSER'] == 'konqu' ? 'alt' : 'title';
return strcmp($content, '')?' '.$attrib.'="'.($hsc?htmlspecialchars($content):$content).'"' : $attrib;
return strcmp($content, '') ? ' ' . $attrib . '="' . ($hsc ? htmlspecialchars($content) : $content) . '"' : $attrib;
}
/**
......
*/
public static function titleAltAttrib($content) {
$out = '';
$out.=' alt="'.htmlspecialchars($content).'"';
$out .= ' alt="' . htmlspecialchars($content) . '"';
$out.=' title="'.htmlspecialchars($content).'"';
$out .= ' title="' . htmlspecialchars($content) . '"';
return $out;
}
......
// Find uploaddir automatically
$uploaddir = (is_null($uploaddir)) ? $TCA[$table]['columns'][$field]['config']['uploadfolder'] : $uploaddir;
$uploaddir = preg_replace('#/$#','', $uploaddir);
$uploaddir = preg_replace('#/$#', '', $uploaddir);
// Set thumbs-script:
if (!$GLOBALS['TYPO3_CONF_VARS']['GFX']['thumbnails']) {
$thumbScript = 'gfx/notfound_thumb.gif';
} elseif(!$thumbScript) {
} elseif (!$thumbScript) {
$thumbScript = 'thumbs.php';
}
// Check and parse the size parameter
$sizeParts = array();
if ($size = trim($size)) {
$sizeParts = explode('x', $size.'x'.$size);
$sizeParts = explode('x', $size . 'x' . $size);
if(!intval($sizeParts[0])) $size = '';
if (!intval($sizeParts[0])) {
$size = '';
}
}
}
// Traverse files:
$thumbs = explode(',', $row[$field]);
......
if (trim($theFile)) {
$fI = t3lib_div::split_fileref($theFile);
$ext = $fI['fileext'];
// New 190201 start
// New 190201 start
$max = 0;
if (t3lib_div::inList('gif,jpg,png', $ext)) {
$imgInfo = @getimagesize(PATH_site.$uploaddir.'/'.$theFile);
$imgInfo = @getimagesize(PATH_site . $uploaddir . '/' . $theFile);
if (is_array($imgInfo)) {$max = max($imgInfo[0], $imgInfo[1]);}
if (is_array($imgInfo)) {
$max = max($imgInfo[0], $imgInfo[1]);
}
}
}
// use the original image if it's size fits to the thumbnail size
if ($max && $max<=(count($sizeParts)&&max($sizeParts)?max($sizeParts):56)) {
if ($max && $max <= (count($sizeParts) && max($sizeParts) ? max($sizeParts) : 56)) {
$theFile = $url = ($abs?'':'../').($uploaddir?$uploaddir.'/':'').trim($theFile);
$theFile = $url = ($abs ? '' : '../') . ($uploaddir ? $uploaddir . '/' : '') . trim($theFile);
$onClick = 'top.launchView(\''.$theFile.'\',\'\',\''.$backPath.'\');return false;';
$onClick = 'top.launchView(\'' . $theFile . '\',\'\',\'' . $backPath . '\');return false;';
$thumbData.= '<a href="#" onclick="'.htmlspecialchars($onClick).'"><img src="'.$backPath.$url.'" '.$imgInfo[3].' hspace="2" border="0" title="'.trim($url).'"'.$tparams.' alt="" /></a> ';
$thumbData .= '<a href="#" onclick="' . htmlspecialchars($onClick) . '"><img src="' . $backPath . $url . '" ' . $imgInfo[3] . ' hspace="2" border="0" title="' . trim($url) . '"' . $tparams . ' alt="" /></a> ';
// New 190201 stop
// New 190201 stop
} elseif ($ext=='ttf' || t3lib_div::inList($GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'], $ext)) {
} elseif ($ext == 'ttf' || t3lib_div::inList($GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'], $ext)) {
$theFile_abs = PATH_site.($uploaddir?$uploaddir.'/':'').trim($theFile);
$theFile_abs = PATH_site . ($uploaddir ? $uploaddir . '/' : '') . trim($theFile);
$theFile = ($abs?'':'../').($uploaddir?$uploaddir.'/':'').trim($theFile);
$theFile = ($abs ? '' : '../') . ($uploaddir ? $uploaddir . '/' : '') . trim($theFile);
if (!is_readable($theFile_abs)) {
$flashMessage = t3lib_div::makeInstance(
't3lib_FlashMessage',
$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:warning.file_missing_text') . ' <abbr title="' . $theFile_abs . '">' . $theFile . '</abbr>',
$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:warning.file_missing_text') . ' <abbr title="' . $theFile_abs . '">' . $theFile . '</abbr>',
$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:warning.file_missing'),
t3lib_FlashMessage::ERROR
);
......
continue;
}
$check = basename($theFile_abs).':'.filemtime($theFile_abs).':'.$GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'];
$check = basename($theFile_abs) . ':' . filemtime($theFile_abs) . ':' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'];
$params = '&file='.rawurlencode($theFile);
$params = '&file=' . rawurlencode($theFile);
$params.= $size?'&size='.$size:'';
$params .= $size ? '&size=' . $size : '';
$params.= '&md5sum='.t3lib_div::shortMD5($check);
$params .= '&md5sum=' . t3lib_div::shortMD5($check);
$url = $thumbScript.'?&dummy='.$GLOBALS['EXEC_TIME'].$params;
$url = $thumbScript . '?&dummy=' . $GLOBALS['EXEC_TIME'] . $params;
$onClick = 'top.launchView(\''.$theFile.'\',\'\',\''.$backPath.'\');return false;';
$onClick = 'top.launchView(\'' . $theFile . '\',\'\',\'' . $backPath . '\');return false;';
$thumbData.= '<a href="#" onclick="'.htmlspecialchars($onClick).'"><img src="'.htmlspecialchars($backPath.$url).'" hspace="2" border="0" title="'.trim($theFile).'"'.$tparams.' alt="" /></a> ';
$thumbData .= '<a href="#" onclick="' . htmlspecialchars($onClick) . '"><img src="' . htmlspecialchars($backPath . $url) . '" hspace="2" border="0" title="' . trim($theFile) . '"' . $tparams . ' alt="" /></a> ';
} else {
$icon = self::getFileIcon($ext);
$url = 'gfx/fileicons/'.$icon;
$url = 'gfx/fileicons/' . $icon;
$thumbData.= '<img src="'.$backPath.$url.'" hspace="2" border="0" title="'.trim($theFile).'"'.$tparams.' alt="" /> ';
$thumbData .= '<img src="' . $backPath . $url . '" hspace="2" border="0" title="' . trim($theFile) . '"' . $tparams . ' alt="" /> ';
}
}
}
......
* @return string Image tag
*/
public static function getThumbNail($thumbScript, $theFile, $tparams = '', $size = '') {
$check = basename($theFile).':'.filemtime($theFile).':'.$GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'];
$check = basename($theFile) . ':' . filemtime($theFile) . ':' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'];
$params = '&file='.rawurlencode($theFile);
$params = '&file=' . rawurlencode($theFile);
$params.= trim($size)?'&size='.trim($size):'';
$params .= trim($size) ? '&size=' . trim($size) : '';
$params.= '&md5sum='.t3lib_div::shortMD5($check);
$params .= '&md5sum=' . t3lib_div::shortMD5($check);
$url = $thumbScript.'?&dummy='.$GLOBALS['EXEC_TIME'].$params;
$url = $thumbScript . '?&dummy=' . $GLOBALS['EXEC_TIME'] . $params;
$th = '<img src="'.htmlspecialchars($url).'" title="'.trim(basename($theFile)).'"'.($tparams?" ".$tparams:"").' alt="" />';
$th = '<img src="' . htmlspecialchars($url) . '" title="' . trim(basename($theFile)) . '"' . ($tparams ? " " . $tparams : "") . ' alt="" />';
return $th;
}
......
public static function titleAttribForPages($row, $perms_clause = '', $includeAttrib = 1) {
global $TCA, $LANG;
$parts = array();
$parts[] = 'id='.$row['uid'];
$parts[] = 'id=' . $row['uid'];
if ($row['alias']) $parts[] = $LANG->sL($TCA['pages']['columns']['alias']['label']).' '.$row['alias'];
if ($row['pid']<0) $parts[] = 'v#1.'.$row['t3ver_id'];
if ($row['alias']) {
$parts[] = $LANG->sL($TCA['pages']['columns']['alias']['label']) . ' ' . $row['alias'];
}
if ($row['pid'] < 0) {
$parts[] = 'v#1.' . $row['t3ver_id'];
}
switch($row['t3ver_state']) {
switch ($row['t3ver_state']) {
case 1:
$parts[] = 'PLH WSID#'.$row['t3ver_wsid'];
$parts[] = 'PLH WSID#' . $row['t3ver_wsid'];
break;
break;
case 2:
$parts[] = 'Deleted element!';
break;
break;
case 3:
$parts[] = 'NEW LOCATION (PLH) WSID#'.$row['t3ver_wsid'];
$parts[] = 'NEW LOCATION (PLH) WSID#' . $row['t3ver_wsid'];
break;
break;
case 4:
$parts[] = 'OLD LOCATION (PNT) WSID#'.$row['t3ver_wsid'];
$parts[] = 'OLD LOCATION (PNT) WSID#' . $row['t3ver_wsid'];
break;
break;
case -1:
$parts[] = 'New element!';
break;
break;
}
if ($row['doktype'] == t3lib_pageSelect::DOKTYPE_LINK) {
$parts[] = $LANG->sL($TCA['pages']['columns']['url']['label']).' '.$row['url'];
$parts[] = $LANG->sL($TCA['pages']['columns']['url']['label']) . ' ' . $row['url'];
} elseif ($row['doktype'] == t3lib_pageSelect::DOKTYPE_SHORTCUT) {
if ($perms_clause) {
$label = self::getRecordPath(intval($row['shortcut']), $perms_clause, 20);
......
$label = $lRec['title'];
}
if ($row['shortcut_mode'] != t3lib_pageSelect::SHORTCUT_MODE_NONE) {
$label.=', '.$LANG->sL($TCA['pages']['columns']['shortcut_mode']['label']).' '.
$label .= ', ' . $LANG->sL($TCA['pages']['columns']['shortcut_mode']['label']) . ' ' .
$LANG->sL(self::getLabelFromItemlist('pages', 'shortcut_mode', $row['shortcut_mode']));
$LANG->sL(self::getLabelFromItemlist('pages', 'shortcut_mode', $row['shortcut_mode']));
}
$parts[] = $LANG->sL($TCA['pages']['columns']['shortcut']['label']).' '.$label;
$parts[] = $LANG->sL($TCA['pages']['columns']['shortcut']['label']) . ' ' . $label;
} elseif ($row['doktype'] == t3lib_pageSelect::DOKTYPE_MOUNTPOINT) {
if ($perms_clause) {
$label = self::getRecordPath(intval($row['mount_pid']), $perms_clause, 20);
......
$lRec = self::getRecordWSOL('pages', intval($row['mount_pid']), 'title');
$label = $lRec['title'];
}
$parts[] = $LANG->sL($TCA['pages']['columns']['mount_pid']['label']).' '.$label;
$parts[] = $LANG->sL($TCA['pages']['columns']['mount_pid']['label']) . ' ' . $label;
if ($row['mount_pid_ol']) {
$parts[] = $LANG->sL($TCA['pages']['columns']['mount_pid_ol']['label']);
}
}
if ($row['nav_hide']) $parts[] = rtrim($LANG->sL($TCA['pages']['columns']['nav_hide']['label']), ':');
if ($row['hidden']) $parts[] = $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.hidden');
if ($row['starttime']) $parts[] = $LANG->sL($TCA['pages']['columns']['starttime']['label']) . ' ' . self::dateTimeAge($row['starttime'], -1, 'date');
if ($row['endtime']) $parts[] = $LANG->sL($TCA['pages']['columns']['endtime']['label']) . ' ' . self::dateTimeAge($row['endtime'], -1, 'date');
if ($row['nav_hide']) {
$parts[] = rtrim($LANG->sL($TCA['pages']['columns']['nav_hide']['label']), ':');
}
if ($row['hidden']) {
$parts[] = $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.hidden');
}
if ($row['starttime']) {
$parts[] = $LANG->sL($TCA['pages']['columns']['starttime']['label']) . ' ' . self::dateTimeAge($row['starttime'], -1, 'date');
}
if ($row['endtime']) {
$parts[] = $LANG->sL($TCA['pages']['columns']['endtime']['label']) . ' ' . self::dateTimeAge($row['endtime'], -1, 'date');
}
if ($row['fe_group']) {
$fe_groups = array();
foreach (t3lib_div::intExplode(',', $row['fe_group']) as $fe_group) {
... This diff was truncated because it exceeds the maximum size that can be displayed.
(9-9/93)