ponepaste/discover.php

30 lines
1 KiB
PHP
Raw Normal View History

2021-07-10 19:18:17 +01:00
<?php
2021-07-10 18:21:03 -04:00
define('IN_PONEPASTE', 1);
require_once('includes/common.php');
2021-07-10 19:18:17 +01:00
require_once('includes/functions.php');
function transformPasteRow(Paste $row) : array {
return [
'id' => $row['id'],
'title' => $row['title'],
'member' => $row['member'],
'time' => $row['created_at'],
2021-07-20 08:44:23 +01:00
'time_update' => $row['updated_at'],
'friendly_update_time' => friendlyDateDifference(new DateTime($row['updated_at']), new DateTime()),
2021-08-17 13:13:04 -04:00
'friendly_time' => friendlyDateDifference(new DateTime($row['created_at']), new DateTime()),
'tags' => $row->tags
];
}
$popular_pastes = Paste::getMostViewed()->map('transformPasteRow');
$monthly_popular_pastes = Paste::getMonthPopular()->map('transformPasteRow');
$recent_pastes = Paste::getRecent()->map('transformPasteRow');
$updated_pastes = Paste::getRecentlyUpdated()->map('transformPasteRow');
$random_pastes = Paste::getRandom()->map('transformPasteRow');
2021-07-10 19:18:17 +01:00
// Theme
2021-08-22 21:45:26 -04:00
$page_template = 'discover';
2021-08-26 05:35:21 -04:00
$page_title = 'Discover';
2021-08-22 21:45:26 -04:00
require_once('theme/' . $default_theme . '/common.php');