Source for file manage.php

Documentation is available at manage.php

  1. <?php
  2. /**
  3.  * @package     Joomla.Administrator
  4.  * @subpackage  com_installer
  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.  * Installer Manage Controller
  14.  *
  15.  * @package     Joomla.Administrator
  16.  * @subpackage  com_installer
  17.  * @since       1.6
  18.  */
  19. {
  20.     /**
  21.      * Constructor.
  22.      *
  23.      * @param   array  $config  An optional associative array of configuration settings.
  24.      *
  25.      * @see     JController
  26.      * @since   1.6
  27.      */
  28.     public function __construct($config array())
  29.     {
  30.         parent::__construct($config);
  31.  
  32.         $this->registerTask('unpublish''publish');
  33.         $this->registerTask('publish',   'publish');
  34.     }
  35.  
  36.     /**
  37.      * Enable/Disable an extension (if supported).
  38.      *
  39.      * @return  void 
  40.      *
  41.      * @since   1.6
  42.      */
  43.     public function publish()
  44.     {
  45.         // Check for request forgeries.
  46.         JSession::checkToken(or jexit(JText::_('JINVALID_TOKEN'));
  47.  
  48.         $ids    $this->input->get('cid'array()'array');
  49.         $values array('publish' => 1'unpublish' => 0);
  50.         $task   $this->getTask();
  51.         $value  JArrayHelper::getValue($values$task0'int');
  52.  
  53.         if (empty($ids))
  54.         {
  55.             JError::raiseWarning(500JText::_('COM_INSTALLER_ERROR_NO_EXTENSIONS_SELECTED'));
  56.         }
  57.         else
  58.         {
  59.             // Get the model.
  60.             $model    $this->getModel('manage');
  61.  
  62.             // Change the state of the records.
  63.             if (!$model->publish($ids$value))
  64.             {
  65.                 JError::raiseWarning(500implode('<br />'$model->getErrors()));
  66.             }
  67.             else
  68.             {
  69.                 if ($value == 1)
  70.                 {
  71.                     $ntext 'COM_INSTALLER_N_EXTENSIONS_PUBLISHED';
  72.                 }
  73.                 elseif ($value == 0)
  74.                 {
  75.                     $ntext 'COM_INSTALLER_N_EXTENSIONS_UNPUBLISHED';
  76.                 }
  77.                 $this->setMessage(JText::plural($ntextcount($ids)));
  78.             }
  79.         }
  80.  
  81.         $this->setRedirect(JRoute::_('index.php?option=com_installer&view=manage'false));
  82.     }
  83.  
  84.     /**
  85.      * Remove an extension (Uninstall).
  86.      *
  87.      * @return  void 
  88.      *
  89.      * @since   1.5
  90.      */
  91.     public function remove()
  92.     {
  93.         // Check for request forgeries
  94.         JSession::checkToken(or jexit(JText::_('JINVALID_TOKEN'));
  95.  
  96.         $eid   $this->input->get('cid'array()'array');
  97.         $model $this->getModel('manage');
  98.  
  99.         JArrayHelper::toInteger($eidarray());
  100.         $model->remove($eid);
  101.         $this->setRedirect(JRoute::_('index.php?option=com_installer&view=manage'false));
  102.     }
  103.  
  104.     /**
  105.      * Refreshes the cached metadata about an extension.
  106.      *
  107.      * Useful for debugging and testing purposes when the XML file might change.
  108.      *
  109.      * @return  void 
  110.      *
  111.      * @since   1.6
  112.      */
  113.     public function refresh()
  114.     {
  115.         // Check for request forgeries
  116.         JSession::checkToken(or jexit(JText::_('JINVALID_TOKEN'));
  117.  
  118.         $uid   $this->input->get('cid'array()'array');
  119.         $model $this->getModel('manage');
  120.  
  121.         JArrayHelper::toInteger($uidarray());
  122.         $model->refresh($uid);
  123.         $this->setRedirect(JRoute::_('index.php?option=com_installer&view=manage'false));
  124.     }
  125. }

Documentation generated on Tue, 19 Nov 2013 15:07:34 +0100 by phpDocumentor 1.4.3