[FEATURE] Streamline element browser in tree, upload & create folder form
[Packages/TYPO3.CMS.git] / typo3 / class.browse_links.php
old mode 100755 (executable)
new mode 100644 (file)
index fb6c2e1..9a050c7
@@ -2,7 +2,7 @@
 /***************************************************************
 *  Copyright notice
 *
-*  (c) 1999-2008 Kasper Skaarhoj (kasperYYYY@typo3.com)
+*  (c) 1999-2011 Kasper Skårhøj (kasperYYYY@typo3.com)
 *  All rights reserved
 *
 *  This script is part of the TYPO3 project. The TYPO3 project is
  * Used from TCEFORMS an other elements
  * In other words: This is the ELEMENT BROWSER!
  *
- * $Id$
- * Revised for TYPO3 3.6 November/2003 by Kasper Skaarhoj
+ * Revised for TYPO3 3.6 November/2003 by Kasper Skårhøj
  * XHTML compliant
  *
- * @author     Kasper Skaarhoj <kasperYYYY@typo3.com>
+ * @author     Kasper Skårhøj <kasperYYYY@typo3.com>
  */
 /**
  * [CLASS/FUNCTION INDEX of SCRIPT]
  *
  */
 
-require_once (PATH_t3lib.'class.t3lib_browsetree.php');
-require_once (PATH_t3lib.'class.t3lib_foldertree.php');
-require_once (PATH_t3lib.'class.t3lib_stdgraphic.php');
-require_once (PATH_t3lib.'class.t3lib_basicfilefunc.php');
-
 
        // Include classes
-require_once (PATH_t3lib.'class.t3lib_page.php');
-require_once (PATH_t3lib.'class.t3lib_recordlist.php');
 require_once (PATH_typo3.'/class.db_list.inc');
 require_once (PATH_typo3.'/class.db_list_extra.inc');
-require_once (PATH_t3lib.'/class.t3lib_pagetree.php');
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
 
 
 
@@ -149,7 +125,7 @@ require_once (PATH_t3lib.'/class.t3lib_pagetree.php');
 /**
  * Local version of the record list.
  *
- * @author     Kasper Skaarhoj <kasperYYYY@typo3.com>
+ * @author     Kasper Skårhøj <kasperYYYY@typo3.com>
  * @package TYPO3
  * @subpackage core
  */
