Commit 35082d28 authored by Luke081515's avatar Luke081515

Replace all remaining json_decode s

* Replaced all remaining json_decode's that were added in the meantime
parent a579cb73
Pipeline #1510 passed with stages
in 2 minutes and 37 seconds
......@@ -709,7 +709,7 @@ class Core extends Password {
$request = $request . "&summary=" . urlencode($summary);
}
$result = $this->httpRequest($request, $this->job);
$result = json_decode($result, true);
$result = $this->decode($result);
if (array_key_exists("error", $result)) {
$code = $this->checkResult($result["error"]["code"]);
if ($code === "fail") {
......@@ -764,8 +764,7 @@ class Core extends Password {
. "&assert=" . $this->assert
. "&maxlag=" . $this->maxlag;
$result = $this->httpRequest($request, $this->job);
$result = json_decode($result, true);
//
$result = $this->decode($result);
if (isset($result['purge'][0]['missing'])) {
return false;
}
......@@ -788,7 +787,7 @@ class Core extends Password {
$request = $request . "&rcid=" . urlencode($id);
}
$result = $this->httpRequest($request, $this->job);
$result = json_decode($result, true);
$result = $this->decode($result);
if (array_key_exists("error", $result)) {
if ($result["error"]["code"] === "patroldisabled" || $result["error"]["code"] === "nosuchrcid" || $result["error"]["code"] === "noautopatrol") {
return $result["error"]["code"];
......@@ -904,7 +903,7 @@ class Core extends Password {
*/
public function getUserGender ($username) {
$result = $this->httpRequest('action=query&format=json&list=users&usprop=gender&ususers=' . urlencode($username), $this->job, 'GET');
$result = json_decode($result, true);
$result = $this->decode($result);
if (isset($result['query']['users'][0]['missing'])) {
return false;
}
......@@ -1202,7 +1201,6 @@ class Core extends Password {
if (strpos ($result, "missing") !== false) {
return false;
}
$answer = json_decode($result, true);
return $answer["query"]["pageids"][0];
}
/** getLinks
......@@ -1455,7 +1453,7 @@ class Core extends Password {
} catch (Exception $e) {
throw $e;
}
$result = json_decode($result, true);
$result = $this->decode($result);
if (array_key_exists("error", $result)) {
return $result["error"]["code"];
} else {
......@@ -1503,7 +1501,7 @@ class Core extends Password {
} catch (Exception $e) {
throw $e;
}
$result = json_decode($result, true);
$result = $this->decode($result);
if (array_key_exists("error", $result)) {
return $result["error"]["globalblock"][0]["code"];
} else {
......@@ -1556,7 +1554,7 @@ class Core extends Password {
} catch (Exception $e) {
throw $e;
}
$result = json_decode($result, true);
$result = $this->decode($result);
if (array_key_exists("error", $result)) {
return $result["error"]["code"];
} else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment