ProvideSupport_Live_Chat - Version 2.0.0

Version Notes

Release Info:
2.0.0

Download this release

Release Info

Developer Provide Support, LLC
Extension ProvideSupport_Live_Chat
Version 2.0.0
Comparing to
See all releases


Code changes from version 1.0.0 to 2.0.0

Files changed (22) hide show
  1. app/code/community/ProvideSupport/Livechat/Model/Livechat.php +0 -8
  2. app/code/community/ProvideSupport/Livechat/Model/Mysql4/Livechat.php +0 -8
  3. app/code/community/ProvideSupport/Livechat/Model/Mysql4/Livechat/Collection.php +0 -4
  4. app/code/community/ProvideSupport/Livechat/Model/Observer.php +0 -69
  5. app/code/community/ProvideSupport/Livechat/sql/providelivechat_setup/mysql4-install-1.0.0.php +0 -18
  6. app/code/community/ProvideSupport/{Livechat → Livechats}/Block/Help.php +1 -1
  7. app/code/community/ProvideSupport/{Livechat → Livechats}/Block/Settings.php +3 -2
  8. app/code/community/ProvideSupport/{Livechat → Livechats}/Helper/Data.php +2 -2
  9. app/code/community/ProvideSupport/Livechats/Model/Action.php +189 -0
  10. app/code/community/ProvideSupport/Livechats/Model/ErrorHandler.php +308 -0
  11. app/code/community/ProvideSupport/Livechats/Model/Livechats.php +8 -0
  12. app/code/community/ProvideSupport/Livechats/Model/Main.php +256 -0
  13. app/code/community/ProvideSupport/Livechats/Model/Mysql4/Livechats.php +8 -0
  14. app/code/community/ProvideSupport/Livechats/Model/Mysql4/Livechats/Collection.php +4 -0
  15. app/code/community/ProvideSupport/Livechats/Model/Observer.php +145 -0
  16. app/code/community/ProvideSupport/{Livechat → Livechats}/controllers/AdminController.php +4 -4
  17. app/code/community/ProvideSupport/{Livechat → Livechats}/etc/config.xml +44 -44
  18. app/code/community/ProvideSupport/Livechats/sql/providelivechat_setup/install-1.0.0.php +30 -0
  19. app/code/community/ProvideSupport/Livechats/sql/providelivechat_setup/upgrade-1.0.0-2.0.0.php +28 -0
  20. app/etc/modules/ProvideSupport_All.xml +2 -2
  21. js/provide/provide.js +6 -6
  22. package.xml +9 -8
