Fixed bug #13662: rsaauth does not work with special characters (like ä ü ö § ) in...
[Packages/TYPO3.CMS.git] / typo3 / class.browse_links.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 1999-2010 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 * Displays the page/file tree for browsing database records or files.
29 * Used from TCEFORMS an other elements
30 * In other words: This is the ELEMENT BROWSER!
31 *
32 * $Id$
33 * Revised for TYPO3 3.6 November/2003 by Kasper Skaarhoj
34 * XHTML compliant
35 *
36 * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
37 */
38 /**
39 * [CLASS/FUNCTION INDEX of SCRIPT]
40 *
41 *
42 *
43 * 155: class TBE_browser_recordList extends localRecordList
44 * 163: function TBE_browser_recordList ()
45 * 175: function listURL($altId='',$table=-1,$exclList='')
46 * 194: function ext_addP()
47 * 211: function linkWrapItems($table,$uid,$code,$row)
48 * 244: function linkWrapTable($table,$code)
49 *
50 *
51 * 261: class localPageTree extends t3lib_browseTree
52 * 268: function localPageTree()
53 * 284: function wrapTitle($title,$v,$ext_pArrPages='')
54 * 299: function printTree($treeArr='')
55 * 350: function ext_isLinkable($doktype,$uid)
56 * 364: function PM_ATagWrap($icon,$cmd,$bMark='')
57 * 381: function wrapIcon($icon,$row)
58 *
59 *
60 * 400: class rtePageTree extends localPageTree
61 *
62 *
63 * 417: class TBE_PageTree extends localPageTree
64 * 426: function ext_isLinkable($doktype,$uid)
65 * 438: function wrapTitle($title,$v,$ext_pArrPages)
66 *
67 *
68 * 464: class localFolderTree extends t3lib_folderTree
69 * 473: function localFolderTree()
70 * 485: function wrapTitle($title,$v)
71 * 500: function ext_isLinkable($v)
72 * 517: function PM_ATagWrap($icon,$cmd,$bMark='')
73 * 532: function printTree($treeArr='')
74 *
75 *
76 * 599: class rteFolderTree extends localFolderTree
77 *
78 *
79 * 615: class TBE_FolderTree extends localFolderTree
80 * 624: function ext_isLinkable($v)
81 * 637: function wrapTitle($title,$v)
82 *
83 *
84 * 658: class browse_links
85 * 764: function init()
86 * 1034: function processSessionData($data)
87 *
88 * SECTION: Main functions
89 * 1077: function main_rte($wiz=0)
90 * 1379: function main_db()
91 * 1424: function main_file()
92 *
93 * SECTION: Record listing
94 * 1534: function expandPage()
95 * 1615: function TBE_expandPage($tables)
96 *
97 * SECTION: File listing
98 * 1708: function expandFolder($expandFolder=0,$extensionList='')
99 * 1778: function TBE_expandFolder($expandFolder=0,$extensionList='',$noThumbs=0)
100 * 1801: function fileList($files, $folderName='', $noThumbs=0)
101 * 1918: function TBE_dragNDrop($expandFolder=0,$extensionList='')
102 *
103 * SECTION: Miscellaneous functions
104 * 2046: function isWebFolder($folder)
105 * 2057: function checkFolder($folder)
106 * 2070: function barheader($str)
107 * 2087: function getMsgBox($in_msg,$icon='icon_note')
108 * 2111: function printCurrentUrl($str)
109 * 2131: function parseCurUrl($href,$siteUrl)
110 * 2193: function uploadForm($path)
111 * 2247: function createFolder($path)
112 *
113 * TOTAL FUNCTIONS: 39
114 * (This index is automatically created/updated by the extension "extdeveval")
115 *
116 */
117
118
119 // Include classes
120 require_once (PATH_typo3.'/class.db_list.inc');
121 require_once (PATH_typo3.'/class.db_list_extra.inc');
122
123
124
125
126 /**
127 * Local version of the record list.
128 *
129 * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
130 * @package TYPO3
131 * @subpackage core
132 */
133 class TBE_browser_recordList extends localRecordList {
134 var $thisScript = 'browse_links.php';
135
136 /**
137 * Initializes the script path
138 *
139 * @return void
140 */
141 function TBE_browser_recordList () {
142 parent::__construct();
143 $this->thisScript = t3lib_div::getIndpEnv('SCRIPT_NAME');
144 }
145
146 /**
147 * Creates the URL for links
148 *
149 * @param mixed If not blank string, this is used instead of $this->id as the id value.
150 * @param string If this is "-1" then $this->table is used, otherwise the value of the input variable.
151 * @param string Commalist of fields NOT to pass as parameters (currently "sortField" and "sortRev")
152 * @return string Query-string for URL
153 */
154 function listURL($altId='',$table=-1,$exclList='') {
155 return $this->thisScript.
156 '?id='.(strcmp($altId,'')?$altId:$this->id).
157 '&table='.rawurlencode($table==-1?$this->table:$table).
158 ($this->thumbs?'&imagemode='.$this->thumbs:'').
159 ($this->searchString?'&search_field='.rawurlencode($this->searchString):'').
160 ($this->searchLevels?'&search_levels='.rawurlencode($this->searchLevels):'').
161 ((!$exclList || !t3lib_div::inList($exclList,'sortField')) && $this->sortField?'&sortField='.rawurlencode($this->sortField):'').
162 ((!$exclList || !t3lib_div::inList($exclList,'sortRev')) && $this->sortRev?'&sortRev='.rawurlencode($this->sortRev):'').
163 // extra:
164 $this->ext_addP()
165 ;
166 }
167
168 /**
169 * Returns additional, local GET parameters to include in the links of the record list.
170 *
171 * @return string
172 */
173 function ext_addP() {
174 $str = '&act='.$GLOBALS['SOBE']->browser->act.
175 '&mode='.$GLOBALS['SOBE']->browser->mode.
176 '&expandPage='.$GLOBALS['SOBE']->browser->expandPage.
177 '&bparams='.rawurlencode($GLOBALS['SOBE']->browser->bparams);
178 return $str;
179 }
180
181 /**
182 * Returns the title (based on $code) of a record (from table $table) with the proper link around (that is for "pages"-records a link to the level of that record...)
183 *
184 * @param string Table name
185 * @param integer UID (not used here)
186 * @param string Title string
187 * @param array Records array (from table name)
188 * @return string
189 */
190 function linkWrapItems($table,$uid,$code,$row) {
191 global $TCA, $BACK_PATH;
192
193 if (!$code) {
194 $code = '<i>['.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.no_title',1).']</i>';
195 } else {
196 $code = t3lib_BEfunc::getRecordTitlePrep($code, $this->fixedL);
197 }
198
199 $title = t3lib_BEfunc::getRecordTitle($table,$row,FALSE,TRUE);
200 $ficon = t3lib_iconWorks::getIcon($table,$row);
201 $aOnClick = "return insertElement('".$table."', '".$row['uid']."', 'db', ".t3lib_div::quoteJSvalue($title).", '', '', '".$ficon."');";
202 $ATag = '<a href="#" onclick="'.$aOnClick.'">';
203 $ATag_alt = substr($ATag,0,-4).',\'\',1);">';
204 $ATag_e = '</a>';
205
206 return $ATag.
207 '<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/plusbullet2.gif','width="18" height="16"').' title="'.$GLOBALS['LANG']->getLL('addToList',1).'" alt="" />'.
208 $ATag_e.
209 $ATag_alt.
210 $code.
211 $ATag_e;
212 }
213
214 /**
215 * Local version that sets allFields to true to support userFieldSelect
216 *
217 * @return void
218 * @see fieldSelectBox
219 */
220 function generateList() {
221 $this->allFields = true;
222 parent::generateList();
223 }
224 }
225
226
227
228
229
230
231 /**
232 * Class which generates the page tree
233 *
234 * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
235 * @package TYPO3
236 * @subpackage core
237 */
238 class localPageTree extends t3lib_browseTree {
239
240 /**
241 * whether the page ID should be shown next to the title, activate through userTSconfig (options.pageTree.showPageIdWithTitle)
242 * @boolean
243 */
244 public $ext_showPageId = FALSE;
245
246 /**
247 * Constructor. Just calling init()
248 *
249 * @return void
250 */
251 function localPageTree() {
252 $this->thisScript = t3lib_div::getIndpEnv('SCRIPT_NAME');
253
254 $this->init();
255
256 $this->clause = ' AND doktype!=255'.$this->clause;
257 }
258
259 /**
260 * Wrapping the title in a link, if applicable.
261 *
262 * @param string Title, (must be ready for output, that means it must be htmlspecialchars()'ed).
263 * @param array The record
264 * @param boolean (Ignore)
265 * @return string Wrapping title string.
266 */
267 function wrapTitle($title,$v,$ext_pArrPages='') {
268 if ($this->ext_isLinkable($v['doktype'],$v['uid'])) {
269 $aOnClick = "return link_typo3Page('".$v['uid']."');";
270 return '<a href="#" onclick="'.htmlspecialchars($aOnClick).'">'.$title.'</a>';
271 } else {
272 return '<span style="color: #666666;">'.$title.'</span>';
273 }
274 }
275
276 /**
277 * Create the page navigation tree in HTML
278 *
279 * @param array Tree array
280 * @return string HTML output.
281 */
282 function printTree($treeArr='') {
283 global $BACK_PATH;
284 $titleLen=intval($GLOBALS['BE_USER']->uc['titleLen']);
285 if (!is_array($treeArr)) $treeArr=$this->tree;
286
287 $out='';
288 $c=0;
289
290 foreach($treeArr as $k => $v) {
291 $c++;
292 $bgColorClass = ($c+1)%2 ? 'bgColor' : 'bgColor-10';
293 if ($GLOBALS['SOBE']->browser->curUrlInfo['act']=='page' && $GLOBALS['SOBE']->browser->curUrlInfo['pageid']==$v['row']['uid'] && $GLOBALS['SOBE']->browser->curUrlInfo['pageid']) {
294 $arrCol='<td><img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/blinkarrow_right.gif','width="5" height="9"').' class="c-blinkArrowR" alt="" /></td>';
295 $bgColorClass='bgColor4';
296 } else {
297 $arrCol='<td></td>';
298 }
299
300 $aOnClick = 'return jumpToUrl(\''.$this->thisScript.'?act='.$GLOBALS['SOBE']->browser->act.'&mode='.$GLOBALS['SOBE']->browser->mode.'&expandPage='.$v['row']['uid'].'\');';
301 $cEbullet = $this->ext_isLinkable($v['row']['doktype'],$v['row']['uid']) ?
302 '<a href="#" onclick="'.htmlspecialchars($aOnClick).'"><img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/ol/arrowbullet.gif','width="18" height="16"').' alt="" /></a>' :
303 '';
304 $out.='
305 <tr class="'.$bgColorClass.'">
306 <td nowrap="nowrap"'.($v['row']['_CSSCLASS'] ? ' class="'.$v['row']['_CSSCLASS'].'"' : '').'>'.
307 $v['HTML'].
308 $this->wrapTitle($this->getTitleStr($v['row'],$titleLen),$v['row'],$this->ext_pArrPages).
309 '</td>'.
310 $arrCol.
311 '<td>'.$cEbullet.'</td>
312 </tr>';
313 }
314 $out='
315
316
317 <!--
318 Navigation Page Tree:
319 -->
320 <table border="0" cellpadding="0" cellspacing="0" id="typo3-tree">
321 '.$out.'
322 </table>';
323 return $out;
324 }
325
326 /**
327 * Returns true if a doktype can be linked.
328 *
329 * @param integer Doktype value to test
330 * @param integer uid to test.
331 * @return boolean
332 */
333 function ext_isLinkable($doktype,$uid) {
334 if ($uid && $doktype<199) {
335 return true;
336 }
337 }
338
339 /**
340 * Wrap the plus/minus icon in a link
341 *
342 * @param string HTML string to wrap, probably an image tag.
343 * @param string Command for 'PM' get var
344 * @param boolean If set, the link will have a anchor point (=$bMark) and a name attribute (=$bMark)
345 * @return string Link-wrapped input string
346 */
347 function PM_ATagWrap($icon,$cmd,$bMark='') {
348 if ($bMark) {
349 $anchor = '#'.$bMark;
350 $name=' name="'.$bMark.'"';
351 }
352 $aOnClick = "return jumpToUrl('".$this->thisScript.'?PM='.$cmd."','".$anchor."');";
353
354 return '<a href="#"'.$name.' onclick="'.htmlspecialchars($aOnClick).'">'.$icon.'</a>';
355 }
356
357 /**
358 * Wrapping the image tag, $icon, for the row, $row
359 *
360 * @param string The image tag for the icon
361 * @param array The row for the current element
362 * @return string The processed icon input value.
363 */
364 function wrapIcon($icon, $row) {
365 $content = $this->addTagAttributes($icon, ' title="id=' . $row['uid'] . '"');
366 if ($this->ext_showPageId) {
367 $content .= '[' . $row['uid'] . ']&nbsp;';
368 }
369 return $content;
370 }
371 }
372
373
374
375
376
377
378
379
380 /**
381 * Page tree for the RTE - totally the same, no changes needed. (Just for the sake of beauty - or confusion... :-)
382 *
383 * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
384 * @package TYPO3
385 * @subpackage core
386 */
387 class rtePageTree extends localPageTree {
388 }
389
390
391
392
393
394
395
396
397 /**
398 * For TBE record browser
399 *
400 * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
401 * @package TYPO3
402 * @subpackage core
403 */
404 class TBE_PageTree extends localPageTree {
405
406 /**
407 * Returns true if a doktype can be linked (which is always the case here).
408 *
409 * @param integer Doktype value to test
410 * @param integer uid to test.
411 * @return boolean
412 */
413 function ext_isLinkable($doktype,$uid) {
414 return true;
415 }
416
417 /**
418 * Wrapping the title in a link, if applicable.
419 *
420 * @param string Title, ready for output.
421 * @param array The record
422 * @param boolean If set, pages clicked will return immediately, otherwise reload page.
423 * @return string Wrapping title string.
424 */
425 function wrapTitle($title,$v,$ext_pArrPages) {
426 if ($ext_pArrPages) {
427 $ficon=t3lib_iconWorks::getIcon('pages',$v);
428 $onClick = "return insertElement('pages', '".$v['uid']."', 'db', ".t3lib_div::quoteJSvalue($v['title']).", '', '', '".$ficon."','',1);";
429 } else {
430 $onClick = htmlspecialchars('return jumpToUrl(\''.$this->thisScript.'?act='.$GLOBALS['SOBE']->browser->act.'&mode='.$GLOBALS['SOBE']->browser->mode.'&expandPage='.$v['uid'].'\');');
431 }
432 return '<a href="#" onclick="'.$onClick.'">'.$title.'</a>';
433 }
434 }
435
436
437
438
439
440
441
442
443 /**
444 * Base extension class which generates the folder tree.
445 * Used directly by the RTE.
446 *
447 * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
448 * @package TYPO3
449 * @subpackage core
450 */
451 class localFolderTree extends t3lib_folderTree {
452 var $ext_IconMode=1;
453
454
455 /**
456 * Initializes the script path
457 *
458 * @return void
459 */
460 function localFolderTree() {
461 $this->thisScript = t3lib_div::getIndpEnv('SCRIPT_NAME');
462 $this->t3lib_folderTree();
463 }
464
465 /**
466 * Wrapping the title in a link, if applicable.
467 *
468 * @param string Title, ready for output.
469 * @param array The "record"
470 * @return string Wrapping title string.
471 */
472 function wrapTitle($title,$v) {
473 if ($this->ext_isLinkable($v)) {
474 $aOnClick = 'return jumpToUrl(\''.$this->thisScript.'?act='.$GLOBALS['SOBE']->browser->act.'&mode='.$GLOBALS['SOBE']->browser->mode.'&expandFolder='.rawurlencode($v['path']).'\');';
475 return '<a href="#" onclick="'.htmlspecialchars($aOnClick).'">'.$title.'</a>';
476 } else {
477 return '<span class="typo3-dimmed">'.$title.'</span>';
478 }
479 }
480
481 /**
482 * Returns true if the input "record" contains a folder which can be linked.
483 *
484 * @param array Array with information about the folder element. Contains keys like title, uid, path, _title
485 * @return boolean True is returned if the path is found in the web-part of the server and is NOT a recycler or temp folder
486 */
487 function ext_isLinkable($v) {
488 $webpath=t3lib_BEfunc::getPathType_web_nonweb($v['path']); // Checking, if the input path is a web-path.
489 if (strstr($v['path'],'_recycler_') || strstr($v['path'],'_temp_') || $webpath!='web') {
490 return 0;
491 }
492 return 1;
493 }
494
495 /**
496 * Wrap the plus/minus icon in a link
497 *
498 * @param string HTML string to wrap, probably an image tag.
499 * @param string Command for 'PM' get var
500 * @param boolean If set, the link will have a anchor point (=$bMark) and a name attribute (=$bMark)
501 * @return string Link-wrapped input string
502 * @access private
503 */
504 function PM_ATagWrap($icon,$cmd,$bMark='') {
505 if ($bMark) {
506 $anchor = '#'.$bMark;
507 $name=' name="'.$bMark.'"';
508 }
509 $aOnClick = 'return jumpToUrl(\''.$this->thisScript.'?PM='.$cmd.'\',\''.$anchor.'\');';
510 return '<a href="#"'.$name.' onclick="'.htmlspecialchars($aOnClick).'">'.$icon.'</a>';
511 }
512
513 /**
514 * Create the folder navigation tree in HTML
515 *
516 * @param mixed Input tree array. If not array, then $this->tree is used.
517 * @return string HTML output of the tree.
518 */
519 function printTree($treeArr='') {
520 global $BACK_PATH;
521 $titleLen=intval($GLOBALS['BE_USER']->uc['titleLen']);
522
523 if (!is_array($treeArr)) $treeArr=$this->tree;
524
525 $out='';
526 $c=0;
527
528 // Preparing the current-path string (if found in the listing we will see a red blinking arrow).
529 if (!$GLOBALS['SOBE']->browser->curUrlInfo['value']) {
530 $cmpPath='';
531 } else if (substr(trim($GLOBALS['SOBE']->browser->curUrlInfo['info']),-1)!='/') {
532 $cmpPath=PATH_site.dirname($GLOBALS['SOBE']->browser->curUrlInfo['info']).'/';
533 } else {
534 $cmpPath=PATH_site.$GLOBALS['SOBE']->browser->curUrlInfo['info'];
535 }
536
537 // Traverse rows for the tree and print them into table rows:
538 foreach($treeArr as $k => $v) {
539 $c++;
540 $bgColorClass=($c+1)%2 ? 'bgColor' : 'bgColor-10';
541
542 // Creating blinking arrow, if applicable:
543 if (($GLOBALS['SOBE']->browser->curUrlInfo['act'] == 'file' || $GLOBALS['SOBE']->browser->curUrlInfo['act'] == 'folder') && $cmpPath == $v['row']['path']) {
544 $arrCol='<td><img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/blinkarrow_right.gif','width="5" height="9"').' class="c-blinkArrowR" alt="" /></td>';
545 $bgColorClass='bgColor4';
546 } else {
547 $arrCol='<td></td>';
548 }
549 // Create arrow-bullet for file listing (if folder path is linkable):
550 $aOnClick = 'return jumpToUrl(\''.$this->thisScript.'?act='.$GLOBALS['SOBE']->browser->act.'&mode='.$GLOBALS['SOBE']->browser->mode.'&expandFolder='.rawurlencode($v['row']['path']).'\');';
551 $cEbullet = $this->ext_isLinkable($v['row']) ? '<a href="#" onclick="'.htmlspecialchars($aOnClick).'"><img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/ol/arrowbullet.gif','width="18" height="16"').' alt="" /></a>' : '';
552
553 // Put table row with folder together:
554 $out.='
555 <tr class="'.$bgColorClass.'">
556 <td nowrap="nowrap">' . $v['HTML'] . $this->wrapTitle(htmlspecialchars(t3lib_div::fixed_lgd_cs($v['row']['title'], $titleLen)), $v['row']) . '</td>
557 '.$arrCol.'
558 <td>'.$cEbullet.'</td>
559 </tr>';
560 }
561
562 $out='
563
564 <!--
565 Folder tree:
566 -->
567 <table border="0" cellpadding="0" cellspacing="0" id="typo3-tree">
568 '.$out.'
569 </table>';
570 return $out;
571 }
572 }
573
574
575
576
577
578
579 /**
580 * Folder tree for the RTE - totally the same, no changes needed. (Just for the sake of beauty - or confusion... :-)
581 *
582 * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
583 * @package TYPO3
584 * @subpackage core
585 */
586 class rteFolderTree extends localFolderTree {
587 }
588
589
590
591
592
593
594
595 /**
596 * For TBE File Browser
597 *
598 * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
599 * @package TYPO3
600 * @subpackage core
601 */
602 class TBE_FolderTree extends localFolderTree {
603 var $ext_noTempRecyclerDirs=0; // If file-drag mode is set, temp and recycler folders are filtered out.
604
605 /**
606 * Returns true if the input "record" contains a folder which can be linked.
607 *
608 * @param array Array with information about the folder element. Contains keys like title, uid, path, _title
609 * @return boolean True is returned if the path is NOT a recycler or temp folder AND if ->ext_noTempRecyclerDirs is not set.
610 */
611 function ext_isLinkable($v) {
612 if ($this->ext_noTempRecyclerDirs && (substr($v['path'],-7)=='_temp_/' || substr($v['path'],-11)=='_recycler_/')) {
613 return 0;
614 } return 1;
615 }
616
617 /**
618 * Wrapping the title in a link, if applicable.
619 *
620 * @param string Title, ready for output.
621 * @param array The 'record'
622 * @return string Wrapping title string.
623 */
624 function wrapTitle($title,$v) {
625 if ($this->ext_isLinkable($v)) {
626 $aOnClick = 'return jumpToUrl(\''.$this->thisScript.'?act='.$GLOBALS['SOBE']->browser->act.'&mode='.$GLOBALS['SOBE']->browser->mode.'&expandFolder='.rawurlencode($v['path']).'\');';
627 return '<a href="#" onclick="'.htmlspecialchars($aOnClick).'">'.$title.'</a>';
628 } else {
629 return '<span class="typo3-dimmed">'.$title.'</span>';
630 }
631 }
632 }
633
634
635
636
637
638 /**
639 * class for the Element Browser window.
640 *
641 * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
642 * @package TYPO3
643 * @subpackage core
644 */
645 class browse_links {
646
647 // Internal, static:
648 var $siteURL; // Current site URL (Frontend)
649 var $thisScript; // the script to link to
650 var $thisConfig; // RTE specific TSconfig
651 var $setTarget; // Target (RTE specific)
652 var $setClass; // CSS Class (RTE specific)
653 var $setTitle; // title (RTE specific)
654 var $doc; // Backend template object
655 var $elements = array(); // Holds information about files
656
657 // GPvars: (Input variables from outside)
658 /**
659 * The mode determines the main kind of output from the element browser.
660 * There are these options for values: rte, db, file, filedrag, wizard.
661 * "rte" will show the link selector for the Rich Text Editor (see main_rte())
662 * "db" will allow you to browse for pages or records in the page tree (for TCEforms, see main_db())
663 * "file"/"filedrag" will allow you to browse for files or folders in the folder mounts (for TCEforms, main_file())
664 * "wizard" will allow you to browse for links (like "rte") which are passed back to TCEforms (see main_rte(1))
665 *
666 * @see main()
667 */
668 var $mode;
669
670 /**
671 * Link selector action.
672 * page,file,url,mail,spec are allowed values.
673 * These are only important with the link selector function and in that case they switch between the various menu options.
674 */
675 var $act;
676
677 /**
678 * When you click a page title/expand icon to see the content of a certain page, this value will contain that value (the ID of the expanded page). If the value is NOT set, then it will be restored from the module session data (see main(), mode="db")
679 */
680 var $expandPage;
681
682 /**
683 * When you click a folder name/expand icon to see the content of a certain file folder, this value will contain that value (the path of the expanded file folder). If the value is NOT set, then it will be restored from the module session data (see main(), mode="file"/"filedrag"). Example value: "/www/htdocs/typo3/32/3dsplm/fileadmin/css/"
684 */
685 var $expandFolder;
686
687
688
689 /**
690 * TYPO3 Element Browser, wizard mode parameters. There is a heap of parameters there, better debug() them out if you need something... :-)
691 */
692 var $P;
693
694 /**
695 * Active with TYPO3 Element Browser: Contains the name of the form field for which this window opens - thus allows us to make references back to the main window in which the form is.
696 * Example value: "data[pages][39][bodytext]|||tt_content|" or "data[tt_content][NEW3fba56fde763d][image]|||gif,jpg,jpeg,tif,bmp,pcx,tga,png,pdf,ai|"
697 *
698 * Values:
699 * 0: form field name reference, eg. "data[tt_content][123][image]"
700 * 1: htlmArea RTE parameters: editorNo:contentTypo3Language:contentTypo3Charset
701 * 2: RTE config parameters: RTEtsConfigParams
702 * 3: allowed types. Eg. "tt_content" or "gif,jpg,jpeg,tif,bmp,pcx,tga,png,pdf,ai"
703 * 4: IRRE uniqueness: target level object-id to perform actions/checks on, eg. "data[79][tt_address][1][<field>][<foreign_table>]"
704 * 5: IRRE uniqueness: name of function in opener window that checks if element is already used, eg. "inline.checkUniqueElement"
705 * 6: IRRE uniqueness: name of function in opener window that performs some additional(!) action, eg. "inline.setUniqueElement"
706 * 7: IRRE uniqueness: name of function in opener window that performs action instead of using addElement/insertElement, eg. "inline.importElement"
707 *
708 * $pArr = explode('|',$this->bparams);
709 * $formFieldName = $pArr[0];
710 * $allowedTablesOrFileTypes = $pArr[3];
711 */
712 var $bparams;
713
714 /**
715 * Used with the Rich Text Editor.
716 * Example value: "tt_content:NEW3fba58c969f5c:bodytext:23:text:23:"
717 */
718 var $RTEtsConfigParams;
719
720
721
722
723 /**
724 * Plus/Minus icon value. Used by the tree class to open/close notes on the trees.
725 */
726 var $PM;
727
728 /**
729 * Pointer, used when browsing a long list of records etc.
730 */
731 var $pointer;
732
733
734
735
736 /**
737 * Used with the link selector: Contains the GET input information about the CURRENT link in the RTE/TCEform field. This consists of "href", "target" and "title" keys. This information is passed around in links.
738 */
739 var $curUrlArray;
740
741 /**
742 * Used with the link selector: Contains a processed version of the input values from curUrlInfo. This is splitted into pageid, content element id, label value etc. This is used for the internal processing of that information.
743 */
744 var $curUrlInfo;
745
746 /**
747 * array which holds hook objects (initialised in init() )
748 */
749 protected $hookObjects = array();
750
751
752 /**
753 * object for t3lib_basicFileFunctions
754 */
755 public $fileProcessor;
756
757
758 /**
759 * Constructor:
760 * Initializes a lot of variables, setting JavaScript functions in header etc.
761 *
762 * @return void
763 */
764 function init() {
765 global $BE_USER,$BACK_PATH;
766
767 // Main GPvars:
768 $this->pointer = t3lib_div::_GP('pointer');
769 $this->bparams = t3lib_div::_GP('bparams');
770 $this->P = t3lib_div::_GP('P');
771 $this->RTEtsConfigParams = t3lib_div::_GP('RTEtsConfigParams');
772 $this->expandPage = t3lib_div::_GP('expandPage');
773 $this->expandFolder = t3lib_div::_GP('expandFolder');
774 $this->PM = t3lib_div::_GP('PM');
775
776 // Find "mode"
777 $this->mode = t3lib_div::_GP('mode');
778 if (!$this->mode) {
779 $this->mode = 'rte';
780 }
781 // Creating backend template object:
782 $this->doc = t3lib_div::makeInstance('template');
783 $this->doc->backPath = $GLOBALS['BACK_PATH'];
784 // Load the Prototype library and browse_links.js
785 $this->doc->getPageRenderer()->loadPrototype();
786 $this->doc->loadJavascriptLib('js/browse_links.js');
787
788 // init hook objects:
789 $this->hookObjects = array();
790 if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.browse_links.php']['browseLinksHook'])) {
791 foreach($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.browse_links.php']['browseLinksHook'] as $classData) {
792 $processObject = t3lib_div::getUserObj($classData);
793
794 if(!($processObject instanceof t3lib_browseLinksHook)) {
795 throw new UnexpectedValueException('$processObject must implement interface t3lib_browseLinksHook', 1195039394);
796 }
797
798 $parameters = array();
799 $processObject->init($this, $parameters);
800 $this->hookObjects[] = $processObject;
801 }
802 }
803
804 // Site URL
805 $this->siteURL = t3lib_div::getIndpEnv('TYPO3_SITE_URL'); // Current site url
806
807 // the script to link to
808 $this->thisScript = t3lib_div::getIndpEnv('SCRIPT_NAME');
809
810 // init fileProcessor
811 $this->fileProcessor = t3lib_div::makeInstance('t3lib_basicFileFunctions');
812 $this->fileProcessor->init($GLOBALS['FILEMOUNTS'], $GLOBALS['TYPO3_CONF_VARS']['BE']['fileExtensions']);
813
814
815 // CurrentUrl - the current link url must be passed around if it exists
816 if ($this->mode == 'wizard') {
817 $currentLinkParts = t3lib_div::unQuoteFilenames($this->P['currentValue'], TRUE);
818 $initialCurUrlArray = array (
819 'href' => $currentLinkParts[0],
820 'target' => $currentLinkParts[1],
821 'class' => $currentLinkParts[2],
822 'title' => $currentLinkParts[3],
823 );
824 $this->curUrlArray = (is_array(t3lib_div::_GP('curUrl'))) ?
825 array_merge($initialCurUrlArray, t3lib_div::_GP('curUrl')) :
826 $initialCurUrlArray;
827 $this->curUrlInfo = $this->parseCurUrl($this->siteURL.'?id='.$this->curUrlArray['href'], $this->siteURL);
828 if ($this->curUrlInfo['pageid'] == 0 && $this->curUrlArray['href']) { // pageid == 0 means that this is not an internal (page) link
829 if (file_exists(PATH_site.rawurldecode($this->curUrlArray['href']))) { // check if this is a link to a file
830 if (t3lib_div::isFirstPartOfStr($this->curUrlArray['href'], PATH_site)) {
831 $currentLinkParts[0] = substr($this->curUrlArray['href'], strlen(PATH_site));
832 }
833 $this->curUrlInfo = $this->parseCurUrl($this->siteURL.$this->curUrlArray['href'], $this->siteURL);
834 } elseif (strstr($this->curUrlArray['href'], '@')) { // check for email link
835 if (t3lib_div::isFirstPartOfStr($this->curUrlArray['href'], 'mailto:')) {
836 $currentLinkParts[0] = substr($this->curUrlArray['href'], 7);
837 }
838 $this->curUrlInfo = $this->parseCurUrl('mailto:'.$this->curUrlArray['href'], $this->siteURL);
839 } else { // nothing of the above. this is an external link
840 if(strpos($this->curUrlArray['href'], '://') === false) {
841 $currentLinkParts[0] = 'http://' . $this->curUrlArray['href'];
842 }
843 $this->curUrlInfo = $this->parseCurUrl($currentLinkParts[0], $this->siteURL);
844 }
845 } elseif (!$this->curUrlArray['href']) {
846 $this->curUrlInfo = array();
847 $this->act = 'page';
848 } else {
849 $this->curUrlInfo = $this->parseCurUrl($this->siteURL.'?id='.$this->curUrlArray['href'], $this->siteURL);
850 }
851 } else {
852 $this->curUrlArray = t3lib_div::_GP('curUrl');
853 if ($this->curUrlArray['all']) {
854 $this->curUrlArray=t3lib_div::get_tag_attributes($this->curUrlArray['all']);
855 }
856 $this->curUrlInfo=$this->parseCurUrl($this->curUrlArray['href'],$this->siteURL);
857 }
858
859 // Determine nature of current url:
860 $this->act=t3lib_div::_GP('act');
861 if (!$this->act) {
862 $this->act=$this->curUrlInfo['act'];
863 }
864
865 // Rich Text Editor specific configuration:
866 $addPassOnParams='';
867 if ((string)$this->mode == 'rte') {
868 $RTEtsConfigParts = explode(':',$this->RTEtsConfigParams);
869 $addPassOnParams.='&RTEtsConfigParams='.rawurlencode($this->RTEtsConfigParams);
870 $RTEsetup = $GLOBALS['BE_USER']->getTSConfig('RTE',t3lib_BEfunc::getPagesTSconfig($RTEtsConfigParts[5]));
871 $this->thisConfig = t3lib_BEfunc::RTEsetup($RTEsetup['properties'],$RTEtsConfigParts[0],$RTEtsConfigParts[2],$RTEtsConfigParts[4]);
872 }
873
874 // Initializing the target value (RTE)
875 $this->setTarget = ($this->curUrlArray['target'] != '-') ? $this->curUrlArray['target'] : '';
876 if ($this->thisConfig['defaultLinkTarget'] && !isset($this->curUrlArray['target'])) {
877 $this->setTarget=$this->thisConfig['defaultLinkTarget'];
878 }
879
880 // Initializing the class value (RTE)
881 $this->setClass = ($this->curUrlArray['class'] != '-') ? $this->curUrlArray['class'] : '';
882
883 // Initializing the title value (RTE)
884 $this->setTitle = ($this->curUrlArray['title'] != '-') ? $this->curUrlArray['title'] : '';
885
886 // BEGIN accumulation of header JavaScript:
887 $JScode = '
888 // This JavaScript is primarily for RTE/Link. jumpToUrl is used in the other cases as well...
889 var add_href="'.($this->curUrlArray['href']?'&curUrl[href]='.rawurlencode($this->curUrlArray['href']):'').'";
890 var add_target="'.($this->setTarget?'&curUrl[target]='.rawurlencode($this->setTarget):'').'";
891 var add_class="'.($this->setClass ? '&curUrl[class]='.rawurlencode($this->setClass) : '').'";
892 var add_title="'.($this->setTitle?'&curUrl[title]='.rawurlencode($this->setTitle):'').'";
893 var add_params="'.($this->bparams?'&bparams='.rawurlencode($this->bparams):'').'";
894
895 var cur_href="'.($this->curUrlArray['href']?$this->curUrlArray['href']:'').'";
896 var cur_target="'.($this->setTarget?$this->setTarget:'').'";
897 var cur_class = "'.($this->setClass ? $this->setClass : '-').'";
898 var cur_title="'.($this->setTitle?$this->setTitle:'').'";
899
900 function browse_links_setTarget(target) { //
901 cur_target=target;
902 add_target="&curUrl[target]="+escape(target);
903 }
904 function browse_links_setClass(cssClass) { //
905 cur_class = cssClass;
906 add_class = "&curUrl[class]=" + escape(cssClass);
907 }
908 function browse_links_setTitle(title) { //
909 cur_title=title;
910 add_title="&curUrl[title]="+escape(title);
911 }
912 function browse_links_setValue(value) { //
913 cur_href=value;
914 add_href="&curUrl[href]="+value;
915 }
916 ';
917
918 if ($this->mode == 'wizard') { // Functions used, if the link selector is in wizard mode (= TCEforms fields)
919 if (!$this->areFieldChangeFunctionsValid() && !$this->areFieldChangeFunctionsValid(TRUE)) {
920 $this->P['fieldChangeFunc'] = array();
921 }
922 unset($this->P['fieldChangeFunc']['alert']);
923 $update='';
924 foreach ($this->P['fieldChangeFunc'] as $k => $v) {
925 $update.= '
926 window.opener.'.$v;
927 }
928
929 $P2=array();
930 $P2['itemName']=$this->P['itemName'];
931 $P2['formName']=$this->P['formName'];
932 $P2['fieldChangeFunc']=$this->P['fieldChangeFunc'];
933 $P2['fieldChangeFuncHash'] = t3lib_div::hmac(serialize($this->P['fieldChangeFunc']));
934 $P2['params']['allowedExtensions']=$this->P['params']['allowedExtensions'];
935 $P2['params']['blindLinkOptions']=$this->P['params']['blindLinkOptions'];
936 $addPassOnParams.=t3lib_div::implodeArrayForUrl('P',$P2);
937
938 $JScode.='
939 function link_typo3Page(id,anchor) { //
940 updateValueInMainForm(id + (anchor ? anchor : ""));
941 close();
942 return false;
943 }
944 function link_folder(folder) { //
945 updateValueInMainForm(folder);
946 close();
947 return false;
948 }
949 function link_current() { //
950 if (cur_href!="http://" && cur_href!="mailto:") {
951 returnBeforeCleaned = cur_href;
952 if (returnBeforeCleaned.substr(0, 7) == "http://") {
953 returnToMainFormValue = returnBeforeCleaned.substr(7);
954 } else if (returnBeforeCleaned.substr(0, 7) == "mailto:") {
955 if (returnBeforeCleaned.substr(0, 14) == "mailto:mailto:") {
956 returnToMainFormValue = returnBeforeCleaned.substr(14);
957 } else {
958 returnToMainFormValue = returnBeforeCleaned.substr(7);
959 }
960 } else {
961 returnToMainFormValue = returnBeforeCleaned;
962 }
963 updateValueInMainForm(returnToMainFormValue);
964 close();
965 }
966 return false;
967 }
968 function checkReference() { //
969 if (window.opener && window.opener.document && window.opener.document.'.$this->P['formName'].' && window.opener.document.'.$this->P['formName'].'["'.$this->P['itemName'].'"] ) {
970 return window.opener.document.'.$this->P['formName'].'["'.$this->P['itemName'].'"];
971 } else {
972 close();
973 }
974 }
975 function updateValueInMainForm(input) { //
976 var field = checkReference();
977 if (field) {
978 if (cur_target == "" && (cur_title != "" || cur_class != "-")) {
979 cur_target = "-";
980 }
981 if (cur_title == "" && cur_class == "-") {
982 cur_class = "";
983 }
984 cur_class = cur_class.replace(/[\'\"]/g, "");
985 if (cur_class.indexOf(" ") != -1) {
986 cur_class = "\"" + cur_class + "\"";
987 }
988 cur_title = cur_title.replace(/(^\")|(\"$)/g, "");
989 if (cur_title.indexOf(" ") != -1) {
990 cur_title = "\"" + cur_title + "\"";
991 }
992 input = input + " " + cur_target + " " + cur_class + " " + cur_title;
993 field.value = input;
994 '.$update.'
995 }
996 }
997 ';
998 } else { // Functions used, if the link selector is in RTE mode:
999 $JScode.='
1000 function link_typo3Page(id,anchor) { //
1001 var theLink = \''.$this->siteURL.'?id=\'+id+(anchor?anchor:"");
1002 self.parent.parent.renderPopup_addLink(theLink, cur_target, cur_class, cur_title);
1003 return false;
1004 }
1005 function link_folder(folder) { //
1006 var theLink = \''.$this->siteURL.'\'+folder;
1007 self.parent.parent.renderPopup_addLink(theLink, cur_target, cur_class, cur_title);
1008 return false;
1009 }
1010 function link_spec(theLink) { //
1011 self.parent.parent.renderPopup_addLink(theLink, cur_target, cur_class, cur_title);
1012 return false;
1013 }
1014 function link_current() { //
1015 if (cur_href!="http://" && cur_href!="mailto:") {
1016 self.parent.parent.renderPopup_addLink(cur_href, cur_target, cur_class, cur_title);
1017 }
1018 return false;
1019 }
1020 ';
1021 }
1022
1023 // General "jumpToUrl" function:
1024 $JScode.='
1025 function jumpToUrl(URL,anchor) { //
1026 var add_act = URL.indexOf("act=")==-1 ? "&act='.$this->act.'" : "";
1027 var add_mode = URL.indexOf("mode=")==-1 ? "&mode='.$this->mode.'" : "";
1028 var theLocation = URL + add_act + add_mode + add_href + add_target + add_class + add_title + add_params'.($addPassOnParams?'+"'.$addPassOnParams.'"':'').'+(anchor?anchor:"");
1029 window.location.href = theLocation;
1030 return false;
1031 }
1032 ';
1033
1034
1035 /**
1036 * Splits parts of $this->bparams
1037 * @see $bparams
1038 */
1039 $pArr = explode('|',$this->bparams);
1040
1041 // This is JavaScript especially for the TBE Element Browser!
1042 $formFieldName = 'data['.$pArr[0].']['.$pArr[1].']['.$pArr[2].']';
1043
1044 // insertElement - Call check function (e.g. for uniqueness handling):
1045 if ($pArr[4] && $pArr[5]) {
1046 $JScodeCheck = '
1047 // Call a check function in the opener window (e.g. for uniqueness handling):
1048 if (parent.window.opener) {
1049 var res = parent.window.opener.'.$pArr[5].'("'.addslashes($pArr[4]).'",table,uid,type);
1050 if (!res.passed) {
1051 if (res.message) alert(res.message);
1052 performAction = false;
1053 }
1054 } else {
1055 alert("Error - reference to main window is not set properly!");
1056 parent.close();
1057 }
1058 ';
1059 }
1060 // insertElement - Call helper function:
1061 if ($pArr[4] && $pArr[6]) {
1062 $JScodeHelper = '
1063 // Call helper function to manage data in the opener window:
1064 if (parent.window.opener) {
1065 parent.window.opener.'.$pArr[6].'("'.addslashes($pArr[4]).'",table,uid,type,"'.addslashes($pArr[0]).'");
1066 } else {
1067 alert("Error - reference to main window is not set properly!");
1068 parent.close();
1069 }
1070 ';
1071 }
1072 // insertElement - perform action commands:
1073 if ($pArr[4] && $pArr[7]) {
1074 // Call user defined action function:
1075 $JScodeAction = '
1076 if (parent.window.opener) {
1077 parent.window.opener.'.$pArr[7].'("'.addslashes($pArr[4]).'",table,uid,type);
1078 focusOpenerAndClose(close);
1079 } else {
1080 alert("Error - reference to main window is not set properly!");
1081 parent.close();
1082 }
1083 ';
1084 } else if ($pArr[0] && !$pArr[1] && !$pArr[2]) {
1085 $JScodeAction = '
1086 addElement(filename,table+"_"+uid,fp,close);
1087 ';
1088 } else {
1089 $JScodeAction = '
1090 if (setReferences()) {
1091 parent.window.opener.group_change("add","'.$pArr[0].'","'.$pArr[1].'","'.$pArr[2].'",elRef,targetDoc);
1092 } else {
1093 alert("Error - reference to main window is not set properly!");
1094 }
1095 focusOpenerAndClose(close);
1096 ';
1097 }
1098
1099 $JScode.='
1100 var elRef="";
1101 var targetDoc="";
1102
1103 function launchView(url) { //
1104 var thePreviewWindow="";
1105 thePreviewWindow = window.open("'.$BACK_PATH.'show_item.php?table="+url,"ShowItem","height=300,width=410,status=0,menubar=0,resizable=0,location=0,directories=0,scrollbars=1,toolbar=0");
1106 if (thePreviewWindow && thePreviewWindow.focus) {
1107 thePreviewWindow.focus();
1108 }
1109 }
1110 function setReferences() { //
1111 if (parent.window.opener && parent.window.opener.content && parent.window.opener.content.document.editform && parent.window.opener.content.document.editform["'.$formFieldName.'"]) {
1112 targetDoc = parent.window.opener.content.document;
1113 elRef = targetDoc.editform["'.$formFieldName.'"];
1114 return true;
1115 } else {
1116 return false;
1117 }
1118 }
1119 function insertElement(table, uid, type, filename,fp,filetype,imagefile,action, close) { //
1120 var performAction = true;
1121 '.$JScodeCheck.'
1122 // Call performing function and finish this action:
1123 if (performAction) {
1124 '.$JScodeHelper.$JScodeAction.'
1125 }
1126 return false;
1127 }
1128 function addElement(elName,elValue,altElValue,close) { //
1129 if (parent.window.opener && parent.window.opener.setFormValueFromBrowseWin) {
1130 parent.window.opener.setFormValueFromBrowseWin("'.$pArr[0].'",altElValue?altElValue:elValue,elName);
1131 focusOpenerAndClose(close);
1132 } else {
1133 alert("Error - reference to main window is not set properly!");
1134 parent.close();
1135 }
1136 }
1137 function focusOpenerAndClose(close) { //
1138 BrowseLinks.focusOpenerAndClose(close);
1139 }
1140 ';
1141
1142 // Finally, add the accumulated JavaScript to the template object:
1143 $this->doc->JScode.= $this->doc->wrapScriptTags($JScode);
1144
1145 // Debugging:
1146 if (FALSE) debug(array(
1147 'pointer' => $this->pointer,
1148 'act' => $this->act,
1149 'mode' => $this->mode,
1150 'curUrlInfo' => $this->curUrlInfo,
1151 'curUrlArray' => $this->curUrlArray,
1152 'P' => $this->P,
1153 'bparams' => $this->bparams,
1154 'RTEtsConfigParams' => $this->RTEtsConfigParams,
1155 'expandPage' => $this->expandPage,
1156 'expandFolder' => $this->expandFolder,
1157 'PM' => $this->PM,
1158 ),'Internal variables of Script Class:');
1159 }
1160
1161
1162 /**
1163 * Session data for this class can be set from outside with this method.
1164 * Call after init()
1165 *
1166 * @param array Session data array
1167 * @return array Session data and boolean which indicates that data needs to be stored in session because it's changed
1168 */
1169 function processSessionData($data) {
1170 $store = false;
1171
1172 switch((string)$this->mode) {
1173 case 'db':
1174 if (isset($this->expandPage)) {
1175 $data['expandPage']=$this->expandPage;
1176 $store = true;
1177 } else {
1178 $this->expandPage=$data['expandPage'];
1179 }
1180 break;
1181 case 'file':
1182 case 'filedrag':
1183 case 'folder':
1184 if (isset($this->expandFolder)) {
1185 $data['expandFolder']=$this->expandFolder;
1186 $store = true;
1187 } else {
1188 $this->expandFolder=$data['expandFolder'];
1189 }
1190 break;
1191 }
1192
1193 return array($data, $store);
1194 }
1195
1196
1197
1198
1199 /******************************************************************
1200 *
1201 * Main functions
1202 *
1203 ******************************************************************/
1204
1205 /**
1206 * Rich Text Editor (RTE) link selector (MAIN function)
1207 * Generates the link selector for the Rich Text Editor.
1208 * Can also be used to select links for the TCEforms (see $wiz)
1209 *
1210 * @param boolean If set, the "remove link" is not shown in the menu: Used for the "Select link" wizard which is used by the TCEforms
1211 * @return string Modified content variable.
1212 */
1213 function main_rte($wiz=0) {
1214 global $LANG, $BACK_PATH;
1215
1216 // Starting content:
1217 $content=$this->doc->startPage('RTE link');
1218
1219 // Initializing the action value, possibly removing blinded values etc:
1220 $allowedItems = array_diff(
1221 explode(',','page,file,folder,url,mail,spec'),
1222 t3lib_div::trimExplode(',',$this->thisConfig['blindLinkOptions'],1)
1223 );
1224 $allowedItems = array_diff(
1225 $allowedItems,
1226 t3lib_div::trimExplode(',',$this->P['params']['blindLinkOptions'])
1227 );
1228
1229 //call hook for extra options
1230 foreach($this->hookObjects as $hookObject) {
1231 $allowedItems = $hookObject->addAllowedItems($allowedItems);
1232 }
1233
1234 reset($allowedItems);
1235 if (!in_array($this->act,$allowedItems)) $this->act = current($allowedItems);
1236
1237 // Making menu in top:
1238 $menuDef = array();
1239 if (!$wiz) {
1240 $menuDef['removeLink']['isActive'] = $this->act=='removeLink';
1241 $menuDef['removeLink']['label'] = $LANG->getLL('removeLink',1);
1242 $menuDef['removeLink']['url'] = '#';
1243 $menuDef['removeLink']['addParams'] = 'onclick="self.parent.parent.renderPopup_unLink();return false;"';
1244 }
1245 if (in_array('page',$allowedItems)) {
1246 $menuDef['page']['isActive'] = $this->act=='page';
1247 $menuDef['page']['label'] = $LANG->getLL('page',1);
1248 $menuDef['page']['url'] = '#';
1249 $menuDef['page']['addParams'] = 'onclick="jumpToUrl(\'?act=page\');return false;"';
1250 }
1251 if (in_array('file',$allowedItems)){
1252 $menuDef['file']['isActive'] = $this->act=='file';
1253 $menuDef['file']['label'] = $LANG->getLL('file',1);
1254 $menuDef['file']['url'] = '#';
1255 $menuDef['file']['addParams'] = 'onclick="jumpToUrl(\'?act=file\');return false;"';
1256 }
1257 if (in_array('folder',$allowedItems)){
1258 $menuDef['folder']['isActive'] = $this->act == 'folder';
1259 $menuDef['folder']['label'] = $LANG->getLL('folder', 1);
1260 $menuDef['folder']['url'] = '#';
1261 $menuDef['folder']['addParams'] = 'onclick="jumpToUrl(\'?act=folder\');return false;"';
1262 }
1263 if (in_array('url',$allowedItems)) {
1264 $menuDef['url']['isActive'] = $this->act=='url';
1265 $menuDef['url']['label'] = $LANG->getLL('extUrl',1);
1266 $menuDef['url']['url'] = '#';
1267 $menuDef['url']['addParams'] = 'onclick="jumpToUrl(\'?act=url\');return false;"';
1268 }
1269 if (in_array('mail',$allowedItems)) {
1270 $menuDef['mail']['isActive'] = $this->act=='mail';
1271 $menuDef['mail']['label'] = $LANG->getLL('email',1);
1272 $menuDef['mail']['url'] = '#';
1273 $menuDef['mail']['addParams'] = 'onclick="jumpToUrl(\'?act=mail\');return false;"';
1274 }
1275 if (is_array($this->thisConfig['userLinks.']) && in_array('spec',$allowedItems)) {
1276 $menuDef['spec']['isActive'] = $this->act=='spec';
1277 $menuDef['spec']['label'] = $LANG->getLL('special',1);
1278 $menuDef['spec']['url'] = '#';
1279 $menuDef['spec']['addParams'] = 'onclick="jumpToUrl(\'?act=spec\');return false;"';
1280 }
1281
1282 // call hook for extra options
1283 foreach($this->hookObjects as $hookObject) {
1284 $menuDef = $hookObject->modifyMenuDefinition($menuDef);
1285 }
1286
1287 $content .= $this->doc->getTabMenuRaw($menuDef);
1288
1289 // Adding the menu and header to the top of page:
1290 $content.=$this->printCurrentUrl($this->curUrlInfo['info']).'<br />';
1291
1292 // Depending on the current action we will create the actual module content for selecting a link:
1293 switch($this->act) {
1294 case 'mail':
1295 $extUrl='
1296
1297 <!--
1298 Enter mail address:
1299 -->
1300 <form action="" name="lurlform" id="lurlform">
1301 <table border="0" cellpadding="2" cellspacing="1" id="typo3-linkMail">
1302 <tr>
1303 <td style="width: 96px;">' . $GLOBALS['LANG']->getLL('emailAddress', 1) . ':</td>
1304 <td><input type="text" name="lemail"'.$this->doc->formWidth(20).' value="'.htmlspecialchars($this->curUrlInfo['act']=='mail'?$this->curUrlInfo['info']:'').'" /> '.
1305 '<input type="submit" value="' . $GLOBALS['LANG']->getLL('setLink', 1) . '" onclick="browse_links_setTarget(\'\');browse_links_setValue(\'mailto:\'+document.lurlform.lemail.value); return link_current();" /></td>
1306 </tr>
1307 </table>
1308 </form>';
1309 $content.=$extUrl;
1310 break;
1311 case 'url':
1312 $extUrl='
1313
1314 <!--
1315 Enter External URL:
1316 -->
1317 <form action="" name="lurlform" id="lurlform">
1318 <table border="0" cellpadding="2" cellspacing="1" id="typo3-linkURL">
1319 <tr>
1320 <td style="width: 96px;">URL:</td>
1321 <td><input type="text" name="lurl"'.$this->doc->formWidth(30).' value="'.htmlspecialchars($this->curUrlInfo['act']=='url'?$this->curUrlInfo['info']:'http://').'" /> '.
1322 '<input type="submit" value="' . $GLOBALS['LANG']->getLL('setLink', 1) . '" onclick="browse_links_setValue(document.lurlform.lurl.value); return link_current();" /></td>
1323 </tr>
1324 </table>
1325 </form>';
1326 $content.=$extUrl;
1327 break;
1328 case 'file':
1329 case 'folder':
1330 $foldertree = t3lib_div::makeInstance('rteFolderTree');
1331 $foldertree->thisScript = $this->thisScript;
1332 $tree = $foldertree->getBrowsableTree();
1333
1334 if (!$this->curUrlInfo['value'] || $this->curUrlInfo['act'] != $this->act) {
1335 $cmpPath = '';
1336 } elseif (substr(trim($this->curUrlInfo['info']), -1) != '/') {
1337 $cmpPath = PATH_site.dirname($this->curUrlInfo['info']).'/';
1338 if (!isset($this->expandFolder)) {
1339 $this->expandFolder = $cmpPath;
1340 }
1341 } else {
1342 $cmpPath = PATH_site.$this->curUrlInfo['info'];
1343 if (!isset($this->expandFolder) && $this->curUrlInfo['act'] == 'folder') {
1344 $this->expandFolder = $cmpPath;
1345 }
1346 }
1347
1348 list(, , $specUid) = explode('_', $this->PM);
1349 $files = $this->expandFolder(
1350 $foldertree->specUIDmap[$specUid],
1351 $this->P['params']['allowedExtensions']
1352 );
1353 $content.= '
1354
1355 <!--
1356 Wrapper table for folder tree / file/folder list:
1357 -->
1358 <table border="0" cellpadding="0" cellspacing="0" id="typo3-linkFiles">
1359 <tr>
1360 <td class="c-wCell" valign="top">'.$this->barheader($GLOBALS['LANG']->getLL('folderTree').':').$tree.'</td>
1361 <td class="c-wCell" valign="top">'.$files.'</td>
1362 </tr>
1363 </table>
1364 ';
1365 break;
1366 case 'spec':
1367 if (is_array($this->thisConfig['userLinks.'])) {
1368 $subcats=array();
1369 $v=$this->thisConfig['userLinks.'];
1370 foreach ($v as $k2 => $value) {
1371 $k2i = intval($k2);
1372 if (substr($k2,-1)=='.' && is_array($v[$k2i.'.'])) {
1373
1374 // Title:
1375 $title = trim($v[$k2i]);
1376 if (!$title) {
1377 $title=$v[$k2i.'.']['url'];
1378 } else {
1379 $title=$LANG->sL($title);
1380 }
1381 // Description:
1382 $description=$v[$k2i.'.']['description'] ? $LANG->sL($v[$k2i.'.']['description'],1).'<br />' : '';
1383
1384 // URL + onclick event:
1385 $onClickEvent='';
1386 if (isset($v[$k2i.'.']['target'])) $onClickEvent.="browse_links_setTarget('".$v[$k2i.'.']['target']."');";
1387 $v[$k2i.'.']['url'] = str_replace('###_URL###',$this->siteURL,$v[$k2i.'.']['url']);
1388 if (substr($v[$k2i.'.']['url'],0,7)=='http://' || substr($v[$k2i.'.']['url'],0,7)=='mailto:') {
1389 $onClickEvent.="cur_href=unescape('".rawurlencode($v[$k2i.'.']['url'])."');link_current();";
1390 } else {
1391 $onClickEvent.="link_spec(unescape('".$this->siteURL.rawurlencode($v[$k2i.'.']['url'])."'));";
1392 }
1393
1394 // Link:
1395 $A=array('<a href="#" onclick="'.htmlspecialchars($onClickEvent).'return false;">','</a>');
1396
1397 // Adding link to menu of user defined links:
1398 $subcats[$k2i]='
1399 <tr>
1400 <td class="bgColor4">'.$A[0].'<strong>'.htmlspecialchars($title).($this->curUrlInfo['info']==$v[$k2i.'.']['url']?'<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/blinkarrow_right.gif','width="5" height="9"').' class="c-blinkArrowR" alt="" />':'').'</strong><br />'.$description.$A[1].'</td>
1401 </tr>';
1402 }
1403 }
1404
1405 // Sort by keys:
1406 ksort($subcats);
1407
1408 // Add menu to content:
1409 $content.= '
1410
1411 <!--
1412 Special userdefined menu:
1413 -->
1414 <table border="0" cellpadding="1" cellspacing="1" id="typo3-linkSpecial">
1415 <tr>
1416 <td class="bgColor5" class="c-wCell" valign="top"><strong>'.$LANG->getLL('special',1).'</strong></td>
1417 </tr>
1418 '.implode('',$subcats).'
1419 </table>
1420 ';
1421 }
1422 break;
1423 case 'page':
1424 $pagetree = t3lib_div::makeInstance('rtePageTree');
1425 $pagetree->thisScript = $this->thisScript;
1426 $pagetree->ext_showPageId = $GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.showPageIdWithTitle');
1427 $tree=$pagetree->getBrowsableTree();
1428 $cElements = $this->expandPage();
1429
1430 // Outputting Temporary DB mount notice:
1431 if (intval($GLOBALS['BE_USER']->getSessionData('pageTree_temporaryMountPoint'))) {
1432 $link = '<a href="' . htmlspecialchars(t3lib_div::linkThisScript(array('setTempDBmount' => 0))) . '">' .
1433 $LANG->sl('LLL:EXT:lang/locallang_core.xml:labels.temporaryDBmount', 1) .
1434 '</a>';
1435 $flashMessage = t3lib_div::makeInstance(
1436 't3lib_FlashMessage',
1437 $link,
1438 '',
1439 t3lib_FlashMessage::INFO
1440 );
1441 $dbmount = $flashMessage->render();
1442 }
1443
1444 $content.= '
1445
1446 <!--
1447 Wrapper table for page tree / record list:
1448 -->
1449 <table border="0" cellpadding="0" cellspacing="0" id="typo3-linkPages">
1450 <tr>
1451 <td class="c-wCell" valign="top">' . $this->barheader($GLOBALS['LANG']->getLL('pageTree') . ':') . $dbmount . $tree . '</td>
1452 <td class="c-wCell" valign="top">'.$cElements.'</td>
1453 </tr>
1454 </table>
1455 ';
1456 break;
1457 default:
1458 //call hook
1459 foreach($this->hookObjects as $hookObject) {
1460 $content .= $hookObject->getTab($this->act);
1461 }
1462 break;
1463 }
1464
1465 $content .= '
1466
1467 <!--
1468 Selecting class for link:
1469 -->
1470 <form action="" name="lclassform" id="lclassform">
1471 <table border="0" cellpadding="2" cellspacing="1" id="typo3-linkClass">
1472 <tr>
1473 <td style="width: 96px;">' . $GLOBALS['LANG']->getLL('class', 1) . '</td>
1474 <td><input type="text" name="lclass" onchange="browse_links_setClass(this.value);" value="' . htmlspecialchars($this->setClass) . '"' . $this->doc->formWidth(10) . ' /></td>
1475 </tr>
1476 </table>
1477 </form>
1478
1479 <!--
1480 Selecting title for link:
1481 -->
1482 <form action="" name="ltitleform" id="ltitleform">
1483 <table border="0" cellpadding="2" cellspacing="1" id="typo3-linkTitle">
1484 <tr>
1485 <td style="width: 96px;">' . $GLOBALS['LANG']->getLL('title', 1) . '</td>
1486 <td><input type="text" name="ltitle" onchange="browse_links_setTitle(this.value);" value="' . htmlspecialchars($this->setTitle) . '"' . $this->doc->formWidth(10) . ' /></td>
1487 </tr>
1488 </table>
1489 </form>
1490 ';
1491
1492 // Target:
1493 if ($this->act!='mail') {
1494 $ltarget='
1495
1496
1497
1498 <!--
1499 Selecting target for link:
1500 -->
1501 <form action="" name="ltargetform" id="ltargetform">
1502 <table border="0" cellpadding="2" cellspacing="1" id="typo3-linkTarget">
1503 <tr>
1504 <td>'.$GLOBALS['LANG']->getLL('target',1).':</td>
1505 <td><input type="text" name="ltarget" onchange="browse_links_setTarget(this.value);" value="' . htmlspecialchars($this->setTarget) . '"' . $this->doc->formWidth(10) . ' /></td>
1506 <td>
1507 <select name="ltarget_type" onchange="browse_links_setTarget(this.options[this.selectedIndex].value);document.ltargetform.ltarget.value=this.options[this.selectedIndex].value;this.selectedIndex=0;">
1508 <option></option>
1509 <option value="_top">'.$GLOBALS['LANG']->getLL('top',1).'</option>
1510 <option value="_blank">'.$GLOBALS['LANG']->getLL('newWindow',1).'</option>
1511 </select>
1512 </td>
1513 <td>';
1514 if (($this->curUrlInfo['act'] == 'page' || $this->curUrlInfo['act'] == 'file' || $this->curUrlInfo['act'] == 'folder') && $this->curUrlArray['href'] && $this->curUrlInfo['act'] == $this->act) {
1515 $ltarget.='
1516 <input type="submit" value="'.$GLOBALS['LANG']->getLL('update',1).'" onclick="return link_current();" />';
1517 }
1518
1519 $selectJS = '
1520 if (document.ltargetform.popup_width.options[document.ltargetform.popup_width.selectedIndex].value>0 && document.ltargetform.popup_height.options[document.ltargetform.popup_height.selectedIndex].value>0) {
1521 document.ltargetform.ltarget.value = document.ltargetform.popup_width.options[document.ltargetform.popup_width.selectedIndex].value+"x"+document.ltargetform.popup_height.options[document.ltargetform.popup_height.selectedIndex].value;
1522 browse_links_setTarget(document.ltargetform.ltarget.value);
1523 browse_links_setClass(document.lclassform.lclass.value);
1524 browse_links_setTitle(document.ltitleform.ltitle.value);
1525 document.ltargetform.popup_width.selectedIndex=0;
1526 document.ltargetform.popup_height.selectedIndex=0;
1527 }
1528 ';
1529
1530 $ltarget.=' </td>
1531 </tr>
1532 <tr>
1533 <td>'.$GLOBALS['LANG']->getLL('target_popUpWindow',1).':</td>
1534 <td colspan="3">
1535 <select name="popup_width" onchange="'.htmlspecialchars($selectJS).'">
1536 <option value="0">'.$GLOBALS['LANG']->getLL('target_popUpWindow_width',1).'</option>
1537 <option value="300">300</option>
1538 <option value="400">400</option>
1539 <option value="500">500</option>
1540 <option value="600">600</option>
1541 <option value="700">700</option>
1542 <option value="800">800</option>
1543 </select>
1544 x
1545 <select name="popup_height" onchange="'.htmlspecialchars($selectJS).'">
1546 <option value="0">'.$GLOBALS['LANG']->getLL('target_popUpWindow_height',1).'</option>
1547 <option value="200">200</option>
1548 <option value="300">300</option>
1549 <option value="400">400</option>
1550 <option value="500">500</option>
1551 <option value="600">600</option>
1552 </select>
1553 </td>
1554 </tr>
1555 </table>
1556 </form>';
1557
1558 // Add "target selector" box to content:
1559 $content.=$ltarget;
1560
1561 // Add some space
1562 $content.='<br /><br />';
1563 }
1564
1565 // End page, return content:
1566 $content.= $this->doc->endPage();
1567 $content = $this->doc->insertStylesAndJS($content);
1568 return $content;
1569 }
1570
1571 /**
1572 * TYPO3 Element Browser: Showing a page tree and allows you to browse for records
1573 *
1574 * @return string HTML content for the module
1575 */
1576 function main_db() {
1577
1578 // Starting content:
1579 $content=$this->doc->startPage('TBE record selector');
1580
1581 // Init variable:
1582 $pArr = explode('|',$this->bparams);
1583
1584 // Making the browsable pagetree:
1585 $pagetree = t3lib_div::makeInstance('TBE_PageTree');
1586 $pagetree->thisScript=$this->thisScript;
1587 $pagetree->ext_pArrPages = !strcmp($pArr[3],'pages')?1:0;
1588 $pagetree->ext_showNavTitle = $GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.showNavTitle');
1589 $pagetree->ext_showPageId = $GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.showPageIdWithTitle');
1590 $pagetree->addField('nav_title');
1591 $tree=$pagetree->getBrowsableTree();
1592
1593 // Making the list of elements, if applicable:
1594 $cElements = $this->TBE_expandPage($pArr[3]);
1595
1596 // Putting the things together, side by side:
1597 $content.= '
1598
1599 <!--
1600 Wrapper table for page tree / record list:
1601 -->
1602 <table border="0" cellpadding="0" cellspacing="0" id="typo3-EBrecords">
1603 <tr>
1604 <td class="c-wCell" valign="top">'.$this->barheader($GLOBALS['LANG']->getLL('pageTree').':').$tree.'</td>
1605 <td class="c-wCell" valign="top">'.$cElements.'</td>
1606 </tr>
1607 </table>
1608 ';
1609
1610 // Add some space
1611 $content.='<br /><br />';
1612
1613 // End page, return content:
1614 $content.= $this->doc->endPage();
1615 $content = $this->doc->insertStylesAndJS($content);
1616 return $content;
1617 }
1618
1619 /**
1620 * TYPO3 Element Browser: Showing a folder tree, allowing you to browse for files.
1621 *
1622 * @return string HTML content for the module
1623 */
1624 function main_file() {
1625 global $BE_USER;
1626
1627 // Starting content:
1628 $content.=$this->doc->startPage('TBE file selector');
1629
1630 // Init variable:
1631 $pArr = explode('|',$this->bparams);
1632
1633 // Create upload/create folder forms, if a path is given:
1634 $path=$this->expandFolder;
1635 if (!$path || !@is_dir($path)) {
1636 // The closest TEMP-path is found
1637 $path = $this->fileProcessor->findTempFolder().'/';
1638 }
1639 if ($path!='/' && @is_dir($path)) {
1640 $uploadForm=$this->uploadForm($path);
1641 $createFolder=$this->createFolder($path);
1642 } else {
1643 $createFolder='';
1644 $uploadForm='';
1645 }
1646 if ($BE_USER->getTSConfigVal('options.uploadFieldsInTopOfEB')) $content.=$uploadForm;
1647
1648 // Getting flag for showing/not showing thumbnails:
1649 $noThumbs = $GLOBALS['BE_USER']->getTSConfigVal('options.noThumbsInEB');
1650
1651 if (!$noThumbs) {
1652 // MENU-ITEMS, fetching the setting for thumbnails from File>List module:
1653 $_MOD_MENU = array('displayThumbs' => '');
1654 $_MCONF['name']='file_list';
1655 $_MOD_SETTINGS = t3lib_BEfunc::getModuleData($_MOD_MENU, t3lib_div::_GP('SET'), $_MCONF['name']);
1656 $addParams = '&act='.$this->act.'&mode='.$this->mode.'&expandFolder='.rawurlencode($path).'&bparams='.rawurlencode($this->bparams);
1657 $thumbNailCheck = t3lib_BEfunc::getFuncCheck('','SET[displayThumbs]',$_MOD_SETTINGS['displayThumbs'],$this->thisScript,$addParams,'id="checkDisplayThumbs"').' <label for="checkDisplayThumbs">'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_file_list.php:displayThumbs',1).'</label>';
1658 } else {
1659 $thumbNailCheck='';
1660 }
1661 $noThumbs = $noThumbs ? $noThumbs : !$_MOD_SETTINGS['displayThumbs'];
1662
1663 // Create folder tree:
1664 $foldertree = t3lib_div::makeInstance('TBE_FolderTree');
1665 $foldertree->thisScript=$this->thisScript;
1666 $foldertree->ext_noTempRecyclerDirs = ($this->mode == 'filedrag');
1667 $tree=$foldertree->getBrowsableTree();
1668
1669 list(,,$specUid) = explode('_',$this->PM);
1670
1671 if ($this->mode=='filedrag') {
1672 $files = $this->TBE_dragNDrop($foldertree->specUIDmap[$specUid],$pArr[3]);
1673 } else {
1674 $files = $this->TBE_expandFolder($foldertree->specUIDmap[$specUid],$pArr[3],$noThumbs);
1675 }
1676
1677 // Putting the parts together, side by side:
1678 $content.= '
1679
1680 <!--
1681 Wrapper table for folder tree / file list:
1682 -->
1683 <table border="0" cellpadding="0" cellspacing="0" id="typo3-EBfiles">
1684 <tr>
1685 <td class="c-wCell" valign="top">'.$this->barheader($GLOBALS['LANG']->getLL('folderTree').':').$tree.'</td>
1686 <td class="c-wCell" valign="top">'.$files.'</td>
1687 </tr>
1688 </table>
1689 ';
1690 $content.= $thumbNailCheck;
1691
1692 // Adding create folder + upload forms if applicable:
1693 if (!$BE_USER->getTSConfigVal('options.uploadFieldsInTopOfEB')) $content.=$uploadForm;
1694 if ($BE_USER->isAdmin() || $BE_USER->getTSConfigVal('options.createFoldersInEB')) $content.=$createFolder;
1695
1696 // Add some space
1697 $content.='<br /><br />';
1698
1699 // Setup indexed elements:
1700 $this->doc->JScode.= $this->doc->wrapScriptTags('BrowseLinks.addElements(' . json_encode($this->elements) . ');');
1701 // Ending page, returning content:
1702 $content.= $this->doc->endPage();
1703 $content = $this->doc->insertStylesAndJS($content);
1704
1705 return $content;
1706 }
1707
1708 /**
1709 * TYPO3 Element Browser: Showing a folder tree, allowing you to browse for folders.
1710 *
1711 * @return string HTML content for the module
1712 */
1713 function main_folder() {
1714 global $BE_USER;
1715
1716 // Starting content:
1717 $content = $this->doc->startPage('TBE folder selector');
1718
1719 // Init variable:
1720 $parameters = explode('|', $this->bparams);
1721
1722
1723 $path = $this->expandFolder;
1724 if (!$path || !@is_dir($path)) {
1725 // The closest TEMP-path is found
1726 $path = $this->fileProcessor->findTempFolder().'/';
1727 }
1728 if ($path != '/' && @is_dir($path)) {
1729 $createFolder = $this->createFolder($path);
1730 } else {
1731 $createFolder='';
1732 }
1733
1734 // Create folder tree:
1735 $foldertree = t3lib_div::makeInstance('TBE_FolderTree');
1736 $foldertree->thisScript = $this->thisScript;
1737 $foldertree->ext_noTempRecyclerDirs = ($this->mode == 'filedrag');
1738 $tree = $foldertree->getBrowsableTree(false);
1739
1740 list(, , $specUid) = explode('_', $this->PM);
1741
1742 if($this->mode == 'filedrag') {
1743 $folders = $this->TBE_dragNDrop(
1744 $foldertree->specUIDmap[$specUid],
1745 $parameters[3]
1746 );
1747 } else {
1748 $folders = $this->TBE_expandSubFolders($foldertree->specUIDmap[$specUid]);
1749 }
1750
1751 // Putting the parts together, side by side:
1752 $content.= '
1753
1754 <!--
1755 Wrapper table for folder tree / folder list:
1756 -->
1757 <table border="0" cellpadding="0" cellspacing="0" id="typo3-EBfiles">
1758 <tr>
1759 <td class="c-wCell" valign="top">'.$this->barheader($GLOBALS['LANG']->getLL('folderTree').':').$tree.'</td>
1760 <td class="c-wCell" valign="top">'.$folders.'</td>
1761 </tr>
1762 </table>
1763 ';
1764
1765 // Adding create folder if applicable:
1766 if($BE_USER->isAdmin() || $BE_USER->getTSConfigVal('options.createFoldersInEB')) {
1767 $content .= $createFolder;
1768 }
1769
1770 // Add some space
1771 $content .= '<br /><br />';
1772
1773 // Ending page, returning content:
1774 $content.= $this->doc->endPage();
1775 $content = $this->doc->insertStylesAndJS($content);
1776
1777 return $content;
1778 }
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796 /******************************************************************
1797 *
1798 * Record listing
1799 *
1800 ******************************************************************/
1801 /**
1802 * For RTE: This displays all content elements on a page and lets you create a link to the element.
1803 *
1804 * @return string HTML output. Returns content only if the ->expandPage value is set (pointing to a page uid to show tt_content records from ...)
1805 */
1806 function expandPage() {
1807 global $BE_USER, $BACK_PATH;
1808
1809 $out='';
1810 $expPageId = $this->expandPage; // Set page id (if any) to expand
1811
1812 // If there is an anchor value (content element reference) in the element reference, then force an ID to expand:
1813 if (!$this->expandPage && $this->curUrlInfo['cElement']) {
1814 $expPageId = $this->curUrlInfo['pageid']; // Set to the current link page id.
1815 }
1816
1817 // Draw the record list IF there is a page id to expand:
1818 if ($expPageId && t3lib_div::testInt($expPageId) && $BE_USER->isInWebMount($expPageId)) {
1819
1820 // Set header:
1821 $out.=$this->barheader($GLOBALS['LANG']->getLL('contentElements').':');
1822
1823 // Create header for listing, showing the page title/icon:
1824 $titleLen=intval($GLOBALS['BE_USER']->uc['titleLen']);
1825 $mainPageRec = t3lib_BEfunc::getRecordWSOL('pages',$expPageId);
1826 $picon = t3lib_iconWorks::getSpriteIconForRecord('pages', $mainPageRec);
1827 $picon.= htmlspecialchars(t3lib_div::fixed_lgd_cs($mainPageRec['title'],$titleLen));
1828 $out.=$picon.'<br />';
1829
1830 // Look up tt_content elements from the expanded page:
1831 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
1832 'uid,header,hidden,starttime,endtime,fe_group,CType,colpos,bodytext',
1833 'tt_content',
1834 'pid='.intval($expPageId).
1835 t3lib_BEfunc::deleteClause('tt_content').
1836 t3lib_BEfunc::versioningPlaceholderClause('tt_content'),
1837 '',
1838 'colpos,sorting'
1839 );
1840 $cc = $GLOBALS['TYPO3_DB']->sql_num_rows($res);
1841
1842 // Traverse list of records:
1843 $c=0;
1844 while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
1845 $c++;
1846 $icon = t3lib_iconWorks::getSpriteIconForRecord('tt_content', $row);
1847 if ($this->curUrlInfo['act']=='page' && $this->curUrlInfo['cElement']==$row['uid']) {
1848 $arrCol='<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/blinkarrow_left.gif','width="5" height="9"').' class="c-blinkArrowL" alt="" />';
1849 } else {
1850 $arrCol='';
1851 }
1852 // Putting list element HTML together:
1853 $out.='<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/ol/join'.($c==$cc?'bottom':'').'.gif','width="18" height="16"').' alt="" />'.
1854 $arrCol.
1855 '<a href="#" onclick="return link_typo3Page(\''.$expPageId.'\',\'#'.$row['uid'].'\');">'.
1856 $icon.
1857 htmlspecialchars(t3lib_div::fixed_lgd_cs($row['header'],$titleLen)).
1858 '</a><br />';
1859
1860 // Finding internal anchor points:
1861 if (t3lib_div::inList('text,textpic', $row['CType'])) {
1862 $split = preg_split('/(<a[^>]+name=[\'"]?([^"\'>[:space:]]+)[\'"]?[^>]*>)/i', $row['bodytext'], -1, PREG_SPLIT_DELIM_CAPTURE);
1863
1864 foreach($split as $skey => $sval) {
1865 if (($skey%3)==2) {
1866 // Putting list element HTML together:
1867 $sval = substr($sval,0,100);
1868 $out.='<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/ol/line.gif','width="18" height="16"').' alt="" />'.
1869 '<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/ol/join'.($skey+3>count($split)?'bottom':'').'.gif','width="18" height="16"').' alt="" />'.
1870 '<a href="#" onclick="return link_typo3Page(\''.$expPageId.'\',\'#'.rawurlencode($sval).'\');">'.
1871 htmlspecialchars(' <A> '.$sval).
1872 '</a><br />';
1873 }
1874 }
1875 }
1876 }
1877 }
1878 return $out;
1879 }
1880
1881 /**
1882 * For TYPO3 Element Browser: This lists all content elements from the given list of tables
1883 *
1884 * @param string Commalist of tables. Set to "*" if you want all tables.
1885 * @return string HTML output.
1886 */
1887 function TBE_expandPage($tables) {
1888 global $TCA,$BE_USER, $BACK_PATH;
1889
1890 $out='';
1891 if ($this->expandPage>=0 && t3lib_div::testInt($this->expandPage) && $BE_USER->isInWebMount($this->expandPage)) {
1892
1893 // Set array with table names to list:
1894 if (!strcmp(trim($tables),'*')) {
1895 $tablesArr = array_keys($TCA);
1896 } else {
1897 $tablesArr = t3lib_div::trimExplode(',',$tables,1);
1898 }
1899 reset($tablesArr);
1900
1901 // Headline for selecting records:
1902 $out.=$this->barheader($GLOBALS['LANG']->getLL('selectRecords').':');
1903
1904 // Create the header, showing the current page for which the listing is. Includes link to the page itself, if pages are amount allowed tables.
1905 $titleLen=intval($GLOBALS['BE_USER']->uc['titleLen']);
1906 $mainPageRec = t3lib_BEfunc::getRecordWSOL('pages',$this->expandPage);
1907 $ATag='';
1908 $ATag_e='';
1909 $ATag2='';
1910 $picon = '';
1911 if (is_array($mainPageRec)) {
1912 $picon = t3lib_iconWorks::getSpriteIconForRecord('pages', $mainPageRec);
1913 if (in_array('pages', $tablesArr)) {
1914 $ATag = "<a href=\"#\" onclick=\"return insertElement('pages', '" . $mainPageRec['uid'] .
1915 "', 'db', " . t3lib_div::quoteJSvalue($mainPageRec['title']) . ", '', '', '','',1);\">";
1916 $ATag2 = "<a href=\"#\" onclick=\"return insertElement('pages', '" . $mainPageRec['uid'] .
1917 "', 'db', " . t3lib_div::quoteJSvalue($mainPageRec['title']) . ", '', '', '','',0);\">";
1918 $ATag_alt = substr($ATag, 0, -4) . ",'',1);\">";
1919 $ATag_e = '</a>';
1920 }
1921 }
1922 $pBicon=$ATag2?'<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/plusbullet2.gif','width="18" height="16"').' alt="" />':'';
1923 $pText=htmlspecialchars(t3lib_div::fixed_lgd_cs($mainPageRec['title'],$titleLen));
1924 $out.=$picon.$ATag2.$pBicon.$ATag_e.$ATag.$pText.$ATag_e.'<br />';
1925
1926 // Initialize the record listing:
1927 $id = $this->expandPage;
1928 $pointer = t3lib_div::intInRange($this->pointer,0,100000);
1929 $perms_clause = $GLOBALS['BE_USER']->getPagePermsClause(1);
1930 $pageinfo = t3lib_BEfunc::readPageAccess($id,$perms_clause);
1931 $table='';
1932
1933 // Generate the record list:
1934 $dblist = t3lib_div::makeInstance('TBE_browser_recordList');
1935 $dblist->thisScript=$this->thisScript;
1936 $dblist->backPath = $GLOBALS['BACK_PATH'];
1937 $dblist->thumbs = 0;
1938 $dblist->calcPerms = $GLOBALS['BE_USER']->calcPerms($pageinfo);
1939 $dblist->noControlPanels=1;
1940 $dblist->clickMenuEnabled=0;
1941 $dblist->tableList=implode(',',$tablesArr);
1942
1943 $dblist->start($id,t3lib_div::_GP('table'),$pointer,
1944 t3lib_div::_GP('search_field'),
1945 t3lib_div::_GP('search_levels'),
1946 t3lib_div::_GP('showLimit')
1947 );
1948 $dblist->setDispFields();
1949 $dblist->generateList();
1950 $dblist->writeBottom();
1951
1952 // Add the HTML for the record list to output variable:
1953 $out.=$dblist->HTMLcode;
1954
1955 // Add support for fieldselectbox in singleTableMode
1956 if ($dblist->table) {
1957 $out.= $dblist->fieldSelectBox($dblist->table);
1958 }
1959
1960 $out.=$dblist->getSearchBox();
1961 }
1962
1963 // Return accumulated content:
1964 return $out;
1965 }
1966
1967
1968 /**
1969 * Render list of folders inside a folder.
1970 *
1971 * @param string string of the current folder
1972 * @return string HTML output
1973 */
1974 function TBE_expandSubFolders($expandFolder=0) {
1975 $content = '';
1976
1977 $expandFolder = $expandFolder ?
1978 $expandFolder :
1979 $this->expandFolder;
1980
1981 if($expandFolder && $this->checkFolder($expandFolder)) {
1982 if(t3lib_div::isFirstPartOfStr($expandFolder, PATH_site)) {
1983 $rootFolder = substr($expandFolder, strlen(PATH_site));
1984 }
1985
1986 $folders = array();
1987
1988 // Listing the folders:
1989 $folders = t3lib_div::get_dirs($expandFolder);
1990 if(count($folders) > 0) {
1991 foreach($folders as $index => $folder) {
1992 $folders[$index] = $rootFolder.$folder.'/';
1993 }
1994 }
1995 $content.= $this->folderList($rootFolder, $folders);
1996 }
1997
1998 // Return accumulated content for folderlisting:
1999 return $content;
2000 }
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012 /******************************************************************
2013 *
2014 * File listing
2015 *
2016 ******************************************************************/
2017 /**
2018 * For RTE: This displays all files from folder. No thumbnails shown
2019 *
2020 * @param string The folder path to expand
2021 * @param string List of fileextensions to show
2022 * @return string HTML output
2023 */
2024 function expandFolder($expandFolder=0,$extensionList='') {
2025 global $BACK_PATH;
2026
2027 $expandFolder = $expandFolder ? $expandFolder : $this->expandFolder;
2028 $out='';
2029 if ($expandFolder && $this->checkFolder($expandFolder)) {
2030
2031 // Create header for filelisting:
2032 $out.=$this->barheader($GLOBALS['LANG']->getLL('files').':');
2033
2034 // Prepare current path value for comparison (showing red arrow)
2035 if (!$this->curUrlInfo['value']) {
2036 $cmpPath='';
2037 } else {
2038 $cmpPath=PATH_site.$this->curUrlInfo['info'];
2039 }
2040
2041
2042 // Create header element; The folder from which files are listed.
2043 $titleLen=intval($GLOBALS['BE_USER']->uc['titleLen']);
2044 $picon='<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/i/_icon_webfolders.gif','width="18" height="16"').' alt="" />';
2045 $picon.=htmlspecialchars(t3lib_div::fixed_lgd_cs(basename($expandFolder),$titleLen));
2046 $picon='<a href="#" onclick="return link_folder(\''.t3lib_div::rawUrlEncodeFP(substr($expandFolder,strlen(PATH_site))).'\');">'.$picon.'</a>';
2047 if ($this->curUrlInfo['act'] == 'folder' && $cmpPath == $expandFolder) {
2048 $out.= '<img'.t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/blinkarrow_left.gif', 'width="5" height="9"') . ' class="c-blinkArrowL" alt="" />';
2049 }
2050 $out.=$picon.'<br />';
2051
2052 // Get files from the folder:
2053 if ($this->mode == 'wizard' && $this->act == 'folder') {
2054 $files = t3lib_div::get_dirs($expandFolder);
2055 } else {
2056 $files = t3lib_div::getFilesInDir($expandFolder, $extensionList, 1, 1); // $extensionList='', $prependPath=0, $order='')
2057 }
2058
2059 $c=0;
2060 $cc=count($files);
2061 if (is_array($files)) {
2062 foreach($files as $filepath) {
2063 $c++;
2064 $fI=pathinfo($filepath);
2065
2066 if ($this->mode == 'wizard' && $this->act == 'folder') {
2067 $filepath = $expandFolder.$filepath.'/';
2068 $icon = '<img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/i/_icon_webfolders.gif', 'width="18" height="16"') . ' alt="" />';
2069 } else {
2070 // File icon:
2071 $icon = t3lib_BEfunc::getFileIcon(strtolower($fI['extension']));
2072
2073 // Get size and icon:
2074 $size = ' (' . t3lib_div::formatSize(filesize($filepath)) . 'bytes)';
2075 $icon = '<img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/fileicons/' . $icon . '', 'width="18" height="16"') . ' title="' . htmlspecialchars($fI['basename'] . $size) . '" alt="" />';
2076 }
2077
2078 // If the listed file turns out to be the CURRENT file, then show blinking arrow:
2079 if (($this->curUrlInfo['act'] == 'file' || $this->curUrlInfo['act'] == 'folder') && $cmpPath == $filepath) {
2080 $arrCol='<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/blinkarrow_left.gif','width="5" height="9"').' class="c-blinkArrowL" alt="" />';
2081 } else {
2082 $arrCol='';
2083 }
2084
2085 // Put it all together for the file element:
2086 $out.='<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/ol/join'.($c==$cc?'bottom':'').'.gif','width="18" height="16"').' alt="" />'.
2087 $arrCol.
2088 '<a href="#" onclick="return link_folder(\''.t3lib_div::rawUrlEncodeFP(substr($filepath,strlen(PATH_site))).'\');">'.
2089 $icon.
2090 htmlspecialchars(t3lib_div::fixed_lgd_cs(basename($filepath),$titleLen)).
2091 '</a><br />';
2092 }
2093 }
2094 }
2095 return $out;
2096 }
2097
2098 /**
2099 * For TYPO3 Element Browser: Expand folder of files.
2100 *
2101 * @param string The folder path to expand
2102 * @param string List of fileextensions to show
2103 * @param boolean Whether to show thumbnails or not. If set, no thumbnails are shown.
2104 * @return string HTML output
2105 */
2106 function TBE_expandFolder($expandFolder=0,$extensionList='',$noThumbs=0) {
2107 global $LANG;
2108
2109 $extensionList = ($extensionList == '*') ? '' : $extensionList;
2110 $expandFolder = $expandFolder ? $expandFolder : $this->expandFolder;
2111 $out='';
2112 if ($expandFolder && $this->checkFolder($expandFolder)) {
2113 // Listing the files:
2114 $files = t3lib_div::getFilesInDir($expandFolder,$extensionList,1,1); // $extensionList="",$prependPath=0,$order='')
2115 $out.= $this->fileList($files, $expandFolder, $noThumbs);
2116 }
2117
2118 // Return accumulated content for filelisting:
2119 return $out;
2120 }
2121
2122 /**
2123 * Render list of files.
2124 *
2125 * @param array List of files. See t3lib_div::getFilesInDir
2126 * @param string If set a header with a folder icon and folder name are shown
2127 * @param boolean Whether to show thumbnails or not. If set, no thumbnails are shown.
2128 * @return string HTML output
2129 */
2130 function fileList($files, $folderName='', $noThumbs=0) {
2131 global $LANG, $BACK_PATH;
2132
2133 $out='';
2134
2135 // Listing the files:
2136 if (is_array($files)) {
2137
2138 // Create headline (showing number of files):
2139 $filesCount = count($files);
2140 $out.=$this->barheader(sprintf($GLOBALS['LANG']->getLL('files').' (%s):', $filesCount));
2141 $out.=$this->getBulkSelector($filesCount);
2142
2143 $titleLen=intval($GLOBALS['BE_USER']->uc['titleLen']);
2144
2145 // Create the header of current folder:
2146 if($folderName) {
2147 $picon='<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/i/_icon_webfolders.gif','width="18" height="16"').' alt="" />';
2148 $picon.=htmlspecialchars(t3lib_div::fixed_lgd_cs(basename($folderName),$titleLen));
2149 $out.=$picon.'<br />';
2150 }
2151
2152 // Init graphic object for reading file dimensions:
2153 $imgObj = t3lib_div::makeInstance('t3lib_stdGraphic');
2154 $imgObj->init();
2155 $imgObj->mayScaleUp=0;
2156 $imgObj->tempPath=PATH_site.$imgObj->tempPath;
2157
2158 // Traverse the file list:
2159 $lines=array();
2160 foreach($files as $filepath) {
2161 $fI=pathinfo($filepath);
2162
2163 // Thumbnail/size generation:
2164 if (t3lib_div::inList(strtolower($GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext']),strtolower($fI['extension'])) && !$noThumbs) {
2165 $imgInfo = $imgObj->getImageDimensions($filepath);
2166 $pDim = $imgInfo[0].'x'.$imgInfo[1].' pixels';
2167 $clickIcon = t3lib_BEfunc::getThumbNail($BACK_PATH.'thumbs.php',$filepath,'hspace="5" vspace="5" border="1"');
2168 } else {
2169 $clickIcon = '';
2170 $pDim = '';
2171 }
2172
2173 // Create file icon:
2174 $ficon = t3lib_BEfunc::getFileIcon(strtolower($fI['extension']));
2175 $size=' ('.t3lib_div::formatSize(filesize($filepath)).'bytes'.($pDim?', '.$pDim:'').')';
2176 $icon = '<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/fileicons/'.$ficon,'width="18" height="16"').' title="'.htmlspecialchars($fI['basename'].$size).'" class="absmiddle" alt="" />';
2177
2178 // Create links for adding the file:
2179 if (strstr($filepath,',') || strstr($filepath,'|')) { // In case an invalid character is in the filepath, display error message:
2180 $eMsg = $LANG->JScharCode(sprintf($LANG->getLL('invalidChar'),', |'));
2181 $ATag = $ATag_alt = "<a href=\"#\" onclick=\"alert(".$eMsg.");return false;\">";
2182 $bulkCheckBox = '';
2183 } else { // If filename is OK, just add it:
2184 $filesIndex = count($this->elements);
2185 $this->elements['file_'.$filesIndex] = array(
2186 'md5' => t3lib_div::shortMD5($filepath),
2187 'type' => 'file',
2188 'fileName' => $fI['basename'],
2189 'filePath' => $filepath,
2190 'fileExt' => $fI['extension'],
2191 'fileIcon' => $ficon,
2192 );
2193 $ATag = "<a href=\"#\" onclick=\"return BrowseLinks.File.insertElement('file_$filesIndex');\">";
2194 $ATag_alt = substr($ATag,0,-4).",1);\">";
2195 $bulkCheckBox = '<input type="checkbox" class="typo3-bulk-item" name="file_'.$filesIndex.'" value="0" /> ';
2196 }
2197 $ATag_e='</a>';
2198
2199 // Create link to showing details about the file in a window:
2200 $Ahref = $BACK_PATH.'show_item.php?table='.rawurlencode($filepath).'&returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'));
2201 $ATag2='<a href="'.htmlspecialchars($Ahref).'">';
2202 $ATag2_e='</a>';
2203
2204 // Combine the stuff:
2205 $filenameAndIcon=$bulkCheckBox.$ATag_alt.$icon.htmlspecialchars(t3lib_div::fixed_lgd_cs(basename($filepath),$titleLen)).$ATag_e;
2206
2207 // Show element:
2208 if ($pDim) { // Image...
2209 $lines[]='
2210 <tr class="bgColor4">
2211 <td nowrap="nowrap">'.$filenameAndIcon.'&nbsp;</td>
2212 <td>'.$ATag.'<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/plusbullet2.gif','width="18" height="16"').' title="'.$LANG->getLL('addToList',1).'" alt="" />'.$ATag_e.'</td>
2213 <td nowrap="nowrap">'.($ATag2.'<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/zoom2.gif','width="12" height="12"').' title="'.$LANG->getLL('info',1).'" alt="" /> '.$LANG->getLL('info',1).$ATag2_e).'</td>
2214 <td nowrap="nowrap">&nbsp;'.$pDim.'</td>
2215 </tr>';
2216 $lines[]='
2217 <tr>
2218 <td colspan="4">'.$ATag_alt.$clickIcon.$ATag_e.'</td>
2219 </tr>';
2220 } else {
2221 $lines[]='
2222 <tr class="bgColor4">
2223 <td nowrap="nowrap">'.$filenameAndIcon.'&nbsp;</td>
2224 <td>'.$ATag.'<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/plusbullet2.gif','width="18" height="16"').' title="'.$LANG->getLL('addToList',1).'" alt="" />'.$ATag_e.'</td>
2225 <td nowrap="nowrap">'.($ATag2.'<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/zoom2.gif','width="12" height="12"').' title="'.$LANG->getLL('info',1).'" alt="" /> '.$LANG->getLL('info',1).$ATag2_e).'</td>
2226 <td>&nbsp;</td>
2227 </tr>';
2228 }
2229 $lines[]='
2230 <tr>
2231 <td colspan="3"><img src="clear.gif" width="1" height="3" alt="" /></td>
2232 </tr>';
2233 }
2234
2235 // Wrap all the rows in table tags:
2236 $out.='
2237
2238
2239
2240 <!--
2241 File listing
2242 -->
2243 <table cellpadding="0" cellspacing="0" id="typo3-fileList">
2244 '.implode('',$lines).'
2245 </table>';
2246 }
2247 // Return accumulated content for filelisting:
2248 return $out;
2249 }
2250
2251 /**
2252 * Render list of folders.
2253 *
2254 * @param array List of folders. See t3lib_div::get_dirs
2255 * @param string If set a header with a folder icon and folder name are shown
2256 * @return string HTML output
2257 */
2258 function folderList($baseFolder, $folders) {
2259 global $LANG, $BACK_PATH;
2260
2261 $content = '';
2262
2263 // Create headline (showing number of folders):
2264 $content.=$this->barheader(
2265 sprintf($GLOBALS['LANG']->getLL('folders').' (%s):',count($folders))
2266 );
2267
2268 $titleLength = intval($GLOBALS['BE_USER']->uc['titleLen']);
2269
2270 // Create the header of current folder:
2271 if($baseFolder) {
2272 if (strstr($baseFolder, ',') || strstr($baseFolder, '|')) {
2273 // In case an invalid character is in the filepath, display error message:
2274 $errorMessage = $LANG->JScharCode(sprintf($LANG->getLL('invalidChar'),', |'));
2275 $aTag = $aTag_alt = "<a href=\"#\" onclick=\"alert(".$errorMessage.");return false;\">";
2276 } else {
2277 // If foldername is OK, just add it:
2278 $aTag = "<a href=\"#\" onclick=\"return insertElement('','".rawurlencode($baseFolder)."', 'folder', '".rawurlencode($baseFolder)."', unescape('".rawurlencode($baseFolder)."'), '".$fI['extension']."', '".$ficon."');\">";
2279 $aTag_alt = substr($aTag,0,-4).",'',1);\">";
2280 }
2281 $aTag_e = '</a>';
2282
2283 // add the foder icon
2284 $folderIcon = $aTag_alt;
2285 $folderIcon.= '<img'.t3lib_iconWorks::skinImg(
2286 $BACK_PATH,
2287 'gfx/i/_icon_webfolders.gif','width="18" height="16"'
2288 ).' alt="" />';
2289 $folderIcon.= htmlspecialchars(
2290 t3lib_div::fixed_lgd_cs(basename($baseFolder),$titleLength)
2291 );
2292 $folderIcon.= $aTag_e;
2293
2294 $content.=$folderIcon.'<br />';
2295 }
2296
2297 // Listing the folders:
2298 if(is_array($folders)) {
2299 if(count($folders) > 0) {
2300 // Traverse the folder list:
2301 $lines = array();
2302 foreach($folders as $folderPath) {
2303 $pathInfo = pathinfo($folderPath);
2304
2305 // Create folder icon:
2306 $icon = '<img src="clear.gif" width="16" height="16" alt="" /><img'.t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/i/_icon_webfolders.gif','width="16" height="16"').' title="'.htmlspecialchars($pathInfo['basename'].$size).'" class="absmiddle" alt="" />';
2307
2308 // Create links for adding the folder:
2309 if($this->P['itemName'] != '' && $this->P['formName'] != '') {
2310 $aTag = "<a href=\"#\" onclick=\"return set_folderpath(unescape('".rawurlencode($folderPath)."'));\">";
2311 } else {
2312 $aTag = "<a href=\"#\" onclick=\"return insertElement('','".rawurlencode($folderPath)."', 'folder', '".rawurlencode($folderPath)."', unescape('".rawurlencode($folderPath)."'), '".$pathInfo['extension']."', '".$ficon."');\">";
2313 }
2314
2315 if (strstr($folderPath,',') || strstr($folderPath,'|')) {
2316 // In case an invalid character is in the filepath, display error message:
2317 $errorMessage = $LANG->JScharCode(sprintf($LANG->getLL('invalidChar'),', |'));
2318 $aTag = $aTag_alt = "<a href=\"#\" onclick=\"alert(".$errorMessage.");return false;\">";
2319 } else {
2320 // If foldername is OK, just add it:
2321 $aTag_alt = substr($aTag,0,-4).",'',1);\">";
2322 }
2323 $aTag_e='</a>';
2324
2325 // Combine icon and folderpath:
2326 $foldernameAndIcon = $aTag_alt.$icon.htmlspecialchars(
2327 t3lib_div::fixed_lgd_cs(basename($folderPath),$titleLength)
2328 ).$aTag_e;
2329
2330 if($this->P['itemName'] != '') {
2331 $lines[] = '
2332 <tr class="bgColor4">
2333 <td nowrap="nowrap">'.$foldernameAndIcon.'&nbsp;</td>
2334 <td>&nbsp;</td>
2335 </tr>';
2336 } else {
2337 $lines[] = '
2338 <tr class="bgColor4">
2339 <td nowrap="nowrap">'.$foldernameAndIcon.'&nbsp;</td>
2340 <td>'.$aTag.'<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/plusbullet2.gif','width="18" height="16"').' title="'.$LANG->getLL('addToList',1).'" alt="" />'.$aTag_e.'</td>
2341 <td>&nbsp;</td>
2342 </tr>';
2343 }
2344
2345 $lines[] = '
2346 <tr>
2347 <td colspan="3"><img src="clear.gif" width="1" height="3" alt="" /></td>
2348 </tr>';
2349 }
2350 }
2351
2352 // Wrap all the rows in table tags:
2353 $content.='
2354
2355 <!--
2356 Folder listing
2357 -->
2358 <table border="0" cellpadding="0" cellspacing="1" id="typo3-folderList">
2359 '.implode('', $lines).'
2360 </table>';
2361 }
2362
2363 // Return accumulated content for folderlisting:
2364 return $content;
2365 }
2366
2367 /**
2368 * For RTE: This displays all IMAGES (gif,png,jpg) (from extensionList) from folder. Thumbnails are shown for images.
2369 * This listing is of images located in the web-accessible paths ONLY - the listing is for drag-n-drop use in the RTE
2370 *
2371 * @param string The folder path to expand
2372 * @param string List of fileextensions to show
2373 * @return string HTML output
2374 */
2375 function TBE_dragNDrop($expandFolder=0,$extensionList='') {
2376 global $BACK_PATH;
2377
2378 $extensionList = ($extensionList == '*') ? '' : $extensionList;
2379 $expandFolder = $expandFolder ? $expandFolder : $this->expandFolder;
2380 $out='';
2381 if ($expandFolder && $this->checkFolder($expandFolder)) {
2382 if ($this->isWebFolder($expandFolder)) {
2383
2384 // Read files from directory:
2385 $files = t3lib_div::getFilesInDir($expandFolder,$extensionList,1,1); // $extensionList="",$prependPath=0,$order='')
2386 if (is_array($files)) {
2387 $out.=$this->barheader(sprintf($GLOBALS['LANG']->getLL('files').' (%s):',count($files)));
2388
2389 $titleLen=intval($GLOBALS['BE_USER']->uc['titleLen']);
2390 $picon='<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/i/_icon_webfolders.gif','width="18" height="16"').' alt="" />';
2391 $picon.=htmlspecialchars(t3lib_div::fixed_lgd_cs(basename($expandFolder),$titleLen));
2392 $out.=$picon.'<br />';
2393
2394 // Init row-array:
2395 $lines=array();
2396
2397 // Add "drag-n-drop" message:
2398 $lines[]='
2399 <tr>
2400 <td colspan="2">'.$this->getMsgBox($GLOBALS['LANG']->getLL('findDragDrop')).'</td>
2401 </tr>';
2402
2403 // Traverse files:
2404 foreach ($files as $filepath) {
2405 $fI = pathinfo($filepath);
2406
2407 // URL of image:
2408 $iurl = $this->siteURL.t3lib_div::rawurlencodeFP(substr($filepath,strlen(PATH_site)));
2409
2410 // Show only web-images
2411 if (t3lib_div::inList('gif,jpeg,jpg,png',strtolower($fI['extension']))) {
2412 $imgInfo = @getimagesize($filepath);
2413 $pDim = $imgInfo[0].'x'.$imgInfo[1].' pixels';
2414
2415 $ficon = t3lib_BEfunc::getFileIcon(strtolower($fI['extension']));
2416 $size=' ('.t3lib_div::formatSize(filesize($filepath)).'bytes'.($pDim?', '.$pDim:'').')';
2417 $icon = '<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/fileicons/'.$ficon,'width="18" height="16"').' class="absmiddle" title="'.htmlspecialchars($fI['basename'].$size).'" alt="" />';
2418 $filenameAndIcon=$icon.htmlspecialchars(t3lib_div::fixed_lgd_cs(basename($filepath),$titleLen));
2419
2420 if (t3lib_div::_GP('noLimit')) {
2421 $maxW=10000;
2422 $maxH=10000;
2423 } else {
2424 $maxW=380;
2425 $maxH=500;
2426 }
2427 $IW = $imgInfo[0];
2428 $IH = $imgInfo[1];
2429 if ($IW>$maxW) {
2430 $IH=ceil($IH/$IW*$maxW);
2431 $IW=$maxW;
2432 }
2433 if ($IH>$maxH) {
2434 $IW=ceil($IW/$IH*$maxH);
2435 $IH=$maxH;
2436 }
2437
2438 // Make row:
2439 $lines[]='
2440 <tr class="bgColor4">
2441 <td nowrap="nowrap">'.$filenameAndIcon.'&nbsp;</td>
2442 <td nowrap="nowrap">'.
2443 ($imgInfo[0]!=$IW ? '<a href="'.htmlspecialchars(t3lib_div::linkThisScript(array('noLimit'=>'1'))).'">'.
2444 '<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/icon_warning2.gif','width="18" height="16"').' title="'.$GLOBALS['LANG']->getLL('clickToRedrawFullSize',1).'" alt="" />'.
2445 '</a>':'').
2446 $pDim.'&nbsp;</td>
2447 </tr>';
2448
2449 $lines[]='
2450 <tr>
2451 <td colspan="2"><img src="'.$iurl.'" width="'.$IW.'" height="'.$IH.'" border="1" alt="" /></td>
2452 </tr>';
2453 $lines[]='
2454 <tr>
2455 <td colspan="2"><img src="clear.gif" width="1" height="3" alt="" /></td>
2456 </tr>';
2457 }
2458 }
2459
2460 // Finally, wrap all rows in a table tag:
2461 $out.='
2462
2463
2464 <!--
2465 File listing / Drag-n-drop
2466 -->
2467 <table border="0" cellpadding="0" cellspacing="1" id="typo3-dragBox">
2468 '.implode('',$lines).'
2469 </table>';
2470 }
2471 } else {
2472 // Print this warning if the folder is NOT a web folder:
2473 $out.=$this->barheader($GLOBALS['LANG']->getLL('files'));
2474 $out.=$this->getMsgBox($GLOBALS['LANG']->getLL('noWebFolder'),'icon_warning2');
2475 }
2476 }
2477 return $out;
2478 }
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491 /******************************************************************
2492 *
2493 * Miscellaneous functions
2494 *
2495 ******************************************************************/
2496
2497
2498 /**
2499 * Verifies that a path is a web-folder:
2500 *
2501 * @param string Absolute filepath
2502 * @return boolean If the input path is found in PATH_site then it returns true.
2503 */
2504 function isWebFolder($folder) {
2505 $folder = rtrim($folder, '/').'/';
2506 return t3lib_div::isFirstPartOfStr($folder,PATH_site) ? TRUE : FALSE;
2507 }
2508
2509 /**
2510 * Checks, if a path is within the mountpoints of the backend user
2511 *
2512 * @param string Absolute filepath
2513 * @return boolean If the input path is found in the backend users filemounts, then return true.
2514 */
2515 function checkFolder($folder) {
2516 return $this->fileProcessor->checkPathAgainstMounts(rtrim($folder, '/') . '/') ? true : false;
2517 }
2518
2519 /**
2520 * Checks, if a path is within a read-only mountpoint of the backend user
2521 *
2522 * @param string Absolute filepath
2523 * @return boolean If the input path is found in the backend users filemounts and if the filemount is of type readonly, then return true.
2524 */
2525 function isReadOnlyFolder($folder) {
2526 return ($GLOBALS['FILEMOUNTS'][$this->fileProcessor->checkPathAgainstMounts(rtrim($folder, '/') . '/')]['type'] == 'readonly');
2527 }
2528
2529 /**
2530 * Prints a 'header' where string is in a tablecell
2531 *
2532 * @param string The string to print in the header. The value is htmlspecialchars()'ed before output.
2533 * @return string The header HTML (wrapped in a table)
2534 */
2535 function barheader($str) {
2536 return '
2537 <!-- Bar header: -->
2538 <h3>' . htmlspecialchars($str) . '</h3>
2539 ';
2540 }
2541
2542 /**
2543 * Displays a message box with the input message
2544 *
2545 * @param string Input message to show (will be htmlspecialchars()'ed inside of this function)
2546 * @param string Icon filename body from gfx/ (default is "icon_note") - meant to allow change to warning type icons...
2547 * @return string HTML for the message (wrapped in a table).
2548 */
2549 function getMsgBox($in_msg,$icon='icon_note') {
2550 global $BACK_PATH;
2551
2552 $msg = '<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/'.$icon.'.gif','width="18" height="16"').' alt="" />'.htmlspecialchars($in_msg);
2553 $msg = '
2554
2555 <!--
2556 Message box:
2557 -->
2558 <table cellspacing="0" class="bgColor4" id="typo3-msgBox">
2559 <tr>
2560 <td>'.$msg.'</td>
2561 </tr>
2562 </table>
2563 ';
2564 return $msg;
2565 }
2566
2567 /**
2568 * For RTE/link: This prints the 'currentUrl'
2569 *
2570 * @param string URL value. The value is htmlspecialchars()'ed before output.
2571 * @return string HTML content, wrapped in a table.
2572 */
2573 function printCurrentUrl($str) {
2574 if (strlen($str)) {
2575 return '
2576 <!-- Print current URL -->
2577 <table border="0" cellpadding="0" cellspacing="0" id="typo3-curUrl">
2578 <tr>
2579 <td>' . $GLOBALS['LANG']->getLL('currentLink',1) . ': ' .htmlspecialchars(rawurldecode($str)) . '</td>
2580 </tr>
2581 </table>';
2582 } else {
2583 return '';
2584 }
2585 }
2586
2587 /**
2588 * For RTE/link: Parses the incoming URL and determines if it's a page, file, external or mail address.
2589 *
2590 * @param string HREF value tp analyse
2591 * @param string The URL of the current website (frontend)
2592 * @return array Array with URL information stored in assoc. keys: value, act (page, file, spec, mail), pageid, cElement, info
2593 */
2594 function parseCurUrl($href,$siteUrl) {
2595 $href = trim($href);
2596 if ($href) {
2597 $info=array();
2598
2599 // Default is "url":
2600 $info['value']=$href;
2601 $info['act']='url';
2602
2603 $specialParts = explode('#_SPECIAL',$href);
2604 if (count($specialParts)==2) { // Special kind (Something RTE specific: User configurable links through: "userLinks." from ->thisConfig)
2605 $info['value']='#_SPECIAL'.$specialParts[1];
2606 $info['act']='spec';
2607 } elseif (t3lib_div::isFirstPartOfStr($href,$siteUrl)) { // If URL is on the current frontend website:
2608 $rel = substr($href,strlen($siteUrl));
2609 if (file_exists(PATH_site.rawurldecode($rel))) { // URL is a file, which exists:
2610 $info['value']=rawurldecode($rel);
2611 if (@is_dir(PATH_site . $info['value'])) {
2612 $info['act'] = 'folder';
2613 } else {
2614 $info['act'] = 'file';
2615 }
2616 } else { // URL is a page (id parameter)
2617 $uP=parse_url($rel);
2618 if (!trim($uP['path'])) {
2619 $pp = preg_split('/^id=/', $uP['query']);
2620 $pp[1] = preg_replace( '/&id=[^&]*/', '', $pp[1]);
2621 $parameters = explode('&', $pp[1]);
2622 $id = array_shift($parameters);
2623 if ($id) {
2624 // Checking if the id-parameter is an alias.
2625 if (!t3lib_div::testInt($id)) {
2626 list($idPartR) = t3lib_BEfunc::getRecordsByField('pages','alias',$id);
2627 $id=intval($idPartR['uid']);
2628 }
2629
2630 $pageRow = t3lib_BEfunc::getRecordWSOL('pages',$id);
2631 $titleLen=intval($GLOBALS['BE_USER']->uc['titleLen']);
2632 $info['value']=$GLOBALS['LANG']->getLL('page',1)." '".htmlspecialchars(t3lib_div::fixed_lgd_cs($pageRow['title'],$titleLen))."' (ID:".$id.($uP['fragment']?', #'.$uP['fragment']:'').')';
2633 $info['pageid']=$id;
2634 $info['cElement']=$uP['fragment'];
2635 $info['act']='page';
2636 $info['query'] = $parameters[0]?'&'.implode('&', $parameters):'';
2637 }
2638 }
2639 }
2640 } else { // Email link:
2641 if (strtolower(substr($href,0,7))=='mailto:') {
2642 $info['value']=trim(substr($href,7));
2643 $info['act']='mail';
2644 }
2645 }
2646 $info['info'] = $info['value'];
2647 } else { // NO value inputted:
2648 $info=array();
2649 $info['info']=$GLOBALS['LANG']->getLL('none');
2650 $info['value']='';
2651 $info['act']='page';
2652 }
2653
2654 // let the hook have a look
2655 foreach($this->hookObjects as $hookObject) {
2656 $info = $hookObject->parseCurrentUrl($href, $siteUrl, $info);
2657 }
2658
2659 return $info;
2660 }
2661
2662 /**
2663 * For TBE: Makes an upload form for uploading files to the filemount the user is browsing.
2664 * The files are uploaded to the tce_file.php script in the core which will handle the upload.
2665 *
2666 * @param string Absolute filepath on server to which to upload.
2667 * @return string HTML for an upload form.
2668 */
2669 function uploadForm($path) {
2670 global $BACK_PATH;
2671
2672 if ($this->isReadOnlyFolder($path)) return '';
2673
2674 // Read configuration of upload field count
2675 $userSetting = $GLOBALS['BE_USER']->getTSConfigVal('options.folderTree.uploadFieldsInLinkBrowser');
2676 $count = isset($userSetting) ? $userSetting : 3;
2677 if ($count === '0') {
2678 return '';
2679 }
2680 $count = intval($count) == 0 ? 3 : intval($count);
2681
2682 // Create header, showing upload path:
2683 $header = t3lib_div::isFirstPartOfStr($path,PATH_site)?substr($path,strlen(PATH_site)):$path;
2684 $code=$this->barheader($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:file_upload.php.pagetitle',1).':');
2685 $code.='
2686
2687 <!--
2688 Form, for uploading files:
2689 -->
2690 <form action="'.$BACK_PATH.'tce_file.php" method="post" name="editform" enctype="'.$GLOBALS['TYPO3_CONF_VARS']['SYS']['form_enctype'].'">
2691 <table border="0" cellpadding="0" cellspacing="3" id="typo3-uplFiles">
2692 <tr>
2693 <td><strong>'.$GLOBALS['LANG']->getLL('path',1).':</strong> '.htmlspecialchars($header).'</td>
2694 </tr>
2695 <tr>
2696 <td>';
2697
2698 // Traverse the number of upload fields (default is 3):
2699 for ($a=1;$a<=$count;$a++) {
2700 $code.='<input type="file" name="upload_'.$a.'"'.$this->doc->formWidth(35).' size="50" />
2701 <input type="hidden" name="file[upload]['.$a.'][target]" value="'.htmlspecialchars($path).'" />
2702 <input type="hidden" name="file[upload]['.$a.'][data]" value="'.$a.'" /><br />';
2703 }
2704
2705 // Make footer of upload form, including the submit button:
2706 $redirectValue = $this->thisScript.'?act='.$this->act.'&mode='.$this->mode.'&expandFolder='.rawurlencode($path).'&bparams='.rawurlencode($this->bparams);
2707 $code.='<input type="hidden" name="redirect" value="'.htmlspecialchars($redirectValue).'" />'.
2708 '<input type="submit" name="submit" value="'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:file_upload.php.submit',1).'" />';
2709
2710 $code.='
2711 <div id="c-override">
2712 <input type="checkbox" name="overwriteExistingFiles" id="overwriteExistingFiles" value="1" /> <label for="overwriteExistingFiles">'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_misc.xml:overwriteExistingFiles',1).'</label>
2713 </div>
2714 ';
2715
2716
2717 $code.='</td>
2718 </tr>
2719 </table>
2720 </form>';
2721
2722 return $code;
2723 }
2724
2725 /**
2726 * For TBE: Makes a form for creating new folders in the filemount the user is browsing.
2727 * The folder creation request is sent to the tce_file.php script in the core which will handle the creation.
2728 *
2729 * @param string Absolute filepath on server in which to create the new folder.
2730 * @return string HTML for the create folder form.
2731 */
2732 function createFolder($path) {
2733 global $BACK_PATH;
2734
2735 if ($this->isReadOnlyFolder($path)) return '';
2736
2737 // Don't show Folder-create form if it's denied
2738 if ($GLOBALS['BE_USER']->getTSConfigVal('options.folderTree.hideCreateFolder')) {
2739 return '';
2740 }
2741 // Create header, showing upload path:
2742 $header = t3lib_div::isFirstPartOfStr($path,PATH_site)?substr($path,strlen(PATH_site)):$path;
2743 $code=$this->barheader($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:file_newfolder.php.pagetitle').':');
2744 $code.='
2745
2746 <!--
2747 Form, for creating new folders:
2748 -->
2749 <form action="'.$BACK_PATH.'tce_file.php" method="post" name="editform2">
2750 <table border="0" cellpadding="0" cellspacing="3" id="typo3-crFolder">
2751 <tr>
2752 <td><strong>'.$GLOBALS['LANG']->getLL('path',1).':</strong> '.htmlspecialchars($header).'</td>
2753 </tr>
2754 <tr>
2755 <td>';
2756
2757 // Create the new-folder name field:
2758 $a=1;
2759 $code.='<input'.$this->doc->formWidth(20).' type="text" name="file[newfolder]['.$a.'][data]" />'.
2760 '<input type="hidden" name="file[newfolder]['.$a.'][target]" value="'.htmlspecialchars($path).'" />';
2761
2762 // Make footer of upload form, including the submit button:
2763 $redirectValue = $this->thisScript.'?act='.$this->act.'&mode='.$this->mode.'&expandFolder='.rawurlencode($path).'&bparams='.rawurlencode($this->bparams);
2764 $code.='<input type="hidden" name="redirect" value="'.htmlspecialchars($redirectValue).'" />'.
2765 '<input type="submit" name="submit" value="'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:file_newfolder.php.submit',1).'" />';
2766
2767 $code.='</td>
2768 </tr>
2769 </table>
2770 </form>';
2771
2772 return $code;
2773 }
2774
2775 /**
2776 * Get the HTML data required for a bulk selection of files of the TYPO3 Element Browser.
2777 *
2778 * @param integer $filesCount: Number of files currently displayed
2779 * @return string HTML data required for a bulk selection of files - if $filesCount is 0, nothing is returned
2780 */
2781 function getBulkSelector($filesCount) {
2782 if ($filesCount) {
2783 $labelToggleSelection = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_browse_links.php:toggleSelection',1);
2784 $labelImportSelection = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_browse_links.php:importSelection',1);
2785
2786 $out = $this->doc->spacer(15).'<div>' .
2787 '<a href="#" onclick="BrowseLinks.Selector.toggle()">' .
2788 '<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/clip_select.gif','width="12" height="12"').' title="'.$labelToggleSelection.'" alt="" /> ' .
2789 $labelToggleSelection.'</a>'.$this->doc->spacer(5) .
2790 '<a href="#" onclick="BrowseLinks.Selector.handle()">' .
2791 '<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/import.gif','width="12" height="12"').' title="'.$labelImportSelection.'" alt="" /> ' .
2792 $labelImportSelection.'</a>' .
2793 '</div>'.$this->doc->spacer(15);
2794 }
2795 return $out;
2796 }
2797
2798 /**
2799 * Determines whether submitted field change functions are valid
2800 * and are coming from the system and not from an external abuse.
2801 *
2802 * @param boolean $allowFlexformSections Whether to handle flexform sections differently
2803 * @return boolean Whether the submitted field change functions are valid
2804 */
2805 protected function areFieldChangeFunctionsValid($handleFlexformSections = FALSE) {
2806 $result = FALSE;
2807
2808 if (isset($this->P['fieldChangeFunc']) && is_array($this->P['fieldChangeFunc']) && isset($this->P['fieldChangeFuncHash'])) {
2809 $matches = array();
2810 $pattern = '#\[el\]\[(([^]-]+-[^]-]+-)(idx\d+-)([^]]+))\]#i';
2811
2812 $fieldChangeFunctions = $this->P['fieldChangeFunc'];
2813
2814 // Special handling of flexform sections:
2815 // Field change functions are modified in JavaScript, thus the hash is always invalid
2816 if ($handleFlexformSections && preg_match($pattern, $this->P['itemName'], $matches)) {
2817 $originalName = $matches[1];
2818 $cleanedName = $matches[2] . $matches[4];
2819
2820 foreach ($fieldChangeFunctions as &$value) {
2821 $value = str_replace($originalName, $cleanedName, $value);
2822 }
2823 }
2824
2825 $result = ($this->P['fieldChangeFuncHash'] === t3lib_div::hmac(serialize($fieldChangeFunctions)));
2826 }
2827
2828 return $result;
2829 }
2830 }
2831
2832
2833 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/class.browse_links.php']) {
2834 include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/class.browse_links.php']);
2835 }
2836
2837 ?>