[ Index ]

PHP Cross Reference of Joomla 2.5.4 DE

title

Body

[close]

/administrator/components/com_cache/ -> controller.php (source)

   1  <?php
   2  /**
   3   * @package        Joomla.Administrator
   4   * @subpackage    com_cache
   5   * @copyright    Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.
   6   * @license        GNU General Public License version 2 or later; see LICENSE.txt
   7   */
   8  
   9  // no direct access
  10  defined('_JEXEC') or die;
  11  
  12  jimport('joomla.application.component.controller');
  13  
  14  /**
  15   * Cache Controller
  16   *
  17   * @package        Joomla.Administrator
  18   * @subpackage    com_cache
  19   * @since 1.6
  20   */
  21  class CacheController extends JController
  22  {
  23      /**
  24       * @param    boolean            If true, the view output will be cached
  25       * @param    array            An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}.
  26       *
  27       * @return    JController        This object to support chaining.
  28       * @since    1.5
  29       */
  30  	public function display($cachable = false, $urlparams = false)
  31      {
  32          require_once  JPATH_COMPONENT.'/helpers/cache.php';
  33  
  34          // Get the document object.
  35          $document    = JFactory::getDocument();
  36  
  37          // Set the default view name and format from the Request.
  38          $vName        = JRequest::getCmd('view', 'cache');
  39          $vFormat    = $document->getType();
  40          $lName        = JRequest::getCmd('layout', 'default');
  41  
  42          // Get and render the view.
  43          if ($view = $this->getView($vName, $vFormat))
  44          {
  45              switch ($vName)
  46              {
  47                  case 'purge':
  48                      break;
  49                  case 'cache':
  50                  default:
  51                      $model = $this->getModel($vName);
  52                      $view->setModel($model, true);
  53                      break;
  54              }
  55  
  56              $view->setLayout($lName);
  57  
  58              // Push document object into the view.
  59              $view->assignRef('document', $document);
  60  
  61              // Load the submenu.
  62              CacheHelper::addSubmenu(JRequest::getCmd('view', 'cache'));
  63  
  64              $view->display();
  65          }
  66      }
  67  
  68  	public function delete()
  69      {
  70          // Check for request forgeries
  71          JSession::checkToken() or jexit(JText::_('JInvalid_Token'));
  72  
  73          $cid = JRequest::getVar('cid', array(), 'post', 'array');
  74  
  75          $model = $this->getModel('cache');
  76  
  77          if(empty($cid)) {
  78              JError::raiseWarning(500, JText::_('JERROR_NO_ITEMS_SELECTED'));
  79          } else {
  80              $model->cleanlist($cid);
  81          }
  82  
  83          $this->setRedirect('index.php?option=com_cache&client='.$model->getClient()->id);
  84      }
  85  
  86  	public function purge()
  87      {
  88          // Check for request forgeries
  89          JSession::checkToken() or jexit(JText::_('JInvalid_Token'));
  90  
  91          $model = $this->getModel('cache');
  92          $ret = $model->purge();
  93  
  94          $msg = JText::_('COM_CACHE_EXPIRED_ITEMS_HAVE_BEEN_PURGED');
  95          $msgType = 'message';
  96  
  97          if ($ret === false) {
  98              $msg = JText::_('Error purging expired items');
  99              $msgType = 'error';
 100          }
 101  
 102          $this->setRedirect('index.php?option=com_cache&view=purge', $msg, $msgType);
 103      }
 104  }


Generated: Tue Apr 3 11:40:28 2012 Cross-referenced by PHPXref 0.7.1