@@ -161,7 +137,8 @@ class TBE_browser_recordList extends localRecordList {
         *
         * @return      void
         */
-       function TBE_browser_recordList () {
+       function __construct() {
+               parent::__construct();
                $this->thisScript = t3lib_div::getIndpEnv('SCRIPT_NAME');
        }
 
@@ -210,12 +187,10 @@ class TBE_browser_recordList extends localRecordList {
         * @return      string
         */
        function linkWrapItems($table,$uid,$code,$row)  {
-               global $TCA, $BACK_PATH;
-
                if (!$code) {
                        $code = '<i>['.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.no_title',1).']</i>';
                } else {
-                       $code = htmlspecialchars(t3lib_div::fixed_lgd_cs($code,$this->fixedL));
+                       $code = t3lib_BEfunc::getRecordTitlePrep($code, $this->fixedL);
                }
 
                $title = t3lib_BEfunc::getRecordTitle($table,$row,FALSE,TRUE);
@@ -226,7 +201,8 @@ class TBE_browser_recordList extends localRecordList {
                $ATag_e = '</a>';
 
                return $ATag.
-                               '<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/plusbullet2.gif','width="18" height="16"').' title="'.$GLOBALS['LANG']->getLL('addToList',1).'" alt="" />'.
+                               '<img' . t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'], 'gfx/plusbullet2.gif', 'width="18" height="16"') .
+                               ' title="' . $GLOBALS['LANG']->getLL('addToList', 1) . '" alt="" />' .
                                $ATag_e.
                                $ATag_alt.
                                $code.
@@ -234,13 +210,13 @@ class TBE_browser_recordList extends localRecordList {
        }
 
        /**
-        * Local version that sets allFields to true to support userFieldSelect
+        * Local version that sets allFields to TRUE to support userFieldSelect
         *
         * @return      void
         * @see fieldSelectBox
         */
        function generateList() {
-               $this->allFields = true;
+               $this->allFields = TRUE;
                parent::generateList();
        }
 }
@@ -253,23 +229,29 @@ class TBE_browser_recordList extends localRecordList {
 /**
  * Class which generates the page tree
  *
- * @author     Kasper Skaarhoj <kasperYYYY@typo3.com>
+ * @author     Kasper Skårhøj <kasperYYYY@typo3.com>
  * @package TYPO3
  * @subpackage core
  */
 class localPageTree extends t3lib_browseTree {
 
        /**
+        * whether the page ID should be shown next to the title, activate through userTSconfig (options.pageTree.showPageIdWithTitle)
+        * @boolean
+        */
+       public $ext_showPageId = FALSE;
+
+       /**
         * Constructor. Just calling init()
         *
         * @return      void
         */
-       function localPageTree() {
+       function __construct() {
                $this->thisScript = t3lib_div::getIndpEnv('SCRIPT_NAME');
 
                $this->init();
 
-               $this->clause = ' AND doktype!=255'.$this->clause;
+               $this->clause = ' AND doktype!=' . t3lib_pageSelect::DOKTYPE_RECYCLER . $this->clause;
        }
 
        /**
@@ -340,7 +322,7 @@ class localPageTree extends t3lib_browseTree {
        }
 
        /**
-        * Returns true if a doktype can be linked.
+        * Returns TRUE if a doktype can be linked.
         *
         * @param       integer         Doktype value to test
         * @param       integer         uid to test.
@@ -348,7 +330,7 @@ class localPageTree extends t3lib_browseTree {
         */
        function ext_isLinkable($doktype,$uid)  {
                if ($uid && $doktype<199)       {
-                       return true;
+                       return TRUE;
                }
        }
 
@@ -377,8 +359,12 @@ class localPageTree extends t3lib_browseTree {
         * @param       array           The row for the current element
         * @return      string          The processed icon input value.
         */
-       function wrapIcon($icon,$row)   {
-               return $this->addTagAttributes($icon,' title="id='.$row['uid'].'"');
+       function wrapIcon($icon, $row) {
+               $content = $this->addTagAttributes($icon, ' title="id=' . $row['uid'] . '"');
+               if ($this->ext_showPageId) {
+                       $content .= '[' . $row['uid'] . ']&nbsp;';
+               }
+               return $content;
        }
 }
 
@@ -392,7 +378,7 @@ class localPageTree extends t3lib_browseTree {
 /**
  * Page tree for the RTE - totally the same, no changes needed. (Just for the sake of beauty - or confusion... :-)
  *
- * @author     Kasper Skaarhoj <kasperYYYY@typo3.com>
+ * @author     Kasper Skårhøj <kasperYYYY@typo3.com>
  * @package TYPO3
  * @subpackage core
  */
@@ -409,21 +395,21 @@ class rtePageTree extends localPageTree {
 /**
  * For TBE record browser
  *
- * @author     Kasper Skaarhoj <kasperYYYY@typo3.com>
+ * @author     Kasper Skårhøj <kasperYYYY@typo3.com>
  * @package TYPO3
  * @subpackage core
  */
 class TBE_PageTree extends localPageTree {
 
        /**
-        * Returns true if a doktype can be linked (which is always the case here).
+        * Returns TRUE if a doktype can be linked (which is always the case here).
         *
         * @param       integer         Doktype value to test
         * @param       integer         uid to test.
         * @return      boolean
         */
        function ext_isLinkable($doktype,$uid)  {
-               return true;
+               return TRUE;
        }
 
        /**
@@ -456,7 +442,7 @@ class TBE_PageTree extends localPageTree {
  * Base extension class which generates the folder tree.
  * Used directly by the RTE.
  *
- * @author     Kasper Skaarhoj <kasperYYYY@typo3.com>
+ * @author     Kasper Skårhøj <kasperYYYY@typo3.com>
  * @package TYPO3
  * @subpackage core
  */
@@ -469,9 +455,9 @@ class localFolderTree extends t3lib_folderTree {
         *
         * @return      void
         */
-       function localFolderTree() {
+       function __construct() {
                $this->thisScript = t3lib_div::getIndpEnv('SCRIPT_NAME');
-               $this->t3lib_folderTree();
+               parent::__construct();
        }
 
        /**
@@ -491,10 +477,10 @@ class localFolderTree extends t3lib_folderTree {
        }
 
        /**
-        * Returns true if the input "record" contains a folder which can be linked.
+        * Returns TRUE if the input "record" contains a folder which can be linked.
         *
         * @param       array           Array with information about the folder element. Contains keys like title, uid, path, _title
-        * @return      boolean         True is returned if the path is found in the web-part of the server and is NOT a recycler or temp folder
+        * @return      boolean         TRUE is returned if the path is found in the web-part of the server and is NOT a recycler or temp folder
         */
        function ext_isLinkable($v)     {
                $webpath=t3lib_BEfunc::getPathType_web_nonweb($v['path']);      // Checking, if the input path is a web-path.
@@ -540,7 +526,7 @@ class localFolderTree extends t3lib_folderTree {
                        // Preparing the current-path string (if found in the listing we will see a red blinking arrow).
                if (!$GLOBALS['SOBE']->browser->curUrlInfo['value'])    {
                        $cmpPath='';
-               } else if (substr(trim($GLOBALS['SOBE']->browser->curUrlInfo['info']),-1)!='/') {
+               } elseif (substr(trim($GLOBALS['SOBE']->browser->curUrlInfo['info']),-1)!='/')  {
                        $cmpPath=PATH_site.dirname($GLOBALS['SOBE']->browser->curUrlInfo['info']).'/';
                } else {
                        $cmpPath=PATH_site.$GLOBALS['SOBE']->browser->curUrlInfo['info'];
@@ -565,7 +551,7 @@ class localFolderTree extends t3lib_folderTree {
                                // Put table row with folder together:
                        $out.='
                                <tr class="'.$bgColorClass.'">
-                                       <td nowrap="nowrap">'.$v['HTML'].$this->wrapTitle(t3lib_div::fixed_lgd_cs($v['row']['title'],$titleLen),$v['row']).'</td>
+                                       <td nowrap="nowrap">' . $v['HTML'] . $this->wrapTitle(htmlspecialchars(t3lib_div::fixed_lgd_cs($v['row']['title'], $titleLen)), $v['row']) . '</td>
                                        '.$arrCol.'
                                        <td>'.$cEbullet.'</td>
                                </tr>';
@@ -591,7 +577,7 @@ class localFolderTree extends t3lib_folderTree {
 /**
  * Folder tree for the RTE - totally the same, no changes needed. (Just for the sake of beauty - or confusion... :-)
  *
- * @author     Kasper Skaarhoj <kasperYYYY@typo3.com>
+ * @author     Kasper Skårhøj <kasperYYYY@typo3.com>
  * @package TYPO3
  * @subpackage core
  */
@@ -607,7 +593,7 @@ class rteFolderTree extends localFolderTree {
 /**
  * For TBE File Browser
  *
- * @author     Kasper Skaarhoj <kasperYYYY@typo3.com>
+ * @author     Kasper Skårhøj <kasperYYYY@typo3.com>
  * @package TYPO3
  * @subpackage core
  */
@@ -615,10 +601,10 @@ class TBE_FolderTree extends localFolderTree {
        var $ext_noTempRecyclerDirs=0;          // If file-drag mode is set, temp and recycler folders are filtered out.
 
        /**
-        * Returns true if the input "record" contains a folder which can be linked.
+        * Returns TRUE if the input "record" contains a folder which can be linked.
         *
         * @param       array           Array with information about the folder element. Contains keys like title, uid, path, _title
-        * @return      boolean         True is returned if the path is NOT a recycler or temp folder AND if ->ext_noTempRecyclerDirs is not set.
+        * @return      boolean         TRUE is returned if the path is NOT a recycler or temp folder AND if ->ext_noTempRecyclerDirs is not set.
         */
        function ext_isLinkable($v)     {
                if ($this->ext_noTempRecyclerDirs && (substr($v['path'],-7)=='_temp_/' || substr($v['path'],-11)=='_recycler_/'))       {
@@ -650,7 +636,7 @@ class TBE_FolderTree extends localFolderTree {
 /**
  * class for the Element Browser window.
  *
- * @author     Kasper Skaarhoj <kasperYYYY@typo3.com>
+ * @author     Kasper Skårhøj <kasperYYYY@typo3.com>
  * @package TYPO3
  * @subpackage core
  */
@@ -709,8 +695,8 @@ class browse_links {
         *
         * Values:
         * 0: form field name reference, eg. "data[tt_content][123][image]"
-        * 1: old/unused?
-        * 2: old/unused?
+        * 1: htlmArea RTE parameters: editorNo:contentTypo3Language:contentTypo3Charset
+        * 2: RTE config parameters: RTEtsConfigParams
         * 3: allowed types. Eg. "tt_content" or "gif,jpg,jpeg,tif,bmp,pcx,tga,png,pdf,ai"
         * 4: IRRE uniqueness: target level object-id to perform actions/checks on, eg. "data[79][tt_address][1][<field>][<foreign_table>]"
         * 5: IRRE uniqueness: name of function in opener window that checks if element is already used, eg. "inline.checkUniqueElement"
@@ -761,7 +747,10 @@ class browse_links {
        protected $hookObjects = array();
 
 
-       var     $readOnly = FALSE;      // If set, all operations that changes something should be disabled. This is used for alternativeBrowsing file mounts (see options like "options.folderTree.altElementBrowserMountPoints" in browse_links.php).
+       /**
+        * object for t3lib_basicFileFunctions
+        */
+       public $fileProcessor;
 
 
        /**
@@ -771,7 +760,7 @@ class browse_links {
         * @return      void
         */
        function init() {
-               global $BE_USER,$BACK_PATH;
+               global $BACK_PATH;
 
                        // Main GPvars:
                $this->pointer           = t3lib_div::_GP('pointer');
@@ -787,12 +776,18 @@ class browse_links {
                if (!$this->mode)       {
                        $this->mode = 'rte';
                }
+                       // Creating backend template object:
+               $this->doc = t3lib_div::makeInstance('template');
+               $this->doc->backPath = $GLOBALS['BACK_PATH'];
+                       // Load the Prototype library and browse_links.js
+               $this->doc->getPageRenderer()->loadPrototype();
+               $this->doc->loadJavascriptLib('js/browse_links.js');
 
                        // init hook objects:
                $this->hookObjects = array();
                if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.browse_links.php']['browseLinksHook'])) {
                        foreach($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.browse_links.php']['browseLinksHook'] as $classData) {
-                               $processObject = &t3lib_div::getUserObj($classData);
+                               $processObject = t3lib_div::getUserObj($classData);
 
                                if(!($processObject instanceof t3lib_browseLinksHook)) {
                                        throw new UnexpectedValueException('$processObject must implement interface t3lib_browseLinksHook', 1195039394);
@@ -810,21 +805,33 @@ class browse_links {
                        // the script to link to
                $this->thisScript = t3lib_div::getIndpEnv('SCRIPT_NAME');
 
+                       // init fileProcessor
+               $this->fileProcessor = t3lib_div::makeInstance('t3lib_basicFileFunctions');
+               $this->fileProcessor->init($GLOBALS['FILEMOUNTS'], $GLOBALS['TYPO3_CONF_VARS']['BE']['fileExtensions']);
+
+
                        // CurrentUrl - the current link url must be passed around if it exists
                if ($this->mode == 'wizard')    {
-                       $currentLinkParts = t3lib_div::trimExplode(' ',$this->P['currentValue']);
+                       $currentValues = t3lib_div::trimExplode(LF, trim($this->P['currentValue']));
+                       if (count($currentValues) > 0) {
+                               $currentValue = array_pop($currentValues);
+                       } else {
+                               $currentValue = '';
+                       }
+                       $currentLinkParts = t3lib_div::unQuoteFilenames($currentValue, TRUE);
                        $initialCurUrlArray = array (
                                'href'   => $currentLinkParts[0],
                                'target' => $currentLinkParts[1],
                                'class'  => $currentLinkParts[2],
                                'title'  => $currentLinkParts[3],
+                               'params'  => $currentLinkParts[4]
                        );
-                       $this->curUrlArray = (is_array(t3lib_div::_GP('curUrl'))) ? 
-                               array_merge($initialCurUrlArray, t3lib_div::_GP('curUrl')) : 
+                       $this->curUrlArray = (is_array(t3lib_div::_GP('curUrl'))) ?
+                               array_merge($initialCurUrlArray, t3lib_div::_GP('curUrl')) :
                                $initialCurUrlArray;
                        $this->curUrlInfo = $this->parseCurUrl($this->siteURL.'?id='.$this->curUrlArray['href'], $this->siteURL);
                        if ($this->curUrlInfo['pageid'] == 0 && $this->curUrlArray['href']) { // pageid == 0 means that this is not an internal (page) link
-                               if (@file_exists(PATH_site.rawurldecode($this->curUrlArray['href'])))   { // check if this is a link to a file
+                               if (file_exists(PATH_site.rawurldecode($this->curUrlArray['href'])))    { // check if this is a link to a file
                                        if (t3lib_div::isFirstPartOfStr($this->curUrlArray['href'], PATH_site)) {
                                                $currentLinkParts[0] = substr($this->curUrlArray['href'], strlen(PATH_site));
                                        }
@@ -835,7 +842,7 @@ class browse_links {
                                        }
                                        $this->curUrlInfo = $this->parseCurUrl('mailto:'.$this->curUrlArray['href'], $this->siteURL);
                                } else { // nothing of the above. this is an external link
-                                       if(strpos($this->curUrlArray['href'], '://') === false) {
+                                       if(strpos($this->curUrlArray['href'], '://') === FALSE) {
                                                $currentLinkParts[0] = 'http://' . $this->curUrlArray['href'];
                                        }
                                        $this->curUrlInfo = $this->parseCurUrl($currentLinkParts[0], $this->siteURL);
@@ -845,7 +852,7 @@ class browse_links {
                                $this->act = 'page';
                        } else {
                                $this->curUrlInfo = $this->parseCurUrl($this->siteURL.'?id='.$this->curUrlArray['href'], $this->siteURL);
-                       } 
+                       }
                } else {
                        $this->curUrlArray = t3lib_div::_GP('curUrl');
                        if ($this->curUrlArray['all'])  {
@@ -881,14 +888,8 @@ class browse_links {
                        // Initializing the title value (RTE)
                $this->setTitle = ($this->curUrlArray['title'] != '-') ? $this->curUrlArray['title'] : '';
 
-                       // Creating backend template object:
-               $this->doc = t3lib_div::makeInstance('template');
-               $this->doc->docType= 'xhtml_trans';
-               $this->doc->backPath = $BACK_PATH;
-
-                       // Load the Prototype library and browse_links.js
-               $this->doc->loadJavascriptLib('contrib/prototype/prototype.js');
-               $this->doc->loadJavascriptLib('js/browse_links.js');
+                       // Initializing the params value
+               $this->setParams = ($this->curUrlArray['params'] != '-') ? $this->curUrlArray['params'] : '';
 
                        // BEGIN accumulation of header JavaScript:
                $JScode = '
@@ -901,8 +902,9 @@ class browse_links {
 
                        var cur_href="'.($this->curUrlArray['href']?$this->curUrlArray['href']:'').'";
                        var cur_target="'.($this->setTarget?$this->setTarget:'').'";
-                       var cur_class = "'.($this->setClass ? $this->setClass : '-').'";
+                       var cur_class = "' . ($this->setClass ? $this->setClass : '') . '";
                        var cur_title="'.($this->setTitle?$this->setTitle:'').'";
+                       var cur_params="' . ($this->setParams ? $this->setParams : '') . '";
 
                        function browse_links_setTarget(target) {       //
                                cur_target=target;
@@ -920,13 +922,19 @@ class browse_links {
                                cur_href=value;
                                add_href="&curUrl[href]="+value;
                        }
+                       function browse_links_setParams(params) {       //
+                               cur_params=params;
+                               add_params="&curUrl[params]="+escape(params);
+                       }
                ';
 
                if ($this->mode == 'wizard')    {       // Functions used, if the link selector is in wizard mode (= TCEforms fields)
+                       if (!$this->areFieldChangeFunctionsValid() && !$this->areFieldChangeFunctionsValid(TRUE)) {
+                               $this->P['fieldChangeFunc'] = array();
+                       }
                        unset($this->P['fieldChangeFunc']['alert']);
-                       reset($this->P['fieldChangeFunc']);
                        $update='';
-                       while(list($k,$v)=each($this->P['fieldChangeFunc']))    {
+                       foreach ($this->P['fieldChangeFunc'] as $k => $v) {
                                $update.= '
                                window.opener.'.$v;
                        }
@@ -935,6 +943,7 @@ class browse_links {
                        $P2['itemName']=$this->P['itemName'];
                        $P2['formName']=$this->P['formName'];
                        $P2['fieldChangeFunc']=$this->P['fieldChangeFunc'];
+                       $P2['fieldChangeFuncHash'] = t3lib_div::hmac(serialize($this->P['fieldChangeFunc']));
                        $P2['params']['allowedExtensions']=$this->P['params']['allowedExtensions'];
                        $P2['params']['blindLinkOptions']=$this->P['params']['blindLinkOptions'];
                        $addPassOnParams.=t3lib_div::implodeArrayForUrl('P',$P2);
@@ -979,14 +988,32 @@ class browse_links {
                                function updateValueInMainForm(input)   {       //
                                        var field = checkReference();
                                        if (field)      {
-                                               if (cur_target == "" && (cur_title != "" || cur_class != "-")) {
+                                               if (cur_target == "" && (cur_class != "" || cur_title != "" || cur_params != "")) {
                                                        cur_target = "-";
                                                }
-                                               if (cur_title == "" && cur_class == "-") {
-                                                       cur_class = "";
+                                               if (cur_class == "" && (cur_title != "" || cur_params != "")) {
+                                                       cur_class = "-";
+                                               }
+                                               cur_class = cur_class.replace(/[\'\"]/g, "");
+                                               if (cur_class.indexOf(" ") != -1) {
+                                                       cur_class = "\"" + cur_class + "\"";
+                                               }
+                                               if (cur_title == "" && cur_params != "") {
+                                                       cur_title = "-";
+                                               }
+                                               cur_title = cur_title.replace(/(^\")|(\"$)/g, "");
+                                               if (cur_title.indexOf(" ") != -1) {
+                                                       cur_title = "\"" + cur_title + "\"";
+                                               }
+                                               if (cur_params) {
+                                                       cur_params = cur_params.replace(/\bid\=.*?(\&|$)/, "");
+                                               }
+                                               input = input + " " + cur_target + " " + cur_class + " " + cur_title + " " + cur_params;
+                                               if(field.value && field.className.search(/textarea/) != -1) {
+                                                       field.value += "\n" + input;
+                                               } else {
+                                                       field.value = input;
                                                }
-                                               input = input + " " + cur_target + " " + cur_class + " " + cur_title;
-                                               field.value = input;
                                                '.$update.'
                                        }
                                }
@@ -1077,7 +1104,7 @@ class browse_links {
                                                parent.close();
                                        }
                        ';
-               } else if ($pArr[0] && !$pArr[1] && !$pArr[2]) {
+               } elseif ($pArr[0] && !$pArr[1] && !$pArr[2]) {
                        $JScodeAction = '
                                        addElement(filename,table+"_"+uid,fp,close);
                        ';
@@ -1163,13 +1190,13 @@ class browse_links {
         * @return      array           Session data and boolean which indicates that data needs to be stored in session because it's changed
         */
        function processSessionData($data) {
-               $store = false;
+               $store = FALSE;
 
                switch((string)$this->mode)     {
                        case 'db':
                                if (isset($this->expandPage))   {
                                        $data['expandPage']=$this->expandPage;
-                                       $store = true;
+                                       $store = TRUE;
                                } else {
                                        $this->expandPage=$data['expandPage'];
                                }
@@ -1179,7 +1206,7 @@ class browse_links {
                        case 'folder':
                                if (isset($this->expandFolder)) {
                                        $data['expandFolder']=$this->expandFolder;
-                                       $store = true;
+                                       $store = TRUE;
                                } else {
                                        $this->expandFolder=$data['expandFolder'];
                                }
@@ -1207,7 +1234,7 @@ class browse_links {
         * @return      string          Modified content variable.
         */
        function main_rte($wiz=0)       {
-               global $LANG, $BACK_PATH;
+               global $BACK_PATH;
 
                        // Starting content:
                $content=$this->doc->startPage('RTE link');
@@ -1234,43 +1261,43 @@ class browse_links {
                $menuDef = array();
                if (!$wiz)      {
                        $menuDef['removeLink']['isActive'] = $this->act=='removeLink';
-                       $menuDef['removeLink']['label'] = $LANG->getLL('removeLink',1);
+                       $menuDef['removeLink']['label'] = $GLOBALS['LANG']->getLL('removeLink', 1);
                        $menuDef['removeLink']['url'] = '#';
                        $menuDef['removeLink']['addParams'] = 'onclick="self.parent.parent.renderPopup_unLink();return false;"';
                }
                if (in_array('page',$allowedItems)) {
                        $menuDef['page']['isActive'] = $this->act=='page';
-                       $menuDef['page']['label'] = $LANG->getLL('page',1);
+                       $menuDef['page']['label'] = $GLOBALS['LANG']->getLL('page', 1);
                        $menuDef['page']['url'] = '#';
                        $menuDef['page']['addParams'] = 'onclick="jumpToUrl(\'?act=page\');return false;"';
                }
                if (in_array('file',$allowedItems)){
                        $menuDef['file']['isActive'] = $this->act=='file';
-                       $menuDef['file']['label'] = $LANG->getLL('file',1);
+                       $menuDef['file']['label'] = $GLOBALS['LANG']->getLL('file', 1);
                        $menuDef['file']['url'] = '#';
                        $menuDef['file']['addParams'] = 'onclick="jumpToUrl(\'?act=file\');return false;"';
                }
                if (in_array('folder',$allowedItems)){
                        $menuDef['folder']['isActive']  = $this->act == 'folder';
-                       $menuDef['folder']['label']     = $LANG->getLL('folder', 1);
+                       $menuDef['folder']['label']     = $GLOBALS['LANG']->getLL('folder', 1);
                        $menuDef['folder']['url']       = '#';
                        $menuDef['folder']['addParams'] = 'onclick="jumpToUrl(\'?act=folder\');return false;"';
                }
                if (in_array('url',$allowedItems)) {
                        $menuDef['url']['isActive'] = $this->act=='url';
-                       $menuDef['url']['label'] = $LANG->getLL('extUrl',1);
+                       $menuDef['url']['label'] = $GLOBALS['LANG']->getLL('extUrl', 1);
                        $menuDef['url']['url'] = '#';
                        $menuDef['url']['addParams'] = 'onclick="jumpToUrl(\'?act=url\');return false;"';
                }
                if (in_array('mail',$allowedItems)) {
                        $menuDef['mail']['isActive'] = $this->act=='mail';
-                       $menuDef['mail']['label'] = $LANG->getLL('email',1);
+                       $menuDef['mail']['label'] = $GLOBALS['LANG']->getLL('email', 1);
                        $menuDef['mail']['url'] = '#';
                        $menuDef['mail']['addParams'] = 'onclick="jumpToUrl(\'?act=mail\');return false;"';
                }
                if (is_array($this->thisConfig['userLinks.']) && in_array('spec',$allowedItems)) {
                        $menuDef['spec']['isActive'] = $this->act=='spec';
-                       $menuDef['spec']['label'] = $LANG->getLL('special',1);
+                       $menuDef['spec']['label'] = $GLOBALS['LANG']->getLL('special', 1);
                        $menuDef['spec']['url'] = '#';
                        $menuDef['spec']['addParams'] = 'onclick="jumpToUrl(\'?act=spec\');return false;"';
                }
@@ -1363,8 +1390,7 @@ class browse_links {
                                if (is_array($this->thisConfig['userLinks.']))  {
                                        $subcats=array();
                                        $v=$this->thisConfig['userLinks.'];
-                                       reset($v);
-                                       while(list($k2)=each($v))       {
+                                       foreach ($v as $k2 => $value) {
                                                $k2i = intval($k2);
                                                if (substr($k2,-1)=='.' && is_array($v[$k2i.'.']))      {
 
@@ -1373,10 +1399,10 @@ class browse_links {
                                                        if (!$title)    {
                                                                $title=$v[$k2i.'.']['url'];
                                                        } else {
-                                                               $title=$LANG->sL($title);
+                                                               $title = $GLOBALS['LANG']->sL($title);
                                                        }
                                                                // Description:
-                                                       $description=$v[$k2i.'.']['description'] ? $LANG->sL($v[$k2i.'.']['description'],1).'<br />' : '';
+                                                       $description = ($v[$k2i . '.']['description'] ? $GLOBALS['LANG']->sL($v[$k2i . '.']['description'], 1) . '<br />' : '');
 
                                                                // URL + onclick event:
                                                        $onClickEvent='';
@@ -1410,7 +1436,7 @@ class browse_links {
                        -->
                                                <table border="0" cellpadding="1" cellspacing="1" id="typo3-linkSpecial">
                                                        <tr>
-                                                               <td class="bgColor5" class="c-wCell" valign="top"><strong>'.$LANG->getLL('special',1).'</strong></td>
+                                                               <td class="bgColor5" class="c-wCell" valign="top"><strong>' . $GLOBALS['LANG']->getLL('special', 1) . '</strong></td>
                                                        </tr>
                                                        '.implode('',$subcats).'
                                                </table>
@@ -1420,8 +1446,26 @@ class browse_links {
                        case 'page':
                                $pagetree = t3lib_div::makeInstance('rtePageTree');
                                $pagetree->thisScript = $this->thisScript;
+                               $pagetree->ext_showPageId = $GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.showPageIdWithTitle');
+                               $pagetree->ext_showNavTitle = $GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.showNavTitle');
+                               $pagetree->addField('nav_title');
                                $tree=$pagetree->getBrowsableTree();
                                $cElements = $this->expandPage();
+
+                               // Outputting Temporary DB mount notice:
+                               if (intval($GLOBALS['BE_USER']->getSessionData('pageTree_temporaryMountPoint')))        {
+                                       $link = '<a href="' . htmlspecialchars(t3lib_div::linkThisScript(array('setTempDBmount' => 0))) . '">' .
+                                                                               $GLOBALS['LANG']->sl('LLL:EXT:lang/locallang_core.xml:labels.temporaryDBmount', 1) .
+                                                                       '</a>';
+                                       $flashMessage = t3lib_div::makeInstance(
+                                               't3lib_FlashMessage',
+                                               $link,
+                                               '',
+                                               t3lib_FlashMessage::INFO
+                                       );
+                                       $dbmount = $flashMessage->render();
+                               }
+
                                $content.= '
 
                        <!--
@@ -1429,7 +1473,7 @@ class browse_links {
                        -->
                                        <table border="0" cellpadding="0" cellspacing="0" id="typo3-linkPages">
                                                <tr>
-                                                       <td class="c-wCell" valign="top">'.$this->barheader($GLOBALS['LANG']->getLL('pageTree').':').$tree.'</td>
+                                                       <td class="c-wCell" valign="top">' . $this->barheader($GLOBALS['LANG']->getLL('pageTree') . ':') . $dbmount . $tree . '</td>
                                                        <td class="c-wCell" valign="top">'.$cElements.'</td>
                                                </tr>
                                        </table>
@@ -1444,6 +1488,17 @@ class browse_links {
                }
 
                $content .= '
+                       <!--
+                               Selecting params for link:
+                       -->
+                               <form action="" name="lparamsform" id="lparamsform">
+                                       <table border="0" cellpadding="2" cellspacing="1" id="typo3-linkParams">
+                                               <tr>
+                                                       <td style="width: 96px;">' . $GLOBALS['LANG']->getLL('params', 1) . '</td>
+                                                       <td><input type="text" name="lparams" class="typo3-link-input" onchange="browse_links_setParams(this.value);" value="' . htmlspecialchars($this->setParams) . '" /></td>
+                                               </tr>
+                                       </table>
+                               </form>
 
                        <!--
                                Selecting class for link:
@@ -1452,7 +1507,7 @@ class browse_links {
                                        <table border="0" cellpadding="2" cellspacing="1" id="typo3-linkClass">
                                                <tr>
                                                        <td style="width: 96px;">' . $GLOBALS['LANG']->getLL('class', 1) . '</td>
-                                                       <td><input type="text" name="lclass" onchange="browse_links_setClass(this.value);" value="' . htmlspecialchars($this->setClass) . '"' . $this->doc->formWidth(10) . ' /></td>
+                                                       <td><input type="text" name="lclass" class="typo3-link-input" onchange="browse_links_setClass(this.value);" value="' . htmlspecialchars($this->setClass) . '" /></td>
                                                </tr>
                                        </table>
                                </form>
@@ -1464,7 +1519,7 @@ class browse_links {
                                        <table border="0" cellpadding="2" cellspacing="1" id="typo3-linkTitle">
                                                <tr>
                                                        <td style="width: 96px;">' . $GLOBALS['LANG']->getLL('title', 1) . '</td>
-                                                       <td><input type="text" name="ltitle" onchange="browse_links_setTitle(this.value);" value="' . htmlspecialchars($this->setTitle) . '"' . $this->doc->formWidth(10) . ' /></td>
+                                                       <td><input type="text" name="ltitle" class="typo3-link-input" onchange="browse_links_setTitle(this.value);" value="' . htmlspecialchars($this->setTitle) . '" /></td>
                                                </tr>
                                        </table>
                                </form>
@@ -1503,6 +1558,7 @@ class browse_links {
                                        browse_links_setTarget(document.ltargetform.ltarget.value);
                                        browse_links_setClass(document.lclassform.lclass.value);
                                        browse_links_setTitle(document.ltitleform.ltitle.value);
+                                       browse_links_setParams(document.lparamsform.lparams.value);
                                        document.ltargetform.popup_width.selectedIndex=0;
                                        document.ltargetform.popup_height.selectedIndex=0;
                                }
@@ -1567,6 +1623,7 @@ class browse_links {
                $pagetree->thisScript=$this->thisScript;
                $pagetree->ext_pArrPages = !strcmp($pArr[3],'pages')?1:0;
                $pagetree->ext_showNavTitle = $GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.showNavTitle');
+               $pagetree->ext_showPageId = $GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.showPageIdWithTitle');
                $pagetree->addField('nav_title');
                $tree=$pagetree->getBrowsableTree();
 
@@ -1602,29 +1659,29 @@ class browse_links {
         * @return      string          HTML content for the module
         */
        function main_file()    {
-               global $BE_USER;
 
                        // Starting content:
-               $content.=$this->doc->startPage('TBE file selector');
+               $content = $this->doc->startPage('TBE file selector');
 
                        // Init variable:
                $pArr = explode('|',$this->bparams);
 
                        // Create upload/create folder forms, if a path is given:
-               $fileProcessor = t3lib_div::makeInstance('t3lib_basicFileFunctions');
-               $fileProcessor->init($GLOBALS['FILEMOUNTS'], $GLOBALS['TYPO3_CONF_VARS']['BE']['fileExtensions']);
                $path=$this->expandFolder;
                if (!$path || !@is_dir($path))  {
-                       $path = $fileProcessor->findTempFolder().'/';   // The closest TEMP-path is found
+                               // The closest TEMP-path is found
+                       $path = $this->fileProcessor->findTempFolder().'/';
                }
-               if ($path!='/' && @is_dir($path) && !$this->readOnly && count($GLOBALS['FILEMOUNTS']))  {
+               if ($path!='/' && @is_dir($path)) {
                        $uploadForm=$this->uploadForm($path);
                        $createFolder=$this->createFolder($path);
                } else {
                        $createFolder='';
                        $uploadForm='';
                }
-               if ($BE_USER->getTSConfigVal('options.uploadFieldsInTopOfEB'))  $content.=$uploadForm;
+               if ($GLOBALS['BE_USER']->getTSConfigVal('options.uploadFieldsInTopOfEB')) {
+                       $content .= $uploadForm;
+               }
 
                        // Getting flag for showing/not showing thumbnails:
                $noThumbs = $GLOBALS['BE_USER']->getTSConfigVal('options.noThumbsInEB');
@@ -1634,10 +1691,6 @@ class browse_links {
                        $_MOD_MENU = array('displayThumbs' => '');
                        $_MCONF['name']='file_list';
                        $_MOD_SETTINGS = t3lib_BEfunc::getModuleData($_MOD_MENU, t3lib_div::_GP('SET'), $_MCONF['name']);
-                       $addParams = '&act='.$this->act.'&mode='.$this->mode.'&expandFolder='.rawurlencode($path).'&bparams='.rawurlencode($this->bparams);
-                       $thumbNailCheck = t3lib_BEfunc::getFuncCheck('','SET[displayThumbs]',$_MOD_SETTINGS['displayThumbs'],$this->thisScript,$addParams,'id="checkDisplayThumbs"').' <label for="checkDisplayThumbs">'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_file_list.php:displayThumbs',1).'</label>';
-               } else {
-                       $thumbNailCheck='';
                }
                $noThumbs = $noThumbs ? $noThumbs : !$_MOD_SETTINGS['displayThumbs'];
 
@@ -1668,17 +1721,20 @@ class browse_links {
                                </tr>
                        </table>
                        ';
-               $content.= $thumbNailCheck;
 
                        // Adding create folder + upload forms if applicable:
-               if (!$BE_USER->getTSConfigVal('options.uploadFieldsInTopOfEB')) $content.=$uploadForm;
-               if ($BE_USER->isAdmin() || $BE_USER->getTSConfigVal('options.createFoldersInEB'))       $content.=$createFolder;
+               if (!$GLOBALS['BE_USER']->getTSConfigVal('options.uploadFieldsInTopOfEB')) {
+                       $content .= $uploadForm;
+               }
+               if ($GLOBALS['BE_USER']->isAdmin() || $GLOBALS['BE_USER']->getTSConfigVal('options.createFoldersInEB')) {
+                       $content .= $createFolder;
+               }
 
                        // Add some space
                $content.='<br /><br />';
 
                        // Setup indexed elements:
-               $this->doc->JScode.= $this->doc->wrapScriptTags('BrowseLinks.addElements('.t3lib_div::array2json($this->elements).');');
+               $this->doc->JScode.= $this->doc->wrapScriptTags('BrowseLinks.addElements(' . json_encode($this->elements) . ');');
                        // Ending page, returning content:
                $content.= $this->doc->endPage();
                $content = $this->doc->insertStylesAndJS($content);
@@ -1692,7 +1748,6 @@ class browse_links {
         * @return      string          HTML content for the module
         */
        function main_folder() {
-               global $BE_USER;
 
                        // Starting content:
                $content = $this->doc->startPage('TBE folder selector');
@@ -1700,18 +1755,13 @@ class browse_links {
                        // Init variable:
                $parameters = explode('|', $this->bparams);
 
-                       // Create upload/create folder forms, if a path is given:
-               $fileProcessor = t3lib_div::makeInstance('t3lib_basicFileFunctions');
-               $fileProcessor->init(
-                       $GLOBALS['FILEMOUNTS'],
-                       $GLOBALS['TYPO3_CONF_VARS']['BE']['fileExtensions']
-               );
 
                $path = $this->expandFolder;
-               if(!$path || !@is_dir($path)) {
-                       $path = $fileProcessor->findTempFolder().'/';   // The closest TEMP-path is found
+               if (!$path || !@is_dir($path)) {
+                               // The closest TEMP-path is found
+                       $path = $this->fileProcessor->findTempFolder().'/';
                }
-               if($path != '/' && @is_dir($path)) {
+               if ($path != '/' && @is_dir($path)) {
                        $createFolder = $this->createFolder($path);
                } else {
                        $createFolder='';
@@ -1721,7 +1771,7 @@ class browse_links {
                $foldertree                         = t3lib_div::makeInstance('TBE_FolderTree');
                $foldertree->thisScript             = $this->thisScript;
                $foldertree->ext_noTempRecyclerDirs = ($this->mode == 'filedrag');
-               $tree                                = $foldertree->getBrowsableTree(false);
+               $tree                                = $foldertree->getBrowsableTree(FALSE);
 
                list(, , $specUid) = explode('_', $this->PM);
 
@@ -1749,7 +1799,7 @@ class browse_links {
                        ';
 
                        // Adding create folder if applicable:
-               if($BE_USER->isAdmin() || $BE_USER->getTSConfigVal('options.createFoldersInEB')) {
+               if ($GLOBALS['BE_USER']->isAdmin() || $GLOBALS['BE_USER']->getTSConfigVal('options.createFoldersInEB')) {
                        $content .= $createFolder;
                }
 
@@ -1790,7 +1840,7 @@ class browse_links {
         * @return      string          HTML output. Returns content only if the ->expandPage value is set (pointing to a page uid to show tt_content records from ...)
         */
        function expandPage()   {
-               global $BE_USER, $BACK_PATH;
+               global $BACK_PATH;
 
                $out='';
                $expPageId = $this->expandPage;         // Set page id (if any) to expand
@@ -1801,7 +1851,7 @@ class browse_links {
                }
 
                        // Draw the record list IF there is a page id to expand:
-               if ($expPageId && t3lib_div::testInt($expPageId) && $BE_USER->isInWebMount($expPageId)) {
+               if ($expPageId && t3lib_div::testInt($expPageId) && $GLOBALS['BE_USER']->isInWebMount($expPageId)) {
 
                                // Set header:
                        $out.=$this->barheader($GLOBALS['LANG']->getLL('contentElements').':');
@@ -1809,19 +1859,19 @@ class browse_links {
                                // Create header for listing, showing the page title/icon:
                        $titleLen=intval($GLOBALS['BE_USER']->uc['titleLen']);
                        $mainPageRec = t3lib_BEfunc::getRecordWSOL('pages',$expPageId);
-                       $picon = t3lib_iconWorks::getIconImage('pages', $mainPageRec, $BACK_PATH, '');
-                       $picon.= htmlspecialchars(t3lib_div::fixed_lgd_cs($mainPageRec['title'],$titleLen));
+                       $picon = t3lib_iconWorks::getSpriteIconForRecord('pages', $mainPageRec);
+                       $picon .= t3lib_BEfunc::getRecordTitle('pages', $mainPageRec, TRUE);
                        $out.=$picon.'<br />';
 
                                // Look up tt_content elements from the expanded page:
                        $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
-                                                       'uid,header,hidden,starttime,endtime,fe_group,CType,colpos,bodytext',
+                                                       'uid,header,hidden,starttime,endtime,fe_group,CType,colPos,bodytext',
                                                        'tt_content',
                                                        'pid='.intval($expPageId).
                                                                t3lib_BEfunc::deleteClause('tt_content').
                                                                t3lib_BEfunc::versioningPlaceholderClause('tt_content'),
                                                        '',
-                                                       'colpos,sorting'
+                                                       'colPos,sorting'
                                                );
                        $cc = $GLOBALS['TYPO3_DB']->sql_num_rows($res);
 
@@ -1829,7 +1879,7 @@ class browse_links {
                        $c=0;
                        while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))       {
                                $c++;
-                               $icon=t3lib_iconWorks::getIconImage('tt_content',$row,$BACK_PATH,'');
+                               $icon = t3lib_iconWorks::getSpriteIconForRecord('tt_content', $row);
                                if ($this->curUrlInfo['act']=='page' && $this->curUrlInfo['cElement']==$row['uid'])     {
                                        $arrCol='<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/blinkarrow_left.gif','width="5" height="9"').' class="c-blinkArrowL" alt="" />';
                                } else {
@@ -1840,7 +1890,7 @@ class browse_links {
                                                $arrCol.
                                                '<a href="#" onclick="return link_typo3Page(\''.$expPageId.'\',\'#'.$row['uid'].'\');">'.
                                                $icon.
-                                               htmlspecialchars(t3lib_div::fixed_lgd_cs($row['header'],$titleLen)).
+                                               t3lib_BEfunc::getRecordTitle('tt_content', $row, TRUE) .
                                                '</a><br />';
 
                                        // Finding internal anchor points:
@@ -1871,14 +1921,12 @@ class browse_links {
         * @return      string          HTML output.
         */
        function TBE_expandPage($tables)        {
-               global $TCA,$BE_USER, $BACK_PATH;
-
                $out='';
-               if ($this->expandPage>=0 && t3lib_div::testInt($this->expandPage) && $BE_USER->isInWebMount($this->expandPage)) {
+               if ($this->expandPage >= 0 && t3lib_div::testInt($this->expandPage) && $GLOBALS['BE_USER']->isInWebMount($this->expandPage)) {
 
                                // Set array with table names to list:
                        if (!strcmp(trim($tables),'*')) {
-                               $tablesArr = array_keys($TCA);
+                               $tablesArr = array_keys($GLOBALS['TCA']);
                        } else {
                                $tablesArr = t3lib_div::trimExplode(',',$tables,1);
                        }
@@ -1893,15 +1941,19 @@ class browse_links {
                        $ATag='';
                        $ATag_e='';
                        $ATag2='';
-                       if (in_array('pages',$tablesArr))       {
-                               $ficon=t3lib_iconWorks::getIcon('pages',$mainPageRec);
-                               $ATag="<a href=\"#\" onclick=\"return insertElement('pages', '".$mainPageRec['uid']."', 'db', ".t3lib_div::quoteJSvalue($mainPageRec['title']).", '', '', '".$ficon."','',1);\">";
-                               $ATag2="<a href=\"#\" onclick=\"return insertElement('pages', '".$mainPageRec['uid']."', 'db', ".t3lib_div::quoteJSvalue($mainPageRec['title']).", '', '', '".$ficon."','',0);\">";
-                               $ATag_alt=substr($ATag,0,-4).",'',1);\">";
-                               $ATag_e='</a>';
+                       $picon = '';
+                       if (is_array($mainPageRec)) {
+                               $picon = t3lib_iconWorks::getSpriteIconForRecord('pages', $mainPageRec);
+                               if (in_array('pages', $tablesArr)) {
+                                       $ATag = "<a href=\"#\" onclick=\"return insertElement('pages', '" . $mainPageRec['uid'] .
+                                               "', 'db', " . t3lib_div::quoteJSvalue($mainPageRec['title']) . ", '', '', '','',1);\">";
+                                       $ATag2 = "<a href=\"#\" onclick=\"return insertElement('pages', '" . $mainPageRec['uid'] .
+                                               "', 'db', " . t3lib_div::quoteJSvalue($mainPageRec['title']) . ", '', '', '','',0);\">";
+                                       $ATag_alt = substr($ATag, 0, -4) . ",'',1);\">";
+                                       $ATag_e = '</a>';
+                               }
                        }
-                       $picon=t3lib_iconWorks::getIconImage('pages',$mainPageRec,$BACK_PATH,'');
-                       $pBicon=$ATag2?'<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/plusbullet2.gif','width="18" height="16"').' alt="" />':'';
+                       $pBicon = ($ATag2 ? '<img' . t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'], 'gfx/plusbullet2.gif', 'width="18" height="16"') . ' alt="" />' : '');
                        $pText=htmlspecialchars(t3lib_div::fixed_lgd_cs($mainPageRec['title'],$titleLen));
                        $out.=$picon.$ATag2.$pBicon.$ATag_e.$ATag.$pText.$ATag_e.'<br />';
 
@@ -1913,6 +1965,7 @@ class browse_links {
                        $table='';
 
                                // Generate the record list:
+                       /** @var $dblist TBE_browser_recordList */
                        $dblist = t3lib_div::makeInstance('TBE_browser_recordList');
                        $dblist->thisScript=$this->thisScript;
                        $dblist->backPath = $GLOBALS['BACK_PATH'];
@@ -1934,7 +1987,7 @@ class browse_links {
                                //      Add the HTML for the record list to output variable:
                        $out.=$dblist->HTMLcode;
 
-                               // Add support for fieldselectbox in singleTableMode
+                               // Add support for fieldselectbox in singleTableMode
                        if ($dblist->table) {
                                $out.= $dblist->fieldSelectBox($dblist->table);
                        }
@@ -2086,8 +2139,7 @@ class browse_links {
         * @return      string          HTML output
         */
        function TBE_expandFolder($expandFolder=0,$extensionList='',$noThumbs=0)        {
-               global $LANG;
-
+               $extensionList = ($extensionList == '*') ? '' : $extensionList;
                $expandFolder = $expandFolder ? $expandFolder : $this->expandFolder;
                $out='';
                if ($expandFolder && $this->checkFolder($expandFolder)) {
@@ -2109,7 +2161,7 @@ class browse_links {
         * @return      string          HTML output
         */
        function fileList($files, $folderName='', $noThumbs=0) {
-               global $LANG, $BACK_PATH;
+               global $BACK_PATH;
 
                $out='';
 
@@ -2119,18 +2171,22 @@ class browse_links {
                                // Create headline (showing number of files):
                        $filesCount = count($files);
                        $out.=$this->barheader(sprintf($GLOBALS['LANG']->getLL('files').' (%s):', $filesCount));
+                       $out .= '<div id="filelist">';
                        $out.=$this->getBulkSelector($filesCount);
 
                        $titleLen=intval($GLOBALS['BE_USER']->uc['titleLen']);
 
                                // Create the header of current folder:
                        if($folderName) {
-                               $picon='<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/i/_icon_webfolders.gif','width="18" height="16"').' alt="" />';
-                               $picon.=htmlspecialchars(t3lib_div::fixed_lgd_cs(basename($folderName),$titleLen));
-                               $out.=$picon.'<br />';
+                               $picon = '<div id="currentFolderHeader">';
+                               $picon .= '<img' . t3lib_iconWorks::skinImg($BACK_PATH,'gfx/i/_icon_webfolders.gif', 'width="18" height="16"') . ' alt="" /> ';
+                               $picon .= htmlspecialchars(t3lib_div::fixed_lgd_cs(basename($folderName), $titleLen));
+                               $picon .= '</div>';
+                               $out .= $picon;
                        }
 
                                // Init graphic object for reading file dimensions:
+                       /** @var $imgObj t3lib_stdGraphic */
                        $imgObj = t3lib_div::makeInstance('t3lib_stdGraphic');
                        $imgObj->init();
                        $imgObj->mayScaleUp=0;
@@ -2158,7 +2214,7 @@ class browse_links {
 
                                        // Create links for adding the file:
                                if (strstr($filepath,',') || strstr($filepath,'|'))     {       // In case an invalid character is in the filepath, display error message:
-                                       $eMsg = $LANG->JScharCode(sprintf($LANG->getLL('invalidChar'),', |'));
+                                       $eMsg = $GLOBALS['LANG']->JScharCode(sprintf($GLOBALS['LANG']->getLL('invalidChar'), ', |'));
                                        $ATag = $ATag_alt = "<a href=\"#\" onclick=\"alert(".$eMsg.");return false;\">";
                                        $bulkCheckBox = '';
                                } else {        // If filename is OK, just add it:
@@ -2190,20 +2246,20 @@ class browse_links {
                                        $lines[]='
                                                <tr class="bgColor4">
                                                        <td nowrap="nowrap">'.$filenameAndIcon.'&nbsp;</td>
-                                                       <td>'.$ATag.'<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/plusbullet2.gif','width="18" height="16"').' title="'.$LANG->getLL('addToList',1).'" alt="" />'.$ATag_e.'</td>
-                                                       <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>
+                                                       <td>' . $ATag . '<img' . t3lib_iconWorks::skinImg($BACK_PATH,'gfx/plusbullet2.gif', 'width="18" height="16"') . ' title="' . $GLOBALS['LANG']->getLL('addToList',1) . '" alt="" />' . $ATag_e . '</td>
+                                                       <td nowrap="nowrap">' . ($ATag2 . '<img'.t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/zoom2.gif', 'width="12" height="12"') . ' title="' . $GLOBALS['LANG']->getLL('info', 1) . '" alt="" /> ' . $GLOBALS['LANG']->getLL('info', 1) . $ATag2_e) . '</td>
                                                        <td nowrap="nowrap">&nbsp;'.$pDim.'</td>
                                                </tr>';
                                        $lines[]='
                                                <tr>
-                                                       <td colspan="4">'.$ATag_alt.$clickIcon.$ATag_e.'</td>
+                                                       <td class="filelistThumbnail" colspan="4">' . $ATag_alt . $clickIcon . $ATag_e . '</td>
                                                </tr>';
                                } else {
                                        $lines[]='
                                                <tr class="bgColor4">
                                                        <td nowrap="nowrap">'.$filenameAndIcon.'&nbsp;</td>
-                                                       <td>'.$ATag.'<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/plusbullet2.gif','width="18" height="16"').' title="'.$LANG->getLL('addToList',1).'" alt="" />'.$ATag_e.'</td>
-                                                       <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>
+                                                       <td>' . $ATag . '<img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/plusbullet2.gif','width="18" height="16"') . ' title="' . $GLOBALS['LANG']->getLL('addToList',1) . '" alt="" />' . $ATag_e . '</td>
+                                                       <td nowrap="nowrap">' . ($ATag2 . '<img' . t3lib_iconWorks::skinImg($BACK_PATH,'gfx/zoom2.gif','width="12" height="12"') . ' title="' . $GLOBALS['LANG']->getLL('info', 1) . '" alt="" /> ' . $GLOBALS['LANG']->getLL('info', 1) . $ATag2_e) . '</td>
                                                        <td>&nbsp;</td>
                                                </tr>';
                                }
@@ -2221,15 +2277,16 @@ class browse_links {
                <!--
                        File listing
                -->
-                               <table border="0" cellpadding="0" cellspacing="1" id="typo3-fileList">
+                               <table cellpadding="0" cellspacing="0" id="typo3-fileList">
                                        '.implode('',$lines).'
                                </table>';
                }
                        // Return accumulated content for filelisting:
+               $out .= '</div>';
                return $out;
        }
 
-       /**
+       /**
         * Render list of folders.
         *
         * @param       array           List of folders. See t3lib_div::get_dirs
@@ -2237,7 +2294,7 @@ class browse_links {
         * @return      string          HTML output
         */
        function folderList($baseFolder, $folders) {
-               global $LANG, $BACK_PATH;
+               global $BACK_PATH;
 
                $content = '';
 
@@ -2252,7 +2309,7 @@ class browse_links {
                if($baseFolder) {
                        if (strstr($baseFolder, ',') || strstr($baseFolder, '|'))       {
                                        // In case an invalid character is in the filepath, display error message:
-                               $errorMessage     = $LANG->JScharCode(sprintf($LANG->getLL('invalidChar'),', |'));
+                               $errorMessage     = $GLOBALS['LANG']->JScharCode(sprintf($GLOBALS['LANG']->getLL('invalidChar'), ', |'));
                                $aTag = $aTag_alt = "<a href=\"#\" onclick=\"alert(".$errorMessage.");return false;\">";
                        } else {
                                        // If foldername is OK, just add it:
@@ -2295,7 +2352,7 @@ class browse_links {
 
                                        if (strstr($folderPath,',') || strstr($folderPath,'|')) {
                                                        // In case an invalid character is in the filepath, display error message:
-                                               $errorMessage     = $LANG->JScharCode(sprintf($LANG->getLL('invalidChar'),', |'));
+                                               $errorMessage     = $GLOBALS['LANG']->JScharCode(sprintf($GLOBALS['LANG']->getLL('invalidChar'), ', |'));
                                                $aTag = $aTag_alt = "<a href=\"#\" onclick=\"alert(".$errorMessage.");return false;\">";
                                        } else {
                                                        // If foldername is OK, just add it:
@@ -2318,7 +2375,7 @@ class browse_links {
                                                $lines[] = '
                                                        <tr class="bgColor4">
                                                                <td nowrap="nowrap">'.$foldernameAndIcon.'&nbsp;</td>
-                                                               <td>'.$aTag.'<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/plusbullet2.gif','width="18" height="16"').' title="'.$LANG->getLL('addToList',1).'" alt="" />'.$aTag_e.'</td>
+                                                               <td>' . $aTag . '<img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/plusbullet2.gif', 'width="18" height="16"') . ' title="' . $GLOBALS['LANG']->getLL('addToList', 1) . '" alt="" />' . $aTag_e .' </td>
                                                                <td>&nbsp;</td>
                                                        </tr>';
                                        }
@@ -2356,6 +2413,7 @@ class browse_links {
        function TBE_dragNDrop($expandFolder=0,$extensionList='')       {
                global $BACK_PATH;
 
+               $extensionList = ($extensionList == '*') ? '' : $extensionList;
                $expandFolder = $expandFolder ? $expandFolder : $this->expandFolder;
                $out='';
                if ($expandFolder && $this->checkFolder($expandFolder)) {
@@ -2380,8 +2438,8 @@ class browse_links {
                                                        <td colspan="2">'.$this->getMsgBox($GLOBALS['LANG']->getLL('findDragDrop')).'</td>
                                                </tr>';
 
-                                               // Fraverse files:
-                                       while(list(,$filepath)=each($files))    {
+                                               // Traverse files:
+                                       foreach ($files as $filepath) {
                                                $fI = pathinfo($filepath);
 
                                                        // URL of image:
@@ -2479,10 +2537,10 @@ class browse_links {
         * Verifies that a path is a web-folder:
         *
         * @param       string          Absolute filepath
-        * @return      boolean         If the input path is found in PATH_site then it returns true.
+        * @return      boolean         If the input path is found in PATH_site then it returns TRUE.
         */
        function isWebFolder($folder)   {
-               $folder = ereg_replace('\/$','',$folder).'/';
+               $folder = rtrim($folder, '/').'/';
                return t3lib_div::isFirstPartOfStr($folder,PATH_site) ? TRUE : FALSE;
        }
 
@@ -2490,13 +2548,20 @@ class browse_links {
         * Checks, if a path is within the mountpoints of the backend user
         *
         * @param       string          Absolute filepath
-        * @return      boolean         If the input path is found in the backend users filemounts, then return true.
+        * @return      boolean         If the input path is found in the backend users filemounts, then return TRUE.
         */
        function checkFolder($folder)   {
-               $fileProcessor = t3lib_div::makeInstance('t3lib_basicFileFunctions');
-               $fileProcessor->init($GLOBALS['FILEMOUNTS'], $GLOBALS['TYPO3_CONF_VARS']['BE']['fileExtensions']);
+               return $this->fileProcessor->checkPathAgainstMounts(rtrim($folder, '/') . '/') ? TRUE : FALSE;
+       }
 
-               return $fileProcessor->checkPathAgainstMounts(ereg_replace('\/$','',$folder).'/') ? TRUE : FALSE;
+       /**
+        * Checks, if a path is within a read-only mountpoint of the backend user
+        *
+        * @param       string          Absolute filepath
+        * @return      boolean         If the input path is found in the backend users filemounts and if the filemount is of type readonly, then return TRUE.
+        */
+       function isReadOnlyFolder($folder) {
+               return ($GLOBALS['FILEMOUNTS'][$this->fileProcessor->checkPathAgainstMounts(rtrim($folder, '/') . '/')]['type'] == 'readonly');
        }
 
        /**
@@ -2507,11 +2572,8 @@ class browse_links {
         */
        function barheader($str)        {
                return '
-
-                       <!--
-                               Bar header:
-                       -->
-                       <h3 class="bgColor5">'.htmlspecialchars($str).'</h3>
+                       <!-- Bar header: -->
+                       <h3>' . htmlspecialchars($str) . '</h3>
                        ';
        }
 
@@ -2547,16 +2609,17 @@ class browse_links {
         * @return      string          HTML content, wrapped in a table.
         */
        function printCurrentUrl($str)  {
-               return '
-
-                       <!--
-                               Print current URL
-                       -->
-                       <table border="0" cellpadding="0" cellspacing="0" class="bgColor5" id="typo3-curUrl">
-                               <tr>
-                                       <td>'.$GLOBALS['LANG']->getLL('currentLink',1).': '.htmlspecialchars(rawurldecode($str)).'</td>
-                               </tr>
-                       </table>';
+               if (strlen($str)) {
+                       return '
+                               <!-- Print current URL -->
+                               <table border="0" cellpadding="0" cellspacing="0" id="typo3-curUrl">
+                                       <tr>
+                                               <td>' . $GLOBALS['LANG']->getLL('currentLink',1) . ': ' .htmlspecialchars(rawurldecode($str)) . '</td>
+                                       </tr>
+                               </table>';
+               } else {
+                       return '';
+               }
        }
 
        /**
@@ -2581,7 +2644,7 @@ class browse_links {
                                $info['act']='spec';
                        } elseif (t3lib_div::isFirstPartOfStr($href,$siteUrl))  {       // If URL is on the current frontend website:
                                $rel = substr($href,strlen($siteUrl));
-                               if (@file_exists(PATH_site.rawurldecode($rel))) {       // URL is a file, which exists:
+                               if (file_exists(PATH_site.rawurldecode($rel)))  {       // URL is a file, which exists:
                                        $info['value']=rawurldecode($rel);
                                        if (@is_dir(PATH_site . $info['value'])) {
                                                $info['act'] = 'folder';
@@ -2591,8 +2654,10 @@ class browse_links {
                                } else {        // URL is a page (id parameter)
                                        $uP=parse_url($rel);
                                        if (!trim($uP['path'])) {
-                                               $pp = explode('id=',$uP['query']);
-                                               $id = $pp[1];
+                                               $pp = preg_split('/^id=/', $uP['query']);
+                                               $pp[1] = preg_replace( '/&id=[^&]*/', '', $pp[1]);
+                                               $parameters = explode('&', $pp[1]);
+                                               $id = array_shift($parameters);
                                                if ($id)        {
                                                                // Checking if the id-parameter is an alias.
                                                        if (!t3lib_div::testInt($id))   {
@@ -2606,6 +2671,7 @@ class browse_links {
                                                        $info['pageid']=$id;
                                                        $info['cElement']=$uP['fragment'];
                                                        $info['act']='page';
+                                                       $info['query'] = $parameters[0]?'&'.implode('&', $parameters):'';
                                                }
                                        }
                                }
@@ -2640,23 +2706,34 @@ class browse_links {
         */
        function uploadForm($path)      {
                global $BACK_PATH;
-               $count=3;
+
+               if ($this->isReadOnlyFolder($path)) return '';
+
+                       // Read configuration of upload field count
+               $userSetting = $GLOBALS['BE_USER']->getTSConfigVal('options.folderTree.uploadFieldsInLinkBrowser');
+               $count = isset($userSetting) ? $userSetting : 3;
+               if ($count === '0') {
+                       return '';
+               }
+               $count = intval($count) == 0 ? 3 : intval($count);
 
                        // Create header, showing upload path:
                $header = t3lib_div::isFirstPartOfStr($path,PATH_site)?substr($path,strlen(PATH_site)):$path;
-               $code=$this->barheader($GLOBALS['LANG']->getLL('uploadImage').':');
-               $code.='
+               $code = '
 
                        <!--
                                Form, for uploading files:
                        -->
-                       <form action="'.$BACK_PATH.'tce_file.php" method="post" name="editform" enctype="'.$GLOBALS['TYPO3_CONF_VARS']['SYS']['form_enctype'].'">
-                               <table border="0" cellpadding="0" cellspacing="3" id="typo3-uplFiles">
+                       <form action="' . $BACK_PATH . 'tce_file.php" method="post" name="editform" id="typo3-uplFilesForm" enctype="' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['form_enctype'] . '">
+                               <table border="0" cellpadding="0" cellspacing="0" id="typo3-uplFiles">
+                                       <tr>
+                                               <td>' . $this->barheader($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:file_upload.php.pagetitle', 1) . ':') . '</td>
+                                       </tr>
                                        <tr>
-                                               <td><strong>'.$GLOBALS['LANG']->getLL('path',1).':</strong> '.htmlspecialchars($header).'</td>
+                                               <td class="c-wCell c-hCell"><strong>' . $GLOBALS['LANG']->getLL('path', 1) . ':</strong> ' . htmlspecialchars($header) . '</td>
                                        </tr>
                                        <tr>
-                                               <td>';
+                                               <td class="c-wCell c-hCell">';
 
                        // Traverse the number of upload fields (default is 3):
                for ($a=1;$a<=$count;$a++)      {
@@ -2667,13 +2744,13 @@ class browse_links {
 
                        // Make footer of upload form, including the submit button:
                $redirectValue = $this->thisScript.'?act='.$this->act.'&mode='.$this->mode.'&expandFolder='.rawurlencode($path).'&bparams='.rawurlencode($this->bparams);
-               $code.='<input type="hidden" name="redirect" value="'.htmlspecialchars($redirectValue).'" />'.
-                               '<input type="submit" name="submit" value="'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:file_upload.php.submit',1).'" />';
+               $code .= '<input type="hidden" name="redirect" value="' . htmlspecialchars($redirectValue) . '" />';
 
                $code.='
                        <div id="c-override">
-                               <input type="checkbox" name="overwriteExistingFiles" id="overwriteExistingFiles" value="1" /> <label for="overwriteExistingFiles">'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_misc.xml:overwriteExistingFiles',1).'</label>
+                               <label><input type="checkbox" name="overwriteExistingFiles" id="overwriteExistingFiles" value="1" /> ' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_misc.xml:overwriteExistingFiles', 1) . '</label>
                        </div>
+                       <input type="submit" name="submit" value="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:file_upload.php.submit', 1) . '" />
                ';
 
 
@@ -2694,21 +2771,30 @@ class browse_links {
         */
        function createFolder($path)    {
                global $BACK_PATH;
+
+               if ($this->isReadOnlyFolder($path)) return '';
+
+                       // Don't show Folder-create form if it's denied
+               if ($GLOBALS['BE_USER']->getTSConfigVal('options.folderTree.hideCreateFolder')) {
+                       return '';
+               }
                        // Create header, showing upload path:
                $header = t3lib_div::isFirstPartOfStr($path,PATH_site)?substr($path,strlen(PATH_site)):$path;
-               $code=$this->barheader($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:file_newfolder.php.pagetitle').':');
-               $code.='
+               $code = '
 
                        <!--
                                Form, for creating new folders:
                        -->
-                       <form action="'.$BACK_PATH.'tce_file.php" method="post" name="editform2">
-                               <table border="0" cellpadding="0" cellspacing="3" id="typo3-crFolder">
+                       <form action="' . $BACK_PATH . 'tce_file.php" method="post" name="editform2" id="typo3-crFolderForm">
+                               <table border="0" cellpadding="0" cellspacing="0" id="typo3-crFolder">
                                        <tr>
-                                               <td><strong>'.$GLOBALS['LANG']->getLL('path',1).':</strong> '.htmlspecialchars($header).'</td>
+                                               <td>' . $this->barheader($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:file_newfolder.php.pagetitle') . ':') . '</td>
                                        </tr>
                                        <tr>
-                                               <td>';
+                                               <td class="c-wCell c-hCell"><strong>' . $GLOBALS['LANG']->getLL('path', 1) . ':</strong> ' . htmlspecialchars($header) . '</td>
+                                       </tr>
+                                       <tr>
+                                               <td class="c-wCell c-hCell">';
 
                        // Create the new-folder name field:
                $a=1;
@@ -2739,6 +2825,9 @@ class browse_links {
                        $labelToggleSelection = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_browse_links.php:toggleSelection',1);
                        $labelImportSelection = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_browse_links.php:importSelection',1);
 
+                       // Getting flag for showing/not showing thumbnails:
+                       $noThumbsInEB = $GLOBALS['BE_USER']->getTSConfigVal('options.noThumbsInEB');
+
                        $out = $this->doc->spacer(15).'<div>' .
                                        '<a href="#" onclick="BrowseLinks.Selector.toggle()">' .
                                                '<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/clip_select.gif','width="12" height="12"').' title="'.$labelToggleSelection.'" alt="" /> ' .
@@ -2746,16 +2835,66 @@ class browse_links {
                                        '<a href="#" onclick="BrowseLinks.Selector.handle()">' .
                                                '<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/import.gif','width="12" height="12"').' title="'.$labelImportSelection.'" alt="" /> ' .
                                                $labelImportSelection.'</a>' .
-                               '</div>'.$this->doc->spacer(15);
+                               '</div>';
+
+                       $thumbNailCheck = '';
+                       if (!$noThumbsInEB) {
+                               $path = $this->expandFolder;
+                               if (!$path || !@is_dir($path)) {
+                                               // The closest TEMP-path is found
+                                       $path = $this->fileProcessor->findTempFolder() . '/';
+                               }
+                                       // MENU-ITEMS, fetching the setting for thumbnails from File>List module:
+                               $_MOD_MENU = array('displayThumbs' => '');
+                               $_MCONF['name'] = 'file_list';
+                               $_MOD_SETTINGS = t3lib_BEfunc::getModuleData($_MOD_MENU, t3lib_div::_GP('SET'), $_MCONF['name']);
+                               $addParams = '&act=' . $this->act . '&mode=' . $this->mode . '&expandFolder=' . rawurlencode($path) . '&bparams=' . rawurlencode($this->bparams);
+                               $thumbNailCheck = t3lib_BEfunc::getFuncCheck('', 'SET[displayThumbs]', $_MOD_SETTINGS['displayThumbs'], $this->thisScript, $addParams, 'id="checkDisplayThumbs"') . ' <label for="checkDisplayThumbs">' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_file_list.php:displayThumbs', 1) . '</label>';
+                               $out .= $this->doc->spacer(5) . $thumbNailCheck . $this->doc->spacer(15);
+                       } else {
+                               $out .= $this->doc->spacer(15);
+                       }
                }
                return $out;
        }
-}
 
-// Include extension?
-if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/class.browse_links.php'])   {
-       include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/class.browse_links.php']);
+       /**
+        * Determines whether submitted field change functions are valid
+        * and are coming from the system and not from an external abuse.
+        *
+        * @param boolean $allowFlexformSections Whether to handle flexform sections differently
+        * @return boolean Whether the submitted field change functions are valid
+        */
+       protected function areFieldChangeFunctionsValid($handleFlexformSections = FALSE) {
+               $result = FALSE;
+
+               if (isset($this->P['fieldChangeFunc']) && is_array($this->P['fieldChangeFunc']) && isset($this->P['fieldChangeFuncHash'])) {
+                       $matches = array();
+                       $pattern = '#\[el\]\[(([^]-]+-[^]-]+-)(idx\d+-)([^]]+))\]#i';
+
+                       $fieldChangeFunctions = $this->P['fieldChangeFunc'];
+
+                               // Special handling of flexform sections:
+                               // Field change functions are modified in JavaScript, thus the hash is always invalid
+                       if ($handleFlexformSections && preg_match($pattern, $this->P['itemName'], $matches)) {
+                               $originalName = $matches[1];
+                               $cleanedName = $matches[2] . $matches[4];
+
+                               foreach ($fieldChangeFunctions as &$value) {
+                                       $value = str_replace($originalName, $cleanedName, $value);
+                               }
+                       }
+
+                       $result = ($this->P['fieldChangeFuncHash'] === t3lib_div::hmac(serialize($fieldChangeFunctions)));
+               }
+
+               return $result;
+       }
 }
 
 
+if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['typo3/class.browse_links.php'])) {
+       include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['typo3/class.browse_links.php']);
+}
+
 ?>