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');
|
|
|
|
|
2021-08-29 01:26:29 -04:00
|
|
|
use PonePaste\Models\Paste;
|
|
|
|
|
2021-08-27 19:24:48 -04:00
|
|
|
function transformPasteRow(Paste $row) : array {
|
2021-07-13 13:32:28 -04:00
|
|
|
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'],
|
2021-07-18 20:56:05 +01:00
|
|
|
'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()),
|
2021-08-27 19:24:48 -04:00
|
|
|
'tags' => $row->tags
|
2021-07-13 13:32:28 -04:00
|
|
|
];
|
|
|
|
}
|
|
|
|
|
2021-08-29 01:26:29 -04:00
|
|
|
$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-13 13:32:28 -04:00
|
|
|
|
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');
|
|
|
|
|