Liveagent - Version 2.5.6

Version Notes

changes:
- signup is using new API
- minor fixes
- default button code change

Download this release

Release Info

Developer Juraj Simon
Extension Liveagent
Version 2.5.6
Comparing to
See all releases


Code changes from version 2.5.5 to 2.5.6

app/code/local/Qualityunit/Liveagent/Block/Account.php CHANGED
@@ -9,7 +9,8 @@ class Qualityunit_Liveagent_Block_Account extends Qualityunit_Liveagent_Block_Ba
9
 
10
  public function _prepareLayout() {
11
  parent::_prepareLayout();
12
- $this->assignVariable('dialogCaption', Mage::helper('adminhtml')->__('LiveAgent - Live chat and helpdesk plugin for Magento'));
 
13
  $this->assignVariable('submitCaption', Mage::helper('adminhtml')->__('Save Account Settings'));
14
  $this->assignVariable('settingsSection', Mage::helper('adminhtml')->__('Account Settings'));
15
  $this->assignVariable('beforeDeleteQuestion', Mage::helper('adminhtml')->__('Are you sure you want to cancel your account?'));
@@ -19,11 +20,17 @@ class Qualityunit_Liveagent_Block_Account extends Qualityunit_Liveagent_Block_Ba
19
  $this->assignVariable('urlLabel', Mage::helper('adminhtml')->__('Url')) . ':';
20
  $this->assignVariable('urlHelp', Mage::helper('adminhtml')->__('Url where your LiveAgent installation is located'));
21
  $this->assignVariable('laOwnerEmailHelp', Mage::helper('adminhtml')->__('Username which you use to login to your Live Agnet'));
22
- $this->assignVariable('laOwnerPasswordHelp', Mage::helper('adminhtml')->__('Your password'));
23
- $this->assignVariable('nameLabel', Mage::helper('adminhtml')->__('Username')) . ':';
24
- $this->assignVariable('passwordLabel', Mage::helper('adminhtml')->__('Password')) . ':';
 
 
 
 
 
 
25
  $this->assignVariable('cancelLink', Mage::helper('adminhtml')->__('Cancel account'));
26
- $this->assignVariable('cancelHelp', Mage::helper('adminhtml')->__('this will clear all your existing account settings and offer you to create a new trial account'));
27
  $this->assignVariable('contactLink', Mage::helper('adminhtml')->__('contact us'));
28
  $this->assignVariable('contactHelp', Mage::helper('adminhtml')->__('Do you need any help with this plugin? Feel free to'));
29
  $this->assignVariable(Qualityunit_Liveagent_Helper_Settings::LA_URL_SETTING_NAME, $this->getInputBox(Qualityunit_Liveagent_Helper_Settings::LA_URL_SETTING_NAME, ''));
@@ -32,7 +39,7 @@ class Qualityunit_Liveagent_Block_Account extends Qualityunit_Liveagent_Block_Ba
32
  $this->assignVariable('saveActionSettingsFlag', self::SAVE_ACCOUNT_SETTINGS_ACTION_FLAG);
33
  }
34
 
35
- protected function getPasswordBox($name, $value) {
36
  $params = $this->getRequest()->getParams();
37
  if (isset($params[$name])) {
38
  return parent::getPasswordBox($name, base64_decode(trim($this->getRequest()->getParam($name))));
@@ -115,4 +122,4 @@ class Qualityunit_Liveagent_Block_Account extends Qualityunit_Liveagent_Block_Ba
115
  </div>
116
  ';
117
  }
118
- }
9
 
10
  public function _prepareLayout() {
11
  parent::_prepareLayout();
12
+ $settings = new Qualityunit_Liveagent_Helper_Settings();
13
+ $this->assignVariable('dialogCaption', Mage::helper('adminhtml')->__('LiveAgent - Free live chat and helpdesk plugin for Magento'));
14
  $this->assignVariable('submitCaption', Mage::helper('adminhtml')->__('Save Account Settings'));
15
  $this->assignVariable('settingsSection', Mage::helper('adminhtml')->__('Account Settings'));
16
  $this->assignVariable('beforeDeleteQuestion', Mage::helper('adminhtml')->__('Are you sure you want to cancel your account?'));
20
  $this->assignVariable('urlLabel', Mage::helper('adminhtml')->__('Url')) . ':';
21
  $this->assignVariable('urlHelp', Mage::helper('adminhtml')->__('Url where your LiveAgent installation is located'));
22
  $this->assignVariable('laOwnerEmailHelp', Mage::helper('adminhtml')->__('Username which you use to login to your Live Agnet'));
23
+ $this->assignVariable('nameLabel', Mage::helper('adminhtml')->__('Username')) . ':';
24
+ if ($settings->useApiKey()) {
25
+ $this->assignVariable('passwordLabel', Mage::helper('adminhtml')->__('Api key')) . ':';
26
+ $this->assignVariable('laOwnerPasswordHelp', Mage::helper('adminhtml')->__('Your REST api key'));
27
+ } else {
28
+ $this->assignVariable('passwordLabel', Mage::helper('adminhtml')->__('Password')) . ':';
29
+ $this->assignVariable('laOwnerPasswordHelp', Mage::helper('adminhtml')->__('Your password'));
30
+ }
31
+
32
  $this->assignVariable('cancelLink', Mage::helper('adminhtml')->__('Cancel account'));
33
+ $this->assignVariable('cancelHelp', Mage::helper('adminhtml')->__('this will clear all your existing account settings and offer you to create a new free account'));
34
  $this->assignVariable('contactLink', Mage::helper('adminhtml')->__('contact us'));
35
  $this->assignVariable('contactHelp', Mage::helper('adminhtml')->__('Do you need any help with this plugin? Feel free to'));
36
  $this->assignVariable(Qualityunit_Liveagent_Helper_Settings::LA_URL_SETTING_NAME, $this->getInputBox(Qualityunit_Liveagent_Helper_Settings::LA_URL_SETTING_NAME, ''));
39
  $this->assignVariable('saveActionSettingsFlag', self::SAVE_ACCOUNT_SETTINGS_ACTION_FLAG);
40
  }
41
 
42
+ protected function getPasswordBox($name, $value) {
43
  $params = $this->getRequest()->getParams();
44
  if (isset($params[$name])) {
45
  return parent::getPasswordBox($name, base64_decode(trim($this->getRequest()->getParam($name))));
122
  </div>
123
  ';
124
  }
125
+ }
app/code/local/Qualityunit/Liveagent/Block/Buttoncode.php CHANGED
@@ -7,7 +7,7 @@ class Qualityunit_Liveagent_Block_Buttoncode extends Qualityunit_Liveagent_Block
7
  public function _prepareLayout() {
8
  $settings = new Qualityunit_Liveagent_Helper_Settings();
9
  parent::_prepareLayout();
10
- $this->assignVariable('dialogCaption', Mage::helper('adminhtml')->__('LiveAgent - Live chat and helpdesk plugin for Magento'));
11
  $this->assignVariable('submitCaption', Mage::helper('adminhtml')->__('Save'));
12
  $this->assignVariable('formKey', Mage::getSingleton('core/session')->getFormKey());
13
  $this->assignVariable('saveUrlAction', $this->getUrl('*/*/post'));
@@ -18,7 +18,7 @@ class Qualityunit_Liveagent_Block_Buttoncode extends Qualityunit_Liveagent_Block
18
  $this->assignVariable('buttonCodeHelp', Mage::helper('adminhtml')->__('Place here the code from your LiveAgent admin panel'));
19
  $this->assignVariable('saveButtonCodeFlag', self::SAVE_BUTTON_CODE_ACTION_FLAG);
20
  $this->assignVariable('accountSectionLabel', Mage::helper('adminhtml')->__('Your account'));
21
- $this->assignVariable('accountUrlLabel', Mage::helper('adminhtml')->__('Account url'));
22
  $this->assignVariable('la-url', $settings->getOption(Qualityunit_Liveagent_Helper_Settings::LA_URL_SETTING_NAME));
23
  $this->assignVariable('loginLabel', Mage::helper('adminhtml')->__('login'));
24
  $this->assignVariable('loginUrl', $this->getLoginUrl($settings));
@@ -30,15 +30,19 @@ class Qualityunit_Liveagent_Block_Buttoncode extends Qualityunit_Liveagent_Block
30
  }
