Revert "[TASK] Streamline typo3/classes naming"
authorOliver Hader <oliver@typo3.org>
Fri, 15 Jun 2012 17:08:56 +0000 (19:08 +0200)
committerOliver Hader <oliver.hader@typo3.org>
Fri, 15 Jun 2012 17:14:32 +0000 (19:14 +0200)
This reverts commit 32c37eb6d9bdb4f80d205d94a091e55d4afd36f5.

Change-Id: Ibc36f5631f12b8cfed759aa6e676f48dc179b1b3
Related: #38087
Releases: 6.0
Reviewed-on: http://review.typo3.org/12106
Reviewed-by: Oliver Hader
Tested-by: Oliver Hader
23 files changed:
t3lib/config_default.php
t3lib/stddb/DefaultSettings.php
typo3/Classes/class.ajaxlogin.php [deleted file]
typo3/Classes/class.clearcachemenu.php [deleted file]
typo3/Classes/class.livesearch.php [deleted file]
typo3/Classes/class.modulemenu.php [deleted file]
typo3/Classes/class.shortcutmenu.php [deleted file]
typo3/Classes/class.typo3_tcefile.php [deleted file]
typo3/Classes/class.typo3ajax.php [deleted file]
typo3/Classes/class.typo3logo.php [deleted file]
typo3/ajax.php
typo3/backend.php
typo3/classes/class.ajaxlogin.php [new file with mode: 0644]
typo3/classes/class.clearcachemenu.php [new file with mode: 0644]
typo3/classes/class.livesearch.php [new file with mode: 0644]
typo3/classes/class.modulemenu.php [new file with mode: 0644]
typo3/classes/class.shortcutmenu.php [new file with mode: 0644]
typo3/classes/class.typo3_tcefile.php [new file with mode: 0644]
typo3/classes/class.typo3ajax.php [new file with mode: 0644]
typo3/classes/class.typo3logo.php [new file with mode: 0644]
typo3/sysext/cms/tslib/class.tslib_extdirecteid.php
typo3/sysext/t3editor/classes/class.tx_t3editor_hooks_fileedit.php
typo3/tce_file.php

index 021f3df..763d541 100644 (file)
@@ -442,4 +442,4 @@ $SIM_EXEC_TIME = $EXEC_TIME;                        // $SIM_EXEC_TIME is set to $EXEC_TIME but can be
 $ACCESS_TIME = $EXEC_TIME - ($EXEC_TIME % 60);         // $ACCESS_TIME is a common time in minutes for access control
 $SIM_ACCESS_TIME = $ACCESS_TIME;               // if $SIM_EXEC_TIME is changed this value must be set accordingly
 
