LoginRadius - Version 4.2.0

Version Notes

Social Login and Social Share for Magento

Download this release

Release Info

Developer LoginRadius Team
Extension LoginRadius
Version 4.2.0
Comparing to
See all releases


Code changes from version 4.1.0 to 4.2.0

Files changed (63) hide show
  1. app/code/community/Loginradius/Sociallogin/Block/Auth.php +46 -44
  2. app/code/community/Loginradius/Sociallogin/Block/Emailpopup.php +0 -5
  3. app/code/community/Loginradius/Sociallogin/Block/Horizontalsharing.php +53 -18
  4. app/code/community/Loginradius/Sociallogin/Block/Sociallogin.php +472 -202
  5. app/code/community/Loginradius/Sociallogin/Block/Socialsharing.php +71 -23
  6. app/code/community/Loginradius/Sociallogin/Block/Verticalsharing.php +35 -0
  7. app/code/community/Loginradius/Sociallogin/Helper/Adminhelper.php +0 -67
  8. app/code/community/Loginradius/Sociallogin/Helper/Data.php +45 -14
  9. app/code/community/Loginradius/Sociallogin/Helper/LoginRadiusSDK.php +0 -125
  10. app/code/community/Loginradius/Sociallogin/Helper/Loginhelper.php +558 -248
  11. app/code/community/Loginradius/Sociallogin/Helper/Loginradiussdk.php +158 -0
  12. app/code/community/Loginradius/Sociallogin/Model/Backend/Validator.php +0 -17
  13. app/code/community/Loginradius/Sociallogin/Model/Observer.php +69 -117
  14. app/code/community/Loginradius/Sociallogin/Model/Source/HorizontalSharing.php +31 -0
  15. app/code/community/Loginradius/Sociallogin/Model/Source/Iconsize.php +25 -0
  16. app/code/community/Loginradius/Sociallogin/Model/Source/LoginPopup.php +25 -0
  17. app/code/community/Loginradius/Sociallogin/Model/Source/SharingVerticalAlignment.php +29 -4
  18. app/code/community/Loginradius/Sociallogin/Model/Source/TwitterRecipients.php +26 -1
  19. app/code/community/Loginradius/Sociallogin/Model/Source/Uihover.php +29 -4
  20. app/code/community/Loginradius/Sociallogin/Model/Source/Uihover2.php +0 -12
  21. app/code/community/Loginradius/Sociallogin/Model/Source/VerticalSharing.php +30 -0
  22. app/code/community/Loginradius/Sociallogin/Model/System/Config/Info.php +36 -2
  23. app/code/community/Loginradius/Sociallogin/controllers/IndexController.php +199 -343
  24. app/code/community/Loginradius/Sociallogin/etc/config.xml +5 -5
  25. app/code/community/Loginradius/Sociallogin/etc/system.xml +1 -1
  26. app/code/community/Loginradius/Sociallogin/sql/sociallogin_setup/{mysql4-install-4.1.0.php → mysql4-install-4.2.0.php} +1 -1
  27. app/code/community/Loginradius/Sociallogin/sql/sociallogin_setup/{mysql4-upgrade-3.7.2-4.1.0.php → mysql4-upgrade-3.7.1-4.2.0.php} +2 -1
  28. app/code/community/Loginradius/Sociallogin/sql/sociallogin_setup/{mysql4-upgrade-3.7.1-4.1.0.php → mysql4-upgrade-3.7.2-4.2.0.php} +2 -1
  29. app/code/community/Loginradius/Sociallogin/sql/sociallogin_setup/{mysql4-upgrade-4.0.0-4.1.0.php → mysql4-upgrade-4.0.0-4.2.0.php} +2 -1
  30. app/code/community/Loginradius/Sociallogin/sql/sociallogin_setup/mysql4-upgrade-4.1.0-4.2.0.php +17 -0
  31. app/design/frontend/base/default/template/sociallogin/abovelogin.phtml +1 -1
  32. app/design/frontend/base/default/template/sociallogin/aboveregister.phtml +2 -2
  33. app/design/frontend/base/default/template/sociallogin/belowlogin.phtml +1 -1
  34. app/design/frontend/base/default/template/sociallogin/belowregister.phtml +1 -1
  35. app/design/frontend/base/default/template/sociallogin/linking.phtml +15 -9
  36. app/design/frontend/base/default/template/sociallogin/popup.phtml +122 -98
  37. app/design/frontend/base/default/template/sociallogin/popupscript.phtml +5 -1
  38. app/design/frontend/base/default/template/sociallogin/sociallogin.phtml +2 -2
  39. app/design/frontend/base/default/template/sociallogin/sociallogin_head.phtml +39 -43
  40. app/design/frontend/base/default/template/sociallogin/sociallogincustom.phtml +13 -11
  41. app/design/frontend/base/default/template/sociallogin/socialshare_head.phtml +15 -11
  42. app/design/frontend/base/default/template/sociallogin/socialshareproduct.phtml +5 -2
  43. app/design/frontend/base/default/template/sociallogin/socialsharesuccess.phtml +6 -2
  44. package.xml +8 -8
  45. skin/adminhtml/default/default/Loginradius/Sociallogin/css/Thumbs.db +0 -0
  46. skin/adminhtml/default/default/Loginradius/Sociallogin/css/admin-ui.css +4 -32
  47. skin/adminhtml/default/default/Loginradius/Sociallogin/css/lrshare_iconsprite32.png +0 -0
  48. skin/adminhtml/default/default/Loginradius/Sociallogin/images/Sharing/Horizontal/responsive-icons.png +0 -0
  49. skin/adminhtml/default/default/Loginradius/Sociallogin/js/admin-ui.js +8 -0
  50. skin/frontend/base/default/Loginradius/Sociallogin/css/lrshare_iconsprite32.png +0 -0
  51. skin/frontend/base/default/Loginradius/Sociallogin/css/popup.css +20 -22
  52. skin/frontend/base/default/Loginradius/Sociallogin/images/Sharing/Horizontal/horizonSharing16.png +0 -0
  53. skin/frontend/base/default/Loginradius/Sociallogin/images/Sharing/Horizontal/horizonSharing32.png +0 -0
  54. skin/frontend/base/default/Loginradius/Sociallogin/images/Sharing/Horizontal/horizontal.png +0 -0
  55. skin/frontend/base/default/Loginradius/Sociallogin/images/Sharing/Horizontal/single-image-theme-large.png +0 -0
  56. skin/frontend/base/default/Loginradius/Sociallogin/images/Sharing/Horizontal/single-image-theme-small.png +0 -0
  57. skin/frontend/base/default/Loginradius/Sociallogin/images/Sharing/Horizontal/vertical.png +0 -0
  58. skin/frontend/base/default/Loginradius/Sociallogin/images/Sharing/Vertical/16VerticlewithBox.png +0 -0
  59. skin/frontend/base/default/Loginradius/Sociallogin/images/Sharing/Vertical/32VerticlewithBox.png +0 -0
  60. skin/frontend/base/default/Loginradius/Sociallogin/images/Sharing/Vertical/verticalhorizontal.png +0 -0
  61. skin/frontend/base/default/Loginradius/Sociallogin/images/Sharing/Vertical/verticalvertical.png +0 -0
  62. skin/frontend/base/default/Loginradius/Sociallogin/js/{LoginRadiusSDK.2.0.0.js → LoginRadiusSDK.js} +0 -0
  63. skin/frontend/base/default/Loginradius/Sociallogin/js/popup.js +3 -0
app/code/community/Loginradius/Sociallogin/Block/Auth.php CHANGED
@@ -1,53 +1,55 @@
1
  <?php
2
- class Loginradius_Sociallogin_Block_Auth extends Mage_Core_Block_Template implements Mage_Widget_Block_Interface {
3
- private $block_anyplace;
4
 
5
- public function __construct() {
6
- $this->block_anyplace = new Loginradius_Sociallogin_Block_Sociallogin();
7
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
 
9
- protected function _toHtml() {
10
- $content = '';
11
- if (Mage::getSingleton('customer/session')->isLoggedIn() == FALSE) {
12
- $content = $this->loginradius_buttons();
13
- }
14
- return $content;
15
- }
16
 
17
- function loginradius_buttons() {
18
- $ApiKey = trim($this->block_anyplace->getApikey());
19
- $ApiSecrete = trim($this->block_anyplace->getApiSecret());
20
- $UserAuth = $this->block_anyplace->getApiValidation($ApiKey, $ApiSecrete);
21
- $titleText = $this->getLabelText();
22
- $errormsg = '<p style ="color:red;">' . $this->__('To activate your plugin, please log in to LoginRadius and get API Key & Secret. Web') . ': <b><a href ="http://www.loginradius.com" target = "_blank">www.LoginRadius.com</a></b></p>';
23
- if ($this->block_anyplace->user_is_already_login()) {
24
- $userName = Mage::getSingleton('customer/session')->getCustomer()->getName();
25
- return '<span>' . __('Welcome') . '!' . ' ' . $userName . '</span>';
26
  }
27
- else {
28
- if ($ApiKey == "" && $ApiSecrete == "") {
29
- return $errormsg;
30
- }
31
- elseif ($UserAuth == FALSE) {
32
- return '<p style ="color:red;">' . $this->__('Your LoginRadius API Key and Secret is not valid, please correct it or contact LoginRadius support at') . ' <b><a href ="http://www.loginradius.com" target = "_blank">www.LoginRadius.com</a></b></p>';
33
- }
34
- else {
35
- $IsHttps = (!empty($UserAuth->IsHttps)) ? $UserAuth->IsHttps : '';
36
- $iframeHeight = (!empty($UserAuth->height)) ? $UserAuth->height : 50;
37
- $iframeWidth = (!empty($UserAuth->width)) ? $UserAuth->width : 138;
38
- $http = ($IsHttps == 1) ? "https://" : "http://";
39
- $loc = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK) . "sociallogin/";
40
- if (empty($titleText)) {
41
- $titleText = __('Social Login');
42
  }
43
- $label = '<span ><b>' . __($titleText) . '</b></span>';
44
- $iframe = '<div class="interfacecontainerdiv" style="margin-left:10px"></div>';
45
- return $label . $iframe;
46
- }
47
  }
48
- }
49
 
50
- protected function _prepareLayout() {
51
- parent::_prepareLayout();
52
- }
 
 
 
 
53
  }
1
  <?php
 
 
2
 
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * sociallogin auth block
17
+ *
18
+ * @category Loginradius
19
+ * @package Loginradius_Sociallogin
20
+ * @author LoginRadius Team
21
+ */
22
 
23
+ /**
24
+ * Class Loginradius_Sociallogin_Block_Auth responsible to generate social login interface
25
+ */
26
+ class Loginradius_Sociallogin_Block_Auth extends Mage_Core_Block_Template implements Mage_Widget_Block_Interface
27
+ {
28
+ private $socialLoginBlockObject;
 
29
 
30
+ /**
31
+ * Constructor for this class
32
+ */
33
+ public function __construct()
34
+ {
35
+ $this->socialLoginBlockObject = new Loginradius_Sociallogin_Block_Sociallogin();
 
 
 
36
  }
37
+
38
+ /**
39
+ * Override _toHtml functions
40
+ */
41
+ protected function _toHtml()
42
+ {
43
+ if (!Mage::helper('sociallogin/loginhelper')->isAlreadyLoggedIn()) {
44
+ return $this->socialLoginBlockObject->getSocialLoginContainer();
 
 
 
 
 
 
 
45
  }
 
 
 
 
46
  }
 
47
 
48
+ /**
49
+ * Overriding _prepareLayout function
50
+ */
51
+ protected function _prepareLayout()
52
+ {
53
+ parent::_prepareLayout();
54
+ }
55
  }
app/code/community/Loginradius/Sociallogin/Block/Emailpopup.php DELETED
@@ -1,5 +0,0 @@
1
- <?php
2
- class Loginradius_Sociallogin_Block_Emailpopup extends Mage_Core_Block_Template
3
- {
4
-
5
- }
 
 
 
 
 
app/code/community/Loginradius/Sociallogin/Block/Horizontalsharing.php CHANGED
@@ -1,24 +1,59 @@
1
  <?php
