mirror of
https://github.com/Sarjuuk/aowow.git
synced 2025-11-29 15:58:16 +08:00
* recreate date functions from javascript in new class DateTime * move date and time functions from Util to new class * fixes various cooldown messages for account recovery
42 lines
1.4 KiB
PHP
42 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace Aowow;
|
|
|
|
if (!defined('AOWOW_REVISION'))
|
|
die('illegal access');
|
|
|
|
|
|
class LatestcommentsRssResponse extends TextResponse
|
|
{
|
|
use TrRss;
|
|
|
|
protected string $contentType = MIME_TYPE_RSS;
|
|
|
|
protected function generate() : void
|
|
{
|
|
$now = new DateTime();
|
|
|
|
foreach (CommunityContent::getCommentPreviews(['comments' => 1, 'replies' => 1], dateFmt: false) as $comment)
|
|
{
|
|
if (empty($comment['commentid']))
|
|
$url = Cfg::get('HOST_URL').'/?go-to-comment&id='.$comment['id'];
|
|
else
|
|
$url = Cfg::get('HOST_URL').'/?go-to-reply&id='.$comment['id'];
|
|
|
|
// todo (low): preview should be html-formated
|
|
$this->feedData[] = array(
|
|
'title' => [true, [], Lang::typeName($comment['type']).Lang::main('colon').htmlentities($comment['subject'])],
|
|
'link' => [false, [], $url],
|
|
'description' => [true, [], htmlentities($comment['preview'])."<br /><br />".Lang::main('byUser', [$comment['user'], '']) . $now->formatDate($comment['date'], true)],
|
|
'pubDate' => [false, [], date(DATE_RSS, $comment['date'])],
|
|
'guid' => [false, [], $url]
|
|
// 'domain' => [false, [], null]
|
|
);
|
|
}
|
|
|
|
$this->result = $this->generateRSS(Lang::main('utilities', 2), 'latest-comments');
|
|
}
|
|
}
|
|
|
|
?>
|