e
This commit is contained in:
parent
db756293aa
commit
cc3fe2f2cf
1 changed files with 12 additions and 16 deletions
|
@ -17,7 +17,7 @@ $contentO = $arr["text"];
|
||||||
$contentR = $arr["responsetext"];
|
$contentR = $arr["responsetext"];
|
||||||
$url = "{$pageProto}://" . $_SERVER["HTTP_HOST"] . $pagePath . "/fetch.php?id={$id}";
|
$url = "{$pageProto}://" . $_SERVER["HTTP_HOST"] . $pagePath . "/fetch.php?id={$id}";
|
||||||
|
|
||||||
if ($arr["isrespondedto"] == "f") {
|
if (strlen($arr["fedipostid"]) == 0) {
|
||||||
curl_setopt($ch, CURLOPT_URL, $fediAPIRoute);
|
curl_setopt($ch, CURLOPT_URL, $fediAPIRoute);
|
||||||
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
|
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
|
||||||
|
|
||||||
|
@ -31,29 +31,25 @@ if ($arr["isrespondedto"] == "f") {
|
||||||
}
|
}
|
||||||
|
|
||||||
$resp = curl_exec($ch);
|
$resp = curl_exec($ch);
|
||||||
fwrite(STDERR, curl_error());
|
|
||||||
fwrite(STDERR, curl_getinfo());
|
|
||||||
$jsonResp = json_decode($resp, true);
|
$jsonResp = json_decode($resp, true);
|
||||||
|
|
||||||
$fediID = $jsonResp["id"];
|
$fediID = $jsonResp["id"];
|
||||||
|
|
||||||
pg_update($db, "data", array("fedipostid" => $fediID), array("id" => $id));
|
pg_update($db, "data", array("fedipostid" => $fediID), array("id" => $id));
|
||||||
} else {
|
} else {
|
||||||
if (strlen($arr["fedipostid"]) > 0) {
|
curl_setopt($ch, CURLOPT_URL, ($fediAPIRoute . "/" . $arr["fedipostid"]));
|
||||||
curl_setopt($ch, CURLOPT_URL, ($fediAPIRoute . "/" . $arr["fedipostid"]));
|
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
|
||||||
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
|
|
||||||
|
|
||||||
if ($arr["iscwed"] == "t") {
|
if ($arr["iscwed"] == "t") {
|
||||||
$contentCW = $arr["cw"];
|
$contentCW = $arr["cw"];
|
||||||
curl_setopt($ch, CURLOPT_POSTFIELDS,
|
curl_setopt($ch, CURLOPT_POSTFIELDS,
|
||||||
http_build_query(array('status' => "question: {$contentO}\n\nresponse: {$contentR}\n\nlink: {$url}", 'visibility' => "{$fediVisibility}", 'spoiler_text' => "anonymous question response (automated); cw: {$contentCW}")));
|
http_build_query(array('status' => "question: {$contentO}\n\nresponse: {$contentR}\n\nlink: {$url}", 'visibility' => "{$fediVisibility}", 'spoiler_text' => "anonymous question response (automated); cw: {$contentCW}")));
|
||||||
} else {
|
} else {
|
||||||
curl_setopt($ch, CURLOPT_POSTFIELDS,
|
curl_setopt($ch, CURLOPT_POSTFIELDS,
|
||||||
http_build_query(array('status' => "question: {$contentO}\n\nresponse: {$contentR}\n\nlink: {$url}", 'visibility' => "{$fediVisibility}", 'spoiler_text' => "anonymous question response (automated)")));
|
http_build_query(array('status' => "question: {$contentO}\n\nresponse: {$contentR}\n\nlink: {$url}", 'visibility' => "{$fediVisibility}", 'spoiler_text' => "anonymous question response (automated)")));
|
||||||
}
|
|
||||||
|
|
||||||
curl_exec($ch);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
curl_exec($ch);
|
||||||
}
|
}
|
||||||
|
|
||||||
curl_close($ch);
|
curl_close($ch);
|
||||||
|
|
Loading…
Add table
Reference in a new issue