Main Page | Directories | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages | Examples

browse_links.php

Go to the documentation of this file.
00001 <?php
00002 /***************************************************************
00003 *  Copyright notice
00004 *
00005 *  (c) 1999-2004 Kasper Skaarhoj (kasperYYYY@typo3.com)
00006 *  All rights reserved
00007 *
00008 *  This script is part of the TYPO3 project. The TYPO3 project is
00009 *  free software; you can redistribute it and/or modify
00010 *  it under the terms of the GNU General Public License as published by
00011 *  the Free Software Foundation; either version 2 of the License, or
00012 *  (at your option) any later version.
00013 *
00014 *  The GNU General Public License can be found at
00015 *  http://www.gnu.org/copyleft/gpl.html.
00016 *  A copy is found in the textfile GPL.txt and important notices to the license
00017 *  from the author is found in LICENSE.txt distributed with these scripts.
00018 *
00019 *
00020 *  This script is distributed in the hope that it will be useful,
00021 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00022 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00023 *  GNU General Public License for more details.
00024 *
00025 *  This copyright notice MUST APPEAR in all copies of the script!
00026 ***************************************************************/
00116 $BACK_PATH='';
00117 require ('init.php');
00118 require ('template.php');
00119 require_once (PATH_t3lib.'class.t3lib_browsetree.php');
00120 require_once (PATH_t3lib.'class.t3lib_foldertree.php');
00121 require_once (PATH_t3lib.'class.t3lib_stdgraphic.php');
00122 require_once (PATH_t3lib.'class.t3lib_basicfilefunc.php');
00123 $LANG->includeLLFile('EXT:lang/locallang_browse_links.xml');
00124 
00125 
00126    // Include classes
00127 require_once (PATH_t3lib.'class.t3lib_page.php');
00128 require_once (PATH_t3lib.'class.t3lib_recordlist.php');
00129 require_once ('class.db_list.inc');
00130 require_once ('class.db_list_extra.inc');
00131 
00132 
00133 
00134 
00135 
00136 
00137 
00138 
00139 
00140 
00141 
00142 
00143 
00144 
00145 
00146 
00147 
00148 
00149 
00157 class TBE_browser_recordList extends localRecordList {
00158    var $script='browse_links.php';
00159 
00168    function listURL($altId='',$table=-1,$exclList='') {
00169       return $this->script.
00170          '?id='.(strcmp($altId,'')?$altId:$this->id).
00171          '&table='.rawurlencode($table==-1?$this->table:$table).
00172          ($this->thumbs?'&imagemode='.$this->thumbs:'').
00173          ($this->searchString?'&search_field='.rawurlencode($this->searchString):'').
00174          ($this->searchLevels?'&search_levels='.rawurlencode($this->searchLevels):'').
00175          ((!$exclList || !t3lib_div::inList($exclList,'sortField')) && $this->sortField?'&sortField='.rawurlencode($this->sortField):'').
00176          ((!$exclList || !t3lib_div::inList($exclList,'sortRev')) && $this->sortRev?'&sortRev='.rawurlencode($this->sortRev):'').
00177             // extra:
00178          $this->ext_addP()
00179          ;
00180    }
00181 
00187    function ext_addP()  {
00188       $str = '&act='.$GLOBALS['SOBE']->act.
00189             '&mode='.$GLOBALS['SOBE']->mode.
00190             '&expandPage='.$GLOBALS['SOBE']->expandPage.
00191             '&bparams='.rawurlencode($GLOBALS['SOBE']->bparams);
00192       return $str;
00193    }
00194 
00204    function linkWrapItems($table,$uid,$code,$row)  {
00205       global $TCA;
00206 
00207       if (!$code) {
00208          $code = '<i>['.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.no_title',1).']</i>';
00209       } else {
00210          $code = htmlspecialchars(t3lib_div::fixed_lgd_cs($code,$this->fixedL));
00211       }
00212 
00213       $titleCol = $TCA[$table]['ctrl']['label'];
00214       $title = $row[$titleCol];
00215 
00216       $ficon = t3lib_iconWorks::getIcon($table,$row);
00217       $aOnClick = "return insertElement('".$table."', '".$row['uid']."', 'db', unescape('".rawurlencode($title)."'), '', '', '".$ficon."');";
00218       $ATag = '<a href="#" onclick="'.htmlspecialchars($aOnClick).'">';
00219       $ATag_alt = substr($ATag,0,-4).',\'\',1);">';
00220       $ATag_e = '</a>';
00221 
00222       return $ATag.
00223             '<img'.t3lib_iconWorks::skinImg('','gfx/plusbullet2.gif','width="18" height="16"').' title="'.$GLOBALS['LANG']->getLL('addToList',1).'" alt="" />'.
00224             $ATag_e.
00225             $ATag_alt.
00226             $code.
00227             $ATag_e;
00228    }
00229 
00237    function linkWrapTable($table,$code)   {
00238       return $code;
00239    }
00240 }
00241 
00242 
00243 
00244 
00245 
00246 
00254 class localPageTree extends t3lib_browseTree {
00255 
00261    function localPageTree() {
00262       $this->init();
00263 
00264       $this->clause = ' AND doktype!=255'.$this->clause;
00265    }
00266 
00275    function wrapTitle($title,$v,$ext_pArrPages='') {
00276       if ($this->ext_isLinkable($v['doktype'],$v['uid']))   {
00277          $aOnClick = "return link_typo3Page('".$v['uid']."');";
00278          return '<a href="#" onclick="'.htmlspecialchars($aOnClick).'">'.$title.'</a>';
00279       } else {
00280          return '<span style="color: #666666;">'.$title.'</span>';
00281       }
00282    }
00283 
00290    function printTree($treeArr='')  {
00291       $titleLen=intval($GLOBALS['BE_USER']->uc['titleLen']);
00292       if (!is_array($treeArr))   $treeArr=$this->tree;
00293 
00294       $out='';
00295       $c=0;
00296 
00297       foreach($treeArr as $k => $v) {
00298          $c++;
00299          $bgColorClass = ($c+1)%2 ? 'bgColor' : 'bgColor-10';
00300          if ($GLOBALS['SOBE']->curUrlInfo['act']=='page' && $GLOBALS['SOBE']->curUrlInfo['pageid']==$v['row']['uid'] && $GLOBALS['SOBE']->curUrlInfo['pageid'])   {
00301             $arrCol='<td><img'.t3lib_iconWorks::skinImg('','gfx/blinkarrow_right.gif','width="5" height="9"').' class="c-blinkArrowR" alt="" /></td>';
00302             $bgColorClass='bgColor4';
00303          } else {
00304             $arrCol='<td></td>';
00305          }
00306 
00307          $aOnClick = 'return jumpToUrl(\''.$this->script.'?act='.$GLOBALS['SOBE']->act.'&mode='.$GLOBALS['SOBE']->mode.'&expandPage='.$v['row']['uid'].'\');';
00308          $cEbullet = $this->ext_isLinkable($v['row']['doktype'],$v['row']['uid']) ?
00309                   '<a href="#" onclick="'.htmlspecialchars($aOnClick).'"><img'.t3lib_iconWorks::skinImg('','gfx/ol/arrowbullet.gif','width="18" height="16"').' alt="" /></a>' :
00310                   '';
00311          $out.='
00312             <tr class="'.$bgColorClass.'">
00313                <td nowrap="nowrap">'.
00314                $v['HTML'].
00315                $this->wrapTitle($this->getTitleStr($v['row'],$titleLen),$v['row'],$this->ext_pArrPages).
00316                '</td>'.
00317                $arrCol.
00318                '<td>'.$cEbullet.'</td>
00319             </tr>';
00320       }
00321       $out='
00322 
00323 
00324          <!--
00325             Navigation Page Tree:
00326          -->
00327          <table border="0" cellpadding="0" cellspacing="0" id="typo3-tree">
00328             '.$out.'
00329          </table>';
00330       return $out;
00331    }
00332 
00340    function ext_isLinkable($doktype,$uid) {
00341       if ($uid && $doktype<199)  {
00342          return true;
00343       }
00344    }
00345 
00354    function PM_ATagWrap($icon,$cmd,$bMark='')   {
00355       if ($bMark) {
00356          $anchor = '#'.$bMark;
00357          $name=' name="'.$bMark.'"';
00358       }
00359       $aOnClick = "return jumpToUrl('".$this->script.'?PM='.$cmd."','".$anchor."');";
00360 
00361       return '<a href="#"'.$name.' onclick="'.htmlspecialchars($aOnClick).'">'.$icon.'</a>';
00362    }
00363 
00371    function wrapIcon($icon,$row) {
00372       return $this->addTagAttributes($icon,' title="id='.$row['uid'].'"');
00373    }
00374 }
00375 
00376 
00377 
00378 
00379 
00380 
00381 
00382 
00390 class rtePageTree extends localPageTree {
00391 }
00392 
00393 
00394 
00395 
00396 
00397 
00398 
00399 
00407 class TBE_PageTree extends localPageTree {
00408 
00416    function ext_isLinkable($doktype,$uid) {
00417       return true;
00418    }
00419 
00428    function wrapTitle($title,$v,$ext_pArrPages) {
00429       if ($ext_pArrPages)  {
00430          $ficon=t3lib_iconWorks::getIcon('pages',$v);
00431          $onClick = "return insertElement('pages', '".$v['uid']."', 'db', unescape('".rawurlencode($v['title'])."'), '', '', '".$ficon."','',1);";
00432       } else {
00433          $onClick = 'return jumpToUrl(\'browse_links.php?act='.$GLOBALS['SOBE']->act.'&mode='.$GLOBALS['SOBE']->mode.'&expandPage='.$v['uid'].'\');';
00434       }
00435       return '<a href="#" onclick="'.htmlspecialchars($onClick).'">'.$title.'</a>';
00436    }
00437 }
00438 
00439 
00440 
00441 
00442 
00443 
00444 
00445 
00454 class localFolderTree extends t3lib_folderTree {
00455    var $ext_IconMode=1;
00456 
00464    function wrapTitle($title,$v) {
00465       if ($this->ext_isLinkable($v))   {
00466          $aOnClick = 'return jumpToUrl(\''.$this->script.'?act='.$GLOBALS['SOBE']->act.'&mode='.$GLOBALS['SOBE']->mode.'&expandFolder='.rawurlencode($v['path']).'\');';
00467          return '<a href="#" onclick="'.htmlspecialchars($aOnClick).'">'.$title.'</a>';
00468       } else {
00469          return '<span class="typo3-dimmed">'.$title.'</span>';
00470       }
00471    }
00472 
00479    function ext_isLinkable($v)   {
00480       $webpath=t3lib_BEfunc::getPathType_web_nonweb($v['path']);  // Checking, if the input path is a web-path.
00481       if (strstr($v['path'],'_recycler_') || strstr($v['path'],'_temp_') || $webpath!='web') {
00482          return 0;
00483       }
00484       return 1;
00485    }
00486 
00496    function PM_ATagWrap($icon,$cmd,$bMark='')   {
00497       if ($bMark) {
00498          $anchor = '#'.$bMark;
00499          $name=' name="'.$bMark.'"';
00500       }
00501       $aOnClick = 'return jumpToUrl(\''.$this->script.'?PM='.$cmd.'\',\''.$anchor.'\');';
00502       return '<a href="#"'.$name.' onclick="'.htmlspecialchars($aOnClick).'">'.$icon.'</a>';
00503    }
00504 
00511    function printTree($treeArr='')  {
00512       $titleLen=intval($GLOBALS['BE_USER']->uc['titleLen']);
00513 
00514       if (!is_array($treeArr))   $treeArr=$this->tree;
00515 
00516       $out='';
00517       $c=0;
00518 
00519          // Preparing the current-path string (if found in the listing we will see a red blinking arrow).
00520       if (!$GLOBALS['SOBE']->curUrlInfo['value'])  {
00521          $cmpPath='';
00522       } else if (substr(trim($GLOBALS['SOBE']->curUrlInfo['info']),-1)!='/')  {
00523          $cmpPath=PATH_site.dirname($GLOBALS['SOBE']->curUrlInfo['info']).'/';
00524       } else {
00525          $cmpPath=PATH_site.$GLOBALS['SOBE']->curUrlInfo['info'];
00526       }
00527 
00528          // Traverse rows for the tree and print them into table rows:
00529       foreach($treeArr as $k => $v) {
00530          $c++;
00531          $bgColorClass=($c+1)%2 ? 'bgColor' : 'bgColor-10';
00532 
00533             // Creating blinking arrow, if applicable:
00534          if ($GLOBALS['SOBE']->curUrlInfo['act']=='file' && $cmpPath==$v['row']['path'])  {
00535             $arrCol='<td><img'.t3lib_iconWorks::skinImg('','gfx/blinkarrow_right.gif','width="5" height="9"').' class="c-blinkArrowR" alt="" /></td>';
00536             $bgColorClass='bgColor4';
00537          } else {
00538             $arrCol='<td></td>';
00539          }
00540             // Create arrow-bullet for file listing (if folder path is linkable):
00541          $aOnClick = 'return jumpToUrl(\''.$this->script.'?act='.$GLOBALS['SOBE']->act.'&mode='.$GLOBALS['SOBE']->mode.'&expandFolder='.rawurlencode($v['row']['path']).'\');';
00542          $cEbullet = $this->ext_isLinkable($v['row']) ? '<a href="#" onclick="'.htmlspecialchars($aOnClick).'"><img'.t3lib_iconWorks::skinImg('','gfx/ol/arrowbullet.gif','width="18" height="16"').' alt="" /></a>' : '';
00543 
00544             // Put table row with folder together:
00545          $out.='
00546             <tr class="'.$bgColorClass.'">
00547                <td nowrap="nowrap">'.$v['HTML'].$this->wrapTitle(t3lib_div::fixed_lgd_cs($v['row']['title'],$titleLen),$v['row']).'</td>
00548                '.$arrCol.'
00549                <td>'.$cEbullet.'</td>
00550             </tr>';
00551       }
00552 
00553       $out='
00554 
00555          <!--
00556             Folder tree:
00557          -->
00558          <table border="0" cellpadding="0" cellspacing="0" id="typo3-tree">
00559             '.$out.'
00560          </table>';
00561       return $out;
00562    }
00563 }
00564 
00565 
00566 
00567 
00568 
00569 
00577 class rteFolderTree extends localFolderTree {
00578 }
00579 
00580 
00581 
00582 
00583 
00584 
00585 
00593 class TBE_FolderTree extends localFolderTree {
00594    var $ext_noTempRecyclerDirs=0;      // If file-drag mode is set, temp and recycler folders are filtered out.
00595 
00602    function ext_isLinkable($v)   {
00603       if ($this->ext_noTempRecyclerDirs && (substr($v['path'],-7)=='_temp_/' || substr($v['path'],-11)=='_recycler_/')) {
00604          return 0;
00605       } return 1;
00606    }
00607 
00615    function wrapTitle($title,$v) {
00616       if ($this->ext_isLinkable($v))   {
00617          $aOnClick = 'return jumpToUrl(\'browse_links.php?act='.$GLOBALS['SOBE']->act.'&mode='.$GLOBALS['SOBE']->mode.'&expandFolder='.rawurlencode($v['path']).'\');';
00618          return '<a href="#" onclick="'.htmlspecialchars($aOnClick).'">'.$title.'</a>';
00619       } else {
00620          return '<span class="typo3-dimmed">'.$title.'</span>';
00621       }
00622    }
00623 }
00624 
00625 
00626 
00627 
00628 
00636 class SC_browse_links {
00637 
00638       // Internal, static:
00639    var $siteURL;        // Current site URL (Frontend)
00640    var $thisConfig;     // RTE specific TSconfig
00641    var $setTarget;         // Target (RTE specific)
00642    var $doc;            // Backend template object
00643 
00644       // GPvars:  (Input variables from outside)
00655    var $mode;
00656 
00662    var $act;
00663 
00667    var $expandPage;
00668 
00672    var $expandFolder;
00673 
00674 
00675 
00679    var $P;
00680 
00685    var $bparams;
00686 
00691    var $RTEtsConfigParams;
00692 
00693 
00694 
00695 
00699    var $PM;
00700 
00704    var $pointer;
00705 
00706 
00707 
00708 
00712    var $curUrlArray;
00713 
00717    var $curUrlInfo;
00718 
00719 
00720 
00721 
00722 
00729    function init()   {
00730       global $BE_USER,$BACK_PATH;
00731 
00732          // Main GPvars:
00733       $this->pointer = t3lib_div::_GP('pointer');
00734       $this->bparams = t3lib_div::_GP('bparams');
00735       $this->P = t3lib_div::_GP('P');
00736       $this->RTEtsConfigParams = t3lib_div::_GP('RTEtsConfigParams');
00737       $this->expandPage = t3lib_div::_GP('expandPage');
00738       $this->expandFolder = t3lib_div::_GP('expandFolder');
00739       $this->PM = t3lib_div::_GP('PM');
00740 
00741          // Find "mode"
00742       $this->mode=t3lib_div::_GP('mode');
00743       if (!$this->mode) {
00744          $this->mode='rte';
00745       }
00746 
00747          // Site URL
00748       $this->siteURL = t3lib_div::getIndpEnv('TYPO3_SITE_URL');   // Current site url
00749 
00750          // CurrentUrl - the current link url must be passed around if it exists
00751       if ($this->mode=='wizard') {
00752          $currentLinkParts = t3lib_div::trimExplode(' ',$this->P['currentValue']);
00753          $this->curUrlArray = array(
00754             'target' => $currentLinkParts[1]
00755          );
00756          $this->curUrlInfo=$this->parseCurUrl($this->siteURL.'?id='.$currentLinkParts[0],$this->siteURL);
00757       } else {
00758          $this->curUrlArray = t3lib_div::_GP('curUrl');
00759          if ($this->curUrlArray['all'])   {
00760             $this->curUrlArray=t3lib_div::get_tag_attributes($this->curUrlArray['all']);
00761          }
00762          $this->curUrlInfo=$this->parseCurUrl($this->curUrlArray['href'],$this->siteURL);
00763       }
00764 
00765          // Determine nature of current url:
00766       $this->act=t3lib_div::_GP('act');
00767       if (!$this->act)  {
00768          $this->act=$this->curUrlInfo['act'];
00769       }
00770 
00771          // Rich Text Editor specific configuration:
00772       $addPassOnParams='';
00773       if ((string)$this->mode=='rte')  {
00774          $RTEtsConfigParts = explode(':',$this->RTEtsConfigParams);
00775          $addPassOnParams.='&RTEtsConfigParams='.rawurlencode($this->RTEtsConfigParams);
00776          $RTEsetup = $GLOBALS['BE_USER']->getTSConfig('RTE',t3lib_BEfunc::getPagesTSconfig($RTEtsConfigParts[5]));
00777          $this->thisConfig = t3lib_BEfunc::RTEsetup($RTEsetup['properties'],$RTEtsConfigParts[0],$RTEtsConfigParts[2],$RTEtsConfigParts[4]);
00778       }
00779 
00780          // Initializing the target value (RTE)
00781       $this->setTarget = $this->curUrlArray['target'];
00782       if ($this->thisConfig['defaultLinkTarget'] && !isset($this->curUrlArray['target'])) {
00783          $this->setTarget=$this->thisConfig['defaultLinkTarget'];
00784       }
00785 
00786 
00787 
00788          // Creating backend template object:
00789       $this->doc = t3lib_div::makeInstance('template');
00790       $this->doc->docType= 'xhtml_trans';
00791       $this->doc->backPath = $BACK_PATH;
00792 
00793          // BEGIN accumulation of header JavaScript:
00794       $JScode = '';
00795       $JScode.= '
00796             // This JavaScript is primarily for RTE/Link. jumpToUrl is used in the other cases as well...
00797          var add_href="'.($this->curUrlArray['href']?'&curUrl[href]='.rawurlencode($this->curUrlArray['href']):'').'";
00798          var add_target="'.($this->setTarget?'&curUrl[target]='.rawurlencode($this->setTarget):'').'";
00799          var add_params="'.($this->bparams?'&bparams='.rawurlencode($this->bparams):'').'";
00800 
00801          var cur_href="'.($this->curUrlArray['href']?$this->curUrlArray['href']:'').'";
00802          var cur_target="'.($this->setTarget?$this->setTarget:'').'";
00803 
00804          function setTarget(target) {  //
00805             cur_target=target;
00806             add_target="&curUrl[target]="+escape(target);
00807          }
00808          function setValue(value)   {  //
00809             cur_href=value;
00810             add_href="&curUrl[href]="+value;
00811          }
00812       ';
00813 
00814 
00815       if ($this->mode=='wizard') {  // Functions used, if the link selector is in wizard mode (= TCEforms fields)
00816          unset($this->P['fieldChangeFunc']['alert']);
00817          reset($this->P['fieldChangeFunc']);
00818          $update='';
00819          while(list($k,$v)=each($this->P['fieldChangeFunc']))  {
00820             $update.= '
00821             window.opener.'.$v;
00822          }
00823 
00824          $P2=array();
00825          $P2['itemName']=$this->P['itemName'];
00826          $P2['formName']=$this->P['formName'];
00827          $P2['fieldChangeFunc']=$this->P['fieldChangeFunc'];
00828          $addPassOnParams.=t3lib_div::implodeArrayForUrl('P',$P2);
00829 
00830          $JScode.='
00831             function link_typo3Page(id,anchor)  {  //
00832                updateValueInMainForm(id+(anchor?anchor:"")+" "+cur_target);
00833                close();
00834                return false;
00835             }
00836             function link_folder(folder)  {  //
00837                updateValueInMainForm(folder+" "+cur_target);
00838                close();
00839                return false;
00840             }
00841             function link_current() {  //
00842                if (cur_href!="http://" && cur_href!="mailto:") {
00843                   var setValue = cur_href+" "+cur_target;
00844                   if (setValue.substr(0,7)=="http://")   setValue = setValue.substr(7);
00845                   if (setValue.substr(0,7)=="mailto:")   setValue = setValue.substr(7);
00846                   updateValueInMainForm(setValue);
00847                   close();
00848                }
00849                return false;
00850             }
00851             function checkReference()  {  //
00852                if (window.opener && window.opener.document && window.opener.document.'.$this->P['formName'].' && window.opener.document.'.$this->P['formName'].'["'.$this->P['itemName'].'"] )  {
00853                   return window.opener.document.'.$this->P['formName'].'["'.$this->P['itemName'].'"];
00854                } else {
00855                   close();
00856                }
00857             }
00858             function updateValueInMainForm(input)  {  //
00859                var field = checkReference();
00860                if (field)  {
00861                   field.value = input;
00862                   '.$update.'
00863                }
00864             }
00865          ';
00866       } else { // Functions used, if the link selector is in RTE mode:
00867          $JScode.='
00868             function link_typo3Page(id,anchor)  {  //
00869                var theLink = \''.$this->siteURL.'?id=\'+id+(anchor?anchor:"");
00870                self.parent.parent.renderPopup_addLink(theLink,cur_target);
00871                return false;
00872             }
00873             function link_folder(folder)  {  //
00874                var theLink = \''.$this->siteURL.'\'+folder;
00875                self.parent.parent.renderPopup_addLink(theLink,cur_target);
00876                return false;
00877             }
00878             function link_spec(theLink)   {  //
00879                self.parent.parent.renderPopup_addLink(theLink,cur_target);
00880                return false;
00881             }
00882             function link_current() {  //
00883                if (cur_href!="http://" && cur_href!="mailto:") {
00884                   self.parent.parent.renderPopup_addLink(cur_href,cur_target);
00885                }
00886                return false;
00887             }
00888          ';
00889       }
00890 
00891          // General "jumpToUrl" function:
00892       $JScode.='
00893          function jumpToUrl(URL,anchor)   {  //
00894             var add_act = URL.indexOf("act=")==-1 ? "&act='.$this->act.'" : "";
00895             var add_mode = URL.indexOf("mode=")==-1 ? "&mode='.$this->mode.'" : "";
00896             var theLocation = URL+add_act+add_mode+add_href+add_target+add_params'.($addPassOnParams?'+"'.$addPassOnParams.'"':'').'+(anchor?anchor:"");
00897             document.location = theLocation;
00898             return false;
00899          }
00900       ';
00901 
00902 
00903          // This is JavaScript especially for the TBE Element Browser!
00904       $pArr = explode('|',$this->bparams);
00905       $formFieldName = 'data['.$pArr[0].']['.$pArr[1].']['.$pArr[2].']';
00906       $JScode.='
00907          var elRef="";
00908          var targetDoc="";
00909 
00910          function launchView(url)   {  //
00911             var thePreviewWindow="";
00912             thePreviewWindow = window.open("show_item.php?table="+url,"ShowItem","height=300,width=410,status=0,menubar=0,resizable=0,location=0,directories=0,scrollbars=1,toolbar=0");
00913             if (thePreviewWindow && thePreviewWindow.focus) {
00914                thePreviewWindow.focus();
00915             }
00916          }
00917          function setReferences()   {  //
00918             if (parent.window.opener
00919             && parent.window.opener.content
00920             && parent.window.opener.content.document.editform
00921             && parent.window.opener.content.document.editform["'.$formFieldName.'"]
00922                   ) {
00923                targetDoc = parent.window.opener.content.document;
00924                elRef = targetDoc.editform["'.$formFieldName.'"];
00925                return true;
00926             } else {
00927                return false;
00928             }
00929          }
00930          function insertElement(table, uid, type, filename,fp,filetype,imagefile,action, close) {  //
00931             if (1=='.($pArr[0]&&!$pArr[1]&&!$pArr[2] ? 1 : 0).')  {
00932                addElement(filename,table+"_"+uid,fp,close);
00933             } else {
00934                if (setReferences()) {
00935                   parent.window.opener.group_change("add","'.$pArr[0].'","'.$pArr[1].'","'.$pArr[2].'",elRef,targetDoc);
00936                } else {
00937                   alert("Error - reference to main window is not set properly!");
00938                }
00939                if (close)  {
00940                   parent.window.opener.focus();
00941                   parent.close();
00942                }
00943             }
00944             return false;
00945          }
00946          function addElement(elName,elValue,altElValue,close)  {  //
00947             if (parent.window.opener && parent.window.opener.setFormValueFromBrowseWin)   {
00948                parent.window.opener.setFormValueFromBrowseWin("'.$pArr[0].'",altElValue?altElValue:elValue,elName);
00949                if (close)  {
00950                   parent.window.opener.focus();
00951                   parent.close();
00952                }
00953             } else {
00954                alert("Error - reference to main window is not set properly!");
00955                parent.close();
00956             }
00957          }
00958       ';
00959 
00960          // Finally, add the accumulated JavaScript to the template object:
00961       $this->doc->JScode = $this->doc->wrapScriptTags($JScode);
00962 
00963          // Debugging:
00964       if (FALSE) debug(array(
00965          'pointer' => $this->pointer,
00966          'act' => $this->act,
00967          'mode' => $this->mode,
00968          'curUrlInfo' => $this->curUrlInfo,
00969          'curUrlArray' => $this->curUrlArray,
00970          'P' => $this->P,
00971          'bparams' => $this->bparams,
00972          'RTEtsConfigParams' => $this->RTEtsConfigParams,
00973          'expandPage' => $this->expandPage,
00974          'expandFolder' => $this->expandFolder,
00975          'PM' => $this->PM,
00976       ),'Internal variables of Script Class:');
00977    }
00978 
00984    function main()   {
00985       global $BE_USER;
00986 
00987       $modData = $BE_USER->getModuleData('browse_links.php','ses');
00988 
00989          // Output the correct content according to $this->mode
00990       switch((string)$this->mode)   {
00991          case 'rte':
00992             $this->content=$this->main_rte();
00993          break;
00994          case 'db':
00995             if (isset($this->expandPage)) {
00996                $modData['expandPage']=$this->expandPage;
00997                $BE_USER->pushModuleData('browse_links.php',$modData);
00998             } else {
00999                $this->expandPage=$modData['expandPage'];
01000             }
01001 
01002             $this->content=$this->main_db();
01003          break;
01004          case 'file':
01005          case 'filedrag':
01006             if (isset($this->expandFolder))  {
01007                $modData['expandFolder']=$this->expandFolder;
01008                $BE_USER->pushModuleData('browse_links.php',$modData);
01009             } else {
01010                $this->expandFolder=$modData['expandFolder'];
01011             }
01012 
01013             $this->content=$this->main_file();
01014          break;
01015          case 'wizard':
01016             $this->content=$this->main_rte(1);
01017          break;
01018       }
01019    }
01020 
01026    function printContent() {
01027       echo $this->content;
01028    }
01029 
01030 
01031 
01032 
01033 
01034 
01035 
01036 
01037 
01038 
01039 
01040 
01041 
01042 
01043    /******************************************************************
01044     *
01045     * Main functions
01046     *
01047     ******************************************************************/
01048 
01057    function main_rte($wiz=0)  {
01058       global $LANG;
01059 
01060          // Starting content:
01061       $content=$this->doc->startPage('RTE link');
01062 
01063          // Initializing the action value, possibly removing blinded values etc:
01064       $allowedItems = array_diff(explode(',','page,file,url,mail,spec'),t3lib_div::trimExplode(',',$this->thisConfig['blindLinkOptions'],1));
01065       reset($allowedItems);
01066       if (!in_array($this->act,$allowedItems))  $this->act = current($allowedItems);
01067 
01068          // Making menu in top:
01069       $menuDef = array();
01070       if (!$wiz)  {
01071          $menuDef['removeLink']['isActive'] = $this->act=='removeLink';
01072          $menuDef['removeLink']['label'] = $LANG->getLL('removeLink',1);
01073          $menuDef['removeLink']['url'] = '#';
01074          $menuDef['removeLink']['addParams'] = 'onclick="self.parent.parent.renderPopup_unLink();return false;"';
01075       }
01076       if (in_array('page',$allowedItems)) {
01077          $menuDef['page']['isActive'] = $this->act=='page';
01078          $menuDef['page']['label'] = $LANG->getLL('page',1);
01079          $menuDef['page']['url'] = '#';
01080          $menuDef['page']['addParams'] = 'onclick="jumpToUrl(\'?act=page\');return false;"';
01081       }
01082       if (in_array('file',$allowedItems)){
01083          $menuDef['file']['isActive'] = $this->act=='file';
01084          $menuDef['file']['label'] = $LANG->getLL('file',1);
01085          $menuDef['file']['url'] = '#';
01086          $menuDef['file']['addParams'] = 'onclick="jumpToUrl(\'?act=file\');return false;"';
01087       }
01088       if (in_array('url',$allowedItems)) {
01089          $menuDef['url']['isActive'] = $this->act=='url';
01090          $menuDef['url']['label'] = $LANG->getLL('extUrl',1);
01091          $menuDef['url']['url'] = '#';
01092          $menuDef['url']['addParams'] = 'onclick="jumpToUrl(\'?act=url\');return false;"';
01093       }
01094       if (in_array('mail',$allowedItems)) {
01095          $menuDef['mail']['isActive'] = $this->act=='mail';
01096          $menuDef['mail']['label'] = $LANG->getLL('email',1);
01097          $menuDef['mail']['url'] = '#';
01098          $menuDef['mail']['addParams'] = 'onclick="jumpToUrl(\'?act=mail\');return false;"';
01099       }
01100       if (is_array($this->thisConfig['userLinks.']) && in_array('spec',$allowedItems)) {
01101          $menuDef['spec']['isActive'] = $this->act=='spec';
01102          $menuDef['spec']['label'] = $LANG->getLL('special',1);
01103          $menuDef['spec']['url'] = '#';
01104          $menuDef['spec']['addParams'] = 'onclick="jumpToUrl(\'?act=spec\');return false;"';
01105       }
01106       $content .= $this->doc->getTabMenuRaw($menuDef);
01107 
01108          // Adding the menu and header to the top of page:
01109       $content.=$this->printCurrentUrl($this->curUrlInfo['info']).'<br />';
01110 
01111 
01112          // Depending on the current action we will create the actual module content for selecting a link:
01113       switch($this->act)   {
01114          case 'mail':
01115             $extUrl='
01116 
01117          <!--
01118             Enter mail address:
01119          -->
01120                <form action="" name="lurlform" id="lurlform">
01121                   <table border="0" cellpadding="2" cellspacing="1" id="typo3-linkMail">
01122                      <tr>
01123                         <td>'.$GLOBALS['LANG']->getLL('emailAddress',1).':</td>
01124                         <td><input type="text" name="lemail"'.$this->doc->formWidth(20).' value="'.htmlspecialchars($this->curUrlInfo['act']=='mail'?$this->curUrlInfo['info']:'').'" /> '.
01125                            '<input type="submit" value="'.$GLOBALS['LANG']->getLL('setLink',1).'" onclick="setTarget(\'\');setValue(\'mailto:\'+document.lurlform.lemail.value); return link_current();" /></td>
01126                      </tr>
01127                   </table>
01128                </form>';
01129             $content.=$extUrl;
01130          break;
01131          case 'url':
01132             $extUrl='
01133 
01134          <!--
01135             Enter External URL:
01136          -->
01137                <form action="" name="lurlform" id="lurlform">
01138                   <table border="0" cellpadding="2" cellspacing="1" id="typo3-linkURL">
01139                      <tr>
01140                         <td>URL:</td>
01141                         <td><input type="text" name="lurl"'.$this->doc->formWidth(20).' value="'.htmlspecialchars($this->curUrlInfo['act']=='url'?$this->curUrlInfo['info']:'http://').'" /> '.
01142                            '<input type="submit" value="'.$GLOBALS['LANG']->getLL('setLink',1).'" onclick="setValue(document.lurlform.lurl.value); return link_current();" /></td>
01143                      </tr>
01144                   </table>
01145                </form>';
01146             $content.=$extUrl;
01147          break;
01148          case 'file':
01149             $foldertree = t3lib_div::makeInstance('rteFolderTree');
01150             $tree=$foldertree->getBrowsableTree();
01151 
01152             if (!$this->curUrlInfo['value'] || $this->curUrlInfo['act']!='file') {
01153                $cmpPath='';
01154             } elseif (substr(trim($this->curUrlInfo['info']),-1)!='/')  {
01155                $cmpPath=PATH_site.dirname($this->curUrlInfo['info']).'/';
01156                if (!isset($this->expandFolder))       $this->expandFolder = $cmpPath;
01157             } else {
01158                $cmpPath=PATH_site.$this->curUrlInfo['info'];
01159             }
01160 
01161             list(,,$specUid) = explode('_',$this->PM);
01162             $files = $this->expandFolder($foldertree->specUIDmap[$specUid]);
01163 
01164             $content.= '
01165 
01166          <!--
01167             Wrapper table for folder tree / file list:
01168          -->
01169                <table border="0" cellpadding="0" cellspacing="0" id="typo3-linkFiles">
01170                   <tr>
01171                      <td class="c-wCell" valign="top">'.$this->barheader($GLOBALS['LANG']->getLL('folderTree').':').$tree.'</td>
01172                      <td class="c-wCell" valign="top">'.$files.'</td>
01173                   </tr>
01174                </table>
01175                ';
01176          break;
01177          case 'spec':
01178             if (is_array($this->thisConfig['userLinks.']))  {
01179                $subcats=array();
01180                $v=$this->thisConfig['userLinks.'];
01181                reset($v);
01182                while(list($k2)=each($v))  {
01183                   $k2i = intval($k2);
01184                   if (substr($k2,-1)=='.' && is_array($v[$k2i.'.'])) {
01185 
01186                         // Title:
01187                      $title = trim($v[$k2i]);
01188                      if (!$title)   {
01189                         $title=$v[$k2i.'.']['url'];
01190                      } else {
01191                         $title=$LANG->sL($title);
01192                      }
01193                         // Description:
01194                      $description=$v[$k2i.'.']['description'] ? $LANG->sL($v[$k2i.'.']['description'],1).'<br />' : '';
01195 
01196                         // URL + onclick event:
01197                      $onClickEvent='';
01198                      if (isset($v[$k2i.'.']['target']))  $onClickEvent.="setTarget('".$v[$k2i.'.']['target']."');";
01199                      $v[$k2i.'.']['url'] = str_replace('###_URL###',$this->siteURL,$v[$k2i.'.']['url']);
01200                      if (substr($v[$k2i.'.']['url'],0,7)=="http://" || substr($v[$k2i.'.']['url'],0,7)=='mailto:')   {
01201                         $onClickEvent.="cur_href=unescape('".rawurlencode($v[$k2i.'.']['url'])."');link_current();";
01202                      } else {
01203                         $onClickEvent.="link_spec(unescape('".$this->siteURL.rawurlencode($v[$k2i.'.']['url'])."'));";
01204                      }
01205 
01206                         // Link:
01207                      $A=array('<a href="#" onclick="'.htmlspecialchars($onClickEvent).'return false;">','</a>');
01208 
01209                         // Adding link to menu of user defined links:
01210                      $subcats[$k2i]='
01211                         <tr>
01212                            <td class="bgColor4">'.$A[0].'<strong>'.htmlspecialchars($title).($this->curUrlInfo['info']==$v[$k2i.'.']['url']?'<img'.t3lib_iconWorks::skinImg('','gfx/blinkarrow_right.gif','width="5" height="9"').' class="c-blinkArrowR" alt="" />':'').'</strong><br />'.$description.$A[1].'</td>
01213                         </tr>';
01214                   }
01215                }
01216 
01217                   // Sort by keys:
01218                ksort($subcats);
01219 
01220                   // Add menu to content:
01221                $content.= '
01222 
01223          <!--
01224             Special userdefined menu:
01225          -->
01226                   <table border="0" cellpadding="1" cellspacing="1" id="typo3-linkSpecial">
01227                      <tr>
01228                         <td class="bgColor5" class="c-wCell" valign="top"><strong>'.$LANG->getLL('special',1).'</strong></td>
01229                      </tr>
01230                      '.implode('',$subcats).'
01231                   </table>
01232                   ';
01233             }
01234          break;
01235          case 'page':
01236          default:
01237             $pagetree = t3lib_div::makeInstance('rtePageTree');
01238             $tree=$pagetree->getBrowsableTree();
01239             $cElements = $this->expandPage();
01240             $content.= '
01241 
01242          <!--
01243             Wrapper table for page tree / record list:
01244          -->
01245                <table border="0" cellpadding="0" cellspacing="0" id="typo3-linkPages">
01246                   <tr>
01247                      <td class="c-wCell" valign="top">'.$this->barheader($GLOBALS['LANG']->getLL('pageTree').':').$tree.'</td>
01248                      <td class="c-wCell" valign="top">'.$cElements.'</td>
01249                   </tr>
01250                </table>
01251                ';
01252          break;
01253       }
01254 
01255          // Target:
01256       if ($this->act!='mail') {
01257          $ltarget='
01258 
01259 
01260          <!--
01261             Selecting target for link:
01262          -->
01263             <form action="" name="ltargetform" id="ltargetform">
01264                <table border="0" cellpadding="2" cellspacing="1" id="typo3-linkTarget">
01265                   <tr>
01266                      <td>'.$GLOBALS['LANG']->getLL('target',1).':</td>
01267                      <td><input type="text" name="ltarget" onchange="setTarget(this.value);" value="'.htmlspecialchars($this->setTarget).'"'.$this->doc->formWidth(10).' /></td>
01268                      <td>
01269                         <select name="ltarget_type" onchange="setTarget(this.options[this.selectedIndex].value);document.ltargetform.ltarget.value=this.options[this.selectedIndex].value;this.selectedIndex=0;">
01270                            <option></option>
01271                            <option value="_top">'.$GLOBALS['LANG']->getLL('top',1).'</option>
01272                            <option value="_blank">'.$GLOBALS['LANG']->getLL('newWindow',1).'</option>
01273                         </select>
01274                      </td>
01275                      <td>';
01276 
01277          if (($this->curUrlInfo['act']=="page" || $this->curUrlInfo['act']=='file') && $this->curUrlArray['href'])   {
01278             $ltarget.='
01279                      <input type="submit" value="'.$GLOBALS['LANG']->getLL('update',1).'" onclick="return link_current();" />';
01280          }
01281 
01282          $selectJS = '
01283             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) {
01284                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;
01285                setTarget(document.ltargetform.ltarget.value);
01286                document.ltargetform.popup_width.selectedIndex=0;
01287                document.ltargetform.popup_height.selectedIndex=0;
01288             }
01289          ';
01290 
01291          $ltarget.='    </td>
01292                   </tr>
01293                   <tr>
01294                      <td>'.$GLOBALS['LANG']->getLL('target_popUpWindow',1).':</td>
01295                      <td colspan="3">
01296                         <select name="popup_width" onchange="'.htmlspecialchars($selectJS).'">
01297                            <option value="0">'.$GLOBALS['LANG']->getLL('target_popUpWindow_width',1).'</option>
01298                            <option value="300">300</option>
01299                            <option value="400">400</option>
01300                            <option value="500">500</option>
01301                            <option value="600">600</option>
01302                            <option value="700">700</option>
01303                            <option value="800">800</option>
01304                         </select>
01305                         x
01306                         <select name="popup_height" onchange="'.htmlspecialchars($selectJS).'">
01307                            <option value="0">'.$GLOBALS['LANG']->getLL('target_popUpWindow_height',1).'</option>
01308                            <option value="200">200</option>
01309                            <option value="300">300</option>
01310                            <option value="400">400</option>
01311                            <option value="500">500</option>
01312                            <option value="600">600</option>
01313                         </select>
01314                      </td>
01315                   </tr>
01316                </table>
01317             </form>';
01318 
01319             // Add "target selector" box to content:
01320          $content.=$ltarget;
01321 
01322             // Add some space
01323          $content.='<br /><br />';
01324       }
01325 
01326          // End page, return content:
01327       $content.= $this->doc->endPage();
01328       return $content;
01329    }
01330 
01336    function main_db()   {
01337 
01338          // Starting content:
01339       $content=$this->doc->startPage('TBE file selector');
01340 
01341          // Init variable:
01342       $pArr = explode('|',$this->bparams);
01343 
01344          // Making the browsable pagetree:
01345       $pagetree = t3lib_div::makeInstance('TBE_PageTree');
01346       $pagetree->script='browse_links.php';
01347       $pagetree->ext_pArrPages = !strcmp($pArr[3],'pages')?1:0;
01348       $tree=$pagetree->getBrowsableTree();
01349 
01350          // Making the list of elements, if applicable:
01351       $cElements = $this->TBE_expandPage($pArr[3]);
01352 
01353          // Putting the things together, side by side:
01354       $content.= '
01355 
01356          <!--
01357             Wrapper table for page tree / record list:
01358          -->
01359          <table border="0" cellpadding="0" cellspacing="0" id="typo3-EBrecords">
01360             <tr>
01361                <td class="c-wCell" valign="top">'.$this->barheader($GLOBALS['LANG']->getLL('pageTree').':').$tree.'</td>
01362                <td class="c-wCell" valign="top">'.$cElements.'</td>
01363             </tr>
01364          </table>
01365          ';
01366 
01367          // Add some space
01368       $content.='<br /><br />';
01369 
01370          // End page, return content:
01371       $content.= $this->doc->endPage();
01372       return $content;
01373    }
01374 
01380    function main_file() {
01381       global $BE_USER;
01382 
01383          // Starting content:
01384       $content.=$this->doc->startPage('TBE file selector');
01385 
01386          // Init variable:
01387       $pArr = explode('|',$this->bparams);
01388 
01389          // Create upload/create folder forms, if a path is given:
01390       $fileProcessor = t3lib_div::makeInstance('t3lib_basicFileFunctions');
01391       $fileProcessor->init($GLOBALS['FILEMOUNTS'], $GLOBALS['TYPO3_CONF_VARS']['BE']['fileExtensions']);
01392       $path=$this->expandFolder;
01393       if (!$path || !@is_dir($path))   {
01394          $path = $fileProcessor->findTempFolder().'/';   // The closest TEMP-path is found
01395       }
01396       if ($path!='/' && @is_dir($path))   {
01397          $uploadForm=$this->uploadForm($path);
01398          $createFolder=$this->createFolder($path);
01399       } else {
01400          $createFolder='';
01401          $uploadForm='';
01402       }
01403       if ($BE_USER->getTSConfigVal('options.uploadFieldsInTopOfEB')) $content.=$uploadForm;
01404 
01405          // Getting flag for showing/not showing thumbnails:
01406       $noThumbs = $GLOBALS['BE_USER']->getTSConfigVal('options.noThumbsInEB');
01407 
01408       if (!$noThumbs)   {
01409             // MENU-ITEMS, fetching the setting for thumbnails from File>List module:
01410          $_MOD_MENU = array('displayThumbs' => '');
01411          $_MCONF['name']='file_list';
01412          $_MOD_SETTINGS = t3lib_BEfunc::getModuleData($_MOD_MENU, t3lib_div::_GP('SET'), $_MCONF['name']);
01413          $addParams = '&act='.$this->act.'&mode='.$this->mode.'&expandFolder='.rawurlencode($path).'&bparams='.rawurlencode($this->bparams);
01414          $thumbNailCheck = t3lib_BEfunc::getFuncCheck('','SET[displayThumbs]',$_MOD_SETTINGS['displayThumbs'],'browse_links.php',$addParams).' '.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_file_list.php:displayThumbs',1);
01415       } else {
01416          $thumbNailCheck='';
01417       }
01418       $noThumbs = $noThumbs?$noThumbs:!$_MOD_SETTINGS['displayThumbs'];
01419 
01420          // Create folder tree:
01421       $foldertree = t3lib_div::makeInstance('TBE_FolderTree');
01422       $foldertree->script='browse_links.php';
01423       $foldertree->ext_noTempRecyclerDirs = ($this->mode == 'filedrag');
01424       $tree=$foldertree->getBrowsableTree();
01425 
01426       list(,,$specUid) = explode('_',$this->PM);
01427 
01428       if ($this->mode=='filedrag')  {
01429          $files = $this->TBE_dragNDrop($foldertree->specUIDmap[$specUid],$pArr[3]);
01430       } else {
01431          $files = $this->TBE_expandFolder($foldertree->specUIDmap[$specUid],$pArr[3],$noThumbs);
01432       }
01433 
01434          // Putting the parts together, side by side:
01435       $content.= '
01436 
01437          <!--
01438             Wrapper table for folder tree / file list:
01439          -->
01440          <table border="0" cellpadding="0" cellspacing="0" id="typo3-EBfiles">
01441             <tr>
01442                <td class="c-wCell" valign="top">'.$this->barheader($GLOBALS['LANG']->getLL('folderTree').':').$tree.'</td>
01443                <td class="c-wCell" valign="top">'.$files.'</td>
01444             </tr>
01445          </table>
01446          ';
01447       $content.=$thumbNailCheck;
01448 
01449          // Adding create folder + upload forms if applicable:
01450       if (!$BE_USER->getTSConfigVal('options.uploadFieldsInTopOfEB'))   $content.=$uploadForm;
01451       if ($BE_USER->isAdmin() || $BE_USER->getTSConfigVal('options.createFoldersInEB'))   $content.=$createFolder;
01452 
01453          // Add some space
01454       $content.='<br /><br />';
01455 
01456          // Ending page, returning content:
01457       $content.= $this->doc->endPage();
01458       return $content;
01459    }
01460 
01461 
01462 
01463 
01464 
01465 
01466 
01467 
01468 
01469 
01470 
01471 
01472 
01473 
01474 
01475 
01476 
01477 
01478 
01479    /******************************************************************
01480     *
01481     * Record listing
01482     *
01483     ******************************************************************/
01489    function expandPage()   {
01490       global $BE_USER;
01491 
01492       $out='';
01493       $expPageId = $this->expandPage;     // Set page id (if any) to expand
01494 
01495          // If there is an anchor value (content element reference) in the element reference, then force an ID to expand:
01496       if (!$this->expandPage && $this->curUrlInfo['cElement']) {
01497          $expPageId = $this->curUrlInfo['pageid']; // Set to the current link page id.
01498       }
01499 
01500          // Draw the record list IF there is a page id to expand:
01501       if ($expPageId && t3lib_div::testInt($expPageId) && $BE_USER->isInWebMount($expPageId))   {
01502 
01503             // Set header:
01504          $out.=$this->barheader($GLOBALS['LANG']->getLL('contentElements').':');
01505 
01506             // Create header for listing, showing the page title/icon:
01507          $titleLen=intval($GLOBALS['BE_USER']->uc['titleLen']);
01508          $mainPageRec = t3lib_BEfunc::getRecord('pages',$expPageId);
01509          $picon=t3lib_iconWorks::getIconImage('pages',$mainPageRec,'','');
01510          $picon.= htmlspecialchars(t3lib_div::fixed_lgd_cs($mainPageRec['title'],$titleLen));
01511          $out.=$picon.'<br />';
01512 
01513             // Look up tt_content elements from the expanded page:
01514          $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
01515                      'uid,header,hidden,starttime,endtime,fe_group,CType,colpos,bodytext',
01516                      'tt_content',
01517                      'pid='.intval($expPageId).t3lib_BEfunc::deleteClause('tt_content'),
01518                      '',
01519                      'colpos,sorting'
01520                   );
01521          $cc = $GLOBALS['TYPO3_DB']->sql_num_rows($res);
01522 
01523             // Traverse list of records:
01524          $c=0;
01525          while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))   {
01526             $c++;
01527             $icon=t3lib_iconWorks::getIconImage('tt_content',$row,'','');
01528             if ($this->curUrlInfo['act']=='page' && $this->curUrlInfo['cElement']==$row['uid']) {
01529                $arrCol='<img'.t3lib_iconWorks::skinImg('','gfx/blinkarrow_left.gif','width="5" height="9"').' class="c-blinkArrowL" alt="" />';
01530             } else {
01531                $arrCol='';
01532             }
01533                // Putting list element HTML together:
01534             $out.='<img'.t3lib_iconWorks::skinImg('','gfx/ol/join'.($c==$cc?'bottom':'').'.gif','width="18" height="16"').' alt="" />'.
01535                   $arrCol.
01536                   '<a href="#" onclick="return link_typo3Page(\''.$expPageId.'\',\'#'.$row['uid'].'\');">'.
01537                   $icon.
01538                   htmlspecialchars(t3lib_div::fixed_lgd_cs($row['header'],$titleLen)).
01539                   '</a><br />';
01540 
01541                // Finding internal anchor points:
01542             if (t3lib_div::inList('text,textpic', $row['CType'])) {
01543                $split = preg_split('/(<a[^>]+name=[\'"]?([^"\'>[:space:]]+)[\'"]?[^>]*>)/i', $row['bodytext'], -1, PREG_SPLIT_DELIM_CAPTURE);
01544 
01545                foreach($split as $skey => $sval)   {
01546                   if (($skey%3)==2) {
01547                         // Putting list element HTML together:
01548                      $sval = substr($sval,0,100);
01549                      $out.='<img'.t3lib_iconWorks::skinImg('','gfx/ol/line.gif','width="18" height="16"').' alt="" />'.
01550                            '<img'.t3lib_iconWorks::skinImg('','gfx/ol/join'.($skey+3>count($split)?'bottom':'').'.gif','width="18" height="16"').' alt="" />'.
01551                            '<a href="#" onclick="return link_typo3Page(\''.$expPageId.'\',\'#'.rawurlencode($sval).'\');">'.
01552                            htmlspecialchars(' <A> '.$sval).
01553                            '</a><br />';
01554                   }
01555                }
01556             }
01557          }
01558       }
01559       return $out;
01560    }
01561 
01568    function TBE_expandPage($tables) {
01569       global $TCA,$BE_USER;
01570 
01571       $out='';
01572       if ($this->expandPage>=0 && t3lib_div::testInt($this->expandPage) && $BE_USER->isInWebMount($this->expandPage))   {
01573 
01574             // Set array with table names to list:
01575          if (!strcmp(trim($tables),'*'))  {
01576             $tablesArr = array_keys($TCA);
01577          } else {
01578             $tablesArr = t3lib_div::trimExplode(',',$tables,1);
01579          }
01580          reset($tablesArr);
01581 
01582             // Headline for selecting records:
01583          $out.=$this->barheader($GLOBALS['LANG']->getLL('selectRecords').':');
01584 
01585             // Create the header, showing the current page for which the listing is. Includes link to the page itself, if pages are amount allowed tables.
01586          $titleLen=intval($GLOBALS['BE_USER']->uc['titleLen']);
01587          $mainPageRec = t3lib_BEfunc::getRecord('pages',$this->expandPage);
01588          $ATag='';
01589          $ATag_e='';
01590          $ATag2='';
01591          if (in_array('pages',$tablesArr))   {
01592             $ficon=t3lib_iconWorks::getIcon('pages',$mainPageRec);
01593             $ATag="<a href=\"#\" onclick=\"return insertElement('pages', '".$mainPageRec['uid']."', 'db', unescape('".rawurlencode($mainPageRec['title'])."'), '', '', '".$ficon."','',1);\">";
01594             $ATag2="<a href=\"#\" onclick=\"return insertElement('pages', '".$mainPageRec['uid']."', 'db', unescape('".rawurlencode($mainPageRec['title'])."'), '', '', '".$ficon."','',0);\">";
01595             $ATag_alt=substr($ATag,0,-4).",'',1);\">";
01596             $ATag_e='</a>';
01597          }
01598          $picon=t3lib_iconWorks::getIconImage('pages',$mainPageRec,'','');
01599          $pBicon=$ATag2?'<img'.t3lib_iconWorks::skinImg('','gfx/plusbullet2.gif','width="18" height="16"').' alt="" />':'';
01600          $pText=htmlspecialchars(t3lib_div::fixed_lgd_cs($mainPageRec['title'],$titleLen));
01601          $out.=$picon.$ATag2.$pBicon.$ATag_e.$ATag.$pText.$ATag_e.'<br />';
01602 
01603             // Initialize the record listing:
01604          $id = $this->expandPage;
01605          $pointer = t3lib_div::intInRange($this->pointer,0,100000);
01606          $perms_clause = $GLOBALS['BE_USER']->getPagePermsClause(1);
01607          $pageinfo = t3lib_BEfunc::readPageAccess($id,$perms_clause);
01608          $table='';
01609 
01610             // Generate the record list:
01611          $dblist = t3lib_div::makeInstance('TBE_browser_recordList');
01612          $dblist->script='browse_links.php';
01613          $dblist->backPath = $GLOBALS['BACK_PATH'];
01614          $dblist->thumbs = 0;
01615          $dblist->calcPerms = $GLOBALS['BE_USER']->calcPerms($pageinfo);
01616          $dblist->noControlPanels=1;
01617          $dblist->clickMenuEnabled=0;
01618          $dblist->tableList=implode(',',$tablesArr);
01619 
01620          $dblist->start($id,t3lib_div::_GP('table'),$pointer,
01621             t3lib_div::_GP('search_field'),
01622             t3lib_div::_GP('search_levels'),
01623             t3lib_div::_GP('showLimit')
01624          );
01625          $dblist->setDispFields();
01626          $dblist->generateList($id,$table);
01627          $dblist->writeBottom();
01628 
01629             // Add the HTML for the record list to output variable:
01630          $out.=$dblist->HTMLcode;
01631          $out.=$dblist->getSearchBox();
01632       }
01633 
01634          // Return accumulated content:
01635       return $out;
01636    }
01637 
01638 
01639 
01640 
01641 
01642 
01643 
01644 
01645 
01646 
01647 
01648 
01649    /******************************************************************
01650     *
01651     * File listing
01652     *
01653     ******************************************************************/
01661    function expandFolder($expandFolder=0,$extensionList='') {
01662 
01663       $expandFolder = $expandFolder ? $expandFolder : $this->expandFolder;
01664       $out='';
01665       if ($expandFolder && $this->checkFolder($expandFolder))  {
01666 
01667             // Create header for filelisting:
01668          $out.=$this->barheader($GLOBALS['LANG']->getLL('files').':');
01669 
01670             // Prepare current path value for comparison (showing red arrow)
01671          if (!$this->curUrlInfo['value']) {
01672             $cmpPath='';
01673          } else {
01674             $cmpPath=PATH_site.$this->curUrlInfo['info'];
01675          }
01676 
01677 
01678             // Create header element; The folder from which files are listed.
01679          $titleLen=intval($GLOBALS['BE_USER']->uc['titleLen']);
01680          $picon='<img'.t3lib_iconWorks::skinImg('','gfx/i/_icon_webfolders.gif','width="18" height="16"').' alt="" />';
01681          $picon.=htmlspecialchars(t3lib_div::fixed_lgd_cs(basename($expandFolder),$titleLen));
01682          $picon='<a href="#" onclick="return link_folder(\''.t3lib_div::rawUrlEncodeFP(substr($expandFolder,strlen(PATH_site))).'\');">'.$picon.'</a>';
01683          $out.=$picon.'<br />';
01684 
01685             // Get files from the folder:
01686          $files = t3lib_div::getFilesInDir($expandFolder,$extensionList,1,1); // $extensionList="",$prependPath=0,$order='')
01687          $c=0;
01688          $cc=count($files);
01689 
01690          if (is_array($files))   {
01691             foreach($files as $filepath)  {
01692                $c++;
01693                $fI=pathinfo($filepath);
01694 
01695                   // File icon:
01696                $icon = t3lib_BEfunc::getFileIcon(strtolower($fI['extension']));
01697 
01698                   // If the listed file turns out to be the CURRENT file, then show blinking arrow:
01699                if ($this->curUrlInfo['act']=="file" && $cmpPath==$filepath)   {
01700                   $arrCol='<img'.t3lib_iconWorks::skinImg('','gfx/blinkarrow_left.gif','width="5" height="9"').' class="c-blinkArrowL" alt="" />';
01701                } else {
01702                   $arrCol='';
01703                }
01704 
01705                   // Get size and icon:
01706                $size=' ('.t3lib_div::formatSize(filesize($filepath)).'bytes)';
01707                $icon = '<img'.t3lib_iconWorks::skinImg('','gfx/fileicons/'.$icon.'','width="18" height="16"').' title="'.htmlspecialchars($fI['basename'].$size).'" alt="" />';
01708 
01709                   // Put it all together for the file element:
01710                $out.='<img'.t3lib_iconWorks::skinImg('','gfx/ol/join'.($c==$cc?'bottom':'').'.gif','width="18" height="16"').' alt="" />'.
01711                      $arrCol.
01712                      '<a href="#" onclick="return link_folder(\''.t3lib_div::rawUrlEncodeFP(substr($filepath,strlen(PATH_site))).'\');">'.
01713                      $icon.
01714                      htmlspecialchars(t3lib_div::fixed_lgd_cs(basename($filepath),$titleLen)).
01715                      '</a><br />';
01716             }
01717          }
01718       }
01719       return $out;
01720    }
01721 
01730    function TBE_expandFolder($expandFolder=0,$extensionList='',$noThumbs=0)   {
01731       global $LANG;
01732 
01733       $expandFolder = $expandFolder ? $expandFolder : $this->expandFolder;
01734       $out='';
01735       if ($expandFolder && $this->checkFolder($expandFolder))  {
01736             // Listing the files:
01737          $files = t3lib_div::getFilesInDir($expandFolder,$extensionList,1,1); // $extensionList="",$prependPath=0,$order='')
01738          $out.= $this->fileList($files, $expandFolder, $noThumbs);
01739       }
01740 
01741          // Return accumulated content for filelisting:
01742       return $out;
01743    }
01744 
01753    function fileList($files, $folderName='', $noThumbs=0) {
01754       global $LANG;
01755 
01756       $out='';
01757 
01758          // Listing the files:
01759       if (is_array($files))   {
01760 
01761             // Create headline (showing number of files):
01762          $out.=$this->barheader(sprintf($GLOBALS['LANG']->getLL('files').' (%s):',count($files)));
01763 
01764          $titleLen=intval($GLOBALS['BE_USER']->uc['titleLen']);
01765 
01766             // Create the header of current folder:
01767          if($folderName) {
01768             $picon='<img'.t3lib_iconWorks::skinImg('','gfx/i/_icon_webfolders.gif','width="18" height="16"').' alt="" />';
01769             $picon.=htmlspecialchars(t3lib_div::fixed_lgd_cs(basename($folderName),$titleLen));
01770             $out.=$picon.'<br />';
01771          }
01772 
01773             // Init graphic object for reading file dimensions:
01774          $imgObj = t3lib_div::makeInstance('t3lib_stdGraphic');
01775          $imgObj->init();
01776          $imgObj->mayScaleUp=0;
01777          $imgObj->tempPath=PATH_site.$imgObj->tempPath;
01778 
01779             // Traverse the file list:
01780          $lines=array();
01781          foreach($files as $filepath)  {
01782             $fI=pathinfo($filepath);
01783 
01784                // Thumbnail/size generation:
01785             if (t3lib_div::inList($GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'],$fI['extension']) && !$noThumbs)  {
01786                $imgInfo = $imgObj->getImageDimensions($filepath);
01787                $pDim = $imgInfo[0].'x'.$imgInfo[1].' pixels';
01788                $clickIcon = t3lib_BEfunc::getThumbNail('thumbs.php',$filepath,'hspace="5" vspace="5" border="1"');
01789             } else {
01790                $clickIcon = '';
01791                $pDim = '';
01792             }
01793 
01794                // Create file icon:
01795             $ficon = t3lib_BEfunc::getFileIcon(strtolower($fI['extension']));
01796             $size=' ('.t3lib_div::formatSize(filesize($filepath)).'bytes'.($pDim?', '.$pDim:'').')';
01797             $icon = '<img'.t3lib_iconWorks::skinImg('','gfx/fileicons/'.$ficon,'width="18" height="16"').' title="'.htmlspecialchars($fI['basename'].$size).'" class="absmiddle" alt="" />';
01798 
01799                // Create links for adding the file:
01800             if (strstr($filepath,',') || strstr($filepath,'|'))   {  // In case an invalid character is in the filepath, display error message:
01801                $eMsg = $LANG->JScharCode(sprintf($LANG->getLL('invalidChar'),', |'));
01802                $ATag = $ATag_alt = "<a href=\"#\" onclick=\"alert(".$eMsg.");return false;\">";
01803             } else { // If filename is OK, just add it:
01804                $ATag = "<a href=\"#\" onclick=\"return insertElement('','".t3lib_div::shortMD5($filepath)."', 'file', '".rawurlencode($fI['basename'])."', unescape('".rawurlencode($filepath)."'), '".$fI['extension']."', '".$ficon."');\">";
01805                $ATag_alt = substr($ATag,0,-4).",'',1);\">";
01806             }
01807             $ATag_e='</a>';
01808 
01809                // Create link to showing details about the file in a window:
01810             $Ahref = 'show_item.php?table='.rawurlencode($filepath).'&returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'));
01811             $ATag2='<a href="'.htmlspecialchars($Ahref).'">';
01812             $ATag2_e='</a>';
01813 
01814                // Combine the stuff:
01815                $filenameAndIcon=$ATag_alt.$icon.htmlspecialchars(t3lib_div::fixed_lgd_cs(basename($filepath),$titleLen)).$ATag_e;
01816 
01817                // Show element:
01818             if ($pDim)  {     // Image...
01819                $lines[]='
01820                   <tr class="bgColor4">
01821                      <td nowrap="nowrap">'.$filenameAndIcon.'&nbsp;</td>
01822                      <td>'.$ATag.'<img'.t3lib_iconWorks::skinImg('','gfx/plusbullet2.gif','width="18" height="16"').' title="'.$LANG->getLL('addToList',1).'" alt="" />'.$ATag_e.'</td>
01823                      <td nowrap="nowrap">'.($ATag2.'<img'.t3lib_iconWorks::skinImg('','gfx/zoom2.gif','width="12" height="12"').' title="'.$LANG->getLL('info',1).'" alt="" /> '.$LANG->getLL('info',1).$ATag2_e).'</td>
01824                      <td nowrap="nowrap">&nbsp;'.$pDim.'</td>
01825                   </tr>';
01826                $lines[]='
01827                   <tr>
01828                      <td colspan="4">'.$ATag_alt.$clickIcon.$ATag_e.'</td>
01829                   </tr>';
01830             } else {
01831                $lines[]='
01832                   <tr class="bgColor4">
01833                      <td nowrap="nowrap">'.$filenameAndIcon.'&nbsp;</td>
01834                      <td>'.$ATag.'<img'.t3lib_iconWorks::skinImg('','gfx/plusbullet2.gif','width="18" height="16"').' title="'.$LANG->getLL('addToList',1).'" alt="" />'.$ATag_e.'</td>
01835                      <td nowrap="nowrap">'.($ATag2.'<img'.t3lib_iconWorks::skinImg('','gfx/zoom2.gif','width="12" height="12"').' title="'.$LANG->getLL('info',1).'" alt="" /> '.$LANG->getLL('info',1).$ATag2_e).'</td>
01836                      <td>&nbsp;</td>
01837                   </tr>';
01838             }
01839             $lines[]='
01840                   <tr>
01841                      <td colspan="3"><img src="clear.gif" width="1" height="3" alt="" /></td>
01842                   </tr>';
01843          }
01844 
01845             // Wrap all the rows in table tags:
01846          $out.='
01847 
01848 
01849 
01850       <!--
01851          File listing
01852       -->
01853             <table border="0" cellpadding="0" cellspacing="1" id="typo3-fileList">
01854                '.implode('',$lines).'
01855             </table>';
01856       }
01857 
01858          // Return accumulated content for filelisting:
01859       return $out;
01860    }
01861 
01870    function TBE_dragNDrop($expandFolder=0,$extensionList='')   {
01871 
01872       $expandFolder = $expandFolder ? $expandFolder : $this->expandFolder;
01873       $out='';
01874       if ($expandFolder && $this->checkFolder($expandFolder))  {
01875          if ($this->isWebFolder($expandFolder)) {
01876 
01877                // Read files from directory:
01878             $files = t3lib_div::getFilesInDir($expandFolder,$extensionList,1,1); // $extensionList="",$prependPath=0,$order='')
01879             if (is_array($files))   {
01880                $out.=$this->barheader(sprintf($GLOBALS['LANG']->getLL('files').' (%s):',count($files)));
01881 
01882                $titleLen=intval($GLOBALS['BE_USER']->uc['titleLen']);
01883                $picon='<img'.t3lib_iconWorks::skinImg('','gfx/i/_icon_webfolders.gif','width="18" height="16"').' alt="" />';
01884                $picon.=htmlspecialchars(t3lib_div::fixed_lgd_cs(basename($expandFolder),$titleLen));
01885                $out.=$picon.'<br />';
01886 
01887                   // Init row-array:
01888                $lines=array();
01889 
01890                   // Add "drag-n-drop" message:
01891                $lines[]='
01892                   <tr>
01893                      <td colspan="2">'.$this->getMsgBox($GLOBALS['LANG']->getLL('findDragDrop')).'</td>
01894                   </tr>';
01895 
01896                   // Fraverse files:
01897                while(list(,$filepath)=each($files))   {
01898                   $fI=pathinfo($filepath);
01899 
01900                      // URL of image:
01901                   $iurl = $this->siteURL.t3lib_div::rawurlencodeFP(substr($filepath,strlen(PATH_site)));
01902 
01903                      // Show only web-images
01904                   if (t3lib_div::inList('gif,jpeg,jpg,png',$fI['extension'])) {
01905                      $imgInfo = @getimagesize($filepath);
01906                      $pDim = $imgInfo[0].'x'.$imgInfo[1].' pixels';
01907 
01908                      $ficon = t3lib_BEfunc::getFileIcon(strtolower($fI['extension']));
01909                      $size=' ('.t3lib_div::formatSize(filesize($filepath)).'bytes'.($pDim?', '.$pDim:'').')';
01910                      $icon = '<img'.t3lib_iconWorks::skinImg('','gfx/fileicons/'.$ficon,'width="18" height="16"').' class="absmiddle" title="'.htmlspecialchars($fI['basename'].$size).'" alt="" />';
01911                      $filenameAndIcon=$icon.htmlspecialchars(t3lib_div::fixed_lgd_cs(basename($filepath),$titleLen));
01912 
01913                      if (t3lib_div::_GP('noLimit'))   {
01914                         $maxW=10000;
01915                         $maxH=10000;
01916                      } else {
01917                         $maxW=380;
01918                         $maxH=500;
01919                      }
01920                      $IW = $imgInfo[0];
01921                      $IH = $imgInfo[1];
01922                      if ($IW>$maxW) {
01923                         $IH=ceil($IH/$IW*$maxW);
01924                         $IW=$maxW;
01925                      }
01926                      if ($IH>$maxH) {
01927                         $IW=ceil($IW/$IH*$maxH);
01928                         $IH=$maxH;
01929                      }
01930 
01931                         // Make row:
01932                      $lines[]='
01933                         <tr class="bgColor4">
01934                            <td nowrap="nowrap">'.$filenameAndIcon.'&nbsp;</td>
01935                            <td nowrap="nowrap">'.
01936                            ($imgInfo[0]!=$IW ? '<a href="'.htmlspecialchars(t3lib_div::linkThisScript(array('noLimit'=>'1'))).'">'.
01937                                           '<img'.t3lib_iconWorks::skinImg('','gfx/icon_warning2.gif','width="18" height="16"').' title="'.$GLOBALS['LANG']->getLL('clickToRedrawFullSize',1).'" alt="" />'.
01938                                           '</a>':'').
01939                            $pDim.'&nbsp;</td>
01940                         </tr>';
01941 
01942                      $lines[]='
01943                         <tr>
01944                            <td colspan="2"><img src="'.$iurl.'" width="'.$IW.'" height="'.$IH.'" border="1" alt="" /></td>
01945                         </tr>';
01946                      $lines[]='
01947                         <tr>
01948                            <td colspan="2"><img src="clear.gif" width="1" height="3" alt="" /></td>
01949                         </tr>';
01950                   }
01951                }
01952 
01953                   // Finally, wrap all rows in a table tag:
01954                $out.='
01955 
01956 
01957          <!--
01958             File listing / Drag-n-drop
01959          -->
01960                   <table border="0" cellpadding="0" cellspacing="1" id="typo3-dragBox">
01961                      '.implode('',$lines).'
01962                   </table>';
01963             }
01964          } else {
01965                // Print this warning if the folder is NOT a web folder:
01966             $out.=$this->barheader($GLOBALS['LANG']->getLL('files'));
01967             $out.=$this->getMsgBox($GLOBALS['LANG']->getLL('noWebFolder'),'icon_warning2');
01968          }
01969       }
01970       return $out;
01971    }
01972 
01973 
01974 
01975 
01976 
01977 
01978 
01979 
01980 
01981 
01982 
01983 
01984    /******************************************************************
01985     *
01986     * Miscellaneous functions
01987     *
01988     ******************************************************************/
01989 
01990 
01997    function isWebFolder($folder) {
01998       $folder = ereg_replace('\/$','',$folder).'/';
01999       return t3lib_div::isFirstPartOfStr($folder,PATH_site) ? TRUE : FALSE;
02000    }
02001 
02008    function checkFolder($folder) {
02009       $fileProcessor = t3lib_div::makeInstance('t3lib_basicFileFunctions');
02010       $fileProcessor->init($GLOBALS['FILEMOUNTS'], $GLOBALS['TYPO3_CONF_VARS']['BE']['fileExtensions']);
02011 
02012       return $fileProcessor->checkPathAgainstMounts(ereg_replace('\/$','',$folder).'/') ? TRUE : FALSE;
02013    }
02014 
02021    function barheader($str)   {
02022       return '
02023 
02024          <!--
02025             Bar header:
02026          -->
02027          <h3 class="bgColor5">'.htmlspecialchars($str).'</h3>
02028          ';
02029    }
02030 
02038    function getMsgBox($in_msg,$icon='icon_note')   {
02039       $msg = '<img'.t3lib_iconWorks::skinImg('','gfx/'.$icon.'.gif','width="18" height="16"').' alt="" />'.htmlspecialchars($in_msg);
02040       $msg = '
02041 
02042          <!--
02043             Message box:
02044          -->
02045          <table cellspacing="0" class="bgColor4" id="typo3-msgBox">
02046             <tr>
02047                <td>'.$msg.'</td>
02048             </tr>
02049          </table>
02050          ';
02051       return $msg;
02052    }
02053 
02060    function printCurrentUrl($str)   {
02061       return '
02062 
02063          <!--
02064             Print current URL
02065          -->
02066          <table border="0" cellpadding="0" cellspacing="0" class="bgColor5" id="typo3-curUrl">
02067             <tr>
02068                <td>'.$GLOBALS['LANG']->getLL('currentLink',1).': '.htmlspecialchars(rawurldecode($str)).'</td>
02069             </tr>
02070          </table>';
02071    }
02072 
02080    function parseCurUrl($href,$siteUrl)   {
02081       $href = trim($href);
02082       if ($href)  {
02083          $info=array();
02084 
02085             // Default is "url":
02086          $info['value']=$href;
02087          $info['act']='url';
02088 
02089          $specialParts = explode('#_SPECIAL',$href);
02090          if (count($specialParts)==2)  {  // Special kind (Something RTE specific: User configurable links through: "userLinks." from ->thisConfig)
02091             $info['value']='#_SPECIAL'.$specialParts[1];
02092             $info['act']='spec';
02093          } elseif (t3lib_div::isFirstPartOfStr($href,$siteUrl))   {  // If URL is on the current frontend website:
02094             $rel = substr($href,strlen($siteUrl));
02095             if (@file_exists(PATH_site.rawurldecode($rel))) {  // URL is a file, which exists:
02096                $info['value']=rawurldecode($rel);
02097                $info['act']='file';
02098             } else { // URL is a page (id parameter)
02099                $uP=parse_url($rel);
02100                if (!trim($uP['path'])) {
02101                   $pp = explode('id=',$uP['query']);
02102                   $id = $pp[1];
02103                   if ($id) {
02104                         // Checking if the id-parameter is an alias.
02105                      if (!t3lib_div::testInt($id)) {
02106                         list($idPartR) = t3lib_BEfunc::getRecordsByField('pages','alias',$id);
02107                         $id=intval($idPartR['uid']);
02108                      }
02109 
02110                      $pageRow = t3lib_BEfunc::getRecord('pages',$id);
02111                      $titleLen=intval($GLOBALS['BE_USER']->uc['titleLen']);
02112                      $info['value']=$GLOBALS['LANG']->getLL('page',1)." '".htmlspecialchars(t3lib_div::fixed_lgd_cs($pageRow['title'],$titleLen))."' (ID:".$id.($uP['fragment']?', #'.$uP['fragment']:'').')';
02113                      $info['pageid']=$id;
02114                      $info['cElement']=$uP['fragment'];
02115                      $info['act']='page';
02116                   }
02117                }
02118             }
02119          } else { // Email link:
02120             if (strtolower(substr($href,0,7))=='mailto:')   {
02121                $info['value']=trim(substr($href,7));
02122                $info['act']='mail';
02123             }
02124          }
02125          $info['info'] = $info['value'];
02126       } else { // NO value inputted:
02127          $info=array();
02128          $info['info']=$GLOBALS['LANG']->getLL('none');
02129          $info['value']='';
02130          $info['act']='page';
02131       }
02132       return $info;
02133    }
02134 
02142    function uploadForm($path) {
02143       $count=3;
02144 
02145          // Create header, showing upload path:
02146       $header = t3lib_div::isFirstPartOfStr($path,PATH_site)?substr($path,strlen(PATH_site)):$path;
02147       $code=$this->barheader($GLOBALS['LANG']->getLL('uploadImage').':');
02148       $code.='
02149 
02150          <!--
02151             Form, for uploading files:
02152          -->
02153          <form action="tce_file.php" method="post" name="editform" enctype="'.$GLOBALS['TYPO3_CONF_VARS']['SYS']['form_enctype'].'">
02154             <table border="0" cellpadding="0" cellspacing="3" id="typo3-uplFiles">
02155                <tr>
02156                   <td><strong>'.$GLOBALS['LANG']->getLL('path',1).':</strong> '.htmlspecialchars($header).'</td>
02157                </tr>
02158                <tr>
02159                   <td>';
02160 
02161          // Traverse the number of upload fields (default is 3):
02162       for ($a=1;$a<=$count;$a++) {
02163          $code.='<input type="file" name="upload_'.$a.'"'.$this->doc->formWidth(35).' size="50" />
02164             <input type="hidden" name="file[upload]['.$a.'][target]" value="'.htmlspecialchars($path).'" />
02165             <input type="hidden" name="file[upload]['.$a.'][data]" value="'.$a.'" /><br />';
02166       }
02167 
02168          // Make footer of upload form, including the submit button:
02169       $redirectValue = 'browse_links.php?act='.$this->act.'&mode='.$this->mode.'&expandFolder='.rawurlencode($path).'&bparams='.rawurlencode($this->bparams);
02170       $code.='<input type="hidden" name="redirect" value="'.htmlspecialchars($redirectValue).'" />'.
02171             '<input type="submit" name="submit" value="'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:file_upload.php.submit',1).'" />';
02172 
02173       $code.='
02174          <div id="c-override">
02175             <input type="checkbox" name="overwriteExistingFiles" value="1" /> '.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_misc.xml:overwriteExistingFiles',1).'
02176          </div>
02177       ';
02178 
02179 
02180       $code.='</td>
02181                </tr>
02182             </table>
02183          </form>';
02184 
02185       return $code;
02186    }
02187 
02195    function createFolder($path)  {
02196 
02197          // Create header, showing upload path:
02198       $header = t3lib_div::isFirstPartOfStr($path,PATH_site)?substr($path,strlen(PATH_site)):$path;
02199       $code=$this->barheader($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:file_newfolder.php.pagetitle').':');
02200       $code.='
02201 
02202          <!--
02203             Form, for creating new folders:
02204          -->
02205          <form action="tce_file.php" method="post" name="editform2">
02206             <table border="0" cellpadding="0" cellspacing="3" id="typo3-crFolder">
02207                <tr>
02208                   <td><strong>'.$GLOBALS['LANG']->getLL('path',1).':</strong> '.htmlspecialchars($header).'</td>
02209                </tr>
02210                <tr>
02211                   <td>';
02212 
02213          // Create the new-folder name field:
02214       $a=1;
02215       $code.='<input'.$this->doc->formWidth(20).' type="text" name="file[newfolder]['.$a.'][data]" />'.
02216             '<input type="hidden" name="file[newfolder]['.$a.'][target]" value="'.htmlspecialchars($path).'" />';
02217 
02218          // Make footer of upload form, including the submit button:
02219       $redirectValue = 'browse_links.php?act='.$this->act.'&mode='.$this->mode.'&expandFolder='.rawurlencode($path).'&bparams='.rawurlencode($this->bparams);
02220       $code.='<input type="hidden" name="redirect" value="'.htmlspecialchars($redirectValue).'" />'.
02221             '<input type="submit" name="submit" value="'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:file_newfolder.php.submit',1).'" />';
02222 
02223       $code.='</td>
02224                </tr>
02225             </table>
02226          </form>';
02227 
02228       return $code;
02229    }
02230 }
02231 
02232 // Include extension?
02233 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/browse_links.php'])  {
02234    include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/browse_links.php']);
02235 }
02236 
02237 
02238 
02239 
02240 
02241 
02242 
02243 
02244 // Make instance:
02245 $SOBE = t3lib_div::makeInstance('SC_browse_links');
02246 $SOBE->init();
02247 $SOBE->main();
02248 $SOBE->printContent();
02249 ?>

Generated on Sun Oct 3 01:05:53 2004 for TYPO3core 3.7.0 dev by  doxygen 1.3.8-20040913