-?>
\ No newline at end of file
+?>
index ca911d7..b5e08c7 100644 (file)
@@ -532,28 +532,28 @@ return array(
                'versionNumberInFilename' => FALSE,     // <p>Boolean: If TRUE, included CSS and JS files will have the timestamp embedded in the filename, ie. filename.1269312081.js. This will make browsers and proxies reload the files if they change (thus avoiding caching issues). IMPORTANT: this feature requires extra .htaccess rules to work (please refer to _.htaccess or the _.htaccess file from the dummy package)</p><p>If FALSE the filemtime will be appended as a query-string.</p>
                'spriteIconGenerator_handler' => '',    // String: Used to register own/other spriteGenerating Handler, they have to implement the interface t3lib_spritemanager_SpriteIconGenerator. If set to "t3lib_spritemanager_SpriteBuildingHandler" icons from extensions will automatically merged into sprites.
                'debug' => FALSE,                       // Boolean: If set, the loginrefresh is disabled and pageRenderer is set to debug mode. Use this to debug the backend only!
-               'AJAX' => array(                                // array of key-value pairs for a unified use of AJAX calls in the TYPO3 backend. Keys are the unique ajaxIDs where the value will be resolved to call a method in an object. See ajax.php and the Classes/class.typo3ajax.php for more information.
+               'AJAX' => array(                                // array of key-value pairs for a unified use of AJAX calls in the TYPO3 backend. Keys are the unique ajaxIDs where the value will be resolved to call a method in an object. See ajax.php and the classes/class.typo3ajax.php for more information.
                        'SC_alt_db_navframe::expandCollapse'                => 'typo3/alt_db_navframe.php:SC_alt_db_navframe->ajaxExpandCollapse',
                        'SC_alt_file_navframe::expandCollapse'              => 'typo3/alt_file_navframe.php:SC_alt_file_navframe->ajaxExpandCollapse',
-                       'TYPO3_tcefile::process'                            => 'typo3/Classes/class.typo3_tcefile.php:TYPO3_tcefile->processAjaxRequest',
+                       'TYPO3_tcefile::process'                            => 'typo3/classes/class.typo3_tcefile.php:TYPO3_tcefile->processAjaxRequest',
                        't3lib_TCEforms_inline::createNewRecord'                    => 't3lib/class.t3lib_tceforms_inline.php:t3lib_TCEforms_inline->processAjaxRequest',
                        't3lib_TCEforms_inline::getRecordDetails'                   => 't3lib/class.t3lib_tceforms_inline.php:t3lib_TCEforms_inline->processAjaxRequest',
                        't3lib_TCEforms_inline::synchronizeLocalizeRecords'     => 't3lib/class.t3lib_tceforms_inline.php:t3lib_TCEforms_inline->processAjaxRequest',
                        't3lib_TCEforms_inline::setExpandedCollapsedState'      => 't3lib/class.t3lib_tceforms_inline.php:t3lib_TCEforms_inline->processAjaxRequest',
                        't3lib_TCEforms_suggest::searchRecord'              => 't3lib/tceforms/class.t3lib_tceforms_suggest.php:t3lib_TCEforms_suggest->processAjaxRequest',
-                       'ShortcutMenu::getGroups'    => 'typo3/Classes/class.shortcutmenu.php:ShortcutMenu->getAjaxShortcutGroups',
-                       'ShortcutMenu::saveShortcut' => 'typo3/Classes/class.shortcutmenu.php:ShortcutMenu->setAjaxShortcut',
-                       'ShortcutMenu::render'       => 'typo3/Classes/class.shortcutmenu.php:ShortcutMenu->renderAjax',
-                       'ShortcutMenu::delete'       => 'typo3/Classes/class.shortcutmenu.php:ShortcutMenu->deleteAjaxShortcut',
-                       'ShortcutMenu::create'       => 'typo3/Classes/class.shortcutmenu.php:ShortcutMenu->createAjaxShortcut',
-                       'ModuleMenu::saveMenuState'  => 'typo3/Classes/class.modulemenu.php:ModuleMenu->saveMenuState',
-                       'ModuleMenu::getData'        => 'typo3/Classes/class.modulemenu.php:ModuleMenu->getModuleData',
-                       'BackendLogin::login'                           => 'typo3/Classes/class.ajaxlogin.php:AjaxLogin->login',
-                       'BackendLogin::logout'                          => 'typo3/Classes/class.ajaxlogin.php:AjaxLogin->logout',
-                       'BackendLogin::refreshLogin'            => 'typo3/Classes/class.ajaxlogin.php:AjaxLogin->refreshLogin',
-                       'BackendLogin::isTimedOut'                      => 'typo3/Classes/class.ajaxlogin.php:AjaxLogin->isTimedOut',
-                       'BackendLogin::getChallenge'            => 'typo3/Classes/class.ajaxlogin.php:AjaxLogin->getChallenge',
-                       'BackendLogin::refreshTokens'           => 'typo3/Classes/class.ajaxlogin.php:AjaxLogin->refreshTokens',
+                       'ShortcutMenu::getGroups'    => 'typo3/classes/class.shortcutmenu.php:ShortcutMenu->getAjaxShortcutGroups',
+                       'ShortcutMenu::saveShortcut' => 'typo3/classes/class.shortcutmenu.php:ShortcutMenu->setAjaxShortcut',
+                       'ShortcutMenu::render'       => 'typo3/classes/class.shortcutmenu.php:ShortcutMenu->renderAjax',
+                       'ShortcutMenu::delete'       => 'typo3/classes/class.shortcutmenu.php:ShortcutMenu->deleteAjaxShortcut',
+                       'ShortcutMenu::create'       => 'typo3/classes/class.shortcutmenu.php:ShortcutMenu->createAjaxShortcut',
+                       'ModuleMenu::saveMenuState'  => 'typo3/classes/class.modulemenu.php:ModuleMenu->saveMenuState',
+                       'ModuleMenu::getData'        => 'typo3/classes/class.modulemenu.php:ModuleMenu->getModuleData',
+                       'BackendLogin::login'                           => 'typo3/classes/class.ajaxlogin.php:AjaxLogin->login',
+                       'BackendLogin::logout'                          => 'typo3/classes/class.ajaxlogin.php:AjaxLogin->logout',
+                       'BackendLogin::refreshLogin'            => 'typo3/classes/class.ajaxlogin.php:AjaxLogin->refreshLogin',
+                       'BackendLogin::isTimedOut'                      => 'typo3/classes/class.ajaxlogin.php:AjaxLogin->isTimedOut',
+                       'BackendLogin::getChallenge'            => 'typo3/classes/class.ajaxlogin.php:AjaxLogin->getChallenge',
+                       'BackendLogin::refreshTokens'           => 'typo3/classes/class.ajaxlogin.php:AjaxLogin->refreshTokens',
                        'ExtDirect::getAPI' => 't3lib/extjs/class.t3lib_extjs_extdirectapi.php:t3lib_extjs_ExtDirectApi->getAPI',
                        'ExtDirect::route' => 't3lib/extjs/class.t3lib_extjs_extdirectrouter.php:t3lib_extjs_ExtDirectRouter->route',
                ),
diff --git a/typo3/Classes/class.ajaxlogin.php b/typo3/Classes/class.ajaxlogin.php
deleted file mode 100644 (file)
index 88d739d..0000000
+++ /dev/null
@@ -1,166 +0,0 @@
- <?php
-/***************************************************************
-*  Copyright notice
-*
-*  (c) 2008-2011 Christoph Koehler (christoph@webempoweredchurch.org)
-*  All rights reserved
-*
-*  This script is part of the TYPO3 project. The TYPO3 project is
-*  free software; you can redistribute it and/or modify
-*  it under the terms of the GNU General Public License as published by
-*  the Free Software Foundation; either version 2 of the License, or
-*  (at your option) any later version.
-*
-*  The GNU General Public License can be found at
-*  http://www.gnu.org/copyleft/gpl.html.
-*  A copy is found in the textfile GPL.txt and important notices to the license
-*  from the author is found in LICENSE.txt distributed with these scripts.
-*
-*
-*  This script is distributed in the hope that it will be useful,
-*  but WITHOUT ANY WARRANTY; without even the implied warranty of
-*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-*  GNU General Public License for more details.
-*
-*  This copyright notice MUST APPEAR in all copies of the script!
-***************************************************************/
-/**
- * This is the ajax handler for backend login after timeout.
- *
- * @author Christoph Koehler <christoph@webempoweredchurch.org>
- */
-class AjaxLogin {
-
-       /**
-        * Handles the actual login process, more specifically it defines the response.
-        * The login details were sent in as part of the ajax request and automatically logged in
-        * the user inside the init.php part of the ajax call. If that was successful, we have
-        * a BE user and reset the timer and hide the login window.
-        * If it was unsuccessful, we display that and show the login box again.
-        *
-        * @param array $parameters Parameters (not used)
-        * @param TYPO3AJAX $ajaxObj The calling parent AJAX object
-        * @return void
-        */
-       public function login(array $parameters, TYPO3AJAX $ajaxObj) {
-               if ($this->isAuthorizedBackendSession()) {
-                       $json = array('success' => TRUE);
-                       if ($this->hasLoginBeenProcessed()) {
-                               $formProtection = t3lib_formprotection_Factory::get();
-                               $formProtection->setSessionTokenFromRegistry();
-                               $formProtection->persistSessionToken();
-                       }
-               } else {
-                       $json = array('success' => FALSE);
-               }
-               $ajaxObj->addContent('login', $json);
-               $ajaxObj->setContentFormat('json');
-       }
-
-       /**
-        * Checks if a user is logged in and the session is active.
-        *
-        * @return boolean
-        */
-       protected function isAuthorizedBackendSession() {
-               return (isset($GLOBALS['BE_USER']) && $GLOBALS['BE_USER'] instanceof t3lib_beUserAuth && isset($GLOBALS['BE_USER']->user['uid']));
-       }
-
-       /**
-        * Check whether the user was already authorized or not
-        *
-        * @return boolean
-        */
-       protected function hasLoginBeenProcessed() {
-               $loginFormData = $GLOBALS['BE_USER']->getLoginFormData();
-
-               return ($loginFormData['status'] == 'login')
-                       && isset($loginFormData['uname'])
-                       && isset($loginFormData['uident'])
-                       && isset($loginFormData['chalvalue'])
-                       && ((string)$_COOKIE[t3lib_beUserAuth::getCookieName()] !== (string)$GLOBALS['BE_USER']->id);
-       }
-
-       /**
-        * Logs out the current BE user
-        *
-        * @param array $parameters Parameters (not used)
-        * @param TYPO3AJAX $ajaxObj The calling parent AJAX object
-        * @return void
-        */
-       public function logout(array $parameters, TYPO3AJAX $ajaxObj) {
-               $GLOBALS['BE_USER']->logoff();
-               if ($GLOBALS['BE_USER']->user['uid']) {
-                       $ajaxObj->addContent('logout', array('success' => FALSE));
-               } else {
-                       $ajaxObj->addContent('logout', array('success' => TRUE));
-               }
-               $ajaxObj->setContentFormat('json');
-       }
-
-       /**
-        * Refreshes the login without needing login information. We just refresh the session.
-        *
-        *
-        * @param array $parameters Parameters (not used)
-        * @param TYPO3AJAX $ajaxObj The calling parent AJAX object
-        * @return void
-        */
-       public function refreshLogin(array $parameters, TYPO3AJAX $ajaxObj) {
-               $GLOBALS['BE_USER']->checkAuthentication();
-               $ajaxObj->addContent('refresh', array('success' => TRUE));
-               $ajaxObj->setContentFormat('json');
-       }
-
-       /**
-        * Checks if the user session is expired yet
-        *
-        * @param array $parameters Parameters (not used)
-        * @param TYPO3AJAX $ajaxObj The calling parent AJAX object
-        * @return void
-        */
-       function isTimedOut(array $parameters, TYPO3AJAX $ajaxObj) {
-               if (is_object($GLOBALS['BE_USER'])) {
-                       $ajaxObj->setContentFormat('json');
-                       if (@is_file(PATH_typo3conf.'LOCK_BACKEND')) {
-                               $ajaxObj->addContent('login', array('will_time_out' => FALSE, 'locked' => TRUE));
-                               $ajaxObj->setContentFormat('json');
-                       } elseif (!isset($GLOBALS['BE_USER']->user['uid'])) {
-                               $ajaxObj->addContent('login', array('timed_out' => TRUE));
-                       } else {
-                               $GLOBALS['BE_USER']->fetchUserSession(TRUE);
-                               $ses_tstamp = $GLOBALS['BE_USER']->user['ses_tstamp'];
-                               $timeout = $GLOBALS['BE_USER']->auth_timeout_field;
-
-                                       // If 120 seconds from now is later than the session timeout, we need to show the refresh dialog.
-                                       // 120 is somewhat arbitrary to allow for a little room during the countdown and load times, etc.
-                               if ($GLOBALS['EXEC_TIME'] >= $ses_tstamp + $timeout - 120) {
-                                       $ajaxObj->addContent('login', array('will_time_out' => TRUE));
-                               } else {
-                                       $ajaxObj->addContent('login', array('will_time_out' => FALSE));
-                               }
-                       }
-               } else {
-                       $ajaxObj->addContent('login', array('success' => FALSE, 'error' => 'No BE_USER object'));
-               }
-       }
-
-       /**
-        * Gets a MD5 challenge.
-        *
-        * @param array $parameters Parameters (not used)
-        * @param TYPO3AJAX $parent The calling parent AJAX object
-        * @return void
-        */
-       public function getChallenge(array $parameters, TYPO3AJAX $parent) {
-               session_start();
-
-               $_SESSION['login_challenge'] = md5(uniqid('') . getmypid());
-
-               session_commit();
-
-               $parent->addContent('challenge', $_SESSION['login_challenge']);
-               $parent->setContentFormat('json');
-       }
-}
-?>
\ No newline at end of file
diff --git a/typo3/Classes/class.clearcachemenu.php b/typo3/Classes/class.clearcachemenu.php
deleted file mode 100644 (file)
index 60e7c1a..0000000
+++ /dev/null
@@ -1,189 +0,0 @@
-<?php
-/***************************************************************
-*  Copyright notice
-*
-*  (c) 2007-2011 Ingo Renner <ingo@typo3.org>
-*  All rights reserved
-*
-*  This script is part of the TYPO3 project. The TYPO3 project is
-*  free software; you can redistribute it and/or modify
-*  it under the terms of the GNU General Public License as published by
-*  the Free Software Foundation; either version 2 of the License, or
-*  (at your option) any later version.
-*
-*  The GNU General Public License can be found at
-*  http://www.gnu.org/copyleft/gpl.html.
-*  A copy is found in the textfile GPL.txt and important notices to the license
-*  from the author is found in LICENSE.txt distributed with these scripts.
-*
-*
-*  This script is distributed in the hope that it will be useful,
-*  but WITHOUT ANY WARRANTY; without even the implied warranty of
-*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-*  GNU General Public License for more details.
-*
-*  This copyright notice MUST APPEAR in all copies of the script!
-***************************************************************/
-
-/**
- * class to render the menu for the cache clearing actions
- *
- * @author Ingo Renner <ingo@typo3.org>
- * @package TYPO3
- * @subpackage core
- */
-class ClearCacheMenu implements backend_toolbarItem {
-
-       /**
-        * @var array
-        */
-       protected $cacheActions;
-
-       /**
-        * @var array
-        */
-       protected $optionValues;
-
-       /**
-        * Reference back to the backend object
-        *
-        * @var TYPO3backend
-        */
-       protected $backendReference;
-
-       /**
-        * Constructor
-        *
-        * @param TYPO3backend $backendReference TYPO3 backend object reference
-        */
-       public function __construct(TYPO3backend &$backendReference = NULL) {
-               $this->backendReference = $backendReference;
-               $this->cacheActions     = array();
-               $this->optionValues     = array('all', 'pages');
-
-                       // Clear cache for ALL tables!
-               if ($GLOBALS['BE_USER']->isAdmin() || $GLOBALS['BE_USER']->getTSConfigVal('options.clearCache.all')) {
-                       $title = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:rm.clearCacheMenu_all', TRUE);
-                       $this->cacheActions[] = array(
-                               'id'    => 'all',
-                               'title' => $title,
-                               'href'  => $this->backPath .
-                                               'tce_db.php?vC=' .
-                                               $GLOBALS['BE_USER']->veriCode() .
-                                               '&cacheCmd=all&ajaxCall=1' .
-                                               t3lib_BEfunc::getUrlToken('tceAction'),
-                               'icon'  => t3lib_iconWorks::getSpriteIcon('actions-system-cache-clear-impact-high')
-                       );
-               }
-
-                       // Clear cache for either ALL pages
-               if ($GLOBALS['BE_USER']->isAdmin() || $GLOBALS['BE_USER']->getTSConfigVal('options.clearCache.pages')) {
-                       $title = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:rm.clearCacheMenu_pages', TRUE);
-                       $this->cacheActions[] = array(
-                               'id'    => 'pages',
-                               'title' => $title,
-                               'href'  => $this->backPath .
-                                               'tce_db.php?vC=' .
-                                               $GLOBALS['BE_USER']->veriCode() .
-                                               '&cacheCmd=pages&ajaxCall=1' .
-                                               t3lib_BEfunc::getUrlToken('tceAction'),
-                               'icon'  => t3lib_iconWorks::getSpriteIcon('actions-system-cache-clear-impact-medium')
-                       );
-               }
-
-                       // Clearing of cache-files in typo3conf/ + menu
-               if ($GLOBALS['BE_USER']->isAdmin() && $GLOBALS['TYPO3_CONF_VARS']['EXT']['extCache']) {
-                       $title = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:rm.clearCacheMenu_allTypo3Conf', TRUE);
-                       $this->cacheActions[] = array(
-                               'id'    => 'temp_CACHED',
-                               'title' => $title,
-                               'href'  => $this->backPath .
-                                               'tce_db.php?vC=' .
-                                               $GLOBALS['BE_USER']->veriCode() .
-                                               '&cacheCmd=temp_CACHED&ajaxCall=1' .
-                                               t3lib_BEfunc::getUrlToken('tceAction'),
-                               'icon'  => t3lib_iconWorks::getSpriteIcon('actions-system-cache-clear-impact-low')
-                       );
-               }
-
-                       // Hook for manipulate cacheActions
-               if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['additionalBackendItems']['cacheActions'])) {
-                       foreach($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['additionalBackendItems']['cacheActions'] as $cacheAction) {
-                               $hookObject = t3lib_div::getUserObj($cacheAction);
-
-                               if (!($hookObject instanceof backend_cacheActionsHook)) {
-                                       throw new UnexpectedValueException('$hookObject must implement interface backend_cacheActionsHook', 1228262000);
-                               }
-
-                               $hookObject->manipulateCacheActions($this->cacheActions, $this->optionValues);
-                       }
-               }
-       }
-
-       /**
-        * Checks whether the user has access to this toolbar item
-        *
-        * @return boolean TRUE if user has access, FALSE if not
-        */
-       public function checkAccess() {
-
-               if ($GLOBALS['BE_USER']->isAdmin()) {
-                       return TRUE;
-               }
-
-               if (is_array($this->optionValues)) {
-                       foreach($this->optionValues as $value) {
-                               if ($GLOBALS['BE_USER']->getTSConfigVal('options.clearCache.' . $value)) {
-                                       return TRUE;
-                               }
-                       }
-               }
-               return FALSE;
-
-       }
-
-       /**
-        * Creates the selector for workspaces
-        *
-        * @return string Workspace selector as HTML select
-        */
-       public function render() {
-               $title = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:rm.clearCache_clearCache', TRUE);
-               $this->addJavascriptToBackend();
-               $cacheMenu = array();
-
-               $cacheMenu[] = '<a href="#" class="toolbar-item">' .
-                       t3lib_iconWorks::getSpriteIcon('apps-toolbar-menu-cache', array('title' => $title)) .
-                       '</a>';
-
-               $cacheMenu[] = '<ul class="toolbar-item-menu" style="display: none;">';
-
-               foreach($this->cacheActions as $actionKey => $cacheAction) {
-                       $cacheMenu[] = '<li><a href="' . htmlspecialchars($cacheAction['href']) . '">' . $cacheAction['icon'] . ' ' . $cacheAction['title'] . '</a></li>';
-               }
-
-               $cacheMenu[] = '</ul>';
-
-               return implode(LF, $cacheMenu);
-       }
-
-       /**
-        * Adds the necessary JavaScript to the backend
-        *
-        * @return void
-        */
-       protected function addJavascriptToBackend() {
-               $this->backendReference->addJavascriptFile('js/clearcachemenu.js');
-       }
-
-       /**
-        * Returns additional attributes for the list item in the toolbar
-        *
-        * @return string List item HTML attibutes
-        */
-       public function getAdditionalAttributes() {
-               return ' id="clear-cache-actions-menu"';
-       }
-
-}
-?>
\ No newline at end of file
diff --git a/typo3/Classes/class.livesearch.php b/typo3/Classes/class.livesearch.php
deleted file mode 100644 (file)
index d34a1a2..0000000
+++ /dev/null
@@ -1,110 +0,0 @@
-<?php
-/***************************************************************
- *  Copyright notice
- *
- *  (c) 2009-2011 Michael Klapper <michael.klapper@aoemedia.de>
- *  (c) 2010-2011 Jeff Segars <jeff@webempoweredchurch.org>
- *  All rights reserved
- *
- *  This script is part of the TYPO3 project. The TYPO3 project is
- *  free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  The GNU General Public License can be found at
- *  http://www.gnu.org/copyleft/gpl.html.
- *  A copy is found in the textfile GPL.txt and important notices to the license
- *  from the author is found in LICENSE.txt distributed with these scripts.
- *
- *
- *  This script is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
-
-/**
- * Adds backend live search to the toolbar
- *
- * @author Michael Klapper <michael.klapper@aoemedia.de>
- * @author Jeff Segars <jeff@webempoweredchurch.org>
- * @package TYPO3
- * @subpackage t3lib
- */
-class LiveSearch implements backend_toolbarItem {
-
-       /**
-        * Reference back to the backend object
-        *
-        * @var TYPO3backend
-        */
-       protected $backendReference;
-
-       /**
-        * Constructor
-        *
-        * @param TYPO3backend $backendReference TYPO3 backend object reference
-        */
-       public function __construct(TYPO3backend &$backendReference = NULL) {
-               $this->backendReference = $backendReference;
-       }
-
-       /**
-        * Checks whether the user has access to this toolbar item
-        *
-        * @return boolean TRUE if user has access, FALSE if not
-        */
-       public function checkAccess() {
-               $access = FALSE;
-
-                       // Loads the backend modules available for the logged in user.
-               $loadModules = t3lib_div::makeInstance('t3lib_loadModules');
-               $loadModules->observeWorkspaces = TRUE;
-               $loadModules->load($GLOBALS['TBE_MODULES']);
-
-                       // Live search is heavily dependent on the list module and only available when that module is.
-               if (is_array($loadModules->modules['web']['sub']['list'])) {
-                       $access = TRUE;
-               }
-
-               return $access;
-       }
-
-       /**
-        * Creates the selector for workspaces
-        *
-        * @return string Workspace selector as HTML select
-        */
-       public function render() {
-               $this->addJavascriptToBackend();
-               return '<div class="live-search-wrapper">
-                                       <span title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:search') .'" class="t3-icon t3-icon-apps t3-icon-apps-toolbar t3-icon-toolbar-menu-search">&nbsp;</span>
-                                       <input id="live-search-box" />
-                               </div>';
-       }
-
-       /**
-        * Adds the necessary JavaScript to the backend
-        *
-        * @return void
-        */
-       protected function addJavascriptToBackend() {
-               $pageRenderer = $GLOBALS['TBE_TEMPLATE']->getPageRenderer();
-
-               $this->backendReference->addJavascriptFile('js/livesearch.js');
-       }
-
-       /**
-        * returns additional attributes for the list item in the toolbar
-        *
-        * @return string List item HTML attibutes
-        */
-       public function getAdditionalAttributes() {
-               return ' id="live-search-menu"';
-       }
-
-}
-?>
\ No newline at end of file
diff --git a/typo3/Classes/class.modulemenu.php b/typo3/Classes/class.modulemenu.php
deleted file mode 100644 (file)
index 16aa2db..0000000
+++ /dev/null
@@ -1,360 +0,0 @@
-<?php
-/***************************************************************
-*  Copyright notice
-*
-*  (c) 2007-2011 Ingo Renner <ingo@typo3.org>
-*  All rights reserved
-*
-*  This script is part of the TYPO3 project. The TYPO3 project is
-*  free software; you can redistribute it and/or modify
-*  it under the terms of the GNU General Public License as published by
-*  the Free Software Foundation; either version 2 of the License, or
-*  (at your option) any later version.
-*
-*  The GNU General Public License can be found at
-*  http://www.gnu.org/copyleft/gpl.html.
-*  A copy is found in the textfile GPL.txt and important notices to the license
-*  from the author is found in LICENSE.txt distributed with these scripts.
-*
-*
-*  This script is distributed in the hope that it will be useful,
-*  but WITHOUT ANY WARRANTY; without even the implied warranty of
-*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-*  GNU General Public License for more details.
-*
-*  This copyright notice MUST APPEAR in all copies of the script!
-***************************************************************/
-
-if (TYPO3_REQUESTTYPE & TYPO3_REQUESTTYPE_AJAX) {
-       $GLOBALS['LANG']->includeLLFile('EXT:lang/locallang_misc.xml');
-}
-
-/**
- * class to render the TYPO3 backend menu for the modules
- *
- * @author Ingo Renner <ingo@typo3.org>
- * @package TYPO3
- * @subpackage core
- */
-class ModuleMenu {
-
-       /**
-        * Module loading object
-        *
-        * @var t3lib_loadModules
-        */
-       protected $moduleLoader;
-
-       protected $backPath;
-       protected $linkModules;
-       protected $loadedModules;
-
-       /**
-        * Constructor, initializes several variables
-        */
-       public function __construct() {
-
-               $this->backPath    = '';
-               $this->linkModules = TRUE;
-
-                       // Loads the backend modules available for the logged in user.
-               $this->moduleLoader = t3lib_div::makeInstance('t3lib_loadModules');
-               $this->moduleLoader->observeWorkspaces = TRUE;
-               $this->moduleLoader->load($GLOBALS['TBE_MODULES']);
-               $this->loadedModules = $this->moduleLoader->modules;
-       }
-
-       /**
-        * sets the path back to /typo3/
-        *
-        * @param string $backPath Path back to /typo3/
-        * @throws InvalidArgumentException
-        * @return void
-        */
-       public function setBackPath($backPath) {
-               if (!is_string($backPath)) {
-                       throw new InvalidArgumentException('parameter $backPath must be of type string', 1193315266);
-               }
-
-               $this->backPath = $backPath;
-       }
-
-       /**
-        * loads the collapse states for the main modules from user's configuration (uc)
-        *
-        * @return array Collapse states
-        */
-       protected function getCollapsedStates() {
-
-               $collapsedStates = array();
-               if ($GLOBALS['BE_USER']->uc['moduleData']['moduleMenu']) {
-                       $collapsedStates = $GLOBALS['BE_USER']->uc['moduleData']['moduleMenu'];
-               }
-
-               return $collapsedStates;
-       }
-
-       /**
-        * ModuleMenu Store loading data
-        *
-        * @param array $params
-        * @param TYPO3AJAX $ajaxObj
-        * @return array
-        */
-       public function getModuleData($params, $ajaxObj) {
-               $data = array('success' => TRUE, 'root' => array());
-               $rawModuleData = $this->getRawModuleData();
-               $index = 0;
-               foreach ($rawModuleData as $moduleKey => $moduleData) {
-                       $key = substr($moduleKey, 8);
-                       $num = count($data['root']);
-                       if ($moduleData['link'] != 'dummy.php' || ($moduleData['link'] == 'dummy.php' && is_array($moduleData['subitems'])) ) {
-                               $data['root'][$num]['key'] = $key;
-                               $data['root'][$num]['menuState'] = $GLOBALS['BE_USER']->uc['moduleData']['menuState'][$moduleKey];
-                               $data['root'][$num]['label'] = $moduleData['title'];
-                               $data['root'][$num]['subitems'] = is_array($moduleData['subitems']) ? count($moduleData['subitems']) : 0;
-
-                               if ($moduleData['link'] && $this->linkModules) {
-                                       $data['root'][$num]['link'] = 'top.goToModule(\'' . $moduleData['name'] . '\')';
-                               }
-
-                                       // Traverse submodules
-                               if (is_array($moduleData['subitems'])) {
-                                       foreach($moduleData['subitems'] as $subKey => $subData) {
-                                               $data['root'][$num]['sub'][] = array(
-                                                       'name' => $subData['name'],
-                                                       'description' => $subData['description'],
-                                                       'label' => $subData['title'],
-                                                       'icon' => $subData['icon']['filename'],
-                                                       'navframe' => $subData['parentNavigationFrameScript'],
-                                                       'link' => $subData['link'],
-                                                       'originalLink' => $subData['originalLink'],
-                                                       'index' => $index++,
-                                                       'navigationFrameScript' => $subData['navigationFrameScript'],
-                                                       'navigationFrameScriptParam' => $subData['navigationFrameScriptParam'],
-                                                       'navigationComponentId' => $subData['navigationComponentId'],
-                                               );
-                                       }
-                               }
-                       }
-               }
-               if ($ajaxObj) {
-                       $ajaxObj->setContent($data);
-                       $ajaxObj->setContentFormat('jsonbody');
-               } else {
-                       return $data;
-               }
-       }
-
-       /**
-        * Returns the loaded modules
-        *
-        * @return array Array of loaded modules
-        */
-       public function getLoadedModules() {
-               return $this->loadedModules;
-       }
-
-       /**
-        * saves the menu's toggle state in the backend user's uc
-        *
-        * @param array $params Array of parameters from the AJAX interface, currently unused
-        * @param TYPO3AJAX $ajaxObj Object of type TYPO3AJAX
-        * @return void
-        */
-       public function saveMenuState($params, $ajaxObj) {
-               $menuItem = t3lib_div::_POST('menuid');
-               $state = t3lib_div::_POST('state') === 'true' ? 1 : 0;
-
-               $GLOBALS['BE_USER']->uc['moduleData']['menuState'][$menuItem] = $state;
-               $GLOBALS['BE_USER']->writeUC();
-       }
-
-       /**
-        * gets the raw module data
-        *
-        * @return array Multi dimension array with module data
-        */
-       public function getRawModuleData() {
-               $modules = array();
-
-                       // Remove the 'doc' module?
-               if ($GLOBALS['BE_USER']->getTSConfigVal('options.disableDocModuleInAB')) {
-                       unset($this->loadedModules['doc']);
-               }
-
-               foreach ($this->loadedModules as $moduleName => $moduleData) {
-                       $moduleLink = '';
-                       if (!is_array($moduleData['sub'])) {
-                               $moduleLink = $moduleData['script'];
-                       }
-                       $moduleLink = t3lib_div::resolveBackPath($moduleLink);
-
-                       $moduleKey   = 'modmenu_' . $moduleName;
-                       $moduleIcon  = $this->getModuleIcon($moduleKey);
-
-                       $modules[$moduleKey] = array(
-                               'name'        => $moduleName,
-                               'title'       => $GLOBALS['LANG']->moduleLabels['tabs'][$moduleName . '_tab'],
-                               'onclick'     => 'top.goToModule(\'' . $moduleName . '\');',
-                               'icon'        => $moduleIcon,
-                               'link'        => $moduleLink,
-                               'description' => $GLOBALS['LANG']->moduleLabels['labels'][$moduleKey.'label']
-                       );
-
-                       if (!is_array($moduleData['sub']) && $moduleData['script'] != 'dummy.php') {
-                                       // Work around for modules with own main entry, but being self the only submodule
-                               $modules[$moduleKey]['subitems'][$moduleKey] = array(
-                                       'name' => $moduleName,
-                                       'title' => $GLOBALS['LANG']->moduleLabels['tabs'][$moduleName . '_tab'],
-                                       'onclick' => 'top.goToModule(\'' . $moduleName . '\');',
-                                       'icon' => $this->getModuleIcon($moduleName . '_tab'),
-                                       'link' => $moduleLink,
-                                       'originalLink' => $moduleLink,
-                                       'description' => $GLOBALS['LANG']->moduleLabels['labels'][$moduleKey . 'label'],
-                                       'navigationFrameScript' => NULL,
-                                       'navigationFrameScriptParam' => NULL,
-                                       'navigationComponentId' => NULL,
-                               );
-                       } elseif (is_array($moduleData['sub'])) {
-                               foreach($moduleData['sub'] as $submoduleName => $submoduleData) {
-                                       $submoduleLink = t3lib_div::resolveBackPath($submoduleData['script']);
-
-                                       $submoduleKey         = $moduleName . '_' . $submoduleName . '_tab';
-                                       $submoduleIcon        = $this->getModuleIcon($submoduleKey);
-                                       $submoduleDescription = $GLOBALS['LANG']->moduleLabels['labels'][$submoduleKey . 'label'];
-
-                                       $originalLink = $submoduleLink;
-
-                                       $modules[$moduleKey]['subitems'][$submoduleKey] = array(
-                                               'name'         => $moduleName . '_' . $submoduleName,
-                                               'title'        => $GLOBALS['LANG']->moduleLabels['tabs'][$submoduleKey],
-                                               'onclick'      => 'top.goToModule(\'' . $moduleName . '_' . $submoduleName . '\');',
-                                               'icon'         => $submoduleIcon,
-                                               'link'         => $submoduleLink,
-                                               'originalLink' => $originalLink,
-                                               'description'  => $submoduleDescription,
-                                               'navigationFrameScript' => $submoduleData['navFrameScript'],
-                                               'navigationFrameScriptParam' => $submoduleData['navFrameScriptParam'],
-                                               'navigationComponentId' => $submoduleData['navigationComponentId'],
-                                       );
-
-                                       if ($moduleData['navFrameScript']) {
-                                               $modules[$moduleKey]['subitems'][$submoduleKey]['parentNavigationFrameScript'] = $moduleData['navFrameScript'];
-                                       }
-                               }
-                       }
-               }
-
-               return $modules;
-       }
-
-       /**
-        * gets the module icon and its size
-        *
-        * @param string $moduleKey Module key
-        * @return array Icon data array with 'filename', 'size', and 'html'
-        */
-       protected function getModuleIcon($moduleKey) {
-               $icon = array(
-                       'filename' => '',
-                       'size' => '',
-                       'title' => '',
-                       'html' => ''
-               );
-
-               $iconFileRelative = $this->getModuleIconRelative($GLOBALS['LANG']->moduleLabels['tabs_images'][$moduleKey]);
-               $iconFileAbsolute = $this->getModuleIconAbsolute($GLOBALS['LANG']->moduleLabels['tabs_images'][$moduleKey]);
-               $iconSizes        = @getimagesize($iconFileAbsolute);
-               $iconTitle        = $GLOBALS['LANG']->moduleLabels['tabs'][$moduleKey];
-
-               if (!empty($iconFileRelative)) {
-                       $icon['filename'] = $iconFileRelative;
-                       $icon['size']     = $iconSizes[3];
-                       $icon['title']    = htmlspecialchars($iconTitle);
-                       $icon['html']     = '<img src="' . $iconFileRelative . '" ' . $iconSizes[3] .
-                               ' title="' . htmlspecialchars($iconTitle) . '" alt="' . htmlspecialchars($iconTitle) . '" />';
-               }
-
-               return $icon;
-       }
-
-       /**
-        * Returns the filename readable for the script from PATH_typo3.
-        * That means absolute names are just returned while relative names are
-        * prepended with the path pointing back to typo3/ dir
-        *
-        * @param string $iconFilename Icon filename
-        * @return string Icon filename with absolute path
-        * @see getModuleIconRelative()
-        */
-       protected function getModuleIconAbsolute($iconFilename) {
-
-               if (!t3lib_div::isAbsPath($iconFilename)) {
-                       $iconFilename = $this->backPath . $iconFilename;
-               }
-
-               return $iconFilename;
-       }
-
-       /**
-        * Returns relative path to the icon filename for use in img-tags
-        *
-        * @param string $iconFilename Icon filename
-        * @return string Icon filename with relative path
-        * @see getModuleIconAbsolute()
-        */
-       protected function getModuleIconRelative($iconFilename) {
-               if (t3lib_div::isAbsPath($iconFilename)) {
-                       $iconFilename = '../' . substr($iconFilename, strlen(PATH_site));
-               }
-               return $this->backPath.$iconFilename;
-       }
-
-       /**
-        * Appends a '?' if there is none in the string already
-        *
-        * @param string $link Link URL
-        * @return string Link URl appended with ? if there wasn't one
-        */
-       protected function appendQuestionmarkToLink($link) {
-               if (!strstr($link, '?')) {
-                       $link .= '?';
-               }
-
-               return $link;
-       }
-
-       /**
-        * renders the logout button form
-        *
-        * @return string Html code snippet displaying the logout button
-        */
-       public function renderLogoutButton() {
-               $buttonLabel      = $GLOBALS['BE_USER']->user['ses_backuserid'] ? 'LLL:EXT:lang/locallang_core.php:buttons.exit' : 'LLL:EXT:lang/locallang_core.php:buttons.logout';
-
-               $buttonForm = '
-               <form action="logout.php" target="_top">
-                       <input type="submit" value="&nbsp;' . $GLOBALS['LANG']->sL($buttonLabel, 1) . '&nbsp;" />
-               </form>';
-
-               return $buttonForm;
-       }
-
-       /**
-        * turns linking of modules on or off
-        *
-        * @param boolean $linkModules Status for linking modules with a-tags, set to FALSE to turn lining off
-        * @throws InvalidArgumentException
-        * @return void
-        */
-       public function setLinkModules($linkModules) {
-               if (!is_bool($linkModules)) {
-                       throw new InvalidArgumentException('parameter $linkModules must be of type bool', 1193326558);
-               }
-
-               $this->linkModules = $linkModules;
-       }
-
-}
-?>
\ No newline at end of file
diff --git a/typo3/Classes/class.shortcutmenu.php b/typo3/Classes/class.shortcutmenu.php
deleted file mode 100644 (file)
index 91c6cb7..0000000
+++ /dev/null
@@ -1,790 +0,0 @@
-<?php
-/***************************************************************
-*  Copyright notice
-*
-*  (c) 2007-2011 Ingo Renner <ingo@typo3.org>
-*  All rights reserved
-*
-*  This script is part of the TYPO3 project. The TYPO3 project is
-*  free software; you can redistribute it and/or modify
-*  it under the terms of the GNU General Public License as published by
-*  the Free Software Foundation; either version 2 of the License, or
-*  (at your option) any later version.
-*
-*  The GNU General Public License can be found at
-*  http://www.gnu.org/copyleft/gpl.html.
-*  A copy is found in the textfile GPL.txt and important notices to the license
-*  from the author is found in LICENSE.txt distributed with these scripts.
-*
-*
-*  This script is distributed in the hope that it will be useful,
-*  but WITHOUT ANY WARRANTY; without even the implied warranty of
-*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-*  GNU General Public License for more details.
-*
-*  This copyright notice MUST APPEAR in all copies of the script!
-***************************************************************/
-
-if (TYPO3_REQUESTTYPE & TYPO3_REQUESTTYPE_AJAX) {
-       require_once(PATH_typo3 . 'interfaces/interface.backend_toolbaritem.php');
-       $GLOBALS['LANG']->includeLLFile('EXT:lang/locallang_misc.xml');
-
-               // Needed to get the correct icons when reloading the menu after saving it
-       $loadModules = t3lib_div::makeInstance('t3lib_loadModules');
-       $loadModules->load($GLOBALS['TBE_MODULES']);
-}
-
-/**
- * Class to render the shortcut menu
- *
- * @author Ingo Renner <ingo@typo3.org>
- * @package TYPO3
- * @subpackage core
- */
-class ShortcutMenu implements backend_toolbarItem {
-
-       protected $shortcutGroups;
-
-       /**
-        * All available shortcuts
-        *
-        * @var array
-        */
-       protected $shortcuts;
-
-       /**
-        * Labels of all groups.
-        * If value is 1, the system will try to find a label in the locallang array.
-        *
-        * @var array
-        */
-       protected $groupLabels;
-
-       /**
-        * Reference back to the backend object
-        *
-        * @var TYPO3backend
-        */
-       protected $backendReference;
-
-       /**
-        * Constructor
-        *
-        * @param TYPO3backend $backendReference TYPO3 backend object reference
-        */
-       public function __construct(TYPO3backend &$backendReference = NULL) {
-               $this->backendReference = $backendReference;
-               $this->shortcuts        = array();
-
-                       // By default, 5 groups are set
-               $this->shortcutGroups = array(
-                       1 => '1',
-                       2 => '1',
-                       3 => '1',
-                       4 => '1',
-                       5 => '1',
-               );
-
-               $this->shortcutGroups  = $this->initShortcutGroups();
-               $this->shortcuts       = $this->initShortcuts();
-       }
-
-       /**
-        * Checks whether the user has access to this toolbar item
-        *
-        * @return boolean TRUE if user has access, FALSE if not
-        */
-       public function checkAccess() {
-               return (bool) $GLOBALS['BE_USER']->getTSConfigVal('options.enableBookmarks');
-       }
-
-       /**
-        * Creates the shortcut menu (default renderer)
-        *
-        * @return string Workspace selector as HTML select
-        */
-       public function render() {
-               $title = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:toolbarItems.bookmarks', TRUE);
-               $this->addJavascriptToBackend();
-
-               $shortcutMenu = array();
-
-               $shortcutMenu[] = '<a href="#" class="toolbar-item">' .
-                       t3lib_iconWorks::getSpriteIcon('apps-toolbar-menu-shortcut', array('title' => $title)) .
-                       '</a>';
-               $shortcutMenu[] = '<div class="toolbar-item-menu" style="display: none;">';
-               $shortcutMenu[] = $this->renderMenu();
-               $shortcutMenu[] = '</div>';
-
-               return implode(LF, $shortcutMenu);
-       }
-
-       /**
-        * Renders the pure contents of the menu
-        *
-        * @return string The menu's content
-        */
-       public function renderMenu() {
-
-               $shortcutGroup  = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:toolbarItems.bookmarksGroup', TRUE);
-               $shortcutEdit   = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:toolbarItems.bookmarksEdit', TRUE);
-               $shortcutDelete = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:toolbarItems.bookmarksDelete', TRUE);
-
-               $groupIcon  = '<img' . t3lib_iconWorks::skinImg($this->backPath, 'gfx/i/sysf.gif', 'width="18" height="16"') . ' title="' . $shortcutGroup . '" alt="' . $shortcutGroup . '" />';
-               $editIcon   = '<img' . t3lib_iconWorks::skinImg($this->backPath, 'gfx/edit2.gif', 'width="11" height="12"') . ' title="' . $shortcutEdit . '" alt="' . $shortcutEdit . '"';
-               $deleteIcon = '<img' . t3lib_iconWorks::skinImg($this->backPath, 'gfx/garbage.gif', 'width="11" height="12"') . ' title="' . $shortcutDelete . '" alt="' . $shortcutDelete . '" />';
-
-               $shortcutMenu[] = '<table border="0" cellspacing="0" cellpadding="0" class="shortcut-list">';
-
-                       // Render shortcuts with no group (group id = 0) first
-               $noGroupShortcuts = $this->getShortcutsByGroup(0);
-               foreach ($noGroupShortcuts as $shortcut) {
-                       $shortcutMenu[] = '
-                       <tr id="shortcut-' . $shortcut['raw']['uid'] . '" class="shortcut">
-                               <td class="shortcut-icon">' . $shortcut['icon'] . '</td>
-                               <td class="shortcut-label">
-                                       <a id="shortcut-label-' . $shortcut['raw']['uid'] . '" href="#" onclick="' . $shortcut['action'] . '; return false;">' . htmlspecialchars($shortcut['label']) . '</a>
-                               </td>
-                               <td class="shortcut-edit">' . $editIcon . ' id="shortcut-edit-' . $shortcut['raw']['uid'] . '" /></td>
-                               <td class="shortcut-delete">' . $deleteIcon . '</td>
-                       </tr>';
-               }
-
-                       // Now render groups and the contained shortcuts
-               $groups = $this->getGroupsFromShortcuts();
-               krsort($groups, SORT_NUMERIC);
-               foreach($groups as $groupId => $groupLabel) {
-                       if ($groupId != 0 ) {
-                               $shortcutGroup = '
-                               <tr class="shortcut-group" id="shortcut-group-' . $groupId . '">
-                                       <td class="shortcut-group-icon">' . $groupIcon . '</td>
-                                       <td class="shortcut-group-label">' . $groupLabel . '</td>
-                                       <td colspan="2">&nbsp;</td>
-                               </tr>';
-
-                               $shortcuts = $this->getShortcutsByGroup($groupId);
-                               $i = 0;
-                               foreach ($shortcuts as $shortcut) {
-                                       $i++;
-
-                                       $firstRow = '';
-                                       if ($i == 1) {
-                                               $firstRow = ' first-row';
-                                       }
-
-                                       $shortcutGroup .= '
-                                       <tr id="shortcut-' . $shortcut['raw']['uid'] . '" class="shortcut' . $firstRow . '">
-                                               <td class="shortcut-icon">' . $shortcut['icon'] . '</td>
-                                               <td class="shortcut-label">
-                                                       <a id="shortcut-label-' . $shortcut['raw']['uid'] . '" href="#" onclick="' . $shortcut['action'] . '; return false;">' . htmlspecialchars($shortcut['label']) . '</a>
-                                               </td>
-                                               <td class="shortcut-edit">' . $editIcon . ' id="shortcut-edit-' . $shortcut['raw']['uid'] . '" /></td>
-                                               <td class="shortcut-delete">' . $deleteIcon . '</td>
-                                       </tr>';
-                               }
-
-                               $shortcutMenu[] = $shortcutGroup;
-                       }
-               }
-
-               if (count($shortcutMenu) == 1) {
-                               // No shortcuts added yet, show a small help message how to add shortcuts
-                       $title = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:toolbarItems.bookmarks', TRUE);
-                       $icon = t3lib_iconWorks::getSpriteIcon('actions-system-shortcut-new', array(
-                               'title' => $title
-                       ));
-                       $label = str_replace('%icon%', $icon, $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_misc.php:bookmarkDescription'));
-
-                       $shortcutMenu[] = '<tr><td style="padding:1px 2px; color: #838383;">' . $label . '</td></tr>';
-               }
-
-               $shortcutMenu[] = '</table>';
-
-               $compiledShortcutMenu = implode(LF, $shortcutMenu);
-
-               return $compiledShortcutMenu;
-       }
-
-       /**
-        * Renders the menu so that it can be returned as response to an AJAX call
-        *
-        * @param array $params Array of parameters from the AJAX interface, currently unused
-        * @param TYPO3AJAX $ajaxObj Object of type TYPO3AJAX
-        * @return void
-        */
-       public function renderAjax($params = array(), TYPO3AJAX &$ajaxObj = NULL) {
-               $menuContent = $this->renderMenu();
-
-               $ajaxObj->addContent('shortcutMenu', $menuContent);
-       }
-
-       /**
-        * Adds the necessary JavaScript to the backend
-        *
-        * @return void
-        */
-       protected function addJavascriptToBackend() {
-               $this->backendReference->addJavascriptFile('js/shortcutmenu.js');
-       }
-
-       /**
-        * Returns additional attributes for the list item in the toolbar
-        *
-        * @return string List item HTML attibutes
-        */
-       public function getAdditionalAttributes() {
-               return ' id="shortcut-menu"';
-       }
-
-       /**
-        * Retrieves the shortcuts for the current user
-        *
-        * @return array Array of shortcuts
-        */
-       protected function initShortcuts() {
-               $shortcuts    = array();
-               $globalGroups = $this->getGlobalShortcutGroups();
-
-               $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
-                       '*',
-                       'sys_be_shortcuts',
-                       '((userid = ' . $GLOBALS['BE_USER']->user['uid'] . ' AND sc_group>=0) OR sc_group IN (' . implode(',', array_keys($globalGroups)) . '))',
-                       '',
-                       'sc_group,sorting'
-               );
-
-                       // Traverse shortcuts
-               while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
-                       $shortcut             = array('raw' => $row);
-                       $moduleParts          = explode('|', $row['module_name']);
-                       $row['module_name']   = $moduleParts[0];
-                       $row['M_module_name'] = $moduleParts[1];
-                       $moduleParts          = explode('_', $row['M_module_name'] ?
-                               $row['M_module_name'] :
-                               $row['module_name']
-                       );
-                       $queryParts           = parse_url($row['url']);
-                       $queryParameters      = t3lib_div::explodeUrl2Array($queryParts['query'], 1);
-
-                       if ($row['module_name'] == 'xMOD_alt_doc.php' && is_array($queryParameters['edit'])) {
-                               $shortcut['table']    = key($queryParameters['edit']);
-                               $shortcut['recordid'] = key($queryParameters['edit'][$shortcut['table']]);
-
-                               if ($queryParameters['edit'][$shortcut['table']][$shortcut['recordid']] == 'edit') {
-                                       $shortcut['type'] = 'edit';
-                               } elseif ($queryParameters['edit'][$shortcut['table']][$shortcut['recordid']] == 'new') {
-                                       $shortcut['type'] = 'new';
-                               }
-
-                               if (substr($shortcut['recordid'], -1) == ',') {
-                                       $shortcut['recordid'] = substr($shortcut['recordid'], 0, -1);
-                               }
-                       } else {
-                               $shortcut['type'] = 'other';
-                       }
-
-                               // Check for module access
-                       $pageId = $this->getLinkedPageId($row['url']);
-                       if (!$GLOBALS['BE_USER']->isAdmin()) {
-                               if (!isset($GLOBALS['LANG']->moduleLabels['tabs_images'][implode('_', $moduleParts).'_tab'])) {
-                                               // Nice hack to check if the user has access to this module
-                                               // - otherwise the translation label would not have been loaded :-)
-                                       continue;
-                               }
-
-                               if (t3lib_utility_Math::canBeInterpretedAsInteger($pageId)) {
-                                               // Check for webmount access
-                                       if (!$GLOBALS['BE_USER']->isInWebMount($pageId)) {
-                                               continue;
-                                       }
-
-                                               // Check for record access
-                                       $pageRow = t3lib_BEfunc::getRecord('pages', $pageId);
-                                       if (!$GLOBALS['BE_USER']->doesUserHaveAccess($pageRow, $perms = 1)) {
-                                               continue;
-                                       }
-                               }
-                       }
-
-                       $shortcutGroup = $row['sc_group'];
-                       if ($shortcutGroup && strcmp($lastGroup, $shortcutGroup) && ($shortcutGroup != -100)) {
-                               $shortcut['groupLabel'] = $this->getShortcutGroupLabel($shortcutGroup);
-                       }
-
-                       if ($row['description']) {
-                               $shortcut['label'] = $row['description'];
-                       } else {
-                               $shortcut['label'] = t3lib_div::fixed_lgd_cs(rawurldecode($queryParts['query']), 150);
-                       }
-
-                       $shortcut['group']     = $shortcutGroup;
-                       $shortcut['icon']      = $this->getShortcutIcon($row, $shortcut);
-                       $shortcut['iconTitle'] = $this->getShortcutIconTitle($shortcutLabel, $row['module_name'], $row['M_module_name']);
-                       $shortcut['action']    = 'jump(unescape(\'' . rawurlencode($row['url']) . '\'),\'' . implode('_', $moduleParts) . '\',\'' . $moduleParts[0] . '\', ' . intval($pageId) . ');';
-
-                       $lastGroup   = $row['sc_group'];
-                       $shortcuts[] = $shortcut;
-               }
-
-               return $shortcuts;
-       }
-
-       /**
-        * Gets shortcuts for a specific group
-        *
-        * @param integer $groupId Group Id
-        * @return array Array of shortcuts that matched the group
-        */
-       protected function getShortcutsByGroup($groupId) {
-               $shortcuts = array();
-
-               foreach ($this->shortcuts as $shortcut) {
-                       if ($shortcut['group'] == $groupId) {
-                               $shortcuts[] = $shortcut;
-                       }
-               }
-
-               return $shortcuts;
-       }
-
-       /**
-        * Gets a shortcut by its uid
-        *
-        * @param integer $shortcutId Shortcut id to get the complete shortcut for
-        * @return mixed An array containing the shortcut's data on success or FALSE on failure
-        */
-       protected function getShortcutById($shortcutId) {
-               $returnShortcut = FALSE;
-
-               foreach ($this->shortcuts as $shortcut) {
-                       if ($shortcut['raw']['uid'] == (int) $shortcutId) {
-                               $returnShortcut = $shortcut;
-                               continue;
-                       }
-               }
-
-               return $returnShortcut;
-       }
-
-       /**
-        * Gets the available shortcut groups from default gropups, user TSConfig,
-        * and global groups
-        *
-        * @param array $params Array of parameters from the AJAX interface, currently unused
-        * @param TYPO3AJAX $ajaxObj Object of type TYPO3AJAX
-        * @return array
-        */
-       protected function initShortcutGroups($params = array(), TYPO3AJAX &$ajaxObj = NULL) {
-                       // Groups from TSConfig
-               $bookmarkGroups = $GLOBALS['BE_USER']->getTSConfigProp('options.bookmarkGroups');
-
-               if (is_array($bookmarkGroups) && count($bookmarkGroups)) {
-                       foreach ($bookmarkGroups as $groupId => $label) {
-                               if (strcmp('', $label) && strcmp('0', $label)) {
-                                       $this->shortcutGroups[$groupId] = (string) $label;
-                               } elseif ($GLOBALS['BE_USER']->isAdmin()) {
-                                       unset($this->shortcutGroups[$groupId]);
-                               }
-                       }
-               }
-
-                       // Generate global groups, all global groups have negative IDs.
-               if (count($this->shortcutGroups)) {
-                       $groups = $this->shortcutGroups;
-                       foreach ($groups as $groupId => $groupLabel) {
-                               $this->shortcutGroups[($groupId * -1)] = $groupLabel;
-                       }
-               }
-
-                       // Group -100 is kind of superglobal and can't be changed.
-               $this->shortcutGroups[-100] = 1;
-
-                       // Add labels
-               foreach ($this->shortcutGroups as $groupId => $groupLabel) {
-                       $label = $groupLabel;
-
-                       if ($groupLabel == '1') {
-                               $label = $GLOBALS['LANG']->getLL('bookmark_group_'.abs($groupId), 1);
-
-                               if (empty($label)) {
-                                               // Fallback label
-                                       $label = $GLOBALS['LANG']->getLL('bookmark_group', 1).' '.abs($groupId);
-                               }
-                       }
-
-                       if ($groupId < 0) {
-                                       // Global group
-                               $label = $GLOBALS['LANG']->getLL('bookmark_global', 1).': '.
-                                       (!empty($label) ?
-                                               $label :
-                                               abs($groupId)
-                                       );
-
-                               if ($groupId == -100) {
-                                       $label = $GLOBALS['LANG']->getLL('bookmark_global', 1) . ': ' . $GLOBALS['LANG']->getLL('bookmark_all', 1);
-                               }
-                       }
-
-                       $this->shortcutGroups[$groupId] = $label;
-               }
-
-               return $this->shortcutGroups;
-       }
-
-       /**
-        * gets the available shortcut groups
-        *
-        * @param array $params Array of parameters from the AJAX interface, currently unused
-        * @param TYPO3AJAX $ajaxObj Object of type TYPO3AJAX
-        * @return void
-        */
-       public function getAjaxShortcutGroups($params = array(), TYPO3AJAX &$ajaxObj = NULL) {
-               $shortcutGroups = $this->shortcutGroups;
-
-               if (!$GLOBALS['BE_USER']->isAdmin()) {
-                       foreach ($shortcutGroups as $groupId => $groupName) {
-                               if (intval($groupId) < 0) {
-                                       unset($shortcutGroups[$groupId]);
-                               }
-                       }
-               }
-
-               $ajaxObj->addContent('shortcutGroups', $shortcutGroups);
-               $ajaxObj->setContentFormat('json');
-       }
-
-       /**
-        * Deletes a shortcut through an AJAX call
-        *
-        * @param array $params Array of parameters from the AJAX interface, currently unused
-        * @param TYPO3AJAX $ajaxObj Object of type TYPO3AJAX
-        * @return void
-        */
-       public function deleteAjaxShortcut($params = array(), TYPO3AJAX &$ajaxObj = NULL) {
-               $shortcutId   = (int) t3lib_div::_POST('shortcutId');
-               $fullShortcut = $this->getShortcutById($shortcutId);
-               $ajaxReturn   = 'failed';
-
-               if ($fullShortcut['raw']['userid'] == $GLOBALS['BE_USER']->user['uid']) {
-                       $GLOBALS['TYPO3_DB']->exec_DELETEquery(
-                               'sys_be_shortcuts',
-                               'uid = ' . $shortcutId
-                       );
-
-                       if ($GLOBALS['TYPO3_DB']->sql_affected_rows() == 1) {
-                               $ajaxReturn = 'deleted';
-                       }
-               }
-
-               $ajaxObj->addContent('delete', $ajaxReturn);
-       }
-
-       /**
-        * Creates a shortcut through an AJAX call
-        *
-        * @param array $params Array of parameters from the AJAX interface, currently unused
-        * @param TYPO3AJAX $ajaxObj Oject of type TYPO3AJAX
-        * @return void
-        */
-       public function createAjaxShortcut($params = array(), TYPO3AJAX &$ajaxObj = NULL) {
-               $shortcutCreated     = 'failed';
-                       // Default name
-               $shortcutName        = 'Shortcut';
-               $shortcutNamePrepend = '';
-
-               $url             = t3lib_div::_POST('url');
-               $module          = t3lib_div::_POST('module');
-               $motherModule    = t3lib_div::_POST('motherModName');
-
-                       // Determine shortcut type
-               $queryParts      = parse_url($url);
-               $queryParameters = t3lib_div::explodeUrl2Array($queryParts['query'], 1);
-
-                       // Proceed only if no scheme is defined, as URL is expected to be relative
-               if (empty($queryParts['scheme'])) {
-                       if (is_array($queryParameters['edit'])) {
-                               $shortcut['table']    = key($queryParameters['edit']);
-                               $shortcut['recordid'] = key($queryParameters['edit'][$shortcut['table']]);
-
-                               if ($queryParameters['edit'][$shortcut['table']][$shortcut['recordid']] == 'edit') {
-                                       $shortcut['type']    = 'edit';
-                                       $shortcutNamePrepend = $GLOBALS['LANG']->getLL('shortcut_edit', 1);
-                               } elseif ($queryParameters['edit'][$shortcut['table']][$shortcut['recordid']] == 'new') {
-                                       $shortcut['type']    = 'new';
-                                       $shortcutNamePrepend = $GLOBALS['LANG']->getLL('shortcut_create', 1);
-                               }
-                       } else {
-                               $shortcut['type'] = 'other';
-                       }
-
-                               // Lookup the title of this page and use it as default description
-                       $pageId = $shortcut['recordid'] ? $shortcut['recordid'] : $this->getLinkedPageId($url);
-
-                       if (t3lib_utility_Math::canBeInterpretedAsInteger($pageId)) {
-                               $page = t3lib_BEfunc::getRecord('pages', $pageId);
-                               if (count($page)) {
-                                               // Set the name to the title of the page
-                                       if ($shortcut['type'] == 'other') {
-                                               $shortcutName = $page['title'];
-                                       } else {
-                                               $shortcutName = $shortcutNamePrepend.' ' . $GLOBALS['LANG']->sL($GLOBALS['TCA'][$shortcut['table']]['ctrl']['title']) . ' (' . $page['title'] . ')';
-                                       }
-                               }
-                       } else {
-                               $dirName = urldecode($pageId);
-                               if (preg_match('/\/$/', $dirName)) {
-                                               // If $pageId is a string and ends with a slash,
-                                               // assume it is a fileadmin reference and set
-                                               // the description to the basename of that path
-                                       $shortcutName .= ' ' . basename($dirName);
-                               }
-                       }
-
-                               // adding the shortcut
-                       if ($module && $url) {
-                               $fieldValues = array(
-                                       'userid'      => $GLOBALS['BE_USER']->user['uid'],
-                                       'module_name' => $module . '|' . $motherModule,
-                                       'url'         => $url,
-                                       'description' => $shortcutName,
-                                       'sorting'     => $GLOBALS['EXEC_TIME'],
-                               );
-                               $GLOBALS['TYPO3_DB']->exec_INSERTquery('sys_be_shortcuts', $fieldValues);
-
-                               if ($GLOBALS['TYPO3_DB']->sql_affected_rows() == 1) {
-                                       $shortcutCreated = 'success';
-                               }
-                       }
-
-                       $ajaxObj->addContent('create', $shortcutCreated);
-               }
-       }
-
-       /**
-        * Gets called when a shortcut is changed, checks whether the user has
-        * permissions to do so and saves the changes if everything is ok
-        *
-        * @param array $params Array of parameters from the AJAX interface, currently unused
-        * @param TYPO3AJAX $ajaxObj Object of type TYPO3AJAX
-        * @return void
-        */
-       public function setAjaxShortcut($params = array(), TYPO3AJAX &$ajaxObj = NULL) {
-
-               $shortcutId      = (int) t3lib_div::_POST('shortcutId');
-               $shortcutName    = strip_tags(t3lib_div::_POST('value'));
-               $shortcutGroupId = (int) t3lib_div::_POST('shortcut-group');
-
-               if ($shortcutGroupId > 0 || $GLOBALS['BE_USER']->isAdmin()) {
-                               // Users can delete only their own shortcuts (except admins)
-                       $addUserWhere = (!$GLOBALS['BE_USER']->isAdmin() ?
-                               ' AND userid='.intval($GLOBALS['BE_USER']->user['uid'])
-                               : ''
-                       );
-
-                       $fieldValues = array(
-                               'description' => $shortcutName,
-                               'sc_group'    => $shortcutGroupId
-                       );
-
-                       if ($fieldValues['sc_group'] < 0 && !$GLOBALS['BE_USER']->isAdmin()) {
-                               $fieldValues['sc_group'] = 0;
-                       }
-
-                       $GLOBALS['TYPO3_DB']->exec_UPDATEquery(
-                               'sys_be_shortcuts',
-                               'uid=' . $shortcutId . $addUserWhere,
-                               $fieldValues
-                       );
-
-                       $affectedRows = $GLOBALS['TYPO3_DB']->sql_affected_rows();
-                       if ($affectedRows == 1) {
-                               $ajaxObj->addContent('shortcut', $shortcutName);
-                       } else {
-                               $ajaxObj->addContent('shortcut', 'failed');
-                       }
-               }
-
-               $ajaxObj->setContentFormat('plain');
-       }
-
-       /**
-        * Gets the label for a shortcut group
-        *
-        * @param integer $groupId A shortcut group id
-        * @return string The shortcut group label, can be an empty string if no group was found for the id
-        */
-       protected function getShortcutGroupLabel($groupId) {
-               $label = '';
-
-               if ($this->shortcutGroups[$groupId]) {
-                       $label = $this->shortcutGroups[$groupId];
-               }
-
-               return $label;
-       }
-
-       /**
-        * Gets a list of global groups, shortcuts in these groups are available to all users
-        *
-        * @return array Array of global groups
-        */
-       protected function getGlobalShortcutGroups() {
-               $globalGroups = array();
-
-               foreach ($this->shortcutGroups as $groupId => $groupLabel) {
-                       if ($groupId < 0) {
-                               $globalGroups[$groupId] = $groupLabel;
-                       }
-               }
-
-               return $globalGroups;
-       }
-
-       /**
-        * runs through the available shortcuts an collects their groups
-        *
-        * @return array Array of groups which have shortcuts
-        */
-       protected function getGroupsFromShortcuts() {
-               $groups = array();
-
-               foreach ($this->shortcuts as $shortcut) {
-                       $groups[$shortcut['group']] = $this->shortcutGroups[$shortcut['group']];
-               }
-
-               return array_unique($groups);
-       }
-
-       /**
-        * Gets the icon for the shortcut
-        *
-        * @param array $row
-        * @param array $shortcut
-        * @return string Shortcut icon as img tag
-        */
-       protected function getShortcutIcon($row, $shortcut) {
-               switch ($row['module_name']) {
-                       case 'xMOD_alt_doc.php':
-                               $table                          = $shortcut['table'];
-                               $recordid                       = $shortcut['recordid'];
-
-                               if ($shortcut['type'] == 'edit') {
-                                               // Creating the list of fields to include in the SQL query:
-                                       $selectFields = $this->fieldArray;
-                                       $selectFields[] = 'uid';
-                                       $selectFields[] = 'pid';
-
-                                       if ($table=='pages') {
-                                               if (t3lib_extMgm::isLoaded('cms')) {
-                                                       $selectFields[] = 'module';
-                                                       $selectFields[] = 'extendToSubpages';
-                                               }
-                                               $selectFields[] = 'doktype';
-                                       }
-
-                                       if (is_array($GLOBALS['TCA'][$table]['ctrl']['enablecolumns'])) {
-                                               $selectFields = array_merge($selectFields, $GLOBALS['TCA'][$table]['ctrl']['enablecolumns']);
-                                       }
-
-                                       if ($GLOBALS['TCA'][$table]['ctrl']['type']) {
-                                               $selectFields[] = $GLOBALS['TCA'][$table]['ctrl']['type'];
-                                       }
-
-                                       if ($GLOBALS['TCA'][$table]['ctrl']['typeicon_column']) {
-                                               $selectFields[] = $GLOBALS['TCA'][$table]['ctrl']['typeicon_column'];
-                                       }
-
-                                       if ($GLOBALS['TCA'][$table]['ctrl']['versioningWS']) {
-                                               $selectFields[] = 't3ver_state';
-                                       }
-
-                                               // Unique list!
-                                       $selectFields     = array_unique($selectFields);
-                                       $permissionClause = ($table=='pages' && $this->perms_clause) ?
-                                               ' AND ' . $this->perms_clause :
-                                               '';
-
-                                       $sqlQueryParts = array(
-                                               'SELECT' => implode(',', $selectFields),
-                                               'FROM'   => $table,
-                                               'WHERE'  => 'uid IN (' . $recordid . ') ' . $permissionClause .
-                                               t3lib_BEfunc::deleteClause($table) .
-                                               t3lib_BEfunc::versioningPlaceholderClause($table)
-                                       );
-                                       $result = $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($sqlQueryParts);
-                                       $row    = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result);
-
-                                       $icon = t3lib_iconWorks::getIcon($table, $row, $this->backPath);
-                               } elseif ($shortcut['type'] == 'new') {
-                                       $icon = t3lib_iconWorks::getIcon($table, '', $this->backPath);
-                               }
-
-                               $icon = t3lib_iconWorks::skinImg($this->backPath, $icon, '', 1);
-                               break;
-                       case 'xMOD_file_edit.php':
-                               $icon = 'gfx/edit_file.gif';
-                               break;
-                       case 'xMOD_wizard_rte.php':
-                               $icon = 'gfx/edit_rtewiz.gif';
-                               break;
-                       default:
-                               if ($GLOBALS['LANG']->moduleLabels['tabs_images'][$row['module_name'].'_tab']) {
-                                       $icon = $GLOBALS['LANG']->moduleLabels['tabs_images'][$row['module_name'].'_tab'];
-
-                                               // Change icon of fileadmin references - otherwise it doesn't differ with Web->List
-                                       $icon = str_replace('mod/file/list/list.gif', 'mod/file/file.gif', $icon);
-
-                                       if (t3lib_div::isAbsPath($icon)) {
-                                               $icon = '../'.substr($icon, strlen(PATH_site));
-                                       }
-                               } else {
-                                       $icon = 'gfx/dummy_module.gif';
-                               }
-               }
-
-               return '<img src="' . $icon . '" alt="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:toolbarItems.shortcut', TRUE) . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:toolbarItems.shortcut', TRUE) . '" />';
-       }
-
-       /**
-        * Returns title for the shortcut icon
-        *
-        * @param string $shortcutLabel Shortcut label
-        * @param string $moduleName Backend module name (key)
-        * @param string $parentModuleName Parent module label
-        * @return string Title for the shortcut icon
-        */
-       protected function getShortcutIconTitle($shortcutLabel, $moduleName, $parentModuleName = '') {
-               $title = '';
-
-               if (substr($moduleName, 0, 5) == 'xMOD_') {
-                       $title = substr($moduleName, 5);
-               } else {
-                       $splitModuleName = explode('_', $moduleName);
-                       $title = $GLOBALS['LANG']->moduleLabels['tabs'][$splitModuleName[0].'_tab'];
-
-                       if (count($splitModuleName) > 1) {
-                               $title .= '>' . $GLOBALS['LANG']->moduleLabels['tabs'][$moduleName . '_tab'];
-                       }
-               }
-
-               if ($parentModuleName) {
-                       $title .= ' (' . $parentModuleName . ')';
-               }
-
-               $title .= ': ' . $shortcutLabel;
-
-               return $title;
-       }
-
-       /**
-        * Return the ID of the page in the URL if found.
-        *
-        * @param string $url The URL of the current shortcut link
-        * @return string If a page ID was found, it is returned. Otherwise: 0
-        */
-       protected function getLinkedPageId($url) {
-               return preg_replace('/.*[\?&]id=([^&]+).*/', '$1', $url);
-       }
-
-}
-?>
\ No newline at end of file
diff --git a/typo3/Classes/class.typo3_tcefile.php b/typo3/Classes/class.typo3_tcefile.php
deleted file mode 100644 (file)
index 56e8076..0000000
+++ /dev/null
@@ -1,177 +0,0 @@
-<?php
-/***************************************************************
-*  Copyright notice
-*
-*  (c) 1999-2011 Kasper Skårhøj (kasperYYYY@typo3.com)
-*  (c) 2009-2011 Benjamin Mack (benni.typo3.org)
-*  All rights reserved
-*
-*  This script is part of the TYPO3 project. The TYPO3 project is
-*  free software; you can redistribute it and/or modify
-*  it under the terms of the GNU General Public License as published by
-*  the Free Software Foundation; either version 2 of the License, or
-*  (at your option) any later version.
-*
-*  The GNU General Public License can be found at
-*  http://www.gnu.org/copyleft/gpl.html.
-*  A copy is found in the textfile GPL.txt and important notices to the license
-*  from the author is found in LICENSE.txt distributed with these scripts.
-*
-*
-*  This script is distributed in the hope that it will be useful,
-*  but WITHOUT ANY WARRANTY; without even the implied warranty of
-*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-*  GNU General Public License for more details.
-*
-*  This copyright notice MUST APPEAR in all copies of the script!
-***************************************************************/
-/**
- * Gateway for TCE (TYPO3 Core Engine) file-handling through POST forms.
- * This script serves as the fileadministration part of the TYPO3 Core Engine.
- * Basically it includes two libraries which are used to manipulate files on the server.
- * Before TYPO3 4.3, it was located in typo3/tce_file.php and redirected back to a
- * $redirectURL. Since 4.3 this class is also used for accessing via AJAX
- *
- *
- * For syntax and API information, see the document 'TYPO3 Core APIs'
- *
- * Revised for TYPO3 3.6 July/2003 by Kasper Skårhøj
- * Revised for TYPO3 4.3 Mar/2009 by Benjamin Mack
- *
- * @author Kasper Skårhøj <kasperYYYY@typo3.com>
- */
-
-require_once(PATH_typo3 . 'template.php');
-
-/**
- * Script Class, handling the calling of methods in the file admin classes.
- *
- * @author Kasper Skårhøj <kasperYYYY@typo3.com>
- * @package TYPO3
- * @subpackage core
- */
-class TYPO3_tcefile {
-
-               // Internal, static: GPvar:
-               // Array of file-operations.
-       protected $file;
-               // Clipboard operations array
-       protected $CB;
-               // If existing files should be overridden.
-       protected $overwriteExistingFiles;
-               // VeriCode - a hash of server specific value and other things which
-               // identifies if a submission is OK. (see $GLOBALS['BE_USER']->veriCode())
-       protected $vC;
-               // the page where the user should be redirected after everything is done
-       protected $redirect;
-
-               // Internal, dynamic:
-               // File processor object
-       protected $fileProcessor;
-               // the result array from the file processor
-       protected $fileData;
-
-       /**
-        * Registering incoming data
-        *
-        * @return void
-        */
-       public function init() {
-                       // Set the GPvars from outside
-               $this->file = t3lib_div::_GP('file');
-               $this->CB = t3lib_div::_GP('CB');
-               $this->overwriteExistingFiles = t3lib_div::_GP('overwriteExistingFiles');
-               $this->vC = t3lib_div::_GP('vC');
-               $this->redirect = t3lib_div::sanitizeLocalUrl(t3lib_div::_GP('redirect'));
-
-               $this->initClipboard();
-       }
-
-       /**
-        * Initialize the Clipboard. This will fetch the data about files to paste/delete if such an action has been sent.
-        *
-        * @return void
-        */
-       public function initClipboard() {
-               if (is_array($this->CB)) {
-                       $clipObj = t3lib_div::makeInstance('t3lib_clipboard');
-                       $clipObj->initializeClipboard();
-                       if ($this->CB['paste']) {
-                               $clipObj->setCurrentPad($this->CB['pad']);
-                               $this->file = $clipObj->makePasteCmdArray_file($this->CB['paste'], $this->file);
-                       }
-                       if ($this->CB['delete']) {
-                               $clipObj->setCurrentPad($this->CB['pad']);
-                               $this->file = $clipObj->makeDeleteCmdArray_file($this->file);
-                       }
-               }
-       }
-
-       /**
-        * Performing the file admin action:
-        * Initializes the objects, setting permissions, sending data to object.
-        *
-        * @return void
-        */
-       public function main() {
-                       // Initializing:
-               $this->fileProcessor = t3lib_div::makeInstance('t3lib_extFileFunctions');
-               $this->fileProcessor->init($GLOBALS['FILEMOUNTS'], $GLOBALS['TYPO3_CONF_VARS']['BE']['fileExtensions']);
-               $this->fileProcessor->init_actionPerms($GLOBALS['BE_USER']->getFileoperationPermissions());
-               $this->fileProcessor->dontCheckForUnique = ($this->overwriteExistingFiles ? 1 : 0);
-
-                       // Checking referer / executing:
-               $refInfo = parse_url(t3lib_div::getIndpEnv('HTTP_REFERER'));
-               $httpHost = t3lib_div::getIndpEnv('TYPO3_HOST_ONLY');
-               if ($httpHost != $refInfo['host']
-                       && $this->vC != $GLOBALS['BE_USER']->veriCode()
-                       && !$GLOBALS['TYPO3_CONF_VARS']['SYS']['doNotCheckReferer']
-                       && $GLOBALS['CLIENT']['BROWSER'] != 'flash') {
-                       $this->fileProcessor->writeLog(0, 2, 1, 'Referer host "%s" and server host "%s" did not match!', array($refInfo['host'], $httpHost));
-               } else {
-                       $this->fileProcessor->start($this->file);
-                       $this->fileData = $this->fileProcessor->processData();
-               }
-       }
-
-       /**
-        * Redirecting the user after the processing has been done.
-        * Might also display error messages directly, if any.
-        *
-        * @return void
-        */
-       public function finish() {
-                       // Prints errors, if there are any
-               $this->fileProcessor->printLogErrorMessages($this->redirect);
-               t3lib_BEfunc::setUpdateSignal('updateFolderTree');
-               if ($this->redirect) {
-                       t3lib_utility_Http::redirect($this->redirect);
-               }
-       }
-
-       /**
-        * Handles the actual process from within the ajaxExec function
-        * therefore, it does exactly the same as the real typo3/tce_file.php
-        * but without calling the "finish" method, thus makes it simpler to deal with the
-        * actual return value
-        *
-        * @param array $params Always empty.
-        * @param TYPO3AJAX $ajaxObj The Ajax object used to return content and set content types
-        * @return void
-        */
-       public function processAjaxRequest(array $params, TYPO3AJAX $ajaxObj) {
-               $this->init();
-               $this->main();
-               $errors = $this->fileProcessor->getErrorMessages();
-               if (count($errors)) {
-                       $ajaxObj->setError(implode(',', $errors));
-               } else {
-                       $ajaxObj->addContent('result', $this->fileData);
-                       if ($this->redirect) {
-                               $ajaxObj->addContent('redirect', $this->redirect);
-                       }
-                       $ajaxObj->setContentFormat('json');
-               }
-       }
-}
-?>
\ No newline at end of file
diff --git a/typo3/Classes/class.typo3ajax.php b/typo3/Classes/class.typo3ajax.php
deleted file mode 100644 (file)
index 5184f8c..0000000
+++ /dev/null
@@ -1,293 +0,0 @@
-<?php
-/***************************************************************
-*  Copyright notice
-*
-*  (c) 2008-2011 Benjamin Mack <mack@xnos.org>
-*  All rights reserved
-*
-*  This script is part of the TYPO3 project. The TYPO3 project is
-*  free software; you can redistribute it and/or modify
-*  it under the terms of the GNU General Public License as published by
-*  the Free Software Foundation; either version 2 of the License, or
-*  (at your option) any later version.
-*
-*  The GNU General Public License can be found at
-*  http://www.gnu.org/copyleft/gpl.html.
-*  A copy is found in the textfile GPL.txt and important notices to the license
-*  from the author is found in LICENSE.txt distributed with these scripts.
-*
-*
-*  This script is distributed in the hope that it will be useful,
-*  but WITHOUT ANY WARRANTY; without even the implied warranty of
-*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-*  GNU General Public License for more details.
-*
-*  This copyright notice MUST APPEAR in all copies of the script!
-***************************************************************/
-
-/**
- * Class to hold all the information about an AJAX call and send
- * the right headers for the request type
- *
- * @author Benjamin Mack <mack@xnos.org>
- * @package TYPO3
- * @subpackage core
- */
-class TYPO3AJAX {
-       protected $ajaxId        = NULL;
-       protected $errorMessage  = NULL;
-       protected $isError       = FALSE;
-       protected $content       = array();
-       protected $contentFormat = 'plain';
-       protected $charset       = 'utf-8';
-       protected $requestCharset = 'utf-8';
-       protected $javascriptCallbackWrap = '
-               <script type="text/javascript">
-                       /*<![CDATA[*/
-                       response = |;
-                       /*]]>*/
-               </script>
-       ';
-
-       /**
-        * Sets the charset and the ID for the AJAX call
-        * due to some charset limitations in Javascript (prototype uses encodeURIcomponent, which converts
-        * all data to utf-8), we need to detect if the encoding of the request differs from the
-        * backend encoding, and then convert all incoming data (_GET and _POST)
-        * in the expected backend encoding.
-        *
-        * @param string $ajaxId The AJAX id
-        */
-       public function __construct($ajaxId) {
-
-                       // Get charset from current AJAX request (which is expected to be utf-8)
-               preg_match('/;\s*charset\s*=\s*([a-zA-Z0-9_-]*)/i', $_SERVER['CONTENT_TYPE'], $contenttype);
-               $charset = $GLOBALS['LANG']->csConvObj->parse_charset($contenttype[1]);
-               if ($charset && $charset != $this->requestCharset) {
-                       $this->requestCharset = $charset;
-               }
-
-                       // If the AJAX request does not have the same encoding like the backend
-                       // we need to convert the POST and GET parameters in the right charset
-               if ($this->charset != $this->requestCharset) {
-                       $GLOBALS['LANG']->csConvObj->convArray($_POST, $this->requestCharset, $this->charset);
-                       $GLOBALS['LANG']->csConvObj->convArray($_GET, $this->requestCharset, $this->charset);
-               }
-
-               $this->ajaxId = $ajaxId;
-       }
-
-       /**
-        * Returns the ID for the AJAX call
-        *
-        * @return string The AJAX id
-        */
-       public function getAjaxID() {
-               return $this->ajaxId;
-       }
-
-       /**
-        * Overwrites the existing content with the first parameter
-        *
-        * @param array $content The new content
-        * @return mixed The old content as array; if the new content was not an array, FALSE is returned
-        */
-       public function setContent($content) {
-               $oldcontent = FALSE;
-               if (is_array($content)) {
-                       $oldcontent = $this->content;
-                       $this->content = $content;
-               }
-               return $oldcontent;
-       }
-
-       /**
-        * Adds new content
-        *
-        * @param string $key The new content key where the content should be added in the content array
-        * @param string $content The new content to add
-        * @return mixed The old content; if the old content didn't exist before, FALSE is returned
-        */
-       public function addContent($key, $content) {
-               $oldcontent = FALSE;
-               if (array_key_exists($key, $this->content)) {
-                       $oldcontent = $this->content[$key];
-               }
-               if (!isset($content) || empty($content)) {
-                       unset($this->content[$key]);
-               } elseif (!isset($key) || empty($key)) {
-                       $this->content[] = $content;
-               } else {
-                       $this->content[$key] = $content;
-               }
-               return $oldcontent;
-       }
-
-       /**
-        * Returns the content for the ajax call
-        *
-        * @return mixed The content for a specific key or the whole content
-        */
-       public function getContent($key = '') {
-               return ($key && array_key_exists($key, $this->content) ? $this->content[$key] : $this->content);
-       }
-
-       /**
-        * Sets the content format for the ajax call
-        *
-        * @param string $format Can be one of 'plain' (default), 'xml', 'json', 'javascript', 'jsonbody' or 'jsonhead'
-        * @return void
-        */
-       public function setContentFormat($format) {
-               if (t3lib_div::inArray(array('plain', 'xml', 'json', 'jsonhead', 'jsonbody', 'javascript'), $format)) {
-                       $this->contentFormat = $format;
-               }
-       }
-
-       /**
-        * Specifies the wrap to be used if contentFormat is "javascript".
-        * The wrap used by default stores the results in a variable "response" and
-        * adds <script>-Tags around it.
-        *
-        * @param string $javascriptCallbackWrap The javascript callback wrap to be used
-        * @return void
-        */
-       public function setJavascriptCallbackWrap($javascriptCallbackWrap) {
-               $this->javascriptCallbackWrap = $javascriptCallbackWrap;
-       }
-
-       /**
-        * Sets an error message and the error flag
-        *
-        * @param string $errorMsg The error message
-        * @return void
-        */
-       public function setError($errorMsg = '') {
-               $this->errorMessage = $errorMsg;
-               $this->isError = TRUE;
-       }
-
-       /**
-        * Checks whether an error occured during the execution or not
-        *
-        * @return boolean Whether this AJAX call had errors
-        */
-       public function isError() {
-               return $this->isError;
-       }
-
-       /**
-        * Renders the AJAX call based on the $contentFormat variable and exits the request
-        *
-        * @return void
-        */
-       public function render() {
-               if ($this->isError) {
-                       $this->renderAsError();
-                       exit;
-               }
-               switch ($this->contentFormat) {
-                       case 'jsonhead':
-                       case 'jsonbody':
-                       case 'json':
-                               $this->renderAsJSON();
-                               break;
-                       case 'javascript':
-                               $this->renderAsJavascript();
-                               break;
-                       case 'xml':
-                               $this->renderAsXML();
-                               break;
-                       default:
-                               $this->renderAsPlain();
-               }
-               exit;
-       }
-
-       /**
-        * Renders the AJAX call in XML error style to handle with JS
-        * the "responseXML" of the transport object will be filled with the error message then
-        *
-        * @return void
-        */
-       protected function renderAsError() {
-               header(t3lib_utility_Http::HTTP_STATUS_500 . ' (AJAX)');
-               header('Content-type: text/xml; charset=' . $this->charset);
-               header('X-JSON: false');
-               die('<t3err>'.htmlspecialchars($this->errorMessage).'</t3err>');
-       }
-
-       /**
-        * Renders the AJAX call with text/html headers
-        * the content will be available in the "responseText" value of the transport object
-        *
-        * @return void
-        */
-       protected function renderAsPlain() {
-               header('Content-type: text/html; charset=' . $this->charset);
-               header('X-JSON: true');
-               echo implode('', $this->content);
-       }
-
-       /**
-        * Renders the AJAX call with text/xml headers
-        * the content will be available in the "responseXML" value of the transport object
-        *
-        * @return void
-        */
-       protected function renderAsXML() {
-               header('Content-type: text/xml; charset=' . $this->charset);
-               header('X-JSON: true');
-               echo implode('', $this->content);
-       }
-
-       /**
-        * Renders the AJAX call with JSON evaluated headers
-        * note that you need to have requestHeaders: {Accept: 'application/json'},
-        * in your AJAX options of your AJAX request object in JS
-        *
-        * the content will be available
-        *    - in the second parameter of the onSuccess / onComplete callback (except when contentFormat = 'jsonbody')
-        *    - and in the xhr.responseText as a string (except when contentFormat = 'jsonhead')
-        *         you can evaluate this in JS with xhr.responseText.evalJSON();
-        *
-        * @return void
-        */
-       protected function renderAsJSON() {
-                       // If the backend does not run in UTF-8 then we need to convert it to unicode as
-                       // the json_encode method will return empty otherwise
-               if ($this->charset != $this->requestCharset) {
-                       $GLOBALS['LANG']->csConvObj->convArray($this->content, $this->charset, $this->requestCharset);
-               }
-
-               $content = json_encode($this->content);
-
-               header('Content-type: application/json; charset=' . $this->requestCharset);
-               header('X-JSON: ' . ($this->contentFormat != 'jsonbody' ? $content : TRUE));
-
-                       // Bring content in xhr.responseText except when in "json head only" mode
-               if ($this->contentFormat != 'jsonhead') {
-                       echo $content;
-               }
-       }
-
-       /**
-        * Renders the AJAX call as inline JSON inside a script tag. This is useful
-        * when an iframe is used as the AJAX transport.
-        *
-        * @return void
-        */
-       protected function renderAsJavascript() {
-                       // If the backend does not run in UTF-8 then we need to convert it to unicode as
-                       // the json_encode method will return empty otherwise
-               if ($this->charset != $this->requestCharset) {
-                       $GLOBALS['LANG']->csConvObj->convArray($this->content, $this->charset, $this->requestCharset);
-               }
-
-               $content = str_replace('|', json_encode($this->content), $this->javascriptCallbackWrap);
-
-               header('Content-type: text/html; charset=' . $this->requestCharset);
-               echo $content;
-       }
-}
-?>
\ No newline at end of file
diff --git a/typo3/Classes/class.typo3logo.php b/typo3/Classes/class.typo3logo.php
deleted file mode 100644 (file)
index b29b100..0000000
+++ /dev/null
@@ -1,91 +0,0 @@
-<?php
-/***************************************************************
-*  Copyright notice
-*
-*  (c) 2007-2011 Ingo Renner <ingo@typo3.org>
-*  All rights reserved
-*
-*  This script is part of the TYPO3 project. The TYPO3 project is
-*  free software; you can redistribute it and/or modify
-*  it under the terms of the GNU General Public License as published by
-*  the Free Software Foundation; either version 2 of the License, or
-*  (at your option) any later version.
-*
-*  The GNU General Public License can be found at
-*  http://www.gnu.org/copyleft/gpl.html.
-*  A copy is found in the textfile GPL.txt and important notices to the license
-*  from the author is found in LICENSE.txt distributed with these scripts.
-*
-*
-*  This script is distributed in the hope that it will be useful,
-*  but WITHOUT ANY WARRANTY; without even the implied warranty of
-*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-*  GNU General Public License for more details.
-*
-*  This copyright notice MUST APPEAR in all copies of the script!
-***************************************************************/
-
-/**
- * class to render the TYPO3 logo in the backend
- *
- * @author Ingo Renner <ingo@typo3.org>
- * @package TYPO3
- * @subpackage core
- */
-class TYPO3Logo {
-
-       protected $logo;
-
-       /**
-        * constructor
-        */
-       public function __construct() {
-               $this->logo = NULL;
-       }
-
-       /**
-        * renders the actual logo code
-        *
-        * @return string Logo html code snippet to use in the backend
-        */
-       public function render() {
-
-                       // Default
-               $logoFile = 'gfx/alt_backend_logo.gif';
-               if (is_string($this->logo)) {
-                               // Overwrite
-                       $logoFile = $this->logo;
-               }
-               $imgInfo = getimagesize(PATH_site . TYPO3_mainDir . $logoFile);
-
-
-               $logo = '<a href="' . TYPO3_URL_GENERAL . '" target="_blank">' .
-                               '<img' . t3lib_iconWorks::skinImg('', $logoFile, $imgInfo[3]) . ' title="TYPO3 Content Management System" alt="" />' .
-                               '</a>';
-
-                       // Overwrite with custom logo
-               if ($GLOBALS['TBE_STYLES']['logo']) {
-                       $imgInfo = @getimagesize(t3lib_div::resolveBackPath(PATH_typo3 . $GLOBALS['TBE_STYLES']['logo'], 3));
-                       $logo = '<a href="' . TYPO3_URL_GENERAL . '" target="_blank">' .
-                               '<img src="' . $GLOBALS['TBE_STYLES']['logo'] . '" ' . $imgInfo[3] . ' title="TYPO3 Content Management System" alt="" />' .
-                               '</a>';
-               }
-
-               return $logo;
-       }
-
-       /**
-        * Sets the logo
-        *
-        * @param string $logo Path to logo file as seen from typo3/
-        * @throws InvalidArgumentException
-        */
-       public function setLogo($logo) {
-               if (!is_string($logo)) {
-                       throw new InvalidArgumentException('parameter $logo must be of type string', 1194041104);
-               }
-
-               $this->logo = $logo;
-       }
-}
-?>
\ No newline at end of file
index db4e26f..0197db7 100644 (file)
@@ -56,7 +56,7 @@ if (in_array($ajaxID, $noUserAjaxIDs)) {
 }
 
 require('init.php');
