Fixed bug #16680: Deactivate live search if list module is not available
authorJeff Segars <jsegars@alumni.rice.edu>
Sat, 22 Jan 2011 15:26:27 +0000 (15:26 +0000)
committerJeff Segars <jsegars@alumni.rice.edu>
Sat, 22 Jan 2011 15:26:27 +0000 (15:26 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@10252 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
typo3/backend.php
typo3/classes/class.livesearch.php

index d6daa47..a68a2bc 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2011-01-22  Jeff Segars  <jeff@webempoweredchurch.org>
+
+       * Fixed bug #16680: Deactivate live search if list module is not available
+
 2011-01-22  Susann Moog  <typo3@susanne-moog.de>
 
        * Fixed bug #17091: Pagetree: undelete recursive deleted pages only undeletes the top node, not the other child nodes of the deleted page (Thanks to Stefan Galinski)
index acd3d41..1db3288 100644 (file)
@@ -363,9 +363,11 @@ class TYPO3backend {
        protected function renderToolbar() {
 
                        // move search to last position
-               $search = $this->toolbarItems['liveSearch'];
-               unset($this->toolbarItems['liveSearch']);
-               $this->toolbarItems['liveSearch'] = $search;
+               if (array_key_exists('liveSearch', $this->toolbarItems)) {
+                       $search = $this->toolbarItems['liveSearch'];
+                       unset($this->toolbarItems['liveSearch']);
+                       $this->toolbarItems['liveSearch'] = $search;
+               }
 
                $toolbar = '<ul id="typo3-toolbar">';
                $toolbar.= '<li>'.$this->getLoggedInUserLabel().'</li>
index f51b4be..917493a 100644 (file)
@@ -58,8 +58,19 @@ class LiveSearch implements backend_toolbarItem {
         * @return  boolean  true if user has access, false if not
         */
        public function checkAccess() {
-                       // LiveSearch module is enabled for everybody
-               return true;
+               $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;
        }
 
        /**