diff --git a/includes/functions.php b/includes/functions.php index 532a34d..e9d9518 100644 --- a/includes/functions.php +++ b/includes/functions.php @@ -13,9 +13,9 @@ * GNU General Public License in GPL.txt for more details. */ -function getUserFavs(DatabaseHandle $conn, string $user_id) : array { +function getUserFavs(DatabaseHandle $conn, int $user_id) : array { $query = $conn->prepare( - "SELECT pins.f_time, pastes.id, pastes.title, pastes.created_at, pastes.tagsys + "SELECT pins.f_time, pastes.id, pins.paste_id, pastes.title, pastes.created_at, pastes.tagsys, pastes.updated_at FROM pins INNER JOIN pastes ON pastes.id = pins.paste_id WHERE pins.user_id = ?"); @@ -28,9 +28,9 @@ function checkFavorite(DatabaseHandle $conn, int $paste_id, int $user_id) : stri $query->execute([$user_id, $paste_id]); if ($query->fetch()) { - return ""; + return ""; } else { - return ""; + return ""; } } diff --git a/theme/bulma/user_profile.php b/theme/bulma/user_profile.php index 7b96b83..fea881e 100644 --- a/theme/bulma/user_profile.php +++ b/theme/bulma/user_profile.php @@ -226,7 +226,7 @@ $protocol = paste_protocol(); ' . ($title) . ' - + ' . $p_dateui . ' @@ -264,21 +264,22 @@ $protocol = paste_protocol(); $row) { + foreach ($profile_favs as $index => $row) { $ftitle = Trim($row['title']); - $f_id = Trim($row['f_paste']); - $f_date = Trim($row['f_time']); - $Recent_update = Trim($row['now_time']); + $f_id = Trim($row['paste_id']); + $f_date = new DateTime($row['f_time']); + $f_dateui = $f_date->format("d F Y"); + $Recent_update = new DateTime($row['updated_at']); + $Recent_update_u = date_format($Recent_update,'U'); $f_tags = Trim($row['tagsys']); $ftagArray = explode(',', $f_tags); $ftagArray = array_filter($ftagArray); - $p_link = ($mod_rewrite == '1') ? "$f_id" : "paste.php?favdel=$fu_id"; - $f_delete_link = ($mod_rewrite == '1') ? "user.php?favdel&user=$profile_username&fid=$fu_id" : "user.php?favdel&user=$profile_username&fid=$fu_id"; + //$p_link = ($mod_rewrite == '1') ? "$f_id" : "paste.php?favdel=$fu_id"; + //$f_delete_link = ($mod_rewrite == '1') ? "user.php?favdel&user=$profile_username&fid=$f_id" : "user.php?favdel&user=$profile_username&fid=$f_id"; $title = truncate($title, 20, 50); $current_time = time(); $past = strtotime('-2 day', $current_time); - if ($past <= $Recent_update && $Recent_update <= $current_time) { + if ($past <= $Recent_update_u && $Recent_update_u <= $current_time) { $updatenote = ""; } else { $updatenote = ""; @@ -288,11 +289,11 @@ $protocol = paste_protocol(); ' . ($ftitle) . ' - - ' . date("d F Y", $f_date) . ' + + ' . date_format($f_date,'U') . ' - ' . $Recent_update . ' + ' . $Recent_update_u . ' ' . $updatenote . ' '; diff --git a/user.php b/user.php index e6e93be..a9fed84 100644 --- a/user.php +++ b/user.php @@ -90,6 +90,7 @@ $profile_total_paste_views = intval($query->fetch(PDO::FETCH_NUM)[0]); $profile_join_date = $profile_info['date']; $profile_pastes = getUserPastes($conn, $profile_info['id']); +$profile_favs = getUserFavs($conn, $profile_info['id']); $is_current_user = ($current_user !== null) && ($profile_info['id'] == $current_user->user_id); updatePageViews($conn);