From e8b5a3a6dd548e471634886bb9022169c082cd35 Mon Sep 17 00:00:00 2001 From: Daichimarukana Date: Mon, 19 Aug 2024 17:24:19 +0900 Subject: [PATCH] uwuzu v1.4.2 Funium --- abi/addabi.php | 3 +- api/migration-api.php | 40 +---- api/ueuse/delete.php | 126 +++---------- api/users/follow.php | 44 +---- delete/delete.php | 123 +------------ favorite/favorite.php | 7 +- function/function.php | 309 +++++++++++++++++++++++++------- home/index.php | 12 +- others/account_migration.php | 92 +++++----- passrecovery/startrecovery.php | 4 +- server/uwuzuabout.txt | 4 +- server/uwuzuinfo.txt | 4 +- server/uwuzurelease.txt | 40 +++-- settings/index.php | 135 ++++++++++++-- settings_admin/update_admin.php | 9 +- ueuse/index.php | 16 +- update.json | 23 ++- user/index.php | 2 +- user/report.php | 107 +---------- uwuzu_database.sql | 6 +- 20 files changed, 560 insertions(+), 546 deletions(-) diff --git a/abi/addabi.php b/abi/addabi.php index 78f2a22..6905126 100644 --- a/abi/addabi.php +++ b/abi/addabi.php @@ -95,8 +95,9 @@ if (safetext(isset($_POST['uniqid'])) && safetext(isset($_POST['abitext'])) && s $title = safetext("" . $result2["username"] . "さんにメンションされました!"); $url = safetext("/!" . $postUniqid . "~" . $userid . ""); $userchk = 'none'; + $category = 'mention'; - send_notification($touserid,$userid,$title,$msg,$url); + send_notification($touserid,$userid,$title,$msg,$url,$category); } if ($res) { diff --git a/api/migration-api.php b/api/migration-api.php index 058b8d2..2b07f6c 100644 --- a/api/migration-api.php +++ b/api/migration-api.php @@ -96,38 +96,14 @@ if(isset($_GET['migration_code'])) { } //メール送信はナシ //------------ - $pdo->beginTransaction(); - - try { - $datetime = date("Y-m-d H:i:s"); - $msg = "アカウントの移行が完了したためこのアカウントの不正コピーを防ぐためアカウントを凍結しました!\n引き続きこのアカウントを利用するには管理者に凍結を解除してもらってください!"; - $title = "✨アカウントの移行が完了しました!🔄️"; - $url = "/rule/serverabout"; - $userchk = 'none'; - $from_userid = "uwuzu-fromsys"; - - $stmt = $pdo->prepare("INSERT INTO notification (fromuserid, touserid, msg, url, datetime, userchk, title) VALUES (:fromuserid, :touserid, :msg, :url, :datetime, :userchk, :title)"); - - $stmt->bindParam(':fromuserid', $from_userid, PDO::PARAM_STR); - $stmt->bindParam(':touserid', $account, PDO::PARAM_STR); - $stmt->bindParam(':msg', $msg, PDO::PARAM_STR); - $stmt->bindParam(':url', $url, PDO::PARAM_STR); - $stmt->bindParam(':userchk', $userchk, PDO::PARAM_STR); - $stmt->bindParam(':title', $title, PDO::PARAM_STR); - - $stmt->bindParam(':datetime', $datetime, PDO::PARAM_STR); - - // SQLクエリの実行 - $res2 = $stmt->execute(); - - // コミット - $res2 = $pdo->commit(); - - } catch(Exception $e) { - - // エラーが発生した時はロールバック - $pdo->rollBack(); - } + + $msg = "アカウントの移行が完了したためこのアカウントの不正コピーを防ぐためアカウントを凍結しました!\n引き続きこのアカウントを利用するには管理者に凍結を解除してもらってください!"; + $title = "✨アカウントの移行が完了しました!🔄️"; + $url = "/rule/serverabout"; + $from_userid = "uwuzu-fromsys"; + $category = "system"; + + send_notification($from_userid,$account,$title,$msg,$url,$category); if ($res) { $item = array( diff --git a/api/ueuse/delete.php b/api/ueuse/delete.php index 28c7a20..34b7bf0 100644 --- a/api/ueuse/delete.php +++ b/api/ueuse/delete.php @@ -72,7 +72,7 @@ if(isset($_GET['token']) || (!(empty($Get_Post_Json)))) { session_start(); if( !empty($pdo) ) { - $userQuery = $pdo->prepare("SELECT username, userid, role FROM account WHERE token = :token"); + $userQuery = $pdo->prepare("SELECT username, userid, role, loginid FROM account WHERE token = :token"); $userQuery->bindValue(':token', $token); $userQuery->execute(); $userData = $userQuery->fetch(); @@ -93,111 +93,37 @@ if(isset($_GET['token']) || (!(empty($Get_Post_Json)))) { echo json_encode($response, JSON_UNESCAPED_UNICODE); exit; }else{ - $query = $pdo->prepare('SELECT * FROM ueuse WHERE uniqid = :uniqid limit 1'); - - $query->execute(array(':uniqid' => $ueuseid)); - - $result = $query->fetch(); - - if(!(empty($result))){ - if($result["account"] === $userData["userid"]){ - - $Userid = $userData["userid"]; - $photo_query = $pdo->prepare("SELECT * FROM ueuse WHERE account = :userid AND uniqid = :uniqid"); - $photo_query->bindValue(':userid', $Userid); - $photo_query->bindValue(':uniqid', $ueuseid); - $photo_query->execute(); - $photo_and_video = $photo_query->fetch(); - - if(!($photo_and_video["photo1"] == "none")){ - $photoDelete1 = glob("../".$photo_and_video["photo1"]); // 「-ユーザーID.拡張子」というパターンを検索 - foreach ($photoDelete1 as $photo1) { - if (is_file($photo1)) { - unlink($photo1); - } - } - } - if(!($photo_and_video["photo2"] == "none")){ - $photoDelete2 = glob("../".$photo_and_video["photo2"]); // 「-ユーザーID.拡張子」というパターンを検索 - foreach ($photoDelete2 as $photo2) { - if (is_file($photo2)) { - unlink($photo2); - } - } - } - if(!($photo_and_video["photo3"] == "none")){ - $photoDelete3 = glob("../".$photo_and_video["photo3"]); // 「-ユーザーID.拡張子」というパターンを検索 - foreach ($photoDelete3 as $photo3) { - if (is_file($photo3)) { - unlink($photo3); - } - } - } - if(!($photo_and_video["photo4"] == "none")){ - $photoDelete4 = glob("../".$photo_and_video["photo4"]); // 「-ユーザーID.拡張子」というパターンを検索 - foreach ($photoDelete4 as $photo4) { - if (is_file($photo4)) { - unlink($photo4); - } - } - } - if(!($photo_and_video["video1"] == "none")){ - $videoDelete1 = glob("../".$photo_and_video["video1"]); // 「-ユーザーID.拡張子」というパターンを検索 - foreach ($videoDelete1 as $video1) { - if (is_file($video1)) { - unlink($video1); - } - } - } - - - try { - $deleteQuery = $pdo->prepare("DELETE FROM ueuse WHERE uniqid = :uniqid AND account = :userid"); - $deleteQuery->bindValue(':uniqid', $ueuseid, PDO::PARAM_STR); - $deleteQuery->bindValue(':userid', $Userid, PDO::PARAM_STR); - $res = $deleteQuery->execute(); - - if ($res) { - $response = array( - 'uniqid' => decode_yajirushi(htmlspecialchars_decode($ueuseid)), - 'userid' => decode_yajirushi(htmlspecialchars_decode($userData["userid"])), - 'success' => true - ); - - echo json_encode($response, JSON_UNESCAPED_UNICODE); - exit; - } else { - $response = array( - 'uniqid' => decode_yajirushi(htmlspecialchars_decode($ueuseid)), - 'userid' => decode_yajirushi(htmlspecialchars_decode($Userid)), - 'success' => false - ); - - echo json_encode($response, JSON_UNESCAPED_UNICODE); - exit; - } - } catch(PDOException $e) { - $response = array( - 'uniqid' => decode_yajirushi(htmlspecialchars_decode($ueuseid)), - 'userid' => decode_yajirushi(htmlspecialchars_decode($userData["userid"])), - 'success' => false - ); - - echo json_encode($response, JSON_UNESCAPED_UNICODE); - exit; - } + if (safetext(isset($ueuseid)) && safetext(isset($userData["userid"])) && safetext(isset($userData["loginid"]))){ + $postUserid = safetext($userData["userid"]); + $postUniqid = safetext($ueuseid); + $loginid = safetext($userData["loginid"]); + + $result = delete_ueuse($postUniqid, $postUserid, $loginid); + if($result[0] === true){ + $response = array( + 'uniqid' => decode_yajirushi(htmlspecialchars_decode($ueuseid)), + 'userid' => decode_yajirushi(htmlspecialchars_decode($userData["userid"])), + 'success' => true + ); + echo json_encode($response, JSON_UNESCAPED_UNICODE); + exit; + }else{ + $response = array( + 'uniqid' => decode_yajirushi(htmlspecialchars_decode($ueuseid)), + 'userid' => decode_yajirushi(htmlspecialchars_decode($userData["userid"])), + 'success' => false + ); + echo json_encode($response, JSON_UNESCAPED_UNICODE); + exit; } - - } else { - $err = "ueuse_not_found"; + }else{ + $err = "input_not_found"; $response = array( 'error_code' => $err, ); - + echo json_encode($response, JSON_UNESCAPED_UNICODE); - exit; } - } } }else{ diff --git a/api/users/follow.php b/api/users/follow.php index 8931672..b522917 100644 --- a/api/users/follow.php +++ b/api/users/follow.php @@ -118,53 +118,27 @@ if(isset($_GET['token']) || (!(empty($Get_Post_Json)))) { $updateQuery->bindValue(':follower', $newFollowerList, PDO::PARAM_STR); $updateQuery->bindValue(':userid', $Follow_userdata['userid'], PDO::PARAM_STR); $res = $updateQuery->execute(); - + // 自分のfollowカラムを更新 - $updateQuery = $pdo->prepare("UPDATE account SET follow = CONCAT_WS(',', follow, :follow) WHERE userid = :userid"); - $updateQuery->bindValue(':follow', $Follow_userdata["userid"], PDO::PARAM_STR); + $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(); - try { - $fromuserid = safetext($userid); - $touserid = safetext($Follow_userdata["userid"]); - $datetime = safetext(date("Y-m-d H:i:s")); - $msg = safetext("".$userid."さんにフォローされました。"); - $title = safetext("🎉".$userid."さんにフォローされました!🎉"); - $url = safetext("/@" . $userid . ""); - $userchk = safetext('none'); - - // 通知用SQL作成 - $stmt = $pdo->prepare("INSERT INTO notification (fromuserid, touserid, msg, url, datetime, userchk, title) VALUES (:fromuserid, :touserid, :msg, :url, :datetime, :userchk, :title)"); - - $stmt->bindParam(':fromuserid', $fromuserid, PDO::PARAM_STR); - $stmt->bindParam(':touserid', $touserid, PDO::PARAM_STR); - $stmt->bindParam(':msg', $msg, PDO::PARAM_STR); - $stmt->bindParam(':url', $url, PDO::PARAM_STR); - $stmt->bindParam(':userchk', $userchk, PDO::PARAM_STR); - $stmt->bindParam(':title', $title, PDO::PARAM_STR); - - $stmt->bindParam(':datetime', $datetime, PDO::PARAM_STR); - - // SQLクエリの実行 - $res = $stmt->execute(); - - // コミット - $res = $pdo->commit(); - - } catch(Exception $e) { - - // エラーが発生した時はロールバック - $pdo->rollBack(); - } + 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 { diff --git a/delete/delete.php b/delete/delete.php index ff3699b..80aa6c8 100644 --- a/delete/delete.php +++ b/delete/delete.php @@ -2,132 +2,19 @@ require('../db.php'); require("../function/function.php"); - if (safetext(isset($_POST['uniqid'])) && safetext(isset($_POST['userid'])) && safetext(isset($_POST['account_id']))){ $postUserid = safetext($_POST['userid']); $postUniqid = safetext($_POST['uniqid']); $loginid = safetext($_POST['account_id']); - try { - $option = array( - PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, - PDO::MYSQL_ATTR_MULTI_STATEMENTS => false - ); - $pdo = new PDO('mysql:charset=utf8mb4;dbname=' . DB_NAME . ';host=' . DB_HOST, DB_USER, DB_PASS, $option); - } catch (PDOException $e) { - // 接続エラーのときエラー内容を取得する - $error_message[] = $e->getMessage(); - } - - $query = $pdo->prepare('SELECT * FROM ueuse WHERE uniqid = :uniqid limit 1'); - $query->execute(array(':uniqid' => $postUniqid)); - $result = $query->fetch(); - - if($result > 0){ - if($result["account"] === $postUserid){ - $query = $pdo->prepare('SELECT * FROM account WHERE userid = :userid limit 1'); - $query->execute(array(':userid' => $postUserid)); - $result2 = $query->fetch(); - - if($result2["loginid"] === $loginid){ - $photo_query = $pdo->prepare("SELECT * FROM ueuse WHERE account = :userid AND uniqid = :uniqid"); - $photo_query->bindValue(':userid', $postUserid); - $photo_query->bindValue(':uniqid', $postUniqid); - $photo_query->execute(); - $photo_and_video = $photo_query->fetch(); - - if(!($photo_and_video["photo1"] == "none")){ - $photoDelete1 = glob($photo_and_video["photo1"]); // 「-ユーザーID.拡張子」というパターンを検索 - foreach ($photoDelete1 as $photo1) { - if (is_file($photo1)) { - unlink($photo1); - } - } - } - if(!($photo_and_video["photo2"] == "none")){ - $photoDelete2 = glob($photo_and_video["photo2"]); // 「-ユーザーID.拡張子」というパターンを検索 - foreach ($photoDelete2 as $photo2) { - if (is_file($photo2)) { - unlink($photo2); - } - } - } - if(!($photo_and_video["photo3"] == "none")){ - $photoDelete3 = glob($photo_and_video["photo3"]); // 「-ユーザーID.拡張子」というパターンを検索 - foreach ($photoDelete3 as $photo3) { - if (is_file($photo3)) { - unlink($photo3); - } - } - } - if(!($photo_and_video["photo4"] == "none")){ - $photoDelete4 = glob($photo_and_video["photo4"]); // 「-ユーザーID.拡張子」というパターンを検索 - foreach ($photoDelete4 as $photo4) { - if (is_file($photo4)) { - unlink($photo4); - } - } - } - if(!($photo_and_video["video1"] == "none")){ - $videoDelete1 = glob($photo_and_video["video1"]); // 「-ユーザーID.拡張子」というパターンを検索 - foreach ($videoDelete1 as $video1) { - if (is_file($video1)) { - unlink($video1); - } - } - } - - $ruChkquery = $pdo->prepare('SELECT * FROM ueuse WHERE ruuniqid = :uniqid AND ueuse = "" limit 1'); - $ruChkquery->execute(array(':uniqid' => $postUniqid)); - $result3 = $ruChkquery->fetch(); - - if($result3 > 0){ - try { - // 削除クエリを実行 - $rudeleteQuery = $pdo->prepare("DELETE FROM ueuse WHERE ruuniqid = :uniqid AND ueuse = ''"); - $rudeleteQuery->bindValue(':uniqid', $postUniqid, PDO::PARAM_STR); - $res = $rudeleteQuery->execute(); - - if (!($res)){ - $pdo->rollBack(); - $error_message[] = "リユーズの削除ができませんでした。"; - } - } catch(PDOException $e) { - $pdo->rollBack(); - $error_message[] = 'データベースエラー:' . $e->getMessage(); - } - } - - try { - // 削除クエリを実行 - $deleteQuery = $pdo->prepare("DELETE FROM ueuse WHERE uniqid = :uniqid AND account = :userid"); - $deleteQuery->bindValue(':uniqid', $postUniqid, PDO::PARAM_STR); - $deleteQuery->bindValue(':userid', $postUserid, PDO::PARAM_STR); - $res = $deleteQuery->execute(); - - if ($res) { - echo json_encode(['success' => true]); - exit; - } else { - $pdo->rollBack(); - echo json_encode(['success' => false, 'error' => '削除に失敗しました。']); - exit; - } - } catch(PDOException $e) { - $pdo->rollBack(); - echo json_encode(['success' => false, 'error' => 'データベースエラー:' . $e->getMessage()]); - exit; - } - } - }else{ - echo json_encode(['success' => false, 'error' => '削除に失敗しました。(userid_err)']); - exit; - } + $result = delete_ueuse($postUniqid, $postUserid, $loginid); + if($result[0] === true){ + echo json_encode(['success' => true]); + exit; }else{ - echo json_encode(['success' => true, 'error' => 'すでに削除されています']); + echo json_encode(['success' => false, 'error' => '削除に失敗しました。']); exit; } - }else{ echo json_encode(['success' => false, 'error' => '削除に失敗しました。(sess_err)']); exit; diff --git a/favorite/favorite.php b/favorite/favorite.php index 0fb52ea..e67cc2c 100644 --- a/favorite/favorite.php +++ b/favorite/favorite.php @@ -37,18 +37,21 @@ if (safetext(isset($_POST['uniqid'])) && safetext(isset($_POST['userid'])) && sa $pdo = new PDO('mysql:charset=utf8mb4;dbname='.DB_NAME.';host='.DB_HOST , DB_USER, DB_PASS); // 投稿のいいね情報を取得 - $stmt = $pdo->prepare("SELECT favorite FROM ueuse WHERE uniqid = :uniqid"); + $stmt = $pdo->prepare("SELECT account,ueuse,favorite FROM ueuse WHERE uniqid = :uniqid"); $stmt->bindValue(':uniqid', $postUniqid, PDO::PARAM_STR); $stmt->execute(); $post = $stmt->fetch(PDO::FETCH_ASSOC); - if ($post) { + if (!(empty($post))) { $favoriteList = explode(',', $post['favorite']); $index = array_search($userId, $favoriteList); if ($index === false) { // ユーザーIDを追加 $favoriteList[] = $userId; + + send_notification(safetext($post['account']),$userId,"".$userId."さんがいいねしました!",safetext($post['ueuse']),"/!".$postUniqid."","favorite"); + } else { // ユーザーIDを削除 array_splice($favoriteList, $index, 1); diff --git a/function/function.php b/function/function.php index 423f918..3d10972 100644 --- a/function/function.php +++ b/function/function.php @@ -189,16 +189,20 @@ function resizeImage($filePath, $maxWidth, $maxHeight) { } //文字装飾・URL変換など -function processMarkdownAndWrapEmptyLines($markdownText){ +function processMarkdownAndWrapEmptyLines($markdownText) { + $placeholders = []; - //\___________________[注意]__________________\ - // \____ここの順番を変えるとうまく動かなくなります___\ - // \______Markdownうまく動くところを探すべし______\ + // インラインコードをプレースホルダーに置き換える + $markdownText = preg_replace_callback('/`([^`\n]+)`/', function($matches) use (&$placeholders) { + $placeholder = 'PLACEHOLDER_' . count($placeholders); + $placeholders[$placeholder] = '' . $matches[1] . ''; + return $placeholder; + }, $markdownText); + + // ここから先の処理はインラインコードとコードブロックに影響しない $markdownText = preg_replace('/\[\[buruburu (.+)\]\]/m', '$1', $markdownText);//ぶるぶる - $markdownText = preg_replace('/(^|[^`])`([^`\n]+)`($|[^`])/m', '$1$2$3', $markdownText);//Inline Code - $markdownText = preg_replace_callback('/\[\[time (\d+)\]\]/m', function($matches) { $timestamp = $matches[1]; return '' . date("Y/m/d H:i", htmlentities($timestamp, ENT_QUOTES, 'UTF-8', false)) . ''; @@ -238,12 +242,18 @@ function processMarkdownAndWrapEmptyLines($markdownText){ // 箇条書き(-)をHTMLのul/liタグに変換 $markdownText = preg_replace('/^- (.+)/m', '

・ $1

', $markdownText); - + // 空行の前に何もない行をHTMLのpタグに変換 $markdownText = preg_replace('/(^\s*)(?!\s)(.*)/m', '$1

$2

', $markdownText); + // プレースホルダーを元のコードに戻す + foreach ($placeholders as $placeholder => $original) { + $markdownText = str_replace($placeholder, $original, $markdownText); + } + return $markdownText; } + //Profile function replaceProfileEmojiImages($postText) { $postText = str_replace(''', '\'', $postText); @@ -361,44 +371,76 @@ function YouTube_and_nicovideo_Links($postText) { // ドメイン部分を抽出 $parsedUrl = parse_url($url); if(!(empty($parsedUrl['host']))){ - if($parsedUrl['host'] == "youtube.com" || $parsedUrl['host'] == "youtu.be" || $parsedUrl['host'] == "www.youtube.com" || $parsedUrl['host'] == "m.youtube.com"){ + $video_time = "0"; + $video_id = ""; + if($parsedUrl['host'] == "youtube.com" || $parsedUrl['host'] == "youtu.be" || $parsedUrl['host'] == "www.youtube.com" || $parsedUrl['host'] == "m.youtube.com"){ if (isset($parsedUrl['query'])) { - if(false !== strpos($parsedUrl['query'], 'v=')) { - $video_id = str_replace('v=', '', htmlentities($parsedUrl['query'], ENT_QUOTES, 'UTF-8', false)); + // クエリ部分を連想配列に変換する + parse_str($parsedUrl['query'], $queryParams); + + // video_idの取得 + if (isset($queryParams['v'])) { + $video_id = safetext($queryParams['v']); $iframe = true; - }else{ - $video_id = str_replace('/', '', htmlentities($parsedUrl['path'], ENT_QUOTES, 'UTF-8', false)); + } else { + $video_id = str_replace('/', '', safetext($parsedUrl['path'])); $iframe = true; } + // video_timeの取得 + if (isset($queryParams['amp;t'])) { + $video_time = safetext($queryParams['amp;t']); + if(!(is_numeric($video_time))){ + $video_time = "0"; + } + } else { + $video_time = "0"; + } $video_id = str_replace('&', '?', $video_id); - }elseif(isset($parsedUrl['path'])){ - $video_id = str_replace('/', '', htmlentities($parsedUrl['path'], ENT_QUOTES, 'UTF-8', false)); + } elseif (isset($parsedUrl['path'])) { + $video_id = str_replace('/', '', safetext($parsedUrl['path'])); + $video_time = "0"; $iframe = true; - }else{ + } else { $video_id = ""; + $video_time = "0"; $iframe = false; } + // 不要な文字を削除してaタグを生成 - if($iframe == true){ - $link = ''; - }else{ + if ($iframe) { + $link = ''; + } else { $link = ""; } + // URLをドメインのみを表示するaタグで置き換え $postText = $link; }elseif($parsedUrl['host'] == "nicovideo.jp" || $parsedUrl['host'] == "www.nicovideo.jp"){ - if(isset($parsedUrl['path'])){ - $video_id = str_replace('/watch/', '', htmlentities($parsedUrl['path'], ENT_QUOTES, 'UTF-8', false)); + $video_id = str_replace('/watch/', '', safetext($parsedUrl['path'])); $iframe = true; }else{ $video_id = ""; $iframe = false; } + if (isset($parsedUrl['query'])) { + // クエリ部分を連想配列に変換する + parse_str($parsedUrl['query'], $queryParams); + + // video_timeの取得 + if (isset($queryParams['from'])) { + $video_time = safetext($queryParams['from']); + if(!(is_numeric($video_time))){ + $video_time = "0"; + } + } else { + $video_time = "0"; + } + } // 不要な文字を削除してaタグを生成 if($iframe == true){ - $link = ''; }else{ $link = ""; } @@ -559,7 +601,7 @@ function get_mentions_userid($postText) { return $mentionedUsers; } -function send_notification($to,$from,$title,$message,$url){ +function send_notification($to,$from,$title,$message,$url,$category){ // データベースに接続 try { $option = array( @@ -571,46 +613,63 @@ function send_notification($to,$from,$title,$message,$url){ return false; } - if(!(empty($pdo))){ - - $pdo->beginTransaction(); + $query = $pdo->prepare('SELECT * FROM account WHERE userid = :userid limit 1'); + $query->execute(array(':userid' => $from)); + $result = $query->fetch(); - try { - $fromuserid = htmlentities($from, ENT_QUOTES, 'UTF-8', false); - $touserid = htmlentities($to, ENT_QUOTES, 'UTF-8', false); - $datetime = date("Y-m-d H:i:s"); - $msg = htmlentities($message, ENT_QUOTES, 'UTF-8', false); - $title = htmlentities($title, ENT_QUOTES, 'UTF-8', false); - $url = htmlentities($url, ENT_QUOTES, 'UTF-8', false); - $userchk = 'none'; - - // 通知用SQL作成 - $stmt = $pdo->prepare("INSERT INTO notification (fromuserid, touserid, msg, url, datetime, userchk, title) VALUES (:fromuserid, :touserid, :msg, :url, :datetime, :userchk, :title)"); - - $stmt->bindParam(':fromuserid', $fromuserid, PDO::PARAM_STR); - $stmt->bindParam(':touserid', $touserid, PDO::PARAM_STR); - $stmt->bindParam(':msg', $msg, PDO::PARAM_STR); - $stmt->bindParam(':url', $url, PDO::PARAM_STR); - $stmt->bindParam(':userchk', $userchk, PDO::PARAM_STR); - $stmt->bindParam(':title', $title, PDO::PARAM_STR); - - $stmt->bindParam(':datetime', $datetime, PDO::PARAM_STR); - - $res = $stmt->execute(); - - $res = $pdo->commit(); - - if($res){ - return true; + $category_list = ["system","favorite","reply","reuse","ueuse","follow","mention","other"]; + if(in_array($category, $category_list)){ + if(in_array($category, explode(',', $result["notification_settings"])) || empty($result["notification_settings"]) || $category === "system" || $category === "other"){ + if(!(empty($pdo))){ + $pdo->beginTransaction(); + + try { + $fromuserid = safetext($from); + $touserid = safetext($to); + $datetime = date("Y-m-d H:i:s"); + $msg = safetext($message); + $title = safetext($title); + $url = safetext($url); + $userchk = 'none'; + $notification_category = safetext($category); + + // 通知用SQL作成 + $stmt = $pdo->prepare("INSERT INTO notification (fromuserid, touserid, msg, url, datetime, userchk, title, category) VALUES (:fromuserid, :touserid, :msg, :url, :datetime, :userchk, :title, :category)"); + + $stmt->bindParam(':fromuserid', $fromuserid, PDO::PARAM_STR); + $stmt->bindParam(':touserid', $touserid, PDO::PARAM_STR); + $stmt->bindParam(':msg', $msg, PDO::PARAM_STR); + $stmt->bindParam(':url', $url, PDO::PARAM_STR); + $stmt->bindParam(':userchk', $userchk, PDO::PARAM_STR); + $stmt->bindParam(':title', $title, PDO::PARAM_STR); + $stmt->bindParam(':category', $notification_category, PDO::PARAM_STR); + + $stmt->bindParam(':datetime', $datetime, PDO::PARAM_STR); + + $res = $stmt->execute(); + + $res = $pdo->commit(); + + if($res){ + return true; + }else{ + $pdo->rollBack(); + return false; + } + + } catch(Exception $e) { + $pdo->rollBack(); + return false; + } }else{ - $pdo->rollBack(); return false; } - - } catch(Exception $e) { - $pdo->rollBack(); - return false; + }else{ + // 受信しない設定なのでtrue + return true; } + }else{ + return false; } } // ユーズするとき全部この関数 @@ -904,7 +963,7 @@ function send_ueuse($userid,$rpUniqid,$ruUniqid,$ueuse,$photo1,$photo2,$photo3,$ $mentionedUsers = array_unique(get_mentions_userid($ueuse)); foreach ($mentionedUsers as $mentionedUser) { - send_notification($mentionedUser,$userid,"".$userid."さんにメンションされました!",$ueuse,"/!".$uniqid.""); + send_notification($mentionedUser,$userid,"".$userid."さんにメンションされました!",$ueuse,"/!".$uniqid."", "mention"); } } catch(Exception $e) { @@ -956,10 +1015,10 @@ function send_ueuse($userid,$rpUniqid,$ruUniqid,$ueuse,$photo1,$photo2,$photo3,$ $mentionedUsers = array_unique(get_mentions_userid($ueuse)); foreach ($mentionedUsers as $mentionedUser) { - send_notification($mentionedUser,$userid,"".$userid."さんにメンションされました!",$ueuse,"/!".$uniqid.""); + send_notification($mentionedUser,$userid,"".$userid."さんにメンションされました!",$ueuse,"/!".$uniqid."", "mention"); } - send_notification($touserid,$userid,"".$userid."さんが返信しました!",$ueuse,"/!".$uniqid.""); + send_notification($touserid,$userid,"".$userid."さんが返信しました!",$ueuse,"/!".$uniqid."", "reply"); } catch(Exception $e) { // エラーが発生した時はロールバック $pdo->rollBack(); @@ -1009,10 +1068,10 @@ function send_ueuse($userid,$rpUniqid,$ruUniqid,$ueuse,$photo1,$photo2,$photo3,$ $mentionedUsers = array_unique(get_mentions_userid($ueuse)); foreach ($mentionedUsers as $mentionedUser) { - send_notification($mentionedUser,$userid,"".$userid."さんにメンションされました!",$ueuse,"/!".$uniqid.""); + send_notification($mentionedUser,$userid,"".$userid."さんにメンションされました!",$ueuse,"/!".$uniqid."", "mention"); } - send_notification($touserid,$userid,"".$userid."さんがリユーズしました!",$ueuse,"/!".$uniqid.""); + send_notification($touserid,$userid,"".$userid."さんがリユーズしました!",$ueuse,"/!".$uniqid."", "reuse"); } catch(Exception $e) { // エラーが発生した時はロールバック @@ -1037,6 +1096,132 @@ function send_ueuse($userid,$rpUniqid,$ruUniqid,$ueuse,$photo1,$photo2,$photo3,$ } } } + +function delete_ueuse($uniqid, $userid, $account_id){ + if (safetext(isset($uniqid)) && safetext(isset($userid)) && safetext(isset($account_id))){ + $postUserid = safetext($userid); + $postUniqid = safetext($uniqid); + $loginid = safetext($account_id); + + try { + $option = array( + PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, + PDO::MYSQL_ATTR_MULTI_STATEMENTS => false + ); + $pdo = new PDO('mysql:charset=utf8mb4;dbname=' . DB_NAME . ';host=' . DB_HOST, DB_USER, DB_PASS, $option); + } catch (PDOException $e) { + // 接続エラーのときエラー内容を取得する + $error_message[] = $e->getMessage(); + } + + $query = $pdo->prepare('SELECT * FROM ueuse WHERE uniqid = :uniqid limit 1'); + $query->execute(array(':uniqid' => $postUniqid)); + $result = $query->fetch(); + + if($result > 0){ + if($result["account"] === $postUserid){ + $query = $pdo->prepare('SELECT * FROM account WHERE userid = :userid limit 1'); + $query->execute(array(':userid' => $postUserid)); + $result2 = $query->fetch(); + + if($result2["loginid"] === $loginid){ + $photo_query = $pdo->prepare("SELECT * FROM ueuse WHERE account = :userid AND uniqid = :uniqid"); + $photo_query->bindValue(':userid', $postUserid); + $photo_query->bindValue(':uniqid', $postUniqid); + $photo_query->execute(); + $photo_and_video = $photo_query->fetch(); + + if(!($photo_and_video["photo1"] == "none")){ + $photoDelete1 = glob($photo_and_video["photo1"]); // 「-ユーザーID.拡張子」というパターンを検索 + foreach ($photoDelete1 as $photo1) { + if (is_file($photo1)) { + unlink($photo1); + } + } + } + if(!($photo_and_video["photo2"] == "none")){ + $photoDelete2 = glob($photo_and_video["photo2"]); // 「-ユーザーID.拡張子」というパターンを検索 + foreach ($photoDelete2 as $photo2) { + if (is_file($photo2)) { + unlink($photo2); + } + } + } + if(!($photo_and_video["photo3"] == "none")){ + $photoDelete3 = glob($photo_and_video["photo3"]); // 「-ユーザーID.拡張子」というパターンを検索 + foreach ($photoDelete3 as $photo3) { + if (is_file($photo3)) { + unlink($photo3); + } + } + } + if(!($photo_and_video["photo4"] == "none")){ + $photoDelete4 = glob($photo_and_video["photo4"]); // 「-ユーザーID.拡張子」というパターンを検索 + foreach ($photoDelete4 as $photo4) { + if (is_file($photo4)) { + unlink($photo4); + } + } + } + if(!($photo_and_video["video1"] == "none")){ + $videoDelete1 = glob($photo_and_video["video1"]); // 「-ユーザーID.拡張子」というパターンを検索 + foreach ($videoDelete1 as $video1) { + if (is_file($video1)) { + unlink($video1); + } + } + } + + $ruChkquery = $pdo->prepare('SELECT * FROM ueuse WHERE ruuniqid = :uniqid AND ueuse = "" limit 1'); + $ruChkquery->execute(array(':uniqid' => $postUniqid)); + $result3 = $ruChkquery->fetch(); + + if($result3 > 0){ + try { + // 削除クエリを実行 + $rudeleteQuery = $pdo->prepare("DELETE FROM ueuse WHERE ruuniqid = :uniqid AND ueuse = ''"); + $rudeleteQuery->bindValue(':uniqid', $postUniqid, PDO::PARAM_STR); + $res = $rudeleteQuery->execute(); + + if (!($res)){ + $pdo->rollBack(); + $error_message[] = "リユーズの削除ができませんでした。"; + } + } catch(PDOException $e) { + $pdo->rollBack(); + $error_message[] = 'データベースエラー:' . $e->getMessage(); + } + } + + try { + // 削除クエリを実行 + $deleteQuery = $pdo->prepare("DELETE FROM ueuse WHERE uniqid = :uniqid AND account = :userid"); + $deleteQuery->bindValue(':uniqid', $postUniqid, PDO::PARAM_STR); + $deleteQuery->bindValue(':userid', $postUserid, PDO::PARAM_STR); + $res = $deleteQuery->execute(); + + if ($res) { + return [true, "削除に成功しました!"]; + } else { + $pdo->rollBack(); + return [false, "削除に失敗しました"]; + } + } catch(PDOException $e) { + $pdo->rollBack(); + return [false, "削除に失敗しました!"]; + } + } + }else{ + return [false, "削除に失敗しました!"]; + } + }else{ + return [true, "すでに削除しています"]; + } + }else{ + return [true, "削除に成功しました!"]; + } +} + function safetext($text){ // テキストの安全化 return htmlspecialchars($text, ENT_QUOTES, 'UTF-8', false); diff --git a/home/index.php b/home/index.php index 01097e1..a3cbc5a 100644 --- a/home/index.php +++ b/home/index.php @@ -1061,6 +1061,7 @@ $(document).ready(function() { document.cookie = "ueuse=" + encodeURIComponent($(this).val()) + "; Secure; SameSite=Lax; path=/home;"; }); loadEmojis(); + $("#emoji_picker_btn").click(function () { if ($("#emoji_picker_btn").prop("checked") == true) { $("#emoji_picker").show(); @@ -1081,10 +1082,11 @@ $(document).ready(function() { } }); var Emoji_pageNumber = 1; - var isLoading = false; + var isEmojiLoading = false; function loadEmojis() { - if (isLoading) return; - isLoading = true; + + if (isEmojiLoading) return; + isEmojiLoading = true; var search_query = ''; var viewmode = 'picker' @@ -1097,7 +1099,7 @@ $(document).ready(function() { success: function(response) { $('.emoji_picker_flex').append(response); Emoji_pageNumber++; - isLoading = false; + isEmojiLoading = false; if($("#error").length){ $("#error").hide(); } @@ -1105,7 +1107,7 @@ $(document).ready(function() { EmojiClickEvent(); }, error: function (xhr, textStatus, errorThrown) { // エラーと判定された場合 - isLoading = false; + isEmojiLoading = false; $("#error").show(); EmojiClickEvent(); }, diff --git a/others/account_migration.php b/others/account_migration.php index e3d8eec..28a4d4a 100644 --- a/others/account_migration.php +++ b/others/account_migration.php @@ -227,55 +227,61 @@ if( !empty($_POST['migration_submit']) ) { 'content' => http_build_query($data, '', '&') ] ]; - $Check_result = json_decode(file_get_contents("http://".$server_domain."/api/serverinfo-api", false, stream_context_create($options)),true); - if($Check_result["software"]["name"] == "uwuzu"){ - $version = str_pad(str_replace('.', '', $Check_result["software"]["version"]), 4, 0, STR_PAD_RIGHT); - - if($version >= 1360){ - if($Check_result["server_info"]["account_migration"] == "true"){ - $pdo->beginTransaction(); - try { - $account = $userid; - $migration_code = createUniqId(); - $encryption_key = random(32); - $encryption_ivkey = random(16); - $datetime = date("Y-m-d H:i:s"); - $domain = $server_domain; + $Get_Info = @file_get_contents("http://".$server_domain."/api/serverinfo-api", false, stream_context_create($options)); + if($Get_Info === false){ + $error_message[] = '入力されたサーバーがuwuzu以外のサーバーソフトウェア(MisskeyさんやMastodonさんなど)を使用しているかuwuzu v1.2.26未満のバージョンを使用している可能性があります。(MIGRATION_TO_SERVER_NOT_UWUZU)'; + }else{ + $Check_result = json_decode($Get_Info, true); + + if($Check_result["software"]["name"] == "uwuzu"){ + $version = str_pad(str_replace('.', '', $Check_result["software"]["version"]), 4, 0, STR_PAD_RIGHT); + + if($version >= 1360){ + if($Check_result["server_info"]["account_migration"] == "true"){ + $pdo->beginTransaction(); + try { + $account = $userid; + $migration_code = createUniqId(); + $encryption_key = random(32); + $encryption_ivkey = random(16); + $datetime = date("Y-m-d H:i:s"); + $domain = $server_domain; - $stmt = $pdo->prepare("INSERT INTO migration (account, domain, migration_code, encryption_key, encryption_ivkey, datetime) VALUES (:account, :domain, :migration_code, :encryption_key, :encryption_ivkey, :datetime)"); + $stmt = $pdo->prepare("INSERT INTO migration (account, domain, migration_code, encryption_key, encryption_ivkey, datetime) VALUES (:account, :domain, :migration_code, :encryption_key, :encryption_ivkey, :datetime)"); - $stmt->bindParam(':account', safetext($account), PDO::PARAM_STR); - $stmt->bindParam(':domain', safetext($domain), PDO::PARAM_STR); - $stmt->bindParam(':migration_code', safetext($migration_code), PDO::PARAM_STR); - $stmt->bindParam(':encryption_key', safetext($encryption_key), PDO::PARAM_STR); - $stmt->bindParam(':encryption_ivkey', safetext($encryption_ivkey), PDO::PARAM_STR); - $stmt->bindParam(':datetime', safetext($datetime), PDO::PARAM_STR); + $stmt->bindParam(':account', safetext($account), PDO::PARAM_STR); + $stmt->bindParam(':domain', safetext($domain), PDO::PARAM_STR); + $stmt->bindParam(':migration_code', safetext($migration_code), PDO::PARAM_STR); + $stmt->bindParam(':encryption_key', safetext($encryption_key), PDO::PARAM_STR); + $stmt->bindParam(':encryption_ivkey', safetext($encryption_ivkey), PDO::PARAM_STR); + $stmt->bindParam(':datetime', safetext($datetime), PDO::PARAM_STR); - $res = $stmt->execute(); + $res = $stmt->execute(); - $res = $pdo->commit(); + $res = $pdo->commit(); - } catch(Exception $e) { - $pdo->rollBack(); + } catch(Exception $e) { + $pdo->rollBack(); + } + if($res) { + $_SESSION["migration_code"] = safetext($migration_code); + $_SESSION["encryption_key"] = safetext($encryption_key); + $_SESSION["encryption_ivkey"] = safetext($encryption_ivkey); + header("Location: account_migration_done.php"); + exit; + }else{ + $error_message[] = $e->getMessage(); + } + }else{ + $error_message[] = "移行先のサーバーがアカウントの移行登録を拒否しているためアカウントの移行はできません。(MIGRATION_TO_SERVER_IYADA)"; } - if($res) { - $_SESSION["migration_code"] = safetext($migration_code); - $_SESSION["encryption_key"] = safetext($encryption_key); - $_SESSION["encryption_ivkey"] = safetext($encryption_ivkey); - header("Location: account_migration_done.php"); - exit; - }else{ - $error_message[] = $e->getMessage(); - } - }else{ - $error_message[] = "移行先のサーバーがアカウントの移行登録を拒否しているためアカウントの移行はできません。(MIGRATION_TO_SERVER_IYADA)"; - } - }else{ - $error_message[] = "移行先のサーバーのuwuzuバージョンが1.3.6未満のためアカウントの移行はできません。(MIGRATION_TO_SERVER_BAD_UWUZU_VERSION)"; - } - }else{ - $error_message[] = "移行先のサーバーのソフトウェアがuwuzuではありません。(MIGRATION_TO_SERVER_NOT_UWUZU)"; - } + }else{ + $error_message[] = "移行先のサーバーのuwuzuバージョンが1.3.6未満のためアカウントの移行はできません。(MIGRATION_TO_SERVER_BAD_UWUZU_VERSION)"; + } + }else{ + $error_message[] = "移行先のサーバーのソフトウェアがuwuzuではありません。(MIGRATION_TO_SERVER_NOT_UWUZU)"; + } + } } } diff --git a/passrecovery/startrecovery.php b/passrecovery/startrecovery.php index 57033ea..116e2d9 100644 --- a/passrecovery/startrecovery.php +++ b/passrecovery/startrecovery.php @@ -141,7 +141,7 @@ if(!($userid == null)){ if ($res) { $msg = "お使いのアカウントのパスワードがパスワードの復元により変更されました。\n変更した覚えがない場合はパスワードを変更し、セッショントークンを再生成してください。"; - send_notification($userid,"uwuzu-fromsys","🔴アカウントのパスワードが復元により変更されました。🔴",$msg,"/others"); + send_notification($userid,"uwuzu-fromsys","🔴アカウントのパスワードが復元により変更されました。🔴",$msg,"/others", "system"); $_SESSION['userid'] = ""; $url = 'donerecovery.php'; @@ -237,7 +237,7 @@ if(!($userid == null)){ if ($res) { $msg = "お使いのアカウントのパスワードがパスワードの復元により変更されました。\n変更した覚えがない場合はパスワードを変更し、セッショントークンを再生成してください。"; - send_notification($userid,"uwuzu-fromsys","🔴アカウントのパスワードが復元により変更されました。🔴",$msg,"/others"); + send_notification($userid,"uwuzu-fromsys","🔴アカウントのパスワードが復元により変更されました。🔴",$msg,"/others", "system"); $_SESSION['userid'] = ""; $url = 'donerecovery.php'; diff --git a/server/uwuzuabout.txt b/server/uwuzuabout.txt index 8f79eed..d48ac08 100644 --- a/server/uwuzuabout.txt +++ b/server/uwuzuabout.txt @@ -61,6 +61,7 @@ PHP 8では事前にGDを有効化しておいてください!(QRコードの - authcode(varchar(256)) 二段階認証用キー保存用 - backupcode(varchar(256)) 二段階認証のバックアップコード保存用 - sacinfo(varchar(256)) 特殊アカウント識別用 +- notification_settings(varchar(256)) 受け取る通知設定用 - mail_settings(mediumtext) メールの送信設定保存用 - encryption_ivkey(varchar(256)) ユーザーデータ暗号化時の暗号化ベクトル保存用 @@ -113,6 +114,7 @@ PHP 8では事前にGDを有効化しておいてください!(QRコードの - msg(mediumtext) 通知の内容 - datetime(datetime) 通知日時 - userchk(varchar(25)) 通知の既読確認 +- category(varchar(256)) 通知のカテゴリ識別用 ### report - sysid(INT)(AUTO_INCREMENT) 追加されるとカウントされるシステム用ID @@ -245,4 +247,4 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ## 更新情報 編集者 : daichimarukana -最終更新日 : 2024/03/26 22:32 \ No newline at end of file +最終更新日 : 2024/08/19 16:58 \ No newline at end of file diff --git a/server/uwuzuinfo.txt b/server/uwuzuinfo.txt index 170010e..e85497f 100644 --- a/server/uwuzuinfo.txt +++ b/server/uwuzuinfo.txt @@ -1,4 +1,4 @@ uwuzu -1.4.1 -2024/08/18 +1.4.2 +2024/08/19 daichimarukana,putonfps \ No newline at end of file diff --git a/server/uwuzurelease.txt b/server/uwuzurelease.txt index 526ff92..14df090 100644 --- a/server/uwuzurelease.txt +++ b/server/uwuzurelease.txt @@ -1,6 +1,21 @@ ## リリースノートだぜぇぇぇぇぇぇい!!!!!!! ここにはuwuzuの更新情報を載せてくぜぇ~!(いやまてテンションおかしいだろ...) +### Version 1.4.2 (Funium) +リリース日:2024/08/19 +fix: 絵文字ピッカーが使用できない問題を修正しました。 +fix: APIでユーズを削除した際にリユーズが残ってしまう問題を修正しました。 +fix: 通報ができない問題を修正しました! +fix: アカウント移行時にuwuzu以外のプラットフォームのドメインを入力された場合にエラーが発生してしまう問題の修正をしました! +fix: 自動アップデート画面にてupdate.jsonにかかれているリリースノートが正しく改行されない問題を修正しましたー! +chg: ユーズ内にYouTube、ニコニコ動画のリンクが含まれている際に?t=や?from=などの時間指定があった場合に埋め込みも時間指定がされるようにしました! +new: 受け取る通知を選べる機能を追加しました! + このアップデートによりDBの更新が必要です。 + データベースのaccountテーブルにnotification_settings(varchar(256))というカラムを追加してください。 + また、データベースのnotificationテーブルにcategory(varchar(256))というカラムを追加してください。 +new: いいねの通知を追加しました! +uwuzu_database.sqlは更新済みです。 + ### Version 1.4.1 (Funium) リリース日:2024/08/18 fix: 二段階認証を設定しているアカウントがログインできない問題を修正しました。 @@ -47,6 +62,7 @@ new: 投稿画面でクリップボードにある画像を貼り付けられる del: ueuse-api,userdata-api,ltl-apiを削除しました。セキュリティ上の観点からuwuzu 1.3.5、uwuzu 1.3.6のアップデート作業を行っていないサーバーは該当のファイルの削除を推奨します。 del: bot-apiを廃止しました。 del: ローカルタイムラインを廃止し、すべてホーム画面にまとめました。 +uwuzu_database.sqlは更新済みです。 ### Version 1.3.6 (new_Planet) リリース日:2024/04/24 @@ -221,18 +237,18 @@ new: サーバーヘッダー機能を実装しました! new: 分間投稿数にレート制限を設けました new: ユーズのMarkdown機能を大幅に更新しました! 以下に全てのuwuzu Markdown書式を記載します。 - - # [ここにテキスト] (h1サイズで文字を表示) - - ## [ここにテキスト] (h2サイズで文字を表示) - - ### [ここにテキスト] (h3サイズで文字を表示) - - [[buruburu [ここにテキスト]]] (文字をブルブルさせて表示) - - `[ここにテキスト]` (インラインコードとして表示) - - ***[ここにテキスト]*** (斜体と太字を適用して表示) - - **[ここにテキスト]** (太字を適用して表示) - - *[ここにテキスト]* (斜体を適用して表示) - - ~~[ここにテキスト]~~ (文字に取り消し線を入れて表示) - - >>> [ここにテキスト] (引用として表示) - - ||[ここにテキスト]|| (カーソルをのせて文字を表示) - - - [ここにテキスト] (箇条書きとして左に点を表示) + - `# [ここにテキスト] (h1サイズで文字を表示)` + - `## [ここにテキスト] (h2サイズで文字を表示)` + - `### [ここにテキスト] (h3サイズで文字を表示)` + - `[[buruburu [ここにテキスト]]] (文字をブルブルさせて表示)` + - ``[ここにテキスト]` (インラインコードとして表示)` + - `***[ここにテキスト]*** (斜体と太字を適用して表示)` + - `**[ここにテキスト]** (太字を適用して表示)` + - `*[ここにテキスト]* (斜体を適用して表示)` + - `~~[ここにテキスト]~~ (文字に取り消し線を入れて表示)` + - `>>> [ここにテキスト] (引用として表示)` + - `||[ここにテキスト]|| (カーソルをのせて文字を表示)` + - `- [ここにテキスト] (箇条書きとして左に点を表示)` new: 全てのエラーに明確なエラーコードを設定しました!(uwuzuで想定されているエラーのみ) new: ブックマーク機能を追加しました! これによりuwuzuのDB内、accountテーブルの構造に「bookmark」(mediumtext)を追加する必要があります! diff --git a/settings/index.php b/settings/index.php index 1470be9..a446d7d 100644 --- a/settings/index.php +++ b/settings/index.php @@ -205,24 +205,28 @@ if( !empty($pdo) ) { }else{ $view_mailadds = $userData["mailadds"]; } + + if(empty($userData["notification_settings"])){ + $notification_settings_list = ["system","favorite","reply","reuse","ueuse","follow","mention","other"]; + }else{ + $notification_settings_list = explode(',', $userData["notification_settings"]); + } } if( !empty($_POST['btn_submit']) ) { - if( !empty($_POST['im_bot']) ) { - $im_bot = safetext($_POST['im_bot']); - }else{ - $im_bot = "false"; - } - if($im_bot === "true"){ - $saveim_bot = "bot"; + if(!(empty($_POST['im_bot']))){ + if($_POST['im_bot'] == "on"){ + $saveim_bot = "bot"; + }else{ + $saveim_bot = "none"; + } }else{ $saveim_bot = "none"; } - // 空白除去 $username = safetext($_POST['username']); $mailadds = safetext($_POST['mailadds']); @@ -675,6 +679,72 @@ if( !empty($_POST['auth_off_submit']) ) { } } + +if( !empty($_POST['notification_submit']) ) { + $New_notification_list = ["system", "other"]; + + if(!(empty($_POST['notification_favorite']))){ + if($_POST['notification_favorite'] == "on"){ + $New_notification_list[] = "favorite"; + } + } + + if(!(empty($_POST['notification_reuse']))){ + if($_POST['notification_reuse'] == "on"){ + $New_notification_list[] = "reuse"; + } + } + + if(!(empty($_POST['notification_reply']))){ + if($_POST['notification_reply'] == "on"){ + $New_notification_list[] = "reply"; + } + } + + if(!(empty($_POST['notification_mention']))){ + if($_POST['notification_mention'] == "on"){ + $New_notification_list[] = "mention"; + } + } + + if(!(empty($_POST['notification_follow']))){ + if($_POST['notification_follow'] == "on"){ + $New_notification_list[] = "follow"; + } + } + + if( empty($error_message) ) { + $Save_notification_list = implode(',', array_unique($New_notification_list)); + + // トランザクション開始 + $pdo->beginTransaction(); + + try { + $stmt = $pdo->prepare("UPDATE account SET notification_settings = :notification_settings WHERE userid = :userid"); + $stmt->bindValue(':notification_settings', $Save_notification_list, PDO::PARAM_STR); + $stmt->bindValue(':userid', $userid, PDO::PARAM_STR); + + $res = $stmt->execute(); + + // コミット + $res = $pdo->commit(); + } catch (Exception $e) { + $pdo->rollBack(); + } + + if ($res) { + $url = (empty($_SERVER['HTTPS']) ? 'http://' : 'https://') . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; + header("Location:".$url.""); + exit; + } else { + $error_message[] = '更新に失敗しました。(REGISTERED_DAME)'; + } + + // プリペアドステートメントを削除 + $stmt = null; + } +} + // データベースの接続を閉じる $pdo = null; @@ -753,13 +823,8 @@ $pdo = null;

このアカウントがBotであることを公開する

- - - - - - - + checked/> +
@@ -816,6 +881,46 @@ $pdo = null; +
+

通知

+ +

いいね

+
ユーズがいいねされた時に通知されます。
+
+ checked/> + +
+ +

リユーズ

+
ユーズがリユーズまたは引用リユーズされた時に通知されます。
+
+ checked/> + +
+ +

返信

+
ユーズに返信が来た時に通知されます。
+
+ checked/> + +
+ +

メンション

+
メンションされた時に通知されます。
+
+ checked/> + +
+ +

フォロー

+
フォローされた時に通知されます。
+
+ checked/> + +
+ + + diff --git a/settings_admin/update_admin.php b/settings_admin/update_admin.php index 77bae3f..57acf10 100644 --- a/settings_admin/update_admin.php +++ b/settings_admin/update_admin.php @@ -266,7 +266,10 @@ require('../logout/logout.php');

ここからuwuzuのアップデートが行えます。
データベースの構造に変更を加える必要のあるアップデートの場合、データベースの構造の変更を手動で行っていただいた後にここからuwuzu自体のアップデートが行えます。
uwuzuは一度アップデートするともとの状態に戻すことはできません。
- また、アップデート中に発生したエラーや不具合に関してuwuzu開発者が責任を取ることはできません。

+ また、アップデート中に発生したエラーや不具合に関してuwuzu開発者が責任を取ることはできません。
+
+ 飛び級アップデートはuwuzuが破損するため絶対にしないでください。 +