mirror of
https://github.com/Daichimarukana/uwuzu.git
synced 2026-06-05 03:24:41 +00:00
uwuzu version 1.2.25
This commit is contained in:
+55
-17
@@ -59,7 +59,7 @@ try {
|
||||
|
||||
if(isset($_SESSION['admin_login']) && $_SESSION['admin_login'] === true) {
|
||||
|
||||
$passQuery = $pdo->prepare("SELECT username,userid,loginid,admin,role,sacinfo FROM account WHERE userid = :userid");
|
||||
$passQuery = $pdo->prepare("SELECT username,userid,loginid,follow,admin,role,sacinfo FROM account WHERE userid = :userid");
|
||||
$passQuery->bindValue(':userid', htmlentities($_SESSION['userid']));
|
||||
$passQuery->execute();
|
||||
$res = $passQuery->fetch();
|
||||
@@ -105,7 +105,7 @@ if(isset($_SESSION['admin_login']) && $_SESSION['admin_login'] === true) {
|
||||
|
||||
} elseif (isset($_COOKIE['admin_login']) && $_COOKIE['admin_login'] == true) {
|
||||
|
||||
$passQuery = $pdo->prepare("SELECT username,userid,loginid,admin,role,sacinfo FROM account WHERE userid = :userid");
|
||||
$passQuery = $pdo->prepare("SELECT username,userid,loginid,follow,admin,role,sacinfo FROM account WHERE userid = :userid");
|
||||
$passQuery->bindValue(':userid', htmlentities($_COOKIE['userid']));
|
||||
$passQuery->execute();
|
||||
$res = $passQuery->fetch();
|
||||
@@ -261,23 +261,61 @@ if( !empty($_POST['btn_submit']) ) {
|
||||
$deleteQuery->bindValue(':touserid', $userid, PDO::PARAM_STR);
|
||||
$res = $deleteQuery->execute();
|
||||
|
||||
// フォローの更新
|
||||
$updateFollowQuery = $pdo->prepare("UPDATE account SET follow = REPLACE(follow, :userid, '') WHERE follow LIKE :pattern");
|
||||
$updateFollowQuery->bindValue(':userid', ",$userid", PDO::PARAM_STR);
|
||||
$updateFollowQuery->bindValue(':pattern', "%,$userid%", PDO::PARAM_STR);
|
||||
$updateFollowQuery->execute();
|
||||
// ユーザーIDを削除したい全てのアカウントを取得
|
||||
$query = $pdo->prepare("SELECT * FROM account WHERE follow LIKE :pattern1 OR follow LIKE :pattern2 OR follow LIKE :pattern3 OR follower LIKE :pattern1 OR follower LIKE :pattern2 OR follower LIKE :pattern3");
|
||||
$query->bindValue(':pattern1', "%,$userid,%", PDO::PARAM_STR);
|
||||
$query->bindValue(':pattern2', "%,$userid", PDO::PARAM_STR);
|
||||
$query->bindValue(':pattern3', "$userid,%", PDO::PARAM_STR);
|
||||
$query->execute();
|
||||
$accounts = $query->fetchAll();
|
||||
|
||||
// フォロワーの更新
|
||||
$updateFollowerQuery = $pdo->prepare("UPDATE account SET follower = REPLACE(follower, :userid, '') WHERE follower LIKE :pattern");
|
||||
$updateFollowerQuery->bindValue(':userid', ",$userid", PDO::PARAM_STR);
|
||||
$updateFollowerQuery->bindValue(':pattern', "%,$userid%", PDO::PARAM_STR);
|
||||
$updateFollowerQuery->execute();
|
||||
foreach ($accounts as $account) {
|
||||
// フォローの更新
|
||||
if (strpos($account['follow'], ",$userid,") !== false || strpos($account['follow'], ",$userid") !== false || strpos($account['follow'], "$userid,") !== false) {
|
||||
$followList = explode(',', $account['follow']);
|
||||
$followList = array_diff($followList, array($userid));
|
||||
$newFollowList = implode(',', $followList);
|
||||
|
||||
$updateFollowQuery = $pdo->prepare("UPDATE account SET follow = :follow WHERE userid = :userid");
|
||||
$updateFollowQuery->bindValue(':follow', $newFollowList, PDO::PARAM_STR);
|
||||
$updateFollowQuery->bindValue(':userid', $account['userid'], PDO::PARAM_STR);
|
||||
$updateFollowQuery->execute();
|
||||
}
|
||||
|
||||
// フォロワーの更新
|
||||
if (strpos($account['follower'], ",$userid,") !== false || strpos($account['follower'], ",$userid") !== false || strpos($account['follower'], "$userid,") !== false) {
|
||||
$followerList = explode(',', $account['follower']);
|
||||
$followerList = array_diff($followerList, array($userid));
|
||||
$newFollowerList = implode(',', $followerList);
|
||||
|
||||
$updateFollowerQuery = $pdo->prepare("UPDATE account SET follower = :follower WHERE userid = :userid");
|
||||
$updateFollowerQuery->bindValue(':follower', $newFollowerList, PDO::PARAM_STR);
|
||||
$updateFollowerQuery->bindValue(':userid', $account['userid'], PDO::PARAM_STR);
|
||||
$updateFollowerQuery->execute();
|
||||
}
|
||||
}
|
||||
|
||||
$query = $pdo->prepare("SELECT * FROM ueuse WHERE favorite LIKE :pattern1 OR favorite LIKE :pattern2 OR favorite LIKE :pattern3");
|
||||
$query->bindValue(':pattern1', "%,$userid,%", PDO::PARAM_STR);
|
||||
$query->bindValue(':pattern2', "%,$userid", PDO::PARAM_STR);
|
||||
$query->bindValue(':pattern3', "$userid,%", PDO::PARAM_STR);
|
||||
$query->execute();
|
||||
$accounts = $query->fetchAll();
|
||||
|
||||
foreach ($accounts as $account) {
|
||||
// いいねの更新
|
||||
if (strpos($account['favorite'], ",$userid,") !== false || strpos($account['favorite'], ",$userid") !== false || strpos($account['favorite'], "$userid,") !== false) {
|
||||
$favoriteList = explode(',', $account['favorite']);
|
||||
$favoriteList = array_diff($favoriteList, array($userid));
|
||||
$newFavoriteList = implode(',', $favoriteList);
|
||||
|
||||
$updateFavoriteQuery = $pdo->prepare("UPDATE ueuse SET favorite = :favorite WHERE uniqid = :uniqid");
|
||||
$updateFavoriteQuery->bindValue(':favorite', $newFavoriteList, PDO::PARAM_STR);
|
||||
$updateFavoriteQuery->bindValue(':uniqid', $account['uniqid'], PDO::PARAM_STR);
|
||||
$updateFavoriteQuery->execute();
|
||||
}
|
||||
}
|
||||
|
||||
// いいねの更新
|
||||
$updateFavoriteQuery = $pdo->prepare("UPDATE ueuse SET favorite = REPLACE(favorite, :favorite, '') WHERE favorite LIKE :pattern");
|
||||
$updateFavoriteQuery->bindValue(':favorite', ",$userid", PDO::PARAM_STR);
|
||||
$updateFavoriteQuery->bindValue(':pattern', "%,$userid%", PDO::PARAM_STR);
|
||||
$updateFavoriteQuery->execute();
|
||||
|
||||
} catch (Exception $e) {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user