This commit is contained in:
Shish
2020-09-19 00:18:51 +01:00
parent 6284f3bcb8
commit 1159ba2fa1
7 changed files with 29 additions and 35 deletions

View File

@@ -13,7 +13,7 @@ class Eokm extends Extension
$username = $config->get_string("eokm_username");
$password = $config->get_string("eokm_password");
if($username && $password) {
if ($username && $password) {
$ch = curl_init("https://api.eokmhashdb.nl/v1/check/md5");
// curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/xml', $additionalHeaders));
curl_setopt($ch, CURLOPT_HEADER, 0);
@@ -21,18 +21,16 @@ class Eokm extends Extension
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $event->image->hash);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$return = curl_exec($ch);
curl_close($ch);
if($return == "false") {
if ($return == "false") {
// all ok
}
elseif($return == "true") {
} elseif ($return == "true") {
log_warning("eokm", "User tried to upload banned image {$event->image->hash}");
throw new UploadException("Image banned");
}
else {
} else {
log_warning("eokm", "Unexpected return from EOKM: $return");
}
}