Project

General

Profile

Bug #22848 ยป 14675_v1.diff

Administrator Admin, 2010-06-09 17:31

View differences:

t3lib/class.t3lib_befunc.php (working copy)
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
$fields,
$table,
'uid='.intval($uid).($useDeleteClause ? t3lib_BEfunc::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);
......
public static function getRecordWSOL($table, $uid, $fields = '*', $where = '', $useDeleteClause = true) {
if ($fields !== '*') {
$internalFields = t3lib_div::uniqueList($fields.',uid,pid'.($table == 'pages' ? ',t3ver_swapmode' : ''));
$row = t3lib_BEfunc::getRecord($table, $uid, $internalFields, $where, $useDeleteClause);
t3lib_BEfunc::workspaceOL($table, $row);
$row = self::getRecord($table, $uid, $internalFields, $where, $useDeleteClause);
self::workspaceOL($table, $row);
if (is_array ($row)) {
foreach (array_keys($row) as $key) {
......
}
}
} else {
$row = t3lib_BEfunc::getRecord($table, $uid, $fields, $where);
t3lib_BEfunc::workspaceOL($table, $row);
$row = self::getRecord($table, $uid, $fields, $where);
self::workspaceOL($table, $row);
}
return $row;
}
......
'*',
$theTable,
$theField.'='.$GLOBALS['TYPO3_DB']->fullQuoteStr($theValue, $theTable).
($useDeleteClause ? t3lib_BEfunc::deleteClause($theTable).' ' : '').
t3lib_BEfunc::versioningPlaceholderClause($theTable).' '.
($useDeleteClause ? self::deleteClause($theTable).' ' : '').
self::versioningPlaceholderClause($theTable) . ' ' .
$whereClause, // whereClauseMightContainGroupOrderBy
$groupBy,
$orderBy,
......
$recordLocalization = false;
if (self::isTableLocalizable($table)) {
$tcaCtrl = $GLOBALS['TCA'][$table]['ctrl'];
$recordLocalization = t3lib_BEfunc::getRecordsByField(
$recordLocalization = self::getRecordsByField(
$table,
$tcaCtrl['transOrigPointerField'],
$uid,
......
'pid,uid,title,TSconfig,is_siteroot,storage_pid,t3ver_oid,t3ver_wsid,t3ver_state,t3ver_swapmode,t3ver_stage',
'pages',
'uid=' . intval($uid) . ' ' .
t3lib_BEfunc::deleteClause('pages') . ' ' .
self::deleteClause('pages') . ' ' .
$clause // whereClauseMightContainGroupOrderBy
);
$row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
if ($row) {
if ($workspaceOL) {
t3lib_BEfunc::workspaceOL('pages', $row);
self::workspaceOL('pages', $row);
}
if (is_array($row)) {
t3lib_BEfunc::fixVersioningPid('pages', $row);
self::fixVersioningPid('pages', $row);
$getPageForRootline_cache[$ident] = $row;
}
}
......
}
// Get rootline:
$rL = t3lib_BEfunc::BEgetRootLine($pid);
$rL = self::BEgetRootLine($pid);
// First, find out what mount index to use (if more than one DB mount exists):
$mountIndex = 0;
......
$sysLanguages[] = array('Default language', 0);
// Traverse languages
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid,title,flag', 'sys_language', 'pid=0'.t3lib_BEfunc::deleteClause('sys_language'));
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid,title,flag', 'sys_language', 'pid=0' . self::deleteClause('sys_language'));
while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
$sysLanguages[] = array($row['title'].' ['.$row['uid'].']', $row['uid'], ($row['flag'] ? 'flags/'.$row['flag'] : ''));
}
......
return $pageinfo;
}
} else {
$pageinfo = t3lib_BEfunc::getRecord('pages', $id, '*', ($perms_clause ? ' AND '.$perms_clause : ''));
$pageinfo = self::getRecord('pages', $id, '*', ($perms_clause ? ' AND ' . $perms_clause : ''));
if ($pageinfo['uid'] && $GLOBALS['BE_USER']->isInWebMount($id, $perms_clause)) {
t3lib_BEfunc::workspaceOL('pages', $pageinfo);
self::workspaceOL('pages', $pageinfo);
if (is_array($pageinfo)) {
t3lib_BEfunc::fixVersioningPid('pages', $pageinfo);
list($pageinfo['_thePath'], $pageinfo['_thePathFull']) = t3lib_BEfunc::getRecordPath(intval($pageinfo['uid']), $perms_clause, 15, 1000);
self::fixVersioningPid('pages', $pageinfo);
list($pageinfo['_thePath'], $pageinfo['_thePathFull']) = self::getRecordPath(intval($pageinfo['uid']), $perms_clause, 15, 1000);
return $pageinfo;
}
}
......
if ($TCA[$table]) {
// Get type value:
$fieldValue = t3lib_BEfunc::getTCAtypeValue($table, $rec);
$fieldValue = self::getTCAtypeValue($table, $rec);
// Get typesConf
$typesConf = $TCA[$table]['types'][$fieldValue];
......
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 = t3lib_BEfunc::getSpecConfParts($pSpec, $defaultExtras);
$specConfParts = self::getSpecConfParts($pSpec, $defaultExtras);
$fieldList[$k] = array(
'field' => $pFieldName,
......
// Searching recursively back if 'ds_pointerField_searchParent' is defined (typ. a page rootline, or maybe a tree-table):
if ($ds_searchParentField && !$srcPointer) {
$rr = t3lib_BEfunc::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) {
t3lib_BEfunc::workspaceOL($table, $rr);
t3lib_BEfunc::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::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!
}
$uidAcc = array(); // Used to avoid looping, if any should happen.
$subFieldPointer = $conf['ds_pointerField_searchParent_subField'];
......
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
'uid,'.$ds_pointerField.','.$ds_searchParentField.($subFieldPointer?','.$subFieldPointer:''),
$table,
'uid='.intval($newRecordPidValue ? $newRecordPidValue : $rr[$ds_searchParentField]).t3lib_BEfunc::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);
......
$uidAcc[$rr['uid']] = 1;
if ($WSOL) {
t3lib_BEfunc::workspaceOL($table, $rr);
t3lib_BEfunc::fixVersioningPid($table, $rr, TRUE);
self::workspaceOL($table, $rr);
self::fixVersioningPid($table, $rr, TRUE);
}
$srcPointer = ($subFieldPointer && $rr[$subFieldPointer]) ? $rr[$subFieldPointer] : $rr[$ds_pointerField];
}
......
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 = t3lib_BEfunc::getRecord($tName, $srcPointer);
$dataStructRec = self::getRecord($tName, $srcPointer);
if ($WSOL) {
t3lib_BEfunc::workspaceOL($tName, $dataStructRec);
self::workspaceOL($tName, $dataStructRec);
}
$dataStructArray = t3lib_div::xml2array($dataStructRec[$fName]);
} else $dataStructArray = 'No tablename ('.$tName.') or fieldname ('.$fName.') was found an valid!';
......
public static function getPagesTSconfig($id, $rootLine = '', $returnPartArray = 0) {
$id = intval($id);
if (!is_array($rootLine)) {
$rootLine = t3lib_BEfunc::BEgetRootLine($id, '', TRUE);
$rootLine = self::BEgetRootLine($id, '', TRUE);
}
ksort($rootLine); // Order correctly
$TSdataArray = array();
......
}
} else {
$hash = md5('pageTS:' . $pageTS);
$cachedContent = t3lib_BEfunc::getHash($hash);
$cachedContent = self::getHash($hash);
$TSconfig = array();
if (isset($cachedContent)) {
$TSconfig = unserialize($cachedContent);
......
$parseObj = t3lib_div::makeInstance('t3lib_TSparser');
$parseObj->parse($pageTS);
$TSconfig = $parseObj->setup;
t3lib_BEfunc::storeHash($hash, serialize($TSconfig), 'PAGES_TSconfig');
self::storeHash($hash, serialize($TSconfig), 'PAGES_TSconfig');
}
}
......
$id = intval($id);
if (is_array($pageTS) && $id>0) {
if (!is_array($impParams)) {
$impParams =t3lib_BEfunc::implodeTSParams(t3lib_BEfunc::getPagesTSconfig($id));
$impParams = self::implodeTSParams(self::getPagesTSconfig($id));
}
$set = array();
foreach ($pageTS as $f => $v) {
......
}
if (count($set)) {
// Get page record and TS config lines
$pRec = t3lib_befunc::getRecord('pages', $id);
$pRec = self::getRecord('pages', $id);
$TSlines = explode(LF, $pRec['TSconfig']);
$TSlines = array_reverse($TSlines);
// Reset the set of changes.
......
if (is_array($p)) {
foreach ($p as $kb => $val) {
if (is_array($val)) {
$implodeParams = array_merge($implodeParams, t3lib_BEfunc::implodeTSParams($val, $k.$kb));
$implodeParams = array_merge($implodeParams, self::implodeTSParams($val, $k . $kb));
} else {
$implodeParams[$k.$kb] = $val;
}
......
public static function getUserNames($fields = 'username,usergroup,usergroup_cached_list,uid', $where = '') {
$be_user_Array = Array();
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery($fields, 'be_users', 'pid=0 '.$where.t3lib_BEfunc::deleteClause('be_users'), '', 'username');
$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)) {
$be_user_Array[$row['uid']] = $row;
}
......
public static function getGroupNames($fields = 'title,uid', $where = '') {
$be_group_Array = Array();
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery($fields, 'be_groups', 'pid=0 '.$where.t3lib_BEfunc::deleteClause('be_groups'), '', 'title');
$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)) {
$be_group_Array[$row['uid']] = $row;
}
......
if (!$GLOBALS['BE_USER']->isAdmin()) {
$exQ.=' AND uid IN ('.($GLOBALS['BE_USER']->user['usergroup_cached_list']?$GLOBALS['BE_USER']->user['usergroup_cached_list']:0).')';
}
return t3lib_BEfunc::getGroupNames($fields, $exQ);
return self::getGroupNames($fields, $exQ);
}
/**
......
*/
public static function dateTimeAge($tstamp, $prefix = 1, $date = '') {
return $tstamp ?
($date=='date' ? t3lib_BEfunc::date($tstamp) : t3lib_BEfunc::datetime($tstamp)) .
' (' . t3lib_BEfunc::calcAge($prefix * ($GLOBALS['EXEC_TIME'] - $tstamp), $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.minutesHoursDaysYears')) . ')'
($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')) . ')'
: '';
}
......
$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> ';
} else {
$icon = t3lib_BEfunc::getFileIcon($ext);
$icon = self::getFileIcon($ext);
$url = 'gfx/fileicons/'.$icon;
$thumbData.= '<img src="'.$backPath.$url.'" hspace="2" border="0" title="'.trim($theFile).'"'.$tparams.' alt="" /> ';
}
......
$parts[] = $LANG->sL($TCA['pages']['columns']['url']['label']).' '.$row['url'];
} elseif ($row['doktype']=='4') {
if ($perms_clause) {
$label = t3lib_BEfunc::getRecordPath(intval($row['shortcut']), $perms_clause, 20);
$label = self::getRecordPath(intval($row['shortcut']), $perms_clause, 20);
} else {
$lRec = t3lib_BEfunc::getRecordWSOL('pages', intval($row['shortcut']), 'title');
$lRec = self::getRecordWSOL('pages', intval($row['shortcut']), 'title');
$label = $lRec['title'];
}
if ($row['shortcut_mode']>0) {
$label.=', '.$LANG->sL($TCA['pages']['columns']['shortcut_mode']['label']).' '.
$LANG->sL(t3lib_BEfunc::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;
} elseif ($row['doktype']=='7') {
if ($perms_clause) {
$label = t3lib_BEfunc::getRecordPath(intval($row['mount_pid']), $perms_clause, 20);
$label = self::getRecordPath(intval($row['mount_pid']), $perms_clause, 20);
} else {
$lRec = t3lib_BEfunc::getRecordWSOL('pages', intval($row['mount_pid']), 'title');
$lRec = self::getRecordWSOL('pages', intval($row['mount_pid']), 'title');
$label = $lRec['title'];
}
$parts[] = $LANG->sL($TCA['pages']['columns']['mount_pid']['label']).' '.$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']).' '.t3lib_BEfunc::dateTimeAge($row['starttime'], -1, 'date');
if ($row['endtime']) $parts[] = $LANG->sL($TCA['pages']['columns']['endtime']['label']).' '.t3lib_BEfunc::dateTimeAge($row['endtime'], -1, 'date');
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) {
if ($fe_group<0) {
$fe_groups[] = $LANG->sL(t3lib_BEfunc::getLabelFromItemlist('pages', 'fe_group', $fe_group));
$fe_groups[] = $LANG->sL(self::getLabelFromItemlist('pages', 'fe_group', $fe_group));
} else {
$lRec = t3lib_BEfunc::getRecordWSOL('fe_groups', $fe_group, 'title');
$lRec = self::getRecordWSOL('fe_groups', $fe_group, 'title');
$fe_groups[] = $lRec['title'];
}
}
......
*/
public static function getRecordIconAltText($row, $table = 'pages') {
if ($table=='pages') {
$out = t3lib_BEfunc::titleAttribForPages($row, '', 0);
$out = self::titleAttribForPages($row, '', 0);
} else {
$ctrl = $GLOBALS['TCA'][$table]['ctrl']['enablecolumns'];
......
}
if ($ctrl['starttime']) {
if ($row[$ctrl['starttime']] > $GLOBALS['EXEC_TIME']) {
$out.=' - '.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.starttime').':'.t3lib_BEfunc::date($row[$ctrl['starttime']]).' ('.t3lib_BEfunc::daysUntil($row[$ctrl['starttime']]).' '.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.days').')';
$out .= ' - ' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.starttime') . ':' .
self::date($row[$ctrl['starttime']]) . ' (' . self::daysUntil($row[$ctrl['starttime']]) . ' ' .
$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.days') . ')';
}
}
if ($row[$ctrl['endtime']]) {
$out.=' - '.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.endtime').': '.t3lib_BEfunc::date($row[$ctrl['endtime']]).' ('.t3lib_BEfunc::daysUntil($row[$ctrl['endtime']]).' '.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.days').')';
$out .= ' - ' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.endtime') . ': ' .
self::date($row[$ctrl['endtime']]) . ' (' . self::daysUntil($row[$ctrl['endtime']]) . ' ' .
$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.days') . ')';
}
}
return htmlspecialchars($out);
......
} else {
// No userFunc: Build label
$t = t3lib_BEfunc::getProcessedValue($table, $TCA[$table]['ctrl']['label'], $row[$TCA[$table]['ctrl']['label']], 0, 0, false, $row['uid'], $forceResult);
$t = self::getProcessedValue($table, $TCA[$table]['ctrl']['label'], $row[$TCA[$table]['ctrl']['label']], 0, 0, false, $row['uid'], $forceResult);
if ($TCA[$table]['ctrl']['label_alt'] && ($TCA[$table]['ctrl']['label_alt_force'] || !strcmp($t, ''))) {
$altFields = t3lib_div::trimExplode(',', $TCA[$table]['ctrl']['label_alt'], 1);
$tA = array();
......
foreach ($altFields as $fN) {
$t = trim(strip_tags($row[$fN]));
if (strcmp($t, '')) {
$t = t3lib_BEfunc::getProcessedValue($table, $fN, $t, 0, 0, false, $row['uid']);
$t = self::getProcessedValue($table, $fN, $t, 0, 0, false, $row['uid']);
if (!$TCA[$table]['ctrl']['label_alt_force']) {
break;
}
......
// If the current result is empty, set it to '[No title]' (localized) and prepare for output if requested
if ($prep || $forceResult) {
if ($prep) {
$t = t3lib_BEfunc::getRecordTitlePrep($t);
$t = self::getRecordTitlePrep($t);
}
if (!strcmp(trim($t), '')) {
$t = t3lib_BEfunc::getNoRecordTitle($prep);
$t = self::getNoRecordTitle($prep);
}
}
......
$l = '';
switch((string)$theColConf['type']) {
case 'radio':
$l = t3lib_BEfunc::getLabelFromItemlist($table,$col,$value);
$l = self::getLabelFromItemlist($table, $col, $value);
$l = $GLOBALS['LANG']->sL($l);
break;
case 'select':
......
'uid IN ('.implode(',', $selectUids).')'
);
while($MMrow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($MMres)) {
$mmlA[] = ($noRecordLookup?$MMrow['uid']:t3lib_BEfunc::getRecordTitle($theColConf['foreign_table'], $MMrow, FALSE, $forceResult));
$mmlA[] = ($noRecordLookup ? $MMrow['uid'] : self::getRecordTitle($theColConf['foreign_table'], $MMrow, FALSE, $forceResult));
}
$GLOBALS['TYPO3_DB']->sql_free_result($MMres);
......
$l = 'N/A';
}
} else {
$l = t3lib_BEfunc::getLabelFromItemlist($table, $col, $value);
$l = self::getLabelFromItemlist($table, $col, $value);
$l = $GLOBALS['LANG']->sL($l);
if ($theColConf['foreign_table'] && !$l && $TCA[$theColConf['foreign_table']]) {
if ($noRecordLookup) {
......
foreach ($rParts as $rVal) {
$rVal = intval($rVal);
if ($rVal>0) {
$r = t3lib_BEfunc::getRecordWSOL($theColConf['foreign_table'], $rVal);
$r = self::getRecordWSOL($theColConf['foreign_table'], $rVal);
} else {
$r = t3lib_BEfunc::getRecordWSOL($theColConf['neg_foreign_table'], -$rVal);
$r = self::getRecordWSOL($theColConf['neg_foreign_table'], -$rVal);
}
if (is_array($r)) {
$lA[] = $GLOBALS['LANG']->sL($rVal>0?$theColConf['foreign_table_prefix']:$theColConf['neg_foreign_table_prefix']).t3lib_BEfunc::getRecordTitle($rVal>0?$theColConf['foreign_table']:$theColConf['neg_foreign_table'], $r, FALSE, $forceResult);
$lA[] = $GLOBALS['LANG']->sL($rVal>0?$theColConf['foreign_table_prefix']:$theColConf['neg_foreign_table_prefix']) . self::getRecordTitle($rVal>0?$theColConf['foreign_table']:$theColConf['neg_foreign_table'], $r, FALSE, $forceResult);
} else {
$lA[] = $rVal?'['.$rVal.'!]':'';
}
......
case 'input':
if (isset($value)) {
if (t3lib_div::inList($theColConf['eval'], 'date')) {
$l = t3lib_BEfunc::date($value) .
$l = self::date($value) .
' (' .
($GLOBALS['EXEC_TIME'] - $value > 0 ? '-' : '') .
t3lib_BEfunc::calcAge(abs($GLOBALS['EXEC_TIME'] - $value), $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.minutesHoursDaysYears')) .
self::calcAge(abs($GLOBALS['EXEC_TIME'] - $value), $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.minutesHoursDaysYears')) .
')';
} elseif (t3lib_div::inList($theColConf['eval'], 'time')) {
$l = t3lib_BEfunc::time($value, FALSE);
$l = self::time($value, FALSE);
} elseif (t3lib_div::inList($theColConf['eval'], 'timesec')) {
$l = t3lib_BEfunc::time($value);
$l = self::time($value);
} elseif (t3lib_div::inList($theColConf['eval'], 'datetime')) {
$l = t3lib_BEfunc::datetime($value);
$l = self::datetime($value);
} else {
$l = $value;
}
......
*/
public static function getProcessedValueExtra($table, $fN, $fV, $fixed_lgd_chars = 0, $uid = 0, $forceResult = TRUE) {
global $TCA;
$fVnew = t3lib_BEfunc::getProcessedValue($table, $fN, $fV, $fixed_lgd_chars, 0, 0, $uid, $forceResult);
$fVnew = self::getProcessedValue($table, $fN, $fV, $fixed_lgd_chars, 0, 0, $uid, $forceResult);
if (!isset($fVnew)) {
if (is_array($TCA[$table])) {
if ($fN==$TCA[$table]['ctrl']['tstamp'] || $fN==$TCA[$table]['ctrl']['crdate']) {
$fVnew = t3lib_BEfunc::datetime($fV);
$fVnew = self::datetime($fV);
} elseif ($fN=='pid'){
$fVnew = t3lib_BEfunc::getRecordPath($fV, '1=1', 20); // Fetches the path with no regard to the users permissions to select pages.
$fVnew = self::getRecordPath($fV, '1=1', 20); // Fetches the path with no regard to the users permissions to select pages.
} else {
$fVnew = $fV;
}
......
$onClick = 'vHWin=window.open(\''.$BACK_PATH.'view_help.php?tfID='.($table.'.'.$field).'\',\'viewFieldHelp\',\'height=400,width=600,status=0,menubar=0,scrollbars=1\');vHWin.focus();return false;';
if (is_array($TCA_DESCR[$table]) && is_array($TCA_DESCR[$table]['columns'][$field]) && (isset($BE_USER->uc['edit_showFieldHelp']) || $force)) {
if ($BE_USER->uc['edit_showFieldHelp'] == 'icon') {
$text = t3lib_BEfunc::helpText($table, $field, $BACK_PATH, '');
$text = self::helpText($table, $field, $BACK_PATH, '');
$text = '<span class="typo3-csh-inline">'.$GLOBALS['LANG']->hscAndCharConv($text, false).'</span>';
}
return '<a class="typo3-csh-link" href="#" onclick="'.htmlspecialchars($onClick).'">' . t3lib_iconWorks::getSpriteIcon('actions-system-help-open', array('class' => 'typo3-csh-icon')) . $text.'</a>';
......
if (is_array($TCA_DESCR[$table])) {
// Creating CSH icon and short description:
$fullText = t3lib_BEfunc::helpText($table, $field, $BACK_PATH, '');
$icon = t3lib_BEfunc::helpTextIcon($table, $field, $BACK_PATH);
$fullText = self::helpText($table, $field, $BACK_PATH, '');
$icon = self::helpTextIcon($table, $field, $BACK_PATH);
if ($fullText && !$onlyIconMode && $BE_USER->uc['edit_showFieldHelp'] == 'text') {
......
$addGetVars .= '&MP=' . $mountPointInfo['MPvar'];
}
$viewDomain = t3lib_BEfunc::getViewDomain($id, $rootLine);
$viewDomain = self::getViewDomain($id, $rootLine);
$urlPreviewEnabled = $viewDomain . $viewScriptPreviewEnabled . $id . $addGetVars . $anchor;
$urlPreviewDisabled = $viewDomain . $viewScriptPreviewDisabled . $id . $addGetVars . $anchor;
......
$domain = rtrim(t3lib_div::getIndpEnv('TYPO3_SITE_URL'), '/');
if (!is_array($rootLine)) {
$rootLine = t3lib_BEfunc::BEgetRootLine($pageId);
$rootLine = self::BEgetRootLine($pageId);
}
// checks alternate domains
if (count($rootLine) > 0) {
$urlParts = parse_url($domain);
if (t3lib_BEfunc::getDomainStartPage($urlParts['host'], $urlParts['path'])) {
if (self::getDomainStartPage($urlParts['host'], $urlParts['path'])) {
$protocol = t3lib_div::getIndpEnv('TYPO3_SSL') ? 'https://' : 'http://';
$domain = $protocol . t3lib_BEfunc::firstDomainRecord($rootLine);
$domain = $protocol . self::firstDomainRecord($rootLine);
}
}
......
* @return array
*/
public static function getModTSconfig($id, $TSref) {
$pageTS_modOptions = $GLOBALS['BE_USER']->getTSConfig($TSref, t3lib_BEfunc::getPagesTSconfig($id));
$pageTS_modOptions = $GLOBALS['BE_USER']->getTSConfig($TSref, self::getPagesTSconfig($id));
$BE_USER_modOptions = $GLOBALS['BE_USER']->getTSConfig($TSref);
$modTSconfig = t3lib_div::array_merge_recursive_overrule($pageTS_modOptions, $BE_USER_modOptions);
return $modTSconfig;
......
// kept for backwards compatibility if $set is empty, use "getUpdateSignalCode()" instead
if ($set) {
return t3lib_BEfunc::setUpdateSignal($set);
return self::setUpdateSignal($set);
} else {
return t3lib_BEfunc::getUpdateSignalCode();
return self::getUpdateSignalCode();
}
}
......
$content = implode(LF, $signals);
t3lib_BEfunc::setUpdateSignal(); // for backwards compatibility, should be replaced
self::setUpdateSignal(); // for backwards compatibility, should be replaced
return $content;
}
......
$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.lockedRecordUser'),
$userType,
$userName,
t3lib_BEfunc::calcAge($GLOBALS['EXEC_TIME']-$row['tstamp'], $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.minutesHoursDaysYears'))
self::calcAge($GLOBALS['EXEC_TIME']-$row['tstamp'], $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.minutesHoursDaysYears'))
);
if ($row['record_pid'] && !isset($LOCKED_RECORDS[$row['record_table'].':'.$row['record_pid']])) {
$LOCKED_RECORDS['pages:'.$row['record_pid']]['msg'] = sprintf(
$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.lockedRecordUser_content'),
$userType,
$userName,
t3lib_BEfunc::calcAge($GLOBALS['EXEC_TIME']-$row['tstamp'], $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.minutesHoursDaysYears'))
self::calcAge($GLOBALS['EXEC_TIME']-$row['tstamp'], $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.minutesHoursDaysYears'))
);
}
}
......
$wgolParts = $GLOBALS['TYPO3_DB']->splitGroupOrderLimit($fTWHERE);
if ($rootLevel) {
$queryParts = array(
'SELECT' => t3lib_BEfunc::getCommonSelectFields($foreign_table, $foreign_table.'.'),
'SELECT' => self::getCommonSelectFields($foreign_table, $foreign_table . '.'),
'FROM' => $foreign_table,
'WHERE' => $foreign_table.'.pid=0 '.
t3lib_BEfunc::deleteClause($foreign_table).' '.
self::deleteClause($foreign_table) . ' ' .
$wgolParts['WHERE'],
'GROUPBY' => $wgolParts['GROUPBY'],
'ORDERBY' => $wgolParts['ORDERBY'],
......
$pageClause = $GLOBALS['BE_USER']->getPagePermsClause(1);
if ($foreign_table!='pages') {
$queryParts = array(
'SELECT' => t3lib_BEfunc::getCommonSelectFields($foreign_table, $foreign_table.'.'),
'SELECT' => self::getCommonSelectFields($foreign_table, $foreign_table . '.'),
'FROM' => $foreign_table.', pages',
'WHERE' => 'pages.uid='.$foreign_table.'.pid
AND pages.deleted=0 '.
t3lib_BEfunc::deleteClause($foreign_table).
self::deleteClause($foreign_table) .
' AND '.$pageClause.' '.
$wgolParts['WHERE'],
'GROUPBY' => $wgolParts['GROUPBY'],
......
);
} else {
$queryParts = array(
'SELECT' => t3lib_BEfunc::getCommonSelectFields($foreign_table, $foreign_table.'.'),
'SELECT' => self::getCommonSelectFields($foreign_table, $foreign_table . '.'),
'FROM' => 'pages',
'WHERE' => 'pages.deleted=0
AND '.$pageClause.' '.
......
* @see t3lib_transferData::renderRecord(), t3lib_TCEforms::setTSconfig(), SC_wizard_list::main(), SC_wizard_add::main()
*/
public static function getTCEFORM_TSconfig($table, $row) {
t3lib_BEfunc::fixVersioningPid($table, $row);
self::fixVersioningPid($table, $row);
$res = array();
$typeVal = t3lib_BEfunc::getTCAtypeValue($table, $row);
$typeVal = self::getTCAtypeValue($table, $row);
// Get main config for the table
list($TScID, $cPid) = t3lib_BEfunc::getTSCpid($table, $row['uid'], $row['pid']);
list($TScID, $cPid) = self::getTSCpid($table, $row['uid'], $row['pid']);
$rootLine = t3lib_BEfunc::BEgetRootLine($TScID, '', TRUE);
$rootLine = self::BEgetRootLine($TScID, '', TRUE);
if ($TScID>=0) {
$tempConf = $GLOBALS['BE_USER']->getTSConfig('TCEFORM.'.$table, t3lib_BEfunc::getPagesTSconfig($TScID, $rootLine));
$tempConf = $GLOBALS['BE_USER']->getTSConfig('TCEFORM.' . $table, self::getPagesTSconfig($TScID, $rootLine));
if (is_array($tempConf['properties'])) {
foreach ($tempConf['properties'] as $key => $val) {
if (is_array($val)) {
......
if (t3lib_div::testInt($pid)) { // If pid is an integer this takes precedence in our lookup.
$thePidValue = intval($pid);
if ($thePidValue<0) { // If ref to another record, look that record up.
$pidRec = t3lib_BEfunc::getRecord($table, abs($thePidValue), 'pid');
$pidRec = self::getRecord($table, abs($thePidValue), 'pid');
$thePidValue = is_array($pidRec) ? $pidRec['pid'] : -2; // Returns -2 if the record did not exist.
}
// ... else the pos/zero pid is just returned here.
} else { // No integer pid and we are forced to look up the $pid
$rr = t3lib_BEfunc::getRecord($table, $uid); // Try to fetch the record pid from uid. If the uid is 'NEW...' then this will of course return nothing...
$rr = self::getRecord($table, $uid); // Try to fetch the record pid from uid. If the uid is 'NEW...' then this will of course return nothing...
if (is_array($rr)) {
// First check if the pid is -1 which means it is a workspaced element. Get the "real" record:
if ($rr['pid']=='-1') {
$rr = t3lib_BEfunc::getRecord($table, $rr['t3ver_oid'], 'pid');
$rr = self::getRecord($table, $rr['t3ver_oid'], 'pid');
if (is_array($rr)) {
$thePidValue = $rr['pid'];
}
......
*/
public static function getTSCpid($table, $uid, $pid) {
// If pid is negative (referring to another record) the pid of the other record is fetched and returned.
$cPid = t3lib_BEfunc::getTSconfig_pidValue($table, $uid, $pid);
$cPid = self::getTSconfig_pidValue($table, $uid, $pid);
// $TScID is the id of $table = pages, else it's the pid of the record.
$TScID = t3lib_BEfunc::getPidForModTSconfig($table, $uid, $cPid);
$TScID = self::getPidForModTSconfig($table, $uid, $cPid);
return array($TScID, $cPid);
}
......
public static function firstDomainRecord($rootLine) {
if (t3lib_extMgm::isLoaded('cms')) {
foreach ($rootLine as $row) {
$dRec = t3lib_BEfunc::getRecordsByField('sys_domain', 'pid', $row['uid'], ' AND redirectTo=\'\' AND hidden=0', '', 'sorting');
$dRec = self::getRecordsByField('sys_domain', 'pid', $row['uid'], ' AND redirectTo=\'\' AND hidden=0', '', 'sorting');
if (is_array($dRec)) {
reset($dRec);
$dRecord = current($dRec);
......
pages.uid=sys_domain.pid
AND sys_domain.hidden=0
AND (sys_domain.domainName='.$GLOBALS['TYPO3_DB']->fullQuoteStr($domain, 'sys_domain').' OR sys_domain.domainName='.$GLOBALS['TYPO3_DB']->fullQuoteStr($domain.'/', 'sys_domain').')'.
t3lib_BEfunc::deleteClause('pages'),
self::deleteClause('pages'),
'', '', '1');
$result = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
$GLOBALS['TYPO3_DB']->sql_free_result($res);
......
$fields,
$table,
'uid=' . intval($uid) .
($includeDeletedRecords ? '' : t3lib_BEfunc::deleteClause($table))
($includeDeletedRecords ? '' : self::deleteClause($table))
);
// Add rows to output array:
......
$fields,
$table,
'pid=-1 AND uid!='.intval($uid).' AND t3ver_oid='.intval($uid).($workspace!=0?' AND t3ver_wsid='.intval($workspace):'').
($includeDeletedRecords ? '' : t3lib_BEfunc::deleteClause($table)),
($includeDeletedRecords ? '' : self::deleteClause($table)),
'',
't3ver_id DESC'
);
......
$oid = $rr['t3ver_oid'];
$wsid = $rr['t3ver_wsid'];
} else { // Otherwise we have to expect "uid" to be in the record and look up based on this:
$newPidRec = t3lib_BEfunc::getRecord($table, $rr['uid'], 't3ver_oid,t3ver_wsid');
$newPidRec = self::getRecord($table, $rr['uid'], 't3ver_oid,t3ver_wsid');
if (is_array($newPidRec)) {
$oid = $newPidRec['t3ver_oid'];
$wsid = $newPidRec['t3ver_wsid'];
......
// If ID of current online version is found, look up the PID value of that:
if ($oid && ($ignoreWorkspaceMatch || !strcmp((int)$wsid, $GLOBALS['BE_USER']->workspace))) {
$oidRec = t3lib_BEfunc::getRecord($table, $oid, 'pid');
$oidRec = self::getRecord($table, $oid, 'pid');
if (is_array($oidRec)) {
$rr['_ORIG_pid'] = $rr['pid'];
$rr['pid'] = $oidRec['pid'];
......
if ($previewMovePlaceholders) {
$orig_uid = $row['uid'];
$orig_pid = $row['pid'];
$movePldSwap = t3lib_BEfunc::movePlhOL($table, $row);
$movePldSwap = self::movePlhOL($table, $row);
# if (!is_array($row)) return;
}
$wsAlt = t3lib_BEfunc::getWorkspaceVersionOfRecord($wsid, $table, $row['uid'], implode(',', array_keys($row)));
$wsAlt = self::getWorkspaceVersionOfRecord($wsid, $table, $row['uid'], implode(',', array_keys($row)));
// If version was found, swap the default record with that one.
if (is_array($wsAlt)) {
......
// If t3ver_state is not found, then find it... (but we like best if it is here...)
if (!isset($wsAlt['t3ver_state'])) {
$stateRec = t3lib_BEfunc::getRecord($table, $wsAlt['uid'], 't3ver_state');
$stateRec = self::getRecord($table, $wsAlt['uid'], 't3ver_state');
$state = $stateRec['t3ver_state'];
} else {
$state = $wsAlt['t3ver_state'];
......
// If t3ver_move_id or t3ver_state is not found, then find it... (but we like best if it is here...)
if (!isset($row['t3ver_move_id']) || !isset($row['t3ver_state'])) {
$moveIDRec = t3lib_BEfunc::getRecord($table, $row['uid'], 't3ver_move_id, t3ver_state');
$moveIDRec = self::getRecord($table, $row['uid'], 't3ver_move_id, t3ver_state');
$moveID = $moveIDRec['t3ver_move_id'];
$state = $moveIDRec['t3ver_state'];
} else {
......
// Find pointed-to record.
if ((int)$state===3 && $moveID) {
if ($origRow = t3lib_BEfunc::getRecord($table, $moveID, implode(',', array_keys($row)))) {
if ($origRow = self::getRecord($table, $moveID, implode(',', array_keys($row)))) {
$row = $origRow;
return TRUE;
}
......
'pid=-1 AND
t3ver_oid=' . intval($uid) . ' AND
t3ver_wsid=' . intval($workspace) .
t3lib_BEfunc::deleteClause($table)
self::deleteClause($table)
);
if (is_array($rows[0])) return $rows[0];
......
// Check that table supports versioning:
if ($TCA[$table] && $TCA[$table]['ctrl']['versioningWS']) {
$rec = t3lib_BEfunc::getRecord($table, $uid, 'pid,t3ver_oid');
$rec = self::getRecord($table, $uid, 'pid,t3ver_oid');
if ($rec['pid']==-1) {
return t3lib_BEfunc::getRecord($table, $rec['t3ver_oid'], $fields);
return self::getRecord($table, $rec['t3ver_oid'], $fields);
}
}
}
......
* @return mixed Returns either "branchpoint" (if branch) or "first" (if page) or false if nothing. Alternatively, it returns the value of "t3ver_stage" for the branchpoint (if any)
*/
public static function isPidInVersionizedBranch($pid, $table = '', $returnStage = FALSE) {
$rl = t3lib_BEfunc::BEgetRootLine($pid);
$rl = self::BEgetRootLine($pid);
$c = 0;
foreach($rl as $rec) {
......
' AND B.pid='.intval($pageId).
' AND A.t3ver_wsid='.intval($workspace).
' AND A.t3ver_oid=B.uid'. // ... and finally the join between the two tables.
t3lib_BEfunc::deleteClause($tableName, 'A').
t3lib_BEfunc::deleteClause($tableName, 'B')
self::deleteClause($tableName, 'A').
self::deleteClause($tableName, 'B')
);
if (!is_array($output[$tableName]) || !count($output[$tableName])) {
......
* @return integer Uid of offline version if any, otherwise live uid.
*/
public static function wsMapId($table, $uid) {
if ($wsRec = t3lib_BEfunc::getWorkspaceVersionOfRecord($GLOBALS['BE_USER']->workspace, $table, $uid, 'uid')) {
if ($wsRec = self::getWorkspaceVersionOfRecord($GLOBALS['BE_USER']->workspace, $table, $uid, 'uid')) {
return $wsRec['uid'];
} else {
return $uid;
......
t3ver_state=3 AND
t3ver_move_id='.intval($uid).' AND
t3ver_wsid='.intval($workspace).
t3lib_BEfunc::deleteClause($table)
self::deleteClause($table)
);
if (is_array($rows[0])) return $rows[0];
......
}
// Check if there is still a default user 'admin' with password 'password' (MD5sum = 5f4dcc3b5aa765d61d8327deb882cf99)
$where_clause = 'username='.$GLOBALS['TYPO3_DB']->fullQuoteStr('admin', 'be_users').' AND password='.$GLOBALS['TYPO3_DB']->fullQuoteStr('5f4dcc3b5aa765d61d8327deb882cf99', 'be_users').t3lib_BEfunc::deleteClause('be_users');
$where_clause = 'username=' . $GLOBALS['TYPO3_DB']->fullQuoteStr('admin', 'be_users') . ' AND password=' .
$GLOBALS['TYPO3_DB']->fullQuoteStr('5f4dcc3b5aa765d61d8327deb882cf99', 'be_users') . self::deleteClause('be_users');
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid, username, password', 'be_users', $where_clause);
if ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
$url = "alt_doc.php?returnUrl=index.php&edit[be_users][".$row['uid']."]=edit";
......
$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:warning.backend_reference_index'),
'<a href="'.$url.'">',
'</a>',
t3lib_BEfunc::dateTime($lastRefIndexUpdate));
self::dateTime($lastRefIndexUpdate));
}
// Check for memcached if configured
......
public static function getListOfBackendModules($name, $perms_clause, $backPath = '', $script = 'index.php') {
t3lib_div::logDeprecatedFunction();
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'pages', 'doktype!=255 AND module IN (\''.implode('\',\'', $name).'\') AND'.$perms_clause.t3lib_BEfunc::deleteClause('pages'));
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'pages', 'doktype!=255 AND module IN (\'' . implode('\',\'', $name) . '\') AND' . $perms_clause . self::deleteClause('pages'));
if (!$GLOBALS['TYPO3_DB']->sql_num_rows($res)) return false;
$out = '';
......
while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
$theRows[] = $row;
$out.='<span class="nobr"><a href="'.htmlspecialchars($script.'?id='.$row['uid']).'">'.
t3lib_iconWorks::getIconImage('pages', $row, $backPath, 'title="'.htmlspecialchars(t3lib_BEfunc::getRecordPath($row['uid'], $perms_clause, 20)).'" align="top"').
t3lib_iconWorks::getIconImage('pages', $row, $backPath, 'title="' . htmlspecialchars(self::getRecordPath($row['uid'], $perms_clause, 20)) . '" align="top"') .
htmlspecialchars($row['title']).
'</a></span><br />';
}
    (1-1/1)