Added fnum() to format numbers in the announcement toot

This commit is contained in:
pezcurrel 2024-08-07 17:48:53 +02:00
parent ccd4a22688
commit 8aaf00b82f

View file

@ -28,6 +28,7 @@ require __DIR__.LIBDP.'/mb_ucfirst.php';
require __DIR__.LIBDP.'/mb_lcfirst.php';
require __DIR__.LIBDP.'/ghs.php';
require __DIR__.LIBDP.'/ght.php';
require __DIR__.LIBDP.'/fnum.php';
require __DIR__.LIBDP.'/supplangs.php';
require __DIR__.LIBDP.'/gettlds.php';
require __DIR__.LIBDP.'/mastodon_postlen.php';
@ -786,6 +787,7 @@ if (isset($idata['blocks']) && is_array($idata['blocks'])) {
}
if ($opts['sendtoot'] && $instanswered && $idata['IsMastodon'] && $idata['FirstSeen']==$now) {
$lc=['decimal_point'=>'.', 'thousands_sep'=>','];
gettlds();
eecho(0,'«'.$opts['hostname'].'»: this instance is new, trying to send an announcement toot about it...'.N);
$endpoint='https://'.$iniarr['bothost'].'/api/v1/statuses';
@ -799,9 +801,9 @@ if ($opts['sendtoot'] && $instanswered && $idata['IsMastodon'] && $idata['FirstS
else
$toot.='unspecified/undetectable';
$toot.=N.N.'Users: ';
(is_null($idata['UserCount'])) ? $toot.='unspecified' : $toot.=$idata['UserCount'];
(is_null($idata['UserCount'])) ? $toot.='unspecified' : $toot.=fnum($idata['UserCount'],$lc);
$toot.=N.N.'Max. characters per post: ';
(is_null($idata['MaxTootChars']) || $idata['MaxTootChars']==500) ? $toot.='500' : $toot.=$idata['MaxTootChars'];
(is_null($idata['MaxTootChars']) || $idata['MaxTootChars']==500) ? $toot.='500' : $toot.=fnum($idata['MaxTootChars'],$lc);
$toot.=N.N.'Registrations: ';
if (is_null($idata['RegOpen'])) {
$toot.='unspecified';