Carotechs_Smsnotify - Version 0.1.7

Version Notes

Sms notification

Download this release

Release Info

Developer Carotechs
Extension Carotechs_Smsnotify
Version 0.1.7
Comparing to
See all releases


Code changes from version 0.1.6 to 0.1.7

app/code/local/Carotechs/Smsnotify/Helper/Data.php CHANGED
@@ -168,6 +168,7 @@ class Carotechs_Smsnotify_Helper_Data extends Mage_Core_Helper_Data
168
  }
169
  else
170
  {
 
171
  $sendSms = $this->file_get_contents_curl($url);
172
  }
173
 
@@ -189,23 +190,20 @@ class Carotechs_Smsnotify_Helper_Data extends Mage_Core_Helper_Data
189
 
190
  public function file_get_contents_curl($url)
191
  {
192
-
193
- curl_setopt($ch, CURLOPT_HEADER, 0);
194
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //Set curl to return the data instead of printing it to the browser.
195
  curl_setopt($ch, CURLOPT_URL, $url);
196
-
197
  $res = curl_exec($ch);
198
  curl_close($ch);
199
-
200
  return $res;
201
  }
202
 
203
  public function file_get_contents_curl_POST($url,$data)
204
  {
205
-
206
  $ch = curl_init($url);
207
  curl_setopt($ch, CURLOPT_POST, true);
208
  curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
 
209
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
210
  $res = curl_exec($ch);
211
  curl_close($ch);
168
  }
169
  else
170
  {
171
+
172
  $sendSms = $this->file_get_contents_curl($url);
173
  }
174
 
190
 
191
  public function file_get_contents_curl($url)
192
  {
193
+ $ch = curl_init();
 
 
194
  curl_setopt($ch, CURLOPT_URL, $url);
195
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //Set curl to return the data instead of printing it to the browser.
196
  $res = curl_exec($ch);
197
  curl_close($ch);
 
198
  return $res;
199
  }
200
 
201
  public function file_get_contents_curl_POST($url,$data)
202
  {
 
203
  $ch = curl_init($url);
204
  curl_setopt($ch, CURLOPT_POST, true);
205
  curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
206
+ curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1);
207
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
208
  $res = curl_exec($ch);
209
  curl_close($ch);
app/code/local/Carotechs/Smsnotify/Model/Observer.php CHANGED
@@ -53,7 +53,7 @@ class Carotechs_Smsnotify_Model_Observer
53
  if($sent_method)
