| Current Path : /home/w/u/e/wuectly/www/03cbe/ |
| Current File : /home/w/u/e/wuectly/www/03cbe/mailto.php.tar |
home/wuectly/www/components/com_mailto/mailto.php 0000604 00000000766 15245572054 0016340 0 ustar 00 <?php
/**
* @package Joomla.Site
* @subpackage com_mailto
*
* @copyright (C) 2006 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
JLoader::register('MailtoHelper', JPATH_COMPONENT . '/helpers/mailto.php');
$controller = JControllerLegacy::getInstance('Mailto');
$controller->registerDefaultTask('mailto');
$controller->execute(JFactory::getApplication()->input->get('task'));
home/wuectly/www/components/com_mailto/helpers/mailto.php 0000604 00000003776 15245617021 0020000 0 ustar 00 <?php
/**
* @package Joomla.Site
* @subpackage com_mailto
*
* @copyright (C) 2011 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Mailto route helper class.
*
* @package Joomla.Site
* @subpackage com_mailto
* @since 1.6.1
*/
abstract class MailtoHelper
{
/**
* Adds a URL to the mailto system and returns the hash
*
* @param string $url Url
*
* @return string URL hash
*/
public static function addLink($url)
{
$hash = sha1($url);
self::cleanHashes();
$session = JFactory::getSession();
$mailto_links = $session->get('com_mailto.links', array());
if (!isset($mailto_links[$hash]))
{
$mailto_links[$hash] = new stdClass;
}
$mailto_links[$hash]->link = $url;
$mailto_links[$hash]->expiry = time();
$session->set('com_mailto.links', $mailto_links);
return $hash;
}
/**
* Checks if a URL is a Flash file
*
* @param string $hash File hash
*
* @return URL
*/
public static function validateHash($hash)
{
$retval = false;
$session = JFactory::getSession();
self::cleanHashes();
$mailto_links = $session->get('com_mailto.links', array());
if (isset($mailto_links[$hash]))
{
$retval = $mailto_links[$hash]->link;
}
return $retval;
}
/**
* Cleans out old hashes
*
* @param integer $lifetime How old are the hashes we want to remove
*
* @return void
*
* @since 1.6.1
*/
public static function cleanHashes($lifetime = 1440)
{
// Flag for if we've cleaned on this cycle
static $cleaned = false;
if (!$cleaned)
{
$past = time() - $lifetime;
$session = JFactory::getSession();
$mailto_links = $session->get('com_mailto.links', array());
foreach ($mailto_links as $index => $link)
{
if ($link->expiry < $past)
{
unset($mailto_links[$index]);
}
}
$session->set('com_mailto.links', $mailto_links);
$cleaned = true;
}
}
}
home/wuectly/www/components/com_mailto/models/mailto.php 0000604 00000005223 15245630051 0017604 0 ustar 00 <?php
/**
* @package Joomla.Site
* @subpackage com_users
*
* @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Mailto model class.
*
* @since 3.8.9
*/
class MailtoModelMailto extends JModelForm
{
/**
* Method to get the mailto form.
*
* The base form is loaded from XML and then an event is fired
* for users plugins to extend the form with extra fields.
*
* @param array $data An optional array of data for the form to interrogate.
* @param boolean $loadData True if the form is to load its own data (default case), false if not.
*
* @return JForm A JForm object on success, false on failure
*
* @since 3.8.9
*/
public function getForm($data = array(), $loadData = true)
{
// Get the form.
$form = $this->loadForm('com_mailto.mailto', 'mailto', array('load_data' => $loadData));
if (empty($form))
{
return false;
}
return $form;
}
/**
* Method to get the data that should be injected in the form.
*
* @return array The default data is an empty array.
*
* @since 3.8.9
*/
protected function loadFormData()
{
$user = JFactory::getUser();
$app = JFactory::getApplication();
$data = $app->getUserState('mailto.mailto.form.data', array());
$data['link'] = urldecode($app->input->get('link', '', 'BASE64'));
if ($data['link'] == '')
{
JError::raiseError(403, JText::_('COM_MAILTO_LINK_IS_MISSING'));
return false;
}
// Load with previous data, if it exists
$data['sender'] = $app->input->post->getString('sender', '');
$data['subject'] = $app->input->post->getString('subject', '');
$data['emailfrom'] = JStringPunycode::emailToPunycode($app->input->post->getString('emailfrom', ''));
$data['emailto'] = JStringPunycode::emailToPunycode($app->input->post->getString('emailto', ''));
if (!$user->guest)
{
$data['sender'] = $user->name;
$data['emailfrom'] = $user->email;
}
$app->setUserState('mailto.mailto.form.data', $data);
$this->preprocessData('com_mailto.mailto', $data);
return $data;
}
/**
* Get the request data
*
* @return array The requested data
*
* @since 3.8.9
*/
public function getData()
{
$input = JFactory::getApplication()->input;
$data['emailto'] = $input->get('emailto', '', 'string');
$data['sender'] = $input->get('sender', '', 'string');
$data['emailfrom'] = $input->get('emailfrom', '', 'string');
$data['subject'] = $input->get('subject', '', 'string');
$data['consentbox'] = $input->get('consentbox', '', 'string');
return $data;
}
}