// delete ajax_send_mail_test.php

This commit is contained in:
rGaillard
2012-06-19 08:40:44 +00:00
parent e113827a45
commit 95ce439d4e
3 changed files with 46 additions and 70 deletions
-50
View File
@@ -1,50 +0,0 @@
<?php
/*
* 2007-2012 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2012 PrestaShop SA
* @version Release: $Revision: 6844 $
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
define('_PS_ADMIN_DIR_', getcwd());
include_once(dirname(__FILE__).'/../config/config.inc.php');
/* Getting cookie or logout */
require_once(dirname(__FILE__).'/init.php');
if (Tools::getValue('token') != Tools::getAdminTokenLite('AdminEmails'))
die(Tools::displayError());
$smtpChecked = (trim($_POST['mailMethod']) == 'smtp');
$smtpServer = $_POST['smtpSrv'];
$content = urldecode($_POST['testMsg']);
$content = utf8_encode(html_entity_decode($content));
$subject = urldecode($_POST['testSubject']);
$type = 'text/html';
$to = $_POST['testEmail'];
$from = Configuration::get('PS_SHOP_EMAIL');
$smtpLogin = $_POST['smtpLogin'];
$smtpPassword = (!empty($_POST['smtpPassword'])) ? urldecode($_POST['smtpPassword']) : Configuration::get('PS_MAIL_PASSWD');
$smtpPort = $_POST['smtpPort'];
$smtpEncryption = $_POST['smtpEnc'];
$result = Mail::sendMailTest(Tools::htmlentitiesUTF8($smtpChecked), Tools::htmlentitiesUTF8($smtpServer), Tools::htmlentitiesUTF8($content), Tools::htmlentitiesUTF8($subject), Tools::htmlentitiesUTF8($type), Tools::htmlentitiesUTF8($to), Tools::htmlentitiesUTF8($from), Tools::htmlentitiesUTF8($smtpLogin), Tools::htmlentitiesUTF8($smtpPassword), Tools::htmlentitiesUTF8($smtpPort), Tools::htmlentitiesUTF8($smtpEncryption));
die($result === true ? 'ok' : $result);
@@ -206,4 +206,27 @@ class AdminEmailsControllerCore extends AdminController
if ($_POST['PS_MAIL_METHOD'] == 2 && (empty($_POST['PS_MAIL_SERVER']) || empty($_POST['PS_MAIL_SMTP_PORT'])))
$this->errors[] = Tools::displayError('You must define an SMTP server and an SMTP port. If you do not know, use the PHP mail() function instead.');
}
public function ajaxProcessSendMailTest()
{
if ($this->tabAccess['view'] === '1')
{
$smtpChecked = (trim(Tools::getValue('mailMethod')) == 'smtp');
$smtpServer = Tools::getValue('smtpSrv');
$content = urldecode(Tools::getValue('testMsg'));
$content = utf8_encode(html_entity_decode($content));
$subject = urldecode(Tools::getValue('testSubject'));
$type = 'text/html';
$to = Tools::getValue('testEmail');
$from = Configuration::get('PS_SHOP_EMAIL');
$smtpLogin = Tools::getValue('smtpLogin');
$smtpPassword = Tools::getValue('smtpPassword');
$smtpPassword = (!empty($smtpPassword)) ? urldecode($smtpPassword) : Configuration::get('PS_MAIL_PASSWD');
$smtpPort = Tools::getValue('smtpPort');
$smtpEncryption = Tools::getValue('smtpEnc');
$result = Mail::sendMailTest(Tools::htmlentitiesUTF8($smtpChecked), Tools::htmlentitiesUTF8($smtpServer), Tools::htmlentitiesUTF8($content), Tools::htmlentitiesUTF8($subject), Tools::htmlentitiesUTF8($type), Tools::htmlentitiesUTF8($to), Tools::htmlentitiesUTF8($from), Tools::htmlentitiesUTF8($smtpLogin), Tools::htmlentitiesUTF8($smtpPassword), Tools::htmlentitiesUTF8($smtpPort), Tools::htmlentitiesUTF8($smtpEncryption));
die($result === true ? 'ok' : $result);
}
}
}
+23 -20
View File
@@ -473,30 +473,33 @@ class AdminFeaturesControllerCore extends AdminController
public function ajaxProcessUpdatePositions()
{
$way = (int)Tools::getValue('way');
$id_feature = (int)Tools::getValue('id');
$positions = Tools::getValue('feature');
$new_positions = array();
foreach ($positions as $k => $v)
if (!empty($v))
$new_positions[] = $v;
foreach ($new_positions as $position => $value)
if ($this->tabAccess['edit'] === '1')
{
$pos = explode('_', $value);
$way = (int)Tools::getValue('way');
$id_feature = (int)Tools::getValue('id');
$positions = Tools::getValue('feature');
if (isset($pos[2]) && (int)$pos[2] === $id_feature)
$new_positions = array();
foreach ($positions as $k => $v)
if (!empty($v))
$new_positions[] = $v;
foreach ($new_positions as $position => $value)
{
if ($feature = new Feature((int)$pos[2]))
if (isset($position) && $feature->updatePosition($way, $position, $id_feature))
echo 'ok position '.(int)$position.' for feature '.(int)$pos[1].'\r\n';
else
echo '{"hasError" : true, "errors" : "Can not update feature '.(int)$id_feature.' to position '.(int)$position.' "}';
else
echo '{"hasError" : true, "errors" : "This feature ('.(int)$id_feature.') can t be loaded"}';
$pos = explode('_', $value);
break;
if (isset($pos[2]) && (int)$pos[2] === $id_feature)
{
if ($feature = new Feature((int)$pos[2]))
if (isset($position) && $feature->updatePosition($way, $position, $id_feature))
echo 'ok position '.(int)$position.' for feature '.(int)$pos[1].'\r\n';
else
echo '{"hasError" : true, "errors" : "Can not update feature '.(int)$id_feature.' to position '.(int)$position.' "}';
else
echo '{"hasError" : true, "errors" : "This feature ('.(int)$id_feature.') can t be loaded"}';
break;
}
}
}
}