Файловый менеджер - Редактировать - /home/lmsyaran/public_html/pusher/com_mailto.tar
Назад
controller.php 0000644 00000007447 15116756346 0007472 0 ustar 00 <?php /** * @package Joomla.Site * @subpackage com_mailto * * @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; /** * Mailer Component Controller. * * @since 1.5 */ class MailtoController extends JControllerLegacy { /** * Show the form so that the user can send the link to someone. * * @return void * * @since 1.5 */ public function mailto() { $this->input->set('view', 'mailto'); $this->display(); } /** * Send the message and display a notice * * @return void * * @since 1.5 */ public function send() { // Check for request forgeries $this->checkToken(); $app = JFactory::getApplication(); $model = $this->getModel('mailto'); $data = $model->getData(); // Validate the posted data. $form = $model->getForm(); if (!$form) { JError::raiseError(500, $model->getError()); return false; } if (!$model->validate($form, $data)) { $errors = $model->getErrors(); foreach ($errors as $error) { $errorMessage = $error; if ($error instanceof Exception) { $errorMessage = $error->getMessage(); } $app->enqueueMessage($errorMessage, 'error'); } return $this->mailto(); } // An array of email headers we do not want to allow as input $headers = array ( 'Content-Type:', 'MIME-Version:', 'Content-Transfer-Encoding:', 'bcc:', 'cc:' ); /* * 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 ($data as $key => $value) { foreach ($headers as $header) { if (is_string($value) && strpos($value, $header) !== false) { JError::raiseError(403, ''); } } } /* * Free up memory */ unset($headers, $fields); $siteName = $app->get('sitename'); $link = MailtoHelper::validateHash($this->input->post->get('link', '', 'post')); // Verify that this is a local link if (!$link || !JUri::isInternal($link)) { // Non-local url... JError::raiseNotice(500, JText::_('COM_MAILTO_EMAIL_NOT_SENT')); return $this->mailto(); } $subject_default = JText::sprintf('COM_MAILTO_SENT_BY', $data['sender']); $subject = $data['subject'] !== '' ? $data['subject'] : $subject_default; // Check for a valid to address $error = false; if (!$data['emailto'] || !JMailHelper::isEmailAddress($data['emailto'])) { $error = JText::sprintf('COM_MAILTO_EMAIL_INVALID', $data['emailto']); JError::raiseWarning(0, $error); } // Check for a valid from address if (!$data['emailfrom'] || !JMailHelper::isEmailAddress($data['emailfrom'])) { $error = JText::sprintf('COM_MAILTO_EMAIL_INVALID', $data['emailfrom']); JError::raiseWarning(0, $error); } if ($error) { return $this->mailto(); } // Build the message to send $msg = JText::_('COM_MAILTO_EMAIL_MSG'); $body = sprintf($msg, $siteName, $data['sender'], $data['emailfrom'], $link); // Clean the email data $subject = JMailHelper::cleanSubject($subject); $body = JMailHelper::cleanBody($body); // To send we need to use punycode. $data['emailfrom'] = JStringPunycode::emailToPunycode($data['emailfrom']); $data['emailfrom'] = JMailHelper::cleanAddress($data['emailfrom']); $data['emailto'] = JStringPunycode::emailToPunycode($data['emailto']); // Send the email if (JFactory::getMailer()->sendMail($data['emailfrom'], $data['sender'], $data['emailto'], $subject, $body) !== true) { JError::raiseNotice(500, JText::_('COM_MAILTO_EMAIL_NOT_SENT')); return $this->mailto(); } $this->input->set('view', 'sent'); $this->display(); } } helpers/mailto.php 0000644 00000004013 15116756346 0010220 0 ustar 00 <?php /** * @package Joomla.Site * @subpackage com_mailto * * @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved. * @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; } } } mailto.php 0000644 00000001003 15116756346 0006552 0 ustar 00 <?php /** * @package Joomla.Site * @subpackage com_mailto * * @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved. * @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')); mailto.xml 0000644 00000002012 15116756346 0006564 0 ustar 00 <?xml version="1.0" encoding="utf-8"?> <extension type="component" version="3.1" method="upgrade"> <name>com_mailto</name> <author>Joomla! Project</author> <creationDate>April 2006</creationDate> <copyright>(C) 2005 - 2020 Open Source Matters. All rights reserved.</copyright> <license>GNU General Public License version 2 or later; see LICENSE.txt</license> <authorEmail>admin@joomla.org</authorEmail> <authorUrl>www.joomla.org</authorUrl> <version>3.0.0</version> <description>COM_MAILTO_XML_DESCRIPTION</description> <files folder="site"> <filename>controller.php</filename> <filename>index.html</filename> <filename>mailto.php</filename> <folder>views</folder> </files> <languages folder="site"> <language tag="en-GB">language/en-GB.com_mailto.ini</language> </languages> <administration> <files folder="admin"> <filename>index.html</filename> </files> <languages folder="admin"> <language tag="en-GB">language/en-GB.com_mailto.sys.ini</language> </languages> </administration> </extension> models/forms/mailto.xml 0000644 00000001532 15116756346 0011203 0 ustar 00 <?xml version="1.0" encoding="utf-8" ?> <form> <fieldset name="default"> <field name="emailto" type="email" label="COM_MAILTO_EMAIL_TO" filter="string" required="true" size="30" validate="email" autocomplete="email" /> <field name="sender" type="text" label="COM_MAILTO_SENDER" filter="string" required="true" size="30" /> <field name="emailfrom" type="email" label="COM_MAILTO_YOUR_EMAIL" filter="string" required="true" size="30" validate="email" autocomplete="email" /> <field name="subject" type="text" label="COM_MAILTO_SUBJECT" filter="string" required="true" size="30" /> <field name="captcha" type="captcha" label="COM_MAILTO_CAPTCHA" validate="captcha" /> </fieldset> </form> models/mailto.php 0000644 00000005240 15116756346 0010044 0 ustar 00 <?php /** * @package Joomla.Site * @subpackage com_users * * @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved. * @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; } } views/mailto/tmpl/default.php 0000644 00000003352 15116756346 0012320 0 ustar 00 <?php /** * @package Joomla.Site * @subpackage com_mailto * * @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; JHtml::_('behavior.core'); JHtml::_('behavior.keepalive'); ?> <div id="mailto-window"> <h2> <?php echo JText::_('COM_MAILTO_EMAIL_TO_A_FRIEND'); ?> </h2> <div class="mailto-close"> <a href="javascript: void window.close()" title="<?php echo JText::_('COM_MAILTO_CLOSE_WINDOW'); ?>"> <span> <?php echo JText::_('COM_MAILTO_CLOSE_WINDOW'); ?> </span> </a> </div> <form action="<?php echo JRoute::_('index.php?option=com_mailto&task=send'); ?>" method="post" class="form-validate form-horizontal well"> <fieldset> <?php foreach ($this->form->getFieldset('') as $field) : ?> <?php if (!$field->hidden) : ?> <?php echo $field->renderField(); ?> <?php endif; ?> <?php endforeach; ?> <div class="control-group"> <div class="controls"> <button type="submit" class="btn btn-primary validate"> <?php echo JText::_('COM_MAILTO_SEND'); ?> </button> <button type="button" class="button" onclick="window.close();return false;"> <?php echo JText::_('COM_MAILTO_CANCEL'); ?> </button> </div> </div> </fieldset> <input type="hidden" name="layout" value="<?php echo htmlspecialchars($this->getLayout(), ENT_COMPAT, 'UTF-8'); ?>" /> <input type="hidden" name="option" value="com_mailto" /> <input type="hidden" name="task" value="send" /> <input type="hidden" name="tmpl" value="component" /> <input type="hidden" name="link" value="<?php echo $this->link; ?>" /> <?php echo JHtml::_('form.token'); ?> </form> </div> views/mailto/view.html.php 0000644 00000001501 15116756346 0011627 0 ustar 00 <?php /** * @package Joomla.Site * @subpackage com_mailto * * @copyright Copyright (C) 2005 - 2020 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 an Error object. * * @since 1.5 */ public function display($tpl = null) { $this->form = $this->get('Form'); $this->link = urldecode(JFactory::getApplication()->input->get('link', '', 'BASE64')); return parent::display($tpl); } } views/sent/tmpl/default.php 0000644 00000001116 15116756346 0012000 0 ustar 00 <?php /** * @package Joomla.Site * @subpackage com_mailto * * @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; ?> <div style="padding: 10px;"> <div style="text-align:right"> <a href="javascript: void window.close()"> <?php echo JText::_('COM_MAILTO_CLOSE_WINDOW'); ?> <?php echo JHtml::_('image', 'mailto/close-x.png', null, null, true); ?> </a> </div> <h2> <?php echo JText::_('COM_MAILTO_EMAIL_SENT'); ?> </h2> </div> views/sent/view.html.php 0000644 00000000561 15116756346 0011320 0 ustar 00 <?php /** * @package Joomla.Site * @subpackage com_mailto * * @copyright Copyright (C) 2005 - 2020 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 email sent view. * * @since 1.5 */ class MailtoViewSent extends JViewLegacy { }
| ver. 1.4 |
Github
|
.
| PHP 8.1.33 | Генерация страницы: 0.03 |
proxy
|
phpinfo
|
Настройка