karma fix

This commit is contained in:
kremsy 2014-02-24 09:11:48 +01:00 committed by Steffen Schröder
parent 1a366dcb50
commit 80ccc1a838

View File

@ -145,7 +145,7 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin {
* @see \ManiaControl\Plugins\Plugin::getAuthor() * @see \ManiaControl\Plugins\Plugin::getAuthor()
*/ */
public static function getAuthor() { public static function getAuthor() {
return 'steeffeen'; return 'steeffeen and kremsy';
} }
/** /**
@ -603,7 +603,7 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin {
return; return;
} }
if (count($this->mxKarma['votes']) == 0) { if (!isset($this->mxKarma['votes']) || count($this->mxKarma['votes']) == 0) {
return; return;
} }
@ -631,18 +631,17 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin {
$content = json_encode($properties); $content = json_encode($properties);
$this->maniaControl->fileReader->postData(self::MX_KARMA_URL . self::MX_KARMA_SAVEVOTES . "?sessionKey=" . urlencode($this->mxKarma['session']->sessionKey), function ($data, $error) { $this->maniaControl->fileReader->postData(self::MX_KARMA_URL . self::MX_KARMA_SAVEVOTES . "?sessionKey=" . urlencode($this->mxKarma['session']->sessionKey), function ($data, $error) {
if (!$error) { if (!$error) {
$data = json_decode($data); $data = json_decode($data);
var_dump($data); if ($data->success) {
if ($data->success) { $this->maniaControl->log("Votes successfully permitted");
$this->maniaControl->log("Votes successfully permitted"); } else {
$this->maniaControl->log("Error while updating votes");
}
} else { } else {
$this->maniaControl->log("Error while updating votes"); $this->maniaControl->log($error);
} }
} else { }, $content, false, 'application/json');
$this->maniaControl->log($error);
}
}, $content, false, 'application/json');
} }
/** /**