-require('Classes/class.typo3ajax.php');
+require('classes/class.typo3ajax.php');
 
        // finding the script path from the variable
 $ajaxScript = $TYPO3_CONF_VARS['BE']['AJAX'][$ajaxID];
@@ -82,4 +82,4 @@ if (empty($ajaxID)) {
        // Outputting the content (and setting the X-JSON-Header)
 $ajaxObj->render();
 
-?>
+?>
\ No newline at end of file
index 469164e..661af8d 100644 (file)
@@ -29,13 +29,13 @@ require_once('init.php');
 require_once('template.php');
 require_once(PATH_typo3 . 'interfaces/interface.backend_toolbaritem.php');
 
-require('Classes/class.typo3logo.php');
-require('Classes/class.modulemenu.php');
+require('classes/class.typo3logo.php');
+require('classes/class.modulemenu.php');
 
        // Core toolbar items
-require('Classes/class.clearcachemenu.php');
-require('Classes/class.shortcutmenu.php');
-require('Classes/class.livesearch.php');
+require('classes/class.clearcachemenu.php');
+require('classes/class.shortcutmenu.php');
+require('classes/class.livesearch.php');
 
 $GLOBALS['LANG']->includeLLFile('EXT:lang/locallang_misc.xml');
 
diff --git a/typo3/classes/class.ajaxlogin.php b/typo3/classes/class.ajaxlogin.php
new file mode 100644 (file)
index 0000000..88d739d
--- /dev/null
@@ -0,0 +1,166 @@
+ <?php
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2008-2011 Christoph Koehler (christoph@webempoweredchurch.org)
+*  All rights reserved
+*
+*  This script is part of the TYPO3 project. The TYPO3 project is
+*  free software; you can redistribute it and/or modify
+*  it under the terms of the GNU General Public License as published by
+*  the Free Software Foundation; either version 2 of the License, or
+*  (at your option) any later version.
+*
+*  The GNU General Public License can be found at
+*  http://www.gnu.org/copyleft/gpl.html.
+*  A copy is found in the textfile GPL.txt and important notices to the license
+*  from the author is found in LICENSE.txt distributed with these scripts.
+*
+*
+*  This script is distributed in the hope that it will be useful,
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*  GNU General Public License for more details.
+*
+*  This copyright notice MUST APPEAR in all copies of the script!
+***************************************************************/
+/**
+ * This is the ajax handler for backend login after timeout.
+ *
+ * @author Christoph Koehler <christoph@webempoweredchurch.org>
+ */
+class AjaxLogin {
+
+       /**
+        * Handles the actual login process, more specifically it defines the response.
+        * The login details were sent in as part of the ajax request and automatically logged in
+        * the user inside the init.php part of the ajax call. If that was successful, we have
+        * a BE user and reset the timer and hide the login window.
+        * If it was unsuccessful, we display that and show the login box again.
+        *
+        * @param array $parameters Parameters (not used)
+        * @param TYPO3AJAX $ajaxObj The calling parent AJAX object
+        * @return void
+        */
+       public function login(array $parameters, TYPO3AJAX $ajaxObj) {
+               if ($this->isAuthorizedBackendSession()) {
+                       $json = array('success' => TRUE);
+                       if ($this->hasLoginBeenProcessed()) {
+                               $formProtection = t3lib_formprotection_Factory::get();
+                               $formProtection->setSessionTokenFromRegistry();
+                               $formProtection->persistSessionToken();
+                       }
+               } else {
+                       $json = array('success' => FALSE);
+               }
+               $ajaxObj->addContent('login', $json);
+               $ajaxObj->setContentFormat('json');
+       }
+
+       /**
+        * Checks if a user is logged in and the session is active.
+        *
+        * @return boolean
+        */
+       protected function isAuthorizedBackendSession() {
+               return (isset($GLOBALS['BE_USER']) && $GLOBALS['BE_USER'] instanceof t3lib_beUserAuth && isset($GLOBALS['BE_USER']->user['uid']));
+       }
+
+       /**
+        * Check whether the user was already authorized or not
+        *
+        * @return boolean
+        */
+       protected function hasLoginBeenProcessed() {
+               $loginFormData = $GLOBALS['BE_USER']->getLoginFormData();
+
+               return ($loginFormData['status'] == 'login')
+                       && isset($loginFormData['uname'])
+                       && isset($loginFormData['uident'])
+                       && isset($loginFormData['chalvalue'])
+                       && ((string)$_COOKIE[t3lib_beUserAuth::getCookieName()] !== (string)$GLOBALS['BE_USER']->id);
+       }
+
+       /**
+        * Logs out the current BE user
+        *
+        * @param array $parameters Parameters (not used)
+        * @param TYPO3AJAX $ajaxObj The calling parent AJAX object
+        * @return void
+        */
+       public function logout(array $parameters, TYPO3AJAX $ajaxObj) {
+               $GLOBALS['BE_USER']->logoff();
+               if ($GLOBALS['BE_USER']->user['uid']) {
+                       $ajaxObj->addContent('logout', array('success' => FALSE));
+               } else {
+                       $ajaxObj->addContent('logout', array('success' => TRUE));
+               }
+               $ajaxObj->setContentFormat('json');
+       }
+
+       /**
+        * Refreshes the login without needing login information. We just refresh the session.
+        *
+        *
+        * @param array $parameters Parameters (not used)
+        * @param TYPO3AJAX $ajaxObj The calling parent AJAX object
+        * @return void
+        */
+       public function refreshLogin(array $parameters, TYPO3AJAX $ajaxObj) {
+               $GLOBALS['BE_USER']->checkAuthentication();
+               $ajaxObj->addContent('refresh', array('success' => TRUE));
+               $ajaxObj->setContentFormat('json');
+       }
+
+       /**
+        * Checks if the user session is expired yet
+        *
+        * @param array $parameters Parameters (not used)
+        * @param TYPO3AJAX $ajaxObj The calling parent AJAX object
+        * @return void
+        */
+       function isTimedOut(array $parameters, TYPO3AJAX $ajaxObj) {
+               if (is_object($GLOBALS['BE_USER'])) {
+                       $ajaxObj->setContentFormat('json');
+                       if (@is_file(PATH_typo3conf.'LOCK_BACKEND')) {
+                               $ajaxObj->addContent('login', array('will_time_out' => FALSE, 'locked' => TRUE));
+                               $ajaxObj->setContentFormat('json');
+                       } elseif (!isset($GLOBALS['BE_USER']->user['uid'])) {
+                               $ajaxObj->addContent('login', array('timed_out' => TRUE));
+                       } else {
+                               $GLOBALS['BE_USER']->fetchUserSession(TRUE);
+                               $ses_tstamp = $GLOBALS['BE_USER']->user['ses_tstamp'];
+                               $timeout = $GLOBALS['BE_USER']->auth_timeout_field;
+
+                                       // If 120 seconds from now is later than the session timeout, we need to show the refresh dialog.
+                                       // 120 is somewhat arbitrary to allow for a little room during the countdown and load times, etc.
+                               if ($GLOBALS['EXEC_TIME'] >= $ses_tstamp + $timeout - 120) {
+                                       $ajaxObj->addContent('login', array('will_time_out' => TRUE));
+                               } else {
+                                       $ajaxObj->addContent('login', array('will_time_out' => FALSE));
+                               }
+                       }
+               } else {
+                       $ajaxObj->addContent('login', array('success' => FALSE, 'error' => 'No BE_USER object'));
+               }
+       }
+
+       /**
+        * Gets a MD5 challenge.
+        *
+        * @param array $parameters Parameters (not used)
+        * @param TYPO3AJAX $parent The calling parent AJAX object
+        * @return void
+        */
+       public function getChallenge(array $parameters, TYPO3AJAX $parent) {
+               session_start();
+
+               $_SESSION['login_challenge'] = md5(uniqid('') . getmypid());
+
+               session_commit();
+
+               $parent->addContent('challenge', $_SESSION['login_challenge']);
+               $parent->setContentFormat('json');
+       }
+}
+?>
\ No newline at end of file
diff --git a/typo3/classes/class.clearcachemenu.php b/typo3/classes/class.clearcachemenu.php
new file mode 100644 (file)
index 0000000..60e7c1a
--- /dev/null
@@ -0,0 +1,189 @@
+<?php
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2007-2011 Ingo Renner <ingo@typo3.org>
+*  All rights reserved
+*
+*  This script is part of the TYPO3 project. The TYPO3 project is
+*  free software; you can redistribute it and/or modify
+*  it under the terms of the GNU General Public License as published by
+*  the Free Software Foundation; either version 2 of the License, or
+*  (at your option) any later version.
+*
+*  The GNU General Public License can be found at
+*  http://www.gnu.org/copyleft/gpl.html.
+*  A copy is found in the textfile GPL.txt and important notices to the license
+*  from the author is found in LICENSE.txt distributed with these scripts.
+*
+*
+*  This script is distributed in the hope that it will be useful,
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*  GNU General Public License for more details.
+*
+*  This copyright notice MUST APPEAR in all copies of the script!
+***************************************************************/
+
+/**
+ * class to render the menu for the cache clearing actions
+ *
+ * @author Ingo Renner <ingo@typo3.org>
+ * @package TYPO3
+ * @subpackage core
+ */
+class ClearCacheMenu implements backend_toolbarItem {
+
+       /**
+        * @var array
+        */
+       protected $cacheActions;
+
+       /**
+        * @var array
+        */
+       protected $optionValues;
+
+       /**
+        * Reference back to the backend object
+        *
+        * @var TYPO3backend
+        */
+       protected $backendReference;
+
+       /**
+        * Constructor
+        *
+        * @param TYPO3backend $backendReference TYPO3 backend object reference
+        */
+       public function __construct(TYPO3backend &$backendReference = NULL) {
+               $this->backendReference = $backendReference;
+               $this->cacheActions     = array();
+               $this->optionValues     = array('all', 'pages');
+
+                       // Clear cache for ALL tables!
+               if ($GLOBALS['BE_USER']->isAdmin() || $GLOBALS['BE_USER']->getTSConfigVal('options.clearCache.all')) {
+                       $title = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:rm.clearCacheMenu_all', TRUE);
+                       $this->cacheActions[] = array(
+                               'id'    => 'all',
+                               'title' => $title,
+                               'href'  => $this->backPath .
+                                               'tce_db.php?vC=' .
+                                               $GLOBALS['BE_USER']->veriCode() .
+                                               '&cacheCmd=all&ajaxCall=1' .
+                                               t3lib_BEfunc::getUrlToken('tceAction'),
+                               'icon'  => t3lib_iconWorks::getSpriteIcon('actions-system-cache-clear-impact-high')
+                       );
+               }
+
+                       // Clear cache for either ALL pages
+               if ($GLOBALS['BE_USER']->isAdmin() || $GLOBALS['BE_USER']->getTSConfigVal('options.clearCache.pages')) {
+                       $title = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:rm.clearCacheMenu_pages', TRUE);
+                       $this->cacheActions[] = array(
+                               'id'    => 'pages',
+                               'title' => $title,
+                               'href'  => $this->backPath .
+                                               'tce_db.php?vC=' .
+                                               $GLOBALS['BE_USER']->veriCode() .
+                                               '&cacheCmd=pages&ajaxCall=1' .
+                                               t3lib_BEfunc::getUrlToken('tceAction'),
+                               'icon'  => t3lib_iconWorks::getSpriteIcon('actions-system-cache-clear-impact-medium')
+                       );
+               }
+
+                       // Clearing of cache-files in typo3conf/ + menu
+               if ($GLOBALS['BE_USER']->isAdmin() && $GLOBALS['TYPO3_CONF_VARS']['EXT']['extCache']) {
+                       $title = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:rm.clearCacheMenu_allTypo3Conf', TRUE);
+                       $this->cacheActions[] = array(
+                               'id'    => 'temp_CACHED',
+                               'title' => $title,
+                               'href'  => $this->backPath .
+                                               'tce_db.php?vC=' .
+                                               $GLOBALS['BE_USER']->veriCode() .
+                                               '&cacheCmd=temp_CACHED&ajaxCall=1' .
+                                               t3lib_BEfunc::getUrlToken('tceAction'),
+                               'icon'  => t3lib_iconWorks::getSpriteIcon('actions-system-cache-clear-impact-low')
+                       );
+               }
+
+                       // Hook for manipulate cacheActions
+               if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['additionalBackendItems']['cacheActions'])) {
+                       foreach($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['additionalBackendItems']['cacheActions'] as $cacheAction) {
+                               $hookObject = t3lib_div::getUserObj($cacheAction);
+
+                               if (!($hookObject instanceof backend_cacheActionsHook)) {
+                                       throw new UnexpectedValueException('$hookObject must implement interface backend_cacheActionsHook', 1228262000);
+                               }
+
+                               $hookObject->manipulateCacheActions($this->cacheActions, $this->optionValues);
+                       }
+               }
+       }
+
+       /**
+        * Checks whether the user has access to this toolbar item
+        *
+        * @return boolean TRUE if user has access, FALSE if not
+        */
+       public function checkAccess() {
+
+               if ($GLOBALS['BE_USER']->isAdmin()) {
+                       return TRUE;
+               }
+
+               if (is_array($this->optionValues)) {
+                       foreach($this->optionValues as $value) {
+                               if ($GLOBALS['BE_USER']->getTSConfigVal('options.clearCache.' . $value)) {
+                                       return TRUE;
+                               }
+                       }
+               }
+               return FALSE;
+
+       }
+
+       /**
+        * Creates the selector for workspaces
+        *
+        * @return string Workspace selector as HTML select
+        */
+       public function render() {
+               $title = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:rm.clearCache_clearCache', TRUE);
+               $this->addJavascriptToBackend();
+               $cacheMenu = array();
+
+               $cacheMenu[] = '<a href="#" class="toolbar-item">' .
+                       t3lib_iconWorks::getSpriteIcon('apps-toolbar-menu-cache', array('title' => $title)) .
+                       '</a>';
+
+               $cacheMenu[] = '<ul class="toolbar-item-menu" style="display: none;">';
+
+               foreach($this->cacheActions as $actionKey => $cacheAction) {
+                       $cacheMenu[] = '<li><a href="' . htmlspecialchars($cacheAction['href']) . '">' . $cacheAction['icon'] . ' ' . $cacheAction['title'] . '</a></li>';
+               }
+
+               $cacheMenu[] = '</ul>';
+
+               return implode(LF, $cacheMenu);
+       }
+
+       /**
+        * Adds the necessary JavaScript to the backend
+        *
+        * @return void
+        */
+       protected function addJavascriptToBackend() {
+               $this->backendReference->addJavascriptFile('js/clearcachemenu.js');
+       }
+
+       /**
+        * Returns additional attributes for the list item in the toolbar
+        *
+        * @return string List item HTML attibutes
+        */
+       public function getAdditionalAttributes() {
+               return ' id="clear-cache-actions-menu"';
+       }
+
+}
+?>
\ No newline at end of file
diff --git a/typo3/classes/class.livesearch.php b/typo3/classes/class.livesearch.php
new file mode 100644 (file)
index 0000000..d34a1a2
--- /dev/null
@@ -0,0 +1,110 @@
+<?php
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2009-2011 Michael Klapper <michael.klapper@aoemedia.de>
+ *  (c) 2010-2011 Jeff Segars <jeff@webempoweredchurch.org>
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *  A copy is found in the textfile GPL.txt and important notices to the license
+ *  from the author is found in LICENSE.txt distributed with these scripts.
+ *
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+/**
+ * Adds backend live search to the toolbar
+ *
+ * @author Michael Klapper <michael.klapper@aoemedia.de>
+ * @author Jeff Segars <jeff@webempoweredchurch.org>
+ * @package TYPO3
+ * @subpackage t3lib
+ */
+class LiveSearch implements backend_toolbarItem {
+
+       /**
+        * Reference back to the backend object
+        *
+        * @var TYPO3backend
+        */
+       protected $backendReference;
+
+       /**
+        * Constructor
+        *
+        * @param TYPO3backend $backendReference TYPO3 backend object reference
+        */
+       public function __construct(TYPO3backend &$backendReference = NULL) {
+               $this->backendReference = $backendReference;
+       }
+
+       /**
+        * Checks whether the user has access to this toolbar item
+        *
+        * @return boolean TRUE if user has access, FALSE if not
+        */
+       public function checkAccess() {
+               $access = FALSE;
+
+                       // Loads the backend modules available for the logged in user.
+               $loadModules = t3lib_div::makeInstance('t3lib_loadModules');
+               $loadModules->observeWorkspaces = TRUE;
+               $loadModules->load($GLOBALS['TBE_MODULES']);
+
+                       // Live search is heavily dependent on the list module and only available when that module is.
+               if (is_array($loadModules->modules['web']['sub']['list'])) {
+                       $access = TRUE;
+               }
+
+               return $access;
+       }
+
+       /**
+        * Creates the selector for workspaces
+        *
+        * @return string Workspace selector as HTML select
+        */
+       public function render() {
+               $this->addJavascriptToBackend();
+               return '<div class="live-search-wrapper">
+                                       <span title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:search') .'" class="t3-icon t3-icon-apps t3-icon-apps-toolbar t3-icon-toolbar-menu-search">&nbsp;</span>
+                                       <input id="live-search-box" />
+                               </div>';
+       }
+
+       /**
+        * Adds the necessary JavaScript to the backend
+        *
+        * @return void
+        */
+       protected function addJavascriptToBackend() {
+               $pageRenderer = $GLOBALS['TBE_TEMPLATE']->getPageRenderer();
+
+               $this->backendReference->addJavascriptFile('js/livesearch.js');
+       }
+
+       /**
+        * returns additional attributes for the list item in the toolbar
+        *
+        * @return string List item HTML attibutes
+        */
+       public function getAdditionalAttributes() {
+               return ' id="live-search-menu"';
+       }
+
+}
+?>
\ No newline at end of file
diff --git a/typo3/classes/class.modulemenu.php b/typo3/classes/class.modulemenu.php
new file mode 100644 (file)
index 0000000..16aa2db
--- /dev/null
@@ -0,0 +1,360 @@
+<?php
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2007-2011 Ingo Renner <ingo@typo3.org>
+*  All rights reserved
+*
+*  This script is part of the TYPO3 project. The TYPO3 project is
+*  free software; you can redistribute it and/or modify
+*  it under the terms of the GNU General Public License as published by
+*  the Free Software Foundation; either version 2 of the License, or
+*  (at your option) any later version.
+*
+*  The GNU General Public License can be found at
+*  http://www.gnu.org/copyleft/gpl.html.
+*  A copy is found in the textfile GPL.txt and important notices to the license
+*  from the author is found in LICENSE.txt distributed with these scripts.
+*
+*
+*  This script is distributed in the hope that it will be useful,
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*  GNU General Public License for more details.
+*
+*  This copyright notice MUST APPEAR in all copies of the script!
+***************************************************************/
+
+if (TYPO3_REQUESTTYPE & TYPO3_REQUESTTYPE_AJAX) {
+       $GLOBALS['LANG']->includeLLFile('EXT:lang/locallang_misc.xml');
+}
+
+/**
+ * class to render the TYPO3 backend menu for the modules
+ *
+ * @author Ingo Renner <ingo@typo3.org>
+ * @package TYPO3
+ * @subpackage core
+ */
+class ModuleMenu {
+
+       /**
+        * Module loading object
+        *
+        * @var t3lib_loadModules
+        */
+       protected $moduleLoader;
+
+       protected $backPath;
+       protected $linkModules;
+       protected $loadedModules;
+
+       /**
+        * Constructor, initializes several variables
+        */
+       public function __construct() {
+
+               $this->backPath    = '';
+               $this->linkModules = TRUE;
+
+                       // Loads the backend modules available for the logged in user.
+               $this->moduleLoader = t3lib_div::makeInstance('t3lib_loadModules');
+               $this->moduleLoader->observeWorkspaces = TRUE;
+               $this->moduleLoader->load($GLOBALS['TBE_MODULES']);
+               $this->loadedModules = $this->moduleLoader->modules;
+       }
+
+       /**
+        * sets the path back to /typo3/
+        *
+        * @param string $backPath Path back to /typo3/
+        * @throws InvalidArgumentException
+        * @return void
+        */
+       public function setBackPath($backPath) {
+               if (!is_string($backPath)) {
+                       throw new InvalidArgumentException('parameter $backPath must be of type string', 1193315266);
+               }
+
+               $this->backPath = $backPath;
+       }
+
+       /**
+        * loads the collapse states for the main modules from user's configuration (uc)
+        *
+        * @return array Collapse states
+        */
+       protected function getCollapsedStates() {
+
+               $collapsedStates = array();
+               if ($GLOBALS['BE_USER']->uc['moduleData']['moduleMenu']) {
+                       $collapsedStates = $GLOBALS['BE_USER']->uc['moduleData']['moduleMenu'];
+               }
+
+               return $collapsedStates;
+       }
+
+       /**
+        * ModuleMenu Store loading data
+        *
+        * @param array $params
+        * @param TYPO3AJAX $ajaxObj
+        * @return array
+        */
+       public function getModuleData($params, $ajaxObj) {
+               $data = array('success' => TRUE, 'root' => array());
+               $rawModuleData = $this->getRawModuleData();
+               $index = 0;
+               foreach ($rawModuleData as $moduleKey => $moduleData) {
+                       $key = substr($moduleKey, 8);
+                       $num = count($data['root']);
+                       if ($moduleData['link'] != 'dummy.php' || ($moduleData['link'] == 'dummy.php' && is_array($moduleData['subitems'])) ) {
+                               $data['root'][$num]['key'] = $key;
+                               $data['root'][$num]['menuState'] = $GLOBALS['BE_USER']->uc['moduleData']['menuState'][$moduleKey];
+                               $data['root'][$num]['label'] = $moduleData['title'];
+                               $data['root'][$num]['subitems'] = is_array($moduleData['subitems']) ? count($moduleData['subitems']) : 0;
+
+                               if ($moduleData['link'] && $this->linkModules) {
+                                       $data['root'][$num]['link'] = 'top.goToModule(\'' . $moduleData['name'] . '\')';
+                               }
+
+                                       // Traverse submodules
+                               if (is_array($moduleData['subitems'])) {
+                                       foreach($moduleData['subitems'] as $subKey => $subData) {
+                                               $data['root'][$num]['sub'][] = array(
+                                                       'name' => $subData['name'],
+                                                       'description' => $subData['description'],
+                                                       'label' => $subData['title'],
+                                                       'icon' => $subData['icon']['filename'],
+                                                       'navframe' => $subData['parentNavigationFrameScript'],
+                                                       'link' => $subData['link'],
+                                                       'originalLink' => $subData['originalLink'],
+                                                       'index' => $index++,
+                                                       'navigationFrameScript' => $subData['navigationFrameScript'],
+                                                       'navigationFrameScriptParam' => $subData['navigationFrameScriptParam'],
+                                                       'navigationComponentId' => $subData['navigationComponentId'],
+                                               );
+                                       }
+                               }
+                       }
+               }
+               if ($ajaxObj) {
+                       $ajaxObj->setContent($data);
+                       $ajaxObj->setContentFormat('jsonbody');
+               } else {
+                       return $data;
+               }
+       }
+
+       /**
+        * Returns the loaded modules
+        *
+        * @return array Array of loaded modules
+        */
+       public function getLoadedModules() {
+               return $this->loadedModules;
+       }
+
+       /**
+        * saves the menu's toggle state in the backend user's uc
+        *
+        * @param array $params Array of parameters from the AJAX interface, currently unused
+        * @param TYPO3AJAX $ajaxObj Object of type TYPO3AJAX
+        * @return void
+        */
+       public function saveMenuState($params, $ajaxObj) {
+               $menuItem = t3lib_div::_POST('menuid');
+               $state = t3lib_div::_POST('state') === 'true' ? 1 : 0;
+
+               $GLOBALS['BE_USER']->uc['moduleData']['menuState'][$menuItem] = $state;
+               $GLOBALS['BE_USER']->writeUC();
+       }
+
+       /**
+        * gets the raw module data
+        *
+        * @return array Multi dimension array with module data
+        */
+       public function getRawModuleData() {
+               $modules = array();
+
+                       // Remove the 'doc' module?
+               if ($GLOBALS['BE_USER']->getTSConfigVal('options.disableDocModuleInAB')) {
+                       unset($this->loadedModules['doc']);
+               }
+
+               foreach ($this->loadedModules as $moduleName => $moduleData) {
+                       $moduleLink = '';
+                       if (!is_array($moduleData['sub'])) {
+                               $moduleLink = $moduleData['script'];
+                       }
+                       $moduleLink = t3lib_div::resolveBackPath($moduleLink);
+
+                       $moduleKey   = 'modmenu_' . $moduleName;
+                       $moduleIcon  = $this->getModuleIcon($moduleKey);
+
+                       $modules[$moduleKey] = array(
+                               'name'        => $moduleName,
+                               'title'       => $GLOBALS['LANG']->moduleLabels['tabs'][$moduleName . '_tab'],
+                               'onclick'     => 'top.goToModule(\'' . $moduleName . '\');',
+                               'icon'        => $moduleIcon,
+                               'link'        => $moduleLink,
+                               'description' => $GLOBALS['LANG']->moduleLabels['labels'][$moduleKey.'label']
+                       );
+
+                       if (!is_array($moduleData['sub']) && $moduleData['script'] != 'dummy.php') {
+                                       // Work around for modules with own main entry, but being self the only submodule
+                               $modules[$moduleKey]['subitems'][$moduleKey] = array(
+                                       'name' => $moduleName,
+                                       'title' => $GLOBALS['LANG']->moduleLabels['tabs'][$moduleName . '_tab'],
+                                       'onclick' => 'top.goToModule(\'' . $moduleName . '\');',
+                                       'icon' => $this->getModuleIcon($moduleName . '_tab'),
+                                       'link' => $moduleLink,
+                                       'originalLink' => $moduleLink,
+                                       'description' => $GLOBALS['LANG']->moduleLabels['labels'][$moduleKey . 'label'],
+                                       'navigationFrameScript' => NULL,
+                                       'navigationFrameScriptParam' => NULL,
+                                       'navigationComponentId' => NULL,
+                               );
+                       } elseif (is_array($moduleData['sub'])) {
+                               foreach($moduleData['sub'] as $submoduleName => $submoduleData) {
+                                       $submoduleLink = t3lib_div::resolveBackPath($submoduleData['script']);
+
+                                       $submoduleKey         = $moduleName . '_' . $submoduleName . '_tab';
+                                       $submoduleIcon        = $this->getModuleIcon($submoduleKey);
+                                       $submoduleDescription = $GLOBALS['LANG']->moduleLabels['labels'][$submoduleKey . 'label'];
+
+                                       $originalLink = $submoduleLink;
+
+                                       $modules[$moduleKey]['subitems'][$submoduleKey] = array(
+                                               'name'         => $moduleName . '_' . $submoduleName,
+                                               'title'        => $GLOBALS['LANG']->moduleLabels['tabs'][$submoduleKey],
+                                               'onclick'      => 'top.goToModule(\'' . $moduleName . '_' . $submoduleName . '\');',
+                                               'icon'         => $submoduleIcon,
+                                               'link'         => $submoduleLink,
+                                               'originalLink' => $originalLink,
+                                               'description'  => $submoduleDescription,
+                                               'navigationFrameScript' => $submoduleData['navFrameScript'],
+                                               'navigationFrameScriptParam' => $submoduleData['navFrameScriptParam'],
+                                               'navigationComponentId' => $submoduleData['navigationComponentId'],
+                                       );
+
+                                       if ($moduleData['navFrameScript']) {
+                                               $modules[$moduleKey]['subitems'][$submoduleKey]['parentNavigationFrameScript'] = $moduleData['navFrameScript'];
+                                       }
+                               }
+                       }
+               }
+
+               return $modules;
+       }
+
+       /**
+        * gets the module icon and its size
+        *
+        * @param string $moduleKey Module key
+        * @return array Icon data array with 'filename', 'size', and 'html'
+        */
+       protected function getModuleIcon($moduleKey) {
+               $icon = array(
+                       'filename' => '',
+                       'size' => '',
+                       'title' => '',
+                       'html' => ''
+               );
+
+               $iconFileRelative = $this->getModuleIconRelative($GLOBALS['LANG']->moduleLabels['tabs_images'][$moduleKey]);
+               $iconFileAbsolute = $this->getModuleIconAbsolute($GLOBALS['LANG']->moduleLabels['tabs_images'][$moduleKey]);
+               $iconSizes        = @getimagesize($iconFileAbsolute);
+               $iconTitle        = $GLOBALS['LANG']->moduleLabels['tabs'][$moduleKey];
+
+               if (!empty($iconFileRelative)) {
+                       $icon['filename'] = $iconFileRelative;
+                       $icon['size']     = $iconSizes[3];
+                       $icon['title']    = htmlspecialchars($iconTitle);
+                       $icon['html']     = '<img src="' . $iconFileRelative . '" ' . $iconSizes[3] .
+                               ' title="' . htmlspecialchars($iconTitle) . '" alt="' . htmlspecialchars($iconTitle) . '" />';
+               }
+
+               return $icon;
+       }
+
+       /**
+        * Returns the filename readable for the script from PATH_typo3.
+        * That means absolute names are just returned while relative names are
+        * prepended with the path pointing back to typo3/ dir
+        *
+        * @param string $iconFilename Icon filename
+        * @return string Icon filename with absolute path
+        * @see getModuleIconRelative()
+        */
+       protected function getModuleIconAbsolute($iconFilename) {
+
+               if (!t3lib_div::isAbsPath($iconFilename)) {
+                       $iconFilename = $this->backPath . $iconFilename;
+               }
+
+               return $iconFilename;
+       }
+
+       /**
+        * Returns relative path to the icon filename for use in img-tags
+        *
+        * @param string $iconFilename Icon filename
+        * @return string Icon filename with relative path
+        * @see getModuleIconAbsolute()
+        */
+       protected function getModuleIconRelative($iconFilename) {
+               if (t3lib_div::isAbsPath($iconFilename)) {
+                       $iconFilename = '../' . substr($iconFilename, strlen(PATH_site));
+               }
+               return $this->backPath.$iconFilename;
+       }
+
+       /**
+        * Appends a '?' if there is none in the string already
+        *
+        * @param string $link Link URL
+        * @return string Link URl appended with ? if there wasn't one
+        */
+       protected function appendQuestionmarkToLink($link) {
+               if (!strstr($link, '?')) {
+                       $link .= '?';
+               }
+
+               return $link;
+       }
+
+       /**
+        * renders the logout button form
+        *
+        * @return string Html code snippet displaying the logout button
+        */
+       public function renderLogoutButton() {
+               $buttonLabel      = $GLOBALS['BE_USER']->user['ses_backuserid'] ? 'LLL:EXT:lang/locallang_core.php:buttons.exit' : 'LLL:EXT:lang/locallang_core.php:buttons.logout';
+
+               $buttonForm = '
+               <form action="logout.php" target="_top">
+                       <input type="submit" value="&nbsp;' . $GLOBALS['LANG']->sL($buttonLabel, 1) . '&nbsp;" />
+               </form>';
+
+               return $buttonForm;
+       }
+
+       /**
+        * turns linking of modules on or off
+        *
+        * @param boolean $linkModules Status for linking modules with a-tags, set to FALSE to turn lining off
+        * @throws InvalidArgumentException
+        * @return void
+        */
+       public function setLinkModules($linkModules) {
+               if (!is_bool($linkModules)) {
+                       throw new InvalidArgumentException('parameter $linkModules must be of type bool', 1193326558);
+               }
+
+               $this->linkModules = $linkModules;
+       }
+
+}
+?>
\ No newline at end of file
diff --git a/typo3/classes/class.shortcutmenu.php b/typo3/classes/class.shortcutmenu.php
new file mode 100644 (file)
index 0000000..91c6cb7
--- /dev/null
@@ -0,0 +1,790 @@
+<?php
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2007-2011 Ingo Renner <ingo@typo3.org>
+*  All rights reserved
+*
+*  This script is part of the TYPO3 project. The TYPO3 project is
+*  free software; you can redistribute it and/or modify
+*  it under the terms of the GNU General Public License as published by
+*  the Free Software Foundation; either version 2 of the License, or
+*  (at your option) any later version.
+*
+*  The GNU General Public License can be found at
+*  http://www.gnu.org/copyleft/gpl.html.
+*  A copy is found in the textfile GPL.txt and important notices to the license
+*  from the author is found in LICENSE.txt distributed with these scripts.
+*
+*
+*  This script is distributed in the hope that it will be useful,
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*  GNU General Public License for more details.
+*
+*  This copyright notice MUST APPEAR in all copies of the script!
+***************************************************************/
+
+if (TYPO3_REQUESTTYPE & TYPO3_REQUESTTYPE_AJAX) {
+       require_once(PATH_typo3 . 'interfaces/interface.backend_toolbaritem.php');
+       $GLOBALS['LANG']->includeLLFile('EXT:lang/locallang_misc.xml');
+
+               // Needed to get the correct icons when reloading the menu after saving it
+       $loadModules = t3lib_div::makeInstance('t3lib_loadModules');
+       $loadModules->load($GLOBALS['TBE_MODULES']);
+}
+
+/**
+ * Class to render the shortcut menu
+ *
+ * @author Ingo Renner <ingo@typo3.org>
+ * @package TYPO3
+ * @subpackage core
+ */
+class ShortcutMenu implements backend_toolbarItem {
+
+       protected $shortcutGroups;
+
+       /**
+        * All available shortcuts
+        *
+        * @var array
+        */
+       protected $shortcuts;
+
+       /**
+        * Labels of all groups.
+        * If value is 1, the system will try to find a label in the locallang array.
+        *
+        * @var array
+        */
+       protected $groupLabels;
+
+       /**
+        * Reference back to the backend object
+        *
+        * @var TYPO3backend
+        */
+       protected $backendReference;
+
+       /**
+        * Constructor
+        *
+        * @param TYPO3backend $backendReference TYPO3 backend object reference
+        */
+       public function __construct(TYPO3backend &$backendReference = NULL) {
+               $this->backendReference = $backendReference;
+               $this->shortcuts        = array();
+
+                       // By default, 5 groups are set
+               $this->shortcutGroups = array(
+                       1 => '1',
+                       2 => '1',
+                       3 => '1',
+                       4 => '1',
+                       5 => '1',
+               );
+
+               $this->shortcutGroups  = $this->initShortcutGroups();
+               $this->shortcuts       = $this->initShortcuts();
+       }
+
+       /**
+        * Checks whether the user has access to this toolbar item
+        *
+        * @return boolean TRUE if user has access, FALSE if not
+        */
+       public function checkAccess() {
+               return (bool) $GLOBALS['BE_USER']->getTSConfigVal('options.enableBookmarks');
+       }
+
+       /**
+        * Creates the shortcut menu (default renderer)
+        *
+        * @return string Workspace selector as HTML select
+        */
+       public function render() {
+               $title = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:toolbarItems.bookmarks', TRUE);
+               $this->addJavascriptToBackend();
+
+               $shortcutMenu = array();
+
+               $shortcutMenu[] = '<a href="#" class="toolbar-item">' .
+                       t3lib_iconWorks::getSpriteIcon('apps-toolbar-menu-shortcut', array('title' => $title)) .
+                       '</a>';
+               $shortcutMenu[] = '<div class="toolbar-item-menu" style="display: none;">';
+               $shortcutMenu[] = $this->renderMenu();
+               $shortcutMenu[] = '</div>';
+
+               return implode(LF, $shortcutMenu);
+       }
+
+       /**
+        * Renders the pure contents of the menu
+        *
+        * @return string The menu's content
+        */
+       public function renderMenu() {
+
+               $shortcutGroup  = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:toolbarItems.bookmarksGroup', TRUE);
+               $shortcutEdit   = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:toolbarItems.bookmarksEdit', TRUE);
+               $shortcutDelete = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:toolbarItems.bookmarksDelete', TRUE);
+
+               $groupIcon  = '<img' . t3lib_iconWorks::skinImg($this->backPath, 'gfx/i/sysf.gif', 'width="18" height="16"') . ' title="' . $shortcutGroup . '" alt="' . $shortcutGroup . '" />';
+               $editIcon   = '<img' . t3lib_iconWorks::skinImg($this->backPath, 'gfx/edit2.gif', 'width="11" height="12"') . ' title="' . $shortcutEdit . '" alt="' . $shortcutEdit . '"';
+               $deleteIcon = '<img' . t3lib_iconWorks::skinImg($this->backPath, 'gfx/garbage.gif', 'width="11" height="12"') . ' title="' . $shortcutDelete . '" alt="' . $shortcutDelete . '" />';
+
+               $shortcutMenu[] = '<table border="0" cellspacing="0" cellpadding="0" class="shortcut-list">';
+
+                       // Render shortcuts with no group (group id = 0) first
+               $noGroupShortcuts = $this->getShortcutsByGroup(0);
+               foreach ($noGroupShortcuts as $shortcut) {
+                       $shortcutMenu[] = '
+                       <tr id="shortcut-' . $shortcut['raw']['uid'] . '" class="shortcut">
+                               <td class="shortcut-icon">' . $shortcut['icon'] . '</td>
+                               <td class="shortcut-label">
+                                       <a id="shortcut-label-' . $shortcut['raw']['uid'] . '" href="#" onclick="' . $shortcut['action'] . '; return false;">' . htmlspecialchars($shortcut['label']) . '</a>
+                               </td>
+                               <td class="shortcut-edit">' . $editIcon . ' id="shortcut-edit-' . $shortcut['raw']['uid'] . '" /></td>
+                               <td class="shortcut-delete">' . $deleteIcon . '</td>
+                       </tr>';
+               }
+
+                       // Now render groups and the contained shortcuts
+               $groups = $this->getGroupsFromShortcuts();
+               krsort($groups, SORT_NUMERIC);
+               foreach($groups as $groupId => $groupLabel) {
+                       if ($groupId != 0 ) {
+                               $shortcutGroup = '
+                               <tr class="shortcut-group" id="shortcut-group-' . $groupId . '">
+                                       <td class="shortcut-group-icon">' . $groupIcon . '</td>
+                                       <td class="shortcut-group-label">' . $groupLabel . '</td>
+                                       <td colspan="2">&nbsp;</td>
+                               </tr>';
+
+                               $shortcuts = $this->getShortcutsByGroup($groupId);
+                               $i = 0;
+                               foreach ($shortcuts as $shortcut) {
+                                       $i++;
+
+                                       $firstRow = '';
+                                       if ($i == 1) {
+                                               $firstRow = ' first-row';
+                                       }
+
+                                       $shortcutGroup .= '
+                                       <tr id="shortcut-' . $shortcut['raw']['uid'] . '" class="shortcut' . $firstRow . '">
+                                               <td class="shortcut-icon">' . $shortcut['icon'] . '</td>
+                                               <td class="shortcut-label">
+                                                       <a id="shortcut-label-' . $shortcut['raw']['uid'] . '" href="#" onclick="' . $shortcut['action'] . '; return false;">' . htmlspecialchars($shortcut['label']) . '</a>
+                                               </td>
+                                               <td class="shortcut-edit">' . $editIcon . ' id="shortcut-edit-' . $shortcut['raw']['uid'] . '" /></td>
+                                               <td class="shortcut-delete">' . $deleteIcon . '</td>
+                                       </tr>';
+                               }
+
+                               $shortcutMenu[] = $shortcutGroup;
+                       }
+               }
+
+               if (count($shortcutMenu) == 1) {
+                               // No shortcuts added yet, show a small help message how to add shortcuts
+                       $title = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:toolbarItems.bookmarks', TRUE);
+                       $icon = t3lib_iconWorks::getSpriteIcon('actions-system-shortcut-new', array(
+                               'title' => $title
+                       ));
+                       $label = str_replace('%icon%', $icon, $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_misc.php:bookmarkDescription'));
+
+                       $shortcutMenu[] = '<tr><td style="padding:1px 2px; color: #838383;">' . $label . '</td></tr>';
+               }
+
+               $shortcutMenu[] = '</table>';
+
+               $compiledShortcutMenu = implode(LF, $shortcutMenu);
+
+               return $compiledShortcutMenu;
+       }
+
+       /**
+        * Renders the menu so that it can be returned as response to an AJAX call
+        *
+        * @param array $params Array of parameters from the AJAX interface, currently unused
+        * @param TYPO3AJAX $ajaxObj Object of type TYPO3AJAX
+        * @return void
+        */
+       public function renderAjax($params = array(), TYPO3AJAX &$ajaxObj = NULL) {
+               $menuContent = $this->renderMenu();
+
+               $ajaxObj->addContent('shortcutMenu', $menuContent);
+       }
+
+       /**
+        * Adds the necessary JavaScript to the backend
+        *
+        * @return void
+        */
+       protected function addJavascriptToBackend() {
+               $this->backendReference->addJavascriptFile('js/shortcutmenu.js');
+       }
+
+       /**
+        * Returns additional attributes for the list item in the toolbar
+        *
+        * @return string List item HTML attibutes
+        */
+       public function getAdditionalAttributes() {
+               return ' id="shortcut-menu"';
+       }
+
+       /**
+        * Retrieves the shortcuts for the current user
+        *
+        * @return array Array of shortcuts
+        */
+       protected function initShortcuts() {
+               $shortcuts    = array();
+               $globalGroups = $this->getGlobalShortcutGroups();
+
+               $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
+                       '*',
+                       'sys_be_shortcuts',
+                       '((userid = ' . $GLOBALS['BE_USER']->user['uid'] . ' AND sc_group>=0) OR sc_group IN (' . implode(',', array_keys($globalGroups)) . '))',
+                       '',
+                       'sc_group,sorting'
+               );
+
+                       // Traverse shortcuts
+               while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
+                       $shortcut             = array('raw' => $row);
+                       $moduleParts          = explode('|', $row['module_name']);
+                       $row['module_name']   = $moduleParts[0];
+                       $row['M_module_name'] = $moduleParts[1];
+                       $moduleParts          = explode('_', $row['M_module_name'] ?
+                               $row['M_module_name'] :
+                               $row['module_name']
+                       );
+                       $queryParts           = parse_url($row['url']);
+                       $queryParameters      = t3lib_div::explodeUrl2Array($queryParts['query'], 1);
+
+                       if ($row['module_name'] == 'xMOD_alt_doc.php' && is_array($queryParameters['edit'])) {
+                               $shortcut['table']    = key($queryParameters['edit']);
+                               $shortcut['recordid'] = key($queryParameters['edit'][$shortcut['table']]);
+
+                               if ($queryParameters['edit'][$shortcut['table']][$shortcut['recordid']] == 'edit') {
+                                       $shortcut['type'] = 'edit';
+                               } elseif ($queryParameters['edit'][$shortcut['table']][$shortcut['recordid']] == 'new') {
+                                       $shortcut['type'] = 'new';
+                               }
+
+                               if (substr($shortcut['recordid'], -1) == ',') {
+                                       $shortcut['recordid'] = substr($shortcut['recordid'], 0, -1);
+                               }
+                       } else {
+                               $shortcut['type'] = 'other';
+                       }
+
+                               // Check for module access
+                       $pageId = $this->getLinkedPageId($row['url']);
+                       if (!$GLOBALS['BE_USER']->isAdmin()) {
+                               if (!isset($GLOBALS['LANG']->moduleLabels['tabs_images'][implode('_', $moduleParts).'_tab'])) {
+                                               // Nice hack to check if the user has access to this module
+                                               // - otherwise the translation label would not have been loaded :-)
+                                       continue;
+                               }
+
+                               if (t3lib_utility_Math::canBeInterpretedAsInteger($pageId)) {
+                                               // Check for webmount access
+                                       if (!$GLOBALS['BE_USER']->isInWebMount($pageId)) {
+                                               continue;
+                                       }
+
+                                               // Check for record access
+                                       $pageRow = t3lib_BEfunc::getRecord('pages', $pageId);
+                                       if (!$GLOBALS['BE_USER']->doesUserHaveAccess($pageRow, $perms = 1)) {
+                                               continue;
+                                       }
+                               }
+                       }
+
+                       $shortcutGroup = $row['sc_group'];
+                       if ($shortcutGroup && strcmp($lastGroup, $shortcutGroup) && ($shortcutGroup != -100)) {
+                               $shortcut['groupLabel'] = $this->getShortcutGroupLabel($shortcutGroup);
+                       }
+
+                       if ($row['description']) {
+                               $shortcut['label'] = $row['description'];
+                       } else {
+                               $shortcut['label'] = t3lib_div::fixed_lgd_cs(rawurldecode($queryParts['query']), 150);
+                       }
+
+                       $shortcut['group']     = $shortcutGroup;
+                       $shortcut['icon']      = $this->getShortcutIcon($row, $shortcut);
+                       $shortcut['iconTitle'] = $this->getShortcutIconTitle($shortcutLabel, $row['module_name'], $row['M_module_name']);
+                       $shortcut['action']    = 'jump(unescape(\'' . rawurlencode($row['url']) . '\'),\'' . implode('_', $moduleParts) . '\',\'' . $moduleParts[0] . '\', ' . intval($pageId) . ');';
+
+                       $lastGroup   = $row['sc_group'];
+                       $shortcuts[] = $shortcut;
+               }
+
+               return $shortcuts;
+       }
+
+       /**
+        * Gets shortcuts for a specific group
+        *
+        * @param integer $groupId Group Id
+        * @return array Array of shortcuts that matched the group
+        */
+       protected function getShortcutsByGroup($groupId) {
+               $shortcuts = array();
+
+               foreach ($this->shortcuts as $shortcut) {
+                       if ($shortcut['group'] == $groupId) {
+                               $shortcuts[] = $shortcut;
+                       }
+               }
+
+               return $shortcuts;
+       }
+
+       /**
+        * Gets a shortcut by its uid
+        *
+        * @param integer $shortcutId Shortcut id to get the complete shortcut for
+        * @return mixed An array containing the shortcut's data on success or FALSE on failure
+        */
+       protected function getShortcutById($shortcutId) {
+               $returnShortcut = FALSE;
+
+               foreach ($this->shortcuts as $shortcut) {
+                       if ($shortcut['raw']['uid'] == (int) $shortcutId) {
+                               $returnShortcut = $shortcut;
+                               continue;
+                       }
+               }
+
+               return $returnShortcut;
+       }
+
+       /**
+        * Gets the available shortcut groups from default gropups, user TSConfig,
+        * and global groups
+        *
+        * @param array $params Array of parameters from the AJAX interface, currently unused
+        * @param TYPO3AJAX $ajaxObj Object of type TYPO3AJAX
+        * @return array
+        */
+       protected function initShortcutGroups($params = array(), TYPO3AJAX &$ajaxObj = NULL) {
+                       // Groups from TSConfig
+               $bookmarkGroups = $GLOBALS['BE_USER']->getTSConfigProp('options.bookmarkGroups');
+
+               if (is_array($bookmarkGroups) && count($bookmarkGroups)) {
+                       foreach ($bookmarkGroups as $groupId => $label) {
+                               if (strcmp('', $label) && strcmp('0', $label)) {
+                                       $this->shortcutGroups[$groupId] = (string) $label;
+                               } elseif ($GLOBALS['BE_USER']->isAdmin()) {
+                                       unset($this->shortcutGroups[$groupId]);
+                               }
+                       }
+               }
+
+                       // Generate global groups, all global groups have negative IDs.
+               if (count($this->shortcutGroups)) {
+                       $groups = $this->shortcutGroups;
+                       foreach ($groups as $groupId => $groupLabel) {
+                               $this->shortcutGroups[($groupId * -1)] = $groupLabel;
+                       }
+               }
+
+                       // Group -100 is kind of superglobal and can't be changed.
+               $this->shortcutGroups[-100] = 1;
+
+                       // Add labels
+               foreach ($this->shortcutGroups as $groupId => $groupLabel) {
+                       $label = $groupLabel;
+
+                       if ($groupLabel == '1') {
+                               $label = $GLOBALS['LANG']->getLL('bookmark_group_'.abs($groupId), 1);
+
+                               if (empty($label)) {
+                                               // Fallback label
+                                       $label = $GLOBALS['LANG']->getLL('bookmark_group', 1).' '.abs($groupId);
+                               }
+                       }
+
+                       if ($groupId < 0) {
+                                       // Global group
+                               $label = $GLOBALS['LANG']->getLL('bookmark_global', 1).': '.
+                                       (!empty($label) ?
+                                               $label :
+                                               abs($groupId)
+                                       );
+
+                               if ($groupId == -100) {
+                                       $label = $GLOBALS['LANG']->getLL('bookmark_global', 1) . ': ' . $GLOBALS['LANG']->getLL('bookmark_all', 1);
+                               }
+                       }
+
+                       $this->shortcutGroups[$groupId] = $label;
+               }
+
+               return $this->shortcutGroups;
+       }
+
+       /**
+        * gets the available shortcut groups
+        *
+        * @param array $params Array of parameters from the AJAX interface, currently unused
+        * @param TYPO3AJAX $ajaxObj Object of type TYPO3AJAX
+        * @return void
+        */
+       public function getAjaxShortcutGroups($params = array(), TYPO3AJAX &$ajaxObj = NULL) {
+               $shortcutGroups = $this->shortcutGroups;
+
+               if (!$GLOBALS['BE_USER']->isAdmin()) {
+                       foreach ($shortcutGroups as $groupId => $groupName) {
+                               if (intval($groupId) < 0) {
+                                       unset($shortcutGroups[$groupId]);
+                               }
+                       }
+               }
+
+               $ajaxObj->addContent('shortcutGroups', $shortcutGroups);
+               $ajaxObj->setContentFormat('json');
+       }
+
+       /**
+        * Deletes a shortcut through an AJAX call
+        *
+        * @param array $params Array of parameters from the AJAX interface, currently unused
+        * @param TYPO3AJAX $ajaxObj Object of type TYPO3AJAX
+        * @return void
+        */
+       public function deleteAjaxShortcut($params = array(), TYPO3AJAX &$ajaxObj = NULL) {
+               $shortcutId   = (int) t3lib_div::_POST('shortcutId');
+               $fullShortcut = $this->getShortcutById($shortcutId);
+               $ajaxReturn   = 'failed';
+
+               if ($fullShortcut['raw']['userid'] == $GLOBALS['BE_USER']->user['uid']) {
+                       $GLOBALS['TYPO3_DB']->exec_DELETEquery(
+                               'sys_be_shortcuts',
+                               'uid = ' . $shortcutId
+                       );
+
+                       if ($GLOBALS['TYPO3_DB']->sql_affected_rows() == 1) {
+                               $ajaxReturn = 'deleted';
+                       }
+               }
+
+               $ajaxObj->addContent('delete', $ajaxReturn);
+       }
+
+       /**
+        * Creates a shortcut through an AJAX call
+        *
+        * @param array $params Array of parameters from the AJAX interface, currently unused
+        * @param TYPO3AJAX $ajaxObj Oject of type TYPO3AJAX
+        * @return void
+        */
+       public function createAjaxShortcut($params = array(), TYPO3AJAX &$ajaxObj = NULL) {
+               $shortcutCreated     = 'failed';
+                       // Default name
+               $shortcutName        = 'Shortcut';
+               $shortcutNamePrepend = '';
+
+               $url             = t3lib_div::_POST('url');
+               $module          = t3lib_div::_POST('module');
+               $motherModule    = t3lib_div::_POST('motherModName');
+
+                       // Determine shortcut type
+               $queryParts      = parse_url($url);
+               $queryParameters = t3lib_div::explodeUrl2Array($queryParts['query'], 1);
+
+                       // Proceed only if no scheme is defined, as URL is expected to be relative
+               if (empty($queryParts['scheme'])) {
+                       if (is_array($queryParameters['edit'])) {
+                               $shortcut['table']    = key($queryParameters['edit']);
+                               $shortcut['recordid'] = key($queryParameters['edit'][$shortcut['table']]);
+
+                               if ($queryParameters['edit'][$shortcut['table']][$shortcut['recordid']] == 'edit') {
+                                       $shortcut['type']    = 'edit';
+                                       $shortcutNamePrepend = $GLOBALS['LANG']->getLL('shortcut_edit', 1);
+                               } elseif ($queryParameters['edit'][$shortcut['table']][$shortcut['recordid']] == 'new') {
+                                       $shortcut['type']    = 'new';
+                                       $shortcutNamePrepend = $GLOBALS['LANG']->getLL('shortcut_create', 1);
+                               }
+                       } else {
+                               $shortcut['type'] = 'other';
+                       }
+
+                               // Lookup the title of this page and use it as default description
+                       $pageId = $shortcut['recordid'] ? $shortcut['recordid'] : $this->getLinkedPageId($url);
+
+                       if (t3lib_utility_Math::canBeInterpretedAsInteger($pageId)) {
+                               $page = t3lib_BEfunc::getRecord('pages', $pageId);
+                               if (count($page)) {
+                                               // Set the name to the title of the page
+                                       if ($shortcut['type'] == 'other') {
+                                               $shortcutName = $page['title'];
+                                       } else {
+                                               $shortcutName = $shortcutNamePrepend.' ' . $GLOBALS['LANG']->sL($GLOBALS['TCA'][$shortcut['table']]['ctrl']['title']) . ' (' . $page['title'] . ')';
+                                       }
+                               }
+                       } else {
+                               $dirName = urldecode($pageId);
+                               if (preg_match('/\/$/', $dirName)) {
+                                               // If $pageId is a string and ends with a slash,
+                                               // assume it is a fileadmin reference and set
+                                               // the description to the basename of that path
+                                       $shortcutName .= ' ' . basename($dirName);
+                               }
+                       }
+
+                               // adding the shortcut
+                       if ($module && $url) {
+                               $fieldValues = array(
+                                       'userid'      => $GLOBALS['BE_USER']->user['uid'],
+                                       'module_name' => $module . '|' . $motherModule,
+                                       'url'         => $url,
+                                       'description' => $shortcutName,
+                                       'sorting'     => $GLOBALS['EXEC_TIME'],
+                               );
+                               $GLOBALS['TYPO3_DB']->exec_INSERTquery('sys_be_shortcuts', $fieldValues);
+
+                               if ($GLOBALS['TYPO3_DB']->sql_affected_rows() == 1) {
+                                       $shortcutCreated = 'success';
+                               }
+                       }
+
+                       $ajaxObj->addContent('create', $shortcutCreated);
+               }
+       }
+
+       /**
+        * Gets called when a shortcut is changed, checks whether the user has
+        * permissions to do so and saves the changes if everything is ok
+        *
+        * @param array $params Array of parameters from the AJAX interface, currently unused
+        * @param TYPO3AJAX $ajaxObj Object of type TYPO3AJAX
+        * @return void
+        */
+       public function setAjaxShortcut($params = array(), TYPO3AJAX &$ajaxObj = NULL) {
+
+               $shortcutId      = (int) t3lib_div::_POST('shortcutId');
+               $shortcutName    = strip_tags(t3lib_div::_POST('value'));
+               $shortcutGroupId = (int) t3lib_div::_POST('shortcut-group');
+
+               if ($shortcutGroupId > 0 || $GLOBALS['BE_USER']->isAdmin()) {
+                               // Users can delete only their own shortcuts (except admins)
+                       $addUserWhere = (!$GLOBALS['BE_USER']->isAdmin() ?
+                               ' AND userid='.intval($GLOBALS['BE_USER']->user['uid'])
+                               : ''
+                       );
+
+                       $fieldValues = array(
+                               'description' => $shortcutName,
+                               'sc_group'    => $shortcutGroupId
+                       );
+
+                       if ($fieldValues['sc_group'] < 0 && !$GLOBALS['BE_USER']->isAdmin()) {
+                               $fieldValues['sc_group'] = 0;
+                       }
+
+                       $GLOBALS['TYPO3_DB']->exec_UPDATEquery(
+                               'sys_be_shortcuts',
+                               'uid=' . $shortcutId . $addUserWhere,
+                               $fieldValues
+                       );
+
+                       $affectedRows = $GLOBALS['TYPO3_DB']->sql_affected_rows();
+                       if ($affectedRows == 1) {
+                               $ajaxObj->addContent('shortcut', $shortcutName);
+                       } else {
+                               $ajaxObj->addContent('shortcut', 'failed');
+                       }
+               }
+
+               $ajaxObj->setContentFormat('plain');
+       }
+
+       /**
+        * Gets the label for a shortcut group
+        *
+        * @param integer $groupId A shortcut group id
+        * @return string The shortcut group label, can be an empty string if no group was found for the id
+        */
+       protected function getShortcutGroupLabel($groupId) {
+               $label = '';
+
+               if ($this->shortcutGroups[$groupId]) {
+                       $label = $this->shortcutGroups[$groupId];
+               }
+
+               return $label;
+       }
+
+       /**
+        * Gets a list of global groups, shortcuts in these groups are available to all users
+        *
+        * @return array Array of global groups
+        */
+       protected function getGlobalShortcutGroups() {
+               $globalGroups = array();
+
+               foreach ($this->shortcutGroups as $groupId => $groupLabel) {
+                       if ($groupId < 0) {
+                               $globalGroups[$groupId] = $groupLabel;
+                       }
+               }
+
+               return $globalGroups;
+       }
+
+       /**
+        * runs through the available shortcuts an collects their groups
+        *
+        * @return array Array of groups which have shortcuts
+        */
+       protected function getGroupsFromShortcuts() {
+               $groups = array();
+
+               foreach ($this->shortcuts as $shortcut) {
+                       $groups[$shortcut['group']] = $this->shortcutGroups[$shortcut['group']];
+               }
+
+               return array_unique($groups);
+       }
+
+       /**
+        * Gets the icon for the shortcut
+        *
+        * @param array $row
+        * @param array $shortcut
+        * @return string Shortcut icon as img tag
+        */
+       protected function getShortcutIcon($row, $shortcut) {
+               switch ($row['module_name']) {
+                       case 'xMOD_alt_doc.php':
+                               $table                          = $shortcut['table'];
+                               $recordid                       = $shortcut['recordid'];
+
+                               if ($shortcut['type'] == 'edit') {
+                                               // Creating the list of fields to include in the SQL query:
+                                       $selectFields = $this->fieldArray;
+                                       $selectFields[] = 'uid';
+                                       $selectFields[] = 'pid';
+
+                                       if ($table=='pages') {
+                                               if (t3lib_extMgm::isLoaded('cms')) {
+                                                       $selectFields[] = 'module';
+                                                       $selectFields[] = 'extendToSubpages';
+                                               }
+                                               $selectFields[] = 'doktype';
+                                       }
+
+                                       if (is_array($GLOBALS['TCA'][$table]['ctrl']['enablecolumns'])) {
+                                               $selectFields = array_merge($selectFields, $GLOBALS['TCA'][$table]['ctrl']['enablecolumns']);
+                                       }
+
+                                       if ($GLOBALS['TCA'][$table]['ctrl']['type']) {
+                                               $selectFields[] = $GLOBALS['TCA'][$table]['ctrl']['type'];
+                                       }
+
+                                       if ($GLOBALS['TCA'][$table]['ctrl']['typeicon_column']) {
+                                               $selectFields[] = $GLOBALS['TCA'][$table]['ctrl']['typeicon_column'];
+                                       }
+
+                                       if ($GLOBALS['TCA'][$table]['ctrl']['versioningWS']) {
+                                               $selectFields[] = 't3ver_state';
+                                       }
+
+                                               // Unique list!
+                                       $selectFields     = array_unique($selectFields);
+                                       $permissionClause = ($table=='pages' && $this->perms_clause) ?
+                                               ' AND ' . $this->perms_clause :
+                                               '';
+
+                                       $sqlQueryParts = array(
+                                               'SELECT' => implode(',', $selectFields),
+                                               'FROM'   => $table,
+                                               'WHERE'  => 'uid IN (' . $recordid . ') ' . $permissionClause .
+                                               t3lib_BEfunc::deleteClause($table) .
+                                               t3lib_BEfunc::versioningPlaceholderClause($table)
+                                       );
+                                       $result = $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($sqlQueryParts);
+                                       $row    = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result);
+
+                                       $icon = t3lib_iconWorks::getIcon($table, $row, $this->backPath);
+                               } elseif ($shortcut['type'] == 'new') {
+                                       $icon = t3lib_iconWorks::getIcon($table, '', $this->backPath);
+                               }
+
+                               $icon = t3lib_iconWorks::skinImg($this->backPath, $icon, '', 1);
+                               break;
+                       case 'xMOD_file_edit.php':
+                               $icon = 'gfx/edit_file.gif';
+                               break;
+                       case 'xMOD_wizard_rte.php':
+                               $icon = 'gfx/edit_rtewiz.gif';
+                               break;
+                       default:
+                               if ($GLOBALS['LANG']->moduleLabels['tabs_images'][$row['module_name'].'_tab']) {
+                                       $icon = $GLOBALS['LANG']->moduleLabels['tabs_images'][$row['module_name'].'_tab'];
+
+                                               // Change icon of fileadmin references - otherwise it doesn't differ with Web->List
+                                       $icon = str_replace('mod/file/list/list.gif', 'mod/file/file.gif', $icon);
+
+                                       if (t3lib_div::isAbsPath($icon)) {
+                                               $icon = '../'.substr($icon, strlen(PATH_site));
+                                       }
+                               } else {
+                                       $icon = 'gfx/dummy_module.gif';
+                               }
+               }
+
+               return '<img src="' . $icon . '" alt="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:toolbarItems.shortcut', TRUE) . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:toolbarItems.shortcut', TRUE) . '" />';
+       }
+
+       /**
+        * Returns title for the shortcut icon
+        *
+        * @param string $shortcutLabel Shortcut label
+        * @param string $moduleName Backend module name (key)
+        * @param string $parentModuleName Parent module label
+        * @return string Title for the shortcut icon
+        */
+       protected function getShortcutIconTitle($shortcutLabel, $moduleName, $parentModuleName = '') {
+               $title = '';
+
+               if (substr($moduleName, 0, 5) == 'xMOD_') {
+                       $title = substr($moduleName, 5);
+               } else {
+                       $splitModuleName = explode('_', $moduleName);
+                       $title = $GLOBALS['LANG']->moduleLabels['tabs'][$splitModuleName[0].'_tab'];
+
+                       if (count($splitModuleName) > 1) {
+                               $title .= '>' . $GLOBALS['LANG']->moduleLabels['tabs'][$moduleName . '_tab'];
+                       }
+               }
+
+               if ($parentModuleName) {
+                       $title .= ' (' . $parentModuleName . ')';
+               }
+
+               $title .= ': ' . $shortcutLabel;
+
+               return $title;
+       }
+
+       /**
+        * Return the ID of the page in the URL if found.
+        *
+        * @param string $url The URL of the current shortcut link
+        * @return string If a page ID was found, it is returned. Otherwise: 0
+        */
+       protected function getLinkedPageId($url) {
+               return preg_replace('/.*[\?&]id=([^&]+).*/', '$1', $url);
+       }
+
+}
+?>
\ No newline at end of file
diff --git a/typo3/classes/class.typo3_tcefile.php b/typo3/classes/class.typo3_tcefile.php
new file mode 100644 (file)
index 0000000..56e8076
--- /dev/null
@@ -0,0 +1,177 @@
+<?php
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 1999-2011 Kasper Skårhøj (kasperYYYY@typo3.com)
+*  (c) 2009-2011 Benjamin Mack (benni.typo3.org)
+*  All rights reserved
+*
+*  This script is part of the TYPO3 project. The TYPO3 project is
+*  free software; you can redistribute it and/or modify
+*  it under the terms of the GNU General Public License as published by
+*  the Free Software Foundation; either version 2 of the License, or
+*  (at your option) any later version.
+*
+*  The GNU General Public License can be found at
+*  http://www.gnu.org/copyleft/gpl.html.
+*  A copy is found in the textfile GPL.txt and important notices to the license
+*  from the author is found in LICENSE.txt distributed with these scripts.
+*
+*
+*  This script is distributed in the hope that it will be useful,
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*  GNU General Public License for more details.
+*
+*  This copyright notice MUST APPEAR in all copies of the script!
+***************************************************************/
+/**
+ * Gateway for TCE (TYPO3 Core Engine) file-handling through POST forms.
+ * This script serves as the fileadministration part of the TYPO3 Core Engine.
+ * Basically it includes two libraries which are used to manipulate files on the server.
+ * Before TYPO3 4.3, it was located in typo3/tce_file.php and redirected back to a
+ * $redirectURL. Since 4.3 this class is also used for accessing via AJAX
+ *
+ *
+ * For syntax and API information, see the document 'TYPO3 Core APIs'
+ *
+ * Revised for TYPO3 3.6 July/2003 by Kasper Skårhøj
+ * Revised for TYPO3 4.3 Mar/2009 by Benjamin Mack
+ *
+ * @author Kasper Skårhøj <kasperYYYY@typo3.com>
+ */
+
+require_once(PATH_typo3 . 'template.php');
+
+/**
+ * Script Class, handling the calling of methods in the file admin classes.
+ *
+ * @author Kasper Skårhøj <kasperYYYY@typo3.com>
+ * @package TYPO3
+ * @subpackage core
+ */
+class TYPO3_tcefile {
+
+               // Internal, static: GPvar:
+               // Array of file-operations.
+       protected $file;
+               // Clipboard operations array
+       protected $CB;
+               // If existing files should be overridden.
+       protected $overwriteExistingFiles;
+               // VeriCode - a hash of server specific value and other things which
+               // identifies if a submission is OK. (see $GLOBALS['BE_USER']->veriCode())
+       protected $vC;
+               // the page where the user should be redirected after everything is done
+       protected $redirect;
+
+               // Internal, dynamic:
+               // File processor object
+       protected $fileProcessor;
+               // the result array from the file processor
+       protected $fileData;
+
+       /**
+        * Registering incoming data
+        *
+        * @return void
+        */
+       public function init() {
+                       // Set the GPvars from outside
+               $this->file = t3lib_div::_GP('file');
+               $this->CB = t3lib_div::_GP('CB');
+               $this->overwriteExistingFiles = t3lib_div::_GP('overwriteExistingFiles');
+               $this->vC = t3lib_div::_GP('vC');
+               $this->redirect = t3lib_div::sanitizeLocalUrl(t3lib_div::_GP('redirect'));
+
+               $this->initClipboard();
+       }
+
+       /**
+        * Initialize the Clipboard. This will fetch the data about files to paste/delete if such an action has been sent.
+        *
+        * @return void
+        */
+       public function initClipboard() {
+               if (is_array($this->CB)) {
+                       $clipObj = t3lib_div::makeInstance('t3lib_clipboard');
+                       $clipObj->initializeClipboard();
+                       if ($this->CB['paste']) {
+                               $clipObj->setCurrentPad($this->CB['pad']);
+                               $this->file = $clipObj->makePasteCmdArray_file($this->CB['paste'], $this->file);
+                       }
+                       if ($this->CB['delete']) {
+                               $clipObj->setCurrentPad($this->CB['pad']);
+                               $this->file = $clipObj->makeDeleteCmdArray_file($this->file);
+                       }
+               }
+       }
+
+       /**
+        * Performing the file admin action:
+        * Initializes the objects, setting permissions, sending data to object.
+        *
+        * @return void
+        */
+       public function main() {
+                       // Initializing:
+               $this->fileProcessor = t3lib_div::makeInstance('t3lib_extFileFunctions');
+               $this->fileProcessor->init($GLOBALS['FILEMOUNTS'], $GLOBALS['TYPO3_CONF_VARS']['BE']['fileExtensions']);
+               $this->fileProcessor->init_actionPerms($GLOBALS['BE_USER']->getFileoperationPermissions());
+               $this->fileProcessor->dontCheckForUnique = ($this->overwriteExistingFiles ? 1 : 0);
+
+                       // Checking referer / executing:
+               $refInfo = parse_url(t3lib_div::getIndpEnv('HTTP_REFERER'));
+               $httpHost = t3lib_div::getIndpEnv('TYPO3_HOST_ONLY');
+               if ($httpHost != $refInfo['host']
+                       && $this->vC != $GLOBALS['BE_USER']->veriCode()
+                       && !$GLOBALS['TYPO3_CONF_VARS']['SYS']['doNotCheckReferer']
+                       && $GLOBALS['CLIENT']['BROWSER'] != 'flash') {
+                       $this->fileProcessor->writeLog(0, 2, 1, 'Referer host "%s" and server host "%s" did not match!', array($refInfo['host'], $httpHost));
+               } else {
+                       $this->fileProcessor->start($this->file);
+                       $this->fileData = $this->fileProcessor->processData();
+               }
+       }
+
+       /**
+        * Redirecting the user after the processing has been done.
+        * Might also display error messages directly, if any.
+        *
+        * @return void
+        */
+       public function finish() {
+                       // Prints errors, if there are any
+               $this->fileProcessor->printLogErrorMessages($this->redirect);
+               t3lib_BEfunc::setUpdateSignal('updateFolderTree');
+               if ($this->redirect) {
+                       t3lib_utility_Http::redirect($this->redirect);
+               }
+       }
+
+       /**
+        * Handles the actual process from within the ajaxExec function
+        * therefore, it does exactly the same as the real typo3/tce_file.php
+        * but without calling the "finish" method, thus makes it simpler to deal with the
+        * actual return value
+        *
+        * @param array $params Always empty.
+        * @param TYPO3AJAX $ajaxObj The Ajax object used to return content and set content types
+        * @return void
+        */
+       public function processAjaxRequest(array $params, TYPO3AJAX $ajaxObj) {
+               $this->init();
+               $this->main();
+               $errors = $this->fileProcessor->getErrorMessages();
+               if (count($errors)) {
+                       $ajaxObj->setError(implode(',', $errors));
+               } else {
+                       $ajaxObj->addContent('result', $this->fileData);
+                       if ($this->redirect) {
+                               $ajaxObj->addContent('redirect', $this->redirect);
+                       }
+                       $ajaxObj->setContentFormat('json');
+               }
+       }
+}
+?>
\ No newline at end of file
diff --git a/typo3/classes/class.typo3ajax.php b/typo3/classes/class.typo3ajax.php
new file mode 100644 (file)
index 0000000..5184f8c
--- /dev/null
@@ -0,0 +1,293 @@
+<?php
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2008-2011 Benjamin Mack <mack@xnos.org>
+*  All rights reserved
+*
+*  This script is part of the TYPO3 project. The TYPO3 project is
+*  free software; you can redistribute it and/or modify
+*  it under the terms of the GNU General Public License as published by
+*  the Free Software Foundation; either version 2 of the License, or
+*  (at your option) any later version.
+*
+*  The GNU General Public License can be found at
+*  http://www.gnu.org/copyleft/gpl.html.
+*  A copy is found in the textfile GPL.txt and important notices to the license
+*  from the author is found in LICENSE.txt distributed with these scripts.
+*
+*
+*  This script is distributed in the hope that it will be useful,
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*  GNU General Public License for more details.
+*
+*  This copyright notice MUST APPEAR in all copies of the script!
+***************************************************************/
+
+/**
+ * Class to hold all the information about an AJAX call and send
+ * the right headers for the request type
+ *
+ * @author Benjamin Mack <mack@xnos.org>
+ * @package TYPO3
+ * @subpackage core
+ */
+class TYPO3AJAX {
+       protected $ajaxId        = NULL;
+       protected $errorMessage  = NULL;
+       protected $isError       = FALSE;
+       protected $content       = array();
+       protected $contentFormat = 'plain';
+       protected $charset       = 'utf-8';
+       protected $requestCharset = 'utf-8';
+       protected $javascriptCallbackWrap = '
+               <script type="text/javascript">
+                       /*<![CDATA[*/
+                       response = |;
+                       /*]]>*/
+               </script>
+       ';
+
+       /**
+        * Sets the charset and the ID for the AJAX call
+        * due to some charset limitations in Javascript (prototype uses encodeURIcomponent, which converts
+        * all data to utf-8), we need to detect if the encoding of the request differs from the
+        * backend encoding, and then convert all incoming data (_GET and _POST)
+        * in the expected backend encoding.
+        *
+        * @param string $ajaxId The AJAX id
+        */
+       public function __construct($ajaxId) {
+
+                       // Get charset from current AJAX request (which is expected to be utf-8)
+               preg_match('/;\s*charset\s*=\s*([a-zA-Z0-9_-]*)/i', $_SERVER['CONTENT_TYPE'], $contenttype);
+               $charset = $GLOBALS['LANG']->csConvObj->parse_charset($contenttype[1]);
+               if ($charset && $charset != $this->requestCharset) {
+                       $this->requestCharset = $charset;
+               }
+
+                       // If the AJAX request does not have the same encoding like the backend
+                       // we need to convert the POST and GET parameters in the right charset
+               if ($this->charset != $this->requestCharset) {
+                       $GLOBALS['LANG']->csConvObj->convArray($_POST, $this->requestCharset, $this->charset);
+                       $GLOBALS['LANG']->csConvObj->convArray($_GET, $this->requestCharset, $this->charset);
+               }
+
+               $this->ajaxId = $ajaxId;
+       }
+
+       /**
+        * Returns the ID for the AJAX call
+        *
+        * @return string The AJAX id
+        */
+       public function getAjaxID() {
+               return $this->ajaxId;
+       }
+
+       /**
+        * Overwrites the existing content with the first parameter
+        *
+        * @param array $content The new content
+        * @return mixed The old content as array; if the new content was not an array, FALSE is returned
+        */
+       public function setContent($content) {
+               $oldcontent = FALSE;
+               if (is_array($content)) {
+                       $oldcontent = $this->content;
+                       $this->content = $content;
+               }
+               return $oldcontent;
+       }
+
+       /**
+        * Adds new content
+        *
+        * @param string $key The new content key where the content should be added in the content array
+        * @param string $content The new content to add
+        * @return mixed The old content; if the old content didn't exist before, FALSE is returned
+        */
+       public function addContent($key, $content) {
+               $oldcontent = FALSE;
+               if (array_key_exists($key, $this->content)) {
+                       $oldcontent = $this->content[$key];
+               }
+               if (!isset($content) || empty($content)) {
+                       unset($this->content[$key]);
+               } elseif (!isset($key) || empty($key)) {
+                       $this->content[] = $content;
+               } else {
+                       $this->content[$key] = $content;
+               }
+               return $oldcontent;
+       }
+
+       /**
+        * Returns the content for the ajax call
+        *
+        * @return mixed The content for a specific key or the whole content
+        */
+       public function getContent($key = '') {
+               return ($key && array_key_exists($key, $this->content) ? $this->content[$key] : $this->content);
+       }
+
+       /**
+        * Sets the content format for the ajax call
+        *
+        * @param string $format Can be one of 'plain' (default), 'xml', 'json', 'javascript', 'jsonbody' or 'jsonhead'
+        * @return void
+        */
+       public function setContentFormat($format) {
+               if (t3lib_div::inArray(array('plain', 'xml', 'json', 'jsonhead', 'jsonbody', 'javascript'), $format)) {
+                       $this->contentFormat = $format;
+               }
+       }
+
+       /**
+        * Specifies the wrap to be used if contentFormat is "javascript".
+        * The wrap used by default stores the results in a variable "response" and
+        * adds <script>-Tags around it.
+        *
+        * @param string $javascriptCallbackWrap The javascript callback wrap to be used
+        * @return void
+        */
+       public function setJavascriptCallbackWrap($javascriptCallbackWrap) {
+               $this->javascriptCallbackWrap = $javascriptCallbackWrap;
+       }
+
+       /**
+        * Sets an error message and the error flag
+        *
+        * @param string $errorMsg The error message
+        * @return void
+        */
+       public function setError($errorMsg = '') {
+               $this->errorMessage = $errorMsg;
+               $this->isError = TRUE;
+       }
+
+       /**
+        * Checks whether an error occured during the execution or not
+        *
+        * @return boolean Whether this AJAX call had errors
+        */
+       public function isError() {
+               return $this->isError;
+       }
+
+       /**
+        * Renders the AJAX call based on the $contentFormat variable and exits the request
+        *
+        * @return void
+        */
+       public function render() {
+               if ($this->isError) {
+                       $this->renderAsError();
+                       exit;
+               }
+               switch ($this->contentFormat) {
+                       case 'jsonhead':
+                       case 'jsonbody':
+                       case 'json':
+                               $this->renderAsJSON();
+                               break;
+                       case 'javascript':
+                               $this->renderAsJavascript();
+                               break;
+                       case 'xml':
+                               $this->renderAsXML();
+                               break;
+                       default:
+                               $this->renderAsPlain();
+               }
+               exit;
+       }
+
+       /**
+        * Renders the AJAX call in XML error style to handle with JS
+        * the "responseXML" of the transport object will be filled with the error message then
+        *
+        * @return void
+        */
+       protected function renderAsError() {
+               header(t3lib_utility_Http::HTTP_STATUS_500 . ' (AJAX)');
+               header('Content-type: text/xml; charset=' . $this->charset);
+               header('X-JSON: false');
+               die('<t3err>'.htmlspecialchars($this->errorMessage).'</t3err>');
+       }
+
+       /**
+        * Renders the AJAX call with text/html headers
+        * the content will be available in the "responseText" value of the transport object
+        *
+        * @return void
+        */
+       protected function renderAsPlain() {
+               header('Content-type: text/html; charset=' . $this->charset);
+               header('X-JSON: true');
+               echo implode('', $this->content);
+       }
+
+       /**
+        * Renders the AJAX call with text/xml headers
+        * the content will be available in the "responseXML" value of the transport object
+        *
+        * @return void
+        */
+       protected function renderAsXML() {
+               header('Content-type: text/xml; charset=' . $this->charset);
+               header('X-JSON: true');
+               echo implode('', $this->content);
+       }
+
+       /**
+        * Renders the AJAX call with JSON evaluated headers
+        * note that you need to have requestHeaders: {Accept: 'application/json'},
+        * in your AJAX options of your AJAX request object in JS
+        *
+        * the content will be available
+        *    - in the second parameter of the onSuccess / onComplete callback (except when contentFormat = 'jsonbody')
+        *    - and in the xhr.responseText as a string (except when contentFormat = 'jsonhead')
+        *         you can evaluate this in JS with xhr.responseText.evalJSON();
+        *
+        * @return void
+        */
+       protected function renderAsJSON() {
+                       // If the backend does not run in UTF-8 then we need to convert it to unicode as
+                       // the json_encode method will return empty otherwise
+               if ($this->charset != $this->requestCharset) {
+                       $GLOBALS['LANG']->csConvObj->convArray($this->content, $this->charset, $this->requestCharset);
+               }
+
+               $content = json_encode($this->content);
+
+               header('Content-type: application/json; charset=' . $this->requestCharset);
+               header('X-JSON: ' . ($this->contentFormat != 'jsonbody' ? $content : TRUE));
+
+                       // Bring content in xhr.responseText except when in "json head only" mode
+               if ($this->contentFormat != 'jsonhead') {
+                       echo $content;
+               }
+       }
+
+       /**
+        * Renders the AJAX call as inline JSON inside a script tag. This is useful
+        * when an iframe is used as the AJAX transport.
+        *
+        * @return void
+        */
+       protected function renderAsJavascript() {
+                       // If the backend does not run in UTF-8 then we need to convert it to unicode as
+                       // the json_encode method will return empty otherwise
+               if ($this->charset != $this->requestCharset) {
+                       $GLOBALS['LANG']->csConvObj->convArray($this->content, $this->charset, $this->requestCharset);
+               }
+
+               $content = str_replace('|', json_encode($this->content), $this->javascriptCallbackWrap);
+
+               header('Content-type: text/html; charset=' . $this->requestCharset);
+               echo $content;
+       }
+}
+?>
\ No newline at end of file
diff --git a/typo3/classes/class.typo3logo.php b/typo3/classes/class.typo3logo.php
new file mode 100644 (file)
index 0000000..b29b100
--- /dev/null
@@ -0,0 +1,91 @@
+<?php
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2007-2011 Ingo Renner <ingo@typo3.org>
+*  All rights reserved
+*
+*  This script is part of the TYPO3 project. The TYPO3 project is
+*  free software; you can redistribute it and/or modify
+*  it under the terms of the GNU General Public License as published by
+*  the Free Software Foundation; either version 2 of the License, or
+*  (at your option) any later version.
+*
+*  The GNU General Public License can be found at
+*  http://www.gnu.org/copyleft/gpl.html.
+*  A copy is found in the textfile GPL.txt and important notices to the license
+*  from the author is found in LICENSE.txt distributed with these scripts.
+*
+*
+*  This script is distributed in the hope that it will be useful,
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*  GNU General Public License for more details.
+*
+*  This copyright notice MUST APPEAR in all copies of the script!
+***************************************************************/
+
+/**
+ * class to render the TYPO3 logo in the backend
+ *
+ * @author Ingo Renner <ingo@typo3.org>
+ * @package TYPO3
+ * @subpackage core
+ */
+class TYPO3Logo {
+
+       protected $logo;
+
+       /**
+        * constructor
+        */
+       public function __construct() {
+               $this->logo = NULL;
+       }
+
+       /**
+        * renders the actual logo code
+        *
+        * @return string Logo html code snippet to use in the backend
+        */
+       public function render() {
+
+                       // Default
+               $logoFile = 'gfx/alt_backend_logo.gif';
+               if (is_string($this->logo)) {
+                               // Overwrite
+                       $logoFile = $this->logo;
+               }
+               $imgInfo = getimagesize(PATH_site . TYPO3_mainDir . $logoFile);
+
+
+               $logo = '<a href="' . TYPO3_URL_GENERAL . '" target="_blank">' .
+                               '<img' . t3lib_iconWorks::skinImg('', $logoFile, $imgInfo[3]) . ' title="TYPO3 Content Management System" alt="" />' .
+                               '</a>';
+
+                       // Overwrite with custom logo
+               if ($GLOBALS['TBE_STYLES']['logo']) {
+                       $imgInfo = @getimagesize(t3lib_div::resolveBackPath(PATH_typo3 . $GLOBALS['TBE_STYLES']['logo'], 3));
+                       $logo = '<a href="' . TYPO3_URL_GENERAL . '" target="_blank">' .
+                               '<img src="' . $GLOBALS['TBE_STYLES']['logo'] . '" ' . $imgInfo[3] . ' title="TYPO3 Content Management System" alt="" />' .
+                               '</a>';
+               }
+
+               return $logo;
+       }
+
+       /**
+        * Sets the logo
+        *
+        * @param string $logo Path to logo file as seen from typo3/
+        * @throws InvalidArgumentException
+        */
+       public function setLogo($logo) {
+               if (!is_string($logo)) {
+                       throw new InvalidArgumentException('parameter $logo must be of type string', 1194041104);
+               }
+
+               $this->logo = $logo;
+       }
+}
+?>
\ No newline at end of file
index 3ece8a1..b285474 100644 (file)
@@ -23,7 +23,7 @@
  * This copyright notice MUST APPEAR in all copies of the script!
  ***************************************************************/
 
