@@ -726,10 +726,22 @@ public function onExtensionBeforeSave($name, $data){
726
726
$ new_config =json_decode ($ data ->params );
727
727
728
728
if (isset ($ new_config ->apikey ) && $ new_config ->apikey != $ config ['apikey ' ] && trim ($ new_config ->apikey ) != '' && $ new_config ->apikey != 'enter key ' ){
729
-
729
+ self :: ctSendAgentVersion ( $ new_config -> apikey );
730
730
}
731
731
}
732
+ /**
733
+ * This event is triggered after update extension
734
+ * Joomla 2.5+
735
+ * @access public
736
+ */
732
737
738
+ public function onExtensionAfterUpdate ($ name , $ data ){
739
+ $ config = $ this ->getCTConfig ();
740
+ //Sending agent version
741
+ if (isset ($ config ['apikey ' ]) && trim ($ config ['apikey ' ]) != '' && $ config ['apikey ' ] != 'enter key ' ){
742
+ self ::ctSendAgentVersion ($ config ['apikey ' ]);
743
+ }
744
+ }
733
745
734
746
/*
735
747
exception for MijoShop ajax calls
@@ -1736,6 +1748,34 @@ private function sendAdminEmail($subject, $message, $is_html = false) {
1736
1748
* $params - array of XML params
1737
1749
* return XML RPS server response
1738
1750
*/
1751
+ private function ctSendAgentVersion ($ apikey )
1752
+ {
1753
+ self ::getCleantalk ();
1754
+ $ ctFbParams ['feedback ' ] = '0: ' . self ::ENGINE ;
1755
+ defined ('_JEXEC ' ) or die ('Restricted access ' );
1756
+ if (!defined ('DS ' )){
1757
+ define ('DS ' , DIRECTORY_SEPARATOR );
1758
+ }
1759
+ require_once (dirname (__FILE__ ) . DS . 'cleantalk.class.php ' );
1760
+ $ ct_request = new CleantalkRequest ;
1761
+
1762
+ foreach ($ ctFbParams as $ k => $ v ) {
1763
+ $ ct_request ->$ k = $ v ;
1764
+ }
1765
+ $ ct_request ->auth_key = $ apikey ;
1766
+ $ ct_request ->agent = self ::ENGINE ;
1767
+ $ config = self ::dbGetServer ();
1768
+ $ result = NULL ;
1769
+
1770
+ self ::$ CT ->work_url = $ config ['ct_work_url ' ];
1771
+ self ::$ CT ->server_ttl = $ config ['ct_server_ttl ' ];
1772
+ self ::$ CT ->server_changed = $ config ['ct_server_changed ' ];
1773
+ $ result = self ::$ CT ->sendFeedback ($ ct_request );
1774
+ if (self ::$ CT ->server_change ) {
1775
+ self ::dbSetServer (self ::$ CT ->work_url , self ::$ CT ->server_ttl , time ());
1776
+ }
1777
+ return $ result ;
1778
+ }
1739
1779
private function ctSendRequest ($ method , $ params ) {
1740
1780
self ::getCleantalk ();
1741
1781
0 commit comments