Current Directory: /home/astoriaah/www/administrator/components/com_admintools/Controller
Viewing File: /home/astoriaah/www/administrator/components/com_admintools/Controller/Scans.php
<?php
/**
* @package admintools
* @copyright Copyright (c)2010-2022 Nicholas K. Dionysopoulos / Akeeba Ltd
* @license GNU General Public License version 3, or later
*/
namespace Akeeba\AdminTools\Admin\Controller;
defined('_JEXEC') || die;
use Akeeba\AdminTools\Admin\Controller\Mixin\CustomACL;
use Akeeba\AdminTools\Admin\View\ScanAlerts\Html;
use Exception;
use FOF40\Controller\DataController;
use Joomla\CMS\Language\Text;
class Scans extends DataController
{
use CustomACL;
public function add(): void
{
throw new Exception(Text::_('JLIB_APPLICATION_ERROR_ACCESS_FORBIDDEN'), 403);
}
public function startscan()
{
$this->input->set('layout', 'scan');
/** @var Html $view */
$view = $this->getView();
/** @var \Akeeba\AdminTools\Admin\Model\Scans $model */
$model = $this->getModel();
$view->retarray = $model->startScan();
$view->setLayout('scan');
$this->layout = 'scan';
parent::display(false);
}
public function stepscan()
{
$this->input->set('layout', 'scan');
/** @var Html $view */
$view = $this->getView();
/** @var \Akeeba\AdminTools\Admin\Model\Scans $model */
$model = $this->getModel();
$view->retarray = $model->stepScan();
$view->setLayout('scan');
$this->layout = 'scan';
parent::display(false);
}
public function purge()
{
/** @var \Akeeba\AdminTools\Admin\Model\Scans $model */
$model = $this->getModel();
$type = null;
if ($model->purgeFilesCache())
{
$msg = Text::_('COM_ADMINTOOLS_MSG_SCAN_PURGE_COMPLETED');
}
else
{
$msg = Text::_('COM_ADMINTOOLS_MSG_SCAN_PURGE_ERROR');
$type = 'error';
}
$this->setRedirect('index.php?option=com_admintools&view=Scans', $msg, $type);
}
/**
* Apply hard-coded filters before rendering the Browse page
*/
protected function onBeforeBrowse()
{
/** @var \Akeeba\AdminTools\Admin\Model\Scans $model */
$model = $this->getModel();
$limitstart = $this->input->getInt('limitstart', null);
if (is_null($limitstart))
{
$total = $model->count();
$limitstart = $model->getState('limitstart', 0);
if ($limitstart > $total)
{
$model->limitstart(0);
}
}
$model->status('complete')->profile_id(1);
}
protected function onAfterBrowse()
{
/** @var \Akeeba\AdminTools\Admin\Model\Scans $model */
$model = $this->getModel();
$model->removeIncompleteScans();
return true;
}
protected function onBeforeApplySave(array &$data)
{
$comment = $this->input->get('comment', null, 'html', 4);
if (is_null($comment) && isset($data['comment']))
{
unset($data['comment']);
}
else
{
$data['comment'] = $comment;
}
}
}