-require_once(PATH_site . 'typo3/Classes/class.typo3ajax.php');
+require_once(PATH_site . 'typo3/classes/class.typo3ajax.php');
 
 /**
  * eID controller for ExtDirect
@@ -81,4 +81,4 @@ class tslib_ExtDirectEid {
        }
 }
 
-?>
+?>
\ No newline at end of file
index 7d14199..8b67b9f 100644 (file)
@@ -137,7 +137,7 @@ class tx_t3editor_hooks_fileedit {
                $savingsuccess = FALSE;
                if ($parameters['type'] == $this->ajaxSaveType) {
                        require_once('init.php');
-                       require_once('Classes/class.typo3_tcefile.php');
+                       require_once('classes/class.typo3_tcefile.php');
 
                        $tceFile = t3lib_div::makeInstance('TYPO3_tcefile');
                        $tceFile->processAjaxRequest(array(), $parameters['ajaxObj']);
@@ -148,4 +148,4 @@ class tx_t3editor_hooks_fileedit {
                return $savingsuccess;
        }
 }
-?>
+?>
\ No newline at end of file
index bbafd8b..5fd325b 100644 (file)
@@ -38,7 +38,7 @@
  */
 
 require_once('init.php');
-require_once('Classes/class.typo3_tcefile.php');
+require_once('classes/class.typo3_tcefile.php');
 
        // Make instance:
 $SOBE = t3lib_div::makeInstance('TYPO3_tcefile');
@@ -46,4 +46,4 @@ $SOBE->init();
 $SOBE->main();
 $SOBE->finish();
 
-?>
+?>
\ No newline at end of file