31
 
32
  private function getLoginUrl(Qualityunit_Liveagent_Helper_Settings $settings) {
33
- $authToken = $settings->getOwnerAuthToken();
 
 
 
 
34
  if ($authToken == '') {
35
- $sessionId = $settingsgetOwnerSessionId();
36
  if ($sessionId != '') {
37
- return $settings->getLiveAgentUrl() . '/agent?S='.$settings->getOwnerSessionId();
38
  }
39
- return $settings->getLiveAgentUrl() . '/agent';
40
  }
41
- return $settings->getLiveAgentUrl() . '/agent?AuthToken='.$authToken;
42
  }
43
 
44
  protected function getTemplateString() {
@@ -50,16 +54,16 @@ class Qualityunit_Liveagent_Block_Buttoncode extends Qualityunit_Liveagent_Block
50
  <table cellspacing="0">
51
  <tbody><tr>
52
  <td style="width:50%;"><h3 class="icon-head head-promo-catalog">{dialogCaption}</h3></td>
53
- <td class="form-buttons"><button id="id_5806f3a306fa79f4340cb58c1d190ff5" type="button" class="scalable save" onclick="configForm.submit()" style=""><span>{submitCaption}</span></button></td>
54
- </tr>
55
  </tbody>
56
- </table>
57
  </div>
58
  <div class="entry-edit">
59
  <fieldset>
60
  {contactHelp}&nbsp;<a href="http://support.qualityunit.com/submit_ticket" target="_blank">{contactLink}</a>.
61
- </fieldset>
62
- </div>
63
  <div class="entry-edit">
64
  <div class="entry-edit-head"><h4>{accountSectionLabel}</h4></div>
65
  <fieldset>
@@ -105,4 +109,4 @@ class Qualityunit_Liveagent_Block_Buttoncode extends Qualityunit_Liveagent_Block
105
  </form>
106
  ';
107
  }
108
- }
7
  public function _prepareLayout() {
8
  $settings = new Qualityunit_Liveagent_Helper_Settings();
9
  parent::_prepareLayout();
10
+ $this->assignVariable('dialogCaption', Mage::helper('adminhtml')->__('LiveAgent - Free live chat and helpdesk plugin for Magento'));
11
  $this->assignVariable('submitCaption', Mage::helper('adminhtml')->__('Save'));
12
  $this->assignVariable('formKey', Mage::getSingleton('core/session')->getFormKey());
13
  $this->assignVariable('saveUrlAction', $this->getUrl('*/*/post'));
18
  $this->assignVariable('buttonCodeHelp', Mage::helper('adminhtml')->__('Place here the code from your LiveAgent admin panel'));
19
  $this->assignVariable('saveButtonCodeFlag', self::SAVE_BUTTON_CODE_ACTION_FLAG);
20
  $this->assignVariable('accountSectionLabel', Mage::helper('adminhtml')->__('Your account'));
21
+ $this->assignVariable('accountUrlLabel', Mage::helper('adminhtml')->__('Account url'));
22
  $this->assignVariable('la-url', $settings->getOption(Qualityunit_Liveagent_Helper_Settings::LA_URL_SETTING_NAME));
23
  $this->assignVariable('loginLabel', Mage::helper('adminhtml')->__('login'));
24
  $this->assignVariable('loginUrl', $this->getLoginUrl($settings));
30
  }
31
 
32
  private function getLoginUrl(Qualityunit_Liveagent_Helper_Settings $settings) {
33
+ try {
34
+ $authToken = $settings->getOwnerAuthToken();
35
+ } catch (Exception $e) {
36
+ $authToken = '';
37
+ }
38
  if ($authToken == '') {
39
+ $sessionId = $settings->getOwnerSessionId();
40
  if ($sessionId != '') {
41
+ return $settings->getLiveAgentUrl() . '/agent/index.php?S='.$settings->getOwnerSessionId();
42
  }
43
+ return $settings->getLiveAgentUrl() . '/agent/index.php';
44
  }
45
+ return $settings->getLiveAgentUrl() . '/agent/index.php?AuthToken='.$authToken;
46
  }
47
 
48
  protected function getTemplateString() {
54
  <table cellspacing="0">
55
  <tbody><tr>
56
  <td style="width:50%;"><h3 class="icon-head head-promo-catalog">{dialogCaption}</h3></td>
57
+ <td class="form-buttons"><button id="id_5806f3a306fa79f4340cb58c1d190ff5" type="button" class="scalable save" onclick="configForm.submit()" style=""><span>{submitCaption}</span></button></td>
58
+ </tr>
59
  </tbody>
60
+ </table>
61
  </div>
62
  <div class="entry-edit">
63
  <fieldset>
64
  {contactHelp}&nbsp;<a href="http://support.qualityunit.com/submit_ticket" target="_blank">{contactLink}</a>.
65
+ </fieldset>
66
+ </div>
67
  <div class="entry-edit">
68
  <div class="entry-edit-head"><h4>{accountSectionLabel}</h4></div>
69
  <fieldset>
109
  </form>
110
  ';
111
  }
112
+ }
app/code/local/Qualityunit/Liveagent/Block/Signup.php CHANGED
@@ -6,11 +6,11 @@ class Qualityunit_Liveagent_Block_Signup extends Qualityunit_Liveagent_Block_Bas
6
 
7
  public function _prepareLayout() {
8
  parent::_prepareLayout();
9
- $this->assignVariable('dialogCaption', Mage::helper('adminhtml')->__('LiveAgent - Live chat and helpdesk plugin for Magento'));
10
  $this->assignVariable(self::FULL_NAME_FIELD, $this->getInputBox(self::FULL_NAME_FIELD, $this->getOwnerName()));
11
  $this->assignVariable(Qualityunit_Liveagent_Helper_Settings::LA_OWNER_EMAIL_SETTING_NAME, $this->getInputBox(Qualityunit_Liveagent_Helper_Settings::LA_OWNER_EMAIL_SETTING_NAME, $this->getOwnerEmail()));
12
  $this->assignVariable(Qualityunit_Liveagent_Helper_Settings::LA_URL_SETTING_NAME, $this->getInputBox(Qualityunit_Liveagent_Helper_Settings::LA_URL_SETTING_NAME, $this->getdomainOnly()));
13
- $this->assignVariable('submitCaption', Mage::helper('adminhtml')->__('Create your trial account'));
14
  $this->assignVariable('skipUrlAction', $this->getUrl('*/*/index', array('key' => $this->getRequest()->get('key'), 'action' => Qualityunit_Liveagent_Block_Account::CREATE_ACCOUNT_ACTION_FLAF)));
15
  $this->assignVariable('registerUrlAction', $this->getUrl('*/*/post'));
16
  $this->assignVariable('formKey', Mage::getSingleton('core/session')->getFormKey());
@@ -23,14 +23,17 @@ class Qualityunit_Liveagent_Block_Signup extends Qualityunit_Liveagent_Block_Bas
23
  $this->assignVariable('termsLink', Mage::helper('adminhtml')->__('Terms & Conditions'));
24
  $this->assignVariable('skipLink', Mage::helper('adminhtml')->__('Skip this step, I already have an account'));
25
  $this->assignVariable('settingsSection', Mage::helper('adminhtml')->__('New account'));
26
- $this->assignVariable('pluginHelpText', Mage::helper('adminhtml')->__('We want you to enjoy the full functionality of LiveAgent with the trial account. It does not limit the number of agents and you have the option to activate the most of available features.'));
27
  }
