reverted changes to private properties
[Packages/TYPO3.CMS.git] / typo3 / classes / class.clearcachemenu.php
index 79e7c86..6d7c492 100644 (file)
@@ -2,7 +2,7 @@
 /***************************************************************
 *  Copyright notice
 *
-*  (c) 2007 Ingo Renner <ingo@typo3.org>
+*  (c) 2007-2008 Ingo Renner <ingo@typo3.org>
 *  All rights reserved
 *
 *  This script is part of the TYPO3 project. The TYPO3 project is
  */
 class ClearCacheMenu implements backend_toolbarItem {
 
-       private $cacheActions;
+       protected $cacheActions;
 
        /**
         * reference back to the backend object
         *
         * @var TYPO3backend
         */
-       private $backendReference;
+       protected $backendReference;
 
        /**
         * constructor
@@ -56,25 +56,29 @@ class ClearCacheMenu implements backend_toolbarItem {
                $this->cacheActions     = array();
 
                        // Clear cache for ALL tables!
-               $title = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:rm.clearCacheMenu_all');
-               $this->cacheActions[] = array(
-                       'id'    => 'all',
-                       'title' => $title,
-                       'href'  => $this->backPath.'tce_db.php?vC='.$GLOBALS['BE_USER']->veriCode().'&cacheCmd=all',
-                       'icon'  => '<img'.t3lib_iconWorks::skinImg($this->backPath, 'gfx/lightning_red.png', 'width="16" height="16"').' title="'.htmlspecialchars($title).'" alt="" />'
-               );
+               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');
+                       $this->cacheActions[] = array(
+                               'id'    => 'all',
+                               'title' => $title,
+                               'href'  => $this->backPath.'tce_db.php?vC='.$GLOBALS['BE_USER']->veriCode().'&cacheCmd=all',
+                               'icon'  => '<img'.t3lib_iconWorks::skinImg($this->backPath, 'gfx/lightning_red.png', 'width="16" height="16"').' title="'.htmlspecialchars($title).'" alt="" />'
+                       );
+               }
 
                        // Clear cache for either ALL pages
-               $title = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:rm.clearCacheMenu_pages');
-               $this->cacheActions[] = array(
-                       'id'    => 'pages',
-                       'title' => $title,
-                       'href'  => $this->backPath.'tce_db.php?vC='.$GLOBALS['BE_USER']->veriCode().'&cacheCmd=pages',
-                       'icon'  => '<img'.t3lib_iconWorks::skinImg($this->backPath, 'gfx/lightning.png', 'width="16" height="16"').' title="'.htmlspecialchars($title).'" alt="" />'
-               );
+               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');
+                       $this->cacheActions[] = array(
+                               'id'    => 'pages',
+                               'title' => $title,
+                               'href'  => $this->backPath.'tce_db.php?vC='.$GLOBALS['BE_USER']->veriCode().'&cacheCmd=pages',
+                               'icon'  => '<img'.t3lib_iconWorks::skinImg($this->backPath, 'gfx/lightning.png', 'width="16" height="16"').' title="'.htmlspecialchars($title).'" alt="" />'
+                       );
+               }
 
                        // Clearing of cache-files in typo3conf/ + menu
-               if ($GLOBALS['TYPO3_CONF_VARS']['EXT']['extCache'])     {
+               if($GLOBALS['BE_USER']->isAdmin() && $GLOBALS['TYPO3_CONF_VARS']['EXT']['extCache']) {
                        $title = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:rm.clearCacheMenu_allTypo3Conf');
                        $this->cacheActions[] = array(
                                'id'    => 'temp_CACHED',
@@ -92,7 +96,11 @@ class ClearCacheMenu implements backend_toolbarItem {
         * @return  boolean  true if user has access, false if not
         */
        public function checkAccess() {
-               return $GLOBALS['BE_USER']->isAdmin();
+               return (
+                       $GLOBALS['BE_USER']->isAdmin()
+                       || $GLOBALS['BE_USER']->getTSConfigVal('options.clearCache.pages')
+                       || $GLOBALS['BE_USER']->getTSConfigVal('options.clearCache.all')
+               );
        }
 
        /**
@@ -118,7 +126,7 @@ class ClearCacheMenu implements backend_toolbarItem {
        }
 
        /**
-        * adds the neccessary javascript ot the backend
+        * adds the neccessary javascript to the backend
         *
         * @return      void
         */
@@ -141,4 +149,4 @@ if(defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/classe
        include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/classes/class.clearcachemenu.php']);
 }
 
-?>
\ No newline at end of file
+?>