Source for file controller.php

Documentation is available at controller.php

  1. <?php
  2. /**
  3.  * @package     Joomla.Site
  4.  * @subpackage  com_content
  5.  *
  6.  * @copyright   Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
  7.  * @license     GNU General Public License version 2 or later; see LICENSE.txt
  8.  */
  9.  
  10. defined('_JEXEC') or die;
  11.  
  12. /**
  13.  * Content Component Controller
  14.  *
  15.  * @package     Joomla.Site
  16.  * @subpackage  com_content
  17.  * @since       1.5
  18.  */
  19. {
  20.     public function __construct($config = array())
  21.     {
  22.         $this->input = JFactory::getApplication()->input;
  23.  
  24.         // Article frontpage Editor pagebreak proxying:
  25.         if ($this->input->get('view') === 'article' && $this->input->get('layout') === 'pagebreak')
  26.         {
  27.             $config['base_path'] = JPATH_COMPONENT_ADMINISTRATOR;
  28.         }
  29.         // Article frontpage Editor article proxying:
  30.         elseif ($this->input->get('view') === 'articles' && $this->input->get('layout') === 'modal')
  31.         {
  32.             JHtml::_('stylesheet', 'system/adminlist.css', array(), true);
  33.             $config['base_path'] = JPATH_COMPONENT_ADMINISTRATOR;
  34.         }
  35.  
  36.         parent::__construct($config);
  37.     }
  38.  
  39.     /**
  40.      * Method to display a view.
  41.      *
  42.      * @param   boolean            If true, the view output will be cached
  43.      * @param   array  An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}.
  44.      *
  45.      * @return  JController        This object to support chaining.
  46.      * @since   1.5
  47.      */
  48.     public function display($cachable = false, $urlparams = false)
  49.     {
  50.         $cachable = true;
  51.  
  52.         // Set the default view name and format from the Request.
  53.         // Note we are using a_id to avoid collisions with the router and the return page.
  54.         // Frontend is a bit messier than the backend.
  55.         $id    = $this->input->getInt('a_id');
  56.         $vName = $this->input->getCmd('view', 'categories');
  57.         $this->input->set('view', $vName);
  58.  
  59.         $user = JFactory::getUser();
  60.  
  61.         if ($user->get('id') ||
  62.             ($this->input->getMethod() == 'POST' &&
  63.                 (($vName == 'category' && $this->input->get('layout') != 'blog') || $vName == 'archive' )))
  64.         {
  65.             $cachable = false;
  66.         }
  67.  
  68.         $safeurlparams = array('catid' => 'INT', 'id' => 'INT', 'cid' => 'ARRAY', 'year' => 'INT', 'month' => 'INT', 'limit' => 'UINT', 'limitstart' => 'UINT',
  69.             'showall' => 'INT', 'return' => 'BASE64', 'filter' => 'STRING', 'filter_order' => 'CMD', 'filter_order_Dir' => 'CMD', 'filter-search' => 'STRING', 'print' => 'BOOLEAN', 'lang' => 'CMD', 'Itemid' => 'INT');
  70.  
  71.         // Check for edit form.
  72.         if ($vName == 'form' && !$this->checkEditId('com_content.edit.article', $id))
  73.         {
  74.             // Somehow the person just went to the form - we don't allow that.
  75.             return JError::raiseError(403, JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id));
  76.         }
  77.  
  78.         parent::display($cachable, $safeurlparams);
  79.  
  80.         return $this;
  81.     }
  82. }

Documentation generated on Tue, 19 Nov 2013 14:57:30 +0100 by phpDocumentor 1.4.3