1
0
mirror of https://github.com/Daichimarukana/uwuzu.git synced 2026-06-04 19:14:41 +00:00

uwuzu v1.4.14 Funium

This commit is contained in:
Daichimarukana
2025-01-26 16:06:37 +09:00
parent 6bcb912a04
commit bc8b6cd800
18 changed files with 588 additions and 275 deletions
+19 -16
View File
@@ -57,30 +57,33 @@ if (isset($_GET['userid']) && isset($_GET['account_id'])) {
$bookmarkQuery->execute();
$bookmarkData = $bookmarkQuery->fetch();
$bookmark = $bookmarkData['bookmark'];
$bookmarkList = explode(',', $bookmark);
$bookmarkList = array_chunk(array_reverse(explode(',', $bookmark)),$itemsPerPage);
// フォローしているユーザーの投稿を取得し、日時順に並び替える
$messages = array(); // 初期化
foreach ($bookmarkList as $bookmarkUniqId) {
$sql = "SELECT ueuse.*
FROM ueuse
LEFT JOIN account ON ueuse.account = account.userid
WHERE uniqid = :bookmarkUniqId AND account.role != 'ice'
ORDER BY ueuse.datetime DESC
LIMIT :offset, :itemsPerPage";
$list_Page = (int)$pageNumber - 1;
$stmt = $pdo->prepare($sql);
$stmt->bindValue(':bookmarkUniqId', $bookmarkUniqId, PDO::PARAM_STR);
$stmt->bindValue(':offset', $offset, PDO::PARAM_INT);
$stmt->bindValue(':itemsPerPage', $itemsPerPage, PDO::PARAM_INT);
$stmt->execute();
if(!(empty($bookmarkList[$list_Page]))){
foreach ($bookmarkList[$list_Page] as $bookmarkUniqId) {
$sql = "SELECT ueuse.*
FROM ueuse
LEFT JOIN account ON ueuse.account = account.userid
WHERE uniqid = :bookmarkUniqId AND account.role != 'ice'
ORDER BY ueuse.datetime DESC";
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
$messages[] = $row;
$stmt = $pdo->prepare($sql);
$stmt->bindValue(':bookmarkUniqId', $bookmarkUniqId, PDO::PARAM_STR);
$stmt->execute();
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
$messages[] = $row;
}
}
}else{
$messages = [];
}
$messages = array_reverse($messages);
// ユーザー情報を取得して、$messages内のusernameをuserDataのusernameに置き換える
foreach ($messages as &$message) {
$userQuery = $pdo->prepare("SELECT username, userid, profile, role, iconname, headname, sacinfo FROM account WHERE userid = :userid");
+2 -6
View File
@@ -94,11 +94,7 @@ if (isset($_GET['userid']) && isset($_GET['account_id'])) {
$get_day = $get_day * (2 ** floor($pageNumber / 3));
$pop_sql = "SELECT
ueuse.*,
(LENGTH(ueuse.favorite) - LENGTH(REPLACE(ueuse.favorite, ',', '')) - 1) AS favorite_count,
(SELECT COUNT(*) FROM ueuse AS reuse WHERE reuse.ruuniqid = ueuse.uniqid) AS reuse_count,
((LENGTH(ueuse.favorite) - LENGTH(REPLACE(ueuse.favorite, ',', '')) - 1) +
(SELECT COUNT(*) FROM ueuse AS reuse WHERE reuse.ruuniqid = ueuse.uniqid)) AS total_score
ueuse.*
FROM
ueuse
LEFT JOIN account ON ueuse.account = account.userid
@@ -109,7 +105,7 @@ if (isset($_GET['userid']) && isset($_GET['account_id'])) {
AND
account.role != 'ice'
ORDER BY
total_score DESC
ueuse.popularity DESC
LIMIT :offset, :itemsPerPage;
";