diff --git a/admin/fedi.php b/admin/fedi.php new file mode 100644 index 0000000..657222c --- /dev/null +++ b/admin/fedi.php @@ -0,0 +1,34 @@ + "question: {$contentO}\nresponse: {$contentR}", 'visibility' => "{$fediVisibility}", 'spoiler_text' => "anonymous requestion response (automated); cw: {$contentCW}"))); +} else { + curl_setopt($ch, CURLOPT_POSTFIELDS, + http_build_query(array('status' => "question: {$contentO}\nresponse: {$contentR}", 'visibility' => "{$fediVisibility}", 'spoiler_text' => "anonymous requestion response (automated)"))); +} + +curl_exec($ch); + +curl_close($ch); + +?> \ No newline at end of file diff --git a/admin/respond.php b/admin/respond.php index 5b01d71..888cc7e 100644 --- a/admin/respond.php +++ b/admin/respond.php @@ -15,8 +15,12 @@ if ($_GET["text"] !== null) { WHERE id = {$id}; "; - pg_query($db, $query); + + if ($fediEnabled) { + include 'fedi.php'; + } + header("Location: index.php?responded=1&pw={$adminPassword}"); } diff --git a/config.example.php b/config.example.php index e35bb61..8fd0d4c 100644 --- a/config.example.php +++ b/config.example.php @@ -15,6 +15,12 @@ $pageDomainOther = $pageDomain; // you can comment out and change this to a subd //$pageDomainOther = "me.example.com"; $pageRoot = "/"; // path to go to +// post to fedi? +$fediEnabled = False; +$fediAPIRoute = "https://example.com/api/v1/statuses"; +$fediAPIToken = "Bearer AUTHTOKENGOESHERE"; +$fediVisibility = "private"; + // database setup $dbHost = "localhost"; $dbName = "postgres";