Fixed bug #9575: use native filter_functions for validate and sanitize
[Packages/TYPO3.CMS.git] / typo3 / alt_menu.php
index 7797561..bf73111 100755 (executable)
@@ -2,7 +2,7 @@
 /***************************************************************
 *  Copyright notice
 *
-*  (c) 1999-2005 Kasper Skaarhoj (kasperYYYY@typo3.com)
+*  (c) 1999-2008 Kasper Skaarhoj (kasperYYYY@typo3.com)
 *  All rights reserved
 *
 *  This script is part of the TYPO3 project. The TYPO3 project is
@@ -120,7 +120,6 @@ class SC_alt_menu {
        function main() {
                global $BE_USER,$TYPO3_CONF_VARS,$TBE_TEMPLATE;
 
-               $TBE_TEMPLATE->docType='xhtml_trans';
                $TBE_TEMPLATE->divClass='vertical-menu';
                $TBE_TEMPLATE->bodyTagAdditions = 'onload="top.restoreHighlightedModuleMenuItem()"';
 
@@ -131,8 +130,10 @@ class SC_alt_menu {
                $alt_menuObj = t3lib_div::makeInstance('alt_menu_functions');
                $this->content.= $alt_menuObj->topMenu($this->loadModules->modules);
 
-                       // clear cache commands for Admins
-               if($BE_USER->isAdmin()) {       //  && $BE_USER->workspace===0 NOT used anyway because under a workspace developers might still like to clear cache!
+                       // clear cache commands for Admins and allowed users
+               if($GLOBALS['BE_USER']->isAdmin()
+               || $GLOBALS['BE_USER']->getTSConfigVal('options.clearCache.pages')
+               || $GLOBALS['BE_USER']->getTSConfigVal('options.clearCache.all')) {     //  && $BE_USER->workspace===0 NOT used anyway because under a workspace developers might still like to clear cache!
                        $functionsArray = $alt_menuObj->adminFunctions($backPath);
 
                        $this->content.='
@@ -154,12 +155,15 @@ class SC_alt_menu {
                                        </tr>';
 
                        $rows=array();
-                       foreach($functionsArray as $functionsArraySetup)        {
-                               $rows[]='
-                                       <tr class="c-subitem">
-                                               <td valign="top" align="center" class="icon">'.$functionsArraySetup['icon'].'</td>
-                                               <td><a href="'.htmlspecialchars($functionsArraySetup['href']).'">'.htmlspecialchars($functionsArraySetup['title']).'</a></td>
-                                       </tr>';
+                       foreach($functionsArray as $functionsArraySetup) {
+                               if(($functionsArraySetup['id'] == 'all' && ($GLOBALS['BE_USER']->isAdmin() || $GLOBALS['BE_USER']->getTSConfigVal('options.clearCache.all')))
+                               || ($functionsArraySetup['id'] == 'temp_CACHED' && $GLOBALS['BE_USER']->isAdmin())) {
+                                       $rows[]='
+                                               <tr class="c-subitem">
+                                                       <td valign="top" align="center" class="icon">'.$functionsArraySetup['icon'].'</td>
+                                                       <td><a href="'.htmlspecialchars($functionsArraySetup['href']).'">'.htmlspecialchars($functionsArraySetup['title']).'</a></td>
+                                               </tr>';
+                                       }
                        }
 
                                // Imploding around the divider table row:
@@ -227,4 +231,4 @@ $SOBE = t3lib_div::makeInstance('SC_alt_menu');
 $SOBE->init();
 $SOBE->main();
 $SOBE->printContent();
-?>
\ No newline at end of file
+?>