oneall_sociallogin - Version 1.0.0

Version Notes

* First version

Download this release

Release Info

Developer OneAll
Extension oneall_sociallogin
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

Files changed (22) hide show
  1. app/code/community/OneAll/SocialLogin/Block/Adminhtml/System/Config/Fieldset/General.php +88 -0
  2. app/code/community/OneAll/SocialLogin/Block/Login.php +58 -0
  3. app/code/community/OneAll/SocialLogin/Helper/Data.php +519 -0
  4. app/code/community/OneAll/SocialLogin/Model/Apiautodetect.php +147 -0
  5. app/code/community/OneAll/SocialLogin/Model/Apiconnectionhandler.php +47 -0
  6. app/code/community/OneAll/SocialLogin/Model/Apiconnectionport.php +47 -0
  7. app/code/community/OneAll/SocialLogin/Model/Apiverify.php +130 -0
  8. app/code/community/OneAll/SocialLogin/Model/Entity.php +32 -0
  9. app/code/community/OneAll/SocialLogin/Model/Mysql4/Entity.php +34 -0
  10. app/code/community/OneAll/SocialLogin/Model/Mysql4/Entity/Collection.php +34 -0
  11. app/code/community/OneAll/SocialLogin/Model/Services.php +45 -0
  12. app/code/community/OneAll/SocialLogin/controllers/AjaxController.php +141 -0
  13. app/code/community/OneAll/SocialLogin/etc/adminhtml.xml +22 -0
  14. app/code/community/OneAll/SocialLogin/etc/config.xml +114 -0
  15. app/code/community/OneAll/SocialLogin/etc/system.xml +398 -0
  16. app/code/community/OneAll/SocialLogin/sql/oneall_sociallogin_setup/mysql4-install-1.0.0.php +44 -0
  17. app/design/frontend/base/default/layout/oneall-sociallogin.xml +45 -0
  18. app/design/frontend/base/default/template/oneall/sociallogin/library.phtml +66 -0
  19. app/design/frontend/base/default/template/oneall/sociallogin/login.phtml +137 -0
  20. app/etc/modules/OneAll_SocialLogin.xml +35 -0
  21. package.xml +20 -0
  22. skin/frontend/base/default/css/oneall/sociallogin.css +74 -0
