Source for file controller.php
Documentation is available at controller.php
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
* Show the form so that the user can send the link to someone
$session->set('com_mailto.formtime', time());
$this->input->set('view', 'mailto');
* Send the message and display a notice
// Check for request forgeries
$timeout =
$session->get('com_mailto.formtime', 0);
if ($timeout ==
0 ||
time() -
$timeout <
20)
$SiteName =
$app->getCfg('sitename');
// Verify that this is a local link
// An array of email headers we do not want to allow as input
$headers =
array ( 'Content-Type:',
'Content-Transfer-Encoding:',
// An array of the input fields to scan for injected headers
* Here is the meat and potatoes of the header injection test. We
* iterate over the array of form input and check for header strings.
* If we find one, send an unauthorized header and die.
foreach ($fields as $field)
foreach ($headers as $header)
if (strpos($_POST[$field], $header) !==
false)
unset
($headers, $fields);
$email =
$this->input->post->getString('mailto', '');
$sender =
$this->input->post->getString('sender', '');
$from =
$this->input->post->getString('from', '');
$subject_default =
JText::sprintf('COM_MAILTO_SENT_BY', $sender);
$subject =
$this->input->post->getString('subject', $subject_default);
// Check for a valid to address
$error =
JText::sprintf('COM_MAILTO_EMAIL_INVALID', $email);
// Check for a valid from address
// Build the message to send
$msg =
JText::_('COM_MAILTO_EMAIL_MSG');
$body =
sprintf($msg, $SiteName, $sender, $from, $link);
// To send we need to use punycode.
if (JFactory::getMailer()->sendMail($from, $sender, $email, $subject, $body) !==
true)
$this->input->set('view', 'sent');
Documentation generated on Tue, 19 Nov 2013 14:57:31 +0100 by phpDocumentor 1.4.3