| Current Path : /var/www/html/administrator/components/com_community/controllers/ |
| Current File : /var/www/html/administrator/components/com_community/controllers/mailqueue.php |
<?php
/**
* @copyright (C) 2013 iJoomla, Inc. - All rights reserved.
* @license GNU General Public License, version 2 (http://www.gnu.org/licenses/gpl-2.0.html)
* @author iJoomla.com <webmaster@ijoomla.com>
* @url https://www.jomsocial.com/license-agreement
* The PHP code portions are distributed under the GPL license. If not otherwise stated, all images, manuals, cascading style sheets, and included JavaScript *are NOT GPL, and are released under the IJOOMLA Proprietary Use License v1.0
* More info at https://www.jomsocial.com/license-agreement
*/
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Table\Table;
use Joomla\CMS\Uri\Uri;
// Disallow direct access to this file
defined('_JEXEC') or die('Restricted access');
jimport('joomla.application.component.controller');
/**
* JomSocial Component Controller
*/
class CommunityControllerMailqueue extends CommunityController
{
public function __construct()
{
parent::__construct();
}
/**
* Remove mail queues
**/
public function removequeue()
{
$mainframe = Factory::getApplication();
$jinput = $mainframe->input;
$ids = $jinput->get('cid', array(), 'array');
$count = count($ids);
$row = Table::getInstance('mailqueue', 'CommunityTable');
foreach ($ids as $id) {
if (!$row->delete($id)) {
// If there are any error when deleting, we just stop and redirect user with error.
$message = Text::_('COM_COMMUNITY_MAILQUEUE_DELETE_ERROR');
$mainframe->enqueueMessage($message);
return $this->setRedirect('index.php?option=com_community&view=mailqueue');
}
}
$message = Text::sprintf('COM_COMMUNITY_MAILQUEUE_SUCCESSFULLY_REMOVE_COUNT', $count);
$mainframe->enqueueMessage($message);
$this->setRedirect('index.php?option=com_community&view=mailqueue');
}
/**
* Purge sent mail queues
**/
public function purgequeue()
{
$mainframe = Factory::getApplication();
$model = $this->getModel('Mailqueue');
$model->purge();
$message = Text::_('COM_COMMUNITY_MAILQUEUE_PURGED');
$mainframe->enqueueMessage($message);
$this->setRedirect('index.php?option=com_community&view=mailqueue');
}
/**
* Execute cron manually
*/
public function executeCron()
{
$mainframe = Factory::getApplication();
$this->setRedirect(Uri::root(). 'index.php?option=com_community&task=cron');
}
}