2
- class Loginradius_Sociallogin_Block_Horizontalsharing extends Mage_Core_Block_Template implements Mage_Widget_Block_Interface {
3
- private $loginRadiusHorizontalSharing;
4
 
5
- public function __construct() {
6
- $this->loginRadiusHorizontalSharing = new Loginradius_Sociallogin_Block_Sociallogin();
7
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
 
9
- protected function _toHtml() {
10
- $content = "";
11
- if ($this->loginRadiusHorizontalSharing->horizontalShareEnable() == "1") {
12
- $content = "<div class='loginRadiusHorizontalSharing'></div>";
13
- $titleText = trim($this->getLabelText());
14
- if ($titleText != "") {
15
- $content = "<div style='font-weight:bold'>" . __($titleText) . "</div>" . $content;
16
- }
 
 
17
  }
18
- return $content;
19
- }
20
 
21
- protected function _prepareLayout() {
22
- parent::_prepareLayout();
23
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
  }
1
  <?php
 
 
2
 
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * sociallogin horizontalsharing block
17
+ *
18
+ * @category Loginradius
19
+ * @package Loginradius_Sociallogin
20
+ * @author LoginRadius Team
21
+ */
22
 
23
+ /**
24
+ * Class Loginradius_Sociallogin_Block_Horizontalsharing which is responsible for horizontal social sharing interface generation.
25
+ */
26
+ class Loginradius_Sociallogin_Block_Horizontalsharing extends Mage_Core_Block_Template implements Mage_Widget_Block_Interface
27
+ {
28
+ private $_loginRadiusHorizontalSharing;
29
+
30
+ public function __construct()
31
+ {
32
+ $this->_loginRadiusHorizontalSharing = new Loginradius_Sociallogin_Block_Sociallogin();
33
  }
 
 
34
 
35
+ /**
36
+ * Used to get horizontal social sharing container
37
+ *
38
+ * @return string
39
+ */
40
+ protected function _toHtml()
41
+ {
42
+ $content = "";
43
+ if ($this->_loginRadiusHorizontalSharing->horizontalShareEnable() == "1") {
44
+ $content = "<div class='loginRadiusHorizontalSharing'></div>";
45
+ }
46
+
47
+ return $content;
48
+ }
49
+
50
+ /**
51
+ * Override _prepareLayout method
52
+ *
53
+ * @return Mage_Core_Block_Abstract|void
54
+ */
55
+ protected function _prepareLayout()
56
+ {
57
+ parent::_prepareLayout();
58
+ }
59
  }
app/code/community/Loginradius/Sociallogin/Block/Sociallogin.php CHANGED
@@ -1,264 +1,534 @@
1
  <?php
2
- class Loginradius_Sociallogin_Block_Sociallogin extends Mage_Core_Block_Template {
3
- public function getPopusScriptUrl() {
4
- $jsPath = Mage::getDesign()->getSkinUrl('Loginradius/Sociallogin/js/popup.js', array('_area' => 'frontend'));
5
- $cssPath = Mage::getDesign()->getSkinUrl('Loginradius/Sociallogin/css/popup.css', array('_area' => 'frontend'));
6
 
7
- echo '<script src="' . $jsPath . '"></script>';
8
- echo '<link rel = "stylesheet" href="' . $cssPath . '" media = "all" />';
9
-
10
- }
11
-
12
- public function _prepareLayout() {
13
- return parent::_prepareLayout();
14
- }
15
-
16
- public function getSociallogin() {
17
- if (!$this->hasData('sociallogin')) {
18
- $this->setData('sociallogin', Mage::registry('sociallogin'));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  }
20
- return $this->getData('sociallogin');
21
- }
22
 
23
- public function user_is_already_login() {
24
- if (Mage::getSingleton('customer/session')->isLoggedIn()) {
25
- return TRUE;
 
 
 
26
  }
27
- return FALSE;
28
- }
29
-
30
- public function getApikey() {
31
- return trim(Mage::getStoreConfig('sociallogin_options/apiSettings/apikey'));
32
- }
33
 
34
- public function getApiSecret() {
35
- return trim(Mage::getStoreConfig('sociallogin_options/apiSettings/apisecret'));
36
- }
37
-
38
- public function getLoginRedirectOption() {
39
- return Mage::getStoreConfig('sociallogin_options/basicSettings/redirectAfterLogin');
40
- }
41
 
42
- public function getRegistrationRedirectOption() {
43
- return Mage::getStoreConfig('sociallogin_options/basicSettings/redirectAfterRegistration');
44
- }
 
 
 
 
 
 
45
 
46
- public function getCustomLoginRedirectOption() {
47
- return Mage::getStoreConfig('sociallogin_options/basicSettings/customUrlLogin');
48
- }
49
 
50
- public function getCustomRegistrationRedirectOption() {
51
- return Mage::getStoreConfig('sociallogin_options/basicSettings/customUrlLogin');
52
- }
 
 
53
 
54
- public function getRegistrationCallBack() {
55
- return Mage::getStoreConfig('sociallogin_options/basicSettings/customUrlRegistration');
56
- }
57
 
58
- public function iconSize() {
59
- return Mage::getStoreConfig('sociallogin_options/advancedSettings/iconSize');
60
- }
 
 
 
 
 
 
61
 
62
- public function iconsPerRow() {
63
- return Mage::getStoreConfig('sociallogin_options/advancedSettings/iconsPerRow');
64
- }
 
 
 
 
65
 
66
- public function backgroundColor() {
67
- return Mage::getStoreConfig('sociallogin_options/advancedSettings/backgroundColor');
68
- }
 
 
 
 
69
 
70
- public function getShowDefault() {
71
- return Mage::getStoreConfig('sociallogin_options/advancedSettings/showdefault');
72
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73
 
74
- public function getAboveLogin() {
75
- return Mage::getStoreConfig('sociallogin_options/advancedSettings/aboveLogin');
76
- }
 
 
 
 
 
 
77
 
78
- public function getBelowLogin() {
79
- return Mage::getStoreConfig('sociallogin_options/advancedSettings/belowLogin');
80
- }
81
 
82
- public function getAboveRegister() {
83
- return Mage::getStoreConfig('sociallogin_options/advancedSettings/aboveRegister');
84
- }
85
 
86
- public function getBelowRegister() {
87
- return Mage::getStoreConfig('sociallogin_options/advancedSettings/belowRegister');
88
- }
 
 
 
 
 
 
89
 
90
- public function getEmailRequired() {
91
- return Mage::getStoreConfig('sociallogin_options/advancedSettings/emailrequired');
92
- }
 
 
 
 
 
 
93
 
94
- public function verificationText() {
95
- return Mage::getStoreConfig('sociallogin_options/advancedSettings/verificationText');
96
- }
 
 
 
 
 
 
97
 
98
- public function getPopupText() {
99
- return Mage::getStoreConfig('sociallogin_options/advancedSettings/popupText');
100
- }
 
 
 
 
 
 
101
 
102
- public function getPopupError() {
103
- return Mage::getStoreConfig('sociallogin_options/advancedSettings/popupError');
104
- }
 
 
 
 
 
 
105
 
106
- public function notifyUser() {
107
- return Mage::getStoreConfig('sociallogin_options/advancedSettings/notifyUser');
108
- }
 
 
 
 
109
 
110
- public function notifyUserText() {
111
- return Mage::getStoreConfig('sociallogin_options/advancedSettings/notifyUserText');
112
- }
113
-
114
- public function notifyAdmin() {
115
- return Mage::getStoreConfig('sociallogin_options/advancedSettings/notifyAdmin');
116
- }
117
-
118
- public function notifyAdminText() {
119
- return Mage::getStoreConfig('sociallogin_options/advancedSettings/notifyAdminText');
120
- }
121
 
122
- public function getAvatar($id) {
123
- $socialLoginConn = Mage::getSingleton('core/resource')->getConnection('core_read');
124
- $SocialLoginTbl = Mage::getSingleton('core/resource')->getTableName("sociallogin");
125
- $select = $socialLoginConn->query("select avatar from $SocialLoginTbl where entity_id = '$id' limit 1");
126
- if ($rowArray = $select->fetch()) {
127
- if (($avatar = trim($rowArray['avatar'])) != "") {
128
- return $avatar;
129
- }
130
- }
131
- return FALSE;
132
- }
133
 
134
- public function getProfileFieldsRequired() {
135
- return Mage::getStoreConfig('sociallogin_options/advancedSettings/profileFieldsRequired');
136
- }
 
 
 
 
 
 
137
 
138
- public function updateProfileData() {
139
- return Mage::getStoreConfig('sociallogin_options/advancedSettings/updateProfileData');
140
- }
 
 
 
 
 
 
141
 
142
- public function getLinking() {
143
- return Mage::getStoreConfig('sociallogin_options/advancedSettings/socialLinking');
144
- }
 
 
 
 
 
 
145
 
146
- public function isDebuggingOn() {
147
- return Mage::getStoreConfig('sociallogin_options/advancedSettings/debugMode');
148
- }
 
 
 
 
 
 
149
 
150
- public function horizontalSharingTheme() {
151
- return Mage::getStoreConfig('sociallogin_options/horizontalSharing/horizontalSharingTheme');
152
- }
 
 
 
 
 
 
153
 
154
- public function horizontalShareSuccess() {
155
- return Mage::getStoreConfig('sociallogin_options/horizontalSharing/horizontalShareSuccess');
156
- }
 
157
 
158
- public function horizontalSharingProviders() {
159
- return Mage::getStoreConfig('sociallogin_options/horizontalSharing/horizontalSharingProvidersHidden');
160
- }
 
 
 
 
 
 
161
 
162
- public function horizontalShareProduct() {
163
- return Mage::getStoreConfig('sociallogin_options/horizontalSharing/horizontalShareProduct');
164
- }
 
 
 
 
 
 
165
 
166
- /* Get horizontal sharing optionS */
 
 
 
 
 
 
 
 
167
 
168
- public function horizontalCounterProviders() {
169
- return Mage::getStoreConfig('sociallogin_options/horizontalSharing/horizontalCounterProvidersHidden');
170
- }
 
 
 
 
 
 
171
 
172
- public function verticalSharingTheme() {
173
- return Mage::getStoreConfig('sociallogin_options/verticalSharing/verticalSharingTheme');
174
- }
 
 
 
 
 
 
175
 
176
- public function verticalAlignment() {
177
- return Mage::getStoreConfig('sociallogin_options/verticalSharing/verticalAlignment');
178
- }
 
 
 
 
 
 
179
 
180
- public function verticalSharingProviders() {
181
- return Mage::getStoreConfig('sociallogin_options/verticalSharing/verticalSharingProvidersHidden');
182
- }
 
 
 
 
 
 
183
 
184
- public function verticalCounterProviders() {
185
- return Mage::getStoreConfig('sociallogin_options/verticalSharing/verticalCounterProvidersHidden');
186
- }
 
 
 
 
 
 
187
 
188
- public function verticalShareProduct() {
189
- return Mage::getStoreConfig('sociallogin_options/verticalSharing/verticalShareProduct');
190
- }
 
 
 
 
 
 
191
 
192
- public function verticalShareSuccess() {
193
- return Mage::getStoreConfig('sociallogin_options/verticalSharing/verticalShareSuccess');
194
- }
 
 
 
 
 
 
195
 
196
- public function offset() {
197
- return 100;
198
- }
 
 
 
 
 
 
199
 
200
- public function getProfileResult($ApiSecrete) {
201
- if (isset($_REQUEST['token'])) {
202
- $ValidateUrl = "http://hub.loginradius.com/userprofile.ashx?token=" . $_REQUEST['token'] . "&apisecrete=" . trim($ApiSecrete);
203
- return $this->getApiCall($ValidateUrl);
 
 
 
 
204
  }
205
- }
206
 
207
- public function getSocialLoginContainer() {
208
- $lrKeys = $this->getApiKeys();
209
- $AdvancedSettings = $this->getAdvancedSettings();
210
- $lrSettings = array_merge($lrKeys, $AdvancedSettings);
211
- $UserAuth = $this->getApiValidation(trim($lrSettings['apikey']), trim($lrSettings['apisecret']));
212
- echo '<div class="block" style="margin-top:15px"><div class="block-title"><strong><span>' . __('Social Login') . '</span></strong></div><div class="block-content"><p class="empty">';
213
- if ($lrKeys['apikey'] == "" && $lrKeys['apikey'] == "apisecret") {
214
- echo '<p style ="color:red;">' . $this->__('To activate your plugin, please log in to LoginRadius and get API Key & Secret. Web') . ': <b><a href ="http://www.loginradius.com" target = "_blank">www.LoginRadius.com</a></b></p>';
215
  }
216
- elseif ($UserAuth == FALSE) {
217
- echo '<p style ="color:red;">' . $this->__('Your LoginRadius API Key and Secret is not valid, please correct it or contact LoginRadius support at') . ' <b><a href ="http://www.loginradius.com" target = "_blank">www.LoginRadius.com</a></b></p>';
 
 
 
 
 
 
 
218
  }
219
- else {
220
- echo '<div style="margin:5px"><div style="margin-bottom:5px">' . trim($this->getLoginRadiusTitle()) . '</div><div class="interfacecontainerdiv"></div></div>';
 
 
 
 
 
 
 
221
  }
222
- echo '</p></div></div>';
223
- }
224
 
225
- public function getApiKeys() {
226
- return Mage::getStoreConfig('sociallogin_options/apiSettings');
227
- }
 
 
 
 
 
 
228
 
229
- public function getAdvancedSettings() {
230
- return Mage::getStoreConfig('sociallogin_options/advancedSettings');
231
- }
 
 
 
 
 
 
232
 
233
- public function getApiValidation($ApiKey, $ApiSecrete) {
234
- if (!empty($ApiKey) && !empty($ApiSecrete) && preg_match('/^\{?[A-Z0-9]{8}-[A-Z0-9]{4}-[A-Z0-9]{4}-[A-Z0-9]{4}-[A-Z0-9]{12}\}?$/i', $ApiKey) && preg_match('/^\{?[A-Z0-9]{8}-[A-Z0-9]{4}-[A-Z0-9]{4}-[A-Z0-9]{4}-[A-Z0-9]{12}\}?$/i', $ApiSecrete)) {
235
- return TRUE;
 
 
 
 
 
236
  }
237
- else {
238
- return FALSE;
 
 
 
 
 
 
 
239
  }
240
- }
241
 
 
 
 
 
 
 
 
242
 
243
- // Extra methods to remove
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
244
 
245
- public function getLoginRadiusTitle() {
246
- return Mage::getStoreConfig('sociallogin_options/advancedSettings/loginradius_title');
247
- }
 
 
 
 
 
 
248
 
249
- protected function _construct() {
250
- parent::_construct();
251
- if ($this->horizontalShareEnable() == "1" || $this->verticalShareEnable() == "1") {
252
- $this->setTemplate('sociallogin/socialshare.phtml');
 
 
 
 
253
  }
254
- }
255
 
256
- public function horizontalShareEnable() {
257
- return Mage::getStoreConfig('sociallogin_options/horizontalSharing/horizontalShareEnable');
258
- }
 
 
 
 
 
 
 
 
259
 
260
- public function verticalShareEnable() {
261
- return Mage::getStoreConfig('sociallogin_options/verticalSharing/verticalShareEnable');
262
- }
 
 
 
 
263
 
264
  }
1
  <?php
 
 
 
 
2
 
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * sociallogin sociallogin block
17
+ *
18
+ * @category Loginradius
19
+ * @package Loginradius_Sociallogin
20
+ * @author LoginRadius Team
21
+ */
22
+
23
+ // Define LoginRadius domain
24
+ if (!defined('LR_DOMAIN')) {
25
+ define('LR_DOMAIN', 'api.loginradius.com');
26
+ }
27
+
28
+ /**
29
+ * Class Loginradius_Sociallogin_Block_Sociallogin bloch which contains function to get all the configuration settings for loginradius extension
30
+ */
31
+ class Loginradius_Sociallogin_Block_Sociallogin extends Mage_Core_Block_Template
32
+ {
33
+
34
+ /**
35
+ * Constructor for class Loginradius_Sociallogin_Block_Sociallogin
36
+ */
37
+ public function _construct()
38
+ {
39
+ parent::_construct();
40
+ if ($this->horizontalShareEnable() == "1" || $this->verticalShareEnable() == "1") {
41
+ $this->setTemplate('sociallogin/socialshare.phtml');
42
+ }
43
  }
 
 
44
 
45
+ /**
46
+ * @return mixed 1/0 according to option enabled or disabled
47
+ */
48
+ public function horizontalShareEnable()
49
+ {
50
+ return Mage::getStoreConfig('sociallogin_options/horizontalSharing/horizontalShareEnable');
51
  }
 
 
 
 
 
 
52
 
53
+ /**
54
+ * @return mixed 1/0 according to option enabled or disabled
55
+ */
56
+ public function verticalShareEnable()
57
+ {
58
+ return Mage::getStoreConfig('sociallogin_options/verticalSharing/verticalShareEnable');
59
+ }
60
 
61
+ /**
62
+ * Override _prepareLayout method
63
+ *
64
+ * @return Mage_Core_Block_Abstract
65
+ */
66
+ public function _prepareLayout()
67
+ {
68
+ return parent::_prepareLayout();
69
+ }
70
 
71
+ /**
72
+ * @return mixed data from sociallogin table
73
+ */
74
 
75
+ public function getSociallogin()
76
+ {
77
+ if (!$this->hasData('sociallogin')) {
78
+ $this->setData('sociallogin', Mage::registry('sociallogin'));
79
+ }
80
 
81
+ return $this->getData('sociallogin');
82
+ }
 
83
 
84
+ /**
85
+ * Check if debugging is on or off
86
+ *
87
+ * @return mixed
88
+ */
89
+ public function isDebuggingOn()
90
+ {
91
+ return Mage::getStoreConfig('sociallogin_options/advancedSettings/debugMode');
92
+ }
93
 
94
+ /**
95
+ * Get LoginRadius API Key
96
+ */
97
+ public function getApikey()
98
+ {
99
+ return trim(Mage::getStoreConfig('sociallogin_options/apiSettings/apikey'));
100
+ }
101
 
102
+ /**
103
+ * Get LoginRadius API Secret
104
+ */
105
+ public function getApiSecret()
106
+ {
107
+ return trim(Mage::getStoreConfig('sociallogin_options/apiSettings/apisecret'));
108
+ }
109
 
110
+ /**
111
+ * Get thumbnail image to be displayed as avatar or false if not exists
112
+ *
113
+ * @param $id
114
+ *
115
+ * @return mix
116
+ */
117
+ public function getAvatar($id)
118
+ {
119
+ $socialLoginConn = Mage::getSingleton('core/resource')->getConnection('core_read');
120
+ $SocialLoginTbl = Mage::getSingleton('core/resource')->getTableName("sociallogin");
121
+ $select = $socialLoginConn->query("select avatar from $SocialLoginTbl where entity_id = '$id' limit 1");
122
+ if ($rowArray = $select->fetch()) {
123
+ if (($avatar = trim($rowArray['avatar'])) != "") {
124
+ return $avatar;
125
+ }
126
+ }
127
+
128
+ return false;
129
+ }
130
 
131
+ /**
132
+ * Get script and css for email required popup
133
+ *
134
+ * @return string
135
+ */
136
+ public function getPopupScriptUrl()
137
+ {
138
+ $jsPath = Mage::getDesign()->getSkinUrl('Loginradius/Sociallogin/js/popup.js', array('_area' => 'frontend'));
139
+ $cssPath = Mage::getDesign()->getSkinUrl('Loginradius/Sociallogin/css/popup.css', array('_area' => 'frontend'));
140
 
141
+ return '<script type="text/javascript" src="' . $jsPath . '"></script><link rel = "stylesheet" href="' . $cssPath . '" media = "all" />';
 
 
142
 
143
+ }
 
 
144
 
145
+ /**
146
+ * configuration to display social login in side bar
147
+ *
148
+ * @return mixed
149
+ */
150
+ public function getShowDefault()
151
+ {
152
+ return Mage::getStoreConfig('sociallogin_options/advancedSettings/showdefault');
153
+ }
154
 
155
+ /**
156
+ * configuration to display social login above login form
157
+ *
158
+ * @return mixed
159
+ */
160
+ public function getAboveLogin()
161
+ {
162
+ return Mage::getStoreConfig('sociallogin_options/advancedSettings/aboveLogin');
163
+ }
164
 
165
+ /**
166
+ * configuration to display social login below login form
167
+ *
168
+ * @return mixed
169
+ */
170
+ public function getBelowLogin()
171
+ {
172
+ return Mage::getStoreConfig('sociallogin_options/advancedSettings/belowLogin');
173
+ }
174
 
175
+ /**
176
+ * configuration to display social login above registration form
177
+ *
178
+ * @return mixed
179
+ */
180
+ public function getAboveRegister()
181
+ {
182
+ return Mage::getStoreConfig('sociallogin_options/advancedSettings/aboveRegister');
183
+ }
184
 
185
+ /**
186
+ * configuration to display social login below registration form
187
+ *
188
+ * @return mixed
189
+ */
190
+ public function getBelowRegister()
191
+ {
192
+ return Mage::getStoreConfig('sociallogin_options/advancedSettings/belowRegister');
193
+ }
194
 
195
+ /**
196
+ * Get icon size as configured in extension configuration page
197
+ */
198
+ public function iconSize()
199
+ {
200
+ return Mage::getStoreConfig('sociallogin_options/advancedSettings/iconSize');
201
+ }
202
 
203
+ /**
204
+ * get no. of icons per row in social login interface
205
+ *
206
+ * @return int
207
+ */
208
+ public function iconsPerRow()
209
+ {
210
+ return Mage::getStoreConfig('sociallogin_options/advancedSettings/iconsPerRow');
211
+ }
 
 
212
 
213
+ /**
214
+ * Get background color for social login interface
215
+ *
216
+ * @return mixed
217
+ */
218
+ public function backgroundColor()
219
+ {
220
+ return Mage::getStoreConfig('sociallogin_options/advancedSettings/backgroundColor');
221
+ }
 
 
222
 
223
+ /**
224
+ * Get redirection url after login
225
+ *
226
+ * @return mixed
227
+ */
228
+ public function getLoginRedirectOption()
229
+ {
230
+ return Mage::getStoreConfig('sociallogin_options/basicSettings/redirectAfterLogin');
231
+ }
232
 
233
+ /**
234
+ * Get redirection url after registration
235
+ *
236
+ * @return mixed
237
+ */
238
+ public function getRegistrationRedirectOption()
239
+ {
240
+ return Mage::getStoreConfig('sociallogin_options/basicSettings/redirectAfterRegistration');
241
+ }
242
 
243
+ /**
244
+ * Get redirection custom url after login
245
+ *
246
+ * @return mixed
247
+ */
248
+ public function getCustomLoginRedirectOption()
249
+ {
250
+ return Mage::getStoreConfig('sociallogin_options/basicSettings/customUrlLogin');
251
+ }
252
 
253
+ /**
254
+ * Get redirection custom url after registration
255
+ *
256
+ * @return mixed
257
+ */
258
+ public function getCustomRegistrationRedirectOption()
259
+ {
260
+ return Mage::getStoreConfig('sociallogin_options/basicSettings/customUrlRegistration');
261
+ }
262
 
263
+ /**
264
+ * Check if email is required if social network does not provide email.
265
+ *
266
+ * @return mixed 1/0
267
+ */
268
+ public function getEmailRequired()
269
+ {
270
+ return Mage::getStoreConfig('sociallogin_options/advancedSettings/emailrequired');
271
+ }
272
 
273
+ public function verificationText()
274
+ {
275
+ return Mage::getStoreConfig('sociallogin_options/advancedSettings/verificationText');
276
+ }
277
 
278
+ /**
279
+ * Get email verification text to be send to customer
280
+ *
281
+ * @return mixed
282
+ */
283
+ public function getPopupText()
284
+ {
285
+ return Mage::getStoreConfig('sociallogin_options/advancedSettings/popupText');
286
+ }
287
 
288
+ /**
289
+ * Get popup error message which to be shown while there is error in email syntax..
290
+ *
291
+ * @return mixed
292
+ */
293
+ public function getPopupError()
294
+ {
295
+ return Mage::getStoreConfig('sociallogin_options/advancedSettings/popupError');
296
+ }
297
 
298
+ /**
299
+ * Check if username password should be emaild to customer
300
+ *
301
+ * @return mixed 1/0
302
+ */
303
+ public function notifyUser()
304
+ {
305
+ return Mage::getStoreConfig('sociallogin_options/advancedSettings/notifyUser');
306
+ }
307
 
308
+ /**
309
+ * Text to be send with Username and password to registerd customer
310
+ *
311
+ * @return mixed
312
+ */
313
+ public function notifyUserText()
314
+ {
315
+ return Mage::getStoreConfig('sociallogin_options/advancedSettings/notifyUserText');
316
+ }
317
 
318
+ /**
319
+ * Check if need to send email to admin on registration.
320
+ *
321
+ * @return mixed
322
+ */
323
+ public function notifyAdmin()
324
+ {
325
+ return Mage::getStoreConfig('sociallogin_options/advancedSettings/notifyAdmin');
326
+ }
327
 
328
+ /**
329
+ * Text to be send with to magento site admin
330
+ *
331
+ * @return mixed
332
+ */
333
+ public function notifyAdminText()
334
+ {
335
+ return Mage::getStoreConfig('sociallogin_options/advancedSettings/notifyAdminText');
336
+ }
337
 
338
+ /**
339
+ * Check if horizontal sharing is enabled on products page or not
340
+ *
341
+ * @return mixed 1/0
342
+ */
343
+ public function horizontalShareProduct()
344
+ {
345
+ return Mage::getStoreConfig('sociallogin_options/horizontalSharing/horizontalShareProduct');
346
+ }
347
 
348
+ /**
349
+ * Check if vertical sharing is enabled on products page or not
350
+ *
351
+ * @return mixed 1/0
352
+ */
353
+ public function verticalShareProduct()
354
+ {
355
+ return Mage::getStoreConfig('sociallogin_options/verticalSharing/verticalShareProduct');
356
+ }
357
 
358
+ /**
359
+ * Check if horizontal sharing is enabled on checkout success page or not
360
+ *
361
+ * @return mixed 1/0
362
+ */
363
+ public function horizontalShareSuccess()
364
+ {
365
+ return Mage::getStoreConfig('sociallogin_options/horizontalSharing/horizontalShareSuccess');
366
+ }
367
 
368
+ /**
369
+ * Check if vertical sharing is enabled on checkout success page or not
370
+ *
371
+ * @return mixed 1/0
372
+ */
373
+ public function verticalShareSuccess()
374
+ {
375
+ return Mage::getStoreConfig('sociallogin_options/verticalSharing/verticalShareSuccess');
376
+ }
377
 
378
+ /**
379
+ * Get name of the horizontal sharing theme
380
+ *
381
+ * @return string
382
+ */
383
+ public function horizontalSharingTheme()
384
+ {
385
+ return Mage::getStoreConfig('sociallogin_options/horizontalSharing/horizontalSharingTheme');
386
+ }
387
 
388
+ /**
389
+ * Get name of the horizontal sharing theme
390
+ *
391
+ * @return string
392
+ */
393
+ public function verticalSharingTheme()
394
+ {
395
+ return Mage::getStoreConfig('sociallogin_options/verticalSharing/verticalSharingTheme');
396
  }
 
397
 
398
+ /**
399
+ * Get vertical sharing alignment
400
+ */
401
+ public function verticalAlignment()
402
+ {
403
+ return Mage::getStoreConfig('sociallogin_options/verticalSharing/verticalAlignment');
 
 
404
  }
405
+
406
+ /**
407
+ * Get array of horizontal sharing providers selected
408
+ *
409
+ * @return array
410
+ */
411
+ public function horizontalSharingProviders()
412
+ {
413
+ return Mage::getStoreConfig('sociallogin_options/horizontalSharing/horizontalSharingProvidersHidden');
414
  }
415
+
416
+ /**
417
+ * Get array of vertical sharing providers selected
418
+ *
419
+ * @return array
420
+ */
421
+ public function verticalSharingProviders()
422
+ {
423
+ return Mage::getStoreConfig('sociallogin_options/verticalSharing/verticalSharingProvidersHidden');
424
  }
 
 
425
 
426
+ /**
427
+ * Get array of horizontal counter providers selected
428
+ *
429
+ * @return array
430
+ */
431
+ public function horizontalCounterProviders()
432
+ {
433
+ return Mage::getStoreConfig('sociallogin_options/horizontalSharing/horizontalCounterProvidersHidden');
434
+ }
435
 
436
+ /**
437
+ * Get array of vertical counter providers selected
438
+ *
439
+ * @return array
440
+ */
441
+ public function verticalCounterProviders()
442
+ {
443
+ return Mage::getStoreConfig('sociallogin_options/verticalSharing/verticalCounterProvidersHidden');
444
+ }
445
 
446
+ /**
447
+ * check if profile fields are required or not
448
+ *
449
+ * @return mixed 1/0
450
+ */
451
+ public function getProfileFieldsRequired()
452
+ {
453
+ return Mage::getStoreConfig('sociallogin_options/advancedSettings/profileFieldsRequired');
454
  }
455
+
456
+ /**
457
+ * Check if profile should be updated each time on customer login.
458
+ *
459
+ * @return mixed 1/0
460
+ */
461
+ public function updateProfileData()
462
+ {
463
+ return Mage::getStoreConfig('sociallogin_options/advancedSettings/updateProfileData');
464
  }
 
465
 
466
+ /**
467
+ * Check if linking option is enabled or not!
468
+ */
469
+ public function getLinking()
470
+ {
471
+ return Mage::getStoreConfig('sociallogin_options/advancedSettings/socialLinking');
472
+ }
473
 
474
+ /**
475
+ * Container for Social Login Interface
476
+ */
477
+ public function getSocialLoginContainer()
478
+ {
479
+ $lrKeys = $this->getApiKeys();
480
+ $AdvancedSettings = $this->getAdvancedSettings();
481
+ $lrSettings = array_merge($lrKeys, $AdvancedSettings);
482
+ $UserAuth = $this->getApiValidation(trim($lrSettings['apikey']), trim($lrSettings['apisecret']));
483
+ echo '<div class="block" style="margin-top:15px"><div class="block-title"><strong><span>' . $this->getSocialLoginTitle() . '</span></strong></div><div class="block-content"><p class="empty">';
484
+ if ($lrKeys['apikey'] == "" && $lrKeys['apikey'] == "apisecret") {
485
+ echo '<p style ="color:red;">' . $this->__('To activate your plugin, please log in to LoginRadius and get API Key & Secret. Web') . ': <b><a href ="http://www.loginradius.com" target = "_blank">www.LoginRadius.com</a></b></p>';
486
+ } elseif ($UserAuth == false) {
487
+ echo '<p style ="color:red;">' . $this->__('Your LoginRadius API Key and Secret is not valid, please correct it or contact LoginRadius support at') . ' <b><a href ="http://www.loginradius.com" target = "_blank">www.LoginRadius.com</a></b></p>';
488
+ } else {
489
+ echo '<div style="margin:5px"><div style="margin-bottom:5px">' . trim($this->getLoginRadiusTitle()) . '</div><div class="interfacecontainerdiv"></div></div>';
490
+ }
491
+ echo '</p></div></div>';
492
+ }
493
 
494
+ /**
495
+ * Get LoginRadius Api Key and Secret Key
496
+ *
497
+ * @return mixed
498
+ */
499
+ public function getApiKeys()
500
+ {
501
+ return Mage::getStoreConfig('sociallogin_options/apiSettings');
502
+ }
503
 
504
+ /**
505
+ * Get Advanced Settings for extension
506
+ *
507
+ * @return mixed
508
+ */
509
+ public function getAdvancedSettings()
510
+ {
511
+ return Mage::getStoreConfig('sociallogin_options/advancedSettings');
512
  }
 
513
 
514
+ /**
515
+ * Validate LoginRadius keys!
516
+ */
517
+ public function getApiValidation($ApiKey, $ApiSecrete)
518
+ {
519
+ if (!empty($ApiKey) && !empty($ApiSecrete) && preg_match('/^\{?[A-Z0-9]{8}-[A-Z0-9]{4}-[A-Z0-9]{4}-[A-Z0-9]{4}-[A-Z0-9]{12}\}?$/i', $ApiKey) && preg_match('/^\{?[A-Z0-9]{8}-[A-Z0-9]{4}-[A-Z0-9]{4}-[A-Z0-9]{4}-[A-Z0-9]{12}\}?$/i', $ApiSecrete)) {
520
+ return true;
521
+ } else {
522
+ return false;
523
+ }
524
+ }
525
 
526
+ /**
527
+ * Get title for social login interface
528
+ */
529
+ public function getSocialLoginTitle()
530
+ {
531
+ return Mage::getStoreConfig('sociallogin_options/advancedSettings/loginradius_title');
532
+ }
533
 
534
  }
app/code/community/Loginradius/Sociallogin/Block/Socialsharing.php CHANGED
@@ -1,14 +1,46 @@
1
  <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  class Loginradius_Sociallogin_Block_Socialsharing extends Mage_Core_Block_Template
3
  {
 
 
 
 
 
 
 
 
4
  /**
5
  * function returns script required for vertical sharing.
6
- *
7
- * global $loginRadiusSettings;
8
  */
9
- public static function login_radius_sharing_get_sharing_script_vertical($loginRadiusSettings, $apiKey)
10
  {
 
11
  $sharingScript = '';
 
12
  $verticalThemvalue = isset($loginRadiusSettings['verticalSharingTheme']) ? $loginRadiusSettings['verticalSharingTheme'] : '';
13
 
14
  switch ($verticalThemvalue) {
@@ -75,29 +107,28 @@ class Loginradius_Sociallogin_Block_Socialsharing extends Mage_Core_Block_Templa
75
 
76
  $offset = '$' . $sharingVariable . '.' . $position1 . ' = \'0px\'; $' . $sharingVariable . '.' . $position2 . ' = \'0px\';';
77
 
78
- if (empty($size)) {
79
- $providers = self:: get_counter_providers('vertical', $loginRadiusSettings);
80
  $sharingScript .= 'LoginRadius.util.ready( function() { $SC.Providers.Selected = ["' . $providers . '"]; $S = $SC.Interface.' . $interface . '; $S.isHorizontal = ' . $ishorizontal . '; $S.countertype = \'' . $type . '\'; ' . $offset . ' $u = LoginRadius.user_settings; if(typeof document.getElementsByName("viewport")[0] != "undefined"){$u.isMobileFriendly=true;}; $S.show( "loginRadiusVerticalSharing" ); } );';
81
  } else {
82
- $providers = self:: get_sharing_providers('vertical', $loginRadiusSettings);
83
  // prepare sharing script
84
  $sharingScript .= 'LoginRadius.util.ready( function() { $i = $SS.Interface.' . $interface . '; $SS.Providers.Top = ["' . $providers . '"]; $u = LoginRadius.user_settings;';
85
  $sharingScript .= '$u.apikey= \'' . trim($apiKey) . '\';';
86
  $sharingScript .= '$i.size = ' . $size . '; ' . $offset . ' if(typeof document.getElementsByName("viewport")[0] != "undefined"){$u.isMobileFriendly=true;}; $i.show( "loginRadiusVerticalSharing" ); } );';
87
  }
 
88
  return $sharingScript;
89
  }
90
 
91
  /**
92
- * function returns comma seperated counters lists
93
- *
94
- * global $loginRadiusSettings;
95
  */
96
- public function get_counter_providers($themeType, $loginRadiusSettings)
97
  {
98
  $searchOption = $themeType . 'CounterProvidersHidden';
99
  if (!empty($loginRadiusSettings[$searchOption])) {
100
- return str_replace(',', '","', $loginRadiusSettings[$searchOption]);
101
  } else {
102
  return 'Facebook Like","Google+ +1","Pinterest Pin it","LinkedIn Share","Hybridshare';
103
  }
@@ -108,26 +139,41 @@ class Loginradius_Sociallogin_Block_Socialsharing extends Mage_Core_Block_Templa
108
  *
109
  * global $loginRadiusSettings;
110
  */
111
- public static function get_sharing_providers($themeType, $loginRadiusSettings)
112
  {
113
  $searchOption = $themeType . 'SharingProvidersHidden';
114
  if (!empty($loginRadiusSettings[$searchOption])) {
115
- return str_replace(',', '","', $loginRadiusSettings[$searchOption]);
116
  } else {
117
  return 'Facebook","Twitter","Pinterest","Print","Email';
118
  }
119
  }
120
 
 
 
 
 
 
121
  public function _prepareLayout()
122
  {
123
  return parent::_prepareLayout();
124
  }
125
 
 
 
 
 
 
126
  public function getHorizontalSharingSettings()
127
  {
128
  return Mage::getStoreConfig('sociallogin_options/horizontalSharing');
129
  }
130
 
 
 
 
 
 
131
  public function getVerticalSharingSettings()
132
  {
133
  return Mage::getStoreConfig('sociallogin_options/verticalSharing');
@@ -135,13 +181,12 @@ class Loginradius_Sociallogin_Block_Socialsharing extends Mage_Core_Block_Templa
135
 
136
  /**
137
  * function returns script required for horizontal sharing.
138
- *
139
- * global $loginRadiusSettings;
140
  */
141
- public function login_radius_sharing_get_sharing_script_horizontal($loginRadiusSettings, $apikey)
142
  {
143
  $size = '';
144
  $sharingScript = '';
 
145
  $horizontalThemvalue = isset($loginRadiusSettings['horizontalSharingTheme']) ? $loginRadiusSettings['horizontalSharingTheme'] : '';
146
 
147
  switch ($horizontalThemvalue) {
@@ -165,6 +210,11 @@ class Loginradius_Sociallogin_Block_Socialsharing extends Mage_Core_Block_Templa
165
  $interface = 'simpleimage';
166
  break;
167
 
 
 
 
 
 
168
  case 'counter_vertical':
169
  $ishorizontal = 'true';
170
  $interface = 'simple';
@@ -182,13 +232,13 @@ class Loginradius_Sociallogin_Block_Socialsharing extends Mage_Core_Block_Templa
182
  $interface = 'horizontal';
183
  break;
184
  }
185
- if (!empty($ishorizontal)) {
186
- $providers = $this->get_counter_providers('horizontal', $loginRadiusSettings);
187
 
188
  // prepare counter script
189
  $sharingScript .= 'LoginRadius.util.ready( function() { $SC.Providers.Selected = ["' . $providers . '"]; $S = $SC.Interface.' . $interface . '; $S.isHorizontal = ' . $ishorizontal . '; $S.countertype = \'' . $countertype . '\'; $u = LoginRadius.user_settings; if(typeof document.getElementsByName("viewport")[0] != "undefined"){$u.isMobileFriendly=true;}; $S.show( "loginRadiusHorizontalSharing" ); } );';
190
  } else {
191
- $providers = $this->get_sharing_providers('horizontal', $loginRadiusSettings);
192
 
193
  // prepare sharing script
194
  $sharingScript .= 'LoginRadius.util.ready( function() { $i = $SS.Interface.' . $interface . '; $SS.Providers.Top = ["' . $providers . '"]; $u = LoginRadius.user_settings;';
@@ -197,11 +247,9 @@ class Loginradius_Sociallogin_Block_Socialsharing extends Mage_Core_Block_Templa
197
  }
198
  $sharingScript .= '$i.size = ' . $size . '; $u.sharecounttype="url"; if(typeof document.getElementsByName("viewport")[0] != "undefined"){$u.isMobileFriendly=true;}; $i.show( "loginRadiusHorizontalSharing" ); } );';
199
  }
 
200
  return $sharingScript;
201
  }
202
 
203
- protected function _construct()
204
- {
205
- parent::_construct();
206
- }
207
  }
1
  <?php
2
+
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * sociallogin socialsharing block
17
+ *
18
+ * @category Loginradius
19
+ * @package Loginradius_Sociallogin
20
+ * @author LoginRadius Team
21
+ */
22
+
23
+ /**
24
+ * Class Loginradius_Sociallogin_Block_Socialsharing which is responsible for generating social sharing script according to configuration!
25
+ */
26
  class Loginradius_Sociallogin_Block_Socialsharing extends Mage_Core_Block_Template
27
  {
28
+ /**
29
+ * Calling constructor for parent class
30
+ */
31
+ public function _construct()
32
+ {
33
+ parent::_construct();
34
+ }
35
+
36
  /**
37
  * function returns script required for vertical sharing.
 
 
38
  */
39
+ public function getVerticalSharingScript($loginRadiusSettings, $apiKey)
40
  {
41
+ $size = '';
42
  $sharingScript = '';
43
+ $type = '';
44
  $verticalThemvalue = isset($loginRadiusSettings['verticalSharingTheme']) ? $loginRadiusSettings['verticalSharingTheme'] : '';
45
 
46
  switch ($verticalThemvalue) {
107
 
108
  $offset = '$' . $sharingVariable . '.' . $position1 . ' = \'0px\'; $' . $sharingVariable . '.' . $position2 . ' = \'0px\';';
109
 
110
+ if (isset($size) && empty($size)) {
111
+ $providers = $this->getCounterProviders('vertical', $loginRadiusSettings);
112
  $sharingScript .= 'LoginRadius.util.ready( function() { $SC.Providers.Selected = ["' . $providers . '"]; $S = $SC.Interface.' . $interface . '; $S.isHorizontal = ' . $ishorizontal . '; $S.countertype = \'' . $type . '\'; ' . $offset . ' $u = LoginRadius.user_settings; if(typeof document.getElementsByName("viewport")[0] != "undefined"){$u.isMobileFriendly=true;}; $S.show( "loginRadiusVerticalSharing" ); } );';
113
  } else {
114
+ $providers = self:: getSharingProviders('vertical', $loginRadiusSettings);
115
  // prepare sharing script
116
  $sharingScript .= 'LoginRadius.util.ready( function() { $i = $SS.Interface.' . $interface . '; $SS.Providers.Top = ["' . $providers . '"]; $u = LoginRadius.user_settings;';
117
  $sharingScript .= '$u.apikey= \'' . trim($apiKey) . '\';';
118
  $sharingScript .= '$i.size = ' . $size . '; ' . $offset . ' if(typeof document.getElementsByName("viewport")[0] != "undefined"){$u.isMobileFriendly=true;}; $i.show( "loginRadiusVerticalSharing" ); } );';
119
  }
120
+
121
  return $sharingScript;
122
  }
123
 
124
  /**
125
+ * function returns comma separated counters lists
 
 
126
  */
127
+ public function getCounterProviders($themeType, $loginRadiusSettings)
128
  {
129
  $searchOption = $themeType . 'CounterProvidersHidden';
130
  if (!empty($loginRadiusSettings[$searchOption])) {
131
+ return str_replace(',', '","', $loginRadiusSettings[$searchOption]);
132
  } else {
133
  return 'Facebook Like","Google+ +1","Pinterest Pin it","LinkedIn Share","Hybridshare';
134
  }
139
  *
140
  * global $loginRadiusSettings;
141
  */
142
+ public static function getSharingProviders($themeType, $loginRadiusSettings)
143
  {
144
  $searchOption = $themeType . 'SharingProvidersHidden';
145
  if (!empty($loginRadiusSettings[$searchOption])) {
146
+ return str_replace(',', '","', $loginRadiusSettings[$searchOption]);
147
  } else {
148
  return 'Facebook","Twitter","Pinterest","Print","Email';
149
  }
150
  }
151
 
152
+ /**
153
+ * Override _prepareLayout method
154
+ *
155
+ * @return Mage_Core_Block_Abstract|void
156
+ */
157
  public function _prepareLayout()
158
  {
159
  return parent::_prepareLayout();
160
  }
161
 
162
+ /**
163
+ * Get all horizontal sharing configuration options
164
+ *
165
+ * @return mixed
166
+ */
167
  public function getHorizontalSharingSettings()
168
  {
169
  return Mage::getStoreConfig('sociallogin_options/horizontalSharing');
170
  }
171
 
172
+ /**
173
+ * Get all vertical sharing configuration options
174
+ *
175
+ * @return mixed
176
+ */
177
  public function getVerticalSharingSettings()
178
  {
179
  return Mage::getStoreConfig('sociallogin_options/verticalSharing');
181
 
182
  /**
183
  * function returns script required for horizontal sharing.
 
 
184
  */
185
+ public function getHorizontalSharingScript($loginRadiusSettings, $apikey)
186
  {
187
  $size = '';
188
  $sharingScript = '';
189
+ $countertype = '';
190
  $horizontalThemvalue = isset($loginRadiusSettings['horizontalSharingTheme']) ? $loginRadiusSettings['horizontalSharingTheme'] : '';
191
 
192
  switch ($horizontalThemvalue) {
210
  $interface = 'simpleimage';
211
  break;
212
 
213
+ case 'responsive':
214
+ $size = '32';
215
+ $interface = 'responsive';
216
+ break;
217
+
218
  case 'counter_vertical':
219
  $ishorizontal = 'true';
220
  $interface = 'simple';
232
  $interface = 'horizontal';
233
  break;
234
  }
235
+ if (isset($ishorizontal) && !empty($ishorizontal)) {
236
+ $providers = $this->getCounterProviders('horizontal', $loginRadiusSettings);
237
 
238
  // prepare counter script
239
  $sharingScript .= 'LoginRadius.util.ready( function() { $SC.Providers.Selected = ["' . $providers . '"]; $S = $SC.Interface.' . $interface . '; $S.isHorizontal = ' . $ishorizontal . '; $S.countertype = \'' . $countertype . '\'; $u = LoginRadius.user_settings; if(typeof document.getElementsByName("viewport")[0] != "undefined"){$u.isMobileFriendly=true;}; $S.show( "loginRadiusHorizontalSharing" ); } );';
240
  } else {
241
+ $providers = $this->getSharingProviders('horizontal', $loginRadiusSettings);
242
 
243
  // prepare sharing script
244
  $sharingScript .= 'LoginRadius.util.ready( function() { $i = $SS.Interface.' . $interface . '; $SS.Providers.Top = ["' . $providers . '"]; $u = LoginRadius.user_settings;';
247
  }
248
  $sharingScript .= '$i.size = ' . $size . '; $u.sharecounttype="url"; if(typeof document.getElementsByName("viewport")[0] != "undefined"){$u.isMobileFriendly=true;}; $i.show( "loginRadiusHorizontalSharing" ); } );';
249
  }
250
+
251
  return $sharingScript;
252
  }
253
 
254
+
 
 
 
255
  }
app/code/community/Loginradius/Sociallogin/Block/Verticalsharing.php CHANGED
@@ -1,4 +1,28 @@
1
  <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  class Loginradius_Sociallogin_Block_Verticalsharing extends Mage_Core_Block_Template implements Mage_Widget_Block_Interface
3
  {
4
  private $loginRadiusVerticalSharing;
@@ -8,15 +32,26 @@ class Loginradius_Sociallogin_Block_Verticalsharing extends Mage_Core_Block_Temp
8
  $this->loginRadiusVerticalSharing = new Loginradius_Sociallogin_Block_Sociallogin();
9
  }
10
 
 
 
 
 
 
11
  protected function _toHtml()
12
  {
13
  $content = "";
14
  if ($this->loginRadiusVerticalSharing->verticalShareEnable() == "1") {
15
  $content = "<div class='loginRadiusVerticalSharing'></div>";
16
  }
 
17
  return $content;
18
  }
19
 
 
 
 
 
 
20
  protected function _prepareLayout()
21
  {
22
  parent::_prepareLayout();
1
  <?php
2
+
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * sociallogin verticalsharing block
17
+ *
18
+ * @category Loginradius
19
+ * @package Loginradius_Sociallogin
20
+ * @author LoginRadius Team
21
+ */
22
+
23
+ /**
24
+ * Class Loginradius_Sociallogin_Block_Verticalalsharing which is responsible for vertical social sharing interface generation.
25
+ */
26
  class Loginradius_Sociallogin_Block_Verticalsharing extends Mage_Core_Block_Template implements Mage_Widget_Block_Interface
27
  {
28
  private $loginRadiusVerticalSharing;
32
  $this->loginRadiusVerticalSharing = new Loginradius_Sociallogin_Block_Sociallogin();
33
  }
34
 
35
+ /**
36
+ * Used to get vertical social sharing container
37
+ *
38
+ * @return string
39
+ */
40
  protected function _toHtml()
41
  {
42
  $content = "";
43
  if ($this->loginRadiusVerticalSharing->verticalShareEnable() == "1") {
44
  $content = "<div class='loginRadiusVerticalSharing'></div>";
45
  }
46
+
47
  return $content;
48
  }
49
 
50
+ /**
51
+ * Override _prepareLayout method
52
+ *
53
+ * @return Mage_Core_Block_Abstract|void
54
+ */
55
  protected function _prepareLayout()
56
  {
57
  parent::_prepareLayout();
app/code/community/Loginradius/Sociallogin/Helper/Adminhelper.php DELETED
@@ -1,67 +0,0 @@
1
- <?php
2
- /**
3
- * Created by PhpStorm.
4
- * User: nyaconcept
5
- * Date: 11/17/14
6
- * Time: 12:33 PM
7
- */
8
-
9
- class Loginradius_Sociallogin_Helper_AdminHelper extends Mage_Core_Helper_Abstract
10
- {
11
- public function loginRadiusApiClient($ValidateUrl, $data)
12
- {
13
- if ($this->getApiMethod()) {
14
- $response = $this->curlApiMethod($ValidateUrl, $data);
15
- } else {
16
- $response = $this->fsockopenApiMethod($ValidateUrl, $data);
17
- }
18
- $message = isset($response->Messages[0]) ? trim($response->Messages[0]) : '';
19
- switch ($message) {
20
- case 'API_KEY_NOT_VALID':
21
- $results['status'] = "error";
22
- $results['message'] = JText::_('COM_SOCIALLOGIN_SAVE_SETTING_ERROR_ONE') . " <a href='http://www.loginradius.com' target='_blank'>LoginRadius</a>";
23
- break;
24
- case 'API_SECRET_NOT_VALID':
25
- $results['status'] = "error";
26
- $results['message'] = JText::_('COM_SOCIALLOGIN_SAVE_SETTING_ERROR_TWO') . " <a href='http://www.loginradius.com' target='_blank'>LoginRadius</a>";
27
- break;
28
- case 'API_KEY_NOT_FORMATED':
29
- $results['status'] = "error";
30
- $results['message'] = JText::_('COM_SOCIALLOGIN_SAVE_SETTING_ERROR_THREE');
31
- break;
32
- case 'API_SECRET_NOT_FORMATED':
33
- $results['status'] = "error";
34
- $results['message'] = JText::_('COM_SOCIALLOGIN_SAVE_SETTING_ERROR_FOUR');
35
- break;
36
- default:
37
- $results['status'] = "message";
38
- $results['message'] = JText::_('COM_SOCIALLOGIN_SETTING_SAVED');
39
- break;
40
- }
41
- return $results;
42
- }
43
-
44
- private function fsockopenApiMethod($ValidateUrl, $data)
45
- {
46
- if (!empty($data)) {
47
- $options = array('http' => array('method' => 'POST', 'timeout' => 15, 'header' => 'Content-type: application/x-www-form-urlencoded', 'content' => $data));
48
- $context = stream_context_create($options);
49
- } else {
50
- $context = null;
51
- }
52
- $jsonResponse = @file_get_contents($ValidateUrl, false, $context);
53
-
54
- if (strpos(@$http_response_header[0], "400") !== false
55
- || strpos(@$http_response_header[0], "401") !== false
56
- || strpos(@$http_response_header[0], "403") !== false
57
- || strpos(@$http_response_header[0], "404") !== false
58
- || strpos(@$http_response_header[0], "500") !== false
59
- || strpos(@$http_response_header[0], "503") !== false
60
- ) {
61
- return JTEXT::_('COM_SOCIALLOGIN_SERVICE_AND_TIMEOUT_ERROR');
62
- } else {
63
- return json_decode($jsonResponse);
64
- }
65
- }
66
-
67
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Loginradius/Sociallogin/Helper/Data.php CHANGED
@@ -1,30 +1,61 @@
1
  <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  class Loginradius_Sociallogin_Helper_Data extends Mage_Core_Helper_Abstract
3
  {
 
4
  /**
5
- * Returns whether the Enabled config variable is set to true
6
  *
7
- * @return bool
 
 
 
 
 
8
  */
9
- public function isSocialloginEnabled()
10
  {
11
- if (Mage::getStoreConfig('sociallogin_options/messages/enabled') == '1') {
12
- return true;
13
- }
14
- return false;
 
 
 
15
  }
16
 
 
 
 
 
 
17
  public function isCurlEnabled()
18
  {
19
  return function_exists('curl_version') ? '1' : '0';
20
  }
21
 
22
- public function isCustomerAlreadyLoggedIn()
23
- {
24
- if (Mage::getSingleton('customer/session')->isLoggedIn()) {
25
- return true;
26
- }
27
- return false;
28
- }
29
 
30
  }
1
  <?php
2
+
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * sociallogin data helper
17
+ *
18
+ * @category Loginradius
19
+ * @package Loginradius_Sociallogin
20
+ * @author LoginRadius Team
21
+ */
22
+
23
+ /**
24
+ * Class Loginradius_Sociallogin_Helper_Data which is default helper for loginradius module and contains function related to session
25
+ */
26
  class Loginradius_Sociallogin_Helper_Data extends Mage_Core_Helper_Abstract
27
  {
28
+
29
  /**
30
+ * Setting the parameter values in session before displaying popup.
31
  *
32
+ * @param string $loginRadiusPopupTxt
33
+ * @param string $socialLoginMsg
34
+ * @param bool $loginRadiusShowForm
35
+ * @param array $profileData
36
+ * @param bool $emailRequired
37
+ * @param bool $hideZipcode
38
  */
39
+ public function setTmpSession($loginRadiusPopupTxt = '', $socialLoginMsg = "", $loginRadiusShowForm = true, $profileData = array(), $emailRequired = true, $hideZipcode = false)
40
  {
41
+
42
+ Mage::getSingleton('core/session')->setTmpPopupTxt($loginRadiusPopupTxt);
43
+ Mage::getSingleton('core/session')->setTmpPopupMsg($socialLoginMsg);
44
+ Mage::getSingleton('core/session')->setTmpShowForm($loginRadiusShowForm);
45
+ Mage::getSingleton('core/session')->setTmpProfileData($profileData);
46
+ Mage::getSingleton('core/session')->setTmpEmailRequired($emailRequired);
47
+ Mage::getSingleton('core/session')->setTmpHideZipcode($hideZipcode);
48
  }
49
 
50
+ /**
51
+ * Check if curl is enabled or not!
52
+ *
53
+ * @return bool
54
+ */
55
  public function isCurlEnabled()
56
  {
57
  return function_exists('curl_version') ? '1' : '0';
58
  }
59
 
 
 
 
 
 
 
 
60
 
61
  }
app/code/community/Loginradius/Sociallogin/Helper/LoginRadiusSDK.php DELETED
@@ -1,125 +0,0 @@
1
- <?php
2
-
3
- // Define LoginRadius domain
4
- define('LR_DOMAIN', 'api.loginradius.com');
5
-
6
- class Loginradius_Sociallogin_Helper_LoginRadiusSDK extends Mage_Core_Helper_Abstract
7
- {
8
- /**
9
- * LoginRadius function - It validate against GUID format of keys.
10
- *
11
- * @param string $key data to validate.
12
- *
13
- * @return boolean. If valid - true, else - false.
14
- */
15
- public function loginradiusValidateKey($key)
16
- {
17
- if (empty($key) || !preg_match('/^\{?[A-Z0-9]{8}-[A-Z0-9]{4}-[A-Z0-9]{4}-[A-Z0-9]{4}-[A-Z0-9]{12}\}?$/i', $key)) {
18
- return false;
19
- } else {
20
- return true;
21
- }
22
- }
23
-
24
- /**
25
- * LoginRadius function - To fetch social profile data from the user's social account after authentication. The social profile will be retrieved via oAuth and OpenID protocols. The data is normalized into LoginRadius' standard data format.
26
- *
27
- * @param string $accessToken LoginRadius access token
28
- * @param boolean $raw If true, raw data is fetched
29
- *
30
- * @return object User profile data.
31
- */
32
- public function fetchUserProfile($accessToken, $raw = false)
33
- {
34
- $ValidateUrl = 'https://' . LR_DOMAIN . '/api/v2/userprofile?access_token=' . $accessToken;
35
- if ($raw) {
36
- $ValidateUrl = 'https://' . LR_DOMAIN . '/api/v2/userprofile/raw?access_token=' . $accessToken;
37
- return $this->accessLoginradiusApi($ValidateUrl);
38
- }
39
- return $this->accessLoginradiusApi($ValidateUrl);
40
- }
41
-
42
- public function accessLoginradiusApi($url, $data = array(), $isPost = false)
43
- {
44
-
45
- if (Mage::helper('sociallogin')->isCurlEnabled()) {
46
- $JsonResponse = $this->curlApiMethod($url, $data, $isPost );
47
- } else {
48
- $JsonResponse = $this->fsockopenApiMethod($url, $data, $isPost);
49
- }
50
- $result = json_decode($JsonResponse);
51
- if (is_object($result) && isset($result->customError)) {
52
- $method = 'GET';
53
-
54
- $client = new Varien_Http_Client($url);
55
- $response = $client->request($method);
56
- $Response = $response->getBody();
57
- return $Response;
58
-
59
- }
60
- return $JsonResponse;
61
-
62
- }
63
-
64
- public function curlApiMethod($url, $data, $post = false)
65
- {
66
- $curl_handle = curl_init();
67
- curl_setopt($curl_handle, CURLOPT_URL, $url);
68
- curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 50);
69
- curl_setopt($curl_handle, CURLOPT_TIMEOUT, 50);
70
- curl_setopt($curl_handle, CURLOPT_SSL_VERIFYPEER, false);
71
- if ($post) {
72
- curl_setopt($curlHandle, CURLOPT_POST, 1);
73
- curl_setopt($curlHandle, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded'));
74
- curl_setopt($curlHandle, CURLOPT_POSTFIELDS, http_build_query($data));
75
- }
76
- if (ini_get('open_basedir') == '' && (ini_get('safe_mode') == 'Off' or !ini_get('safe_mode'))) {
77
- curl_setopt($curl_handle, CURLOPT_FOLLOWLOCATION, 1);
78
- curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, true);
79
- } else {
80
- curl_setopt($curl_handle, CURLOPT_HEADER, 1);
81
- $url = curl_getinfo($curl_handle, CURLINFO_EFFECTIVE_URL);
82
- curl_close($curl_handle);
83
- $curl_handle = curl_init();
84
- $url = str_replace('?', '/?', $url);
85
- curl_setopt($curl_handle, CURLOPT_URL, $url);
86
- curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, true);
87
- }
88
- $JsonResponse = curl_exec($curl_handle);
89
- $httpCode = curl_getinfo($curl_handle, CURLINFO_HTTP_CODE);
90
- if (in_array($httpCode, array(400, 401, 403, 404, 500, 503))) {
91
- $JsonResponse = json_encode(array("customError" => true, "Messages" => "Error in using curl connection ,Service connection error occurred"));
92
- } else {
93
- if (curl_errno($curl_handle) == 28) {
94
- $JsonResponse = json_encode(array("customError" => true, "Messages" => "Connection timeout"));
95
- }
96
- }
97
- curl_close($curl_handle);
98
- return $JsonResponse;
99
- }
100
-
101
- public function fsockopenApiMethod($ValidateUrl, $data, $post = false)
102
- {
103
- if (!empty($data)) {
104
- $options = array('http' => array('method' => 'POST', 'timeout' => 15, 'header' => 'Content-type: application/x-www-form-urlencoded', 'content' => $data));
105
- $context = stream_context_create($options);
106
- } else {
107
- $context = null;
108
- }
109
- $jsonResponse = @file_get_contents($ValidateUrl, false, $context);
110
- if (strpos(@$http_response_header[0], "400") !== false
111
- || strpos(@$http_response_header[0], "401") !== false
112
- || strpos(@$http_response_header[0], "403") !== false
113
- || strpos(@$http_response_header[0], "404") !== false
114
- || strpos(@$http_response_header[0], "500") !== false
115
- || strpos(@$http_response_header[0], "503") !== false
116
- ) {
117
- $jsonResponse = json_encode(array("customError" => true, "Messages" => "Error in using FSOCKOPEN connection method, Service connection timeout occurred"));
118
- }
119
- if (!$jsonResponse) {
120
- $jsonResponse = json_encode(array("customError" => true, "Messages" => "FSOCKOPEN not working"));
121
- }
122
- return $jsonResponse;
123
- }
124
-
125
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Loginradius/Sociallogin/Helper/Loginhelper.php CHANGED
@@ -1,269 +1,579 @@
1
  <?php
2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
 
4
- class Loginradius_Sociallogin_Helper_Loginhelper extends Mage_Core_Helper_Abstract {
5
- public function loginRadiusRead($table, $handle, $params, $result = FALSE) {
6
- $socialLoginConn = Mage::getSingleton('core/resource')->getConnection('core_read');
7
- $Tbl = $this->getMazeTable($table);
8
- $customerTable = $this->getMazeTable('customer_entity');
9
- $websiteId = Mage::app()->getWebsite()->getId();
10
- $storeId = Mage::app()->getStore()->getId();
11
- $query = "";
12
- switch ($handle) {
13
- case "email exists pop1":
14
- $query = "select entity_id from $Tbl where email = '" . $params[0] . "' and website_id = $websiteId and store_id = $storeId";
15
- break;
16
- case "get_user_by_social_id":
17
- $query = "SELECT $Tbl.entity_id, verified from $Tbl JOIN $customerTable ON $customerTable.entity_id = $Tbl.entity_id WHERE $Tbl.sociallogin_id = '" . $params[0] . "'";
18
- break;
19
- case "get_user_from_customer_entity":
20
- $query = "select entity_id from $Tbl where entity_id = " . $params[0] . " and website_id = $websiteId";
21
- break;
22
- case "email_already_exists":
23
- $query = "select * from $Tbl where email = '" . $params[0] . "' and website_id = $websiteId";
24
- break;
25
- case "email exists sl":
26
- $query = "select verified,sociallogin_id from $Tbl where entity_id = '" . $params[0] . "' and provider = '" . $params[1] . "'";
27
- break;
28
- case "provider exists in sociallogin":
29
- $query = "select entity_id from $Tbl where entity_id = '" . $params[0] . "' and provider = '" . $params[1] . "'";
30
- break;
31
- case "verification":
32
- $query = "select entity_id, provider from $Tbl where vkey = '" . $params[0] . "'";
33
- break;
34
- case "verification2":
35
- $query = "select entity_id from $Tbl where entity_id = " . $params[0] . " and provider = '" . $params[1] . "' and vkey != '' ";
36
- break;
37
- }
38
- $select = $socialLoginConn->query($query);
39
- if ($result) {
40
- return $select;
41
- }
42
- if ($select->fetch()) {
43
- return TRUE;
44
- }
45
- return FALSE;
46
- }
47
-
48
- public function getMazeTable($tbl) {
49
- $tableName = Mage::getSingleton('core/resource')->getTableName($tbl);
50
- return ($tableName);
51
- }
52
-
53
- /**
54
- * Validate url.
55
- */
56
- public function loginRadiusValidateUrl($url) {
57
- $validUrlExpression = "/^(http:\/\/|https:\/\/|ftp:\/\/|ftps:\/\/|)?[a-z0-9_\-]+[a-z0-9_\-\.]+\.[a-z]{2,4}(\/+[a-z0-9_\.\-\/]*)?$/i";
58
- return (bool) preg_match($validUrlExpression, $url);
59
- }
60
-
61
- public function generateRandomEmail($userObject) {
62
- switch ($userObject->Provider) {
63
- case 'twitter':
64
- case 'linkedin':
65
- $email = $userObject->ID . '@' . $userObject->Provider . '.com';
66
- break;
67
- default:
68
- $Email_id = substr($userObject->ID, 7);
69
- $Email_id2 = str_replace("/", "_", $Email_id);
70
- $email = str_replace(".", "_", $Email_id2) . '@' . $userObject->Provider . '.com';
71
- break;
72
- }
73
- return $email;
74
- }
75
-
76
- public function verifyUser($slId, $entityId, $avatar, $provider, $email,$sendAdminEmail = false,$loginRadiusUsername = '') {
77
-
78
- $this->blockObj = new Loginradius_Sociallogin_Block_Sociallogin();
79
- $vKey = md5(uniqid(rand(), TRUE));
80
- $data = array();
81
- $data['sociallogin_id'] = $slId;
82
- $data['entity_id'] = $entityId;
83
- $data['avatar'] = $avatar;
84
- $data['verified'] = "0";
85
- $data['vkey'] = $vKey;
86
- $data['provider'] = $provider;
87
- // insert details in sociallogin table
88
- $this->SocialLoginInsert("sociallogin", $data);
89
- // send verification mail
90
- $message = __(Mage::helper('core')->htmlEscape(trim($this->blockObj->verificationText())));
91
- if ($message == "") {
92
- $message = __("Please click on the following link or paste it in browser to verify your email");
93
- }
94
- $message .= "<br/>" . Mage::getBaseUrl() . "sociallogin/?loginRadiusKey=" . $vKey;
95
- $this->loginRadiusEmail(__("Email verification"), $message, $email, $email);
96
- if($sendAdminEmail){
97
- $loginRadiusAdminEmail = Mage::getStoreConfig('trans_email/ident_general/email');
98
- $loginRadiusAdminName = Mage::getStoreConfig('trans_email/ident_general/name');
99
- $loginRadiusMessage = trim($this->blockObj->notifyAdminText());
100
- if ($loginRadiusMessage == "") {
101
- $loginRadiusMessage = __("New customer has been registered to your store with following details");
102
- }
103
- $loginRadiusMessage .= "<br/>" . __("Name") . " : " . $loginRadiusUsername . "<br/>" . __("Email") . " : " . $email;
104
- Mage::helper('sociallogin/loginhelper')->loginRadiusEmail(__("New User Registration"), $loginRadiusMessage, $loginRadiusAdminEmail, $loginRadiusAdminName);
105
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
106
  }
107
- $session = Mage::getSingleton('customer/session');
108
- $session->addSuccess(__('Confirmation link has been sent to your email address. Please verify your email by clicking on confirmation link.'));
109
-
110
- header("Location:" . Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK));
111
- die;
112
- }
113
-
114
- public function SocialLoginInsert($lrTable, $lrInsertData, $update = FALSE, $value = '') {
115
- $connection = Mage::getSingleton('core/resource')->getConnection('core_write');
116
- $connection->beginTransaction();
117
- $sociallogin = $this->getMazeTable($lrTable);
118
- if (!$update) {
119
- $connection->insert($sociallogin, $lrInsertData);
120
- }
121
- else {
122
- // update query magento way
123
- $connection->update(
124
- $sociallogin, $lrInsertData, $value
125
- );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
126
  }
127
- $connection->commit();
128
- }
129
-
130
- public function loginRadiusEmail($subject, $message, $to, $toName) {
131
- $storeName = Mage::app()->getStore()->getGroup()->getName();
132
- $mail = new Zend_Mail('UTF-8'); //class for mail
133
- $mail->setBodyHtml($message); //for sending message containing html code
134
- $mail->setFrom("Owner", $storeName);
135
- $mail->addTo($to, $toName);
136
- $mail->setSubject($subject);
137
- try {
138
- $mail->send();
139
- } catch (Exception $ex) {
140
  }
141
- }
142
-
143
- public function setTmpSession($loginRadiusPopupTxt = '', $socialLoginMsg = "", $loginRadiusShowForm = TRUE, $profileData = array(), $emailRequired = TRUE, $hideZipcode = FALSE) {
144
- Mage::getSingleton('core/session')->setTmpPopupTxt($loginRadiusPopupTxt);
145
- Mage::getSingleton('core/session')->setTmpPopupMsg($socialLoginMsg);
146
- Mage::getSingleton('core/session')->setTmpShowForm($loginRadiusShowForm);
147
- Mage::getSingleton('core/session')->setTmpProfileData($profileData);
148
- Mage::getSingleton('core/session')->setTmpEmailRequired($emailRequired);
149
- Mage::getSingleton('core/session')->setTmpHideZipcode($hideZipcode);
150
- }
151
-
152
- function setInSession($id, $socialloginProfileData) {
153
- $socialloginProfileData['lrId'] = $id;
154
- Mage::getSingleton('core/session')->setSocialLoginData($socialloginProfileData);
155
- }
156
-
157
- public function socialLoginFilterData($userObject) {
158
- //My code ends
159
- $profileDataFiltered = array();
160
- $profileDataFiltered['Email'] = isset($userObject->Email[0]->Value) ? $userObject->Email[0]->Value : '';
161
- $profileDataFiltered['Provider'] = empty($userObject->Provider) ? "" : $userObject->Provider;
162
- $profileDataFiltered['FirstName'] = empty($userObject->FirstName) ? "" : $userObject->FirstName;
163
- $profileDataFiltered['FullName'] = empty($userObject->FullName) ? "" : $userObject->FullName;
164
- $profileDataFiltered['NickName'] = empty($userObject->NickName) ? "" : $userObject->NickName;
165
- $profileDataFiltered['LastName'] = empty($userObject->LastName) ? "" : $userObject->LastName;
166
- if (isset($userObject->Addresses) && is_array($userObject->Addresses)) {
167
- foreach ($userObject->Addresses as $address) {
168
- if (isset($address->Address1) && !empty($address->Address1)) {
169
- $profileDataFiltered['Address'] = $address->Address1;
170
- break;
171
  }
172
- }
173
  }
174
- elseif (isset($userObject->Addresses) && is_string($userObject->Addresses)) {
175
- $profileDataFiltered['Address'] = isset($userObject->Addresses) && $userObject->Addresses != "" ? $userObject->Addresses : "";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
176
  }
177
- else {
178
- $profileDataFiltered['Address'] = "";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
179
  }
180
- $profileDataFiltered['PhoneNumber'] = empty($userObject->PhoneNumbers['0']->PhoneNumber) ? "" : $userObject->PhoneNumbers['0']->PhoneNumber;
181
- $profileDataFiltered['State'] = empty($userObject->State) ? "" : $userObject->State;
182
- $profileDataFiltered['City'] = empty($userObject->City) || $userObject->City == "unknown" ? "" : $userObject->City;
183
- $profileDataFiltered['Industry'] = empty($userObject->Positions['0']->Comapny->Name) ? "" : $userObject->Positions['0']->Comapny->Name;
184
- if (isset($userObject->Country->Code) && is_string($userObject->Country->Code)) {
185
- $profileDataFiltered['Country'] = $userObject->Country->Code;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
186
  }
187
- else {
188
- $profileDataFiltered['Country'] = "";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
189
  }
190
- $profileDataFiltered['thumbnail'] = $this->socialLoginFilterAvatar($userObject->ID, $userObject->ThumbnailImageUrl, $profileDataFiltered['Provider']);
191
-
192
-
193
- if (empty($profileDataFiltered['FirstName'])) {
194
- if (!empty($profileDataFiltered['FullName'])) {
195
- $profileDataFiltered['FirstName'] = $profileDataFiltered['FullName'];
196
- }
197
- elseif (!empty($profileDataFiltered['ProfileName'])) {
198
- $profileDataFiltered['FirstName'] = $profileDataFiltered['ProfileName'];
199
- }
200
- elseif (!empty($profileDataFiltered['NickName'])) {
201
- $profileDataFiltered['FirstName'] = $profileDataFiltered['NickName'];
202
- }
203
- elseif (!empty($email)) {
204
- $user_name = explode('@', $email);
205
- $profileDataFiltered['FirstName'] = str_replace("_", " ", $user_name[0]);
206
- }
207
- else {
208
- $profileDataFiltered['FirstName'] = $userObject->ID;
209
- }
210
  }
211
 
212
- $profileDataFiltered['Gender'] = (!empty($userObject->Gender) ? $userObject->Gender : '');
213
- if (strtolower(substr($profileDataFiltered['Gender'], 0, 1)) == 'm') {
214
- $profileDataFiltered['Gender'] = '1';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
215
  }
216
- elseif (strtolower(substr($profileDataFiltered['Gender'], 0, 1)) == 'f') {
217
- $profileDataFiltered['Gender'] = '2';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
218
  }
219
- else {
220
- $profileDataFiltered['Gender'] = '';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
221
  }
222
- $profileDataFiltered['BirthDate'] = (!empty($userObject->BirthDate) ? $userObject->BirthDate : '');
223
- if ($profileDataFiltered['BirthDate'] != "") {
224
- switch ($profileDataFiltered['Provider']) {
225
- case 'facebook':
226
- case 'foursquare':
227
- case 'yahoo':
228
- case 'openid':
229
- break;
230
-
231
- case 'google':
232
- $temp = explode('/', $profileDataFiltered['BirthDate']); // yy/mm/dd
233
- $profileDataFiltered['BirthDate'] = $temp[1] . "/" . $temp[2] . "/" . $temp[0];
234
- break;
235
-
236
- case 'twitter':
237
- case 'linkedin':
238
- case 'vkontakte':
239
- case 'live';
240
- $temp = explode('/', $profileDataFiltered['BirthDate']); // dd/mm/yy
241
- $profileDataFiltered['BirthDate'] = $temp[1] . "/" . $temp[0] . "/" . $temp[2];
242
- break;
243
- }
244
  }
245
- return $profileDataFiltered;
246
- }
247
 
248
- public function socialLoginFilterAvatar($id, $ImgUrl, $provider) {
249
- $thumbnail = (!empty($ImgUrl) ? trim($ImgUrl) : '');
250
- if (empty($thumbnail) && ($provider == 'facebook')) {
251
- $thumbnail = "http://graph.facebook.com/" . $id . "/picture?type=large";
 
 
 
 
 
 
252
  }
253
- return $thumbnail;
254
- }
255
-
256
- public function loginRadiusRedirect($url) {
257
- ?>
258
- <script>
259
- if (window.opener) {
260
- window.opener.location.href = "<?php echo $url; ?>";
261
- window.close();
262
- } else {
263
- window.location.href = "<?php echo $url; ?>";
264
- }
265
- </script>
266
- <?php
267
- die;
268
- }
269
- }
1
  <?php
2
 
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * sociallogin loginhelper helper
17
+ *
18
+ * @category Loginradius
19
+ * @package Loginradius_Sociallogin
20
+ * @author LoginRadius Team
21
+ */
22
 
23
+ /**
24
+ * Class Loginradius_Sociallogin_Helper_LoginHelper which contains functions related tosocail login process functionality
25
+ */
26
+ class Loginradius_Sociallogin_Helper_Loginhelper extends Mage_Core_Helper_Abstract
27
+ {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
28
 
29
+ /**
30
+ * function responsible for customer registration and profile updation
31
+ *
32
+ * @param $socialloginProfileData
33
+ * @param bool $verify
34
+ * @param bool $update
35
+ * @param string $customerId
36
+ * @param bool $requiredFields
37
+ */
38
+ public function socialLoginAddNewUser($socialloginProfileData, $verify = false, $update = false, $customerId = '', $requiredFields = false)
39
+ {
40
+ $blockObject = new Loginradius_Sociallogin_Block_Sociallogin();
41
+ $websiteId = Mage::app()->getWebsite()->getId();
42
+ $store = Mage::app()->getStore();
43
+ if (!$update) {
44
+ $redirectionTo = 'Registration';
45
+ // add new user magento way
46
+ $customer = Mage::getModel("customer/customer");
47
+ } else {
48
+ $redirectionTo = 'Login';
49
+ $customer = Mage::getModel('customer/customer')->load($customerId);
50
+ }
51
+ $customer->website_id = $websiteId;
52
+ $customer->setStore($store);
53
+ if ($socialloginProfileData['FirstName'] != "") {
54
+ $customer->firstname = $socialloginProfileData['FirstName'];
55
+ }
56
+ if (!$update) {
57
+ $customer->lastname = $socialloginProfileData['LastName'] == "" ? $socialloginProfileData['FirstName'] : $socialloginProfileData['LastName'];
58
+ } elseif ($update && $socialloginProfileData['LastName'] != "") {
59
+ $customer->lastname = $socialloginProfileData['LastName'];
60
+ }
61
+ if (!$update) {
62
+ $customer->email = $socialloginProfileData['Email'];
63
+ $loginRadiusPwd = $customer->generatePassword(10);
64
+ $customer->password_hash = md5($loginRadiusPwd);
65
+ }
66
+ if ($socialloginProfileData['BirthDate'] != "") {
67
+ $customer->dob = $socialloginProfileData['BirthDate'];
68
+ }
69
+ if ($socialloginProfileData['Gender'] != "") {
70
+ $customer->gender = $socialloginProfileData['Gender'];
71
+ }
72
+ $customer->setConfirmation(null);
73
+ $customer->save();
74
+
75
+ $address = Mage::getModel("customer/address");
76
+ if (!$update) {
77
+ $address->setCustomerId($customer->getId());
78
+ }
79
+ if (!$update) {
80
+ $address->firstname = $customer->firstname;
81
+ $address->lastname = $customer->lastname;
82
+ $address->country_id = isset($socialloginProfileData['Country']) ? ucfirst($socialloginProfileData['Country']) : '';
83
+ if (isset($socialloginProfileData['Zipcode'])) {
84
+ $address->postcode = $socialloginProfileData['Zipcode'];
85
+ }
86
+ $address->city = isset($socialloginProfileData['City']) ? ucfirst($socialloginProfileData['City']) : '';
87
+ if (isset($socialloginProfileData['State']) && !empty($socialloginProfileData['State'])) {
88
+ $address->region = $socialloginProfileData['State'];
89
+ }
90
+ // If country is USA, set up province
91
+ if (isset($socialloginProfileData['Province'])) {
92
+ $address->region = $socialloginProfileData['Province'];
93
+ }
94
+ $address->telephone = isset($socialloginProfileData['PhoneNumber']) ? ucfirst($socialloginProfileData['PhoneNumber']) : '';
95
+ $address->company = isset($socialloginProfileData['Industry']) ? ucfirst($socialloginProfileData['Industry']) : '';
96
+ $address->street = isset($socialloginProfileData['Address']) ? ucfirst($socialloginProfileData['Address']) : '';
97
+ // set default billing, shipping address and save in address book
98
+ $address->setIsDefaultShipping('1')->setIsDefaultBilling('1')->setSaveInAddressBook('1');
99
+ if ($requiredFields) {
100
+ $address->save();
101
+ }
102
+ }
103
+ // add info in sociallogin table
104
+ if (!$verify) {
105
+ $fields = array();
106
+ $fields['sociallogin_id'] = $socialloginProfileData['lrId'];
107
+ $fields['entity_id'] = $customer->getId();
108
+ $fields['avatar'] = $socialloginProfileData['Thumbnail'];
109
+ $fields['provider'] = $socialloginProfileData['Provider'];
110
+ if (!$update) {
111
+ $this->SocialLoginInsert("sociallogin", $fields);
112
+ } else {
113
+ $this->SocialLoginInsert("sociallogin", array('avatar' => $socialloginProfileData['thumbnail']), true, array('entity_id = ?' => $customerId));
114
+ }
115
+ if (!$update) {
116
+ $loginRadiusUsername = $socialloginProfileData['FirstName'] . " " . $socialloginProfileData['LastName'];
117
+ // email notification to user
118
+ if ($blockObject->notifyUser() == "1") {
119
+ $loginRadiusMessage = $blockObject->notifyUserText();
120
+ if ($loginRadiusMessage == "") {
121
+ $loginRadiusMessage = __("Welcome to ") . $store->getGroup()->getName() . ". " . __("You can login to the store using following e-mail address and password");
122
+ }
123
+ $loginRadiusMessage .= "<br/>" . "Email : " . $socialloginProfileData['Email'] . "<br/>" . __("Password") . " : " . $loginRadiusPwd;
124
+
125
+ Mage::helper('sociallogin/loginhelper')->loginRadiusEmail(__("Welcome") . " " . $loginRadiusUsername . "!", $loginRadiusMessage, $socialloginProfileData['Email'], $loginRadiusUsername);
126
+ }
127
+ // new user notification to admin
128
+ if ($blockObject->notifyAdmin() == "1") {
129
+ $loginRadiusAdminEmail = Mage::getStoreConfig('trans_email/ident_general/email');
130
+ $loginRadiusAdminName = Mage::getStoreConfig('trans_email/ident_general/name');
131
+ $loginRadiusMessage = trim($blockObject->notifyAdminText());
132
+ if ($loginRadiusMessage == "") {
133
+ $loginRadiusMessage = __("New customer has been registered to your store with following details");
134
+ }
135
+ $loginRadiusMessage .= "<br/>" . __("Name") . " : " . $loginRadiusUsername . "<br/>" . __("Email") . " : " . $socialloginProfileData['Email'];
136
+ Mage::helper('sociallogin/loginhelper')->loginRadiusEmail(__("New User Registration"), $loginRadiusMessage, $loginRadiusAdminEmail, $loginRadiusAdminName);
137
+ }
138
+ }
139
+ //login and redirect user
140
+ $this->socialLoginUserLogin($customer->getId(), $fields['sociallogin_id'], $redirectionTo);
141
+ }
142
+ if ($verify) {
143
+ $loginRadiusUsername = $socialloginProfileData['FirstName'] . " " . $socialloginProfileData['LastName'];
144
+ Mage::helper('sociallogin/loginhelper')->verifyUser($socialloginProfileData['lrId'], $customer->getId(), $socialloginProfileData['Thumbnail'], $socialloginProfileData['Provider'], $socialloginProfileData['Email'], true, $loginRadiusUsername);
145
+ }
146
  }
147
+
148
+ /**
149
+ * function responsible for inserting or updating data in loginradius tables
150
+ *
151
+ * @param string $lrTable table name
152
+ * @param array $lrInsertData array of data to be inserted
153
+ * @param bool $update
154
+ * @param string $value result of insertion
155
+ *
156
+ * @return mixed
157
+ */
158
+ public function SocialLoginInsert($lrTable, $lrInsertData, $update = false, $value = '')
159
+ {
160
+ $connection = Mage::getSingleton('core/resource')->getConnection('core_write');
161
+ $connection->beginTransaction();
162
+ $sociallogin = $this->getMazeTable($lrTable);
163
+ if (!$update) {
164
+ try {
165
+ $connection->insert($sociallogin, $lrInsertData);
166
+ } catch (Exception $e) {
167
+ Mage::logException($e);
168
+
169
+ }
170
+
171
+ } else {
172
+ try {
173
+ // update query magento way
174
+ $connection->update(
175
+ $sociallogin, $lrInsertData, $value
176
+ );
177
+ } catch (Exception $e) {
178
+ Mage::logException($e);
179
+ }
180
+ }
181
+ $connection->commit();
182
  }
183
+
184
+ /**
185
+ * Create table name!
186
+ *
187
+ * @param $tbl
188
+ *
189
+ * @return mixed
190
+ */
191
+ public function getMazeTable($tbl)
192
+ {
193
+ $tableName = Mage::getSingleton('core/resource')->getTableName($tbl);
194
+
195
+ return ($tableName);
196
  }
197
+
198
+ /**
199
+ * Send email to specified to specified email address $to.
200
+ *
201
+ * @param string $subject
202
+ * @param string $message
203
+ * @param string $to
204
+ * @param string $toName
205
+ */
206
+ public function loginRadiusEmail($subject, $message, $to, $toName)
207
+ {
208
+ $storeName = Mage::app()->getStore()->getGroup()->getName();
209
+ $mail = new Zend_Mail('UTF-8'); //class for mail
210
+ $mail->setBodyHtml($message); //for sending message containing html code
211
+ $mail->setFrom("Owner", $storeName);
212
+ $mail->addTo($to, $toName);
213
+ $mail->setSubject($subject);
214
+ try {
215
+ $mail->send();
216
+ } catch (Exception $ex) {
217
+ Mage::logException($ex);
 
 
 
 
 
 
 
 
 
218
  }
 
219
  }
220
+
221
+ /**
222
+ * function responsible for providing login to customer
223
+ *
224
+ * @param $entityId customer entity id
225
+ * @param $socialId social id
226
+ * @param string $loginOrRegister is logging in after registration!
227
+ */
228
+ public function socialLoginUserLogin($entityId, $socialId, $loginOrRegister = 'Login')
229
+ {
230
+ $blockObj = new Loginradius_Sociallogin_Block_Sociallogin();
231
+ $session = Mage::getSingleton("customer/session");
232
+ $session->setloginRadiusId($socialId);
233
+ $customer = Mage::getModel('customer/customer')->load($entityId);
234
+ $customer->setWebsiteId(Mage::app()->getWebsite()->getId());
235
+ $session->setCustomerAsLoggedIn($customer);
236
+ $functionForRedirectOption = 'get' . $loginOrRegister . 'RedirectOption';
237
+ $Hover = $blockObj->$functionForRedirectOption();
238
+ $functionForCustomRedirectOption = 'getCustom' . $loginOrRegister . 'RedirectOption';
239
+ $write_url = $blockObj->$functionForCustomRedirectOption();
240
+ $url = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK);
241
+ // check if logged in from callback page
242
+ if (isset($_GET['loginradiuscheckout'])) {
243
+ $currentUrl = Mage::helper('checkout/url')->getCheckoutUrl();
244
+ Mage::app()->getResponse()->setRedirect($currentUrl)->sendResponse();
245
+ }
246
+ if ($Hover == 'account') {
247
+ $currentUrl = $url . 'customer/account';
248
+ } elseif ($Hover == 'index') {
249
+ $currentUrl = $url;
250
+ } elseif ($Hover == 'custom' && $write_url != '') {
251
+ $currentUrl = $write_url;
252
+ } elseif ($Hover == 'same') {
253
+ $currentUrl = Mage::helper('core/http')->getHttpReferer() ? Mage::helper('core/http')->getHttpReferer() : Mage::getUrl();
254
+ } else {
255
+ if (isset($_GET['redirect_to'])) {
256
+ $currentUrl = trim($_GET['redirect_to']);
257
+ } else {
258
+ $currentUrl = $url;
259
+ }
260
+
261
+ }
262
+ Mage::app()->getResponse()->setRedirect($currentUrl)->sendResponse();
263
  }
264
+
265
+ /**
266
+ * function handles customer email verification and displays appropriate message
267
+ *
268
+ * @param $slId
269
+ * @param $entityId
270
+ * @param $avatar
271
+ * @param $provider
272
+ * @param $email
273
+ * @param $sendAdminEmail
274
+ * @param $loginRadiusUsername
275
+ */
276
+ public function verifyUser($slId, $entityId, $avatar, $provider, $email, $sendAdminEmail = false, $loginRadiusUsername = '')
277
+ {
278
+
279
+ $this->blockObj = new Loginradius_Sociallogin_Block_Sociallogin();
280
+ $vKey = md5(uniqid(rand(), true));
281
+ $data = array();
282
+ $data['sociallogin_id'] = $slId;
283
+ $data['entity_id'] = $entityId;
284
+ $data['avatar'] = $avatar;
285
+ $data['verified'] = "0";
286
+ $data['vkey'] = $vKey;
287
+ $data['provider'] = $provider;
288
+ // insert details in sociallogin table
289
+ $this->SocialLoginInsert("sociallogin", $data);
290
+ // send verification mail
291
+ $message = __(Mage::helper('core')->htmlEscape(trim($this->blockObj->verificationText())));
292
+ if ($message == "") {
293
+ $message = __("Please click on the following link or paste it in browser to verify your email");
294
+ }
295
+ $message .= "<br/>" . Mage::getBaseUrl() . "sociallogin/?loginRadiusKey=" . $vKey;
296
+ Mage::helper('sociallogin/loginhelper')->loginRadiusEmail(__("Email verification"), $message, $email, $email);
297
+
298
+ if ($sendAdminEmail) {
299
+ $loginRadiusAdminEmail = Mage::getStoreConfig('trans_email/ident_general/email');
300
+ $loginRadiusAdminName = Mage::getStoreConfig('trans_email/ident_general/name');
301
+ $loginRadiusMessage = trim($this->blockObj->notifyAdminText());
302
+ if ($loginRadiusMessage == "") {
303
+ $loginRadiusMessage = __("New customer has been registered to your store with following details");
304
+ }
305
+ $loginRadiusMessage .= "<br/>" . __("Name") . " : " . $loginRadiusUsername . "<br/>" . __("Email") . " : " . $email;
306
+ Mage::helper('sociallogin/loginhelper')->loginRadiusEmail(__("New User Registration"), $loginRadiusMessage, $loginRadiusAdminEmail, $loginRadiusAdminName);
307
+
308
+ }
309
+ $session = Mage::getSingleton('customer/session');
310
+ $session->addSuccess(__('Confirmation link has been sent to your email address. Please verify your email by clicking on confirmation link.'));
311
+ header("Location:" . Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK));
312
+ exit();
313
  }
314
+
315
+ /**
316
+ * Filter user profile data from loginradius api and return userprofile array
317
+ *
318
+ * @param object $userObject
319
+ *
320
+ * @return array
321
+ */
322
+ public function socialLoginFilterData($userObject)
323
+ {
324
+ //My code ends
325
+ $profileDataFiltered = array();
326
+ $profileDataFiltered['Email'] = isset($userObject->Email[0]->Value) ? $userObject->Email[0]->Value : '';
327
+ $profileDataFiltered['Provider'] = empty($userObject->Provider) ? "" : $userObject->Provider;
328
+ $profileDataFiltered['FirstName'] = empty($userObject->FirstName) ? "" : $userObject->FirstName;
329
+ $profileDataFiltered['FullName'] = empty($userObject->FullName) ? "" : $userObject->FullName;
330
+ $profileDataFiltered['NickName'] = empty($userObject->NickName) ? "" : $userObject->NickName;
331
+ $profileDataFiltered['LastName'] = empty($userObject->LastName) ? "" : $userObject->LastName;
332
+ if (isset($userObject->Addresses) && is_array($userObject->Addresses)) {
333
+ foreach ($userObject->Addresses as $address) {
334
+ if (isset($address->Address1) && !empty($address->Address1)) {
335
+ $profileDataFiltered['Address'] = $address->Address1;
336
+ break;
337
+ }
338
+ }
339
+ } elseif (isset($userObject->Addresses) && is_string($userObject->Addresses)) {
340
+ $profileDataFiltered['Address'] = isset($userObject->Addresses) && $userObject->Addresses != "" ? $userObject->Addresses : "";
341
+ } else {
342
+ $profileDataFiltered['Address'] = "";
343
+ }
344
+ $profileDataFiltered['PhoneNumber'] = empty($userObject->PhoneNumbers['0']->PhoneNumber) ? "" : $userObject->PhoneNumbers['0']->PhoneNumber;
345
+ $profileDataFiltered['State'] = empty($userObject->State) ? "" : $userObject->State;
346
+ $profileDataFiltered['City'] = empty($userObject->City) || $userObject->City == "unknown" ? "" : $userObject->City;
347
+ $profileDataFiltered['Industry'] = empty($userObject->Positions['0']->Comapany->Name) ? "" : $userObject->Positions['0']->Comapany->Name;
348
+ if (isset($userObject->Country->Code) && is_string($userObject->Country->Code)) {
349
+ $profileDataFiltered['Country'] = $userObject->Country->Code;
350
+ } else {
351
+ $profileDataFiltered['Country'] = "";
352
+ }
353
+ $profileDataFiltered['Thumbnail'] = $this->socialLoginFilterAvatar($userObject->ID, $userObject->ThumbnailImageUrl, $profileDataFiltered['Provider']);
354
+
355
+
356
+ if (empty($profileDataFiltered['FirstName'])) {
357
+ if (!empty($profileDataFiltered['FullName'])) {
358
+ $profileDataFiltered['FirstName'] = $profileDataFiltered['FullName'];
359
+ } elseif (!empty($profileDataFiltered['ProfileName'])) {
360
+ $profileDataFiltered['FirstName'] = $profileDataFiltered['ProfileName'];
361
+ } elseif (!empty($profileDataFiltered['NickName'])) {
362
+ $profileDataFiltered['FirstName'] = $profileDataFiltered['NickName'];
363
+ } elseif (!empty($email)) {
364
+ $user_name = explode('@', $email);
365
+ $profileDataFiltered['FirstName'] = str_replace("_", " ", $user_name[0]);
366
+ } else {
367
+ $profileDataFiltered['FirstName'] = $userObject->ID;
368
+ }
369
+ }
370
+
371
+ $profileDataFiltered['Gender'] = (!empty($userObject->Gender) ? $userObject->Gender : '');
372
+ if (strtolower(substr($profileDataFiltered['Gender'], 0, 1)) == 'm') {
373
+ $profileDataFiltered['Gender'] = '1';
374
+ } elseif (strtolower(substr($profileDataFiltered['Gender'], 0, 1)) == 'f') {
375
+ $profileDataFiltered['Gender'] = '2';
376
+ } else {
377
+ $profileDataFiltered['Gender'] = '';
378
+ }
379
+ $profileDataFiltered['BirthDate'] = (!empty($userObject->BirthDate) ? $userObject->BirthDate : '');
380
+ if ($profileDataFiltered['BirthDate'] != "") {
381
+ switch ($profileDataFiltered['Provider']) {
382
+ case 'facebook':
383
+ case 'foursquare':
384
+ case 'yahoo':
385
+ case 'openid':
386
+ break;
387
+
388
+ case 'google':
389
+ $temp = explode('/', $profileDataFiltered['BirthDate']); // yy/mm/dd
390
+ $profileDataFiltered['BirthDate'] = $temp[1] . "/" . $temp[2] . "/" . $temp[0];
391
+ break;
392
+
393
+ case 'twitter':
394
+ case 'linkedin':
395
+ case 'vkontakte':
396
+ case 'live';
397
+ $temp = explode('/', $profileDataFiltered['BirthDate']); // dd/mm/yy
398
+ $profileDataFiltered['BirthDate'] = $temp[1] . "/" . $temp[0] . "/" . $temp[2];
399
+ break;
400
+ }
401
+ }
402
+
403
+ return $profileDataFiltered;
404
  }
405
+
406
+ /**
407
+ * Get thumbnail image url
408
+ *
409
+ * @param $id
410
+ * @param $imgUrl
411
+ * @param $provider
412
+ *
413
+ * @return string
414
+ */
415
+ public function socialLoginFilterAvatar($id, $imgUrl, $provider)
416
+ {
417
+ $thumbnail = (!empty($imgUrl) ? trim($imgUrl) : '');
418
+ if (empty($thumbnail) && ($provider == 'facebook')) {
419
+ $thumbnail = "http://graph.facebook.com/" . $id . "/picture?type=large";
420
+ }
421
+
422
+ return $thumbnail;
423
  }
424
+
425
+ /**
426
+ * check if url is valid or not.
427
+ *
428
+ * @param string $url
429
+ *
430
+ * @return bool true/false
431
+ */
432
+ public function validateUrl($url)
433
+ {
434
+ $validUrlExpression = "/^(http:\/\/|https:\/\/|ftp:\/\/|ftps:\/\/|)?[a-z0-9_\-]+[a-z0-9_\-\.]+\.[a-z]{2,4}(\/+[a-z0-9_\.\-\/]*)?$/i";
435
+
436
+ return (bool)preg_match($validUrlExpression, $url);
 
 
 
 
 
 
 
437
  }
438
 
439
+ /**
440
+ * Generate random email
441
+ *
442
+ * @param $userObject
443
+ *
444
+ * @return string
445
+ */
446
+ public function getAutoGeneratedEmail($userObject)
447
+ {
448
+ $emailName = str_replace(array("/", "."), "_", substr($userObject->ID, -10, -1));
449
+ $email = $emailName . '@' . $userObject->Provider . '.com';
450
+ $userId = Mage::helper('sociallogin/loginhelper')->loginRadiusRead("customer_entity", "email exists pop1", array($email), true);
451
+ if ($rowArray = $userId->fetch()) {
452
+ $emailName = str_replace(array("/", "."), "_", substr($userObject->ID, -10));
453
+ $emailName = str_shuffle($emailName);
454
+ $email = $emailName . '@' . $userObject->Provider . '.com';
455
+ }
456
+
457
+ return $email;
458
  }
459
+
460
+ /**
461
+ * Read data from LoginRadius related tables
462
+ *
463
+ * @param $table
464
+ * @param $handle
465
+ * @param $params
466
+ * @param bool $result
467
+ *
468
+ * @return bool|Zend_Db_Statement_Interface
469
+ */
470
+ public function loginRadiusRead($table, $handle, $params, $result = false)
471
+ {
472
+ $socialLoginConn = Mage::getSingleton('core/resource')->getConnection('core_read');
473
+ $Tbl = $this->getMazeTable($table);
474
+ $customerTable = $this->getMazeTable('customer_entity');
475
+ $websiteId = Mage::app()->getWebsite()->getId();
476
+ $storeId = Mage::app()->getStore()->getId();
477
+ $query = "";
478
+ switch ($handle) {
479
+ case "email exists pop1":
480
+ $query = "select entity_id from $Tbl where email = '" . $params[0] . "' and website_id = $websiteId and store_id = $storeId";
481
+ break;
482
+ case "get_user_by_social_id":
483
+ $query = "SELECT $Tbl.entity_id, verified from $Tbl JOIN $customerTable ON $customerTable.entity_id = $Tbl.entity_id WHERE $Tbl.sociallogin_id = '" . $params[0] . "' AND $customerTable.website_id = $websiteId AND $customerTable.store_id =" . $storeId;
484
+ break;
485
+ case "get_user_from_customer_entity":
486
+ $query = "select entity_id from $Tbl where entity_id = " . $params[0] . " and website_id = $websiteId and store_id = $storeId";
487
+ break;
488
+ case "email_already_exists":
489
+ $query = "select * from $Tbl where email = '" . $params[0] . "' and website_id = $websiteId and store_id = $storeId";
490
+ break;
491
+ case "email exists sl":
492
+ $query = "select verified,sociallogin_id from $Tbl where entity_id = '" . $params[0] . "' and provider = '" . $params[1] . "'";
493
+ break;
494
+ case "provider exists in sociallogin":
495
+ $query = "select entity_id from $Tbl where entity_id = '" . $params[0] . "' and provider = '" . $params[1] . "'";
496
+ break;
497
+ case "verification":
498
+ $query = "select entity_id, provider from $Tbl where vkey = '" . $params[0] . "'";
499
+ break;
500
+ case "verification2":
501
+ $query = "select entity_id from $Tbl where entity_id = " . $params[0] . " and provider = '" . $params[1] . "' and vkey != '' ";
502
+ break;
503
+ }
504
+ $select = $socialLoginConn->query($query);
505
+ if ($result) {
506
+ return $select;
507
+ }
508
+ if ($select->fetch()) {
509
+ return true;
510
+ }
511
+
512
+ return false;
513
  }
514
+
515
+ /**
516
+ * Function to perform social linking
517
+ *
518
+ * @param $entityId logged in customer entity id
519
+ * @param $socialId social id
520
+ * @param $provider provider
521
+ * @param $thumbnail thumbnail image url
522
+ * @param bool $unique
523
+ */
524
+ public function loginRadiusSocialLinking($entityId, $socialId, $provider, $thumbnail, $unique = false)
525
+ {
526
+ $session = Mage::getSingleton('customer/session');
527
+ // check if any account from this provider is already linked
528
+ if (Mage::helper('sociallogin/loginhelper')->isAlreadyLoggedIn()) {
529
+ if (Mage::helper('sociallogin/loginhelper')->loginRadiusRead("sociallogin", "get_user_by_social_id", array($socialId))) {
530
+ $session->addError(__('This accounts is already linked with an account.'));
531
+ header("Location:" . Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK) . "customer/account");
532
+ exit();
533
+ } elseif ($unique && Mage::helper('sociallogin/loginhelper')->loginRadiusRead("sociallogin", "provider exists in sociallogin", array($entityId, $provider))) {
534
+ $session->addError(__('Multiple accounts cannot be linked from the same Social ID Provider.'));
535
+ header("Location:" . Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK) . "customer/account");
536
+ exit();
537
+ }
538
+ }
539
+ $socialLoginLinkData = array();
540
+ $socialLoginLinkData['sociallogin_id'] = $socialId;
541
+ $socialLoginLinkData['entity_id'] = $entityId;
542
+ $socialLoginLinkData['provider'] = empty($provider) ? "" : $provider;
543
+ $socialLoginLinkData['avatar'] = Mage::helper('sociallogin/loginHelper')->socialLoginFilterAvatar($socialId, $thumbnail, $provider);
544
+ $socialLoginLinkData['avatar'] = ($socialLoginLinkData['avatar'] == "") ? null : $socialLoginLinkData['avatar'];
545
+ Mage::helper('sociallogin/loginhelper')->SocialLoginInsert("sociallogin", $socialLoginLinkData);
546
+ if (Mage::helper('sociallogin/loginhelper')->isAlreadyLoggedIn()) {
547
+ $session->addSuccess(__('Account linked successfully.'));
548
+ header("Location:" . Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK) . "customer/account");
549
+ exit();
550
+ }
551
  }
552
+
553
+ /**
554
+ * Check if user is already loggedin
555
+ *
556
+ * @return bool
557
+ */
558
+ public function isAlreadyLoggedIn()
559
+ {
560
+ if (Mage::getSingleton('customer/session')->isLoggedIn()) {
561
+ return true;
562
+ }
563
+
564
+ return false;
 
 
 
 
 
 
 
 
 
565
  }
 
 
566
 
567
+ /**
568
+ * Set social network profile data in session
569
+ *
570
+ * @param $id
571
+ * @param $socialloginProfileData
572
+ */
573
+ public function setInSession($id, $socialloginProfileData)
574
+ {
575
+ $socialloginProfileData['lrId'] = $id;
576
+ Mage::getSingleton('core/session')->setSocialLoginData($socialloginProfileData);
577
  }
578
+
579
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Loginradius/Sociallogin/Helper/Loginradiussdk.php ADDED
@@ -0,0 +1,158 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // Define LoginRadius domain
4
+ if(!defined('LR_DOMAIN') ) define('LR_DOMAIN', 'api.loginradius.com');
5
+
6
+ class Loginradius_Sociallogin_Helper_Loginradiussdk extends Mage_Core_Helper_Abstract
7
+ {
8
+ /**
9
+ * LoginRadius function - It validate against GUID format of keys.
10
+ *
11
+ * @param string $key data to validate.
12
+ *
13
+ * @return boolean. If valid - true, else - false.
14
+ */
15
+ public function loginradiusValidateKey($key)
16
+ {
17
+ if (empty($key) || !preg_match('/^\{?[A-Z0-9]{8}-[A-Z0-9]{4}-[A-Z0-9]{4}-[A-Z0-9]{4}-[A-Z0-9]{12}\}?$/i', $key)) {
18
+ return false;
19
+ } else {
20
+ return true;
21
+ }
22
+ }
23
+
24
+ /**
25
+ * LoginRadius function - To fetch social profile data from the user's social account after authentication. The social profile will be retrieved via oAuth and OpenID protocols. The data is normalized into LoginRadius' standard data format.
26
+ *
27
+ * @param string $accessToken LoginRadius access token
28
+ * @param boolean $raw If true, raw data is fetched
29
+ *
30
+ * @return object User profile data.
31
+ */
32
+ public function fetchUserProfile($accessToken, $raw = false)
33
+ {
34
+ $ValidateUrl = 'https://' . LR_DOMAIN . '/api/v2/userprofile?access_token=' . $accessToken;
35
+ if ($raw) {
36
+ $ValidateUrl = 'https://' . LR_DOMAIN . '/api/v2/userprofile/raw?access_token=' . $accessToken;
37
+
38
+ return $this->accessLoginradiusApi($ValidateUrl);
39
+ }
40
+
41
+ return $this->accessLoginradiusApi($ValidateUrl);
42
+ }
43
+
44
+ /**
45
+ * Function for caalling appropriate method ex. curl, fsockopen or magento default varien to call LoginRadius api.
46
+ *
47
+ * @param $url
48
+ * @param array $data
49
+ * @param bool $isPost
50
+ *
51
+ * @return mixed|string
52
+ */
53
+ public function accessLoginradiusApi($url, $data = array(), $isPost = false)
54
+ {
55
+
56
+ if (Mage::helper('sociallogin')->isCurlEnabled()) {
57
+ $JsonResponse = $this->curlApiMethod($url, $data, $isPost);
58
+ } else {
59
+ $JsonResponse = $this->fsockopenApiMethod($url, $data, $isPost);
60
+ }
61
+ $result = json_decode($JsonResponse);
62
+ if (is_object($result) && isset($result->customError)) {
63
+ $method = 'GET';
64
+
65
+ $client = new Varien_Http_Client($url);
66
+ $response = $client->request($method);
67
+ $Response = $response->getBody();
68
+
69
+ return $Response;
70
+
71
+ }
72
+
73
+ return $JsonResponse;
74
+
75
+ }
76
+
77
+ /**
78
+ * Function for calling LoginRadius Api using curl method
79
+ *
80
+ * @param $url
81
+ * @param $data
82
+ * @param bool $post
83
+ *
84
+ * @return mixed|string
85
+ */
86
+ public function curlApiMethod($url, $data, $post = false)
87
+ {
88
+ $curl_handle = curl_init();
89
+ curl_setopt($curl_handle, CURLOPT_URL, $url);
90
+ curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 50);
91
+ curl_setopt($curl_handle, CURLOPT_TIMEOUT, 50);
92
+ curl_setopt($curl_handle, CURLOPT_SSL_VERIFYPEER, false);
93
+ if ($post) {
94
+ curl_setopt($curl_handle, CURLOPT_POST, 1);
95
+ curl_setopt($curl_handle, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded'));
96
+ curl_setopt($curl_handle, CURLOPT_POSTFIELDS, http_build_query($data));
97
+ }
98
+ if (ini_get('open_basedir') == '' && (ini_get('safe_mode') == 'Off' or !ini_get('safe_mode'))) {
99
+ curl_setopt($curl_handle, CURLOPT_FOLLOWLOCATION, 1);
100
+ curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, true);
101
+ } else {
102
+ curl_setopt($curl_handle, CURLOPT_HEADER, 1);
103
+ $url = curl_getinfo($curl_handle, CURLINFO_EFFECTIVE_URL);
104
+ curl_close($curl_handle);
105
+ $curl_handle = curl_init();
106
+ $url = str_replace('?', '/?', $url);
107
+ curl_setopt($curl_handle, CURLOPT_URL, $url);
108
+ curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, true);
109
+ }
110
+ $JsonResponse = curl_exec($curl_handle);
111
+ $httpCode = curl_getinfo($curl_handle, CURLINFO_HTTP_CODE);
112
+ if (in_array($httpCode, array(400, 401, 403, 404, 500, 503))) {
113
+ $JsonResponse = json_encode(array("customError" => true, "Messages" => "Error in using curl connection ,Service connection error occurred"));
114
+ } else {
115
+ if (curl_errno($curl_handle) == 28) {
116
+ $JsonResponse = json_encode(array("customError" => true, "Messages" => "Connection timeout"));
117
+ }
118
+ }
119
+ curl_close($curl_handle);
120
+
121
+ return $JsonResponse;
122
+ }
123
+
124
+ /**
125
+ * Function for calling LoginRadius Api using fsockopen method
126
+ *
127
+ * @param $ValidateUrl
128
+ * @param $data
129
+ * @param bool $post
130
+ *
131
+ * @return string
132
+ */
133
+ public function fsockopenApiMethod($ValidateUrl, $data, $post = false)
134
+ {
135
+ if (!empty($data)) {
136
+ $options = array('http' => array('method' => 'POST', 'timeout' => 15, 'header' => 'Content-type: application/x-www-form-urlencoded', 'content' => $data));
137
+ $context = stream_context_create($options);
138
+ } else {
139
+ $context = null;
140
+ }
141
+ $jsonResponse = @file_get_contents($ValidateUrl, false, $context);
142
+ if (strpos(@$http_response_header[0], "400") !== false
143
+ || strpos(@$http_response_header[0], "401") !== false
144
+ || strpos(@$http_response_header[0], "403") !== false
145
+ || strpos(@$http_response_header[0], "404") !== false
146
+ || strpos(@$http_response_header[0], "500") !== false
147
+ || strpos(@$http_response_header[0], "503") !== false
148
+ ) {
149
+ $jsonResponse = json_encode(array("customError" => true, "Messages" => "Error in using FSOCKOPEN connection method, Service connection timeout occurred"));
150
+ }
151
+ if (!$jsonResponse) {
152
+ $jsonResponse = json_encode(array("customError" => true, "Messages" => "FSOCKOPEN not working"));
153
+ }
154
+
155
+ return $jsonResponse;
156
+ }
157
+
158
+ }
app/code/community/Loginradius/Sociallogin/Model/Backend/Validator.php DELETED
@@ -1,17 +0,0 @@
1
- <?php
2
-
3
- class Loginradius_Sociallogin_Model_Backend_Validator extends Mage_Core_Model_Config_Data
4
- {
5
- protected function _beforeSave()
6
- {
7
- echo "hello";die;
8
- $value = $this->getValue();
9
- if (!Zend_Validate::is($value, 'EmailAddress')) {
10
- Mage::throwException(Mage::helper('adminhtml')->__('Invalid email address "%s".', $value));
11
- }
12
- return $this;
13
- }
14
- protected function _afterLoad(){
15
- echo "hello";die;
16
- }
17
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Loginradius/Sociallogin/Model/Observer.php CHANGED
@@ -1,126 +1,78 @@
1
  <?php
 
2
  /**
3
- * Created by PhpStorm.
4
- * User: nyaconcept
5
- * Date: 11/17/14
6
- * Time: 10:53 AM
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  */
8
- class Loginradius_Sociallogin_Model_Observer extends Mage_Core_Helper_Abstract {
9
- public function adminSystemConfigChangedSection() {
10
- $post = Mage::app()->getRequest()->getPost();
11
- foreach ($post['groups']['apiSettings']['fields'] as $apis) {
12
- if (isset($apis['inherit']) && $apis['inherit']) {
13
- $result['message'] = '';
14
- $result['status'] = 'Success';
15
- return $result;
16
- }
17
- }
18
- $this->getAllVariables('basic');
19
-
20
- }
21
-
22
- public function getAllVariables($action) {
23
- $function = 'loginradius_' . $action . '_setting_array';
24
- $settings = $this->$function();
25
- $responce = $this->getval($settings, $action);
26
- $session = Mage::getSingleton('adminhtml/session');
27
- $session->getMessages(TRUE);
28
- if ($responce['status'] != 'Success') {
29
- throw new Exception($responce['message']);
30
- }
31
- }
32
-
33
- public function getval($fieldArrays, $action) {
34
- $post = Mage::app()->getRequest()->getPost();
35
- $count = 1;
36
- $string = '';
37
- foreach ($fieldArrays as $fieldId => $fieldArray) {
38
- foreach ($fieldArray as $fieldValue) {
39
- $settings[$fieldValue] = isset($post['groups'][$fieldId]['fields'][$fieldValue]['value']) ? $post['groups'][$fieldId]['fields'][$fieldValue]['value'] : '';
40
- }
41
-
42
- $string .= $this->loginradius_get_string_format($count, $fieldArray, $settings);
43
- $count++;
44
- }
45
 
46
- $result['message'] = '';
47
- $result['status'] = 'Success';
48
- $validateUrl = 'https://api.loginradius.com/api/v2/app/validate?apikey=' . rawurlencode($settings['apikey']) . '&apisecret=' . rawurlencode($settings['apisecret']);
49
-
50
- $data = array(
51
- 'addon' => 'Magento: ' . Mage::getVersion(),
52
- 'version' => '4.0.0',
53
- 'agentstring' => $_SERVER["HTTP_USER_AGENT"],
54
- 'clientip' => $_SERVER["REMOTE_ADDR"],
55
- 'configuration' => $string
56
- );
57
-
58
- return $this->loginradius_save_setting_on_server($validateUrl, $data);
59
- }
60
-
61
- function loginradius_get_string_format($tabNo, $array, $settings) {
62
- $string = "~" . $tabNo . "#";
63
- for ($i = 0; $i < count($array); $i++) {
64
- if (in_array($array[$i], array('appid', 'appkey'))) {
65
- continue;
66
- }
67
- elseif (is_numeric($settings[$array[$i]])) {
68
- $string .= '|' . $settings[$array[$i]];
69
- }
70
- elseif (@unserialize($settings[$array[$i]])) {
71
- $string .= '|' . json_encode(@unserialize($settings[$array[$i]]));
72
- }
73
- elseif (is_string($settings[$array[$i]])) {
74
- $string .= '|"' . $settings[$array[$i]] . '"';
75
- }
76
- }
77
- return $string . '|';
78
- }
79
 
80
- function loginradius_save_setting_on_server($url, $data) {
81
- $result['status'] = 'Error';
82
- $loginradiusObgect = new Loginradius_Sociallogin_Helper_LoginRadiusSDK();
83
- $responce = json_decode($loginradiusObgect->accessLoginradiusApi($url, http_build_query($data)));
84
- $status = isset($responce->Status) ? $responce->Status : FALSE;
85
- $result['message'] = isset($responce->Messages[0]) ? $responce->Messages[0] : 'An error ocCureD';
86
- if ($status) {
87
- $result['message'] = '';
88
- $result['status'] = 'Success';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
89
  }
90
- else {
91
- if ($result['message'] == 'API_KEY_NOT_FORMATED') {
92
- $result['message'] = 'LoginRadius API key is not correct.';
93
- }
94
- elseif ($result['message'] == 'API_SECRET_NOT_FORMATED') {
95
- $result['message'] = 'LoginRadius API Secret key is not correct.';
96
- }
97
- elseif ($result['message'] == 'API_KEY_NOT_VALID') {
98
- $result['message'] = 'LoginRadius API key is not valid.';
99
- }
100
- elseif ($result['message'] == 'API_SECRET_NOT_VALID') {
101
- $result['message'] = 'LoginRadius API Secret key is not valid.';
102
- }
103
- }
104
- return $result;
105
- }
106
 
107
- public function loginradius_basic_setting_array() {
108
- return array(
109
- 'apiSettings' => array('apikey', 'apisecret'),
110
- 'basicSettings' => array('redirectAfterLogin', 'customLogin', 'redirectAfterRegistration', 'customRegistration'),
111
- 'advancedSettings' => array('loginradius_title', 'iconSize', 'iconsPerRow', 'backgroundColor', 'showdefault', 'aboveLogin', 'belowLogin', 'aboveRegister', 'belowRegister', 'emailrequired', 'verificationText', 'popupText', 'popupError', 'notifyUser', 'notifyUserText', 'notifyAdmin', 'notifyAdminText', 'profileFieldsRequired', 'updateProfileData', 'socialLinking', 'debugMode'),
112
- 'horizontalSharing' => array('horizontalShareEnable', 'horizontalSharingTheme', 'horizontalAlignment', 'horizontalSharingProvidersHidden', 'horizontalCounterProvidersHidden', 'horizontalShareProduct', 'horizontalShareSuccess'),
113
- 'verticalSharing' => array('verticalShareEnable', 'verticalSharingTheme', 'verticalAlignment', 'verticalSharingProvidersHidden', 'verticalCounterProvidersHidden', 'verticalShareProduct', 'verticalShareSuccess')
114
- );
115
- }
 
 
 
 
116
 
117
- function loginradius_get_array($fieldArray) {
118
- $settings = array();
119
- foreach ($fieldArray as $fieldKey => $fieldValues) {
120
- foreach ($fieldValues as $fieldValue) {
121
- $settings[] = $fieldValue;
122
- }
123
  }
124
- return $settings;
125
- }
126
- }
1
  <?php
2
+
3
  /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * sociallogin observer model
17
+ *
18
+ * @category Loginradius
19
+ * @package Loginradius_Sociallogin
20
+ * @author LoginRadius Team
21
  */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
 
23
+ /**
24
+ * Class Loginradius_Sociallogin_Model_Observer responsible for LoginRadius api keys verification!
25
+ */
26
+ class Loginradius_Sociallogin_Model_Observer extends Mage_Core_Helper_Abstract
27
+ {
28
+ /**
29
+ * @throws Exception while api keys are not valid!
30
+ */
31
+ public function validateLoginradiusKeys()
32
+ {
33
+ $post = Mage::app()->getRequest()->getPost();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34
 
35
+ //$post['groups']['verticalSharing']['fields']['verticalCounterProvidersHidden'] = str_replace(' ', '', $post['groups']['verticalSharing']['fields']['verticalCounterProvidersHidden']);
36
+ //$post['groups']['horizontalSharing']['fields']['horizontalCounterProvidersHidden'] = str_replace(' ', '', $post['groups']['horizontalSharing']['fields']['horizontalCounterProvidersHidden']);
37
+ if (isset($post['config_state']['sociallogin_options_apiSettings'])) {
38
+ $apiKey = $post['groups']['apiSettings']['fields']['apikey']['value'];
39
+ $apiSecret = $post['groups']['apiSettings']['fields']['apisecret']['value'];
40
+ $validateUrl = 'https://api.loginradius.com/api/v2/app/validate?apikey=' . rawurlencode($apiKey) . '&apisecret=' . rawurlencode($apiSecret);
41
+ $result = $this->getLoginRadiusKeysValidationStatus($validateUrl);
42
+ if (isset($result['status']) && $result['status']) {
43
+ $result['message'] = '';
44
+ $result['status'] = 'Success';
45
+ } else {
46
+ if ($result['message'] == 'API_KEY_NOT_FORMATED') {
47
+ $result['message'] = 'LoginRadius API key is not correct.';
48
+ } elseif ($result['message'] == 'API_SECRET_NOT_FORMATED') {
49
+ $result['message'] = 'LoginRadius API Secret key is not correct.';
50
+ } elseif ($result['message'] == 'API_KEY_NOT_VALID') {
51
+ $result['message'] = 'LoginRadius API key is not valid.';
52
+ } elseif ($result['message'] == 'API_SECRET_NOT_VALID') {
53
+ $result['message'] = 'LoginRadius API Secret key is not valid.';
54
+ }
55
+ }
56
+ if ($result['status'] != 'Success') {
57
+ throw new Exception($result['message']);
58
+ }
59
+ }
60
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
61
 
62
+ /**
63
+ * function is used to get response form LoginRadius api validation.
64
+ *
65
+ * @param string $url
66
+ *
67
+ * @return array $result
68
+ */
69
+ public function getLoginRadiusKeysValidationStatus($url)
70
+ {
71
+ $loginradiusObject = Mage::helper('sociallogin/loginradiussdk');
72
+ $response = json_decode($loginradiusObject->accessLoginradiusApi($url));
73
+ $result['status'] = isset($response->Status) ? $response->Status : false;
74
+ $result['message'] = isset($response->Messages[0]) ? $response->Messages[0] : 'an error occurred';
75
 
76
+ return $result;
 
 
 
 
 
77
  }
78
+ }
 
 
app/code/community/Loginradius/Sociallogin/Model/Source/HorizontalSharing.php CHANGED
@@ -1,15 +1,46 @@
1
  <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  class Loginradius_Sociallogin_Model_Source_HorizontalSharing
3
  {
 
 
 
 
 
4
  public function toOptionArray()
5
  {
6
  $result = array();
7
  $result[] = array('value' => '32', 'label' => '<img src="' . Mage::getDesign()->getSkinUrl('Loginradius/Sociallogin/images/Sharing/Horizontal/horizonSharing32.png', array('_area' => 'adminhtml')) . '" /><div style="clear:both"></div>');
8
  $result[] = array('value' => '16', 'label' => '<img src="' . Mage::getDesign()->getSkinUrl('Loginradius/Sociallogin/images/Sharing/Horizontal/horizonSharing16.png', array('_area' => 'adminhtml')) . '" /><div style="clear:both"></div>');
 
9
  $result[] = array('value' => 'single_large', 'label' => '<img src="' . Mage::getDesign()->getSkinUrl('Loginradius/Sociallogin/images/Sharing/Horizontal/single-image-theme-large.png', array('_area' => 'adminhtml')) . '" /><div style="clear:both"></div>');
10
  $result[] = array('value' => 'single_small', 'label' => '<img src="' . Mage::getDesign()->getSkinUrl('Loginradius/Sociallogin/images/Sharing/Horizontal/single-image-theme-small.png', array('_area' => 'adminhtml')) . '" /><div style="clear:both"></div>');
11
  $result[] = array('value' => 'counter_vertical', 'label' => '<img src="' . Mage::getDesign()->getSkinUrl('Loginradius/Sociallogin/images/Sharing/Horizontal/vertical.png', array('_area' => 'adminhtml')) . '" /><div style="clear:both"></div>');
12
  $result[] = array('value' => 'counter_horizontal', 'label' => '<img style="width:375px;" src="' . Mage::getDesign()->getSkinUrl('Loginradius/Sociallogin/images/Sharing/Horizontal/horizontal.png', array('_area' => 'adminhtml')) . '" /><div style="clear:both"></div>');
 
13
  return $result;
14
  }
15
  }
1
  <?php
2
+
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * sociallogin horizontalsharing source model
17
+ *
18
+ * @category Loginradius
19
+ * @package Loginradius_Sociallogin
20
+ * @author LoginRadius Team
21
+ */
22
+
23
+ /**
24
+ * Class Loginradius_Sociallogin_Model_Source_HorizontalSharing which return horizontal sharing theme options
25
+ */
26
  class Loginradius_Sociallogin_Model_Source_HorizontalSharing
27
  {
28
+ /**
29
+ * function return array of horizontal themes
30
+ *
31
+ * @return array
32
+ */
33
  public function toOptionArray()
34
  {
35
  $result = array();
36
  $result[] = array('value' => '32', 'label' => '<img src="' . Mage::getDesign()->getSkinUrl('Loginradius/Sociallogin/images/Sharing/Horizontal/horizonSharing32.png', array('_area' => 'adminhtml')) . '" /><div style="clear:both"></div>');
37
  $result[] = array('value' => '16', 'label' => '<img src="' . Mage::getDesign()->getSkinUrl('Loginradius/Sociallogin/images/Sharing/Horizontal/horizonSharing16.png', array('_area' => 'adminhtml')) . '" /><div style="clear:both"></div>');
38
+ $result[] = array('value' => 'responsive', 'label' => '<img src="' . Mage::getDesign()->getSkinUrl('Loginradius/Sociallogin/images/Sharing/Horizontal/responsive-icons.png', array('_area' => 'adminhtml')) . '" /><div style="clear:both"></div>');
39
  $result[] = array('value' => 'single_large', 'label' => '<img src="' . Mage::getDesign()->getSkinUrl('Loginradius/Sociallogin/images/Sharing/Horizontal/single-image-theme-large.png', array('_area' => 'adminhtml')) . '" /><div style="clear:both"></div>');
40
  $result[] = array('value' => 'single_small', 'label' => '<img src="' . Mage::getDesign()->getSkinUrl('Loginradius/Sociallogin/images/Sharing/Horizontal/single-image-theme-small.png', array('_area' => 'adminhtml')) . '" /><div style="clear:both"></div>');
41
  $result[] = array('value' => 'counter_vertical', 'label' => '<img src="' . Mage::getDesign()->getSkinUrl('Loginradius/Sociallogin/images/Sharing/Horizontal/vertical.png', array('_area' => 'adminhtml')) . '" /><div style="clear:both"></div>');
42
  $result[] = array('value' => 'counter_horizontal', 'label' => '<img style="width:375px;" src="' . Mage::getDesign()->getSkinUrl('Loginradius/Sociallogin/images/Sharing/Horizontal/horizontal.png', array('_area' => 'adminhtml')) . '" /><div style="clear:both"></div>');
43
+
44
  return $result;
45
  }
46
  }
app/code/community/Loginradius/Sociallogin/Model/Source/Iconsize.php CHANGED
@@ -1,4 +1,28 @@
1
  <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  class Loginradius_Sociallogin_Model_Source_Iconsize
3
  {
4
  public function toOptionArray()
@@ -6,6 +30,7 @@ class Loginradius_Sociallogin_Model_Source_Iconsize
6
  $result = array();
7
  $result[] = array('value' => 'medium', 'label' => __('Medium'));
8
  $result[] = array('value' => 'small', 'label' => __('Small'));
 
9
  return $result;
10
  }
11
  }
1
  <?php
2
+
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * sociallogin iconsize source model
17
+ *
18
+ * @category Loginradius
19
+ * @package Loginradius_Sociallogin
20
+ * @author LoginRadius Team
21
+ */
22
+
23
+ /**
24
+ * Class Loginradius_Sociallogin_Model_Source_Iconsize which return iconsize configuration options in admin
25
+ */
26
  class Loginradius_Sociallogin_Model_Source_Iconsize
27
  {
28
  public function toOptionArray()
30
  $result = array();
31
  $result[] = array('value' => 'medium', 'label' => __('Medium'));
32
  $result[] = array('value' => 'small', 'label' => __('Small'));
33
+
34
  return $result;
35
  }
36
  }
app/code/community/Loginradius/Sociallogin/Model/Source/LoginPopup.php CHANGED
@@ -1,4 +1,28 @@
1
  <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  class Loginradius_Sociallogin_Model_Source_Loginpopup
3
  {
4
  public function toOptionArray()
@@ -6,6 +30,7 @@ class Loginradius_Sociallogin_Model_Source_Loginpopup
6
  $result = array();
7
  $result[] = array('value' => '1', 'label' => __('Yes') . '<br/>');
8
  $result[] = array('value' => '0', 'label' => __('No') . '<br/>');
 
9
  return $result;
10
  }
11
  }
1
  <?php
2
+
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * sociallogin loginpopup source model
17
+ *
18
+ * @category Loginradius
19
+ * @package Loginradius_Sociallogin
20
+ * @author LoginRadius Team
21
+ */
22
+
23
+ /**
24
+ * Class Loginradius_Sociallogin_Model_Source_Loginpopup which return loginpopup configuration options in admin
25
+ */
26
  class Loginradius_Sociallogin_Model_Source_Loginpopup
27
  {
28
  public function toOptionArray()
30
  $result = array();
31
  $result[] = array('value' => '1', 'label' => __('Yes') . '<br/>');
32
  $result[] = array('value' => '0', 'label' => __('No') . '<br/>');
33
+
34
  return $result;
35
  }
36
  }