28
 
29
  private function getdomainOnly() {
30
  $domain = preg_replace('/^(.*\.)?([^.]*\..*)$/', '$2', @$_SERVER['HTTP_HOST']);
31
- if (trim($domain) == 'localhost' || trim($domain) == 'www' || trim($domain) == 'http' || trim($domain) == 'dev') {
32
  return '';
33
  }
 
 
 
34
  return $domain;
35
  }
36
 
@@ -57,7 +60,7 @@ class Qualityunit_Liveagent_Block_Signup extends Qualityunit_Liveagent_Block_Bas
57
  protected function getTemplateString() {
58
  return '
59
  <script type="text/javascript">
60
- var skipCreate = function() {
61
  setLocation(\'{skipUrlAction}\')
62
  }
63
  </script>
@@ -68,15 +71,15 @@ class Qualityunit_Liveagent_Block_Signup extends Qualityunit_Liveagent_Block_Bas
68
  <table cellspacing="0">
69
  <tbody><tr>
70
  <td style="width:50%;"><h3 class="icon-head head-promo-catalog">{dialogCaption}</h3></td>
71
- <td class="form-buttons"><button id="id_5806f3a306fa79f4340cb58c1d190ff5" type="button" class="scalable save" onclick="configForm.submit()" style=""><span>{submitCaption}</span></button></td>
72
- </tr>
73
  </tbody>
74
- </table>
75
  </div>
76
  <div class="entry-edit">
77
  <fieldset>
78
  {pluginHelpText}
79
- </fieldset>
80
  </div>
81
  <div class="entry-edit">
82
  <div class="entry-edit-head"><h4>{settingsSection}</h4></div>
@@ -109,13 +112,13 @@ class Qualityunit_Liveagent_Block_Signup extends Qualityunit_Liveagent_Block_Bas
109
  <tr>
110
  <td colspan="4" class="scope-label"></td>
111
  </tr>
112
- <tr>
113
  <td colspan="4" class="scope-label"><button onclick="skipCreate()" type="button" class="scalable "><span>{skipLink}</span></button></td>
114
  </tr>
115
  </tbody>
116
  </table>
117
  </fieldset>
118
- </div>
119
  ';
120
  }
121
- }
6
 
7
  public function _prepareLayout() {
8
  parent::_prepareLayout();
9
+ $this->assignVariable('dialogCaption', Mage::helper('adminhtml')->__('LiveAgent - Free live chat and helpdesk plugin for Magento'));
10
  $this->assignVariable(self::FULL_NAME_FIELD, $this->getInputBox(self::FULL_NAME_FIELD, $this->getOwnerName()));
11
  $this->assignVariable(Qualityunit_Liveagent_Helper_Settings::LA_OWNER_EMAIL_SETTING_NAME, $this->getInputBox(Qualityunit_Liveagent_Helper_Settings::LA_OWNER_EMAIL_SETTING_NAME, $this->getOwnerEmail()));
12
  $this->assignVariable(Qualityunit_Liveagent_Helper_Settings::LA_URL_SETTING_NAME, $this->getInputBox(Qualityunit_Liveagent_Helper_Settings::LA_URL_SETTING_NAME, $this->getdomainOnly()));
13
+ $this->assignVariable('submitCaption', Mage::helper('adminhtml')->__('Create your Free account'));
14
  $this->assignVariable('skipUrlAction', $this->getUrl('*/*/index', array('key' => $this->getRequest()->get('key'), 'action' => Qualityunit_Liveagent_Block_Account::CREATE_ACCOUNT_ACTION_FLAF)));
15
  $this->assignVariable('registerUrlAction', $this->getUrl('*/*/post'));
16
  $this->assignVariable('formKey', Mage::getSingleton('core/session')->getFormKey());
23
  $this->assignVariable('termsLink', Mage::helper('adminhtml')->__('Terms & Conditions'));
24
  $this->assignVariable('skipLink', Mage::helper('adminhtml')->__('Skip this step, I already have an account'));
25
  $this->assignVariable('settingsSection', Mage::helper('adminhtml')->__('New account'));
26
+ $this->assignVariable('pluginHelpText', Mage::helper('adminhtml')->__('We want you to enjoy the full functionality of LiveAgent with the free account. It does not limit the number of agents and you have the option to activate the most of available features.'));
27
  }
28
 
29
  private function getdomainOnly() {
30
  $domain = preg_replace('/^(.*\.)?([^.]*\..*)$/', '$2', @$_SERVER['HTTP_HOST']);
31
+ if (trim($domain) == 'localhost') {
32
  return '';
33
  }
34
+ if (preg_match('/^[a-zA-Z0-9\-]+$/', $domain) === false) {
35
+ return '';
36
+ }
37
  return $domain;
38
  }
39
 
60
  protected function getTemplateString() {
61
  return '
62
  <script type="text/javascript">
63
+ var skipCreate = function() {
64
  setLocation(\'{skipUrlAction}\')
65
  }
66
  </script>
71
  <table cellspacing="0">
72
  <tbody><tr>
73
  <td style="width:50%;"><h3 class="icon-head head-promo-catalog">{dialogCaption}</h3></td>
74
+ <td class="form-buttons"><button id="id_5806f3a306fa79f4340cb58c1d190ff5" type="button" class="scalable save" onclick="configForm.submit()" style=""><span>{submitCaption}</span></button></td>
75
+ </tr>
76
  </tbody>
77
+ </table>
78
  </div>
79
  <div class="entry-edit">
80
  <fieldset>
81
  {pluginHelpText}
82
+ </fieldset>
83
  </div>
84
  <div class="entry-edit">
85
  <div class="entry-edit-head"><h4>{settingsSection}</h4></div>
112
  <tr>
113
  <td colspan="4" class="scope-label"></td>
114
  </tr>
115
+ <tr>
116
  <td colspan="4" class="scope-label"><button onclick="skipCreate()" type="button" class="scalable "><span>{skipLink}</span></button></td>
117
  </tr>
118
  </tbody>
119
  </table>
120
  </fieldset>
121
+ </div>
122
  ';
123
  }
124
+ }
app/code/local/Qualityunit/Liveagent/Helper/Auth.php CHANGED
@@ -24,12 +24,42 @@ class Qualityunit_Liveagent_Helper_Auth extends Qualityunit_Liveagent_Helper_Bas
24
  throw new Qualityunit_Liveagent_Exception_ConnectProblem($e->getMessage());
25
  }
26
  }
27
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
28
  /**
29
  * @return La_Rpc_Data
30
  */
31
  public function LoginAndGetLoginData($url = null, $username = null, $password = null) {
32
  $url = $this->getRemoteApiUrl($url);
 
33
  $request = new La_Rpc_DataRequest("Gpf_Api_AuthService", "authenticate");
34
 
35
  if ($username == null) {
@@ -58,4 +88,4 @@ class Qualityunit_Liveagent_Helper_Auth extends Qualityunit_Liveagent_Helper_Bas
58
  return $request->getData();
59
  }
60
  }
61
- ?>
24
  throw new Qualityunit_Liveagent_Exception_ConnectProblem($e->getMessage());
25
  }
26
  }
