soselo/api/v1/http/mastodon/accounts/silence/mod.php

27 lines
694 B
PHP
Raw Permalink Normal View History

<?php
$_ = function() {
$id = trim($_GET['id']);
if (!valid_mastodon_account_id($id))
return apiresult(['error' => 'id parameter has incorrect format'], 400);
instance_config();
$output = instance_http_post('/api/v1/admin/accounts/'.$id.'/action',
['type' => 'silence' ]);
$silenced = [];
$sile_file = 'silenced_accounts,'.$GLOBALS['ap_software'].','.$GLOBALS['ap_instance'];
if (filedb_exists('cache', $sile_file))
$silenced = unserialize(filedb_get('cache', $sile_file));
$silenced []= $id;
$silenced = array_unique($silenced);
filedb_put('cache', $sile_file, serialize($silenced));
if (!isset($_SERVER['REQUEST_URI']))
sleep(2);
return apiresult($output);
};
$_();