app/code/community/Loginradius/Sociallogin/Model/Source/SharingVerticalAlignment.php CHANGED
@@ -1,13 +1,38 @@
1
  <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  class Loginradius_Sociallogin_Model_Source_SharingVerticalAlignment
3
  {
4
  public function toOptionArray()
5
  {
6
  $result = array();
7
- $result[] = array('value' => 'top_left', 'label' => __('Top Left'));
8
- $result[] = array('value' => 'top_right', 'label' => __('Top Right'));
9
- $result[] = array('value' => 'bottom_left', 'label' => __('Bottom Left'));
10
- $result[] = array('value' => 'bottom_right', 'label' => __('Bottom Right'));
 
11
  return $result;
12
  }
13
  }
1
  <?php
2
+
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * sociallogin sharingverticalalignment source model
17
+ *
18
+ * @category Loginradius
19
+ * @package Loginradius_Sociallogin
20
+ * @author LoginRadius Team
21
+ */
22
+
23
+ /**
24
+ * Class Loginradius_Sociallogin_Model_Source_VerticalSharing which returns vertical alignment options
25
+ */
26
  class Loginradius_Sociallogin_Model_Source_SharingVerticalAlignment
27
  {
28
  public function toOptionArray()
29
  {
30
  $result = array();
31
+ $result[] = array('value' => 'top_left', 'label' => 'Top Left');
32
+ $result[] = array('value' => 'top_right', 'label' => 'Top Right');
33
+ $result[] = array('value' => 'bottom_left', 'label' => 'Bottom Left');
34
+ $result[] = array('value' => 'bottom_right', 'label' => 'Bottom Right');
35
+
36
  return $result;
37
  }
38
  }
