Skip to content

Commit

Permalink
// delete ajax_send_mail_test.php
Browse files Browse the repository at this point in the history
  • Loading branch information
rGaillard committed Jun 19, 2012
1 parent e113827 commit 95ce439
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 69 deletions.
50 changes: 0 additions & 50 deletions admin-dev/ajax_send_mail_test.php

This file was deleted.

23 changes: 23 additions & 0 deletions controllers/admin/AdminEmailsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -206,4 +206,27 @@ public function beforeUpdateOptions()
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);
}
}
}
41 changes: 22 additions & 19 deletions controllers/admin/AdminFeaturesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -473,30 +473,33 @@ public function getList($id_lang, $order_by = null, $order_way = null, $start =

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');

$new_positions = array();
foreach ($positions as $k => $v)
if (!empty($v))
$new_positions[] = $v;

if (isset($pos[2]) && (int)$pos[2] === $id_feature)
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';
$pos = explode('_', $value);

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" : "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"}';
echo '{"hasError" : true, "errors" : "This feature ('.(int)$id_feature.') can t be loaded"}';

break;
break;
}
}
}
}
Expand Down

0 comments on commit 95ce439

Please sign in to comment.