27
+
28
+ public function getauthTokenByApi($url, $apiKey) {
29
+ $url = $this->getRemoteApiUrl($url);
30
+ $url .= '?handler=agents/' . urlencode($this->settingsModel->getOwnerEmail()) . '&apikey=' . $apiKey;
31
+
32
+ $ch = curl_init();
33
+ curl_setopt($ch,CURLOPT_URL, $url);
34
+ curl_setopt($ch,CURLOPT_RETURNTRANSFER, true);
35
+ $this->_log('Fetching user auth info from api url: ' . $url);
36
+ $curl_response=curl_exec($ch);
37
+ if ($curl_response === false) {
38
+ $info = curl_getinfo($ch);
39
+ curl_close($ch);
40
+ $this->_log('Error calling API request: ' . var_export($info, true));
41
+ return '';
42
+ }
43
+ $info = curl_getinfo($ch);
44
+ curl_close($ch);
45
+ $decodedResponse = json_decode($curl_response);
46
+ if (!isset($decodedResponse->response)) {
47
+ $this->_log('Error decoding API response: ' . $curl_response . ', info: ' . var_export($info, true));
48
+ return '';
49
+ }
50
+ if ($info['http_code'] != 200) {
51
+ $this->_log('API response returned error: ' . $curl_response . ', info: ' . var_export($info, true));
52
+ return '';
53
+ }
54
+ return $decodedResponse->response->authtoken;
55
+ }
56
+
57
  /**
58
  * @return La_Rpc_Data
59
  */
60
  public function LoginAndGetLoginData($url = null, $username = null, $password = null) {
61
  $url = $this->getRemoteApiUrl($url);
62
+
63
  $request = new La_Rpc_DataRequest("Gpf_Api_AuthService", "authenticate");
64
 
65
  if ($username == null) {
88
  return $request->getData();
89
  }
90
  }
