[ Index ]

PHP Cross Reference of Joomla 1.5.26 DE

title

Body

[close]

/administrator/components/com_cache/ -> admin.cache.php (source)

   1  <?php
   2  /**
   3   * @version        $Id: admin.cache.php 14401 2010-01-26 14:10:00Z louis $
   4   * @package        Joomla
   5   * @subpackage    Cache
   6   * @copyright    Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved.
   7   * @license        GNU/GPL, see LICENSE.php
   8   * Joomla! is free software. This version may have been modified pursuant
   9   * to the GNU General Public License, and as distributed it includes or
  10   * is derivative of works licensed under the GNU General Public License or
  11   * other free or open source software licenses.
  12   * See COPYRIGHT.php for copyright notices and details.
  13   */
  14  
  15  // no direct access
  16  defined( '_JEXEC' ) or die( 'Restricted access' );
  17  
  18  /*
  19   * Make sure the user is authorized to view this page
  20   */
  21  $user =& JFactory::getUser();
  22  if (!$user->authorize( 'com_cache', 'manage' )) {
  23      $mainframe->redirect( 'index.php', JText::_('ALERTNOTAUTH') );
  24  }
  25  
  26  // Load the html output class and the model class
  27  require_once (JApplicationHelper::getPath('admin_html'));
  28  require_once (JApplicationHelper::getPath('class'));
  29  
  30  $cid = JRequest::getVar( 'cid', array(0), 'post', 'array' );
  31  
  32  /*
  33   * This is our main control structure for the component
  34   *
  35   * Each view is determined by the $task variable
  36   */
  37  switch ( JRequest::getVar( 'task' ) )
  38  {
  39      case 'delete':
  40          CacheController::deleteCache($cid);
  41          CacheController::showCache();
  42          break;
  43      case 'purgeadmin':
  44          CacheController::showPurgeCache();
  45          break;
  46      case 'purge':
  47          CacheController::purgeCache();
  48          break;
  49      default :
  50          CacheController::showCache();
  51          break;
  52  }
  53  
  54  /**
  55   * Static class to hold controller functions for the Cache component
  56   *
  57   * @static
  58   * @package        Joomla
  59   * @subpackage    Weblinks
  60   * @since        1.5
  61   */
  62  class CacheController
  63  {
  64      /**
  65       * Show the cache
  66       *
  67       * @since    1.5
  68       */
  69  	function showCache()
  70      {
  71          global $mainframe, $option;
  72          $submenu = JRequest::getVar('client', '0', '', 'int');
  73          $client     =& JApplicationHelper::getClientInfo($submenu);
  74          if ($submenu == 1) {
  75              JSubMenuHelper::addEntry(JText::_('Site'), 'index.php?option=com_cache&client=0');
  76              JSubMenuHelper::addEntry(JText::_('Administrator'), 'index.php?option=com_cache&client=1', true);
  77          } else {
  78              JSubMenuHelper::addEntry(JText::_('Site'), 'index.php?option=com_cache&client=0', true);
  79              JSubMenuHelper::addEntry(JText::_('Administrator'), 'index.php?option=com_cache&client=1');
  80          }
  81  
  82          $limit        = $mainframe->getUserStateFromRequest( 'global.list.limit', 'limit', $mainframe->getCfg('list_limit'));
  83          $limitstart = $mainframe->getUserStateFromRequest( $option.'.limitstart', 'limitstart', 0 );
  84  
  85          $cmData = new CacheData($client->path.DS.'cache');
  86  
  87          jimport('joomla.html.pagination');
  88          $pageNav = new JPagination( $cmData->getGroupCount(), $limitstart, $limit );
  89  
  90          CacheView::displayCache( $cmData->getRows( $limitstart, $limit ), $client, $pageNav );
  91      }
  92  
  93  	function deleteCache($cid)
  94      {
  95          // Check for request forgeries
  96          JRequest::checkToken() or jexit( 'Invalid Token' );
  97  
  98          $client    =& JApplicationHelper::getClientInfo(JRequest::getVar('client', '0', '', 'int'));
  99  
 100          $cmData = new CacheData($client->path.DS.'cache');
 101          $cmData->cleanCacheList( $cid );
 102      }
 103  	function showPurgeCache()
 104      {    
 105          // Check for request forgeries
 106          CacheView::showPurgeExecute();
 107      }
 108  	function purgeCache()
 109      {    
 110          // Check for request forgeries
 111          JRequest::checkToken() or jexit( 'Invalid Token' );
 112          $cache =& JFactory::getCache('');
 113          $cache->gc();
 114          CacheView::purgeSuccess();
 115      }
 116  }


Generated: Wed Mar 28 15:54:07 2012 Cross-referenced by PHPXref 0.7.1