CoreFiles by mySites.guru
MailController.php69 lines, 1,542 bytes, from Joomla_4.2.0-Stable-Full_Package.zip
Raw History Compare with 4.1.5
md5
855ca0df81bb6c4203aea05ea958be4c
sha1
16b499e48efb1e33bb294af1c5ae4689d9fb058e
sha256
c17f2710594c17376983c9f5c6167dcfac70fbec9a374575829f6090dddfb50d
<?php

/**
 * @package     Joomla.Administrator
 * @subpackage  com_users
 *
 * @copyright   (C) 2009 Open Source Matters, Inc. <https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

namespace Joomla\Component\Users\Administrator\Controller;

use Joomla\CMS\MVC\Controller\BaseController;
use Joomla\CMS\Router\Route;

/**
 * Users mail controller.
 *
 * @since  1.6
 */
class MailController extends BaseController
{
    /**
     * Send the mail
     *
     * @return void
     *
     * @since 1.6
     */
    public function send()
    {
        // Redirect to admin index if mass mailer disabled in conf
        if ($this->app->get('massmailoff', 0) == 1) {
            $this->app->redirect(Route::_('index.php', false));
        }

        // Check for request forgeries.
        $this->checkToken('request');

        $model = $this->getModel('Mail');

        if ($model->send()) {
            $type = 'message';
        } else {
            $type = 'error';
        }

        $msg = $model->getError();
        $this->setRedirect('index.php?option=com_users&view=mail', $msg, $type);
    }

    /**
     * Cancel the mail
     *
     * @return void
     *
     * @since 1.6
     */
    public function cancel()
    {
        // Check for request forgeries.
        $this->checkToken('request');

        // Clear data from session.
        $this->app->setUserState('com_users.display.mail.data', null);

        $this->setRedirect('index.php?option=com_users&view=users');
    }
}

The same content is in 5 releases, Joomla 4.2.0-beta3 to 4.2.1-rc2. See them all, or every version of this file.