54
  {
55
  $data = '';
56
- $data .= '?'.$message_field_name.'=' . $smsmsg;
57
  $data .= '&'.$to_field_name.'=' . $smsto;
58
 
59
  $method = 'GET';
@@ -63,8 +63,11 @@ class Carotechs_Smsnotify_Model_Observer
63
  else
64
  {
65
  $method = 'POST';
66
- $post_data[$message_field_name] = $smsmsg;
67
- $post_data[$to_field_name] = $smsto;
 
 
 
68
  $url = $api_url;
69
  $sendSms = $this->getHelper()->sendSms($url,$post_data);
70
  }
@@ -134,7 +137,7 @@ class Carotechs_Smsnotify_Model_Observer
134
  if($sent_method)
135
  {
136
  $data = '';
137
- $data .= '?'.$message_field_name.'=' . $smsmsg;
138
  $data .= '&'.$to_field_name.'=' . $smsto;
139
 
140
  $method = 'GET';
@@ -144,10 +147,13 @@ class Carotechs_Smsnotify_Model_Observer
144
  else
145
  {
146
  $method = 'POST';
147
- $post_data[$message_field_name] = $smsmsg;
148
- $post_data[$to_field_name] = $smsto;
149
- $url = $api_url;
150
- $sendSms = $this->getHelper()->sendSms($url,$post_data);
 
 
 
151
  }
152
  } // end flag
153
  else
@@ -214,7 +220,7 @@ class Carotechs_Smsnotify_Model_Observer
214
  if($sent_method)
215
  {
216
  $data = '';
217
- $data .= '?'.$message_field_name.'=' . $smsmsg;
218
  $data .= '&'.$to_field_name.'=' . $smsto;
219
 
220
  $method = 'GET';
@@ -224,8 +230,9 @@ class Carotechs_Smsnotify_Model_Observer
224
  else
225
  {
226
  $method = 'POST';
227
- $post_data[$message_field_name] = $smsmsg;
228
- $post_data[$to_field_name] = $smsto;
 
229
  $url = $api_url;
230
  $sendSms = $this->getHelper()->sendSms($url,$post_data);
231
  }
@@ -295,7 +302,7 @@ class Carotechs_Smsnotify_Model_Observer
295
  if($sent_method)
296
  {
297
  $data = '';
298
- $data .= '?'.$message_field_name.'=' . $smsmsg;
299
  $data .= '&'.$to_field_name.'=' . $smsto;
300
 
301
  $method = 'GET';
@@ -305,8 +312,9 @@ class Carotechs_Smsnotify_Model_Observer
305
  else
306
  {
307
  $method = 'POST';
308
- $post_data[$message_field_name] = $smsmsg;
309
- $post_data[$to_field_name] = $smsto;
 
310
  $url = $api_url;
311
  $sendSms = $this->getHelper()->sendSms($url,$post_data);
312
  }
@@ -376,7 +384,7 @@ class Carotechs_Smsnotify_Model_Observer
376
  if($sent_method)
377
  {
378
  $data = '';
379
- $data .= '?'.$message_field_name.'=' . $smsmsg;
380
  $data .= '&'.$to_field_name.'=' . $smsto;
381
 
382
  $method = 'GET';
@@ -386,8 +394,9 @@ class Carotechs_Smsnotify_Model_Observer
386
  else
387
  {
388
  $method = 'POST';
389
- $post_data[$message_field_name] = $smsmsg;
390
- $post_data[$to_field_name] = $smsto;
 
391
  $url = $api_url;
392
  $sendSms = $this->getHelper()->sendSms($url,$post_data);
393
  }
53
  if($sent_method)
54
  {
55
  $data = '';
56
+ $data .= '&'.$message_field_name.'=' . $smsmsg;
57
  $data .= '&'.$to_field_name.'=' . $smsto;
58
 
59
  $method = 'GET';
63
  else
64
  {
65
  $method = 'POST';
66
+ //$post_data[$message_field_name] = $smsmsg;
67
+ //$post_data[$to_field_name] = $smsto;
68
+ $post_data = '';
69
+ $post_data .= $message_field_name.'=' . $smsmsg;
70
+ $post_data .= '&'.$to_field_name.'=' . $smsto;
71
  $url = $api_url;
72
  $sendSms = $this->getHelper()->sendSms($url,$post_data);
73
  }
137
  if($sent_method)
138
  {
139
  $data = '';
140
+ $data .= '&'.$message_field_name.'=' . $smsmsg;
141
  $data .= '&'.$to_field_name.'=' . $smsto;
142
 
143
  $method = 'GET';
147
  else
148
  {
149
  $method = 'POST';
150
+ //$post_data[$message_field_name] = $smsmsg;
151
+ //$post_data[$to_field_name] = $smsto;
152
+ $post_data = '';
153
+ $post_data .= $message_field_name.'=' . $smsmsg;
154
+ $post_data .= '&'.$to_field_name.'=' . $smsto;
155
+ $url = $api_url;
156
+ $sendSms = $this->getHelper()->sendSms($url,$post_data);
157
  }
158
  } // end flag
159
  else
220
  if($sent_method)
221
  {
222
  $data = '';
223
+ $data .= '&'.$message_field_name.'=' . $smsmsg;
224
  $data .= '&'.$to_field_name.'=' . $smsto;
225
 
226
  $method = 'GET';
230
  else
231
  {
232
  $method = 'POST';
233
+ $post_data = '';
234
+ $post_data .= $message_field_name.'=' . $smsmsg;
235
+ $post_data .= '&'.$to_field_name.'=' . $smsto;
236
  $url = $api_url;
237
  $sendSms = $this->getHelper()->sendSms($url,$post_data);
238
  }
302
  if($sent_method)
303
  {
304
  $data = '';
305
+ $data .= '&'.$message_field_name.'=' . $smsmsg;
306
  $data .= '&'.$to_field_name.'=' . $smsto;
307
 
308
  $method = 'GET';
312
  else
313
  {
314
  $method = 'POST';
315
+ $post_data = '';
316
+ $post_data .= $message_field_name.'=' . $smsmsg;
317
+ $post_data .= '&'.$to_field_name.'=' . $smsto;
318
  $url = $api_url;
319
  $sendSms = $this->getHelper()->sendSms($url,$post_data);
320
  }
384
  if($sent_method)
385
  {
386
  $data = '';
387
+ $data .= '&'.$message_field_name.'=' . $smsmsg;
388
  $data .= '&'.$to_field_name.'=' . $smsto;
389
 
390
  $method = 'GET';
394
  else
395
  {
396
  $method = 'POST';
397
+ $post_data = '';
398
+ $post_data .= $message_field_name.'=' . $smsmsg;
399
+ $post_data .= '&'.$to_field_name.'=' . $smsto;
400
  $url = $api_url;
401
  $sendSms = $this->getHelper()->sendSms($url,$post_data);
402
  }
app/code/local/Carotechs/Smsnotify/controllers/Adminhtml/SmsnotifyController.php CHANGED
@@ -60,7 +60,7 @@ class Carotechs_Smsnotify_Adminhtml_SmsnotifyController extends Mage_Adminhtml_C
60
  if($sent_method)
61
  {
62
  $data = '';
63
- $data .= '?'.$message_field_name.'=' . $message;
64
  $data .= '&'.$to_field_name.'=' . $phone_array[$i];
65
 
66
  $method = 'GET';
@@ -69,9 +69,13 @@ class Carotechs_Smsnotify_Adminhtml_SmsnotifyController extends Mage_Adminhtml_C
69
  }
70
  else
71
  {
72
- $post_data = array();
73
- $post_data[$message_field_name] = $message;
74
- $post_data[$to_field_name] = $phone_array[$i];
 
 
 
 
75
  $url = $api_url;
76
  $sendSms = Mage::helper('smsnotify')->sendSms($url,$post_data);
77
  }
60
  if($sent_method)
61
  {
62
  $data = '';
63
+ $data .= '&'.$message_field_name.'=' . $message;
64
  $data .= '&'.$to_field_name.'=' . $phone_array[$i];
65
 
66
  $method = 'GET';
69
  }
70
  else
71
  {
72
+ //$post_data = array();
73
+ //$post_data[$message_field_name] = $message;
74
+ //$post_data[$to_field_name] = $phone_array[$i];
75
+ $post_data = '';
76
+ $post_data .= $message_field_name.'=' . $message;
77
+ $post_data .= '&'.$to_field_name.'=' . $phone_array[$i];
78
+
79
  $url = $api_url;
80
  $sendSms = Mage::helper('smsnotify')->sendSms($url,$post_data);
81
  }
app/code/local/Carotechs/Smsnotify/etc/system.xml CHANGED
@@ -77,7 +77,7 @@ or check out.</comment>
77
  <show_in_store>1</show_in_store>
78
  </to_field>
79
 
80
- <configinfo translate="label">
81
  <frontend_type>label</frontend_type>
82
  <label>Sample API URL format:</label>
83
  <comment><![CDATA[http://www.yoursmsgateway.com/send.php?user={{user}}&password={{pass}}&api_id=YOUR_API_ID&to={{phone_number}}&text={{text_message}}<br/><b>Make sure that this URL format matches gateway api url.]]></comment>
@@ -85,7 +85,7 @@ or check out.</comment>
85
  <show_in_default>1</show_in_default>
86
  <show_in_website>0</show_in_website>
87
  <show_in_store>0</show_in_store>
88
- </configinfo>
89
 
90
 
91
 
77
  <show_in_store>1</show_in_store>
78
  </to_field>
79
 
80
+ <!--configinfo translate="label">
81
  <frontend_type>label</frontend_type>
82
  <label>Sample API URL format:</label>
83
  <comment><![CDATA[http://www.yoursmsgateway.com/send.php?user={{user}}&password={{pass}}&api_id=YOUR_API_ID&to={{phone_number}}&text={{text_message}}<br/><b>Make sure that this URL format matches gateway api url.]]></comment>
85
  <show_in_default>1</show_in_default>
86
  <show_in_website>0</show_in_website>
87
  <show_in_store>0</show_in_store>
88
+ </configinfo-->
89
 
90
 
91
 
package.xml CHANGED
@@ -1,18 +1,18 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Carotechs_Smsnotify</name>
4
- <version>0.1.6</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">OSLv3.0</license>
7
  <channel>community</channel>
8
  <extends/>
9
- <summary>SMS notification</summary>
10
- <description>SMS notification</description>
11
  <notes>Sms notification</notes>
12
  <authors><author><name>Carotechs</name><user>Carotechs</user><email>apps@carotechs.com</email></author></authors>
13
- <date>2014-12-31</date>
14
- <time>09:25:44</time>
15
- <contents><target name="mageetc"><dir name="modules"><file name="Carotechs_Smsnotify.xml" hash="cbc54fef2beda0afca8e70da6b1cb64e"/></dir></target><target name="magelocal"><dir name="Carotechs"><dir name="Smsnotify"><dir name="Block"><dir name="Adminhtml"><file name="Smsnotify.php" hash="f6be5c24ff0fdf5d1f5762dc6143e5d3"/></dir></dir><dir name="Helper"><file name="Data.php" hash="2ec7d62b4b02c351c2241a0b0d648cbf"/></dir><dir name="Model"><dir name="Dropdown"><file name="Values.php" hash="c4b45a94203c6d01ad5c68254e9a47ef"/></dir><file name="Observer.php" hash="4d868dc8e1dbc7dfac8a520e986f641a"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="SmsnotifyController.php" hash="264c71915d0f6cbe23ae6d3dd9975d97"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="e99746e0ff62933de319ad34edb31ec1"/><file name="config.xml" hash="a5cb4bd1d8e7433b30600ba33e130e0d"/><file name="system.xml" hash="264f6be93060b3c9624af49cff3cac45"/></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="smsnotify.xml" hash="0cec03163537aa5471b459f8698e56b4"/></dir><dir name="template"><dir name="smsnotify"><file name="sendsms.phtml" hash="a9f51355cb85c439c72b65b3236aa61a"/></dir></dir></dir></dir></dir></target></contents>
16
  <compatible/>
17
- <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php><package><name></name><channel>connect.magentocommerce.com/core</channel><min></min><max></max></package></required></dependencies>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Carotechs_Smsnotify</name>
4
+ <version>0.1.7</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">OSLv3.0</license>
7
  <channel>community</channel>
8
  <extends/>
9
+ <summary>Sms notification</summary>
10
+ <description>Sms notification</description>
11
  <notes>Sms notification</notes>
12
  <authors><author><name>Carotechs</name><user>Carotechs</user><email>apps@carotechs.com</email></author></authors>
13
+ <date>2015-01-13</date>
14
+ <time>05:31:40</time>
15
+ <contents><target name="magelocal"><dir name="Carotechs"><dir name="Smsnotify"><dir name="Block"><dir name="Adminhtml"><file name="Smsnotify.php" hash="f6be5c24ff0fdf5d1f5762dc6143e5d3"/></dir></dir><dir name="Helper"><file name="Data.php" hash="bda6cb415b3ea67a5dbcbc59e0ad7a6f"/></dir><dir name="Model"><dir name="Dropdown"><file name="Values.php" hash="c4b45a94203c6d01ad5c68254e9a47ef"/></dir><file name="Observer.php" hash="08661f8044dd1b049cfe352c2b875aca"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="SmsnotifyController.php" hash="9d44584d63f9f67de31db6cdf08a3743"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="e99746e0ff62933de319ad34edb31ec1"/><file name="config.xml" hash="a5cb4bd1d8e7433b30600ba33e130e0d"/><file name="system.xml" hash="8c4b1f5f692a2d2c4224a351025e0fd6"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Carotechs_Smsnotify.xml" hash="cbc54fef2beda0afca8e70da6b1cb64e"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="smsnotify.xml" hash="0cec03163537aa5471b459f8698e56b4"/></dir><dir name="template"><dir name="smsnotify"><file name="sendsms.phtml" hash="a9f51355cb85c439c72b65b3236aa61a"/></dir></dir></dir></dir></dir></target></contents>
16
  <compatible/>
17
+ <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
18
  </package>