diff --git a/endpoints/account/account.php b/endpoints/account/account.php
index 2512d508..f095ea81 100644
--- a/endpoints/account/account.php
+++ b/endpoints/account/account.php
@@ -112,7 +112,7 @@ class AccountBaseResponse extends TemplateResponse
// Username
$this->curName = User::$username;
- $this->renameCD = Util::formatTime(Cfg::get('ACC_RENAME_DECAY') * 1000);
+ $this->renameCD = DateTime::formatTimeElapsedFloat(Cfg::get('ACC_RENAME_DECAY') * 1000);
if ($user['renameCooldown'] > time())
{
$locCode = implode('_', str_split(Lang::getLocale()->json(), 2)); // ._.
diff --git a/endpoints/account/forgot-password.php b/endpoints/account/forgot-password.php
index 4121f47f..1f340cad 100644
--- a/endpoints/account/forgot-password.php
+++ b/endpoints/account/forgot-password.php
@@ -76,7 +76,7 @@ class AccountforgotpasswordResponse extends TemplateResponse
// on cooldown pretend we dont know the email address
if ($timeout && $timeout > time())
- return Cfg::get('DEBUG') ? 'resend on cooldown: '.Util::formatTimeDiff($timeout).' remaining' : Lang::account('inputbox', 'error', 'emailNotFound');
+ return Cfg::get('DEBUG') ? 'resend on cooldown: '.DateTime::formatTimeElapsed($timeout * 1000).' remaining' : Lang::account('inputbox', 'error', 'emailNotFound');
// pretend recovery started
if (!DB::Aowow()->selectCell('SELECT 1 FROM ?_account WHERE `email` = ?', $this->_post['email']))
diff --git a/endpoints/account/forgot-username.php b/endpoints/account/forgot-username.php
index 4a6245d4..0b8345fd 100644
--- a/endpoints/account/forgot-username.php
+++ b/endpoints/account/forgot-username.php
@@ -75,7 +75,7 @@ class AccountforgotusernameResponse extends TemplateResponse
// on cooldown pretend we dont know the email address
if ($timeout && $timeout > time())
- return Cfg::get('DEBUG') ? 'resend on cooldown: '.Util::formatTimeDiff($timeout).' remaining' : Lang::account('inputbox', 'error', 'emailNotFound');
+ return Cfg::get('DEBUG') ? 'resend on cooldown: '.DateTime::formatTimeElapsed($timeout * 1000).' remaining' : Lang::account('inputbox', 'error', 'emailNotFound');
// pretend recovery started
if (!DB::Aowow()->selectCell('SELECT 1 FROM ?_account WHERE `email` = ?', $this->_post['email']))
diff --git a/endpoints/account/resend.php b/endpoints/account/resend.php
index 234aea17..7c02075e 100644
--- a/endpoints/account/resend.php
+++ b/endpoints/account/resend.php
@@ -73,7 +73,7 @@ class AccountResendResponse extends TemplateResponse
// on cooldown pretend we dont know the email address
if ($timeout && $timeout > time())
- return Cfg::get('DEBUG') ? 'resend on cooldown: '.Util::formatTimeDiff($timeout).' remaining' : Lang::account('inputbox', 'error', 'emailNotFound');
+ return Cfg::get('DEBUG') ? 'resend on cooldown: '.DateTime::formatTimeElapsed($timeout * 1000).' remaining' : Lang::account('inputbox', 'error', 'emailNotFound');
// check email and account status
if ($token = DB::Aowow()->selectCell('SELECT `token` FROM ?_account WHERE `email` = ? AND `status` = ?d', $this->_post['email'], ACC_STATUS_NEW))
diff --git a/endpoints/account/signin.php b/endpoints/account/signin.php
index c4a0329e..ffcd15b7 100644
--- a/endpoints/account/signin.php
+++ b/endpoints/account/signin.php
@@ -99,7 +99,7 @@ class AccountSigninResponse extends TemplateResponse
// AUTH_BANNED => Lang::account('accBanned'); // ToDo: should this return an error? the actual account functionality should be blocked elsewhere
AUTH_WRONGUSER => Lang::account('userNotFound'),
AUTH_WRONGPASS => Lang::account('wrongPass'),
- AUTH_IPBANNED => Lang::account('inputbox', 'error', 'loginExceeded', [Util::formatTime(Cfg::get('ACC_FAILED_AUTH_BLOCK') * 1000)]),
+ AUTH_IPBANNED => Lang::account('inputbox', 'error', 'loginExceeded', [DateTime::formatTimeElapsedFloat(Cfg::get('ACC_FAILED_AUTH_BLOCK') * 1000)]),
AUTH_INTERNAL_ERR => Lang::main('intError'),
default => Lang::main('intError')
};
diff --git a/endpoints/account/signup.php b/endpoints/account/signup.php
index f8a819e1..734832b1 100644
--- a/endpoints/account/signup.php
+++ b/endpoints/account/signup.php
@@ -112,7 +112,7 @@ class AccountSignupResponse extends TemplateResponse
if (DB::Aowow()->selectRow('SELECT 1 FROM ?_account_bannedips WHERE `type` = ?d AND `ip` = ? AND `count` >= ?d AND `unbanDate` >= UNIX_TIMESTAMP()', IP_BAN_TYPE_REGISTRATION_ATTEMPT, User::$ip, Cfg::get('ACC_FAILED_AUTH_COUNT')))
{
DB::Aowow()->query('UPDATE ?_account_bannedips SET `count` = `count` + 1, `unbanDate` = UNIX_TIMESTAMP() + ?d WHERE `ip` = ? AND `type` = ?d', Cfg::get('ACC_FAILED_AUTH_BLOCK'), User::$ip, IP_BAN_TYPE_REGISTRATION_ATTEMPT);
- return Lang::account('inputbox', 'error', 'signupExceeded', [Util::formatTime(Cfg::get('ACC_FAILED_AUTH_BLOCK') * 1000)]);
+ return Lang::account('inputbox', 'error', 'signupExceeded', [DateTime::formatTimeElapsedFloat(Cfg::get('ACC_FAILED_AUTH_BLOCK') * 1000)]);
}
// username / email taken
diff --git a/endpoints/account/update-email.php b/endpoints/account/update-email.php
index 104e18a5..6806ad3b 100644
--- a/endpoints/account/update-email.php
+++ b/endpoints/account/update-email.php
@@ -53,7 +53,7 @@ class AccountUpdateemailResponse extends TextResponse
$status = DB::Aowow()->selectCell('SELECT `status` FROM ?_account WHERE `statusTimer` > UNIX_TIMESTAMP() AND `id` = ?d', User::$id);
if ($status != ACC_STATUS_NONE && $status != ACC_STATUS_CHANGE_EMAIL)
- return Lang::account('isRecovering', [Util::formatTime(Cfg::get('ACC_RECOVERY_DECAY') * 1000)]);
+ return Lang::account('inputbox', 'error', 'isRecovering', [DateTime::formatTimeElapsedFloat(Cfg::get('ACC_RECOVERY_DECAY') * 1000)]);
$oldEmail = DB::Aowow()->selectCell('SELECT `email` FROM ?_account WHERE `id` = ?d', User::$id);
if ($this->_post['newemail'] == $oldEmail)
diff --git a/endpoints/account/update-password.php b/endpoints/account/update-password.php
index cc4151d6..35543fe6 100644
--- a/endpoints/account/update-password.php
+++ b/endpoints/account/update-password.php
@@ -55,7 +55,7 @@ class AccountUpdatepasswordResponse extends TextResponse
$userData = DB::Aowow()->selectRow('SELECT `status`, `passHash`, `statusTimer` FROM ?_account WHERE `id` = ?d', User::$id);
if ($userData['status'] != ACC_STATUS_NONE && $userData['status'] != ACC_STATUS_CHANGE_PASS && $userData['statusTimer'] > time())
- return Lang::account('isRecovering', [Util::formatTime(Cfg::get('ACC_RECOVERY_DECAY') * 1000)]);
+ return Lang::account('inputbox', 'error', 'isRecovering', [DateTime::formatTimeElapsedFloat(Cfg::get('ACC_RECOVERY_DECAY') * 1000)]);
if (!User::verifyCrypt($this->_post['currentPassword'], $userData['passHash']))
return Lang::account('wrongPass');
diff --git a/endpoints/event/event.php b/endpoints/event/event.php
index ac3b5f31..2218d781 100644
--- a/endpoints/event/event.php
+++ b/endpoints/event/event.php
@@ -327,7 +327,7 @@ class EventBaseResponse extends TemplateResponse implements ICache
// interval
if ($rec > 0)
- $infobox[] = Lang::event('interval').Util::formatTime($rec * 1000);
+ $infobox[] = Lang::event('interval').DateTime::formatTimeElapsed($rec * 1000);
// in progress
if ($start < time() && $end > time())
diff --git a/endpoints/guide/changelog.php b/endpoints/guide/changelog.php
index 614af6d6..aa41d802 100644
--- a/endpoints/guide/changelog.php
+++ b/endpoints/guide/changelog.php
@@ -79,20 +79,21 @@ class GuideChangelogResponse extends TemplateResponse
$buff = '
';
$inp = fn($rev) => User::isInGroup(U_GROUP_STAFF) && false ? ($rev !== null ? '' : '') : '';
+ $now = new DateTime();
$logEntries = DB::Aowow()->select('SELECT a.`username` AS `name`, gcl.`date`, gcl.`status`, gcl.`msg`, gcl.`rev` FROM ?_guides_changelog gcl JOIN ?_account a ON a.`id` = gcl.`userId` WHERE gcl.`id` = ?d ORDER BY gcl.`date` DESC', $this->_get['id']);
foreach ($logEntries as $log)
{
if ($log['status'] != GuideMgr::STATUS_NONE)
- $buff .= '- '.$inp($log['rev']).''.Lang::guide('clStatusSet', [Lang::guide('status', $log['status'])]).''.Util::formatTimeDiff($log['date'])."
\n";
+ $buff .= '- '.$inp($log['rev']).''.Lang::guide('clStatusSet', [Lang::guide('status', $log['status'])]).''.$now->formatDate($log['date'], true)."
\n";
else if ($log['msg'])
- $buff .= '- '.$inp($log['rev']).''.Util::formatTimeDiff($log['date']).Lang::main('colon').''.$log['msg'].' '.Lang::main('byUser', [$log['name'], 'style="text-decoration:underline"'])."
\n";
+ $buff .= '- '.$inp($log['rev']).''.$now->formatDate($log['date'], true).Lang::main('colon').''.$log['msg'].' '.Lang::main('byUser', [$log['name'], 'style="text-decoration:underline"'])."
\n";
else
- $buff .= '- '.$inp($log['rev']).''.Util::formatTimeDiff($log['date']).Lang::main('colon').''.Lang::guide('clMinorEdit').' '.Lang::main('byUser', [$log['name'], 'style="text-decoration:underline"'])."
\n";
+ $buff .= '- '.$inp($log['rev']).''.$now->formatDate($log['date'], true).Lang::main('colon').''.Lang::guide('clMinorEdit').' '.Lang::main('byUser', [$log['name'], 'style="text-decoration:underline"'])."
\n";
}
// append creation
- $buff .= '- '.$inp(0).''.Lang::guide('clCreated').''.Util::formatTimeDiff($guide->getField('date'))."
\n
\n";
+ $buff .= ''.$inp(0).''.Lang::guide('clCreated').''.$now->formatDate($guide->getField('date'), true)."\n\n";
if (User::isInGroup(U_GROUP_STAFF) && false)
$buff .= '';
diff --git a/endpoints/latest-comments/latest-comments_rss.php b/endpoints/latest-comments/latest-comments_rss.php
index 22389005..0176ec41 100644
--- a/endpoints/latest-comments/latest-comments_rss.php
+++ b/endpoints/latest-comments/latest-comments_rss.php
@@ -14,6 +14,8 @@ class LatestcommentsRssResponse extends TextResponse
protected function generate() : void
{
+ $now = new DateTime();
+
foreach (CommunityContent::getCommentPreviews(['comments' => 1, 'replies' => 1], dateFmt: false) as $comment)
{
if (empty($comment['commentid']))
@@ -25,7 +27,7 @@ class LatestcommentsRssResponse extends TextResponse
$this->feedData[] = array(
'title' => [true, [], Lang::typeName($comment['type']).Lang::main('colon').htmlentities($comment['subject'])],
'link' => [false, [], $url],
- 'description' => [true, [], htmlentities($comment['preview'])."
".Lang::main('byUser', [$comment['user'], '']) . Util::formatTimeDiff($comment['date'])],
+ 'description' => [true, [], htmlentities($comment['preview'])."
".Lang::main('byUser', [$comment['user'], '']) . $now->formatDate($comment['date'], true)],
'pubDate' => [false, [], date(DATE_RSS, $comment['date'])],
'guid' => [false, [], $url]
// 'domain' => [false, [], null]
diff --git a/endpoints/latest-screenshots/latest-screenshots_rss.php b/endpoints/latest-screenshots/latest-screenshots_rss.php
index a91c0127..78520b50 100644
--- a/endpoints/latest-screenshots/latest-screenshots_rss.php
+++ b/endpoints/latest-screenshots/latest-screenshots_rss.php
@@ -14,12 +14,14 @@ class LatestscreenshotsRssResponse extends TextResponse
protected function generate() : void
{
+ $now = new DateTime();
+
foreach (CommunityContent::getScreenshots(dateFmt: false) as $screenshot)
{
$desc = '
';
if ($screenshot['caption'])
$desc .= '
'.$screenshot['caption'];
- $desc .= "
".Lang::main('byUser', [$screenshot['user'], '']) . Util::formatTimeDiff($screenshot['date'], true);
+ $desc .= "
".Lang::main('byUser', [$screenshot['user'], '']) . $now->formatDate($screenshot['date'], true);
// enclosure/length => filesize('static/uploads/screenshots/thumb/'.$screenshot['id'].'.jpg') .. always set to this placeholder value though
$this->feedData[] = array(
diff --git a/endpoints/latest-videos/latest-videos_rss.php b/endpoints/latest-videos/latest-videos_rss.php
index 4fd63165..e35a5f94 100644
--- a/endpoints/latest-videos/latest-videos_rss.php
+++ b/endpoints/latest-videos/latest-videos_rss.php
@@ -14,12 +14,14 @@ class LatestvideosRssResponse extends TextResponse
protected function generate() : void
{
+ $now = new DateTime();
+
foreach (CommunityContent::getvideos(dateFmt: false) as $video)
{
$desc = '
';
if ($video['caption'])
$desc .= '
'.$video['caption'];
- $desc .= "
".Lang::main('byUser', [$video['user'], '']) . Util::formatTimeDiff($video['date'], true);
+ $desc .= "
".Lang::main('byUser', [$video['user'], '']) . $now->formatDate($video['date'], true);
// is enclosure/length .. is this even relevant..?
$this->feedData[] = array(
diff --git a/endpoints/mail/mail.php b/endpoints/mail/mail.php
index 73bc132e..ffad7f29 100644
--- a/endpoints/mail/mail.php
+++ b/endpoints/mail/mail.php
@@ -99,7 +99,7 @@ class MailBaseResponse extends TemplateResponse implements ICache
}
if ($q['rewardMailDelay'] > 0)
- $infobox[] = Lang::mail('delay', [Util::formatTime($q['rewardMailDelay'] * 1000)]);
+ $infobox[] = Lang::mail('delay', [DateTime::formatTimeElapsed($q['rewardMailDelay'] * 1000)]);
}
else if ($npcId = DB::World()->selectCell('SELECT `Sender` FROM achievement_reward WHERE `MailTemplateId` = ?d', $this->typeId))
{
diff --git a/endpoints/object/object.php b/endpoints/object/object.php
index 6b5150ef..d41d478b 100644
--- a/endpoints/object/object.php
+++ b/endpoints/object/object.php
@@ -151,7 +151,7 @@ class ObjectBaseResponse extends TemplateResponse implements ICache
$buff = Lang::spell('spellModOp', 4).Lang::main('colon').Util::createNumRange($min, $max);
// since Veins don't have charges anymore, the timer is questionable
- $infobox[] = $restock > 1 ? '[tooltip name=restock]'.Lang::gameObject('restock', [Util::formatTime($restock * 1000)]).'[/tooltip][span class=tip tooltip=restock]'.$buff.'[/span]' : $buff;
+ $infobox[] = $restock > 1 ? '[tooltip name=restock]'.Lang::gameObject('restock', [DateTime::formatTimeElapsed($restock * 1000)]).'[/tooltip][span class=tip tooltip=restock]'.$buff.'[/span]' : $buff;
}
// meeting stone [minLevel, maxLevel, zone]
@@ -177,7 +177,7 @@ class ObjectBaseResponse extends TemplateResponse implements ICache
$buff .= Lang::main('colon').'[ul]';
if ($minTime > 1) // sign shenannigans reverse the display order
- $buff .= '[li]'.Lang::game('duration').Lang::main('colon').Util::createNumRange(-$maxTime, -$minTime, fn: fn($x) => Util::FormatTime(-$x * 1000, true)).'[/li]';
+ $buff .= '[li]'.Lang::game('duration').Lang::main('colon').Util::createNumRange(-$maxTime, -$minTime, fn: fn($x) => DateTime::formatTimeElapsed(-$x * 1000)).'[/li]';
if ($minPlayer)
$buff .= '[li]'.Lang::main('players').Lang::main('colon').Util::createNumRange($minPlayer, $maxPlayer).'[/li]';
diff --git a/endpoints/quest/quest.php b/endpoints/quest/quest.php
index 10c56534..1c21e771 100644
--- a/endpoints/quest/quest.php
+++ b/endpoints/quest/quest.php
@@ -197,7 +197,7 @@ class QuestBaseResponse extends TemplateResponse implements ICache
// timer
if ($_ = $this->subject->getField('timeLimit'))
- $infobox[] = Lang::quest('timer').Util::formatTime($_ * 1000);
+ $infobox[] = Lang::quest('timer').DateTime::formatTimeElapsedFloat($_ * 1000);
$startEnd = DB::Aowow()->select('SELECT * FROM ?_quests_startend WHERE `questId` = ?d', $this->typeId);
@@ -1159,7 +1159,7 @@ class QuestBaseResponse extends TemplateResponse implements ICache
'header' => array(
$rmtId,
null,
- $delay ? Lang::mail('mailIn', [Util::formatTime($delay * 1000)]) : null,
+ $delay ? Lang::mail('mailIn', [DateTime::formatTimeElapsed($delay * 1000)]) : null,
)
);
diff --git a/endpoints/spell/spell.php b/endpoints/spell/spell.php
index f473a698..f2369f30 100644
--- a/endpoints/spell/spell.php
+++ b/endpoints/spell/spell.php
@@ -228,7 +228,7 @@ class SpellBaseResponse extends TemplateResponse implements ICache
$this->castTime = $this->subject->createCastTimeForCurrent(false, false);
$this->level = $this->subject->getField('spellLevel');
$this->rangeName = $this->subject->getField('rangeText', true);
- $this->gcd = Util::formatTime($this->subject->getField('startRecoveryTime'));
+ $this->gcd = DateTime::formatTimeElapsedFloat($this->subject->getField('startRecoveryTime'));
$this->school = $this->fmtStaffTip(Lang::getMagicSchools($this->subject->getField('schoolMask')), Util::asHex($this->subject->getField('schoolMask')));
$this->dispel = $this->subject->getField('dispelType') ? Lang::game('dt', $this->subject->getField('dispelType')) : null;
$this->mechanic = $this->subject->getField('mechanic') ? Lang::game('me', $this->subject->getField('mechanic')) : null;
@@ -258,12 +258,12 @@ class SpellBaseResponse extends TemplateResponse implements ICache
$this->stances = Lang::getStances($this->subject->getField('stanceMask'));
if (($_ = $this->subject->getField('recoveryTime')) && $_ > 0)
- $this->cooldown = Util::formatTime($_);
+ $this->cooldown = DateTime::formatTimeElapsedFloat($_);
else if (($_ = $this->subject->getField('recoveryCategory')) && $_ > 0)
- $this->cooldown = Util::formatTime($_);
+ $this->cooldown = DateTime::formatTimeElapsedFloat($_);
if (($_ = $this->subject->getField('duration')) && $_ > 0)
- $this->duration = Util::formatTime($_);
+ $this->duration = DateTime::formatTimeElapsedFloat($_);
/**************/
@@ -1703,7 +1703,7 @@ class SpellBaseResponse extends TemplateResponse implements ICache
$_footer['radius'] = Lang::spell('_radius').$this->subject->getField('effect'.$i.'RadiusMax').' '.Lang::spell('_distUnit');
if ($this->subject->getField('effect'.$i.'Periode') > 0)
- $_footer['interval'] = Lang::spell('_interval').Util::formatTime($this->subject->getField('effect'.$i.'Periode'));
+ $_footer['interval'] = Lang::spell('_interval').DateTime::formatTimeElapsedFloat($this->subject->getField('effect'.$i.'Periode'));
if ($_ = $this->subject->getField('effect'.$i.'Mechanic'))
$_footer['mechanic'] = Lang::game('mechanic').Lang::main('colon').Lang::game('me', $_);
@@ -1712,7 +1712,7 @@ class SpellBaseResponse extends TemplateResponse implements ICache
{
$_footer['proc'] = $procData['chance'] < 0 ? Lang::spell('ppm', [-$procData['chance']]) : Lang::spell('procChance', [$procData['chance']]);
if ($procData['cooldown'])
- $_footer['procCD'] = Lang::game('cooldown', [Util::formatTime($procData['cooldown'], true)]);
+ $_footer['procCD'] = Lang::game('cooldown', [DateTime::formatTimeElapsed($procData['cooldown'] * 1000)]);
}
// Effect Name
diff --git a/endpoints/user/user.php b/endpoints/user/user.php
index d6ad92a1..d18a968f 100644
--- a/endpoints/user/user.php
+++ b/endpoints/user/user.php
@@ -46,7 +46,7 @@ class UserBaseResponse extends TemplateResponse
// do not display system account
if (!$this->user['id'])
$this->generateNotFound(Lang::user('notFound', [$pageParam]));
- }
+ }
protected function generate() : void
{
@@ -74,14 +74,16 @@ class UserBaseResponse extends TemplateResponse
}
if ($this->user['joinDate'])
- $infobox[] = Lang::user('joinDate') . '[tooltip name=joinDate]'. date('l, G:i:s', $this->user['joinDate']). '[/tooltip][span class=tip tooltip=joinDate]'. date(Lang::main('dateFmtShort'), $this->user['joinDate']). '[/span]';
+ $infobox[] = Lang::user('joinDate') . '[tooltip name=joinDate]'. date('l, G:i:s', $this->user['joinDate']). '[/tooltip][span class=tip tooltip=joinDate]'.(new DateTime())->formatDate($this->user['joinDate']). '[/span]';
if ($this->user['prevLogin'])
- $infobox[] = Lang::user('lastLogin') . '[tooltip name=lastLogin]'.date('l, G:i:s', $this->user['prevLogin']).'[/tooltip][span class=tip tooltip=lastLogin]'.date(Lang::main('dateFmtShort'), $this->user['prevLogin']).'[/span]';
+ $infobox[] = Lang::user('lastLogin') . '[tooltip name=lastLogin]'.date('l, G:i:s', $this->user['prevLogin']).'[/tooltip][span class=tip tooltip=lastLogin]'.(new DateTime())->formatDate($this->user['prevLogin']).'[/span]';
if ($groups)
$infobox[] = Lang::user('userGroups') . implode(', ', $groups);
$infobox[] = Lang::user('consecVisits'). $this->user['consecutiveVisits'];
- $infobox[] = Lang::main('siteRep') . Lang::nf($this->user['sumRep']);
+
+ if ($this->user['sumRep'])
+ $infobox[] = Lang::main('siteRep') . Lang::nf($this->user['sumRep']);
if ($infobox)
$this->infobox = new InfoboxMarkup($infobox, ['allow' => Markup::CLASS_STAFF], 'infobox-contents0');
@@ -298,6 +300,9 @@ class UserBaseResponse extends TemplateResponse
[$sum, $nRatings] = $co;
+ if (!$sum)
+ return null;
+
return Lang::user('comments').$sum.($nRatings ? ' [small]([tooltip=tooltip_totalratings]'.$nRatings.'[/tooltip])[/small]' : '');
}
@@ -313,6 +318,9 @@ class UserBaseResponse extends TemplateResponse
[$sum, $nSticky, $nPending] = $ss;
+ if (!$sum)
+ return null;
+
$buff = [];
if ($nSticky || $nPending)
{
@@ -341,6 +349,9 @@ class UserBaseResponse extends TemplateResponse
[$sum, $nSticky, $nPending] = $vi;
+ if (!$sum)
+ return null;
+
$buff = [];
if ($nSticky || $nPending)
{
@@ -373,6 +384,9 @@ class UserBaseResponse extends TemplateResponse
if ($nReplies)
$buff[] = '[tooltip=replies]'.$nReplies.'[/tooltip]';
+ if (!$buff)
+ return null;
+
return Lang::user('posts').($nTopics + $nReplies).($buff ? ' [small]('.implode(' + ', $buff).')[/small]' : '');
}
}
diff --git a/includes/components/SmartAI/SmartAI.class.php b/includes/components/SmartAI/SmartAI.class.php
index 07f25a11..f5e0fcfc 100644
--- a/includes/components/SmartAI/SmartAI.class.php
+++ b/includes/components/SmartAI/SmartAI.class.php
@@ -22,7 +22,7 @@ trait SmartHelper
private function numRange(int $min, int $max, bool $isTime) : string
{
if ($isTime)
- return Util::createNumRange($min, $max, ' – ', fn($x) => Util::formatTime($x, true));
+ return Util::createNumRange($min, $max, ' – ', fn($x) => DateTime::formatTimeElapsed($x));
return Util::createNumRange($min, $max, ' – ');
}
@@ -32,7 +32,7 @@ trait SmartHelper
if (!$time)
return '';
- return Util::formatTime($time * ($isMilliSec ? 1 : 1000), false);
+ return DateTime::formatTimeElapsedFloat($time * ($isMilliSec ? 1 : 1000));
}
private function castFlags(int $flags) : string
diff --git a/includes/components/dbtypelist.class.php b/includes/components/dbtypelist.class.php
index 204a8319..95542533 100644
--- a/includes/components/dbtypelist.class.php
+++ b/includes/components/dbtypelist.class.php
@@ -653,7 +653,7 @@ trait spawnHelper
$label = [Lang::npc('waypoint').Lang::main('colon').$p['point']];
if ($p['wait'])
- $label[] = Lang::npc('wait').Lang::main('colon').Util::formatTime($p['wait'], false);
+ $label[] = Lang::npc('wait').Lang::main('colon').DateTime::formatTimeElapsedFloat($p['wait']);
$opts = array( // \0 doesn't get printed and tricks Util::toJSON() into handling this as a string .. i feel slightly dirty now
'label' => "\0$
".implode('
', $label).'',
diff --git a/includes/components/response/baseresponse.class.php b/includes/components/response/baseresponse.class.php
index 37761981..7e32969d 100644
--- a/includes/components/response/baseresponse.class.php
+++ b/includes/components/response/baseresponse.class.php
@@ -19,7 +19,7 @@ trait TrRecoveryHelper
// check if already processing
if ($_ = DB::Aowow()->selectCell('SELECT `statusTimer` - UNIX_TIMESTAMP() FROM ?_account WHERE `email` = ? AND `status` > ?d AND `statusTimer` > UNIX_TIMESTAMP()', $email, ACC_STATUS_NEW))
- return Lang::account('inputbox', 'error', 'isRecovering', [Util::formatTime($_ * 1000)]);
+ return Lang::account('inputbox', 'error', 'isRecovering', [DateTime::formatTimeElapsed($_ * 1000)]);
// create new token and write to db
$token = Util::createHash();
diff --git a/includes/components/response/templateresponse.class.php b/includes/components/response/templateresponse.class.php
index 6353e87d..ce53910f 100644
--- a/includes/components/response/templateresponse.class.php
+++ b/includes/components/response/templateresponse.class.php
@@ -228,9 +228,9 @@ class TemplateResponse extends BaseResponse
{
if (User::isInGroup(U_GROUP_EMPLOYEE))
{
- $stats['time'] = Util::formatTime((microtime(true) - self::$time) * 1000, true);
- $stats['sql'] = ['count' => parent::$sql['count'], 'time' => Util::formatTime(parent::$sql['time'] * 1000, true)];
- $stats['cache'] = !empty(static::$cacheStats) ? [static::$cacheStats[0], Util::formatTimeDiff(static::$cacheStats[1])] : null;
+ $stats['time'] = DateTime::formatTimeElapsed((microtime(true) - self::$time) * 1000);
+ $stats['sql'] = ['count' => parent::$sql['count'], 'time' => DateTime::formatTimeElapsed(parent::$sql['time'] * 1000)];
+ $stats['cache'] = !empty(static::$cacheStats) ? [static::$cacheStats[0], (new DateTime())->formatDate(static::$cacheStats[1])] : null;
}
else
$stats = [];
diff --git a/includes/components/response/textresponse.class.php b/includes/components/response/textresponse.class.php
index 57e5faf0..cfcc3167 100644
--- a/includes/components/response/textresponse.class.php
+++ b/includes/components/response/textresponse.class.php
@@ -149,14 +149,14 @@ class TextResponse extends BaseResponse
$this->sumSQLStats();
echo "/*\n";
- echo " * generated in ".Util::formatTime((microtime(true) - self::$time) * 1000)."\n";
- echo " * " . parent::$sql['count'] . " SQL queries in " . Util::formatTime(parent::$sql['time'] * 1000) . "\n";
+ echo " * generated in ".DateTime::formatTimeElapsedFloat((microtime(true) - self::$time) * 1000)."\n";
+ echo " * " . parent::$sql['count'] . " SQL queries in " . DateTime::formatTimeElapsedFloat(parent::$sql['time'] * 1000) . "\n";
if ($this instanceof ICache && static::$cacheStats)
{
[$mode, $set, $lifetime] = static::$cacheStats;
echo " * stored in " . ($mode == CACHE_MODE_MEMCACHED ? 'Memcached' : 'filecache') . ":\n";
- echo " * + ".date('c', $set) . ' - ' . Util::formatTimeDiff($set) . "\n";
- echo " * - ".date('c', $set + $lifetime) . ' - in '.Util::formatTime(($set + $lifetime - time()) * 1000) . "\n";
+ echo " * + ".date('c', $set) . ' - ' . DateTime::formatTimeElapsedFloat((time() - $set) * 1000) . " ago\n";
+ echo " * - ".date('c', $set + $lifetime) . ' - in '.DateTime::formatTimeElapsedFloat(($set + $lifetime - time()) * 1000) . "\n";
}
echo " */\n\n";
}
diff --git a/includes/dbtypes/item.class.php b/includes/dbtypes/item.class.php
index ceca727c..901cf289 100644
--- a/includes/dbtypes/item.class.php
+++ b/includes/dbtypes/item.class.php
@@ -965,7 +965,7 @@ class ItemList extends DBTypeList
$extra = [];
if ($cd >= 5000 && $this->curTpl['spellTrigger'.$j] != SPELL_TRIGGER_EQUIP)
{
- $pt = Util::parseTime($cd);
+ $pt = DateTime::parse($cd);
if (count(array_filter($pt)) == 1) // simple time: use simple method
$extra[] = Lang::formatTime($cd, 'item', 'cooldown');
else // build block with generic time
diff --git a/includes/dbtypes/spell.class.php b/includes/dbtypes/spell.class.php
index aabf72e0..032f0e6b 100644
--- a/includes/dbtypes/spell.class.php
+++ b/includes/dbtypes/spell.class.php
@@ -668,7 +668,7 @@ class SpellList extends DBTypeList
else if ($noInstant && !in_array($this->curTpl['typeCat'], [11, 7, -3, -6, -8, 0]) && !($this->curTpl['cuFlags'] & SPELL_CU_TALENTSPELL))
return '';
else
- return $short ? Lang::formatTime($this->curTpl['castTime'] * 1000, 'spell', 'castTime') : Util::formatTime($this->curTpl['castTime'] * 1000);
+ return $short ? Lang::formatTime($this->curTpl['castTime'] * 1000, 'spell', 'castTime') : DateTime::formatTimeElapsedFloat($this->curTpl['castTime'] * 1000);
}
private function createCooldownForCurrent() : string
diff --git a/includes/kernel.php b/includes/kernel.php
index b2f43938..8f1c9780 100644
--- a/includes/kernel.php
+++ b/includes/kernel.php
@@ -32,6 +32,7 @@ if ($error)
require_once 'includes/defines.php';
require_once 'includes/locale.class.php';
require_once 'localization/lang.class.php';
+require_once 'localization/datetime.class.php';
require_once 'includes/libs/DbSimple/Generic.php'; // Libraray: http://en.dklab.ru/lib/DbSimple (using variant: https://github.com/ivan1986/DbSimple/tree/master)
require_once 'includes/database.class.php'; // wrap DBSimple
require_once 'includes/utilities.php'; // helper functions
diff --git a/includes/utilities.php b/includes/utilities.php
index 97de57e8..e4e8aff6 100644
--- a/includes/utilities.php
+++ b/includes/utilities.php
@@ -148,110 +148,6 @@ abstract class Util
return $money;
}
- public static function parseTime(int $msec) : array
- {
- $time = [0, 0, 0, 0, 0];
-
- if ($_ = ($msec % 1000))
- $time[0] = $_;
-
- $sec = $msec / 1000;
-
- if ($sec >= 3600 * 24)
- {
- $time[4] = floor($sec / 3600 / 24);
- $sec -= $time[4] * 3600 * 24;
- }
-
- if ($sec >= 3600)
- {
- $time[3] = floor($sec / 3600);
- $sec -= $time[3] * 3600;
- }
-
- if ($sec >= 60)
- {
- $time[2] = floor($sec / 60);
- $sec -= $time[2] * 60;
- }
-
- if ($sec > 0)
- {
- $time[1] = (int)$sec;
- $sec -= $time[1];
- }
-
- return $time;
- }
-
- public static function formatTime(int $msec, bool $short = false) : string
- {
- [$ms, $s, $m, $h, $d] = self::parseTime(abs($msec));
- // \u00A0 is  , but also usable by js
-
- if ($short)
- {
- if ($_ = round($d / 365))
- return $_."\u{00A0}".Lang::timeUnits('ab', 0);
- if ($_ = round($d / 30))
- return $_."\u{00A0}".Lang::timeUnits('ab', 1);
- if ($_ = round($d / 7))
- return $_."\u{00A0}".Lang::timeUnits('ab', 2);
- if ($_ = round($d))
- return $_."\u{00A0}".Lang::timeUnits('ab', 3);
- if ($_ = round($h))
- return $_."\u{00A0}".Lang::timeUnits('ab', 4);
- if ($_ = round($m))
- return $_."\u{00A0}".Lang::timeUnits('ab', 5);
- if ($_ = round($s + $ms / 1000, 2))
- return $_."\u{00A0}".Lang::timeUnits('ab', 6);
- if ($ms)
- return $ms."\u{00A0}".Lang::timeUnits('ab', 7);
-
- return "0\u{00A0}".Lang::timeUnits('ab', 6);
- }
- else
- {
- $_ = $d + $h / 24;
- if ($_ > 1 && !($_ % 365)) // whole years
- return round(($d + $h / 24) / 365, 2)."\u{00A0}".Lang::timeUnits($d / 365 == 1 && !$h ? 'sg' : 'pl', 0);
- if ($_ > 1 && !($_ % 30)) // whole months
- return round(($d + $h / 24) / 30, 2)."\u{00A0}".Lang::timeUnits($d / 30 == 1 && !$h ? 'sg' : 'pl', 1);
- if ($_ > 1 && !($_ % 7)) // whole weeks
- return round(($d + $h / 24) / 7, 2)."\u{00A0}".Lang::timeUnits($d / 7 == 1 && !$h ? 'sg' : 'pl', 2);
- if ($d)
- return round($d + $h / 24, 2)."\u{00A0}".Lang::timeUnits($d == 1 && !$h ? 'sg' : 'pl', 3);
- if ($h)
- return round($h + $m / 60, 2)."\u{00A0}".Lang::timeUnits($h == 1 && !$m ? 'sg' : 'pl', 4);
- if ($m)
- return round($m + $s / 60, 2)."\u{00A0}".Lang::timeUnits($m == 1 && !$s ? 'sg' : 'pl', 5);
- if ($s)
- return round($s + $ms / 1000, 2)."\u{00A0}".Lang::timeUnits($s == 1 && !$ms ? 'sg' : 'pl', 6);
- if ($ms)
- return $ms."\u{00A0}".Lang::timeUnits($ms == 1 ? 'sg' : 'pl', 7);
-
- return "0\u{00A0}".Lang::timeUnits('pl', 6);
- }
- }
-
- public static function formatTimeDiff(int $sec) : string
- {
- $delta = abs(time() - $sec);
-
- [, $s, $m, $h, $d] = self::parseTime($delta * 1000);
-
- if ($delta > (1 * MONTH)) // use absolute
- return date(Lang::main('dateFmtLong'), $sec);
- else if ($delta > (2 * DAY)) // days ago
- return Lang::main('timeAgo', [$d . ' ' . Lang::timeUnits('pl', 3)]);
- else if ($h) // hours, minutes ago
- return Lang::main('timeAgo', [$h . ' ' . Lang::timeUnits('ab', 4) . ' ' . $m . ' ' . Lang::timeUnits('ab', 5)]);
- else if ($m) // minutes, seconds ago
- return Lang::main('timeAgo', [$m . ' ' . Lang::timeUnits('ab', 5) . ' ' . $s . ' ' . Lang::timeUnits('ab', 6)]);
- else // seconds ago
- return Lang::main('timeAgo', [$s . ' ' . Lang::timeUnits($s == 1 ? 'sg' : 'pl', 6)]);
- }
-
// pageTexts, questTexts and mails
public static function parseHtmlText(string|array $text, bool $markdown = false) : string|array
{
@@ -1264,7 +1160,7 @@ abstract class Util
if ($expiration)
{
$vars += array_fill(0, 9, null); // vsprintf requires all unused indizes to also be set...
- $vars[9] = Util::formatTime($expiration * 1000);
+ $vars[9] = DateTime::formatTimeElapsed($expiration * 1000, 0);
}
if ($vars)
diff --git a/localization/datetime.class.php b/localization/datetime.class.php
new file mode 100644
index 00000000..f6789390
--- /dev/null
+++ b/localization/datetime.class.php
@@ -0,0 +1,218 @@
+getTimestamp() - $timestamp);
+
+ $today = new DateTime();
+ $eventDay = new DateTime(time() - $elapsed);
+
+ $todayMidnight = $today->setTime(0, 0);
+ $eventDayMidnight = $eventDay->setTime(0, 0);
+
+ $delta = $todayMidnight->diff($eventDayMidnight, true)->days;
+
+ if ($elapsed >= 2592000) /* More than a month ago */
+ $txt = Lang::main('date_on') . $eventDay->formatDateSimple($withTime);
+ else if ($delta > 1)
+ $txt = Lang::main('ddaysago', [$delta]);
+ else if ($elapsed >= 43200)
+ {
+ if ($today->format('j') == $eventDay->format('j'))
+ $txt = Lang::main('today');
+ else
+ $txt = Lang::main('yesterday');
+
+ $txt = $eventDay->formatTimeSimple($txt);
+ }
+ else /* Less than 12 hours ago */
+ $txt = Lang::main('date_ago', [self::formatTimeElapsed($elapsed * 1000)]);
+
+ return $txt;
+ }
+
+ /**
+ * Human-readable format of a date. Optionally append time of day.
+ *
+ * @param bool $withTime [optional] affixes day time
+ * @return string a formatted date string.
+ */
+ public function formatDateSimple(bool $withTime = false) : string
+ {
+ $txt = '';
+ $day = $this->format('d');
+ $month = $this->format('m');
+ $year = $this->format('Y');
+
+ if ($year <= 1970)
+ $txt .= Lang::main('unknowndate_stc');
+ else
+ $txt .= Lang::main('date_simple', [$day, $month, $year]);
+
+ if ($withTime)
+ $txt = $this->formatTimeSimple($txt);
+
+ return $txt;
+ }
+
+ /**
+ * Human-readable format of the time of day.
+ *
+ * @param string $txt [optional] text to affeix the day time to
+ * @param bool $noPrefix [optional] don't use " at " to affix time of day to $txt
+ * @return string a formatted time of day string.
+ */
+ public function formatTimeSimple(string $txt = '', bool $noPrefix = false) : string
+ {
+ $hours = $this->format('G');
+ $minutes = $this->format('i');
+
+ $txt .= ($noPrefix ? ' ' : Lang::main('date_at'));
+
+ if ($hours == 12)
+ $txt .= Lang::main('noon');
+ else if ($hours == 0)
+ $txt .= Lang::main('midnight');
+ else if ($hours > 12)
+ $txt .= ($hours - 12) . ':' . $minutes . ' ' . Lang::main('pm');
+ else
+ $txt .= $hours . ':' . $minutes . ' ' . Lang::main('am');
+
+ return $txt;
+ }
+
+ /**
+ * Calculate component values from timestamp
+ *
+ * @param int $msec time in milliseconds to parse
+ * @return int[] [msec, sec, min, hr, day]
+ */
+ public static function parse(int $msec) : array
+ {
+ $time = [0, 0, 0, 0, 0];
+ $msec = abs($msec);
+
+ for ($i = 3; $i < count(self::RANGE); ++$i)
+ {
+ if ($msec < self::RANGE[$i])
+ continue;
+
+ $time[7 - $i] = intVal($msec / self::RANGE[$i]);
+ $msec %= self::RANGE[$i];
+ }
+
+ return $time;
+ }
+
+ /**
+ * Human-readable longform format of a timespan.
+ *
+ * @param int $delay time in milliseconds to format
+ * @return string a formatted time string. If an error occured "n/a" (localized) is returned
+ */
+ public static function formatTimeElapsedFloat(int $delay) : string
+ {
+ $delay = max($delay, 1);
+
+ for ($i = 0; $i < count(self::RANGE); ++$i)
+ {
+ if ($delay < self::RANGE[$i])
+ continue;
+
+ $v = round($delay / self::RANGE[$i], 2);
+ return $v . self::NBSP . Lang::timeUnits($v === 1.0 ? 'sg' : 'pl', $i);
+ }
+
+ return Lang::main('n_a');
+ }
+
+ /**
+ * Human-readable format of a timespan.
+ *
+ * @param int $delay time in milliseconds to format
+ * @param int $maxRange [optional] time unit index - 0 (year) ... 7 (milliseconds)
+ * @return string a formatted time string. If an error occured "n/a" (localized) is returned
+ */
+ public static function formatTimeElapsed(int $delay, int $maxRange = 3) : string
+ {
+ if ($maxRange > 7 || $maxRange < 0)
+ $maxRange = 3; // default: days
+
+ $subunit = [1, 3, 3, -1, 5, -1, 7, -1];
+ $delay = max($delay, 1);
+
+ for ($i = $maxRange; $i < count(self::RANGE); ++$i)
+ {
+ if ($delay >= self::RANGE[$i])
+ {
+ $i1 = $i;
+ $v1 = floor($delay / self::RANGE[$i1]);
+
+ if ($subunit[$i1] != -1)
+ {
+ $i2 = $subunit[$i1];
+ $delay %= self::RANGE[$i1];
+ $v2 = floor($delay / self::RANGE[$i2]);
+
+ if ($v2 > 0)
+ return self::OMG($v1, $i1, true) . self::NBSP . self::OMG($v2, $i2, true);
+ }
+
+ return self::OMG($v1, $i1, false);
+ }
+ }
+
+ return Lang::main('n_a');
+ }
+
+ /**
+ * internal number formatter
+ *
+ * @param int $value unit value
+ * @param int $unit time unit index 0 (year) ... 7 (milliseconds)
+ * @param bool $abbrv use abbreviation
+ * @return string value + unit
+ */
+ private static function OMG(int $value, int $unit, bool $abbrv) : string
+ {
+ if ($abbrv && !Lang::timeUnits('ab', $unit))
+ $abbrv = false;
+
+ return $value .= self::NBSP . match(true)
+ {
+ $abbrv => Lang::timeUnits('ab', $unit),
+ $value == 1 => Lang::timeUnits('sg', $unit),
+ default => Lang::timeUnits('pl', $unit)
+ };
+ }
+}
+
+?>
diff --git a/localization/lang.class.php b/localization/lang.class.php
index bdedb1c1..48e4dc1b 100644
--- a/localization/lang.class.php
+++ b/localization/lang.class.php
@@ -535,7 +535,7 @@ class Lang
if ($msec < 0)
$msec = 0;
- $time = Util::parseTime($msec); // [$ms, $s, $m, $h, $d]
+ $time = DateTime::parse($msec); // [$ms, $s, $m, $h, $d]
$mult = [0, 1000, 60, 60, 24];
$total = 0;
$ref = [];
@@ -552,33 +552,22 @@ class Lang
if (!$msec)
return self::vspf($ref[0], [0]);
- if ($concat)
- {
- for ($i = 4; $i > 0; $i--)
- {
- $total += $time[$i];
- if (isset($ref[$i]) && ($total || ($i == 1 && !$result)))
- {
- $result[] = self::vspf($ref[$i], [$total]);
- $total = 0;
- }
- else
- $total *= $mult[$i];
- }
-
- return implode(', ', $result);
- }
-
for ($i = 4; $i > 0; $i--)
{
$total += $time[$i];
- if (isset($ref[$i]) && ($total || $i == 1))
- return self::vspf($ref[$i], [$total + ($time[$i-1] ?? 0) / $mult[$i]]);
+ if (isset($ref[$i]) && ($total || ($i == 1 && !$result)))
+ {
+ if (!$concat)
+ return self::vspf($ref[$i], [$total + ($time[$i-1] ?? 0) / $mult[$i]]);
+
+ $result[] = self::vspf($ref[$i], [$total]);
+ $total = 0;
+ }
else
$total *= $mult[$i];
}
- return '';
+ return implode(', ', $result);
}
private static function vspf(null|array|string $var, array $args = []) : null|array|string
diff --git a/localization/locale_dede.php b/localization/locale_dede.php
index d55c252a..956604e2 100644
--- a/localization/locale_dede.php
+++ b/localization/locale_dede.php
@@ -134,8 +134,25 @@ $lang = array(
'dateFmtShort' => "d.m.Y",
'dateFmtLong' => "d.m.Y \u\m H:i",
'dateFmtIntl' => "d. MMMM y",
- 'timeAgo' => 'vor %s',
'nfSeparators' => ['.', ','],
+ 'n_a' => "n. v.",
+
+ // date time
+ 'date' => "Datum",
+ 'date_colon' => "Datum: ",
+ 'date_on' => "am ",
+ 'date_ago' => "vor %s",
+ 'date_at' => " um ",
+ 'date_to' => " bis ",
+ 'date_simple' => '%1$d.%2$d.%3$d',
+ 'unknowndate' => "Unbekanntes Datum",
+ 'ddaysago' => "vor %d Tagen",
+ 'today' => "heute",
+ 'yesterday' => "gestern",
+ 'noon' => "Mittag",
+ 'midnight' => "Mitternacht",
+ 'am' => "vormittags",
+ 'pm' => "nachmittags",
// error
'intError' => "Ein interner Fehler ist aufgetreten.",
@@ -1656,7 +1673,6 @@ $lang = array(
'_rankRange' => "Rang: %d - %d",
'_showXmore' => "Zeige %d weitere",
- 'n_a' => "n. v.",
'normal' => "Normal",
'special' => "Besonders",
diff --git a/localization/locale_enus.php b/localization/locale_enus.php
index d306d84a..8361d2b4 100644
--- a/localization/locale_enus.php
+++ b/localization/locale_enus.php
@@ -134,8 +134,25 @@ $lang = array(
'dateFmtShort' => "Y/m/d",
'dateFmtLong' => "Y/m/d \a\\t g:i A",
'dateFmtIntl' => "MMMM d, y",
- 'timeAgo' => "%s ago",
'nfSeparators' => [',', '.'],
+ 'n_a' => "n/a",
+
+ // date time
+ 'date' => "Date",
+ 'date_colon' => "Date: ",
+ 'date_on' => "on ",
+ 'date_ago' => "%s ago",
+ 'date_at' => " at ",
+ 'date_to' => " to ",
+ 'date_simple' => '%2$d/%1$d/%3$d',
+ 'unknowndate' => "Unknown date",
+ 'ddaysago' => "%d days ago",
+ 'today' => "today",
+ 'yesterday' => "yesterday",
+ 'noon' => "noon",
+ 'midnight' => "midnight",
+ 'am' => "AM",
+ 'pm' => "PM",
// error
'intError' => "An internal error has occurred.",
@@ -1656,7 +1673,6 @@ $lang = array(
'_rankRange' => "Rank: %d - %d",
'_showXmore' => "Show %d More",
- 'n_a' => "n/a",
'normal' => "Normal",
'special' => "Special",
diff --git a/localization/locale_eses.php b/localization/locale_eses.php
index e78c918e..d1687ea0 100644
--- a/localization/locale_eses.php
+++ b/localization/locale_eses.php
@@ -134,8 +134,25 @@ $lang = array(
'dateFmtShort' => "d/m/Y",
'dateFmtLong' => "d/m/Y \a \l\a\s g:i A",
'dateFmtIntl' => "d 'de' MMMM 'de' y",
- 'timeAgo' => 'hace %s',
'nfSeparators' => ['.', ','],
+ 'n_a' => "n/d",
+
+ // date time
+ 'date' => "Fecha",
+ 'date_colon' => "Fecha: ",
+ 'date_on' => "el ",
+ 'date_ago' => "hace %s",
+ 'date_at' => " a las ",
+ 'date_to' => " al ",
+ 'date_simple' => '%1$d/%2$d/%3$d',
+ 'unknowndate' => "Fecha desconocida",
+ 'ddaysago' => "Hace %d días",
+ 'today' => "hoy",
+ 'yesterday' => "ayer",
+ 'noon' => "medio día",
+ 'midnight' => "medianoche",
+ 'am' => "a.m.",
+ 'pm' => "p.m.",
// error
'intError' => "Un error interno ha ocurrido.",
@@ -1656,7 +1673,6 @@ $lang = array(
'_rankRange' => "Rango: %d - %d",
'_showXmore' => "Mostrar %d más",
- 'n_a' => "n/d",
'normal' => "Normal",
'special' => "Especial",
diff --git a/localization/locale_frfr.php b/localization/locale_frfr.php
index 52b16a3b..3da25911 100644
--- a/localization/locale_frfr.php
+++ b/localization/locale_frfr.php
@@ -134,8 +134,25 @@ $lang = array(
'dateFmtShort' => "Y-m-d",
'dateFmtLong' => "Y-m-d à g:i A",
'dateFmtIntl' => "d MMMM y",
- 'timeAgo' => 'il y a %s',
'nfSeparators' => [' ', ','],
+ 'n_a' => "n/d",
+
+ // date time
+ 'date' => "Date",
+ 'date_colon' => "Date : ",
+ 'date_on' => "le ",
+ 'date_ago' => "il y a %s",
+ 'date_at' => " à ",
+ 'date_to' => " à ",
+ 'date_simple' => '%1$d-%2$d-%3$d',
+ 'unknowndate' => "Date inconnue",
+ 'ddaysago' => "%d jours avant",
+ 'today' => "aujourd'hui",
+ 'yesterday' => "hier",
+ 'noon' => "midi",
+ 'midnight' => "minuit",
+ 'am' => "AM",
+ 'pm' => "PM",
// error
'intError' => "[An internal error occured.]",
@@ -1656,7 +1673,6 @@ $lang = array(
'_rankRange' => "Rang : %d - %d",
'_showXmore' => "En afficher %d de plus",
- 'n_a' => "n/d",
'normal' => "Standard",
'special' => "Spécial",
diff --git a/localization/locale_ruru.php b/localization/locale_ruru.php
index 51b53869..e2466a5a 100644
--- a/localization/locale_ruru.php
+++ b/localization/locale_ruru.php
@@ -134,8 +134,25 @@ $lang = array(
'dateFmtShort' => "Y-m-d",
'dateFmtLong' => "Y-m-d в g:i A",
'dateFmtIntl' => "d MMMM y г.",
- 'timeAgo' => '%s назад',
'nfSeparators' => [' ', ','],
+ 'n_a' => "нет",
+
+ // date time
+ 'date' => "По дате",
+ 'date_colon' => "Дата: ",
+ 'date_on' => "на ",
+ 'date_ago' => "%s назад",
+ 'date_at' => " в ",
+ 'date_to' => " в ",
+ 'date_simple' => '%1$d.%2$d.%3$d',
+ 'unknowndate' => "Неизвестная дата",
+ 'ddaysago' => "%d дней назад",
+ 'today' => "сегодня",
+ 'yesterday' => "вчера",
+ 'noon' => "полдень",
+ 'midnight' => "полночь",
+ 'am' => "a.m.",
+ 'pm' => "p.m.",
// error
'intError' => "[An internal error occured.]",
@@ -1656,7 +1673,6 @@ $lang = array(
'_rankRange' => "Ранг: %d - %d",
'_showXmore' => "Показать на %d больше",
- 'n_a' => "нет",
'normal' => "Обычный",
'special' => "Особый",
diff --git a/localization/locale_zhcn.php b/localization/locale_zhcn.php
index e3eb62f3..fbc1908e 100644
--- a/localization/locale_zhcn.php
+++ b/localization/locale_zhcn.php
@@ -134,8 +134,25 @@ $lang = array(
'dateFmtShort' => "Y/m/d",
'dateFmtLong' => "Y/m/d \a\\t g:i A",
'dateFmtIntl' => "y年M月d日",
- 'timeAgo' => '%s之前',
'nfSeparators' => [',', '.'],
+ 'n_a' => "n/a",
+
+ // date time
+ 'date' => "日期",
+ 'date_colon' => "日期:",
+ 'date_on' => "在 ",
+ 'date_ago' => "%s前",
+ 'date_at' => "于",
+ 'date_to' => "至",
+ 'date_simple' => '%3$d/%2$d/%1$d',
+ 'unknowndate' => "未知日期",
+ 'ddaysago' => "%d天前",
+ 'today' => "今日",
+ 'yesterday' => "昨天",
+ 'noon' => "正午",
+ 'midnight' => "午夜",
+ 'am' => "AM",
+ 'pm' => "PM",
// error
'intError' => "发生内部错误。",
@@ -1656,7 +1673,6 @@ $lang = array(
'_rankRange' => "排名: %d - %d",
'_showXmore' => "[Show %d More]",
- 'n_a' => "n/a",
'normal' => "普通",
'special' => "特殊",
diff --git a/template/pages/spell.tpl.php b/template/pages/spell.tpl.php
index 476e3f05..c03f6ad1 100644
--- a/template/pages/spell.tpl.php
+++ b/template/pages/spell.tpl.php
@@ -92,23 +92,23 @@ endif;
| =Lang::game('duration');?> |
- =($this->duration ?: ''.Lang::spell('n_a').'');?> |
+ =($this->duration ?: ''.Lang::main('n_a').'');?> |
| =Lang::game('school'); ?> |
- =($this->school ?: ''.Lang::spell('n_a').'');?> |
+ =($this->school ?: ''.Lang::main('n_a').'');?> |
| =Lang::game('mechanic');?> |
- =($this->mechanic ?:''.Lang::spell('n_a').'');?> |
+ =($this->mechanic ?:''.Lang::main('n_a').'');?> |
| =Lang::game('dispelType');?> |
- =($this->dispel ?: ''.Lang::spell('n_a').'');?> |
+ =($this->dispel ?: ''.Lang::main('n_a').'');?> |
| =Lang::spell('_gcdCategory');?> |
- =($this->gcdCat ?: ''.Lang::spell('n_a').'');?> |
+ =($this->gcdCat ?: ''.Lang::main('n_a').'');?> |
@@ -127,7 +127,7 @@ endif;
| =Lang::spell('_cooldown');?> |
- =($this->cooldown ?: ''.Lang::spell('n_a').'');?> |
+ =($this->cooldown ?: ''.Lang::main('n_a').'');?> |
| '.Lang::spell('_gcd');?> |