diff --git a/settings_admin/userinfo.php b/settings_admin/userinfo.php
index 30eabd8..2aae2b6 100644
--- a/settings_admin/userinfo.php
+++ b/settings_admin/userinfo.php
@@ -440,23 +440,60 @@ if( !empty($_POST['send_ban_submit']) ) {
$deleteQuery->bindValue(':touserid', $userId2, PDO::PARAM_STR);
$res = $deleteQuery->execute();
- // フォローの更新
- $updateFollowQuery = $pdo->prepare("UPDATE account SET follow = REPLACE(follow, :userid, '') WHERE follow LIKE :pattern");
- $updateFollowQuery->bindValue(':userid', ",$userId2", PDO::PARAM_STR);
- $updateFollowQuery->bindValue(':pattern', "%,$userId2%", 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', ",$userId2", PDO::PARAM_STR);
- $updateFollowerQuery->bindValue(':pattern', "%,$userId2%", 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);
- // いいねの更新
- $updateFavoriteQuery = $pdo->prepare("UPDATE ueuse SET favorite = REPLACE(favorite, :favorite, '') WHERE favorite LIKE :pattern");
- $updateFavoriteQuery->bindValue(':favorite', ",$userId2", PDO::PARAM_STR);
- $updateFavoriteQuery->bindValue(':pattern', "%,$userId2%", PDO::PARAM_STR);
- $updateFavoriteQuery->execute();
+ $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();
+ }
+ }
} catch (Exception $e) {
diff --git a/sw.js b/sw.js
index b564d9e..3005359 100644
--- a/sw.js
+++ b/sw.js
@@ -42,4 +42,4 @@ self.addEventListener('fetch', function(event) {
return fetch(event.request);
})
);
-});
\ No newline at end of file
+});
diff --git a/ueuse/activity/index.php b/ueuse/activity/index.php
index 0dd325a..f45c415 100644
--- a/ueuse/activity/index.php
+++ b/ueuse/activity/index.php
@@ -90,5 +90,7 @@ if(file_get_contents($activitypub_file) === "true"){
echo json_encode($item, JSON_UNESCAPED_UNICODE);
}
+}else{
+ header("HTTP/1.1 410 Gone");
}
?>
\ No newline at end of file
diff --git a/user/inbox/index.php b/user/inbox/index.php
index 48005b1..bc4e71a 100644
--- a/user/inbox/index.php
+++ b/user/inbox/index.php
@@ -18,5 +18,7 @@ if(file_get_contents($activitypub_file) === "true"){
);
echo json_encode($item, JSON_UNESCAPED_UNICODE);
+}else{
+ header("HTTP/1.1 410 Gone");
}
?>
\ No newline at end of file
diff --git a/user/index.php b/user/index.php
index 90c6fe0..124e045 100644
--- a/user/index.php
+++ b/user/index.php
@@ -49,7 +49,7 @@ try {
if(isset($_SESSION['admin_login']) && $_SESSION['admin_login'] === true) {
- $passQuery = $pdo->prepare("SELECT username,userid,loginid,admin,role,sacinfo,blocklist FROM account WHERE userid = :userid");
+ $passQuery = $pdo->prepare("SELECT username,userid,loginid,follow,admin,role,sacinfo,blocklist FROM account WHERE userid = :userid");
$passQuery->bindValue(':userid', htmlentities($_SESSION['userid']));
$passQuery->execute();
$res = $passQuery->fetch();
@@ -64,6 +64,7 @@ if(isset($_SESSION['admin_login']) && $_SESSION['admin_login'] === true) {
$role = htmlentities($res["role"]);
$sacinfo = htmlentities($res["sacinfo"]);
$myblocklist = htmlentities($res["blocklist"]);
+ $myfollowlist = htmlentities($res["follow"]);
$_SESSION['admin_login'] = true;
$_SESSION['userid'] = $userid;
$_SESSION['username'] = $username;
@@ -96,7 +97,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,blocklist FROM account WHERE userid = :userid");
+ $passQuery = $pdo->prepare("SELECT username,userid,loginid,follow,admin,role,sacinfo,blocklist FROM account WHERE userid = :userid");
$passQuery->bindValue(':userid', htmlentities($_COOKIE['userid']));
$passQuery->execute();
$res = $passQuery->fetch();
@@ -111,6 +112,7 @@ if(isset($_SESSION['admin_login']) && $_SESSION['admin_login'] === true) {
$role = htmlentities($res["role"]);
$sacinfo = htmlentities($res["sacinfo"]);
$myblocklist = htmlentities($res["blocklist"]);
+ $myfollowlist = htmlentities($res["follow"]);
$_SESSION['admin_login'] = true;
$_SESSION['userid'] = $userid;
$_SESSION['username'] = $username;
@@ -224,7 +226,7 @@ if( !empty($pdo) ) {
function replaceURLsWithLinks($postText) {
// URLを正規表現を使って検出
- $pattern = '/(https?:\/\/[^\s]+)/';
+ $pattern = '/(https:\/\/[^\s<>\[\]\'"]+)/'; // 改良された正規表現
preg_match_all($pattern, $postText, $matches);
// 検出したURLごとに処理を行う
@@ -233,11 +235,12 @@ if( !empty($pdo) ) {
$parsedUrl = parse_url($url);
$domain = isset($parsedUrl['host']) ? $parsedUrl['host'] : '';
- // ドメインのみを表示するaタグを生成
- $link = "
$domain";
+ // 不要な文字を削除してaタグを生成
+ $urlWithoutSpaces = preg_replace('/\s+/', '', $url);
+ $link = "
$domain";
// URLをドメインのみを表示するaタグで置き換え
- $postText = str_replace($url, $link, $postText);
+ $postText = preg_replace('/' . preg_quote($url, '/') . '/', $link, $postText);
}
return $postText;
@@ -278,8 +281,9 @@ if( !empty($pdo) ) {
// コンマで区切って配列に分割し、要素数を数える
$followIds = explode(',', $follow);
$followCount = count($followIds)-1;
-
- $follow_on_me = strpos($follow, $userid);
+
+ $follow_on_me = array_search($userid, $followIds);
+
if ($follow_on_me !== false) {
$follow_yes = "フォローされています"; // worldを含む:6
}else{
@@ -301,6 +305,47 @@ if( !empty($pdo) ) {
$allueuse->execute();
$ueuse_cnt = $allueuse->rowCount();
+ //-------フォロワー取得---------
+
+ // フォロワーのユーザーIDを $follower_userids 配列に追加
+ foreach ($followerIds as $follower_userid) {
+ $follower_userids[] = $follower_userid;
+ }
+
+ // フォロワーのユーザー情報を取得
+ $follower_userdata = array();
+
+ foreach ($follower_userids as $follower_userid) {
+ $follower_userQuery = $pdo->prepare("SELECT username, userid, iconname, headname, sacinfo FROM account WHERE userid = :userid");
+ $follower_userQuery->bindValue(':userid', $follower_userid);
+ $follower_userQuery->execute();
+ $follower_userinfo = $follower_userQuery->fetch();
+
+ if ($follower_userinfo) {
+ // フォロワーのユーザー情報を $follower_userdata 配列に追加
+ $follower_userdata[] = $follower_userinfo;
+ }
+ }
+
+ //-------フォロー取得---------
+
+ foreach ($followIds as $follow_userid) {
+ $follow_userids[] = $follow_userid;
+ }
+
+ $follow_userdata = array();
+
+ foreach ($follow_userids as $follow_userid) {
+ $follow_userQuery = $pdo->prepare("SELECT username, userid, iconname, headname, sacinfo FROM account WHERE userid = :userid");
+ $follow_userQuery->bindValue(':userid', $follow_userid);
+ $follow_userQuery->execute();
+ $follow_userinfo = $follow_userQuery->fetch();
+
+ if ($follow_userinfo) {
+ // フォロワーのユーザー情報を $follower_userdata 配列に追加
+ $follow_userdata[] = $follow_userinfo;
+ }
+ }
}else{
@@ -393,9 +438,12 @@ if (!empty($_POST['follow'])) {
$updateQuery->bindValue(':userid', $userData['userid'], PDO::PARAM_STR);
$res = $updateQuery->execute();
- $deluserid = ",".$userdata["userid"];
+ $myflwlist = explode(',', $myfollowlist);
+ $delfollowList = array_diff($myflwlist, array($userData['userid']));
+ $deluserid = implode(',', $delfollowList);
+
// 自分のfollowカラムから相手のユーザーIDを削除
- $updateQuery = $pdo->prepare("UPDATE account SET follow = REPLACE(follow, :follow, '') WHERE userid = :userid");
+ $updateQuery = $pdo->prepare("UPDATE account SET follow = :follow WHERE userid = :userid");
$updateQuery->bindValue(':follow', $deluserid, PDO::PARAM_STR);
$updateQuery->bindValue(':userid', $userid, PDO::PARAM_STR);
$res_follow = $updateQuery->execute();
@@ -433,9 +481,11 @@ if (!empty($_POST['send_block_submit'])) {
$updateQuery->bindValue(':userid', $userData['userid'], PDO::PARAM_STR);
$res = $updateQuery->execute();
- $deluserid = ",".$userdata["userid"];
+ $myflwlist = explode(',', $myfollowlist);
+ $delfollowList = array_diff($myflwlist, array($userData['userid']));
+ $deluserid = implode(',', $delfollowList);
// 自分のfollowカラムから相手のユーザーIDを削除
- $updateQuery = $pdo->prepare("UPDATE account SET follow = REPLACE(follow, :follow, '') WHERE userid = :userid");
+ $updateQuery = $pdo->prepare("UPDATE account SET follow = :follow WHERE userid = :userid");
$updateQuery->bindValue(':follow', $deluserid, PDO::PARAM_STR);
$updateQuery->bindValue(':userid', $userid, PDO::PARAM_STR);
$res_follow = $updateQuery->execute();
@@ -461,9 +511,11 @@ if (!empty($_POST['send_block_submit'])) {
} elseif (!empty($_POST['send_un_block_submit'])) {
- $deluserid = ",".$userdata["userid"];
+ $myblklist = explode(',', $myBlocklist);
+ $delblkList = array_diff($myblklist, array($userData['userid']));
+ $deluserid = implode(',', $delblkList);
// 自分のfollowカラムから相手のユーザーIDを削除
- $updateQuery = $pdo->prepare("UPDATE account SET blocklist = REPLACE(blocklist, :blocklist, '') WHERE userid = :userid");
+ $updateQuery = $pdo->prepare("UPDATE account SET blocklist = :blocklist WHERE userid = :userid");
$updateQuery->bindValue(':blocklist', $deluserid, PDO::PARAM_STR);
$updateQuery->bindValue(':userid', $userid, PDO::PARAM_STR);
$res_block = $updateQuery->execute();
@@ -490,6 +542,7 @@ $pdo = null;
+
@@ -504,6 +557,16 @@ $pdo = null;
+
+
+
+
🦖💨 インターネットへの接続が切断されました...
+
+
+
🌐💫 インターネットへの接続が復帰しました!!!
+
+
+
@@ -516,7 +579,8 @@ $pdo = null;
@@ -880,10 +1005,13 @@ $(document).ready(function() {
if (outerBottom <= $('.outer').scrollTop()) {
var elem = document.getElementById("noueuse");
- if (elem === null){
+ if($("#error").css('display') == 'block') {
+ // えらー処理
+ return;
+ }else if (elem === null){
// 存在しない場合の処理
loadPosts();
- } else {
+ }else{
// 存在する場合の処理
return;
}
@@ -1121,6 +1249,59 @@ $(document).ready(function() {
}, 150);
});
});
+
+ var modal4 = document.getElementById('FollowerUserModal');
+ var CloseButton4 = document.getElementById('CloseButton4'); // 追加
+ var modalMain = $('.modal-content');
+
+ $('#follower_cnt').click(function() {
+ modal4.style.display = 'block';
+ modalMain.addClass("slideUp");
+ modalMain.removeClass("slideDown");
+
+ CloseButton4.addEventListener('click', () => {
+ modalMain.removeClass("slideUp");
+ modalMain.addClass("slideDown");
+ window.setTimeout(function(){
+ modal4.style.display = 'none';
+ }, 150);
+ });
+ });
+
+ var modal5 = document.getElementById('FollowUserModal');
+ var CloseButton5 = document.getElementById('CloseButton5'); // 追加
+ var modalMain = $('.modal-content');
+
+ $('#follow_cnt').click(function() {
+ modal5.style.display = 'block';
+ modalMain.addClass("slideUp");
+ modalMain.removeClass("slideDown");
+
+ CloseButton5.addEventListener('click', () => {
+ modalMain.removeClass("slideUp");
+ modalMain.addClass("slideDown");
+ window.setTimeout(function(){
+ modal5.style.display = 'none';
+ }, 150);
+ });
+ });
+
+ window.addEventListener('online', function(){
+ checkOnline();
+ });
+ window.addEventListener('offline', function(){
+ checkOnline();
+ });
+ function checkOnline() {
+ if( navigator.onLine ) {
+ $("#online").show();
+ $("#offline").hide();
+ } else {
+ $("#online").hide();
+ $("#offline").show();
+ }
+ }
+
});
diff --git a/user/outbox/index.php b/user/outbox/index.php
index ac3e72e..edece00 100644
--- a/user/outbox/index.php
+++ b/user/outbox/index.php
@@ -127,5 +127,7 @@ if(file_get_contents($activitypub_file) === "true"){
echo json_encode($item, JSON_UNESCAPED_UNICODE);
}
}
+}else{
+ header("HTTP/1.1 410 Gone");
}
?>
\ No newline at end of file