Advertisement
Guest User

Untitled

a guest
Mar 11th, 2013
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.99 KB | None | 0 0
  1.     <?php
  2.    
  3.     // no direct access
  4.     defined( '_JEXEC' ) or die( 'Restricted access' );
  5.    
  6.     // import Joomla controller library
  7.     jimport('joomla.application.component.controller');
  8.    
  9.     /**
  10.      * General Controller of ReDJ component
  11.      */
  12.     class ReDJController extends JControllerAdmin
  13.     {
  14.       /**
  15.        * @var    string  The default view.
  16.        * @since  1.6
  17.        */
  18.       protected $default_view = 'redirects';
  19.    
  20.       /**
  21.        * Display view
  22.        *
  23.        * @return void
  24.        */
  25.       public function display($cachable = false, $urlparams = false)
  26.       {
  27.         $input =JFactory::getApplication()->input;
  28.         $view = $input->get('view', 'redirects');
  29.         $layout = $input->get('layout', 'default');
  30.         $id = $input->get('id');
  31.    
  32.         // Set the submenu
  33.         require_once JPATH_COMPONENT.'/helpers/redj.php';
  34.         ReDJHelper::addSubmenu($view);
  35.    
  36.         // Check for edit form
  37.         if ($view == 'redirect' && $layout == 'edit' && !$this->checkEditId('com_redj.edit.redirect', $id)) {
  38.           // Somehow the person just went to the form - we don't allow that
  39.           $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id));
  40.           $this->setMessage($this->getError(), 'error');
  41.           $this->setRedirect(JRoute::_('index.php?option=com_redj&view=redirects', false));
  42.    
  43.           return false;
  44.         }
  45.         else if ($view == 'page404' && $layout == 'edit' && !$this->checkEditId('com_redj.edit.page404', $id)) {
  46.           // Somehow the person just went to the form - we don't allow that
  47.           $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id));
  48.           $this->setMessage($this->getError(), 'error');
  49.           $this->setRedirect(JRoute::_('index.php?option=com_redj&view=pages404', false));
  50.    
  51.           return false;
  52.         }
  53.    
  54.         // Call parent behavior
  55.         parent::display();
  56.    
  57.         return $this;
  58.       }
  59.    
  60.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement