mirror of
https://github.com/Daichimarukana/uwuzu.git
synced 2026-06-05 03:24:41 +00:00
uwuzu v1.4.2 Funium
This commit is contained in:
+2
-1
@@ -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) {
|
||||
|
||||
+2
-26
@@ -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";
|
||||
$category = "system";
|
||||
|
||||
$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();
|
||||
}
|
||||
send_notification($from_userid,$account,$title,$msg,$url,$category);
|
||||
|
||||
if ($res) {
|
||||
$item = array(
|
||||
|
||||
+10
-84
@@ -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');
|
||||
if (safetext(isset($ueuseid)) && safetext(isset($userData["userid"])) && safetext(isset($userData["loginid"]))){
|
||||
$postUserid = safetext($userData["userid"]);
|
||||
$postUniqid = safetext($ueuseid);
|
||||
$loginid = safetext($userData["loginid"]);
|
||||
|
||||
$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) {
|
||||
$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($Userid)),
|
||||
'success' => false
|
||||
);
|
||||
|
||||
echo json_encode($response, JSON_UNESCAPED_UNICODE);
|
||||
exit;
|
||||
}
|
||||
} catch(PDOException $e) {
|
||||
}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{
|
||||
|
||||
+8
-34
@@ -120,51 +120,25 @@ if(isset($_GET['token']) || (!(empty($Get_Post_Json)))) {
|
||||
$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 {
|
||||
|
||||
+3
-116
@@ -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) {
|
||||
$result = delete_ueuse($postUniqid, $postUserid, $loginid);
|
||||
if($result[0] === true){
|
||||
echo json_encode(['success' => true]);
|
||||
exit;
|
||||
} else {
|
||||
$pdo->rollBack();
|
||||
}else{
|
||||
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;
|
||||
}
|
||||
}else{
|
||||
echo json_encode(['success' => true, 'error' => 'すでに削除されています']);
|
||||
exit;
|
||||
}
|
||||
|
||||
}else{
|
||||
echo json_encode(['success' => false, 'error' => '削除に失敗しました。(sess_err)']);
|
||||
exit;
|
||||
|
||||
@@ -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);
|
||||
|
||||
+218
-33
@@ -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] = '<span class="inline">' . $matches[1] . '</span>';
|
||||
return $placeholder;
|
||||
}, $markdownText);
|
||||
|
||||
// ここから先の処理はインラインコードとコードブロックに影響しない
|
||||
|
||||
$markdownText = preg_replace('/\[\[buruburu (.+)\]\]/m', '<span class="buruburu">$1</span>', $markdownText);//ぶるぶる
|
||||
|
||||
$markdownText = preg_replace('/(^|[^`])`([^`\n]+)`($|[^`])/m', '$1<span class="inline">$2</span>$3', $markdownText);//Inline Code
|
||||
|
||||
$markdownText = preg_replace_callback('/\[\[time (\d+)\]\]/m', function($matches) {
|
||||
$timestamp = $matches[1];
|
||||
return '<span class="unixtime" title="'.date("Y/m/d H:i.s", htmlentities($timestamp, ENT_QUOTES, 'UTF-8', false)).'">' . date("Y/m/d H:i", htmlentities($timestamp, ENT_QUOTES, 'UTF-8', false)) . '</span>';
|
||||
@@ -242,8 +246,14 @@ function processMarkdownAndWrapEmptyLines($markdownText){
|
||||
// 空行の前に何もない行をHTMLのpタグに変換
|
||||
$markdownText = preg_replace('/(^\s*)(?!\s)(.*)/m', '$1<p>$2</p>', $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 = '<iframe src="https://www.youtube-nocookie.com/embed/'.$video_id.'" rel="0" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>';
|
||||
}else{
|
||||
if ($iframe) {
|
||||
$link = '<iframe src="https://www.youtube-nocookie.com/embed/'.$video_id.'?start='.$video_time.'" rel="0" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>';
|
||||
} 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 = '<iframe src="https://embed.nicovideo.jp/watch/'.$video_id.'"</iframe>';
|
||||
$link = '<iframe src="https://embed.nicovideo.jp/watch/'.$video_id.'?from='.$video_time.'"</iframe>';
|
||||
}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,21 +613,28 @@ function send_notification($to,$from,$title,$message,$url){
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!(empty($pdo))){
|
||||
$query = $pdo->prepare('SELECT * FROM account WHERE userid = :userid limit 1');
|
||||
$query->execute(array(':userid' => $from));
|
||||
$result = $query->fetch();
|
||||
|
||||
$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 = htmlentities($from, ENT_QUOTES, 'UTF-8', false);
|
||||
$touserid = htmlentities($to, ENT_QUOTES, 'UTF-8', false);
|
||||
$fromuserid = safetext($from);
|
||||
$touserid = safetext($to);
|
||||
$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);
|
||||
$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) VALUES (:fromuserid, :touserid, :msg, :url, :datetime, :userchk, :title)");
|
||||
$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);
|
||||
@@ -593,6 +642,7 @@ function send_notification($to,$from,$title,$message,$url){
|
||||
$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);
|
||||
|
||||
@@ -611,6 +661,15 @@ function send_notification($to,$from,$title,$message,$url){
|
||||
$pdo->rollBack();
|
||||
return false;
|
||||
}
|
||||
}else{
|
||||
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);
|
||||
|
||||
+7
-5
@@ -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();
|
||||
},
|
||||
|
||||
@@ -227,7 +227,12 @@ 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);
|
||||
$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);
|
||||
|
||||
@@ -277,6 +282,7 @@ if( !empty($_POST['migration_submit']) ) {
|
||||
$error_message[] = "移行先のサーバーのソフトウェアがuwuzuではありません。(MIGRATION_TO_SERVER_NOT_UWUZU)";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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
|
||||
最終更新日 : 2024/08/19 16:58
|
||||
@@ -1,4 +1,4 @@
|
||||
uwuzu
|
||||
1.4.1
|
||||
2024/08/18
|
||||
1.4.2
|
||||
2024/08/19
|
||||
daichimarukana,putonfps
|
||||
+28
-12
@@ -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)を追加する必要があります!
|
||||
|
||||
+118
-13
@@ -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"){
|
||||
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;
|
||||
|
||||
<p>このアカウントがBotであることを公開する</p>
|
||||
<div class="switch_button">
|
||||
<?php if($sacinfo === "bot"){?>
|
||||
<input id="im_bot" class="switch_input" type='checkbox' name="im_bot" value="true" checked/>
|
||||
<input id="im_bot" class="switch_input" type='checkbox' name="im_bot" <?php if($sacinfo === "bot"){?>checked<?php }?>/>
|
||||
<label for="im_bot" class="switch_label"></label>
|
||||
<?php }else{?>
|
||||
<input id="im_bot" class="switch_input" type='checkbox' name="im_bot" value="true" />
|
||||
<label for="im_bot" class="switch_label"></label>
|
||||
<?php }?>
|
||||
</div>
|
||||
|
||||
<?php }elseif($userData['token']==='ice'){ ?>
|
||||
@@ -816,6 +881,46 @@ $pdo = null;
|
||||
<input type="submit" class = "irobutton" name="auth_off_submit" value="二段階認証の解除">
|
||||
<?php } ?>
|
||||
|
||||
<hr>
|
||||
<h1>通知</h1>
|
||||
|
||||
<p>いいね</p>
|
||||
<div class="p2">ユーズがいいねされた時に通知されます。</div>
|
||||
<div class="switch_button">
|
||||
<input id="notification_favorite" class="switch_input" type='checkbox' name="notification_favorite" <?php if(in_array("favorite",$notification_settings_list)){?>checked<?php }?>/>
|
||||
<label for="notification_favorite" class="switch_label"></label>
|
||||
</div>
|
||||
|
||||
<p>リユーズ</p>
|
||||
<div class="p2">ユーズがリユーズまたは引用リユーズされた時に通知されます。</div>
|
||||
<div class="switch_button">
|
||||
<input id="notification_reuse" class="switch_input" type='checkbox' name="notification_reuse" <?php if(in_array("reuse",$notification_settings_list)){?>checked<?php }?>/>
|
||||
<label for="notification_reuse" class="switch_label"></label>
|
||||
</div>
|
||||
|
||||
<p>返信</p>
|
||||
<div class="p2">ユーズに返信が来た時に通知されます。</div>
|
||||
<div class="switch_button">
|
||||
<input id="notification_reply" class="switch_input" type='checkbox' name="notification_reply" <?php if(in_array("reply",$notification_settings_list)){?>checked<?php }?>/>
|
||||
<label for="notification_reply" class="switch_label"></label>
|
||||
</div>
|
||||
|
||||
<p>メンション</p>
|
||||
<div class="p2">メンションされた時に通知されます。</div>
|
||||
<div class="switch_button">
|
||||
<input id="notification_mention" class="switch_input" type='checkbox' name="notification_mention" <?php if(in_array("mention",$notification_settings_list)){?>checked<?php }?>/>
|
||||
<label for="notification_mention" class="switch_label"></label>
|
||||
</div>
|
||||
|
||||
<p>フォロー</p>
|
||||
<div class="p2">フォローされた時に通知されます。</div>
|
||||
<div class="switch_button">
|
||||
<input id="notification_follow" class="switch_input" type='checkbox' name="notification_follow" <?php if(in_array("follow",$notification_settings_list)){?>checked<?php }?>/>
|
||||
<label for="notification_follow" class="switch_label"></label>
|
||||
</div>
|
||||
|
||||
<input type="submit" class = "irobutton" name="notification_submit" value="通知の設定&更新">
|
||||
|
||||
</form>
|
||||
</main>
|
||||
|
||||
|
||||
@@ -266,7 +266,10 @@ require('../logout/logout.php');
|
||||
<p>ここからuwuzuのアップデートが行えます。<br>
|
||||
データベースの構造に変更を加える必要のあるアップデートの場合、データベースの構造の変更を手動で行っていただいた後にここからuwuzu自体のアップデートが行えます。<br>
|
||||
uwuzuは一度アップデートするともとの状態に戻すことはできません。<br>
|
||||
また、アップデート中に発生したエラーや不具合に関してuwuzu開発者が責任を取ることはできません。</p>
|
||||
また、アップデート中に発生したエラーや不具合に関してuwuzu開発者が責任を取ることはできません。<br>
|
||||
<br>
|
||||
飛び級アップデートはuwuzuが破損するため絶対にしないでください。
|
||||
</p>
|
||||
|
||||
|
||||
<label class="irobutton" for="file_upload">ファイル選択
|
||||
@@ -336,8 +339,8 @@ $(document).ready(function(){
|
||||
$("#software").text(response["software_name"]);
|
||||
$("#version").text(response["version"]);
|
||||
|
||||
$("#release_notes").html(response["release_notes"].replace("\n", "<br>"));
|
||||
$("#notices").html(response["notices"].replace("\n", "<br>"));
|
||||
$("#release_notes").html(response["release_notes"].replace(/\n/g, '<br>'));
|
||||
$("#notices").html(response["notices"].replace(/\n/g, '<br>'));
|
||||
|
||||
$("#confirm_update").show();
|
||||
} else {
|
||||
|
||||
+11
-5
@@ -984,10 +984,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'
|
||||
@@ -1000,11 +1001,16 @@ $(document).ready(function() {
|
||||
success: function(response) {
|
||||
$('.emoji_picker_flex').append(response);
|
||||
Emoji_pageNumber++;
|
||||
isLoading = false;
|
||||
isEmojiLoading = false;
|
||||
if($("#error").length){
|
||||
$("#error").hide();
|
||||
}
|
||||
|
||||
EmojiClickEvent();
|
||||
},
|
||||
error: function (xhr, textStatus, errorThrown) { // エラーと判定された場合
|
||||
isLoading = false;
|
||||
isEmojiLoading = false;
|
||||
$("#error").show();
|
||||
EmojiClickEvent();
|
||||
},
|
||||
});
|
||||
|
||||
+18
-5
@@ -1,13 +1,26 @@
|
||||
{
|
||||
"software": "uwuzu",
|
||||
"version": "1.4.1",
|
||||
"release_date": "2024-08-18",
|
||||
"release_notes": "このアップデートでは二段階認証を設定しているユーザーがログインできない問題を修正しました。\n他の変更点はありません。",
|
||||
"notices": "アップデートの前に、データのバックアップを行うことをおすすめします!",
|
||||
"version": "1.4.2",
|
||||
"release_date": "2024-08-19",
|
||||
"release_notes": "このアップデートでは、絵文字ピッカーが使用できない問題やAPIの問題、通報ができない問題などを修正しました!\n\nまた、次の変更と新機能が追加されています。\nYouTubeとニコニコ動画の動画埋め込みの時間指定に対応\n受け取る通知を選べる機能を追加\nいいねの通知を追加\n\n新しいバージョンのuwuzuをお楽しみください!",
|
||||
"notices": "事前にデータベースの構造の追加が必要です。\nリリースノートに従ってデータベースの構造を追加したうえでアップデートをしてください。\nアップデートの前に、データのバックアップを行うことをおすすめします!",
|
||||
"files": {
|
||||
"overwrite": [
|
||||
"/authlogin.php",
|
||||
"/abi/addabi.php",
|
||||
"/api/migration-api.php",
|
||||
"/api/users/follow.php",
|
||||
"/api/ueuse/delete.php",
|
||||
"/delete/delete.php",
|
||||
"/favorite/favorite.php",
|
||||
"/function/function.php",
|
||||
"/home/index.php",
|
||||
"/others/account_migration.php",
|
||||
"/passrecovery/startrecovery.php",
|
||||
"/settings/index.php",
|
||||
"/settings_admin/update_admin.php",
|
||||
"/ueuse/index.php",
|
||||
"/user/index.php",
|
||||
"/user/report.php",
|
||||
"/server/uwuzuabout.txt",
|
||||
"/server/uwuzuinfo.txt",
|
||||
"/server/uwuzurelease.txt"
|
||||
|
||||
+1
-1
@@ -333,7 +333,7 @@ if (!empty($_POST['follow'])) {
|
||||
$updateQuery->bindValue(':userid', $userid, PDO::PARAM_STR);
|
||||
$res_follow = $updateQuery->execute();
|
||||
|
||||
send_notification($userData["userid"], $userid, "🎉" . $userid . "さんにフォローされました!🎉", "" . $userid . "さんにフォローされました。", "/@" . $userid . "");
|
||||
send_notification($userData["userid"], $userid, "🎉" . $userid . "さんにフォローされました!🎉", "" . $userid . "さんにフォローされました。", "/@" . $userid . "", "follow");
|
||||
|
||||
if ($res && $res_follow) {
|
||||
$pdo->commit();
|
||||
|
||||
+2
-95
@@ -178,13 +178,6 @@ $notiData = $notiQuery->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
$notificationcount = $notiData['notification_count'];
|
||||
|
||||
function customStripTags($html, $allowedTags) {
|
||||
$allowedTagsString = '<' . implode('><', $allowedTags) . '>';
|
||||
return strip_tags($html, $allowedTagsString);
|
||||
}
|
||||
|
||||
$allowedTags = array('h1', 'h2', 'h3', 'center', 'font');
|
||||
|
||||
if( !empty($pdo) ) {
|
||||
|
||||
// データベース接続の設定
|
||||
@@ -200,68 +193,6 @@ if( !empty($pdo) ) {
|
||||
$uwuzuid = "";
|
||||
}
|
||||
|
||||
// ユーズ内の絵文字を画像に置き換える
|
||||
function replaceEmojisWithImages($postText) {
|
||||
// ユーズ内で絵文字名(:emoji:)を検出して画像に置き換える
|
||||
$emojiPattern = '/:(\w+):/';
|
||||
$postTextWithImages = preg_replace_callback($emojiPattern, function($matches) {
|
||||
$emojiName = $matches[1];
|
||||
return "<img src='../emoji/emojiimage.php?emoji=" . urlencode($emojiName) . "' alt=':$emojiName:' title=':$emojiName:'>";
|
||||
}, $postText);
|
||||
|
||||
// @username を検出してリンクに置き換える
|
||||
$usernamePattern = '/@(\w+)/';
|
||||
$postTextWithImagesAndUsernames = preg_replace_callback($usernamePattern, function($matches) {
|
||||
$username = $matches[1];
|
||||
|
||||
$dbh = new PDO('mysql:charset=utf8mb4;dbname='.DB_NAME.';host='.DB_HOST, DB_USER, DB_PASS, array(
|
||||
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
|
||||
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
|
||||
PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => true,
|
||||
));
|
||||
|
||||
$mentionsuserQuery = $dbh->prepare("SELECT username, userid FROM account WHERE userid = :userid");
|
||||
$mentionsuserQuery->bindValue(':userid', $username);
|
||||
$mentionsuserQuery->execute();
|
||||
$mentionsuserData = $mentionsuserQuery->fetch();
|
||||
|
||||
if(empty($mentionsuserData)){
|
||||
return "@$username";
|
||||
}else{
|
||||
return "<a class = 'mta' href='/@".$mentionsuserData["userid"]."'>@".$mentionsuserData["username"]."</a>";
|
||||
}
|
||||
}, $postTextWithImages);
|
||||
|
||||
$hashtagsPattern = '/#([\p{Han}\p{Hiragana}\p{Katakana}A-Za-z0-9_]+)/u';
|
||||
$postTextWithHashtags = preg_replace_callback($hashtagsPattern, function($matches) {
|
||||
$hashtags = $matches[1];
|
||||
return "<a class = 'hashtags' href='/search?q=".urlencode('#').$hashtags."'>".'#'.$hashtags."</a>";
|
||||
}, $postTextWithImagesAndUsernames);
|
||||
|
||||
return $postTextWithHashtags;
|
||||
}
|
||||
|
||||
function replaceURLsWithLinks($postText) {
|
||||
// URLを正規表現を使って検出
|
||||
$pattern = '/(https?:\/\/[^\s]+)/';
|
||||
preg_match_all($pattern, $postText, $matches);
|
||||
|
||||
// 検出したURLごとに処理を行う
|
||||
foreach ($matches[0] as $url) {
|
||||
// ドメイン部分を抽出
|
||||
$parsedUrl = parse_url($url);
|
||||
$domain = isset($parsedUrl['host']) ? $parsedUrl['host'] : '';
|
||||
|
||||
// ドメインのみを表示するaタグを生成
|
||||
$link = "<a href='$url'>$domain</a>";
|
||||
|
||||
// URLをドメインのみを表示するaタグで置き換え
|
||||
$postText = str_replace($url, $link, $postText);
|
||||
}
|
||||
|
||||
return $postText;
|
||||
}
|
||||
|
||||
$userQuery = $dbh->prepare("SELECT username, userid, profile, role, follower FROM account WHERE userid = :userid");
|
||||
$userQuery->bindValue(':userid', $uwuzuid);
|
||||
$userQuery->execute();
|
||||
@@ -319,38 +250,14 @@ if (!empty($_POST['report'])) {
|
||||
|
||||
$pdo->beginTransaction();
|
||||
|
||||
try {
|
||||
$fromuserid = $userid;
|
||||
$touserid2 = $to_admin["userid"];//管理者宛通知
|
||||
$datetime = date("Y-m-d H:i:s");
|
||||
$msg = "通報情報をご確認ください!";
|
||||
$title = "🚨" . $touserid . "さんが通報されました!🚨";
|
||||
$url = "/settings_admin/useradmin";
|
||||
$userchk = 'none';
|
||||
$category = "system";
|
||||
|
||||
// 通知用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', safetext('uwuzu-fromsys'), PDO::PARAM_STR);
|
||||
$stmt->bindParam(':touserid', safetext($touserid2), PDO::PARAM_STR);
|
||||
$stmt->bindParam(':msg', $msg, PDO::PARAM_STR);
|
||||
$stmt->bindParam(':url', safetext($url), PDO::PARAM_STR);
|
||||
$stmt->bindParam(':userchk', safetext($userchk), PDO::PARAM_STR);
|
||||
$stmt->bindParam(':title', safetext($title), PDO::PARAM_STR);
|
||||
|
||||
$stmt->bindParam(':datetime', safetext($datetime), PDO::PARAM_STR);
|
||||
|
||||
// SQLクエリの実行
|
||||
$res = $stmt->execute();
|
||||
|
||||
// コミット
|
||||
$res = $pdo->commit();
|
||||
|
||||
} catch(Exception $e) {
|
||||
|
||||
// エラーが発生した時はロールバック
|
||||
$pdo->rollBack();
|
||||
}
|
||||
send_notification($fromuserid, $touserid2, $title, $msg, $url, $category);
|
||||
|
||||
}
|
||||
|
||||
|
||||
+4
-2
@@ -3,7 +3,7 @@
|
||||
-- https://www.phpmyadmin.net/
|
||||
--
|
||||
-- ホスト: 127.0.0.1
|
||||
-- 生成日時: 2024-08-18 13:04:27
|
||||
-- 生成日時: 2024-08-19 10:03:35
|
||||
-- サーバのバージョン: 10.4.32-MariaDB
|
||||
-- PHP のバージョン: 8.2.12
|
||||
|
||||
@@ -48,6 +48,7 @@ CREATE TABLE `account` (
|
||||
`authcode` varchar(256) NOT NULL,
|
||||
`backupcode` varchar(256) NOT NULL,
|
||||
`sacinfo` varchar(256) NOT NULL,
|
||||
`notification_settings` varchar(256) NOT NULL,
|
||||
`mail_settings` mediumtext NOT NULL,
|
||||
`encryption_ivkey` varchar(256) NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
@@ -141,7 +142,8 @@ CREATE TABLE `notification` (
|
||||
`url` varchar(512) NOT NULL,
|
||||
`datetime` datetime NOT NULL,
|
||||
`userchk` varchar(32) NOT NULL,
|
||||
`title` varchar(1024) NOT NULL
|
||||
`title` varchar(1024) NOT NULL,
|
||||
`category` varchar(256) NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user