1
0
mirror of https://github.com/Daichimarukana/uwuzu.git synced 2026-06-05 03:24:41 +00:00

uwuzu v1.4.8 Funium

This commit is contained in:
Daichimarukana
2024-12-27 17:37:41 +09:00
parent eb28cc49cc
commit 7fd6bcbc05
82 changed files with 2267 additions and 797 deletions
+10 -50
View File
@@ -18,13 +18,7 @@ header("Content-Type: application/json");
header("charset=utf-8");
header("Access-Control-Allow-Origin: *");
function decode_yajirushi($postText){
$postText = str_replace('←', '←', $postText);
$postText = str_replace('↓', '↓', $postText);
$postText = str_replace('↑', '↑', $postText);
$postText = str_replace('→', '→', $postText);
return $postText;
}
$pdo = null;
@@ -107,50 +101,16 @@ if(isset($_GET['token']) || (!(empty($Get_Post_Json)))) {
if(!(empty($Follow_userdata))){
if(!($userid == $Follow_userdata['userid'])){
$followerList = explode(',', $Follow_userdata['follower']);
if (!(in_array($userid, $followerList))) {
// 自分が相手をフォローしていない場合、相手のfollowerカラムと自分のfollowカラムを更新
$followerList[] = $userid;
$newFollowerList = implode(',', $followerList);
// UPDATE文を実行してフォロー情報を更新
$updateQuery = $pdo->prepare("UPDATE account SET follower = :follower WHERE userid = :userid");
$updateQuery->bindValue(':follower', $newFollowerList, PDO::PARAM_STR);
$updateQuery->bindValue(':userid', $Follow_userdata['userid'], PDO::PARAM_STR);
$res = $updateQuery->execute();
// 自分のfollowカラムを更新
$myflwlist = explode(',', $userData['follow']);
$myflwlist[] = $userData['userid'];
$newFollowList = implode(',', array_unique($myflwlist));
$updateQuery = $pdo->prepare("UPDATE account SET follow = :follow WHERE userid = :userid");
$updateQuery->bindValue(':follow', $newFollowList, PDO::PARAM_STR);
$updateQuery->bindValue(':userid', $userid, PDO::PARAM_STR);
$res_follow = $updateQuery->execute();
$datetime = date("Y-m-d H:i:s");
$pdo->beginTransaction();
send_notification($follow_userid, $userid, "🎉" . $userid . "さんにフォローされました!🎉", "" . $userid . "さんにフォローされました。", "/@" . $userid . "", "follow");
if ($res && $res_follow) {
//フォロー完了
$response = array(
'userid' => decode_yajirushi(htmlspecialchars_decode($Follow_userdata["userid"])),
'success' => true
);
echo json_encode($response, JSON_UNESCAPED_UNICODE);
} else {
$err = "db_error_".$e->getMessage();
$response = array(
'error_code' => $err,
);
echo json_encode($response, JSON_UNESCAPED_UNICODE);
}
$stmt = null;
$res = follow_user($pdo, $Follow_userdata['userid'], $userid);
if($res === true){
//フォロー完了
$response = array(
'userid' => decode_yajirushi(htmlspecialchars_decode($Follow_userdata["userid"])),
'success' => true
);
echo json_encode($response, JSON_UNESCAPED_UNICODE);
}else{
$err = "already_been_completed";
$err = "could_not_complete";
$response = array(
'error_code' => $err,
);