app/code/community/Loginradius/Sociallogin/Model/Source/TwitterRecipients.php CHANGED
@@ -1,11 +1,36 @@
1
  <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  class Loginradius_Sociallogin_Model_Source_twitterRecipients
3
  {
4
  public function toOptionArray()
5
  {
6
  $result = array();
7
- $result[] = array('value' => 'selected', 'label' => 'Let the user pick<br/>');
8
  $result[] = array('value' => 'all', 'label' => 'All contacts');
 
9
  return $result;
10
  }
11
  }
1
  <?php
2
+
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * sociallogin twitterrecipients source model
17
+ *
18
+ * @category Loginradius
19
+ * @package Loginradius_Sociallogin
20
+ * @author LoginRadius Team
21
+ */
22
+
23
+ /**
24
+ * Class Loginradius_Sociallogin_Model_Source_twitterRecipients which returns options for select users for twitter tweets.
25
+ */
26
  class Loginradius_Sociallogin_Model_Source_twitterRecipients
27
  {
28
  public function toOptionArray()
29
  {
30
  $result = array();
31
+ $result[] = array('value' => 'selected', 'label' => 'Let the user pick');
32
  $result[] = array('value' => 'all', 'label' => 'All contacts');
33
+
34
  return $result;
35
  }
36
  }
