- md5
- 6ea0c43eb6254f9e02dbdf1f47d37b20
- sha1
- 51aba6f2c0c774a80ddcd59ac4287a6c4f3afa72
- sha256
- 970d36836a171dd8e39eee230554ef011b903cc94b1fd386656df243381f248a
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
<?php
/**
* @package Joomla.Administrator
* @subpackage com_postinstall
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\Component\Postinstall\Administrator\Controller;
\defined('_JEXEC') or die;
use Joomla\CMS\Filesystem\File;
use Joomla\CMS\MVC\Controller\BaseController;
use Joomla\Component\Postinstall\Administrator\Helper\PostinstallHelper;
use Joomla\Component\Postinstall\Administrator\Model\MessagesModel;
/**
* Postinstall message controller.
*
* @since 3.2
*/
class MessageController extends BaseController
{
/**
* Resets all post-installation messages of the specified extension.
*
* @return void
*
* @since 3.2
*/
public function reset()
{
$this->checkToken();
/** @var MessagesModel $model */
$model = $this->getModel('Messages', '', array('ignore_request' => true));
$eid = (int) $model->getState('eid', $model->getJoomlaFilesExtensionId());
if (empty($eid))
{
$eid = $model->getJoomlaFilesExtensionId();
}
$model->resetMessages($eid);
$this->setRedirect('index.php?option=com_postinstall&eid=' . $eid);
}
/**
* Unpublishes post-installation message of the specified extension.
*
* @return void
*
* @since 3.2
*/
public function unpublish()
{
$model = $this->getModel('Messages', '', array('ignore_request' => true));
$id = $this->input->get('id');
$eid = (int) $model->getState('eid', $model->getJoomlaFilesExtensionId());
if (empty($eid))
{
$eid = $model->getJoomlaFilesExtensionId();
}
$model->setState('published', 0);
$model->unpublishMessage($id);
$this->setRedirect('index.php?option=com_postinstall&eid=' . $eid);
}
/**
* Executes the action associated with an item.
*
* @return void
*
* @since 3.2
*/
public function action()
{
$this->checkToken();
$model = $this->getModel('Messages', '', array('ignore_request' => true));
$id = $this->input->get('id');
$item = $model->getItem($id);
switch ($item->type)
{
case 'link':
$this->setRedirect($item->action);
return;
break;
case 'action':
$helper = new PostinstallHelper;
$file = $helper->parsePath($item->action_file);
if (File::exists($file))
{
require_once $file;
call_user_func($item->action);
}
break;
case 'message':
default:
break;
}
$this->setRedirect('index.php?option=com_postinstall');
}
/**
* Hides all post-installation messages of the specified extension.
*
* @return void
*
* @since 3.8.7
*/
public function hideAll()
{
$this->checkToken();
/** @var MessagesModel $model */
$model = $this->getModel('Messages', '', array('ignore_request' => true));
$eid = (int) $model->getState('eid', $model->getJoomlaFilesExtensionId());
if (empty($eid))
{
$eid = $model->getJoomlaFilesExtensionId();
}
$model->hideMessages($eid);
$this->setRedirect('index.php?option=com_postinstall&eid=' . $eid);
}
}
The same content is in 5 releases, Joomla 4.0.0-beta to 4.0.0-beta5. See them all, or every version of this file.