app/code/community/OneAll/SocialLogin/Block/Adminhtml/System/Config/Fieldset/General.php ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @package OneAll Social Login
5
+ * @copyright Copyright 2014 http://www.oneall.com - All rights reserved.
6
+ * @license GNU/GPL 2 or later
7
+ *
8
+ * This program is free software; you can redistribute it and/or
9
+ * modify it under the terms of the GNU General Public License
10
+ * as published by the Free Software Foundation; either version 2
11
+ * of the License, or (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program; if not, write to the Free Software
20
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
21
+ *
22
+ * The "GNU General Public License" (GPL) is available at
23
+ * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
24
+ *
25
+ */
26
+
27
+ class OneAll_SocialLogin_Block_Adminhtml_System_Config_Fieldset_General extends Mage_Adminhtml_Block_System_Config_Form_Fieldset
28
+ {
29
+ protected function _getHeaderHtml ($element)
30
+ {
31
+ if (method_exists ($this, '_getHeaderTitleHtml'))
32
+ {
33
+ if ($element->getIsNested ())
34
+ {
35
+ $html = '<tr class="nested"><td colspan="4"><div class="' . $this->_getFrontendClass ($element) . '">';
36
+ }
37
+ else
38
+ {
39
+ $html = '<div class="' . $this->_getFrontendClass ($element) . '">';
40
+ }
41
+ $html .= $this->_getHeaderTitleHtml ($element);
42
+
43
+ $html .= '<input id="' . $element->getHtmlId () . '-state" name="config_state[' . $element->getId () . ']" type="hidden" value="' . (int) $this->_getCollapseState ($element) . '" />';
44
+ $html .= '<fieldset class="' . $this->_getFieldsetCss ($element) . '" id="' . $element->getHtmlId () . '">';
45
+ // $html.= '<button style="margin-right:25px; margin-top:-33px; float: right;" onclick="window.open(\'http://docs.oneall.com\')" class="scalable go" type="button" id="gsc_wiki"><span>'.$this->__('OneAll Social Connector Wiki').'</span></button>';
46
+
47
+ $html .= '<legend>' . $element->getLegend () . '</legend>';
48
+
49
+ $html .= $this->_getHeaderCommentHtml ($element);
50
+
51
+ // field label column
52
+ $html .= '<table cellspacing="0" class="form-list"><colgroup class="label" /><colgroup class="value" />';
53
+ if ($this->getRequest ()->getParam ('website') || $this->getRequest ()->getParam ('store'))
54
+ {
55
+ $html .= '<colgroup class="use-default" />';
56
+ }
57
+ $html .= '<colgroup class="scope-label" /><colgroup class="" /><tbody>';
58
+ }
59
+ else
60
+ {
61
+ $default = ! $this->getRequest ()->getParam ('website') && ! $this->getRequest ()->getParam ('store');
62
+ $html = '<div class="entry-edit-head collapseable" >';
63
+ // $html.= '<button style="margin-right:25px;float: right;" onclick="window.open(\'http://docs.oneall.com\')" class="scalable go" type="button" id="gsc_wiki"><span>'.$this->__('OneAll Social Connector Wiki').'</span></button>';
64
+ $html .= '<a id="' . $element->getHtmlId () . '-head" href="#" onclick="Fieldset.toggleCollapse(\'' . $element->getHtmlId () . '\', \'' . $this->getUrl ('*/*/state') . '\'); return false;">' . $element->getLegend () . '</a></div>';
65
+ $html .= '<input id="' . $element->getHtmlId () . '-state" name="config_state[' . $element->getId () . ']" type="hidden" value="' . (int) $this->_getCollapseState ($element) . '" />';
66
+ $html .= '<fieldset class="' . $this->_getFieldsetCss () . '" id="' . $element->getHtmlId () . '">';
67
+ $html .= '<legend>' . $element->getLegend () . '</legend>';
68
+
69
+ if ($element->getComment ())
70
+ {
71
+ $html .= '<div class="comment">' . $element->getComment () . '</div>';
72
+ }
73
+ // field label column
74
+ $html .= '<table cellspacing="0" class="form-list"><colgroup class="label" /><colgroup class="value" />';
75
+ if (! $default)
76
+ {
77
+ $html .= '<colgroup class="use-default" />';
78
+ }
79
+ $html .= '<colgroup class="scope-label" /><colgroup class="" /><tbody>';
80
+ }
81
+ return $html;
82
+ }
83
+ protected function _getFieldsetCss ($element = null)
84
+ {
85
+ $configCss = (string) $this->getGroup ($element)->fieldset_css;
86
+ return 'config collapseable' . ($configCss ? ' ' . $configCss : '');
87
+ }
88
+ }
app/code/community/OneAll/SocialLogin/Block/Login.php ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @package OneAll Social Login
5
+ * @copyright Copyright 2014 http://www.oneall.com - All rights reserved.
6
+ * @license GNU/GPL 2 or later
7
+ *
8
+ * This program is free software; you can redistribute it and/or
9
+ * modify it under the terms of the GNU General Public License
10
+ * as published by the Free Software Foundation; either version 2
11
+ * of the License, or (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program; if not, write to the Free Software
20
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
21
+ *
22
+ * The "GNU General Public License" (GPL) is available at
23
+ * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
24
+ *
25
+ */
26
+
27
+ class OneAll_SocialLogin_Block_Login extends Mage_Core_Block_Template
28
+ {
29
+ private $place;
30
+ public function __construct ()
31
+ {
32
+ parent::__construct ();
33
+ if (! $this->getSession ()->isLoggedIn () && Mage::helper ('oneall_sociallogin')->handle_api_callback () !== 'yes')
34
+ {
35
+ $this->setTemplate ('oneall/sociallogin/login.phtml');
36
+ }
37
+ else
38
+ {
39
+ }
40
+ }
41
+ private function getSession ()
42
+ {
43
+ return Mage::getSingleton ('customer/session');
44
+ }
45
+ public function setPlace ($place)
46
+ {
47
+ $this->place = $place;
48
+ return $this;
49
+ }
50
+ public function getPlace ()
51
+ {
52
+ return $this->place;
53
+ }
54
+ public function getLoginType ($service = '')
55
+ {
56
+ return Mage::getStoreConfig ('oneall_sociallogin/' . $service . '/' . $this->getPlace () . '_type');
57
+ }
58
+ }
app/code/community/OneAll/SocialLogin/Helper/Data.php ADDED
@@ -0,0 +1,519 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @package OneAll Social Login
5
+ * @copyright Copyright 2014 http://www.oneall.com - All rights reserved.
6
+ * @license GNU/GPL 2 or later
7
+ *
8
+ * This program is free software; you can redistribute it and/or
9
+ * modify it under the terms of the GNU General Public License
10
+ * as published by the Free Software Foundation; either version 2
11
+ * of the License, or (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program; if not, write to the Free Software
20
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
21
+ *
22
+ * The "GNU General Public License" (GPL) is available at
23
+ * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
24
+ *
25
+ */
26
+
27
+ // Helper
28
+ class OneAll_SocialLogin_Helper_Data extends Mage_Core_Helper_Abstract
29
+ {
30
+ /**
31
+ * Generate a random email address.
32
+ */
33
+ protected function create_random_email ()
34
+ {
35
+ $customer = Mage::getModel ('customer/customer');
36
+ $website_id = Mage::app ()->getWebsite ()->getId ();
37
+
38
+ // Website Id
39
+ if ($website_id)
40
+ {
41
+ $customer->setWebsiteId ($website_id);
42
+ }
43
+
44
+ do
45
+ {
46
+ // Create a random email.
47
+ $email = md5 (uniqid (wp_rand (10000, 99000))) . "@example.com";
48
+
49
+ // Try to load a customer for it
50
+ $customer->loadByEmail ($email);
51
+ }
52
+ while (! $customer->getId ());
53
+
54
+ // Done
55
+ return $email;
56
+ }
57
+
58
+ /**
59
+ * Check if the current connection is being made over https.
60
+ */
61
+ public function is_https_on ()
62
+ {
63
+ if (! empty ($_SERVER ['SERVER_PORT']))
64
+ {
65
+ if (trim ($_SERVER ['SERVER_PORT']) == '443')
66
+ {
67
+ return true;
68
+ }
69
+ }
70
+
71
+ if (! empty ($_SERVER ['HTTP_X_FORWARDED_PROTO']))
72
+ {
73
+ if (strtolower (trim ($_SERVER ['HTTP_X_FORWARDED_PROTO'])) == 'https')
74
+ {
75
+ return true;
76
+ }
77
+ }
78
+
79
+ if (! empty ($_SERVER ['HTTPS']))
80
+ {
81
+ if (strtolower (trim ($_SERVER ['HTTPS'])) == 'on' or trim ($_SERVER ['HTTPS']) == '1')
82
+ {
83
+ return true;
84
+ }
85
+ }
86
+
87
+ return false;
88
+ }
89
+
90
+ /**
91
+ * Handle the callback from OneAll.
92
+ */
93
+ public function handle_api_callback ()
94
+ {
95
+ // Read URL parameters
96
+ $action = Mage::app ()->getRequest ()->getParam ('oa_action');
97
+ $connection_token = Mage::app ()->getRequest ()->getParam ('connection_token');
98
+
99
+ // Callback Handler
100
+ if ($action == 'social_login' and ! empty ($connection_token))
101
+ {
102
+ // Read settings
103
+ $settings = array ();
104
+ $settings ['api_connection_handler'] = Mage::getStoreConfig ('oneall_sociallogin/connection/handler');
105
+ $settings ['api_connection_port'] = Mage::getStoreConfig ('oneall_sociallogin/connection/port');
106
+ $settings ['api_subdomain'] = Mage::getStoreConfig ('oneall_sociallogin/general/subdomain');
107
+ $settings ['api_key'] = Mage::getStoreConfig ('oneall_sociallogin/general/key');
108
+ $settings ['api_secret'] = Mage::getStoreConfig ('oneall_sociallogin/general/secret');
109
+
110
+ // API Settings
111
+ $api_connection_handler = ((! empty ($settings ['api_connection_handler']) and $settings ['api_connection_handler'] == 'fsockopen') ? 'fsockopen' : 'curl');
112
+ $api_connection_port = ((! empty ($settings ['api_connection_port']) and $settings ['api_connection_port'] == 80) ? 80 : 443);
113
+ $api_connection_protocol = ($api_connection_port == 80 ? 'http' : 'https');
114
+ $api_subdomain = (! empty ($settings ['api_subdomain']) ? trim ($settings ['api_subdomain']) : '');
115
+
116
+ // We cannot make a connection without a subdomain
117
+ if (! empty ($api_subdomain))
118
+ {
119
+ // See: http://docs.oneall.com/api/resources/connections/read-connection-details/
120
+ $api_resource_url = $api_connection_protocol . '://' . $api_subdomain . '.api.oneall.com/connections/' . $connection_token . '.json';
121
+
122
+ // API Credentials
123
+ $api_credentials = array ();
124
+ $api_credentials ['api_key'] = (! empty ($settings ['api_key']) ? $settings ['api_key'] : '');
125
+ $api_credentials ['api_secret'] = (! empty ($settings ['api_secret']) ? $settings ['api_secret'] : '');
126
+
127
+ // Retrieve connection details
128
+ $result = $this->do_api_request ($api_connection_handler, $api_resource_url, $api_credentials);
129
+
130
+ // Check result
131
+ if (is_object ($result) and property_exists ($result, 'http_code') and $result->http_code == 200 and property_exists ($result, 'http_data'))
132
+ {
133
+ // Decode result
134
+ $decoded_result = @json_decode ($result->http_data);
135
+
136
+ if (is_object ($decoded_result) and isset ($decoded_result->response->result->data->user))
137
+ {
138
+ // Extract user data.
139
+ $data = $decoded_result->response->result->data;
140
+
141
+ // The user_token uniquely identifies the user.
142
+ $user_token = $data->user->user_token;
143
+
144
+ // The identity_token uniquely identifies the social network account.
145
+ $identity_token = $data->user->identity->identity_token;
146
+
147
+ // Check if we have a user for this user_token.
148
+ $customer_id = Mage::getModel ('oneall_sociallogin/entity')->load ($user_token, 'user_token')->customer_id;
149
+
150
+ // No user for this token, check if we have a user for this email.
151
+ if (empty ($customer_id))
152
+ {
153
+ if (isset ($data->user->identity->emails) and is_array ($data->user->identity->emails))
154
+ {
155
+ $customer = Mage::getModel ("customer/customer");
156
+ $customer->setWebsiteId (Mage::app ()->getWebsite ()->getId ());
157
+ $customer->loadByEmail ($data->user->identity->emails [0]->value);
158
+ $customer_id = $customer->getId ();
159
+ }
160
+ }
161
+
162
+ // This is a new customer.
163
+ if (empty ($customer_id))
164
+ {
165
+ // Generate email address
166
+ if (isset ($data->user->identity->emails) and is_array ($data->user->identity->emails))
167
+ {
168
+ $email = $data->user->identity->emails [0]->value;
169
+ $email_is_random = false;
170
+ }
171
+ else
172
+ {
173
+ $email = $this->create_random_email ();
174
+ $email_is_random = true;
175
+ }
176
+
177
+ // Generate a random password.
178
+ $password = $customer->generatePassword (8);
179
+
180
+ // Create a new customer.
181
+ $customer = Mage::getModel ('customer/customer');
182
+ $customer->setData ('firstname', $data->user->identity->name->givenName);
183
+ $customer->setData ('lastname', $data->user->identity->name->familyName);
184
+ $customer->setData ('email', $email);
185
+ $customer->setSkipConfirmationIfEmail ($email);
186
+ $customer->setData ('password', $password);
187
+ $customer->setConfirmation ($password);
188
+
189
+ // Validate user details.
190
+ $errors = $customer->validate ();
191
+
192
+ // Do we have any errors?
193
+ if (is_array ($errors) && count ($errors))
194
+ {
195
+ Mage::getSingleton ('customer/session')->addError (implode (' ', $errors));
196
+ return false;
197
+ }
198
+
199
+ // Save user.
200
+ $customer->save ();
201
+
202
+ // Send email.
203
+ if (! $email_is_random)
204
+ {
205
+ $customer->sendNewAccountEmail ();
206
+ }
207
+
208
+ // Log this user in.
209
+ $customer_id = $customer->getId ();
210
+
211
+ // Save OneAll user_token.
212
+ $model = Mage::getModel ('oneall_sociallogin/entity');
213
+ $model->setData ('customer_id', $customer->getId ());
214
+ $model->setData ('user_token', $user_token);
215
+ $model->setData ('identity_token', $identity_token);
216
+ $model->save ();
217
+ }
218
+ // This is an existing customer.
219
+ else
220
+ {
221
+ // Check if we have a user for this user_token.
222
+ if (strlen (Mage::getModel ('oneall_sociallogin/entity')->load ($user_token, 'user_token')->customer_id) == 0)
223
+ {
224
+ // Save OneAll user_token.
225
+ $model = Mage::getModel ('oneall_sociallogin/entity');
226
+ $model->setData ('customer_id', $customer_id);
227
+ $model->setData ('user_token', $user_token);
228
+ $model->setData ('identity_token', $identity_token);
229
+ $model->save ();
230
+ }
231
+ }
232
+
233
+ // Login
234
+ if (! empty ($customer_id))
235
+ {
236
+ // Login
237
+ Mage::getSingleton ('customer/session')->loginById ($customer_id);
238
+
239
+ // Done
240
+ return true;
241
+ }
242
+ }
243
+ }
244
+ }
245
+ }
246
+
247
+ // Not logged in.
248
+ return false;
249
+ }
250
+
251
+ /**
252
+ * Return the list of disabled PHP functions.
253
+ */
254
+ public function get_disabled_php_functions ()
255
+ {
256
+ $disabled_functions = trim (ini_get ('disable_functions'));
257
+ if (strlen ($disabled_functions) == 0)
258
+ {
259
+ $disabled_functions = array ();
260
+ }
261
+ else
262
+ {
263
+ $disabled_functions = explode (',', $disabled_functions);
264
+ $disabled_functions = array_map ('trim', $disabled_functions);
265
+ }
266
+ return $disabled_functions;
267
+ }
268
+
269
+ /**
270
+ * Send an API request by using the given handler
271
+ */
272
+ public function do_api_request ($handler, $url, $options = array(), $timeout = 25)
273
+ {
274
+ // FSOCKOPEN
275
+ if ($handler == 'fsockopen')
276
+ {
277
+ return $this->do_fsockopen_request ($url, $options, $timeout);
278
+ }
279
+ // CURL
280
+ else
281
+ {
282
+ return $this->do_curl_request ($url, $options, $timeout);
283
+ }
284
+ }
285
+
286
+ /**
287
+ * Check if fsockopen is available.
288
+ */
289
+ public function is_fsockopen_available ()
290
+ {
291
+ // Make sure fsockopen has been loaded
292
+ if (function_exists ('fsockopen') and function_exists ('fwrite'))
293
+ {
294
+ // Read the disabled functions
295
+ $disabled_functions = $this->get_disabled_php_functions ();
296
+
297
+ // Make sure fsockopen has not been disabled
298
+ if (! in_array ('fsockopen', $disabled_functions) and ! in_array ('fwrite', $disabled_functions))
299
+ {
300
+ // Loaded and enabled
301
+ return true;
302
+ }
303
+ }
304
+
305
+ // Not loaded or disabled
306
+ return false;
307
+ }
308
+
309
+ /**
310
+ * Check if fsockopen is enabled and can be used to connect to OneAll.
311
+ */
312
+ public function is_api_connection_fsockopen_ok ($secure = true)
313
+ {
314
+ if ($this->is_fsockopen_available ())
315
+ {
316
+ $result = $this->do_fsockopen_request (($secure ? 'https' : 'http') . '://www.oneall.com/ping.html');
317
+ if (is_object ($result) and property_exists ($result, 'http_code') and $result->http_code == 200)
318
+ {
319
+ if (property_exists ($result, 'http_data'))
320
+ {
321
+ if (strtolower ($result->http_data) == 'ok')
322
+ {
323
+ return true;
324
+ }
325
+ }
326
+ }
327
+ }
328
+ return false;
329
+ }
330
+
331
+ /**
332
+ * Send an fsockopen request.
333
+ */
334
+ public function do_fsockopen_request ($url, $options = array(), $timeout = 15)
335
+ {
336
+ // Store the result
337
+ $result = new stdClass ();
338
+
339
+ // Make sure that this is a valid URL
340
+ if (($uri = parse_url ($url)) == false)
341
+ {
342
+ $result->http_code = - 1;
343
+ $result->http_data = null;
344
+ $result->http_error = 'invalid_uri';
345
+ return $result;
346
+ }
347
+
348
+ // Make sure that we can handle the scheme
349
+ switch ($uri ['scheme'])
350
+ {
351
+ case 'http':
352
+ $port = (isset ($uri ['port']) ? $uri ['port'] : 80);
353
+ $host = ($uri ['host'] . ($port != 80 ? ':' . $port : ''));
354
+ $fp = @fsockopen ($uri ['host'], $port, $errno, $errstr, $timeout);
355
+ break;
356
+
357
+ case 'https':
358
+ $port = (isset ($uri ['port']) ? $uri ['port'] : 443);
359
+ $host = ($uri ['host'] . ($port != 443 ? ':' . $port : ''));
360
+ $fp = @fsockopen ('ssl://' . $uri ['host'], $port, $errno, $errstr, $timeout);
361
+ break;
362
+
363
+ default:
364
+ $result->http_code = - 1;
365
+ $result->http_data = null;
366
+ $result->http_error = 'invalid_schema';
367
+ return $result;
368
+ break;
369
+ }
370
+
371
+ // Make sure that the socket has been opened properly
372
+ if (! $fp)
373
+ {
374
+ $result->http_code = - $errno;
375
+ $result->http_data = null;
376
+ $result->http_error = trim ($errstr);
377
+ return $result;
378
+ }
379
+
380
+ // Construct the path to act on
381
+ $path = (isset ($uri ['path']) ? $uri ['path'] : '/');
382
+ if (isset ($uri ['query']))
383
+ {
384
+ $path .= '?' . $uri ['query'];
385
+ }
386
+
387
+ // Create HTTP request
388
+ $defaults = array (
389
+ 'Host' => "Host: $host",
390
+ 'User-Agent' => 'User-Agent: SocialLogin Magento (+http://www.oneall.com/)'
391
+ );
392
+
393
+ // Enable basic authentication
394
+ if (isset ($options ['api_key']) and isset ($options ['api_secret']))
395
+ {
396
+ $defaults ['Authorization'] = 'Authorization: Basic ' . base64_encode ($options ['api_key'] . ":" . $options ['api_secret']);
397
+ }
398
+
399
+ // Build and send request
400
+ $request = 'GET ' . $path . " HTTP/1.0\r\n";
401
+ $request .= implode ("\r\n", $defaults);
402
+ $request .= "\r\n\r\n";
403
+ fwrite ($fp, $request);
404
+
405
+ // Fetch response
406
+ $response = '';
407
+ while (! feof ($fp))
408
+ {
409
+ $response .= fread ($fp, 1024);
410
+ }
411
+
412
+ // Close connection
413
+ fclose ($fp);
414
+
415
+ // Parse response
416
+ list ($response_header, $response_body) = explode ("\r\n\r\n", $response, 2);
417
+
418
+ // Parse header
419
+ $response_header = preg_split ("/\r\n|\n|\r/", $response_header);
420
+ list ($header_protocol, $header_code, $header_status_message) = explode (' ', trim (array_shift ($response_header)), 3);
421
+
422
+ // Build result
423
+ $result->http_code = $header_code;
424
+ $result->http_data = $response_body;
425
+
426
+ // Done
427
+ return $result;
428
+ }
429
+
430
+ /**
431
+ * Check if cURL has been loaded and is enabled.
432
+ */
433
+ public function is_curl_available ()
434
+ {
435
+ // Make sure cURL has been loaded.
436
+ if (in_array ('curl', get_loaded_extensions ()) and function_exists ('curl_init') and function_exists ('curl_exec'))
437
+ {
438
+ // Read the disabled functions.
439
+ $disabled_functions = $this->get_disabled_php_functions ();
440
+
441
+ // Make sure CURL has not been disabled.
442
+ if (! in_array ('curl_init', $disabled_functions) and ! in_array ('curl_exec', $disabled_functions))
443
+ {
444
+ // Loaded and enabled.
445
+ return true;
446
+ }
447
+ }
448
+
449
+ // Not loaded or disabled.
450
+ return false;
451
+ }
452
+
453
+ /**
454
+ * Check if CURL is available and can be used to connect to OneAll
455
+ */
456
+ public function is_api_connection_curl_ok ($secure = true)
457
+ {
458
+ // Is CURL available and enabled?
459
+ if ($this->is_curl_available ())
460
+ {
461
+ // Make a request to the OneAll API.
462
+ $result = $this->do_curl_request (($secure ? 'https' : 'http') . '://www.oneall.com/ping.html');
463
+ if (is_object ($result) and property_exists ($result, 'http_code') and $result->http_code == 200)
464
+ {
465
+ if (property_exists ($result, 'http_data'))
466
+ {
467
+ if (strtolower ($result->http_data) == 'ok')
468
+ {
469
+ return true;
470
+ }
471
+ }
472
+ }
473
+ }
474
+ return false;
475
+ }
476
+
477
+ /**
478
+ * Send a CURL request.
479
+ */
480
+ public function do_curl_request ($url, $options = array(), $timeout = 15)
481
+ {
482
+ // Store the result
483
+ $result = new stdClass ();
484
+
485
+ // Send request
486
+ $curl = curl_init ();
487
+ curl_setopt ($curl, CURLOPT_URL, $url);
488
+ curl_setopt ($curl, CURLOPT_HEADER, 0);
489
+ curl_setopt ($curl, CURLOPT_TIMEOUT, $timeout);
490
+ curl_setopt ($curl, CURLOPT_VERBOSE, 0);
491
+ curl_setopt ($curl, CURLOPT_RETURNTRANSFER, 1);
492
+ curl_setopt ($curl, CURLOPT_SSL_VERIFYPEER, 0);
493
+ curl_setopt ($curl, CURLOPT_SSL_VERIFYHOST, 0);
494
+ curl_setopt ($curl, CURLOPT_USERAGENT, 'SocialLogin Magento (+http://www.oneall.com/)');
495
+
496
+ // Basic AUTH?
497
+ if (isset ($options ['api_key']) and isset ($options ['api_secret']))
498
+ {
499
+ curl_setopt ($curl, CURLOPT_USERPWD, $options ['api_key'] . ":" . $options ['api_secret']);
500
+ }
501
+
502
+ // Make request
503
+ if (($http_data = curl_exec ($curl)) !== false)
504
+ {
505
+ $result->http_code = curl_getinfo ($curl, CURLINFO_HTTP_CODE);
506
+ $result->http_data = $http_data;
507
+ $result->http_error = null;
508
+ }
509
+ else
510
+ {
511
+ $result->http_code = - 1;
512
+ $result->http_data = null;
513
+ $result->http_error = curl_error ($curl);
514
+ }
515
+
516
+ // Done
517
+ return $result;
518
+ }
519
+ }
app/code/community/OneAll/SocialLogin/Model/Apiautodetect.php ADDED
@@ -0,0 +1,147 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @package OneAll Social Login
5
+ * @copyright Copyright 2014 http://www.oneall.com - All rights reserved.
6
+ * @license GNU/GPL 2 or later
7
+ *
8
+ * This program is free software; you can redistribute it and/or
9
+ * modify it under the terms of the GNU General Public License
10
+ * as published by the Free Software Foundation; either version 2
11
+ * of the License, or (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program; if not, write to the Free Software
20
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
21
+ *
22
+ * The "GNU General Public License" (GPL) is available at
23
+ * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
24
+ *
25
+ */
26
+ class OneAll_SocialLogin_Model_Apiautodetect
27
+ {
28
+ public function toOptionArray ()
29
+ {
30
+ $helper = Mage::helper ('oneall_sociallogin');
31
+ }
32
+ public function getCommentText ()
33
+ {
34
+ $base_url = Mage::getBaseUrl ();
35
+
36
+ return <<<HTML
37
+
38
+ <script language="javascript">
39
+
40
+ var button = document.getElementById("oneall_sociallogin_connection_autodetect");
41
+ button.value = "Autodetect API Connection";
42
+ button.onclick = function ()
43
+ {
44
+ autodetect_api_connection();
45
+ }
46
+
47
+ var autodetect_api_connection = function ()
48
+ {
49
+ var div = document.getElementById('oa_social_login_api_test_result');
50
+ div.innerHTML = 'Loading ...';
51
+ autodetect_ajax('{$base_url}social/ajax', autodetect_complete);
52
+ }
53
+
54
+ var autodetect_ajax = function (url, callback_function)
55
+ {
56
+ var request = new XMLHttpRequest();
57
+
58
+ request.open("GET", url, true);
59
+ request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
60
+ request.onreadystatechange = function()
61
+ {
62
+ if (request.readyState == 4 && request.status == 200)
63
+ {
64
+ if (request.responseText)
65
+ {
66
+ callback_function(request.responseText);
67
+ }
68
+ }
69
+ };
70
+ request.send();
71
+ }
72
+
73
+ var autodetect_complete = function (text)
74
+ {
75
+ var is_success,result_container, e, handler, port;
76
+
77
+ result_container = document.getElementById('oa_social_login_api_test_result');
78
+
79
+ handler = document.getElementById('oneall_sociallogin_connection_handler');
80
+ handler.value = '';
81
+
82
+ port = document.getElementById('oneall_sociallogin_connection_port');
83
+ port.value = '';
84
+
85
+ /* CURL detected, HTTPS */
86
+ if (text == 'success_autodetect_api_curl_https')
87
+ {
88
+ is_success = true;
89
+ result_container.innerHTML = '<b style="color:#3d6611">Detected CURL on Port 443 !</b>';
90
+ handler.value = 'curl';
91
+ port.value = '443';
92
+ }
93
+ /* CURL detected, HTTP */
94
+ else if (text == 'success_autodetect_api_curl_http')
95
+ {
96
+ is_success = true;
97
+ result_container.innerHTML = '<b style="color:#3d6611">Detected CURL on Port 80 !</b>';
98
+ handler.value = 'curl';
99
+ port.value = '80';
100
+ }
101
+ /* CURL detected, ports closed */
102
+ else if (text == 'error_autodetect_api_curl_ports_blocked')
103
+ {
104
+ is_success = false;
105
+ result_container.innerHTML = '<b style="color:red">Detected CURL but both ports are blocked!</b>';
106
+ handler.value = 'curl'
107
+ }
108
+ /* FSOCKOPEN detected, HTTPS */
109
+ else if (text == 'success_autodetect_api_fsockopen_https')
110
+ {
111
+ is_success = true;
112
+ result_container.innerHTML = '<b style="color:#3d6611">Detected FSOCKOPEN on Port 443!</b>';
113
+ handler.value = 'fsockopen';
114
+ port.value = '80';
115
+ }
116
+ /* FSOCKOPEN detected, HTTP */
117
+ else if (text == 'success_autodetect_api_fsockopen_http')
118
+ {
119
+ is_success = true;
120
+ result_container.innerHTML = '<b style="color:#3d6611">Detected FSOCKOPEN on Port 80!</b>';
121
+ handler.value = 'fsockopen';
122
+ port.value = '80';
123
+ }
124
+ /* FSOCKOPEN detected, ports closed */
125
+ else if (text == 'error_autodetect_api_fsockopen_ports_blocked')
126
+ {
127
+ is_success = false;
128
+ result_container.innerHTML = '<b style="color:red">Detected FSOCKOPEN but both ports are blocked!</b>';
129
+ handler.value = 'fsockopen';
130
+ }
131
+ /* No handler detected */
132
+ else
133
+ {
134
+ is_success = false;
135
+ result_container.innerHTML = '<b style="color:red">No connection handler detected!</b>';
136
+ }
137
+ }
138
+
139
+ </script>
140
+
141
+ <div id="oa_social_login_api_test_result"></div>
142
+ HTML;
143
+ }
144
+ }
145
+
146
+
147
+
app/code/community/OneAll/SocialLogin/Model/Apiconnectionhandler.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @package OneAll Social Login
5
+ * @copyright Copyright 2014 http://www.oneall.com - All rights reserved.
6
+ * @license GNU/GPL 2 or later
7
+ *
8
+ * This program is free software; you can redistribute it and/or
9
+ * modify it under the terms of the GNU General Public License
10
+ * as published by the Free Software Foundation; either version 2
11
+ * of the License, or (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program; if not, write to the Free Software
20
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
21
+ *
22
+ * The "GNU General Public License" (GPL) is available at
23
+ * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
24
+ *
25
+ */
26
+ class OneAll_SocialLogin_Model_Apiconnectionhandler
27
+ {
28
+ public function toOptionArray ()
29
+ {
30
+ $helper = Mage::helper ('oneall_sociallogin');
31
+
32
+ return array (
33
+ array (
34
+ 'value' => '',
35
+ 'label' => ''
36
+ ),
37
+ array (
38
+ 'value' => 'curl',
39
+ 'label' => $helper->__ ('Use PHP CURL to communicate with the API')
40
+ ),
41
+ array (
42
+ 'value' => 'fsockopen',
43
+ 'label' => $helper->__ ('Use PHP FSOCKOPEN to communicate with the API')
44
+ )
45
+ );
46
+ }
47
+ }
app/code/community/OneAll/SocialLogin/Model/Apiconnectionport.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @package OneAll Social Login
5
+ * @copyright Copyright 2014 http://www.oneall.com - All rights reserved.
6
+ * @license GNU/GPL 2 or later
7
+ *
8
+ * This program is free software; you can redistribute it and/or
9
+ * modify it under the terms of the GNU General Public License
10
+ * as published by the Free Software Foundation; either version 2
11
+ * of the License, or (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program; if not, write to the Free Software
20
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
21
+ *
22
+ * The "GNU General Public License" (GPL) is available at
23
+ * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
24
+ *
25
+ */
26
+ class OneAll_SocialLogin_Model_Apiconnectionport
27
+ {
28
+ public function toOptionArray ()
29
+ {
30
+ $helper = Mage::helper ('oneall_sociallogin');
31
+
32
+ return array (
33
+ array (
34
+ 'value' => '',
35
+ 'label' => ''
36
+ ),
37
+ array (
38
+ 'value' => 443,
39
+ 'label' => $helper->__ ('Communication via HTTPS on port 443')
40
+ ),
41
+ array (
42
+ 'value' => 80,
43
+ 'label' => $helper->__ ('Communication via HTTP on port 80')
44
+ )
45
+ );
46
+ }
47
+ }
app/code/community/OneAll/SocialLogin/Model/Apiverify.php ADDED
@@ -0,0 +1,130 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package OneAll Social Login
4
+ * @copyright Copyright 2014 http://www.oneall.com - All rights reserved.
5
+ * @license GNU/GPL 2 or later
6
+ *
7
+ * This program is free software; you can redistribute it and/or
8
+ * modify it under the terms of the GNU General Public License
9
+ * as published by the Free Software Foundation; either version 2
10
+ * of the License, or (at your option) any later version.
11
+ *
12
+ * This program is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ * GNU General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU General Public License
18
+ * along with this program; if not, write to the Free Software
19
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
20
+ *
21
+ * The "GNU General Public License" (GPL) is available at
22
+ * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
23
+ *
24
+ */
25
+
26
+ //Verifies the API Settings
27
+ class OneAll_SocialLogin_Model_Apiverify
28
+ {
29
+ public function toOptionArray ()
30
+ {
31
+ $helper = Mage::helper ('oneall_sociallogin');
32
+ }
33
+ public function getCommentText ()
34
+ {
35
+ $base_url = Mage::getBaseUrl ();
36
+
37
+ return <<<HTML
38
+
39
+ <script language="javascript">
40
+
41
+ var button = document.getElementById("oneall_sociallogin_general_verify");
42
+ button.value = "Verify API Settings ";
43
+ button.onclick = function ()
44
+ {
45
+ verify_api_settings();
46
+ }
47
+
48
+
49
+ var verify_ajax = function (url, callback_function)
50
+ {
51
+ var request = new XMLHttpRequest();
52
+
53
+ request.open("GET", url, true);
54
+ request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
55
+ request.onreadystatechange = function()
56
+ {
57
+ if (request.readyState == 4 && request.status == 200)
58
+ {
59
+ if (request.responseText)
60
+ {
61
+ callback_function(request.responseText);
62
+ }
63
+ }
64
+ };
65
+ request.send();
66
+ }
67
+
68
+
69
+ var verify_api_settings = function ()
70
+ {
71
+ var e, result_container, api_connection_handler, api_port, api_key, api_secret, api_connection_handler;
72
+
73
+ e = document.getElementById('oneall_sociallogin_connection_handler');
74
+ api_connection_handler = e.options[e.selectedIndex].value;
75
+
76
+ e = document.getElementById('oneall_sociallogin_connection_port');
77
+ api_connection_port = e.options[e.selectedIndex].value;
78
+
79
+ api_key = document.getElementById('oneall_sociallogin_general_key').value;
80
+ api_secret = document.getElementById('oneall_sociallogin_general_secret').value;
81
+ api_subdomain = document.getElementById('oneall_sociallogin_general_subdomain').value;
82
+
83
+ var result_container = document.getElementById('oa_social_login_api_verify_result');
84
+ result_container.innerHTML = 'Loading ...';
85
+ verify_ajax('{$base_url}social/ajax/verify?api_key=' + api_key + '&api_subdomain=' + api_subdomain + '&api_secret='+ api_secret +'&api_connection_handler='+ api_connection_handler +'&api_connection_port=' + api_connection_port, verify_complete);
86
+ }
87
+
88
+
89
+ var verify_complete = function (text)
90
+ {
91
+ var result_container;
92
+
93
+ result_container = document.getElementById('oa_social_login_api_verify_result');
94
+
95
+ if (text == 'error_selected_handler_faulty')
96
+ {
97
+ result_container.innerHTML = '<b style="color:red">The connection handler does not work!</b>';
98
+ }
99
+ else if (text == 'error_not_all_fields_filled_out')
100
+ {
101
+ result_container.innerHTML = '<b style="color:red">Please fill out each of the fields above.</b>';
102
+ }
103
+ else if (text == 'error_subdomain_wrong')
104
+ {
105
+ result_container.innerHTML = '<b style="color:red">The API subdomain does not seem to exist!</b>';
106
+ }
107
+ else if (text == 'error_subdomain_wrong_syntax')
108
+ {
109
+ result_container.innerHTML = '<b style="color:red">The API subdomain does not seem to exist!</b>';
110
+ }
111
+ else if (text == 'error_communication')
112
+ {
113
+ result_container.innerHTML = '<b style="color:red">Could not establish a communication with OneAll.';
114
+ }
115
+ else if (text == 'error_authentication_credentials_wrong')
116
+ {
117
+ result_container.innerHTML = '<b style="color:red">The API keys are invalid!</b>';
118
+ }
119
+ else
120
+ {
121
+ result_container.innerHTML = '<b style="color:#3d6611">The API settings are correct !</b>';
122
+ }
123
+ }
124
+
125
+ </script>
126
+
127
+ <div id="oa_social_login_api_verify_result"></div>
128
+ HTML;
129
+ }
130
+ }
app/code/community/OneAll/SocialLogin/Model/Entity.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @package OneAll Social Login
5
+ * @copyright Copyright 2014 http://www.oneall.com - All rights reserved.
6
+ * @license GNU/GPL 2 or later
7
+ *
8
+ * This program is free software; you can redistribute it and/or
9
+ * modify it under the terms of the GNU General Public License
10
+ * as published by the Free Software Foundation; either version 2
11
+ * of the License, or (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program; if not, write to the Free Software
20
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
21
+ *
22
+ * The "GNU General Public License" (GPL) is available at
23
+ * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
24
+ *
25
+ */
26
+ class OneAll_SocialLogin_Model_Entity extends Mage_Core_Model_Abstract
27
+ {
28
+ protected function _construct ()
29
+ {
30
+ $this->_init ("oneall_sociallogin/entity");
31
+ }
32
+ }
app/code/community/OneAll/SocialLogin/Model/Mysql4/Entity.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @package OneAll Social Login
5
+ * @copyright Copyright 2014 http://www.oneall.com - All rights reserved.
6
+ * @license GNU/GPL 2 or later
7
+ *
8
+ * This program is free software; you can redistribute it and/or
9
+ * modify it under the terms of the GNU General Public License
10
+ * as published by the Free Software Foundation; either version 2
11
+ * of the License, or (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program; if not, write to the Free Software
20
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
21
+ *
22
+ * The "GNU General Public License" (GPL) is available at
23
+ * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
24
+ *
25
+ */
26
+
27
+ // OneAll Social Login Table
28
+ class OneAll_SocialLogin_Model_Mysql4_Entity extends Mage_Core_Model_Mysql4_Abstract
29
+ {
30
+ protected function _construct ()
31
+ {
32
+ $this->_init ("oneall_sociallogin/entity", "entity_id");
33
+ }
34
+ }
app/code/community/OneAll/SocialLogin/Model/Mysql4/Entity/Collection.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @package OneAll Social Login
5
+ * @copyright Copyright 2014 http://www.oneall.com - All rights reserved.
6
+ * @license GNU/GPL 2 or later
7
+ *
8
+ * This program is free software; you can redistribute it and/or
9
+ * modify it under the terms of the GNU General Public License
10
+ * as published by the Free Software Foundation; either version 2
11
+ * of the License, or (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program; if not, write to the Free Software
20
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
21
+ *
22
+ * The "GNU General Public License" (GPL) is available at
23
+ * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
24
+ *
25
+ */
26
+
27
+ // OneAll Social Login Table
28
+ class OneAll_SocialLogin_Model_Mysql4_Entity_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
29
+ {
30
+ public function _construct ()
31
+ {
32
+ $this->_init ("oneall_sociallogin/entity");
33
+ }
34
+ }
app/code/community/OneAll/SocialLogin/Model/Services.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @package OneAll Social Login
5
+ * @copyright Copyright 2014 http://www.oneall.com - All rights reserved.
6
+ * @license GNU/GPL 2 or later
7
+ *
8
+ * This program is free software; you can redistribute it and/or
9
+ * modify it under the terms of the GNU General Public License
10
+ * as published by the Free Software Foundation; either version 2
11
+ * of the License, or (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program; if not, write to the Free Software
20
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
21
+ *
22
+ * The "GNU General Public License" (GPL) is available at
23
+ * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
24
+ *
25
+ */
26
+
27
+ // Social Networks
28
+ class OneAll_SocialLogin_Model_Services
29
+ {
30
+ public function toOptionArray ()
31
+ {
32
+ $helper = Mage::helper ("oneall_sociallogin");
33
+
34
+ return array (
35
+ array (
36
+ "value" => "setno",
37
+ "label" => ''
38
+ ),
39
+ array (
40
+ "value" => "setyes",
41
+ "label" => $helper->__ ("Enable")
42
+ )
43
+ );
44
+ }
45
+ }
app/code/community/OneAll/SocialLogin/controllers/AjaxController.php ADDED
@@ -0,0 +1,141 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @package OneAll Social Login
5
+ * @copyright Copyright 2014 http://www.oneall.com - All rights reserved.
6
+ * @license GNU/GPL 2 or later
7
+ *
8
+ * This program is free software; you can redistribute it and/or
9
+ * modify it under the terms of the GNU General Public License
10
+ * as published by the Free Software Foundation; either version 2
11
+ * of the License, or (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program; if not, write to the Free Software
20
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
21
+ *
22
+ * The "GNU General Public License" (GPL) is available at
23
+ * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
24
+ *
25
+ */
26
+ class OneAll_SocialLogin_AjaxController extends Mage_Core_Controller_Front_Action
27
+ {
28
+ // Autodetect API Handler
29
+ public function indexAction ()
30
+ {
31
+ // Check if CURL is available
32
+ if (Mage::helper ('oneall_sociallogin')->is_curl_available ())
33
+ {
34
+ // Check CURL HTTPS - Port 443
35
+ if (Mage::helper ('oneall_sociallogin')->is_api_connection_curl_ok (true) === true)
36
+ {
37
+ die ('success_autodetect_api_curl_https');
38
+ }
39
+ // Check CURL HTTP - Port 80
40
+ elseif (Mage::helper ('oneall_sociallogin')->is_api_connection_curl_ok (false) === true)
41
+ {
42
+ die ('success_autodetect_api_curl_http');
43
+ }
44
+ else
45
+ {
46
+ die ('error_autodetect_api_curl_ports_blocked');
47
+ }
48
+ }
49
+ // Check if FSOCKOPEN is available
50
+ elseif (Mage::helper ('oneall_sociallogin')->is_fsockopen_available ())
51
+ {
52
+ // Check FSOCKOPEN HTTPS - Port 443
53
+ if (Mage::helper ('oneall_sociallogin')->is_api_connection_fsockopen_ok (true) == true)
54
+ {
55
+ die ('success_autodetect_api_fsockopen_https');
56
+ }
57
+ // Check FSOCKOPEN HTTP - Port 80
58
+ elseif (Mage::helper ('oneall_sociallogin')->is_api_connection_fsockopen_ok (false) == true)
59
+ {
60
+ die ('success_autodetect_api_fsockopen_http');
61
+ }
62
+ else
63
+ {
64
+ die ('error_autodetect_api_fsockopen_ports_blocked');
65
+ }
66
+ }
67
+
68
+ // No working handler found
69
+ die ('error_autodetect_api_no_handler');
70
+ }
71
+
72
+ // Verify API Settings
73
+ public function verifyAction ()
74
+ {
75
+ // API Credentials
76
+ $api_subdomain = trim (Mage::app ()->getRequest ()->getParam ('api_subdomain'));
77
+ $api_key = trim (Mage::app ()->getRequest ()->getParam ('api_key'));
78
+ $api_secret = trim (Mage::app ()->getRequest ()->getParam ('api_secret'));
79
+
80
+ // API Handler
81
+ $api_connection_handler = (trim (Mage::app ()->getRequest ()->getParam ('api_connection_handler')) == 'fsockopen' ? 'fsockopen' : 'curl');
82
+ $api_connection_port = (trim (Mage::app ()->getRequest ()->getParam ('api_connection_port')) == '80' ? 80 : 443);
83
+
84
+ // Fields missing
85
+ if (empty ($api_subdomain) or empty ($api_key) or empty ($api_secret))
86
+ {
87
+ die ('error_not_all_fields_filled_out');
88
+ }
89
+
90
+ // Full domain entered
91
+ if (preg_match ("/([a-z0-9\-]+)\.api\.oneall\.com/i", $api_subdomain, $matches))
92
+ {
93
+ $api_subdomain = $matches [1];
94
+ }
95
+
96
+ // Check subdomain format
97
+ if (! preg_match ("/^[a-z0-9\-]+$/i", $api_subdomain))
98
+ {
99
+ die ('error_subdomain_wrong_syntax');
100
+ }
101
+
102
+ // Domain
103
+ $api_domain = $api_subdomain . '.api.oneall.com';
104
+
105
+ // Connection to
106
+ $api_resource_url = ($api_connection_port == 443 ? 'https' : 'http') . '://' . $api_domain . '/tools/ping.json';
107
+
108
+ // API Credentials
109
+ $api_credentials = array ();
110
+ $api_credentials ['api_key'] = $api_key;
111
+ $api_credentials ['api_secret'] = $api_secret;
112
+
113
+ // Get connection details
114
+ $result = Mage::helper ('oneall_sociallogin')->do_api_request ($api_connection_handler, $api_resource_url, $api_credentials);
115
+
116
+ // Parse result
117
+ if (is_object ($result) and property_exists ($result, 'http_code') and property_exists ($result, 'http_data'))
118
+ {
119
+ switch ($result->http_code)
120
+ {
121
+ // Success
122
+ case 200:
123
+ die ('success');
124
+
125
+ // Authentication Error
126
+ case 401:
127
+ die ('error_authentication_credentials_wrong');
128
+
129
+ // Wrong Subdomain
130
+ case 404:
131
+ die ('error_subdomain_wrong');
132
+
133
+ // Other error
134
+ default:
135
+ die ('error_communication');
136
+ }
137
+ }
138
+
139
+ die ('error_communication');
140
+ }
141
+ }
app/code/community/OneAll/SocialLogin/etc/adminhtml.xml ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <acl>
4
+ <resources>
5
+ <admin>
6
+ <children>
7
+ <system>
8
+ <children>
9
+ <config>
10
+ <children>
11
+ <oneall_sociallogin translate="title" module="oneall_sociallogin">
12
+ <title>OneAll Social Login</title>
13
+ </oneall_sociallogin>
14
+ </children>
15
+ </config>
16
+ </children>
17
+ </system>
18
+ </children>
19
+ </admin>
20
+ </resources>
21
+ </acl>
22
+ </config>
app/code/community/OneAll/SocialLogin/etc/config.xml ADDED
@@ -0,0 +1,114 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <OneAll_SocialLogin>
5
+ <version>1.0.0</version>
6
+ </OneAll_SocialLogin>
7
+ </modules>
8
+ <frontend>
9
+ <routers>
10
+ <oneallsociallogin>
11
+ <use>standard</use>
12
+ <args>
13
+ <module>OneAll_SocialLogin</module>
14
+ <frontName>social</frontName>
15
+ </args>
16
+ </oneallsociallogin>
17
+ </routers>
18
+ <layout>
19
+ <updates>
20
+ <oneall_sociallogin module="oneall_sociallogin">
21
+ <file>oneall-sociallogin.xml</file>
22
+ </oneall_sociallogin>
23
+ </updates>
24
+ </layout>
25
+ </frontend>
26
+ <global>
27
+ <blocks>
28
+ <oneall_sociallogin>
29
+ <class>OneAll_SocialLogin_Block</class>
30
+ </oneall_sociallogin>
31
+ </blocks>
32
+ <models>
33
+ <oneall_sociallogin>
34
+ <class>OneAll_SocialLogin_Model</class>
35
+ <resourceModel>oneall_sociallogin_mysql4</resourceModel>
36
+ </oneall_sociallogin>
37
+ <oneall_sociallogin_mysql4>
38
+ <class>OneAll_SocialLogin_Model_Mysql4</class>
39
+ <entities>
40
+ <entity>
41
+ <table>oneall_sociallogin_entity</table>
42
+ </entity>
43
+ </entities>
44
+ </oneall_sociallogin_mysql4>
45
+ </models>
46
+ <resources>
47
+ <oneall_sociallogin_setup>
48
+ <setup>
49
+ <module>OneAll_SocialLogin</module>
50
+ </setup>
51
+ <connection>
52
+ <use>core_setup</use>
53
+ </connection>
54
+ </oneall_sociallogin_setup>
55
+ <oneall_sociallogin_write>
56
+ <connection>
57
+ <use>core_write</use>
58
+ </connection>
59
+ </oneall_sociallogin_write>
60
+ <oneall_sociallogin_read>
61
+ <connection>
62
+ <use>core_read</use>
63
+ </connection>
64
+ </oneall_sociallogin_read>
65
+ </resources>
66
+ <helpers>
67
+ <oneall_sociallogin>
68
+ <class>OneAll_SocialLogin_Helper</class>
69
+ </oneall_sociallogin>
70
+ </helpers>
71
+ </global>
72
+ <default>
73
+ <oneall_sociallogin>
74
+ <connection>
75
+ <handler>curl</handler>
76
+ <port>443</port>
77
+ </connection>
78
+ <settings>
79
+ <textsignup>Sign up with a social network</textsignup>
80
+ <textsignin>Sign in with a social network</textsignin>
81
+ </settings>
82
+ <services>
83
+ <amazon>setno</amazon>
84
+ <blogger>setno</blogger>
85
+ <disqus>setno</disqus>
86
+ <facebook>setyes</facebook>
87
+ <foursquare>setno</foursquare>
88
+ <githubcom>setno</githubcom>
89
+ <google>setyes</google>
90
+ <instagram>setno</instagram>
91
+ <linkedin>setyes</linkedin>
92
+ <livejournal>setno</livejournal>
93
+ <mailru>setno</mailru>
94
+ <odnoklassniki>setno</odnoklassniki>
95
+ <openid>setno</openid>
96
+ <paypal>setno</paypal>
97
+ <reddit>setno</reddit>
98
+ <skyrockcom>setno</skyrockcom>
99
+ <stackexchange>setno</stackexchange>
100
+ <steam>setno</steam>
101
+ <twitch>setno</twitch>
102
+ <twitter>setyes</twitter>
103
+ <vimeo>setno</vimeo>
104
+ <vkontakte>setno</vkontakte>
105
+ <windowslive>setno</windowslive>
106
+ <wordpress>setno</wordpress>
107
+ <yahoo>setno</yahoo>
108
+ </services>
109
+ </oneall_sociallogin>
110
+ </default>
111
+ </config>
112
+
113
+
114
+
app/code/community/OneAll/SocialLogin/etc/system.xml ADDED
@@ -0,0 +1,398 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <config>
3
+ <tabs>
4
+ <oneall translate="label">
5
+ <label>OneAll</label>
6
+ <sort_order>200</sort_order>
7
+ </oneall>
8
+ </tabs>
9
+ <sections>
10
+ <oneall_sociallogin>
11
+ <label>OneAll Social Login</label>
12
+ <tab>oneall</tab>
13
+ <frontend_type>text</frontend_type>
14
+ <sort_order>250</sort_order>
15
+ <show_in_default>1</show_in_default>
16
+ <show_in_website>1</show_in_website>
17
+ <show_in_store>1</show_in_store>
18
+ <groups>
19
+
20
+ <connection translate="label">
21
+ <label>API Connection Handler</label>
22
+ <frontend_type>Radios</frontend_type>
23
+ <frontend_model>oneall_sociallogin/adminhtml_system_config_fieldset_general</frontend_model>
24
+ <sort_order>1</sort_order>
25
+ <show_in_default>1</show_in_default>
26
+ <show_in_website>1</show_in_website>
27
+ <show_in_store>1</show_in_store>
28
+ <expanded>1</expanded>
29
+ <fields>
30
+ <handler>
31
+ <label>Connection Handler</label>
32
+ <frontend_type>select</frontend_type>
33
+ <source_model>oneall_sociallogin/apiconnectionhandler</source_model>
34
+ <sort_order>88</sort_order>
35
+ <show_in_default>1</show_in_default>
36
+ <show_in_website>1</show_in_website>
37
+ <show_in_store>1</show_in_store>
38
+ </handler>
39
+ <port>
40
+ <label>Connection Port</label>
41
+ <frontend_type>select</frontend_type>
42
+ <source_model>oneall_sociallogin/apiconnectionport</source_model>
43
+ <sort_order>89</sort_order>
44
+ <show_in_default>1</show_in_default>
45
+ <show_in_website>1</show_in_website>
46
+ <show_in_store>1</show_in_store>
47
+ </port>
48
+ <autodetect>
49
+ <frontend_type>Button</frontend_type>
50
+ <comment>
51
+ <model>oneall_sociallogin/apiautodetect</model>
52
+ </comment>
53
+ <source_model>oneall_sociallogin/apiautodetect</source_model>
54
+ <sort_order>90</sort_order>
55
+ <show_in_default>1</show_in_default>
56
+ <show_in_website>1</show_in_website>
57
+ <show_in_store>1</show_in_store>
58
+ </autodetect>
59
+ </fields>
60
+ </connection>
61
+
62
+ <general translate="label">
63
+ <label>API Settings</label>
64
+ <frontend_type>text</frontend_type>
65
+ <frontend_model>oneall_sociallogin/adminhtml_system_config_fieldset_general
66
+ </frontend_model>
67
+ <sort_order>2</sort_order>
68
+ <show_in_default>1</show_in_default>
69
+ <show_in_website>1</show_in_website>
70
+ <show_in_store>1</show_in_store>
71
+ <expanded>1</expanded>
72
+ <fields>
73
+ <subdomain>
74
+ <label>API Subdomain</label>
75
+ <frontend_type>text</frontend_type>
76
+ <sort_order>1</sort_order>
77
+ <show_in_default>1</show_in_default>
78
+ <show_in_website>1</show_in_website>
79
+ <show_in_store>1</show_in_store>
80
+ </subdomain>
81
+ <key>
82
+ <label>API Public Key</label>
83
+ <frontend_type>text</frontend_type>
84
+ <sort_order>2</sort_order>
85
+ <show_in_default>1</show_in_default>
86
+ <show_in_website>1</show_in_website>
87
+ <show_in_store>1</show_in_store>
88
+ </key>
89
+ <secret>
90
+ <label>API Private Key</label>
91
+ <frontend_type>text</frontend_type>
92
+ <sort_order>3</sort_order>
93
+ <show_in_default>1</show_in_default>
94
+ <show_in_website>1</show_in_website>
95
+ <show_in_store>1</show_in_store>
96
+ </secret>
97
+ <verify>
98
+ <label></label>
99
+ <frontend_type>Button</frontend_type>
100
+ <comment>
101
+ <model>oneall_sociallogin/apiverify</model>
102
+ </comment>
103
+ <source_model>oneall_sociallogin/apiverify</source_model>
104
+ <sort_order>90</sort_order>
105
+ <show_in_default>1</show_in_default>
106
+ <show_in_website>1</show_in_website>
107
+ <show_in_store>1</show_in_store>
108
+ </verify>
109
+ </fields>
110
+ </general>
111
+
112
+ <services translate="label">
113
+ <label>Enable the Social Networks to use</label>
114
+ <frontend_type>text</frontend_type>
115
+ <frontend_model>oneall_sociallogin/adminhtml_system_config_fieldset_general</frontend_model>
116
+ <sort_order>3</sort_order>
117
+ <show_in_default>1</show_in_default>
118
+ <show_in_website>1</show_in_website>
119
+ <show_in_store>1</show_in_store>
120
+ <expanded>1</expanded>
121
+ <fields>
122
+ <amazon>
123
+ <label>Amazon</label>
124
+ <frontend_type>Select</frontend_type>
125
+ <source_model>oneall_sociallogin/services</source_model>
126
+ <sort_order>62</sort_order>
127
+ <show_in_default>1</show_in_default>
128
+ <show_in_website>1</show_in_website>
129
+ <show_in_store>1</show_in_store>
130
+ </amazon>
131
+ <blogger>
132
+ <label>Blogger</label>
133
+ <frontend_type>Select</frontend_type>
134
+ <source_model>oneall_sociallogin/services</source_model>
135
+ <sort_order>63</sort_order>
136
+ <show_in_default>1</show_in_default>
137
+ <show_in_website>1</show_in_website>
138
+ <show_in_store>1</show_in_store>
139
+ </blogger>
140
+ <disqus>
141
+ <label>Disqus</label>
142
+ <frontend_type>Select</frontend_type>
143
+ <source_model>oneall_sociallogin/services</source_model>
144
+ <sort_order>64</sort_order>
145
+ <show_in_default>1</show_in_default>
146
+ <show_in_website>1</show_in_website>
147
+ <show_in_store>1</show_in_store>
148
+ </disqus>
149
+ <facebook>
150
+ <label>Facebook</label>
151
+ <frontend_type>Select</frontend_type>
152
+ <source_model>oneall_sociallogin/services</source_model>
153
+ <sort_order>65</sort_order>
154
+ <show_in_default>1</show_in_default>
155
+ <show_in_website>1</show_in_website>
156
+ <show_in_store>1</show_in_store>
157
+ </facebook>
158
+ <foursquare>
159
+ <label>Foursquare</label>
160
+ <frontend_type>Select</frontend_type>
161
+ <source_model>oneall_sociallogin/services</source_model>
162
+ <sort_order>66</sort_order>
163
+ <show_in_default>1</show_in_default>
164
+ <show_in_website>1</show_in_website>
165
+ <show_in_store>1</show_in_store>
166
+ </foursquare>
167
+ <githubcom>
168
+ <label>Github.com</label>
169
+ <frontend_type>Select</frontend_type>
170
+ <source_model>oneall_sociallogin/services</source_model>
171
+ <sort_order>67</sort_order>
172
+ <show_in_default>1</show_in_default>
173
+ <show_in_website>1</show_in_website>
174
+ <show_in_store>1</show_in_store>
175
+ </githubcom>
176
+ <google>
177
+ <label>Google</label>
178
+ <frontend_type>Select</frontend_type>
179
+ <source_model>oneall_sociallogin/services</source_model>
180
+ <sort_order>68</sort_order>
181
+ <show_in_default>1</show_in_default>
182
+ <show_in_website>1</show_in_website>
183
+ <show_in_store>1</show_in_store>
184
+ </google>
185
+ <instagram>
186
+ <label>Instagram</label>
187
+ <frontend_type>Select</frontend_type>
188
+ <source_model>oneall_sociallogin/services</source_model>
189
+ <sort_order>69</sort_order>
190
+ <show_in_default>1</show_in_default>
191
+ <show_in_website>1</show_in_website>
192
+ <show_in_store>1</show_in_store>
193
+ </instagram>
194
+ <linkedin>
195
+ <label>Linkedin</label>
196
+ <frontend_type>Select</frontend_type>
197
+ <source_model>oneall_sociallogin/services</source_model>
198
+ <sort_order>70</sort_order>
199
+ <show_in_default>1</show_in_default>
200
+ <show_in_website>1</show_in_website>
201
+ <show_in_store>1</show_in_store>
202
+ </linkedin>
203
+ <livejournal>
204
+ <label>Live journal</label>
205
+ <frontend_type>Select</frontend_type>
206
+ <source_model>oneall_sociallogin/services</source_model>
207
+ <sort_order>71</sort_order>
208
+ <show_in_default>1</show_in_default>
209
+ <show_in_website>1</show_in_website>
210
+ <show_in_store>1</show_in_store>
211
+ </livejournal>
212
+ <mailru>
213
+ <label>Mail.ru</label>
214
+ <frontend_type>Select</frontend_type>
215
+ <source_model>oneall_sociallogin/services</source_model>
216
+ <sort_order>72</sort_order>
217
+ <show_in_default>1</show_in_default>
218
+ <show_in_website>1</show_in_website>
219
+ <show_in_store>1</show_in_store>
220
+ </mailru>
221
+ <odnoklassniki>
222
+ <label>Odnoklassniki</label>
223
+ <frontend_type>Select</frontend_type>
224
+ <source_model>oneall_sociallogin/services</source_model>
225
+ <sort_order>73</sort_order>
226
+ <show_in_default>1</show_in_default>
227
+ <show_in_website>1</show_in_website>
228
+ <show_in_store>1</show_in_store>
229
+ </odnoklassniki>
230
+ <openid>
231
+ <label>Openid</label>
232
+ <frontend_type>Select</frontend_type>
233
+ <source_model>oneall_sociallogin/services</source_model>
234
+ <sort_order>74</sort_order>
235
+ <show_in_default>1</show_in_default>
236
+ <show_in_website>1</show_in_website>
237
+ <show_in_store>1</show_in_store>
238
+ </openid>
239
+ <paypal>
240
+ <label>Paypal</label>
241
+ <frontend_type>Select</frontend_type>
242
+ <source_model>oneall_sociallogin/services</source_model>
243
+ <sort_order>75</sort_order>
244
+ <show_in_default>1</show_in_default>
245
+ <show_in_website>1</show_in_website>
246
+ <show_in_store>1</show_in_store>
247
+ </paypal>
248
+ <reddit>
249
+ <label>Reddit</label>
250
+ <frontend_type>Select</frontend_type>
251
+ <source_model>oneall_sociallogin/services</source_model>
252
+ <sort_order>76</sort_order>
253
+ <show_in_default>1</show_in_default>
254
+ <show_in_website>1</show_in_website>
255
+ <show_in_store>1</show_in_store>
256
+ </reddit>
257
+ <skyrockcom>
258
+ <label>Skyrock.com</label>
259
+ <frontend_type>Select</frontend_type>
260
+ <source_model>oneall_sociallogin/services</source_model>
261
+ <sort_order>77</sort_order>
262
+ <show_in_default>1</show_in_default>
263
+ <show_in_website>1</show_in_website>
264
+ <show_in_store>1</show_in_store>
265
+ </skyrockcom>
266
+ <stackexchange>
267
+ <label>Stackexchange</label>
268
+ <frontend_type>Select</frontend_type>
269
+ <source_model>oneall_sociallogin/services</source_model>
270
+ <sort_order>78</sort_order>
271
+ <show_in_default>1</show_in_default>
272
+ <show_in_website>1</show_in_website>
273
+ <show_in_store>1</show_in_store>
274
+ </stackexchange>
275
+ <steam>
276
+ <label>Steam</label>
277
+ <frontend_type>Select</frontend_type>
278
+ <source_model>oneall_sociallogin/services</source_model>
279
+ <sort_order>79</sort_order>
280
+ <show_in_default>1</show_in_default>
281
+ <show_in_website>1</show_in_website>
282
+ <show_in_store>1</show_in_store>
283
+ </steam>
284
+ <twitch>
285
+ <label>Twitch.tv</label>
286
+ <frontend_type>Select</frontend_type>
287
+ <source_model>oneall_sociallogin/services</source_model>
288
+ <sort_order>80</sort_order>
289
+ <show_in_default>1</show_in_default>
290
+ <show_in_website>1</show_in_website>
291
+ <show_in_store>1</show_in_store>
292
+ </twitch>
293
+ <twitter>
294
+ <label>Twitter</label>
295
+ <frontend_type>Select</frontend_type>
296
+ <source_model>oneall_sociallogin/services</source_model>
297
+ <sort_order>81</sort_order>
298
+ <show_in_default>1</show_in_default>
299
+ <show_in_website>1</show_in_website>
300
+ <show_in_store>1</show_in_store>
301
+ </twitter>
302
+ <vimeo>
303
+ <label>Vimeo</label>
304
+ <frontend_type>Select</frontend_type>
305
+ <source_model>oneall_sociallogin/services</source_model>
306
+ <sort_order>82</sort_order>
307
+ <show_in_default>1</show_in_default>
308
+ <show_in_website>1</show_in_website>
309
+ <show_in_store>1</show_in_store>
310
+ </vimeo>
311
+ <vkontakte>
312
+ <label>Vkontakte</label>
313
+ <frontend_type>Select</frontend_type>
314
+ <source_model>oneall_sociallogin/services</source_model>
315
+ <sort_order>83</sort_order>
316
+ <show_in_default>1</show_in_default>
317
+ <show_in_website>1</show_in_website>
318
+ <show_in_store>1</show_in_store>
319
+ </vkontakte>
320
+ <windowslive>
321
+ <label>Windows live</label>
322
+ <frontend_type>Select</frontend_type>
323
+ <source_model>oneall_sociallogin/services</source_model>
324
+ <sort_order>84</sort_order>
325
+ <show_in_default>1</show_in_default>
326
+ <show_in_website>1</show_in_website>
327
+ <show_in_store>1</show_in_store>
328
+ </windowslive>
329
+ <wordpress>
330
+ <label>Wordpress</label>
331
+ <frontend_type>Select</frontend_type>
332
+ <source_model>oneall_sociallogin/services</source_model>
333
+ <sort_order>85</sort_order>
334
+ <show_in_default>1</show_in_default>
335
+ <show_in_website>1</show_in_website>
336
+ <show_in_store>1</show_in_store>
337
+ </wordpress>
338
+ <yahoo>
339
+ <label>Yahoo</label>
340
+ <frontend_type>Select</frontend_type>
341
+ <source_model>oneall_sociallogin/services</source_model>
342
+ <sort_order>86</sort_order>
343
+ <show_in_default>1</show_in_default>
344
+ <show_in_website>1</show_in_website>
345
+ <show_in_store>1</show_in_store>
346
+ </yahoo>
347
+ <youtube>
348
+ <label>Youtube</label>
349
+ <frontend_type>Select</frontend_type>
350
+ <source_model>oneall_sociallogin/services</source_model>
351
+ <sort_order>87</sort_order>
352
+ <show_in_default>1</show_in_default>
353
+ <show_in_website>1</show_in_website>
354
+ <show_in_store>1</show_in_store>
355
+ </youtube>
356
+ </fields>
357
+ </services>
358
+
359
+ <settings translate="label">
360
+ <label>Settings</label>
361
+ <frontend_type>text</frontend_type>
362
+ <frontend_model>oneall_sociallogin/adminhtml_system_config_fieldset_general
363
+ </frontend_model>
364
+ <sort_order>4</sort_order>
365
+ <show_in_default>1</show_in_default>
366
+ <show_in_website>1</show_in_website>
367
+ <show_in_store>1</show_in_store>
368
+ <expanded>1</expanded>
369
+ <fields>
370
+ <textsignup>
371
+ <label>Registration Title</label>
372
+ <comment>Displayed when registering with a Social Network
373
+ </comment>
374
+ <frontend_type>text</frontend_type>
375
+ <sort_order>1</sort_order>
376
+ <show_in_default>1</show_in_default>
377
+ <show_in_website>1</show_in_website>
378
+ <show_in_store>1</show_in_store>
379
+ </textsignup>
380
+ <textsignin>
381
+ <label>Login Title</label>
382
+ <comment>Displayed when logging in with a Social Network
383
+ </comment>
384
+ <frontend_type>text</frontend_type>
385
+ <sort_order>2</sort_order>
386
+ <show_in_default>1</show_in_default>
387
+ <show_in_website>1</show_in_website>
388
+ <show_in_store>1</show_in_store>
389
+ </textsignin>
390
+ </fields>
391
+ </settings>
392
+
393
+
394
+ </groups>
395
+ </oneall_sociallogin>
396
+ </sections>
397
+ </config>
398
+
app/code/community/OneAll/SocialLogin/sql/oneall_sociallogin_setup/mysql4-install-1.0.0.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package OneAll Social Login
4
+ * @copyright Copyright 2014 http://www.oneall.com - All rights reserved.
5
+ * @license GNU/GPL 2 or later
6
+ *
7
+ * This program is free software; you can redistribute it and/or
8
+ * modify it under the terms of the GNU General Public License
9
+ * as published by the Free Software Foundation; either version 2
10
+ * of the License, or (at your option) any later version.
11
+ *
12
+ * This program is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ * GNU General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU General Public License
18
+ * along with this program; if not, write to the Free Software
19
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
20
+ *
21
+ * The "GNU General Public License" (GPL) is available at
22
+ * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
23
+ *
24
+ */
25
+
26
+
27
+ $installer = $this;
28
+ $installer->startSetup ();
29
+
30
+ // Table structure
31
+ $sql = "CREATE TABLE `".$this->getTable('oneall_sociallogin_entity')."`(
32
+ `entity_id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
33
+ `customer_id` int(11) UNSIGNED NOT NULL,
34
+ `user_token` char(36) NOT NULL,
35
+ `identity_token` char(36) NOT NULL,
36
+ PRIMARY KEY (`entity_id`)
37
+ ) ENGINE=InnoDB AUTO_INCREMENT=1;";
38
+
39
+ // Create table
40
+ $installer->run ($sql);
41
+
42
+ $installer->endSetup ();
43
+
44
+ ?>
app/design/frontend/base/default/layout/oneall-sociallogin.xml ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+
4
+ <customer_logged_out>
5
+ <reference name="head">
6
+ <block type="core/template" name="oneall.sociallogin.library" template="oneall/sociallogin/library.phtml" />
7
+ </reference>
8
+ <reference name="head">
9
+ <action method="addItem">
10
+ <type>skin_css</type>
11
+ <name>css/oneall/sociallogin.css</name>
12
+ </action>
13
+ </reference>
14
+ </customer_logged_out>
15
+
16
+ <checkout_onepage_index>
17
+ <reference name="checkout.onepage.login.before">
18
+ <block type="oneall_sociallogin/login" name="oneall.sociallogin.login.checkout">
19
+ <action method="setPlace">
20
+ <place>checkout</place>
21
+ </action>
22
+ </block>
23
+ </reference>
24
+ </checkout_onepage_index>
25
+
26
+ <customer_account_login>
27
+ <reference name="content">
28
+ <block before="customer_form_login" type="oneall_sociallogin/login" name="oneall.sociallogin.login.login">
29
+ <action method="setPlace">
30
+ <place>login</place>
31
+ </action>
32
+ </block>
33
+ </reference>
34
+ </customer_account_login>
35
+
36
+ <customer_account_create>
37
+ <reference name="content">
38
+ <block before="customer_form_register" type="oneall_sociallogin/login" name="oneall.sociallogin.login.login">
39
+ <action method="setPlace">
40
+ <place>login</place>
41
+ </action>
42
+ </block>
43
+ </reference>
44
+ </customer_account_create>
45
+ </layout>
app/design/frontend/base/default/template/oneall/sociallogin/library.phtml ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package OneAll Social Login
4
+ * @copyright Copyright 2014 http://www.oneall.com - All rights reserved.
5
+ * @license GNU/GPL 2 or later
6
+ *
7
+ * This program is free software; you can redistribute it and/or
8
+ * modify it under the terms of the GNU General Public License
9
+ * as published by the Free Software Foundation; either version 2
10
+ * of the License, or (at your option) any later version.
11
+ *
12
+ * This program is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ * GNU General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU General Public License
18
+ * along with this program; if not, write to the Free Software
19
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
20
+ *
21
+ * The "GNU General Public License" (GPL) is available at
22
+ * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
23
+ *
24
+ */
25
+
26
+ // Include Library
27
+ // http://docs.oneall.com/api/javascript/library/setup/
28
+ $oneall_sociallogin_subdomain = Mage::getStoreConfig ('oneall_sociallogin/general/subdomain');
29
+ if (! empty ($oneall_sociallogin_subdomain))
30
+ {
31
+ ?>
32
+ <!-- OneAll.com / Social Login for Magento -->
33
+ <script type="text/javascript">
34
+ var oa = document.createElement('script');
35
+ oa.type = 'text/javascript'; oa.async = true;
36
+ oa.src = '//<?php echo $oneall_sociallogin_subdomain; ?>.api.oneall.com/socialize/library.js'
37
+ var s = document.getElementsByTagName('script')[0];
38
+ s.parentNode.insertBefore(oa, s);
39
+ </script>
40
+ <?php
41
+ }
42
+ ?>
43
+
44
+
45
+ <?php
46
+ if (isset ($_GET ['oneall']))
47
+ {
48
+ $pageaction = Mage::app ()->getFrontController ()->getAction ()->getFullActionName ();
49
+
50
+ if ($_GET ['oneall'] == 'login')
51
+ {
52
+ // is user is come from checkout...
53
+ if ($pageaction == 'checkout_onepage_index')
54
+ {
55
+
56
+ $link = Mage::getUrl ('checkout/onepage');
57
+ echo '<meta http-equiv="refresh" content="0; url=' . $link . ' " />';
58
+ exit ();
59
+ }
60
+
61
+ $link = Mage::getUrl ('customer/account');
62
+ echo '<meta http-equiv="refresh" content="0; url=' . $link . ' " />';
63
+ exit ();
64
+ }
65
+ }
66
+ ?>
app/design/frontend/base/default/template/oneall/sociallogin/login.phtml ADDED
@@ -0,0 +1,137 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package OneAll Social Login
4
+ * @copyright Copyright 2014 http://www.oneall.com - All rights reserved.
5
+ * @license GNU/GPL 2 or later
6
+ *
7
+ * This program is free software; you can redistribute it and/or
8
+ * modify it under the terms of the GNU General Public License
9
+ * as published by the Free Software Foundation; either version 2
10
+ * of the License, or (at your option) any later version.
11
+ *
12
+ * This program is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ * GNU General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU General Public License
18
+ * along with this program; if not, write to the Free Software
19
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
20
+ *
21
+ * The "GNU General Public License" (GPL) is available at
22
+ * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
23
+ *
24
+ */
25
+
26
+ // Read available providers
27
+ $providers_config = (array) Mage::getStoreConfig ('oneall_sociallogin/services');
28
+
29
+ // Enabled providers
30
+ $providers_enabled = array ();
31
+
32
+ // Build Social Network List
33
+ foreach ($providers_config as $provider => $is_enabled)
34
+ {
35
+ // Enabled?
36
+ if ($is_enabled == 'setyes')
37
+ {
38
+ $providers_enabled [] = $provider;
39
+ }
40
+ }
41
+
42
+ //At least one providers needs to be enabled
43
+ if (count ($providers_enabled) > 0)
44
+ {
45
+ // Transform to JSON
46
+ $providers = "'" . implode ("','", $providers_enabled) . "'";
47
+
48
+ //What are we doing?
49
+ switch (Mage::app ()->getFrontController ()->getAction ()->getFullActionName ())
50
+ {
51
+ // We are on the login oage
52
+ case 'customer_account_login':
53
+ ?>
54
+ <div class="oneall_social_login loginpage siginf">
55
+ <?php
56
+ //Random integer to prevent id collisions
57
+ $rand = rand ();
58
+
59
+ //Caption
60
+ $caption = trim (Mage::getStoreConfig ('oneall_sociallogin/settings/textsignin'));
61
+ if ( ! empty ($caption))
62
+ {
63
+ echo '<h4 class="tlog logup">' . $caption . '</h4>';
64
+ }
65
+ ?>
66
+ <div class="oneall_social_login_providers" id="oneall_social_login_providers_<?php echo $rand; ?>"></div>
67
+ <script type="text/javascript">
68
+ var _oneall = _oneall || [];
69
+ _oneall.push(['social_login', 'set_providers', [<?php echo $providers; ?>]]);
70
+ _oneall.push(['social_login', 'set_callback_uri', (window.location.href + ((window.location.href.split('?')[1] ? '&amp;' : '?') + 'oneall=login'))]);
71
+ _oneall.push(['social_login', 'set_custom_css_uri', (("https:" == document.location.protocol) ? "https://secure" : "http://public") + '.oneallcdn.com/css/api/socialize/themes/magento/default.css']);
72
+ _oneall.push(['social_login', 'do_render_ui', 'oneall_social_login_providers_<?php echo $rand; ?>']);
73
+ </script>
74
+ </div>
75
+
76
+ <div class="oneall_social_login loginpage registerloginform">
77
+ <?php
78
+ //Random integer to prevent id collisions
79
+ $rand = rand ();
80
+
81
+ //Caption
82
+ $caption = trim (Mage::getStoreConfig ('oneall_sociallogin/settings/textsignup'));
83
+ if ( ! empty ($caption))
84
+ {
85
+ echo '<h4 class="tlog logup">' . $caption . '</h4>';
86
+ }
87
+ ?>
88
+ <div class="oneall_social_login_providers" id="oneall_social_login_providers_<?php echo $rand; ?>"></div>
89
+ <script type="text/javascript">
90
+ var _oneall = _oneall || [];
91
+ _oneall.push(['social_login', 'set_providers', [<?php echo $providers; ?>]]);
92
+ _oneall.push(['social_login', 'set_callback_uri', (window.location.href + ((window.location.href.split('?')[1] ? '&amp;' : '?') + 'oneall=login'))]);
93
+ _oneall.push(['social_login', 'set_custom_css_uri', (("https:" == document.location.protocol) ? "https://secure" : "http://public") + '.oneallcdn.com/css/api/socialize/themes/magento/default.css']);
94
+ _oneall.push(['social_login', 'do_render_ui', 'oneall_social_login_providers_<?php echo $rand; ?>']);
95
+ </script>
96
+ </div>
97
+ <div class="clr"></div>
98
+ <?php
99
+ break;
100
+
101
+ //On any other page
102
+ default:
103
+ ?>
104
+ <div class="oneall_social_login placeregister">
105
+ <?php
106
+
107
+ //Random integer to prevent id collisions
108
+ $rand = rand ();
109
+
110
+ //Caption
111
+ $caption = trim (Mage::getStoreConfig ('oneall_sociallogin/settings/textsignup'));
112
+ if ( ! empty ($caption))
113
+ {
114
+ echo '<h4 class="tlog logup">' . $caption . '</h4>';
115
+ }
116
+ ?>
117
+ <div class="oneall_social_login_providers" id="oneall_social_login_providers_<?php echo $rand; ?>"></div>
118
+ <script type="text/javascript">
119
+ var _oneall = _oneall || [];
120
+ _oneall.push(['social_login', 'set_providers', [<?php echo $providers; ?>]]);
121
+ _oneall.push(['social_login', 'set_callback_uri', (window.location.href + ((window.location.href.split('?')[1] ? '&amp;' : '?') + 'oneall=login'))]);
122
+ _oneall.push(['social_login', 'set_custom_css_uri', (("https:" == document.location.protocol) ? "https://secure" : "http://public") + '.oneallcdn.com/css/api/socialize/themes/magento/default.css']);
123
+ _oneall.push(['social_login', 'do_render_ui', 'oneall_social_login_providers_<?php echo $rand; ?>']);
124
+ </script>
125
+ </div>
126
+ <div class="clr"></div>
127
+ <?php
128
+ break;
129
+ }
130
+ }
131
+ //N orpoviders enabled
132
+ else
133
+ {
134
+ ?>
135
+ <div class="oneall_social_login_error">Please enable at least one social network in <strong>System \ Configuration \ OneAll Social Login</strong></div>
136
+ <?php
137
+ }
app/etc/modules/OneAll_SocialLogin.xml ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * @package OneAll Social Login
5
+ * @copyright Copyright 2014 http://www.oneall.com - All rights reserved.
6
+ * @license GNU/GPL 2 or later
7
+ *
8
+ * This program is free software; you can redistribute it and/or
9
+ * modify it under the terms of the GNU General Public License
10
+ * as published by the Free Software Foundation; either version 2
11
+ * of the License, or (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program; if not, write to the Free Software
20
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
21
+ *
22
+ * The "GNU General Public License" (GPL) is available at
23
+ * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
24
+ *
25
+ */
26
+ -->
27
+ <config>
28
+ <modules>
29
+ <OneAll_SocialLogin>
30
+ <active>true</active>
31
+ <codePool>community</codePool>
32
+ <version>1.0.0</version>
33
+ </OneAll_SocialLogin>
34
+ </modules>
35
+ </config>
package.xml ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>oneall_sociallogin</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license>GNU/GPL 2 or later</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Social Login allows your customers to login and register with 25+ Social Networks.</summary>
10
+ <description>Social Login for Magento is a professional extension that allows your visitors to login and register with social networks like for example Twitter, Facebook, LinkedIn and PayPal.&#xD;
11
+ &#xD;
12
+ It increases your user conversion rate by simplifying the registration process and provides permission-based social data retrieved from the social network profiles. </description>
13
+ <notes>* First version</notes>
14
+ <authors><author><name>OneAll LLC</name><user>OneAll</user><email>support@oneall.com</email></author></authors>
15
+ <date>2014-11-18</date>
16
+ <time>15:16:35</time>
17
+ <contents><target name="magecommunity"><dir name="OneAll"><dir name="SocialLogin"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Fieldset"><file name="General.php" hash="20fbab117eae81cbad109c3b555e99d9"/></dir></dir></dir></dir><file name="Login.php" hash="e9e05075cf0135ba84124658e3900f8c"/></dir><dir name="Helper"><file name="Data.php" hash="cba896131f336dc8495da079a94155fa"/></dir><dir name="Model"><file name="Apiautodetect.php" hash="6ab0deb4f99b1a205126b52bccb01206"/><file name="Apiconnectionhandler.php" hash="83c9bb3729bd94f11ed0593f401cf97b"/><file name="Apiconnectionport.php" hash="7f904e1eca2e618e6f95c24b7e71b093"/><file name="Apiverify.php" hash="8aa2a12318d8c251138fa3e49ab49651"/><file name="Entity.php" hash="a40f9d2c93e16413066987ca1edd8712"/><dir name="Mysql4"><dir name="Entity"><file name="Collection.php" hash="420f9e47f1a2429f9627e93b338b816d"/></dir><file name="Entity.php" hash="b2abd06f18048fe564c2b17cf30aed49"/></dir><file name="Services.php" hash="d4bce23856958465c7fd62fa5a1efcba"/></dir><dir name="controllers"><file name="AjaxController.php" hash="fc561a0262bdeb73de4c535b4030ffda"/></dir><dir name="etc"><file name="adminhtml.xml" hash="b2b2205da48b85a4002c84464a3c7555"/><file name="config.xml" hash="8710b088d3e1f385c3febf353dabae83"/><file name="system.xml" hash="5f3d8593086bfb07b571e6e8e979f842"/></dir><dir name="sql"><dir name="oneall_sociallogin_setup"><file name="mysql4-install-1.0.0.php" hash="e51670ff053f5391e6626ac9dd22769b"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="oneall-sociallogin.xml" hash="459f3b6807ec3e94dd1dfa97e0fe6135"/></dir><dir name="template"><dir name="oneall"><dir name="sociallogin"><file name="library.phtml" hash="81d9683ae5e0d67c4fba204e770fa25d"/><file name="login.phtml" hash="7e86303baa498c7840a7da61d2fdbdf0"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="OneAll_SocialLogin.xml" hash="9054f02d5ed387bb8cb8602aedea3fee"/></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><dir name="oneall"><file name="sociallogin.css" hash="b9ff1f97c2aa7d4cc1c188975f08e5bf"/></dir></dir></dir></dir></dir></target></contents>
18
+ <compatible/>
19
+ <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php><extension><name>curl</name><min></min><max></max></extension></required></dependencies>
20
+ </package>
skin/frontend/base/default/css/oneall/sociallogin.css ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ div.oneall_social_login {
2
+ padding-top: 10px;
3
+ }
4
+
5
+ .oneall_social_login_error {
6
+ margin-bottom: 20px;
7
+ background-color: #efdfdf;
8
+ color: #B80C14;
9
+ padding: 10px;
10
+ line-height: 16px;
11
+ font-size: 12px;
12
+ border: 1px dashed #B80C14;
13
+ }
14
+
15
+ .customer-account-login .page-title {
16
+ position: absolute;
17
+ max-width: 1260px;
18
+ width: 1200px;
19
+ margin-top: -165px;
20
+ }
21
+
22
+ .loginpage {
23
+ margin-top: 31px;
24
+ }
25
+
26
+ .logup {
27
+ padding-bottom: 5px;
28
+ }
29
+
30
+ .oneall_social_login iframe {
31
+ max-width: 100%;
32
+ width: 100%;
33
+ }
34
+
35
+ .siginf {
36
+ max-width: 308px;
37
+ width: 100%;
38
+ float: right;
39
+ margin-right: 230px;
40
+ }
41
+
42
+ .clr {
43
+ clear: both;
44
+ }
45
+
46
+ .registerloginform {
47
+ max-width: 308px;
48
+ width: 100%;
49
+ float: left;
50
+ position: relative;
51
+ }
52
+
53
+ .placeregister {
54
+ padding-bottom: 10px;
55
+ }
56
+
57
+ .customer-account-create .oneall_social_login_providers {
58
+ margin-bottom: 25px;
59
+ }
60
+
61
+ @media ( max-width : 1200px) {
62
+ .customer-account-login .page-title {
63
+ max-width: 100%;
64
+ }
65
+ .registerloginform,.siginf {
66
+ float: none;
67
+ display: inline-block;
68
+ margin: 0px auto;
69
+ }
70
+ .customer-account-login .page-title {
71
+ position: static;
72
+ margin-top: 0px;
73
+ }
74
+ }