Remove duplicated code - extract lostAccountCooldown function

This commit is contained in:
slawkens
2025-09-14 20:03:03 +02:00
parent 233bf001ce
commit 413ad42afa
3 changed files with 21 additions and 16 deletions

View File

@@ -0,0 +1,14 @@
<?php
defined('MYAAC') or die('Direct access not allowed!');
function lostAccountCooldown(string $nick, int $time): string
{
$inSec = $time - time();
$minutesLeft = floor($inSec / 60);
$secondsLeft = $inSec - ($minutesLeft * 60);
$timeLeft = $minutesLeft.' minutes '.$secondsLeft.' seconds';
$timeRounded = ceil(setting('core.mail_lost_account_interval') / 60);
return "Account of selected character (<b>" . escapeHtml($nick) . "</b>) received e-mail in last $timeRounded minutes. You must wait $timeLeft before you can use Lost Account Interface again.";
}