app/code/community/Loginradius/Sociallogin/Model/Source/Uihover.php CHANGED
@@ -1,13 +1,38 @@
1
  <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  class Loginradius_Sociallogin_Model_Source_Uihover
3
  {
4
  public function toOptionArray()
5
  {
6
  $result = array();
7
- $result[] = array('value' => 'same', 'label' => __('Same Page'));
8
- $result[] = array('value' => 'account', 'label' => __('Account Page'));
9
- $result[] = array('value' => 'index', 'label' => __('Home Page'));
10
- $result[] = array('value' => 'custom', 'label' => __('Custom URL'));
 
11
  return $result;
12
  }
13
  }
1
  <?php
2
+
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * sociallogin uihover source model
17
+ *
18
+ * @category Loginradius
19
+ * @package Loginradius_Sociallogin
20
+ * @author LoginRadius Team
21
+ */
22
+
23
+ /**
24
+ * Class Loginradius_Sociallogin_Model_Source_Uihover responsible for returning resirection configuration oprions!
25
+ */
26
  class Loginradius_Sociallogin_Model_Source_Uihover
27
  {
28
  public function toOptionArray()
29
  {
30
  $result = array();
31
+ $result[] = array('value' => 'same', 'label' => 'Same page');
32
+ $result[] = array('value' => 'account', 'label' => 'Account page');
33
+ $result[] = array('value' => 'index', 'label' => 'Home page');
34
+ $result[] = array('value' => 'custom', 'label' => 'Custom URL');
35
+
36
  return $result;
37
  }
38
  }
app/code/community/Loginradius/Sociallogin/Model/Source/Uihover2.php DELETED
@@ -1,12 +0,0 @@
1
- <?php
2
- class Loginradius_Sociallogin_Model_Source_Uihover2
3
- {
4
- public function toOptionArray()
5
- {
6
- $result = array();
7
- $result[] = array('value' => 'varien', 'label' => __('Use') . ' "http_varien_client"');
8
- $result[] = array('value' => 'curl', 'label' => __('Use') . ' cURL');
9
- $result[] = array('value' => 'fopen', 'label' => __('Use') . ' FSOCKOPEN');
10
- return $result;
11
- }
12
- }
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Loginradius/Sociallogin/Model/Source/VerticalSharing.php CHANGED
@@ -1,6 +1,35 @@
1
  <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  class Loginradius_Sociallogin_Model_Source_VerticalSharing
3
  {
 
 
 
 
 
4
  public function toOptionArray()
5
  {
6
  $result = array();
@@ -8,6 +37,7 @@ class Loginradius_Sociallogin_Model_Source_VerticalSharing
8
  $result[] = array('value' => '16', 'label' => '<img src="' . Mage::getDesign()->getSkinUrl('Loginradius/Sociallogin/images/Sharing/Vertical/16VerticlewithBox.png', array('_area' => 'adminhtml')) . '" /><br />');
9
  $result[] = array('value' => 'counter_vertical', 'label' => '<img src="' . Mage::getDesign()->getSkinUrl('Loginradius/Sociallogin/images/Sharing/Vertical/verticalvertical.png', array('_area' => 'adminhtml')) . '" /><br />');
10
  $result[] = array('value' => 'counter_horizontal', 'label' => '<img src="' . Mage::getDesign()->getSkinUrl('Loginradius/Sociallogin/images/Sharing/Vertical/verticalhorizontal.png', array('_area' => 'adminhtml')) . '" /><br />');
 
11
  return $result;
12
  }
13
  }
1
  <?php
2
+
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * sociallogin verticalsharing source model
17
+ *
18
+ * @category Loginradius
19
+ * @package Loginradius_Sociallogin
20
+ * @author LoginRadius Team
21
+ */
22
+
23
+ /**
24
+ * Class Loginradius_Sociallogin_Model_Source_VerticalSharing which return vertical sharing theme options
25
+ */
26
  class Loginradius_Sociallogin_Model_Source_VerticalSharing
27
  {
28
+ /**
29
+ * function return array of vertical themes
30
+ *
31
+ * @return array
32
+ */
33
  public function toOptionArray()
34
  {
35
  $result = array();
37
  $result[] = array('value' => '16', 'label' => '<img src="' . Mage::getDesign()->getSkinUrl('Loginradius/Sociallogin/images/Sharing/Vertical/16VerticlewithBox.png', array('_area' => 'adminhtml')) . '" /><br />');
38
  $result[] = array('value' => 'counter_vertical', 'label' => '<img src="' . Mage::getDesign()->getSkinUrl('Loginradius/Sociallogin/images/Sharing/Vertical/verticalvertical.png', array('_area' => 'adminhtml')) . '" /><br />');
39
  $result[] = array('value' => 'counter_horizontal', 'label' => '<img src="' . Mage::getDesign()->getSkinUrl('Loginradius/Sociallogin/images/Sharing/Vertical/verticalhorizontal.png', array('_area' => 'adminhtml')) . '" /><br />');
40
+
41
  return $result;
42
  }
43
  }
app/code/community/Loginradius/Sociallogin/Model/System/Config/Info.php CHANGED
@@ -1,5 +1,24 @@
1
  <?php
2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  class Loginradius_Sociallogin_Model_System_Config_Info extends Mage_Adminhtml_Block_Abstract implements Varien_Data_Form_Element_Renderer_Interface
4
  {
5
 
@@ -29,6 +48,9 @@ class Loginradius_Sociallogin_Model_System_Config_Info extends Mage_Adminhtml_Bl
29
  $this->render_module_admin_script_container();
30
  }
31
 
 
 
 
32
  public function render_module_thanks_message_container()
33
  {
34
  ?>
@@ -67,6 +89,9 @@ class Loginradius_Sociallogin_Model_System_Config_Info extends Mage_Adminhtml_Bl
67
  <?php
68
  }
69
 
 
 
 
70
  public function render_module_info_container()
71
  {
72
  ?>
@@ -74,7 +99,7 @@ class Loginradius_Sociallogin_Model_System_Config_Info extends Mage_Adminhtml_Bl
74
  <h4 class="lr_admin_fieldset_title"><strong><?php echo $this->__('Extension Information!') ?></strong></h4>
75
 
76
  <div style="margin:5px 0">
77
- <strong>Version: </strong>4.1.0 <br/>
78
  <strong>Author:</strong> LoginRadius<br/>
79
  <strong>Website:</strong> <a href="https://www.loginradius.com" target="_blank">www.loginradius.com</a>
80
  <br/>
@@ -100,6 +125,9 @@ class Loginradius_Sociallogin_Model_System_Config_Info extends Mage_Adminhtml_Bl
100
  <?php
101
  }
102
 
 
 
 
103
  public function render_module_help_and_documentations_container()
104
  {
105
  ?>
@@ -122,6 +150,9 @@ class Loginradius_Sociallogin_Model_System_Config_Info extends Mage_Adminhtml_Bl
122
  <?php
123
  }
124
 
 
 
 
125
  public function render_module_support_us_container()
126
  {
127
  ?>
@@ -139,6 +170,9 @@ class Loginradius_Sociallogin_Model_System_Config_Info extends Mage_Adminhtml_Bl
139
  <?php
140
  }
141
 
 
 
 
142
  public function render_module_admin_script_container()
143
  {
144
  ?>
@@ -176,7 +210,7 @@ class Loginradius_Sociallogin_Model_System_Config_Info extends Mage_Adminhtml_Bl
176
  });
177
  // toggle sharing/counter providers according to the theme and sharing type
178
  function loginRadiusToggleSharingProviders(element, sharingType) {
179
- if (element.value == '32' || element.value == '16') {
180
  document.getElementById('row_sociallogin_options_' + sharingType + 'Sharing_' + sharingType + 'SharingProviders').style.display = 'table-row';
181
  document.getElementById('row_sociallogin_options_' + sharingType + 'Sharing_' + sharingType + 'CounterProviders').style.display = 'none';
182
  document.getElementById('row_sociallogin_options_' + sharingType + 'Sharing_' + sharingType + 'SharingProvidersHidden').style.display = 'table-row';
1
  <?php
2
 
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * sociallogin system config info model
17
+ *
18
+ * @category Loginradius
19
+ * @package Loginradius_Sociallogin
20
+ * @author LoginRadius Team
21
+ */
22
  class Loginradius_Sociallogin_Model_System_Config_Info extends Mage_Adminhtml_Block_Abstract implements Varien_Data_Form_Element_Renderer_Interface
23
  {
24
 
48
  $this->render_module_admin_script_container();
49
  }
50
 
51
+ /**
52
+ * Get LoginRadius Module Thanks message container..
53
+ */
54
  public function render_module_thanks_message_container()
55
  {
56
  ?>
89
  <?php
90
  }
91
 
92
+ /**
93
+ * Get LoginRadius Module information container..
94
+ */
95
  public function render_module_info_container()
96
  {
97
  ?>
99
  <h4 class="lr_admin_fieldset_title"><strong><?php echo $this->__('Extension Information!') ?></strong></h4>
100
 
101
  <div style="margin:5px 0">
102
+ <strong>Version: </strong><?php echo Mage::getConfig()->getNode()->modules->Loginradius_Sociallogin->version; ?> <br/>
103
  <strong>Author:</strong> LoginRadius<br/>
104
  <strong>Website:</strong> <a href="https://www.loginradius.com" target="_blank">www.loginradius.com</a>
105
  <br/>
125
  <?php
126
  }
127
 
128
+ /**
129
+ * Get LoginRadius Module Help & Documentations container..
130
+ */
131
  public function render_module_help_and_documentations_container()
132
  {
133
  ?>
150
  <?php
151
  }
152
 
153
+ /**
154
+ * Get LoginRadius Module Help & Documentations container..
155
+ */
156
  public function render_module_support_us_container()
157
  {
158
  ?>
170
  <?php
171
  }
172
 
173
+ /**
174
+ * Render script for extension admin configuration options
175
+ */
176
  public function render_module_admin_script_container()
177
  {
178
  ?>
210
  });
211
  // toggle sharing/counter providers according to the theme and sharing type
212
  function loginRadiusToggleSharingProviders(element, sharingType) {
213
+ if (element.value == '32' || element.value == '16' || element.value == 'responsive') {
214
  document.getElementById('row_sociallogin_options_' + sharingType + 'Sharing_' + sharingType + 'SharingProviders').style.display = 'table-row';
215
  document.getElementById('row_sociallogin_options_' + sharingType + 'Sharing_' + sharingType + 'CounterProviders').style.display = 'none';
216
  document.getElementById('row_sociallogin_options_' + sharingType + 'Sharing_' + sharingType + 'SharingProvidersHidden').style.display = 'table-row';
app/code/community/Loginradius/Sociallogin/controllers/IndexController.php CHANGED
@@ -1,94 +1,244 @@
1
  <?php
2
- Mage::app('default');
3
- function getMazeTable($tbl)
4
- {
5
- $tableName = Mage::getSingleton('core/resource')->getTableName($tbl);
6
-
7
- return ($tableName);
8
- }
9
 
10
- //customer will be re-directed to this file. this file handle all token, email etc things.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  class Loginradius_Sociallogin_IndexController extends Mage_Core_Controller_Front_Action
12
  {
13
  public $socialloginProfileData;
14
  public $blockObj;
15
  private $loginRadiusPopMsg;
16
  private $loginRadiusPopErr;
 
17
 
 
 
 
18
  public function indexAction()
19
  {
 
20
  $this->blockObj = new Loginradius_Sociallogin_Block_Sociallogin();
21
- $token = isset($_REQUEST['token']) ? trim($_REQUEST['token']) : '';
22
- if (!empty($token)) {
23
- $this->tokenHandle($token);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
 
25
- return;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
  }
 
27
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
28
  // email verification
29
  if (isset($_GET['loginRadiusKey']) && !empty($_GET['loginRadiusKey'])) {
30
- $loginRadiusVkey = trim($_GET['loginRadiusKey']);
31
  // get entity_id and provider of the vKey
32
- $result = Mage::helper('sociallogin/loginhelper')->loginRadiusRead("sociallogin", "verification", array($loginRadiusVkey), true);
33
  if ($temp = $result->fetch()) {
34
  // set verified status true at this verification key
35
  $tempUpdate = array("verified" => '1', "vkey" => '');
36
  $tempUpdate2 = array("vkey = ?" => $loginRadiusVkey);
37
- Mage::helper('sociallogin/loginhelper')->SocialLoginInsert("sociallogin", $tempUpdate, true, $tempUpdate2);
38
 
39
- $session = Mage::getSingleton('customer/session');
40
- $session->addSuccess(__('Your email has been verified. Now you can login to your account.'));
41
  // check if verification for same provider is still pending on this entity_id
42
- if (Mage::helper('sociallogin/loginhelper')->loginRadiusRead("sociallogin", "verification2", array($temp['entity_id'], $temp['provider']))) {
43
  $tempUpdate = array("vkey" => '');
44
  $tempUpdate2 = array("entity_id = ?" => $temp['entity_id'], "provider = ?" => $temp['provider']);
45
- Mage::helper('sociallogin/loginhelper')->SocialLoginInsert("sociallogin", $tempUpdate, true, $tempUpdate2);
46
  }
 
 
47
  header("Location:" . Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK));
48
- die;
 
49
  }
50
  }
51
 
52
- if (isset($_POST['LoginRadiusRedSliderClick'])) {
53
- $loginhelper = Mage::helper('sociallogin/loginhelper');
54
  $socialLoginProfileData = Mage::getSingleton('core/session')->getSocialLoginData();
55
  $session_user_id = $socialLoginProfileData['lrId'];
56
  $loginRadiusPopProvider = $socialLoginProfileData['Provider'];
57
- $loginRadiusAvatar = $socialLoginProfileData['thumbnail'];
58
  if (!empty($session_user_id)) {
59
  $loginRadiusProfileData = array();
60
  // address
61
  if (isset($_POST['loginRadiusAddress'])) {
62
  $loginRadiusProfileData['Address'] = "";
63
- $profileAddress = trim($_POST['loginRadiusAddress']);
64
  }
65
  // city
66
  if (isset($_POST['loginRadiusCity'])) {
67
  $loginRadiusProfileData['City'] = "";
68
- $profileCity = trim($_POST['loginRadiusCity']);
69
  }
70
  // country
71
  if (isset($_POST['loginRadiusCountry'])) {
72
  $loginRadiusProfileData['Country'] = "";
73
- $profileCountry = trim($_POST['loginRadiusCountry']);
74
  }
75
  // phone number
76
  if (isset($_POST['loginRadiusPhone'])) {
77
  $loginRadiusProfileData['PhoneNumber'] = "";
78
- $profilePhone = trim($_POST['loginRadiusPhone']);
79
  }
80
  // email
81
  if (isset($_POST['loginRadiusEmail'])) {
82
  $email = trim($_POST['loginRadiusEmail']);
83
- $select = $loginhelper->loginRadiusRead("customer_entity", "email_already_exists", array($email), true);
84
  if ($rowArray = $select->fetch()) {
85
  $errorMessage = $this->blockObj->getPopupError();
86
  if ($this->blockObj->getProfileFieldsRequired() == 1) {
87
- $loginhelper->setTmpSession("", $errorMessage, true, $socialLoginProfileData, true);
88
  } else {
89
- $loginhelper->setTmpSession("", $errorMessage, true, array(), true, true);
90
  }
91
- $this->popupHandle();
92
 
93
  return;
94
  }
@@ -99,43 +249,43 @@ class Loginradius_Sociallogin_IndexController extends Mage_Core_Controller_Front
99
  } else {
100
  $hideZipCountry = true;
101
  }
102
- Mage::helper('sociallogin/loginhelper')->setTmpSession($this->blockObj->getPopupText(), $this->blockObj->getPopupError(), true, $loginRadiusProfileData, true, $hideZipCountry);
103
- $this->popupHandle();
104
 
105
  return;
106
  }
107
  // check if email already exists
108
- $userId = Mage::helper('sociallogin/loginhelper')->loginRadiusRead("customer_entity", "email exists pop1", array($email), true);
109
  if ($rowArray = $userId->fetch()) { // email exists
110
  //check if entry exists on same provider in sociallogin table
111
- $verified = Mage::helper('sociallogin/loginhelper')->loginRadiusRead("sociallogin", "email exists sl", array($rowArray['entity_id'], $loginRadiusPopProvider), true);
112
  if ($rowArray2 = $verified->fetch()) {
113
  // check verified field
114
  if ($rowArray2['verified'] == "1") {
115
  // check sociallogin id
116
  if ($rowArray2['sociallogin_id'] == $session_user_id) {
117
- $this->socialLoginUserLogin($rowArray['entity_id'], $rowArray2['sociallogin_id']);
118
  } else {
119
- Mage::helper('sociallogin/loginhelper')->setTmpSession($this->loginRadiusPopMsg, $this->loginRadiusPopErr, true, array(), true, true);
120
- $this->popupHandle();
121
  }
122
 
123
  return;
124
  } else {
125
  // check sociallogin id
126
  if ($rowArray2['sociallogin_id'] == $session_user_id) {
127
- Mage::helper('sociallogin/loginhelper')->setTmpSession("Please provide following details", "", true, $this->socialloginProfileData, false);
128
- $this->popupHandle();
129
  } else {
130
  // send verification email
131
- Mage::helper('sociallogin/loginhelper')->verifyUser($session_user_id, $rowArray['entity_id'], $loginRadiusAvatar, $loginRadiusPopProvider, $email);
132
  }
133
 
134
  return;
135
  }
136
  } else {
137
  // send verification email
138
- Mage::helper('sociallogin/loginhelper')->verifyUser($session_user_id, $rowArray['entity_id'], $loginRadiusAvatar, $loginRadiusPopProvider, $email);
139
 
140
  return;
141
  }
@@ -143,7 +293,7 @@ class Loginradius_Sociallogin_IndexController extends Mage_Core_Controller_Front
143
  }
144
  // validate other profile fields
145
  if ((isset($profileAddress) && $profileAddress == "") || (isset($profileCity) && $profileCity == "") || (isset($profileCountry) && $profileCountry == "") || (isset($profilePhone) && $profilePhone == "")) {
146
- Mage::helper('sociallogin/loginhelper')->setTmpSession("", "Please fill all the fields", true, $loginRadiusProfileData, true);
147
  $this->popupHandle();
148
 
149
  return;
@@ -183,9 +333,9 @@ class Loginradius_Sociallogin_IndexController extends Mage_Core_Controller_Front
183
  }
184
  Mage::getSingleton('core/session')->unsSocialLoginData(); // unset session
185
  if ($this->blockObj->getProfileFieldsRequired() == "1") {
186
- $this->socialLoginAddNewUser($this->socialloginProfileData, $verify, false, '', true);
187
  } else {
188
- $this->socialLoginAddNewUser($this->socialloginProfileData, $verify);
189
  }
190
 
191
  }
@@ -200,314 +350,20 @@ class Loginradius_Sociallogin_IndexController extends Mage_Core_Controller_Front
200
  Mage::getSingleton('core/session')->unsTmpHideZipcode();
201
 
202
  header("Location:" . Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK));
203
- die;
204
- }
205
- $this->SocialLoginShowLayout();
206
- }
207
-
208
- public function tokenHandle($token)
209
- {
210
- $loginhelper = Mage::helper('sociallogin/loginhelper');
211
- $loginRadiusSDK = Mage::helper('sociallogin/LoginRadiusSDK');
212
- // Fetch user profile using access token ......
213
- $responseFromLoginRadius = $loginRadiusSDK->fetchUserProfile($token);
214
- $userObj = json_decode($responseFromLoginRadius);
215
-
216
- if (isset($userObj->ID) && !empty($userObj->ID)) {
217
- // If linking variable is available then link account
218
- if ($this->blockObj->user_is_already_login()) {
219
- $this->loginRadiusSocialLinking(Mage::getSingleton("customer/session")->getCustomer()->getId(), $userObj->ID, $userObj->Provider, $userObj->ThumbnailImageUrl, true);
220
- }
221
- $this->socialloginProfileData = $loginhelper->socialLoginFilterData($userObj);
222
-
223
- //valid user, checking if user in sociallogin and customer entity tabel
224
- $queryResult = $loginhelper->loginRadiusRead("sociallogin", "get_user_by_social_id", array($userObj->ID), true);
225
- //Social Id Exist in Local DB
226
- if ($result = $queryResult->fetch()) {
227
- if ($result['verified'] == "0") {
228
- $session = Mage::getSingleton('customer/session');
229
- $session->addError(__('Please verify your email to login.'));
230
- header("Location:" . Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK));
231
- die;
232
- } else {
233
- if ($this->blockObj->updateProfileData() != '1') {
234
- $this->socialLoginUserLogin($result['entity_id'], $userObj->ID);
235
- } else {
236
- $this->socialloginProfileData['lrId'] = $userObj->ID;
237
- $this->socialLoginAddNewUser($this->socialloginProfileData, false, true, $result['entity_id']);
238
- }
239
-
240
- return;
241
- }
242
- } //Social Id not Exist in Local DB and email not empty
243
- elseif (isset($userObj->Email[0]->Value) && !empty($userObj->Email[0]->Value)) {
244
- //if email is provided by provider then check if it's in table
245
- $email = $userObj->Email[0]->Value;
246
- $select = $loginhelper->loginRadiusRead("customer_entity", "email_already_exists", array($email), true);
247
- if ($rowArray = $select->fetch()) {
248
- //user is in customer table
249
- if ($this->blockObj->getLinking() == "1") { // Social Linking
250
- $this->loginRadiusSocialLinking($rowArray['entity_id'], $userObj->ID, $userObj->Provider, $userObj->ThumbnailImageUrl);
251
- }
252
-
253
- if ($this->blockObj->updateProfileData() != '1') {
254
- $this->socialLoginUserLogin($rowArray['entity_id'], $userObj->ID);
255
- } else {
256
- $this->socialloginProfileData = $loginhelper->socialLoginFilterData($userObj);
257
- $this->socialloginProfileData['lrId'] = $userObj->ID;
258
- $this->socialLoginAddNewUser($this->socialloginProfileData, false, true, $rowArray['entity_id']);
259
- }
260
- } else {
261
- $this->socialloginProfileData['lrId'] = $userObj->ID;
262
- if ($this->blockObj->getProfileFieldsRequired() == 1) {
263
- $loginhelper->setInSession($userObj->ID, $this->socialloginProfileData);
264
- $loginhelper->setTmpSession($this->blockObj->getPopupText(), "", true, $this->socialloginProfileData, false);
265
- // show a popup to fill required profile fields
266
- $this->popupHandle();
267
-
268
- return;
269
- }
270
- $this->socialLoginAddNewUser($this->socialloginProfileData);
271
- }
272
- } else {
273
- $emailRequired = true;
274
- if ($this->blockObj->getEmailRequired() == 0) { // dummy email
275
- $email = $loginhelper->generateRandomEmail($userObj);
276
- $this->socialloginProfileData['Email'] = $email;
277
- $this->socialloginProfileData['lrId'] = $userObj->ID;
278
- $emailRequired = false;
279
- }
280
- //
281
- $this->socialloginProfileData['lrToken'] = $this->loginRadiusAccessToken;
282
- //show required fields popup
283
- $loginhelper->setInSession($userObj->ID, $this->socialloginProfileData);
284
- if ($this->blockObj->getProfileFieldsRequired() == 1) {
285
- // show a popup to fill required profile fields
286
- $loginhelper->setTmpSession($this->loginRadiusPopMsg, "", true, $this->socialloginProfileData, $emailRequired);
287
- $this->popupHandle();
288
- } elseif ($this->blockObj->getEmailRequired() == 1) {
289
- $loginhelper->setTmpSession($this->loginRadiusPopMsg, "", true, array(), $emailRequired, true);
290
- $this->popupHandle();
291
- } else {
292
- //create new user without showing popup
293
- $this->socialLoginAddNewUser($this->socialloginProfileData);
294
- }
295
- }
296
- } else {
297
- if ($this->blockObj->isDebuggingOn()) {
298
- Mage::getSingleton('core/session')->addNotice($userObj->description);
299
- session_write_close();
300
- }
301
- $refererUrl = $this->_getRefererUrl();
302
- if (empty($refererUrl)) {
303
- $refererUrl = Mage::getBaseUrl();
304
- }
305
- $this->getResponse()->setRedirect($refererUrl);
306
-
307
- return;
308
  }
309
- }
310
-
311
- function loginRadiusSocialLinking($entityId, $socialId, $provider, $thumbnail, $unique = false)
312
- {
313
- $session = Mage::getSingleton('customer/session');
314
- // check if any account from this provider is already linked
315
- if ($this->blockObj->user_is_already_login()) {
316
- if (Mage::helper('sociallogin/loginhelper')->loginRadiusRead("sociallogin", "get_user_by_social_id", array($socialId))) {
317
- $session->addError(__('This accounts is already linked with an account.'));
318
- header("Location:" . Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK) . "customer/account");
319
- die;
320
- } elseif ($unique && Mage::helper('sociallogin/loginhelper')->loginRadiusRead("sociallogin", "provider exists in sociallogin", array($entityId, $provider))) {
321
- $session->addError(__('Multiple accounts cannot be linked from the same Social ID Provider.'));
322
- header("Location:" . Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK) . "customer/account");
323
- die;
324
- }
325
- }
326
- $socialLoginLinkData = array();
327
- $socialLoginLinkData['sociallogin_id'] = $socialId;
328
- $socialLoginLinkData['entity_id'] = $entityId;
329
- $socialLoginLinkData['provider'] = empty($provider) ? "" : $provider;
330
- $socialLoginLinkData['avatar'] = Mage::helper('sociallogin/loginHelper')->socialLoginFilterAvatar($socialId, $thumbnail, $provider);
331
- $socialLoginLinkData['avatar'] = ($socialLoginLinkData['avatar'] == "") ? null : $socialLoginLinkData['avatar'];
332
- Mage::helper('sociallogin/loginhelper')->SocialLoginInsert("sociallogin", $socialLoginLinkData);
333
- if ($this->blockObj->user_is_already_login()) {
334
- $session->addSuccess(__('Account linked successfully.'));
335
- header("Location:" . Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK) . "customer/account");
336
- die;
337
- }
338
- }
339
-
340
- function socialLoginUserLogin($entityId, $socialId, $loginOrRegister = 'Login')
341
- {
342
- $session = Mage::getSingleton("customer/session");
343
- $customer = Mage::getModel('customer/customer')->load($entityId);
344
- $customer->setWebsiteId(Mage::app()->getWebsite()->getId());
345
- $session->setCustomerAsLoggedIn($customer);
346
- $functionForRedirectOption = 'get' . $loginOrRegister . 'RedirectOption';
347
- $Hover = $this->blockObj->$functionForRedirectOption();
348
- $functionForCustomRedirectOption = 'getCustom' . $loginOrRegister . 'RedirectOption';
349
- $write_url = $this->blockObj->$functionForCustomRedirectOption();
350
- $url = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK);
351
- // check if logged in from callback page
352
- if (isset($_GET['loginradiuscheckout'])) {
353
- $currentUrl = Mage::helper('checkout/url')->getCheckoutUrl();
354
- Mage::app()->getResponse()->setRedirect($currentUrl)->sendResponse();
355
- }
356
- if ($Hover == 'account') {
357
- $currentUrl = $url . 'customer/account';
358
- } elseif ($Hover == 'index') {
359
- $currentUrl = $url;
360
- } elseif ($Hover == 'custom' && $write_url != '') {
361
- $currentUrl = $write_url;
362
- } elseif ($Hover == 'same') {
363
- $currentUrl = Mage::helper('core/http')->getHttpReferer() ? Mage::helper('core/http')->getHttpReferer() : Mage::getUrl();
364
- } else {
365
- if (isset($_GET['redirect_to'])) {
366
- $currentUrl = trim($_GET['redirect_to']);
367
- } else {
368
- $currentUrl = $url;
369
- }
370
-
371
- }
372
- Mage::app()->getResponse()->setRedirect($currentUrl)->sendResponse();
373
- }
374
-
375
- // if token is posted then this function will be called. It will login user if already in database. else if email is provided by api, it will insert data and login user. It will handle all after token.
376
-
377
- function socialLoginAddNewUser($socialloginProfileData, $verify = false, $update = false, $customerId = '', $requiredFields = false)
378
- {
379
- $websiteId = Mage::app()->getWebsite()->getId();
380
- $store = Mage::app()->getStore();
381
- if (!$update) {
382
- $redirectionTo = 'Registration';
383
- // add new user magento way
384
- $customer = Mage::getModel("customer/customer");
385
- } else {
386
- $redirectionTo = 'Login';
387
- $customer = Mage::getModel('customer/customer')->load($customerId);
388
- }
389
- $customer->website_id = $websiteId;
390
- $customer->setStore($store);
391
- if ($socialloginProfileData['FirstName'] != "") {
392
- $customer->firstname = $socialloginProfileData['FirstName'];
393
- }
394
- if (!$update) {
395
- $customer->lastname = $socialloginProfileData['LastName'] == "" ? $socialloginProfileData['FirstName'] : $socialloginProfileData['LastName'];
396
- } elseif ($update && $socialloginProfileData['LastName'] != "") {
397
- $customer->lastname = $socialloginProfileData['LastName'];
398
- }
399
- if (!$update) {
400
- $customer->email = $socialloginProfileData['Email'];
401
- $loginRadiusPwd = $customer->generatePassword(10);
402
- $customer->password_hash = md5($loginRadiusPwd);
403
- }
404
- if ($socialloginProfileData['BirthDate'] != "") {
405
- $customer->dob = $socialloginProfileData['BirthDate'];
406
- }
407
- if ($socialloginProfileData['Gender'] != "") {
408
- $customer->gender = $socialloginProfileData['Gender'];
409
- }
410
- $customer->setConfirmation(null);
411
- $customer->save();
412
-
413
- $address = Mage::getModel("customer/address");
414
- if (!$update) {
415
- $address->setCustomerId($customer->getId());
416
- }
417
- if (!$update) {
418
- $address->firstname = $customer->firstname;
419
- $address->lastname = $customer->lastname;
420
- $address->country_id = isset($socialloginProfileData['Country']) ? ucfirst($socialloginProfileData['Country']) : '';
421
- if (isset($socialloginProfileData['Zipcode'])) {
422
- $address->postcode = $socialloginProfileData['Zipcode'];
423
- }
424
- $address->city = isset($socialloginProfileData['City']) ? ucfirst($socialloginProfileData['City']) : '';
425
- // If country is USA, set up province
426
- if (isset($socialloginProfileData['Province'])) {
427
- $address->region = $socialloginProfileData['Province'];
428
- }
429
- $address->telephone = isset($socialloginProfileData['PhoneNumber']) ? ucfirst($socialloginProfileData['PhoneNumber']) : '';
430
- $address->company = isset($socialloginProfileData['Industry']) ? ucfirst($socialloginProfileData['Industry']) : '';
431
- $address->street = isset($socialloginProfileData['Address']) ? ucfirst($socialloginProfileData['Address']) : '';
432
- // set default billing, shipping address and save in address book
433
- $address->setIsDefaultShipping('1')->setIsDefaultBilling('1')->setSaveInAddressBook('1');
434
- if ($requiredFields) {
435
- $address->save();
436
- }
437
- }
438
- // add info in sociallogin table
439
- if (!$verify) {
440
- $fields = array();
441
- $fields['sociallogin_id'] = $socialloginProfileData['lrId'];
442
- $fields['entity_id'] = $customer->getId();
443
- $fields['avatar'] = $socialloginProfileData['thumbnail'];
444
- $fields['provider'] = $socialloginProfileData['Provider'];
445
- if (!$update) {
446
- Mage::helper('sociallogin/loginhelper')->SocialLoginInsert("sociallogin", $fields);
447
- } else {
448
- Mage::helper('sociallogin/loginhelper')->SocialLoginInsert("sociallogin", array('avatar' => $socialloginProfileData['thumbnail']), true, array('entity_id = ?' => $customerId));
449
- }
450
- if (!$update) {
451
- $loginRadiusUsername = $socialloginProfileData['FirstName'] . " " . $socialloginProfileData['LastName'];
452
- // email notification to user
453
- if ($this->blockObj->notifyUser() == "1") {
454
- $loginRadiusMessage = $this->blockObj->notifyUserText();
455
- if ($loginRadiusMessage == "") {
456
- $loginRadiusMessage = __("Welcome to ") . $store->getGroup()->getName() . ". " . __("You can login to the store using following e-mail address and password");
457
- }
458
- $loginRadiusMessage .= "<br/>" . "Email : " . $socialloginProfileData['Email'] . "<br/>" . __("Password") . " : " . $loginRadiusPwd;
459
-
460
- Mage::helper('sociallogin/loginhelper')->loginRadiusEmail(__("Welcome") . " " . $loginRadiusUsername . "!", $loginRadiusMessage, $socialloginProfileData['Email'], $loginRadiusUsername);
461
- }
462
- // new user notification to admin
463
- if ($this->blockObj->notifyAdmin() == "1") {
464
- $loginRadiusAdminEmail = Mage::getStoreConfig('trans_email/ident_general/email');
465
- $loginRadiusAdminName = Mage::getStoreConfig('trans_email/ident_general/name');
466
- $loginRadiusMessage = trim($this->blockObj->notifyAdminText());
467
- if ($loginRadiusMessage == "") {
468
- $loginRadiusMessage = __("New customer has been registered to your store with following details");
469
- }
470
- $loginRadiusMessage .= "<br/>" . __("Name") . " : " . $loginRadiusUsername . "<br/>" . __("Email") . " : " . $socialloginProfileData['Email'];
471
- Mage::helper('sociallogin/loginhelper')->loginRadiusEmail(__("New User Registration"), $loginRadiusMessage, $loginRadiusAdminEmail, $loginRadiusAdminName);
472
- }
473
- }
474
- //login and redirect user
475
- $this->socialLoginUserLogin($customer->getId(), $fields['sociallogin_id'], $redirectionTo);
476
- }
477
- if ($verify) {
478
- $loginRadiusUsername = $socialloginProfileData['FirstName'] . " " . $socialloginProfileData['LastName'];
479
- Mage::helper('sociallogin/loginhelper')->verifyUser($socialloginProfileData['lrId'], $customer->getId(), $socialloginProfileData['thumbnail'], $socialloginProfileData['Provider'], $socialloginProfileData['Email'], true, $loginRadiusUsername);
480
- }
481
- }
482
-
483
- public function popupHandle()
484
- {
485
  $this->loadLayout();
486
- $this->getLayout()->getBlock('content')->append(
487
- $this->getLayout()->createBlock('Mage_Core_Block_Template', 'emailpopup', array('template' => 'sociallogin/popup.phtml'))
488
- );
489
  $this->renderLayout();
490
 
491
- return $this;
492
- }
493
-
494
- public function SocialLoginShowLayout()
495
- {
496
- $this->loadLayout();
497
- $this->renderLayout();
498
  }