91
+ ?>
app/code/local/Qualityunit/Liveagent/Helper/Settings.php CHANGED
@@ -26,6 +26,7 @@ class Qualityunit_Liveagent_Helper_Settings {
26
 
27
  const LA_URL_SETTING_NAME = 'la-url';
28
  const LA_OWNER_EMAIL_SETTING_NAME = 'la-owner-email';
 
29
  const LA_OWNER_PASSWORD_SETTING_NAME = 'la-owner-password';
30
  const GENERAL_SETTINGS_PAGE_STATE_SETTING_NAME = 'general-settings-state';
31
 
@@ -59,7 +60,15 @@ class Qualityunit_Liveagent_Helper_Settings {
59
 
60
  public function login() {
61
  $auth = new Qualityunit_Liveagent_Helper_Auth();
62
- $loginData = $auth->LoginAndGetLoginData();
 
 
 
 
 
 
 
 
63
  try {
64
  $sessionId = $loginData->getValue('session');
65
  $this->setOption(Qualityunit_Liveagent_Helper_Settings::OWNER_SESSIONID, $sessionId);
@@ -79,8 +88,8 @@ class Qualityunit_Liveagent_Helper_Settings {
79
 
80
  public function getLiveAgentUrl() {
81
  $url = $this->getOption(Qualityunit_Liveagent_Helper_Settings::LA_URL_SETTING_NAME);
82
- if ($url == null) {
83
- return $url;
84
  }
85
  if (strpos($url, 'http://') === false && strpos($url, 'https://') === false) {
86
  return 'http://' . $url;
@@ -88,6 +97,10 @@ class Qualityunit_Liveagent_Helper_Settings {
88
  return $url;
89
  }
90
 
 
 
 
 
91
  public function getOwnerEmail() {
92
  return $this->getOption(Qualityunit_Liveagent_Helper_Settings::LA_OWNER_EMAIL_SETTING_NAME);
93
  }
@@ -109,10 +122,13 @@ class Qualityunit_Liveagent_Helper_Settings {
109
 
110
  public function saveButtonCodeForButtonId($buttonid) {
111
  $url = $this->getLiveAgentUrl();
112
- $this->setOption(self::BUTTON_CODE, '
113
- <script type="text/javascript" id="la_x2s6df8d" src="'.$url.'/scripts/trackjs.php"></script>
114
- <img src="//support.qualityunit.com/scripts/pix.gif" onLoad="LiveAgentTracker.createButton(\''.$buttonid.'\', this);"/>
115
- ');
 
 
 
116
  }
117
 
118
  public function getOption($name) {
@@ -128,4 +144,4 @@ class Qualityunit_Liveagent_Helper_Settings {
128
  return $this->getOption(Qualityunit_Liveagent_Helper_Settings::LA_URL_SETTING_NAME) == '' && $this->getOption(Qualityunit_Liveagent_Helper_Settings::LA_OWNER_EMAIL_SETTING_NAME) == '';
129
  }
130
  }
131
- ?>
26
 
27
  const LA_URL_SETTING_NAME = 'la-url';
28
  const LA_OWNER_EMAIL_SETTING_NAME = 'la-owner-email';
29
+ const LA_USE_API_KEY = 'la-use-api-key';
30
  const LA_OWNER_PASSWORD_SETTING_NAME = 'la-owner-password';
31
  const GENERAL_SETTINGS_PAGE_STATE_SETTING_NAME = 'general-settings-state';
32
 
60
 
61
  public function login() {
62
  $auth = new Qualityunit_Liveagent_Helper_Auth();
63
+ if ($this->getOption(Qualityunit_Liveagent_Helper_Settings::LA_USE_API_KEY) == 'Y') {
64
+ //use api and fetch auth token
65
+ $token = $auth->getauthTokenByApi(null , $this->getOwnerPassword());
66
+ $this->setOption(Qualityunit_Liveagent_Helper_Settings::OWNER_AUTHTOKEN, $token);
67
+ return $token;
68
+ }
69
+
70
+
71
+ $loginData = $auth->LoginAndGetLoginData();
72
  try {
73
  $sessionId = $loginData->getValue('session');
74
  $this->setOption(Qualityunit_Liveagent_Helper_Settings::OWNER_SESSIONID, $sessionId);
88
 
89
  public function getLiveAgentUrl() {
90
  $url = $this->getOption(Qualityunit_Liveagent_Helper_Settings::LA_URL_SETTING_NAME);
91
+ if ($url == null) {
92
+ return $url;
93
  }
94
  if (strpos($url, 'http://') === false && strpos($url, 'https://') === false) {
95
  return 'http://' . $url;
97
  return $url;
98
  }
99
 
100
+ public function useApiKey() {
101
+ return $this->getOption(Qualityunit_Liveagent_Helper_Settings::LA_USE_API_KEY) == 'Y';
102
+ }
103
+
104
  public function getOwnerEmail() {
105
  return $this->getOption(Qualityunit_Liveagent_Helper_Settings::LA_OWNER_EMAIL_SETTING_NAME);
106
  }
122
 
123
  public function saveButtonCodeForButtonId($buttonid) {
124
  $url = $this->getLiveAgentUrl();
125
+ $this->setOption(self::BUTTON_CODE, "
126
+ <script type=\"text/javascript\">
127
+ (function(d, src, c) { var t=d.scripts[d.scripts.length - 1],s=d.createElement('script');s.id='la_x2s6df8d';s.async=true;s.src=src;s.onload=s.onreadystatechange=function(){var rs=this.readyState;if(rs&&(rs!='complete')&&(rs!='loaded')){return;}c(this);};t.parentElement.insertBefore(s,t.nextSibling);})(document,
128
+ '//latrialtst456466.ladesk.com/scripts/track.js',
129
+ function(e){});
130
+ </script>
131
+ ");
132
  }
133
 
134
  public function getOption($name) {
144
  return $this->getOption(Qualityunit_Liveagent_Helper_Settings::LA_URL_SETTING_NAME) == '' && $this->getOption(Qualityunit_Liveagent_Helper_Settings::LA_OWNER_EMAIL_SETTING_NAME) == '';
145
  }
146
  }
147
+
app/code/local/Qualityunit/Liveagent/Helper/Signup.php CHANGED
@@ -11,16 +11,37 @@
11
  class Qualityunit_Liveagent_Helper_Signup extends Qualityunit_Liveagent_Helper_Base {
12
 
13
  public function signup($name, $email, $domain, $password, $papVisitorId = '') {
14
- $request = new La_Rpc_ActionRequest('Dp_QualityUnit_La_Signup', 'createAccountRequest');
15
- $request->setUrl('http://members.qualityunit.com/scripts/server.php');
16
- $request->addParam('domain', $domain);
17
- $request->addParam('name', $name);
18
- $request->addParam('email', $email);
19
- $request->addParam('password', $password);
20
- $request->addParam('variationid', '3513230f');
21
- $request->addParam('PAPvisitorId', $papVisitorId);
22
- $request->addParam('source', 'magento');
23
- $request->sendNow();
24
- return $request->getStdResponse();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25
  }
26
- }
11
  class Qualityunit_Liveagent_Helper_Signup extends Qualityunit_Liveagent_Helper_Base {
12
 
13
  public function signup($name, $email, $domain, $password, $papVisitorId = '') {
14
+ $ch = curl_init();
15
+ $curl_post_data = array(
16
+ 'variation_id' => '3513230f',
17
+ 'customer_email' => $email,
18
+ 'initial_api_key' => $password,
19
+ 'customer_name' => $name,
20
+ 'subdomain' => $domain,
21
+ 'location_id' => 'magento',
22
+ 'apikey' => 'jx5imiBhB6K12zui03YJL0lumHOr7S5T'
23
+ );
24
+ curl_setopt($ch,CURLOPT_URL,"https://signup.ladesk.com/api/index.php?handler=accounts&apikey=jx5imiBhB6K12zui03YJL0lumHOr7S5T");
25
+ curl_setopt($ch,CURLOPT_RETURNTRANSFER, true);
26
+ curl_setopt($ch, CURLOPT_POST, true);
27
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $curl_post_data);
28
+ $curl_response=curl_exec($ch);
29
+ if ($curl_response === false) {
30
+ $info = curl_getinfo($ch);
31
+ curl_close($ch);
32
+ throw new Qualityunit_Liveagent_Exception_Base("Error during signup request. Additioanl info:" . var_export($info, true));
33
+ }
34
+ $info = curl_getinfo($ch);
35
+ curl_close($ch);
36
+ Mage::log('Response info: ' . var_export($info, true));
37
+ Mage::log('Raw repsonse: ' . $curl_response);
38
+ $decodedResponse = json_decode($curl_response);
39
+ if (!isset($decodedResponse->response)) {
40
+ throw new Qualityunit_Liveagent_Exception_Base("Signup request failed. Please try again...");
41
+ }
42
+ if ($info['http_code'] != 200) {
43
+ throw new Qualityunit_Liveagent_Exception_Base("Signup request failed: " . $decodedResponse->response->errormessage);
44
+ }
45
+ return $decodedResponse->response;
46
  }
47
+ }
app/code/local/Qualityunit/Liveagent/controllers/Adminhtml/LiveagentController.php CHANGED
@@ -34,7 +34,7 @@ class Qualityunit_Liveagent_Adminhtml_LiveagentController extends Mage_Adminhtml
34
  ->_addBreadcrumb(Mage::helper('adminhtml')->__('Account'), Mage::helper('adminhtml')->__('Settings'));
35
  }
36
 
37
- private function doAfterPost($params = array()) {
38
  $this->_redirect('*/*', $params);
39
  }
40
 
@@ -47,11 +47,12 @@ class Qualityunit_Liveagent_Adminhtml_LiveagentController extends Mage_Adminhtml
47
  if ($post['action']=="r") {
48
  try {
49
  $this->validateSignupMail($post[Qualityunit_Liveagent_Helper_Settings::LA_OWNER_EMAIL_SETTING_NAME]);
 
50
  $this->registerAccountAction(
51
  $post[Qualityunit_Liveagent_Block_Signup::FULL_NAME_FIELD],
52
  $post[Qualityunit_Liveagent_Helper_Settings::LA_OWNER_EMAIL_SETTING_NAME],
53
  $post[Qualityunit_Liveagent_Helper_Settings::LA_URL_SETTING_NAME],
54
- substr(md5(microtime()),0,8),
55
  ''
56
  );
57
  } catch (Qualityunit_Liveagent_Exception_SignupFailed $e) {
@@ -61,7 +62,7 @@ class Qualityunit_Liveagent_Adminhtml_LiveagentController extends Mage_Adminhtml
61
  $this->doAfterPost();
62
  return;
63
  }
64
- if ($post['action']==Qualityunit_Liveagent_Block_Account::SAVE_ACCOUNT_SETTINGS_ACTION_FLAG) {
65
  if (!$this->checkAccountSettings($post)) {
66
  $this->doAfterPost($this->getAccountSettingsPost($post));
67
  return;
@@ -73,21 +74,35 @@ class Qualityunit_Liveagent_Adminhtml_LiveagentController extends Mage_Adminhtml
73
  Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Unable to connect to LiveAgent at') . ' ' . $post[Qualityunit_Liveagent_Helper_Settings::LA_URL_SETTING_NAME] . '. ' . $this->getAccountSettingsChangeRevertLink());
74
  $this->doAfterPost($this->getAccountSettingsPost($post));
75
  return;
76
- }
77
- try {
78
- $auth->LoginAndGetLoginData($post[Qualityunit_Liveagent_Helper_Settings::LA_URL_SETTING_NAME],
79
- $post[Qualityunit_Liveagent_Helper_Settings::LA_OWNER_EMAIL_SETTING_NAME],
80
- $post[Qualityunit_Liveagent_Helper_Settings::LA_OWNER_PASSWORD_SETTING_NAME]);
81
- } catch (Qualityunit_Liveagent_Exception_ConnectProblem $e) {
82
- Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Unable to login to LiveAgent with given credentails. Please check your username and password.') . ' ' . $this->getAccountSettingsChangeRevertLink());
83
- $this->doAfterPost($this->getAccountSettingsPost($post));
84
- return;
85
- }
86
- $this->saveAccountSettings($post);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
87
  if (!$this->isSetStatus()) {
88
  $this->settings->setOption(Qualityunit_Liveagent_Helper_Settings::ACCOUNT_STATUS, Qualityunit_Liveagent_Helper_Base::ACCOUNT_STATUS_SET);
89
  }
90
- Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Account settings were saved successfully'));
91
  }
92
  if ($post['action']==Qualityunit_Liveagent_Block_Buttoncode::SAVE_BUTTON_CODE_ACTION_FLAG) {
93
  $this->settings->setOption(Qualityunit_Liveagent_Helper_Settings::BUTTON_CODE,
@@ -110,6 +125,12 @@ class Qualityunit_Liveagent_Adminhtml_LiveagentController extends Mage_Adminhtml
110
  );
111
  }
112
 
 
 
 
 
 
 
113
  private function validateSignupMail($mail) {
114
  if (!Zend_Validate::is($mail, 'EmailAddress')) {
115
  throw new Qualityunit_Liveagent_Exception_SignupFailed(Mage::helper('adminhtml')->__('Please enter valid email address'));
@@ -153,12 +174,16 @@ class Qualityunit_Liveagent_Adminhtml_LiveagentController extends Mage_Adminhtml
153
  return true;
154
  }
155
 
156
- private function saveAccountsettings($post) {
157
  $oldUrl = $this->settings->getOption(Qualityunit_Liveagent_Helper_Settings::LA_URL_SETTING_NAME);
158
  $this->settings->setOption(Qualityunit_Liveagent_Helper_Settings::LA_OWNER_EMAIL_SETTING_NAME, $post[Qualityunit_Liveagent_Helper_Settings::LA_OWNER_EMAIL_SETTING_NAME]);
159
  $this->settings->setOption(Qualityunit_Liveagent_Helper_Settings::LA_OWNER_PASSWORD_SETTING_NAME, $post[Qualityunit_Liveagent_Helper_Settings::LA_OWNER_PASSWORD_SETTING_NAME]);
160
  $this->settings->setOption(Qualityunit_Liveagent_Helper_Settings::LA_URL_SETTING_NAME, $post[Qualityunit_Liveagent_Helper_Settings::LA_URL_SETTING_NAME]);
161
- $this->settings->setOption(Qualityunit_Liveagent_Helper_Settings::OWNER_AUTHTOKEN, '');
 
 
 
 
162
  $this->settings->setOption(Qualityunit_Liveagent_Helper_Settings::OWNER_SESSIONID, '');
163
  if ($oldUrl == $post[Qualityunit_Liveagent_Helper_Settings::LA_URL_SETTING_NAME]) {
164
  return;
@@ -241,7 +266,7 @@ class Qualityunit_Liveagent_Adminhtml_LiveagentController extends Mage_Adminhtml
241
  }
242
  }
243
 
244
- private function renderAccountDialog() {
245
  if ($this->isSetStatus() && Qualityunit_Liveagent_Helper_Account::isOnline()) {
246
  $this->checkButtonCodeIsEmpty();
247
  $block = new Qualityunit_Liveagent_Block_Buttoncode();
@@ -269,6 +294,7 @@ class Qualityunit_Liveagent_Adminhtml_LiveagentController extends Mage_Adminhtml
269
  }
270
 
271
  private function resetAccountAction() {
 
272
  $this->settings->setOption(Qualityunit_Liveagent_Helper_Settings::ACCOUNT_STATUS, Qualityunit_Liveagent_Helper_Base::ACCOUNT_STATUS_NOTSET);
273
  }
274
 
@@ -279,11 +305,12 @@ class Qualityunit_Liveagent_Adminhtml_LiveagentController extends Mage_Adminhtml
279
  } catch (Qualityunit_Liveagent_Exception_Base $e) {
280
  throw new Qualityunit_Liveagent_Exception_SignupFailed($e->getMessage());
281
  }
282
- Mage::log("Signup response recieved:" . print_r($response, true), Zend_log::DEBUG);
283
- if ($response->success != "Y") {
284
- Mage::log("Response contain error:" . $response->errorMessage, Zend_log::DEBUG);
285
- throw new Qualityunit_Liveagent_Exception_SignupFailed($response->errorMessage);
286
- }
 
287
  Mage::log("Response OK", Zend_log::DEBUG);
288
  }
289
 
@@ -292,6 +319,7 @@ class Qualityunit_Liveagent_Adminhtml_LiveagentController extends Mage_Adminhtml
292
  $this->settings->setOption(Qualityunit_Liveagent_Helper_Settings::LA_URL_SETTING_NAME, 'http://' . $domain . '.ladesk.com');
293
  $this->settings->setOption(Qualityunit_Liveagent_Helper_Settings::LA_OWNER_EMAIL_SETTING_NAME, $email);
294
  $this->settings->setOption(Qualityunit_Liveagent_Helper_Settings::LA_OWNER_PASSWORD_SETTING_NAME, $password);
 
295
  $this->settings->saveDefaultButtonCode();
296
  $this->settings->setOption(Qualityunit_Liveagent_Helper_Settings::ACCOUNT_STATUS, Qualityunit_Liveagent_Helper_Base::ACCOUNT_STATUS_WAIT);
297
  }
@@ -300,4 +328,4 @@ class Qualityunit_Liveagent_Adminhtml_LiveagentController extends Mage_Adminhtml
300
  $this->settings->setOption(Qualityunit_Liveagent_Helper_Settings::ACCOUNT_STATUS, Qualityunit_Liveagent_Helper_Base::ACCOUNT_STATUS_SET);
301
  $this->settings->setOption(Qualityunit_Liveagent_Helper_Settings::ACCOUNT_NOT_REACHABLE_TIMES, 0);
302
  }
303
- }
34
  ->_addBreadcrumb(Mage::helper('adminhtml')->__('Account'), Mage::helper('adminhtml')->__('Settings'));
35
  }
36
 
37
+ private function doAfterPost($params = array()) {
38
  $this->_redirect('*/*', $params);
39
  }
40
 
47
  if ($post['action']=="r") {
48
  try {
49
  $this->validateSignupMail($post[Qualityunit_Liveagent_Helper_Settings::LA_OWNER_EMAIL_SETTING_NAME]);
50
+ $this->validateSubdomain($post[Qualityunit_Liveagent_Helper_Settings::LA_URL_SETTING_NAME]);
51
  $this->registerAccountAction(
52
  $post[Qualityunit_Liveagent_Block_Signup::FULL_NAME_FIELD],
53
  $post[Qualityunit_Liveagent_Helper_Settings::LA_OWNER_EMAIL_SETTING_NAME],
54
  $post[Qualityunit_Liveagent_Helper_Settings::LA_URL_SETTING_NAME],
55
+ md5(rand(90000,99999) . microtime() . rand(90000,99999)),
56
  ''
57
  );
58
  } catch (Qualityunit_Liveagent_Exception_SignupFailed $e) {
62
  $this->doAfterPost();
63
  return;
64
  }
65
+ if ($post['action']==Qualityunit_Liveagent_Block_Account::SAVE_ACCOUNT_SETTINGS_ACTION_FLAG) {
66
  if (!$this->checkAccountSettings($post)) {
67
  $this->doAfterPost($this->getAccountSettingsPost($post));
68
  return;
74
  Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Unable to connect to LiveAgent at') . ' ' . $post[Qualityunit_Liveagent_Helper_Settings::LA_URL_SETTING_NAME] . '. ' . $this->getAccountSettingsChangeRevertLink());
75
  $this->doAfterPost($this->getAccountSettingsPost($post));
76
  return;
77
+ }
78
+ if ($this->settings->useApiKey()) {
79
+ try {
80
+ $token = $auth->getauthTokenByApi($post[Qualityunit_Liveagent_Helper_Settings::LA_URL_SETTING_NAME], $post[Qualityunit_Liveagent_Helper_Settings::LA_OWNER_PASSWORD_SETTING_NAME]);
81
+ $this->settings->setOption(Qualityunit_Liveagent_Helper_Settings::OWNER_AUTHTOKEN, $token);
82
+ } catch (Qualityunit_Liveagent_Exception_ConnectProblem $e) {
83
+ }
84
+ if ($token == null) {
85
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Unable to login to LiveAgent with given credentails. Please check your url, username and api key.') . ' ' . $this->getAccountSettingsChangeRevertLink());
86
+ $this->doAfterPost($this->getAccountSettingsPost($post));
87
+ return;
88
+ }
89
+ } else {
90
+ try {
91
+ $auth->LoginAndGetLoginData($post[Qualityunit_Liveagent_Helper_Settings::LA_URL_SETTING_NAME],
92
+ $post[Qualityunit_Liveagent_Helper_Settings::LA_OWNER_EMAIL_SETTING_NAME],
93
+ $post[Qualityunit_Liveagent_Helper_Settings::LA_OWNER_PASSWORD_SETTING_NAME]);
94
+ } catch (Qualityunit_Liveagent_Exception_ConnectProblem $e) {
95
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Unable to login to LiveAgent with given credentails. Please check your username and password.') . ' ' . $this->getAccountSettingsChangeRevertLink());
96
+ $this->doAfterPost($this->getAccountSettingsPost($post));
97
+ return;
98
+ }
99
+ }
100
+
101
+ $this->saveAccountSettings($post, $token);
102
  if (!$this->isSetStatus()) {
103
  $this->settings->setOption(Qualityunit_Liveagent_Helper_Settings::ACCOUNT_STATUS, Qualityunit_Liveagent_Helper_Base::ACCOUNT_STATUS_SET);
104
  }
105
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Account settings were saved successfully'));
106
  }
107
  if ($post['action']==Qualityunit_Liveagent_Block_Buttoncode::SAVE_BUTTON_CODE_ACTION_FLAG) {
108
  $this->settings->setOption(Qualityunit_Liveagent_Helper_Settings::BUTTON_CODE,
125
  );
126
  }
127
 
128
+ private function validateSubdomain($subdomain) {
129
+ if (0 == preg_match('/^[a-z0-9-]{3,}$/', $subdomain)) {
130
+ throw new Qualityunit_Liveagent_Exception_SignupFailed(Mage::helper('adminhtml')->__('Please enter valid subdomain name'));
131
+ }
132
+ }
133
+
134
  private function validateSignupMail($mail) {
135
  if (!Zend_Validate::is($mail, 'EmailAddress')) {
136
  throw new Qualityunit_Liveagent_Exception_SignupFailed(Mage::helper('adminhtml')->__('Please enter valid email address'));
174
  return true;
175
  }
176
 
177
+ private function saveAccountsettings($post, $token = null) {
178
  $oldUrl = $this->settings->getOption(Qualityunit_Liveagent_Helper_Settings::LA_URL_SETTING_NAME);
179
  $this->settings->setOption(Qualityunit_Liveagent_Helper_Settings::LA_OWNER_EMAIL_SETTING_NAME, $post[Qualityunit_Liveagent_Helper_Settings::LA_OWNER_EMAIL_SETTING_NAME]);
180
  $this->settings->setOption(Qualityunit_Liveagent_Helper_Settings::LA_OWNER_PASSWORD_SETTING_NAME, $post[Qualityunit_Liveagent_Helper_Settings::LA_OWNER_PASSWORD_SETTING_NAME]);
181
  $this->settings->setOption(Qualityunit_Liveagent_Helper_Settings::LA_URL_SETTING_NAME, $post[Qualityunit_Liveagent_Helper_Settings::LA_URL_SETTING_NAME]);
182
+ if ($this->settings->useApiKey() && $token != '') {
183
+ $this->settings->setOption(Qualityunit_Liveagent_Helper_Settings::OWNER_AUTHTOKEN. $token);
184
+ } else {
185
+ $this->settings->setOption(Qualityunit_Liveagent_Helper_Settings::OWNER_AUTHTOKEN, '');
186
+ }
187
  $this->settings->setOption(Qualityunit_Liveagent_Helper_Settings::OWNER_SESSIONID, '');
188
  if ($oldUrl == $post[Qualityunit_Liveagent_Helper_Settings::LA_URL_SETTING_NAME]) {
189
  return;
266
  }
267
  }
268
 
269
+ private function renderAccountDialog() {
270
  if ($this->isSetStatus() && Qualityunit_Liveagent_Helper_Account::isOnline()) {
271
  $this->checkButtonCodeIsEmpty();
272
  $block = new Qualityunit_Liveagent_Block_Buttoncode();
294
  }
295
 
296
  private function resetAccountAction() {
297
+ $this->settings->setOption(Qualityunit_Liveagent_Helper_Settings::LA_USE_API_KEY, 'Y');
298
  $this->settings->setOption(Qualityunit_Liveagent_Helper_Settings::ACCOUNT_STATUS, Qualityunit_Liveagent_Helper_Base::ACCOUNT_STATUS_NOTSET);
299
  }
300
 
305
  } catch (Qualityunit_Liveagent_Exception_Base $e) {
306
  throw new Qualityunit_Liveagent_Exception_SignupFailed($e->getMessage());
307
  }
308
+ Mage::log("Signup response recieved: " . print_r($response, true), Zend_log::DEBUG);
309
+
310
+ // if ($response->success != "Y") {
311
+ // Mage::log("Response contain error:" . $response->errorMessage, Zend_log::DEBUG);
312
+ // throw new Qualityunit_Liveagent_Exception_SignupFailed($response->errorMessage);
313
+ // }
314
  Mage::log("Response OK", Zend_log::DEBUG);
315
  }
316
 
319
  $this->settings->setOption(Qualityunit_Liveagent_Helper_Settings::LA_URL_SETTING_NAME, 'http://' . $domain . '.ladesk.com');
320
  $this->settings->setOption(Qualityunit_Liveagent_Helper_Settings::LA_OWNER_EMAIL_SETTING_NAME, $email);
321
  $this->settings->setOption(Qualityunit_Liveagent_Helper_Settings::LA_OWNER_PASSWORD_SETTING_NAME, $password);
322
+ $this->settings->setOption(Qualityunit_Liveagent_Helper_Settings::LA_USE_API_KEY, 'Y');
323
  $this->settings->saveDefaultButtonCode();
324
  $this->settings->setOption(Qualityunit_Liveagent_Helper_Settings::ACCOUNT_STATUS, Qualityunit_Liveagent_Helper_Base::ACCOUNT_STATUS_WAIT);
325
  }
328
  $this->settings->setOption(Qualityunit_Liveagent_Helper_Settings::ACCOUNT_STATUS, Qualityunit_Liveagent_Helper_Base::ACCOUNT_STATUS_SET);
329
  $this->settings->setOption(Qualityunit_Liveagent_Helper_Settings::ACCOUNT_NOT_REACHABLE_TIMES, 0);
330
  }
331
+ }
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Liveagent</name>
4
- <version>2.5.5</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.gnu.org/licenses/gpl-3.0.txt">GPLv3</license>
7
  <channel>community</channel>
@@ -10,11 +10,13 @@
10
  <description>Magento-LiveAgent plugin integrates full featured help desk and live chat software Live Agent into any Magento installation.&#xD;
11
  Simply add "start chat" button by few simple clicks and be live within 5 minutes.</description>
12
  <notes>changes:&#xD;
13
- - do not offer random domain name when proper name can not be detected</notes>
 
 
14
  <authors><author><name>Juraj Simon</name><user>jurajsim</user><email>jsimon@qualityunit.com</email></author></authors>
15
- <date>2014-05-07</date>
16
- <time>13:35:25</time>
17
- <contents><target name="magelocal"><dir name="Qualityunit"><dir name="Liveagent"><dir name="Block"><file name="Account.php" hash="56e4f19da52a86005818c67a3fb1f3f5"/><file name="Base.php" hash="dc71cde05c3010139be7ccab1b9a9120"/><file name="Buttoncode.php" hash="9f9b35152e7aa37fa84500e758d2f2d6"/><file name="Signup.php" hash="a32cbca5baf7047e2d2c9e9900075594"/><file name="Waiting.php" hash="223cd9f902b00860c53d1f4fd395ee3f"/></dir><dir name="Exception"><file name="Base.php" hash="6efd9dcda657c33bc9cfe6709300b883"/><file name="ConnectProblem.php" hash="f2c9840d533e6389ba84989337de32c9"/><file name="SignupFailed.php" hash="e370773d3b306bb8c24e5263d1491860"/></dir><dir name="Helper"><file name="Account.php" hash="e82e7c5f8bfc34ce8016a50d9c072046"/><file name="Auth.php" hash="3e7e9f453cf7949d04f519e8f47e8749"/><file name="Base.php" hash="5d7b663453478d14458103a694ab9137"/><file name="Data.php" hash="006a11910d2f5365f4d3fddb2a4058bf"/><file name="PhpApi.php" hash="adb77eb5ef4cc7a2d5b2adc076a3ee81"/><file name="Settings.php" hash="71025affe5879d766ec335bf68b43065"/><file name="Signup.php" hash="afcf742f8f0ad2d84892365f5e86fb45"/></dir><dir name="Model"><file name="Buttons.php" hash="2db48b5ff722dc0aa13c27ee0d625e74"/><file name="Liveagent.php" hash="91844f01d97d79cff0ee0c91496fa3a3"/><dir name="Mysql4"><dir name="Buttons"><file name="Collection.php" hash="b93a104561a802454e06bfb8ffc29ef5"/></dir><file name="Buttons.php" hash="12ea6a6a4cd03692c1665bfd86b81aa8"/><dir name="Liveagent"><file name="Collection.php" hash="3682b0f4f0ec4b640c5ee215cec222f1"/></dir><file name="Liveagent.php" hash="c52f750808b18966862ef49738eb8daf"/><dir name="Settings"><file name="Collection.php" hash="19b1f3e92b930af46d36d436fb0cdc23"/></dir><file name="Settings.php" hash="7e02819c52cc34ffd14d27aad6165697"/></dir><file name="Settings.php" hash="0c99b933072e01be32b202315367fce9"/><file name="Status.php" hash="c743fdabadd7527820e7b8ede6937f38"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="LiveagentController.php" hash="03ed29c55aaeae3c4fdf698f2b524ee1"/></dir><file name="IndexController.php" hash="425c0f6b8d7e19d42ad491c5248efded"/></dir><dir name="etc"><file name="config.xml" hash="698ba467e2f87a54844e0ab544b55875"/></dir><dir name="sql"><dir name="liveagent_setup"><file name="mysql4-install-0.1.0.php" hash="21c2e292c7366bc46ff9a7b53ed72678"/><file name="mysql4-install-2.5.4.php" hash="ab55adfa2214c5ae0bb19053159377b3"/></dir></dir></dir><file name=".buildpath" hash="0d2475e3be03419439e2a22ebc4e0813"/><file name=".project" hash="41fa1353a5ab19352d5636d52e17351d"/><dir name=".settings"><file name="org.eclipse.php.core.prefs" hash="abf8f34f8087365ab830524698638d7c"/><file name="org.eclipse.wst.jsdt.ui.superType.container" hash="b27d1cf62dde4473bab7c433317bb0ce"/><file name="org.eclipse.wst.jsdt.ui.superType.name" hash="c89686a387d2b12b3c729ce35a0bcb5b"/><file name=".jsdtscope" hash="d098ed1fa924b2d9d9cb377fb391d758"/></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="liveagent.xml" hash="e07cbd75c0faa7d86c9c0a8a2ff53df1"/></dir><dir name="template"><dir name="liveagent"><file name="button.phtml" hash="3cef6df19c905140c8c8ce01520f0ebd"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Qualityunit_Liveagent.xml" hash="db13786c45588e15d5a390201a1709e4"/></dir></target><target name="magelocale"><dir name="en_US"><file name="qualityunit_liveagent.csv" hash="234db3c1cdc05df98928ae633500bc04"/></dir></target></contents>
18
  <compatible/>
19
  <dependencies><required><php><min>5.2.0</min><max>5.6.0</max></php><extension><name>curl</name><min/><max/></extension></required></dependencies>
20
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Liveagent</name>
4
+ <version>2.5.6</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.gnu.org/licenses/gpl-3.0.txt">GPLv3</license>
7
  <channel>community</channel>
10
  <description>Magento-LiveAgent plugin integrates full featured help desk and live chat software Live Agent into any Magento installation.&#xD;
11
  Simply add "start chat" button by few simple clicks and be live within 5 minutes.</description>
12
  <notes>changes:&#xD;
13
+ - signup is using new API&#xD;
14
+ - minor fixes&#xD;
15
+ - default button code change</notes>
16
  <authors><author><name>Juraj Simon</name><user>jurajsim</user><email>jsimon@qualityunit.com</email></author></authors>
17
+ <date>2015-05-28</date>
18
+ <time>12:17:26</time>
19
+ <contents><target name="magelocal"><dir name="Qualityunit"><dir name="Liveagent"><dir name="Block"><file name="Account.php" hash="9cd8d7fdab5c6b88e3593edd5eb3ab38"/><file name="Base.php" hash="dc71cde05c3010139be7ccab1b9a9120"/><file name="Buttoncode.php" hash="4ff97380c40bdb7bec87464a7c06b6f9"/><file name="Signup.php" hash="861d0dc0d8dc1302e59b4a46c1a18153"/><file name="Waiting.php" hash="223cd9f902b00860c53d1f4fd395ee3f"/></dir><dir name="Exception"><file name="Base.php" hash="6efd9dcda657c33bc9cfe6709300b883"/><file name="ConnectProblem.php" hash="f2c9840d533e6389ba84989337de32c9"/><file name="SignupFailed.php" hash="e370773d3b306bb8c24e5263d1491860"/></dir><dir name="Helper"><file name="Account.php" hash="e82e7c5f8bfc34ce8016a50d9c072046"/><file name="Auth.php" hash="5fc9f40dd7a6b5e412361b27033b09b7"/><file name="Base.php" hash="5d7b663453478d14458103a694ab9137"/><file name="Data.php" hash="006a11910d2f5365f4d3fddb2a4058bf"/><file name="PhpApi.php" hash="adb77eb5ef4cc7a2d5b2adc076a3ee81"/><file name="Settings.php" hash="a859c416fdd16f61b6e3a035ef22807d"/><file name="Signup.php" hash="ef096f5f677389616d4bad8fb006b323"/></dir><dir name="Model"><file name="Buttons.php" hash="2db48b5ff722dc0aa13c27ee0d625e74"/><file name="Liveagent.php" hash="91844f01d97d79cff0ee0c91496fa3a3"/><dir name="Mysql4"><dir name="Buttons"><file name="Collection.php" hash="b93a104561a802454e06bfb8ffc29ef5"/></dir><file name="Buttons.php" hash="12ea6a6a4cd03692c1665bfd86b81aa8"/><dir name="Liveagent"><file name="Collection.php" hash="3682b0f4f0ec4b640c5ee215cec222f1"/></dir><file name="Liveagent.php" hash="c52f750808b18966862ef49738eb8daf"/><dir name="Settings"><file name="Collection.php" hash="19b1f3e92b930af46d36d436fb0cdc23"/></dir><file name="Settings.php" hash="7e02819c52cc34ffd14d27aad6165697"/></dir><file name="Settings.php" hash="0c99b933072e01be32b202315367fce9"/><file name="Status.php" hash="c743fdabadd7527820e7b8ede6937f38"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="LiveagentController.php" hash="d9cbbc574f1a9df57bdd0d9282403ff1"/></dir><file name="IndexController.php" hash="425c0f6b8d7e19d42ad491c5248efded"/></dir><dir name="etc"><file name="config.xml" hash="698ba467e2f87a54844e0ab544b55875"/></dir><dir name="sql"><dir name="liveagent_setup"><file name="mysql4-install-0.1.0.php" hash="21c2e292c7366bc46ff9a7b53ed72678"/><file name="mysql4-install-2.5.4.php" hash="ab55adfa2214c5ae0bb19053159377b3"/></dir></dir></dir><file name=".buildpath" hash="0d2475e3be03419439e2a22ebc4e0813"/><file name=".project" hash="41fa1353a5ab19352d5636d52e17351d"/><dir name=".settings"><file name="org.eclipse.php.core.prefs" hash="abf8f34f8087365ab830524698638d7c"/><file name="org.eclipse.wst.jsdt.ui.superType.container" hash="b27d1cf62dde4473bab7c433317bb0ce"/><file name="org.eclipse.wst.jsdt.ui.superType.name" hash="c89686a387d2b12b3c729ce35a0bcb5b"/><file name=".jsdtscope" hash="d098ed1fa924b2d9d9cb377fb391d758"/></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="liveagent.xml" hash="e07cbd75c0faa7d86c9c0a8a2ff53df1"/></dir><dir name="template"><dir name="liveagent"><file name="button.phtml" hash="3cef6df19c905140c8c8ce01520f0ebd"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Qualityunit_Liveagent.xml" hash="db13786c45588e15d5a390201a1709e4"/></dir></target><target name="magelocale"><dir name="en_US"><file name="qualityunit_liveagent.csv" hash="234db3c1cdc05df98928ae633500bc04"/></dir></target></contents>
20
  <compatible/>
21
  <dependencies><required><php><min>5.2.0</min><max>5.6.0</max></php><extension><name>curl</name><min/><max/></extension></required></dependencies>
22
  </package>