From f77b5cb20a35b2b4d44c81c7e3f63a5ac707c93d Mon Sep 17 00:00:00 2001 From: kremsy Date: Thu, 20 Feb 2014 17:59:09 +0100 Subject: [PATCH] give up dedi work --- .../core/Files/AsynchronousFileReader.php | 7 ++++--- application/plugins/Dedimania/Dedimania.php | 18 +++++++++--------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/application/core/Files/AsynchronousFileReader.php b/application/core/Files/AsynchronousFileReader.php index 2ddc1c9e..46d5301d 100644 --- a/application/core/Files/AsynchronousFileReader.php +++ b/application/core/Files/AsynchronousFileReader.php @@ -74,7 +74,7 @@ class AsynchronousFileReader { ->set(CURLOPT_ENCODING, "")//accept encoding ->set(CURLOPT_AUTOREFERER, true)//accept link reference ->set(CURLOPT_HTTPHEADER, array("Content-Type: " . $contentType)) // - ->set(CURLOPT_USERAGENT, 'User-Agent: ManiaControl v' . ManiaControl::VERSION) // + ->set(CURLOPT_USERAGENT, 'ManiaControl v' . ManiaControl::VERSION) // ->set(CURLOPT_RETURNTRANSFER, true); $request->addListener('complete', function (\cURL\Event $event) use (&$function) { @@ -129,6 +129,7 @@ class AsynchronousFileReader { if ($compression) { $content = gzencode($content); } + $request = new Request($url); $request->getOptions()->set(CURLOPT_HEADER, false) //don't display response header ->set(CURLOPT_CRLF, true) //linux linefeed @@ -137,8 +138,8 @@ class AsynchronousFileReader { ->set(CURLOPT_POST, true) //post field ->set(CURLOPT_POSTFIELDS, $content) //post content field ->set(CURLOPT_HTTPHEADER, array("Content-Type: " . $contentType, "Keep-Alive: 300", "Connection: Keep-Alive", "Content-Encoding: gzip")) // - //->set(CURLOPT_HTTPHEADER, array("Content-Type: " . $contentType, "Keep-Alive")) // - ->set(CURLOPT_USERAGENT, 'User-Agent: ManiaControl v' . ManiaControl::VERSION) // + //->set(CURLOPT_HTTPHEADER, array("Content-Type: " . $contentType, "Keep-Alive: 300", "Connection: Keep-Alive")) // + ->set(CURLOPT_USERAGENT, 'ManiaControl v' . ManiaControl::VERSION) // ->set(CURLOPT_RETURNTRANSFER, true); $request->addListener('complete', function (\cURL\Event $event) use (&$function) { diff --git a/application/plugins/Dedimania/Dedimania.php b/application/plugins/Dedimania/Dedimania.php index 4f43b67d..ed8ea0ac 100644 --- a/application/plugins/Dedimania/Dedimania.php +++ b/application/plugins/Dedimania/Dedimania.php @@ -303,15 +303,15 @@ class Dedimania implements CallbackListener, TimerListener, Plugin { if (!isset($replays['Top1GReplay'])) { $replays['Top1GReplay'] = ''; } - //$replays['VReplay'] = ''; - $replays['Top1GReplay'] = ''; - $replays['VReplay'] = base64_encode($replays['VReplay']); - //$replays['Top1GReplay'] = base64_encode($replays['Top1GReplay']); - //xmlrpc_set_type($replays['VReplay'], 'base64'); - //xmlrpc_set_type($replays['Top1GReplay'], 'base64'); - var_dump($replays); - $data = array($this->dedimaniaData->sessionId, $this->getMapInfo(), $gameMode, $times, $replays); + $replays['VReplay'] = base64_encode($replays['VReplay']); + $replays['Top1GReplay'] = base64_encode($replays['Top1GReplay']); + + xmlrpc_set_type($replays['VReplay'], 'string'); + xmlrpc_set_type($replays['Top1GReplay'], 'string'); + + //var_dump($replays); + $data = array($this->dedimaniaData->sessionId, $this->getMapInfo(), $gameMode, $times, $replays); //var_dump($data); $content = $this->encode_request(self::DEDIMANIA_SETCHALLENGETIMES, $data); @@ -321,7 +321,7 @@ class Dedimania implements CallbackListener, TimerListener, Plugin { } var_dump($data); $data = $this->decode($data); - var_dump($data); + //var_dump($data); if (is_array($data)) { foreach($data as $index => $methodResponse) { if (xmlrpc_is_fault($methodResponse)) {