499
 
500
  /**
501
- * Action for AJAX
502
  */
503
- function ajaxAction()
504
- {
505
- $this->loadLayout();
506
- $this->renderLayout();
507
- }
508
-
509
  protected function _getSession()
510
  {
511
  return Mage::getSingleton('sociallogin/session');
512
  }
 
 
513
  }
1
  <?php
 
 
 
 
 
 
 
2
 
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * sociallogin controller
17
+ *
18
+ * @category Loginradius
19
+ * @package Loginradius_Sociallogin
20
+ * @author LoginRadius Team
21
+ */
22
+
23
+ /**
24
+ * Class Loginradius_Sociallogin_IndexController this is the controller where loginradius login and registration takes place
25
+ */
26
  class Loginradius_Sociallogin_IndexController extends Mage_Core_Controller_Front_Action
27
  {
28
  public $socialloginProfileData;
29
  public $blockObj;
30
  private $loginRadiusPopMsg;
31
  private $loginRadiusPopErr;
32
+ private $loginRadiusToken;
33
 
34
+ /**
35
+ * Default action for LoginRadius sociallogin controller
36
+ */
37
  public function indexAction()
38
  {
39
+ $this->loginRadiusToken = $this->getRequest()->getPost('token');
40
  $this->blockObj = new Loginradius_Sociallogin_Block_Sociallogin();
41
+ $this->loginRadiusPopMsg = trim($this->blockObj->getPopupText());
42
+ $this->loginRadiusPopErr = trim($this->blockObj->getPopupError());
43
+ if (!empty($this->loginRadiusToken)) {
44
+ $this->tokenHandler();
45
+ } else {
46
+ $this->popupHandler();
47
+ }
48
+
49
+ }
50
+
51
+ /**
52
+ * This function handles all the process once got the token from LoginRadius
53
+ */
54
+ public function tokenHandler()
55
+ {
56
+ $loginHelper = Mage::helper('sociallogin/loginhelper');
57
+ $loginRadiusSdk = Mage::helper('sociallogin/loginradiussdk');
58
+ // Fetch user profile using access token ......
59
+ $responseFromLoginRadius = $loginRadiusSdk->fetchUserProfile($this->loginRadiusToken);
60
+ $userObj = json_decode($responseFromLoginRadius);
61
+
62
+ if (is_object($userObj) && isset($userObj->ID) && !empty($userObj->ID)) {
63
+ $this->socialloginProfileData = $loginHelper->socialLoginFilterData($userObj);
64
+ $this->socialloginProfileData['lrToken'] = $this->loginRadiusToken;
65
+ // If linking variable is available then link account
66
+ if ($loginHelper->isAlreadyLoggedIn()) {
67
+ $loginHelper->loginRadiusSocialLinking(Mage::getSingleton("customer/session")->getCustomer()->getId(), $userObj->ID, $userObj->Provider, $userObj->ThumbnailImageUrl, true);
68
+ }
69
+ //user not loggedin
70
+ if (!$loginHelper->isAlreadyLoggedIn()) {
71
+ //check user on database with social id
72
+
73
+ $innerJoinQuery = $loginHelper->loginRadiusRead("sociallogin", "get_user_by_social_id", array($userObj->ID), true);
74
+ if ($customerEntity = $innerJoinQuery->fetch()) {
75
+ if ($customerEntity['verified'] == "0") {
76
+ $session = Mage::getSingleton('customer/session');
77
+ $session->addError(__('Please verify your email to login.'));
78
+ header("Location:" . Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK));
79
+ exit();
80
+ } else {
81
+ if ($this->blockObj->updateProfileData() != '1') {
82
+ $loginHelper->socialLoginUserLogin($customerEntity['entity_id'], $userObj->ID);
83
+ } else {
84
+ $this->socialloginProfileData['lrId'] = $userObj->ID;
85
+ $loginHelper->socialLoginAddNewUser($this->socialloginProfileData, false, true, $customerEntity['entity_id']);
86
+ }
87
+
88
+ return;
89
+ }
90
+ } //Social Id not Exist in Local DB and email not empty
91
+ elseif (isset($userObj->Email[0]->Value) && !empty($userObj->Email[0]->Value)) {
92
+ //if email is provided by provider then check if it's in table
93
+ $email = $userObj->Email[0]->Value;
94
+ $select = $loginHelper->loginRadiusRead("customer_entity", "email_already_exists", array($email), true);
95
+ if ($rowArray = $select->fetch()) {
96
+ //user is in customer table
97
+ if ($this->blockObj->getLinking() == "1") { // Social Linking
98
+ $loginHelper->loginRadiusSocialLinking($rowArray['entity_id'], $userObj->ID, $userObj->Provider, $userObj->ThumbnailImageUrl);
99
+ }
100
 
101
+ if ($this->blockObj->updateProfileData() != '1') {
102
+ $loginHelper->socialLoginUserLogin($rowArray['entity_id'], $userObj->ID);
103
+ } else {
104
+ $this->socialloginProfileData = $loginHelper->socialLoginFilterData($userObj);
105
+ $this->socialloginProfileData['lrId'] = $userObj->ID;
106
+ $loginHelper->socialLoginAddNewUser($this->socialloginProfileData, false, true, $rowArray['entity_id']);
107
+ }
108
+ } else {
109
+ $this->socialloginProfileData['lrId'] = $userObj->ID;
110
+ if ($this->blockObj->getProfileFieldsRequired() == 1) {
111
+ $loginHelper->setInSession($userObj->ID, $this->socialloginProfileData);
112
+ Mage::helper('sociallogin')->setTmpSession($this->blockObj->getPopupText(), "", true, $this->socialloginProfileData, false);
113
+ // show a popup to fill required profile fields
114
+ $this->getPopupTemplate();
115
+
116
+ return;
117
+ }
118
+ $loginHelper->socialLoginAddNewUser($this->socialloginProfileData);
119
+ }
120
+ } else {
121
+ $emailRequired = true;
122
+ if ($this->blockObj->getEmailRequired() == 0) { // dummy email
123
+ $email = $loginHelper->getAutoGeneratedEmail($userObj);
124
+ $this->socialloginProfileData['Email'] = $email;
125
+ $this->socialloginProfileData['lrId'] = $userObj->ID;
126
+ $emailRequired = false;
127
+ }
128
+ //
129
+ $this->socialloginProfileData['lrToken'] = $this->loginRadiusToken;
130
+ //show required fields popup
131
+ $loginHelper->setInSession($userObj->ID, $this->socialloginProfileData);
132
+ if ($this->blockObj->getProfileFieldsRequired() == 1) {
133
+ // show a popup to fill required profile fields
134
+ Mage::helper('sociallogin')->setTmpSession($this->loginRadiusPopMsg, "", true, $this->socialloginProfileData, $emailRequired);
135
+ $this->getPopupTemplate();
136
+ } elseif ($this->blockObj->getEmailRequired() == 1) {
137
+ Mage::helper('sociallogin')->setTmpSession($this->loginRadiusPopMsg, "", true, $this->socialloginProfileData, $emailRequired, true);
138
+ $this->getPopupTemplate();
139
+ } else {
140
+ //create new user without showing popup
141
+ $loginHelper->socialLoginAddNewUser($this->socialloginProfileData);
142
+ }
143
+ }
144
+ }
145
+ } else {
146
+ if ($this->blockObj->isDebuggingOn()) {
147
+ Mage::getSingleton('core/session')->addError($userObj->description);
148
+ }
149
+ $referrerUrl = $this->_getRefererUrl();
150
+ if (empty($referrerUrl)) {
151
+ $referrerUrl = Mage::getBaseUrl();
152
+ }
153
+ header("Location:" . $referrerUrl);
154
+ exit();
155
  }
156
+ }
157
 
158
+ /**
159
+ * Get template to render email required popup
160
+ */
161
+ public function getPopupTemplate()
162
+ {
163
+ $this->loadLayout();
164
+ $this->getLayout()->getBlock('content')->append(
165
+ $this->getLayout()->createBlock('Mage_Core_Block_Template', 'emailpopup', array('template' => 'sociallogin/popup.phtml'))
166
+ );
167
+ $this->renderLayout();
168
+
169
+ return $this;
170
+ }
171
+
172
+ /**
173
+ * Function to display friend invite popup, delas with email poup submission, customer verification functionality.
174
+ */
175
+ public function popupHandler()
176
+ {
177
+ $loginHelper = Mage::helper('sociallogin/loginhelper');
178
  // email verification
179
  if (isset($_GET['loginRadiusKey']) && !empty($_GET['loginRadiusKey'])) {
180
+ $loginRadiusVkey = strip_tags(trim($_GET['loginRadiusKey']));
181
  // get entity_id and provider of the vKey
182
+ $result = $loginHelper->loginRadiusRead("sociallogin", "verification", array($loginRadiusVkey), true);
183
  if ($temp = $result->fetch()) {
184
  // set verified status true at this verification key
185
  $tempUpdate = array("verified" => '1', "vkey" => '');
186
  $tempUpdate2 = array("vkey = ?" => $loginRadiusVkey);
187
+ $loginHelper->SocialLoginInsert("sociallogin", $tempUpdate, true, $tempUpdate2);
188
 
 
 
189
  // check if verification for same provider is still pending on this entity_id
190
+ if ($loginHelper->loginRadiusRead("sociallogin", "verification2", array($temp['entity_id'], $temp['provider']))) {
191
  $tempUpdate = array("vkey" => '');
192
  $tempUpdate2 = array("entity_id = ?" => $temp['entity_id'], "provider = ?" => $temp['provider']);
193
+ $loginHelper->SocialLoginInsert("sociallogin", $tempUpdate, true, $tempUpdate2);
194
  }
195
+ $session = Mage::getSingleton('core/session');
196
+ $session->addSuccess(__('Your email has been verified. Now you can login to your account.'));
197
  header("Location:" . Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK));
198
+ exit();
199
+
200
  }
201
  }
202
 
203
+ if (isset($_POST['EmailPopupOkButton'])) {
 
204
  $socialLoginProfileData = Mage::getSingleton('core/session')->getSocialLoginData();
205
  $session_user_id = $socialLoginProfileData['lrId'];
206
  $loginRadiusPopProvider = $socialLoginProfileData['Provider'];
207
+ $loginRadiusAvatar = $socialLoginProfileData['Thumbnail'];
208
  if (!empty($session_user_id)) {
209
  $loginRadiusProfileData = array();
210
  // address
211
  if (isset($_POST['loginRadiusAddress'])) {
212
  $loginRadiusProfileData['Address'] = "";
213
+ $profileAddress = strip_tags(trim($_POST['loginRadiusAddress']));
214
  }
215
  // city
216
  if (isset($_POST['loginRadiusCity'])) {
217
  $loginRadiusProfileData['City'] = "";
218
+ $profileCity = strip_tags(trim($_POST['loginRadiusCity']));
219
  }
220
  // country
221
  if (isset($_POST['loginRadiusCountry'])) {
222
  $loginRadiusProfileData['Country'] = "";
223
+ $profileCountry = strip_tags(trim($_POST['loginRadiusCountry']));
224
  }
225
  // phone number
226
  if (isset($_POST['loginRadiusPhone'])) {
227
  $loginRadiusProfileData['PhoneNumber'] = "";
228
+ $profilePhone = strip_tags(trim($_POST['loginRadiusPhone']));
229
  }
230
  // email
231
  if (isset($_POST['loginRadiusEmail'])) {
232
  $email = trim($_POST['loginRadiusEmail']);
233
+ $select = $loginHelper->loginRadiusRead("customer_entity", "email_already_exists", array($email), true);
234
  if ($rowArray = $select->fetch()) {
235
  $errorMessage = $this->blockObj->getPopupError();
236
  if ($this->blockObj->getProfileFieldsRequired() == 1) {
237
+ Mage::helper('sociallogin')->setTmpSession("", $errorMessage, true, $socialLoginProfileData, true);
238
  } else {
239
+ Mage::helper('sociallogin')->setTmpSession("", $errorMessage, true, $socialLoginProfileData, true, true);
240
  }
241
+ $this->getPopupTemplate();
242
 
243
  return;
244
  }
249
  } else {
250
  $hideZipCountry = true;
251
  }
252
+ Mage::helper('sociallogin')->setTmpSession($this->blockObj->getPopupText(), $this->blockObj->getPopupError(), true, $loginRadiusProfileData, true, $hideZipCountry);
253
+ $this->getPopupTemplate();
254
 
255
  return;
256
  }
257
  // check if email already exists
258
+ $userId = $loginHelper->loginRadiusRead("customer_entity", "email exists pop1", array($email), true);
259
  if ($rowArray = $userId->fetch()) { // email exists
260
  //check if entry exists on same provider in sociallogin table
261
+ $verified = $loginHelper->loginRadiusRead("sociallogin", "email exists sl", array($rowArray['entity_id'], $loginRadiusPopProvider), true);
262
  if ($rowArray2 = $verified->fetch()) {
263
  // check verified field
264
  if ($rowArray2['verified'] == "1") {
265
  // check sociallogin id
266
  if ($rowArray2['sociallogin_id'] == $session_user_id) {
267
+ $loginHelper->socialLoginUserLogin($rowArray['entity_id'], $rowArray2['sociallogin_id']);
268
  } else {
269
+ Mage::helper('sociallogin')->setTmpSession($this->loginRadiusPopMsg, $this->loginRadiusPopErr, true, array(), true, true);
270
+ $this->getPopupTemplate();
271
  }
272
 
273
  return;
274
  } else {
275
  // check sociallogin id
276
  if ($rowArray2['sociallogin_id'] == $session_user_id) {
277
+ Mage::helper('sociallogin')->setTmpSession("Please provide following details", "", true, $this->socialloginProfileData, false);
278
+ $this->getPopupTemplate();
279
  } else {
280
  // send verification email
281
+ $loginHelper->verifyUser($session_user_id, $rowArray['entity_id'], $loginRadiusAvatar, $loginRadiusPopProvider, $email);
282
  }
283
 
284
  return;
285
  }
286
  } else {
287
  // send verification email
288
+ $loginHelper->verifyUser($session_user_id, $rowArray['entity_id'], $loginRadiusAvatar, $loginRadiusPopProvider, $email);
289
 
290
  return;
291
  }
293
  }
294
  // validate other profile fields
295
  if ((isset($profileAddress) && $profileAddress == "") || (isset($profileCity) && $profileCity == "") || (isset($profileCountry) && $profileCountry == "") || (isset($profilePhone) && $profilePhone == "")) {
296
+ Mage::helper('sociallogin')->setTmpSession("", "Please fill all the fields", true, $loginRadiusProfileData, true);
297
  $this->popupHandle();
298
 
299
  return;
333
  }
334
  Mage::getSingleton('core/session')->unsSocialLoginData(); // unset session
335
  if ($this->blockObj->getProfileFieldsRequired() == "1") {
336
+ $loginHelper->socialLoginAddNewUser($this->socialloginProfileData, $verify, false, '', true);
337
  } else {
338
+ $loginHelper->socialLoginAddNewUser($this->socialloginProfileData, $verify);
339
  }
340
 
341
  }
350
  Mage::getSingleton('core/session')->unsTmpHideZipcode();
351
 
352
  header("Location:" . Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK));
353
+ exit();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
354
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
355
  $this->loadLayout();
 
 
 
356
  $this->renderLayout();
357
 
 
 
 
 
 
 
 
358
  }
359
 
360
  /**
361
+ * Override _getSession method
362
  */
 
 
 
 
 
 
363
  protected function _getSession()
364
  {
365
  return Mage::getSingleton('sociallogin/session');
366
  }
367
+
368
+
369
  }
app/code/community/Loginradius/Sociallogin/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <Loginradius_Sociallogin>
5
- <version>4.1.0</version>
6
  </Loginradius_Sociallogin>
7
  </modules>
8
  <frontend>
@@ -96,15 +96,15 @@
96
  </modules>
97
  </translate>
98
  <events>
99
- <admin_system_config_changed_section_sociallogin_options>
100
  <observers>
101
  <sociallogin>
102
  <type>singleton</type>
103
  <class>sociallogin/Observer</class>
104
- <method>adminSystemConfigChangedSection</method>
105
  </sociallogin>
106
  </observers>
107
- </admin_system_config_changed_section_sociallogin_options>
108
  </events>
109
  <helpers>
110
  <sociallogin>
@@ -178,7 +178,7 @@
178
  <updateProfileData>1</updateProfileData>
179
  <profileFieldsRequired>0</profileFieldsRequired>
180
  <verificationText>Please click on the following link or paste it in browser to verify your email:-</verificationText>
181
- <popupText>Please provide following details</popupText>
182
  <popupError>The email you entered is already registered or invalid. Please enter a valid email.</popupError>
183
  <notifyUser>1</notifyUser>
184
  <notifyAdmin>0</notifyAdmin>
2
  <config>
3
  <modules>
4
  <Loginradius_Sociallogin>
5
+ <version>4.2.0</version>
6
  </Loginradius_Sociallogin>
7
  </modules>
8
  <frontend>
96
  </modules>
97
  </translate>
98
  <events>
99
+ <model_config_data_save_before>
100
  <observers>
101
  <sociallogin>
102
  <type>singleton</type>
103
  <class>sociallogin/Observer</class>
104
+ <method>validateLoginradiusKeys</method>
105
  </sociallogin>
106
  </observers>
107
+ </model_config_data_save_before>
108
  </events>
109
  <helpers>
110
  <sociallogin>
178
  <updateProfileData>1</updateProfileData>
179
  <profileFieldsRequired>0</profileFieldsRequired>
180
  <verificationText>Please click on the following link or paste it in browser to verify your email:-</verificationText>
181
+ <popupText>You are trying to connect with @provider</popupText>
182
  <popupError>The email you entered is already registered or invalid. Please enter a valid email.</popupError>
183
  <notifyUser>1</notifyUser>
184
  <notifyAdmin>0</notifyAdmin>
app/code/community/Loginradius/Sociallogin/etc/system.xml CHANGED
@@ -256,7 +256,7 @@
256
  <popupText translate="label">
257
  <label>"Email required" - Popup title</label>
258
  <frontend_type>text</frontend_type>
259
- <comment><![CDATA[This text will be displayed on "Email required" popup.]]></comment>
260
  <sort_order>28</sort_order>
261
  <show_in_default>1</show_in_default>
262
  <show_in_website>1</show_in_website>
256
  <popupText translate="label">
257
  <label>"Email required" - Popup title</label>
258
  <frontend_type>text</frontend_type>
259
+ <comment><![CDATA[This text will be displayed on "Email required" popup.@provider will be replaced by social network you are trying to logging in with]]></comment>
260
  <sort_order>28</sort_order>
261
  <show_in_default>1</show_in_default>
262
  <show_in_website>1</show_in_website>
app/code/community/Loginradius/Sociallogin/sql/sociallogin_setup/{mysql4-install-4.1.0.php → mysql4-install-4.2.0.php} RENAMED
@@ -3,7 +3,6 @@ $installer = $this;
3
  $installer->startSetup();
