- md5
- c70f9f89801438096ebd213cda5186e0
- sha1
- e6eba3826be26fb9d14c2fb01891709411262912
- sha256
- 9cba60417a63b3753af631de3b39645fd23aa761d8cf1abbd4b443168ab4b0f1
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
<?php
/**
* @package Joomla.Site
* @subpackage com_mailto
*
* @copyright Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\Component\Mailto\Site\View\Mailto;
defined('_JEXEC') or die;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\String\PunycodeHelper;
/**
* Class for Mail.
*
* @since 1.5
*/
class HtmlView extends BaseHtmlView
{
/**
* Execute and display a template script.
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return mixed A string if successful, otherwise an Error object.
*
* @since 1.5
*/
public function display($tpl = null)
{
$data = $this->getData();
if ($data === false)
{
return false;
}
$this->set('data', $data);
return parent::display($tpl);
}
/**
* Get the form data
*
* @return object|false
*
* @since 1.5
*/
protected function getData()
{
$user = Factory::getUser();
$app = Factory::getApplication();
$data = new \stdClass;
$input = $app->input;
$method = $input->getMethod();
$data->link = urldecode($input->$method->get('link', '', 'BASE64'));
if ($data->link == '')
{
throw new \Exception(Text::_('COM_MAILTO_LINK_IS_MISSING'), 400);
}
// Load with previous data, if it exists
$mailto = $app->input->post->getString('mailto', '');
$sender = $app->input->post->getString('sender', '');
$from = $app->input->post->getString('from', '');
$subject = $app->input->post->getString('subject', '');
if ($user->get('id') > 0)
{
$data->sender = $user->get('name');
$data->from = $user->get('email');
}
else
{
$data->sender = $sender;
$data->from = PunycodeHelper::emailToPunycode($from);
}
$data->subject = $subject;
$data->mailto = PunycodeHelper::emailToPunycode($mailto);
return $data;
}
}
The same content is in 2 releases, Joomla 4.0.0-alpha5 to 4.0.0-alpha6. See them all, or every version of this file.