Version Notes
Fixed a undefined constant error, if certain return paths were set via smtp
Download this release
Release Info
Developer | Simon Cooper |
Extension | Swift_Swiftplugin |
Version | 1.7.1 |
Comparing to | |
See all releases |
Code changes from version 1.7.0 to 1.7.1
app/code/community/Swift/Swiftplugin/Model/XmlProduct.php
CHANGED
@@ -46,6 +46,8 @@ class Swift_Swiftplugin_Model_XmlProduct {
|
|
46 |
$xmlRow = array();
|
47 |
$xml = new xml();
|
48 |
|
|
|
|
|
49 |
if ($this->offset <= $productCollection->getLastPageNumber()) {
|
50 |
|
51 |
foreach ($productCollection as $product) {
|
46 |
$xmlRow = array();
|
47 |
$xml = new xml();
|
48 |
|
49 |
+
$today = time();
|
50 |
+
|
51 |
if ($this->offset <= $productCollection->getLastPageNumber()) {
|
52 |
|
53 |
foreach ($productCollection as $product) {
|
app/code/community/Swift/Swiftplugin/controllers/MailController.php
CHANGED
@@ -4,23 +4,42 @@ require_once(Mage::getBaseDir('lib') . '/SwiftAPI/SwiftAPI.php');
|
|
4 |
|
5 |
class Swift_Swiftplugin_MailController extends Mage_Core_Controller_Front_Action {
|
6 |
|
7 |
-
const XML_PATH_SENDING_SET_RETURN_PATH
|
|
|
|
|
|
|
|
|
8 |
|
9 |
public function triggerAction() {
|
10 |
if (function_exists('mail') && $this->getRequest()->getPost()) {
|
11 |
$postData = $this->getRequest()->getPost();
|
12 |
if (isset($postData['version']) && isset($postData['domain']) && isset($postData['data'])) {
|
|
|
|
|
|
|
13 |
$key = hex2bin(Mage::helper('swift/Data')->getSwiftPrivateKey());
|
|
|
|
|
|
|
14 |
try {
|
|
|
|
|
|
|
|
|
15 |
$emailPackage = SwiftAPI::Decode($postData['version'], $postData['domain'], $postData['data'], $key);
|
16 |
-
|
|
|
|
|
|
|
|
|
|
|
17 |
foreach($emailPackage->emailPackage as $emailContent) {
|
18 |
|
19 |
$body = $emailContent->body;
|
20 |
$emailTo = $emailContent->email;
|
21 |
$subject = $emailContent->subject;
|
22 |
|
23 |
-
|
24 |
$setReturnPath = Mage::getStoreConfig(self::XML_PATH_SENDING_SET_RETURN_PATH);
|
25 |
switch ($setReturnPath) {
|
26 |
case 1:
|
@@ -33,12 +52,15 @@ class Swift_Swiftplugin_MailController extends Mage_Core_Controller_Front_Action
|
|
33 |
$returnPathEmail = null;
|
34 |
break;
|
35 |
}
|
|
|
36 |
|
37 |
if ($returnPathEmail !== null) {
|
38 |
$mailTransport = new Zend_Mail_Transport_Sendmail("-f".$returnPathEmail);
|
39 |
Zend_Mail::setDefaultTransport($mailTransport);
|
40 |
}
|
41 |
|
|
|
|
|
42 |
$mail = Mage::getModel('core/email');
|
43 |
|
44 |
$mail->setToEmail($emailTo);
|
@@ -48,14 +70,31 @@ class Swift_Swiftplugin_MailController extends Mage_Core_Controller_Front_Action
|
|
48 |
$mail->setReturnPath(Mage::getStoreConfig('trans_email/ident_sales/email'));
|
49 |
$mail->setFromName(Mage::getStoreConfig('trans_email/ident_sales/name'));
|
50 |
$mail->setType('html');// You can use 'html' or 'text'
|
|
|
|
|
51 |
$mail->send();
|
|
|
|
|
|
|
52 |
if (property_exists($emailContent, 'monitor') && filter_var( $emailContent->monitor, FILTER_VALIDATE_EMAIL)) {
|
|
|
53 |
$mail->setToEmail($emailContent->monitor);
|
54 |
$mail->setSubject($emailTo.'_'.$subject);
|
55 |
$mail->send();
|
|
|
56 |
}
|
57 |
}
|
58 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
}
|
60 |
catch (SwiftAPI_Exception $e) {
|
61 |
echo $e->getMessage();
|
4 |
|
5 |
class Swift_Swiftplugin_MailController extends Mage_Core_Controller_Front_Action {
|
6 |
|
7 |
+
const XML_PATH_SENDING_SET_RETURN_PATH = 'system/smtp/set_return_path';
|
8 |
+
|
9 |
+
const XML_PATH_SENDING_RETURN_PATH_EMAIL = 'system/smtp/return_path_email';
|
10 |
+
|
11 |
+
private $timeDebugOutput = array();
|
12 |
|
13 |
public function triggerAction() {
|
14 |
if (function_exists('mail') && $this->getRequest()->getPost()) {
|
15 |
$postData = $this->getRequest()->getPost();
|
16 |
if (isset($postData['version']) && isset($postData['domain']) && isset($postData['data'])) {
|
17 |
+
|
18 |
+
//We time this regardless of whether debug is set as we can't yet tell if we want the debug or not
|
19 |
+
$fetchKeyTimeStart = microtime(true);
|
20 |
$key = hex2bin(Mage::helper('swift/Data')->getSwiftPrivateKey());
|
21 |
+
$fetchKeyTimeEnd = microtime(true);
|
22 |
+
|
23 |
+
|
24 |
try {
|
25 |
+
|
26 |
+
|
27 |
+
//Again, we can't tell yet if time debug is needed, so grab it anyway
|
28 |
+
$decodeTimeStart = microtime(true);
|
29 |
$emailPackage = SwiftAPI::Decode($postData['version'], $postData['domain'], $postData['data'], $key);
|
30 |
+
if($emailPackage->timeDebug === true) {$decodeTimeEnd = microtime(true); $this->timeDebugOutput['SwiftAPI::Decode'] = $decodeTimeEnd-$decodeTimeStart;}
|
31 |
+
|
32 |
+
//Output previous $key=hex2bin... debug as we now know whether or not we need it
|
33 |
+
if($emailPackage->timeDebug === true) {$this->timeDebugOutput['$key = hex2bin(Mage::helper(\'swift/Data\')->getSwiftPrivateKey())'] = $fetchKeyTimeEnd-$fetchKeyTimeStart;}
|
34 |
+
|
35 |
+
if($emailPackage->timeDebug === true) {$allEmailTimeStart = microtime(true);}
|
36 |
foreach($emailPackage->emailPackage as $emailContent) {
|
37 |
|
38 |
$body = $emailContent->body;
|
39 |
$emailTo = $emailContent->email;
|
40 |
$subject = $emailContent->subject;
|
41 |
|
42 |
+
if($emailPackage->timeDebug === true) {$returnpathTimeStart = microtime(true);}
|
43 |
$setReturnPath = Mage::getStoreConfig(self::XML_PATH_SENDING_SET_RETURN_PATH);
|
44 |
switch ($setReturnPath) {
|
45 |
case 1:
|
52 |
$returnPathEmail = null;
|
53 |
break;
|
54 |
}
|
55 |
+
|
56 |
|
57 |
if ($returnPathEmail !== null) {
|
58 |
$mailTransport = new Zend_Mail_Transport_Sendmail("-f".$returnPathEmail);
|
59 |
Zend_Mail::setDefaultTransport($mailTransport);
|
60 |
}
|
61 |
|
62 |
+
if($emailPackage->timeDebug === true) {$returnPathTimeEnd = microtime(true); $this->timeDebugOutput['Setting return path for ' . $emailTo] = $returnPathTimeEnd-$returnpathTimeStart;}
|
63 |
+
|
64 |
$mail = Mage::getModel('core/email');
|
65 |
|
66 |
$mail->setToEmail($emailTo);
|
70 |
$mail->setReturnPath(Mage::getStoreConfig('trans_email/ident_sales/email'));
|
71 |
$mail->setFromName(Mage::getStoreConfig('trans_email/ident_sales/name'));
|
72 |
$mail->setType('html');// You can use 'html' or 'text'
|
73 |
+
|
74 |
+
if($emailPackage->timeDebug === true) {$singleEmailTimeStart = microtime(true);}
|
75 |
$mail->send();
|
76 |
+
if($emailPackage->timeDebug === true) {$singleEmailTimeEnd = microtime(true); $this->timeDebugOutput['$mail->send() for ' . $emailTo] = $singleEmailTimeEnd-$singleEmailTimeStart;}
|
77 |
+
|
78 |
+
|
79 |
if (property_exists($emailContent, 'monitor') && filter_var( $emailContent->monitor, FILTER_VALIDATE_EMAIL)) {
|
80 |
+
if($emailPackage->timeDebug === true) {$monitorModeEmailStart = microtime(true);}
|
81 |
$mail->setToEmail($emailContent->monitor);
|
82 |
$mail->setSubject($emailTo.'_'.$subject);
|
83 |
$mail->send();
|
84 |
+
if($emailPackage->timeDebug === true) {$monitorModeEmailEnd = microtime(true); $this->timeDebugOutput['Monitor mode email for ' . $emailTo] = $monitorModeEmailEnd-$monitorModeEmailStart;}
|
85 |
}
|
86 |
}
|
87 |
+
if($emailPackage->timeDebug === true) {$allEmailTimeEnd = microtime(true); $this->timeDebugOutput['foreach($emailPackage->emailPackage as $emailContent)'] = $allEmailTimeEnd-$allEmailTimeStart;}
|
88 |
+
|
89 |
+
|
90 |
+
if($emailPackage->timeDebug === true)
|
91 |
+
{
|
92 |
+
echo json_encode($this->timeDebugOutput);
|
93 |
+
}
|
94 |
+
else
|
95 |
+
{
|
96 |
+
echo 'data recieved and email sent';
|
97 |
+
}
|
98 |
}
|
99 |
catch (SwiftAPI_Exception $e) {
|
100 |
echo $e->getMessage();
|
app/code/community/Swift/Swiftplugin/etc/config.xml
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Swift_Swiftplugin>
|
5 |
-
<version>1.7.
|
6 |
</Swift_Swiftplugin>
|
7 |
</modules>
|
8 |
<frontend>
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Swift_Swiftplugin>
|
5 |
+
<version>1.7.1</version>
|
6 |
</Swift_Swiftplugin>
|
7 |
</modules>
|
8 |
<frontend>
|
lib/SwiftAPI/SwiftAPI_Request_EmailPackage.php
CHANGED
@@ -9,6 +9,7 @@ class SwiftAPI_Request_EmailPackage extends SwiftAPI_Request {
|
|
9 |
public $emailPackage;
|
10 |
public $site;
|
11 |
public $is_mail_function;
|
|
|
12 |
|
13 |
|
14 |
//////////////////////////////////////////////////////////////////////////////
|
@@ -19,11 +20,12 @@ class SwiftAPI_Request_EmailPackage extends SwiftAPI_Request {
|
|
19 |
// Public: __construct()
|
20 |
////////////////////////
|
21 |
|
22 |
-
public function __construct($domain, $user, $site, $emailPackage, $is_mail_function = false, $version = NULL, $date = NULL)
|
23 |
{
|
24 |
$this -> emailPackage = $emailPackage;
|
25 |
$this -> site = $site;
|
26 |
$this->is_mail_function = $is_mail_function;
|
|
|
27 |
parent::__construct($domain, SwiftAPI::OPERATION_EMAILPACKAGE, $user, $version, $date);
|
28 |
}
|
29 |
|
9 |
public $emailPackage;
|
10 |
public $site;
|
11 |
public $is_mail_function;
|
12 |
+
public $timeDebug;
|
13 |
|
14 |
|
15 |
//////////////////////////////////////////////////////////////////////////////
|
20 |
// Public: __construct()
|
21 |
////////////////////////
|
22 |
|
23 |
+
public function __construct($domain, $user, $site, $emailPackage, $is_mail_function = false, $version = NULL, $date = NULL, $timeDebug = false)
|
24 |
{
|
25 |
$this -> emailPackage = $emailPackage;
|
26 |
$this -> site = $site;
|
27 |
$this->is_mail_function = $is_mail_function;
|
28 |
+
$this->timeDebug = $timeDebug;
|
29 |
parent::__construct($domain, SwiftAPI::OPERATION_EMAILPACKAGE, $user, $version, $date);
|
30 |
}
|
31 |
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Swift_Swiftplugin</name>
|
4 |
-
<version>1.7.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/LGPL-3.0">LGPL</license>
|
7 |
<channel>community</channel>
|
@@ -18,11 +18,11 @@ The extension uses background JavaScript calls to collect and store the customer
|
|
18 |
<p>
|
19 |
The extension is easy to set up and uses Magento’s built in features to collect information and send emails to the customers. Visit swiftcrm.net for prices and free trails.
|
20 |
</p></description>
|
21 |
-
<notes>
|
22 |
<authors><author><name>Simon Cooper</name><user>Netready</user><email>simon@netready.biz</email></author></authors>
|
23 |
-
<date>2016-
|
24 |
-
<time>14:
|
25 |
-
<contents><target name="magelib"><dir name="libXML"><file name="xml.php" hash="c20ca4a39971acf4605247712186b9ec"/></dir><dir name="SwiftAPI"><file name="SwiftAPI.php" hash="8bb2f97586dbd62da6fd0d6781b67ae6"/><file name="SwiftAPI_Exception.php" hash="879b899a7961f4de1212b7296ccafb16"/><file name="SwiftAPI_Product.php" hash="063922cccb485d81c6022de5c4e8e044"/><file name="SwiftAPI_Request.php" hash="f072a4c42fe3767d769f8e9f9c824ecd"/><file name="SwiftAPI_Request_Cart.php" hash="f8955c78200ddb0512adb5214fd64bb2"/><file name="SwiftAPI_Request_EmailPackage.php" hash="
|
26 |
<compatible/>
|
27 |
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php><extension><name>mcrypt</name><min/><max/></extension></required></dependencies>
|
28 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Swift_Swiftplugin</name>
|
4 |
+
<version>1.7.1</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/LGPL-3.0">LGPL</license>
|
7 |
<channel>community</channel>
|
18 |
<p>
|
19 |
The extension is easy to set up and uses Magento’s built in features to collect information and send emails to the customers. Visit swiftcrm.net for prices and free trails.
|
20 |
</p></description>
|
21 |
+
<notes>Fixed a undefined constant error, if certain return paths were set via smtp</notes>
|
22 |
<authors><author><name>Simon Cooper</name><user>Netready</user><email>simon@netready.biz</email></author></authors>
|
23 |
+
<date>2016-10-18</date>
|
24 |
+
<time>14:07:03</time>
|
25 |
+
<contents><target name="magelib"><dir name="libXML"><file name="xml.php" hash="c20ca4a39971acf4605247712186b9ec"/></dir><dir name="SwiftAPI"><file name="SwiftAPI.php" hash="8bb2f97586dbd62da6fd0d6781b67ae6"/><file name="SwiftAPI_Exception.php" hash="879b899a7961f4de1212b7296ccafb16"/><file name="SwiftAPI_Product.php" hash="063922cccb485d81c6022de5c4e8e044"/><file name="SwiftAPI_Request.php" hash="f072a4c42fe3767d769f8e9f9c824ecd"/><file name="SwiftAPI_Request_Cart.php" hash="f8955c78200ddb0512adb5214fd64bb2"/><file name="SwiftAPI_Request_EmailPackage.php" hash="a23bdf7699540ece514ec5a6f53ecb12"/><file name="SwiftAPI_Request_Home.php" hash="9268da121dd10db50d5c2675afd1c65e"/><file name="SwiftAPI_Request_Order.php" hash="49ff0d4c501b075f11ef94727d729a75"/><file name="SwiftAPI_Request_OrderPackage.php" hash="45ad4af3b24bfab66f96b493c830ceab"/><file name="SwiftAPI_Request_PastOrder.php" hash="90ac5fb44bd1ad61f39d277d268e3575"/><file name="SwiftAPI_Request_Ping.php" hash="e5e13b71682f8230711d5d2f28f9a534"/><file name="SwiftAPI_Request_Product.php" hash="e5fab27bb2dd45946ed8c143a18fe3c4"/><file name="SwiftAPI_Request_SendMail.php" hash="ba04382a3df6b3e179aed5fe3e809de7"/><file name="SwiftAPI_Request_Subscription.php" hash="5545738b941d8ca4dca69b6059a0cce4"/><file name="SwiftAPI_Request_Unsubscribe.php" hash="78aa37cc0ecb98d501674350a4a409c9"/><file name="SwiftAPI_Request_Version.php" hash="21cebd7eb59698bb0aae55bdeaa23660"/><file name="SwiftAPI_Request_ViewMail.php" hash="f0eb0236c7f6e1fa194d8f05f865a7d8"/><dir name="doc"><file name="SwiftAPI-Specification.html" hash="a31d6c9f13198d017f9f50ac787bea23"/><file name="SwiftAPI-Specification_v3.html" hash="17f8207291313730a72286901c61e44f"/></dir><file name="index.php" hash="82886bb98883bd5868ea04c7d8c88ba5"/><file name="php.ini" hash="ef29c923925a1d1bbc8879c22297daa4"/></dir></target><target name="magecommunity"><dir name="Swift"><dir name="Swiftplugin"><dir name="Block"><dir name="Adminhtml"><dir name="Swift"><dir name="Edit"><file name="Form.php" hash="bd80ab8170f7f2286f13ac579e5249d9"/><dir name="Tab"><file name="Form.php" hash="3d15c45cb2205acabc20376f41a9bd5b"/><file name="Instruct.php" hash="9f34075cc9cdfa92b7876c33fda514de"/></dir><file name="Tabs.php" hash="993769f682fad7d28df79ff3acea97cc"/></dir><file name="Edit.php" hash="d93f75dbaaa7266d91e828b3208fbf2d"/></dir></dir><file name="Swiftblock.php" hash="8b4f72297c8af67374c695b44003867d"/></dir><dir name="Helper"><file name="Data.php" hash="08be234d9cbc17ed98f67a5fd0ca9002"/></dir><dir name="Model"><dir name="Mysql4"><dir name="Swift"><file name="Collection.php" hash="82de0fe56cd875d3e78c8fc690424ee1"/></dir><file name="Swift.php" hash="252d5f2ecb1119804b415758d2db6800"/><dir name="Swiftorders"><file name="Collection.php" hash="a9e75003a18fcedc8badf1ab3ae79719"/></dir><file name="Swiftorders.php" hash="881185eb5fa8af8fe385c1bfaaeb94e0"/></dir><file name="Observer.php" hash="8bb4dd498a57f1166ed1c85a2b8ab0e0"/><file name="Swift.php" hash="1f9e49d4db7f8987cfd8858061fedc6a"/><file name="Swiftorders.php" hash="e3f2d23f00e0ad8309a958a24b613678"/><file name="XmlProduct.php" hash="3aed17e5f76c1397f16a9a4aabb3bdd7"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="IndexController.php" hash="92604a30880c89fbe7885780520096cc"/></dir><file name="MailController.php" hash="cecc1f1806a0da398cdf6ef7b7bdaec0"/><file name="OrdersController.php" hash="bbc0ecc7669fdc388aa258fb162bdff2"/><file name="VersionController.php" hash="b9bebb51f946430a2dc7bfc82f96bf36"/><file name="XmlController.php" hash="e78cc03f619a75d43752e8bde42b0798"/></dir><dir name="etc"><file name="config.xml" hash="e3ba0f484e340ba683190fd0948d2218"/></dir><dir name="sql"><dir name="swift_setup"><file name="install-1.1.13.php" hash="2447b5645fc36738373678473cec88dc"/><file name="install-1.1.2.php" hash="00832a00c34cb4c997a96330cb28cbfb"/><file name="install-1.7.0.php" hash="13788c22d8b0ad31c68a775f06333d47"/><file name="upgrade-1.1.12-1.7.0.php" hash="979794d8258b7f3840e9699139505823"/><file name="upgrade-1.1.2-1.1.12.php" hash="cbe3c3fa07facb7b720d7dd518acbeca"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="swift.xml" hash="d80a5229e30cf4b76f5a5150ac1c27c3"/></dir><dir name="template"><dir name="swift"><file name="swiftplugin.phtml" hash="d4d25148e09529e457b6436d7655627b"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Swift_all.xml" hash="0ae5a788c805a9fc79b402fe7a02e54d"/></dir></target></contents>
|
26 |
<compatible/>
|
27 |
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php><extension><name>mcrypt</name><min/><max/></extension></required></dependencies>
|
28 |
</package>
|