4
  $installer->run(
5
  "
6
- DROP TABLE IF EXISTS {$this->getTable('sociallogin')};
7
  CREATE TABLE IF NOT EXISTS {$this->getTable('sociallogin')} (
8
  `sociallogin_id` varchar(200) default NULL,
9
  `entity_id` int(11) default NULL,
@@ -14,4 +13,5 @@ CREATE TABLE IF NOT EXISTS {$this->getTable('sociallogin')} (
14
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
15
  "
16
  );
 
17
  $installer->endSetup();
3
  $installer->startSetup();
4
  $installer->run(
5
  "
 
6
  CREATE TABLE IF NOT EXISTS {$this->getTable('sociallogin')} (
7
  `sociallogin_id` varchar(200) default NULL,
8
  `entity_id` int(11) default NULL,
13
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
14
  "
15
  );
16
+ $installer->run("alter table {$this->getTable('sociallogin')} modify `sociallogin_id` varchar(200) default NULL");
17
  $installer->endSetup();
app/code/community/Loginradius/Sociallogin/sql/sociallogin_setup/{mysql4-upgrade-3.7.2-4.1.0.php → mysql4-upgrade-3.7.1-4.2.0.php} RENAMED
@@ -2,7 +2,7 @@
2
  $installer = $this;
3
  $installer->startSetup();
4
  $installer->run(
5
- "
6
  CREATE TABLE IF NOT EXISTS {$this->getTable('sociallogin')} (
7
  `sociallogin_id` varchar(200) default NULL,
8
  `entity_id` int(11) default NULL,
@@ -13,4 +13,5 @@ CREATE TABLE IF NOT EXISTS {$this->getTable('sociallogin')} (
13
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
14
  "
15
  );
 
16
  $installer->endSetup();
2
  $installer = $this;
3
  $installer->startSetup();
4
  $installer->run(
5
+ "
6
  CREATE TABLE IF NOT EXISTS {$this->getTable('sociallogin')} (
7
  `sociallogin_id` varchar(200) default NULL,
8
  `entity_id` int(11) default NULL,
13
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
14
  "
15
  );
16
+ $installer->run("alter table {$this->getTable('sociallogin')} modify `sociallogin_id` varchar(200) default NULL");
17
  $installer->endSetup();
app/code/community/Loginradius/Sociallogin/sql/sociallogin_setup/{mysql4-upgrade-3.7.1-4.1.0.php → mysql4-upgrade-3.7.2-4.2.0.php} RENAMED
@@ -2,7 +2,7 @@
2
  $installer = $this;
3
  $installer->startSetup();
4
  $installer->run(
5
- "
6
  CREATE TABLE IF NOT EXISTS {$this->getTable('sociallogin')} (
7
  `sociallogin_id` varchar(200) default NULL,
8
  `entity_id` int(11) default NULL,
@@ -13,4 +13,5 @@ CREATE TABLE IF NOT EXISTS {$this->getTable('sociallogin')} (
13
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
14
  "
15
  );
 
16
  $installer->endSetup();
2
  $installer = $this;
3
  $installer->startSetup();
4
  $installer->run(
5
+ "
6
  CREATE TABLE IF NOT EXISTS {$this->getTable('sociallogin')} (
7
  `sociallogin_id` varchar(200) default NULL,
8
  `entity_id` int(11) default NULL,
13
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
14
  "
15
  );
16
+ $installer->run("alter table {$this->getTable('sociallogin')} modify `sociallogin_id` varchar(200) default NULL");
17
  $installer->endSetup();
app/code/community/Loginradius/Sociallogin/sql/sociallogin_setup/{mysql4-upgrade-4.0.0-4.1.0.php → mysql4-upgrade-4.0.0-4.2.0.php} RENAMED
@@ -2,7 +2,7 @@
2
  $installer = $this;
3
  $installer->startSetup();
4
  $installer->run(
5
- "
6
  CREATE TABLE IF NOT EXISTS {$this->getTable('sociallogin')} (
7
  `sociallogin_id` varchar(200) default NULL,
8
  `entity_id` int(11) default NULL,
@@ -13,4 +13,5 @@ CREATE TABLE IF NOT EXISTS {$this->getTable('sociallogin')} (
13
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
14
  "
15
  );
 
16
  $installer->endSetup();
2
  $installer = $this;
3
  $installer->startSetup();
4
  $installer->run(
5
+ "
6
  CREATE TABLE IF NOT EXISTS {$this->getTable('sociallogin')} (
7
  `sociallogin_id` varchar(200) default NULL,
8
  `entity_id` int(11) default NULL,
13
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
14
  "
15
  );
16
+ $installer->run("alter table {$this->getTable('sociallogin')} modify `sociallogin_id` varchar(200) default NULL");
17
  $installer->endSetup();
app/code/community/Loginradius/Sociallogin/sql/sociallogin_setup/mysql4-upgrade-4.1.0-4.2.0.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $installer = $this;
3
+ $installer->startSetup();
4
+ $installer->run(
5
+ "
6
+ CREATE TABLE IF NOT EXISTS {$this->getTable('sociallogin')} (
7
+ `sociallogin_id` varchar(200) default NULL,
8
+ `entity_id` int(11) default NULL,
9
+ `avatar` varchar(1000) default NULL,
10
+ `verified` enum('0','1') default NULL,
11
+ `vkey` varchar(40) default NULL,
12
+ `provider` varchar(20) default NULL
13
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
14
+ "
15
+ );
16
+ $installer->run("alter table {$this->getTable('sociallogin')} modify `sociallogin_id` varchar(200) default NULL");
17
+ $installer->endSetup();
app/design/frontend/base/default/template/sociallogin/abovelogin.phtml CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- if (!$this->user_is_already_login() && $this->getAboveLogin() == '1') {
3
  $this->getSocialLoginContainer();
4
  }
5
  ?>
1
  <?php
2
+ if (!Mage::helper('sociallogin/loginhelper')->isAlreadyLoggedIn() && $this->getAboveLogin() == '1') {
3
  $this->getSocialLoginContainer();
4
  }
5
  ?>
app/design/frontend/base/default/template/sociallogin/aboveregister.phtml CHANGED
@@ -1,5 +1,5 @@
1
- <?php
2
- if( !$this->user_is_already_login() && $this->getAboveRegister() == '1' ){
3
  $this->getSocialLoginContainer();
4
  }
5
  ?>
1
+ <?php
2
+ if (!Mage::helper('sociallogin/loginhelper')->isAlreadyLoggedIn() && $this->getAboveRegister() == '1') {
3
  $this->getSocialLoginContainer();
4
  }
5
  ?>
app/design/frontend/base/default/template/sociallogin/belowlogin.phtml CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- if( !$this->user_is_already_login() && $this->getBelowLogin() == '1' ){
3
  $this->getSocialLoginContainer();
4
  }
5
  ?>
1
  <?php
2
+ if( !Mage::helper('sociallogin/loginhelper')->isAlreadyLoggedIn() && $this->getBelowLogin() == '1' ){
3
  $this->getSocialLoginContainer();
4
  }
5
  ?>
app/design/frontend/base/default/template/sociallogin/belowregister.phtml CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- if( !$this->user_is_already_login() && $this->getBelowRegister() == '1' ){
3
  $this->getSocialLoginContainer();
4
  }
5
  ?>
1
  <?php
2
+ if (!Mage::helper('sociallogin/loginhelper')->isAlreadyLoggedIn() && $this->getBelowRegister() == '1') {
3
  $this->getSocialLoginContainer();
4
  }
5
  ?>
app/design/frontend/base/default/template/sociallogin/linking.phtml CHANGED
@@ -1,3 +1,9 @@
 
 
 
 
 
 
1
  <div class="dashboard">
2
  <div class="box-account box-info">
3
  <div class="box-head">
@@ -23,20 +29,20 @@
23
 
24
  // unlink account
25
  if (isset($_GET['LoginRadiusUnlink']) && trim($_GET['LoginRadiusUnlink']) != "") {
26
- $session = Mage::getSingleton('customer/session');
27
- if(count($loginRadiusResult) == 1){
28
- $session->addError(__('This Account can\'t be removed.'));
29
- header("Location:" . Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK) . "customer/account");
30
- die;
31
- }
32
  $loginRadiusConn = Mage::getSingleton('core/resource')->getConnection('core_write');
33
  try {
34
  // delete query magento way
35
  $loginRadiusConn->delete(
36
- Mage::getSingleton('core/resource')->getTableName('sociallogin'), array('entity_id = ?' => $loginRadiusUserId, 'sociallogin_id = ?' => trim($_GET['LoginRadiusUnlink']))
37
  );
38
  } catch (Exception $e) {
39
-
40
  }
41
  $session->addSuccess(__('Account removed successfully.'));
42
  header("Location:" . Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK) . "customer/account");
@@ -52,7 +58,7 @@
52
  }
53
  echo '<div style="float:left;"><span>';
54
  echo __('Connected with') . '</span></div><div style="float:left; padding-left:4px;"><img alt="' . ucfirst($result['provider']) . '" title="' . ucfirst($result['provider']) . '" src="' . Mage::getDesign()->getSkinUrl("Loginradius" . DS . "Sociallogin" . DS . "images" . DS . "Linking" . DS . $result["provider"] . '.png', array('_area' => 'frontend')) . '" /></div>' . '</div>';
55
- if(count($loginRadiusResult) != 1){
56
  echo '<div style="float:right"><a href="' . Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK) . 'customer/account/?LoginRadiusUnlink=' . $result["sociallogin_id"] . '" title="' . __('Unlink this ID from your account') . '">' . __('Remove') . '</a></div>';
57
  }
58
  echo '<br /><div style="clear:both"></div>';
1
+ <?php
2
+
3
+ /**
4
+ * template to display social linking interface
5
+ */
6
+ ?>
7
  <div class="dashboard">
8
  <div class="box-account box-info">
9
  <div class="box-head">
29
 
30
  // unlink account
31
  if (isset($_GET['LoginRadiusUnlink']) && trim($_GET['LoginRadiusUnlink']) != "") {
32
+ $session = Mage::getSingleton('customer/session');
33
+ if (count($loginRadiusResult) == 1) {
34
+ $session->addError(__('This Account can\'t be removed.'));
35
+ header("Location:" . Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK) . "customer/account");
36
+ die;
37
+ }
38
  $loginRadiusConn = Mage::getSingleton('core/resource')->getConnection('core_write');
39
  try {
40
  // delete query magento way
41
  $loginRadiusConn->delete(
42
+ Mage::getSingleton('core/resource')->getTableName('sociallogin'), array('entity_id = ?' => $loginRadiusUserId, 'sociallogin_id = ?' => trim($_GET['LoginRadiusUnlink']))
43
  );
44
  } catch (Exception $e) {
45
+
46
  }
47
  $session->addSuccess(__('Account removed successfully.'));
48
  header("Location:" . Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK) . "customer/account");
58
  }
59
  echo '<div style="float:left;"><span>';
60
  echo __('Connected with') . '</span></div><div style="float:left; padding-left:4px;"><img alt="' . ucfirst($result['provider']) . '" title="' . ucfirst($result['provider']) . '" src="' . Mage::getDesign()->getSkinUrl("Loginradius" . DS . "Sociallogin" . DS . "images" . DS . "Linking" . DS . $result["provider"] . '.png', array('_area' => 'frontend')) . '" /></div>' . '</div>';
61
+ if (count($loginRadiusResult) != 1) {
62
  echo '<div style="float:right"><a href="' . Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK) . 'customer/account/?LoginRadiusUnlink=' . $result["sociallogin_id"] . '" title="' . __('Unlink this ID from your account') . '">' . __('Remove') . '</a></div>';
63
  }
64
  echo '<br /><div style="clear:both"></div>';
app/design/frontend/base/default/template/sociallogin/popup.phtml CHANGED
@@ -1,115 +1,139 @@
1
  <?php
2
- // instantiate your controller, using the `Mage:app()` object to grab the required request and response
3
- $controller = new Loginradius_Sociallogin_IndexController();
 
 
 
4
  $socialLoginMsg = Mage::getSingleton('core/session')->getTmpPopupMsg();
5
  $loginRadiusShowForm = Mage::getSingleton('core/session')->getTmpShowForm();
6
  $profileData = Mage::getSingleton('core/session')->getTmpProfileData();
7
  $emailRequired = Mage::getSingleton('core/session')->getTmpEmailRequired();
8
  $hideZipcode = Mage::getSingleton('core/session')->getTmpHideZipcode();
9
- $provider = isset($profileData['Provider'])?trim($profileData['Provider']):'';
10
- $loginRadiusPopupTxt = str_replace('@provider', $provider, Mage::getSingleton('core/session')->getTmpPopupTxt());
11
  $blockObj = new Loginradius_Sociallogin_Block_Sociallogin();
12
- $popupTitle = $blockObj->getPopupText()
 
13
  ?>
14
  <div id="fade" class="LoginRadius_overlay">
15
- <div id="popupouter">
16
- <div id="popupinner">
17
- <div style="width:100%; border-bottom: 1px solid #ccc;">
18
- <div class="lr-popupheading" style="margin-bottom:5px;"><?php echo __(Mage::helper('core')->htmlEscape($popupTitle)); ?></div></div>
19
- <?php if(!empty($socialLoginMsg)){?>
20
- <div class="lr-error"><?php echo __(Mage::helper('core')->htmlEscape($socialLoginMsg)); ?></div>
21
- <?php }
22
- if ($loginRadiusShowForm) {
23
- ?>
24
- <form id="loginRadiusForm" method="post" action="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK) . 'sociallogin' ?>" onSubmit="return loginRadiusValidateForm()">
25
- <?php
26
- if((!$blockObj->getProfileFieldsRequired() && $emailRequired) || isset($_POST[loginRadiusEmail]) || ($emailRequired && (isset($profileData['Email']) && empty($profileData['Email']))) || ($emailRequired && $blockObj->getEmailRequired() && isset($_POST['Email']))){
27
- ?>
28
- <div class="loginRadiusDiv">
29
- <label for="loginRadiusEmail"><?php echo __("Email"); ?> *</label>
30
- <input type="text" name="loginRadiusEmail" id="loginRadiusEmail" class="loginRadiusText"/>
31
- </div>
32
- <?php
33
- }
34
- if (isset($profileData['Address']) && $profileData['Address'] == "") {
35
- ?>
36
- <div class="loginRadiusDiv">
37
- <label for="loginRadiusAddress"><?php echo __("Address"); ?> *</label>
38
- <input type="text" name="loginRadiusAddress" id="loginRadiusAddress" class="loginRadiusText"/>
39
- </div>
40
- <?php
41
- }
42
- if (isset($profileData['City']) && $profileData['City'] == "") {
43
- ?>
44
- <div class="loginRadiusDiv">
45
- <label for="loginRadiusCity"><?php echo __("City") ?> *</label>
46
- <input type="text" name="loginRadiusCity" id="loginRadiusCity" class="loginRadiusText"/>
47
- </div>
48
- <?php
49
- }
50
- if (!$hideZipcode) {
51
- ?>
52
- <div class="loginRadiusDiv">
53
- <label for="loginRadiusCountry"><?php echo __("Country"); ?> *</label>
54
- <?php
55
- $countries = Mage::getResourceModel('directory/country_collection')->loadData()->toOptionArray(false);
56
- if (count($countries) > 0) {
57
- ?>
58
- <select onChange="if(this.value == 'US'){ document.getElementById('loginRadiusProvinceContainer').style.display = 'block' }else{ document.getElementById('loginRadiusProvinceContainer').style.display = 'none' }" name="loginRadiusCountry" id="loginRadiusCountry" class="loginRadiusText">
59
- <option value="">-- <?php echo __("Please Select"); ?> --</option>
60
- <?php foreach ($countries as $country): ?>
61
- <option value="<?php echo $country['value'] ?>">
62
- <?php echo $country['label'] ?>
63
- </option>
64
- <?php endforeach; ?>
65
- </select>
66
- </div>
67
- <!-- United States province -->
68
- <div style="display:none" id="loginRadiusProvinceContainer" class="loginRadiusDiv">
69
- <label for="loginRadiusCountry"><?php echo __("State/Province") ?> *</label>
70
- <select id="loginRadiusProvince" name="loginRadiusProvince" class="loginRadiusText">
71
- <option value="" selected="selected">-- <?php echo __("Please Select"); ?>--</option>
72
- <?php $states = array("Alabama","Alaska","American Samoa","Arizona","Arkansas","Armed Forces Africa","Armed Forces Americas","Armed Forces Canada","Armed Forces Europe","Armed Forces Middle East","Armed Forces Pacific","California","Colorado","Connecticut","Delaware","District of Columbia","Federated States Of Micronesia","Florida","Georgia","Guam","Hawaii","Idaho","Illinois","Indiana","Iowa","Kansas","Kentucky","Louisiana","Maine","Marshall Islands","Maryland","Massachusetts","Michigan","Minnesota","Mississippi","Missouri","Montana","Nebraska","Nevada","New Hampshire","New Jersey","New Mexico","New York","North Carolina","North Dakota","Northern Mariana Islands","Ohio","Oklahoma","Oregon","Palau","Pennsylvania","Puerto Rico","Rhode Island","South Carolina","South Dakota","Tennessee","Texas","Utah","Vermont","Virgin Islands","Virginia","Washington","West Virginia","Wisconsin","Wyoming");
73
- foreach ($states as $key=>$value){
74
- echo '<option value="'.$key.'">'.__($value).'</option>';
75
- }
76
  ?>
77
- </select>
78
- <?php
79
- } else {
80
- ?>
81
- <input type="text" name="loginRadiusCountry" id="loginRadiusCountry" class="loginRadiusText"/>
82
  <?php
83
  }
 
 
84
  ?>
85
- </div>
86
- <div class="loginRadiusDiv">
87
- <label for="loginRadiusZipcode"><?php echo __("Zipcode") ?> *</label>
88
- <input type="text" name="loginRadiusZipcode" id="loginRadiusZipcode" class="loginRadiusText"/>
89
- </div>
90
- <?php
91
- }
92
- if (isset($profileData['PhoneNumber']) && $profileData['PhoneNumber'] == "") {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
93
  ?>
94
- <div class="loginRadiusDiv">
95
- <label for="loginRadiusPhone"><?php echo __("Phone Number") ?> *</label>
96
- <input type="text" name="loginRadiusPhone" id="loginRadiusPhone" class="loginRadiusText"/>
97
- </div>
98
- <?php
99
- }
100
- ?>
101
- <div class="loginRadiusDiv">
102
- <input type="submit" id="LoginRadiusRedSliderClick" name="LoginRadiusRedSliderClick" value="<?php echo __("Submit") ?>" onClick="loginRadiusPopupSubmit = true" class="inputbutton"/>
103
- <input type="submit" value="<?php echo __("Cancel") ?>" class="inputbutton" name="LoginRadiusPopupCancel" onClick="loginRadiusPopupSubmit = false"/>
104
- </div>
105
- </form>
106
- <?php
107
- } else {
108
  ?>
109
- <input type="button" value="<?php echo __("Okay") ?>" class="inputbutton" onClick="location.href = '<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK); ?>'"/>
110
- <?php
111
- }
112
- ?>
113
  </div>
114
- </div>
115
  </div>
1
  <?php
2
+
3
+ /**
4
+ * template to display email required popup!
5
+ */
6
+
7
  $socialLoginMsg = Mage::getSingleton('core/session')->getTmpPopupMsg();
8
  $loginRadiusShowForm = Mage::getSingleton('core/session')->getTmpShowForm();
9
  $profileData = Mage::getSingleton('core/session')->getTmpProfileData();
10
  $emailRequired = Mage::getSingleton('core/session')->getTmpEmailRequired();
11
  $hideZipcode = Mage::getSingleton('core/session')->getTmpHideZipcode();
12
+ $provider = isset($profileData['Provider']) ? trim($profileData['Provider']) : '';
 
13
  $blockObj = new Loginradius_Sociallogin_Block_Sociallogin();
14
+ $popupTitle = $blockObj->getPopupText();
15
+ $popupTitle = str_replace('@provider', $provider, $popupTitle);
16
  ?>
17
  <div id="fade" class="LoginRadius_overlay">
18
+ <div id="popupouter">
19
+ <div class="lr-popupheading"><?php echo __(Mage::helper('core')->htmlEscape($popupTitle)); ?></div>
20
+ <?php if (!empty($socialLoginMsg)) { ?>
21
+ <div class="lr-error" id ="lr-message-error"><?php echo __(Mage::helper('core')->htmlEscape($socialLoginMsg)); ?></div>
22
+ <?php
23
+ } else {
24
+ if (!isset($_POST['EmailPopupOkButton'])) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25
  ?>
26
+ <div class="lr-noerror" id="lr-message"><?php echo __(Mage::helper('core')->htmlEscape('Please provide following details.')); ?></div>
 
 
 
 
27
  <?php
28
  }
29
+ }
30
+ if ($loginRadiusShowForm) {
31
  ?>
32
+ <form id="loginRadiusForm" method="post" action="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK) . 'sociallogin' ?>" onSubmit="return loginRadiusValidateForm()">
33
+ <div id="popupinner">
34
+ <table id="lr_required_fields">
35
+ <?php
36
+ if ($emailRequired) {
37
+ ?>
38
+ <tr>
39
+ <td class="lr_required_field_label"><label for="loginRadiusEmail"><?php echo __("Email"); ?> *</label></td>
40
+ <td><input type="text" name="loginRadiusEmail" id="loginRadiusEmail" class="loginRadiusText"/></td>
41
+ </tr>
42
+ <?php
43
+ }
44
+ if ($blockObj->getProfileFieldsRequired() == 1) {
45
+ if (isset($profileData['Address'])) {
46
+ ?>
47
+ <tr>
48
+ <td class="lr_required_field_label"><label for="loginRadiusAddress"><?php echo __("Address"); ?> *</label></td>
49
+ <td><input type="text" name="loginRadiusAddress" id="loginRadiusAddress" class="loginRadiusText" value="<?php echo $profileData['Address'] ?>"/></td>
50
+ </tr>
51
+
52
+ <?php
53
+ }
54
+ if (isset($profileData['City'])) {
55
+ ?>
56
+ <tr>
57
+ <td class="lr_required_field_label"><label for="loginRadiusCity"><?php echo __("City") ?> *</label></td>
58
+ <td><input type="text" name="loginRadiusCity" id="loginRadiusCity" class="loginRadiusText" value="<?php echo $profileData['City'] ?>"/></td>
59
+ </tr>
60
+
61
+ <?php
62
+ }
63
+ if (!$hideZipcode) {
64
+ ?>
65
+ <tr>
66
+ <td class="lr_required_field_label"><label for="loginRadiusCountry"><?php echo __("Country"); ?> *</label></td>
67
+ <?php
68
+ $countries = Mage::getResourceModel('directory/country_collection')->loadData()->toOptionArray(false);
69
+ foreach ($countries as $key => $val) {
70
+ if (strtolower($val['label']) === strtolower($profileData['Country'])) {
71
+ $currentCountry = $val['value'];
72
+ break;
73
+ }
74
+ }
75
+ if (!isset($currentCountry)) {
76
+ $currentCountry = '';
77
+ }
78
+ if (count($countries) > 0) {
79
+ ?>
80
+ <td>
81
+
82
+ <select name="loginRadiusCountry" id="loginRadiusCountry" class="loginRadiusText">
83
+ <option value="">-- <?php echo __("Please Select"); ?> --</option>
84
+ <?php foreach ($countries as $country):
85
+ if ($country['value'] == $currentCountry) {
86
+ ?>
87
+ <option selected="selected" value="<?php echo $country['value'] ?>">
88
+ <?php echo $country['label'] ?>
89
+ </option>
90
+ <?php } else { ?>
91
+ <option value="<?php echo $country['value'] ?>">
92
+ <?php echo $country['label'] ?>
93
+ </option>
94
+ <?php
95
+ }
96
+ endforeach; ?>
97
+ </select>
98
+ </td>
99
+
100
+ <?php
101
+ } else {
102
+ ?>
103
+ <td><input type="text" name="loginRadiusCountry" id="loginRadiusCountry" class="loginRadiusText"/></td>
104
+ <?php
105
+ }
106
+ ?>
107
+ </tr>
108
+ <tr>
109
+ <td class="lr_required_field_label"><label for="loginRadiusZipcode"><?php echo __("Zipcode") ?> *</label></td>
110
+ <td><input type="text" name="loginRadiusZipcode" id="loginRadiusZipcode" class="loginRadiusText"/></td>
111
+ </tr>
112
+ <?php
113
+ }
114
+ if (isset($profileData['PhoneNumber'])) {
115
+ ?>
116
+ <tr>
117
+ <td class="lr_required_field_label"><label for="loginRadiusPhone"><?php echo __("Phone Number") ?> *</label></td>
118
+ <td><input type="text" name="loginRadiusPhone" id="loginRadiusPhone" class="loginRadiusText" value="<?php echo $profileData['PhoneNumber'] ?>"/></td>
119
+ </tr>
120
+ <?php
121
+ }
122
+ }
123
+ ?>
124
+ </table>
125
+ </div>
126
+ <div class="footerbox">
127
+ <input type="submit" id="EmailPopupOkButton" name="EmailPopupOkButton" value="<?php echo __("Submit") ?>" onClick="loginRadiusPopupSubmit = true" class="inputbutton"/>
128
+ <input type="submit" value="<?php echo __("Cancel") ?>" class="inputbutton" name="LoginRadiusPopupCancel" onClick="loginRadiusPopupSubmit = false"/>
129
+ </div>
130
+ </form>
131
+ <?php
132
+ } else {
133
  ?>
134
+ <input type="button" value="<?php echo __("Okay") ?>" class="inputbutton" onClick="location.href = '<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK); ?>'"/>
135
+ <?php
136
+ }
 
 
 
 
 
 
 
 
 
 
 
137
  ?>
 
 
 
 
138
  </div>
 
139
  </div>
app/design/frontend/base/default/template/sociallogin/popupscript.phtml CHANGED
@@ -1,3 +1,7 @@
1
  <?php
2
- $this->getPopusScriptUrl();
 
 
 
 
3
  ?>
1
  <?php
2
+
3
+ /**
4
+ * template to render script required to display email popup!
5
+ */
6
+ echo $this->getPopupScriptUrl();
7
  ?>
app/design/frontend/base/default/template/sociallogin/sociallogin.phtml CHANGED
@@ -5,8 +5,8 @@ $ApiSecrete = trim($this->getApiSecret());
5
  $loginRadiusTitle = trim($this->getLoginRadiusTitle());
6
  $UserAuth = $this->getApiResult($ApiKey, $ApiSecrete);
7
  if ($showdefault == 1) {
8
- if ($this->user_is_already_login()) {
9
- echo '<div class="block style="height:100px" ><div class="block-title"><strong><span>' . __('Social Login') . '</span></strong></div><div class="block-content"><p class="empty">';
10
 
11
  $userName = Mage::getSingleton('customer/session')->getCustomer()->getName();
12
  if ($loginRadiusAvatar = trim($this->getAvatar(Mage::getSingleton('customer/session')->getCustomer()->getId()))
5
  $loginRadiusTitle = trim($this->getLoginRadiusTitle());
6
  $UserAuth = $this->getApiResult($ApiKey, $ApiSecrete);
7
  if ($showdefault == 1) {
8
+ if (Mage::helper('sociallogin/loginhelper')->isAlreadyLoggedIn()) {
9
+ echo '<div class="block" style="height:100px" ><div class="block-title"><strong><span>' . __('Social Login') . '</span></strong></div><div class="block-content"><p class="empty">';
10
 
11
  $userName = Mage::getSingleton('customer/session')->getCustomer()->getName();
12
  if ($loginRadiusAvatar = trim($this->getAvatar(Mage::getSingleton('customer/session')->getCustomer()->getId()))
app/design/frontend/base/default/template/sociallogin/sociallogin_head.phtml CHANGED
@@ -1,56 +1,52 @@
1
  <?php
2
  /**
3
- * Created by PhpStorm.
4
- * User: nyaconcept
5
- * Date: 11/18/14
6
- * Time: 7:05 PM
7
  */
 
8
  $loc = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK) . "sociallogin/";
9
- if (strpos(Mage::helper('core/url')->getCurrentUrl(),'https://') !== false) {
10
  $loc = str_replace('http://', 'https://', $loc);
11
  }
12
  if ($this->getLayout()->getBlock('head')->getTitle() == "Checkout") {
13
- $loginRadiusCallback = $loc . "?loginradiuscheckout=1";
14
- }
15
- elseif ($this->getLayout()->getBlock('head')->getTitle() == "My Account") {
16
- $loginRadiusCallback = $loc . "?loginRadiusLinking=1";
17
- }
18
- else {
19
- $loginRadiusCallback = $loc . "?redirect_to=" . Mage::helper('core/url')->getCurrentUrl();
20
  }
21
- $scriptUrl = $this->getSkinUrl('Loginradius/Sociallogin/js/LoginRadiusSDK.2.0.0.js');
22
  ?>
23
- <script src="//cdn.loginradius.com/hub/prod/v1/js/LoginRadius.1.0.js"></script>
24
  <script src="<?php echo $scriptUrl; ?>"></script>
25
 
26
  <script type="text/javascript">
27
- var loginRadiusOptions = {};
28
- loginRadiusOptions.login = true;
29
- LoginRadius_SocialLogin.util.ready(function () {
30
- $ui = LoginRadius_SocialLogin.lr_login_settings;
31
- $ui.interfacesize = "<?php echo $this->iconSize() == 'small' ? 'small' : '' ?>";
32
- <?php if (trim($this->iconsPerRow()) != '' && is_numeric($this->iconsPerRow())) {
33
- echo '$ui.noofcolumns = ' . trim($this->iconsPerRow()) . ';';
34
- } ?>
35
- <?php if (trim($this->backgroundColor()) != '') {
36
- echo '$ui.lrinterfacebackground = "' . trim($this->backgroundColor()) . '";';
37
- } ?>
38
- $ui.apikey = "<?php echo trim($this->getApikey()) ?>";
39
- $ui.callback = "<?php echo $loginRadiusCallback ?>";
40
- $ui.lrinterfacecontainer = "interfacecontainerdiv";
41
- $ui.is_access_token = true;
42
- LoginRadius_SocialLogin.init(loginRadiusOptions);
43
- });
44
- LoginRadiusSDK.setLoginCallback(function () {
45
- var form = document.createElement('form');
46
- form.action = "<?php echo urldecode($loginRadiusCallback); ?>";
47
- form.method = 'POST';
48
- var hiddenToken = document.createElement('input');
49
- hiddenToken.type = 'hidden';
50
- hiddenToken.value = LoginRadiusSDK.getToken();
51
- hiddenToken.name = "token";
52
- form.appendChild(hiddenToken);
53
- document.body.appendChild(form);
54
- form.submit();
55
- });
56
  </script>
1
  <?php
2
  /**
3
+ * template to render script which is required for social login.
 
 
 
4
  */
5
+
6
  $loc = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK) . "sociallogin/";
7
+ if (strpos(Mage::helper('core/url')->getCurrentUrl(), 'https://') !== false) {
8
  $loc = str_replace('http://', 'https://', $loc);
9
  }
10
  if ($this->getLayout()->getBlock('head')->getTitle() == "Checkout") {
11
+ $loginRadiusCallback = $loc . "?loginradiuscheckout=1";
12
+ } elseif ($this->getLayout()->getBlock('head')->getTitle() == "My Account") {
13
+ $loginRadiusCallback = $loc . "?loginRadiusLinking=1";
14
+ } else {
15
+ $loginRadiusCallback = $loc . "?redirect_to=" . Mage::helper('core/url')->getCurrentUrl();
 
 
16
  }
17
+ $scriptUrl = $this->getSkinUrl('Loginradius/Sociallogin/js/LoginRadiusSDK.js');
18
  ?>
19
+ <script src="//hub.loginradius.com/include/js/LoginRadius.js"></script>
20
  <script src="<?php echo $scriptUrl; ?>"></script>
21
 
22
  <script type="text/javascript">
23
+ var loginRadiusOptions = {};
24
+ loginRadiusOptions.login = true;
25
+ LoginRadius_SocialLogin.util.ready(function () {
26
+ $ui = LoginRadius_SocialLogin.lr_login_settings;
27
+ $ui.interfacesize = "<?php echo $this->iconSize() == 'small' ? 'small' : '' ?>";
28
+ <?php if (trim($this->iconsPerRow()) != '' && is_numeric($this->iconsPerRow())) {
29
+ echo '$ui.noofcolumns = ' . trim($this->iconsPerRow()) . ';';
30
+ } ?>
31
+ <?php if (trim($this->backgroundColor()) != '') {
32
+ echo '$ui.lrinterfacebackground = "' . trim($this->backgroundColor()) . '";';
33
+ } ?>
34
+ $ui.apikey = "<?php echo trim($this->getApikey()) ?>";
35
+ $ui.callback = "<?php echo $loginRadiusCallback ?>";
36
+ $ui.lrinterfacecontainer = "interfacecontainerdiv";
37
+ $ui.is_access_token = true;
38
+ LoginRadius_SocialLogin.init(loginRadiusOptions);
39
+ });
40
+ LoginRadiusSDK.setLoginCallback(function () {
41
+ var form = document.createElement('form');
42
+ form.action = "<?php echo urldecode($loginRadiusCallback); ?>";
43
+ form.method = 'POST';
44
+ var hiddenToken = document.createElement('input');
45
+ hiddenToken.type = 'hidden';
46
+ hiddenToken.value = LoginRadiusSDK.getToken();
47
+ hiddenToken.name = "token";
48
+ form.appendChild(hiddenToken);
49
+ document.body.appendChild(form);
50
+ form.submit();
51
+ });
52
  </script>
app/design/frontend/base/default/template/sociallogin/sociallogincustom.phtml CHANGED
@@ -1,15 +1,17 @@
1
  <?php
2
- if ($this->user_is_already_login()) {
3
- echo '<div class="block"><div class="block-title"><strong><span>' . __('Social Login') . '</span></strong></div><div class="block-content"><p class="empty">';
4
-
5
- $userName = Mage::getSingleton('customer/session')->getCustomer()->getName();
6
- if ($loginRadiusAvatar = trim($this->getAvatar(Mage::getSingleton('customer/session')->getCustomer()->getId()))
7
- ) {
8
- echo "<img style='float:left' width='50' height='50' src='" . $loginRadiusAvatar . "' />";
9
- }
10
- echo "<span style='clear:both; float:left'>" . __("Welcome") . "! $userName </span>";
11
- echo '</p></div></div>';
12
 
 
 
 
 
 
 
 
 
 
 
 
 
13
  } else {
14
- $this->getSocialLoginContainer();
15
  }
1
  <?php
 
 
 
 
 
 
 
 
 
 
2
 
3
+ /**
4
+ * template to display custom social login interface
5
+ */
6
+ if (Mage::helper('sociallogin/loginhelper')->isAlreadyLoggedIn()) {
7
+ echo '<div class="block"><div class="block-title"><strong><span>' . __('Social Login') . '</span></strong></div>';
8
+ $userName = Mage::getSingleton('customer/session')->getCustomer()->getName();
9
+ if ($loginRadiusAvatar = trim($this->getAvatar(Mage::getSingleton('customer/session')->getCustomer()->getId()))
10
+ ) {
11
+ echo '<div class="block-content"><p class="empty"><img style="float:left" width="50" height="50" src="' . $loginRadiusAvatar . '" /><span style="clear:both; float:left">' . __("Welcome") . '! $userName </span></p></div></div>';
12
+ } else {
13
+ echo '<div class="block-content" style="height:20px"><p class="empty"><span style="clear:both; float:left">' . __("Welcome") . '! '.$userName.' </span></p></div></div>';
14
+ }
15
  } else {
16
+ $this->getSocialLoginContainer();
17
  }
app/design/frontend/base/default/template/sociallogin/socialshare_head.phtml CHANGED
@@ -1,18 +1,22 @@
1
  <?php
 
 
 
 
2
  $horizontalShareSettings = $this->getHorizontalSharingSettings();
3
  $verticalShareSettings = $this->getVerticalSharingSettings();
4
  $apiKey = Mage::getStoreConfig('sociallogin_options/apiSettings/apikey');
5
  if ($horizontalShareSettings['horizontalShareEnable'] == "1" || $verticalShareSettings['verticalShareEnable'] == "1") {
6
- $sharingScript = '<script type="text/javascript">var islrsharing = true; var islrsocialcounter = true;</script> <script type="text/javascript" src="//share.loginradius.com/Content/js/LoginRadius.js" id="lrsharescript"></script><script type="text/javascript">';
7
 
8
- if ($horizontalShareSettings['horizontalShareEnable'] == "1") {
9
- // check horizontal sharing enabled
10
- $sharingScript .= $this->login_radius_sharing_get_sharing_script_horizontal($horizontalShareSettings, $apiKey);
11
- }
12
- if ($verticalShareSettings['verticalShareEnable'] == '1') {
13
- // check vertical sharing enabled
14
- $sharingScript .= $this->login_radius_sharing_get_sharing_script_vertical($verticalShareSettings, $apiKey);
15
- }
16
- $sharingScript .= '</script>';
17
- echo $sharingScript;
18
  }
1
  <?php
2
+
3
+ /**
4
+ * template to add script required for social sharing
5
+ */
6
  $horizontalShareSettings = $this->getHorizontalSharingSettings();
7
  $verticalShareSettings = $this->getVerticalSharingSettings();
8
  $apiKey = Mage::getStoreConfig('sociallogin_options/apiSettings/apikey');
9
  if ($horizontalShareSettings['horizontalShareEnable'] == "1" || $verticalShareSettings['verticalShareEnable'] == "1") {
10
+ $sharingScript = '<script type="text/javascript">var islrsharing = true; var islrsocialcounter = true;</script> <script type="text/javascript" src="//share.loginradius.com/Content/js/LoginRadius.js" id="lrsharescript"></script><script type="text/javascript">';
11
 
12
+ if ($horizontalShareSettings['horizontalShareEnable'] == "1") {
13
+ // check horizontal sharing enabled
14
+ $sharingScript .= $this->getHorizontalSharingScript($horizontalShareSettings, $apiKey);
15
+ }
16
+ if ($verticalShareSettings['verticalShareEnable'] == '1') {
17
+ // check vertical sharing enabled
18
+ $sharingScript .= $this->getVerticalSharingScript($verticalShareSettings, $apiKey);
19
+ }
20
+ $sharingScript .= '</script>';
21
+ echo $sharingScript;
22
  }
app/design/frontend/base/default/template/sociallogin/socialshareproduct.phtml CHANGED
@@ -1,10 +1,13 @@
1
  <?php
2
 
 
 
 
3
  if ($this->horizontalShareEnable() == "1" && $this->horizontalShareProduct() == "1") {
4
 
5
- echo '<div class="loginRadiusHorizontalSharing"></div>';
6
  }
7
  if ($this->verticalShareEnable() == "1" && $this->verticalShareProduct() == "1") {
8
- echo '<div class="loginRadiusVerticalSharing"></div>';
9
  }
10
  ?>
1
  <?php
2
 
3
+ /**
4
+ * add horizontal or vertical sharing container!
5
+ */
6
  if ($this->horizontalShareEnable() == "1" && $this->horizontalShareProduct() == "1") {
7
 
8
+ echo '<div class="loginRadiusHorizontalSharing"></div>';
9
  }
10
  if ($this->verticalShareEnable() == "1" && $this->verticalShareProduct() == "1") {
11
+ echo '<div class="loginRadiusVerticalSharing"></div>';
12
  }
13
  ?>
app/design/frontend/base/default/template/sociallogin/socialsharesuccess.phtml CHANGED
@@ -1,9 +1,13 @@
1
  <?php
 
 
 
 
2
  if ($this->horizontalShareEnable() == "1" && $this->horizontalShareSuccess() == "1") {
3
 
4
- echo '<div class="loginRadiusHorizontalSharing"></div>';
5
  }
6
  if ($this->verticalShareEnable() == "1" && $this->verticalShareSuccess() == "1") {
7
- echo '<div class="loginRadiusVerticalSharing"></div>';
8
  }
9
  ?>
1
  <?php
2
+
3
+ /**
4
+ * template to display social sharing on checkout success page!
5
+ */
6
  if ($this->horizontalShareEnable() == "1" && $this->horizontalShareSuccess() == "1") {
7
 
8
+ echo '<div class="loginRadiusHorizontalSharing"></div>';
9
  }
10
  if ($this->verticalShareEnable() == "1" && $this->verticalShareSuccess() == "1") {
11
+ echo '<div class="loginRadiusVerticalSharing"></div>';
12
  }
13
  ?>
package.xml CHANGED
@@ -1,18 +1,18 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>LoginRadius</name>
4
- <version>4.1.0</version>
5
  <stability>stable</stability>
6
  <license>GNU General Public License (GPL)</license>
7
  <channel>community</channel>
8
  <extends/>
9
- <summary>Social Login and Sharing for Magento</summary>
10
- <description>Add Social Login and Sharing to your Magento website and also get accurate User Profile Data and Social Analytics.</description>
11
- <notes>Social Login and Sharing for Magento</notes>
12
  <authors><author><name>LoginRadius Team</name><user>LoginRadius</user><email>developers@loginradius.com</email></author></authors>
13
- <date>2015-02-13</date>
14
- <time>06:01:00</time>
15
- <contents><target name="magecommunity"><dir name="Loginradius"><dir name="Sociallogin"><dir name="Block"><file name="Auth.php" hash="4d9b0a7b6e403ff9c2a0898cae41afd8"/><file name="Emailpopup.php" hash="d4aac86b3de441ea4cf35559a605e973"/><file name="Horizontalsharing.php" hash="67fc95c9238a9d3327ca16ad3f18f2e4"/><file name="Sociallogin.php" hash="6d91ed9e156fe7d03c2bf95c97aac590"/><file name="Socialsharing.php" hash="bc0f22fc87d6efca142f6e7099a319eb"/><file name="Verticalsharing.php" hash="6410be41f2e7af717d4dd5de83ff4ca4"/></dir><dir name="Helper"><file name="Adminhelper.php" hash="0e88b0ae2a83aa6e419ca11194328b3c"/><file name="Data.php" hash="9b4cfd68e9bdbfa73038be009da120ca"/><file name="LoginRadiusSDK.php" hash="e55149a472facdf2c83e6513c73caa3b"/><file name="Loginhelper.php" hash="0a0ebe79e72d239e97ebd31e64f9494a"/></dir><dir name="Model"><dir name="Backend"><file name="Validator.php" hash="151ee6cc958f5c08fbad177c186d0bba"/></dir><file name="Observer.php" hash="c6e5b6d19ba39ad46398ee1950e1c940"/><dir name="Source"><file name="HorizontalSharing.php" hash="3dae6386a5f32e20ba270eb3c2d15de9"/><file name="Iconsize.php" hash="42eeb07db318ba705a09161c9496f1d8"/><file name="LoginPopup.php" hash="b423750764b43bbbb7504d2186e5cfc0"/><file name="SharingVerticalAlignment.php" hash="e897335623190b33778940d0559ce13e"/><file name="TwitterRecipients.php" hash="20c2e3e4e3662d610c55211b94d74d9d"/><file name="Uihover.php" hash="12c37574892cea00e167e679cc96eadd"/><file name="Uihover2.php" hash="8be4bac9bc4500977c81046ea511dada"/><file name="VerticalSharing.php" hash="2e9b88d5a8f4b38481e282534256f3b1"/></dir><dir name="System"><dir name="Config"><file name="Info.php" hash="7a97fbbd77c8b8cfd42a104a06de603f"/></dir></dir></dir><dir name="controllers"><file name="IndexController.php" hash="01e12b60b42ec834372dababb5310457"/></dir><dir name="etc"><file name="config.xml" hash="83ad3605db96539d4af1118bb8a8d1e5"/><file name="system.xml" hash="650c5b76041656f6b54efadf528e8fbf"/><file name="widget.xml" hash="f6e8a254aa3a9ff86f958710c4e8edca"/></dir><dir name="sql"><dir name="sociallogin_setup"><file name="mysql4-install-4.1.0.php" hash="c02ab421149fa4aafbfb0813ff350071"/><file name="mysql4-upgrade-3.7.1-4.1.0.php" hash="145b69433c87f3f3e7189ca0a647e71a"/><file name="mysql4-upgrade-3.7.2-4.1.0.php" hash="145b69433c87f3f3e7189ca0a647e71a"/><file name="mysql4-upgrade-4.0.0-4.1.0.php" hash="145b69433c87f3f3e7189ca0a647e71a"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Loginradius_Sociallogin.xml" hash="20cb11d66b0f486ebca4b8deedacc86b"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="loginradius_sociallogin.xml" hash="86b4e183c723dc96e13ee28198a36bc8"/></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="sociallogin.xml" hash="dcc24b2735bf4a240ca8916a597b8157"/></dir><dir name="template"><dir name="sociallogin"><file name="abovelogin.phtml" hash="29723ed6743adb5c94f553ce440effe2"/><file name="aboveregister.phtml" hash="e966762897e2084916733a5b594b56f3"/><file name="belowlogin.phtml" hash="5e81b7807c53da0230671c39e35fa682"/><file name="belowregister.phtml" hash="603509b2093ec24863cb3d8cd82e929c"/><file name="linking.phtml" hash="d1c8d7cdcf808425d86436bc84aadecf"/><file name="popup.phtml" hash="95bfee9711a860bc5a4314ca1be317dd"/><file name="popupscript.phtml" hash="45dcdebdfca0cebbc748540e3a3d3e67"/><file name="sociallogin.phtml" hash="3c39511fe8c96ce890e25df57232ac45"/><file name="sociallogin_head.phtml" hash="53115ac61d4cf76d79d57157938de7a3"/><file name="sociallogincustom.phtml" hash="74981f871595e6ec876390bf9d9172d3"/><file name="socialshare_head.phtml" hash="ac05792d7af1badb469db4befa21b10a"/><file name="socialshareproduct.phtml" hash="2c306de83dff3995de1ccf424cd645bd"/><file name="socialsharesuccess.phtml" hash="b8de15c1333b70764beb8fa67a36265d"/></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="Loginradius"><dir name="Sociallogin"><dir name="css"><file name="Thumbs.db" hash="48d8e49d8f4b82fff044544f39a16537"/><file name="admin-ui.css" hash="bbb74482c891fe366ff8ae8638afa09e"/><file name="lrshare_iconsprite32.png" hash="a016ded3f25653acf2fa9dfab8a38103"/></dir><dir name="images"><dir name="Linking"><file name="amazon.png" hash="961d0082ed4b433d8e0274c133072e2c"/><file name="aol.png" hash="4e51f60c1b8750c5b9dfa94f56fe13b1"/><file name="facebook.png" hash="141309628c58912076f00954b3fd19a6"/><file name="foursquare.png" hash="de2f4fcf5b3c1156f22ed546f5c3f0c5"/><file name="github.png" hash="45f8e1436fc5c5803ed9d4edb7cb59b6"/><file name="google.png" hash="ffeddc7d14c9b4de2efb6b8ea0f5f652"/><file name="hyves.png" hash="3c77fd2243b22c61915a950c3910f37c"/><file name="kaixin.png" hash="bc84991a5c9d15e20946fae5e9c27f4d"/><file name="linkedin.png" hash="7a9bc12ec91ab2a30442c56a9f70e9ea"/><file name="live.png" hash="9d747bae72fc0f2e3a04f32896d62fbc"/><file name="livejournal.png" hash="e21f34630444412ab3dd197884e0c2e6"/><file name="mixi.png" hash="909e7edc76e59b448d56043eee5e1412"/><file name="myopenid.png" hash="c8295969044cb9d99f8348091ba75319"/><file name="myspace.png" hash="42cd07decb5f4a1fba604ef8df32ef2e"/><file name="odnoklassniki.png" hash="34cd7d239583b015cdd1adb5b7fec085"/><file name="openid.png" hash="92bd4471ef1d5dd04855887806db74f0"/><file name="orange.png" hash="9b9b8f2da956a238e7d58c241423af8a"/><file name="paypal.png" hash="082f0b50411b1dfb1bfd86cfdeb92cea"/><file name="persona.png" hash="e0d926f89e9c428aece1e0f9dbb1f8f2"/><file name="qq.png" hash="8e6dc34bdf03f07277e0aadf8706a4a7"/><file name="renren.png" hash="040a0af8119b7f85bfc2df41ec56f915"/><file name="salesforce.png" hash="e41bcac63438bb04af3a9745b816a675"/><file name="stackexchange.png" hash="8ab952fe75d4a96d6752792ffdcbf0c3"/><file name="steamcommunity.png" hash="ad05c57a4ee01ebc01428b0da905d6b6"/><file name="twitter.png" hash="48044aca3a1d4864361f78c02ba86848"/><file name="verisign.png" hash="7a15fd820171218d803d26e7a3ec46a3"/><file name="virgilio.png" hash="f5c3b6e19c38903a192954934000f60a"/><file name="vkontakte.png" hash="ae1e98911fe9ea6da8a50a568c082133"/><file name="wordpress.png" hash="8ce8b46a2233b8497dd10d9c4d535e22"/><file name="yahoo.png" hash="5c159cc8fed73621b2c12600f8dac288"/></dir><dir name="Sharing"><dir name="Horizontal"><file name="horizonSharing16.png" hash="0fad94b8e4a3e44a2e14f81a2ee04041"/><file name="horizonSharing32.png" hash="561208c81d7cd9d3500e3c460a8a5c49"/><file name="horizontal.png" hash="628fb90190ea3ded7b1f384662ce8153"/><file name="single-image-theme-large.png" hash="e6ff4a26149b631639b601d95e2dc361"/><file name="single-image-theme-small.png" hash="8c2b20fa0f276e33f3876783eb2cbd74"/><file name="vertical.png" hash="81e8591ec1216ffaa22430e86431bf15"/></dir><dir name="Vertical"><file name="16VerticlewithBox.png" hash="73b3abf54889144e9188ffaa76cbb11f"/><file name="32VerticlewithBox.png" hash="37060e164ca4f7c00f430d5f1ab7eddd"/><file name="verticalhorizontal.png" hash="0f4729083e85894d126a7c5202b18465"/><file name="verticalvertical.png" hash="fbbcf59f5e1c121d34073e4769048ff4"/></dir></dir><dir name="media-pages"><file name="Thumbs.db" hash="2bf832cc35446fe90ae3b62f3d1d6044"/><file name="facebook.png" hash="206f9ea5a7374595f0d8dc94a713eb01"/><file name="google.png" hash="aeb7ef22d42ef585b133f4f6f9332996"/><file name="linkedin.png" hash="30428fd794b1d4444891a987b76080df"/><file name="twitter.png" hash="ebab12206bed415ea082231ed2d5c3b9"/><file name="youtube.png" hash="a78066dee928ad36762b83a29cdea932"/></dir></dir><dir name="js"><file name="admin-ui.js" hash="e325d2de12ba432e1598e1c972a096cc"/><file name="jquery.js" hash="5654b0561c66ca9c0ad2a1dd75e5d9b8"/><file name="jquery.ui.sortable.min.js" hash="b847eafb05bcc6ef0908ff07dcd2b0f1"/></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="Loginradius"><dir name="Sociallogin"><dir name="css"><file name="lrshare_iconsprite32.png" hash="a016ded3f25653acf2fa9dfab8a38103"/><file name="popup.css" hash="d2b6b3044d2a499ae1dfb93c62b77809"/></dir><dir name="images"><dir name="Linking"><file name="amazon.png" hash="961d0082ed4b433d8e0274c133072e2c"/><file name="aol.png" hash="4e51f60c1b8750c5b9dfa94f56fe13b1"/><file name="facebook.png" hash="141309628c58912076f00954b3fd19a6"/><file name="foursquare.png" hash="de2f4fcf5b3c1156f22ed546f5c3f0c5"/><file name="github.png" hash="45f8e1436fc5c5803ed9d4edb7cb59b6"/><file name="google.png" hash="ffeddc7d14c9b4de2efb6b8ea0f5f652"/><file name="hyves.png" hash="3c77fd2243b22c61915a950c3910f37c"/><file name="kaixin.png" hash="bc84991a5c9d15e20946fae5e9c27f4d"/><file name="linkedin.png" hash="7a9bc12ec91ab2a30442c56a9f70e9ea"/><file name="live.png" hash="9d747bae72fc0f2e3a04f32896d62fbc"/><file name="livejournal.png" hash="e21f34630444412ab3dd197884e0c2e6"/><file name="mixi.png" hash="909e7edc76e59b448d56043eee5e1412"/><file name="myopenid.png" hash="c8295969044cb9d99f8348091ba75319"/><file name="myspace.png" hash="42cd07decb5f4a1fba604ef8df32ef2e"/><file name="odnoklassniki.png" hash="34cd7d239583b015cdd1adb5b7fec085"/><file name="openid.png" hash="92bd4471ef1d5dd04855887806db74f0"/><file name="orange.png" hash="9b9b8f2da956a238e7d58c241423af8a"/><file name="paypal.png" hash="082f0b50411b1dfb1bfd86cfdeb92cea"/><file name="persona.png" hash="e0d926f89e9c428aece1e0f9dbb1f8f2"/><file name="qq.png" hash="8e6dc34bdf03f07277e0aadf8706a4a7"/><file name="renren.png" hash="040a0af8119b7f85bfc2df41ec56f915"/><file name="salesforce.png" hash="e41bcac63438bb04af3a9745b816a675"/><file name="stackexchange.png" hash="8ab952fe75d4a96d6752792ffdcbf0c3"/><file name="steamcommunity.png" hash="ad05c57a4ee01ebc01428b0da905d6b6"/><file name="twitter.png" hash="48044aca3a1d4864361f78c02ba86848"/><file name="verisign.png" hash="7a15fd820171218d803d26e7a3ec46a3"/><file name="virgilio.png" hash="f5c3b6e19c38903a192954934000f60a"/><file name="vkontakte.png" hash="ae1e98911fe9ea6da8a50a568c082133"/><file name="wordpress.png" hash="8ce8b46a2233b8497dd10d9c4d535e22"/><file name="yahoo.png" hash="5c159cc8fed73621b2c12600f8dac288"/></dir><dir name="Sharing"><dir name="Horizontal"><file name="horizonSharing16.png" hash="64188c128c8263c052153cf9708ac218"/><file name="horizonSharing32.png" hash="5e85ac81864885bcef5cc9691a9eba49"/><file name="horizontal.png" hash="6bb8038603bbf9cc70bac8365eebd7ba"/><file name="single-image-theme-large.png" hash="e6ff4a26149b631639b601d95e2dc361"/><file name="single-image-theme-small.png" hash="8c2b20fa0f276e33f3876783eb2cbd74"/><file name="vertical.png" hash="9c71cfb83ffb121a0ef89e263d474387"/></dir><dir name="Vertical"><file name="16VerticlewithBox.png" hash="73b3abf54889144e9188ffaa76cbb11f"/><file name="32VerticlewithBox.png" hash="37060e164ca4f7c00f430d5f1ab7eddd"/><file name="verticalhorizontal.png" hash="469ce5302d294dc987bdb070ef448446"/><file name="verticalvertical.png" hash="f59288edc8c87dde216b6616027aa72b"/></dir></dir></dir><dir name="js"><file name="LoginRadiusSDK.2.0.0.js" hash="4bcc695e646cca3e0775e8279dfd773b"/><file name="jquery.js" hash="5654b0561c66ca9c0ad2a1dd75e5d9b8"/><file name="jquery.ui.sortable.min.js" hash="b847eafb05bcc6ef0908ff07dcd2b0f1"/><file name="popup.js" hash="29c4ce9392fa95d76fe21e12ba1b91b2"/></dir></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>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>LoginRadius</name>
4
+ <version>4.2.0</version>
5
  <stability>stable</stability>
6
  <license>GNU General Public License (GPL)</license>
7
  <channel>community</channel>
8
  <extends/>
9
+ <summary>Social Login and Social Share for Magento</summary>
10
+ <description>Add Social Login and Social Share to your Magento website and also get accurate User Profile Data and Social Analytics.</description>
11
+ <notes>Social Login and Social Share for Magento</notes>
12
  <authors><author><name>LoginRadius Team</name><user>LoginRadius</user><email>developers@loginradius.com</email></author></authors>
13
+ <date>2015-04-22</date>
14
+ <time>10:14:16</time>
15
+ <contents><target name="magecommunity"><dir name="Loginradius"><dir name="Sociallogin"><dir name="Block"><file name="Auth.php" hash="b19bd173c73bc378cb7538a5eca674db"/><file name="Horizontalsharing.php" hash="3713675479e57166b26a6174899d8c45"/><file name="Sociallogin.php" hash="d0c4fe1c7c6dad02ebaf35fa0922b6ab"/><file name="Socialsharing.php" hash="0c2feef7550ad0d98f6b356077a4ba9e"/><file name="Verticalsharing.php" hash="c9b06bf1c7e2112caddeef92bd393b30"/></dir><dir name="Helper"><file name="Data.php" hash="b8823bc8c1e74269d2ec79a6a1fa53e2"/><file name="Loginhelper.php" hash="cce833c4a35927ed38f1747f36ff864f"/><file name="Loginradiussdk.php" hash="fc3f0f459d644bd8e02e395c8ee74cf1"/></dir><dir name="Model"><file name="Observer.php" hash="9534e40fdae5503950b39516ceec066c"/><dir name="Source"><file name="HorizontalSharing.php" hash="ef8b65ade59f872e505332fcd037f3f6"/><file name="Iconsize.php" hash="0ca612f395f4c4e6594af40d82a1d348"/><file name="LoginPopup.php" hash="c9cf8733dd7ea86550e5f87959343126"/><file name="SharingVerticalAlignment.php" hash="83db29fc20525218156176077519b040"/><file name="TwitterRecipients.php" hash="bcb80e9a53354a553244ea3d565085b5"/><file name="Uihover.php" hash="74041c8cc5c0259770c39bec881799c0"/><file name="VerticalSharing.php" hash="2c8dff8846941dd95ecb53e366fe287e"/></dir><dir name="System"><dir name="Config"><file name="Info.php" hash="33f58cfd122dd1246a29c5f1963a1763"/></dir></dir></dir><dir name="controllers"><file name="IndexController.php" hash="fd04c978c752114738b364ff2f39f81f"/></dir><dir name="etc"><file name="config.xml" hash="0613462aa13eefeddc5130f817afe0ee"/><file name="system.xml" hash="60249f8a2d9cd88fe4b2eeabf11a6adf"/><file name="widget.xml" hash="f6e8a254aa3a9ff86f958710c4e8edca"/></dir><dir name="sql"><dir name="sociallogin_setup"><file name="mysql4-install-4.2.0.php" hash="4a0e9043a38af9970f4ed55f8e6762c9"/><file name="mysql4-upgrade-3.7.1-4.2.0.php" hash="4a0e9043a38af9970f4ed55f8e6762c9"/><file name="mysql4-upgrade-3.7.2-4.2.0.php" hash="4a0e9043a38af9970f4ed55f8e6762c9"/><file name="mysql4-upgrade-4.0.0-4.2.0.php" hash="4a0e9043a38af9970f4ed55f8e6762c9"/><file name="mysql4-upgrade-4.1.0-4.2.0.php" hash="4a0e9043a38af9970f4ed55f8e6762c9"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Loginradius_Sociallogin.xml" hash="20cb11d66b0f486ebca4b8deedacc86b"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="loginradius_sociallogin.xml" hash="86b4e183c723dc96e13ee28198a36bc8"/></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="sociallogin.xml" hash="dcc24b2735bf4a240ca8916a597b8157"/></dir><dir name="template"><dir name="sociallogin"><file name="abovelogin.phtml" hash="d0ef7a79dac876ae14fcf1f0b838f215"/><file name="aboveregister.phtml" hash="f2cf9967267917c0116d9088b117e58f"/><file name="belowlogin.phtml" hash="4bfae009a6e1b1a9c36a2de031269623"/><file name="belowregister.phtml" hash="b75a87b979719e81a165aba5f83d2277"/><file name="linking.phtml" hash="6cafc097b8d23cab626c5b1f745a0314"/><file name="popup.phtml" hash="4e5305b1edff6073528d870ba372bd13"/><file name="popupscript.phtml" hash="64323c1a52b45987c5e4e9f70a4402e5"/><file name="sociallogin.phtml" hash="ed8f2bfa0adfc632afc9d47e50faacf8"/><file name="sociallogin_head.phtml" hash="90f31d8be1b38b8aa2aefbe1d5b921e2"/><file name="sociallogincustom.phtml" hash="e66b8b4049df01d1865dd2fa8b1e7876"/><file name="socialshare_head.phtml" hash="0b78b9f4451cb295de0a49ebaebb1abd"/><file name="socialshareproduct.phtml" hash="6c8049790baf1110aa40eadfa14c1bb8"/><file name="socialsharesuccess.phtml" hash="4f6b476cbd3af099507e39e5abdb530e"/></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="Loginradius"><dir name="Sociallogin"><dir name="css"><file name="admin-ui.css" hash="78bba6098eeeb6e9f39edfdf41ee0b11"/></dir><dir name="images"><dir name="Linking"><file name="amazon.png" hash="961d0082ed4b433d8e0274c133072e2c"/><file name="aol.png" hash="4e51f60c1b8750c5b9dfa94f56fe13b1"/><file name="facebook.png" hash="141309628c58912076f00954b3fd19a6"/><file name="foursquare.png" hash="de2f4fcf5b3c1156f22ed546f5c3f0c5"/><file name="github.png" hash="45f8e1436fc5c5803ed9d4edb7cb59b6"/><file name="google.png" hash="ffeddc7d14c9b4de2efb6b8ea0f5f652"/><file name="hyves.png" hash="3c77fd2243b22c61915a950c3910f37c"/><file name="kaixin.png" hash="bc84991a5c9d15e20946fae5e9c27f4d"/><file name="linkedin.png" hash="7a9bc12ec91ab2a30442c56a9f70e9ea"/><file name="live.png" hash="9d747bae72fc0f2e3a04f32896d62fbc"/><file name="livejournal.png" hash="e21f34630444412ab3dd197884e0c2e6"/><file name="mixi.png" hash="909e7edc76e59b448d56043eee5e1412"/><file name="myopenid.png" hash="c8295969044cb9d99f8348091ba75319"/><file name="myspace.png" hash="42cd07decb5f4a1fba604ef8df32ef2e"/><file name="odnoklassniki.png" hash="34cd7d239583b015cdd1adb5b7fec085"/><file name="openid.png" hash="92bd4471ef1d5dd04855887806db74f0"/><file name="orange.png" hash="9b9b8f2da956a238e7d58c241423af8a"/><file name="paypal.png" hash="082f0b50411b1dfb1bfd86cfdeb92cea"/><file name="persona.png" hash="e0d926f89e9c428aece1e0f9dbb1f8f2"/><file name="qq.png" hash="8e6dc34bdf03f07277e0aadf8706a4a7"/><file name="renren.png" hash="040a0af8119b7f85bfc2df41ec56f915"/><file name="salesforce.png" hash="e41bcac63438bb04af3a9745b816a675"/><file name="stackexchange.png" hash="8ab952fe75d4a96d6752792ffdcbf0c3"/><file name="steamcommunity.png" hash="ad05c57a4ee01ebc01428b0da905d6b6"/><file name="twitter.png" hash="48044aca3a1d4864361f78c02ba86848"/><file name="verisign.png" hash="7a15fd820171218d803d26e7a3ec46a3"/><file name="virgilio.png" hash="f5c3b6e19c38903a192954934000f60a"/><file name="vkontakte.png" hash="ae1e98911fe9ea6da8a50a568c082133"/><file name="wordpress.png" hash="8ce8b46a2233b8497dd10d9c4d535e22"/><file name="yahoo.png" hash="5c159cc8fed73621b2c12600f8dac288"/></dir><dir name="Sharing"><dir name="Horizontal"><file name="horizonSharing16.png" hash="0fad94b8e4a3e44a2e14f81a2ee04041"/><file name="horizonSharing32.png" hash="561208c81d7cd9d3500e3c460a8a5c49"/><file name="horizontal.png" hash="628fb90190ea3ded7b1f384662ce8153"/><file name="responsive-icons.png" hash="f792ba85bf94a6cf05329d5a9a4087b5"/><file name="single-image-theme-large.png" hash="e6ff4a26149b631639b601d95e2dc361"/><file name="single-image-theme-small.png" hash="8c2b20fa0f276e33f3876783eb2cbd74"/><file name="vertical.png" hash="81e8591ec1216ffaa22430e86431bf15"/></dir><dir name="Vertical"><file name="16VerticlewithBox.png" hash="73b3abf54889144e9188ffaa76cbb11f"/><file name="32VerticlewithBox.png" hash="37060e164ca4f7c00f430d5f1ab7eddd"/><file name="verticalhorizontal.png" hash="0f4729083e85894d126a7c5202b18465"/><file name="verticalvertical.png" hash="fbbcf59f5e1c121d34073e4769048ff4"/></dir></dir><dir name="media-pages"><file name="Thumbs.db" hash="2bf832cc35446fe90ae3b62f3d1d6044"/><file name="facebook.png" hash="206f9ea5a7374595f0d8dc94a713eb01"/><file name="google.png" hash="aeb7ef22d42ef585b133f4f6f9332996"/><file name="linkedin.png" hash="30428fd794b1d4444891a987b76080df"/><file name="twitter.png" hash="ebab12206bed415ea082231ed2d5c3b9"/><file name="youtube.png" hash="a78066dee928ad36762b83a29cdea932"/></dir></dir><dir name="js"><file name="admin-ui.js" hash="5684b24482733c990195c4c4d3524927"/><file name="jquery.js" hash="5654b0561c66ca9c0ad2a1dd75e5d9b8"/><file name="jquery.ui.sortable.min.js" hash="b847eafb05bcc6ef0908ff07dcd2b0f1"/></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="Loginradius"><dir name="Sociallogin"><dir name="css"><file name="popup.css" hash="b0c7d630e5cabf477a58172d534efb67"/></dir><dir name="images"><dir name="Linking"><file name="amazon.png" hash="961d0082ed4b433d8e0274c133072e2c"/><file name="aol.png" hash="4e51f60c1b8750c5b9dfa94f56fe13b1"/><file name="facebook.png" hash="141309628c58912076f00954b3fd19a6"/><file name="foursquare.png" hash="de2f4fcf5b3c1156f22ed546f5c3f0c5"/><file name="github.png" hash="45f8e1436fc5c5803ed9d4edb7cb59b6"/><file name="google.png" hash="ffeddc7d14c9b4de2efb6b8ea0f5f652"/><file name="hyves.png" hash="3c77fd2243b22c61915a950c3910f37c"/><file name="kaixin.png" hash="bc84991a5c9d15e20946fae5e9c27f4d"/><file name="linkedin.png" hash="7a9bc12ec91ab2a30442c56a9f70e9ea"/><file name="live.png" hash="9d747bae72fc0f2e3a04f32896d62fbc"/><file name="livejournal.png" hash="e21f34630444412ab3dd197884e0c2e6"/><file name="mixi.png" hash="909e7edc76e59b448d56043eee5e1412"/><file name="myopenid.png" hash="c8295969044cb9d99f8348091ba75319"/><file name="myspace.png" hash="42cd07decb5f4a1fba604ef8df32ef2e"/><file name="odnoklassniki.png" hash="34cd7d239583b015cdd1adb5b7fec085"/><file name="openid.png" hash="92bd4471ef1d5dd04855887806db74f0"/><file name="orange.png" hash="9b9b8f2da956a238e7d58c241423af8a"/><file name="paypal.png" hash="082f0b50411b1dfb1bfd86cfdeb92cea"/><file name="persona.png" hash="e0d926f89e9c428aece1e0f9dbb1f8f2"/><file name="qq.png" hash="8e6dc34bdf03f07277e0aadf8706a4a7"/><file name="renren.png" hash="040a0af8119b7f85bfc2df41ec56f915"/><file name="salesforce.png" hash="e41bcac63438bb04af3a9745b816a675"/><file name="stackexchange.png" hash="8ab952fe75d4a96d6752792ffdcbf0c3"/><file name="steamcommunity.png" hash="ad05c57a4ee01ebc01428b0da905d6b6"/><file name="twitter.png" hash="48044aca3a1d4864361f78c02ba86848"/><file name="verisign.png" hash="7a15fd820171218d803d26e7a3ec46a3"/><file name="virgilio.png" hash="f5c3b6e19c38903a192954934000f60a"/><file name="vkontakte.png" hash="ae1e98911fe9ea6da8a50a568c082133"/><file name="wordpress.png" hash="8ce8b46a2233b8497dd10d9c4d535e22"/><file name="yahoo.png" hash="5c159cc8fed73621b2c12600f8dac288"/></dir></dir><dir name="js"><file name="LoginRadiusSDK.js" hash="4bcc695e646cca3e0775e8279dfd773b"/><file name="jquery.js" hash="5654b0561c66ca9c0ad2a1dd75e5d9b8"/><file name="jquery.ui.sortable.min.js" hash="b847eafb05bcc6ef0908ff07dcd2b0f1"/><file name="popup.js" hash="8459298049f4a6c6303144573db82ace"/></dir></dir></dir></dir></dir></dir></target></contents>
16
  <compatible/>
17
+ <dependencies><required><php><min>5.1.0</min><max>7.0.0</max></php></required></dependencies>
18
  </package>
skin/adminhtml/default/default/Loginradius/Sociallogin/css/Thumbs.db DELETED
Binary file
skin/adminhtml/default/default/Loginradius/Sociallogin/css/admin-ui.css CHANGED
@@ -151,35 +151,7 @@ border-bottom: 1px solid grey !important;
151
  margin-right:2px;
152
  float:left !important
153
  }
154
- .lrshare_iconsprite32{
155
- cursor: pointer !important;
156
- height: 32px;
157
- margin: 4px !important;
158
- width: 32px;
159
- padding: 0px !important;
160
- border: none !important;
161
- background: url("lrshare_iconsprite32.png") no-repeat scroll left top transparent;
162
- list-style-type: none !important;
163
- }
164
- .lrshare_iconsprite32.lrshare_delicious { background-position: 0px 0px; width: 32px; height: 32px; }
165
- .lrshare_iconsprite32.lrshare_digg { background-position: -34px 0px; width: 32px; height: 32px; }
166
- .lrshare_iconsprite32.lrshare_dotnetkicks { background-position: -68px 0px; width: 32px; height: 32px; }
167
- .lrshare_iconsprite32.lrshare_email { background-position: -102px 0px; width: 32px; height: 32px; }
168
- .lrshare_iconsprite32.lrshare_evenmore32 { background-position: -138px 0px; width: 32px; height: 32px; }
169
- .lrshare_iconsprite32.lrshare_facebook { background-position: -174px 0px; width: 32px; height: 32px; }
170
- .lrshare_iconsprite32.lrshare_google { background-position: -208px 0px; width: 32px; height: 32px; }
171
- .lrshare_iconsprite32.lrshare_googleplus { background-position: -242px 0px; width: 32px; height: 32px; }
172
- .lrshare_iconsprite32.lrshare_hyves { background-position: -276px 0px; width: 32px; height: 32px; }
173
- .lrshare_iconsprite32.lrshare_linkedin { background-position: -310px 0px; width: 32px; height: 32px; }
174
- .lrshare_iconsprite32.lrshare_live { background-position: -344px 0px; width: 32px; height: 32px; }
175
- .lrshare_iconsprite32.lrshare_myspace { background-position: -378px 0px; width: 32px; height: 32px; }
176
- .lrshare_iconsprite32.lrshare_pinterest { background-position: -412px 0px; width: 32px; height: 32px; }
177
- .lrshare_iconsprite32.lrshare_print { background-position: -446px 0px; width: 32px; height: 32px; }
178
- .lrshare_iconsprite32.lrshare_reddit { background-position: -480px 0px; width: 32px; height: 32px; }
179
- .lrshare_iconsprite32.lrshare_sharingcounter32 { background-position: -514px 0px; width: 50px; height: 32px; padding-top:4px !important; font-size:18px; }
180
- .lrshare_iconsprite32.lrshare_tumblr { background-position: -576px 0px; width: 32px; height: 32px; }
181
- .lrshare_iconsprite32.lrshare_twitter { background-position: -610px 0px; width: 32px; height: 32px; }
182
- .lrshare_iconsprite32.lrshare_viadeo { background-position: -644px 0px; width: 32px; height: 32px; }
183
- .lrshare_iconsprite32.lrshare_vkontakte { background-position: -678px 0px; width: 32px; height: 32px; }
184
- .lrshare_iconsprite32.lrshare_wordpress { background-position: -712px 0px; width: 32px; height: 32px; }
185
- .lrshare_iconsprite32.lrshare_yahoo { background-position: -746px 0px; width: 32px; height: 32px; }
151
  margin-right:2px;
152
  float:left !important
153
  }
154
+ #loginRadiushorizontalRearrangeSharing li, #loginRadiusverticalRearrangeSharing li{
155
+ float:left;
156
+ margin-right: 3px;
157
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
skin/adminhtml/default/default/Loginradius/Sociallogin/css/lrshare_iconsprite32.png DELETED
Binary file
skin/adminhtml/default/default/Loginradius/Sociallogin/images/Sharing/Horizontal/responsive-icons.png ADDED
Binary file
skin/adminhtml/default/default/Loginradius/Sociallogin/js/admin-ui.js CHANGED
@@ -9,6 +9,14 @@ function loginRadiusIsNumber(n) {
9
  return !isNaN(parseFloat(n)) && isFinite(n);
10
  }
11
  var $loginRadiusJquery = jQuery.noConflict();
 
 
 
 
 
 
 
 
12
  // prepare admin UI on window load
13
  function loginRadiusPrepareAdminUI(){
14
 
9
  return !isNaN(parseFloat(n)) && isFinite(n);
10
  }
11
  var $loginRadiusJquery = jQuery.noConflict();
12
+ $loginRadiusJquery(document).ready(function(){
13
+ jQuery('#sociallogin_options_apiSettings_apikey').keyup(function(){
14
+ jQuery(this).val(jQuery(this).val().trim());
15
+ });
16
+ jQuery('#sociallogin_options_apiSettings_apisecret').keyup(function(){
17
+ jQuery(this).val(jQuery(this).val().trim());
18
+ });
19
+ });
20
  // prepare admin UI on window load
21
  function loginRadiusPrepareAdminUI(){
22
 
skin/frontend/base/default/Loginradius/Sociallogin/css/lrshare_iconsprite32.png DELETED
Binary file
skin/frontend/base/default/Loginradius/Sociallogin/css/popup.css CHANGED
@@ -14,10 +14,23 @@
14
  filter: alpha(opacity=97);
15
  }
16
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  .lr-popupheading{
18
  font-size: 17px;
19
  text-align: center;
20
  font-weight: normal;
 
21
  }
22
  #popupouter{
23
  border-radius: 0 23px;
@@ -56,8 +69,14 @@
56
  border-radius: 0px 12px;
57
  background: #fff;
58
  }
 
 
 
 
 
 
59
  select.loginRadiusText {
60
- width: 365px;
61
  }
62
  .inputbutton{
63
  border: #dcdcdc 1px solid !important;
@@ -100,36 +119,15 @@ select.loginRadiusText {
100
  .lr-error {
101
  text-align: left;
102
  background-color: rgb(255, 235, 232);
103
- margin-bottom: 12px;
104
  padding: 12px;
105
  }
106
 
107
  .lr-noerror {
108
  text-align: left;
109
  background-color: #e1eabc;
110
- margin-bottom: 12px;
111
  padding: 12px;
112
 
113
  }
114
- <!--[if IE]>
115
- .LoginRadius_content_IE
116
- {
117
- background:black;
118
- -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=90)";
119
- filter: alpha(opacity=90);
120
- }
121
- .loginRadiusDiv{
122
- float:left;
123
- margin: 0 0 4px 2px;
124
- }
125
- .loginRadiusDiv label{
126
- width: 94px;
127
- margin: 5px 10px 10px 0;
128
- display: block;
129
- text-align: left;
130
- }
131
-
132
- <![endif]-->
133
 
134
  @media (max-width: 769px) {
135
  #popupouter {
14
  filter: alpha(opacity=97);
15
  }
16
 
17
+ #loginRadiusCountry {
18
+ width:100%;
19
+ }
20
+ table#lr_required_fields{
21
+ width:85%;
22
+ }
23
+ #lr_required_fields input[type=text] {
24
+ width:100%;
25
+ }
26
+ #loginRadiusForm {
27
+ width:100%;
28
+ }
29
  .lr-popupheading{
30
  font-size: 17px;
31
  text-align: center;
32
  font-weight: normal;
33
+ padding: 15px;
34
  }
35
  #popupouter{
36
  border-radius: 0 23px;
69
  border-radius: 0px 12px;
70
  background: #fff;
71
  }
72
+ .footerbox {
73
+ padding-bottom: 12px;
74
+ float: left;
75
+ padding-top: 12px;
76
+ padding-left: 20px;
77
+ }
78
  select.loginRadiusText {
79
+ width: 342px;
80
  }
81
  .inputbutton{
82
  border: #dcdcdc 1px solid !important;
119
  .lr-error {
120
  text-align: left;
121
  background-color: rgb(255, 235, 232);
 
122
  padding: 12px;
123
  }
124
 
125
  .lr-noerror {
126
  text-align: left;
127
  background-color: #e1eabc;
 
128
  padding: 12px;
129
 
130
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
131
 
132
  @media (max-width: 769px) {
133
  #popupouter {
skin/frontend/base/default/Loginradius/Sociallogin/images/Sharing/Horizontal/horizonSharing16.png DELETED
Binary file
skin/frontend/base/default/Loginradius/Sociallogin/images/Sharing/Horizontal/horizonSharing32.png DELETED
Binary file
skin/frontend/base/default/Loginradius/Sociallogin/images/Sharing/Horizontal/horizontal.png DELETED
Binary file
skin/frontend/base/default/Loginradius/Sociallogin/images/Sharing/Horizontal/single-image-theme-large.png DELETED
Binary file
skin/frontend/base/default/Loginradius/Sociallogin/images/Sharing/Horizontal/single-image-theme-small.png DELETED
Binary file
skin/frontend/base/default/Loginradius/Sociallogin/images/Sharing/Horizontal/vertical.png DELETED
Binary file
skin/frontend/base/default/Loginradius/Sociallogin/images/Sharing/Vertical/16VerticlewithBox.png DELETED
Binary file
skin/frontend/base/default/Loginradius/Sociallogin/images/Sharing/Vertical/32VerticlewithBox.png DELETED
Binary file
skin/frontend/base/default/Loginradius/Sociallogin/images/Sharing/Vertical/verticalhorizontal.png DELETED
Binary file
skin/frontend/base/default/Loginradius/Sociallogin/images/Sharing/Vertical/verticalvertical.png DELETED
Binary file
skin/frontend/base/default/Loginradius/Sociallogin/js/{LoginRadiusSDK.2.0.0.js → LoginRadiusSDK.js} RENAMED
File without changes
skin/frontend/base/default/Loginradius/Sociallogin/js/popup.js CHANGED
@@ -27,6 +27,9 @@ function loginRadiusValidateForm() {
27
  if (!validateProvince && loginRadiusForm.elements[i].id == "loginRadiusProvince") {
28
  continue;
29
  }
 
 
 
30
  if (loginRadiusForm.elements[i].value.trim() == "" && loginRadiusForm.elements[i].id != "loginRadiusEmail") {
31
  loginRadiusErrorDiv.innerHTML = "Please fill all the fields";
32
  loginRadiusErrorDiv.style.backgroundColor = "rgb(255, 235, 232)";
27
  if (!validateProvince && loginRadiusForm.elements[i].id == "loginRadiusProvince") {
28
  continue;
29
  }
30
+ if (loginRadiusErrorDiv ==null){
31
+ loginRadiusErrorDiv = document.getElementById('lr-message-error');
32
+ }
33
  if (loginRadiusForm.elements[i].value.trim() == "" && loginRadiusForm.elements[i].id != "loginRadiusEmail") {
34
  loginRadiusErrorDiv.innerHTML = "Please fill all the fields";
35
  loginRadiusErrorDiv.style.backgroundColor = "rgb(255, 235, 232)";