2022-12-12 23:03:19 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
$_ = function() {
|
|
|
|
$id = trim($_GET['id']);
|
|
|
|
if (!valid_mastodon_account_id($id))
|
|
|
|
return apiresult(['error' => 'id parameter has incorrect format'], 400);
|
|
|
|
|
2022-12-13 12:15:19 +00:00
|
|
|
instance_config();
|
|
|
|
|
2022-12-12 23:03:19 +00:00
|
|
|
$output = instance_http_post('/api/v1/admin/accounts/'.$id.'/action',
|
|
|
|
['type' => 'silence' ]);
|
|
|
|
|
2022-12-13 12:15:19 +00:00
|
|
|
$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));
|
|
|
|
|
2022-12-12 23:03:19 +00:00
|
|
|
if (!isset($_SERVER['REQUEST_URI']))
|
|
|
|
sleep(2);
|
2022-12-13 12:15:19 +00:00
|
|
|
|
2022-12-12 23:03:19 +00:00
|
|
|
return apiresult($output);
|
|
|
|
};
|
|
|
|
$_();
|