Added more comments, $Id$ keywords etc for the whole core of TYPO3.
[Packages/TYPO3.CMS.git] / typo3 / browse_links.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 1999-2003 Kasper Skaarhoj (kasper@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 *
31 * $Id$
32 * Revised for TYPO3 3.6 July/2003 by Kasper Skaarhoj
33 * XHTML compliant
34 *
35 * @author Kasper Skaarhoj <kasper@typo3.com>
36 */
37 /**
38 * [CLASS/FUNCTION INDEX of SCRIPT]
39 *
40 *
41 *
42 * 152: class TBE_browser_recordList extends localRecordList
43 * 161: function listURL($altId='',$table=-1,$exclList='')
44 * 180: function ext_addP()
45 * 197: function linkWrapItems($table,$uid,$code,$row)
46 *
47 *
48 * 233: class localPageTree extends t3lib_browseTree
49 * 235: function localPageTree()
50 * 245: function wrapTitle($title,$v,$ext_pArrPages)
51 * 261: function printTree($treeArr="")
52 * 289: function ext_isLinkable($doktype,$uid)
53 * 303: function PM_ATagWrap($icon,$cmd,$bMark="")
54 * 318: function wrapIcon($icon,$row)
55 *
56 *
57 * 334: class rtePageTree extends localPageTree
58 *
59 *
60 * 348: class TBE_PageTree extends localPageTree
61 * 355: function ext_isLinkable($doktype,$uid)
62 * 367: function wrapTitle($title,$v,$ext_pArrPages)
63 *
64 *
65 * 390: class localFolderTree extends t3lib_folderTree
66 * 397: function wrapTitle($title,$v)
67 * 412: function printTree($treeArr="")
68 * 446: function ext_isLinkable($v)
69 * 464: function PM_ATagWrap($icon,$cmd,$bMark="")
70 * 478: function ext_getRelFolder($path)
71 *
72 *
73 * 495: class rteFolderTree extends localFolderTree
74 *
75 *
76 * 507: class TBE_FolderTree extends localFolderTree
77 * 514: function ext_isLinkable($v)
78 * 527: function wrapTitle($title,$v)
79 *
80 *
81 * 547: class SC_browse_links
82 * 559: function init()
83 * 791: function main()
84 * 841: function printContent()
85 *
86 * SECTION: OTHER FUNCTIONS: These functions are designed to display the records from a page
87 * 858: function expandPage()
88 * 894: function TBE_expandPage($tables)
89 * 997: function isWebFolder($folder)
90 * 1008: function checkFolder($folder)
91 *
92 * SECTION: OTHER FUNCTIONS: These functions are designed to display the files from a folder
93 * 1031: function expandFolder($expandFolder=0,$extensionList="")
94 * 1074: function TBE_expandFolder($expandFolder=0,$extensionList="")
95 * 1158: function TBE_dragNDrop($expandFolder=0,$extensionList="")
96 * 1239: function getMsgBox($in_msg,$icon="icon_note")
97 *
98 * SECTION: Miscellaneous functions
99 * 1260: function barheader($str)
100 * 1270: function printCurrentUrl($str)
101 * 1281: function parseCurUrl($href,$siteUrl)
102 * 1342: function uploadForm($path)
103 * 1363: function createFolder($path)
104 * 1391: function main_rte($content="",$wiz=0)
105 * 1557: function main_db($content="")
106 * 1603: function main_file($content="",$mode)
107 *
108 * TOTAL FUNCTIONS: 37
109 * (This index is automatically created/updated by the extension "extdeveval")
110 *
111 */
112 $BACK_PATH='';
113 require ('init.php');
114 require ('template.php');
115 require_once (PATH_t3lib.'class.t3lib_browsetree.php');
116 require_once (PATH_t3lib.'class.t3lib_foldertree.php');
117 require_once (PATH_t3lib.'class.t3lib_stdgraphic.php');
118 require_once (PATH_t3lib.'class.t3lib_basicfilefunc.php');
119 include ('sysext/lang/locallang_browse_links.php');
120
121 // **************************
122 // Functions and classes
123 // **************************
124 require_once (PATH_t3lib.'class.t3lib_page.php');
125 require_once (PATH_t3lib.'class.t3lib_recordlist.php');
126 require_once ('class.db_list.inc');
127 require_once ('class.db_list_extra.inc');
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147 /**
148 * @author Kasper Skaarhoj <kasper@typo3.com>
149 * @package TYPO3
150 * @subpackage core
151 */
152 class TBE_browser_recordList extends localRecordList {
153 var $script='browse_links.php';
154
155 /**
156 * @param [type] $altId: ...
157 * @param [type] $table: ...
158 * @param [type] $exclList: ...
159 * @return [type] ...
160 */
161 function listURL($altId='',$table=-1,$exclList='') {
162 return $this->script.
163 '?id='.(strcmp($altId,'')?$altId:$this->id).
164 '&table='.rawurlencode($table==-1?$this->table:$table).
165 ($this->thumbs?'&imagemode='.$this->thumbs:'').
166 ($this->searchString?'&search_field='.rawurlencode($this->searchString):'').
167 ($this->searchLevels?'&search_levels='.rawurlencode($this->searchLevels):'').
168 ((!$exclList || !t3lib_div::inList($exclList,'sortField')) && $this->sortField?'&sortField='.rawurlencode($this->sortField):'').
169 ((!$exclList || !t3lib_div::inList($exclList,'sortRev')) && $this->sortRev?'&sortRev='.rawurlencode($this->sortRev):'').
170 // extra:
171 $this->ext_addP()
172 ;
173 }
174
175 /**
176 * [Describe function...]
177 *
178 * @return [type] ...
179 */
180 function ext_addP() {
181 $str = '&act='.$GLOBALS['act'].
182 '&mode='.$GLOBALS['mode'].
183 '&expandPage='.t3lib_div::GPvar('expandPage').
184 '&bparams='.rawurlencode(t3lib_div::GPvar('bparams'));
185 return $str;
186 }
187
188 /**
189 * 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...)
190 *
191 * @param [type] $table: ...
192 * @param [type] $uid: ...
193 * @param [type] $code: ...
194 * @param [type] $row: ...
195 * @return [type] ...
196 */
197 function linkWrapItems($table,$uid,$code,$row) {
198 global $TCA;
199
200 if (!$code) {$code='<i>['.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.no_title').']</i>';}
201 $code=t3lib_div::fixed_lgd('&nbsp;'.$code,$this->fixedL);
202
203 $titleCol = $TCA[$table]['ctrl']['label'];
204 $title=$row[$titleCol];
205
206 $ficon=t3lib_iconWorks::getIcon($table,$row);
207 $aOnClick = "return insertElement('".$table."', '".$row['uid']."', 'db', unescape('".rawurlencode($title)."'), '', '', '".$ficon."');";
208 $ATag='<a href="#" onclick="'.htmlspecialchars($aOnClick).'">';
209 $ATag_alt=substr($ATag,0,-4).',\'\',1);">';
210 $ATag_e='</a>';
211
212 return $ATag.
213 '<img src="gfx/plusbullet2.gif" width="18" height="16" border="0" align="top"'.t3lib_BEfunc::titleAttrib($GLOBALS['LANG']->getLL('addToList')).' alt="" />'.
214 $ATag_e.
215 $ATag_alt.
216 $code.
217 $ATag_e;
218 }
219 }
220
221
222
223
224
225
226 /**
227 * Class which generates the page tree
228 *
229 * @author Kasper Skaarhoj <kasper@typo3.com>
230 * @package TYPO3
231 * @subpackage core
232 */
233 class localPageTree extends t3lib_browseTree {
234
235 function localPageTree() {
236 $this->init();
237 }
238
239 /**
240 * @param [type] $title: ...
241 * @param [type] $v: ...
242 * @param [type] $ext_pArrPages: ...
243 * @return [type] ...
244 */
245 function wrapTitle($title,$v,$ext_pArrPages) {
246 $title= (!strcmp(trim($title),'')) ? '<em>['.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.no_title').']</em>' : htmlspecialchars($title);
247
248 if ($this->ext_isLinkable($v['doktype'],$v['uid'])) {
249 return '<a href="#" onclick="return link_typo3Page(\''.$v["uid"].'\');">'.$title.'</a>';
250 } else {
251 return '<font color=#666666>'.$title.'</font>';
252 }
253 }
254
255 /**
256 * [Describe function...]
257 *
258 * @param [type] $treeArr: ...
259 * @return [type] ...
260 */
261 function printTree($treeArr="") {
262 $titleLen=intval($GLOBALS["BE_USER"]->uc["titleLen"]);
263 if (!is_array($treeArr)) $treeArr=$this->tree;
264 reset($treeArr);
265 $out="";
266 $c=0;
267 $xCol = t3lib_div::modifyHTMLColor($GLOBALS["SOBE"]->doc->bgColor,-10,-10,-10);
268 while(list($k,$v)=each($treeArr)) {
269 $c++;
270 $bgColor=' bgColor="'.(($c+1)%2 ? $GLOBALS["SOBE"]->doc->bgColor : $xCol).'"';
271 if ($GLOBALS["curUrlInfo"]["act"]=="page" && $GLOBALS["curUrlInfo"]["pageid"]==$v["row"]["uid"] && $GLOBALS["curUrlInfo"]["pageid"]) {
272 $arrCol='<td><img src="gfx/blinkarrow_right.gif" width="5" height="9" vspace=1></td>';
273 $bgColor=' bgColor="'.$GLOBALS["SOBE"]->doc->bgColor4.'"';
274 } else {$arrCol='<td></td>';}
275 $cEbullet = $this->ext_isLinkable($v["row"]["doktype"],$v["row"]["uid"]) ? '<a href="#" onclick="return jumpToUrl(\''.$this->script.'?act='.$GLOBALS["act"].'&mode='.$GLOBALS["mode"].'&expandPage='.$v["row"]["uid"].'\');"><img src="gfx/ol/arrowbullet.gif" width="18" hspace=5 height="16" border="0"></a>' : '';
276 $out.='<tr'.$bgColor.'><td nowrap>'.$v["HTML"].$this->wrapTitle(t3lib_div::fixed_lgd($v["row"]["title"],$titleLen),$v["row"],$this->ext_pArrPages).'</td>'.$arrCol.'<td>'.$cEbullet.'</td></tr>';
277 }
278 $out='<table border=0 cellpadding=0 cellspacing=0>'.$out.'</table>';
279 return $out;
280 }
281
282 /**
283 * [Describe function...]
284 *
285 * @param [type] $doktype: ...
286 * @param [type] $uid: ...
287 * @return [type] ...
288 */
289 function ext_isLinkable($doktype,$uid) {
290 if ($uid && $doktype<199) {
291 return true;
292 }
293 }
294
295 /**
296 * [Describe function...]
297 *
298 * @param [type] $icon: ...
299 * @param [type] $cmd: ...
300 * @param [type] $bMark: ...
301 * @return [type] ...
302 */
303 function PM_ATagWrap($icon,$cmd,$bMark="") {
304 if ($bMark) {
305 $anchor = "#".$bMark;
306 $name=' name="'.$bMark.'"';
307 }
308 return '<a href="#"'.$name.' onclick="return jumpToUrl(\''.$this->script.'?PM='.$cmd.'\',\''.$anchor.'\');">'.$icon.'</a>';
309 }
310
311 /**
312 * [Describe function...]
313 *
314 * @param [type] $icon: ...
315 * @param [type] $row: ...
316 * @return [type] ...
317 */
318 function wrapIcon($icon,$row) {
319 return substr($icon,0,-1).' title="id='.$row["uid"].'">';
320 }
321 }
322
323
324
325
326
327 /**
328 * For RTE
329 *
330 * @author Kasper Skaarhoj <kasper@typo3.com>
331 * @package TYPO3
332 * @subpackage core
333 */
334 class rtePageTree extends localPageTree {
335 }
336
337
338
339
340
341 /**
342 * For TBE record browser
343 *
344 * @author Kasper Skaarhoj <kasper@typo3.com>
345 * @package TYPO3
346 * @subpackage core
347 */
348 class TBE_PageTree extends localPageTree {
349
350 /**
351 * @param [type] $doktype: ...
352 * @param [type] $uid: ...
353 * @return [type] ...
354 */
355 function ext_isLinkable($doktype,$uid) {
356 return true;
357 }
358
359 /**
360 * [Describe function...]
361 *
362 * @param [type] $title: ...
363 * @param [type] $v: ...
364 * @param [type] $ext_pArrPages: ...
365 * @return [type] ...
366 */
367 function wrapTitle($title,$v,$ext_pArrPages) {
368 $title= (!strcmp(trim($title),"")) ? "<em>[".$GLOBALS["LANG"]->sL("LLL:EXT:lang/locallang_core.php:labels.no_title")."]</em>" : htmlspecialchars($title);
369 if ($ext_pArrPages) {
370 $ficon=t3lib_iconWorks::getIcon("pages",$v);
371 $onClick = "return insertElement('pages', '".$v["uid"]."', 'db', unescape('".rawurlencode($v["title"])."'), '', '', '".$ficon."','',1);";
372 } else {
373 $onClick = 'return jumpToUrl(\'browse_links.php?act='.$GLOBALS["act"].'&mode='.$GLOBALS["mode"].'&expandPage='.$v["uid"].'\');';
374 }
375 return '<a href="#" onclick="'.htmlspecialchars($onClick).'">'.$title.'</a>';
376 }
377 }
378
379
380
381
382
383 /**
384 * Class which generates the folder tree
385 *
386 * @author Kasper Skaarhoj <kasper@typo3.com>
387 * @package TYPO3
388 * @subpackage core
389 */
390 class localFolderTree extends t3lib_folderTree {
391
392 /**
393 * @param [type] $title: ...
394 * @param [type] $v: ...
395 * @return [type] ...
396 */
397 function wrapTitle($title,$v) {
398 if ($this->ext_isLinkable($v)) {
399 return '<a href="#" onclick="return jumpToUrl(\''.$this->script.'?act='.$GLOBALS["act"].'&mode='.$GLOBALS["mode"].'&expandFolder='.rawurlencode($v["path"]).'\');">'.$title.'</a>';
400 // return '<a href="#" onclick="return link_folder(\''.$this->ext_getRelFolder($v["path"]).'\');">'.$title.'</a>';
401 } else {
402 return '<font color=#666666>'.$title.'</font>';
403 }
404 }
405
406 /**
407 * [Describe function...]
408 *
409 * @param [type] $treeArr: ...
410 * @return [type] ...
411 */
412 function printTree($treeArr="") {
413 $titleLen=intval($GLOBALS["BE_USER"]->uc["titleLen"]);
414 if (!is_array($treeArr)) $treeArr=$this->tree;
415 reset($treeArr);
416 $out="";
417 $c=0;
418 $xCol = t3lib_div::modifyHTMLColorAll($GLOBALS["SOBE"]->doc->bgColor,-10);
419 if (!$GLOBALS["curUrlInfo"]["value"]) {
420 $cmpPath="";
421 } else if (substr(trim($GLOBALS["curUrlInfo"]["info"]),-1)!="/") {
422 $cmpPath=PATH_site.dirname($GLOBALS["curUrlInfo"]["info"])."/";
423 } else {
424 $cmpPath=PATH_site.$GLOBALS["curUrlInfo"]["info"];
425 }
426 while(list($k,$v)=each($treeArr)) {
427 $c++;
428 $bgColor=' bgColor="'.(($c+1)%2 ? $GLOBALS["SOBE"]->doc->bgColor : $xCol).'"';
429 if ($GLOBALS["curUrlInfo"]["act"]=="file" && $cmpPath==$v["row"]["path"]) {
430 $arrCol='<td><img src="gfx/blinkarrow_right.gif" width="5" height="9" vspace=1></td>';
431 $bgColor=' bgColor="'.$GLOBALS["SOBE"]->doc->bgColor4.'"';
432 } else {$arrCol='<td></td>';}
433 $cEbullet = $this->ext_isLinkable($v["row"]) ? '<a href="#" onclick="return jumpToUrl(\''.$this->script.'?act='.$GLOBALS["act"].'&mode='.$GLOBALS["mode"].'&expandFolder='.rawurlencode($v["row"]["path"]).'\');"><img src="gfx/ol/arrowbullet.gif" width="18" hspace=5 height="16" border="0"></a>' : '';
434 $out.='<tr'.$bgColor.'><td nowrap>'.$v["HTML"].$this->wrapTitle(t3lib_div::fixed_lgd($v["row"]["title"],$titleLen),$v["row"]).'</td>'.$arrCol.'<td>'.$cEbullet.'</td></tr>';
435 }
436 $out='<table border=0 cellpadding=0 cellspacing=0>'.$out.'</table>';
437 return $out;
438 }
439
440 /**
441 * [Describe function...]
442 *
443 * @param [type] $v: ...
444 * @return [type] ...
445 */
446 function ext_isLinkable($v) {
447 // debug($v);
448 $webpath=t3lib_BEfunc::getPathType_web_nonweb($v["path"]);
449 // debug($webpath);
450 if (strstr($v["path"],"_recycler_") || strstr($v["path"],"_temp_") || $webpath!="web") {
451 return 0;
452 }
453 return 1;
454 }
455
456 /**
457 * [Describe function...]
458 *
459 * @param [type] $icon: ...
460 * @param [type] $cmd: ...
461 * @param [type] $bMark: ...
462 * @return [type] ...
463 */
464 function PM_ATagWrap($icon,$cmd,$bMark="") {
465 if ($bMark) {
466 $anchor = "#".$bMark;
467 $name=' name="'.$bMark.'"';
468 }
469 return '<a href="#"'.$name.' onclick="return jumpToUrl(\''.$this->script.'?PM='.$cmd.'\',\''.$anchor.'\');">'.$icon.'</a>';
470 }
471
472 /**
473 * [Describe function...]
474 *
475 * @param [type] $path: ...
476 * @return [type] ...
477 */
478 function ext_getRelFolder($path) {
479 return substr($path,strlen(PATH_site));
480 }
481 }
482
483
484
485
486
487
488 /**
489 * For RTE
490 *
491 * @author Kasper Skaarhoj <kasper@typo3.com>
492 * @package TYPO3
493 * @subpackage core
494 */
495 class rteFolderTree extends localFolderTree {
496 }
497
498
499
500 /**
501 * For TBE File Browser
502 *
503 * @author Kasper Skaarhoj <kasper@typo3.com>
504 * @package TYPO3
505 * @subpackage core
506 */
507 class TBE_FolderTree extends localFolderTree {
508 var $ext_noTempRecyclerDirs=0;
509
510 /**
511 * @param [type] $v: ...
512 * @return [type] ...
513 */
514 function ext_isLinkable($v) {
515 if ($this->ext_noTempRecyclerDirs && (substr($v["path"],-7)=="_temp_/" || substr($v["path"],-11)=="_recycler_/")) {
516 return 0;
517 } return 1;
518 }
519
520 /**
521 * [Describe function...]
522 *
523 * @param [type] $title: ...
524 * @param [type] $v: ...
525 * @return [type] ...
526 */
527 function wrapTitle($title,$v) {
528 if ($this->ext_isLinkable($v)) {
529 return '<a href="#" onclick="return jumpToUrl(\'browse_links.php?act='.$GLOBALS["act"].'&mode='.$GLOBALS["mode"].'&expandFolder='.rawurlencode($v["path"]).'\');">'.$title.'</a>';
530 } else {
531 return '<font color=#666666>'.$title.'</font>';
532 }
533 }
534 }
535
536
537
538
539
540 /**
541 * Script class
542 *
543 * @author Kasper Skaarhoj <kasper@typo3.com>
544 * @package TYPO3
545 * @subpackage core
546 */
547 class SC_browse_links {
548 var $pointer;
549 var $siteURL;
550 var $thisConfig;
551 var $setTarget;
552 var $doc;
553
554 /**
555 * Constructor
556 *
557 * @return [type] ...
558 */
559 function init() {
560 global $BE_USER,$LANG,$BACK_PATH,$TCA_DESCR,$TCA,$HTTP_GET_VARS,$HTTP_POST_VARS,$CLIENT,$TYPO3_CONF_VARS;
561 global $act,$mode,$curUrlInfo,$curUrlArray;
562
563 $this->pointer = t3lib_div::GPvar("pointer");
564
565
566 // **************************
567 // For RTE/Link: Pre-processing
568 // **************************
569 $addPassOnParams="";
570
571 // Current site url:
572 $this->siteURL = t3lib_div::getIndpEnv("TYPO3_SITE_URL");
573
574 // CurrentUrl - the current link url must be passed around if it exists
575 $curUrlArray = t3lib_div::GPvar("curUrl",1);
576 if ($curUrlArray["all"]) {
577 $curUrlArray=t3lib_div::get_tag_attributes($curUrlArray["all"]);
578 }
579 // debug($curUrlArray);
580 $curUrlInfo=$this->parseCurUrl($curUrlArray["href"],$this->siteURL);
581
582 // Determine nature of current url:
583 $act=t3lib_div::GPvar("act");
584 if (!$act) {
585 $act=$curUrlInfo["act"];
586 }
587
588 $mode=t3lib_div::GPvar("mode");
589 if (!$mode) {
590 $mode="rte";
591 }
592
593
594 if ((string)$mode=="rte") {
595 $RTEtsConfigParts = explode(":",t3lib_div::GPvar("RTEtsConfigParams"));
596 $addPassOnParams.="&RTEtsConfigParams=".rawurlencode(t3lib_div::GPvar("RTEtsConfigParams"));
597 $RTEsetup = $GLOBALS["BE_USER"]->getTSConfig("RTE",t3lib_BEfunc::getPagesTSconfig($RTEtsConfigParts[5]));
598 $this->thisConfig = t3lib_BEfunc::RTEsetup($RTEsetup["properties"],$RTEtsConfigParts[0],$RTEtsConfigParts[2],$RTEtsConfigParts[4]);
599 }
600 $this->setTarget = $curUrlArray["target"];
601 if ($this->thisConfig["defaultLinkTarget"] && !isset($curUrlArray["target"])) {
602 $this->setTarget=$this->thisConfig["defaultLinkTarget"];
603 }
604
605 // **************************
606 // Main thing:
607 // **************************
608
609 $this->doc = t3lib_div::makeInstance("template");
610 $this->doc->backPath = $BACK_PATH;
611 $this->doc->JScode='
612 <script language="javascript" type="text/javascript">
613 // This JavaScript is primarily for RTE/Link. jumpToUrl is used in the other cases as well...
614
615 var add_href="'.($curUrlArray["href"]?"&curUrl[href]=".rawurlencode($curUrlArray["href"]):"").'";
616 var add_target="'.($this->setTarget?"&curUrl[target]=".rawurlencode($this->setTarget):"").'";
617 var add_params="'.(t3lib_div::GPvar("bparams")?"&bparams=".rawurlencode(t3lib_div::GPvar("bparams")):"").'";
618
619 var cur_href="'.($curUrlArray["href"]?$curUrlArray["href"]:"").'";
620 var cur_target="'.($this->setTarget?$this->setTarget:"").'";
621
622 function setTarget(target) { //
623 cur_target=target;
624 add_target="&curUrl[target]="+target;
625 }
626 function setValue(value) { //
627 cur_href=value;
628 add_href="&curUrl[href]="+value;
629 }
630 ';
631
632
633 if ($mode=="wizard") {
634 $P = t3lib_div::GPvar("P",1);
635 //debug($P);
636 unset($P["fieldChangeFunc"]["alert"]);
637 reset($P["fieldChangeFunc"]);
638 $update="";
639 while(list($k,$v)=each($P["fieldChangeFunc"])) {
640 $update.= "
641 window.opener.".$v;
642 }
643
644 $P2=array();
645 $P2["itemName"]=$P["itemName"];
646 $P2["formName"]=$P["formName"];
647 $P2["fieldChangeFunc"]=$P["fieldChangeFunc"];
648 $addPassOnParams.=t3lib_div::implodeArrayForUrl("P",$P2);
649
650 $this->doc->JScode.='
651 function link_typo3Page(id,anchor) { //
652 updateValueInMainForm(id+(anchor?anchor:"")+" "+cur_target);
653 close();
654 return false;
655 }
656 function link_folder(folder) { //
657 updateValueInMainForm(folder+" "+cur_target);
658 close();
659 return false;
660 }
661 function link_current() { //
662 if (cur_href!="http://" && cur_href!="mailto:") {
663 var setValue = cur_href+" "+cur_target;
664 if (setValue.substr(0,7)=="http://") setValue = setValue.substr(7);
665 if (setValue.substr(0,7)=="mailto:") setValue = setValue.substr(7);
666 updateValueInMainForm(setValue);
667 close();
668 }
669 return false;
670 }
671 function checkReference() { //
672 if (window.opener && window.opener.document && window.opener.document.'.$P["formName"].' && window.opener.document.'.$P["formName"].'["'.$P["itemName"].'"] ) {
673 return window.opener.document.'.$P["formName"].'["'.$P["itemName"].'"];
674 } else {
675 close();
676 }
677 }
678 function updateValueInMainForm(input) { //
679 var field = checkReference();
680 if (field) {
681 field.value = input;
682 '.$update.'
683 }
684 }
685 ';
686 } else {
687 $this->doc->JScode.='
688 function link_typo3Page(id,anchor) { //
689 var theLink = \''.$this->siteURL.'?id=\'+id+(anchor?anchor:"");
690 self.parent.parent.renderPopup_addLink(theLink,cur_target);
691 return false;
692 }
693 function link_folder(folder) { //
694 var theLink = \''.$this->siteURL.'\'+folder;
695 self.parent.parent.renderPopup_addLink(theLink,cur_target);
696 return false;
697 }
698 function link_spec(theLink) { //
699 self.parent.parent.renderPopup_addLink(theLink,cur_target);
700 return false;
701 }
702 function link_current() { //
703 if (cur_href!="http://" && cur_href!="mailto:") {
704 self.parent.parent.renderPopup_addLink(cur_href,cur_target);
705 }
706 return false;
707 }
708 ';
709 }
710 $this->doc->JScode.='
711 function jumpToUrl(URL,anchor) { //
712 var add_act = URL.indexOf("act=")==-1 ? "&act='.$act.'" : "";
713 var add_mode = URL.indexOf("mode=")==-1 ? "&mode='.$mode.'" : "";
714 var theLocation = URL+add_act+add_mode+add_href+add_target+add_params'.($addPassOnParams?'+"'.$addPassOnParams.'"':"").'+(anchor?anchor:"");
715 document.location = theLocation;
716 return false;
717 }
718 </script>
719 ';
720
721
722 // This is JavaScript especially for the TBE Element Browser!
723
724 $pArr = explode("|",t3lib_div::GPvar("bparams"));
725 #debug($pArr);
726 $formFieldName = 'data['.$pArr[0].']['.$pArr[1].']['.$pArr[2].']';
727 $this->doc->JScode.='
728 <script language="javascript" type="text/javascript">
729 var elRef="";
730 var targetDoc="";
731
732 function launchView(url) { //
733 var thePreviewWindow="";
734 thePreviewWindow = window.open("show_item.php?table="+url,"ShowItem","height=300,width=410,status=0,menubar=0,resizable=0,location=0,directories=0,scrollbars=1,toolbar=0");
735 if (thePreviewWindow && thePreviewWindow.focus) {
736 thePreviewWindow.focus();
737 }
738 }
739 function setReferences() { //
740 if (parent.typoWin
741 && parent.typoWin.content
742 && parent.typoWin.content.document.editform
743 && parent.typoWin.content.document.editform["'.$formFieldName.'"]
744 ) {
745 targetDoc = parent.typoWin.content.document;
746 elRef = targetDoc.editform["'.$formFieldName.'"];
747 return true;
748 } else {
749 return false;
750 }
751 }
752 function insertElement(table, uid, type, filename,fp,filetype,imagefile,action, close) { //
753 if (1=='.($pArr[0]&&!$pArr[1]&&!$pArr[2] ? 1 : 0).') {
754 addElement(filename,table+"_"+uid,fp,close);
755 } else {
756 if (setReferences()) {
757 if (parent.typoWin.clipBrd.clipboard) parent.typoWin.clipBrd.clipboard.closing();
758 parent.typoWin.clipBrd.swPad("normal");
759 parent.typoWin.clipBrd.aI("normal", table, uid, type, filename,fp,filetype,imagefile,action);
760 parent.typoWin.group_change("add","'.$pArr[0].'","'.$pArr[1].'","'.$pArr[2].'",elRef,targetDoc);
761 } else {
762 alert("Error - reference to main window is not set properly!");
763 }
764 if (close) {
765 parent.typoWin.focus();
766 parent.close();
767 }
768 }
769 return false;
770 }
771 function addElement(elName,elValue,altElValue,close) { //
772 if (parent.typoWin && parent.typoWin.setFormValueFromBrowseWin) {
773 parent.typoWin.setFormValueFromBrowseWin("'.$pArr[0].'",altElValue?altElValue:elValue,elName);
774 if (close) {
775 parent.typoWin.focus();
776 parent.close();
777 }
778 } else {
779 alert("Error - refderence to main window is not set properly!");
780 parent.close();
781 }
782 }
783 </script>';
784 }
785
786 /**
787 * [Describe function...]
788 *
789 * @return [type] ...
790 */
791 function main() {
792 global $BE_USER,$LANG,$BACK_PATH,$TCA_DESCR,$TCA,$HTTP_GET_VARS,$HTTP_POST_VARS,$CLIENT,$TYPO3_CONF_VARS;
793 global $act,$mode,$curUrlInfo,$curUrlArray;
794
795 $modData = $BE_USER->getModuleData("browse_links.php","ses");
796
797 // Output the correct content according to $mode
798 switch((string)$mode) {
799 case "rte":
800 $this->content="";
801 $this->content.=$this->main_rte();
802 break;
803 case "db":
804 $expandPage = t3lib_div::GPvar("expandPage");
805 if (isset($expandPage)) {
806 $modData["expandPage"]=$expandPage;
807 $BE_USER->pushModuleData("browse_links.php",$modData);
808 } else {
809 $HTTP_GET_VARS["expandPage"]=$modData["expandPage"];
810 }
811
812 $this->content="";
813 $this->content.=$this->main_db();
814 break;
815 case "file":
816 case "filedrag":
817 $expandPage = t3lib_div::GPvar("expandFolder");
818 if (isset($expandPage)) {
819 $modData["expandFolder"]=$expandPage;
820 $BE_USER->pushModuleData("browse_links.php",$modData);
821 } else {
822 $HTTP_GET_VARS["expandFolder"]=$modData["expandFolder"];
823 }
824
825 $this->content="";
826 $this->content.=$this->main_file("",$mode);
827 break;
828 case "wizard":
829 $this->content="";
830 $this->content.=$this->main_rte("",1);
831 break;
832 }
833
834 }
835
836 /**
837 * [Describe function...]
838 *
839 * @return [type] ...
840 */
841 function printContent() {
842 echo $this->content;
843 }
844
845
846
847
848 /******************************************************************
849 *
850 * OTHER FUNCTIONS: These functions are designed to display the records from a page
851 *
852 ******************************************************************/
853 /**
854 * For RTE: This displays all content elements on a page and lets you create a link to the element.
855 *
856 * @return [type] ...
857 */
858 function expandPage() {
859 $expandPage = t3lib_div::GPvar("expandPage");
860 $out="";
861 if ($expandPage) {
862 $out.=$this->barheader($GLOBALS["LANG"]->getLL("contentElements").':');
863
864 $titleLen=intval($GLOBALS["BE_USER"]->uc["titleLen"]);
865 $mainPageRec = t3lib_BEfunc::getRecord("pages",$expandPage);
866 $picon=t3lib_iconWorks::getIconImage("pages",$mainPageRec,"","align=top");
867 $picon.=htmlspecialchars(t3lib_div::fixed_lgd($mainPageRec["title"],$titleLen));
868 $out.='<nobr>'.$picon.'</nobr><BR>';
869
870 $query="SELECT uid,header,hidden,starttime,endtime,fe_group,CType,colpos FROM tt_content WHERE pid=".intval($expandPage).t3lib_BEfunc::deleteClause("tt_content")." ORDER BY colpos,sorting";
871 $res = mysql(TYPO3_db,$query);
872 echo mysql_error();
873 $cc=mysql_num_rows($res);
874 $c=0;
875 while($row=mysql_fetch_assoc($res)) {
876 $c++;
877 $icon=t3lib_iconWorks::getIconImage("tt_content",$row,"","align=top");
878 if ($GLOBALS["curUrlInfo"]["act"]=="page" && $GLOBALS["curUrlInfo"]["cElement"]==$row["uid"]) {
879 $arrCol='<img src="gfx/blinkarrow_left.gif" width="5" height="9" vspace=3 hspace=2 align=top>';
880 } else {$arrCol="";}
881 $out.='<nobr><img src="gfx/ol/join'.($c==$cc?"bottom":"").'.gif" width="18" height="16" align=top>'.$arrCol.'<a href="#" onclick="return link_typo3Page(\''.$expandPage.'\',\'#'.$row["uid"].'\');">'.$icon.htmlspecialchars(t3lib_div::fixed_lgd($row["header"],$titleLen)).'</a></nobr><BR>';
882 // debug($row);
883 }
884 }
885 return $out;
886 }
887
888 /**
889 * For TBE Record Browser: This lists all content elements from the given category!
890 *
891 * @param [type] $tables: ...
892 * @return [type] ...
893 */
894 function TBE_expandPage($tables) {
895 global $TCA;
896 $expandPage = t3lib_div::GPvar("expandPage");
897 /* if (isset($id)) {
898 $expandPage=$id;
899 }
900 */ $out="";
901 if (t3lib_div::testInt($expandPage) && $expandPage>=0) {
902 if (!strcmp(trim($tables),"*")) {
903 $tablesArr = array_keys($TCA);
904 } else {
905 $tablesArr = t3lib_div::trimExplode(",",$tables,1);
906 }
907
908 reset($tablesArr);
909 $titleLen=intval($GLOBALS["BE_USER"]->uc["titleLen"]);
910
911 $out.=$this->barheader($GLOBALS["LANG"]->getLL("selectRecords").':');
912
913 $mainPageRec = t3lib_BEfunc::getRecord("pages",$expandPage);
914 $ATag="";
915 $ATag_e="";
916 if (in_array("pages",$tablesArr)) {
917 $ficon=t3lib_iconWorks::getIcon("pages",$mainPageRec);
918 $ATag="<a href=\"#\" onclick=\"return insertElement('pages', '".$mainPageRec["uid"]."', 'db', unescape('".rawurlencode($mainPageRec["title"])."'), '', '', '".$ficon."','',1);\">";
919 $ATag2="<a href=\"#\" onclick=\"return insertElement('pages', '".$mainPageRec["uid"]."', 'db', unescape('".rawurlencode($mainPageRec["title"])."'), '', '', '".$ficon."','',0);\">";
920 $ATag_alt=substr($ATag,0,-4).",'',1);\">";
921 $ATag_e="</a>";
922 }
923 $picon=t3lib_iconWorks::getIconImage("pages",$mainPageRec,"","align=top");
924 $pBicon='<img src="gfx/plusbullet2.gif" width="18" height="16" border="0" align="top">';
925 $pText=htmlspecialchars(t3lib_div::fixed_lgd($mainPageRec["title"],$titleLen));
926 $out.='<nobr>'.$picon.$ATag2.$pBicon.$ATag_e.$ATag.$pText.$ATag_e.'</nobr><BR>';
927
928
929
930
931
932 $id = $expandPage;
933 $pointer = t3lib_div::intInRange($this->pointer,0,100000);
934 $perms_clause = $GLOBALS["BE_USER"]->getPagePermsClause(1);
935 $pageinfo = t3lib_BEfunc::readPageAccess($id,$perms_clause);
936 $table="";
937
938 $dblist = t3lib_div::makeInstance("TBE_browser_recordList");
939 $dblist->script="browse_links.php";
940 $dblist->backPath = $GLOBALS["BACK_PATH"];
941 $dblist->thumbs = 0;
942 $dblist->calcPerms = $GLOBALS["BE_USER"]->calcPerms($pageinfo);
943 $dblist->noControlPanels=1;
944 $dblist->tableList=implode(",",$tablesArr);
945
946 $dblist->start($id,t3lib_div::GPvar("table"),$pointer,
947 t3lib_div::GPvar("search_field"),
948 t3lib_div::GPvar("search_levels"),
949 t3lib_div::GPvar("showLimit")
950 );
951 $dblist->setDispFields();
952 // $dblist->writeTop($pageinfo,$pageinfo["_thePath"]);
953 $dblist->generateList($id,$table);
954 $dblist->writeBottom();
955
956
957 $out.=$dblist->HTMLcode;
958 $out.=$dblist->getSearchBox();
959
960 /*
961
962 while(list(,$table)=each($tablesArr)) {
963 if ($table=="tt_content" && $TCA[$table]) {
964 $query="SELECT uid,header,hidden,starttime,endtime,fe_group,CType,colpos FROM tt_content WHERE pid=".intval($expandPage).t3lib_BEfunc::deleteClause("tt_content")." ORDER BY colpos,sorting";
965 $res = mysql(TYPO3_db,$query);
966 echo mysql_error();
967 $cc=mysql_num_rows($res);
968 $c=0;
969 while($row=mysql_fetch_assoc($res)) {
970 $c++;
971 $icon=t3lib_iconWorks::getIconImage("tt_content",$row,"","align=top");
972
973 $ficon=t3lib_iconWorks::getIcon("tt_content",$row);
974 $ATag="<a href=\"#\" onclick=\"return insertElement('".$table."', '".$row["uid"]."', 'db', unescape('".rawurlencode($row["header"])."'), '', '', '".$ficon."');\">";
975 $ATag_alt=substr($ATag,0,-4).",'',1);\">";
976 $ATag_e="</a>";
977
978 $out.='<nobr><img src="gfx/ol/join'.($c==$cc?"bottom":"").'.gif" width="18" height="16" align=top>'.$ATag.$icon.htmlspecialchars(t3lib_div::fixed_lgd($row["header"],$titleLen)).$ATag_e.'</nobr><BR>';
979 // debug($row);
980 }
981 }
982 }
983 */
984
985
986
987 }
988 return $out;
989 }
990
991 /**
992 * [Describe function...]
993 *
994 * @param [type] $folder: ...
995 * @return [type] ...
996 */
997 function isWebFolder($folder) {
998 $folder = ereg_replace("\/$","",$folder)."/";
999 return t3lib_div::isFirstPartOfStr($folder,PATH_site);
1000 }
1001
1002 /**
1003 * [Describe function...]
1004 *
1005 * @param [type] $folder: ...
1006 * @return [type] ...
1007 */
1008 function checkFolder($folder) {
1009 $fileProcessor = t3lib_div::makeInstance("t3lib_basicFileFunctions");
1010 $fileProcessor->init($GLOBALS["FILEMOUNTS"], $GLOBALS["TYPO3_CONF_VARS"]["BE"]["fileExtensions"]);
1011 //debug(array($GLOBALS["FILEMOUNTS"],$folder."/"));
1012 $ret= $fileProcessor->checkPathAgainstMounts(ereg_replace("\/$","",$folder)."/");
1013 //debug($ret);
1014 return $ret;
1015 }
1016
1017
1018
1019 /******************************************************************
1020 *
1021 * OTHER FUNCTIONS: These functions are designed to display the files from a folder
1022 *
1023 ******************************************************************/
1024 /**
1025 * For RTE: This displays all files from folder. No thumbnails shown
1026 *
1027 * @param [type] $expandFolder: ...
1028 * @param [type] $extensionList: ...
1029 * @return [type] ...
1030 */
1031 function expandFolder($expandFolder=0,$extensionList="") {
1032 $expandFolder = $expandFolder?$expandFolder:t3lib_div::GPvar("expandFolder");
1033 $out="";
1034 if ($expandFolder && $this->checkFolder($expandFolder)) {
1035 $out.=$this->barheader($GLOBALS["LANG"]->getLL("files").':');
1036
1037 if (!$GLOBALS["curUrlInfo"]["value"]) {
1038 $cmpPath="";
1039 } else $cmpPath=PATH_site.$GLOBALS["curUrlInfo"]["info"];
1040
1041 $titleLen=intval($GLOBALS["BE_USER"]->uc["titleLen"]);
1042 $picon='<img src="gfx/i/_icon_webfolders.gif" width="18" height="16" align=top border=0>';
1043 $picon.=htmlspecialchars(t3lib_div::fixed_lgd(basename($expandFolder),$titleLen));
1044 $picon='<a href="#" onclick="return link_folder(\''.substr($expandFolder,strlen(PATH_site)).'\');">'.$picon.'</a>';
1045 $out.='<nobr>'.$picon.'</nobr><BR>';
1046
1047 $files = t3lib_div::getFilesInDir($expandFolder,$extensionList,1,1); // $extensionList="",$prependPath=0,$order="")
1048 reset($files);
1049 $c=0;
1050 $cc=count($files);
1051 while(list(,$filepath)=each($files)) {
1052 $c++;
1053 $fI=pathinfo($filepath);
1054 // debug($fI);
1055 $icon = t3lib_BEfunc::getFileIcon(strtolower($fI["extension"]));
1056 if ($GLOBALS["curUrlInfo"]["act"]=="file" && $cmpPath==$filepath) {
1057 $arrCol='<img src="gfx/blinkarrow_left.gif" width="5" height="9" vspace=3 hspace=2 align=top>';
1058 } else {$arrCol='';}
1059 $size=" (".t3lib_div::formatSize(filesize($filepath))."bytes)";
1060 $icon = '<img src="gfx/fileicons/'.$icon.'" width=18 height=16 border=0 title="'.$fI["basename"].$size.'" align=top>';
1061 $out.='<nobr><img src="gfx/ol/join'.($c==$cc?"bottom":"").'.gif" width="18" height="16" align=top>'.$arrCol.'<a href="#" onclick="return link_folder(\''.substr($filepath,strlen(PATH_site)).'\');">'.$icon.htmlspecialchars(t3lib_div::fixed_lgd(basename($filepath),$titleLen)).'</a></nobr><BR>';
1062 }
1063 }
1064 return $out;
1065 }
1066
1067 /**
1068 * [Describe function...]
1069 *
1070 * @param [type] $expandFolder: ...
1071 * @param [type] $extensionList: ...
1072 * @return [type] ...
1073 */
1074 function TBE_expandFolder($expandFolder=0,$extensionList="") {
1075 global $LANG;
1076 $expandFolder = $expandFolder?$expandFolder:t3lib_div::GPvar("expandFolder");
1077 $out="";
1078 if ($expandFolder && $this->checkFolder($expandFolder)) {
1079 $files = t3lib_div::getFilesInDir($expandFolder,$extensionList,1,1); // $extensionList="",$prependPath=0,$order="")
1080 if (is_array($files)) {
1081 reset($files);
1082
1083 $out.=$this->barheader(sprintf($GLOBALS["LANG"]->getLL("files").' (%s):',count($files)));
1084
1085 $titleLen=intval($GLOBALS["BE_USER"]->uc["titleLen"]);
1086 $picon='<img src="gfx/i/_icon_webfolders.gif" width="18" height="16" align=top>';
1087 $picon.=htmlspecialchars(t3lib_div::fixed_lgd(basename($expandFolder),$titleLen));
1088 $out.='<nobr>'.$picon.'</nobr><BR>';
1089
1090 $imgObj = t3lib_div::makeInstance("t3lib_stdGraphic");
1091 $imgObj->init();
1092 $imgObj->mayScaleUp=0;
1093 $imgObj->tempPath=PATH_site.$imgObj->tempPath;
1094
1095 $noThumbs = $GLOBALS["BE_USER"]->getTSConfigVal("options.noThumbsInEB");
1096
1097 $lines=array();
1098 while(list(,$filepath)=each($files)) {
1099 $fI=pathinfo($filepath);
1100
1101 $iurl = $this->siteURL.substr($filepath,strlen(PATH_site));
1102
1103 if (t3lib_div::inList($GLOBALS["TYPO3_CONF_VARS"]["GFX"]["imagefile_ext"],$fI["extension"]) && !$noThumbs) {
1104 $imgInfo = $imgObj->getImageDimensions($filepath);
1105 $pDim = $imgInfo[0]."x".$imgInfo[1]." pixels";
1106 $clickIcon = t3lib_BEfunc::getThumbNail("thumbs.php",$filepath,"hspace=5 vspace=5 border=1");
1107 } else {
1108 $clickIcon = '';
1109 $pDim = "";
1110 }
1111
1112 $ficon = t3lib_BEfunc::getFileIcon(strtolower($fI["extension"]));
1113 $size=" (".t3lib_div::formatSize(filesize($filepath))."bytes".($pDim?", ".$pDim:"").")";
1114 $icon = '<img src="gfx/fileicons/'.$ficon.'" width=18 height=16 border=0 title="'.$fI["basename"].$size.'" align=absmiddle>';
1115
1116 // table, uid, type, filename,fp,filetype,imagefile,action
1117 $ATag = "<a href=\"#\" onclick=\"return insertElement('','".t3lib_div::shortMD5($filepath)."', 'file', '".rawurlencode($fI["basename"])."', unescape('".rawurlencode($filepath)."'), '".$fI["extension"]."', '".$ficon."');\">";
1118 $ATag_alt = substr($ATag,0,-4).",'',1);\">";
1119 $ATag_e="</a>";
1120
1121 // $ATag2='<a href="#" onclick="launchView(\''.rawurlencode($filepath).'\'); return false;">';
1122 $ATag2='<a href="show_item.php?table='.rawurlencode($filepath).'&returnUrl='.rawurlencode(t3lib_div::getIndpEnv("REQUEST_URI")).'">';
1123 $ATag2_e="</a>";
1124
1125 $filenameAndIcon=$ATag_alt.$icon.htmlspecialchars(t3lib_div::fixed_lgd(basename($filepath),$titleLen)).$ATag_e;
1126
1127 if ($pDim) { // Image...
1128 $lines[]='<tr bgcolor="'.$this->doc->bgColor4.'">
1129 <td nowrap>'.$filenameAndIcon.'&nbsp;</td>
1130 <td>'.$ATag.'<img src="gfx/plusbullet2.gif" width="18" height="16" border="0"'.t3lib_BEfunc::titleAttrib($LANG->getLL("addToList")).'>'.$ATag_e.'</td>
1131 <td nowrap>'.($ATag2.'<img src="gfx/zoom2.gif" width="12" height="12" border="0" align=top'.t3lib_BEfunc::titleAttrib($LANG->getLL("info")).'> '.$LANG->getLL("info").$ATag2_e).'</td>
1132 <td nowrap>&nbsp;'.$pDim.'</td>
1133 </tr>';
1134 $lines[]='<tr><td colspan=4>'.$ATag_alt.$clickIcon.$ATag_e.'</td></tr>';
1135 } else {
1136 $lines[]='<tr bgcolor="'.$this->doc->bgColor4.'">
1137 <td nowrap>'.$filenameAndIcon.'&nbsp;</td>
1138 <td>'.$ATag.'<img src="gfx/plusbullet2.gif" width="18" height="16" border="0"'.t3lib_BEfunc::titleAttrib($LANG->getLL("addToList")).'>'.$ATag_e.'</td>
1139 <td nowrap>'.($ATag2.'<img src="gfx/zoom2.gif" width="12" height="12" border="0" align=top'.t3lib_BEfunc::titleAttrib($LANG->getLL("info")).'> '.$LANG->getLL("info").$ATag2_e).'</td>
1140 <td>&nbsp;</td>
1141 </tr>';
1142 }
1143 $lines[]='<tr><td colspan=3><img src=clear.gif width=1 height=3></td></tr>';
1144 }
1145 $out.='<table border=0 cellpadding=0 cellspacing=1>'.implode("",$lines).'</table>';
1146 }
1147 }
1148 return $out;
1149 }
1150
1151 /**
1152 * For RTE: This displays all files (from extensionList) from folder. Thumbnails are shown for images.
1153 *
1154 * @param [type] $expandFolder: ...
1155 * @param [type] $extensionList: ...
1156 * @return [type] ...
1157 */
1158 function TBE_dragNDrop($expandFolder=0,$extensionList="") {
1159 $expandFolder = $expandFolder?$expandFolder:t3lib_div::GPvar("expandFolder");
1160 $out="";
1161 if ($expandFolder && $this->checkFolder($expandFolder)) {
1162 if ($this->isWebFolder($expandFolder)) {
1163 $files = t3lib_div::getFilesInDir($expandFolder,$extensionList,1,1); // $extensionList="",$prependPath=0,$order="")
1164 if (is_array($files)) {
1165 reset($files);
1166
1167 $out.=$this->barheader(sprintf($GLOBALS["LANG"]->getLL("files").' (%s):',count($files)));
1168
1169 $titleLen=intval($GLOBALS["BE_USER"]->uc["titleLen"]);
1170 $picon='<img src="gfx/i/_icon_webfolders.gif" width="18" height="16" align=top>';
1171 $picon.=htmlspecialchars(t3lib_div::fixed_lgd(basename($expandFolder),$titleLen));
1172 $out.='<nobr>'.$picon.'</nobr><BR>';
1173
1174 $lines=array();
1175 $lines[]='<tr><td colspan=2>'.$this->getMsgBox($GLOBALS["LANG"]->getLL("findDragDrop")).'</td></tr>';
1176
1177 while(list(,$filepath)=each($files)) {
1178 $fI=pathinfo($filepath);
1179
1180 $iurl = $this->siteURL.substr($filepath,strlen(PATH_site));
1181
1182 if (t3lib_div::inList("gif,jpeg,jpg,png",$fI["extension"])) {
1183 $imgInfo = @getimagesize($filepath);
1184 $pDim = $imgInfo[0]."x".$imgInfo[1]." pixels";
1185
1186 $ficon = t3lib_BEfunc::getFileIcon(strtolower($fI["extension"]));
1187 $size=" (".t3lib_div::formatSize(filesize($filepath))."bytes".($pDim?", ".$pDim:"").")";
1188 $icon = '<img src="gfx/fileicons/'.$ficon.'" width=18 height=16 border=0 title="'.$fI["basename"].$size.'" align=absmiddle>';
1189 $filenameAndIcon=$icon.htmlspecialchars(t3lib_div::fixed_lgd(basename($filepath),$titleLen));
1190
1191 if (t3lib_div::GPvar("noLimit")) {
1192 $maxW=10000;
1193 $maxH=10000;
1194 } else {
1195 $maxW=380;
1196 $maxH=500;
1197 }
1198 $IW = $imgInfo[0];
1199 $IH = $imgInfo[1];
1200 if ($IW>$maxW) {
1201 $IH=ceil($IH/$IW*$maxW);
1202 $IW=$maxW;
1203 }
1204 if ($IH>$maxH) {
1205 $IW=ceil($IW/$IH*$maxH);
1206 $IH=$maxH;
1207 }
1208
1209
1210 $lines[]='<tr bgcolor="'.$this->doc->bgColor4.'">
1211 <td nowrap>'.$filenameAndIcon.'&nbsp;</td>
1212 <td nowrap>'.
1213 ($imgInfo[0]!=$IW ? '<a href="'.t3lib_div::linkThisScript(array("noLimit"=>"1")).'"><img src="gfx/icon_warning2.gif" width="18" height="16" border="0"'.t3lib_BEfunc::titleAttrib($GLOBALS["LANG"]->getLL("clickToRedrawFullSize")).' align=top></a>':'').
1214
1215 $pDim.'&nbsp;</td>
1216 </tr>';
1217
1218 $lines[]='<tr><td colspan=2><img src="'.$iurl.'" width="'.$IW.'" height="'.$IH.'" border=1></td></tr>';
1219 $lines[]='<tr><td colspan=2><img src=clear.gif width=1 height=3></td></tr>';
1220 }
1221 }
1222 $out.='<table border=0 cellpadding=0 cellspacing=1>'.implode("",$lines).'</table>';
1223 }
1224 } else {
1225 $out.=$this->barheader($GLOBALS["LANG"]->getLL("files"));
1226 $out.=$this->getMsgBox($GLOBALS["LANG"]->getLL("noWebFolder"),"icon_warning2");
1227 }
1228 }
1229 return $out;
1230 }
1231
1232 /**
1233 * [Describe function...]
1234 *
1235 * @param [type] $in_msg: ...
1236 * @param [type] $icon: ...
1237 * @return [type] ...
1238 */
1239 function getMsgBox($in_msg,$icon="icon_note") {
1240 $msg = '<img src="gfx/'.$icon.'.gif" width="18" height="16" align=top>'.$in_msg;
1241 $msg = '<table border=1 align=center width="95%" bordercolor="black" cellpadding=10 cellspacing=0 bgColor="'.$this->doc->bgColor4.'"><tr><td>'.$msg.'</td></tr></table><BR>';
1242 return $msg;
1243 }
1244
1245
1246
1247
1248 /******************************************************************
1249 *
1250 * Miscellaneous functions
1251 *
1252 ******************************************************************/
1253
1254 /**
1255 * Prints a 'header' where string is in a tablecell
1256 *
1257 * @param [type] $str: ...
1258 * @return [type] ...
1259 */
1260 function barheader($str) {
1261 return '<table border=0 cellpadding=2 cellspacing=0 width=100% bgcolor="'.$this->doc->bgColor5.'"><tr><td><strong>'.$str.'</strong></td></tr></table>';
1262 }
1263
1264 /**
1265 * For RTE/link: This prints the 'currentUrl'
1266 *
1267 * @param [type] $str: ...
1268 * @return [type] ...
1269 */
1270 function printCurrentUrl($str) {
1271 return '<table border=0 cellpadding=0 cellspacing=0 width=100% bgcolor="'.$this->doc->bgColor5.'"><tr><td><strong>'.$GLOBALS["LANG"]->getLL("currentLink").':</strong> '.$str.'</td></tr></table>';
1272 }
1273
1274 /**
1275 * For RTE/link: Parses the incoming URL and determins if it's a page, file, external or mail address.
1276 *
1277 * @param [type] $href: ...
1278 * @param [type] $siteUrl: ...
1279 * @return [type] ...
1280 */
1281 function parseCurUrl($href,$siteUrl) {
1282 $href = trim($href);
1283 if ($href) {
1284 $info=array();
1285
1286 // Default is "url":
1287 $info["value"]=$href;
1288 $info["act"]="url";
1289
1290 $specialParts = explode("#_SPECIAL",$href);
1291 if (count($specialParts)==2) {
1292 $info["value"]="#_SPECIAL".$specialParts[1];
1293 $info["act"]="spec";
1294 } elseif (t3lib_div::isFirstPartOfStr($href,$siteUrl)) { // Checking for other kinds:
1295 $rel = substr($href,strlen($siteUrl));
1296 if (@file_exists(PATH_site.$rel)) {
1297 $info["value"]=$rel;
1298 $info["act"]="file";
1299 } else {
1300 $uP=parse_url($rel);
1301 if (!trim($uP["path"])) {
1302 $pp = explode("id=",$uP["query"]);
1303 $id = $pp[1];
1304 if ($id) {
1305 // Checking if the id-parameter is an alias.
1306 if (!t3lib_div::testInt($id)) {
1307 list($idPartR) = t3lib_BEfunc::getRecordsByField("pages","alias",$id);
1308 $id=intval($idPartR["uid"]);
1309 }
1310
1311 $pageRow = t3lib_BEfunc::getRecord("pages",$id);
1312 $titleLen=intval($GLOBALS["BE_USER"]->uc["titleLen"]);
1313 $info["value"]=$GLOBALS["LANG"]->getLL("page")." '".htmlspecialchars(t3lib_div::fixed_lgd($pageRow["title"],$titleLen))."' (ID:".$id.($uP["fragment"]?", #".$uP["fragment"]:"").")";
1314 $info["pageid"]=$id;
1315 $info["cElement"]=$uP["fragment"];
1316 $info["act"]="page";
1317 }
1318 }
1319 }
1320 } else {
1321 if (strtolower(substr($href,0,7))=="mailto:") {
1322 $info["value"]=trim(substr($href,7));
1323 $info["act"]="mail";
1324 }
1325 }
1326 $info["info"] = $info["value"];
1327 } else {
1328 $info=array();
1329 $info["info"]=$GLOBALS["LANG"]->getLL("none");
1330 $info["value"]="";
1331 $info["act"]="page";
1332 }
1333 return $info;
1334 }
1335
1336 /**
1337 * For TBE: Makes an upload form (similar to the one from rte_select_image.php)
1338 *
1339 * @param [type] $path: ...
1340 * @return [type] ...
1341 */
1342 function uploadForm($path) {
1343 $count=3;
1344 $header = t3lib_div::isFirstPartOfStr($path,PATH_site)?substr($path,strlen(PATH_site)):$path;
1345 $code=$this->barheader($GLOBALS["LANG"]->getLL("uploadImage").":");
1346 $code.='<table border=0 cellpadding=0 cellspacing=3><FORM action="tce_file.php" method="POST" name="editform" enctype="'.$GLOBALS["TYPO3_CONF_VARS"]["SYS"]["form_enctype"].'"><tr><td>';
1347 $code.="<strong>".$GLOBALS["LANG"]->getLL("path").":</strong> ".$header."</td></tr><tr><td>";
1348 for ($a=1;$a<=$count;$a++) {
1349 $code.='<input type="File" name="upload_'.$a.'"'.$GLOBALS["TBE_TEMPLATE"]->formWidth(30).'>
1350 <input type="Hidden" name="file[upload]['.$a.'][target]" value="'.$path.'">
1351 <input type="Hidden" name="file[upload]['.$a.'][data]" value="'.$a.'"><BR>';
1352 }
1353 $code.='<input type="Hidden" name="redirect" value="browse_links.php?act='.$GLOBALS["act"].'&mode='.$GLOBALS["mode"].'&expandFolder='.rawurlencode($path).'&bparams='.rawurlencode(t3lib_div::GPvar("bparams")).'"><input type="Submit" name="submit" value="'.$GLOBALS["LANG"]->sL("LLL:EXT:lang/locallang_core.php:file_upload.php.submit").'"></td></tr></FORM></table>';
1354 return $code;
1355 }
1356
1357 /**
1358 * For TBE: Makes an upload form (similar to the one from rte_select_image.php)
1359 *
1360 * @param [type] $path: ...
1361 * @return [type] ...
1362 */
1363 function createFolder($path) {
1364 $header = t3lib_div::isFirstPartOfStr($path,PATH_site)?substr($path,strlen(PATH_site)):$path;
1365 $code=$this->barheader($GLOBALS["LANG"]->sL("LLL:EXT:lang/locallang_core.php:file_newfolder.php.pagetitle").":");
1366 $code.='<table border=0 cellpadding=0 cellspacing=3><FORM action="tce_file.php" method="POST" name="editform2"><tr><td>';
1367 $code.="<strong>".$GLOBALS["LANG"]->getLL("path").":</strong> ".$header."</td></tr><tr><td>";
1368 $a=1;
1369 $code.='<input'.$GLOBALS["TBE_TEMPLATE"]->formWidth(20).' type="Text" name="file[newfolder]['.$a.'][data]"><input type="Hidden" name="file[newfolder]['.$a.'][target]" value="'.$path.'">';
1370 $code.='<input type="Hidden" name="redirect" value="browse_links.php?act='.$GLOBALS["act"].'&mode='.$GLOBALS["mode"].'&expandFolder='.rawurlencode($path).'&bparams='.rawurlencode(t3lib_div::GPvar("bparams")).'"><input type="Submit" name="submit" value="'.$GLOBALS["LANG"]->sL("LLL:EXT:lang/locallang_core.php:file_newfolder.php.submit").'"></td></tr></FORM></table>';
1371 return $code;
1372 }
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384 /**
1385 * Rich Text Editor (RTE) link selector (MAIN function)
1386 *
1387 * @param [type] $content: ...
1388 * @param [type] $wiz: ...
1389 * @return [type] ...
1390 */
1391 function main_rte($content="",$wiz=0) {
1392 global $SOBE,$act,$mode,$curUrlInfo,$curUrlArray,$LANG;
1393 // Starting content:
1394 // debug($this->thisConfig);
1395 $content.=$this->doc->startPage("RTE link");
1396
1397 $allowedItems = array_diff(explode(",","page,file,url,mail,spec"),t3lib_div::trimExplode(",",$this->thisConfig["blindLinkOptions"],1));
1398 reset($allowedItems);
1399 if (!in_array($act,$allowedItems)) $act = current($allowedItems);
1400
1401 // Making menu in top:
1402 $menu='<table border=0 cellpadding=2 cellspacing=1><tr>';
1403 $bgcolor=' bgcolor="'.$this->doc->bgColor4.'"';
1404 $bgcolorA=' bgcolor="'.$this->doc->bgColor5.'"';
1405 if (!$wiz) $menu.='<td align=center nowrap width=15%'.$bgcolor.'><a href="#" onclick="self.parent.parent.renderPopup_unLink();return false;"><strong>'.$GLOBALS["LANG"]->getLL("removeLink").'</strong></a></td>';
1406 if (in_array("page",$allowedItems)) $menu.='<td align=center nowrap width=15%'.($act=="page"?$bgcolorA:$bgcolor).'><a href="#" onclick="jumpToUrl(\'?act=page\');return false;"><strong>'.$GLOBALS["LANG"]->getLL("page").'</strong></a></td>';
1407 if (in_array("file",$allowedItems)) $menu.='<td align=center nowrap width=15%'.($act=="file"?$bgcolorA:$bgcolor).'><a href="#" onclick="jumpToUrl(\'?act=file\');return false;"><strong>'.$GLOBALS["LANG"]->getLL("file").'</strong></a></td>';
1408 if (in_array("url",$allowedItems)) $menu.='<td align=center nowrap width=15%'.($act=="url"?$bgcolorA:$bgcolor).'><a href="#" onclick="jumpToUrl(\'?act=url\');return false;"><strong>'.$GLOBALS["LANG"]->getLL("extUrl").'</strong></a></td>';
1409 if (in_array("mail",$allowedItems)) $menu.='<td align=center nowrap width=15%'.($act=="mail"?$bgcolorA:$bgcolor).'><a href="#" onclick="jumpToUrl(\'?act=mail\');return false;"><strong>'.$GLOBALS["LANG"]->getLL("email").'</strong></a></td>';
1410 if (is_array($this->thisConfig["userLinks."]) && in_array("spec",$allowedItems)) $menu.='<td align=center nowrap width=15%'.($act=="spec"?$bgcolorA:$bgcolor).'><a href="#" onclick="jumpToUrl(\'?act=spec\');return false;"><strong>'.$GLOBALS["LANG"]->getLL("special").'</strong></a></td>';
1411 $menu.='</tr></table>';
1412
1413 $content.='<img src=clear.gif width=1 height=2>';
1414 $content.=$this->printCurrentUrl($curUrlInfo["info"]);
1415 $content.='<img src=clear.gif width=1 height=2>';
1416 $content.=$menu;
1417 $content.='<img src=clear.gif width=1 height=10>';
1418
1419 switch($act) {
1420 case "mail":
1421 $extUrl='<table border=0 cellpadding=2 cellspacing=1><form name="lurlform" id="lurlform"><tr>';
1422 $extUrl.='<td width=90>'.$GLOBALS["LANG"]->getLL("emailAddress").':</td>';
1423 $extUrl.='<td><input type="text" name="lemail"'.$GLOBALS["TBE_TEMPLATE"]->formWidth(20).' value="'.($curUrlInfo["act"]=="mail"?$curUrlInfo["info"]:"").'"> <input type="submit" value="'.$GLOBALS["LANG"]->getLL("setLink").'" onclick="setTarget(\'\');setValue(\'mailto:\'+document.lurlform.lemail.value); return link_current();"></td>';
1424 $extUrl.='</tr></form></table>';
1425
1426 $content.=$extUrl;
1427 break;
1428 case "url":
1429 $extUrl='<table border=0 cellpadding=2 cellspacing=1><form name="lurlform" id="lurlform"><tr>';
1430 $extUrl.='<td width=90>URL:</td>';
1431 $extUrl.='<td><input type="text" name="lurl"'.$GLOBALS["TBE_TEMPLATE"]->formWidth(20).' value="'.($curUrlInfo["act"]=="url"?$curUrlInfo["info"]:"http://").'"> <input type="submit" value="'.$GLOBALS["LANG"]->getLL("setLink").'" onclick="setValue(document.lurlform.lurl.value); return link_current();"></td>';
1432 $extUrl.='</tr></form></table>';
1433
1434 $content.=$extUrl;
1435 break;
1436 case "file":
1437 $foldertree = t3lib_div::makeInstance("rteFolderTree");
1438 $tree=$foldertree->getBrowsableTree();
1439
1440
1441 // debug($GLOBALS["HTTP_GET_VARS"]);
1442 if (!$GLOBALS["curUrlInfo"]["value"] || $GLOBALS["curUrlInfo"]["act"]!="file") {
1443 $cmpPath="";
1444 } else if (substr(trim($GLOBALS["curUrlInfo"]["info"]),-1)!="/") {
1445 $cmpPath=PATH_site.dirname($GLOBALS["curUrlInfo"]["info"])."/";
1446 if (!isset($GLOBALS["HTTP_GET_VARS"]["expandFolder"])) $GLOBALS["HTTP_GET_VARS"]["expandFolder"] = $cmpPath;
1447 } else {
1448 $cmpPath=PATH_site.$GLOBALS["curUrlInfo"]["info"];
1449 }
1450
1451
1452 list(,,$specUid) = explode("_",t3lib_div::GPvar("PM"));
1453 $files = $this->expandFolder($foldertree->specUIDmap[$specUid]);
1454
1455 $content.= '<table border=0 cellpadding=0 cellspacing=0>
1456 <tr>
1457 <td valign=top><font face=verdana size=1 color=black>'.$this->barheader($GLOBALS["LANG"]->getLL("folderTree").':').$tree.'</font></td>
1458 <td>&nbsp;</td>
1459 <td valign=top><font face=verdana size=1 color=black>'.$files.'</font></td>
1460 </tr>
1461 </table>
1462 <BR>';
1463 break;
1464 case "spec":
1465 if (is_array($this->thisConfig["userLinks."])) {
1466 $subcats=array();
1467 $v=$this->thisConfig["userLinks."];
1468 reset($v);
1469 while(list($k2)=each($v)) {
1470 $k2i = intval($k2);
1471 if (substr($k2,-1)=="." && is_array($v[$k2i."."])) {
1472 $title = trim($v[$k2i]);
1473 if (!$title) {
1474 $title=$v[$k2i."."]["url"];
1475 } else {
1476 $title=$LANG->sL($title,1);
1477 }
1478 $description=$v[$k2i."."]["description"] ? $LANG->sL($v[$k2i."."]["description"],1)."<BR>" : "";
1479 $onClickEvent='';
1480 if (isset($v[$k2i."."]["target"])) $onClickEvent.="setTarget('".$v[$k2i."."]["target"]."');";
1481 $v[$k2i."."]["url"] = str_replace("###_URL###",$this->siteURL,$v[$k2i."."]["url"]);
1482
1483 if (substr($v[$k2i."."]["url"],0,7)=="http://" || substr($v[$k2i."."]["url"],0,7)=="mailto:") {
1484 $onClickEvent.="cur_href=unescape('".rawurlencode($v[$k2i."."]["url"])."');link_current();";
1485 } else {
1486 $onClickEvent.="link_spec(unescape('".$this->siteURL.rawurlencode($v[$k2i."."]["url"])."'));";
1487 }
1488 $icon = ''; //'<img src="gfx/123_go.png" width="50" border=0>';
1489 $A=array('<a href="#" onclick="'.htmlspecialchars($onClickEvent).'return false;">','</a>');
1490
1491 // debug(array($onClickEvent));
1492 $subcats[$k2i]='<tr>
1493 <td bgColor="'.$this->doc->bgColor4.'" valign=top>'.$A[0].$icon.$A[1].'</td>
1494 <td bgColor="'.$this->doc->bgColor4.'" valign=top>'.$A[0].'<strong>'.$title.($curUrlInfo["info"]==$v[$k2i."."]["url"]?'<img src="gfx/blinkarrow_right.gif" width="5" height="9" align=top vspace=1 hspace=5 border=0>':'').'</strong><BR>'.$description.$A[1].'</td>
1495 </tr>';
1496 }
1497 }
1498 ksort($subcats);
1499 $content.= '<table border=0 cellpadding=1 cellspacing=1>
1500 <tr>
1501 <td bgColor="'.$this->doc->bgColor5.'" valign=top colspan=2><strong>'.$LANG->getLL("special").'</strong></td>
1502 </tr>
1503 '.implode("",$subcats).'</table><BR>';
1504 // debug($subcats);
1505 }
1506 break;
1507 case "page":
1508 default:
1509 $pagetree = t3lib_div::makeInstance("rtePageTree");
1510 $tree=$pagetree->getBrowsableTree(" AND doktype!=255");
1511 $cElements = $this->expandPage();
1512 $content.= '<table border=0 cellpadding=0 cellspacing=0>
1513 <tr>
1514 <td valign=top><font face=verdana size=1 color=black>'.$this->barheader($GLOBALS["LANG"]->getLL("pageTree").':').$tree.'</font></td>
1515 <td>&nbsp;</td>
1516 <td valign=top><font face=verdana size=1 color=black>'.$cElements.'</font></td>
1517 </tr>
1518 </table>
1519 <BR>';
1520 break;
1521 }
1522
1523 // Target:
1524 if ($act!="mail") {
1525 $ltarget='<table border=0 cellpadding=2 cellspacing=1><form name="ltargetform" id="ltargetform"><tr>';
1526 $ltarget.='<td width=90>'.$GLOBALS["LANG"]->getLL("target").':</td>';
1527 $ltarget.='<td><input type="text" name="ltarget" onChange="setTarget(this.value);" value="'.htmlspecialchars($this->setTarget).'"'.$GLOBALS["TBE_TEMPLATE"]->formWidth(20).'></td>';
1528 $ltarget.='<td><select name="ltarget_type" onChange="setTarget(this.options[this.selectedIndex].value);document.ltargetform.ltarget.value=this.options[this.selectedIndex].value;this.selectedIndex=0;">
1529 <option></option>
1530 <option value="_top">'.$GLOBALS["LANG"]->getLL("top").'</option>
1531 <option value="_blank">'.$GLOBALS["LANG"]->getLL("newWindow").'</option>
1532 </select></td>';
1533 if (($curUrlInfo["act"]=="page" || $curUrlInfo["act"]=="file") && $curUrlArray["href"]) {
1534 $ltarget.='<td><input type="submit" value="'.$GLOBALS["LANG"]->getLL("update").'" onclick="return link_current();"></td>';
1535 }
1536 $ltarget.='</tr></form></table>';
1537
1538 $content.=$ltarget;
1539 }
1540
1541 $content.= $this->doc->endPage();
1542 return $content;
1543 }
1544
1545
1546
1547
1548
1549
1550
1551 /**
1552 * TBE Record Browser (MAIN function)
1553 *
1554 * @param [type] $content: ...
1555 * @return [type] ...
1556 */
1557 function main_db($content="") {
1558 global $SOBE;
1559
1560 // Starting content:
1561 $content.=$this->doc->startPage("TBE file selector");
1562 $content.='<img src=clear.gif width=1 height=2>';
1563 $pArr = explode("|",t3lib_div::GPvar("bparams"));
1564
1565 // debug($pArr);
1566
1567 $pagetree = t3lib_div::makeInstance("TBE_PageTree");
1568 $pagetree->script="browse_links.php";
1569 $pagetree->ext_pArrPages = !strcmp($pArr[3],"pages")?1:0;
1570
1571 $tree=$pagetree->getBrowsableTree(" AND doktype!=255");
1572 $cElements = $this->TBE_expandPage($pArr[3]);
1573
1574 $content.= '<table border=0 cellpadding=0 cellspacing=0>
1575 <tr>
1576 <td valign=top><font face=verdana size=1 color=black>'.$this->barheader($GLOBALS["LANG"]->getLL("pageTree").':').$tree.'</font></td>
1577 <td>&nbsp;</td>
1578 <td valign=top><font face=verdana size=1 color=black>'.$cElements.'</font></td>
1579 </tr>
1580 </table>
1581 <BR>';
1582
1583 return $content;
1584 }
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596 /**
1597 * TBE File Browser (MAIN function)
1598 *
1599 * @param [type] $content: ...
1600 * @param [type] $mode: ...
1601 * @return [type] ...
1602 */
1603 function main_file($content="",$mode) {
1604 global $SOBE,$BE_USER;
1605
1606 // Starting content:
1607 $content.=$this->doc->startPage("TBE file selector");
1608 $content.='<img src=clear.gif width=1 height=2>';
1609 $pArr = explode("|",t3lib_div::GPvar("bparams"));
1610
1611
1612 // ***************************
1613 // Upload
1614 // ***************************
1615 $fileProcessor = t3lib_div::makeInstance("t3lib_basicFileFunctions");
1616 $fileProcessor->init($GLOBALS["FILEMOUNTS"], $GLOBALS["TYPO3_CONF_VARS"]["BE"]["fileExtensions"]);
1617 $path=t3lib_div::GPvar("expandFolder");
1618 if (!$path || !@is_dir($path)) {
1619 $path = $fileProcessor->findTempFolder()."/"; // The closest TEMP-path is found
1620 }
1621 if ($path!="/" && @is_dir($path)) {
1622 $uploadForm=$this->uploadForm($path)."<BR>";
1623 $createFolder=$this->createFolder($path)."<BR>";
1624 } else {
1625 $createFolder="";
1626 $uploadForm="";
1627 }
1628
1629 if ($BE_USER->getTSConfigVal("options.uploadFieldsInTopOfEB")) $content.=$uploadForm;
1630
1631 // FOLDER TREE:
1632
1633 $foldertree = t3lib_div::makeInstance("TBE_FolderTree");
1634 $foldertree->script="browse_links.php";
1635 $foldertree->ext_noTempRecyclerDirs = ($mode == "filedrag");
1636 $tree=$foldertree->getBrowsableTree();
1637
1638 list(,,$specUid) = explode("_",t3lib_div::GPvar("PM"));
1639
1640 if ($mode=="filedrag") {
1641 $files = $this->TBE_dragNDrop($foldertree->specUIDmap[$specUid],$pArr[3]);
1642 } else {
1643 $files = $this->TBE_expandFolder($foldertree->specUIDmap[$specUid],$pArr[3]);
1644 }
1645
1646 $content.= '<table border=0 cellpadding=0 cellspacing=0>
1647 <tr>
1648 <td valign=top><font face=verdana size=1 color=black>'.$this->barheader($GLOBALS["LANG"]->getLL("folderTree").':').$tree.'</font></td>
1649 <td>&nbsp;</td>
1650 <td valign=top><font face=verdana size=1 color=black>'.$files.'</font></td>
1651 </tr>
1652 </table>
1653 <BR>';
1654
1655 if (!$BE_USER->getTSConfigVal("options.uploadFieldsInTopOfEB")) $content.=$uploadForm;
1656 if ($BE_USER->isAdmin() || $BE_USER->getTSConfigVal("options.createFoldersInEB")) $content.=$createFolder;
1657
1658 $content.= $this->doc->endPage();
1659 return $content;
1660 }
1661 }
1662
1663 // Include extension?
1664 if (defined("TYPO3_MODE") && $TYPO3_CONF_VARS[TYPO3_MODE]["XCLASS"]["typo3/browse_links.php"]) {
1665 include_once($TYPO3_CONF_VARS[TYPO3_MODE]["XCLASS"]["typo3/browse_links.php"]);
1666 }
1667
1668
1669
1670
1671
1672
1673
1674
1675 // Make instance:
1676 $SOBE = t3lib_div::makeInstance("SC_browse_links");
1677 $SOBE->init();
1678 $SOBE->main();
1679 $SOBE->printContent();
1680 ?>