app/code/community/ProvideSupport/Livechat/Model/Livechat.php DELETED
@@ -1,8 +0,0 @@
1
- <?php
2
- class ProvideSupport_Livechat_Model_Livechat extends Mage_Core_Model_Abstract
3
- {
4
- protected function _construct()
5
- {
6
- $this->_init('livechat/livechat');
7
- }
8
- }
 
 
 
 
 
 
 
 
app/code/community/ProvideSupport/Livechat/Model/Mysql4/Livechat.php DELETED
@@ -1,8 +0,0 @@
1
- <?php
2
- class ProvideSupport_Livechat_Model_Mysql4_Livechat extends Mage_Core_Model_Mysql4_Abstract
3
- {
4
- protected function _construct()
5
- {
6
- $this->_init('livechat/livechat', 'id');
7
- }
8
- }
 
 
 
 
 
 
 
 
app/code/community/ProvideSupport/Livechat/Model/Mysql4/Livechat/Collection.php DELETED
@@ -1,4 +0,0 @@
1
- <?php
2
- class ProvideSupport_Livechat_Model_Mysql4_Livechat_Collection extends Varien_Data_Collection_Db
3
- {
4
- }
 
 
 
 
app/code/community/ProvideSupport/Livechat/Model/Observer.php DELETED
@@ -1,69 +0,0 @@
1
- <?php
2
- class ProvideSupport_Livechat_Model_Observer
3
- {
4
- public $countPastCode;
5
- public function __construct()
6
- {
7
- $this->provide = Mage::getModel('livechat/livechat')->load(1)->getData('content');
8
- $this->view = Zend_Json::decode($this->provide, Zend_Json::TYPE_OBJECT);
9
- $this->settings = Zend_Json::decode($this->view->settings, Zend_Json::TYPE_OBJECT);
10
- $this->pos = $this->settings->buttonLocation;
11
- $this->list = $this->settings->buttonAvailableMenusList[0];
12
- $this->helper = Mage::helper('livechat/data');
13
- $this->helper->initCode($this->view);
14
- }
15
- public function insertBlock($observer)
16
- {
17
- if (Mage::app()->getLayout()->getArea() == 'frontend') {
18
- $_name = $observer->getBlock()->getNameInLayout();
19
- $_type = $observer->getBlock()->getType();
20
- if ($this->settings->pluginEnabled) {
21
- if ($this->pos == 'fixed') {
22
- if ($_name == 'root') {
23
- $this->handler();
24
- }
25
- } elseif ($this->pos == 'define') {
26
- if ($_name == $this->list) {
27
- $this->countPastCode = true; //1
28
- $this->handler();
29
- } else {
30
- if ($_name == 'before_body_end' && !$this->countPastCode && $this->settings->buttonAvailableWhole) {
31
- $this->helper->showModuleHiddenCode();
32
- $this->countPastCode = true;
33
- }
34
- }
35
- }
36
- }
37
- }
38
- }
39
- protected function handler()
40
- {
41
- $this->helper->initJs();
42
- if ($this->settings->buttonAvailableAll == false && $this->settings->buttonAvailablePost == false && $this->settings->buttonAvailableWhole == false) {
43
- //Nothing to display in fixed position
44
- } elseif ($this->settings->buttonAvailableAll == false && $this->settings->buttonAvailablePost == false && $this->settings->buttonAvailableWhole) {
45
- //Only display the hidden code
46
- if ($this->pos === 'fixed') {
47
- $this->helper->showModuleJsHiddenCode();
48
- } else {
49
- $this->helper->showModuleHiddenCode();
50
- $this->countPastCode = true;
51
- }
52
- } else {
53
- if ($this->settings->buttonAvailableAll) {
54
- $this->helper->showInAllCode($this->pos);
55
- } else {
56
- $this->helper->showInAllHiddenCode($this->pos);
57
- }
58
- if ($this->settings->buttonAvailablePost) {
59
- if ($this->settings->buttonAvailablePostWhich == 'all') {
60
- $this->helper->showAllPageCode($this->pos);
61
- } elseif ($this->settings->buttonAvailablePostWhich == 'selected') {
62
- $this->helper->showSelectedPageCode($this->pos);
63
- }
64
- } else {
65
- $this->helper->showAllPageHiddenCode($this->pos);
66
- }
67
- }
68
- }
69
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/ProvideSupport/Livechat/sql/providelivechat_setup/mysql4-install-1.0.0.php DELETED
@@ -1,18 +0,0 @@
1
- <?php
2
- $installer = $this;
3
- $installer->startSetup();
4
-
5
- $installer->run("
6
- CREATE TABLE IF NOT EXISTS {$this->getTable('providelivechat')} (
7
- `id` int(11) NOT NULL auto_increment,
8
- `title` varchar(100) NOT NULL,
9
- `content` text NOT NULL,
10
- PRIMARY KEY (`id`)
11
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
12
-
13
- INSERT INTO {$this->getTable('providelivechat')}
14
- (`id`, `title`, `content`) VALUES
15
- (1, 'Provide Support LiveChat', '{\"account\":{\"accountName\":\"\",\"accountHash\":\"\"},\"settings\":\"null\",\"code\":\"\",\"hiddencode\":\"\"}');
16
- ");
17
-
18
- $installer->endSetup();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/ProvideSupport/{Livechat → Livechats}/Block/Help.php RENAMED
@@ -1,5 +1,5 @@
1
  <?php
2
- class ProvideSupport_Livechat_Block_Help extends Mage_Core_Block_Template
3
  {
4
  protected function _toHtml()
5
  {
1
  <?php
2
+ class ProvideSupport_livechats_Block_Help extends Mage_Core_Block_Template
3
  {
4
  protected function _toHtml()
5
  {
app/code/community/ProvideSupport/{Livechat → Livechats}/Block/Settings.php RENAMED
@@ -1,5 +1,5 @@
1
  <?php
2
- class ProvideSupport_Livechat_Block_Settings extends Mage_Core_Block_Template
3
  {
4
  private function addProvideCss()
5
  {
@@ -237,7 +237,7 @@ background: none repeat scroll 0 0 #FAFAFA;
237
  }
238
  protected function _toHtml()
239
  {
240
- $html = '<script>var urlAjax = "' . Mage::getUrl('') . 'livechat/admin/ajax/?isAjax=true";</script>';
241
  $html .= $this->addProvideCss() . ' <div id="f7main">';
242
  $html .= '<div id="f7title">';
243
  $html .= 'Welcome to Provide Support Live Chat module settings page.<br/>Visit our website <a href="http://www.providesupport.com" target="_blank">www.providesupport.com</a> to find more information about our Live Chat system.';
@@ -440,6 +440,7 @@ background: none repeat scroll 0 0 #FAFAFA;
440
  preg_match_all('/<option value="([^"]*)" >([^>]*)<\/option>/', $option, $option_value);
441
  $count = count($option_value[1]);
442
  if ($count > 0) {
 
443
  for ($i = 1; $i < $count; $i++) {
444
  $div_menu .= '<option value="' . $option_value[1][$i] . '">' . $option_value[2][$i] . '</option>';
445
  }
1
  <?php
2
+ class ProvideSupport_livechats_Block_Settings extends Mage_Core_Block_Template
3
  {
4
  private function addProvideCss()
5
  {
237
  }
238
  protected function _toHtml()
239
  {
240
+ $html = '<script>var urlAjax = "' . Mage::getUrl('') . 'livechats/admin/ajax/?isAjax=true";</script>';
241
  $html .= $this->addProvideCss() . ' <div id="f7main">';
242
  $html .= '<div id="f7title">';
243
  $html .= 'Welcome to Provide Support Live Chat module settings page.<br/>Visit our website <a href="http://www.providesupport.com" target="_blank">www.providesupport.com</a> to find more information about our Live Chat system.';
440
  preg_match_all('/<option value="([^"]*)" >([^>]*)<\/option>/', $option, $option_value);
441
  $count = count($option_value[1]);
442
  if ($count > 0) {
443
+ $div_menu = '';
444
  for ($i = 1; $i < $count; $i++) {
445
  $div_menu .= '<option value="' . $option_value[1][$i] . '">' . $option_value[2][$i] . '</option>';
446
  }
app/code/community/ProvideSupport/{Livechat → Livechats}/Helper/Data.php RENAMED
@@ -1,12 +1,12 @@
1
  <?php
2
- class ProvideSupport_Livechat_Helper_Data extends Mage_Core_Helper_Abstract
3
  {
4
  public function initJs()
5
  {
6
  $this->page = Mage::getSingleton('cms/page');
7
  $this->list_page = Zend_Json::decode($this->settings, Zend_Json::TYPE_OBJECT);
8
  }
9
- public function initCode($view)
10
  {
11
  $this->settings = $view->settings;
12
  $this->code = $view->code;
1
  <?php
2
+ class ProvideSupport_livechats_Helper_Data extends Mage_Core_Helper_Abstract
3
  {
4
  public function initJs()
5
  {
6
  $this->page = Mage::getSingleton('cms/page');
7
  $this->list_page = Zend_Json::decode($this->settings, Zend_Json::TYPE_OBJECT);
8
  }
9
+ public function initCodePS($view)
10
  {
11
  $this->settings = $view->settings;
12
  $this->code = $view->code;
app/code/community/ProvideSupport/Livechats/Model/Action.php ADDED
@@ -0,0 +1,189 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Action.php
4
+ *
5
+ * Copyright 2014 Ortus IT <contact@ortus-it.com>
6
+ *
7
+ * This program is free software; you can redistribute it and/or modify
8
+ * it under the terms of the GNU General Public License as published by
9
+ * the Free Software Foundation; either version 2 of the License, or
10
+ * (at your option) any later version.
11
+ *
12
+ * This program is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ * GNU General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU General Public License
18
+ * along with this program; if not, write to the Free Software
19
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
20
+ * MA 02110-1301, USA.
21
+ *
22
+ *
23
+ */
24
+
25
+ namespace ortus\main\action;
26
+
27
+ class Action
28
+ {
29
+ public $stateSend = false;
30
+ public function __construct($data = '')
31
+ {
32
+ $this->data = !empty($data) && isset($data) ? $data : false;
33
+
34
+ if ($this->data) {
35
+ if ($this->sendCurl($this->data)) {
36
+ $this->stateSend = true;
37
+ } else {
38
+ $this->stateSend = false;
39
+ }
40
+ }
41
+ }
42
+
43
+ public function sendCurl($data = '')
44
+ {
45
+ //if you want to use curl
46
+ /*
47
+ if ($curl = curl_init()) {
48
+ //$data['method'] = 'curl';
49
+ $data = array(
50
+ // 'action' => 'setsettings',
51
+ 'logmagento' => $this->prepareString($data)
52
+ );
53
+ $headers = array(
54
+ 'Content-type: application/x-www-form-urlencoded'
55
+ );
56
+ curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
57
+ curl_setopt($curl, CURLOPT_URL, 'http://errorreport.providesupport.com/cgi-bin/providesupport/logmagento.cgi');
58
+ curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
59
+ curl_setopt($curl, CURLOPT_POST, true);
60
+ curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
61
+ $out = curl_exec($curl);
62
+ //echo $out; //output answer
63
+ if(!curl_errno($curl))
64
+ {
65
+ //answer info
66
+ //$http_code = curl_getinfo($curl, CURLINFO_HTTP_CODE);
67
+ //$url = curl_getinfo($curl,CURLINFO_EFFECTIVE_URL);
68
+ curl_close($curl);
69
+ return true;
70
+ }else{
71
+ curl_close($curl);
72
+ return false;
73
+ }
74
+ }else{
75
+ return false;
76
+ }
77
+ //curl debug info
78
+ /*
79
+ extract(curl_getinfo($curl));
80
+ $metrics = <<<EOD
81
+ URL....: $url <br>
82
+ Code...: $http_code ($redirect_count redirect(s) in $redirect_time secs)<br>
83
+ Content: $content_type Size: $download_content_length (Own: $size_download) Filetime: $filetime<br>
84
+ Time...: $total_time Start @ $starttransfer_time (DNS: $namelookup_time Connect: $connect_time Request: $pretransfer_time)<br>
85
+ Speed..: Down: $speed_download (avg.) Up: $speed_upload (avg.)<br>
86
+ Curl...: v{$curl['version']}
87
+ EOD;
88
+ print_r($metrics);
89
+ */
90
+
91
+
92
+ $data = array(
93
+ 'logmagento' => $this->prepareString($data)
94
+ );
95
+
96
+ $result = $this->post_request('http://errorreport.providesupport.com/cgi-bin/providesupport/logmagento.cgi', $data);
97
+
98
+ if ('ok' == $result['status']){
99
+
100
+ return true;
101
+
102
+ //debug info
103
+ // Print headers
104
+ //echo $result['header'];
105
+ //echo '<hr />';
106
+ // print the result of the whole request:
107
+ //echo $result['content'];
108
+ }else {
109
+ return false;
110
+
111
+ //debug info
112
+ //echo 'A error occured: ' . $result['error'];
113
+ }
114
+
115
+ }
116
+
117
+
118
+ public function post_request($url, $data, $referer='') {
119
+
120
+ // Convert the data array into URL Parameters like a=b&foo=bar etc.
121
+ $data = http_build_query($data);
122
+
123
+ // parse the given URL
124
+ $url = parse_url($url);
125
+
126
+ if ($url['scheme'] != 'http') {
127
+ return array(
128
+ 'status' => 'err',
129
+ 'error' => 'Error: Only HTTP request are supported !'
130
+ );
131
+ }
132
+
133
+ // extract host and path:
134
+ $host = $url['host'];
135
+ $path = $url['path'];
136
+
137
+ // open a socket connection on port 80 - timeout: 30 sec
138
+ $fp = fsockopen($host, 80, $errno, $errstr, 30);
139
+
140
+ if ($fp){
141
+
142
+ // send the request headers:
143
+ fputs($fp, "POST $path HTTP/1.1\r\n");
144
+ fputs($fp, "Host: $host\r\n");
145
+
146
+ if ($referer != '')
147
+ fputs($fp, "Referer: $referer\r\n");
148
+
149
+ fputs($fp, "Content-type: application/x-www-form-urlencoded\r\n");
150
+ fputs($fp, "Content-length: ". strlen($data) ."\r\n");
151
+ fputs($fp, "Connection: close\r\n\r\n");
152
+ fputs($fp, $data);
153
+
154
+ $result = '';
155
+ while(!feof($fp)) {
156
+ // receive the results of the request
157
+ $result .= fgets($fp, 128);
158
+ }
159
+ }
160
+ else {
161
+ return array(
162
+ 'status' => 'err',
163
+ 'error' => "$errstr ($errno)"
164
+ );
165
+ }
166
+
167
+ // close the socket connection:
168
+ fclose($fp);
169
+
170
+ // split the result header from the content
171
+ $result = explode("\r\n\r\n", $result, 2);
172
+
173
+ $header = isset($result[0]) ? $result[0] : '';
174
+ $content = isset($result[1]) ? $result[1] : '';
175
+
176
+ // return as structured array:
177
+ return array(
178
+ 'status' => 'ok',
179
+ 'header' => $header,
180
+ 'content' => $content
181
+ );
182
+ }
183
+
184
+ public function prepareString($str = '')
185
+ {
186
+ return base64_encode(json_encode($str));
187
+ }
188
+
189
+ }
app/code/community/ProvideSupport/Livechats/Model/ErrorHandler.php ADDED
@@ -0,0 +1,308 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * ErrorHandler.php
4
+ *
5
+ * Copyright 2014 Ortus IT <contact@ortus-it.com>
6
+ *
7
+ * This program is free software; you can redistribute it and/or modify
8
+ * it under the terms of the GNU General Public License as published by
9
+ * the Free Software Foundation; either version 2 of the License, or
10
+ * (at your option) any later version.
11
+ *
12
+ * This program is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ * GNU General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU General Public License
18
+ * along with this program; if not, write to the Free Software
19
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
20
+ * MA 02110-1301, USA.
21
+ *
22
+ * Обработка
23
+ */
24
+
25
+ namespace ortus\main\handler;
26
+
27
+ require_once 'Main.php';
28
+ require_once 'Action.php';
29
+
30
+ use ortus\main as Info;
31
+ use ortus\main\action as Sender;
32
+
33
+ class ErrorHandler
34
+ {
35
+
36
+ public function __construct($errorTypes = NULL, $total_info = array(), $level = 1)
37
+ {
38
+ $this->total_info = $total_info;
39
+ $this->level = $level;
40
+
41
+ if (is_null($errorTypes)) {
42
+ $errorTypes = E_ALL | E_STRICT;
43
+ }
44
+
45
+ // регистрация ошибок
46
+ set_error_handler(array(
47
+ $this,
48
+ 'OtherErrorCatcher'
49
+ ), $errorTypes);
50
+
51
+ // перехват критических ошибок
52
+ register_shutdown_function(array(
53
+ $this,
54
+ 'FatalErrorCatcher'
55
+ ));
56
+
57
+ // создание буфера вывода
58
+ ob_start();
59
+ }
60
+
61
+
62
+ public function OtherErrorCatcher($errno, $errstr, $errfile, $errline, $errcontext)
63
+ {
64
+ echo '<br>Ошибка-warning<br>';
65
+ echo date("y.m.d H:m:s") . "\t" . $errno . "\t" . $errstr . "\t" . $errfile . "\t" . $errline . "\t" . $errcontext;
66
+ return false;
67
+ }
68
+
69
+ public function FatalErrorCatcher()
70
+ {
71
+ $error = error_get_last();
72
+
73
+
74
+ if (isset($error)) {
75
+ if ($error['type'] & (E_ERROR | E_PARSE | E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_COMPILE_WARNING | E_USER_ERROR | E_RECOVERABLE_ERROR)) //E_ERROR | E_PARSE | E_COMPILE_ERROR
76
+ {
77
+ $stack = ob_get_contents();
78
+ ob_end_clean(); // сбросить буфер, завершить работу буфера
79
+
80
+ $this->error = array(
81
+ 'Fatal_Error_Info' => $error,
82
+ 'Line_Error_Info' => $this->getPartofLineError($error['file'], $error['line']),
83
+ 'Stack' => $stack
84
+ );
85
+ $this->getHtml();
86
+
87
+ } else {
88
+ ob_end_flush();
89
+ }
90
+ } else {
91
+ ob_end_flush(); // вывод буфера, завершить работу буфера
92
+ }
93
+
94
+ $this->endErrorCatcher();
95
+ }
96
+
97
+ public function endErrorCatcher()
98
+ {
99
+ ob_end_flush(); // вывод буфера, завершить работу буфера
100
+ restore_error_handler();
101
+ return true;
102
+ }
103
+
104
+ public function getPartofLineError($file = NULL, $startLine = 0)
105
+ {
106
+ if (!is_null($file)) {
107
+ $f = fopen($file, 'r');
108
+ $lineNo = 0;
109
+ $startLineBefore = $startLine - 3;
110
+ $endLine = $startLine + 2;
111
+ $content = '';
112
+ while ($line = fgets($f)) {
113
+ $lineNo++;
114
+ if ($lineNo >= $startLineBefore) {
115
+ if ($lineNo == $startLine - 1) {
116
+ $content .= $line . '/* in that line FATAL ERROR!!! */';
117
+ } else {
118
+ $content .= $line;
119
+ }
120
+ }
121
+ if ($lineNo == $endLine) {
122
+ break;
123
+ }
124
+ }
125
+ fclose($f);
126
+ return $content;
127
+ }
128
+ }
129
+
130
+ public function getHtml()
131
+ {
132
+ ?>
133
+ <!DOCTYPE HTML>
134
+ <html lang="en-US">
135
+ <head>
136
+ <meta charset="UTF-8">
137
+ <title></title>
138
+ <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>
139
+ <script src='https://javascriptbase64.googlecode.com/files/base64.js' type='text/javascript'></script>
140
+
141
+ <style type="text/css">
142
+ body {
143
+ min-width: 1200px;
144
+ }
145
+ body {
146
+ background-color: #E6EDF8;
147
+ font-family: Verdana,sans-serif;
148
+ line-height: 1;
149
+ margin: 0 auto;
150
+ min-width: 767px;
151
+ overflow-x: hidden;
152
+ }
153
+ body {
154
+ line-height: 1;
155
+ }
156
+
157
+ .site-header{
158
+ background-color:#fff;
159
+ border-top: 1px solid #CDDAE9;
160
+ height: 110px;
161
+ margin: 15px auto 0;
162
+ max-width: 970px;
163
+ min-width: 970px;
164
+ text-align:center;
165
+ }
166
+ article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section {
167
+ display: block;
168
+ }
169
+
170
+ .site-logo {
171
+ background: url("http://www.providesupport.com/s/gry9s1/root/images/logo.png") repeat scroll 0 0 rgba(0, 0, 0, 0);
172
+ display: block;
173
+ height: 38px;
174
+ margin: 1.93em auto;
175
+ width: 257px;
176
+ }
177
+
178
+ .article {
179
+ background: none repeat scroll 0 0 #FFFFFF;
180
+ box-shadow: 0 1px 0 0 #D4DFEC;
181
+ cursor: default;
182
+ margin: 0 auto;
183
+ padding: 15px 35px 40px 45px;
184
+ width: 890px;
185
+ }
186
+ .site-line {
187
+ background: #5bb5e9; /* Old browsers */
188
+ background: -moz-linear-gradient(top, #5bb5e9 0%, #60abf8 44%, #499ee1 100%); /* FF3.6+ */
189
+ background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#5bb5e9), color-stop(44%,#60abf8), color-stop(100%,#499ee1)); /* Chrome,Safari4+ */
190
+ background: -webkit-linear-gradient(top, #5bb5e9 0%,#60abf8 44%,#499ee1 100%); /* Chrome10+,Safari5.1+ */
191
+ background: -o-linear-gradient(top, #5bb5e9 0%,#60abf8 44%,#499ee1 100%); /* Opera 11.10+ */
192
+ background: -ms-linear-gradient(top, #5bb5e9 0%,#60abf8 44%,#499ee1 100%); /* IE10+ */
193
+ background: linear-gradient(to bottom, #5bb5e9 0%,#60abf8 44%,#499ee1 100%); /* W3C */
194
+ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#5bb5e9', endColorstr='#499ee1',GradientType=0 ); /* IE6-9 */
195
+ margin: 0 auto;
196
+ padding: 20px 0 20px 0;
197
+ width: 80%;
198
+ max-width: 970px;
199
+ min-width: 970px;
200
+ text-align:center;
201
+
202
+ }
203
+ .site-line h3{
204
+ color:#fff;
205
+ font-size:18px;
206
+ }
207
+
208
+ .header {
209
+ color: #FF310F;
210
+ font-weight: normal;
211
+ padding: 15px 0 10px;
212
+ }
213
+
214
+ .article p, .article i, .article em, .article strong, .article ul, .article ol {
215
+ font-size: 13px;
216
+ line-height: 18px;
217
+ padding: 10px 0;
218
+ }
219
+ .header h3{
220
+ border: 0 none;
221
+ font: inherit;
222
+ margin: 0;
223
+ padding: 0;
224
+ vertical-align: baseline;
225
+ text-align:center;
226
+ }
227
+
228
+ textarea{
229
+ width:100%;
230
+ }
231
+
232
+ .submit-button {
233
+ background-color:#4AA0E2;
234
+ border-radius: 2px;
235
+ border-width: 0;
236
+ color: #FFFFFF;
237
+ cursor: pointer;
238
+ font-size: 18px;
239
+ height: 21px;
240
+ min-width: 70px;
241
+ padding: 20px 15px;
242
+ margin: 20px auto;
243
+ text-align:center;
244
+ width: 200px;
245
+ }
246
+ </style>
247
+ <script type="text/javascript">
248
+ jQuery('document').ready(function(){
249
+ sending = function(){
250
+
251
+ var ajaxData = {
252
+ logmagento: Base64.encode(JSON.stringify(jQuery('#total_info').html()))
253
+ };
254
+ jQuery.ajax({
255
+ type: 'POST',
256
+ url: 'http://errorreport.providesupport.com/cgi-bin/providesupport/logmagento.cgi',
257
+ data: ajaxData
258
+ }).done(function(msg){
259
+ //console.log(msg);
260
+ });
261
+ }
262
+ });
263
+ </script>
264
+ </head>
265
+
266
+ <body>
267
+ <header role="banner" class="site-header">
268
+ <div id="provide-logo">
269
+ Critical error(s) found in CMS module(s). Debug information is available below:<br />
270
+
271
+ <a title="Provide Support Live Chat software tool for website owners" href="http://www.providesupport.com/" class="logo-link">
272
+ <div class="site-logo"></div>
273
+ </a>
274
+ <div class="cleared"></div>
275
+ </div>
276
+ </header>
277
+ <div class="site-line">
278
+ <h3>Critical error(s) found</h3>
279
+ </div>
280
+ <article class="article">
281
+ <section>
282
+ <header class="header">
283
+ <h3>You can copy (press CTRL+A to select the log and CTRL+C to copy it) this log to send it to your Magento admin or supporting service if needed.</h3>
284
+ </header>
285
+ <br />
286
+ <textarea name="" id="total_info" cols="" rows="30">
287
+ <?php
288
+ $InfoController = new Info\Struct(true, $this->total_info, $this->level, $this->error);
289
+ $all_data = $InfoController->viewInfo();
290
+ print_r($all_data);
291
+ ?>
292
+ </textarea>
293
+ </section>
294
+ </article>
295
+ <?php
296
+ $ActionInfoController = new Sender\Action($all_data);
297
+ if (!$ActionInfoController->stateSend) {
298
+ echo '<script type="text/javascript">jQuery("document").ready(function(){
299
+ sending();
300
+ });</script>';
301
+ }
302
+ ?>
303
+ </body>
304
+ </html>
305
+ <?php
306
+ }
307
+
308
+ }
app/code/community/ProvideSupport/Livechats/Model/Livechats.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class ProvideSupport_livechats_Model_livechats extends Mage_Core_Model_Abstract
3
+ {
4
+ protected function _construct()
5
+ {
6
+ $this->_init('livechats/livechats');
7
+ }
8
+ }
app/code/community/ProvideSupport/Livechats/Model/Main.php ADDED
@@ -0,0 +1,256 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Main.php
4
+ *
5
+ * Copyright 2014 Ortus IT <contact@ortus-it.com>
6
+ *
7
+ * This program is free software; you can redistribute it and/or modify
8
+ * it under the terms of the GNU General Public License as published by
9
+ * the Free Software Foundation; either version 2 of the License, or
10
+ * (at your option) any later version.
11
+ *
12
+ * This program is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ * GNU General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU General Public License
18
+ * along with this program; if not, write to the Free Software
19
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
20
+ * MA 02110-1301, USA.
21
+ *
22
+ *
23
+ */
24
+
25
+
26
+ namespace ortus\main;
27
+
28
+ class Struct
29
+ {
30
+ public $info_array = array();
31
+ public $debug = false;
32
+
33
+ /**
34
+ * Constructor of class Main.
35
+ *
36
+ * @return void
37
+ */
38
+ public function __construct($debug = false, $total_info = array(), $level = 1, $merge = array())
39
+ {
40
+ $this->debug = is_bool($debug) ? $debug : false;
41
+
42
+ $this->agent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : NULL;
43
+
44
+ $this->cms = $total_info['current_CMS'];
45
+ $this->module = $total_info['install_Modules'];
46
+ $this->js = $total_info['current_Js_file'];
47
+ $this->level = $level;
48
+
49
+ $this->getInfo();
50
+ $this->info_array = $this->info_array + $merge;
51
+
52
+
53
+ }
54
+
55
+
56
+ public function getInfo()
57
+ {
58
+ if ($this->debug) {
59
+
60
+ $arr = array(
61
+ '__construct',
62
+ 'viewInfo',
63
+ 'getInfo'
64
+
65
+
66
+ );
67
+
68
+ switch ($this->level) {
69
+
70
+ case 1:
71
+ array_push($arr, 'getUserClass', 'getUserFunctions', 'getUserVars', 'getUserIncludeRequireFile', 'getUserModules', 'getUserJsFile');
72
+ break;
73
+
74
+ case 2:
75
+ array_push($arr, 'getUserFunctions', 'getUserVars');
76
+ break;
77
+
78
+ case 3:
79
+ default:
80
+ break;
81
+
82
+ }
83
+
84
+
85
+ foreach (get_class_methods($this) as $key) {
86
+ if (!in_array($key, $arr)) {
87
+ $this->info_array[$key] = $this->{$key}();
88
+ }
89
+
90
+ }
91
+
92
+ return $this->info_array;
93
+
94
+ }
95
+
96
+ }
97
+
98
+ public function viewInfo()
99
+ {
100
+ if ($this->debug) {
101
+ return $this->info_array;
102
+ }
103
+ }
104
+
105
+
106
+
107
+ public function getPhpVersion()
108
+ {
109
+ return phpversion();
110
+ }
111
+
112
+ public function getUserFunctions()
113
+ {
114
+
115
+ $defined_functions = get_defined_functions();
116
+ return $defined_functions['user'];
117
+
118
+ }
119
+
120
+ public function getUserClass()
121
+ {
122
+
123
+ return get_declared_classes();
124
+
125
+ }
126
+
127
+ public function getUserVars()
128
+ {
129
+
130
+ $ignore = array(
131
+ 'GLOBALS',
132
+ '_FILES',
133
+ '_COOKIE',
134
+ '_POST',
135
+ '_GET',
136
+ '_SERVER',
137
+ '_ENV',
138
+ 'ignore'
139
+ );
140
+ $vars = array_diff_key(get_defined_vars() + array_flip($ignore), array_flip($ignore));
141
+ return $vars;
142
+
143
+ }
144
+
145
+ public function getUserIncludeRequireFile()
146
+ {
147
+
148
+ return get_included_files();
149
+
150
+ }
151
+
152
+ public function getUserCms()
153
+ {
154
+
155
+ return $this->cms;
156
+
157
+ }
158
+
159
+
160
+ public function getUserSiteUrl()
161
+ {
162
+ return sprintf("%s://%s%s", isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off' ? 'https' : 'http', $_SERVER['HTTP_HOST'], $_SERVER['REQUEST_URI']);
163
+ }
164
+
165
+ public function getIpServer()
166
+ {
167
+ return $_SERVER['SERVER_ADDR'];
168
+ }
169
+
170
+ public function getUserModules()
171
+ {
172
+
173
+ return $this->module;
174
+
175
+ }
176
+
177
+ public function getUserJsFile()
178
+ {
179
+
180
+ return $this->js;
181
+
182
+ }
183
+
184
+ public function getUserBrowser()
185
+ {
186
+
187
+ $browser = array(
188
+ "Navigator" => "/Navigator(.*)/i",
189
+ "Firefox" => "/Firefox(.*)/i",
190
+ "Internet Explorer" => "/MSIE(.*)/i",
191
+ "Google Chrome" => "/chrome(.*)/i",
192
+ "MAXTHON" => "/MAXTHON(.*)/i",
193
+ "Opera" => "/Opera(.*)/i"
194
+ );
195
+ foreach ($browser as $key => $value) {
196
+ if (preg_match($value, $this->agent)) {
197
+
198
+ $browser = strtolower($key);
199
+ preg_match_all($value, $this->agent, $match);
200
+ switch ($browser) {
201
+ case "firefox":
202
+ $version = str_replace("/", "", $match[1][0]);
203
+ break;
204
+
205
+ case "internet explorer":
206
+ $version = substr($match[1][0], 0, 4);
207
+ break;
208
+
209
+ case "opera":
210
+ $version = str_replace("/", "", substr($match[1][0], 0, 5));
211
+ break;
212
+
213
+ case "navigator":
214
+ $version = substr($match[1][0], 1, 7);
215
+ break;
216
+
217
+ case "maxthon":
218
+ $version = str_replace(")", "", $match[1][0]);
219
+ break;
220
+
221
+ case "google chrome":
222
+ $version = substr($match[1][0], 1, 10);
223
+ }
224
+
225
+ return array(
226
+ "Browser" => $key,
227
+ "Version" => $version
228
+ );
229
+ break;
230
+ }
231
+ }
232
+
233
+ }
234
+
235
+ public function getUserOS()
236
+ {
237
+ $OS = array(
238
+ "Windows" => "/Windows/i",
239
+ "Linux" => "/Linux/i",
240
+ "Unix" => "/Unix/i",
241
+ "Mac" => "/Mac/i"
242
+ );
243
+
244
+ foreach ($OS as $key => $value) {
245
+ if (preg_match($value, $this->agent)) {
246
+ return array(
247
+ "Operating System" => $key
248
+ );
249
+ break;
250
+ }
251
+ }
252
+ }
253
+
254
+
255
+
256
+ }
app/code/community/ProvideSupport/Livechats/Model/Mysql4/Livechats.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class ProvideSupport_livechats_Model_Mysql4_livechats extends Mage_Core_Model_Mysql4_Abstract
3
+ {
4
+ protected function _construct()
5
+ {
6
+ $this->_init('livechats/livechats', 'id');
7
+ }
8
+ }
app/code/community/ProvideSupport/Livechats/Model/Mysql4/Livechats/Collection.php ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ <?php
2
+ class ProvideSupport_livechats_Model_Mysql4_livechats_Collection extends Varien_Data_Collection_Db
3
+ {
4
+ }
app/code/community/ProvideSupport/Livechats/Model/Observer.php ADDED
@@ -0,0 +1,145 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ require_once 'ErrorHandler.php';
3
+ use ortus\main\handler as Handler;
4
+
5
+ class ProvideSupport_livechats_Model_Observer
6
+ {
7
+
8
+ public $countPastCode;
9
+
10
+ public function startCmsHadler()
11
+ {
12
+
13
+ $cms_info_array = array(
14
+ 'Magento' => array(
15
+ 'Mage' => 'getVersion'
16
+ ),
17
+ 'Wordpress' => array(
18
+ 'wp' => 'wp'
19
+ )
20
+ );
21
+
22
+
23
+ foreach ($cms_info_array as $cms_name => $cms_data) {
24
+ switch ($cms_name) {
25
+ case 'Magento':
26
+ $cms = array();
27
+ $module = array();
28
+
29
+ $modules = array_keys((array) Mage::getConfig()->getNode('modules')->children());
30
+
31
+ foreach ($modules as $mod) {
32
+ $module[$mod] = array(
33
+ 'Version' => (string) Mage::getConfig()->getNode()->modules->{$mod}->version,
34
+ 'Active' => Mage::getConfig()->getModuleConfig($mod)->is('active', 'true')
35
+ );
36
+ }
37
+
38
+ foreach ($cms_data as $class => $method) {
39
+ if (method_exists($class, $method)) {
40
+ $cms[$cms_name] = Mage::getVersion();
41
+ }
42
+ }
43
+
44
+ $update = Mage::app()->getLayout()->getUpdate();
45
+ $update->load(array(
46
+ 'default',
47
+ 'catalog_product_view'
48
+ ));
49
+ $xml = $update->asSimplexml();
50
+ $js = $xml->xpath('//action[@method="addJs"]');
51
+
52
+ foreach ($js as $key) {
53
+ $jsFile[] = (string) $key->script;
54
+ }
55
+
56
+ $total_info = array(
57
+ 'current_CMS' => $cms,
58
+ 'install_Modules' => $module,
59
+ 'current_Js_file' => $jsFile
60
+ );
61
+ break;
62
+
63
+ default:
64
+ break;
65
+
66
+ }
67
+ }
68
+
69
+ $level = 3;
70
+ $ErrorController = new Handler\ErrorHandler(false, $total_info, $level);
71
+
72
+ }
73
+
74
+ public function __construct()
75
+ {
76
+ //Get if Error
77
+ $this->startCmsHadler();
78
+
79
+ $this->provide = Mage::getModel('livechats/livechats')->load(1)->getData('content');
80
+ $this->view = Zend_Json::decode($this->provide, Zend_Json::TYPE_OBJECT);
81
+ $this->settings = Zend_Json::decode($this->view->settings, Zend_Json::TYPE_OBJECT);
82
+ $this->pos = !empty($this->settings->buttonLocation) && isset($this->settings->buttonLocation) ? $this->settings->buttonLocation : '';
83
+ $this->list = !empty($this->settings->buttonAvailableMenusList[0]) && isset($this->settings->buttonLocation) ? $this->settings->buttonAvailableMenusList[0] : '' ;
84
+ $this->helper = Mage::helper('livechats/data');
85
+ $this->helper->initCodePS($this->view);
86
+
87
+ //Fatal error testing
88
+ //require('null');
89
+
90
+ }
91
+ public function insertBlock($observer)
92
+ {
93
+ if (Mage::app()->getLayout()->getArea() == 'frontend') {
94
+ $_name = $observer->getBlock()->getNameInLayout();
95
+ $_type = $observer->getBlock()->getType();
96
+ if (isset($this->settings->pluginEnabled) && $this->settings->pluginEnabled) {
97
+ if ($this->pos == 'fixed') {
98
+ if ($_name == 'root') {
99
+ $this->handler();
100
+ }
101
+ } elseif ($this->pos == 'define') {
102
+ if ($_name == $this->list) {
103
+ $this->countPastCode = true; //1
104
+ $this->handler();
105
+ } else {
106
+ if ($_name == 'before_body_end' && !$this->countPastCode && $this->settings->buttonAvailableWhole) {
107
+ $this->helper->showModuleHiddenCode();
108
+ $this->countPastCode = true;
109
+ }
110
+ }
111
+ }
112
+ }
113
+ }
114
+ }
115
+ protected function handler()
116
+ {
117
+ $this->helper->initJs();
118
+ if ($this->settings->buttonAvailableAll == false && $this->settings->buttonAvailablePost == false && $this->settings->buttonAvailableWhole == false) {
119
+ //Nothing to display in fixed position
120
+ } elseif ($this->settings->buttonAvailableAll == false && $this->settings->buttonAvailablePost == false && $this->settings->buttonAvailableWhole) {
121
+ //Only display the hidden code
122
+ if ($this->pos === 'fixed') {
123
+ $this->helper->showModuleJsHiddenCode();
124
+ } else {
125
+ $this->helper->showModuleHiddenCode();
126
+ $this->countPastCode = true;
127
+ }
128
+ } else {
129
+ if ($this->settings->buttonAvailableAll) {
130
+ $this->helper->showInAllCode($this->pos);
131
+ } else {
132
+ $this->helper->showInAllHiddenCode($this->pos);
133
+ }
134
+ if ($this->settings->buttonAvailablePost) {
135
+ if ($this->settings->buttonAvailablePostWhich == 'all') {
136
+ $this->helper->showAllPageCode($this->pos);
137
+ } elseif ($this->settings->buttonAvailablePostWhich == 'selected') {
138
+ $this->helper->showSelectedPageCode($this->pos);
139
+ }
140
+ } else {
141
+ $this->helper->showAllPageHiddenCode($this->pos);
142
+ }
143
+ }
144
+ }
145
+ }
app/code/community/ProvideSupport/{Livechat → Livechats}/controllers/AdminController.php RENAMED
@@ -1,5 +1,5 @@
1
  <?php
2
- class ProvideSupport_Livechat_AdminController extends Mage_Adminhtml_Controller_Action
3
  {
4
  public function settingsAction()
5
  {
@@ -8,19 +8,19 @@ class ProvideSupport_Livechat_AdminController extends Mage_Adminhtml_Controller_
8
  $this->getLayout()->getBlock('head')->addJs('provide/jquery-noconflict.js');
9
  $this->getLayout()->getBlock('head')->addJs('provide/md5.js');
10
  $this->getLayout()->getBlock('head')->addJs('provide/provide.js');
11
- $this->_addContent($this->getLayout()->createBlock('livechat/settings'))->_setActiveMenu('livechat');
12
  $this->renderLayout();
13
  }
14
  public function helpAction()
15
  {
16
  $this->loadLayout();
17
- $this->_addContent($this->getLayout()->createBlock('livechat/help'))->_setActiveMenu('livechat');
18
  $this->renderLayout();
19
  }
20
  public function ajaxAction()
21
  {
22
  $dbction = $this->getRequest()->getParam('action');
23
- $db = Mage::getModel('livechat/livechat')->load(1);
24
  if (!empty($dbction)) {
25
  switch ($dbction) {
26
  case 'getaccount':
1
  <?php
2
+ class ProvideSupport_livechats_AdminController extends Mage_Adminhtml_Controller_Action
3
  {
4
  public function settingsAction()
5
  {
8
  $this->getLayout()->getBlock('head')->addJs('provide/jquery-noconflict.js');
9
  $this->getLayout()->getBlock('head')->addJs('provide/md5.js');
10
  $this->getLayout()->getBlock('head')->addJs('provide/provide.js');
11
+ $this->_addContent($this->getLayout()->createBlock('livechats/settings'))->_setActiveMenu('livechats');
12
  $this->renderLayout();
13
  }
14
  public function helpAction()
15
  {
16
  $this->loadLayout();
17
+ $this->_addContent($this->getLayout()->createBlock('livechats/help'))->_setActiveMenu('livechats');
18
  $this->renderLayout();
19
  }
20
  public function ajaxAction()
21
  {
22
  $dbction = $this->getRequest()->getParam('action');
23
+ $db = Mage::getModel('livechats/livechats')->load(1);
24
  if (!empty($dbction)) {
25
  switch ($dbction) {
26
  case 'getaccount':
app/code/community/ProvideSupport/{Livechat → Livechats}/etc/config.xml RENAMED
@@ -1,117 +1,117 @@
1
  <?xml version="1.0"?>
2
  <config>
3
  <modules>
4
- <ProvideSupport_Livechat>
5
- <version>1.0.0</version>
6
- </ProvideSupport_Livechat>
7
  </modules>
8
  <global>
9
  <events>
10
  <core_block_abstract_to_html_before>
11
  <observers>
12
- <ProvideSupport_Livechat_core_block_abstract_to_html_before>
13
  <type>singleton</type>
14
- <class>ProvideSupport_Livechat_Model_Observer</class>
15
  <method>insertBlock</method>
16
- </ProvideSupport_Livechat_core_block_abstract_to_html_before>
17
  </observers>
18
  </core_block_abstract_to_html_before>
19
  </events>
20
  <models>
21
- <livechat>
22
- <class>ProvideSupport_Livechat_Model</class>
23
- <resourceModel>livechat_mysql4</resourceModel>
24
- </livechat>
25
- <livechat_mysql4>
26
- <class>ProvideSupport_Livechat_Model_Mysql4</class>
27
  <entities>
28
- <livechat>
29
  <table>providelivechat</table>
30
- </livechat>
31
  </entities>
32
- </livechat_mysql4>
33
- </models>
34
  <blocks>
35
- <livechat>
36
- <class>ProvideSupport_Livechat_Block</class>
37
- </livechat>
38
  </blocks>
39
  <helpers>
40
- <livechat>
41
- <class>ProvideSupport_Livechat_Helper</class>
42
- </livechat>
43
  </helpers>
44
  <resources>
45
  <providelivechat_setup>
46
  <setup>
47
- <module>ProvideSupport_Livechat</module>
48
  </setup>
49
  <connection>
50
  <use>core_setup</use>
51
  </connection>
52
  </providelivechat_setup>
53
- <livechat_write>
54
  <connection>
55
  <use>core_write</use>
56
  </connection>
57
- </livechat_write>
58
- <livechat_read>
59
  <connection>
60
  <use>core_read</use>
61
  </connection>
62
- </livechat_read>
63
  </resources>
64
  </global>
65
  <admin>
66
  <routers>
67
- <ProvideSupport_Livechat>
68
  <use>admin</use>
69
  <args>
70
- <module>ProvideSupport_Livechat</module>
71
- <frontName>livechat</frontName>
72
  </args>
73
- </ProvideSupport_Livechat>
74
  </routers>
75
  </admin>
76
  <adminhtml>
77
  <menu>
78
- <livechat translate="title" module="livechat">
79
  <title>Provide Support Live Chat</title>
80
  <sort_order>1000</sort_order>
81
  <children>
82
- <settings translate="title" module="livechat">
83
  <title>Settings</title>
84
- <action>livechat/admin/settings</action>
85
  <sort_order>0</sort_order>
86
  </settings>
87
- <help translate="title" module="livechat">
88
  <title>Help</title>
89
- <action>livechat/admin/help</action>
90
  <sort_order>20</sort_order>
91
  </help>
92
  </children>
93
- </livechat>
94
  </menu>
95
  <acl>
96
  <resources>
97
  <admin>
98
  <children>
99
- <livechat translate="title" module="livechat">
100
  <title>Provide Support Live Chat</title>
101
- <sort_order>1000</sort_order>
102
  <children>
103
- <settings translate="title" module="livechat">
104
  <title>Settings</title>
105
- <action>livechat/admin/settings</action>
106
  <sort_order>0</sort_order>
107
  </settings>
108
- <help translate="title" module="livechat">
109
  <title>Help</title>
110
- <action>livechat/admin/help</action>
111
  <sort_order>30</sort_order>
112
  </help>
113
  </children>
114
- </livechat>
115
  </children>
116
  </admin>
117
  </resources>
1
  <?xml version="1.0"?>
2
  <config>
3
  <modules>
4
+ <ProvideSupport_livechats>
5
+ <version>2.0.0</version>
6
+ </ProvideSupport_livechats>
7
  </modules>
8
  <global>
9
  <events>
10
  <core_block_abstract_to_html_before>
11
  <observers>
12
+ <ProvideSupport_livechats_core_block_abstract_to_html_before>
13
  <type>singleton</type>
14
+ <class>ProvideSupport_livechats_Model_Observer</class>
15
  <method>insertBlock</method>
16
+ </ProvideSupport_livechats_core_block_abstract_to_html_before>
17
  </observers>
18
  </core_block_abstract_to_html_before>
19
  </events>
20
  <models>
21
+ <livechats>
22
+ <class>ProvideSupport_livechats_Model</class>
23
+ <resourceModel>livechats_mysql4</resourceModel>
24
+ </livechats>
25
+ <livechats_mysql4>
26
+ <class>ProvideSupport_livechats_Model_Mysql4</class>
27
  <entities>
28
+ <livechats>
29
  <table>providelivechat</table>
30
+ </livechats>
31
  </entities>
32
+ </livechats_mysql4>
33
+ </models>
34
  <blocks>
35
+ <livechats>
36
+ <class>ProvideSupport_livechats_Block</class>
37
+ </livechats>
38
  </blocks>
39
  <helpers>
40
+ <livechats>
41
+ <class>ProvideSupport_livechats_Helper</class>
42
+ </livechats>
43
  </helpers>
44
  <resources>
45
  <providelivechat_setup>
46
  <setup>
47
+ <module>ProvideSupport_livechats</module>
48
  </setup>
49
  <connection>
50
  <use>core_setup</use>
51
  </connection>
52
  </providelivechat_setup>
53
+ <livechats_write>
54
  <connection>
55
  <use>core_write</use>
56
  </connection>
57
+ </livechats_write>
58
+ <livechats_read>
59
  <connection>
60
  <use>core_read</use>
61
  </connection>
62
+ </livechats_read>
63
  </resources>
64
  </global>
65
  <admin>
66
  <routers>
67
+ <ProvideSupport_livechats>
68
  <use>admin</use>
69
  <args>
70
+ <module>ProvideSupport_livechats</module>
71
+ <frontName>livechats</frontName>
72
  </args>
73
+ </ProvideSupport_livechats>
74
  </routers>
75
  </admin>
76
  <adminhtml>
77
  <menu>
78
+ <livechats translate="title" module="livechats">
79
  <title>Provide Support Live Chat</title>
80
  <sort_order>1000</sort_order>
81
  <children>
82
+ <settings translate="title" module="livechats">
83
  <title>Settings</title>
84
+ <action>livechats/admin/settings</action>
85
  <sort_order>0</sort_order>
86
  </settings>
87
+ <help translate="title" module="livechats">
88
  <title>Help</title>
89
+ <action>livechats/admin/help</action>
90
  <sort_order>20</sort_order>
91
  </help>
92
  </children>
93
+ </livechats>
94
  </menu>
95
  <acl>
96
  <resources>
97
  <admin>
98
  <children>
99
+ <livechats translate="title" module="livechats">
100
  <title>Provide Support Live Chat</title>
101
+ <sort_order>2000</sort_order>
102
  <children>
103
+ <settings translate="title" module="livechats">
104
  <title>Settings</title>
105
+ <action>livechats/admin/settings</action>
106
  <sort_order>0</sort_order>
107
  </settings>
108
+ <help translate="title" module="livechats">
109
  <title>Help</title>
110
+ <action>livechats/admin/help</action>
111
  <sort_order>30</sort_order>
112
  </help>
113
  </children>
114
+ </livechats>
115
  </children>
116
  </admin>
117
  </resources>
app/code/community/ProvideSupport/Livechats/sql/providelivechat_setup/install-1.0.0.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+ $tableNews = $installer->getTable('livechats/livechats');
5
+
6
+ $installer->startSetup();
7
+ $installer->getConnection()->dropTable($tableNews);
8
+ $table = $installer->getConnection()
9
+ ->newTable($tableNews)
10
+ ->addColumn('id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
11
+ 'identity' => true,
12
+ 'nullable' => false,
13
+ 'primary' => true,
14
+ ))
15
+ ->addColumn('title', Varien_Db_Ddl_Table::TYPE_TEXT, '255', array(
16
+ 'nullable' => false,
17
+ ))
18
+ ->addColumn('content', Varien_Db_Ddl_Table::TYPE_TEXT, null, array(
19
+ 'nullable' => false,
20
+ ));
21
+ $installer->getConnection()->createTable($table);
22
+
23
+ $installer->run("
24
+ INSERT INTO {$installer->getTable('livechats/livechats')}
25
+ (`id`, `title`, `content`) VALUES
26
+ (1, 'Provide Support livechats', '{\"account\":{\"accountName\":\"\",\"accountHash\":\"\"},\"settings\":\"null\",\"code\":\"\",\"hiddencode\":\"\"}');
27
+ ");
28
+
29
+
30
+ $installer->endSetup();
app/code/community/ProvideSupport/Livechats/sql/providelivechat_setup/upgrade-1.0.0-2.0.0.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $installer = $this;
3
+ $tableProvide = $installer->getTable('livechats/livechats');
4
+
5
+ $installer->startSetup();
6
+ /*
7
+ $installer->getConnection()->dropTable($tableProvide);
8
+ $table = $installer->getConnection()
9
+ ->newTable($tableProvide)
10
+ ->addColumn('id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
11
+ 'identity' => true,
12
+ 'nullable' => false,
13
+ 'primary' => true,
14
+ ))
15
+ ->addColumn('title', Varien_Db_Ddl_Table::TYPE_TEXT, '255', array(
16
+ 'nullable' => false,
17
+ ))
18
+ ->addColumn('content', Varien_Db_Ddl_Table::TYPE_TEXT, null, array(
19
+ 'nullable' => false,
20
+ ));
21
+ $installer->getConnection()->createTable($table);
22
+ $installer->run("
23
+ INSERT INTO {$installer->getTable('livechats/livechats')}
24
+ (`id`, `title`, `content`) VALUES
25
+ (1, 'Provide Support livechats', '{\"account\":{\"accountName\":\"\",\"accountHash\":\"\"},\"settings\":\"null\",\"code\":\"\",\"hiddencode\":\"\"}');
26
+ ");
27
+ */
28
+ $installer->endSetup();
app/etc/modules/ProvideSupport_All.xml CHANGED
@@ -1,9 +1,9 @@
1
  <?xml version="1.0"?>
2
  <config>
3
  <modules>
4
- <ProvideSupport_Livechat>
5
  <active>true</active>
6
  <codePool>community</codePool>
7
- </ProvideSupport_Livechat>
8
  </modules>
9
  </config>
1
  <?xml version="1.0"?>
2
  <config>
3
  <modules>
4
+ <ProvideSupport_livechats>
5
  <active>true</active>
6
  <codePool>community</codePool>
7
+ </ProvideSupport_livechats>
8
  </modules>
9
  </config>
js/provide/provide.js CHANGED
@@ -1,7 +1,7 @@
1
  /*
2
  * Developed by Ortus IT.
3
  * Web: http://ortus-it.com
4
- * Code part:#02-01-rev.004, October 2013.
5
  * -All Rights of this product are belong to Provide Support, LLC.-
6
  *
7
  */
@@ -647,7 +647,7 @@ ajaxSend = function(ajaxData, func){
647
  //accSet.companyPassword = CryptoJS.MD5(f7acc.pass)+'';
648
  accSet.companyPassword = f7acc.pass;
649
  accSet.email = f7acc.mail;
650
- accSet.caller = 'magento-plugin-1.0';
651
  accSet.accountSettings = {
652
  "chatIconOnline": "57/chat-icon-57-online-en.gif",
653
  "chatIconOffline": "57/chat-icon-57-offline-en.gif"
@@ -735,8 +735,8 @@ ajaxSend = function(ajaxData, func){
735
  }
736
  };
737
 
738
- console.log('json.fixed = '+json.fixed);
739
- console.log('json.fixedPosition : '+json.fixedPosition);
740
 
741
 
742
 
@@ -883,7 +883,7 @@ ajaxSend = function(ajaxData, func){
883
  async: false,
884
  success: function (msg) {
885
 
886
- console.log(msg);
887
  setCode(msg.code, format);
888
  }
889
  });
@@ -901,7 +901,7 @@ ajaxSend = function(ajaxData, func){
901
  async: false,
902
  success: function (msg) {
903
 
904
- console.log(msg);
905
 
906
  if (!format) {
907
  jQuery('#f7livePreview').html('Your live chat link example: <br />' + msg.code);
1
  /*
2
  * Developed by Ortus IT.
3
  * Web: http://ortus-it.com
4
+ * Code part:#02-02-rev.004, October 2013.
5
  * -All Rights of this product are belong to Provide Support, LLC.-
6
  *
7
  */
647
  //accSet.companyPassword = CryptoJS.MD5(f7acc.pass)+'';
648
  accSet.companyPassword = f7acc.pass;
649
  accSet.email = f7acc.mail;
650
+ accSet.caller = 'magento-plugin-2.0';
651
  accSet.accountSettings = {
652
  "chatIconOnline": "57/chat-icon-57-online-en.gif",
653
  "chatIconOffline": "57/chat-icon-57-offline-en.gif"
735
  }
736
  };
737
 
738
+ //console.log('json.fixed = '+json.fixed);
739
+ //console.log('json.fixedPosition : '+json.fixedPosition);
740
 
741
 
742
 
883
  async: false,
884
  success: function (msg) {
885
 
886
+ //console.log(msg);
887
  setCode(msg.code, format);
888
  }
889
  });
901
  async: false,
902
  success: function (msg) {
903
 
904
+ //console.log(msg);
905
 
906
  if (!format) {
907
  jQuery('#f7livePreview').html('Your live chat link example: <br />' + msg.code);
package.xml CHANGED
@@ -1,23 +1,24 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>ProvideSupport_Live_Chat</name>
4
- <version>1.0.0</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.gnu.org/copyleft/gpl.html">GNU General Public License</license>
7
  <channel>community</channel>
8
  <extends/>
9
- <summary>Live Chat module for Magento by Provide Support, LLC&#xD;
10
- </summary>
11
  <description>The module helps to integrate Provide Support Live Chat&#xD;
12
  with Magento based websites. It offers flexible settings to customize&#xD;
13
  the appearance of the Live Chat on your website according to your&#xD;
14
- requirements.</description>
15
- <notes>First public release&#xD;
 
 
16
  </notes>
17
  <authors><author><name>Provide Support, LLC</name><user>providesupport</user><email>magento@providesupport.com</email></author></authors>
18
- <date>2013-11-13</date>
19
- <time>12:06:28</time>
20
- <contents><target name="magecommunity"><dir name="ProvideSupport"><dir name="Livechat"><dir name="Block"><file name="Help.php" hash="06a993b6ed92dc5a7c22445f65b72cd5"/><file name="Settings.php" hash="a900da0bd0bafc0b479d0aa0aaa4adaa"/></dir><dir name="Helper"><file name="Data.php" hash="306a5efc9bf9eae926c6ca693eca0367"/></dir><dir name="Model"><file name="Livechat.php" hash="668d641a7309fc7efc8d754f062c537b"/><dir name="Mysql4"><dir name="Livechat"><file name="Collection.php" hash="0a08b2c0c0c81f0afbbae08ea7b1095b"/></dir><file name="Livechat.php" hash="5cd46359fdf549c69dbf6cedd370a9a3"/></dir><file name="Observer.php" hash="b649cb16d354f61ccc4024f58dcc8a4f"/></dir><dir name="controllers"><file name="AdminController.php" hash="d60456baf0aee0c0c4d57181e3087f5f"/></dir><dir name="etc"><file name="config.xml" hash="b4af121d684f132f38a4817beb5ea603"/></dir><dir name="sql"><dir name="providelivechat_setup"><file name="mysql4-install-1.0.0.php" hash="b5bbd6a1e88814e3fca9112a1a55dab6"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="ProvideSupport_All.xml" hash="942a89517a99d55e014eba20bf6e27b9"/></dir></target><target name="mageweb"><dir name="js"><dir name="provide"><file name="jquery-noconflict.js" hash="e2060c4e5e5955c824723b13a212d3ec"/><file name="jquery.js" hash="41ca0b5d474117281973aeb249b944c8"/><file name="md5.js" hash="76b55cb1f28848b833083b2f19e6e088"/><file name="provide.js" hash="58d3c27112e65fff7265f61bf57eecb5"/></dir></dir></target></contents>
21
  <compatible/>
22
  <dependencies><required><php><min>5.1.0</min><max>5.7.0</max></php></required></dependencies>
23
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>ProvideSupport_Live_Chat</name>
4
+ <version>2.0.0</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.gnu.org/copyleft/gpl.html">GNU General Public License</license>
7
  <channel>community</channel>
8
  <extends/>
9
+ <summary>Live Chat module for Magento by Provide Support, LLC</summary>
 
10
  <description>The module helps to integrate Provide Support Live Chat&#xD;
11
  with Magento based websites. It offers flexible settings to customize&#xD;
12
  the appearance of the Live Chat on your website according to your&#xD;
13
+ requirements.&#xD;
14
+ </description>
15
+ <notes>Release Info:&#xD;
16
+ 2.0.0&#xD;
17
  </notes>
18
  <authors><author><name>Provide Support, LLC</name><user>providesupport</user><email>magento@providesupport.com</email></author></authors>
19
+ <date>2014-02-17</date>
20
+ <time>16:48:37</time>
21
+ <contents><target name="magecommunity"><dir name="ProvideSupport"><dir name="Livechats"><dir name="Block"><file name="Help.php" hash="04b1789e11aa93bce631b1dc50e9cbd4"/><file name="Settings.php" hash="be3f3be8b3112eb9a7261593ec0127a3"/></dir><dir name="Helper"><file name="Data.php" hash="e8385d29b4cf64f6ef996eea8f2914a3"/></dir><dir name="Model"><file name="Action.php" hash="38d0662f4dc15a64f0f29944c28e924f"/><file name="ErrorHandler.php" hash="dcb815396090b1bf6f1858cb77692126"/><file name="Livechats.php" hash="e11381487405e4de8deac8c9f89d37d7"/><file name="Main.php" hash="028e281ee14df3e420e70afb0f58596c"/><dir name="Mysql4"><dir name="Livechats"><file name="Collection.php" hash="494c1641bf7b816d3499243c4105f2bc"/></dir><file name="Livechats.php" hash="072f5667c104375a95964987e22b3596"/></dir><file name="Observer.php" hash="64941b0accb438e4c5aab021cbc478eb"/></dir><dir name="controllers"><file name="AdminController.php" hash="b7ea1a7c689e0a0263ed2d50c0057b52"/></dir><dir name="etc"><file name="config.xml" hash="70fadcb777218899e49b8a63ea9a87de"/></dir><dir name="sql"><dir name="providelivechat_setup"><file name="install-1.0.0.php" hash="d94091d758a7ec7c765203caa77607b7"/><file name="upgrade-1.0.0-2.0.0.php" hash="50607727970ec8fc8aeef2b960ce17f4"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="ProvideSupport_All.xml" hash="25a8d844fe6f5805e1280aa68d08154f"/></dir></target><target name="mageweb"><dir name="js"><dir name="provide"><file name="jquery-noconflict.js" hash="e2060c4e5e5955c824723b13a212d3ec"/><file name="jquery.js" hash="41ca0b5d474117281973aeb249b944c8"/><file name="md5.js" hash="76b55cb1f28848b833083b2f19e6e088"/><file name="provide.js" hash="19999745864cf1d224dde043a7187049"/></dir></dir></target></contents>
22
  <compatible/>
23
  <dependencies><required><php><min>5.1.0</min><max>5.7.0</max></php></required></dependencies>
24
  </package>