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

uwuzu v1.6.5 Hapuego

This commit is contained in:
Daichimarukana
2025-10-28 00:06:47 +09:00
parent 7c4de15050
commit 9adf294efc
64 changed files with 1763 additions and 982 deletions
+6 -1
View File
@@ -53,6 +53,8 @@ if (safetext(isset($_POST['page'])) && safetext(isset($_POST['userid'])) && safe
$list_Page = max(0, (int)$pageNumber - 1);
$messages = [];
$blocked_accounts = sqlBlockAccountList('account', $myblocklist);
if (!empty($bookmarkList[$list_Page])) {
$currentPageUniqIds = $bookmarkList[$list_Page];
@@ -69,13 +71,16 @@ if (safetext(isset($_POST['page'])) && safetext(isset($_POST['userid'])) && safe
$sql = "SELECT ueuse.*
FROM ueuse
LEFT JOIN account ON ueuse.account = account.userid
WHERE ueuse.uniqid IN ($placeholderStr) AND account.role != 'ice'
WHERE ueuse.uniqid IN ($placeholderStr) AND account.role != 'ice' {$blocked_accounts['sql']}
ORDER BY FIELD(ueuse.uniqid, $placeholderStr)";
$stmt = $pdo->prepare($sql);
foreach ($params as $key => $val) {
$stmt->bindValue($key, $val, PDO::PARAM_STR);
}
foreach ($blocked_accounts['params'] as $ph => $val) {
$stmt->bindValue($ph, $val, PDO::PARAM_STR);
}
$stmt->execute();
$messages = $stmt->fetchAll(PDO::FETCH_ASSOC);
}
+1 -7
View File
@@ -40,13 +40,7 @@ if (safetext(isset($_POST['page'])) && safetext(isset($_POST['userid'])) && safe
}
$offset = ($pageNumber - 1) * $itemsPerPage;
$followQuery = $pdo->prepare("SELECT follow FROM account WHERE userid = :userid");
$followQuery->bindValue(':userid', $userId);
$followQuery->execute();
$followData = $followQuery->fetch();
$follow = $followData['follow']/*.",".$userid*/;
$followList = explode(',', $follow);
$followList = getFolloweeList($pdo, $userId);
$messages = array(); // 初期化
// 空ならエラー回避
+21 -7
View File
@@ -41,16 +41,21 @@ if (safetext(isset($_POST['page'])) && safetext(isset($_POST['userid'])) && safe
$offset = ($pageNumber - 1) * $itemsPerPage;
$messages = array();
$blocked_accounts = sqlBlockAccountList('account', $myblocklist);
//------------------------------------------すべてのユーズを取得----------------------------------------------
$all_sql = "SELECT ueuse.*
FROM ueuse
LEFT JOIN account ON ueuse.account = account.userid
WHERE ueuse.rpuniqid = '' AND account.role != 'ice'
WHERE ueuse.rpuniqid = '' AND account.role != 'ice' {$blocked_accounts['sql']}
ORDER BY ueuse.datetime DESC
LIMIT :offset, :itemsPerPage";
$all_stmt = $pdo->prepare($all_sql);
foreach ($blocked_accounts['params'] as $ph => $val) {
$all_stmt->bindValue($ph, $val, PDO::PARAM_STR);
}
$all_stmt->bindValue(':offset', $offset, PDO::PARAM_INT);
$all_stmt->bindValue(':itemsPerPage', $itemsPerPage, PDO::PARAM_INT);
$all_stmt->execute();
@@ -64,11 +69,10 @@ if (safetext(isset($_POST['page'])) && safetext(isset($_POST['userid'])) && safe
$day_count_sql = "SELECT ueuse.*
FROM ueuse
LEFT JOIN account ON ueuse.account = account.userid
WHERE ueuse.datetime >= NOW() - INTERVAL 7 DAY AND ueuse.rpuniqid = '' AND account.role != 'ice'
WHERE ueuse.datetime >= NOW() - INTERVAL 7 DAY AND ueuse.rpuniqid = '' AND account.role != 'ice'
ORDER BY ueuse.datetime DESC
LIMIT 1000";
$cnt_stmt = $pdo->prepare($day_count_sql);
$cnt_stmt->execute();
$Before7daysPosts = $cnt_stmt->fetchAll(PDO::FETCH_ASSOC);
// 結果が15件に満たない場合
@@ -98,12 +102,16 @@ if (safetext(isset($_POST['page'])) && safetext(isset($_POST['userid'])) && safe
ueuse.rpuniqid = ''
AND
account.role != 'ice'
{$blocked_accounts['sql']}
ORDER BY
ueuse.popularity DESC
LIMIT :offset, :itemsPerPage;
";
$pop_stmt = $pdo->prepare($pop_sql);
foreach ($blocked_accounts['params'] as $ph => $val) {
$pop_stmt->bindValue($ph, $val, PDO::PARAM_STR);
}
$pop_stmt->bindValue(':getday', $get_day, PDO::PARAM_INT);
$pop_stmt->bindValue(':offset', $offset, PDO::PARAM_INT);
$pop_stmt->bindValue(':itemsPerPage', $itemsPerPage, PDO::PARAM_INT);
@@ -115,17 +123,20 @@ if (safetext(isset($_POST['page'])) && safetext(isset($_POST['userid'])) && safe
}
//------------------------------------------フォローしているユーザーから取得----------------------------------------------
$followList = explode(',', getUserData($pdo, $userId)["follow"]);
$followList = getFolloweeList($pdo, $userId);
foreach ($followList as $followUserId) {
$flw_sql = "SELECT ueuse.*
FROM ueuse
LEFT JOIN account ON ueuse.account = account.userid
WHERE ueuse.rpuniqid = '' AND account.role != 'ice' AND ueuse.account = :follow_account AND ueuse.datetime >= NOW() - INTERVAL :getday DAY
WHERE ueuse.rpuniqid = '' AND account.role != 'ice' AND ueuse.account = :follow_account AND ueuse.datetime >= NOW() - INTERVAL :getday DAY {$blocked_accounts['sql']}
ORDER BY ueuse.datetime DESC
LIMIT :offset, :itemsPerPage";
$flw_stmt = $pdo->prepare($flw_sql);
foreach ($blocked_accounts['params'] as $ph => $val) {
$flw_stmt->bindValue($ph, $val, PDO::PARAM_STR);
}
$flw_stmt->bindValue(':getday', $get_day, PDO::PARAM_INT);
$flw_stmt->bindValue(':offset', $offset, PDO::PARAM_INT);
$flw_stmt->bindValue(':itemsPerPage', $itemsPerPage, PDO::PARAM_INT);
@@ -148,7 +159,7 @@ if (safetext(isset($_POST['page'])) && safetext(isset($_POST['userid'])) && safe
$fav_sql = "SELECT ueuse.*,
(LENGTH(ueuse.favorite) - LENGTH(REPLACE(ueuse.favorite, ',', '')) - 1) AS favorite_count
FROM ueuse
WHERE FIND_IN_SET(:userid, ueuse.favorite) > 0
WHERE FIND_IN_SET(:userid, ueuse.favorite) > 0
ORDER BY ueuse.datetime DESC
LIMIT 100
";
@@ -167,11 +178,14 @@ if (safetext(isset($_POST['page'])) && safetext(isset($_POST['userid'])) && safe
$favget_sql = "SELECT ueuse.*
FROM ueuse
LEFT JOIN account ON ueuse.account = account.userid
WHERE ueuse.rpuniqid = '' AND account.role != 'ice' AND ueuse.account = :fav_account AND ueuse.datetime >= NOW() - INTERVAL :getday DAY
WHERE ueuse.rpuniqid = '' AND account.role != 'ice' AND ueuse.account = :fav_account AND ueuse.datetime >= NOW() - INTERVAL :getday DAY {$blocked_accounts['sql']}
ORDER BY ueuse.datetime DESC
LIMIT :offset, :itemsPerPage";
$favget_stmt = $pdo->prepare($favget_sql);
foreach ($blocked_accounts['params'] as $ph => $val) {
$favget_stmt->bindValue($ph, $val, PDO::PARAM_STR);
}
$favget_stmt->bindValue(':getday', $get_day, PDO::PARAM_INT);
$favget_stmt->bindValue(':offset', $offset, PDO::PARAM_INT);
$favget_stmt->bindValue(':itemsPerPage', $itemsPerPage, PDO::PARAM_INT);
+8 -1
View File
@@ -40,16 +40,23 @@ if (safetext(isset($_POST['page'])) && safetext(isset($_POST['userid'])) && safe
}
$offset = ($pageNumber - 1) * $itemsPerPage;
$blocked_accounts = sqlBlockAccountList('account', $myblocklist);
$messages = array();
$sql = "SELECT ueuse.*
FROM ueuse
LEFT JOIN account ON ueuse.account = account.userid
WHERE ueuse.rpuniqid = '' AND account.role != 'ice'
WHERE ueuse.rpuniqid = '' AND account.role != 'ice' {$blocked_accounts['sql']}
ORDER BY ueuse.datetime DESC
LIMIT :offset, :itemsPerPage";
$stmt = $pdo->prepare($sql);
foreach ($blocked_accounts['params'] as $ph => $val) {
$stmt->bindValue($ph, $val, PDO::PARAM_STR);
}
$stmt->bindValue(':offset', $offset, PDO::PARAM_INT);
$stmt->bindValue(':itemsPerPage', $itemsPerPage, PDO::PARAM_INT);
$stmt->execute();
+2 -7
View File
@@ -135,13 +135,8 @@ if (safetext(isset($_POST['page'])) && safetext(isset($_POST['userid'])) && safe
$userItems = array();
if(!empty($users)){
foreach ($users as $value) {
$follower = $value['follower'];
$followerIds = array_reverse(array_values(array_filter(explode(',', $follower))));
$followerCount = count($followerIds);
$follow = $value['follow'];
$followIds = array_reverse(array_values(array_filter(explode(',', $follow))));
$followCount = count($followIds);
$followerCount = count(getFollowerList($pdo, $value["userid"]));
$followCount = count(getFolloweeList($pdo, $value["userid"]));
$user = array(
"type" => "User",
+14 -2
View File
@@ -17,6 +17,11 @@ if (safetext(isset($_POST['page'])) && safetext(isset($_POST['userid'])) && safe
exit;
}
if(empty($uniqid)){
echo json_encode(['success' => false, 'error' => 'no_ueuse']);
exit;
}
// データベースに接続
try {
$option = array(
@@ -42,8 +47,12 @@ if (safetext(isset($_POST['page'])) && safetext(isset($_POST['userid'])) && safe
$offset = ($pageNumber - 1) * $itemsPerPage;
$messages = array();
$blocked_accounts = sqlBlockAccountList('account', $myblocklist);
$messageQuery = $pdo->prepare("SELECT * FROM ueuse WHERE uniqid = :ueuseid OR rpuniqid = :rpueuseid ORDER BY datetime ASC LIMIT :offset, :itemsPerPage");
$messageQuery = $pdo->prepare("SELECT * FROM ueuse WHERE (uniqid = :ueuseid OR rpuniqid = :rpueuseid) {$blocked_accounts['sql']} ORDER BY datetime ASC LIMIT :offset, :itemsPerPage");
foreach ($blocked_accounts['params'] as $ph => $val) {
$messageQuery->bindValue($ph, $val, PDO::PARAM_STR);
}
$messageQuery->bindValue(':ueuseid', $uniqid, PDO::PARAM_STR);
$messageQuery->bindValue(':rpueuseid', $uniqid, PDO::PARAM_STR);
$messageQuery->bindValue(':offset', $offset, PDO::PARAM_INT);
@@ -56,7 +65,10 @@ if (safetext(isset($_POST['page'])) && safetext(isset($_POST['userid'])) && safe
foreach ($message_array as $row) {
if(!(empty($row["rpuniqid"]))){
if(!($row["rpuniqid"] == $uniqid)){
$up_messageQuery = $pdo->prepare("SELECT * FROM ueuse WHERE uniqid = :ueuseid ORDER BY datetime ASC LIMIT :offset, :itemsPerPage");
$up_messageQuery = $pdo->prepare("SELECT * FROM ueuse WHERE uniqid = :ueuseid {$blocked_accounts['sql']} ORDER BY datetime ASC LIMIT :offset, :itemsPerPage");
foreach ($blocked_accounts['params'] as $ph => $val) {
$up_messageQuery->bindValue($ph, $val, PDO::PARAM_STR);
}
$up_messageQuery->bindValue(':ueuseid', $row["rpuniqid"]);
$up_messageQuery->bindValue(':offset', $offset, PDO::PARAM_INT);
$up_messageQuery->bindValue(':itemsPerPage', $itemsPerPage, PDO::PARAM_INT);