diff --git a/CleanTalk/Base/CleanTalk.php b/CleanTalk/Base/CleanTalk.php index 26f71b2..6719f24 100644 --- a/CleanTalk/Base/CleanTalk.php +++ b/CleanTalk/Base/CleanTalk.php @@ -1,11 +1,44 @@ get('cleantalk', 'enabled') && sizeof($_POST)>0 && isset($_POST['options']) && isset($_POST['options']['cleantalk'])) + { + require_once 'CleanTalk/Base/cleantalk.class.php'; + $ct_ws = array( + 'work_url' => 'http://moderate.cleantalk.org', + 'server_url' => 'http://moderate.cleantalk.org', + 'server_ttl' => 0, + 'server_changed' => 0 + ); + $ct = new Cleantalk(); + $ct->work_url = $ct_ws['work_url']; + $ct->server_url = $ct_ws['server_url']; + $ct->server_ttl = $ct_ws['server_ttl']; + $ct->server_changed = $ct_ws['server_changed']; + + $options = XenForo_Application::getOptions(); + + $ct_request = new CleantalkRequest(); + $ct_request->auth_key = $_POST['options']['cleantalk']['apikey']; + $ct_request->agent = 'xenforo-144'; + $ct_request->response_lang = 'en'; + $ct_request->js_on = 1; + $ct_request->sender_email = "good@cleantalk.org"; + $ct_request->sender_nickname = "CleanTalk"; + $ct_request->sender_ip = $ct->ct_session_ip($_SERVER['REMOTE_ADDR']); + $ct_request->submit_time = 0; + $ct_request->message = "This message is a test to check the connection to the CleanTalk servers."; + + $ct_result = $ct->isAllowMessage($ct_request); + } + } + /** Return Array of JS-keys for checking * * @return Array diff --git a/CleanTalk/Listener/LoadClassController.php b/CleanTalk/Listener/LoadClassController.php index b0a9007..c65718e 100644 --- a/CleanTalk/Listener/LoadClassController.php +++ b/CleanTalk/Listener/LoadClassController.php @@ -1,5 +1,4 @@ + diff --git a/addon-CleanTalk.xml b/addon-CleanTalk.xml index 7afb423..0c13f90 100644 --- a/addon-CleanTalk.xml +++ b/addon-CleanTalk.xml @@ -32,6 +32,7 @@ +