CoreFiles by mySites.guru
view.html.php88 lines, 1,879 bytes, from Joomla_3.5.0-beta-Beta-Full_Package.zip
Raw History Compare with 3.4.0-beta3
md5
c21be578bb39768faf07d2125865d5fe
sha1
7dc2f03a258a60f8d66023c1af66dd3a427bbd58
sha256
8b4c2de41d8de45f4aa683b9d7c9dc19c73a7936657806970c93817f71cfcce8
<?php
/**
 * @package     Joomla.Site
 * @subpackage  com_mailto
 *
 * @copyright   Copyright (C) 2005 - 2015 Open Source Matters, Inc. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

defined('_JEXEC') or die;

/**
 * Class for Mail.
 * 
 * @since  1.5
 */
class MailtoViewMailto extends JViewLegacy
{
	/**
	 * 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 a 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
	 *
	 * @since  1.5
	 */
	protected function &getData()
	{
		$user = JFactory::getUser();
		$app  = JFactory::getApplication();
		$data = new stdClass;

		$input      = $app->input;
		$method     = $input->getMethod();
		$data->link = urldecode($input->$method->get('link', '', 'BASE64'));

		if ($data->link == '')
		{
			JError::raiseError(403, JText::_('COM_MAILTO_LINK_IS_MISSING'));

			return false;
		}

		// 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   = JStringPunycode::emailToPunycode($from);
		}

		$data->subject = $subject;
		$data->mailto  = JStringPunycode::emailToPunycode($mailto);

		return $data;
	}
}

The same content is in 9 releases, Joomla 3.4.4-rc to 3.5.0-beta. See them all, or every version of this file.