Documentation TYPO3 par Ameos

browse_links.php

00001 <?php
00002 /***************************************************************
00003 *  Copyright notice
00004 *
00005 *  (c) 1999-2004 Kasper Skaarhoj (kasperYYYY@typo3.com)
00006 *  (c) 2005-2006 Stanislas Rolland <stanislas.rolland(arobas)fructifor.ca>
00007 *  All rights reserved
00008 *
00009 *  This script is part of the TYPO3 project. The TYPO3 project is
00010 *  free software; you can redistribute it and/or modify
00011 *  it under the terms of the GNU General Public License as published by
00012 *  the Free Software Foundation; either version 2 of the License, or
00013 *  (at your option) any later version.
00014 *
00015 *  The GNU General Public License can be found at
00016 *  http://www.gnu.org/copyleft/gpl.html.
00017 *  A copy is found in the textfile GPL.txt and important notices to the license
00018 *  from the author is found in LICENSE.txt distributed with these scripts.
00019 *
00020 *
00021 *  This script is distributed in the hope that it will be useful,
00022 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00023 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00024 *  GNU General Public License for more details.
00025 *
00026 *  This copyright notice MUST APPEAR in all copies of the script!
00027 ***************************************************************/
00122 error_reporting (E_ALL ^ E_NOTICE);
00123 unset($MCONF);
00124 require ('conf.php');
00125 require ($BACK_PATH.'init.php');
00126 require ($BACK_PATH.'template.php');
00127 require_once (PATH_t3lib.'class.t3lib_browsetree.php');
00128 require_once (PATH_t3lib.'class.t3lib_foldertree.php');
00129 require_once (PATH_t3lib.'class.t3lib_stdgraphic.php');
00130 require_once (PATH_t3lib.'class.t3lib_basicfilefunc.php');
00131 
00132 $LANG->includeLLFile('EXT:rtehtmlarea/mod3/locallang.xml');
00133 
00134         // Include classes
00135 require_once (PATH_t3lib.'class.t3lib_page.php');
00136 require_once (PATH_t3lib.'class.t3lib_recordlist.php');
00137 require_once ($BACK_PATH.'class.db_list.inc');
00138 require_once ($BACK_PATH.'class.db_list_extra.inc');
00139 
00140 
00148 class TBE_browser_recordList extends localRecordList {
00149 
00158         function listURL($altId='',$table=-1,$exclList='')      {
00159                 return $BACK_PATH . t3lib_extMgm::extRelPath('rtehtmlarea') . 'mod3/' . $this->script .
00160                         '?id='.(strcmp($altId,'')?$altId:$this->id).
00161                         '&table='.rawurlencode($table==-1?$this->table:$table).
00162                         ($this->thumbs?'&imagemode='.$this->thumbs:'').
00163                         ($this->searchString?'&search_field='.rawurlencode($this->searchString):'').
00164                         ($this->searchLevels?'&search_levels='.rawurlencode($this->searchLevels):'').
00165                         ((!$exclList || !t3lib_div::inList($exclList,'sortField')) && $this->sortField?'&sortField='.rawurlencode($this->sortField):'').
00166                         ((!$exclList || !t3lib_div::inList($exclList,'sortRev')) && $this->sortRev?'&sortRev='.rawurlencode($this->sortRev):'').
00167                                 // extra:
00168                         $this->ext_addP()
00169                         ;
00170         }
00171 
00177         function ext_addP()     {
00178                 $str = '&act='.$GLOBALS['SOBE']->act.
00179                                 '&mode='.$GLOBALS['SOBE']->mode.
00180                                 '&expandPage='.$GLOBALS['SOBE']->expandPage.
00181                                 '&bparams='.rawurlencode($GLOBALS['SOBE']->bparams);
00182                 return $str;
00183         }
00184 
00194         function linkWrapItems($table,$uid,$code,$row)  {
00195                 global $TCA, $BACK_PATH;
00196 
00197                 if (!$code) {
00198                         $code = '<i>['.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.no_title',1).']</i>';
00199                 } else {
00200                         if(t3lib_div::int_from_ver($GLOBALS['TYPO_VERSION']) >= 3007000 ) {
00201                                 $code = htmlspecialchars(t3lib_div::fixed_lgd_cs($code,$this->fixedL));
00202                         } else {
00203                                 $code = htmlspecialchars(t3lib_div::fixed_lgd($code,$this->fixedL));
00204                         }
00205                 }
00206 
00207                 $titleCol = $TCA[$table]['ctrl']['label'];
00208                 $title = $row[$titleCol];
00209 
00210                 $ficon = t3lib_iconWorks::getIcon($table,$row);
00211                 $aOnClick = "return insertElement('".$table."', '".$row['uid']."', 'db', unescape('".rawurlencode($title)."'), '', '', '".$ficon."');";
00212                 $ATag = '<a href="#" onclick="'.htmlspecialchars($aOnClick).'">';
00213                 $ATag_alt = substr($ATag,0,-4).',\'\',1);">';
00214                 $ATag_e = '</a>';
00215 
00216                 return $ATag.
00217                                 '<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/plusbullet2.gif','width="18" height="16"').' title="'.$GLOBALS['LANG']->getLL('addToList',1).'" alt="" />'.
00218                                 $ATag_e.
00219                                 $ATag_alt.
00220                                 $code.
00221                                 $ATag_e;
00222         }
00223 
00231         function linkWrapTable($table,$code)    {
00232                 return $code;
00233         }
00234 }
00235 
00243 class localPageTree extends t3lib_browseTree {
00244 
00250         function localPageTree() {
00251                 $this->init();
00252                 $this->clause = ' AND doktype!=255'.$this->clause;
00253         }
00254 
00263         function wrapTitle($title,$v,$ext_pArrPages='') {
00264                 if ($this->ext_isLinkable($v['doktype'],$v['uid']))     {
00265                         $aOnClick = "return link_typo3Page('".$v['uid']."');";
00266                         return '<a href="#" onclick="'.htmlspecialchars($aOnClick).'">'.$title.'</a>';
00267                 } else {
00268                         return '<span style="color: #666666;">'.$title.'</span>';
00269                 }
00270         }
00271 
00278         function printTree($treeArr='') {
00279                 global $BACK_PATH;
00280                 $titleLen=intval($GLOBALS['BE_USER']->uc['titleLen']);
00281                 if (!is_array($treeArr))        $treeArr=$this->tree;
00282 
00283                 $out='';
00284                 $c=0;
00285 
00286                 foreach($treeArr as $k => $v)   {
00287                         $c++;
00288                         $bgColorClass = ($c+1)%2 ? 'bgColor' : 'bgColor-10';
00289                         if ($GLOBALS['SOBE']->curUrlInfo['act']=='page' && $GLOBALS['SOBE']->curUrlInfo['pageid']==$v['row']['uid'] && $GLOBALS['SOBE']->curUrlInfo['pageid'])  {
00290                                 $arrCol='<td><img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/blinkarrow_right.gif','width="5" height="9"').' class="c-blinkArrowR" alt="" /></td>';
00291                                 $bgColorClass='bgColor4';
00292                         } else {
00293                                 $arrCol='<td></td>';
00294                         }
00295 
00296                         $aOnClick = 'return jumpToUrl(\''.$this->thisScript.'?act='.$GLOBALS['SOBE']->act.'&mode='.$GLOBALS['SOBE']->mode.'&expandPage='.$v['row']['uid'].'\');';
00297                         $cEbullet = $this->ext_isLinkable($v['row']['doktype'],$v['row']['uid']) ?
00298                                                 '<a href="#" onclick="'.htmlspecialchars($aOnClick).'"><img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/ol/arrowbullet.gif','width="18" height="16"').' alt="" /></a>' :
00299                                                 '';
00300                         $out.='
00301                                 <tr class="'.$bgColorClass.'">
00302                                         <td nowrap="nowrap">'.
00303                                         $v['HTML'].
00304                                         $this->wrapTitle($this->getTitleStr($v['row'],$titleLen),$v['row'],$this->ext_pArrPages).
00305                                         '</td>'.
00306                                         $arrCol.
00307                                         '<td>'.$cEbullet.'</td>
00308                                 </tr>';
00309                 }
00310                 $out='
00311                         <!--
00312                                 Navigation Page Tree:
00313                         -->
00314                         <table border="0" cellpadding="0" cellspacing="0" id="typo3-tree">
00315                                 '.$out.'
00316                         </table>';
00317                 return $out;
00318         }
00319 
00327         function ext_isLinkable($doktype,$uid)  {
00328                 if ($uid && $doktype<199)       {
00329                         return true;
00330                 }
00331         }
00332 
00341         function PM_ATagWrap($icon,$cmd,$bMark='')      {
00342                 if ($bMark)     {
00343                         $anchor = '#'.$bMark;
00344                         $name=' name="'.$bMark.'"';
00345                 }
00346                 $aOnClick = "return jumpToUrl('".$this->script.'?PM='.$cmd."','".$anchor."');";
00347 
00348                 return '<a href="#"'.$name.' onclick="'.htmlspecialchars($aOnClick).'">'.$icon.'</a>';
00349         }
00350 
00358         function wrapIcon($icon,$row)   {
00359                 return $this->addTagAttributes($icon,' title="id='.$row['uid'].'"');
00360         }
00361 }
00362 
00370 class rtePageTree extends localPageTree {
00371 }
00372 
00380 class TBE_PageTree extends localPageTree {
00381 
00389         function ext_isLinkable($doktype,$uid)  {
00390                 return true;
00391         }
00392 
00401         function wrapTitle($title,$v,$ext_pArrPages)    {
00402                 if ($ext_pArrPages)     {
00403                         $ficon=t3lib_iconWorks::getIcon('pages',$v);
00404                         $onClick = "return insertElement('pages', '".$v['uid']."', 'db', unescape('".rawurlencode($v['title'])."'), '', '', '".$ficon."','',1);";
00405                 } else {
00406                         $onClick = 'return jumpToUrl(\'' . $this->thisScript . '?act='.$GLOBALS['SOBE']->act.'&mode='.$GLOBALS['SOBE']->mode.'&expandPage='.$v['uid'].'\');';
00407                 }
00408                 return '<a href="#" onclick="'.htmlspecialchars($onClick).'">'.$title.'</a>';
00409         }
00410 }
00411 
00420 class localFolderTree extends t3lib_folderTree {
00421         var $ext_IconMode=1;
00422 
00430         function wrapTitle($title,$v)   {
00431                 if ($this->ext_isLinkable($v))  {
00432                         $aOnClick = 'return jumpToUrl(\''.$this->thisScript.'?act='.$GLOBALS['SOBE']->act.'&mode='.$GLOBALS['SOBE']->mode.'&expandFolder='.rawurlencode($v['path']).'\');';
00433                         return '<a href="#" onclick="'.htmlspecialchars($aOnClick).'">'.$title.'</a>';
00434                 } else {
00435                         return '<span class="typo3-dimmed">'.$title.'</span>';
00436                 }
00437         }
00438 
00445         function ext_isLinkable($v)     {
00446                 $webpath=t3lib_BEfunc::getPathType_web_nonweb($v['path']);      // Checking, if the input path is a web-path.
00447                 if (strstr($v['path'],'_recycler_') || strstr($v['path'],'_temp_') || $webpath!='web')  {
00448                         return 0;
00449                 }
00450                 return 1;
00451         }
00452 
00462         function PM_ATagWrap($icon,$cmd,$bMark='')      {
00463                 if ($bMark)     {
00464                         $anchor = '#'.$bMark;
00465                         $name=' name="'.$bMark.'"';
00466                 }
00467                 $aOnClick = 'return jumpToUrl(\''.$this->thisScript.'?PM='.$cmd.'\',\''.$anchor.'\');';
00468                 return '<a href="#"'.$name.' onclick="'.htmlspecialchars($aOnClick).'">'.$icon.'</a>';
00469         }
00470 
00477         function printTree($treeArr='') {
00478                 global $BACK_PATH;
00479                 $titleLen=intval($GLOBALS['BE_USER']->uc['titleLen']);
00480 
00481                 if (!is_array($treeArr))        $treeArr=$this->tree;
00482                 $out='';
00483                 $c=0;
00484                         // Preparing the current-path string (if found in the listing we will see a red blinking arrow).
00485                 if (!$GLOBALS['SOBE']->curUrlInfo['value'])     {
00486                         $cmpPath='';
00487                 } else if (substr(trim($GLOBALS['SOBE']->curUrlInfo['info']),-1)!='/')  {
00488                         $cmpPath=PATH_site.dirname($GLOBALS['SOBE']->curUrlInfo['info']).'/';
00489                 } else {
00490                         $cmpPath=PATH_site.$GLOBALS['SOBE']->curUrlInfo['info'];
00491                 }
00492 
00493                         // Traverse rows for the tree and print them into table rows:
00494                 foreach($treeArr as $k => $v)   {
00495                         $c++;
00496                         $bgColorClass=($c+1)%2 ? 'bgColor' : 'bgColor-10';
00497 
00498                                 // Creating blinking arrow, if applicable:
00499                         if ($GLOBALS['SOBE']->curUrlInfo['act']=='file' && $cmpPath==$v['row']['path']) {
00500                                 $arrCol='<td><img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/blinkarrow_right.gif','width="5" height="9"').' class="c-blinkArrowR" alt="" /></td>';
00501                                 $bgColorClass='bgColor4';
00502                         } else {
00503                                 $arrCol='<td></td>';
00504                         }
00505                                 // Create arrow-bullet for file listing (if folder path is linkable):
00506                         $aOnClick = 'return jumpToUrl(\''.$this->thisScript.'?act='.$GLOBALS['SOBE']->act.'&mode='.$GLOBALS['SOBE']->mode.'&expandFolder='.rawurlencode($v['row']['path']).'\');';
00507                         $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>' : '';
00508 
00509                                 // Put table row with folder together:
00510                         if(t3lib_div::int_from_ver($GLOBALS['TYPO_VERSION']) >= 3007000 ) {
00511                                 $out.='
00512                                         <tr class="'.$bgColorClass.'">
00513                                                 <td nowrap="nowrap">'.$v['HTML'].$this->wrapTitle(t3lib_div::fixed_lgd_cs($v['row']['title'],$titleLen),$v['row']).'</td>
00514                                                 '.$arrCol.'
00515                                                 <td>'.$cEbullet.'</td>
00516                                         </tr>';
00517                         } else {
00518                                 $out.='
00519                                         <tr class="'.$bgColorClass.'">
00520                                                 <td nowrap="nowrap">'.$v['HTML'].$this->wrapTitle(t3lib_div::fixed_lgd($v['row']['title'],$titleLen),$v['row']).'</td>
00521                                                 '.$arrCol.'
00522                                                 <td>'.$cEbullet.'</td>
00523                                         </tr>';
00524                         }
00525                 }
00526 
00527                 $out='
00528                         <!--
00529                                 Folder tree:
00530                         -->
00531                         <table border="0" cellpadding="0" cellspacing="0" id="typo3-tree">
00532                                 '.$out.'
00533                         </table>';
00534                 return $out;
00535         }
00536 }
00537 
00545 class rteFolderTree extends localFolderTree {
00546 }
00547 
00555 class TBE_FolderTree extends localFolderTree {
00556         var $ext_noTempRecyclerDirs=0;          // If file-drag mode is set, temp and recycler folders are filtered out.
00557 
00564         function ext_isLinkable($v)     {
00565                 if ($this->ext_noTempRecyclerDirs && (substr($v['path'],-7)=='_temp_/' || substr($v['path'],-11)=='_recycler_/'))       {
00566                         return 0;
00567                 } return 1;
00568         }
00569 
00577         function wrapTitle($title,$v)   {
00578                 if ($this->ext_isLinkable($v))  {
00579                         $aOnClick = 'return jumpToUrl(\'' . $this->thisScript . '?act=' . $GLOBALS['SOBE']->act.'&mode='.$GLOBALS['SOBE']->mode.'&expandFolder='.rawurlencode($v['path']).'\');';
00580                         return '<a href="#" onclick="'.htmlspecialchars($aOnClick).'">'.$title.'</a>';
00581                 } else {
00582                         return '<span class="typo3-dimmed">'.$title.'</span>';
00583                 }
00584         }
00585 }
00586 
00594 class tx_rtehtmlarea_browse_links {
00595 //class SC_browse_links {
00596 
00597                 // Internal, static:
00598         var $siteURL;                   // Current site URL (Frontend)
00599         var $thisConfig;                // RTE specific TSconfig
00600         var $setTarget;                 // Target (RTE specific)
00601         var $setClass;                  // Class (RTE specific)
00602         var $setTitle;                  // Title(RTE specific)
00603         var $doc;                               // Backend template object
00604         var $script='browse_links.php';
00605         var $typoVersion;                               // Typo3 version
00606 
00607                 // GPvars:      (Input variables from outside)
00618         var $mode;
00619 
00625         var $act;
00626 
00630         var $expandPage;
00631 
00635         var $expandFolder;
00636 
00640         var $P;
00641 
00646         var $bparams;
00647 
00652         var $RTEtsConfigParams;
00653 
00657         var $PM;
00658 
00662         var $pointer;
00663 
00667         var $curUrlArray;
00668 
00672         var $curUrlInfo;
00673 
00680         function init() {
00681                 global $BE_USER,$BACK_PATH,$LANG;
00682                 $this->typoVersion = t3lib_div::int_from_ver($GLOBALS['TYPO_VERSION']);
00683 
00684                         // Main GPvars:
00685                 $this->pointer = t3lib_div::_GP('pointer');
00686                 $this->bparams = t3lib_div::_GP('bparams');
00687                 $this->P = t3lib_div::_GP('P');
00688                 $this->RTEtsConfigParams = t3lib_div::_GP('RTEtsConfigParams');
00689                 $this->expandPage = t3lib_div::_GP('expandPage');
00690                 $this->expandFolder = t3lib_div::_GP('expandFolder');
00691                 $this->PM = t3lib_div::_GP('PM');
00692                 $this->contentTypo3Language = t3lib_div::_GP('typo3ContentLanguage');
00693                 $this->contentTypo3Charset = t3lib_div::_GP('typo3ContentCharset');
00694 
00695                         // Find "mode"
00696                 $this->mode=t3lib_div::_GP('mode');
00697                 if (!$this->mode)       {
00698                         $this->mode='rte';
00699                 }
00700 
00701                         // Site URL
00702                 $this->siteURL = t3lib_div::getIndpEnv('TYPO3_SITE_URL');       // Current site url
00703 
00704                         // CurrentUrl - the current link url must be passed around if it exists
00705                 if ($this->mode=='wizard')      {
00706                         $currentLinkParts = t3lib_div::trimExplode(' ',$this->P['currentValue']);
00707                         $this->curUrlArray = array(
00708                                 'target' => $currentLinkParts[1]
00709                         );
00710                         $this->curUrlInfo=$this->parseCurUrl($this->siteURL.'?id='.$currentLinkParts[0],$this->siteURL);
00711                 } else {
00712                         $this->curUrlArray = t3lib_div::_GP('curUrl');
00713                         if ($this->curUrlArray['all'])  {
00714                                 $this->curUrlArray=t3lib_div::get_tag_attributes($this->curUrlArray['all']);
00715                         }
00716                         $this->curUrlInfo=$this->parseCurUrl($this->curUrlArray['href'],$this->siteURL);
00717                 }
00718 
00719                         // Determine nature of current url:
00720                 $this->act=t3lib_div::_GP('act');
00721                 if (!$this->act)        {
00722                         $this->act=$this->curUrlInfo['act'];
00723                 }
00724 
00725                         // Initializing the titlevalue (RTE)
00726                 $this->setTitle = $LANG->csConvObj->conv($this->curUrlArray['title'], 'utf-8', $LANG->charSet);
00727 
00728                         // Rich Text Editor specific configuration:
00729                 $addPassOnParams='';
00730                 if ((string)$this->mode=='rte') {
00731                         $RTEtsConfigParts = explode(':',$this->RTEtsConfigParams);
00732                         $addPassOnParams .= '&RTEtsConfigParams='.rawurlencode($this->RTEtsConfigParams);
00733                         $addPassOnParams .= ($this->contentTypo3Language ? '&typo3ContentLanguage=' . rawurlencode($this->contentTypo3Language) : '');
00734                         $addPassOnParams .= ($this->contentTypo3Charset ? '&typo3ContentCharset=' . rawurlencode($this->contentTypo3Charset) : '');
00735                         $RTEsetup = $GLOBALS['BE_USER']->getTSConfig('RTE',t3lib_BEfunc::getPagesTSconfig($RTEtsConfigParts[5]));
00736                         $this->thisConfig = t3lib_BEfunc::RTEsetup($RTEsetup['properties'],$RTEtsConfigParts[0],$RTEtsConfigParts[2],$RTEtsConfigParts[4]);
00737                         if($this->thisConfig['classesAnchor']) {
00738                                 $this->setClass = $this->curUrlArray['class'];
00739                                 $classesAnchorArray = t3lib_div::trimExplode(',',$this->thisConfig['classesAnchor'],1);
00740                                 $anchorTypes = array( 'page', 'url', 'file', 'mail', 'spec');
00741                                 $classesAnchor = array();
00742                                 $classesAnchorDefault = array();
00743                                 $this->classesAnchorDefaultTitle = array();
00744                                 $classesAnchor['all'] = array();
00745                                 if (is_array($RTEsetup['properties']['classesAnchor.'])) {
00746                                         reset($RTEsetup['properties']['classesAnchor.']);
00747                                         while(list($label,$conf)=each($RTEsetup['properties']['classesAnchor.'])) {
00748                                                 $classesAnchor['all'][] = $conf['class'];
00749                                                 if (in_array($conf['type'], $anchorTypes)) {
00750                                                         $classesAnchor[$conf['type']][] = $conf['class'];
00751                                                         if (is_array($this->thisConfig['classesAnchor.']) && is_array($this->thisConfig['classesAnchor.']['default.']) && $this->thisConfig['classesAnchor.']['default.'][$conf['type']] == $conf['class']) {
00752                                                                 $classesAnchorDefault[$conf['type']] = $conf['class'];
00753                                                                 if ($conf['titleText'] && $this->typoVersion >= 3008002) {
00754                                                                         $string = trim($conf['titleText']);
00755                                                                         if (substr($string,0,4)=='LLL:') {       // language file
00756                                                                                 $arr = explode(':',$string);
00757                                                                                 if($arr[0] == 'LLL' && $arr[1] == 'EXT') {
00758                                                                                         $BE_lang = $LANG->lang;
00759                                                                                         $BE_origCharset = $LANG->origCharSet;
00760                                                                                         $LANG->lang = $this->contentTypo3Language;
00761                                                                                         $LANG->origCharSet = $LANG->csConvObj->charSetArray[$this->contentTypo3Language];
00762                                                                                         $LANG->origCharSet = $LANG->origCharSet ? $LANG->origCharSet : 'iso-8859-1';
00763                                                                                         $string = $LANG->getLLL($arr[3], $LANG->readLLfile($arr[1].':'.$arr[2]), true);
00764                                                                                         $LANG->lang = $BE_lang;
00765                                                                                         $LANG->origCharSet = $BE_origCharset;
00766                                                                                 }
00767                                                                         }
00768                                                                         $this->classesAnchorDefaultTitle[$conf['type']] = $string;
00769                                                                 }
00770                                                         }
00771                                                 }
00772                                         }
00773                                 }
00774                                 $this->classesAnchorJSOptions = array();
00775                                 reset($anchorTypes);
00776                                 while (list(, $anchorType) = each($anchorTypes) ) {
00777                                         reset($classesAnchorArray);
00778                                         while(list(,$class)=each($classesAnchorArray)) {
00779                                                 if (!in_array($class, $classesAnchor['all']) || (in_array($class, $classesAnchor['all']) && is_array($classesAnchor[$anchorType]) && in_array($class, $classesAnchor[$anchorType]))) {
00780                                                         $selected = '';
00781                                                         if ($this->setClass == $class) $selected = 'selected="selected"';
00782                                                         if (!$this->setClass && $classesAnchorDefault[$anchorType] == $class) {
00783                                                                 $selected = 'selected="selected"';
00784                                                         }
00785                                                         $this->classesAnchorJSOptions[$anchorType] .= '<option ' . $selected . ' value="' .$class . '">' . $class . '</option>';
00786                                                 }
00787                                         }
00788                                         if ($this->classesAnchorJSOptions[$anchorType]) {
00789                                                 $selected = '';
00790                                                 if (!$this->setClass && !$classesAnchorDefault[$anchorType])  $selected = 'selected="selected"';
00791                                                 $this->classesAnchorJSOptions[$anchorType] =  '<option ' . $selected . ' value=""></option>' . $this->classesAnchorJSOptions[$anchorType];
00792                                         }
00793                                 }
00794                         }
00795                 }
00796 
00797                         // Initializing the target value (RTE)
00798                 $this->setTarget = $this->curUrlArray['target'];
00799                 if ($this->thisConfig['defaultLinkTarget'] && !isset($this->curUrlArray['target']))     {
00800                         $this->setTarget=$this->thisConfig['defaultLinkTarget'];
00801                 }
00802 
00803                         // Creating backend template object:
00804                 $this->doc = t3lib_div::makeInstance('template');
00805                 $this->doc->docType= 'xhtml_trans';
00806                 $this->doc->backPath = $BACK_PATH;
00807 
00808                         // BEGIN accumulation of header JavaScript:
00809                 $JScode = '';
00810                 $JScode.= '
00811                         var editor = parent.editor;
00812                         var HTMLArea = parent.HTMLArea;
00813                                 // This JavaScript is primarily for RTE/Link. jumpToUrl is used in the other cases as well...
00814                         var add_href="'.($this->curUrlArray['href']?'&curUrl[href]='.rawurlencode($this->curUrlArray['href']):'').'";
00815                         var add_target="'.($this->setTarget?'&curUrl[target]='.rawurlencode($this->setTarget):'').'";
00816                         var add_class="'.($this->setClass?'&curUrl[class]='.rawurlencode($this->setClass):'').'";
00817                         var add_title="'.($this->setTitle?'&curUrl[title]='.rawurlencode($this->setTitle):'').'";
00818                         var add_params="'.($this->bparams?'&bparams='.rawurlencode($this->bparams):'').'";
00819 
00820                         var cur_href="'.($this->curUrlArray['href']?$this->curUrlArray['href']:'').'";
00821                         var cur_target="'.($this->setTarget?$this->setTarget:'').'";
00822                         var cur_class="'.($this->setClass?$this->setClass:'').'";
00823                         var cur_title="'.($this->setTitle?$this->setTitle:'').'";
00824 
00825                         function setTarget(value)       {
00826                                 cur_target=value;
00827                                 add_target="&curUrl[target]="+encodeURIComponent(value);
00828                         }
00829                         function setClass(value)        {
00830                                 cur_class=value;
00831                                 add_class="&curUrl[class]="+encodeURIComponent(value);
00832                         }
00833                         function setTitle(value)        {
00834                                 cur_title=value;
00835                                 add_title="&curUrl[title]="+encodeURIComponent(value);
00836                         }
00837                         function setValue(value)        {
00838                                 cur_href=value;
00839                                 add_href="&curUrl[href]="+value;
00840                         }
00841 ';
00842 
00843                 if ($this->mode=='wizard')      {       // Functions used, if the link selector is in wizard mode (= TCEforms fields)
00844                         unset($this->P['fieldChangeFunc']['alert']);
00845                         reset($this->P['fieldChangeFunc']);
00846                         $update='';
00847                         while(list($k,$v)=each($this->P['fieldChangeFunc']))    {
00848 
00849                                 $update.= '
00850                                 window.opener.'.$v;
00851                         }
00852 
00853                         $P2=array();
00854                         $P2['itemName']=$this->P['itemName'];
00855                         $P2['formName']=$this->P['formName'];
00856                         $P2['fieldChangeFunc']=$this->P['fieldChangeFunc'];
00857                         $addPassOnParams.=t3lib_div::implodeArrayForUrl('P',$P2);
00858 
00859                         $JScode.='
00860                                 function link_typo3Page(id,anchor)      {       //
00861                                         updateValueInMainForm(id+(anchor?anchor:"")+" "+cur_target);
00862                                         close();
00863                                         return false;
00864                                 }
00865                                 function link_folder(folder)    {       //
00866                                         updateValueInMainForm(folder+" "+cur_target);
00867                                         close();
00868                                         return false;
00869                                 }
00870                                 function link_current() {       //
00871                                         if (cur_href!="http://" && cur_href!="mailto:") {
00872                                                 var setValue = cur_href+" "+cur_target+" "+cur_class+" "+cur_title;
00873                                                 if (setValue.substr(0,7)=="http://")    setValue = setValue.substr(7);
00874                                                 if (setValue.substr(0,7)=="mailto:")    setValue = setValue.substr(7);
00875                                                 updateValueInMainForm(setValue);
00876                                                 close();
00877                                         }
00878                                         return false;
00879                                 }
00880                                 function checkReference()       {       //
00881                                         if (window.opener && window.opener.document && window.opener.document.'.$this->P['formName'].' && window.opener.document.'.$this->P['formName'].'["'.$this->P['itemName'].'"] ) {
00882                                                 return window.opener.document.'.$this->P['formName'].'["'.$this->P['itemName'].'"];
00883                                         } else {
00884                                                 close();
00885                                         }
00886                                 }
00887                                 function updateValueInMainForm(input)   {       //
00888                                         var field = checkReference();
00889                                         if (field)      {
00890                                                 field.value = input;
00891                                                 '.$update.'
00892                                         }
00893                                 }
00894                         ';
00895                 } else {        // Functions used, if the link selector is in RTE mode:
00896                         $JScode.='
00897                                 function link_typo3Page(id,anchor)      {
00898                                         var theLink = \''.$this->siteURL.'?id=\'+id+(anchor?anchor:"");
00899                                         if (document.ltargetform.anchor_title) setTitle(document.ltargetform.anchor_title.value);
00900                                         if (document.ltargetform.anchor_class) setClass(document.ltargetform.anchor_class.value);
00901                                         editor.renderPopup_addLink(theLink,cur_target,cur_class,cur_title);
00902                                         return false;
00903                                 }
00904                                 function link_folder(folder)    {       //
00905                                         var theLink = \''.$this->siteURL.'\'+folder;
00906                                         if (document.ltargetform.anchor_title) setTitle(document.ltargetform.anchor_title.value);
00907                                         if (document.ltargetform.anchor_class) setClass(document.ltargetform.anchor_class.value);
00908                                         editor.renderPopup_addLink(theLink,cur_target,cur_class,cur_title);
00909                                         return false;
00910                                 }
00911                                 function link_spec(theLink)     {       //
00912                                         if (document.ltargetform.anchor_title) setTitle(document.ltargetform.anchor_title.value);
00913                                         if (document.ltargetform.anchor_class) setClass(document.ltargetform.anchor_class.value);
00914                                         editor.renderPopup_addLink(theLink,cur_target,cur_class,cur_title);
00915                                         return false;
00916                                 }
00917                                 function link_current() {       //
00918                                         if (document.ltargetform.anchor_title) setTitle(document.ltargetform.anchor_title.value);
00919                                         if (document.ltargetform.anchor_class) setClass(document.ltargetform.anchor_class.value);
00920                                         if (cur_href!="http://" && cur_href!="mailto:") {
00921                                                 editor.renderPopup_addLink(cur_href,cur_target,cur_class,cur_title);
00922                                         }
00923                                         return false;
00924                                 }
00925                         ';
00926                 }
00927 
00928                         // General "jumpToUrl" function:
00929                 $JScode.='
00930                         function jumpToUrl(URL,anchor)  {       //
00931                                 var add_act = URL.indexOf("act=")==-1 ? "&act='.$this->act.'" : "";
00932                                 var add_mode = URL.indexOf("mode=")==-1 ? "&mode='.$this->mode.'" : "";
00933                                 var theLocation = URL+add_act+add_mode+add_href+add_target+add_class+add_title+add_params'.($addPassOnParams?'+"'.$addPassOnParams.'"':'').'+(anchor?anchor:"");
00934                                 window.location.href = theLocation;
00935                                 return false;
00936                         }
00937                 ';
00938 
00939                         // This is JavaScript especially for the TBE Element Browser!
00940                 $pArr = explode('|',$this->bparams);
00941                 $formFieldName = 'data['.$pArr[0].']['.$pArr[1].']['.$pArr[2].']';
00942                 $JScode.='
00943                         var elRef="";
00944                         var targetDoc="";
00945 
00946                         function launchView(url)        {       //
00947                                 var thePreviewWindow="";
00948                                 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");
00949                                 if (thePreviewWindow && thePreviewWindow.focus) {
00950                                         thePreviewWindow.focus();
00951                                 }
00952                         }
00953                         function setReferences()        {       //
00954                                 if (parent.window.opener
00955                                 && parent.window.opener.content
00956                                 && parent.window.opener.content.document.editform
00957                                 && parent.window.opener.content.document.editform["'.$formFieldName.'"]
00958                                                 ) {
00959                                         targetDoc = parent.window.opener.content.document;
00960                                         elRef = targetDoc.editform["'.$formFieldName.'"];
00961                                         return true;
00962                                 } else {
00963                                         return false;
00964                                 }
00965                         }
00966                         function insertElement(table, uid, type, filename,fp,filetype,imagefile,action, close)  {       //
00967                                 if (1=='.($pArr[0]&&!$pArr[1]&&!$pArr[2] ? 1 : 0).')    {
00968                                         addElement(filename,table+"_"+uid,fp,close);
00969                                 } else {
00970                                         if (setReferences())    {
00971                                                 parent.window.opener.group_change("add","'.$pArr[0].'","'.$pArr[1].'","'.$pArr[2].'",elRef,targetDoc);
00972                                         } else {
00973                                                 alert("Error - reference to main window is not set properly!");
00974                                         }
00975                                         if (close)      {
00976                                                 parent.window.opener.focus();
00977                                                 parent.close();
00978                                         }
00979                                 }
00980                                 return false;
00981                         }
00982                         function addElement(elName,elValue,altElValue,close)    {       //
00983                                 if (parent.window.opener && parent.window.opener.setFormValueFromBrowseWin)     {
00984                                         parent.window.opener.setFormValueFromBrowseWin("'.$pArr[0].'",altElValue?altElValue:elValue,elName);
00985                                         if (close)      {
00986                                                 parent.window.opener.focus();
00987                                                 parent.close();
00988                                         }
00989                                 } else {
00990                                         alert("Error - reference to main window is not set properly!");
00991                                         parent.close();
00992                                 }
00993                         }
00994                 ';
00995 
00996                         // Finally, add the accumulated JavaScript to the template object:
00997                 $this->doc->JScode = $this->doc->wrapScriptTags($JScode);
00998 
00999                         // Debugging:
01000                 if (FALSE) debug(array(
01001                         'pointer' => $this->pointer,
01002                         'act' => $this->act,
01003                         'mode' => $this->mode,
01004                         'curUrlInfo' => $this->curUrlInfo,
01005                         'curUrlArray' => $this->curUrlArray,
01006                         'P' => $this->P,
01007                         'bparams' => $this->bparams,
01008                         'RTEtsConfigParams' => $this->RTEtsConfigParams,
01009                         'expandPage' => $this->expandPage,
01010                         'expandFolder' => $this->expandFolder,
01011                         'PM' => $this->PM,
01012                 ),'Internal variables of Script Class:');
01013         }
01014 
01020         function main() {
01021                 global $BE_USER;
01022 
01023                 $modData = $BE_USER->getModuleData($this->script,'ses');
01024 
01025                         // Output the correct content according to $this->mode
01026                 switch((string)$this->mode)     {
01027                         case 'rte':
01028                                 $this->content=$this->main_rte();
01029                         break;
01030                         case 'db':
01031                                 if (isset($this->expandPage))   {
01032                                         $modData['expandPage']=$this->expandPage;
01033                                         $BE_USER->pushModuleData($this->script,$modData);
01034                                 } else {
01035                                         $this->expandPage=$modData['expandPage'];
01036                                 }
01037                                 $this->content=$this->main_db();
01038                         break;
01039                         case 'file':
01040                         case 'filedrag':
01041                                 if (isset($this->expandFolder)) {
01042                                         $modData['expandFolder']=$this->expandFolder;
01043                                         $BE_USER->pushModuleData($this->script,$modData);
01044                                 } else {
01045                                         $this->expandFolder=$modData['expandFolder'];
01046                                 }
01047                                 $this->content=$this->main_file();
01048                         break;
01049                         case 'wizard':
01050                                 $this->content=$this->main_rte(1);
01051                         break;
01052                 }
01053         }
01054 
01060         function printContent() {
01061                 echo $this->content;
01062         }
01063 
01064         /******************************************************************
01065          *
01066          * Main functions
01067          *
01068          ******************************************************************/
01077         function main_rte($wiz=0)       {
01078                 global $LANG, $BE_USER, $BACK_PATH;
01079 
01080                         // Starting content:
01081                 $content=$this->doc->startPage('RTE link');
01082 
01083                         // Initializing the action value, possibly removing blinded values etc:
01084                 $allowedItems = array_diff(explode(',','page,file,url,mail,spec'),t3lib_div::trimExplode(',',$this->thisConfig['blindLinkOptions'],1));
01085                 reset($allowedItems);
01086                 if (!in_array($this->act,$allowedItems))        $this->act = current($allowedItems);
01087 
01088                         // Making menu in top:
01089                 if($this->typoVersion >= 3007000 ) {
01090                 $menuDef = array();
01091                 if (!$wiz)      {
01092                         $menuDef['removeLink']['isActive'] = $this->act=='removeLink';
01093                         $menuDef['removeLink']['label'] = $LANG->getLL('removeLink',1);
01094                         $menuDef['removeLink']['url'] = '#';
01095                         $menuDef['removeLink']['addParams'] = 'onclick="editor.renderPopup_unLink();return false;"';
01096                 }
01097                 if (in_array('page',$allowedItems)) {
01098                         $menuDef['page']['isActive'] = $this->act=='page';
01099                         $menuDef['page']['label'] = $LANG->getLL('page',1);
01100                         $menuDef['page']['url'] = '#';
01101                         $menuDef['page']['addParams'] = 'onclick="jumpToUrl(\'?act=page\');return false;"';
01102 
01103                 }
01104                 if (in_array('file',$allowedItems)){
01105                         $menuDef['file']['isActive'] = $this->act=='file';
01106                         $menuDef['file']['label'] = $LANG->getLL('file',1);
01107                         $menuDef['file']['url'] = '#';
01108                         $menuDef['file']['addParams'] = 'onclick="jumpToUrl(\'?act=file\');return false;"';
01109                 }
01110                 if (in_array('url',$allowedItems)) {
01111                         $menuDef['url']['isActive'] = $this->act=='url';
01112                         $menuDef['url']['label'] = $LANG->getLL('extUrl',1);
01113                         $menuDef['url']['url'] = '#';
01114                         $menuDef['url']['addParams'] = 'onclick="jumpToUrl(\'?act=url\');return false;"';
01115                 }
01116                 if (in_array('mail',$allowedItems)) {
01117                         $menuDef['mail']['isActive'] = $this->act=='mail';
01118                         $menuDef['mail']['label'] = $LANG->getLL('email',1);
01119                         $menuDef['mail']['url'] = '#';
01120                         $menuDef['mail']['addParams'] = 'onclick="jumpToUrl(\'?act=mail\');return false;"';
01121 
01122                 }
01123 
01124                 if (is_array($this->thisConfig['userLinks.']) && in_array('spec',$allowedItems)) {
01125                         $menuDef['spec']['isActive'] = $this->act=='spec';
01126                         $menuDef['spec']['label'] = $LANG->getLL('special',1);
01127                         $menuDef['spec']['url'] = '#';
01128                         $menuDef['spec']['addParams'] = 'onclick="jumpToUrl(\'?act=spec\');return false;"';
01129                 }
01130                 $content .= $this->doc->getTabMenuRaw($menuDef);
01131 
01132                         // Adding the menu and header to the top of page:
01133                 $content.=$this->printCurrentUrl($this->curUrlInfo['info']).'<br />';
01134 
01135                 } else {  // TYPO3 3.6.0
01136                 $menu='
01137                         <!--
01138                                 RTE Link top menu:
01139                         -->
01140                         <table border="0" cellpadding="2" cellspacing="1" id="typo3-RTElinkMenu">
01141                                 <tr>
01142                                         ';
01143                 $bgcolor=' class="bgColor4"';
01144                 $bgcolorA=' class="bgColor5"';
01145                 if (!$wiz)      $menu.='<td'.$bgcolor.'><a href="#" onclick="editor.renderPopup_unLink();return false;">'.$GLOBALS['LANG']->getLL('removeLink',1).'</a></td>';
01146                 if (in_array('page',$allowedItems))     $menu.='
01147                                         <td'.($this->act=='page'?$bgcolorA:$bgcolor).'><a href="#" onclick="jumpToUrl(\'?act=page\');return false;">'.$GLOBALS['LANG']->getLL('page',1).'</a></td>';
01148                 if (in_array('file',$allowedItems))     $menu.='
01149 
01150                                         <td'.($this->act=='file'?$bgcolorA:$bgcolor).'><a href="#" onclick="jumpToUrl(\'?act=file\');return false;">'.$GLOBALS['LANG']->getLL('file',1).'</a></td>';
01151                 if (in_array('url',$allowedItems))      $menu.='
01152                                         <td'.($this->act=='url'?$bgcolorA:$bgcolor).'><a href="#" onclick="jumpToUrl(\'?act=url\');return false;">'.$GLOBALS['LANG']->getLL('extUrl',1).'</a></td>';
01153                 if (in_array('mail',$allowedItems))     $menu.='
01154                                         <td'.($this->act=='mail'?$bgcolorA:$bgcolor).'><a href="#" onclick="jumpToUrl(\'?act=mail\');return false;">'.$GLOBALS['LANG']->getLL('email',1).'</a></td>';
01155                 if (is_array($this->thisConfig['userLinks.']) && in_array('spec',$allowedItems))        $menu.='
01156                                         <td'.($this->act=='spec'?$bgcolorA:$bgcolor).'><a href="#" onclick="jumpToUrl(\'?act=spec\');return false;">'.$GLOBALS['LANG']->getLL('special',1).'</a></td>';
01157 
01158                 $menu.='
01159                                 </tr>
01160                         </table>';
01161 
01162                         // Adding the menu and header to the top of page:
01163                 $content.=$this->printCurrentUrl($this->curUrlInfo['info']);
01164                 $content.=$menu;
01165                 }
01166 
01167                         // Depending on the current action we will create the actual module content for selecting a link:
01168                 switch($this->act)      {
01169                         case 'mail':
01170                                 $extUrl='
01171                         <!--
01172                                 Enter mail address:
01173                         -->
01174                                         <form action="" name="lurlform" id="lurlform">
01175                                                 <table border="0" cellpadding="2" cellspacing="1" id="typo3-linkMail">
01176                                                         <tr>
01177                                                                 <td>'.$GLOBALS['LANG']->getLL('emailAddress',1).':</td>
01178                                                                 <td><input type="text" name="lemail"'.$this->doc->formWidth(20).' value="'.htmlspecialchars($this->curUrlInfo['act']=='mail'?$this->curUrlInfo['info']:'').'" /> '.
01179                                                                         '<input type="submit" value="'.$GLOBALS['LANG']->getLL('setLink',1).'" onclick="setTarget(\'\');setValue(\'mailto:\'+document.lurlform.lemail.value); return link_current();" /></td>
01180                                                         </tr>
01181                                                 </table>
01182                                         </form>';
01183                                 $content.=$extUrl;
01184                         break;
01185                         case 'url':
01186                                 $extUrl='
01187                         <!--
01188                                 Enter External URL:
01189                         -->
01190                                         <form action="" name="lurlform" id="lurlform">
01191                                                 <table border="0" cellpadding="2" cellspacing="1" id="typo3-linkURL">
01192                                                         <tr>
01193                                                                 <td>URL:</td>
01194                                                                 <td><input type="text" name="lurl"'.$this->doc->formWidth(20).' value="'.htmlspecialchars($this->curUrlInfo['act']=='url'?$this->curUrlInfo['info']:'http://').'" /> '.
01195                                                                         '<input type="submit" value="'.$GLOBALS['LANG']->getLL('setLink',1).'" onclick="setValue(document.lurlform.lurl.value); return link_current();" /></td>
01196                                                         </tr>
01197                                                 </table>
01198                                         </form>';
01199                                 $content.=$extUrl;
01200                         break;
01201                         case 'file':
01202                                 $foldertree = t3lib_div::makeInstance('rteFolderTree');
01203                                 $foldertree->thisScript = $this->script;
01204                                 $tree=$foldertree->getBrowsableTree();
01205 
01206                                 if (!$this->curUrlInfo['value'] || $this->curUrlInfo['act']!='file')    {
01207                                         $cmpPath='';
01208                                 } elseif (substr(trim($this->curUrlInfo['info']),-1)!='/')      {
01209                                         $cmpPath=PATH_site.dirname($this->curUrlInfo['info']).'/';
01210                                         if (!isset($this->expandFolder))                        $this->expandFolder = $cmpPath;
01211                                 } else {
01212                                         $cmpPath=PATH_site.$this->curUrlInfo['info'];
01213                                 }
01214 
01215                                 list(,,$specUid) = explode('_',$this->PM);
01216                                 $files = $this->expandFolder($foldertree->specUIDmap[$specUid]);
01217 //<Peter Niederlag: allow uploads from file-link dialog>
01218                                         // Create upload/create folder forms, if a path is given:
01219                                 $fileProcessor = t3lib_div::makeInstance('t3lib_basicFileFunctions');
01220                                 $fileProcessor->init($GLOBALS['FILEMOUNTS'], $GLOBALS['TYPO3_CONF_VARS']['BE']['fileExtensions']);
01221                                 $path=$this->expandFolder;
01222                                 if (!$path || !@is_dir($path))  {
01223                                         $path = $fileProcessor->findTempFolder().'/';   // The closest TEMP-path is found
01224                                 }
01225                                 if ($path!='/' && @is_dir($path))       {
01226                                         $uploadForm=$this->uploadForm($path);
01227                                         $createFolder=$this->createFolder($path);
01228                                 } else {
01229                                         $createFolder='';
01230                                         $uploadForm='';
01231                                 }
01232                                 if ($BE_USER->getTSConfigVal('options.uploadFieldsInTopOfEB'))  $content.=$uploadForm;
01233 //</Peter Niederlag: allow uploads from file-link dialog>
01234 
01235                                 $content.= '
01236                         <!--
01237                         Wrapper table for folder tree / file list:
01238                         -->
01239                                         <table border="0" cellpadding="0" cellspacing="0" id="typo3-linkFiles">
01240                                                 <tr>
01241                                                         <td class="c-wCell" valign="top">'.$this->barheader($GLOBALS['LANG']->getLL('folderTree').':').$tree.'</td>
01242                                                         <td class="c-wCell" valign="top">'.$files.'</td>
01243                                                 </tr>
01244                                         </table>
01245                                         ';
01246                         break;
01247                         case 'spec':
01248                                 if (is_array($this->thisConfig['userLinks.']))  {
01249                                         $subcats=array();
01250                                         $v=$this->thisConfig['userLinks.'];
01251                                         reset($v);
01252                                         while(list($k2)=each($v))       {
01253                                                 $k2i = intval($k2);
01254                                                 if (substr($k2,-1)=='.' && is_array($v[$k2i.'.']))      {
01255 
01256                                                                 // Title:
01257                                                         $title = trim($v[$k2i]);
01258                                                         if (!$title)    {
01259                                                                 $title=$v[$k2i.'.']['url'];
01260                                                         } else {
01261                                                                 $title=$LANG->sL($title);
01262                                                         }
01263                                                                 // Description:
01264                                                         $description=$v[$k2i.'.']['description'] ? $LANG->sL($v[$k2i.'.']['description'],1).'<br />' : '';
01265 
01266                                                                 // URL + onclick event:
01267                                                         $onClickEvent='';
01268                                                         if (isset($v[$k2i.'.']['target']))      $onClickEvent.="setTarget('".$v[$k2i.'.']['target']."');";
01269                                                         $v[$k2i.'.']['url'] = str_replace('###_URL###',$this->siteURL,$v[$k2i.'.']['url']);
01270                                                         if (substr($v[$k2i.'.']['url'],0,7)=="http://" || substr($v[$k2i.'.']['url'],0,7)=='mailto:')   {
01271                                                                 $onClickEvent.="cur_href=unescape('".rawurlencode($v[$k2i.'.']['url'])."');link_current();";
01272                                                         } else {
01273                                                                 $onClickEvent.="link_spec(unescape('".$this->siteURL.rawurlencode($v[$k2i.'.']['url'])."'));";
01274                                                         }
01275 
01276                                                                 // Link:
01277                                                         $A=array('<a href="#" onclick="'.htmlspecialchars($onClickEvent).'return false;">','</a>');
01278 
01279                                                                 // Adding link to menu of user defined links:
01280                                                         $subcats[$k2i]='
01281                                                                 <tr>
01282                                                                         <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>
01283                                                                 </tr>';
01284                                                 }
01285                                         }
01286 
01287                                                 // Sort by keys:
01288                                         ksort($subcats);
01289 
01290                                                 // Add menu to content:
01291                                         $content.= '
01292                         <!--
01293                                 Special userdefined menu:
01294                         -->
01295                                                 <table border="0" cellpadding="1" cellspacing="1" id="typo3-linkSpecial">
01296                                                         <tr>
01297                                                                 <td class="bgColor5" class="c-wCell" valign="top"><strong>'.$LANG->getLL('special',1).'</strong></td>
01298                                                         </tr>
01299                                                         '.implode('',$subcats).'
01300                                                 </table>
01301                                                 ';
01302                                 }
01303                         break;
01304                         case 'page':
01305                         default:
01306                                 $pagetree = t3lib_div::makeInstance('rtePageTree');
01307                                 $pagetree->thisScript=$this->script;
01308                                 $tree=$pagetree->getBrowsableTree();
01309                                 $cElements = $this->expandPage();
01310                                 $content.= '
01311                         <!--
01312                                 Wrapper table for page tree / record list:
01313                         -->
01314                                         <table border="0" cellpadding="0" cellspacing="0" id="typo3-linkPages">
01315                                                 <tr>
01316                                                         <td class="c-wCell" valign="top">'.$this->barheader($GLOBALS['LANG']->getLL('pageTree').':').$tree.'</td>
01317                                                         <td class="c-wCell" valign="top">'.$cElements.'</td>
01318                                                 </tr>
01319                                         </table>
01320                                         ';
01321                         break;
01322                 }
01323 
01324                         // Target:
01325                 if ($this->act!='mail') {
01326                         $ltarget='
01327                         <!--
01328                                 Selecting target for link:
01329                         -->
01330                                 <form action="" name="ltargetform" id="ltargetform">
01331                                         <table border="0" cellpadding="2" cellspacing="1" id="typo3-linkTarget">
01332                                                 <tr>
01333                                                         <td>'.$GLOBALS['LANG']->getLL('target',1).':</td>
01334                                                         <td><input type="text" name="ltarget" onchange="setTarget(this.value);" value="'.htmlspecialchars($this->setTarget).'"'.$this->doc->formWidth(10).' /></td>
01335                                                         <td>
01336                                                                 <select name="ltarget_type" onchange="setTarget(this.options[this.selectedIndex].value);document.ltargetform.ltarget.value=this.options[this.selectedIndex].value;this.selectedIndex=0;">
01337                                                                         <option></option>
01338                                                                         <option value="_top">'.$GLOBALS['LANG']->getLL('top',1).'</option>
01339                                                                         <option value="_blank">'.$GLOBALS['LANG']->getLL('newWindow',1).'</option>
01340                                                                 </select>
01341                                                         </td>
01342                                                         <td>';
01343 
01344                         if (($this->curUrlInfo['act']=="page" || $this->curUrlInfo['act']=='file') && $this->curUrlArray['href'])       {
01345                                 $ltarget.='
01346                                                         <input type="submit" value="'.$GLOBALS['LANG']->getLL('update',1).'" onclick="return link_current();" />';
01347                         }
01348 
01349                         $selectJS = '
01350                                 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)     {
01351                                         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;
01352                                         setTarget(document.ltargetform.ltarget.value);
01353                                         document.ltargetform.popup_width.selectedIndex=0;
01354                                         document.ltargetform.popup_height.selectedIndex=0;
01355                                 }
01356                         ';
01357 
01358                         $ltarget.='             </td>
01359                                                 </tr>
01360                                                 <tr>
01361                                                         <td>'.$GLOBALS['LANG']->getLL('target_popUpWindow',1).':</td>
01362                                                         <td colspan="3">
01363                                                                 <select name="popup_width" onchange="'.$selectJS.'">
01364                                                                         <option value="0">'.$GLOBALS['LANG']->getLL('target_popUpWindow_width',1).'</option>
01365                                                                         <option value="300">300</option>
01366                                                                         <option value="400">400</option>
01367                                                                         <option value="500">500</option>
01368                                                                         <option value="600">600</option>
01369                                                                         <option value="700">700</option>
01370                                                                         <option value="800">800</option>
01371                                                                 </select>
01372                                                                 x
01373                                                                 <select name="popup_height" onchange="'.$selectJS.'">
01374                                                                         <option value="0">'.$GLOBALS['LANG']->getLL('target_popUpWindow_height',1).'</option>
01375                                                                         <option value="200">200</option>
01376                                                                         <option value="300">300</option>
01377                                                                         <option value="400">400</option>
01378                                                                         <option value="500">500</option>
01379                                                                         <option value="600">600</option>
01380                                                                 </select>';
01381                                 // Class:
01382                         if ($this->classesAnchorJSOptions[$this->act]) {
01383                                 $selectClassJS = '
01384                                         document.ltargetform.anchor_class.value = document.ltargetform.anchor_class.options[document.ltargetform.anchor_class.selectedIndex].value;
01385                                         if(document.ltargetform.anchor_class.value && editor.classesAnchorSetup) {
01386                                                 for (var i = editor.classesAnchorSetup.length; --i >= 0;) {
01387                                                         var anchorClass = editor.classesAnchorSetup[i];
01388                                                         if (anchorClass[\'name\'] == document.ltargetform.anchor_class.value) {
01389                                                                 if(anchorClass[\'titleText\'] && document.ltargetform.anchor_title) document.ltargetform.anchor_title.value = anchorClass[\'titleText\'];
01390                                                                 break;
01391                                                         }
01392                                                 }
01393                                         }
01394                                         setClass(document.ltargetform.anchor_class.value);
01395                                 ';
01396                                 $ltarget .='            </td>
01397                                                 </tr>
01398                                                 <tr>
01399                                                         <td>'.$GLOBALS['LANG']->getLL('anchor_class',1).':</td>
01400                                                         <td colspan="3">
01401                                                                 <select name="anchor_class" onchange="'.$selectClassJS.'">
01402                                                                         ' . $this->classesAnchorJSOptions[$this->act] . '
01403                                                                 </select>';
01404                         }
01405                                 // Title:
01406                         if ($this->typoVersion >= 3008002) {
01407                                 $ltarget .='            </td>
01408                                                 </tr>
01409                                                 <tr>
01410                                                         <td>'.$GLOBALS['LANG']->getLL('anchor_title',1).':</td>
01411                                                         <td colspan="3">
01412                                                                 <input type="text" name="anchor_title" value="' . ($this->setTitle?$this->setTitle:($this->thisConfig['classesAnchor']?$this->classesAnchorDefaultTitle[$this->act]:'')) . '" ' . $GLOBALS['TBE_TEMPLATE']->formWidth(30) . ' />';
01413                         }
01414                                 $ltarget.='     </td>
01415                                                 </tr>
01416                                         </table>
01417                                 </form>';
01418 
01419                                 // Add class selector box and title field to content:
01420                                 $content .=$ltarget;
01421 
01422                                 // Add some space
01423                         $content.='<br /><br />';
01424                 } else {
01425                         $selectClassJS = '
01426                                 document.ltargetform.anchor_class.value = document.ltargetform.anchor_class.options[document.ltargetform.anchor_class.selectedIndex].value;
01427                                 if(document.ltargetform.anchor_class.value && editor.classesAnchorSetup) {
01428                                         for (var i = editor.classesAnchorSetup.length; --i >= 0;) {
01429                                                 var anchorClass = editor.classesAnchorSetup[i];
01430                                                 if (anchorClass[\'name\'] == document.ltargetform.anchor_class.value) {
01431                                                         if(anchorClass[\'titleText\'] && document.ltargetform.anchor_title) document.ltargetform.anchor_title.value = anchorClass[\'titleText\'];
01432                                                         break;
01433                                                 }
01434 
01435                                         }
01436                                 }
01437                                 setClass(document.ltargetform.anchor_class.value);
01438                         ';
01439                         $ltarget='
01440                         <!--
01441                                 Selecting class and title for email link:
01442                         -->
01443                                 <form action="" name="ltargetform" id="ltargetform">
01444                                         <table border="0" cellpadding="2" cellspacing="1" id="typo3-linkTarget">';
01445                         if ($this->classesAnchorJSOptions[$this->act]) {
01446                                 $ltarget .='
01447                                                 <tr>
01448                                                         <td>'.$GLOBALS['LANG']->getLL('anchor_class',1).':</td>
01449                                                         <td colspan="3">
01450                                                                 <select name="anchor_class" onchange="'.$selectClassJS.'">
01451                                                                         ' . $this->classesAnchorJSOptions[$this->act] . '
01452                                                                 </select>
01453                                                 </td>
01454                                                 </tr>';
01455                         }
01456                         if ($this->typoVersion >= 3008002) {
01457                                 $ltarget .='
01458                                                 <tr>
01459                                                         <td>'.$GLOBALS['LANG']->getLL('anchor_title',1).':</td>
01460                                                         <td colspan="3">
01461                                                                 <input type="text" name="anchor_title" value="' .  ($this->setTitle?$this->setTitle:($this->thisConfig['classesAnchor']?$this->classesAnchorDefaultTitle[$this->act]:'')) . '" ' . $GLOBALS['TBE_TEMPLATE']->formWidth(30) . ' />
01462                                                 </td>
01463                                                 </tr>';
01464                         }
01465                         $ltarget .='
01466                                         </table>
01467                                 </form>';
01468                                 // Add class selector box and title field to content:
01469                         $content.=$ltarget;
01470 
01471                                 // Add some space
01472                         $content .='<br /><br />';
01473 
01474                 }
01475 
01476                         // End page, return content:
01477                 $content.= $this->doc->endPage();
01478                 return $content;
01479         }
01480 
01486         function main_db()      {
01487 
01488                         // Starting content:
01489                 $content=$this->doc->startPage('TBE file selector');
01490 
01491                         // Init variable:
01492                 $pArr = explode('|',$this->bparams);
01493 
01494                         // Making the browsable pagetree:
01495                 $pagetree = t3lib_div::makeInstance('TBE_PageTree');
01496                 $pagetree->script= $this->script;
01497                 $pagetree->ext_pArrPages = !strcmp($pArr[3],'pages')?1:0;
01498                 $tree=$pagetree->getBrowsableTree();
01499 
01500                         // Making the list of elements, if applicable:
01501                 $cElements = $this->TBE_expandPage($pArr[3]);
01502 
01503                         // Putting the things together, side by side:
01504                 $content.= '
01505                         <!--
01506                                 Wrapper table for page tree / record list:
01507                         -->
01508                         <table border="0" cellpadding="0" cellspacing="0" id="typo3-EBrecords">
01509                                 <tr>
01510                                         <td class="c-wCell" valign="top">'.$this->barheader($GLOBALS['LANG']->getLL('pageTree').':').$tree.'</td>
01511                                         <td class="c-wCell" valign="top">'.$cElements.'</td>
01512                                 </tr>
01513                         </table>
01514                         ';
01515 
01516                         // Add some space
01517                 $content.='<br /><br />';
01518 
01519                         // End page, return content:
01520                 $content.= $this->doc->endPage();
01521                 return $content;
01522         }
01523 
01529         function main_file()    {
01530                 global $BE_USER;
01531 
01532                         // Starting content:
01533                 $content.=$this->doc->startPage('TBE file selector');
01534 
01535                         // Init variable:
01536                 $pArr = explode('|',$this->bparams);
01537 
01538                         // Create upload/create folder forms, if a path is given:
01539                 $fileProcessor = t3lib_div::makeInstance('t3lib_basicFileFunctions');
01540                 $fileProcessor->init($GLOBALS['FILEMOUNTS'], $GLOBALS['TYPO3_CONF_VARS']['BE']['fileExtensions']);
01541                 $path=$this->expandFolder;
01542                 if (!$path || !@is_dir($path))  {
01543                         $path = $fileProcessor->findTempFolder().'/';   // The closest TEMP-path is found
01544                 }
01545                 if ($path!='/' && @is_dir($path))       {
01546                         $uploadForm=$this->uploadForm($path);
01547                         $createFolder=$this->createFolder($path);
01548                 } else {
01549                         $createFolder='';
01550                         $uploadForm='';
01551                 }
01552                 if ($BE_USER->getTSConfigVal('options.uploadFieldsInTopOfEB'))  $content.=$uploadForm;
01553 
01554                         // Getting flag for showing/not showing thumbnails:
01555                 $noThumbs = $GLOBALS['BE_USER']->getTSConfigVal('options.noThumbsInEB');
01556 
01557                 if (!$noThumbs) {
01558                                 // MENU-ITEMS, fetching the setting for thumbnails from File>List module:
01559                         $_MOD_MENU = array('displayThumbs' => '');
01560                         $_MCONF['name']='file_list';
01561                         $_MOD_SETTINGS = t3lib_BEfunc::getModuleData($_MOD_MENU, t3lib_div::_GP('SET'), $_MCONF['name']);
01562                         $addParams = '&act='.$this->act.'&mode='.$this->mode.'&expandFolder='.rawurlencode($path).'&bparams='.rawurlencode($this->bparams);
01563                         $thumbNailCheck = t3lib_BEfunc::getFuncCheck('','SET[displayThumbs]',$_MOD_SETTINGS['displayThumbs'], $this->script, $addParams).' '.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_file_list.php:displayThumbs',1);
01564                 } else {
01565                         $thumbNailCheck='';
01566                 }
01567                 $noThumbs = $noThumbs?$noThumbs:!$_MOD_SETTINGS['displayThumbs'];
01568 
01569                         // Create folder tree:
01570                 $foldertree = t3lib_div::makeInstance('TBE_FolderTree');
01571                 $foldertree->thisScript= $this->script;
01572                 $foldertree->ext_noTempRecyclerDirs = ($this->mode == 'filedrag');
01573                 $tree=$foldertree->getBrowsableTree();
01574 
01575                 list(,,$specUid) = explode('_',$this->PM);
01576                 if ($this->mode=='filedrag')    {
01577                         $files = $this->TBE_dragNDrop($foldertree->specUIDmap[$specUid],$pArr[3]);
01578                 } else {
01579                         $files = $this->TBE_expandFolder($foldertree->specUIDmap[$specUid],$pArr[3],$noThumbs);
01580                 }
01581 
01582                         // Putting the parts together, side by side:
01583                 $content.= '
01584                         <!--
01585                                 Wrapper table for folder tree / file list:
01586                         -->
01587                         <table border="0" cellpadding="0" cellspacing="0" id="typo3-EBfiles">
01588                                 <tr>
01589                                         <td class="c-wCell" valign="top">'.$this->barheader($GLOBALS['LANG']->getLL('folderTree').':').$tree.'</td>
01590                                         <td class="c-wCell" valign="top">'.$files.'</td>
01591                                 </tr>
01592                         </table>
01593                         ';
01594                 $content.=$thumbNailCheck;
01595 
01596                         // Adding create folder + upload forms if applicable:
01597                 if (!$BE_USER->getTSConfigVal('options.uploadFieldsInTopOfEB')) $content.=$uploadForm;
01598                 if ($BE_USER->isAdmin() || $BE_USER->getTSConfigVal('options.createFoldersInEB'))       $content.=$createFolder;
01599 
01600                         // Add some space
01601                 $content.='<br /><br />';
01602 
01603                         // Ending page, returning content:
01604                 $content.= $this->doc->endPage();
01605                 return $content;
01606         }
01607 
01608         /******************************************************************
01609          *
01610          * Record listing
01611          *
01612          ******************************************************************/
01618         function expandPage()   {
01619                 global $BE_USER, $BACK_PATH;
01620                 $out='';
01621                 $expPageId = $this->expandPage;         // Set page id (if any) to expand
01622 
01623                         // If there is an anchor value (content element reference) in the element reference, then force an ID to expand:
01624                 if (!$this->expandPage && $this->curUrlInfo['cElement'])        {
01625                         $expPageId = $this->curUrlInfo['pageid'];       // Set to the current link page id.
01626                 }
01627 
01628                         // Draw the record list IF there is a page id to expand:
01629                 if ($expPageId && t3lib_div::testInt($expPageId) && $BE_USER->isInWebMount($expPageId)) {
01630 
01631                                 // Set header:
01632                         $out.=$this->barheader($GLOBALS['LANG']->getLL('contentElements').':');
01633                                 // Create header for listing, showing the page title/icon:
01634                         $titleLen=intval($GLOBALS['BE_USER']->uc['titleLen']);
01635                         $mainPageRec = t3lib_BEfunc::getRecord('pages',$expPageId);
01636                         $picon=t3lib_iconWorks::getIconImage('pages',$mainPageRec,$BACK_PATH,'');
01637                         if($his->typoVersion >= 3007000 ) {
01638                                 $picon.= htmlspecialchars(t3lib_div::fixed_lgd_cs($mainPageRec['title'],$titleLen));
01639                         } else {
01640                                 $picon.= htmlspecialchars(t3lib_div::fixed_lgd($mainPageRec['title'],$titleLen));
01641                         }
01642                         $out.=$picon.'<br />';
01643 
01644                                 // Look up tt_content elements from the expanded page:
01645                         $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
01646                                                         'uid,header,hidden,starttime,endtime,fe_group,CType,colpos,bodytext',
01647                                                         'tt_content',
01648                                                         'pid='.intval($expPageId).t3lib_BEfunc::deleteClause('tt_content'),
01649                                                         '',
01650                                                         'colpos,sorting'
01651                                                 );
01652                         $cc = $GLOBALS['TYPO3_DB']->sql_num_rows($res);
01653 
01654                                 // Traverse list of records:
01655                         $c=0;
01656                         while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))       {
01657                                 $c++;
01658                                 $icon=t3lib_iconWorks::getIconImage('tt_content',$row,$BACK_PATH,'');
01659                                 if ($this->curUrlInfo['act']=='page' && $this->curUrlInfo['cElement']==$row['uid'])     {
01660                                         $arrCol='<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/blinkarrow_left.gif','width="5" height="9"').' class="c-blinkArrowL" alt="" />';
01661                                 } else {
01662                                         $arrCol='';
01663                                 }
01664                                         // Putting list element HTML together:
01665                                 if($his->typoVersion >= 3007000 ) {
01666                                         $out.='<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/ol/join'.($c==$cc?'bottom':'').'.gif','width="18" height="16"').' alt="" />'.
01667                                                 $arrCol.
01668                                                 '<a href="#" onclick="return link_typo3Page(\''.$expPageId.'\',\'#'.$row['uid'].'\');">'.
01669                                                 $icon.
01670                                                 htmlspecialchars(t3lib_div::fixed_lgd_cs($row['header'],$titleLen)).
01671                                                 '</a><br />';
01672                                 } else  {
01673                                         $out.='<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/ol/join'.($c==$cc?'bottom':'').'.gif','width="18" height="16"').' alt="" />'.
01674                                                 $arrCol.
01675                                                 '<a href="#" onclick="return link_typo3Page(\''.$expPageId.'\',\'#'.$row['uid'].'\');">'.
01676                                                 $icon.
01677                                                 htmlspecialchars(t3lib_div::fixed_lgd($row['header'],$titleLen)).
01678                                                 '</a><br />';
01679                                 }
01680                                         // Finding internal anchor points:
01681                                 if (t3lib_div::inList('text,textpic', $row['CType']))   {
01682                                         $split = preg_split('/(<a[^>]+name=[\'"]?([^"\'>[:space:]]+)[\'"]?[^>]*>)/i', $row['bodytext'], -1, PREG_SPLIT_DELIM_CAPTURE);
01683 
01684                                         foreach($split as $skey => $sval)       {
01685                                                 if (($skey%3)==2)       {
01686                                                                 // Putting list element HTML together:
01687                                                         $sval = substr($sval,0,100);
01688                                                         $out.='<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/ol/line.gif','width="18" height="16"').' alt="" />'.
01689                                                                         '<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/ol/join'.($skey+3>count($split)?'bottom':'').'.gif','width="18" height="16"').' alt="" />'.
01690                                                                         '<a href="#" onclick="return link_typo3Page(\''.$expPageId.'\',\'#'.rawurlencode($sval).'\');">'.
01691                                                                         htmlspecialchars(' <A> '.$sval).
01692                                                                         '</a><br />';
01693                                                 }
01694                                         }
01695                                 }
01696                         }
01697                 }
01698                 return $out;
01699         }
01700 
01708         function TBE_expandPage($tables)        {
01709                 global $TCA, $BE_USER, $BACK_PATH;
01710 
01711                 $out='';
01712                 if ($this->expandPage>=0 && t3lib_div::testInt($this->expandPage) && $BE_USER->isInWebMount($this->expandPage)) {
01713 
01714                                 // Set array with table names to list:
01715                         if (!strcmp(trim($tables),'*')) {
01716                                 $tablesArr = array_keys($TCA);
01717                         } else {
01718                                 $tablesArr = t3lib_div::trimExplode(',',$tables,1);
01719                         }
01720                         reset($tablesArr);
01721 
01722                                 // Headline for selecting records:
01723                         $out.=$this->barheader($GLOBALS['LANG']->getLL('selectRecords').':');
01724 
01725                                 // Create the header, showing the current page for which the listing is. Includes link to the page itself, if pages are amount allowed tables.
01726                         $titleLen=intval($GLOBALS['BE_USER']->uc['titleLen']);
01727                         $mainPageRec = t3lib_BEfunc::getRecord('pages',$this->expandPage);
01728                         $ATag='';
01729                         $ATag_e='';
01730                         $ATag2='';
01731                         if (in_array('pages',$tablesArr))       {
01732                                 $ficon=t3lib_iconWorks::getIcon('pages',$mainPageRec);
01733                                 $ATag="<a href=\"#\" onclick=\"return insertElement('pages', '".$mainPageRec['uid']."', 'db', unescape('".rawurlencode($mainPageRec['title'])."'), '', '', '".$ficon."','',1);\">";
01734                                 $ATag2="<a href=\"#\" onclick=\"return insertElement('pages', '".$mainPageRec['uid']."', 'db', unescape('".rawurlencode($mainPageRec['title'])."'), '', '', '".$ficon."','',0);\">";
01735                                 $ATag_alt=substr($ATag,0,-4).",'',1);\">";
01736                                 $ATag_e='</a>';
01737                         }
01738                         $picon=t3lib_iconWorks::getIconImage('pages',$mainPageRec,$BACK_PATH,'');
01739                         $pBicon=$ATag2?'<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/plusbullet2.gif','width="18" height="16"').' alt="" />':'';
01740 
01741                         if($this->typoVersion >= 3007000 ) {
01742                                 $pText=htmlspecialchars(t3lib_div::fixed_lgd_cs($mainPageRec['title'],$titleLen));
01743                         } else {
01744                                 $pText=htmlspecialchars(t3lib_div::fixed_lgd($mainPageRec['title'],$titleLen));
01745                         }
01746                         $out.=$picon.$ATag2.$pBicon.$ATag_e.$ATag.$pText.$ATag_e.'<br />';
01747 
01748                                 // Initialize the record listing:
01749                         $id = $this->expandPage;
01750                         $pointer = t3lib_div::intInRange($this->pointer,0,100000);
01751                         $perms_clause = $GLOBALS['BE_USER']->getPagePermsClause(1);
01752                         $pageinfo = t3lib_BEfunc::readPageAccess($id,$perms_clause);
01753                         $table='';
01754 
01755                                 // Generate the record list:
01756                         $dblist = t3lib_div::makeInstance('TBE_browser_recordList');
01757                         $dblist->script= $this->script;
01758                         $dblist->backPath = $GLOBALS['BACK_PATH'];
01759                         $dblist->thumbs = 0;
01760                         $dblist->calcPerms = $GLOBALS['BE_USER']->calcPerms($pageinfo);
01761                         $dblist->noControlPanels=1;
01762                         $dblist->clickMenuEnabled=0;
01763                         $dblist->tableList=implode(',',$tablesArr);
01764 
01765                         $dblist->start($id,t3lib_div::_GP('table'),$pointer,
01766                                 t3lib_div::_GP('search_field'),
01767                                 t3lib_div::_GP('search_levels'),
01768                                 t3lib_div::_GP('showLimit')
01769                         );
01770                         $dblist->setDispFields();
01771                         $dblist->generateList($id,$table);
01772                         $dblist->writeBottom();
01773 
01774                                 //      Add the HTML for the record list to output variable:
01775                         $out.=$dblist->HTMLcode;
01776                         $out.=$dblist->getSearchBox();
01777                 }
01778 
01779                         // Return accumulated content:
01780                 return $out;
01781         }
01782 
01783         /******************************************************************
01784          *
01785          * File listing
01786          *
01787          ******************************************************************/
01795         function expandFolder($expandFolder=0,$extensionList='')        {
01796                 global $BACK_PATH;
01797 
01798                 $expandFolder = $expandFolder ? $expandFolder : $this->expandFolder;
01799                 $out='';
01800                 if ($expandFolder && $this->checkFolder($expandFolder)) {
01801 
01802                                 // Create header for filelisting:
01803                         $out.=$this->barheader($GLOBALS['LANG']->getLL('files').':');
01804 
01805                                 // Prepare current path value for comparison (showing red arrow)
01806                         if (!$this->curUrlInfo['value'])        {
01807                                 $cmpPath='';
01808                         } else {
01809                                 $cmpPath=PATH_site.$this->curUrlInfo['info'];
01810                         }
01811 
01812                                 // Create header element; The folder from which files are listed.
01813                         $titleLen=intval($GLOBALS['BE_USER']->uc['titleLen']);
01814                         $picon='<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/i/_icon_webfolders.gif','width="18" height="16"').' alt="" />';
01815                         if($this->typoVersion >= 3007000 ) {
01816                                 $picon.=htmlspecialchars(t3lib_div::fixed_lgd_cs(basename($expandFolder),$titleLen));
01817                         } else {
01818                                 $picon.=htmlspecialchars(t3lib_div::fixed_lgd(basename($expandFolder),$titleLen));
01819                         }
01820                         $picon='<a href="#" onclick="return link_folder(\''.t3lib_div::rawUrlEncodeFP(substr($expandFolder,strlen(PATH_site))).'\');">'.$picon.'</a>';
01821                         $out.=$picon.'<br />';
01822 
01823                                 // Get files from the folder:
01824                         $files = t3lib_div::getFilesInDir($expandFolder,$extensionList,1,1);    // $extensionList="",$prependPath=0,$order='')
01825                         $c=0;
01826                         $cc=count($files);
01827 
01828                         if (is_array($files))   {
01829                                 foreach($files as $filepath)    {
01830                                         $c++;
01831                                         $fI=pathinfo($filepath);
01832 
01833                                                 // File icon:
01834                                         $icon = t3lib_BEfunc::getFileIcon(strtolower($fI['extension']));
01835 
01836                                                 // If the listed file turns out to be the CURRENT file, then show blinking arrow:
01837                                         if ($this->curUrlInfo['act']=="file" && $cmpPath==$filepath)    {
01838                                                 $arrCol='<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/blinkarrow_left.gif','width="5" height="9"').' class="c-blinkArrowL" alt="" />';
01839                                         } else {
01840                                                 $arrCol='';
01841                                         }
01842 
01843                                                 // Get size and icon:
01844                                         $size=' ('.t3lib_div::formatSize(filesize($filepath)).'bytes)';
01845                                         $icon = '<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/fileicons/'.$icon.'','width="18" height="16"').' title="'.htmlspecialchars($fI['basename'].$size).'" alt="" />';
01846 
01847                                                 // Put it all together for the file element:
01848                                         if($this->typoVersion >= 3007000 ) {
01849                                                 $out.='<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/ol/join'.($c==$cc?'bottom':'').'.gif','width="18" height="16"').' alt="" />'.
01850                                                         $arrCol.
01851                                                         '<a href="#" onclick="return link_folder(\''.t3lib_div::rawUrlEncodeFP(substr($filepath,strlen(PATH_site))).'\');">'.
01852                                                         $icon.
01853                                                         htmlspecialchars(t3lib_div::fixed_lgd_cs(basename($filepath),$titleLen)).
01854                                                         '</a><br />';
01855                                         } else {
01856                                                 $out.='<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/ol/join'.($c==$cc?'bottom':'').'.gif','width="18" height="16"').' alt="" />'.
01857                                                         $arrCol.
01858                                                         '<a href="#" onclick="return link_folder(\''.t3lib_div::rawUrlEncodeFP(substr($filepath,strlen(PATH_site))).'\');">'.
01859                                                         $icon.
01860                                                         htmlspecialchars(t3lib_div::fixed_lgd(basename($filepath),$titleLen)).
01861                                                         '</a><br />';
01862                                         }
01863                                 }
01864                         }
01865                 }
01866                 return $out;
01867         }
01868 
01877         function TBE_expandFolder($expandFolder=0,$extensionList='',$noThumbs=0)        {
01878                 global $LANG;
01879 
01880 
01881 
01882                 $expandFolder = $expandFolder ? $expandFolder : $this->expandFolder;
01883 
01884                 $out='';
01885 
01886                 if ($expandFolder && $this->checkFolder($expandFolder)) {
01887 
01888                                 // Listing the files:
01889 
01890                         $files = t3lib_div::getFilesInDir($expandFolder,$extensionList,1,1);    // $extensionList="",$prependPath=0,$order='')
01891 
01892                         $out.= $this->fileList($files, $expandFolder, $noThumbs);
01893 
01894                 }
01895 
01896 
01897 
01898                         // Return accumulated content for filelisting:
01899 
01900                 return $out;
01901 
01902         }
01903 
01912         function fileList($files, $folderName='', $noThumbs=0) {
01913                 global $LANG, $BACK_PATH;
01914 
01915                 $out='';
01916 
01917                         // Listing the files:
01918                 if (is_array($files))   {
01919 
01920                                 // Create headline (showing number of files):
01921                         $out.=$this->barheader(sprintf($GLOBALS['LANG']->getLL('files').' (%s):',count($files)));
01922                         $titleLen=intval($GLOBALS['BE_USER']->uc['titleLen']);
01923 
01924                                 // Create the header of current folder:
01925                         if($folderName) {
01926                                 $picon='<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/i/_icon_webfolders.gif','width="18" height="16"').' alt="" />';
01927                                 if($this->typoVersion >= 3007000 ) {
01928                                         $picon.=htmlspecialchars(t3lib_div::fixed_lgd_cs(basename($folderName),$titleLen));
01929                                 } else {
01930                                         $picon.=htmlspecialchars(t3lib_div::fixed_lgd(basename($folderName),$titleLen));
01931                                 }
01932                                 $out.=$picon.'<br />';
01933                         }
01934 
01935                                 // Init graphic object for reading file dimensions:
01936                         $imgObj = t3lib_div::makeInstance('t3lib_stdGraphic');
01937                         $imgObj->init();
01938                         $imgObj->mayScaleUp=0;
01939                         $imgObj->tempPath=PATH_site.$imgObj->tempPath;
01940 
01941                                 // Traverse the file list:
01942                         $lines=array();
01943                         foreach($files as $filepath)    {
01944                                 $fI=pathinfo($filepath);
01945 
01946                                         // Thumbnail/size generation:
01947                                 if (t3lib_div::inList($GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'],$fI['extension']) && !$noThumbs)      {
01948                                         $imgInfo = $imgObj->getImageDimensions($filepath);
01949                                         $pDim = $imgInfo[0].'x'.$imgInfo[1].' pixels';
01950                                         $clickIcon = t3lib_BEfunc::getThumbNail($BACK_PATH.'thumbs.php',$filepath,'hspace="5" vspace="5" border="1"');
01951                                 } else {
01952                                         $clickIcon = '';
01953                                         $pDim = '';
01954                                 }
01955 
01956                                         // Create file icon:
01957                                 $ficon = t3lib_BEfunc::getFileIcon(strtolower($fI['extension']));
01958                                 $size=' ('.t3lib_div::formatSize(filesize($filepath)).'bytes'.($pDim?', '.$pDim:'').')';
01959                                 $icon = '<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/fileicons/'.$ficon,'width="18" height="16"').' title="'.htmlspecialchars($fI['basename'].$size).'" class="absmiddle" alt="" />';
01960 
01961                                         // Create links for adding the file:
01962                                 if (strstr($filepath,',') || strstr($filepath,'|'))     {       // In case an invalid character is in the filepath, display error message:
01963                                         $eMsg = $LANG->JScharCode(sprintf($LANG->getLL('invalidChar'),', |'));
01964                                         $ATag = $ATag_alt = "<a href=\"#\" onclick=\"alert(".$eMsg.");return false;\">";
01965                                 } else {        // If filename is OK, just add it:
01966                                         $ATag = "<a href=\"#\" onclick=\"return insertElement('','".t3lib_div::shortMD5($filepath)."', 'file', '".rawurlencode($fI['basename'])."', unescape('".rawurlencode($filepath)."'), '".$fI['extension']."', '".$ficon."');\">";
01967                                         $ATag_alt = substr($ATag,0,-4).",'',1);\">";
01968                                 }
01969                                 $ATag_e='</a>';
01970 
01971                                         // Create link to showing details about the file in a window:
01972                                 $Ahref = $BACK_PATH.'show_item.php?table='.rawurlencode($filepath).'&returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'));
01973                                 $ATag2='<a href="'.htmlspecialchars($Ahref).'">';
01974                                 $ATag2_e='</a>';
01975 
01976                                         // Combine the stuff:
01977                                         if($this->typoVersion >= 3007000 ) {
01978                                                 $filenameAndIcon=$ATag_alt.$icon.htmlspecialchars(t3lib_div::fixed_lgd_cs(basename($filepath),$titleLen)).$ATag_e;
01979                                         } else {
01980                                                 $filenameAndIcon=$ATag_alt.$icon.htmlspecialchars(t3lib_div::fixed_lgd(basename($filepath),$titleLen)).$ATag_e;
01981                                         }
01982 
01983                                         // Show element:
01984                                 if ($pDim)      {               // Image...
01985                                         $lines[]='
01986                                                 <tr class="bgColor4">
01987                                                         <td nowrap="nowrap">'.$filenameAndIcon.'&nbsp;</td>
01988                                                         <td>'.$ATag.'<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/plusbullet2.gif','width="18" height="16"').' title="'.$LANG->getLL('addToList',1).'" alt="" />'.$ATag_e.'</td>
01989                                                         <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>
01990                                                         <td nowrap="nowrap">&nbsp;'.$pDim.'</td>
01991                                                 </tr>';
01992                                         $lines[]='
01993                                                 <tr>
01994                                                         <td colspan="4">'.$ATag_alt.$clickIcon.$ATag_e.'</td>
01995                                                 </tr>';
01996 
01997                                 } else {
01998                                         $lines[]='
01999                                                 <tr class="bgColor4">
02000                                                         <td nowrap="nowrap">'.$filenameAndIcon.'&nbsp;</td>
02001                                                         <td>'.$ATag.'<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/plusbullet2.gif','width="18" height="16"').' title="'.$LANG->getLL('addToList',1).'" alt="" />'.$ATag_e.'</td>
02002                                                         <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>
02003                                                         <td>&nbsp;</td>
02004                                                 </tr>';
02005                                 }
02006                                 $lines[]='
02007                                                 <tr>
02008                                                         <td colspan="3"><img src="clear.gif" width="1" height="3" alt="" /></td>
02009                                                 </tr>';
02010                         }
02011 
02012                                 // Wrap all the rows in table tags:
02013                         $out.='
02014 
02015                 <!--
02016                         File listing
02017                 -->
02018                                 <table border="0" cellpadding="0" cellspacing="1" id="typo3-fileList">
02019                                         '.implode('',$lines).'
02020                                 </table>';
02021                 }
02022 
02023                         // Return accumulated content for filelisting:
02024                 return $out;
02025         }
02034         function TBE_dragNDrop($expandFolder=0,$extensionList='')       {
02035                 global $BACK_PATH;
02036                 $expandFolder = $expandFolder ? $expandFolder : $this->expandFolder;
02037                 $out='';
02038                 if ($expandFolder && $this->checkFolder($expandFolder)) {
02039                         if ($this->isWebFolder($expandFolder))  {
02040 
02041                                         // Read files from directory:
02042                                 $files = t3lib_div::getFilesInDir($expandFolder,$extensionList,1,1);    // $extensionList="",$prependPath=0,$order='')
02043                                 if (is_array($files))   {
02044                                         $out.=$this->barheader(sprintf($GLOBALS['LANG']->getLL('files').' (%s):',count($files)));
02045 
02046                                         $titleLen=intval($GLOBALS['BE_USER']->uc['titleLen']);
02047                                         $picon='<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/i/_icon_webfolders.gif','width="18" height="16"').' alt="" />';
02048                                         if($this->typoVersion >= 3007000 ) {
02049                                                 $picon.=htmlspecialchars(t3lib_div::fixed_lgd_cs(basename($expandFolder),$titleLen));
02050 
02051                                         } else {
02052                                                 $picon.=htmlspecialchars(t3lib_div::fixed_lgd(basename($expandFolder),$titleLen));
02053                                         }
02054                                         $out.=$picon.'<br />';
02055 
02056                                                 // Init row-array:
02057                                         $lines=array();
02058 
02059                                                 // Add "drag-n-drop" message:
02060                                         $lines[]='
02061                                                 <tr>
02062                                                         <td colspan="2">'.$this->getMsgBox($GLOBALS['LANG']->getLL('findDragDrop')).'</td>
02063                                                 </tr>';
02064 
02065                                                 // Fraverse files:
02066                                         while(list(,$filepath)=each($files))    {
02067                                                 $fI=pathinfo($filepath);
02068 
02069                                                         // URL of image:
02070                                                 $iurl = $this->siteURL.t3lib_div::rawurlencodeFP(substr($filepath,strlen(PATH_site)));
02071 
02072                                                         // Show only web-images
02073                                                 if (t3lib_div::inList('gif,jpeg,jpg,png',$fI['extension']))     {
02074                                                         $imgInfo = @getimagesize($filepath);
02075                                                         $pDim = $imgInfo[0].'x'.$imgInfo[1].' pixels';
02076                                                         $ficon = t3lib_BEfunc::getFileIcon(strtolower($fI['extension']));
02077                                                         $size=' ('.t3lib_div::formatSize(filesize($filepath)).'bytes'.($pDim?', '.$pDim:'').')';
02078                                                         $icon = '<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/fileicons/'.$ficon,'width="18" height="16"').' class="absmiddle" title="'.htmlspecialchars($fI['basename'].$size).'" alt="" />';
02079                                                         if($this->typoVersion >= 3007000 ) {
02080                                                                 $filenameAndIcon=$icon.htmlspecialchars(t3lib_div::fixed_lgd_cs(basename($filepath),$titleLen));
02081                                                         } else {
02082                                                                 $filenameAndIcon=$icon.htmlspecialchars(t3lib_div::fixed_lgd(basename($filepath),$titleLen));
02083                                                         }
02084                                                         if (t3lib_div::_GP('noLimit'))  {
02085                                                                 $maxW=10000;
02086 
02087                                                                 $maxH=10000;
02088                                                         } else {
02089                                                                 $maxW=380;
02090                                                                 $maxH=500;
02091                                                         }
02092                                                         $IW = $imgInfo[0];
02093                                                         $IH = $imgInfo[1];
02094                                                         if ($IW>$maxW)  {
02095                                                                 $IH=ceil($IH/$IW*$maxW);
02096                                                                 $IW=$maxW;
02097                                                         }
02098                                                         if ($IH>$maxH)  {
02099                                                                 $IW=ceil($IW/$IH*$maxH);
02100                                                                 $IH=$maxH;
02101                                                         }
02102 
02103                                                                 // Make row:
02104                                                         $lines[]='
02105                                                                 <tr class="bgColor4">
02106                                                                         <td nowrap="nowrap">'.$filenameAndIcon.'&nbsp;</td>
02107                                                                         <td nowrap="nowrap">'.
02108                                                                         ($imgInfo[0]!=$IW ? '<a href="'.htmlspecialchars(t3lib_div::linkThisScript(array('noLimit'=>'1'))).'">'.
02109                                                                                                                 '<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/icon_warning2.gif','width="18" height="16"').' title="'.$GLOBALS['LANG']->getLL('clickToRedrawFullSize',1).'" alt="" />'.
02110                                                                                                                 '</a>':'').
02111                                                                         $pDim.'&nbsp;</td>
02112                                                                 </tr>';
02113 
02114                                                         $lines[]='
02115                                                                 <tr>
02116                                                                         <td colspan="2"><img src="'.$iurl.'" width="'.$IW.'" height="'.$IH.'" border="1" alt="" /></td>
02117                                                                 </tr>';
02118                                                         $lines[]='
02119                                                                 <tr>
02120                                                                         <td colspan="2"><img src="clear.gif" width="1" height="3" alt="" /></td>
02121                                                                 </tr>';
02122                                                 }
02123                                         }
02124 
02125                                                 // Finally, wrap all rows in a table tag:
02126                                         $out.='
02127 
02128 
02129                         <!--
02130                                 File listing / Drag-n-drop
02131                         -->
02132                                                 <table border="0" cellpadding="0" cellspacing="1" id="typo3-dragBox">
02133                                                         '.implode('',$lines).'
02134                                                 </table>';
02135 
02136                                 }
02137                         } else {
02138                                         // Print this warning if the folder is NOT a web folder:
02139                                 $out.=$this->barheader($GLOBALS['LANG']->getLL('files'));
02140                                 $out.=$this->getMsgBox($GLOBALS['LANG']->getLL('noWebFolder'),'icon_warning2');
02141                         }
02142                 }
02143                 return $out;
02144         }
02145 
02146 
02147         /******************************************************************
02148          *
02149          * Miscellaneous functions
02150          *
02151          ******************************************************************/
02152 
02159         function isWebFolder($folder)   {
02160                 $folder = ereg_replace('\/$','',$folder).'/';
02161                 return t3lib_div::isFirstPartOfStr($folder,PATH_site) ? TRUE : FALSE;
02162         }
02163 
02170         function checkFolder($folder)   {
02171                 $fileProcessor = t3lib_div::makeInstance('t3lib_basicFileFunctions');
02172                 $fileProcessor->init($GLOBALS['FILEMOUNTS'], $GLOBALS['TYPO3_CONF_VARS']['BE']['fileExtensions']);
02173 
02174                 return $fileProcessor->checkPathAgainstMounts(ereg_replace('\/$','',$folder).'/') ? TRUE : FALSE;
02175         }
02176 
02183         function barheader($str)        {
02184                 return '
02185 
02186                         <!--
02187                                 Bar header:
02188                         -->
02189                         <h3 class="bgColor5">'.htmlspecialchars($str).'</h3>
02190                         ';
02191         }
02192 
02200         function getMsgBox($in_msg,$icon='icon_note')   {
02201                 global $BACK_PATH;
02202                 $msg = '<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/'.$icon.'.gif','width="18" height="16"').' alt="" />'.htmlspecialchars($in_msg);
02203                 $msg = '
02204 
02205                         <!--
02206                                 Message box:
02207                         -->
02208                         <table cellspacing="0" class="bgColor4" id="typo3-msgBox">
02209                                 <tr>
02210                                         <td>'.$msg.'</td>
02211                                 </tr>
02212                         </table>
02213                         ';
02214                 return $msg;
02215         }
02216 
02223         function printCurrentUrl($str)  {
02224                 return '
02225 
02226                         <!--
02227                                 Print current URL
02228                         -->
02229                         <table border="0" cellpadding="0" cellspacing="0" class="bgColor5" id="typo3-curUrl">
02230                                 <tr>
02231                                         <td>'.$GLOBALS['LANG']->getLL('currentLink',1).': '.htmlspecialchars(rawurldecode($str)).'</td>
02232                                 </tr>
02233                         </table>';
02234         }
02235 
02243         function parseCurUrl($href,$siteUrl)    {
02244                 $href = trim($href);
02245                 if ($href)      {
02246                         $info=array();
02247 
02248                                 // Default is "url":
02249                         $info['value']=$href;
02250                         $info['act']='url';
02251 
02252                         $specialParts = explode('#_SPECIAL',$href);
02253                         if (count($specialParts)==2)    {       // Special kind (Something RTE specific: User configurable links through: "userLinks." from ->thisConfig)
02254                                 $info['value']='#_SPECIAL'.$specialParts[1];
02255                                 $info['act']='spec';
02256                         } elseif (t3lib_div::isFirstPartOfStr($href,$siteUrl))  {       // If URL is on the current frontend website:
02257                                 $rel = substr($href,strlen($siteUrl));
02258                                 if (@file_exists(PATH_site.rawurldecode($rel))) {       // URL is a file, which exists:
02259                                         $info['value']=rawurldecode($rel);
02260                                         $info['act']='file';
02261                                 } else {        // URL is a page (id parameter)
02262                                         $uP=parse_url($rel);
02263                                         if (!trim($uP['path'])) {
02264                                                 $pp = explode('id=',$uP['query']);
02265                                                 $id = $pp[1];
02266                                                 if ($id)        {
02267                                                                 // Checking if the id-parameter is an alias.
02268                                                         if (!t3lib_div::testInt($id))   {
02269                                                                 list($idPartR) = t3lib_BEfunc::getRecordsByField('pages','alias',$id);
02270                                                                 $id=intval($idPartR['uid']);
02271                                                         }
02272 
02273                                                         $pageRow = t3lib_BEfunc::getRecord('pages',$id);
02274                                                         $titleLen=intval($GLOBALS['BE_USER']->uc['titleLen']);
02275                                                         if($this->typoVersion >= 3007000 ) {
02276                                                                 $info['value']=$GLOBALS['LANG']->getLL('page',1)." '".htmlspecialchars(t3lib_div::fixed_lgd_cs($pageRow['title'],$titleLen))."' (ID:".$id.($uP['fragment']?', #'.$uP['fragment']:'').')';
02277                                                         } else {
02278                                                                 $info['value']=$GLOBALS['LANG']->getLL('page',1)." '".htmlspecialchars(t3lib_div::fixed_lgd($pageRow['title'],$titleLen))."' (ID:".$id.($uP['fragment']?', #'.$uP['fragment']:'').')';
02279                                                         }
02280                                                         $info['pageid']=$id;
02281                                                         $info['cElement']=$uP['fragment'];
02282 
02283                                                         $info['act']='page';
02284                                                 }
02285                                         }
02286                                 }
02287                         } else {        // Email link:
02288                                 if (strtolower(substr($href,0,7))=='mailto:')   {
02289                                         $info['value']=trim(substr($href,7));
02290                                         $info['act']='mail';
02291                                 }
02292                         }
02293                         $info['info'] = $info['value'];
02294                 } else {        // NO value inputted:
02295                         $info=array();
02296                         $info['info']=$GLOBALS['LANG']->getLL('none');
02297                         $info['value']='';
02298                         $info['act']='page';
02299                 }
02300                 return $info;
02301         }
02302 
02310         function uploadForm($path)      {
02311                 global $BACK_PATH;
02312                 $count=3;
02313 
02314                         // Create header, showing upload path:
02315                 $header = t3lib_div::isFirstPartOfStr($path,PATH_site)?substr($path,strlen(PATH_site)):$path;
02316                 $code=$this->barheader($GLOBALS['LANG']->getLL('uploadImage').':');
02317                 $code.='
02318 
02319                         <!--
02320                                 Form, for uploading files:
02321                         -->
02322                         <form action="' . $BACK_PATH . 'tce_file.php" method="post" name="editform" enctype="'.$GLOBALS['TYPO3_CONF_VARS']['SYS']['form_enctype'].'">
02323                                 <table border="0" cellpadding="0" cellspacing="3" id="typo3-uplFiles">
02324                                         <tr>
02325                                                 <td><strong>'.$GLOBALS['LANG']->getLL('path',1).':</strong> '.htmlspecialchars($header).'</td>
02326                                         </tr>
02327                                         <tr>
02328                                                 <td>';
02329 
02330                         // Traverse the number of upload fields (default is 3):
02331                 for ($a=1;$a<=$count;$a++)      {
02332                         $code.='<input type="file" name="upload_'.$a.'"'.$this->doc->formWidth(35).' size="50" />
02333                                 <input type="hidden" name="file[upload]['.$a.'][target]" value="'.htmlspecialchars($path).'" />
02334                                 <input type="hidden" name="file[upload]['.$a.'][data]" value="'.$a.'" /><br />';
02335                 }
02336 
02337                         // Make footer of upload form, including the submit button:
02338                 $redirectValue = TYPO3_MOD_PATH . $this->script . '?act='.$this->act.'&mode='.$this->mode.'&expandFolder='.rawurlencode($path).'&bparams='.rawurlencode($this->bparams);
02339                 $code.='<input type="hidden" name="redirect" value="'.htmlspecialchars($redirectValue).'" />'.
02340                                 '<input type="submit" name="submit" value="'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:file_upload.php.submit',1).'" />';
02341 
02342                 $code.='
02343                         <div id="c-override">
02344                                 <input type="checkbox" name="overwriteExistingFiles" value="1" /> '.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_misc.xml:overwriteExistingFiles',1).'
02345                         </div>
02346                 ';
02347 
02348                 $code.='</td>
02349                                         </tr>
02350                                 </table>
02351                         </form>';
02352                 return $code;
02353         }
02354 
02362         function createFolder($path)    {
02363                 global $BACK_PATH;
02364                         // Create header, showing upload path:
02365                 $header = t3lib_div::isFirstPartOfStr($path,PATH_site)?substr($path,strlen(PATH_site)):$path;
02366                 $code=$this->barheader($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:file_newfolder.php.pagetitle').':');
02367                 $code.='
02368 
02369                         <!--
02370                                 Form, for creating new folders:
02371                         -->
02372                         <form action="' . $BACK_PATH . 'tce_file.php" method="post" name="editform2">
02373                                 <table border="0" cellpadding="0" cellspacing="3" id="typo3-crFolder">
02374                                         <tr>
02375                                                 <td><strong>'.$GLOBALS['LANG']->getLL('path',1).':</strong> '.htmlspecialchars($header).'</td>
02376                                         </tr>
02377                                         <tr>
02378                                                 <td>';
02379 
02380                         // Create the new-folder name field:
02381                 $a=1;
02382 
02383                 $code.='<input'.$this->doc->formWidth(20).' type="text" name="file[newfolder]['.$a.'][data]" />'.
02384                                 '<input type="hidden" name="file[newfolder]['.$a.'][target]" value="'.htmlspecialchars($path).'" />';
02385 
02386                         // Make footer of upload form, including the submit button:
02387 
02388                 $redirectValue = TYPO3_MOD_PATH . $this->script . '?act='.$this->act.'&mode='.$this->mode.'&expandFolder='.rawurlencode($path).'&bparams='.rawurlencode($this->bparams);
02389                 $code.='<input type="hidden" name="redirect" value="'.htmlspecialchars($redirectValue).'" />'.
02390                                 '<input type="submit" name="submit" value="'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:file_newfolder.php.submit',1).'" />';
02391 
02392                 $code.='</td>
02393                                         </tr>
02394                                 </table>
02395                         </form>';
02396 
02397                 return $code;
02398         }
02399 }
02400 
02401 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/rtehtmlarea/mod3/browse_links.php'])   {
02402         include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/rtehtmlarea/mod3/browse_links.php']);
02403 }
02404 
02405 
02406 // Make instance:
02407 $SOBE = t3lib_div::makeInstance('tx_rtehtmlarea_browse_links');
02408 $SOBE->init();
02409 $SOBE->main();
02410 $SOBE->printContent();
02411 ?>


Généré par Les spécialistes TYPO3 avec  doxygen 1.4.6