* Added "config.doctype = none" support - omits any doctype in the frontend.
[Packages/TYPO3.CMS.git] / typo3 / alt_clickmenu.php
index 7659782..3a3804d 100755 (executable)
@@ -2,7 +2,7 @@
 /***************************************************************
 *  Copyright notice
 *  
-*  (c) 1999-2003 Kasper Skaarhoj (kasper@typo3.com)
+*  (c) 1999-2004 Kasper Skaarhoj (kasper@typo3.com)
 *  All rights reserved
 *
 *  This script is part of the TYPO3 project. The TYPO3 project is 
  *
  *
  *  123: class clickMenu 
- *  154:     function init($item)      
- *  194:     function doDisplayTopFrameCM()    
+ *  155:     function init($item)      
+ *  198:     function doDisplayTopFrameCM()    
  *
  *              SECTION: DATABASE
- *  222:     function printDBClickMenu($table,$uid)    
- *  309:     function printNewDBLevel($table,$uid)     
- *  346:     function externalProcessingOfDBMenuItems($menuItems)      
- *  358:     function processingByExtClassArray($menuItems,$table,$uid)        
- *  377:     function urlRefForCM($url,$retUrl='',$hideCM=1)   
- *  394:     function DB_copycut($table,$uid,$type)    
- *  417:     function DB_paste($table,$uid,$type,$elInfo)      
- *  438:     function DB_info($table,$uid)     
- *  454:     function DB_history($table,$uid)  
- *  473:     function DB_perms($table,$uid,$rec)       
- *  492:     function DB_db_list($table,$uid,$rec)     
- *  511:     function DB_moveWizard($table,$uid,$rec)  
- *  532:     function DB_newWizard($table,$uid,$rec)   
- *  550:     function DB_editAccess($table,$uid)       
- *  568:     function DB_editPageHeader($uid)  
- *  586:     function DB_edit($table,$uid)     
- *  625:     function DB_new($table,$uid)      
- *  650:     function DB_hideUnhide($table,$rec,$hideField)    
- *  674:     function DB_delete($table,$uid,$elInfo)   
- *  695:     function DB_view($id,$anchor='')  
+ *  226:     function printDBClickMenu($table,$uid)    
+ *  313:     function printNewDBLevel($table,$uid)     
+ *  350:     function externalProcessingOfDBMenuItems($menuItems)      
+ *  362:     function processingByExtClassArray($menuItems,$table,$uid)        
+ *  381:     function urlRefForCM($url,$retUrl='',$hideCM=1)   
+ *  398:     function DB_copycut($table,$uid,$type)    
+ *  421:     function DB_paste($table,$uid,$type,$elInfo)      
+ *  442:     function DB_info($table,$uid)     
+ *  458:     function DB_history($table,$uid)  
+ *  477:     function DB_perms($table,$uid,$rec)       
+ *  496:     function DB_db_list($table,$uid,$rec)     
+ *  515:     function DB_moveWizard($table,$uid,$rec)  
+ *  536:     function DB_newWizard($table,$uid,$rec)   
+ *  559:     function DB_editAccess($table,$uid)       
+ *  577:     function DB_editPageHeader($uid)  
+ *  595:     function DB_edit($table,$uid)     
+ *  637:     function DB_new($table,$uid)      
+ *  662:     function DB_hideUnhide($table,$rec,$hideField)    
+ *  686:     function DB_delete($table,$uid,$elInfo)   
+ *  707:     function DB_view($id,$anchor='')  
  *
  *              SECTION: FILE
- *  724:     function printFileClickMenu($path)        
- *  788:     function externalProcessingOfFileMenuItems($menuItems)    
- *  802:     function FILE_launch($path,$script,$type,$image)  
- *  821:     function FILE_copycut($path,$type)        
- *  841:     function FILE_delete($path)       
- *  863:     function FILE_paste($path,$target,$elInfo)        
+ *  736:     function printFileClickMenu($path)        
+ *  800:     function externalProcessingOfFileMenuItems($menuItems)    
+ *  814:     function FILE_launch($path,$script,$type,$image)  
+ *  833:     function FILE_copycut($path,$type)        
+ *  853:     function FILE_delete($path)       
+ *  875:     function FILE_paste($path,$target,$elInfo)        
  *
  *              SECTION: COMMON
- *  903:     function printItems($menuItems,$item)     
- *  945:     function printLayerJScode($menuItems)     
- *  980:     function wrapColorTableCM($str)   
- *  995:     function menuItemsForTopFrame($menuItems) 
- * 1012:     function menuItemsForClickMenu($menuItems)        
- * 1047:     function linkItem($str,$icon,$onClick,$onlyCM=0,$dontHide=0)      
- * 1071:     function excludeIcon($iconCode)   
- * 1081:     function label($label)    
- * 1090:     function isCMlayers()     
- * 1100:     function frameLocation($str)      
+ *  915:     function printItems($menuItems,$item)     
+ *  960:     function printLayerJScode($menuItems)     
+ *  998:     function wrapColorTableCM($str)   
+ * 1021:     function menuItemsForTopFrame($menuItems) 
+ * 1038:     function menuItemsForClickMenu($menuItems)        
+ * 1073:     function linkItem($str,$icon,$onClick,$onlyCM=0,$dontHide=0)      
+ * 1097:     function excludeIcon($iconCode)   
+ * 1107:     function label($label)    
+ * 1116:     function isCMlayers()     
+ * 1126:     function frameLocation($str)      
  *
  *
- * 1125: class SC_alt_clickmenu 
- * 1143:     function init()   
- * 1226:     function main()   
- * 1266:     function printContent()   
+ * 1151: class SC_alt_clickmenu 
+ * 1169:     function init()   
+ * 1260:     function main()   
+ * 1295:     function printContent()   
  *
  * TOTAL FUNCTIONS: 41
  * (This index is automatically created/updated by the extension "extdeveval")
@@ -114,7 +114,7 @@ $LANG->includeLLFile('EXT:lang/locallang_misc.php');
 
 /**
  * Class for generating the click menu
- * 
+ *
  * @author     Kasper Skaarhoj <kasper@typo3.com>
  * @package TYPO3
  * @subpackage core
@@ -128,6 +128,7 @@ class clickMenu {
 
                // Internal, static:
        var $backPath='';                       // Backpath for scripts/images.
+       var $PH_backPath='###BACK_PATH###';             // BackPath place holder: We need different backPath set whether the clickmenu is written back to a frame which is not in typo3/ dir or if the clickmenu is shown in the top frame (no backpath)
        var $listFrame=0;                       // If set, the calling document should be in the listframe of a frameset.
        var $isDBmenu=0;                        // If set, the menu is about database records, not files. (set if part 2 [1] of the item-var is NOT blank)
        var $alwaysContentFrame=0;      // If true, the "content" frame is always used for reference (when condensed mode is enabled)
@@ -147,15 +148,15 @@ class clickMenu {
 
        /**
         * Initialize click menu
-        * 
+        *
         * @param       string          Input "item" GET var.
         * @return      string          The clickmenu HTML content
         */
        function init($item)    {
 
                        // Setting GPvars:
-               $this->cmLevel = intval(t3lib_div::GPvar('cmLevel'));
-               $this->CB = t3lib_div::GPvar('CB');
+               $this->cmLevel = intval(t3lib_div::_GP('cmLevel'));
+               $this->CB = t3lib_div::_GP('CB');
 
 
                        // Explode the incoming command:
@@ -174,22 +175,25 @@ class clickMenu {
                if (!$this->cmLevel)    {
                                // Make 1st level clickmenu:
                        if ($this->isDBmenu)    {
-                               return $this->printDBClickMenu($this->iParts[0],$this->iParts[1]);
+                               $CMcontent = $this->printDBClickMenu($this->iParts[0],$this->iParts[1]);
                        } else {
-                               return $this->printFileClickMenu($this->iParts[0]);
+                               $CMcontent = $this->printFileClickMenu($this->iParts[0]);
                        }
                } else {
                                // Make 2nd level clickmenu (only for DBmenus)
                        if ($this->isDBmenu)    {
-                               return $this->printNewDBLevel($this->iParts[0],$this->iParts[1]);
+                               $CMcontent = $this->printNewDBLevel($this->iParts[0],$this->iParts[1]);
                        }
                }
+               
+                       // Return clickmenu conten:
+               return $CMcontent;
        }
 
        /**
         * Returns true if the menu should (also?) be displayed in topframe, not just <div>-layers
-        * 
-        * @return      boolean         
+        *
+        * @return      boolean
         */
        function doDisplayTopFrameCM()  {
                return !$GLOBALS['SOBE']->doc->isCMlayers() || !$this->dontDisplayTopFrameCM;
@@ -214,7 +218,7 @@ class clickMenu {
 
        /**
         * Make 1st level clickmenu:
-        * 
+        *
         * @param       string          Table name
         * @param       integer         UID for the current record.
         * @return      string          HTML content
@@ -294,14 +298,14 @@ class clickMenu {
                        // Return the printed elements:
                return $this->printItems($menuItems,
                        $root?
-                       '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/i/_icon_website.gif','width="18" height="16"').' class="absmiddle" alt="" />'.htmlspecialchars($GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']):
-                       t3lib_iconWorks::getIconImage($table,$this->rec,$this->backPath,' class="absmiddle" title="'.htmlspecialchars(t3lib_BEfunc::getRecordIconAltText($this->rec,$table)).'"').t3lib_BEfunc::getRecordTitle($table,$this->rec,1)
+                       '<img'.t3lib_iconWorks::skinImg($this->PH_backPath,'gfx/i/_icon_website.gif','width="18" height="16"').' class="absmiddle" alt="" />'.htmlspecialchars($GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']):
+                       t3lib_iconWorks::getIconImage($table,$this->rec,$this->PH_backPath,' class="absmiddle" title="'.htmlspecialchars(t3lib_BEfunc::getRecordIconAltText($this->rec,$table)).'"').t3lib_BEfunc::getRecordTitle($table,$this->rec,1)
                );
        }
 
        /**
         * Make 2nd level clickmenu (only for DBmenus)
-        * 
+        *
         * @param       string          Table name
         * @param       integer         UID for the current record.
         * @return      string          HTML content
@@ -332,14 +336,14 @@ class clickMenu {
                if (!is_array($menuItems))      $menuItems=array();
                return $this->printItems($menuItems,
                        $root?
-                       '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/i/_icon_website.gif','width="18" height="16"').' class="absmiddle" alt="" />'.htmlspecialchars($GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']):
-                       t3lib_iconWorks::getIconImage($table,$this->rec,$this->backPath,' class="absmiddle" title="'.htmlspecialchars(t3lib_BEfunc::getRecordIconAltText($this->rec,$table)).'"').t3lib_BEfunc::getRecordTitle($table,$this->rec,1)
+                       '<img'.t3lib_iconWorks::skinImg($this->PH_backPath,'gfx/i/_icon_website.gif','width="18" height="16"').' class="absmiddle" alt="" />'.htmlspecialchars($GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']):
+                       t3lib_iconWorks::getIconImage($table,$this->rec,$this->PH_backPath,' class="absmiddle" title="'.htmlspecialchars(t3lib_BEfunc::getRecordIconAltText($this->rec,$table)).'"').t3lib_BEfunc::getRecordTitle($table,$this->rec,1)
                );
        }
 
        /**
         * Processing the $menuItems array (for extension classes) (DATABASE RECORDS)
-        * 
+        *
         * @param       array           $menuItems array for manipulation.
         * @return      array           Processed $menuItems array
         */
@@ -349,7 +353,7 @@ class clickMenu {
 
        /**
         * Processing the $menuItems array by external classes (typ. adding items)
-        * 
+        *
         * @param       array           $menuItems array for manipulation.
         * @param       string          Table name
         * @param       integer         UID for the current record.
@@ -368,7 +372,7 @@ class clickMenu {
 
        /**
         * Returning JavaScript for the onClick event linking to the input URL.
-        * 
+        *
         * @param       string          The URL relative to TYPO3_mainDir
         * @param       string          The return_url-parameter
         * @param       boolean         If set, the "hideCM()" will be called
@@ -384,7 +388,7 @@ class clickMenu {
 
        /**
         * Adding CM element for Clipboard "copy" and "cut"
-        * 
+        *
         * @param       string          Table name
         * @param       integer         UID for the current record.
         * @param       string          Type: "copy" or "cut"
@@ -397,7 +401,7 @@ class clickMenu {
                }       
                return $this->linkItem(
                        $this->label($type),
-                       $this->excludeIcon('<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/clip_'.$type.($isSel==$type?'_h':'').'.gif','width="12" height="12"').' alt="" />'),
+                       $this->excludeIcon('<img'.t3lib_iconWorks::skinImg($this->PH_backPath,'gfx/clip_'.$type.($isSel==$type?'_h':'').'.gif','width="12" height="12"').' alt="" />'),
                        "top.loadTopMenu('".$this->clipObj->selUrlDB($table,$uid,($type=='copy'?1:0),($isSel==$type))."');return false;"
                );
        }
@@ -405,7 +409,7 @@ class clickMenu {
        /**
         * Adding CM element for Clipboard "paste into"/"paste after"
         * NOTICE: $table and $uid should follow the special syntax for paste, see clipboard-class :: pasteUrl();
-        * 
+        *
         * @param       string          Table name
         * @param       integer         UID for the current record. NOTICE: Special syntax!
         * @param       string          Type: "into" or "after"
@@ -422,14 +426,14 @@ class clickMenu {
                
                return $this->linkItem(
                        $this->label('paste'.$type),
-                       $this->excludeIcon('<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/clip_paste'.$type.'.gif','width="12" height="12"').' alt="" />'),
+                       $this->excludeIcon('<img'.t3lib_iconWorks::skinImg($this->PH_backPath,'gfx/clip_paste'.$type.'.gif','width="12" height="12"').' alt="" />'),
                        $editOnClick.'return false;'
                );
        }
 
        /**
         * Adding CM element for Info
-        * 
+        *
         * @param       string          Table name
         * @param       integer         UID for the current record.
         * @return      array           Item array, element in $menuItems
@@ -438,14 +442,14 @@ class clickMenu {
        function DB_info($table,$uid)   {
                return $this->linkItem(
                        $this->label('info'),
-                       $this->excludeIcon('<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/zoom2.gif','width="12" height="12"').' alt="" />'),
+                       $this->excludeIcon('<img'.t3lib_iconWorks::skinImg($this->PH_backPath,'gfx/zoom2.gif','width="12" height="12"').' alt="" />'),
                        "top.launchView('".$table."', '".$uid."'); return hideCM();"                    
                );
        }
 
        /**
         * Adding CM element for History
-        * 
+        *
         * @param       string          Table name
         * @param       integer         UID for the current record.
         * @return      array           Item array, element in $menuItems
@@ -455,7 +459,7 @@ class clickMenu {
                $url = 'show_rechis.php?element='.rawurlencode($table.':'.$uid);
                return $this->linkItem(
                        $GLOBALS['LANG']->makeEntities($GLOBALS['LANG']->getLL('CM_history')),
-                       $this->excludeIcon('<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/history2.gif','width="13" height="12"').' alt="" />'),
+                       $this->excludeIcon('<img'.t3lib_iconWorks::skinImg($this->PH_backPath,'gfx/history2.gif','width="13" height="12"').' alt="" />'),
                        $this->urlRefForCM($url,'returnUrl'),
                        0
                );
@@ -463,7 +467,7 @@ class clickMenu {
 
        /**
         * Adding CM element for Permission setting
-        * 
+        *
         * @param       string          Table name
         * @param       integer         UID for the current record.
         * @param       array           The "pages" record with "perms_*" fields inside.
@@ -474,7 +478,7 @@ class clickMenu {
                $url = 'mod/web/perm/index.php?id='.$uid.($rec['perms_userid']==$GLOBALS['BE_USER']->user['uid']||$GLOBALS['BE_USER']->isAdmin()?'&return_id='.$uid.'&edit=1':'');
                return $this->linkItem(
                        $GLOBALS['LANG']->makeEntities($GLOBALS['LANG']->getLL('CM_perms')),
-                       $this->excludeIcon('<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/perm.gif','width="7" height="12"').' alt="" />'),
+                       $this->excludeIcon('<img'.t3lib_iconWorks::skinImg($this->PH_backPath,'gfx/perm.gif','width="7" height="12"').' alt="" />'),
                        $this->urlRefForCM($url),
                        0
                );
@@ -482,7 +486,7 @@ class clickMenu {
 
        /**
         * Adding CM element for DBlist
-        * 
+        *
         * @param       string          Table name
         * @param       integer         UID for the current record.
         * @param       array           Record of the element (needs "pid" field if not pages-record)
@@ -493,7 +497,7 @@ class clickMenu {
                $url = t3lib_div::getIndpEnv('TYPO3_REQUEST_DIR').'db_list.php?table='.($table=='pages'?'':$table).'&id='.($table=='pages'?$uid:$rec['pid']);
                return $this->linkItem(
                        $GLOBALS['LANG']->makeEntities($GLOBALS['LANG']->getLL('CM_db_list')),
-                       $this->excludeIcon('<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/list.gif','width="11" height="11"').' alt="" />'),
+                       $this->excludeIcon('<img'.t3lib_iconWorks::skinImg($this->PH_backPath,'gfx/list.gif','width="11" height="11"').' alt="" />'),
                        "top.nextLoadModuleUrl='".$url."';top.goToModule('web_list',1);",
                        0
                );
@@ -501,7 +505,7 @@ class clickMenu {
 
        /**
         * Adding CM element for Moving wizard
-        * 
+        *
         * @param       string          Table name
         * @param       integer         UID for the current record.
         * @param       array           Record. Needed for tt-content elements which will have the sys_language_uid sent
@@ -514,15 +518,15 @@ class clickMenu {
                                
                return $this->linkItem(
                        $GLOBALS['LANG']->makeEntities($GLOBALS['LANG']->getLL('CM_moveWizard'.($table=='pages'?'_page':''))),
-                       $this->excludeIcon('<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/move_'.($table=='pages'?'page':'record').'.gif','width="11" height="12"').' alt="" />'),
+                       $this->excludeIcon('<img'.t3lib_iconWorks::skinImg($this->PH_backPath,'gfx/move_'.($table=='pages'?'page':'record').'.gif','width="11" height="12"').' alt="" />'),
                        $this->urlRefForCM($url,'returnUrl'),
                        0
                );
        }
 
        /**
-        * Adding CM element for Create new wizard (either db_new.php or sysext/cms/layout/db_new_content_el.php)
-        * 
+        * Adding CM element for Create new wizard (either db_new.php or sysext/cms/layout/db_new_content_el.php or custom wizard)
+        *
         * @param       string          Table name
         * @param       integer         UID for the current record.
         * @param       array           Record.
@@ -530,10 +534,15 @@ class clickMenu {
         * @internal
         */
        function DB_newWizard($table,$uid,$rec) {
-               $url = ($table=='pages' || !t3lib_extMgm::isLoaded('cms')) ? 'db_new.php?id='.$uid.'&pagesOnly=1' : 'sysext/cms/layout/db_new_content_el.php?id='.$rec['pid'].'&sys_language_uid='.intval($rec['sys_language_uid']);
+                       //  If mod.web_list.newContentWiz.overrideWithExtension is set, use that extension's create new content wizard instead:
+               $tmpTSc = t3lib_BEfunc::getModTSconfig($this->pageinfo['uid'],'mod.web_list');
+               $tmpTSc = $tmpTSc ['properties']['newContentWiz.']['overrideWithExtension'];
+               $newContentWizScriptPath = t3lib_extMgm::isLoaded($tmpTSc) ? (t3lib_extMgm::extRelPath($tmpTSc).'mod1/db_new_content_el.php') : (TYPO3_mainDir.'sysext/cms/layout/db_new_content_el.php');
+
+               $url = ($table=='pages' || !t3lib_extMgm::isLoaded('cms')) ? 'db_new.php?id='.$uid.'&pagesOnly=1' : $newContentWizScriptPath.'?id='.$rec['pid'].'&sys_language_uid='.intval($rec['sys_language_uid']);
                return $this->linkItem(
                        $GLOBALS['LANG']->makeEntities($GLOBALS['LANG']->getLL('CM_newWizard')),
-                       $this->excludeIcon('<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/new_'.($table=='pages'?'page':'record').'.gif','width="'.($table=='pages'?'13':'16').'" height="12"').' alt="" />'),
+                       $this->excludeIcon('<img'.t3lib_iconWorks::skinImg($this->PH_backPath,'gfx/new_'.($table=='pages'?'page':'record').'.gif','width="'.($table=='pages'?'13':'16').'" height="12"').' alt="" />'),
                        $this->urlRefForCM($url,'returnUrl'),
                        0
                );
@@ -541,7 +550,7 @@ class clickMenu {
 
        /**
         * Adding CM element for Editing of the access related fields of a table (disable, starttime, endtime, fe_groups)
-        * 
+        *
         * @param       string          Table name
         * @param       integer         UID for the current record.
         * @return      array           Item array, element in $menuItems
@@ -552,7 +561,7 @@ class clickMenu {
                $url = 'alt_doc.php?edit['.$table.']['.$uid.']=edit'.$addParam;
                return $this->linkItem(
                        $GLOBALS['LANG']->makeEntities($GLOBALS['LANG']->getLL('CM_editAccess')),
-                       $this->excludeIcon('<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/editaccess.gif','width="12" height="12"').' alt="" />'),
+                       $this->excludeIcon('<img'.t3lib_iconWorks::skinImg($this->PH_backPath,'gfx/editaccess.gif','width="12" height="12"').' alt="" />'),
                        $this->urlRefForCM($url,'returnUrl'),
                        1       // no top frame CM!
                );
@@ -560,7 +569,7 @@ class clickMenu {
 
        /**
         * Adding CM element for edit page header
-        * 
+        *
         * @param       integer         page uid to edit (PID)
         * @return      array           Item array, element in $menuItems
         * @internal
@@ -569,7 +578,7 @@ class clickMenu {
                $url = 'alt_doc.php?edit[pages]['.$uid.']=edit';
                return $this->linkItem(
                        $GLOBALS['LANG']->makeEntities($GLOBALS['LANG']->getLL('CM_editPageHeader')),
-                       $this->excludeIcon('<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/edit2.gif','width="11" height="12"').' alt="" />'),
+                       $this->excludeIcon('<img'.t3lib_iconWorks::skinImg($this->PH_backPath,'gfx/edit2.gif','width="11" height="12"').' alt="" />'),
                        $this->urlRefForCM($url,'returnUrl'),
                        1       // no top frame CM!
                );
@@ -577,7 +586,7 @@ class clickMenu {
 
        /**
         * Adding CM element for regular editing of the element!
-        * 
+        *
         * @param       string          Table name
         * @param       integer         UID for the current record.
         * @return      array           Item array, element in $menuItems
@@ -592,13 +601,13 @@ class clickMenu {
                $editOnClick='';
                $loc='top.content'.($this->listFrame && !$this->alwaysContentFrame ?'.list_frame':'');
                $addParam='';
-               $theIcon = t3lib_iconWorks::skinImg($this->backPath,'gfx/edit2.gif','width="11" height="12"');
+               $theIcon = t3lib_iconWorks::skinImg($this->PH_backPath,'gfx/edit2.gif','width="11" height="12"');
                if (
                                $this->iParts[0]=='pages' && 
                                $this->iParts[1] && 
                                $BE_USER->check('modules', $pageModule)
                        )       {
-                       $theIcon = t3lib_iconWorks::skinImg($this->backPath,'gfx/edit_page.gif','width="12" height="12"');
+                       $theIcon = t3lib_iconWorks::skinImg($this->PH_backPath,'gfx/edit_page.gif','width="12" height="12"');
                        $this->editPageIconSet=1;
                        if ($BE_USER->uc['classicPageEditMode'] || !t3lib_extMgm::isLoaded('cms'))      {
                                $addParam='&editRegularContentFromId='.intval($this->iParts[1]);
@@ -619,7 +628,7 @@ class clickMenu {
 
        /**
         * Adding CM element for regular Create new element
-        * 
+        *
         * @param       string          Table name
         * @param       integer         UID for the current record.
         * @return      array           Item array, element in $menuItems
@@ -630,20 +639,20 @@ class clickMenu {
                $loc='top.content'.(!$this->alwaysContentFrame?'.list_frame':'');
                $editOnClick='if('.$loc.'){'.$loc.".document.location=top.TS.PATH_typo3+'".
                        ($this->listFrame?
-                               $this->backPath."alt_doc.php?returnUrl='+top.rawurlencode(".$this->frameLocation($loc.'.document').")+'&edit[".$table."][-".$uid."]=new'":
-                               $this->backPath.'db_new.php?id='.intval($uid)."'").
+                               "alt_doc.php?returnUrl='+top.rawurlencode(".$this->frameLocation($loc.'.document').")+'&edit[".$table."][-".$uid."]=new'":
+                               'db_new.php?id='.intval($uid)."'").
                        ';}';
                        
                return $this->linkItem(
                        $this->label('new'),
-                       $this->excludeIcon('<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/new_'.($table=='pages'&&$this->listFrame?'page':'el').'.gif','width="'.($table=='pages'?'13':'11').'" height="12"').' alt="" />'),
+                       $this->excludeIcon('<img'.t3lib_iconWorks::skinImg($this->PH_backPath,'gfx/new_'.($table=='pages'&&$this->listFrame?'page':'el').'.gif','width="'.($table=='pages'?'13':'11').'" height="12"').' alt="" />'),
                        $editOnClick.'return hideCM();'
                );
        }
 
        /**
         * Adding CM element for hide/unhide of the input record
-        * 
+        *
         * @param       string          Table name
         * @param       array           Record array
         * @param       string          Name of the hide field
@@ -659,7 +668,7 @@ class clickMenu {
 
                return $this->linkItem(
                        $this->label(($rec[$hideField]?'un':'').'hide'),
-                       $this->excludeIcon('<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/button_'.($rec[$hideField]?'un':'').'hide.gif','width="11" height="10"').' alt="" />'),
+                       $this->excludeIcon('<img'.t3lib_iconWorks::skinImg($this->PH_backPath,'gfx/button_'.($rec[$hideField]?'un':'').'hide.gif','width="11" height="10"').' alt="" />'),
                        $editOnClick.'return false;',
                        1
                );
@@ -667,7 +676,7 @@ class clickMenu {
 
        /**
         * Adding CM element for Delete
-        * 
+        *
         * @param       string          Table name
         * @param       integer         UID for the current record.
         * @param       array           Label for including in the confirmation message, EXT:lang/locallang_core.php:mess.delete
@@ -682,14 +691,14 @@ class clickMenu {
 
                return $this->linkItem(
                        $this->label('delete'),
-                       $this->excludeIcon('<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/garbage.gif','width="11" height="12"').' alt="" />'),
+                       $this->excludeIcon('<img'.t3lib_iconWorks::skinImg($this->PH_backPath,'gfx/garbage.gif','width="11" height="12"').' alt="" />'),
                        $editOnClick.'return false;'
                );
        }
 
        /**
         * Adding CM element for View Page
-        * 
+        *
         * @param       integer         Page uid (PID)
         * @param       string          Anchor, if any
         * @return      array           Item array, element in $menuItems
@@ -698,8 +707,8 @@ class clickMenu {
        function DB_view($id,$anchor='')        {
                return $this->linkItem(
                        $this->label('view'),
-                       $this->excludeIcon('<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/zoom.gif','width="12" height="12"').' alt="" />'),
-                       t3lib_BEfunc::viewOnClick($id,$this->backPath,t3lib_BEfunc::BEgetRootLine($id),$anchor).'return hideCM();'
+                       $this->excludeIcon('<img'.t3lib_iconWorks::skinImg($this->PH_backPath,'gfx/zoom.gif','width="12" height="12"').' alt="" />'),
+                       t3lib_BEfunc::viewOnClick($id,$this->PH_backPath,t3lib_BEfunc::BEgetRootLine($id),$anchor).'return hideCM();'
                );
        }
 
@@ -720,7 +729,7 @@ class clickMenu {
 
        /**
         * Make 1st level clickmenu:
-        * 
+        *
         * @param       string          The absolute path
         * @return      string          HTML content
         */
@@ -731,7 +740,7 @@ class clickMenu {
                        $fI = pathinfo($path);
                        $icon = is_dir($path) ? 'folder.gif' : t3lib_BEfunc::getFileIcon(strtolower($fI['extension']));
                        $size=' ('.t3lib_div::formatSize(filesize($path)).'bytes)';
-                       $icon = '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/fileicons/'.$icon,'width="18" height="16"').' class="absmiddle" title="'.htmlspecialchars($fI['basename'].$size).'" alt="" />';
+                       $icon = '<img'.t3lib_iconWorks::skinImg($this->PH_backPath,'gfx/fileicons/'.$icon,'width="18" height="16"').' class="absmiddle" title="'.htmlspecialchars($fI['basename'].$size).'" alt="" />';
 
                                // edit
                        if (!in_array('edit',$this->disabledItems) && is_file($path) && t3lib_div::inList($GLOBALS['TYPO3_CONF_VARS']['SYS']['textfile_ext'],$fI['extension'])) $menuItems['edit']=$this->FILE_launch($path,'file_edit.php','edit','edit_file.gif');
@@ -784,7 +793,7 @@ class clickMenu {
 
        /**
         * Processing the $menuItems array (for extension classes) (FILES)
-        * 
+        *
         * @param       array           $menuItems array for manipulation.
         * @return      array           Processed $menuItems array
         */
@@ -794,7 +803,7 @@ class clickMenu {
 
        /**
         * Multi-function for adding an entry to the $menuItems array
-        * 
+        *
         * @param       string          Path to the file/directory (target)
         * @param       string          Script (eg. file_edit.php) to pass &target= to
         * @param       string          "type" is the code which fetches the correct label for the element from "cm."
@@ -808,14 +817,14 @@ class clickMenu {
                
                return $this->linkItem(
                        $this->label($type),
-                       $this->excludeIcon('<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/'.$image,'width="12" height="12"').' alt="" />'),
+                       $this->excludeIcon('<img'.t3lib_iconWorks::skinImg($this->PH_backPath,'gfx/'.$image,'width="12" height="12"').' alt="" />'),
                        $editOnClick.'return hideCM();'
                );
        }
 
        /**
         * Returns element for copy or cut of files.
-        * 
+        *
         * @param       string          Path to the file/directory (target)
         * @param       string          Type: "copy" or "cut"
         * @return      array           Item array, element in $menuItems
@@ -829,14 +838,14 @@ class clickMenu {
                }       
                return $this->linkItem(
                        $this->label($type),
-                       $this->excludeIcon('<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/clip_'.$type.($isSel==$type?'_h':'').'.gif','width="12" height="12"').' alt="" />'),
+                       $this->excludeIcon('<img'.t3lib_iconWorks::skinImg($this->PH_backPath,'gfx/clip_'.$type.($isSel==$type?'_h':'').'.gif','width="12" height="12"').' alt="" />'),
                        "top.loadTopMenu('".$this->clipObj->selUrlFile($path,($type=='copy'?1:0),($isSel==$type))."');return false;"
                );
        }
 
        /**
         * Creates element for deleting of target
-        * 
+        *
         * @param       string          Path to the file/directory (target)
         * @return      array           Item array, element in $menuItems
         * @internal
@@ -849,14 +858,14 @@ class clickMenu {
                
                return $this->linkItem(
                        $this->label('delete'),
-                       $this->excludeIcon('<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/garbage.gif','width="11" height="12"').' alt="" />'),
+                       $this->excludeIcon('<img'.t3lib_iconWorks::skinImg($this->PH_backPath,'gfx/garbage.gif','width="11" height="12"').' alt="" />'),
                        $editOnClick.'return false;'
                );
        }
 
        /**
         * Creates element for pasting files.
-        * 
+        *
         * @param       string          Path to the file/directory (target)
         * @param       string          target - NOT USED.
         * @param       array           Various values for the labels.
@@ -866,13 +875,13 @@ class clickMenu {
        function FILE_paste($path,$target,$elInfo)      {       
                $editOnClick='';
                $loc='top.content'.($this->listFrame && !$this->alwaysContentFrame ?'.list_frame':'');
-               $conf=$loc." && confirm(".$GLOBALS['LANG']->JScharCode(sprintf($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:mess'.($elInfo[2]=='copy'?'copy':'move').'_into'),$elInfo[0],$elInfo[1])).")";
+               $conf=$loc." && confirm(".$GLOBALS['LANG']->JScharCode(sprintf($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:mess.'.($elInfo[2]=='copy'?'copy':'move').'_into'),$elInfo[0],$elInfo[1])).")";
                $editOnClick='if('.$conf.'){'.$loc.".document.location=top.TS.PATH_typo3+'".$this->clipObj->pasteUrl('_FILE',$path,0).
                        "&redirect='+top.rawurlencode(".$this->frameLocation($loc.'.document').'); hideCM();}';
                
                return $this->linkItem(
                        $this->label('pasteinto'),
-                       $this->excludeIcon('<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/clip_pasteinto.gif','width="12" height="12"').' alt="" />'),
+                       $this->excludeIcon('<img'.t3lib_iconWorks::skinImg($this->PH_backPath,'gfx/clip_pasteinto.gif','width="12" height="12"').' alt="" />'),
                        $editOnClick.'return false;'
                );
        }
@@ -896,9 +905,9 @@ class clickMenu {
         **************************************/
 
        /**
-        * Prints the items from input $menuItems array - both as topframe menu AND the JS section for writing to the div-layers. 
+        * Prints the items from input $menuItems array - both as topframe menu AND the JS section for writing to the div-layers.
         * Of course the topframe menu will appear only if $this->doDisplayTopFrameCM() returns true
-        * 
+        *
         * @param       array           $menuItems array
         * @param       string          HTML code for the element which was clicked - shown in the end of the horizontal menu in topframe after the close-button.
         * @return      string          HTML code
@@ -919,18 +928,21 @@ class clickMenu {
                                                        <!-- Items: -->
                                                <td class="c-item">'.
                                                        implode('</td>
-                                               <td><img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/acm_spacer2.gif','width="8" height="12"').' alt="" /></td>
+                                               <td><img'.t3lib_iconWorks::skinImg($this->PH_backPath,'gfx/acm_spacer2.gif','width="8" height="12"').' alt="" /></td>
                                                <td class="c-item">',$this->menuItemsForTopFrame($menuItems)).
                                                '</td>
                                                
                                                        <!-- Close button: -->
-                                               <td class="c-closebutton"><a href="#" onclick="hideCM();return false;"><img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/close_12h.gif','width="11" height="12"').' title="'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.close',1).'" alt="" /></a></td>
+                                               <td class="c-closebutton"><a href="#" onclick="hideCM();return false;"><img'.t3lib_iconWorks::skinImg($this->PH_backPath,'gfx/close_12h.gif','width="11" height="12"').' title="'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.close',1).'" alt="" /></a></td>
                                                
                                                        <!-- The item of the clickmenu: -->
                                                <td class="c-itemicon">'.$item.'</td>
                                        </tr>
                                </table>
                        ';
+               
+                               // Set remaining BACK_PATH to blank (if any)
+                       $out = str_replace($this->PH_backPath,'',$out);
                }
                        // Adding JS part:
                $out.=$this->printLayerJScode($menuItems);
@@ -941,7 +953,7 @@ class clickMenu {
 
        /**
         * Create the JavaScript section
-        * 
+        *
         * @param       array           The $menuItems array to print
         * @return      string          The JavaScript section which will print the content of the CM to the div-layer in the target frame.
         */
@@ -960,6 +972,9 @@ class clickMenu {
                                // Wrap the inner table in another table to create outer border:
                        $CMtable = $this->wrapColorTableCM($CMtable);
                                
+                               // Set back path place holder to real back path
+                       $CMtable = str_replace($this->PH_backPath,$this->backPath,$CMtable);
+
                                // Create JavaScript section:
                        $script=$GLOBALS['TBE_TEMPLATE']->wrapScriptTags('
                        
@@ -976,9 +991,9 @@ if (top.content && top.content'.$frameName.' && top.content'.$frameName.'.setLay
        /**
         * Wrapping the input string in a table with background color 4 and a black border style.
         * For the pop-up menu
-        * 
+        *
         * @param       string          HTML content to wrap in table.
-        * @return      string          
+        * @return      string
         */
        function wrapColorTableCM($str) {
        
@@ -998,7 +1013,7 @@ if (top.content && top.content'.$frameName.' && top.content'.$frameName.'.setLay
 
        /**
         * Traverses the menuItems and generates an output array for implosion in the topframe horizontal menu
-        * 
+        *
         * @param       array           $menuItem array
         * @param       array           Array with HTML content to be imploded between <td>-tags
         * @return      array           Array of menu items for top frame.
@@ -1015,7 +1030,7 @@ if (top.content && top.content'.$frameName.' && top.content'.$frameName.'.setLay
 
        /**
         * Traverses the menuItems and generates an output array for implosion in the CM div-layers table.
-        * 
+        *
         * @param       array           $menuItem array
         * @param       array           Array with HTML content to be imploded between <td>-tags
         * @return      array           array for implosion in the CM div-layers table.
@@ -1047,7 +1062,7 @@ if (top.content && top.content'.$frameName.' && top.content'.$frameName.'.setLay
 
        /**
         * Creating an array with various elements for the clickmenu entry
-        * 
+        *
         * @param       string          The label, htmlspecialchar'ed already
         * @param       string          <img>-tag for the icon
         * @param       string          JavaScript onclick event for label/icon
@@ -1075,7 +1090,7 @@ if (top.content && top.content'.$frameName.' && top.content'.$frameName.'.setLay
 
        /**
         * Returns the input string IF not a user setting has disabled display of icons.
-        * 
+        *
         * @param       string          The icon-image tag
         * @return      string          The icon-image tag prefixed with space char IF the icon should be printed at all due to user settings
         */
@@ -1085,9 +1100,9 @@ if (top.content && top.content'.$frameName.' && top.content'.$frameName.'.setLay
 
        /**
         * Get label from locallang_core.php:cm.*
-        * 
+        *
         * @param       string          The "cm."-suffix to get.
-        * @return      string          
+        * @return      string
         */
        function label($label)  {
                return $GLOBALS['LANG']->makeEntities($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:cm.'.$label,1));
@@ -1095,8 +1110,8 @@ if (top.content && top.content'.$frameName.' && top.content'.$frameName.'.setLay
 
        /**
         * Returns true if there should be writing to the div-layers (commands sent to clipboard MUST NOT write to div-layers)
-        * 
-        * @return      boolean         
+        *
+        * @return      boolean
         */
        function isCMlayers()   {
                return $GLOBALS['SOBE']->doc->isCMlayers() && !$this->CB;
@@ -1104,9 +1119,9 @@ if (top.content && top.content'.$frameName.' && top.content'.$frameName.'.setLay
 
        /**
         * Appends ".location" to input string
-        * 
+        *
         * @param       string          Input string, probably a JavaScript document reference
-        * @return      string          
+        * @return      string
         */
        function frameLocation($str)    {
                return $str.'.location';
@@ -1127,7 +1142,7 @@ if (top.content && top.content'.$frameName.' && top.content'.$frameName.'.setLay
 
 /**
  * Script Class for the Context Sensitive Menu in TYPO3 (rendered in top frame, normally writing content dynamically to list frames).
- * 
+ *
  * @author     Kasper Skaarhoj <kasper@typo3.com>
  * @package TYPO3
  * @subpackage core
@@ -1148,15 +1163,15 @@ class SC_alt_clickmenu {
 
        /**
         * Constructor function for script class.
-        * 
-        * @return      void            
+        *
+        * @return      void
         */
        function init() {
                global $BE_USER,$BACK_PATH;
                
                        // Setting GPvars:
-               $this->backPath = t3lib_div::GPvar('backPath');
-               $this->item = t3lib_div::GPvar('item');
+               $this->backPath = t3lib_div::_GP('backPath');
+               $this->item = t3lib_div::_GP('item');
 
                        // Setting pseudo module name
                $this->MCONF['name']='xMOD_alt_clickmenu.php';
@@ -1168,7 +1183,7 @@ class SC_alt_clickmenu {
                } else {
                        $this->backPath = $BACK_PATH;
                }
-
+               
                        // Setting internal array of classes for extending the clickmenu:
                $this->extClassArray = $GLOBALS['TBE_MODULES_EXT']['xMOD_alt_clickmenu']['extendCMclasses'];
 
@@ -1239,11 +1254,10 @@ class SC_alt_clickmenu {
 
        /**
         * Main function - generating the click menu in whatever form it has.
-        * 
-        * @return      void            
+        *
+        * @return      void
         */
        function main() {
-               global $HTTP_GET_VARS;
 
                        // Initialize Clipboard object:
                $clipObj = t3lib_div::makeInstance('t3lib_clipboard');
@@ -1251,7 +1265,8 @@ class SC_alt_clickmenu {
                $clipObj->lockToNormal();       // This locks the clipboard to the Normal for this request.
                
                        // Update clipboard if some actions are sent.
-               $CB = $HTTP_GET_VARS['CB'];
+               $CB = t3lib_div::_GET('CB');
+               
                $clipObj->setCmd($CB);
                $clipObj->cleanCurrent();
                $clipObj->endClipboard();       // Saves
@@ -1264,12 +1279,6 @@ class SC_alt_clickmenu {
                $clickMenu->extClassArray = $this->extClassArray;
                $clickMenu->dontDisplayTopFrameCM = $this->dontDisplayTopFrameCM;
                $clickMenu->backPath = $this->backPath;
-               
-                       // Takes the backPath as a parameter BUT since we are worried about someone forging a backPath (XSS security hole) we will check with sent md5 hash:
-               $inputBP = explode('|',$this->backPath);
-               if (count($inputBP)==2 && $inputBP[1]==md5($inputBP[0].'|'.$GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'])) {
-                       $clickMenu->backPath = $inputBP[0];
-               }
 
                        // Start page 
                $this->content.=$this->doc->startPage('Context Sensitive Menu');
@@ -1280,8 +1289,8 @@ class SC_alt_clickmenu {
 
        /**
         * End page and output content.
-        * 
-        * @return      void            
+        *
+        * @return      void
         */
        function printContent() {
                $this->content.= $this->doc->endPage();