aowow/endpoints/latest-screenshots/latest-screenshots_rss.php
Sarjuuk c44bf4f575 Config/Misc
* hardcode sql limits within their respective components instead of
   having them configurable
 * creating a new DBTypeList defaults it to being unlimited
   * SQL_LIMIT_NONE (0) > removed as it only existed for consistency
   * SQL_LIMIT_DEFAULT (300) > frontend / Listview::DEFAULT_SIZE
   * SQL_LIMIT_SEARCH (500) > Search::DEFAULT_MAX_RESULTS
   * SQL_LIMIT_QUICKSEARCH (10) > Search::SUGGESTIONS_MAX_RESULTS
2025-12-30 03:20:09 +01:00

42 lines
2 KiB
PHP

<?php
namespace Aowow;
if (!defined('AOWOW_REVISION'))
die('illegal access');
class LatestscreenshotsRssResponse extends TextResponse
{
use TrRss;
protected string $contentType = MIME_TYPE_RSS;
protected function generate() : void
{
$now = new DateTime();
foreach (CommunityContent::getScreenshots(dateFmt: false, resultLimit: 100) as $screenshot)
{
$desc = '<a href="'.Cfg::get('HOST_URL').'/?'.Type::getFileString($screenshot['type']).'='.$screenshot['typeId'].'#screenshots:id='.$screenshot['id'].'"><img src="'.Cfg::get('STATIC_URL').'/uploads/screenshots/thumb/'.$screenshot['id'].'.jpg" alt="" /></a>';
if ($screenshot['caption'])
$desc .= '<br />'.$screenshot['caption'];
$desc .= "<br /><br />".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(
'title' => [true, [], Lang::typeName($screenshot['type']).Lang::main('colon').htmlentities($screenshot['subject'])],
'link' => [false, [], Cfg::get('HOST_URL').'/?'.Type::getFileString($screenshot['type']).'='.$screenshot['typeId'].'#screenshots:id='.$screenshot['id']],
'description' => [true, [], $desc],
'pubDate' => [false, [], date(DATE_RSS, $screenshot['date'])],
'enclosure' => [false, ['url' => Cfg::get('STATIC_URL').'/uploads/screenshots/thumb/'.$screenshot['id'].'.jpg', 'length' => 12345, 'type' => 'image/jpeg'], null],
'guid' => [false, [], Cfg::get('HOST_URL').'/?'.Type::getFileString($screenshot['type']).'='.$screenshot['typeId'].'#screenshots:id='.$screenshot['id']],
// 'domain' => [false, [], live|ptr]
);
}
$this->result = $this->generateRSS(Lang::main('utilities', 3), 'latest-screenshots');
}
}
?>