| [ PHPXref.com ] | [ Generated: Sun Jul 20 20:48:27 2008 ] | [ TYPO3 4.0 ] |
| [ Index ] [ Variables ] [ Functions ] [ Classes ] [ Constants ] [ Statistics ] | ||
[Summary view] [Print] [Text view]
1 <?php 2 /*************************************************************** 3 * Copyright notice 4 * 5 * (c) 1999-2006 Kasper Skaarhoj (kasperYYYY@typo3.com) 6 * All rights reserved 7 * 8 * This script is part of the TYPO3 project. The TYPO3 project is 9 * free software; you can redistribute it and/or modify 10 * it under the terms of the GNU General Public License as published by 11 * the Free Software Foundation; either version 2 of the License, or 12 * (at your option) any later version. 13 * 14 * The GNU General Public License can be found at 15 * http://www.gnu.org/copyleft/gpl.html. 16 * A copy is found in the textfile GPL.txt and important notices to the license 17 * from the author is found in LICENSE.txt distributed with these scripts. 18 * 19 * 20 * This script is distributed in the hope that it will be useful, 21 * but WITHOUT ANY WARRANTY; without even the implied warranty of 22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 * GNU General Public License for more details. 24 * 25 * This copyright notice MUST APPEAR in all copies of the script! 26 ***************************************************************/ 27 /** 28 * Standard functions available for the TYPO3 backend. 29 * You are encouraged to use this class in your own applications (Backend Modules) 30 * 31 * Call ALL methods without making an object! 32 * Eg. to get a page-record 51 do this: 't3lib_BEfunc::getRecord('pages',51)' 33 * 34 * $Id: class.t3lib_befunc.php,v 1.60.2.22 2006/03/23 16:21:48 typo3 Exp $ 35 * Usage counts are based on search 22/2 2003 through whole backend source of typo3/ 36 * Revised for TYPO3 3.6 July/2003 by Kasper Skaarhoj 37 * XHTML compliant 38 * 39 * @author Kasper Skaarhoj <kasperYYYY@typo3.com> 40 */ 41 /** 42 * [CLASS/FUNCTION INDEX of SCRIPT] 43 * 44 * 45 * 46 * 183: class t3lib_BEfunc 47 * 48 * SECTION: SQL-related, selecting records, searching 49 * 204: function deleteClause($table,$tableAlias='') 50 * 227: function getRecord($table,$uid,$fields='*',$where='') 51 * 245: function getRecordWSOL($table,$uid,$fields='*',$where='') 52 * 278: function getRecordRaw($table,$where='',$fields='*') 53 * 300: function getRecordsByField($theTable,$theField,$theValue,$whereClause='',$groupBy='',$orderBy='',$limit='') 54 * 333: function searchQuery($searchWords,$fields,$table='') 55 * 348: function listQuery($field,$value) 56 * 360: function splitTable_Uid($str) 57 * 375: function getSQLselectableList($in_list,$tablename,$default_tablename) 58 * 403: function BEenableFields($table,$inv=0) 59 * 60 * SECTION: SQL-related, DEPRECATED functions 61 * 467: function mm_query($select,$local_table,$mm_table,$foreign_table,$whereClause='',$groupBy='',$orderBy='',$limit='') 62 * 489: function DBcompileInsert($table,$fields_values) 63 * 503: function DBcompileUpdate($table,$where,$fields_values) 64 * 65 * SECTION: Page tree, TCA related 66 * 533: function BEgetRootLine($uid,$clause='',$workspaceOL=FALSE) 67 * 589: function openPageTree($pid,$clearExpansion) 68 * 634: function getRecordPath($uid, $clause, $titleLimit, $fullTitleLimit=0) 69 * 677: function getExcludeFields() 70 * 707: function getExplicitAuthFieldValues() 71 * 778: function getSystemLanguages() 72 * 803: function readPageAccess($id,$perms_clause) 73 * 834: function getTCAtypes($table,$rec,$useFieldNameAsKey=0) 74 * 887: function getTCAtypeValue($table,$rec) 75 * 910: function getSpecConfParts($str, $defaultExtras) 76 * 941: function getSpecConfParametersFromArray($pArr) 77 * 969: function getFlexFormDS($conf,$row,$table,$fieldName='',$WSOL=TRUE) 78 * 79 * SECTION: Caching related 80 * 1096: function storeHash($hash,$data,$ident) 81 * 1116: function getHash($hash,$expTime=0) 82 * 83 * SECTION: TypoScript related 84 * 1152: function getPagesTSconfig($id,$rootLine='',$returnPartArray=0) 85 * 1208: function updatePagesTSconfig($id,$pageTS,$TSconfPrefix,$impParams='') 86 * 1263: function implodeTSParams($p,$k='') 87 * 88 * SECTION: Users / Groups related 89 * 1300: function getUserNames($fields='username,usergroup,usergroup_cached_list,uid',$where='') 90 * 1318: function getGroupNames($fields='title,uid', $where='') 91 * 1335: function getListGroupNames($fields='title,uid') 92 * 1354: function blindUserNames($usernames,$groupArray,$excludeBlindedFlag=0) 93 * 1387: function blindGroupNames($groups,$groupArray,$excludeBlindedFlag=0) 94 * 95 * SECTION: Output related 96 * 1428: function daysUntil($tstamp) 97 * 1440: function date($tstamp) 98 * 1451: function datetime($value) 99 * 1463: function time($value) 100 * 1479: function calcAge($seconds,$labels = 'min|hrs|days|yrs') 101 * 1505: function dateTimeAge($tstamp,$prefix=1,$date='') 102 * 1523: function titleAttrib($content='',$hsc=0) 103 * 1536: function titleAltAttrib($content) 104 * 1560: function thumbCode($row,$table,$field,$backPath,$thumbScript='',$uploaddir=NULL,$abs=0,$tparams='',$size='') 105 * 1628: function getThumbNail($thumbScript,$theFile,$tparams='',$size='') 106 * 1645: function titleAttribForPages($row,$perms_clause='',$includeAttrib=1) 107 * 1707: function getRecordIconAltText($row,$table='pages') 108 * 1749: function getLabelFromItemlist($table,$col,$key) 109 * 1775: function getItemLabel($table,$col,$printAllWrap='') 110 * 1800: function getRecordTitle($table,$row,$prep=0) 111 * 1838: function getProcessedValue($table,$col,$value,$fixed_lgd_chars=0,$defaultPassthrough=0,$noRecordLookup=FALSE,$uid=0) 112 * 1989: function getProcessedValueExtra($table,$fN,$fV,$fixed_lgd_chars=0,$uid=0) 113 * 2013: function getFileIcon($ext) 114 * 2027: function getCommonSelectFields($table,$prefix='') 115 * 2070: function makeConfigForm($configArray,$defaults,$dataPrefix) 116 * 117 * SECTION: Backend Modules API functions 118 * 2145: function helpTextIcon($table,$field,$BACK_PATH,$force=0) 119 * 2167: function helpText($table,$field,$BACK_PATH,$styleAttrib='') 120 * 2219: function cshItem($table,$field,$BACK_PATH,$wrap='',$onlyIconMode=FALSE, $styleAttrib='') 121 * 2257: function editOnClick($params,$backPath='',$requestUri='') 122 * 2276: function viewOnClick($id,$backPath='',$rootLine='',$anchor='',$altUrl='',$addGetVars='',$switchFocus=TRUE) 123 * 2308: function getModTSconfig($id,$TSref) 124 * 2329: function getFuncMenu($mainParams,$elementName,$currentValue,$menuItems,$script='',$addparams='') 125 * 2372: function getFuncCheck($mainParams,$elementName,$currentValue,$script='',$addparams='',$tagParams='') 126 * 2397: function getFuncInput($mainParams,$elementName,$currentValue,$size=10,$script="",$addparams="") 127 * 2418: function unsetMenuItems($modTSconfig,$itemArray,$TSref) 128 * 2441: function getSetUpdateSignal($set='') 129 * 2492: function getModuleData($MOD_MENU, $CHANGED_SETTINGS, $modName, $type='', $dontValidateList='', $setDefaultList='') 130 * 131 * SECTION: Core 132 * 2565: function compilePreviewKeyword($getVarsStr, $beUserUid, $ttl=172800) 133 * 2593: function lockRecords($table='',$uid=0,$pid=0) 134 * 2622: function isRecordLocked($table,$uid) 135 * 2662: function exec_foreign_table_where_query($fieldValue,$field='',$TSconfig=array(),$prefix='') 136 * 2743: function getTCEFORM_TSconfig($table,$row) 137 * 2794: function getTSconfig_pidValue($table,$uid,$pid) 138 * 2824: function getPidForModTSconfig($table,$uid,$pid) 139 * 2840: function getTSCpid($table,$uid,$pid) 140 * 2856: function firstDomainRecord($rootLine) 141 * 2878: function getDomainStartPage($domain, $path='') 142 * 2908: function RTEsetup($RTEprop,$table,$field,$type='') 143 * 2927: function &RTEgetObj() 144 * 2966: function &softRefParserObj($spKey) 145 * 2998: function explodeSoftRefParserList($parserList) 146 * 3030: function isModuleSetInTBE_MODULES($modName) 147 * 3053: function referenceCount($table,$ref,$msg='') 148 * 149 * SECTION: Workspaces / Versioning 150 * 3112: function selectVersionsOfRecord($table, $uid, $fields='*', $workspace=0) 151 * 3160: function fixVersioningPid($table,&$rr,$ignoreWorkspaceMatch=FALSE) 152 * 3200: function workspaceOL($table,&$row,$wsid=-99) 153 * 3248: function getWorkspaceVersionOfRecord($workspace, $table, $uid, $fields='*') 154 * 3277: function getLiveVersionOfRecord($table,$uid,$fields='*') 155 * 3299: function isPidInVersionizedBranch($pid, $table='',$returnStage=FALSE) 156 * 3322: function versioningPlaceholderClause($table) 157 * 3336: function countVersionsOfRecordsOnPage($workspace,$pageId, $allTables=FALSE) 158 * 3371: function wsMapId($table,$uid) 159 * 160 * SECTION: Miscellaneous 161 * 3401: function typo3PrintError($header,$text,$js='',$head=1) 162 * 3445: function TYPO3_copyRightNotice() 163 * 3469: function displayWarningMessages() 164 * 3526: function getPathType_web_nonweb($path) 165 * 3538: function ADMCMD_previewCmds($pageinfo) 166 * 3560: function processParams($params) 167 * 3586: function getListOfBackendModules($name,$perms_clause,$backPath='',$script='index.php') 168 * 169 * TOTAL FUNCTIONS: 99 170 * (This index is automatically created/updated by the extension "extdeveval") 171 * 172 */ 173 174 175 /** 176 * Standard functions available for the TYPO3 backend. 177 * Don't instantiate - call functions with "t3lib_BEfunc::" prefixed the function name. 178 * 179 * @author Kasper Skaarhoj <kasperYYYY@typo3.com> 180 * @package TYPO3 181 * @subpackage t3lib 182 */ 183 class t3lib_BEfunc { 184 185 186 187 /******************************************* 188 * 189 * SQL-related, selecting records, searching 190 * 191 *******************************************/ 192 193 194 /** 195 * Returns the WHERE clause " AND NOT [tablename].[deleted-field]" if a deleted-field is configured in $TCA for the tablename, $table 196 * This function should ALWAYS be called in the backend for selection on tables which are configured in TCA since it will ensure consistent selection of records, even if they are marked deleted (in which case the system must always treat them as non-existent!) 197 * In the frontend a function, ->enableFields(), is known to filter hidden-field, start- and endtime and fe_groups as well. But that is a job of the frontend, not the backend. If you need filtering on those fields as well in the backend you can use ->BEenableFields() though. 198 * Usage: 71 199 * 200 * @param string Table name present in $TCA 201 * @param string Table alias if any 202 * @return string WHERE clause for filtering out deleted records, eg " AND tablename.deleted=0" 203 */ 204 function deleteClause($table,$tableAlias='') { 205 global $TCA; 206 if ($TCA[$table]['ctrl']['delete']) { 207 return ' AND '.($tableAlias ? $tableAlias : $table).'.'.$TCA[$table]['ctrl']['delete'].'=0'; 208 } else { 209 return ''; 210 } 211 } 212 213 /** 214 * Gets record with uid=$uid from $table 215 * You can set $field to a list of fields (default is '*') 216 * Additional WHERE clauses can be added by $where (fx. ' AND blabla=1') 217 * Will automatically check if records has been deleted and if so, not return anything. 218 * $table must be found in $TCA 219 * Usage: 99 220 * 221 * @param string Table name present in $TCA 222 * @param integer UID of record 223 * @param string List of fields to select 224 * @param string Additional WHERE clause, eg. " AND blablabla=0" 225 * @return array Returns the row if found, otherwise nothing 226 */ 227 function getRecord($table,$uid,$fields='*',$where='') { 228 if ($GLOBALS['TCA'][$table]) { 229 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery($fields, $table, 'uid='.intval($uid).t3lib_BEfunc::deleteClause($table).$where); 230 if ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { 231 return $row; 232 } 233 } 234 } 235 236 /** 237 * Like getRecord(), but overlays workspace version if any. 238 * 239 * @param string Table name present in $TCA 240 * @param integer UID of record 241 * @param string List of fields to select 242 * @param string Additional WHERE clause, eg. " AND blablabla=0" 243 * @return array Returns the row if found, otherwise nothing 244 */ 245 function getRecordWSOL($table,$uid,$fields='*',$where='') { 246 if ($fields !== '*') { 247 $internalFields = t3lib_div::uniqueList($fields.',uid,pid'.($table == 'pages' ? ',t3ver_swapmode' : '')); 248 $row = t3lib_BEfunc::getRecord($table,$uid,$internalFields,$where); 249 t3lib_BEfunc::workspaceOL($table,$row); 250 251 if (is_array ($row)) { 252 foreach (array_keys($row) as $key) { 253 if (!t3lib_div::inList($fields, $key) && $key{0} !== '_') { 254 unset ($row[$key]); 255 } 256 } 257 } 258 } else { 259 $row = t3lib_BEfunc::getRecord($table,$uid,$fields,$where); 260 t3lib_BEfunc::workspaceOL($table,$row); 261 } 262 return $row; 263 } 264 265 /** 266 * Returns the first record found from $table with $where as WHERE clause 267 * This function does NOT check if a record has the deleted flag set. 268 * $table does NOT need to be configured in $TCA 269 * The query used is simply this: 270 * $query='SELECT '.$fields.' FROM '.$table.' WHERE '.$where; 271 * Usage: 5 (ext: sys_todos) 272 * 273 * @param string Table name (not necessarily in TCA) 274 * @param string WHERE clause 275 * @param string $fields is a list of fields to select, default is '*' 276 * @return array First row found, if any 277 */ 278 function getRecordRaw($table,$where='',$fields='*') { 279 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery($fields, $table, $where); 280 if ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { 281 return $row; 282 } 283 } 284 285 /** 286 * Returns records from table, $theTable, where a field ($theField) equals the value, $theValue 287 * The records are returned in an array 288 * If no records were selected, the function returns nothing 289 * Usage: 8 290 * 291 * @param string Table name present in $TCA 292 * @param string Field to select on 293 * @param string Value that $theField must match 294 * @param string Optional additional WHERE clauses put in the end of the query. DO NOT PUT IN GROUP BY, ORDER BY or LIMIT! 295 * @param string Optional GROUP BY field(s), if none, supply blank string. 296 * @param string Optional ORDER BY field(s), if none, supply blank string. 297 * @param string Optional LIMIT value ([begin,]max), if none, supply blank string. 298 * @return mixed Multidimensional array with selected records (if any is selected) 299 */ 300 function getRecordsByField($theTable,$theField,$theValue,$whereClause='',$groupBy='',$orderBy='',$limit='') { 301 global $TCA; 302 if (is_array($TCA[$theTable])) { 303 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery( 304 '*', 305 $theTable, 306 $theField.'='.$GLOBALS['TYPO3_DB']->fullQuoteStr($theValue, $theTable). 307 t3lib_BEfunc::deleteClause($theTable).' '. 308 t3lib_BEfunc::versioningPlaceholderClause($theTable).' '. 309 $whereClause, // whereClauseMightContainGroupOrderBy 310 $groupBy, 311 $orderBy, 312 $limit 313 ); 314 $rows = array(); 315 while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { 316 $rows[] = $row; 317 } 318 $GLOBALS['TYPO3_DB']->sql_free_result($res); 319 if (count($rows)) return $rows; 320 } 321 } 322 323 /** 324 * 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. 325 * Usage: 0 326 * 327 * @param array Array of search words 328 * @param array Array of fields 329 * @param string Table in which we are searching (for DBAL detection of quoteStr() method) 330 * @return string WHERE clause for search 331 * @deprecated Use $GLOBALS['TYPO3_DB']->searchQuery() directly! 332 */ 333 function searchQuery($searchWords,$fields,$table='') { 334 return $GLOBALS['TYPO3_DB']->searchQuery($searchWords,$fields,$table); 335 } 336 337 /** 338 * Returns a WHERE clause that can find a value ($value) in a list field ($field) 339 * For instance a record in the database might contain a list of numbers, "34,234,5" (with no spaces between). This query would be able to select that record based on the value "34", "234" or "5" regardless of their positioni in the list (left, middle or right). 340 * Is nice to look up list-relations to records or files in TYPO3 database tables. 341 * Usage: 0 342 * 343 * @param string Table field name 344 * @param string Value to find in list 345 * @return string WHERE clause for a query 346 * @deprecated Use $GLOBALS['TYPO3_DB']->listQuery() directly! 347 */ 348 function listQuery($field,$value) { 349 return $GLOBALS['TYPO3_DB']->listQuery($field,$value,''); 350 } 351 352 /** 353 * Makes an backwards explode on the $str and returns an array with ($table,$uid). 354 * Example: tt_content_45 => array('tt_content',45) 355 * Usage: 1 356 * 357 * @param string [tablename]_[uid] string to explode 358 * @return array 359 */ 360 function splitTable_Uid($str) { 361 list($uid,$table) = explode('_',strrev($str),2); 362 return array(strrev($table),strrev($uid)); 363 } 364 365 /** 366 * Returns a list of pure integers based on $in_list being a list of records with table-names prepended. 367 * Ex: $in_list = "pages_4,tt_content_12,45" would result in a return value of "4,45" if $tablename is "pages" and $default_tablename is 'pages' as well. 368 * Usage: 1 (t3lib_userauthgroup) 369 * 370 * @param string Input list 371 * @param string Table name from which ids is returned 372 * @param string $default_tablename denotes what table the number '45' is from (if nothing is prepended on the value) 373 * @return string List of ids 374 */ 375 function getSQLselectableList($in_list,$tablename,$default_tablename) { 376 $list = Array(); 377 if ((string)trim($in_list)!='') { 378 $tempItemArray = explode(',',trim($in_list)); 379 while(list($key,$val)=each($tempItemArray)) { 380 $val = strrev($val); 381 $parts = explode('_',$val,2); 382 if ((string)trim($parts[0])!='') { 383 $theID = intval(strrev($parts[0])); 384 $theTable = trim($parts[1]) ? strrev(trim($parts[1])) : $default_tablename; 385 if ($theTable==$tablename) {$list[]=$theID;} 386 } 387 } 388 } 389 return implode(',',$list); 390 } 391 392 /** 393 * Backend implementation of enableFields() 394 * Notice that "fe_groups" is not selected for - only disabled, starttime and endtime. 395 * Notice that deleted-fields are NOT filtered - you must ALSO call deleteClause in addition. 396 * $GLOBALS["SIM_EXEC_TIME"] is used for date. 397 * Usage: 5 398 * 399 * @param string $table is the table from which to return enableFields WHERE clause. Table name must have a 'ctrl' section in $TCA. 400 * @param boolean $inv means that the query will select all records NOT VISIBLE records (inverted selection) 401 * @return string WHERE clause part 402 */ 403 function BEenableFields($table,$inv=0) { 404 $ctrl = $GLOBALS['TCA'][$table]['ctrl']; 405 $query=array(); 406 $invQuery=array(); 407 if (is_array($ctrl)) { 408 if (is_array($ctrl['enablecolumns'])) { 409 if ($ctrl['enablecolumns']['disabled']) { 410 $field = $table.'.'.$ctrl['enablecolumns']['disabled']; 411 $query[]=$field.'=0'; 412 $invQuery[]=$field.'!=0'; 413 } 414 if ($ctrl['enablecolumns']['starttime']) { 415 $field = $table.'.'.$ctrl['enablecolumns']['starttime']; 416 $query[]='('.$field.'<='.$GLOBALS['SIM_EXEC_TIME'].')'; 417 $invQuery[]='('.$field.'!=0 AND '.$field.'>'.$GLOBALS['SIM_EXEC_TIME'].')'; 418 } 419 if ($ctrl['enablecolumns']['endtime']) { 420 $field = $table.'.'.$ctrl['enablecolumns']['endtime']; 421 $query[]='('.$field.'=0 OR '.$field.'>'.$GLOBALS['SIM_EXEC_TIME'].')'; 422 $invQuery[]='('.$field.'!=0 AND '.$field.'<='.$GLOBALS['SIM_EXEC_TIME'].')'; 423 } 424 } 425 } 426 $outQ = ' AND '.($inv ? '('.implode(' OR ',$invQuery).')' : implode(' AND ',$query)); 427 428 return $outQ; 429 } 430 431 432 433 434 435 436 437 438 439 440 /******************************************* 441 * 442 * SQL-related, DEPRECATED functions 443 * (use t3lib_DB functions instead) 444 * 445 *******************************************/ 446 447 448 /** 449 * Returns a SELECT query, selecting fields ($select) from two/three tables joined 450 * $local_table and $mm_table is mandatory. $foreign_table is optional. 451 * The JOIN is done with [$local_table].uid <--> [$mm_table].uid_local / [$mm_table].uid_foreign <--> [$foreign_table].uid 452 * The function is very useful for selecting MM-relations between tables adhering to the MM-format used by TCE (TYPO3 Core Engine). See the section on $TCA in Inside TYPO3 for more details. 453 * DEPRECATED - Use $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query() instead since that will return the result pointer while this returns the query. Using this function may make your application less fitted for DBAL later. 454 * 455 * @param string Field list for SELECT 456 * @param string Tablename, local table 457 * @param string Tablename, relation table 458 * @param string Tablename, foreign table 459 * @param string Optional additional WHERE clauses put in the end of the query. DO NOT PUT IN GROUP BY, ORDER BY or LIMIT! 460 * @param string Optional GROUP BY field(s), if none, supply blank string. 461 * @param string Optional ORDER BY field(s), if none, supply blank string. 462 * @param string Optional LIMIT value ([begin,]max), if none, supply blank string. 463 * @return string Full SQL query 464 * @deprecated 465 * @see t3lib_DB::exec_SELECT_mm_query() 466 */ 467 function mm_query($select,$local_table,$mm_table,$foreign_table,$whereClause='',$groupBy='',$orderBy='',$limit='') { 468 $query = $GLOBALS['TYPO3_DB']->SELECTquery( 469 $select, 470 $local_table.','.$mm_table.($foreign_table?','.$foreign_table:''), 471 $local_table.'.uid='.$mm_table.'.uid_local'.($foreign_table?' AND '.$foreign_table.'.uid='.$mm_table.'.uid_foreign':'').' '. 472 $whereClause, // whereClauseMightContainGroupOrderBy 473 $groupBy, 474 $orderBy, 475 $limit 476 ); 477 return $query; 478 } 479 480 /** 481 * Creates an INSERT SQL-statement for $table from the array with field/value pairs $fields_values. 482 * DEPRECATED - $GLOBALS['TYPO3_DB']->INSERTquery() directly instead! But better yet, use $GLOBALS['TYPO3_DB']->exec_INSERTquery() 483 * 484 * @param string Table name 485 * @param array Field values as key=>value pairs. 486 * @return string Full SQL query for INSERT 487 * @deprecated 488 */ 489 function DBcompileInsert($table,$fields_values) { 490 return $GLOBALS['TYPO3_DB']->INSERTquery($table, $fields_values); 491 } 492 493 /** 494 * Creates an UPDATE SQL-statement for $table where $where-clause (typ. 'uid=...') from the array with field/value pairs $fields_values. 495 * DEPRECATED - $GLOBALS['TYPO3_DB']->UPDATEquery() directly instead! But better yet, use $GLOBALS['TYPO3_DB']->exec_UPDATEquery() 496 * 497 * @param string Database tablename 498 * @param string WHERE clause, eg. "uid=1" 499 * @param array Field values as key=>value pairs. 500 * @return string Full SQL query for UPDATE 501 * @deprecated 502 */ 503 function DBcompileUpdate($table,$where,$fields_values) { 504 return $GLOBALS['TYPO3_DB']->UPDATEquery($table, $where, $fields_values); 505 } 506 507 508 509 510 511 512 513 514 515 516 /******************************************* 517 * 518 * Page tree, TCA related 519 * 520 *******************************************/ 521 522 /** 523 * Returns what is called the 'RootLine'. That is an array with information about the page records from a page id ($uid) and back to the root. 524 * By default deleted pages are filtered. 525 * This RootLine will follow the tree all the way to the root. This is opposite to another kind of root line known from the frontend where the rootline stops when a root-template is found. 526 * Usage: 1 527 * 528 * @param integer Page id for which to create the root line. 529 * @param string $clause can be used to select other criteria. It would typically be where-clauses that stops the process if we meet a page, the user has no reading access to. 530 * @param boolean If true, version overlay is applied. This must be requested specifically because it is usually only wanted when the rootline is used for visual output while for permission checking you want the raw thing! 531 * @return array Root line array, all the way to the page tree root (or as far as $clause allows!) 532 */ 533 function BEgetRootLine($uid,$clause='',$workspaceOL=FALSE) { 534 $loopCheck = 100; 535 $theRowArray = Array(); 536 $output = Array(); 537 while ($uid!=0 && $loopCheck>0) { 538 $loopCheck--; 539 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery( 540 'pid,uid,title,TSconfig,is_siteroot,storage_pid,t3ver_oid,t3ver_wsid,t3ver_state,t3ver_swapmode,t3ver_stage', 541 'pages', 542 'uid='.intval($uid).' '. 543 t3lib_BEfunc::deleteClause('pages').' '. 544 $clause // whereClauseMightContainGroupOrderBy 545 ); 546 if ($GLOBALS['TYPO3_DB']->sql_error()) { 547 debug($GLOBALS['TYPO3_DB']->sql_error(),1); 548 } 549 if ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { 550 if($workspaceOL) t3lib_BEfunc::workspaceOL('pages',$row); 551 t3lib_BEfunc::fixVersioningPid('pages',$row); 552 $uid = $row['pid']; 553 $theRowArray[] = $row; 554 } else { 555 break; 556 } 557 } 558 if ($uid==0) {$theRowArray[] = Array('uid'=>0,'title'=>'');} 559 if (is_array($theRowArray)) { 560 reset($theRowArray); 561 $c=count($theRowArray); 562 while(list($key,$val)=each($theRowArray)) { 563 $c--; 564 $output[$c]['uid'] = $val['uid']; 565 $output[$c]['pid'] = $val['pid']; 566 if (isset($val['_ORIG_pid'])) $output[$c]['_ORIG_pid'] = $val['_ORIG_pid']; 567 $output[$c]['title'] = $val['title']; 568 $output[$c]['TSconfig'] = $val['TSconfig']; 569 $output[$c]['is_siteroot'] = $val['is_siteroot']; 570 $output[$c]['storage_pid'] = $val['storage_pid']; 571 $output[$c]['t3ver_oid'] = $val['t3ver_oid']; 572 $output[$c]['t3ver_wsid'] = $val['t3ver_wsid']; 573 $output[$c]['t3ver_state'] = $val['t3ver_state']; 574 $output[$c]['t3ver_swapmode'] = $val['t3ver_swapmode']; 575 $output[$c]['t3ver_stage'] = $val['t3ver_stage']; 576 } 577 } 578 579 return $output; 580 } 581 582 /** 583 * Opens the page tree to the specified page id 584 * 585 * @param integer Page id. 586 * @param boolean If set, then other open branches are closed. 587 * @return void 588 */ 589 function openPageTree($pid,$clearExpansion) { 590 global $BE_USER; 591 592 // Get current expansion data: 593 if ($clearExpansion) { 594 $expandedPages = array(); 595 } else { 596 $expandedPages = unserialize($BE_USER->uc['browseTrees']['browsePages']); 597 } 598 599 // Get rootline: 600 $rL = t3lib_BEfunc::BEgetRootLine($pid); 601 602 // First, find out what mount index to use (if more than one DB mount exists): 603 $mountIndex = 0; 604 $mountKeys = array_flip($BE_USER->returnWebmounts()); 605 foreach($rL as $rLDat) { 606 if (isset($mountKeys[$rLDat['uid']])) { 607 $mountIndex = $mountKeys[$rLDat['uid']]; 608 break; 609 } 610 } 611 612 // Traverse rootline and open paths: 613 foreach($rL as $rLDat) { 614 $expandedPages[$mountIndex][$rLDat['uid']] = 1; 615 } 616 617 // Write back: 618 $BE_USER->uc['browseTrees']['browsePages'] = serialize($expandedPages); 619 $BE_USER->writeUC(); 620 } 621 622 /** 623 * Returns the path (visually) of a page $uid, fx. "/First page/Second page/Another subpage" 624 * Each part of the path will be limited to $titleLimit characters 625 * Deleted pages are filtered out. 626 * Usage: 15 627 * 628 * @param integer Page uid for which to create record path 629 * @param string $clause is additional where clauses, eg. " 630 * @param integer Title limit 631 * @param integer Title limit of Full title (typ. set to 1000 or so) 632 * @return mixed Path of record (string) OR array with short/long title if $fullTitleLimit is set. 633 */ 634 function getRecordPath($uid, $clause, $titleLimit, $fullTitleLimit=0) { 635 if (!$titleLimit) { $titleLimit=1000; } 636 637 $loopCheck = 100; 638 $output = $fullOutput = '/'; 639 while ($uid!=0 && $loopCheck>0) { 640 $loopCheck--; 641 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery( 642 'uid,pid,title,t3ver_oid,t3ver_wsid,t3ver_swapmode', 643 'pages', 644 'uid='.intval($uid). 645 t3lib_BEfunc::deleteClause('pages'). 646 (strlen(trim($clause)) ? ' AND '.$clause : '') 647 ); 648 if ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { 649 t3lib_BEfunc::workspaceOL('pages',$row); 650 t3lib_BEfunc::fixVersioningPid('pages',$row); 651 652 if ($row['_ORIG_pid'] && $row['t3ver_swapmode']>0) { // Branch points 653 $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... 654 } 655 $uid = $row['pid']; 656 $output = '/'.t3lib_div::fixed_lgd_cs(strip_tags($row['title']),$titleLimit).$output; 657 if ($fullTitleLimit) $fullOutput = '/'.t3lib_div::fixed_lgd_cs(strip_tags($row['title']),$fullTitleLimit).$fullOutput; 658 } else { 659 break; 660 } 661 } 662 663 if ($fullTitleLimit) { 664 return array($output, $fullOutput); 665 } else { 666 return $output; 667 } 668 } 669 670 /** 671 * Returns an array with the exclude-fields as defined in TCA 672 * Used for listing the exclude-fields in be_groups forms 673 * Usage: 2 (t3lib_tceforms + t3lib_transferdata) 674 * 675 * @return array Array of arrays with excludeFields (fieldname, table:fieldname) from all TCA entries 676 */ 677 function getExcludeFields() { 678 global $TCA; 679 // All TCA keys: 680 $theExcludeArray = Array(); 681 $tc_keys = array_keys($TCA); 682 foreach($tc_keys as $table) { 683 // Load table 684 t3lib_div::loadTCA($table); 685 // All field names configured: 686 if (is_array($TCA[$table]['columns'])) { 687 $f_keys = array_keys($TCA[$table]['columns']); 688 foreach($f_keys as $field) { 689 if ($TCA[$table]['columns'][$field]['exclude']) { 690 // Get Human Readable names of fields and table: 691 $Fname=$GLOBALS['LANG']->sl($TCA[$table]['ctrl']['title']).': '.$GLOBALS['LANG']->sl($TCA[$table]['columns'][$field]['label']); 692 // add entry: 693 $theExcludeArray[] = Array($Fname , $table.':'.$field); 694 } 695 } 696 } 697 } 698 return $theExcludeArray; 699 } 700 701 /** 702 * Returns an array with explicit Allow/Deny fields. 703 * Used for listing these field/value pairs in be_groups forms 704 * 705 * @return array Array with information from all of $TCA 706 */ 707 function getExplicitAuthFieldValues() { 708 global $TCA; 709 710 // Initialize: 711 $adLabel = array( 712 'ALLOW' => $GLOBALS['LANG']->sl('LLL:EXT:lang/locallang_core.xml:labels.allow'), 713 'DENY' => $GLOBALS['LANG']->sl('LLL:EXT:lang/locallang_core.xml:labels.deny'), 714 ); 715 716 // All TCA keys: 717 $allowDenyOptions = Array(); 718 $tc_keys = array_keys($TCA); 719 foreach($tc_keys as $table) { 720 721 // Load table 722 t3lib_div::loadTCA($table); 723 724 // All field names configured: 725 if (is_array($TCA[$table]['columns'])) { 726 $f_keys = array_keys($TCA[$table]['columns']); 727 foreach($f_keys as $field) { 728 $fCfg = $TCA[$table]['columns'][$field]['config']; 729 if ($fCfg['type']=='select' && $fCfg['authMode']) { 730 731 // Check for items: 732 if (is_array($fCfg['items'])) { 733 // Get Human Readable names of fields and table: 734 $allowDenyOptions[$table.':'.$field]['tableFieldLabel'] = $GLOBALS['LANG']->sl($TCA[$table]['ctrl']['title']).': '.$GLOBALS['LANG']->sl($TCA[$table]['columns'][$field]['label']); 735 736 // Check for items: 737 foreach($fCfg['items'] as $iVal) { 738 if (strcmp($iVal[1],'')) { // Values '' is not controlled by this setting. 739 740 // Find iMode: 741 $iMode = ''; 742 switch((string)$fCfg['authMode']) { 743 case 'explicitAllow': 744 $iMode = 'ALLOW'; 745 break; 746 case 'explicitDeny': 747 $iMode = 'DENY'; 748 break; 749 case 'individual': 750 if (!strcmp($iVal[4],'EXPL_ALLOW')) { 751 $iMode = 'ALLOW'; 752 } elseif (!strcmp($iVal[4],'EXPL_DENY')) { 753 $iMode = 'DENY'; 754 } 755 break; 756 } 757 758 // Set iMode: 759 if ($iMode) { 760 $allowDenyOptions[$table.':'.$field]['items'][$iVal[1]] = array($iMode, $GLOBALS['LANG']->sl($iVal[0]), $adLabel[$iMode]); 761 } 762 } 763 } 764 } 765 } 766 } 767 } 768 } 769 770 return $allowDenyOptions; 771 } 772 773 /** 774 * Returns an array with system languages: 775 * 776 * @return array Array with languages 777 */ 778 function getSystemLanguages() { 779 780 // Initialize, add default language: 781 $sysLanguages = array(); 782 $sysLanguages[] = array('Default language', 0); 783 784 // Traverse languages 785 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid,title,flag','sys_language','pid=0'.t3lib_BEfunc::deleteClause('sys_language')); 786 while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { 787 $sysLanguages[] = array($row['title'].' ['.$row['uid'].']', $row['uid'], ($row['flag'] ? 'flags/'.$row['flag'] : '')); 788 } 789 790 return $sysLanguages; 791 } 792 793 /** 794 * Returns a page record (of page with $id) with an extra field "_thePath" set to the record path IF the WHERE clause, $perms_clause, selects the record. Thus is works as an access check that returns a page record if access was granted, otherwise not. 795 * If $id is zero a pseudo root-page with "_thePath" set is returned IF the current BE_USER is admin. 796 * In any case ->isInWebMount must return true for the user (regardless of $perms_clause) 797 * Usage: 21 798 * 799 * @param integer Page uid for which to check read-access 800 * @param string $perms_clause is typically a value generated with $BE_USER->getPagePermsClause(1); 801 * @return array Returns page record if OK, otherwise false. 802 */ 803 function readPageAccess($id,$perms_clause) { 804 if ((string)$id!='') { 805 $id = intval($id); 806 if (!$id) { 807 if ($GLOBALS['BE_USER']->isAdmin()) { 808 $path = '/'; 809 $pageinfo['_thePath'] = $path; 810 return $pageinfo; 811 } 812 } else { 813 $pageinfo = t3lib_BEfunc::getRecord('pages',$id,'*',($perms_clause ? ' AND '.$perms_clause : '')); 814 if ($pageinfo['uid'] && $GLOBALS['BE_USER']->isInWebMount($id,$perms_clause)) { 815 t3lib_BEfunc::workspaceOL('pages', $pageinfo); 816 t3lib_BEfunc::fixVersioningPid('pages', $pageinfo); 817 list($pageinfo['_thePath'],$pageinfo['_thePathFull']) = t3lib_BEfunc::getRecordPath(intval($pageinfo['uid']), $perms_clause, 15, 1000); 818 return $pageinfo; 819 } 820 } 821 } 822 return false; 823 } 824 825 /** 826 * Returns the "types" configuration parsed into an array for the record, $rec, from table, $table 827 * Usage: 6 828 * 829 * @param string Table name (present in TCA) 830 * @param array Record from $table 831 * @param boolean If $useFieldNameAsKey is set, then the fieldname is associative keys in the return array, otherwise just numeric keys. 832 * @return array 833 */ 834 function getTCAtypes($table,$rec,$useFieldNameAsKey=0) { 835 global $TCA; 836 837 t3lib_div::loadTCA($table); 838 if ($TCA[$table]) { 839 840 // Get type value: 841 $fieldValue = t3lib_BEfunc::getTCAtypeValue($table,$rec); 842 843 // Get typesConf 844 $typesConf = $TCA[$table]['types'][$fieldValue]; 845 846 // Get fields list and traverse it 847 $fieldList = explode(',', $typesConf['showitem']); 848 $altFieldList = array(); 849 850 // Traverse fields in types config and parse the configuration into a nice array: 851 foreach($fieldList as $k => $v) { 852 list($pFieldName, $pAltTitle, $pPalette, $pSpec) = t3lib_div::trimExplode(';', $v); 853 $defaultExtras = is_array($TCA[$table]['columns'][$pFieldName]) ? $TCA[$table]['columns'][$pFieldName]['defaultExtras'] : ''; 854 $specConfParts = t3lib_BEfunc::getSpecConfParts($pSpec, $defaultExtras); 855 856 $fieldList[$k]=array( 857 'field' => $pFieldName, 858 'title' => $pAltTitle, 859 'palette' => $pPalette, 860 'spec' => $specConfParts, 861 'origString' => $v 862 ); 863 if ($useFieldNameAsKey) { 864 $altFieldList[$fieldList[$k]['field']] = $fieldList[$k]; 865 } 866 } 867 if ($useFieldNameAsKey) { 868 $fieldList = $altFieldList; 869 } 870 871 // Return array: 872 return $fieldList; 873 } 874 } 875 876 /** 877 * Returns the "type" value of $rec from $table which can be used to look up the correct "types" rendering section in $TCA 878 * If no "type" field is configured in the "ctrl"-section of the $TCA for the table, zero is used. 879 * If zero is not an index in the "types" section of $TCA for the table, then the $fieldValue returned will default to 1 (no matter if that is an index or not) 880 * Usage: 7 881 * 882 * @param string Table name present in TCA 883 * @param array Record from $table 884 * @return string Field value 885 * @see getTCAtypes() 886 */ 887 function getTCAtypeValue($table,$rec) { 888 global $TCA; 889 890 // If no field-value, set it to zero. If there is no type matching the field-value (which now may be zero...) test field-value '1' as default. 891 t3lib_div::loadTCA($table); 892 if ($TCA[$table]) { 893 $field = $TCA[$table]['ctrl']['type']; 894 $fieldValue = $field ? ($rec[$field] ? $rec[$field] : 0) : 0; 895 if (!is_array($TCA[$table]['types'][$fieldValue])) $fieldValue = 1; 896 return $fieldValue; 897 } 898 } 899 900 /** 901 * Parses a part of the field lists in the "types"-section of $TCA arrays, namely the "special configuration" at index 3 (position 4) 902 * Elements are splitted by ":" and within those parts, parameters are splitted by "|". 903 * Everything is returned in an array and you should rather see it visually than listen to me anymore now... Check out example in Inside TYPO3 904 * Usage: 5 905 * 906 * @param string Content from the "types" configuration of TCA (the special configuration) - see description of function 907 * @param string The ['defaultExtras'] value from field configuration 908 * @return array 909 */ 910 function getSpecConfParts($str, $defaultExtras) { 911 912 // Add defaultExtras: 913 $specConfParts = t3lib_div::trimExplode(':', $defaultExtras.':'.$str, 1); 914 915 $reg = array(); 916 if (count($specConfParts)) { 917 foreach($specConfParts as $k2 => $v2) { 918 unset($specConfParts[$k2]); 919 if (ereg('(.*)\[(.*)\]',$v2,$reg)) { 920 $specConfParts[trim($reg[1])] = array( 921 'parameters' => t3lib_div::trimExplode('|', $reg[2], 1) 922 ); 923 } else { 924 $specConfParts[trim($v2)] = 1; 925 } 926 } 927 } else { 928 $specConfParts = array(); 929 } 930 return $specConfParts; 931 } 932 933 /** 934 * Takes an array of "[key]=[value]" strings and returns an array with the keys set as keys pointing to the value. 935 * Better see it in action! Find example in Inside TYPO3 936 * Usage: 6 937 * 938 * @param array Array of "[key]=[value]" strings to convert. 939 * @return array 940 */ 941 function getSpecConfParametersFromArray($pArr) { 942 $out=array(); 943 if (is_array($pArr)) { 944 reset($pArr); 945 while(list($k,$v)=each($pArr)) { 946 $parts=explode('=',$v,2); 947 if (count($parts)==2) { 948 $out[trim($parts[0])]=trim($parts[1]); 949 } else { 950 $out[$k]=$v; 951 } 952 } 953 } 954 return $out; 955 } 956 957 /** 958 * Finds the Data Structure for a FlexForm field 959 * Usage: 5 960 * 961 * @param array Field config array 962 * @param array Record data 963 * @param string The table name 964 * @param string Optional fieldname passed to hook object 965 * @param boolean Boolean; If set, workspace overlay is applied to records. This is correct behaviour for all presentation and export, but NOT if you want a true reflection of how things are in the live workspace. 966 * @return mixed If array, the data structure was found and returned as an array. Otherwise (string) it is an error message. 967 * @see t3lib_TCEforms::getSingleField_typeFlex() 968 */ 969 function getFlexFormDS($conf,$row,$table,$fieldName='',$WSOL=TRUE) { 970 global $TYPO3_CONF_VARS; 971 972 // Get pointer field etc from TCA-config: 973 $ds_pointerField = $conf['ds_pointerField']; 974 $ds_array = $conf['ds']; 975 $ds_tableField = $conf['ds_tableField']; 976 $ds_searchParentField = $conf['ds_pointerField_searchParent']; 977 978 // Find source value: 979 $dataStructArray=''; 980 if (is_array($ds_array)) { // If there is a data source array, that takes precedence 981 // If a pointer field is set, take the value from that field in the $row array and use as key. 982 if ($ds_pointerField) { 983 $srcPointer = $row[$ds_pointerField]; 984 $srcPointer = isset($ds_array[$srcPointer]) ? $srcPointer : 'default'; 985 } else $srcPointer='default'; 986 987 // 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. 988 if (substr($ds_array[$srcPointer],0,5)=='FILE:') { 989 $file = t3lib_div::getFileAbsFileName(substr($ds_array[$srcPointer],5)); 990 if ($file && @is_file($file)) { 991 $dataStructArray = t3lib_div::xml2array(t3lib_div::getUrl($file)); 992 } else $dataStructArray = 'The file "'.substr($ds_array[$srcPointer],5).'" in ds-array key "'.$srcPointer.'" was not found ("'.$file.'")'; // Error message. 993 } else { 994 $dataStructArray = t3lib_div::xml2array($ds_array[$srcPointer]); 995 } 996 997 } elseif ($ds_pointerField) { // If pointer field AND possibly a table/field is set: 998 // Value of field pointed to: 999 $srcPointer = $row[$ds_pointerField]; 1000 1001 // Searching recursively back if 'ds_pointerField_searchParent' is defined (typ. a page rootline, or maybe a tree-table): 1002 if ($ds_searchParentField && !$srcPointer) { 1003 $rr = t3lib_BEfunc::getRecord($table,$row['uid'],'uid,'.$ds_searchParentField); // Get the "pid" field - we cannot know that it is in the input record! 1004 if ($WSOL) { 1005 t3lib_BEfunc::workspaceOL($table,$rr); 1006 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! 1007 } 1008 $uidAcc=array(); // Used to avoid looping, if any should happen. 1009 $subFieldPointer = $conf['ds_pointerField_searchParent_subField']; 1010 while(!$srcPointer) { 1011 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery( 1012 'uid,'.$ds_pointerField.','.$ds_searchParentField.($subFieldPointer?','.$subFieldPointer:''), 1013 $table, 1014 'uid='.intval($rr[$ds_searchParentField]).t3lib_BEfunc::deleteClause($table) 1015 ); 1016 $rr = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res); 1017 1018 // break if no result from SQL db or if looping... 1019 if (!is_array($rr) || isset($uidAcc[$rr['uid']])) break; 1020 $uidAcc[$rr['uid']]=1; 1021 1022 if ($WSOL) { 1023 t3lib_BEfunc::workspaceOL($table,$rr); 1024 t3lib_BEfunc::fixVersioningPid($table,$rr,TRUE); 1025 } 1026 $srcPointer = ($subFieldPointer && $rr[$subFieldPointer]) ? $rr[$subFieldPointer] : $rr[$ds_pointerField]; 1027 } 1028 } 1029 1030 // If there is a srcPointer value: 1031 if ($srcPointer) { 1032 if (t3lib_div::testInt($srcPointer)) { // If integer, then its a record we will look up: 1033 list($tName,$fName) = explode(':',$ds_tableField,2); 1034 if ($tName && $fName && is_array($GLOBALS['TCA'][$tName])) { 1035 $dataStructRec = t3lib_BEfunc::getRecord($tName, $srcPointer); 1036 if ($WSOL) { 1037 t3lib_BEfunc::workspaceOL($tName,$dataStructRec); 1038 } 1039 $dataStructArray = t3lib_div::xml2array($dataStructRec[$fName]); 1040 } else $dataStructArray = 'No tablename ('.$tName.') or fieldname ('.$fName.') was found an valid!'; 1041 } else { // Otherwise expect it to be a file: 1042 $file = t3lib_div::getFileAbsFileName($srcPointer); 1043 if ($file && @is_file($file)) { 1044 $dataStructArray = t3lib_div::xml2array(t3lib_div::getUrl($file)); 1045 } else $dataStructArray='The file "'.$srcPointer.'" was not found ("'.$file.'")'; // Error message. 1046 } 1047 } else $dataStructArray='No source value in fieldname "'.$ds_pointerField.'"'; // Error message. 1048 } else $dataStructArray='No proper configuration!'; 1049 1050 // Hook for post-processing the Flexform DS. Introduces the possibility to configure Flexforms via TSConfig 1051 if (is_array ($TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_befunc.php']['getFlexFormDSClass'])) { 1052 foreach ($TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_befunc.php']['getFlexFormDSClass'] as $classRef) { 1053 $hookObj = &t3lib_div::getUserObj($classRef); 1054 if (method_exists($hookObj, 'getFlexFormDS_postProcessDS')) { 1055 $hookObj->getFlexFormDS_postProcessDS($dataStructArray, $conf, $row, $table, $fieldName); 1056 } 1057 } 1058 } 1059 1060 return $dataStructArray; 1061 } 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 /******************************************* 1081 * 1082 * Caching related 1083 * 1084 *******************************************/ 1085 1086 /** 1087 * Stores the string value $data in the 'cache_hash' table with the hash key, $hash, and visual/symbolic identification, $ident 1088 * IDENTICAL to the function by same name found in t3lib_page: 1089 * Usage: 2 1090 * 1091 * @param string Hash key, 32 bytes hex 1092 * @param string $data must be serialized before function call 1093 * @param string Visual/symbolic identification (informational only) 1094 * @return void 1095 */ 1096 function storeHash($hash,$data,$ident) { 1097 $insertFields = array( 1098 'hash' => $hash, 1099 'content' => $data, 1100 'ident' => $ident, 1101 'tstamp' => time() 1102 ); 1103 $GLOBALS['TYPO3_DB']->exec_DELETEquery('cache_hash', 'hash='.$GLOBALS['TYPO3_DB']->fullQuoteStr($hash, 'cache_hash')); 1104 $GLOBALS['TYPO3_DB']->exec_INSERTquery('cache_hash', $insertFields); 1105 } 1106 1107 /** 1108 * Retrieves the string content stored with hash key, $hash, in cache_hash 1109 * IDENTICAL to the function by same name found in t3lib_page: 1110 * Usage: 2 1111 * 1112 * @param string Hash key, 32 bytes hex 1113 * @param integer $expTime represents the expire time in seconds. For instance a value of 3600 would allow cached content within the last hour, otherwise nothing is returned. 1114 * @return string 1115 */ 1116 function getHash($hash,$expTime=0) { 1117 // if expTime is not set, the hash will never expire 1118 $expTime = intval($expTime); 1119 if ($expTime) { 1120 $whereAdd = ' AND tstamp > '.(time()-$expTime); 1121 } 1122 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('content', 'cache_hash', 'hash='.$GLOBALS['TYPO3_DB']->fullQuoteStr($hash, 'cache_hash').$whereAdd); 1123 if ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { 1124 return $row['content']; 1125 } 1126 } 1127 1128 1129 1130 1131 1132 1133 1134 1135 /******************************************* 1136 * 1137 * TypoScript related 1138 * 1139 *******************************************/ 1140 1141 /** 1142 * Returns the Page TSconfig for page with id, $id 1143 * Requires class "t3lib_TSparser" 1144 * Usage: 26 (spec. in ext info_pagetsconfig) 1145 * 1146 * @param integer Page uid for which to create Page TSconfig 1147 * @param array If $rootLine is an array, that is used as rootline, otherwise rootline is just calculated 1148 * @param boolean If $returnPartArray is set, then the array with accumulated Page TSconfig is returned non-parsed. Otherwise the output will be parsed by the TypoScript parser. 1149 * @return array Page TSconfig 1150 * @see t3lib_TSparser 1151 */ 1152 function getPagesTSconfig($id,$rootLine='',$returnPartArray=0) { 1153 $id=intval($id); 1154 if (!is_array($rootLine)) { 1155 $rootLine = t3lib_BEfunc::BEgetRootLine($id,'',TRUE); 1156 } 1157 ksort($rootLine); // Order correctly 1158 $TSdataArray = array(); 1159 $TSdataArray['defaultPageTSconfig']=$GLOBALS['TYPO3_CONF_VARS']['BE']['defaultPageTSconfig']; // Setting default configuration: 1160 foreach($rootLine as $k => $v) { 1161 $TSdataArray['uid_'.$v['uid']]=$v['TSconfig']; 1162 } 1163 $TSdataArray = t3lib_TSparser::checkIncludeLines_array($TSdataArray); 1164 if ($returnPartArray) { 1165 return $TSdataArray; 1166 } 1167 1168 // Parsing the user TS (or getting from cache) 1169 $userTS = implode($TSdataArray,chr(10).'[GLOBAL]'.chr(10)); 1170 $hash = md5('pageTS:'.$userTS); 1171 $cachedContent = t3lib_BEfunc::getHash($hash,0); 1172 $TSconfig = array(); 1173 if (isset($cachedContent)) { 1174 $TSconfig = unserialize($cachedContent); 1175 } else { 1176 $parseObj = t3lib_div::makeInstance('t3lib_TSparser'); 1177 $parseObj->parse($userTS); 1178 $TSconfig = $parseObj->setup; 1179 t3lib_BEfunc::storeHash($hash,serialize($TSconfig),'PAGES_TSconfig'); 1180 } 1181 1182 // get User TSconfig overlay 1183 $userTSconfig = $GLOBALS['BE_USER']->userTS['page.']; 1184 if (is_array($userTSconfig)) { 1185 $TSconfig = t3lib_div::array_merge_recursive_overrule($TSconfig, $userTSconfig); 1186 } 1187 return $TSconfig; 1188 } 1189 1190 /** 1191 * Updates Page TSconfig for a page with $id 1192 * The function seems to take $pageTS as an array with properties and compare the values with those that already exists for the "object string", $TSconfPrefix, for the page, then sets those values which were not present. 1193 * $impParams can be supplied as already known Page TSconfig, otherwise it's calculated. 1194 * 1195 * THIS DOES NOT CHECK ANY PERMISSIONS. SHOULD IT? 1196 * More documentation is needed. 1197 * 1198 * Usage: 1 (ext. direct_mail) 1199 * 1200 * @param integer Page id 1201 * @param array Page TS array to write 1202 * @param string Prefix for object paths 1203 * @param array [Description needed.] 1204 * @return void 1205 * @internal 1206 * @see implodeTSParams(), getPagesTSconfig() 1207 */ 1208 function updatePagesTSconfig($id,$pageTS,$TSconfPrefix,$impParams='') { 1209 $id=intval($id); 1210 if (is_array($pageTS) && $id>0) { 1211 if (!is_array($impParams)) { 1212 $impParams =t3lib_BEfunc::implodeTSParams(t3lib_BEfunc::getPagesTSconfig($id)); 1213 } 1214 reset($pageTS); 1215 $set=array(); 1216 while(list($f,$v)=each($pageTS)) { 1217 $f = $TSconfPrefix.$f; 1218 if ((!isset($impParams[$f])&&trim($v)) || strcmp(trim($impParams[$f]),trim($v))) { 1219 $set[$f]=trim($v); 1220 } 1221 } 1222 if (count($set)) { 1223 // Get page record and TS config lines 1224 $pRec = t3lib_befunc::getRecord('pages',$id); 1225 $TSlines = explode(chr(10),$pRec['TSconfig']); 1226 $TSlines = array_reverse($TSlines); 1227 // Reset the set of changes. 1228 reset($set); 1229 while(list($f,$v)=each($set)) { 1230 reset($TSlines); 1231 $inserted=0; 1232 while(list($ki,$kv)=each($TSlines)) { 1233 if (substr($kv,0,strlen($f)+1)==$f.'=') { 1234 $TSlines[$ki]=$f.'='.$v; 1235 $inserted=1; 1236 break; 1237 } 1238 } 1239 if (!$inserted) { 1240 $TSlines = array_reverse($TSlines); 1241 $TSlines[]=$f.'='.$v; 1242 $TSlines = array_reverse($TSlines); 1243 } 1244 } 1245 $TSlines = array_reverse($TSlines); 1246 1247 // store those changes 1248 $TSconf = implode(chr(10),$TSlines); 1249 1250 $GLOBALS['TYPO3_DB']->exec_UPDATEquery('pages', 'uid='.intval($id), array('TSconfig' => $TSconf)); 1251 } 1252 } 1253 } 1254 1255 /** 1256 * Implodes a multi dimensional TypoScript array, $p, into a one-dimentional array (return value) 1257 * Usage: 3 1258 * 1259 * @param array TypoScript structure 1260 * @param string Prefix string 1261 * @return array Imploded TypoScript objectstring/values 1262 */ 1263 function implodeTSParams($p,$k='') { 1264 $implodeParams=array(); 1265 if (is_array($p)) { 1266 reset($p); 1267 while(list($kb,$val)=each($p)) { 1268 if (is_array($val)) { 1269 $implodeParams = array_merge($implodeParams,t3lib_BEfunc::implodeTSParams($val,$k.$kb)); 1270 } else { 1271 $implodeParams[$k.$kb]=$val; 1272 } 1273 } 1274 } 1275 return $implodeParams; 1276 } 1277 1278 1279 1280 1281 1282 1283 1284 1285 /******************************************* 1286 * 1287 * Users / Groups related 1288 * 1289 *******************************************/ 1290 1291 /** 1292 * Returns an array with be_users records of all user NOT DELETED sorted by their username 1293 * Keys in the array is the be_users uid 1294 * Usage: 14 (spec. ext. "beuser" and module "web_perm") 1295 * 1296 * @param string Optional $fields list (default: username,usergroup,usergroup_cached_list,uid) can be used to set the selected fields 1297 * @param string Optional $where clause (fx. "AND username='pete'") can be used to limit query 1298 * @return array 1299 */ 1300 function getUserNames($fields='username,usergroup,usergroup_cached_list,uid',$where='') { 1301 $be_user_Array=Array(); 1302 1303 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery($fields, 'be_users', 'pid=0 '.$where.t3lib_BEfunc::deleteClause('be_users'), '', 'username'); 1304 while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { 1305 $be_user_Array[$row['uid']]=$row; 1306 } 1307 return $be_user_Array; 1308 } 1309 1310 /** 1311 * Returns an array with be_groups records (title, uid) of all groups NOT DELETED sorted by their title 1312 * Usage: 8 (spec. ext. "beuser" and module "web_perm") 1313 * 1314 * @param string Field list 1315 * @param string WHERE clause 1316 * @return array 1317 */ 1318 function getGroupNames($fields='title,uid', $where='') { 1319 $be_group_Array = Array(); 1320 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery($fields, 'be_groups', 'pid=0 '.$where.t3lib_BEfunc::deleteClause('be_groups'), '', 'title'); 1321 while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { 1322 $be_group_Array[$row['uid']] = $row; 1323 } 1324 return $be_group_Array; 1325 } 1326 1327 /** 1328 * Returns an array with be_groups records (like ->getGroupNames) but: 1329 * - if the current BE_USER is admin, then all groups are returned, otherwise only groups that the current user is member of (usergroup_cached_list) will be returned. 1330 * Usage: 2 (module "web_perm" and ext. taskcenter) 1331 * 1332 * @param string Field list; $fields specify the fields selected (default: title,uid) 1333 * @return array 1334 */ 1335 function getListGroupNames($fields='title,uid') { 1336 $exQ=' AND hide_in_lists=0'; 1337 if (!$GLOBALS['BE_USER']->isAdmin()) { 1338 $exQ.=' AND uid IN ('.($GLOBALS['BE_USER']->user['usergroup_cached_list']?$GLOBALS['BE_USER']->user['usergroup_cached_list']:0).')'; 1339 } 1340 return t3lib_BEfunc::getGroupNames($fields,$exQ); 1341 } 1342 1343 /** 1344 * Returns the array $usernames with the names of all users NOT IN $groupArray changed to the uid (hides the usernames!). 1345 * If $excludeBlindedFlag is set, then these records are unset from the array $usernames 1346 * Takes $usernames (array made by t3lib_BEfunc::getUserNames()) and a $groupArray (array with the groups a certain user is member of) as input 1347 * Usage: 8 1348 * 1349 * @param array User names 1350 * @param array Group names 1351 * @param boolean If $excludeBlindedFlag is set, then these records are unset from the array $usernames 1352 * @return array User names, blinded 1353 */ 1354 function blindUserNames($usernames,$groupArray,$excludeBlindedFlag=0) { 1355 if (is_array($usernames) && is_array($groupArray)) { 1356 while(list($uid,$row)=each($usernames)) { 1357 $userN=$uid; 1358 $set=0; 1359 if ($row['uid']!=$GLOBALS['BE_USER']->user['uid']) { 1360 reset($groupArray); 1361 while(list(,$v)=each($groupArray)) { 1362 if ($v && t3lib_div::inList($row['usergroup_cached_list'],$v)) { 1363 $userN = $row['username']; 1364 $set=1; 1365 } 1366 } 1367 } else { 1368 $userN = $row['username']; 1369 $set=1; 1370 } 1371 $usernames[$uid]['username']=$userN; 1372 if ($excludeBlindedFlag && !$set) {unset($usernames[$uid]);} 1373 } 1374 } 1375 return $usernames; 1376 } 1377 1378 /** 1379 * Corresponds to blindUserNames but works for groups instead 1380 * Usage: 2 (module web_perm) 1381 * 1382 * @param array Group names 1383 * @param array Group names (reference) 1384 * @param boolean If $excludeBlindedFlag is set, then these records are unset from the array $usernames 1385 * @return array 1386 */ 1387 function blindGroupNames($groups,$groupArray,$excludeBlindedFlag=0) { 1388 if (is_array($groups) && is_array($groupArray)) { 1389 while(list($uid,$row)=each($groups)) { 1390 $groupN=$uid; 1391 $set=0; 1392 if (t3lib_div::inArray($groupArray,$uid)) { 1393 $groupN=$row['title']; 1394 $set=1; 1395 } 1396 $groups[$uid]['title']=$groupN; 1397 if ($excludeBlindedFlag && !$set) {unset($groups[$uid]);} 1398 } 1399 } 1400 return $groups; 1401 } 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 /******************************************* 1416 * 1417 * Output related 1418 * 1419 *******************************************/ 1420 1421 /** 1422 * Returns the difference in days between input $tstamp and $EXEC_TIME 1423 * Usage: 2 (class t3lib_BEfunc) 1424 * 1425 * @param integer Time stamp, seconds 1426 * @return integer 1427 */ 1428 function daysUntil($tstamp) { 1429 $delta_t = $tstamp-$GLOBALS['EXEC_TIME']; 1430 return ceil($delta_t/(3600*24)); 1431 } 1432 1433 /** 1434 * Returns $tstamp formatted as "ddmmyy" (According to $TYPO3_CONF_VARS['SYS']['ddmmyy']) 1435 * Usage: 11 1436 * 1437 * @param integer Time stamp, seconds 1438 * @return string Formatted time 1439 */ 1440 function date($tstamp) { 1441 return date($GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'],$tstamp); 1442 } 1443 1444 /** 1445 * Returns $tstamp formatted as "ddmmyy hhmm" (According to $TYPO3_CONF_VARS['SYS']['ddmmyy'] AND $TYPO3_CONF_VARS['SYS']['hhmm']) 1446 * Usage: 28 1447 * 1448 * @param integer Time stamp, seconds 1449 * @return string Formatted time 1450 */ 1451 function datetime($value) { 1452 return date($GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'].' '.$GLOBALS['TYPO3_CONF_VARS']['SYS']['hhmm'], $value); 1453 } 1454 1455 /** 1456 * Returns $value (in seconds) formatted as hh:mm:ss 1457 * For instance $value = 3600 + 60*2 + 3 should return "01:02:03" 1458 * Usage: 1 (class t3lib_BEfunc) 1459 * 1460 * @param integer Time stamp, seconds 1461 * @return string Formatted time 1462 */ 1463 function time($value) { 1464 $hh = floor($value/3600); 1465 $min = floor(($value-$hh*3600)/60); 1466 $sec = $value-$hh*3600-$min*60; 1467 $l = sprintf('%02d',$hh).':'.sprintf('%02d',$min).':'.sprintf('%02d',$sec); 1468 return $l; 1469 } 1470 1471 /** 1472 * Returns the "age" in minutes / hours / days / years of the number of $seconds inputted. 1473 * Usage: 15 1474 * 1475 * @param integer $seconds could be the difference of a certain timestamp and time() 1476 * @param string $labels should be something like ' min| hrs| days| yrs'. This value is typically delivered by this function call: $GLOBALS["LANG"]->sL("LLL:EXT:lang/locallang_core.php:labels.minutesHoursDaysYears") 1477 * @return string Formatted time 1478 */ 1479 function calcAge($seconds,$labels = 'min|hrs|days|yrs') { 1480 $labelArr = explode('|',$labels); 1481 $prefix=''; 1482 if ($seconds<0) {$prefix='-'; $seconds=abs($seconds);} 1483 if ($seconds<3600) { 1484 $seconds = round ($seconds/60).' '.trim($labelArr[0]); 1485 } elseif ($seconds<24*3600) { 1486 $seconds = round ($seconds/3600).' '.trim($labelArr[1]); 1487 } elseif ($seconds<365*24*3600) { 1488 $seconds = round ($seconds/(24*3600)).' '.trim($labelArr[2]); 1489 } else { 1490 $seconds = round ($seconds/(365*24*3600)).' '.trim($labelArr[3]); 1491 } 1492 return $prefix.$seconds; 1493 } 1494 1495 /** 1496 * Returns a formatted timestamp if $tstamp is set. 1497 * The date/datetime will be followed by the age in parenthesis. 1498 * Usage: 3 1499 * 1500 * @param integer Time stamp, seconds 1501 * @param integer 1/-1 depending on polarity of age. 1502 * @param string $date=="date" will yield "dd:mm:yy" formatting, otherwise "dd:mm:yy hh:mm" 1503 * @return string 1504 */ 1505 function dateTimeAge($tstamp,$prefix=1,$date='') { 1506 return $tstamp ? 1507 ($date=='date' ? t3lib_BEfunc::date($tstamp) : t3lib_BEfunc::datetime($tstamp)). 1508 ' ('.t3lib_BEfunc::calcAge($prefix*(time()-$tstamp),$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.minutesHoursDaysYears')).')' : ''; 1509 } 1510 1511 /** 1512 * Returns either title='' or alt='' attribute. This depends on the client browser and whether it supports title='' or not (which is the default) 1513 * If no $content is given only the attribute name is returned. 1514 * The returned attribute with content will have a leading space char. 1515 * Warning: Be careful to submit empty $content var - that will return just the attribute name! 1516 * Usage: 0 1517 * 1518 * @param string String to set as title-attribute. If no $content is given only the attribute name is returned. 1519 * @param boolean If $hsc is set, then content of the attribute is htmlspecialchar()'ed (which is good for XHTML and other reasons...) 1520 * @return string 1521 * @deprecated The idea made sense with older browsers, but now all browsers should support the "title" attribute - so just hardcode the title attribute instead! 1522 */ 1523 function titleAttrib($content='',$hsc=0) { 1524 global $CLIENT; 1525 $attrib= ($CLIENT['BROWSER']=='net'&&$CLIENT['VERSION']<5)||$CLIENT['BROWSER']=='konqu' ? 'alt' : 'title'; 1526 return strcmp($content,'')?' '.$attrib.'="'.($hsc?htmlspecialchars($content):$content).'"' : $attrib; 1527 } 1528 1529 /** 1530 * Returns alt="" and title="" attributes with the value of $content. 1531 * Usage: 7 1532 * 1533 * @param string Value for 'alt' and 'title' attributes (will be htmlspecialchars()'ed before output) 1534 * @return string 1535 */ 1536 function titleAltAttrib($content) { 1537 $out=''; 1538 $out.=' alt="'.htmlspecialchars($content).'"'; 1539 $out.=' title="'.htmlspecialchars($content).'"'; 1540 return $out; 1541 } 1542 1543 /** 1544 * Returns a linked image-tag for thumbnail(s)/fileicons/truetype-font-previews from a database row with a list of image files in a field 1545 * All $TYPO3_CONF_VARS['GFX']['imagefile_ext'] extension are made to thumbnails + ttf file (renders font-example) 1546 * Thumbsnails are linked to the show_item.php script which will display further details. 1547 * Usage: 7 1548 * 1549 * @param array $row is the database row from the table, $table. 1550 * @param string Table name for $row (present in TCA) 1551 * @param string $field is pointing to the field with the list of image files 1552 * @param string Back path prefix for image tag src="" field 1553 * @param string Optional: $thumbScript os by default 'thumbs.php' if you don't set it otherwise 1554 * @param string Optional: $uploaddir is the directory relative to PATH_site where the image files from the $field value is found (Is by default set to the entry in $TCA for that field! so you don't have to!) 1555 * @param boolean If set, uploaddir is NOT prepended with "../" 1556 * @param string Optional: $tparams is additional attributes for the image tags 1557 * @param integer Optional: $size is [w]x[h] of the thumbnail. 56 is default. 1558 * @return string Thumbnail image tag. 1559 */ 1560 function thumbCode($row,$table,$field,$backPath,$thumbScript='',$uploaddir=NULL,$abs=0,$tparams='',$size='') { 1561 global $TCA; 1562 // Load table. 1563 t3lib_div::loadTCA($table); 1564 1565 // Find uploaddir automatically 1566 $uploaddir = (is_null($uploaddir)) ? $TCA[$table]['columns'][$field]['config']['uploadfolder'] : $uploaddir; 1567 $uploaddir = preg_replace('#/$#','',$uploaddir); 1568 1569 // Set thumbs-script: 1570 if (!$GLOBALS['TYPO3_CONF_VARS']['GFX']['thumbnails']) { 1571 $thumbScript='gfx/notfound_thumb.gif'; 1572 } elseif(!$thumbScript) { 1573 $thumbScript='thumbs.php'; 1574 } 1575 // Check and parse the size parameter 1576 $sizeParts=array(); 1577 if ($size = trim($size)) { 1578 $sizeParts = explode('x', $size.'x'.$size); 1579 if(!intval($sizeParts[0])) $size=''; 1580 } 1581 1582 // Traverse files: 1583 $thumbs = explode(',', $row[$field]); 1584 $thumbData=''; 1585 while(list(,$theFile)=each($thumbs)) { 1586 if (trim($theFile)) { 1587 $fI = t3lib_div::split_fileref($theFile); 1588 $ext = $fI['fileext']; 1589 // New 190201 start 1590 $max=0; 1591 if (t3lib_div::inList('gif,jpg,png',$ext)) { 1592 $imgInfo=@getimagesize(PATH_site.$uploaddir.'/'.$theFile); 1593 if (is_array($imgInfo)) {$max = max($imgInfo[0],$imgInfo[1]);} 1594 } 1595 // use the original image if it's size fits to the thumbnail size 1596 if ($max && $max<=(count($sizeParts)&&max($sizeParts)?max($sizeParts):56)) { 1597 $theFile = $url = ($abs?'':'../').($uploaddir?$uploaddir.'/':'').trim($theFile); 1598 $onClick='top.launchView(\''.$theFile.'\',\'\',\''.$backPath.'\');return false;'; 1599 $thumbData.='<a href="#" onclick="'.htmlspecialchars($onClick).'"><img src="'.$backPath.$url.'" '.$imgInfo[3].' hspace="2" border="0" title="'.trim($url).'"'.$tparams.' alt="" /></a> '; 1600 // New 190201 stop 1601 } elseif ($ext=='ttf' || t3lib_div::inList($GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'],$ext)) { 1602 $theFile = ($abs?'':'../').($uploaddir?$uploaddir.'/':'').trim($theFile); 1603 $params = '&file='.rawurlencode($theFile); 1604 $params .= $size?'&size='.$size:''; 1605 $url = $thumbScript.'?&dummy='.$GLOBALS['EXEC_TIME'].$params; 1606 $onClick='top.launchView(\''.$theFile.'\',\'\',\''.$backPath.'\');return false;'; 1607 $thumbData.='<a href="#" onclick="'.htmlspecialchars($onClick).'"><img src="'.htmlspecialchars($backPath.$url).'" hspace="2" border="0" title="'.trim($theFile).'"'.$tparams.' alt="" /></a> '; 1608 } else { 1609 $icon = t3lib_BEfunc::getFileIcon($ext); 1610 $url = 'gfx/fileicons/'.$icon; 1611 $thumbData.='<img src="'.$backPath.$url.'" hspace="2" border="0" title="'.trim($theFile).'"'.$tparams.' alt="" /> '; 1612 } 1613 } 1614 } 1615 return $thumbData; 1616 } 1617 1618 /** 1619 * Returns single image tag to thumbnail using a thumbnail script (like thumbs.php) 1620 * Usage: 3 1621 * 1622 * @param string $thumbScript must point to "thumbs.php" relative to the script position 1623 * @param string $theFile must be the proper reference to the file thumbs.php should show 1624 * @param string $tparams are additional attributes for the image tag 1625 * @param integer $size is the size of the thumbnail send along to "thumbs.php" 1626 * @return string Image tag 1627 */ 1628 function getThumbNail($thumbScript,$theFile,$tparams='',$size='') { 1629 $params = '&file='.rawurlencode($theFile); 1630 $params .= trim($size)?'&size='.trim($size):''; 1631 $url = $thumbScript.'?&dummy='.$GLOBALS['EXEC_TIME'].$params; 1632 $th='<img src="'.htmlspecialchars($url).'" title="'.trim(basename($theFile)).'"'.($tparams?" ".$tparams:"").' alt="" />'; 1633 return $th; 1634 } 1635 1636 /** 1637 * Returns title-attribute information for a page-record informing about id, alias, doktype, hidden, starttime, endtime, fe_group etc. 1638 * Usage: 8 1639 * 1640 * @param array Input must be a page row ($row) with the proper fields set (be sure - send the full range of fields for the table) 1641 * @param string $perms_clause is used to get the record path of the shortcut page, if any (and doktype==4) 1642 * @param boolean If $includeAttrib is set, then the 'title=""' attribute is wrapped about the return value, which is in any case htmlspecialchar()'ed already 1643 * @return string 1644 */ 1645 function titleAttribForPages($row,$perms_clause='',$includeAttrib=1) { 1646 global $TCA,$LANG; 1647 $parts=array(); 1648 $parts[] = 'id='.$row['uid']; 1649 if ($row['alias']) $parts[]=$LANG->sL($TCA['pages']['columns']['alias']['label']).' '.$row['alias']; 1650 if ($row['pid']<0) $parts[] = 'v#1.'.$row['t3ver_id']; 1651 if ($row['t3ver_state']==1) $parts[] = 'PLH WSID#'.$row['t3ver_wsid']; 1652 if ($row['t3ver_state']==-1) $parts[] = 'New element!'; 1653 1654 if ($row['doktype']=='3') { 1655 $parts[]=$LANG->sL($TCA['pages']['columns']['url']['label']).' '.$row['url']; 1656 } elseif ($row['doktype']=='4') { 1657 if ($perms_clause) { 1658 $label = t3lib_BEfunc::getRecordPath(intval($row['shortcut']),$perms_clause,20); 1659 } else { 1660 $lRec = t3lib_BEfunc::getRecordWSOL('pages',intval($row['shortcut']),'title'); 1661 $label = $lRec['title']; 1662 } 1663 if ($row['shortcut_mode']>0) { 1664 $label.=', '.$LANG->sL($TCA['pages']['columns']['shortcut_mode']['label']).' '. 1665 $LANG->sL(t3lib_BEfunc::getLabelFromItemlist('pages','shortcut_mode',$row['shortcut_mode'])); 1666 } 1667 $parts[]=$LANG->sL($TCA['pages']['columns']['shortcut']['label']).' '.$label; 1668 } elseif ($row['doktype']=='7') { 1669 if ($perms_clause) { 1670 $label = t3lib_BEfunc::getRecordPath(intval($row['mount_pid']),$perms_clause,20); 1671 } else { 1672 $lRec = t3lib_BEfunc::getRecordWSOL('pages',intval($row['mount_pid']),'title'); 1673 $label = $lRec['title']; 1674 } 1675 $parts[]=$LANG->sL($TCA['pages']['columns']['mount_pid']['label']).' '.$label; 1676 if ($row['mount_pid_ol']) { 1677 $parts[] = $LANG->sL($TCA['pages']['columns']['mount_pid_ol']['label']); 1678 } 1679 } 1680 if ($row['nav_hide']) $parts[] = ereg_replace(':$','',$LANG->sL($TCA['pages']['columns']['nav_hide']['label'])); 1681 if ($row['hidden']) $parts[] = $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.hidden'); 1682 if ($row['starttime']) $parts[] = $LANG->sL($TCA['pages']['columns']['starttime']['label']).' '.t3lib_BEfunc::dateTimeAge($row['starttime'],-1,'date'); 1683 if ($row['endtime']) $parts[] = $LANG->sL($TCA['pages']['columns']['endtime']['label']).' '.t3lib_BEfunc::dateTimeAge($row['endtime'],-1,'date'); 1684 if ($row['fe_group']) { 1685 if ($row['fe_group']<0) { 1686 $label = $LANG->sL(t3lib_BEfunc::getLabelFromItemlist('pages','fe_group',$row['fe_group'])); 1687 } else { 1688 $lRec = t3lib_BEfunc::getRecordWSOL('fe_groups',$row['fe_group'],'title'); 1689 $label = $lRec['title']; 1690 } 1691 $parts[] = $LANG->sL($TCA['pages']['columns']['fe_group']['label']).' '.$label; 1692 } 1693 $out = htmlspecialchars(implode(' - ',$parts)); 1694 return $includeAttrib ? 'title="'.$out.'"' : $out; 1695 } 1696 1697 /** 1698 * Returns title-attribute information for ANY record (from a table defined in TCA of course) 1699 * The included information depends on features of the table, but if hidden, starttime, endtime and fe_group fields are configured for, information about the record status in regard to these features are is included. 1700 * "pages" table can be used as well and will return the result of ->titleAttribForPages() for that page. 1701 * Usage: 10 1702 * 1703 * @param array Table row; $row is a row from the table, $table 1704 * @param string Table name 1705 * @return string 1706 */ 1707 function getRecordIconAltText($row,$table='pages') { 1708 if ($table=='pages') { 1709 $out = t3lib_BEfunc::titleAttribForPages($row,'',0); 1710 } else { 1711 $ctrl = $GLOBALS['TCA'][$table]['ctrl']['enablecolumns']; 1712 1713 $out='id='.$row['uid']; // Uid is added 1714 if ($table=='pages' && $row['alias']) { 1715 $out.=' / '.$row['alias']; 1716 } 1717 if ($GLOBALS['TCA'][$table]['ctrl']['versioningWS'] && $row['pid']<0) { 1718 $out.=' - v#1.'.$row['t3ver_id']; 1719 } 1720 if ($GLOBALS['TCA'][$table]['ctrl']['versioningWS']) { 1721 if ($row['t3ver_state']==1) $out.= ' - PLH WSID#'.$row['t3ver_wsid']; 1722 if ($row['t3ver_state']==-1) $out.= ' - New element!'; 1723 } 1724 1725 if ($ctrl['disabled']) { // Hidden ... 1726 $out.=($row[$ctrl['disabled']]?' - '.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.hidden'):''); 1727 } 1728 if ($ctrl['starttime']) { 1729 if ($row[$ctrl['starttime']] > $GLOBALS['EXEC_TIME']) { 1730 $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').')'; 1731 } 1732 } 1733 if ($row[$ctrl['endtime']]) { 1734 $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').')'; 1735 } 1736 } 1737 return htmlspecialchars($out); 1738 } 1739 1740 /** 1741 * Returns the label of the first found entry in an "items" array from $TCA (tablename=$table/fieldname=$col) where the value is $key 1742 * Usage: 9 1743 * 1744 * @param string Table name, present in $TCA 1745 * @param string Field name, present in $TCA 1746 * @param string items-array value to match 1747 * @return string Label for item entry 1748 */ 1749 function getLabelFromItemlist($table,$col,$key) { 1750 global $TCA; 1751 // Load full TCA for $table 1752 t3lib_div::loadTCA($table); 1753 1754 // Check, if there is an "items" array: 1755 if (is_array($TCA[$table]) && is_array($TCA[$table]['columns'][$col]) && is_array($TCA[$table]['columns'][$col]['config']['items'])) { 1756 // Traverse the items-array... 1757 reset($TCA[$table]['columns'][$col]['config']['items']); 1758 while(list($k,$v)=each($TCA[$table]['columns'][$col]['config']['items'])) { 1759 // ... and return the first found label where the value was equal to $key 1760 if (!strcmp($v[1],$key)) return $v[0]; 1761 } 1762 } 1763 } 1764 1765 /** 1766 * Returns the label-value for fieldname $col in table, $table 1767 * If $printAllWrap is set (to a "wrap") then it's wrapped around the $col value IF THE COLUMN $col DID NOT EXIST in TCA!, eg. $printAllWrap='<b>|</b>' and the fieldname was 'not_found_field' then the return value would be '<b>not_found_field</b>' 1768 * Usage: 17 1769 * 1770 * @param string Table name, present in $TCA 1771 * @param string Field name 1772 * @param string Wrap value - set function description 1773 * @return string 1774 */ 1775 function getItemLabel($table,$col,$printAllWrap='') { 1776 global $TCA; 1777 // Load full TCA for $table 1778 t3lib_div::loadTCA($table); 1779 // Check if column exists 1780 if (is_array($TCA[$table]) && is_array($TCA[$table]['columns'][$col])) { 1781 // Re 1782 return $TCA[$table]['columns'][$col]['label']; 1783 } 1784 if ($printAllWrap) { 1785 $parts = explode('|',$printAllWrap); 1786 return $parts[0].$col.$parts[1]; 1787 } 1788 } 1789 1790 /** 1791 * Returns the "title"-value in record, $row, from table, $table 1792 * The field(s) from which the value is taken is determined by the "ctrl"-entries 'label', 'label_alt' and 'label_alt_force' 1793 * Usage: 26 1794 * 1795 * @param string Table name, present in TCA 1796 * @param array Row from table 1797 * @param boolean If set, result is prepared for output: The output is cropped to a limited lenght (depending on BE_USER->uc['titleLen']) and if no value is found for the title, '<em>[No title]</em>' is returned (localized). Further, the output is htmlspecialchars()'ed 1798 * @return string 1799 */ 1800 function getRecordTitle($table,$row,$prep=0) { 1801 global $TCA; 1802 if (is_array($TCA[$table])) { 1803 $t = $row[$TCA[$table]['ctrl']['label']]; 1804 if ($TCA[$table]['ctrl']['label_alt'] && ($TCA[$table]['ctrl']['label_alt_force'] || !strcmp($t,''))) { 1805 $altFields=t3lib_div::trimExplode(',',$TCA[$table]['ctrl']['label_alt'],1); 1806 $tA=array(); 1807 $tA[]=$t; 1808 while(list(,$fN)=each($altFields)) { 1809 $t = $tA[] = trim(strip_tags($row[$fN])); 1810 if (strcmp($t,'') && !$TCA[$table]['ctrl']['label_alt_force']) break; 1811 } 1812 if ($TCA[$table]['ctrl']['label_alt_force']) $t=implode(', ',$tA); 1813 } 1814 if ($prep) { 1815 $t = htmlspecialchars(t3lib_div::fixed_lgd_cs($t,$GLOBALS['BE_USER']->uc['titleLen'])); 1816 if (!strcmp(trim($t),'')) $t='<em>['.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.no_title',1).']</em>'; 1817 } 1818 return $t; 1819 } 1820 } 1821 1822 /** 1823 * Returns a human readable output of a value from a record 1824 * For instance a database record relation would be looked up to display the title-value of that record. A checkbox with a "1" value would be "Yes", etc. 1825 * $table/$col is tablename and fieldname 1826 * REMEMBER to pass the output through htmlspecialchars() if you output it to the browser! (To protect it from XSS attacks and be XHTML compliant) 1827 * Usage: 24 1828 * 1829 * @param string Table name, present in TCA 1830 * @param string Field name, present in TCA 1831 * @param string $value is the value of that field from a selected record 1832 * @param integer $fixed_lgd_chars is the max amount of characters the value may occupy 1833 * @param boolean $defaultPassthrough flag means that values for columns that has no conversion will just be pass through directly (otherwise cropped to 200 chars or returned as "N/A") 1834 * @param boolean If set, no records will be looked up, UIDs are just shown. 1835 * @param integer uid of the current record 1836 * @return string 1837 */ 1838 function getProcessedValue($table,$col,$value,$fixed_lgd_chars=0,$defaultPassthrough=0,$noRecordLookup=FALSE,$uid=0) { 1839 global $TCA; 1840 global $TYPO3_CONF_VARS; 1841 // Load full TCA for $table 1842 t3lib_div::loadTCA($table); 1843 // Check if table and field is configured: 1844 if (is_array($TCA[$table]) && is_array($TCA[$table]['columns'][$col])) { 1845 // Depending on the fields configuration, make a meaningful output value. 1846 $theColConf = $TCA[$table]['columns'][$col]['config']; 1847 1848 /***************** 1849 *HOOK: pre-processing the human readable output from a record 1850 ****************/ 1851 if (is_array ($TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_befunc.php']['preProcessValue'])) { 1852 foreach ($TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_befunc.php']['preProcessValue'] as $_funcRef) { 1853 t3lib_div::callUserFunction($_funcRef,$theColConf,$this); 1854 } 1855 } 1856 1857 $l=''; 1858 switch((string)$theColConf['type']) { 1859 case 'radio': 1860 $l=t3lib_BEfunc::getLabelFromItemlist($table,$col,$value); 1861 $l=$GLOBALS['LANG']->sL($l); 1862 break; 1863 case 'select': 1864 if ($theColConf['MM']) { 1865 // Display the title of MM related records in lists 1866 $MMfield = $noRecordLookup?'uid':$TCA[$theColConf['foreign_table']]['ctrl']['label']; 1867 $MMres = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query( 1868 $theColConf['foreign_table'].'.'.$MMfield, 1869 ($table!=$theColConf['foreign_table']?$table:''), 1870 $theColConf['MM'], 1871 $theColConf['foreign_table'], 1872 'AND '.$theColConf['MM'].'.uid_local ='.intval($uid).t3lib_BEfunc::deleteClause($theColConf['foreign_table']) 1873 ); 1874 if ($MMres) { 1875 while($MMrow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($MMres)) { 1876 $mmlA[] = $MMrow[$MMfield]; 1877 } 1878 if (is_array($mmlA)) { 1879 $l=implode(', ',$mmlA); 1880 } else { 1881 $l = ''; 1882 } 1883 } else { 1884 $l = 'n/A'; 1885 } 1886 } else { 1887 $l = t3lib_BEfunc::getLabelFromItemlist($table,$col,$value); 1888 $l = $GLOBALS['LANG']->sL($l); 1889 if ($theColConf['foreign_table'] && !$l && $TCA[$theColConf['foreign_table']]) { 1890 if ($noRecordLookup) { 1891 $l = $value; 1892 } else { 1893 $rParts = t3lib_div::trimExplode(',',$value,1); 1894 reset($rParts); 1895 $lA = array(); 1896 while(list(,$rVal)=each($rParts)) { 1897 $rVal = intval($rVal); 1898 if ($rVal>0) { 1899 $r=t3lib_BEfunc::getRecordWSOL($theColConf['foreign_table'],$rVal); 1900 } else { 1901 $r=t3lib_BEfunc::getRecordWSOL($theColConf['neg_foreign_table'],-$rVal); 1902 } 1903 if (is_array($r)) { 1904 $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); 1905 } else { 1906 $lA[]=$rVal?'['.$rVal.'!]':''; 1907 } 1908 } 1909 $l = implode(', ',$lA); 1910 } 1911 } 1912 } 1913 break; 1914 case 'group': 1915 $l = implode(', ',t3lib_div::trimExplode(',',$value,1)); 1916 break; 1917 case 'check': 1918 if (!is_array($theColConf['items']) || count($theColConf['items'])==1) { 1919 $l = $value ? 'Yes' : ''; 1920 } else { 1921 reset($theColConf['items']); 1922 $lA=Array(); 1923 while(list($key,$val)=each($theColConf['items'])) { 1924 if ($value & pow(2,$key)) {$lA[]=$GLOBALS['LANG']->sL($val[0]);} 1925 } 1926 $l = implode(', ',$lA); 1927 } 1928 break; 1929 case 'input': 1930 if ($value) { 1931 if (t3lib_div::inList($theColConf['eval'],'date')) { 1932 $l = t3lib_BEfunc::date($value).' ('.(time()-$value>0?'-':'').t3lib_BEfunc::calcAge(abs(time()-$value), $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.minutesHoursDaysYears')).')'; 1933 } elseif (t3lib_div::inList($theColConf['eval'],'time')) { 1934 $l = t3lib_BEfunc::time($value); 1935 } elseif (t3lib_div::inList($theColConf['eval'],'datetime')) { 1936 $l = t3lib_BEfunc::datetime($value); 1937 } else { 1938 $l = $value; 1939 } 1940 } 1941 break; 1942 case 'flex': 1943 $l = strip_tags($value); 1944 break; 1945 default: 1946 if ($defaultPassthrough) { 1947 $l=$value; 1948 } elseif ($theColConf['MM']) { 1949 $l='N/A'; 1950 } elseif ($value) { 1951 $l=t3lib_div::fixed_lgd_cs(strip_tags($value),200); 1952 } 1953 break; 1954 } 1955 1956 /***************** 1957 *HOOK: post-processing the human readable output from a record 1958 ****************/ 1959 if (is_array ($TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_befunc.php']['postProcessValue'])) { 1960 foreach ($TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_befunc.php']['postProcessValue'] as $_funcRef) { 1961 $params = array( 1962 'value' => $l, 1963 'colConf' => $theColConf 1964 ); 1965 $l = t3lib_div::callUserFunction($_funcRef,$params,$this); 1966 } 1967 } 1968 1969 if ($fixed_lgd_chars) { 1970 return t3lib_div::fixed_lgd_cs($l,$fixed_lgd_chars); 1971 } else { 1972 return $l; 1973 } 1974 } 1975 } 1976 1977 /** 1978 * Same as ->getProcessedValue() but will go easy on fields like "tstamp" and "pid" which are not configured in TCA - they will be formatted by this function instead. 1979 * Usage: 2 1980 * 1981 * @param string Table name, present in TCA 1982 * @param string Field name 1983 * @param string Field value 1984 * @param integer $fixed_lgd_chars is the max amount of characters the value may occupy 1985 * @param integer uid of the current record 1986 * @return string 1987 * @see getProcessedValue() 1988 */ 1989 function getProcessedValueExtra($table,$fN,$fV,$fixed_lgd_chars=0,$uid=0) { 1990 global $TCA; 1991 $fVnew = t3lib_BEfunc::getProcessedValue($table,$fN,$fV,$fixed_lgd_chars,0,0,$uid); 1992 if (!isset($fVnew)) { 1993 if (is_array($TCA[$table])) { 1994 if ($fN==$TCA[$table]['ctrl']['tstamp'] || $fN==$TCA[$table]['ctrl']['crdate']) { 1995 $fVnew = t3lib_BEfunc::datetime($fV); 1996 } elseif ($fN=='pid'){ 1997 $fVnew = t3lib_BEfunc::getRecordPath($fV,'1=1',20); // Fetches the path with no regard to the users permissions to select pages. 1998 } else { 1999 $fVnew = $fV; 2000 } 2001 } 2002 } 2003 return $fVnew; 2004 } 2005 2006 /** 2007 * Returns file icon name (from $FILEICONS) for the fileextension $ext 2008 * Usage: 10 2009 * 2010 * @param string File extension, lowercase 2011 * @return string File icon filename 2012 */ 2013 function getFileIcon($ext) { 2014 return $GLOBALS['FILEICONS'][$ext] ? $GLOBALS['FILEICONS'][$ext] : $GLOBALS['FILEICONS']['default']; 2015 } 2016 2017 /** 2018 * Returns fields for a table, $table, which would typically be interesting to select 2019 * This includes uid, the fields defined for title, icon-field. 2020 * Returned as a list ready for query ($prefix can be set to eg. "pages." if you are selecting from the pages table and want the table name prefixed) 2021 * Usage: 3 2022 * 2023 * @param string Table name, present in TCA 2024 * @param string Table prefix 2025 * @return string List of fields. 2026 */ 2027 function getCommonSelectFields($table,$prefix='') { 2028 global $TCA; 2029 $fields = array(); 2030 $fields[] = $prefix.'uid'; 2031 $fields[] = $prefix.$TCA[$table]['ctrl']['label']; 2032 2033 if ($TCA[$table]['ctrl']['label_alt']) { 2034 $secondFields = t3lib_div::trimExplode(',',$TCA[$table]['ctrl']['label_alt'],1); 2035 foreach($secondFields as $fieldN) { 2036 $fields[] = $prefix.$fieldN; 2037 } 2038 } 2039 if ($TCA[$table]['ctrl']['versioningWS']) { 2040 $fields[] = $prefix.'t3ver_id'; 2041 $fields[] = $prefix.'t3ver_state'; 2042 $fields[] = $prefix.'t3ver_wsid'; 2043 $fields[] = $prefix.'t3ver_count'; 2044 } 2045 2046 if ($TCA[$table]['ctrl']['selicon_field']) $fields[] = $prefix.$TCA[$table]['ctrl']['selicon_field']; 2047 if ($TCA[$table]['ctrl']['typeicon_column']) $fields[] = $prefix.$TCA[$table]['ctrl']['typeicon_column']; 2048 2049 if (is_array($TCA[$table]['ctrl']['enablecolumns'])) { 2050 if ($TCA[$table]['ctrl']['enablecolumns']['disabled']) $fields[] = $prefix.$TCA[$table]['ctrl']['enablecolumns']['disabled']; 2051 if ($TCA[$table]['ctrl']['enablecolumns']['starttime']) $fields[] = $prefix.$TCA[$table]['ctrl']['enablecolumns']['starttime']; 2052 if ($TCA[$table]['ctrl']['enablecolumns']['endtime']) $fields[] = $prefix.$TCA[$table]['ctrl']['enablecolumns']['endtime']; 2053 if ($TCA[$table]['ctrl']['enablecolumns']['fe_group']) $fields[] = $prefix.$TCA[$table]['ctrl']['enablecolumns']['fe_group']; 2054 } 2055 2056 return implode(',', array_unique($fields)); 2057 } 2058 2059 /** 2060 * Makes a form for configuration of some values based on configuration found in the array $configArray, with default values from $defaults and a data-prefix $dataPrefix 2061 * <form>-tags must be supplied separately 2062 * Needs more documentation and examples, in particular syntax for configuration array. See Inside TYPO3. That's were you can expect to find example, if anywhere. 2063 * Usage: 1 (ext. direct_mail) 2064 * 2065 * @param array Field configuration code. 2066 * @param array Defaults 2067 * @param string Prefix for formfields 2068 * @return string HTML for a form. 2069 */ 2070 function makeConfigForm($configArray,$defaults,$dataPrefix) { 2071 $params = $defaults; 2072 if (is_array($configArray)) { 2073 reset($configArray); 2074 $lines=array(); 2075 while(list($fname,$config)=each($configArray)) { 2076 if (is_array($config)) { 2077 $lines[$fname]='<strong>'.htmlspecialchars($config[1]).'</strong><br />'; 2078 $lines[$fname].=$config[2].'<br />'; 2079 switch($config[0]) { 2080 case 'string': 2081 case 'short': 2082 $formEl = '<input type="text" name="'.$dataPrefix.'['.$fname.']" value="'.$params[$fname].'"'.$GLOBALS['TBE_TEMPLATE']->formWidth($config[0]=='short'?24:48).' />'; 2083 break; 2084 case 'check': 2085 $formEl = '<input type="hidden" name="'.$dataPrefix.'['.$fname.']" value="0" /><input type="checkbox" name="'.$dataPrefix.'['.$fname.']" value="1"'.($params[$fname]?' checked="checked"':'').' />'; 2086 break; 2087 case 'comment': 2088 $formEl = ''; 2089 break; 2090 case 'select': 2091 reset($config[3]); 2092 $opt=array(); 2093 while(list($k,$v)=each($config[3])) { 2094 $opt[]='<option value="'.htmlspecialchars($k).'"'.($params[$fname]==$k?' selected="selected"':'').'>'.htmlspecialchars($v).'</option>'; 2095 } 2096 $formEl = '<select name="'.$dataPrefix.'['.$fname.']">'.implode('',$opt).'</select>'; 2097 break; 2098 default: 2099 debug($config); 2100 break; 2101 } 2102 $lines[$fname].=$formEl; 2103 $lines[$fname].='<br /><br />'; 2104 } else { 2105 $lines[$fname]='<hr />'; 2106 if ($config) $lines[$fname].='<strong>'.strtoupper(htmlspecialchars($config)).'</strong><br />'; 2107 if ($config) $lines[$fname].='<br />'; 2108 } 2109 } 2110 } 2111 $out = implode('',$lines); 2112 $out.='<input type="submit" name="submit" value="Update configuration" />'; 2113 return $out; 2114 } 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 /******************************************* 2129 * 2130 * Backend Modules API functions 2131 * 2132 *******************************************/ 2133 2134 /** 2135 * Returns help-text icon if configured for. 2136 * TCA_DESCR must be loaded prior to this function and $BE_USER must have 'edit_showFieldHelp' set to 'icon', otherwise nothing is returned 2137 * Usage: 6 2138 * 2139 * @param string Table name 2140 * @param string Field name 2141 * @param string Back path 2142 * @param boolean Force display of icon nomatter BE_USER setting for help 2143 * @return string HTML content for a help icon/text 2144 */ 2145 function helpTextIcon($table,$field,$BACK_PATH,$force=0) { 2146 global $TCA_DESCR,$BE_USER; 2147 if (is_array($TCA_DESCR[$table]) && is_array($TCA_DESCR[$table]['columns'][$field]) && ($BE_USER->uc['edit_showFieldHelp']=='icon' || $force)) { 2148 $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;'; 2149 return '<a href="#" onclick="'.htmlspecialchars($onClick).'">'. 2150 '<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/helpbubble.gif','width="14" height="14"').' hspace="2" border="0" class="typo3-csh-icon" alt="" />'. 2151 '</a>'; 2152 } 2153 } 2154 2155 /** 2156 * Returns CSH help text (description), if configured for. 2157 * TCA_DESCR must be loaded prior to this function and $BE_USER must have "edit_showFieldHelp" set to "text", otherwise nothing is returned 2158 * Will automatically call t3lib_BEfunc::helpTextIcon() to get the icon for the text. 2159 * Usage: 4 2160 * 2161 * @param string Table name 2162 * @param string Field name 2163 * @param string Back path 2164 * @param string Additional style-attribute content for wrapping table 2165 * @return string HTML content for help text 2166 */ 2167 function helpText($table,$field,$BACK_PATH,$styleAttrib='') { 2168 global $TCA_DESCR,$BE_USER; 2169 if (is_array($TCA_DESCR[$table]) && is_array($TCA_DESCR[$table]['columns'][$field]) && $BE_USER->uc['edit_showFieldHelp']=='text') { 2170 $fDat = $TCA_DESCR[$table]['columns'][$field]; 2171 2172 // Get Icon: 2173 $editIcon = t3lib_BEfunc::helpTextIcon( 2174 $table, 2175 $field, 2176 $BACK_PATH, 2177 TRUE 2178 ); 2179 // Add title? 2180 $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;'; 2181 $text = 2182 ($fDat['alttitle'] ? '<h4><a href="#" onclick="'.htmlspecialchars($onClick).'">'.$fDat['alttitle'].'</a></h4>' : ''). 2183 $fDat['description']; 2184 2185 // More information to get? 2186 if ($fDat['image_descr'] || $fDat['seeAlso'] || $fDat['details'] || $fDat['syntax']) { // || $fDat['image']; 2187 $text.=' <a href="#" onclick="'.htmlspecialchars($onClick).'">'. 2188 '<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/rel_db.gif','width="13" height="12"').' class="absmiddle typo3-csh-more" alt="" />'. 2189 '</a>'; 2190 } 2191 2192 // Additional styles? 2193 $params = $styleAttrib ? ' style="'.$styleAttrib.'"' : ''; 2194 2195 // Compile table with CSH information: 2196 return '<table border="0" cellpadding="2" cellspacing="0" class="typo3-csh-inline"'.$params.'> 2197 <tr> 2198 <td valign="top" width="14">'.$editIcon.'</td> 2199 <td valign="top">'.$text.'</td> 2200 </tr> 2201 </table>'; 2202 } 2203 } 2204 2205 /** 2206 * API for getting CSH icons/text for use in backend modules. 2207 * TCA_DESCR will be loaded if it isn't already 2208 * Usage: ? 2209 * 2210 * @param string Table name ('_MOD_'+module name) 2211 * @param string Field name (CSH locallang main key) 2212 * @param string Back path 2213 * @param string Wrap code for icon-mode, splitted by "|". Not used for full-text mode. 2214 * @param boolean If set, the full text will never be shown (only icon). Useful for places where it will break the page if the table with full text is shown. 2215 * @param string Additional style-attribute content for wrapping table (full text mode only) 2216 * @return string HTML content for help text 2217 * @see helpText(), helpTextIcon() 2218 */ 2219 function cshItem($table,$field,$BACK_PATH,$wrap='',$onlyIconMode=FALSE, $styleAttrib='') { 2220 global $TCA_DESCR, $LANG, $BE_USER; 2221 if ($BE_USER->uc['edit_showFieldHelp']) { 2222 $LANG->loadSingleTableDescription($table); 2223 2224 if (is_array($TCA_DESCR[$table])) { 2225 // Creating CSH icon and short description: 2226 $fullText = t3lib_BEfunc::helpText($table,$field,$BACK_PATH,$styleAttrib); 2227 $icon = t3lib_BEfunc::helpTextIcon($table,$field,$BACK_PATH,$onlyIconMode); 2228 2229 if ($fullText && !$onlyIconMode) { 2230 $output = $GLOBALS['LANG']->hscAndCharConv($fullText, false); 2231 } else { 2232 #$output = '<span style="position:absolute; filter: alpha(opacity=50); -moz-opacity: 0.50;">'.$icon.'</span>'; 2233 $output = $icon; 2234 2235 if ($output && $wrap) { 2236 $wrParts = explode('|',$wrap); 2237 $output = $wrParts[0].$output.$wrParts[1]; 2238 } 2239 } 2240 2241 return $output; 2242 } 2243 } 2244 } 2245 2246 /** 2247 * Returns a JavaScript string (for an onClick handler) which will load the alt_doc.php script that shows the form for editing of the record(s) you have send as params. 2248 * REMEMBER to always htmlspecialchar() content in href-properties to ampersands get converted to entities (XHTML requirement and XSS precaution) 2249 * Usage: 35 2250 * 2251 * @param string $params is parameters sent along to alt_doc.php. This requires a much more details description which you must seek in Inside TYPO3s documentation of the alt_doc.php API. And example could be '&edit[pages][123]=edit' which will show edit form for page record 123. 2252 * @param string $backPath must point back to the TYPO3_mainDir directory (where alt_doc.php is) 2253 * @param string $requestUri is an optional returnUrl you can set - automatically set to REQUEST_URI. 2254 * @return string 2255 * @see template::issueCommand() 2256 */ 2257 function editOnClick($params,$backPath='',$requestUri='') { 2258 $retUrl = 'returnUrl='.($requestUri==-1?"'+T3_THIS_LOCATION+'":rawurlencode($requestUri?$requestUri:t3lib_div::getIndpEnv('REQUEST_URI'))); 2259 return "window.location.href='".$backPath."alt_doc.php?".$retUrl.$params."'; return false;"; 2260 } 2261 2262 /** 2263 * Returns a JavaScript string for viewing the page id, $id 2264 * It will detect the correct domain name if needed and provide the link with the right back path. Also it will re-use any window already open. 2265 * Usage: 8 2266 * 2267 * @param integer $id is page id 2268 * @param string $backpath must point back to TYPO3_mainDir (where the site is assumed to be one level above) 2269 * @param array If root line is supplied the function will look for the first found domain record and use that URL instead (if found) 2270 * @param string $anchor is optional anchor to the URL 2271 * @param string $altUrl is an alternative URL which - if set - will make all other parameters ignored: The function will just return the window.open command wrapped around this URL! 2272 * @param string Additional GET variables. 2273 * @param boolean If true, then the preview window will gain the focus. 2274 * @return string 2275 */ 2276 function viewOnClick($id,$backPath='',$rootLine='',$anchor='',$altUrl='',$addGetVars='',$switchFocus=TRUE) { 2277 if ($altUrl) { 2278 $url = $altUrl; 2279 } else { 2280 2281 if ($GLOBALS['BE_USER']->workspace!=0) { 2282 $url = t3lib_div::getIndpEnv('TYPO3_SITE_URL').TYPO3_mainDir.'mod/user/ws/wsol_preview.php?id='.$id.$addGetVars.$anchor; 2283 } else { 2284 if ($rootLine) { 2285 $parts = parse_url(t3lib_div::getIndpEnv('TYPO3_SITE_URL')); 2286 if (t3lib_BEfunc::getDomainStartPage($parts['host'],$parts['path'])) { 2287 $preUrl_temp = t3lib_BEfunc::firstDomainRecord($rootLine); 2288 } 2289 } 2290 $preUrl = $preUrl_temp ? (t3lib_div::getIndpEnv('TYPO3_SSL') ? 'https://' : 'http://').$preUrl_temp : $backPath.'..'; 2291 $url = $preUrl.'/index.php?id='.$id.$addGetVars.$anchor; 2292 } 2293 } 2294 2295 return "previewWin=window.open('".$url."','newTYPO3frontendWindow');". 2296 ($switchFocus ? 'previewWin.focus();' : ''); 2297 } 2298 2299 /** 2300 * Returns the merged User/Page TSconfig for page id, $id. 2301 * Please read details about module programming elsewhere! 2302 * Usage: 15 2303 * 2304 * @param integer Page uid 2305 * @param string $TSref is an object string which determines the path of the TSconfig to return. 2306 * @return array 2307 */ 2308 function getModTSconfig($id,$TSref) { 2309 $pageTS_modOptions = $GLOBALS['BE_USER']->getTSConfig($TSref,t3lib_BEfunc::getPagesTSconfig($id)); 2310 $BE_USER_modOptions = $GLOBALS['BE_USER']->getTSConfig($TSref); 2311 $modTSconfig = t3lib_div::array_merge_recursive_overrule($pageTS_modOptions,$BE_USER_modOptions); 2312 return $modTSconfig; 2313 } 2314 2315 /** 2316 * Returns a selector box "function menu" for a module 2317 * Requires the JS function jumpToUrl() to be available 2318 * See Inside TYPO3 for details about how to use / make Function menus 2319 * Usage: 50 2320 * 2321 * @param mixed $id is the "&id=" parameter value to be sent to the module, but it can be also a parameter array which will be passed instead of the &id=... 2322 * @param string $elementName it the form elements name, probably something like "SET[...]" 2323 * @param string $currentValue is the value to be selected currently. 2324 * @param array $menuItems is an array with the menu items for the selector box 2325 * @param string $script is the script to send the &id to, if empty it's automatically found 2326 * @param string $addParams is additional parameters to pass to the script. 2327 * @return string HTML code for selector box 2328 */ 2329 function getFuncMenu($mainParams,$elementName,$currentValue,$menuItems,$script='',$addparams='') { 2330 if (is_array($menuItems)) { 2331 if (!is_array($mainParams)) { 2332 $mainParams = array('id' => $mainParams); 2333 } 2334 $mainParams = t3lib_div::implodeArrayForUrl('',$mainParams); 2335 2336 if (!$script) { $script=basename(PATH_thisScript); } 2337 2338 $options = array(); 2339 foreach($menuItems as $value => $label) { 2340 $options[] = '<option value="'.htmlspecialchars($value).'"'.(!strcmp($currentValue,$value)?' selected="selected"':'').'>'. 2341 t3lib_div::deHSCentities(htmlspecialchars($label)). 2342 '</option>'; 2343 } 2344 if (count($options)) { 2345 $onChange = 'jumpToUrl(\''.$script.'?'.$mainParams.$addparams.'&'.$elementName.'=\'+this.options[this.selectedIndex].value,this);'; 2346 return ' 2347 2348 <!-- Function Menu of module --> 2349 <select name="'.$elementName.'" onchange="'.htmlspecialchars($onChange).'"> 2350 '.implode(' 2351 ',$options).' 2352 </select> 2353 '; 2354 } 2355 } 2356 } 2357 2358 /** 2359 * Checkbox function menu. 2360 * Works like ->getFuncMenu() but takes no $menuItem array since this is a simple checkbox. 2361 * Usage: 34 2362 * 2363 * @param mixed $mainParams $id is the "&id=" parameter value to be sent to the module, but it can be also a parameter array which will be passed instead of the &id=... 2364 * @param string $elementName it the form elements name, probably something like "SET[...]" 2365 * @param string $currentValue is the value to be selected currently. 2366 * @param string $script is the script to send the &id to, if empty it's automatically found 2367 * @param string $addParams is additional parameters to pass to the script. 2368 * @param string Additional attributes for the checkbox input tag 2369 * @return string HTML code for checkbox 2370 * @see getFuncMenu() 2371 */ 2372 function getFuncCheck($mainParams,$elementName,$currentValue,$script='',$addparams='',$tagParams='') { 2373 if (!is_array($mainParams)) { 2374 $mainParams = array('id' => $mainParams); 2375 } 2376 $mainParams = t3lib_div::implodeArrayForUrl('',$mainParams); 2377 2378 if (!$script) {basename(PATH_thisScript);} 2379 $onClick = 'jumpToUrl(\''.$script.'?'.$mainParams.$addparams.'&'.$elementName.'=\'+(this.checked?1:0),this);'; 2380 return '<input type="checkbox" name="'.$elementName.'"'.($currentValue?' checked="checked"':'').' onclick="'.htmlspecialchars($onClick).'"'.($tagParams?' '.$tagParams:'').' />'; 2381 } 2382 2383 /** 2384 * Input field function menu 2385 * Works like ->getFuncMenu() / ->getFuncCheck() but displays a input field instead which updates the script "onchange" 2386 * Usage: 1 2387 * 2388 * @param mixed $id is the "&id=" parameter value to be sent to the module, but it can be also a parameter array which will be passed instead of the &id=... 2389 * @param string $elementName it the form elements name, probably something like "SET[...]" 2390 * @param string $currentValue is the value to be selected currently. 2391 * @param integer Relative size of input field, max is 48 2392 * @param string $script is the script to send the &id to, if empty it's automatically found 2393 * @param string $addParams is additional parameters to pass to the script. 2394 * @return string HTML code for input text field. 2395 * @see getFuncMenu() 2396 */ 2397 function getFuncInput($mainParams,$elementName,$currentValue,$size=10,$script="",$addparams="") { 2398 if (!is_array($mainParams)) { 2399 $mainParams = array('id' => $mainParams); 2400 } 2401 $mainParams = t3lib_div::implodeArrayForUrl('',$mainParams); 2402 2403 if (!$script) {basename(PATH_thisScript);} 2404 $onChange = 'jumpToUrl(\''.$script.'?'.$mainParams.$addparams.'&'.$elementName.'=\'+escape(this.value),this);'; 2405 return '<input type="text"'.$GLOBALS['TBE_TEMPLATE']->formWidth($size).' name="'.$elementName.'" value="'.htmlspecialchars($currentValue).'" onchange="'.htmlspecialchars($onChange).'" />'; 2406 } 2407 2408 /** 2409 * Removes menu items from $itemArray if they are configured to be removed by TSconfig for the module ($modTSconfig) 2410 * See Inside TYPO3 about how to program modules and use this API. 2411 * Usage: 4 2412 * 2413 * @param array Module TS config array 2414 * @param array Array of items from which to remove items. 2415 * @param string $TSref points to the "object string" in $modTSconfig 2416 * @return array The modified $itemArray is returned. 2417 */ 2418 function unsetMenuItems($modTSconfig,$itemArray,$TSref) { 2419 // Getting TS-config options for this module for the Backend User: 2420 $conf = $GLOBALS['BE_USER']->getTSConfig($TSref,$modTSconfig); 2421 if (is_array($conf['properties'])) { 2422 reset($conf['properties']); 2423 while(list($key,$val)=each($conf['properties'])) { 2424 if (!$val) { 2425 unset($itemArray[$key]); 2426 } 2427 } 2428 } 2429 return $itemArray; 2430 } 2431 2432 /** 2433 * Call to update the page tree frame (or something else..?) after 2434 * t3lib_BEfunc::getSetUpdateSignal('updatePageTree') -> will set the page tree to be updated. 2435 * t3lib_BEfunc::getSetUpdateSignal() -> will return some JavaScript that does the update (called in the typo3/template.php file, end() function) 2436 * Usage: 11 2437 * 2438 * @param string Whether to set or clear the update signal. When setting, this value contains strings telling WHAT to set. At this point it seems that the value "updatePageTree" is the only one it makes sense to set. 2439 * @return string HTML code (<script> section) 2440 */ 2441 function getSetUpdateSignal($set='') { 2442 global $BE_USER; 2443 $key = 't3lib_BEfunc::getSetUpdateSignal'; 2444 $out=''; 2445 if ($set) { 2446 $modData=array(); 2447 $modData['set']=$set; 2448 $BE_USER->pushModuleData($key,$modData); 2449 } else { 2450 $modData = $BE_USER->getModuleData($key,'ses'); 2451 if (trim($modData['set'])) { 2452 $l=explode(',',$modData['set']); 2453 while(list(,$v)=each($l)) { 2454 switch($v) { 2455 case 'updatePageTree': 2456 case 'updateFolderTree': 2457 $out.=' 2458 <script type="text/javascript"> 2459 /*<![CDATA[*/ 2460 if (top.content && top.content.nav_frame && top.content.nav_frame.refresh_nav) { 2461 top.content.nav_frame.refresh_nav(); 2462 } 2463 /*]]>*/ 2464 </script>'; 2465 break; 2466 } 2467 } 2468 $modData=array(); 2469 $modData['set']=''; 2470 $BE_USER->pushModuleData($key,$modData); 2471 } 2472 } 2473 return $out; 2474 } 2475 2476 2477 /** 2478 * Returns an array which is most backend modules becomes MOD_SETTINGS containing values from function menus etc. determining the function of the module. 2479 * This is kind of session variable management framework for the backend users. 2480 * If a key from MOD_MENU is set in the CHANGED_SETTINGS array (eg. a value is passed to the script from the outside), this value is put into the settings-array 2481 * Ultimately, see Inside TYPO3 for how to use this function in relation to your modules. 2482 * Usage: 23 2483 * 2484 * @param array MOD_MENU is an array that defines the options in menus. 2485 * @param array CHANGED_SETTINGS represents the array used when passing values to the script from the menus. 2486 * @param string modName is the name of this module. Used to get the correct module data. 2487 * @param string If type is 'ses' then the data is stored as session-lasting data. This means that it'll be wiped out the next time the user logs in. 2488 * @param string dontValidateList can be used to list variables that should not be checked if their value is found in the MOD_MENU array. Used for dynamically generated menus. 2489 * @param string List of default values from $MOD_MENU to set in the output array (only if the values from MOD_MENU are not arrays) 2490 * @return array The array $settings, which holds a key for each MOD_MENU key and the values of each key will be within the range of values for each menuitem 2491 */ 2492 function getModuleData($MOD_MENU, $CHANGED_SETTINGS, $modName, $type='', $dontValidateList='', $setDefaultList='') { 2493 2494 if ($modName && is_string($modName)) { 2495 // GETTING stored user-data from this module: 2496 $settings = $GLOBALS['BE_USER']->getModuleData($modName,$type); 2497 2498 $changed=0; 2499 if (!is_array($settings)) { 2500 $changed=1; 2501 $settings=array(); 2502 } 2503 if (is_array($MOD_MENU)) { 2504 foreach ($MOD_MENU as $key=>$var) { 2505 // If a global var is set before entering here. eg if submitted, then it's substituting the current value the array. 2506 if (is_array($CHANGED_SETTINGS) && isset($CHANGED_SETTINGS[$key]) && strcmp($settings[$key],$CHANGED_SETTINGS[$key])) { 2507 $settings[$key] = (string)$CHANGED_SETTINGS[$key]; 2508 $changed=1; 2509 } 2510 // If the $var is an array, which denotes the existence of a menu, we check if the value is permitted 2511 if (is_array($var) && (!$dontValidateList || !t3lib_div::inList($dontValidateList,$key))) { 2512 // If the setting is an array or not present in the menu-array, MOD_MENU, then the default value is inserted. 2513 if (is_array($settings[$key]) || !isset($MOD_MENU[$key][$settings[$key]])) { 2514 $settings[$key]=(string)key($var); 2515 $changed=1; 2516 } 2517 } 2518 if ($setDefaultList && !is_array($var)) { // Sets default values (only strings/checkboxes, not menus) 2519 if (t3lib_div::inList($setDefaultList,$key) && !isset($settings[$key])) { 2520 $settings[$key]=$var; 2521 } 2522 } 2523 } 2524 } else {die ('No menu!');} 2525 2526 if ($changed) { 2527 $GLOBALS['BE_USER']->pushModuleData($modName,$settings); 2528 } 2529 2530 return $settings; 2531 } else {die ('Wrong module name: "'.$modName.'"');} 2532 } 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 /******************************************* 2547 * 2548 * Core 2549 * 2550 *******************************************/ 2551 2552 /** 2553 * Set preview keyword, eg: 2554 * $previewUrl = t3lib_div::getIndpEnv('TYPO3_SITE_URL').'?ADMCMD_prev='.t3lib_BEfunc::compilePreviewKeyword('id='.$pageId.'&L='.$language.'&ADMCMD_view=1&ADMCMD_editIcons=1&ADMCMD_previewWS='.$this->workspace, $GLOBALS['BE_USER']->user['uid'], 120); 2555 * 2556 * todo for sys_preview: 2557 * - Add a comment which can be shown to previewer in frontend in some way (plus maybe ability to write back, take other action?) 2558 * - Add possibility for the preview keyword to work in the backend as well: So it becomes a quick way to a certain action of sorts? 2559 * 2560 * @param string Get variables to preview, eg. 'id=1150&L=0&ADMCMD_view=1&ADMCMD_editIcons=1&ADMCMD_previewWS=8' 2561 * @param string 32 byte MD5 hash keyword for the URL: "?ADMCMD_prev=[keyword]" 2562 * @param integer Time-To-Live for keyword 2563 * @return string Returns keyword to use in URL for ADMCMD_prev= 2564 */ 2565 function compilePreviewKeyword($getVarsStr, $beUserUid, $ttl=172800) { 2566 $field_array = array( 2567 'keyword' => md5(uniqid(microtime())), 2568 'tstamp' => time(), 2569 'endtime' => time()+$ttl, 2570 'config' => serialize(array( 2571 'getVars' => $getVarsStr, 2572 'BEUSER_uid' => $beUserUid 2573 )) 2574 ); 2575 2576 $GLOBALS['TYPO3_DB']->exec_INSERTquery('sys_preview', $field_array); 2577 2578 return $field_array['keyword']; 2579 } 2580 2581 /** 2582 * Unlock or Lock a record from $table with $uid 2583 * If $table and $uid is not set, then all locking for the current BE_USER is removed! 2584 * Usage: 5 2585 * 2586 * @param string Table name 2587 * @param integer Record uid 2588 * @param integer Record pid 2589 * @return void 2590 * @internal 2591 * @see t3lib_transferData::lockRecord(), alt_doc.php, db_layout.php, db_list.php, wizard_rte.php 2592 */ 2593 function lockRecords($table='',$uid=0,$pid=0) { 2594 $user_id = intval($GLOBALS['BE_USER']->user['uid']); 2595 if ($table && $uid) { 2596 $fields_values = array( 2597 'userid' => $user_id, 2598 'tstamp' => $GLOBALS['EXEC_TIME'], 2599 'record_table' => $table, 2600 'record_uid' => $uid, 2601 'username' => $GLOBALS['BE_USER']->user['username'], 2602 'record_pid' => $pid 2603 ); 2604 2605 $GLOBALS['TYPO3_DB']->exec_INSERTquery('sys_lockedrecords', $fields_values); 2606 } else { 2607 $GLOBALS['TYPO3_DB']->exec_DELETEquery('sys_lockedrecords', 'userid='.intval($user_id)); 2608 } 2609 } 2610 2611 /** 2612 * Returns information about whether the record from table, $table, with uid, $uid is currently locked (edited by another user - which should issue a warning). 2613 * Notice: Locking is not strictly carried out since locking is abandoned when other backend scripts are activated - which means that a user CAN have a record "open" without having it locked. So this just serves as a warning that counts well in 90% of the cases, which should be sufficient. 2614 * Usage: 5 2615 * 2616 * @param string Table name 2617 * @param integer Record uid 2618 * @return array 2619 * @internal 2620 * @see class.db_layout.inc, alt_db_navframe.php, alt_doc.php, db_layout.php 2621 */ 2622 function isRecordLocked($table,$uid) { 2623 global $LOCKED_RECORDS; 2624 if (!is_array($LOCKED_RECORDS)) { 2625 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery( 2626 '*', 2627 'sys_lockedrecords', 2628 'sys_lockedrecords.userid!='.intval($GLOBALS['BE_USER']->user['uid']).' 2629 AND sys_lockedrecords.tstamp > '.($GLOBALS['EXEC_TIME']-2*3600) 2630 ); 2631 while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { 2632 $LOCKED_RECORDS[$row['record_table'].':'.$row['record_uid']]=$row; 2633 $LOCKED_RECORDS[$row['record_table'].':'.$row['record_uid']]['msg']=sprintf( 2634 $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.lockedRecord'), 2635 $row['username'], 2636 t3lib_BEfunc::calcAge($GLOBALS['EXEC_TIME']-$row['tstamp'],$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.minutesHoursDaysYears')) 2637 ); 2638 if ($row['record_pid'] && !isset($LOCKED_RECORDS[$row['record_table'].':'.$row['record_pid']])) { 2639 $LOCKED_RECORDS['pages:'.$row['record_pid']]['msg']=sprintf( 2640 $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.lockedRecord_content'), 2641 $row['username'], 2642 t3lib_BEfunc::calcAge($GLOBALS['EXEC_TIME']-$row['tstamp'],$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.minutesHoursDaysYears')) 2643 ); 2644 } 2645 } 2646 } 2647 return $LOCKED_RECORDS[$table.':'.$uid]; 2648 } 2649 2650 /** 2651 * Returns select statement for MM relations (as used by TCEFORMs etc) 2652 * Usage: 3 2653 * 2654 * @param array Configuration array for the field, taken from $TCA 2655 * @param string Field name 2656 * @param array TSconfig array from which to get further configuration settings for the field name 2657 * @param string Prefix string for the key "*foreign_table_where" from $fieldValue array 2658 * @return string Part of query 2659 * @internal 2660 * @see t3lib_transferData::renderRecord(), t3lib_TCEforms::foreignTable() 2661 */ 2662 function exec_foreign_table_where_query($fieldValue,$field='',$TSconfig=array(),$prefix='') { 2663 global $TCA; 2664 $foreign_table = $fieldValue['config'][$prefix.'foreign_table']; 2665 $rootLevel = $TCA[$foreign_table]['ctrl']['rootLevel']; 2666 2667 $fTWHERE = $fieldValue['config'][$prefix.'foreign_table_where']; 2668 if (strstr($fTWHERE,'###REC_FIELD_')) { 2669 $fTWHERE_parts = explode('###REC_FIELD_',$fTWHERE); 2670 while(list($kk,$vv)=each($fTWHERE_parts)) { 2671 if ($kk) { 2672 $fTWHERE_subpart = explode('###',$vv,2); 2673 $fTWHERE_parts[$kk]=$TSconfig['_THIS_ROW'][$fTWHERE_subpart[0]].$fTWHERE_subpart[1]; 2674 } 2675 } 2676 $fTWHERE = implode('',$fTWHERE_parts); 2677 } 2678 2679 $fTWHERE = str_replace('###CURRENT_PID###',intval($TSconfig['_CURRENT_PID']),$fTWHERE); 2680 $fTWHERE = str_replace('###THIS_UID###',intval($TSconfig['_THIS_UID']),$fTWHERE); 2681 $fTWHERE = str_replace('###THIS_CID###',intval($TSconfig['_THIS_CID']),$fTWHERE); 2682 $fTWHERE = str_replace('###STORAGE_PID###',intval($TSconfig['_STORAGE_PID']),$fTWHERE); 2683 $fTWHERE = str_replace('###SITEROOT###',intval($TSconfig['_SITEROOT']),$fTWHERE); 2684 $fTWHERE = str_replace('###PAGE_TSCONFIG_ID###',intval($TSconfig[$field]['PAGE_TSCONFIG_ID']),$fTWHERE); 2685 $fTWHERE = str_replace('###PAGE_TSCONFIG_IDLIST###',$GLOBALS['TYPO3_DB']->cleanIntList($TSconfig[$field]['PAGE_TSCONFIG_IDLIST']),$fTWHERE); 2686 $fTWHERE = str_replace('###PAGE_TSCONFIG_STR###',$GLOBALS['TYPO3_DB']->quoteStr($TSconfig[$field]['PAGE_TSCONFIG_STR'], $foreign_table),$fTWHERE); 2687 2688 // rootLevel = -1 is not handled 'properly' here - it goes as if it was rootLevel = 1 (that is pid=0) 2689 $wgolParts = $GLOBALS['TYPO3_DB']->splitGroupOrderLimit($fTWHERE); 2690 if ($rootLevel) { 2691 $queryParts = array( 2692 'SELECT' => t3lib_BEfunc::getCommonSelectFields($foreign_table,$foreign_table.'.'), 2693 'FROM' => $foreign_table, 2694 'WHERE' => $foreign_table.'.pid=0 '. 2695 t3lib_BEfunc::deleteClause($foreign_table).' '. 2696 $wgolParts['WHERE'], 2697 'GROUPBY' => $wgolParts['GROUPBY'], 2698 'ORDERBY' => $wgolParts['ORDERBY'], 2699 'LIMIT' => $wgolParts['LIMIT'] 2700 ); 2701 } else { 2702 $pageClause = $GLOBALS['BE_USER']->getPagePermsClause(1); 2703 if ($foreign_table!='pages') { 2704 $queryParts = array( 2705 'SELECT' => t3lib_BEfunc::getCommonSelectFields($foreign_table,$foreign_table.'.'), 2706 'FROM' => $foreign_table.',pages', 2707 'WHERE' => 'pages.uid='.$foreign_table.'.pid 2708 AND pages.deleted=0 '. 2709 t3lib_BEfunc::deleteClause($foreign_table). 2710 ' AND '.$pageClause.' '. 2711 $wgolParts['WHERE'], 2712 'GROUPBY' => $wgolParts['GROUPBY'], 2713 'ORDERBY' => $wgolParts['ORDERBY'], 2714 'LIMIT' => $wgolParts['LIMIT'] 2715 ); 2716 } else { 2717 $queryParts = array( 2718 'SELECT' => t3lib_BEfunc::getCommonSelectFields($foreign_table,$foreign_table.'.'), 2719 'FROM' => 'pages', 2720 'WHERE' => 'pages.deleted=0 2721 AND '.$pageClause.' '. 2722 $wgolParts['WHERE'], 2723 'GROUPBY' => $wgolParts['GROUPBY'], 2724 'ORDERBY' => $wgolParts['ORDERBY'], 2725 'LIMIT' => $wgolParts['LIMIT'] 2726 ); 2727 } 2728 } 2729 2730 return $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($queryParts); 2731 } 2732 2733 /** 2734 * Returns TSConfig for the TCEFORM object in Page TSconfig. 2735 * Used in TCEFORMs 2736 * Usage: 4 2737 * 2738 * @param string Table name present in TCA 2739 * @param array Row from table 2740 * @return array 2741 * @see t3lib_transferData::renderRecord(), t3lib_TCEforms::setTSconfig(), SC_wizard_list::main(), SC_wizard_add::main() 2742 */ 2743 function getTCEFORM_TSconfig($table,$row) { 2744 t3lib_BEfunc::fixVersioningPid($table,$row); 2745 2746 $res = array(); 2747 $typeVal = t3lib_BEfunc::getTCAtypeValue($table,$row); 2748 2749 // Get main config for the table 2750 list($TScID,$cPid) = t3lib_BEfunc::getTSCpid($table,$row['uid'],$row['pid']); 2751 2752 $rootLine = t3lib_BEfunc::BEgetRootLine($TScID,'',TRUE); 2753 if ($TScID>=0) { 2754 $tempConf = $GLOBALS['BE_USER']->getTSConfig('TCEFORM.'.$table,t3lib_BEfunc::getPagesTSconfig($TScID,$rootLine)); 2755 if (is_array($tempConf['properties'])) { 2756 while(list($key,$val)=each($tempConf['properties'])) { 2757 if (is_array($val)) { 2758 $fieldN = substr($key,0,-1); 2759 $res[$fieldN] = $val; 2760 unset($res[$fieldN]['types.']); 2761 if (strcmp($typeVal,'') && is_array($val['types.'][$typeVal.'.'])) { 2762 $res[$fieldN] = t3lib_div::array_merge_recursive_overrule($res[$fieldN],$val['types.'][$typeVal.'.']); 2763 } 2764 } 2765 } 2766 } 2767 } 2768 $res['_CURRENT_PID']=$cPid; 2769 $res['_THIS_UID']=$row['uid']; 2770 $res['_THIS_CID']=$row['cid']; 2771 $res['_THIS_ROW']=$row; // So the row will be passed to foreign_table_where_query() 2772 2773 reset($rootLine); 2774 while(list(,$rC)=each($rootLine)) { 2775 if (!$res['_STORAGE_PID']) $res['_STORAGE_PID']=intval($rC['storage_pid']); 2776 if (!$res['_SITEROOT']) $res['_SITEROOT']=$rC['is_siteroot']?intval($rC['uid']):0; 2777 } 2778 2779 return $res; 2780 } 2781 2782 /** 2783 * Find the real PID of the record (with $uid from $table). This MAY be impossible if the pid is set as a reference to the former record or a page (if two records are created at one time). 2784 * NOTICE: Make sure that the input PID is never negativ because the record was an offline version! Therefore, you should always use t3lib_BEfunc::fixVersioningPid($table,$row); on the data you input before calling this function! 2785 * Usage: 2 2786 * 2787 * @param string Table name 2788 * @param integer Record uid 2789 * @param integer Record pid, could be negative then pointing to a record from same table whos pid to find and return. 2790 * @return integer 2791 * @internal 2792 * @see t3lib_TCEmain::copyRecord(), getTSCpid() 2793 */ 2794 function getTSconfig_pidValue($table,$uid,$pid) { 2795 2796 if (t3lib_div::testInt($pid)) { // If pid is an integer this takes precedence in our lookup. 2797 $thePidValue = intval($pid); 2798 if ($thePidValue<0) { // If ref to another record, look that record up. 2799 $pidRec = t3lib_BEfunc::getRecord($table,abs($thePidValue),'pid'); 2800 $thePidValue = is_array($pidRec) ? $pidRec['pid'] : -2; // Returns -2 if the record did not exist. 2801 } 2802 // ... else the pos/zero pid is just returned here. 2803 } else { // No integer pid and we are forced to look up the $pid 2804 $rr = t3lib_BEfunc::getRecord($table,$uid,'pid'); // Try to fetch the record pid from uid. If the uid is 'NEW...' then this will of course return nothing... 2805 if (is_array($rr)) { 2806 $thePidValue = $rr['pid']; // Returning the 'pid' of the record 2807 } else $thePidValue=-1; // Returns -1 if the record with the pid was not found. 2808 } 2809 2810 return $thePidValue; 2811 } 2812 2813 /** 2814 * Return $uid if $table is pages and $uid is integer - otherwise the $pid 2815 * Usage: 1 2816 * 2817 * @param string Table name 2818 * @param integer Record uid 2819 * @param integer Record pid 2820 * @return integer 2821 * @internal 2822 * @see t3lib_TCEforms::getTSCpid() 2823 */ 2824 function getPidForModTSconfig($table,$uid,$pid) { 2825 $retVal = ($table=='pages' && t3lib_div::testInt($uid)) ? $uid : $pid; 2826 return $retVal; 2827 } 2828 2829 /** 2830 * Returns the REAL pid of the record, if possible. If both $uid and $pid is strings, then pid=-1 is returned as an error indication. 2831 * Usage: 8 2832 * 2833 * @param string Table name 2834 * @param integer Record uid 2835 * @param integer Record pid 2836 * @return array Array of two integers; first is the REAL PID of a record and if its a new record negative values are resolved to the true PID, second value is the PID value for TSconfig (uid if table is pages, otherwise the pid) 2837 * @internal 2838 * @see t3lib_TCEmain::setHistory(), t3lib_TCEmain::process_datamap() 2839 */ 2840 function getTSCpid($table,$uid,$pid) { 2841 // If pid is negative (referring to another record) the pid of the other record is fetched and returned. 2842 $cPid = t3lib_BEfunc::getTSconfig_pidValue($table,$uid,$pid); 2843 // $TScID is the id of $table=pages, else it's the pid of the record. 2844 $TScID = t3lib_BEfunc::getPidForModTSconfig($table,$uid,$cPid); 2845 2846 return array($TScID,$cPid); 2847 } 2848 2849 /** 2850 * Returns first found domain record "domainName" (without trailing slash) if found in the input $rootLine 2851 * Usage: 2 2852 * 2853 * @param array Root line array 2854 * @return string Domain name, if found. 2855 */ 2856 function firstDomainRecord($rootLine) { 2857 if (t3lib_extMgm::isLoaded('cms')) { 2858 reset($rootLine); 2859 while(list(,$row)=each($rootLine)) { 2860 $dRec = t3lib_BEfunc::getRecordsByField('sys_domain','pid',$row['uid'],' AND redirectTo=\'\' AND hidden=0', '', 'sorting'); 2861 if (is_array($dRec)) { 2862 reset($dRec); 2863 $dRecord = current($dRec); 2864 return ereg_replace('\/$','',$dRecord['domainName']); 2865 } 2866 } 2867 } 2868 } 2869 2870 /** 2871 * Returns the sys_domain record for $domain, optionally with $path appended. 2872 * Usage: 2 2873 * 2874 * @param string Domain name 2875 * @param string Appended path 2876 * @return array Domain record, if found 2877 */ 2878 function getDomainStartPage($domain, $path='') { 2879 if (t3lib_extMgm::isLoaded('cms')) { 2880 $domain = explode(':',$domain); 2881 $domain = strtolower(ereg_replace('\.$','',$domain[0])); 2882 // path is calculated. 2883 $path = trim(ereg_replace('\/[^\/]*$','',$path)); 2884 // stuff: 2885 $domain.=$path; 2886 2887 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('sys_domain.*', 'pages,sys_domain', ' 2888 pages.uid=sys_domain.pid 2889 AND sys_domain.hidden=0 2890 AND (sys_domain.domainName='.$GLOBALS['TYPO3_DB']->fullQuoteStr($domain, 'sys_domain').' or sys_domain.domainName='.$GLOBALS['TYPO3_DB']->fullQuoteStr($domain.'/', 'sys_domain').')'. 2891 t3lib_BEfunc::deleteClause('pages'), 2892 '', '', '1'); 2893 return $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res); 2894 } 2895 } 2896 2897 /** 2898 * Returns overlayered RTE setup from an array with TSconfig. Used in TCEforms and TCEmain 2899 * Usage: 8 2900 * 2901 * @param array The properties of Page TSconfig in the key "RTE." 2902 * @param string Table name 2903 * @param string Field name 2904 * @param string Type value of the current record (like from CType of tt_content) 2905 * @return array Array with the configuration for the RTE 2906 * @internal 2907 */ 2908 function RTEsetup($RTEprop,$table,$field,$type='') { 2909 $thisConfig = is_array($RTEprop['default.']) ? $RTEprop['default.'] : array(); 2910 $thisFieldConf = $RTEprop['config.'][$table.'.'][$field.'.']; 2911 if (is_array($thisFieldConf)) { 2912 unset($thisFieldConf['types.']); 2913 $thisConfig = t3lib_div::array_merge_recursive_overrule($thisConfig,$thisFieldConf); 2914 } 2915 if ($type && is_array($RTEprop['config.'][$table.'.'][$field.'.']['types.'][$type.'.'])) { 2916 $thisConfig = t3lib_div::array_merge_recursive_overrule($thisConfig,$RTEprop['config.'][$table.'.'][$field.'.']['types.'][$type.'.']); 2917 } 2918 return $thisConfig; 2919 } 2920 2921 /** 2922 * Returns first possible RTE object if available. 2923 * Usage: $RTEobj = &t3lib_BEfunc::RTEgetObj(); 2924 * 2925 * @return mixed If available, returns RTE object, otherwise an array of messages from possible RTEs 2926 */ 2927 function &RTEgetObj() { 2928 2929 // If no RTE object has been set previously, try to create it: 2930 if (!isset($GLOBALS['T3_VAR']['RTEobj'])) { 2931 2932 // Set the object string to blank by default: 2933 $GLOBALS['T3_VAR']['RTEobj'] = array(); 2934 2935 // Traverse registered RTEs: 2936 if (is_array($GLOBALS['TYPO3_CONF_VARS']['BE']['RTE_reg'])) { 2937 foreach($GLOBALS['TYPO3_CONF_VARS']['BE']['RTE_reg'] as $extKey => $rteObjCfg) { 2938 $rteObj = &t3lib_div::getUserObj($rteObjCfg['objRef']); 2939 if (is_object($rteObj)) { 2940 if ($rteObj->isAvailable()) { 2941 $GLOBALS['T3_VAR']['RTEobj'] = &$rteObj; 2942 break; 2943 } else { 2944 $GLOBALS['T3_VAR']['RTEobj'] = array_merge($GLOBALS['T3_VAR']['RTEobj'], $rteObj->errorLog); 2945 } 2946 } 2947 } 2948 } 2949 2950 if (!count($GLOBALS['T3_VAR']['RTEobj'])) { 2951 $GLOBALS['T3_VAR']['RTEobj'][] = 'No RTEs configured at all'; 2952 } 2953 } 2954 2955 // Return RTE object (if any!) 2956 return $GLOBALS['T3_VAR']['RTEobj']; 2957 } 2958 2959 /** 2960 * Returns soft-reference parser for the softRef processing type 2961 * Usage: $softRefObj = &t3lib_BEfunc::softRefParserObj('[parser key]'); 2962 * 2963 * @param string softRef parser key 2964 * @return mixed If available, returns Soft link parser object. 2965 */ 2966 function &softRefParserObj($spKey) { 2967 2968 // If no softRef parser object has been set previously, try to create it: 2969 if (!isset($GLOBALS['T3_VAR']['softRefParser'][$spKey])) { 2970 2971 // Set the object string to blank by default: 2972 $GLOBALS['T3_VAR']['softRefParser'][$spKey] = ''; 2973 2974 // Now, try to create parser object: 2975 $objRef = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['GLOBAL']['softRefParser'][$spKey] ? 2976 $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['GLOBAL']['softRefParser'][$spKey] : 2977 $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['GLOBAL']['softRefParser_GL'][$spKey]; 2978 if ($objRef) { 2979 $softRefParserObj = &t3lib_div::getUserObj($objRef,''); 2980 if (is_object($softRefParserObj)) { 2981 $GLOBALS['T3_VAR']['softRefParser'][$spKey] = &$softRefParserObj; 2982 } 2983 } 2984 } 2985 2986 // Return RTE object (if any!) 2987 return $GLOBALS['T3_VAR']['softRefParser'][$spKey]; 2988 } 2989 2990 /** 2991 * Returns array of soft parser references 2992 * 2993 * @param string softRef parser list 2994 * @param string Table name 2995 * @param string Field name 2996 * @return array Array where the parser key is the key and the value is the parameter string 2997 */ 2998 function explodeSoftRefParserList($parserList) { 2999 3000 // Looking for global parsers: 3001 if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['GLOBAL']['softRefParser_GL'])) { 3002 $parserList = implode(',',array_keys($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['GLOBAL']['softRefParser_GL'])).','.$parserList; 3003 } 3004 3005 // Return immediately if list is blank: 3006 if (!strlen($parserList)) return FALSE; 3007 3008 // Otherwise parse the list: 3009 $keyList = t3lib_div::trimExplode(',', $parserList, 1); 3010 $output = array(); 3011 3012 foreach($keyList as $val) { 3013 $reg = array(); 3014 if (ereg('^([[:alnum:]_-]+)\[(.*)\]$', $val, $reg)) { 3015 $output[$reg[1]] = t3lib_div::trimExplode(';', $reg[2], 1); 3016 } else { 3017 $output[$val] = ''; 3018 } 3019 } 3020 return $output; 3021 } 3022 3023 /** 3024 * Returns true if $modName is set and is found as a main- or submodule in $TBE_MODULES array 3025 * Usage: 1 3026 * 3027 * @param string Module name 3028 * @return boolean 3029 */ 3030 function isModuleSetInTBE_MODULES($modName) { 3031 reset($GLOBALS['TBE_MODULES']); 3032 $loaded=array(); 3033 while(list($mkey,$list)=each($GLOBALS['TBE_MODULES'])) { 3034 $loaded[$mkey]=1; 3035 if (trim($list)) { 3036 $subList = t3lib_div::trimExplode(',',$list,1); 3037 while(list(,$skey)=each($subList)) { 3038 $loaded[$mkey.'_'.$skey]=1; 3039 } 3040 } 3041 } 3042 return $modName && isset($loaded[$modName]); 3043 } 3044 3045 /** 3046 * Counting references to a record/file 3047 * 3048 * @param string Table name (or "_FILE" if its a file) 3049 * @param string Reference: If table, then integer-uid, if _FILE, then file reference (relative to PATH_site) 3050 * @param string Message with %s, eg. "There were %s records pointing to this file!" 3051 * @return string Output string (or integer count value if no msg string specified) 3052 */ 3053 function referenceCount($table,$ref,$msg='') { 3054 3055 if ($table=='_FILE') { 3056 3057 if (t3lib_div::isFirstPartOfStr($ref,PATH_site)) { 3058 $ref = substr($ref,strlen(PATH_site)); 3059 } else return ''; 3060 3061 // Look up the path: 3062 list($res) = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows( 3063 'count(*) as count', 3064 'sys_refindex', 3065 'ref_table='.$GLOBALS['TYPO3_DB']->fullQuoteStr($table,'sys_refindex'). 3066 ' AND ref_string='.$GLOBALS['TYPO3_DB']->fullQuoteStr($ref,'sys_refindex'). 3067 ' AND deleted=0' 3068 ); 3069 3070 } else { 3071 // Look up the path: 3072 list($res) = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows( 3073 'count(*) as count', 3074 'sys_refindex', 3075 'ref_table='.$GLOBALS['TYPO3_DB']->fullQuoteStr($table,'sys_refindex'). 3076 ' AND ref_uid='.intval($ref). 3077 ' AND deleted=0' 3078 ); 3079 } 3080 3081 return $res['count'] ? ($msg ? sprintf($msg,$res['count']) : $res['count']) : ''; 3082 } 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 /******************************************* 3098 * 3099 * Workspaces / Versioning 3100 * 3101 *******************************************/ 3102 3103 /** 3104 * Select all versions of a record, ordered by version id (DESC) 3105 * 3106 * @param string Table name to select from 3107 * @param integer Record uid for which to find versions. 3108 * @param string Field list to select 3109 * @param integer Workspace ID, if zero all versions regardless of workspace is found. 3110 * @return array Array of versions of table/uid 3111 */ 3112 function selectVersionsOfRecord($table, $uid, $fields='*', $workspace=0) { 3113 global $TCA; 3114 3115 if ($TCA[$table] && $TCA[$table]['ctrl']['versioningWS']) { 3116 3117 // Select all versions of record: 3118 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery( 3119 $fields, 3120 $table, 3121 '((t3ver_oid='.intval($uid).($workspace!=0?' AND t3ver_wsid='.intval($workspace):'').') OR uid='.intval($uid).')'. 3122 t3lib_BEfunc::deleteClause($table), 3123 '', 3124 't3ver_id DESC' 3125 ); 3126 3127 // Add rows to output array: 3128 $realPid = 0; 3129 $outputRows = array(); 3130 while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { 3131 if ($uid==$row['uid']) { 3132 $row['_CURRENT_VERSION']=TRUE; 3133 $realPid = $row['pid']; 3134 } 3135 $outputRows[] = $row; 3136 } 3137 3138 // Set real-pid: 3139 foreach($outputRows as $idx => $oRow) { 3140 $outputRows[$idx]['_REAL_PID'] = $realPid; 3141 } 3142 3143 return $outputRows; 3144 } 3145 } 3146 3147 /** 3148 * Find page-tree PID for versionized record 3149 * Will look if the "pid" value of the input record is -1 and if the table supports versioning - if so, it will translate the -1 PID into the PID of the original record 3150 * Used whenever you are tracking something back, like making the root line. 3151 * Will only translate if the workspace of the input record matches that of the current user (unless flag set) 3152 * Principle; Record offline! => Find online? 3153 * 3154 * @param string Table name 3155 * @param array Record array passed by reference. As minimum, "pid" and "uid" fields must exist! "t3ver_oid" and "t3ver_wsid" is nice and will save you a DB query. 3156 * @param boolean Ignore workspace match 3157 * @return void (Passed by ref). If the record had its pid corrected to the online versions pid, then "_ORIG_pid" is set to the original pid value (-1 of course). The field "_ORIG_pid" is used by various other functions to detect if a record was in fact in a versionized branch. 3158 * @see t3lib_page::fixVersioningPid() 3159 */ 3160 function fixVersioningPid($table,&$rr,$ignoreWorkspaceMatch=FALSE) { 3161 global $TCA; 3162 3163 // Check that the input record is an offline version from a table that supports versioning: 3164 if (is_array($rr) && $rr['pid']==-1 && $TCA[$table]['ctrl']['versioningWS']) { 3165 3166 // Check values for t3ver_oid and t3ver_wsid: 3167 if (isset($rr['t3ver_oid']) && isset($rr['t3ver_wsid'])) { // If "t3ver_oid" is already a field, just set this: 3168 $oid = $rr['t3ver_oid']; 3169 $wsid = $rr['t3ver_wsid']; 3170 } else { // Otherwise we have to expect "uid" to be in the record and look up based on this: 3171 $newPidRec = t3lib_BEfunc::getRecord($table,$rr['uid'],'t3ver_oid,t3ver_wsid'); 3172 if (is_array($newPidRec)) { 3173 $oid = $newPidRec['t3ver_oid']; 3174 $wsid = $newPidRec['t3ver_wsid']; 3175 } 3176 } 3177 3178 // If ID of current online version is found, look up the PID value of that: 3179 if ($oid && ($ignoreWorkspaceMatch || !strcmp((int)$wsid,$GLOBALS['BE_USER']->workspace))) { 3180 $oidRec = t3lib_BEfunc::getRecord($table,$oid,'pid'); 3181 if (is_array($oidRec)) { 3182 $rr['_ORIG_pid'] = $rr['pid']; 3183 $rr['pid'] = $oidRec['pid']; 3184 } 3185 } 3186 } 3187 } 3188 3189 /** 3190 * Workspace Preview Overlay 3191 * Generally ALWAYS used when records are selected based on uid or pid. If records are selected on other fields than uid or pid (eg. "email = ....") then usage might produce undesired results and that should be evaluated on individual basis. 3192 * Principle; Record online! => Find offline? 3193 * 3194 * @param string Table name 3195 * @param array Record array passed by reference. As minimum, the "uid", "pid" and "t3ver_swapmode" (pages) fields must exist! Fake fields cannot exist since the fields in the array is used as field names in the SQL look up. 3196 * @param integer Workspace ID, if not specified will use $GLOBALS['BE_USER']->workspace 3197 * @return void (Passed by ref). 3198 * @see fixVersioningPid() 3199 */ 3200 function workspaceOL($table,&$row,$wsid=-99) { 3201 3202 // Initialize workspace ID: 3203 if ($wsid == -99) $wsid = $GLOBALS['BE_USER']->workspace; 3204 3205 // Check if workspace is different from zero and record is set: 3206 if ($wsid!==0 && is_array($row)) { 3207 $wsAlt = t3lib_BEfunc::getWorkspaceVersionOfRecord($wsid, $table, $row['uid'], implode(',',array_keys($row))); 3208 3209 // If version was found, swap the default record with that one. 3210 if (is_array($wsAlt)) { 3211 3212 // Always correct PID from -1 to what it should be: 3213 if (isset($wsAlt['pid'])) { 3214 $wsAlt['_ORIG_pid'] = $wsAlt['pid']; // Keep the old (-1) - indicates it was a version... 3215 $wsAlt['pid'] = $row['pid']; // Set in the online versions PID. 3216 } 3217 3218 // For versions of single elements or page+content, swap UID and PID: 3219 if ($table!=='pages' || $wsAlt['t3ver_swapmode']<=0) { 3220 $wsAlt['_ORIG_uid'] = $wsAlt['uid']; 3221 $wsAlt['uid'] = $row['uid']; 3222 3223 // Backend css class: 3224 $wsAlt['_CSSCLASS'] = $table==='pages' && $wsAlt['t3ver_swapmode']==0 ? 'ver-page' : 'ver-element'; 3225 } else { // This is only for page-versions with BRANCH below! 3226 $wsAlt['_ONLINE_uid'] = $row['uid']; 3227 3228 // Backend css class: 3229 $wsAlt['_CSSCLASS'] = 'ver-branchpoint'; 3230 $wsAlt['_SUBCSSCLASS'] = 'ver-branch'; 3231 } 3232 3233 // Changing input record to the workspace version alternative: 3234 $row = $wsAlt; 3235 } 3236 } 3237 } 3238 3239 /** 3240 * Select the workspace version of a record, if exists 3241 * 3242 * @param integer Workspace ID 3243 * @param string Table name to select from 3244 * @param integer Record uid for which to find workspace version. 3245 * @param string Field list to select 3246 * @return array If found, return record, otherwise false 3247 */ 3248 function getWorkspaceVersionOfRecord($workspace, $table, $uid, $fields='*') { 3249 global $TCA; 3250 3251 if ($workspace!==0 && $TCA[$table] && $TCA[$table]['ctrl']['versioningWS']) { 3252 3253 // Select workspace version of record: 3254 $rows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows( 3255 $fields, 3256 $table, 3257 'pid=-1 AND 3258 t3ver_oid='.intval($uid).' AND 3259 t3ver_wsid='.intval($workspace). 3260 t3lib_BEfunc::deleteClause($table) 3261 ); 3262 3263 if (is_array($rows[0])) return $rows[0]; 3264 } 3265 3266 return FALSE; 3267 } 3268 3269 /** 3270 * Returns live version of record 3271 * 3272 * @param string Table name 3273 * @param integer Record UID of draft, offline version 3274 * @param string Field list, default is * 3275 * @return array If found, the record, otherwise nothing. 3276 */ 3277 function getLiveVersionOfRecord($table,$uid,$fields='*') { 3278 global $TCA; 3279 3280 // Check that table supports versioning: 3281 if ($TCA[$table] && $TCA[$table]['ctrl']['versioningWS']) { 3282 $rec = t3lib_BEfunc::getRecord($table,$uid,'pid,t3ver_oid'); 3283 3284 if ($rec['pid']==-1) { 3285 return t3lib_BEfunc::getRecord($table,$rec['t3ver_oid'],$fields); 3286 } 3287 } 3288 } 3289 3290 /** 3291 * Will fetch the rootline for the pid, then check if anywhere in the rootline there is a branch point and if so everything is allowed of course. 3292 * Alternatively; if the page of the PID itself is a version and swapmode is zero (page+content) then tables from versioning_followPages are allowed as well. 3293 * 3294 * @param integer Page id inside of which you want to edit/create/delete something. 3295 * @param string Table name you are checking for. If you don't give the table name ONLY "branch" types are found and returned true. Specifying table you might also get a positive response if the pid is a "page" versioning type AND the table has "versioning_followPages" set. 3296 * @param boolean If set, the keyword "branchpoint" or "first" is not returned by rather the "t3ver_stage" value of the branch-point. 3297 * @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) 3298 */ 3299 function isPidInVersionizedBranch($pid, $table='',$returnStage=FALSE) { 3300 $rl = t3lib_BEfunc::BEgetRootLine($pid); 3301 $c = 0; 3302 3303 foreach($rl as $rec) { 3304 if ($rec['_ORIG_pid']==-1) { 3305 // In any case: is it a branchpoint, then OK... 3306 if ($rec['t3ver_swapmode']>0) { 3307 return $returnStage ? (int)$rec['t3ver_stage'] : 'branchpoint'; // OK, we are in a versionized branch 3308 } elseif ($c==0 && $rec['t3ver_swapmode']==0 && $table && $GLOBALS['TCA'][$table]['ctrl']['versioning_followPages']) { // First level: So $table must be versioning_followPages 3309 return $returnStage ? (int)$rec['t3ver_stage'] : 'first'; // OK, we are in a versionized branch 3310 } 3311 } 3312 $c++; 3313 } 3314 } 3315 3316 /** 3317 * Will return where clause de-selecting new-versions from other workspaces. 3318 * 3319 * @param string Table name 3320 * @return string Where clause if applicable. 3321 */ 3322 function versioningPlaceholderClause($table) { 3323 if ($GLOBALS['BE_USER']->workspace!==0 && $GLOBALS['TCA'][$table] && $GLOBALS['TCA'][$table]['ctrl']['versioningWS']) { 3324 return ' AND ('.$table.'.t3ver_state!=1 OR '.$table.'.t3ver_wsid='.intval($GLOBALS['BE_USER']->workspace).')'; 3325 } 3326 } 3327 3328 /** 3329 * Count number of versions on a page 3330 * 3331 * @param integer Workspace ID 3332 * @param integer Page ID 3333 * @param boolean If set, then all tables and not only "versioning_followPages" are found (except other pages) 3334 * @return array Overview of records 3335 */ 3336 function countVersionsOfRecordsOnPage($workspace,$pageId, $allTables=FALSE) { 3337 $output = array(); 3338 if ($workspace!=0) { 3339 foreach($GLOBALS['TCA'] as $tableName => $cfg) { 3340 if ($tableName!='pages' && $cfg['ctrl']['versioningWS'] && ($cfg['ctrl']['versioning_followPages'] || $allTables)) { 3341 3342 // Select all records from this table in the database from the workspace 3343 // This joins the online version with the offline version as tables A and B 3344 $output[$tableName] = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows ( 3345 'B.uid as live_uid, A.uid as offline_uid', 3346 $tableName.' A,'.$tableName.' B', 3347 'A.pid=-1'. // Table A is the offline version and pid=-1 defines offline 3348 ' AND B.pid='.intval($pageId). 3349 ' AND A.t3ver_wsid='.intval($workspace). 3350 ' AND A.t3ver_oid=B.uid'. // ... and finally the join between the two tables. 3351 t3lib_BEfunc::deleteClause($tableName,'A'). 3352 t3lib_BEfunc::deleteClause($tableName,'B') 3353 ); 3354 3355 if (!is_array($output[$tableName]) || !count($output[$tableName])) { 3356 unset($output[$tableName]); 3357 } 3358 } 3359 } 3360 } 3361 return $output; 3362 } 3363 3364 /** 3365 * Performs mapping of new uids to new versions UID in case of import inside a workspace. 3366 * 3367 * @param string Table name 3368 * @param integer Record uid (of live record placeholder) 3369 * @return integer Uid of offline version if any, otherwise live uid. 3370 */ 3371 function wsMapId($table,$uid) { 3372 if ($wsRec = t3lib_BEfunc::getWorkspaceVersionOfRecord($GLOBALS['BE_USER']->workspace,$table,$uid,'uid')) { 3373 return $wsRec['uid']; 3374 } else { 3375 return $uid; 3376 } 3377 } 3378 3379 3380 3381 3382 3383 3384 3385 /******************************************* 3386 * 3387 * Miscellaneous 3388 * 3389 *******************************************/ 3390 3391 /** 3392 * Print error message with header, text etc. 3393 * Usage: 19 3394 * 3395 * @param string Header string 3396 * @param string Content string 3397 * @param boolean Will return an alert() with the content of header and text. 3398 * @param boolean Print header. 3399 * @return void 3400 */ 3401 function typo3PrintError($header,$text,$js='',$head=1) { 3402 // This prints out a TYPO3 error message. 3403 // If $js is set the message will be output in JavaScript 3404 if ($js) { 3405 echo "alert('".t3lib_div::slashJS($header.'\n'.$text)."');"; 3406 } else { 3407 echo $head?'<html> 3408 <head> 3409 <title>Error!</title> 3410 </head> 3411 <body bgcolor="white" topmargin="0" leftmargin="0" marginwidth="0" marginheight="0">':''; 3412 echo '<div align="center"> 3413 <table border="0" cellspacing="0" cellpadding="0" width="333"> 3414 <tr> 3415 <td align="center">'. 3416 ($GLOBALS['TBE_STYLES']['logo_login']?'<img src="'.$GLOBALS['BACK_PATH'].$GLOBALS['TBE_STYLES']['logo_login'].'" alt="" />':'<img src="'.$GLOBALS['BACK_PATH'].'gfx/typo3logo.gif" width="123" height="34" vspace="10" />'). 3417 '</td> 3418 </tr> 3419 <tr> 3420 <td bgcolor="black"> 3421 <table width="100%" border="0" cellspacing="1" cellpadding="10"> 3422 <tr> 3423 <td bgcolor="#F4F0E8"> 3424 <font face="verdana,arial,helvetica" size="2">'; 3425 echo '<b><center><font size="+1">'.$header.'</font></center></b><br />'.$text; 3426 echo ' </font> 3427 </td> 3428 </tr> 3429 </table> 3430 </td> 3431 </tr> 3432 </table> 3433 </div>'; 3434 echo $head?' 3435 </body> 3436 </html>':''; 3437 } 3438 } 3439 3440 /** 3441 * Prints TYPO3 Copyright notice for About Modules etc. modules. 3442 * 3443 * @return void 3444 */ 3445 function TYPO3_copyRightNotice() { 3446 global $TYPO3_CONF_VARS; 3447 3448 // COPYRIGHT NOTICE: 3449 $loginCopyrightWarrantyProvider = strip_tags(trim($TYPO3_CONF_VARS['SYS']['loginCopyrightWarrantyProvider'])); 3450 $loginCopyrightWarrantyURL = strip_tags(trim($TYPO3_CONF_VARS['SYS']['loginCopyrightWarrantyURL'])); 3451 3452 if (strlen($loginCopyrightWarrantyProvider)>=2 && strlen($loginCopyrightWarrantyURL)>=10) { 3453 $warrantyNote='Warranty is supplied by '.htmlspecialchars($loginCopyrightWarrantyProvider).'; <a href="'.htmlspecialchars($loginCopyrightWarrantyURL).'" target="_blank">click for details.</a>'; 3454 } else { 3455 $warrantyNote='TYPO3 comes with ABSOLUTELY NO WARRANTY; <a href="http://typo3.com/1316.0.html" target="_blank">click for details.</a>'; 3456 } 3457 $cNotice = '<a href="http://typo3.com/" target="_blank"><img src="gfx/loginlogo_transp.gif" width="75" vspace="2" hspace="4" height="19" alt="TYPO3 logo" align="left" />TYPO3 CMS ver. '.htmlspecialchars(TYPO3_version).'</a>. Copyright © '.htmlspecialchars(TYPO3_copyright_year).' Kasper Skårhøj. Extensions are copyright of their respective owners. Go to <a href="http://typo3.com/" target="_blank">http://typo3.com/</a> for details. 3458 '.strip_tags($warrantyNote,'<a>').' This is free software, and you are welcome to redistribute it under certain conditions; <a href="http://typo3.com/1316.0.html" target="_blank">click for details</a>. Obstructing the appearance of this notice is prohibited by law.'; 3459 3460 return $cNotice; 3461 } 3462 3463 /** 3464 * Display some warning messages if this installation is obviously insecure!! 3465 * These warnings are only displayed to admin users 3466 * 3467 * @return void 3468 */ 3469 function displayWarningMessages() { 3470 if($GLOBALS['BE_USER']->isAdmin()) { 3471 $warnings = array(); 3472 3473 // Check if the Install Tool Password is still default: joh316 3474 if($GLOBALS['TYPO3_CONF_VARS']['BE']['installToolPassword']==md5('joh316')) { 3475 $warnings[] = 'The password of your Install Tool is still using the default value "joh316"'; 3476 } 3477 3478 // Check if there is still a default user 'admin' with password 'password' (MD5sum = 5f4dcc3b5aa765d61d8327deb882cf99) 3479 $where_clause = 'username='.$GLOBALS['TYPO3_DB']->fullQuoteStr('admin','be_users').' AND password='.$GLOBALS['TYPO3_DB']->fullQuoteStr('5f4dcc3b5aa765d61d8327deb882cf99','be_users').t3lib_BEfunc::deleteClause('be_users'); 3480 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('username, password', 'be_users', $where_clause); 3481 if ($GLOBALS['TYPO3_DB']->sql_num_rows($res)) { 3482 $warnings[] = 'The backend user "admin" with password "password" is still existing'; 3483 } 3484 3485 // Check if the encryption key is empty 3486 if ($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'] == '') { 3487 $url = 'install/index.php?redirect_url=index.php'.urlencode('?TYPO3_INSTALL[type]=config#set_encryptionKey'); 3488 $warnings[] = 'The encryption key is not set! Set it in <a href="'.$url.'">$TYPO3_CONF_VARS[SYS][encryptionKey]</a>'; 3489 } 3490 3491 // check if there are still updates to perform 3492 if (!t3lib_div::compat_version(TYPO3_version)) { 3493 $url = 'install/index.php?redirect_url=index.php'.urlencode('?TYPO3_INSTALL[type]=update'); 3494 $warnings[] = 'This installation is not configured for the TYPO3 version it is running. Please visit the <a href="'.$url.'" target="_blank">Update Wizard</a> in the Install Tool.'; 3495 } 3496 3497 // check if sys_refindex is empty 3498 if (is_object($GLOBALS['TYPO3_DB'])) { 3499 list($count) = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('count(*) as rcount','sys_refindex','1=1'); 3500 if (!$count['rcount']) { 3501 $warnings[] = 'The Reference Index table is empty which is likely to be the case because you just upgraded your TYPO3 source. Please go to Tools>DB Check and update the reference index.'; 3502 } 3503 } 3504 3505 if(count($warnings)) { 3506 $content = '<table border="0" cellpadding="0" cellspacing="0" class="warningbox"><tr><td>'. 3507 $GLOBALS['TBE_TEMPLATE']->icons(3).'Important notice!<br />'. 3508 '- '.implode('<br />- ', $warnings).'<br /><br />'. 3509 'It is highly recommended that you change this immediately.'. 3510 '</td></tr></table>'; 3511 3512 unset($warnings); 3513 return $content; 3514 } 3515 } 3516 return '<p> </p>'; 3517 } 3518 3519 /** 3520 * Returns "web" if the $path (absolute) is within the DOCUMENT ROOT - and thereby qualifies as a "web" folder. 3521 * Usage: 4 3522 * 3523 * @param string Path to evaluate 3524 * @return boolean 3525 */ 3526 function getPathType_web_nonweb($path) { 3527 return t3lib_div::isFirstPartOfStr($path,t3lib_div::getIndpEnv('TYPO3_DOCUMENT_ROOT')) ? 'web' : ''; 3528 } 3529 3530 /** 3531 * Creates ADMCMD parameters for the "viewpage" extension / "cms" frontend 3532 * Usage: 1 3533 * 3534 * @param array Page record 3535 * @return string Query-parameters 3536 * @internal 3537 */ 3538 function ADMCMD_previewCmds($pageinfo) { 3539 if ($pageinfo['fe_group']>0) { 3540 $simUser = '&ADMCMD_simUser='.$pageinfo['fe_group']; 3541 } 3542 if ($pageinfo['starttime']>time()) { 3543 $simTime = '&ADMCMD_simTime='.$pageinfo['starttime']; 3544 } 3545 if ($pageinfo['endtime']<time() && $pageinfo['endtime']!=0) { 3546 $simTime = '&ADMCMD_simTime='.($pageinfo['endtime']-1); 3547 } 3548 return $simUser.$simTime; 3549 } 3550 3551 /** 3552 * Returns an array with key=>values based on input text $params 3553 * $params is exploded by line-breaks and each line is supposed to be on the syntax [key] = [some value] 3554 * These pairs will be parsed into an array an returned. 3555 * Usage: 1 3556 * 3557 * @param string String of parameters on multiple lines to parse into key-value pairs (see function description) 3558 * @return array 3559 */ 3560 function processParams($params) { 3561 $paramArr=array(); 3562 $lines=explode(chr(10),$params); 3563 while(list(,$val)=each($lines)) { 3564 $val = trim($val); 3565 if ($val) { 3566 $pair = explode('=',$val,2); 3567 $paramArr[trim($pair[0])] = trim($pair[1]); 3568 } 3569 } 3570 return $paramArr; 3571 } 3572 3573 /** 3574 * Returns "list of backend modules". Most likely this will be obsolete soon / removed. Don't use. 3575 * Usage: 3 3576 * 3577 * @param array Module names in array. Must be "addslashes()"ed 3578 * @param string Perms clause for SQL query 3579 * @param string Backpath 3580 * @param string The URL/script to jump to (used in A tag) 3581 * @return array Two keys, rows and list 3582 * @internal 3583 * @deprecated 3584 * @obsolete 3585 */ 3586 function getListOfBackendModules($name,$perms_clause,$backPath='',$script='index.php') { 3587 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'pages', 'doktype!=255 AND module IN (\''.implode('\',\'',$name).'\') AND'.$perms_clause.t3lib_BEfunc::deleteClause('pages')); 3588 if (!$GLOBALS['TYPO3_DB']->sql_num_rows($res)) return false; 3589 3590 $out=''; 3591 $theRows=array(); 3592 while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { 3593 $theRows[]=$row; 3594 $out.='<span class="nobr"><a href="'.htmlspecialchars($script.'?id='.$row['uid']).'">'. 3595 t3lib_iconWorks::getIconImage('pages',$row,$backPath,'title="'.htmlspecialchars(t3lib_BEfunc::getRecordPath($row['uid'],$perms_clause,20)).'" align="top"'). 3596 htmlspecialchars($row['title']). 3597 '</a></span><br />'; 3598 } 3599 return array('rows'=>$theRows,'list'=>$out); 3600 } 3601 } 3602 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| [ Powered by PHPXref - Served by Debian GNU/Linux ] |