diff --git a/.well-known/host-meta/index.php b/.well-known/host-meta/index.php new file mode 100644 index 0000000..3e952ab --- /dev/null +++ b/.well-known/host-meta/index.php @@ -0,0 +1,13 @@ +'; + echo ''; + echo ''; + echo ''; +} +?> \ No newline at end of file diff --git a/.well-known/nodeinfo/index.php b/.well-known/nodeinfo/index.php new file mode 100644 index 0000000..fb8d878 --- /dev/null +++ b/.well-known/nodeinfo/index.php @@ -0,0 +1,19 @@ + [ + array( + "rel" => "http://nodeinfo.diaspora.software/ns/schema/2.1", + "href" => "https://".$domain."/nodeinfo/2.1", + ), + ], + ); + + echo json_encode($item, JSON_UNESCAPED_UNICODE); +} +?> \ No newline at end of file diff --git a/.well-known/webfinger/index.php b/.well-known/webfinger/index.php new file mode 100644 index 0000000..508d537 --- /dev/null +++ b/.well-known/webfinger/index.php @@ -0,0 +1,39 @@ + 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(); + } + + $user = htmlentities($_GET['resource']); + + $userid = str_replace('@','', str_replace('@'.$domain.'', '', $user)); + + $item = array( + "subject" => "acct:".$userid.'@'.$domain.'', + "links" => [ + array( + "rel" => "self", + "type" => "application/activity+json", + "href" => "https://".$domain."/actor/?actor=@".$userid.'', + ), + ], + ); + + echo json_encode($item, JSON_UNESCAPED_UNICODE); +} +?> \ No newline at end of file diff --git a/README.md b/README.md index 4d3204d..08fb61a 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,7 @@ PHP 8では事前にGDを有効化しておいてください!(QRコードの - datetime(datetime) アカウント作成日時保存用 - follow(text) アカウントがフォローしている人保存用 - follower(text) アカウントがフォローされている人保存用 +- blocklist(text) ブロックしている人保存用 - admin(varchar(25)) 管理者アカウントなら「yes」、それ以外なら「none」と入力。 - authcode(varchar(256)) 二段階認証用キー保存用 - backupcode(varchar(256)) 二段階認証のバックアップコード保存用 @@ -119,10 +120,10 @@ PHP 8では事前にGDを有効化しておいてください!(QRコードの - 404imagepath.txt : 404ページに表示する画像パス保存用 - 503imagepath.txt : 503ページに表示する画像パス保存用 +- activitypub.txt : ActivityPub機能のオンオフ(trueまたはfalse) - admininfo.txt : 管理者名(てすとまる/@sampledayo) - banurldomain.txt : 投稿禁止URLドメイン - banuserid.txt : 登録禁止ユーザーid -- admininfo.txt : 管理者名(てすとまる/@sampledayo) - contact.txt : 管理者への連絡用メアド(sample@test.com) - info.txt : サーバー登録時に表示されるメッセージ(好きな内容) - privacypolicy.txt : プライバシーポリシー(サーバーのプライバシーポリシーを記載) diff --git a/abi/addabi.php b/abi/addabi.php index 2b73520..3adec74 100644 --- a/abi/addabi.php +++ b/abi/addabi.php @@ -1,4 +1,10 @@ $err, + ); + echo json_encode($response, JSON_UNESCAPED_UNICODE); + exit; + } + // 禁止url確認 + for($i = 0; $i < count($banurl); $i++) { + if (false !== strpos($abitext, 'https://'.$banurl[$i])) { + $err = "contains_prohibited_url"; + $response = array( + 'error_code' => $err, + ); + echo json_encode($response, JSON_UNESCAPED_UNICODE); + exit; + } + } + try { $pdo = new PDO('mysql:charset=utf8mb4;dbname='.DB_NAME.';host='.DB_HOST , DB_USER, DB_PASS); diff --git a/actor/index.php b/actor/index.php new file mode 100644 index 0000000..0f2b0c2 --- /dev/null +++ b/actor/index.php @@ -0,0 +1,81 @@ + 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(); + } + + $user = htmlentities($_GET['actor']); + + $userid = str_replace('@','', str_replace('@'.$domain.'', '', $user)); + if( !empty($pdo) ) { + + // データベース接続の設定 + $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, + )); + $userQuery = $dbh->prepare("SELECT username, userid, profile, follow, follower, iconname, headname,datetime FROM account WHERE userid = :userid"); + $userQuery->bindValue(':userid', $userid); + $userQuery->execute(); + $userData = $userQuery->fetch(); + } + if(!empty($userData)){ + + $icon_kakucho_ci = pathinfo($userData["iconname"], PATHINFO_EXTENSION); + $head_kakucho_ci = pathinfo($userData["headname"], PATHINFO_EXTENSION); + + $item = array( + "@context" => [ + "https://www.w3.org/ns/activitystreams", + "https://w3id.org/security/v1", + ], + "id" => "https://".$domain."/actor/?actor=@".$userid."", + "type" => "Person", + "preferredUsername" => "".$userData["userid"]."", + "name" => "".$userData["username"]."", + "summary" => "".nl2br($userData["profile"])."", + "inbox" => "https://".$domain."/user/inbox/?actor=@".$userid."", + "outbox" => "https://".$domain."/user/outbox/?actor=@".$userid."", + "published" => "".date(DATE_ATOM, strtotime($userData["datetime"]))."", + + "discoverable" => true, + + "url" => "https://".$domain."/@".$userid."", + + "icon" => array( + "type" => "Image", + "mediaType" => "image/".$icon_kakucho_ci."", + "url" => "https://".$domain."/".$userData["iconname"]."", + ), + + "image" => array( + "type" => "Image", + "mediaType" => "image/".$icon_kakucho_ci."", + "url" => "https://".$domain."/".$userData["headname"]."", + ), + ); + echo json_encode($item, JSON_UNESCAPED_UNICODE); + }else{ + $item = array( + "user_not_found", + ); + echo json_encode($item, JSON_UNESCAPED_UNICODE); + } +} +?> \ No newline at end of file diff --git a/api/bot-api.php b/api/bot-api.php index 24d05b2..301eb03 100644 --- a/api/bot-api.php +++ b/api/bot-api.php @@ -1,4 +1,7 @@ $err, - ); - - echo json_encode($response, JSON_UNESCAPED_UNICODE); - exit; - } else { - // 文字数を確認 - if( (int)htmlspecialchars(file_get_contents($mojisizefile), ENT_QUOTES, 'UTF-8') < mb_strlen($ueuse, 'UTF-8') ) { - $err = "content_to_".htmlspecialchars(file_get_contents($mojisizefile), ENT_QUOTES, 'UTF-8')."_characters"; - $response = array( - 'error_code' => $err, - ); - - echo json_encode($response, JSON_UNESCAPED_UNICODE); - exit; - } - // 禁止url確認 - for($i = 0; $i < count($banurl); $i++) { - if (false !== strpos($ueuse, 'https://'.$banurl[$i])) { - $err = "contains_prohibited_url"; + if($type === "post" || $type === "ueuse"){ + if(isset($_GET['ueuse'])) { + $ueuse = nl2br(htmlentities($_GET['ueuse'])); + + if( empty($ueuse) ) { + $err = "input_not_found"; + $response = array( + 'error_code' => $err, + ); + echo json_encode($response, JSON_UNESCAPED_UNICODE); + exit; + } else { + // 文字数を確認 + if( (int)htmlspecialchars(file_get_contents($mojisizefile), ENT_QUOTES, 'UTF-8') < mb_strlen($ueuse, 'UTF-8') ) { + $err = "content_to_".htmlspecialchars(file_get_contents($mojisizefile), ENT_QUOTES, 'UTF-8')."_characters"; + $response = array( + 'error_code' => $err, + ); + echo json_encode($response, JSON_UNESCAPED_UNICODE); + exit; + } + // 禁止url確認 + for($i = 0; $i < count($banurl); $i++) { + if (false !== strpos($ueuse, 'https://'.$banurl[$i])) { + $err = "contains_prohibited_url"; + $response = array( + 'error_code' => $err, + ); + + echo json_encode($response, JSON_UNESCAPED_UNICODE); + exit; + } + } + } + + if($token === 'ice'){ + $err = "this_account_has_been_frozen"; $response = array( 'error_code' => $err, ); echo json_encode($response, JSON_UNESCAPED_UNICODE); exit; - } - } - } - - if($token === 'ice'){ - $err = "input_error"; - $response = array( - 'error_code' => $err, - ); - - echo json_encode($response, JSON_UNESCAPED_UNICODE); - exit; - }elseif($token === ''){ - $err = "input_error"; - $response = array( - 'error_code' => $err, - ); - - echo json_encode($response, JSON_UNESCAPED_UNICODE); - exit; - } - - require('../db.php'); - - $datetime = array(); - $pdo = null; - - session_start(); - - 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(); - } - - - if( !empty($pdo) ) { - - // データベース接続の設定 - $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, - )); - - $userQuery = $dbh->prepare("SELECT username, userid FROM account WHERE token = :token"); - $userQuery->bindValue(':token', $token); - $userQuery->execute(); - $userData = $userQuery->fetch(); - - if(empty($userData["userid"])){ - $err = "token_invalid"; + }elseif($token === ''){ + $err = "token_input_error"; $response = array( 'error_code' => $err, ); echo json_encode($response, JSON_UNESCAPED_UNICODE); - }else{ - // 書き込み日時を取得 - $username = $userData["username"]; - $userid = $userData["userid"]; - $datetime = date("Y-m-d H:i:s"); - $uniqid = createUniqId(); - $abi = "none"; - $nones = "none"; + exit; + } + + require('../db.php'); + + $datetime = array(); + $pdo = null; + + session_start(); + + 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(); + } - // トランザクション開始 - $pdo->beginTransaction(); - - try { - - // SQL作成 - $stmt = $pdo->prepare("INSERT INTO ueuse (username, account, uniqid, ueuse, photo1, photo2, video1, datetime, abi) VALUES (:username, :account, :uniqid, :ueuse, :photo1, :photo2, :video1, :datetime, :abi)"); + if( !empty($pdo) ) { + + // データベース接続の設定 + $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, + )); - $stmt->bindParam(':username', $username, PDO::PARAM_STR); - $stmt->bindParam(':account', $userid, PDO::PARAM_STR); - $stmt->bindParam(':uniqid', $uniqid, PDO::PARAM_STR); - $stmt->bindParam(':ueuse', $ueuse, PDO::PARAM_STR); + $userQuery = $dbh->prepare("SELECT username, userid, role FROM account WHERE token = :token"); + $userQuery->bindValue(':token', $token); + $userQuery->execute(); + $userData = $userQuery->fetch(); - $stmt->bindParam(':photo1', $nones, PDO::PARAM_STR); - $stmt->bindParam(':photo2', $nones, PDO::PARAM_STR); - $stmt->bindParam(':video1', $nones, PDO::PARAM_STR); - - $stmt->bindParam(':datetime', $datetime, PDO::PARAM_STR); - - $stmt->bindParam(':abi', $abi, PDO::PARAM_STR); - - // SQLクエリの実行 - $res = $stmt->execute(); - - // コミット - $res = $pdo->commit(); - - $mentionedUsers = get_mentions_userid($ueuse); - - foreach ($mentionedUsers as $mentionedUser) { + if(empty($userData["userid"])){ + $err = "token_invalid"; + $response = array( + 'error_code' => $err, + ); + echo json_encode($response, JSON_UNESCAPED_UNICODE); + exit; + }elseif($userData["role"] === "ice"){ + $err = "this_account_has_been_frozen"; + $response = array( + 'error_code' => $err, + ); + echo json_encode($response, JSON_UNESCAPED_UNICODE); + exit; + }else{ + // 書き込み日時を取得 + $username = $userData["username"]; + $userid = $userData["userid"]; + $datetime = date("Y-m-d H:i:s"); + $uniqid = createUniqId(); + $abi = "none"; + $nones = "none"; + + // トランザクション開始 + $pdo->beginTransaction(); + + try { + + // SQL作成 + $stmt = $pdo->prepare("INSERT INTO ueuse (username, account, uniqid, ueuse, photo1, photo2, video1, datetime, abi) VALUES (:username, :account, :uniqid, :ueuse, :photo1, :photo2, :video1, :datetime, :abi)"); + + $stmt->bindParam(':username', $username, PDO::PARAM_STR); + $stmt->bindParam(':account', $userid, PDO::PARAM_STR); + $stmt->bindParam(':uniqid', $uniqid, PDO::PARAM_STR); + $stmt->bindParam(':ueuse', $ueuse, PDO::PARAM_STR); + + $stmt->bindParam(':photo1', $nones, PDO::PARAM_STR); + $stmt->bindParam(':photo2', $nones, PDO::PARAM_STR); + $stmt->bindParam(':video1', $nones, PDO::PARAM_STR); + + $stmt->bindParam(':datetime', $datetime, PDO::PARAM_STR); + + $stmt->bindParam(':abi', $abi, PDO::PARAM_STR); + + // SQLクエリの実行 + $res = $stmt->execute(); + + // コミット + $res = $pdo->commit(); + + $mentionedUsers = get_mentions_userid($ueuse); + + foreach ($mentionedUsers as $mentionedUser) { + + $pdo->beginTransaction(); + + try { + $touserid = $mentionedUser; + $datetime = date("Y-m-d H:i:s"); + $msg = "" . $ueuse . ""; + $title = "" . $username . "さんにメンションされました!"; + $url = "/!" . $uniqid . "~" . $userid . ""; + $userchk = 'none'; + + // 通知用SQL作成 + $stmt = $pdo->prepare("INSERT INTO notification (touserid, msg, url, datetime, userchk, title) VALUES (:touserid, :msg, :url, :datetime, :userchk, :title)"); + + + $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(); + } + + } + + } catch(Exception $e) { + + // エラーが発生した時はロールバック + $pdo->rollBack(); + } + + if( $res ) { + $response = array( + 'uniqid' => $uniqid, + 'userid' => $userid, + ); + + echo json_encode($response, JSON_UNESCAPED_UNICODE); + } else { + $err = "db_error_".$e->getMessage(); + $response = array( + 'error_code' => $err, + ); + + echo json_encode($response, JSON_UNESCAPED_UNICODE); + } + + // プリペアドステートメントを削除 + $stmt = null; + } + } + }else{ + $err = "input_not_found"; + $response = array( + 'error_code' => $err, + ); + echo json_encode($response, JSON_UNESCAPED_UNICODE); + exit; + } + } + + if($type === "reply"){ + if(isset($_GET['ueuse'])) { + $rpuniqid = htmlentities($_GET['uniqid']); + $ueuse = nl2br(htmlentities($_GET['ueuse'])); + + if( empty($ueuse) ) { + $err = "input_not_found"; + $response = array( + 'error_code' => $err, + ); + echo json_encode($response, JSON_UNESCAPED_UNICODE); + exit; + } else { + // 文字数を確認 + if( (int)htmlspecialchars(file_get_contents($mojisizefile), ENT_QUOTES, 'UTF-8') < mb_strlen($ueuse, 'UTF-8') ) { + $err = "content_to_".htmlspecialchars(file_get_contents($mojisizefile), ENT_QUOTES, 'UTF-8')."_characters"; + $response = array( + 'error_code' => $err, + ); + echo json_encode($response, JSON_UNESCAPED_UNICODE); + exit; + } + // 禁止url確認 + for($i = 0; $i < count($banurl); $i++) { + if (false !== strpos($ueuse, 'https://'.$banurl[$i])) { + $err = "contains_prohibited_url"; + $response = array( + 'error_code' => $err, + ); + + echo json_encode($response, JSON_UNESCAPED_UNICODE); + exit; + } + } + } + + if($token === 'ice'){ + $err = "this_account_has_been_frozen"; + $response = array( + 'error_code' => $err, + ); + + echo json_encode($response, JSON_UNESCAPED_UNICODE); + exit; + }elseif($token === ''){ + $err = "token_input_error"; + $response = array( + 'error_code' => $err, + ); + + echo json_encode($response, JSON_UNESCAPED_UNICODE); + exit; + } + + require('../db.php'); + + $datetime = array(); + $pdo = null; + + session_start(); + + 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(); + } + + if( !empty($pdo) ) { + + // データベース接続の設定 + $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, + )); + + $userQuery = $dbh->prepare("SELECT username, userid, role FROM account WHERE token = :token"); + $userQuery->bindValue(':token', $token); + $userQuery->execute(); + $userData = $userQuery->fetch(); + + if(empty($userData["userid"])){ + $err = "token_invalid"; + $response = array( + 'error_code' => $err, + ); + echo json_encode($response, JSON_UNESCAPED_UNICODE); + exit; + }elseif($userData["role"] === "ice"){ + $err = "this_account_has_been_frozen"; + $response = array( + 'error_code' => $err, + ); + + echo json_encode($response, JSON_UNESCAPED_UNICODE); + exit; + }else{ + $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, + )); + + $resultQuery = $dbh->prepare("SELECT * FROM ueuse WHERE uniqid = :uniqid"); + $resultQuery->bindValue(':uniqid', $rpuniqid); + $resultQuery->execute(); + $resultData = $resultQuery->fetch(); + + if($resultData > 0){ + + // 書き込み日時を取得 + $username = $userData["username"]; + $userid = $userData["userid"]; + $datetime = date("Y-m-d H:i:s"); + $uniqid = createUniqId(); + $abi = "none"; + $nones = "none"; + + $touserid2 = $resultData["account"]; + + // トランザクション開始 $pdo->beginTransaction(); try { - $touserid = $mentionedUser; - $datetime = date("Y-m-d H:i:s"); - $msg = "" . $ueuse . ""; - $title = "" . $username . "さんにメンションされました!"; - $url = "/!" . $uniqid . "~" . $userid . ""; - $userchk = 'none'; + // SQL作成 + $stmt = $pdo->prepare("INSERT INTO ueuse (username, account, rpuniqid, uniqid, ueuse, photo1, photo2, video1, datetime, abi) VALUES (:username, :account, :rpuniqid, :uniqid, :ueuse, :photo1, :photo2, :video1, :datetime, :abi)"); + + $stmt->bindParam(':username', $username, PDO::PARAM_STR); + $stmt->bindParam(':account', $userid, PDO::PARAM_STR); + $stmt->bindParam(':rpuniqid', $rpuniqid, PDO::PARAM_STR); + $stmt->bindParam(':uniqid', $uniqid, PDO::PARAM_STR); + $stmt->bindParam(':ueuse', $ueuse, PDO::PARAM_STR); + + $stmt->bindParam(':photo1', $nones, PDO::PARAM_STR); + $stmt->bindParam(':photo2', $nones, PDO::PARAM_STR); + $stmt->bindParam(':video1', $nones, PDO::PARAM_STR); + + $stmt->bindParam(':datetime', $datetime, PDO::PARAM_STR); + + $stmt->bindParam(':abi', $abi, PDO::PARAM_STR); + + // SQLクエリの実行 + $res = $stmt->execute(); + + // コミット + $res = $pdo->commit(); + + $pdo->beginTransaction(); + + $msg = ''.$ueuse.''; + $title = ''.$username.'さんが返信しました!'; + $url = "https://".$domain."/!".$uniqid."~".$userid.""; + $userchk = 'none'; // 通知用SQL作成 $stmt = $pdo->prepare("INSERT INTO notification (touserid, msg, url, datetime, userchk, title) VALUES (:touserid, :msg, :url, :datetime, :userchk, :title)"); - - - $stmt->bindParam(':touserid', $touserid, PDO::PARAM_STR); + + $stmt->bindParam(':touserid', $touserid2, PDO::PARAM_STR); $stmt->bindParam(':msg', $msg, PDO::PARAM_STR); $stmt->bindParam(':url', $url, PDO::PARAM_STR); $stmt->bindParam(':userchk', $userchk, PDO::PARAM_STR); @@ -210,39 +439,189 @@ if(isset($_GET['token'])&&isset($_GET['ueuse'])) { // コミット $res = $pdo->commit(); + $mentionedUsers = get_mentions_userid($ueuse); + + foreach ($mentionedUsers as $mentionedUser) { + + $pdo->beginTransaction(); + + try { + $touserid = $mentionedUser; + $datetime = date("Y-m-d H:i:s"); + $msg = "" . $ueuse . ""; + $title = "" . $username . "さんにメンションされました!"; + $url = "/!" . $uniqid . "~" . $userid . ""; + $userchk = 'none'; + + // 通知用SQL作成 + $stmt = $pdo->prepare("INSERT INTO notification (touserid, msg, url, datetime, userchk, title) VALUES (:touserid, :msg, :url, :datetime, :userchk, :title)"); + + + $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(); + } + + } + } catch(Exception $e) { // エラーが発生した時はロールバック $pdo->rollBack(); } - + + if( $res ) { + $response = array( + 'uniqid' => $uniqid, + 'userid' => $userid, + ); + + echo json_encode($response, JSON_UNESCAPED_UNICODE); + } else { + $err = "db_error_".$e->getMessage(); + $response = array( + 'error_code' => $err, + ); + + echo json_encode($response, JSON_UNESCAPED_UNICODE); + } + // プリペアドステートメントを削除 + $stmt = null; + + }else{ + $err = "post_not_found"; + $response = array( + 'error_code' => $err, + ); + echo json_encode($response, JSON_UNESCAPED_UNICODE); + exit; } - - } catch(Exception $e) { - - // エラーが発生した時はロールバック - $pdo->rollBack(); } + } + }else{ + $err = "input_not_found"; + $response = array( + 'error_code' => $err, + ); + echo json_encode($response, JSON_UNESCAPED_UNICODE); + exit; + } + } - if( $res ) { + if($type === "getuser"){ + + if($token === 'ice'){ + $err = "this_account_has_been_frozen"; + $response = array( + 'error_code' => $err, + ); + echo json_encode($response, JSON_UNESCAPED_UNICODE); + exit; + }elseif($token === ''){ + $err = "token_input_error"; + $response = array( + 'error_code' => $err, + ); + echo json_encode($response, JSON_UNESCAPED_UNICODE); + exit; + } + + require('../db.php'); + + $datetime = array(); + $pdo = null; + + session_start(); + + 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(); + } + + if( !empty($pdo) ) { + + // データベース接続の設定 + $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, + )); + + $userQuery = $dbh->prepare("SELECT username, userid,role FROM account WHERE token = :token"); + $userQuery->bindValue(':token', $token); + $userQuery->execute(); + $userData = $userQuery->fetch(); + + if(empty($userData["userid"])){ + $err = "token_invalid"; + $response = array( + 'error_code' => $err, + ); + echo json_encode($response, JSON_UNESCAPED_UNICODE); + exit; + }elseif($userData["role"] === "ice"){ + $err = "this_account_has_been_frozen"; + $response = array( + 'error_code' => $err, + ); + + echo json_encode($response, JSON_UNESCAPED_UNICODE); + exit; + }else{ + $userQuery = $pdo->prepare("SELECT username,userid,profile,datetime,follow,follower,iconname,headname FROM account WHERE userid = :userid"); + $userQuery->bindValue(':userid', $userData["userid"]); + $userQuery->execute(); + $userdata = $userQuery->fetch(); + + if (empty($userdata)){ $response = array( - 'uniqid' => $uniqid, + 'error_code' => "critical_error_userdata_not_found", ); - - echo json_encode($response, JSON_UNESCAPED_UNICODE); - } else { - $err = "db_error_".$e->getMessage(); + }else{ + $followcnts = explode(',', $userdata["follow"]); + $userdata["follow_cnt"] = count($followcnts)-1; + + $followercnts = explode(',', $userdata["follower"]); + $userdata["follower_cnt"] = count($followercnts)-1; + $response = array( - 'error_code' => $err, + 'user_name' => htmlentities($userdata["username"]), + 'user_id' => htmlentities($userdata["userid"]), + 'profile' => htmlentities($userdata["profile"]), + 'user_icon' => htmlentities("https://".$domain."/".$userdata["iconname"]), + 'user_header' => htmlentities("https://".$domain."/".$userdata["headname"]), + 'registered_date' => htmlentities($userdata["datetime"]), + 'follow' => htmlentities($userdata["follow"]), + 'follow_cnt' => htmlentities($userdata["follow_cnt"]), + 'follower' => htmlentities($userdata["follower"]), + 'follower_cnt' => htmlentities($userdata["follower_cnt"]), ); - - echo json_encode($response, JSON_UNESCAPED_UNICODE); } - - // プリペアドステートメントを削除 - $stmt = null; + echo json_encode($response, JSON_UNESCAPED_UNICODE);; } } + } }else{ diff --git a/api/userdata-api.php b/api/userdata-api.php index d7253f4..a126a57 100644 --- a/api/userdata-api.php +++ b/api/userdata-api.php @@ -5,6 +5,7 @@ if(isset($_GET['userid'])) { $search = htmlentities($_GET['userid']); +$domain = $_SERVER['HTTP_HOST']; require('../db.php'); @@ -36,7 +37,7 @@ session_start(); PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => true, )); - $userQuery = $pdo->prepare("SELECT username,profile,datetime,follow,follower FROM account WHERE userid = :userid"); + $userQuery = $pdo->prepare("SELECT username,userid,profile,datetime,follow,follower,iconname,headname FROM account WHERE userid = :userid"); $userQuery->bindValue(':userid', $search); $userQuery->execute(); $userdata = $userQuery->fetch(); @@ -54,7 +55,10 @@ if (empty($userdata)){ $response = array( 'user_name' => htmlentities($userdata["username"]), + 'user_id' => htmlentities($userdata["userid"]), 'profile' => htmlentities($userdata["profile"]), + 'user_icon' => htmlentities("https://".$domain."/".$userdata["iconname"]), + 'user_header' => htmlentities("https://".$domain."/".$userdata["headname"]), 'registered_date' => htmlentities($userdata["datetime"]), 'follow' => htmlentities($userdata["follow"]), 'follow_cnt' => htmlentities($userdata["follow_cnt"]), @@ -62,7 +66,7 @@ if (empty($userdata)){ 'follower_cnt' => htmlentities($userdata["follower_cnt"]), ); } -echo json_encode($response, JSON_UNESCAPED_UNICODE);; +echo json_encode($response, JSON_UNESCAPED_UNICODE); }else{ diff --git a/css/home.css b/css/home.css index 8a2de73..86816b4 100644 --- a/css/home.css +++ b/css/home.css @@ -466,7 +466,7 @@ main{ margin-top: 12px; margin-left: 12px; margin-right: 12px; - width: 62%; + width: 60%; background-color: var(--tl-color-color); box-shadow:0 0px 48px 0 rgba(0, 0, 0, .05); border: 1px solid var(--main-color); @@ -537,6 +537,18 @@ main h1{ font-weight: 900; } +.userheader span{ + word-wrap: break-word; + margin-left: 0px; + margin-right: auto; + margin-top: auto; + margin-bottom: 14px; + color: var(--dark-subtext-color); + font-size: 18px; + font-family: 'BIZ UDPGothic', sans-serif; + font-weight: 900; +} + .userheader .profile p{ text-align: left; margin-top: 12px; @@ -1599,6 +1611,100 @@ main h1{ filter: brightness(100%) blur(0px) saturate(100%); } +.ueuse .profilebox{ + max-height: 64px; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} +.ueuse .profilebox p{ + line-height:20px; + overflow-wrap: break-word; + margin-top: auto; + margin-bottom: auto; + margin-left: 24px; + margin-right: 24px; + font-size: 16px; + color:var(--text-color); + text-decoration: none; + font-family: 'BIZ UDPGothic', sans-serif; + font-weight: bold; +} +.ueuse .headbox a{ + margin: 0px; +} +.ueuse .headbox img{ + overflow: hidden; + object-fit: cover; + margin-left: 0px; + margin-right: 0px; + margin-top: 12px; + margin-bottom: 12px; + width: 100%; + height: 74px; + border-radius: 7px; + box-shadow:0 0px 48px 0 rgba(0, 0, 0, .05); +} +.ueuse .flebox .user{ + margin-bottom: 12px; + display: flex; + flex-wrap: wrap; +} +.ueuse .flebox .user img{ + object-fit: cover; + margin-top: -54px; + margin-left: 12px; + text-align: center; + width: 74px; + height:74px; + border-radius: 50%; +} +.ueuse .flebox .user a { + flex-shrink: 0; + margin-top: auto; + margin-bottom: auto; + margin-left: 12px; + font-size: 22px; + color: var(--text-color); + text-decoration: none; + font-family: 'BIZ UDPGothic', sans-serif; + font-weight: bold; +} +.ueuse .flebox .user .idbox{ + margin-top: auto; + margin-bottom: auto; + margin-left: 6px; + border-radius: 10px; + background-color: var(--background-color); + border: 1px solid var(--border-color); +} +.ueuse .flebox .user .idbox a{ + margin-top: 6px; + margin-bottom: 6px; + margin-left: 8px; + margin-right: 8px; + text-align: center; + font-size: 12px; + color:var(--subtext-color); + text-decoration: none; + font-family: 'BIZ UDPGothic', sans-serif; +} +.ueuse .flebox .user .bot{ + margin-top: auto; + margin-bottom: auto; + padding: 6px 8px; + margin-left: 6px; + border-radius: 10px; + background-color: var(--sub-color); + border: 1px solid var(--border-color); + font-family: 'BIZ UDGothic', sans-serif; + font-weight: bold; + text-align: center; + font-size: 12px; + color:var(--main-color); +} + + .tokonone p{ text-align: center; margin-top: 64px; @@ -1674,9 +1780,10 @@ main h1{ cursor: pointer; border: none; display: block; - width:6%; + width: 24px; height: 24px; - padding: 8px auto; + padding: 6px 6px; + margin-left: 6px; margin-right: 6px; @@ -1701,11 +1808,9 @@ main h1{ background-color: var(--main-color); color: var(--sub-color); box-shadow:0 0px 48px 0 rgba(0, 0, 0, .2); - width:7%; } .sendbox label:active{ box-shadow:0 0px 48px 0 rgba(0, 0, 0, .05); - width:5%; } .sendbox label svg{ margin: auto; @@ -1749,7 +1854,7 @@ main h1{ background-color: var(--main-color); width: auto; height: auto; - color: var(--background-color); + color: var(--sub-color); position: relative; border-radius: 50px; transition: all 250ms ease-out; @@ -2476,7 +2581,7 @@ label>input { margin-top: 12px; margin-left: 12px; margin-right: 12px; - width: 24%; + width: 260px; height: 92.5dvh; background-color: var(--background-color); padding: 12px; @@ -2534,6 +2639,7 @@ label>input { font-weight: normal; font-size: 16px; text-align: left; + overflow-wrap:break-word; color: var(--text-color); } @@ -2587,7 +2693,7 @@ label>input { .rightbox .btmbox{ position: absolute; - bottom: 12px; /*下に固定*/ + bottom: 36px; /*下に固定*/ height: 320px; width: 90%; } @@ -3741,6 +3847,41 @@ summary { box-shadow:0 0px 48px 0 rgba(0, 0, 0, .05); } +.f_c_area{ + margin: 0px; + background-color: var(--background-color); + border: none; + width: auto; + text-align: center; + display: flex; +} +.f_c_area .fcnt{ + display: block; + width: 25%; + line-height: 32px; + margin-top: 0px; + margin-bottom: 0px; + margin-left: auto; + margin-right: auto; + display: inline-block; + border: none; +} +.f_c_area .fcnt .p2{ + margin-top: 0px; + margin-bottom: 0px; +} +.f_c_area .fcnt p{ + overflow-wrap: break-word; + margin-top: 0px; + margin-bottom: 0px; + font-size: 20px; + color: var(--main-color); + text-decoration: none; + font-family: 'BIZ UDGothic', sans-serif; + font-weight: normal; + text-align: center; +} + /*------------------------------------------------------------------------------------------------------------*/ /*--------------------------------------------------スマホ向け--------------------------------------------------*/ /*--------------------------------------------------ここから--------------------------------------------------*/ @@ -3858,21 +3999,22 @@ summary { } .sendbox label{ + cursor: pointer; + border: none; display: block; - flex-shrink: 0; - text-align: center; - width:10%; - padding: 6px 2.6px; + width: 24px; + height: 24px; + padding: 6px 6px; + margin-left: 6px; margin-right: 6px; + padding-top: 6px; padding-bottom: 6px; - } - .sendbox label:hover{ - width:11%; - } - .sendbox label:active{ - width:9%; + + + background-color: var(--main-color); + text-align: center; } .sendbox label img{ vertical-align:bottom; @@ -4233,6 +4375,46 @@ summary { color:var(--subtext-color); font-family: 'BIZ UDPGothic', sans-serif; } + + .ueuse .headbox{ + margin-bottom: 12px; + } + .ueuse .headbox a{ + margin: 0px; + padding: 0px; + } + .ueuse .headbox img{ + margin-left: auto; + margin-right: auto; + margin-top: 0px; + margin-bottom: 12px; + width: 100%; + height: 74px; + } + .ueuse .profilebox p{ + margin-left: 12px; + margin-right: 12px; + } + .ueuse .flebox .user{ + margin-top: -12px; + } + .ueuse .flebox .user img{ + margin-left: 12px; + } + .ueuse .flebox .user a { + margin-left: 0px; + } + .ueuse .flebox .user .bot{ + margin-top: auto; + margin-bottom: auto; + padding: 3px 8px; + margin-left: 6px; + border-radius: 10px; + font-family: 'BIZ UDGothic', sans-serif; + font-weight: bold; + text-align: center; + font-size: 12px; + } .leftbox{ display: block; @@ -4241,7 +4423,7 @@ summary { margin-left: 12px; margin-right: 12px; margin-bottom: 12px; - background-color: var(--background-color)FFF; + background-color: var(--background-color); width: 18%; height: 100%; margin-left: 0px; @@ -5183,6 +5365,27 @@ summary { border: none; } + .ueuse .profilebox p{ + color:var(--dark-text-color); + } + .ueuse .flebox .user a{ + color:var(--sub-color); + } + + .ueuse .flebox .user .idbox{ + background-color: #302c2c; + border: none; + } + .ueuse .flebox .user .idbox a{ + color:var(--dark-subtext-color); + } + + .ueuse .flebox .user .bot{ + background-color: #302c2c; + border: none; + color:var(--main-color); + } + .userheader h2{ color:var(--sub-color); } @@ -5190,6 +5393,10 @@ summary { .userheader p{ color: var(--dark-subtext-color); } + + .userheader span{ + color: var(--subtext-color); + } .userheader .profile p{ color:var(--sub-color); @@ -5664,4 +5871,10 @@ summary { .servericon img{ box-shadow:none; } + .f_c_area{ + background-color: var(--dark-background-color); + } + .f_c_area .fcnt p{ + color: var(--dark-text-color); + } } \ No newline at end of file diff --git a/db.php b/db.php index cde25eb..62fe374 100644 --- a/db.php +++ b/db.php @@ -1,8 +1,8 @@ - - + + -サーバー停止 - ゆずさば +サーバー停止中 - @@ -14,20 +21,20 @@
-
ゆずさば
-
uwuzu.net
+
+

サーバー停止中

(/´・ヮ・`\)
現在サーバーが管理者によって停止されています...
停止の理由は以下の通りです。


-

あまりにも脆弱すぎたためサービスを止めさせていただきました。
復旧の目処はたっておりません。

+

diff --git a/home/index.php b/home/index.php index 34ed4a9..f207a2b 100644 --- a/home/index.php +++ b/home/index.php @@ -1,4 +1,5 @@ \ No newline at end of file diff --git a/img/sysimage/unblock_1.svg b/img/sysimage/unblock_1.svg new file mode 100644 index 0000000..c70ce56 --- /dev/null +++ b/img/sysimage/unblock_1.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/js/console_notice.js b/js/console_notice.js index 7b55552..c339eab 100644 --- a/js/console_notice.js +++ b/js/console_notice.js @@ -25,4 +25,4 @@ console.log( "", "color:#000;", "", -); \ No newline at end of file +); diff --git a/nextpage/ftlpage.php b/nextpage/ftlpage.php index 8456a25..2f9b5ac 100644 --- a/nextpage/ftlpage.php +++ b/nextpage/ftlpage.php @@ -27,6 +27,12 @@ try { $userid = htmlentities($_GET['userid']); +$aduserinfoQuery = $pdo->prepare("SELECT username,userid,loginid,admin,role,sacinfo,blocklist FROM account WHERE userid = :userid"); +$aduserinfoQuery->bindValue(':userid', htmlentities($userid)); +$aduserinfoQuery->execute(); +$res = $aduserinfoQuery->fetch(); +$myblocklist = htmlentities($res["blocklist"]); + $itemsPerPage = 15; // 1ページあたりのユーズ数 $pageNumber = htmlentities(isset($_GET['page'])) ? htmlentities(intval($_GET['page'])) : 1; $offset = ($pageNumber - 1) * $itemsPerPage; @@ -110,15 +116,18 @@ if (!empty($pdo)) { if(!empty($messages)){ foreach ($messages as $value) { - - $fav = $value['favorite']; // コンマで区切られたユーザーIDを含む変数 - - // コンマで区切って配列に分割し、要素数を数える - $favIds = explode(',', $fav); - $value["favcnt"] = count($favIds)-1; - - $messageDisplay = new MessageDisplay($value, $userid); // $userid をコンストラクタに渡す - $messageDisplay->display(); + if (false === strpos($myblocklist, ','.htmlentities($value['account'], ENT_QUOTES, 'UTF-8'))) { + if(!($value["role"] === "ice")){ + $fav = $value['favorite']; // コンマで区切られたユーザーIDを含む変数 + + // コンマで区切って配列に分割し、要素数を数える + $favIds = explode(',', $fav); + $value["favcnt"] = count($favIds)-1; + + $messageDisplay = new MessageDisplay($value, $userid); // $userid をコンストラクタに渡す + $messageDisplay->display(); + } + } } if($message['ads'] === "true"){ echo '
'; diff --git a/nextpage/nextpage.php b/nextpage/nextpage.php index 72efc8b..dfc4e27 100644 --- a/nextpage/nextpage.php +++ b/nextpage/nextpage.php @@ -27,6 +27,12 @@ try { $userid = htmlentities($_GET['userid']); +$aduserinfoQuery = $pdo->prepare("SELECT username,userid,loginid,admin,role,sacinfo,blocklist FROM account WHERE userid = :userid"); +$aduserinfoQuery->bindValue(':userid', htmlentities($userid)); +$aduserinfoQuery->execute(); +$res = $aduserinfoQuery->fetch(); +$myblocklist = htmlentities($res["blocklist"]); + $itemsPerPage = 15; // 1ページあたりのユーズ数 $pageNumber = htmlentities(isset($_GET['page'])) ? htmlentities(intval($_GET['page'])) : 1; $offset = ($pageNumber - 1) * $itemsPerPage; @@ -87,15 +93,18 @@ if (!empty($pdo)) { if(!empty($messages)){ foreach ($messages as $value) { - - $fav = $value['favorite']; // コンマで区切られたユーザーIDを含む変数 - - // コンマで区切って配列に分割し、要素数を数える - $favIds = explode(',', $fav); - $value["favcnt"] = count($favIds)-1; - - $messageDisplay = new MessageDisplay($value, $userid); // $userid をコンストラクタに渡す - $messageDisplay->display(); + if (false === strpos($myblocklist, ','.htmlentities($value['account'], ENT_QUOTES, 'UTF-8'))) { + if(!($value["role"] === "ice")){ + $fav = $value['favorite']; // コンマで区切られたユーザーIDを含む変数 + + // コンマで区切って配列に分割し、要素数を数える + $favIds = explode(',', $fav); + $value["favcnt"] = count($favIds)-1; + + $messageDisplay = new MessageDisplay($value, $userid); // $userid をコンストラクタに渡す + $messageDisplay->display(); + } + } } if($message['ads'] === "true"){ echo '
'; diff --git a/nextpage/searchpage.php b/nextpage/searchpage.php index 33c65cd..38af833 100644 --- a/nextpage/searchpage.php +++ b/nextpage/searchpage.php @@ -13,6 +13,8 @@ require('../db.php'); require('view.php'); +require('user_view.php'); + // データベースに接続 try { $option = array( @@ -32,78 +34,105 @@ $userid = htmlentities($_GET['userid']); $messages = array(); if (!empty($pdo)) { + if (!empty($keyword)) { - $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, - )); + $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, + )); - $keywordPattern = '/from:@(\w+)\s+(.+)/'; - if (preg_match($keywordPattern, $keyword, $matches)) { - $username = $matches[1]; - $searchKeyword = $matches[2]; + $keywordPattern = '/from:@(\w+)\s+(.+)/'; + if (preg_match($keywordPattern, $keyword, $matches)) { + $username = $matches[1]; + $searchKeyword = $matches[2]; - $messageQuery = $dbh->prepare("SELECT * FROM ueuse WHERE account = :username AND (ueuse LIKE :searchKeyword OR abi LIKE :searchKeyword) ORDER BY datetime DESC"); - $messageQuery->bindValue(':username', $username, PDO::PARAM_STR); - $messageQuery->bindValue(':searchKeyword', '%' . $searchKeyword . '%', PDO::PARAM_STR); - $messageQuery->execute(); - $message_array = $messageQuery->fetchAll(); - } else { - $messageQuery = $dbh->prepare("SELECT * FROM ueuse WHERE ueuse LIKE :keyword OR abi LIKE :keyword ORDER BY datetime DESC"); - $messageQuery->bindValue(':keyword', '%' . $keyword . '%', PDO::PARAM_STR); - $messageQuery->execute(); - $message_array = $messageQuery->fetchAll(); - } - - - $messages = array(); - foreach ($message_array as $row) { - $messages[] = $row; - } - // ユーザー情報を取得して、$messages内のusernameをuserDataのusernameに置き換える - foreach ($messages as &$message) { - $userQuery = $pdo->prepare("SELECT username, userid, profile, role, iconname, headname, sacinfo FROM account WHERE userid = :userid"); - $userQuery->bindValue(':userid', $message["account"]); - $userQuery->execute(); - $userData = $userQuery->fetch(); - - if ($userData) { - $message['iconname'] = $userData['iconname']; - $message['headname'] = $userData['headname']; - $message['username'] = $userData['username']; - $message['sacinfo'] = $userData['sacinfo']; - $message['role'] = $userData['role']; + $messageQuery = $dbh->prepare("SELECT * FROM ueuse WHERE account = :username AND (ueuse LIKE :searchKeyword OR abi LIKE :searchKeyword) ORDER BY datetime DESC"); + $messageQuery->bindValue(':username', $username, PDO::PARAM_STR); + $messageQuery->bindValue(':searchKeyword', '%' . $searchKeyword . '%', PDO::PARAM_STR); + $messageQuery->execute(); + $message_array = $messageQuery->fetchAll(); + } else { + $messageQuery = $dbh->prepare("SELECT * FROM ueuse WHERE ueuse LIKE :keyword OR abi LIKE :keyword ORDER BY datetime DESC"); + $messageQuery->bindValue(':keyword', '%' . $keyword . '%', PDO::PARAM_STR); + $messageQuery->execute(); + $message_array = $messageQuery->fetchAll(); } - $rpQuery = $pdo->prepare("SELECT COUNT(*) as reply_count FROM ueuse WHERE rpuniqid = :rpuniqid"); - $rpQuery->bindValue(':rpuniqid', $message['uniqid']); - $rpQuery->execute(); - $rpData = $rpQuery->fetch(PDO::FETCH_ASSOC); - - if ($rpData){ - $message['reply_count'] = $rpData['reply_count']; + $user_keyword = str_replace('@', '', $keyword); + $usersQuery = $dbh->prepare("SELECT * FROM account WHERE username LIKE :keyword OR userid LIKE :keyword OR profile LIKE :keyword ORDER BY datetime DESC"); + $usersQuery->bindValue(':keyword', '%' . $user_keyword . '%', PDO::PARAM_STR); + $usersQuery->execute(); + $users_array = $usersQuery->fetchAll(); + + $users = array(); + foreach ($users_array as $row) { + $users[] = $row; } - } - - if(!empty($messages)){ - foreach ($messages as $value) { - - $fav = $value['favorite']; // コンマで区切られたユーザーIDを含む変数 - - // コンマで区切って配列に分割し、要素数を数える - $favIds = explode(',', $fav); - $value["favcnt"] = count($favIds)-1; - $messageDisplay = new MessageDisplay($value, $userid); - $messageDisplay->display(); + $messages = array(); + foreach ($message_array as $row) { + $messages[] = $row; } - }else{ - echo '

ユーズがありません

'; - } - - $pdo = null; + // ユーザー情報を取得して、$messages内のusernameをuserDataのusernameに置き換える + foreach ($messages as &$message) { + $userQuery = $pdo->prepare("SELECT username, userid, profile, role, iconname, headname, sacinfo FROM account WHERE userid = :userid"); + $userQuery->bindValue(':userid', $message["account"]); + $userQuery->execute(); + $userData = $userQuery->fetch(); + if ($userData) { + $message['iconname'] = $userData['iconname']; + $message['headname'] = $userData['headname']; + $message['username'] = $userData['username']; + $message['sacinfo'] = $userData['sacinfo']; + $message['role'] = $userData['role']; + } + + $rpQuery = $pdo->prepare("SELECT COUNT(*) as reply_count FROM ueuse WHERE rpuniqid = :rpuniqid"); + $rpQuery->bindValue(':rpuniqid', $message['uniqid']); + $rpQuery->execute(); + $rpData = $rpQuery->fetch(PDO::FETCH_ASSOC); + + if ($rpData){ + $message['reply_count'] = $rpData['reply_count']; + } + } + + if(!empty($users)){ + foreach ($users as $uservalue) { + $flw = $uservalue['follow']; + $flwIds = explode(',', $flw); + $uservalue["follow_cnt"] = count($flwIds)-1; + + $flr = $uservalue['follower']; + $flrIds = explode(',', $flr); + $uservalue["follower_cnt"] = count($flrIds)-1; + + $messageDisplay = new UserdataDisplay($uservalue, $userid); + $messageDisplay->display(); + } + } + if(!empty($messages)){ + foreach ($messages as $value) { + + $fav = $value['favorite']; // コンマで区切られたユーザーIDを含む変数 + + // コンマで区切って配列に分割し、要素数を数える + $favIds = explode(',', $fav); + $value["favcnt"] = count($favIds)-1; + + $messageDisplay = new MessageDisplay($value, $userid); + $messageDisplay->display(); + } + }else{ + echo '

ユーズがありません

'; + } + + $pdo = null; + }else{ + echo '

検索ワードを入力してください。

'; + } } ?> diff --git a/nextpage/ueusepage.php b/nextpage/ueusepage.php index 7c920e7..5650b75 100644 --- a/nextpage/ueusepage.php +++ b/nextpage/ueusepage.php @@ -27,6 +27,12 @@ try { $userid = htmlentities($_GET['userid']); +$aduserinfoQuery = $pdo->prepare("SELECT username,userid,loginid,admin,role,sacinfo,blocklist FROM account WHERE userid = :userid"); +$aduserinfoQuery->bindValue(':userid', htmlentities($userid)); +$aduserinfoQuery->execute(); +$res = $aduserinfoQuery->fetch(); +$myblocklist = htmlentities($res["blocklist"]); + $ueuseid = htmlentities(isset($_GET['id'])) ? htmlentities($_GET['id']) : ''; $itemsPerPage = 15; // 1ページあたりの投稿数 @@ -104,14 +110,16 @@ if (!empty($pdo)) { if(!empty($messages)){ foreach ($messages as $value) { - $fav = $value['favorite']; // コンマで区切られたユーザーIDを含む変数 + if (false === strpos($myblocklist, ','.htmlentities($value['account'], ENT_QUOTES, 'UTF-8'))) { + $fav = $value['favorite']; // コンマで区切られたユーザーIDを含む変数 - // コンマで区切って配列に分割し、要素数を数える - $favIds = explode(',', $fav); - $value["favcnt"] = count($favIds)-1; + // コンマで区切って配列に分割し、要素数を数える + $favIds = explode(',', $fav); + $value["favcnt"] = count($favIds)-1; - $messageDisplay = new MessageDisplay($value, $userid); - $messageDisplay->display(); + $messageDisplay = new MessageDisplay($value, $userid); + $messageDisplay->display(); + } } if($message['ads'] === "true"){ echo '
'; diff --git a/nextpage/user_view.php b/nextpage/user_view.php new file mode 100644 index 0000000..2980a04 --- /dev/null +++ b/nextpage/user_view.php @@ -0,0 +1,54 @@ + +value = $uservalue; + $this->userid = $userid; + } + + public function display() { + + if (empty($this->value)) { + echo '

ユーザーがいません

'; + } else { + echo '
'; + + echo '
'; + echo ' '; + echo '
'; + + echo '
'; + echo '
'; + + echo ' '; + echo ' ' . htmlentities($this->value['username']) . ''; + echo ' '; + if(!empty($this->value['sacinfo'])){ + if($this->value['sacinfo'] === "bot"){ + echo '
Bot
'; + } + } + if (false !== strpos($this->value['role'], 'official')) { + echo '
'; + echo '
'; + echo '
'; + echo '
'; + } + echo '
'; + echo '
'; + + echo '
'; + echo '

' .replaceEmojisWithImages(replaceURLsWithLinks(nl2br($this->value['profile']))) . '

'; + echo '
'; + + echo '
'; + + } + } +} +?> \ No newline at end of file diff --git a/nextpage/userlikepage.php b/nextpage/userlikepage.php index 4d6ba2c..808a8aa 100644 --- a/nextpage/userlikepage.php +++ b/nextpage/userlikepage.php @@ -29,6 +29,12 @@ try { $uwuzuid = htmlentities(isset($_GET['id'])) ? htmlentities($_GET['id']) : ''; $userid = htmlentities($_GET['userid']); +$aduserinfoQuery = $pdo->prepare("SELECT username,userid,loginid,admin,role,sacinfo,blocklist FROM account WHERE userid = :userid"); +$aduserinfoQuery->bindValue(':userid', htmlentities($userid)); +$aduserinfoQuery->execute(); +$res = $aduserinfoQuery->fetch(); +$myblocklist = htmlentities($res["blocklist"]); + $itemsPerPage = 15; // 1ページあたりのユーズ数 $pageNumber = htmlentities(isset($_GET['page'])) ? htmlentities(intval($_GET['page'])) : 1; $offset = ($pageNumber - 1) * $itemsPerPage; @@ -102,15 +108,17 @@ if (!empty($pdo)) { if(!empty($messages)){ foreach ($messages as $value) { + if (false === strpos($myblocklist, ','.htmlentities($value['account'], ENT_QUOTES, 'UTF-8'))) { - $fav = $value['favorite']; // コンマで区切られたユーザーIDを含む変数 + $fav = $value['favorite']; // コンマで区切られたユーザーIDを含む変数 - // コンマで区切って配列に分割し、要素数を数える - $favIds = explode(',', $fav); - $value["favcnt"] = count($favIds)-1; - - $messageDisplay = new MessageDisplay($value, $userid); - $messageDisplay->display(); + // コンマで区切って配列に分割し、要素数を数える + $favIds = explode(',', $fav); + $value["favcnt"] = count($favIds)-1; + + $messageDisplay = new MessageDisplay($value, $userid); + $messageDisplay->display(); + } } if($message['ads'] === "true"){ echo '
'; diff --git a/nextpage/usermediapage.php b/nextpage/usermediapage.php index 3807eec..47b3b68 100644 --- a/nextpage/usermediapage.php +++ b/nextpage/usermediapage.php @@ -29,6 +29,12 @@ try { $uwuzuid = htmlentities(isset($_GET['id'])) ? htmlentities($_GET['id']) : ''; $userid = htmlentities($_GET['userid']); +$aduserinfoQuery = $pdo->prepare("SELECT username,userid,loginid,admin,role,sacinfo,blocklist FROM account WHERE userid = :userid"); +$aduserinfoQuery->bindValue(':userid', htmlentities($userid)); +$aduserinfoQuery->execute(); +$res = $aduserinfoQuery->fetch(); +$myblocklist = htmlentities($res["blocklist"]); + $itemsPerPage = 15; // 1ページあたりのユーズ数 $pageNumber = htmlentities(isset($_GET['page'])) ? htmlentities(intval($_GET['page'])) : 1; $offset = ($pageNumber - 1) * $itemsPerPage; @@ -102,15 +108,16 @@ if (!empty($pdo)) { if(!empty($messages)){ foreach ($messages as $value) { + if (false === strpos($myblocklist, ','.htmlentities($value['account'], ENT_QUOTES, 'UTF-8'))) { + $fav = $value['favorite']; // コンマで区切られたユーザーIDを含む変数 - $fav = $value['favorite']; // コンマで区切られたユーザーIDを含む変数 - - // コンマで区切って配列に分割し、要素数を数える - $favIds = explode(',', $fav); - $value["favcnt"] = count($favIds)-1; - - $messageDisplay = new MessageDisplay($value, $userid); - $messageDisplay->display(); + // コンマで区切って配列に分割し、要素数を数える + $favIds = explode(',', $fav); + $value["favcnt"] = count($favIds)-1; + + $messageDisplay = new MessageDisplay($value, $userid); + $messageDisplay->display(); + } } if($message['ads'] === "true"){ echo '
'; diff --git a/nextpage/userpage.php b/nextpage/userpage.php index 2b6fe28..360d893 100644 --- a/nextpage/userpage.php +++ b/nextpage/userpage.php @@ -29,6 +29,12 @@ try { $uwuzuid = htmlentities(isset($_GET['id'])) ? htmlentities($_GET['id']) : ''; $userid = htmlentities($_GET['userid']); +$aduserinfoQuery = $pdo->prepare("SELECT username,userid,loginid,admin,role,sacinfo,blocklist FROM account WHERE userid = :userid"); +$aduserinfoQuery->bindValue(':userid', htmlentities($userid)); +$aduserinfoQuery->execute(); +$res = $aduserinfoQuery->fetch(); +$myblocklist = htmlentities($res["blocklist"]); + $itemsPerPage = 15; // 1ページあたりのユーズ数 $pageNumber = htmlentities(isset($_GET['page'])) ? htmlentities(intval($_GET['page'])) : 1; $offset = ($pageNumber - 1) * $itemsPerPage; @@ -102,15 +108,16 @@ if (!empty($pdo)) { if(!empty($messages)){ foreach ($messages as $value) { + if (false === strpos($myblocklist, ','.htmlentities($value['account'], ENT_QUOTES, 'UTF-8'))) { + $fav = $value['favorite']; // コンマで区切られたユーザーIDを含む変数 - $fav = $value['favorite']; // コンマで区切られたユーザーIDを含む変数 - - // コンマで区切って配列に分割し、要素数を数える - $favIds = explode(',', $fav); - $value["favcnt"] = count($favIds)-1; - - $messageDisplay = new MessageDisplay($value, $userid); - $messageDisplay->display(); + // コンマで区切って配列に分割し、要素数を数える + $favIds = explode(',', $fav); + $value["favcnt"] = count($favIds)-1; + + $messageDisplay = new MessageDisplay($value, $userid); + $messageDisplay->display(); + } } if($message['ads'] === "true"){ echo '
'; diff --git a/nodeinfo/2.1/index.php b/nodeinfo/2.1/index.php new file mode 100644 index 0000000..ce84426 --- /dev/null +++ b/nodeinfo/2.1/index.php @@ -0,0 +1,105 @@ + 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(); + } + + mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT); + $mysqli = new mysqli(DB_HOST, DB_USER, DB_PASS, DB_NAME); + + $result = $mysqli->query("SELECT userid FROM account ORDER BY datetime"); + + /* 結果セットの行数を取得します */ + $count1 = $result->num_rows; + + $result2 = $mysqli->query("SELECT uniqid FROM ueuse ORDER BY datetime"); + + /* 結果セットの行数を取得します */ + $count2 = $result2->num_rows; + + if($onlyuser === "true"){ + $openregit = false; + }elseif($onlyuser === "false"){ + $openregit = true; + }else{ + $openregit = false; + } + + $item = array( + "version" => "2.1", + "software" => array( + "name" => "uwuzu", + "version" => "".str_replace("\r", '', $uwuzuinfo[1])."", + "repository" => "https://github.com/Daichimarukana/uwuzu", + ), + "protocols" => [ + "activitypub", + ], + "service" => [ + "inbound" => array(), + "outbound" => array(), + ], + "openRegistrations" => $openregit, + "usage" => [ + "users" => array( + "total" => $count1, + ), + "localPosts" => $count2, + ], + "metadata" => [ + "nodeName" => file_get_contents($servernamefile), + "nodeDescription" => $serverinfo, + "maintainer" => array( + "name" => file_get_contents($adminfile), + "email" => file_get_contents($contactfile), + ), + "langs" => array( + "ja", + ), + "tosUrl" => "https://".$domain."/rule/terms", + "maxNoteTextLength" => (int)htmlspecialchars(file_get_contents($mojisizefile), ENT_QUOTES, 'UTF-8'), + ], + ); + + $item; // ループ内で $response にデータを追加 + + echo json_encode($item, JSON_UNESCAPED_UNICODE); +} +?> \ No newline at end of file diff --git a/others/index.php b/others/index.php index 40c99fa..edc4208 100644 --- a/others/index.php +++ b/others/index.php @@ -493,15 +493,21 @@ require('../logout/logout.php');

これにより投稿内容(ueuse)と、ユーザーネーム(user_name)、ユーザーID(userid)、投稿ID(uniqid)、写真・動画URL(photo1,photo2,video1)、いいねした人一覧(favorite)、いいね数(favorite_cnt)、投稿日時(datetime)、追記内容(abi)、追記日時(abidatetime)が取得できます。
page=は指定しなくても動作します。(https://[ドメイン名(uwuzu.netなど)]/api/ltl-api?limit=[取得件数])


  • 投稿API
  • -

    https://[ドメイン名(uwuzu.netなど)]/api/bot-api?token=[アクセストークン]&ueuse=[投稿の内容]

    - +

    https://[ドメイン名(uwuzu.netなど)]/api/bot-api?token=[アクセストークン]&type=post&ueuse=[投稿の内容]

    +
    +
  • アクセストークンからユーザー情報取得API
  • +

    https://[ドメイン名(uwuzu.netなど)]/api/bot-api?token=[アクセストークン]&type=getuser

    +
    +
  • 返信API
  • +

    https://[ドメイン名(uwuzu.netなど)]/api/bot-api?token=[アクセストークン]&type=reply&uniqid=[返信先のuniqid]&ueuse=[返信の内容]

    +

    以下のボタンよりアクセストークンを取得すると使用できます。
    アクセストークンは一度発行すると作り直すまで再度確認はできません。また、絶対に他人に知られないように保護してください。

    -

    アカウントが凍結されているため発行できません。

    +

    アクセストークンはアカウントが凍結されているため発行できません。

    以下のボタンよりアクセストークンを削除できます。ボタンを押すとすぐに削除されますのでご注意ください。

    diff --git a/server/activitypub.txt b/server/activitypub.txt new file mode 100644 index 0000000..02e4a84 --- /dev/null +++ b/server/activitypub.txt @@ -0,0 +1 @@ +false \ No newline at end of file diff --git a/server/uwuzuabout.txt b/server/uwuzuabout.txt index ea94ba9..0753795 100644 --- a/server/uwuzuabout.txt +++ b/server/uwuzuabout.txt @@ -53,6 +53,7 @@ PHP 8では事前にGDを有効化しておいてください!(QRコードの - datetime(datetime) アカウント作成日時保存用 - follow(text) アカウントがフォローしている人保存用 - follower(text) アカウントがフォローされている人保存用 +- blocklist(text) ブロックしている人保存用 - admin(varchar(25)) 管理者アカウントなら「yes」、それ以外なら「none」と入力。 - authcode(varchar(256)) 二段階認証用キー保存用 - backupcode(varchar(256)) 二段階認証のバックアップコード保存用 @@ -142,10 +143,10 @@ PHP 8では事前にGDを有効化しておいてください!(QRコードの - 404imagepath.txt : 404ページに表示する画像パス保存用 - 503imagepath.txt : 503ページに表示する画像パス保存用 +- activitypub.txt : ActivityPub機能のオンオフ(trueまたはfalse) - admininfo.txt : 管理者名(てすとまる/@sampledayo) - banurldomain.txt : 投稿禁止URLドメイン - banuserid.txt : 登録禁止ユーザーid -- admininfo.txt : 管理者名(てすとまる/@sampledayo) - contact.txt : 管理者への連絡用メアド(sample@test.com) - info.txt : サーバー登録時に表示されるメッセージ(好きな内容) - privacypolicy.txt : プライバシーポリシー(サーバーのプライバシーポリシーを記載) @@ -182,4 +183,4 @@ daichimarukanaと一緒に開発したいよ~って人は私のHPからメー 編集者 : daichimarukana -最終更新日 : 2023/09/10 18:15 \ No newline at end of file +最終更新日 : 2023/10/04 00:07 \ No newline at end of file diff --git a/server/uwuzuinfo.txt b/server/uwuzuinfo.txt index 75943de..732a0e9 100644 --- a/server/uwuzuinfo.txt +++ b/server/uwuzuinfo.txt @@ -1,4 +1,4 @@ uwuzu -1.2.23 -2023/09/16 +1.2.24 +2023/10/04 daichimarukana,putonfps \ No newline at end of file diff --git a/server/uwuzurelease.txt b/server/uwuzurelease.txt index 96f69be..96ed9dc 100644 --- a/server/uwuzurelease.txt +++ b/server/uwuzurelease.txt @@ -1,6 +1,66 @@ ## リリースノートだぜぇぇぇぇぇぇい!!!!!!! ここにはuwuzuの更新情報を載せてくぜぇ~!(いやまてテンションおかしいだろ...) +## Version 1.2.24 +リリース日:2023/10/04 +画像選択ボタンのUIを変更しました。 +サーバー管理画面で改行が正常にされない問題を修正しました。 +アカウントの解凍機能を微調整しました。 +うっかりミスを修正しました。 +不完全ですがActivityPubに準拠したjsonを返すプログラムを実装しました。 +標準では動作しないようにしてあります。 +凍結されたユーザーの投稿をLTLとFTLで表示しないようにしました。 +追記機能にも禁止URLと文字数制限を掛けるようにしました。 +bot-apiの仕様を変更しました。 +(新URL)https://[ドメイン名(uwuzu.netなど)]/api/bot-api?token=[アクセストークン]&ueuse=[投稿の内容]&type=post +【レスポンス例↓】 +uniqid "1bwtu12ea1" +userid "admin" + +typeを指定するようにしてください。 +typeにgetuserを指定し、ueuseを削除するとアクセストークンからユーザー情報を取得することができるようになります。 +※アクセストークンから取得しない場合は今までと同じくuserdata-apiをご利用ください。 +(新URL)https://[ドメイン名(uwuzu.netなど)]/api/bot-api?token=[アクセストークン]&type=getuser +【レスポンス例↓】 +user_name "あどみん" +user_id "admin" +profile "tets\r\n2" +user_icon "https://[ドメイン名(uwuzu.netなど)]/usericons/64f5f5bf69a2f-admin.webp" +user_header "https://[ドメイン名(uwuzu.netなど)]/userheads/64f5f5bf69c3f-admin.png" +registered_date "2023-09-05 00:20:31" +follow ",test" +follow_cnt "1" +follower ",test" +follower_cnt "1" + +凍結されたユーザーがプロフィールを変更できないようにしました。 +パスワード更新の際にユーザーIDの確認を求めるようにしました。 +ユーザー情報取得APIのレスポンス仕様を変更しました。 +【レスポンス例↓】 +user_name "あどみん" +user_id "admin" +profile "tets\r\n2" +user_icon "https://[ドメイン名(uwuzu.netなど)]/usericons/64f5f5bf69a2f-admin.webp" +user_header "https://[ドメイン名(uwuzu.netなど)]/userheads/64f5f5bf69c3f-admin.png" +registered_date "2023-09-05 00:20:31" +follow ",test" +follow_cnt "1" +follower ",test" +follower_cnt "1" + +返信APIを実装しました。 +https://[ドメイン名(uwuzu.netなど)]/api/bot-api?token=[アクセストークン]&type=reply&uniqid=[返信先のuniqid]&ueuse=[返信の内容] +【レスポンス例↓】 +uniqid "1bwtu12ea2" +userid "admin" + +バグの修正をしました。 +アカウント検索機能を実装しました。 +ユーザープロフィールで投稿数を表示するようにしました。 +ブロック機能を実装しました。(現状Xのミュート機能とほぼ同じ機能です) +DBに変更があるためaccountにblocklist[text]を追加してください。 +uwuzu_database.sqlも更新済みです。 + ## Version 1.2.23 リリース日:2023/09/16 アカウント登録ができない問題を修正しました。 @@ -19,7 +79,7 @@ UIを一部変更しました。 サーバーアイコン機能を実装しました! アカウント登録画面をダークモード対応にしました! DBに変更があるためaccountにsacinfo[varchar(256)]を、ueuseにnsfw[varchar(25)]を追加してください。 -uwuzu-database.sqlも更新済みです。 +uwuzu_database.sqlも更新済みです。 ## Version 1.2.22 リリース日:2023/09/12 diff --git a/settings/index.php b/settings/index.php index 5d18f05..61c2e57 100644 --- a/settings/index.php +++ b/settings/index.php @@ -282,32 +282,22 @@ if( !empty($_POST['btn_submit']) ) { if( !empty($_POST['pass_submit']) ) { + $pass_chk = htmlentities($_POST['passchk_userid']); $password = $_POST['password']; $hashpassword = password_hash($password, PASSWORD_DEFAULT); - $options = array( - // SQL実行失敗時に例外をスルー - PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, - // デフォルトフェッチモードを連想配列形式に設定 - PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC, - // バッファードクエリを使う(一度に結果セットを全て取得し、サーバー負荷を軽減) - // SELECTで得た結果に対してもrowCountメソッドを使えるようにする - PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => true, - ); - - $dbh = new PDO('mysql:charset=utf8mb4;dbname='.DB_NAME.';host='.DB_HOST , DB_USER, DB_PASS, $option); - - - $query = $dbh->prepare('SELECT * FROM account WHERE userid = :userid limit 1'); - - $query->execute(array(':userid' => $userid)); - - $result = $query->fetch(); + if(empty($pass_chk)){ + $error_message[] = 'ユーザーidを入力してください。'; + }else{ + if(!($pass_chk === $userData["userid"])){ + $error_message[] = 'ユーザーidが不正です。'; + } + } // ユーザーネームの入力チェック if( empty($password) ) { - $error_message[] = 'パスワードを入力してください。'; + $error_message[] = '新しいパスワードを入力してください。'; } else { $weakPasswords = array( @@ -394,6 +384,7 @@ if( !empty($_POST['pass_submit']) ) { } } + if( empty($error_message) ) { // トランザクション開始 $pdo->beginTransaction(); @@ -401,7 +392,7 @@ if( !empty($_POST['pass_submit']) ) { try { // SQL作成 - $stmt = $pdo->prepare("UPDATE account SET password = :password WHERE userid = :userid;"); + $stmt = $pdo->prepare("UPDATE account SET password = :password WHERE userid = :userid"); // 他の値をセット $stmt->bindParam(':password', $hashpassword, PDO::PARAM_STR); @@ -748,56 +739,65 @@ $pdo = null;
    - + +

    お使いのアカウントは凍結されているため設定を変更できません

    + - - -
    - - -
    + - -
    -

    ユーザーネーム

    - -
    -
    -

    メールアドレス

    - -
    - -
    -

    プロフィール

    - -
    - - - -

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

    -
    - - - - - - - + + +
    + +
    - -

    アカウントが凍結されているためBotであることの設定変更はできません。

    - - - + +
    +

    ユーザーネーム

    + +
    +
    +

    メールアドレス

    + +
    + +
    +

    プロフィール

    + +
    + + +

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

    +
    + + + + + + + +
    + + +

    アカウントが凍結されているためBotであることの設定変更はできません。

    + + + + +
    -

    パスワード

    +

    ユーザーid

    + +
    +
    +

    新しいパスワード

    diff --git a/settings_admin/customize_admin.php b/settings_admin/customize_admin.php index b344bd6..cd294e8 100644 --- a/settings_admin/customize_admin.php +++ b/settings_admin/customize_admin.php @@ -268,7 +268,7 @@ require('../logout/logout.php');

    CSS

    ここで指定されている色が適用されます。
    もし適用されなかった場合はキャッシュを削除し再読み込みしてください。
    表示がおかしくなってしまった場合はカラーコードを再度確認してください。
    - +
    diff --git a/settings_admin/moderation_admin.php b/settings_admin/moderation_admin.php index 6e8c065..f1fa9a8 100644 --- a/settings_admin/moderation_admin.php +++ b/settings_admin/moderation_admin.php @@ -287,13 +287,13 @@ require('../logout/logout.php');

    登録禁止ユーザーid

    ここに入力してあるユーザーidは登録できません。
    改行で禁止するユーザーidを指定できます。
    すでにあるアカウントは影響を受けません。
    - +

    投稿禁止URLドメイン

    ここに入力してあるドメインが含まれる投稿をしようとすると投稿が拒否されます。
    なお、この機能はまだ確実な動作が保証されないためベータ版です。
    位置情報特定サイトなどの対策等にご利用ください。
    - +
    diff --git a/settings_admin/overview_admin.php b/settings_admin/overview_admin.php index fe27a4d..8e0bde3 100644 --- a/settings_admin/overview_admin.php +++ b/settings_admin/overview_admin.php @@ -243,7 +243,7 @@ require('../logout/logout.php');


    サーバー紹介メッセージ

    -

    +


    サーバー管理者の名前

    diff --git a/settings_admin/serveradmin.php b/settings_admin/serveradmin.php index b08490a..ccecf4e 100644 --- a/settings_admin/serveradmin.php +++ b/settings_admin/serveradmin.php @@ -20,6 +20,8 @@ $serverstopfile = "../server/serverstop.txt"; $onlyuserfile = "../server/onlyuser.txt"; +$activitypub_file = "../server/activitypub.txt"; + $err404imagefile = "../server/404imagepath.txt"; $robots = "../robots.txt"; @@ -261,6 +263,14 @@ if( !empty($_POST['btn_submit']) ) { fclose($file); } + $activitypub = $_POST['activitypub']; + + if($activitypub === "true"){ + $saveactivitypub = "true"; + }else{ + $saveactivitypub = "false"; + } + $serverterms = $_POST['serverterms']; @@ -304,6 +314,12 @@ if( !empty($_POST['btn_submit']) ) { fputs($file, $data); fclose($file); + //ActivityPub + $file = fopen($activitypub_file, 'w'); + $data = $saveactivitypub; + fputs($file, $data); + fclose($file); + //利用規約 $file = fopen($servertermsfile, 'w'); $data = $serverterms; @@ -419,6 +435,20 @@ require('../logout/logout.php');
    +
    +

    ActivityPubサーバーとして認識されるようにするか

    +
    ActivityPubの仮実装をオンにするかです。inboxに入ってきた内容には今現在これといったレスポンスを返しません。
    また、publicKeyも返却しません。
    現状ActivityPubサーバーと連合を組むことは出来ません。(リモートユーザーの確認程度なら出来ます。)
    +
    + + + + + + + +
    +
    +

    利用規約

    diff --git a/settings_admin/userinfo.php b/settings_admin/userinfo.php index 71fd047..30eabd8 100644 --- a/settings_admin/userinfo.php +++ b/settings_admin/userinfo.php @@ -299,7 +299,7 @@ if( !empty($_POST['send_water_submit']) ) { $newrole = "user"; $newtoken = ""; - $newadmin = "user"; + $newadmin = "none"; // トランザクション開始 $pdo->beginTransaction(); diff --git a/ueuse/activity/index.php b/ueuse/activity/index.php new file mode 100644 index 0000000..0dd325a --- /dev/null +++ b/ueuse/activity/index.php @@ -0,0 +1,94 @@ + 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(); + } + + $ueuse = htmlentities($_GET['ueuse']); + + if( !empty($pdo) ) { + + $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, + )); + + $messageQuery = $dbh->prepare("SELECT * FROM ueuse WHERE uniqid = :ueuse limit 1"); + $messageQuery->bindValue(':ueuse', $ueuse); + $messageQuery->execute(); + $message_array = $messageQuery->fetchAll(); + + $messages = array(); + foreach ($message_array as $row) { + $messages[] = $row; + } + } + + if (!empty($messages)) { + $orderedItems = array(); + + foreach ($messages as $value) { + if ($value["nsfw"] === "true") { + $value["sensitive"] = true; + } else { + $value["sensitive"] = false; + } + $orderedItem = array( + "@context" => "https://www.w3.org/ns/activitystreams", + "id" => "https://" . $domain . "/ueuse/activity/?ueuse=" . $value["uniqid"], + "actor" => "https://" . $domain . "/actor/?actor=@" . $value["account"], + "type" => "Create", + "published" => date(DATE_ATOM, strtotime($value["datetime"])), + "to" => [ + "https://" . $domain . "/followers", + "https://www.w3.org/ns/activitystreams#Public", + ], + "object" => array( + "type" => "Note", + "@context" => "https://www.w3.org/ns/activitystreams", + "id" => "https://" . $domain . "/ueuse/activity/?ueuse=" . $value["uniqid"], + "url" => "https://" . $domain . "/ueuse/activity/?ueuse=" . $value["uniqid"], + "published" => date(DATE_ATOM, strtotime($value["datetime"])), + "to" => [ + "https://" . $domain . "/followers", + "https://www.w3.org/ns/activitystreams#Public", + ], + "attributedTo" => "https://" . $domain . "/@" . $value["account"], + "content" => nl2br($value["ueuse"]), + "inReplyTo" => null, + "attachment" => [], + "sensitive" => $value["sensitive"], + "tag" => [], + ), + ); + + $orderedItems[] = $orderedItem; + } + + echo json_encode($orderedItems, JSON_UNESCAPED_UNICODE); + } else { + $item = array( + "type" => "item_not_found", + ); + echo json_encode($item, JSON_UNESCAPED_UNICODE); + } + +} +?> \ No newline at end of file diff --git a/ueuse/index.php b/ueuse/index.php index e937591..b9011c7 100644 --- a/ueuse/index.php +++ b/ueuse/index.php @@ -53,7 +53,7 @@ try { if(isset($_SESSION['admin_login']) && $_SESSION['admin_login'] === true) { - $passQuery = $pdo->prepare("SELECT username,userid,loginid,admin,role,sacinfo FROM account WHERE userid = :userid"); + $passQuery = $pdo->prepare("SELECT username,userid,loginid,admin,role,sacinfo,blocklist FROM account WHERE userid = :userid"); $passQuery->bindValue(':userid', htmlentities($_SESSION['userid'])); $passQuery->execute(); $res = $passQuery->fetch(); @@ -67,6 +67,7 @@ if(isset($_SESSION['admin_login']) && $_SESSION['admin_login'] === true) { $loginid = htmlentities($res["loginid"]); $role = htmlentities($res["role"]); $sacinfo = htmlentities($res["sacinfo"]); + $myblocklist = htmlentities($res["blocklist"]); $_SESSION['admin_login'] = true; $_SESSION['userid'] = $userid; $_SESSION['username'] = $username; @@ -99,7 +100,7 @@ if(isset($_SESSION['admin_login']) && $_SESSION['admin_login'] === true) { } elseif (isset($_COOKIE['admin_login']) && $_COOKIE['admin_login'] == true) { - $passQuery = $pdo->prepare("SELECT username,userid,loginid,admin,role,sacinfo FROM account WHERE userid = :userid"); + $passQuery = $pdo->prepare("SELECT username,userid,loginid,admin,role,sacinfo,blocklist FROM account WHERE userid = :userid"); $passQuery->bindValue(':userid', htmlentities($_COOKIE['userid'])); $passQuery->execute(); $res = $passQuery->fetch(); @@ -113,6 +114,7 @@ if(isset($_SESSION['admin_login']) && $_SESSION['admin_login'] === true) { $loginid = htmlentities($res["loginid"]); $role = htmlentities($res["role"]); $sacinfo = htmlentities($res["sacinfo"]); + $myblocklist = htmlentities($res["blocklist"]); $_SESSION['admin_login'] = true; $_SESSION['userid'] = $userid; $_SESSION['username'] = $username; @@ -155,7 +157,7 @@ if(empty($userid)){ if(empty($username)){ header("Location: ../login.php"); exit; -} +} $notiQuery = $pdo->prepare("SELECT COUNT(*) as notification_count FROM notification WHERE touserid = :userid AND userchk = 'none'"); $notiQuery->bindValue(':userid', $userid); $notiQuery->execute(); @@ -413,39 +415,42 @@ if( !empty($_POST['btn_submit']) ) { $mentionedUsers = get_mentions_userid($ueuse); foreach ($mentionedUsers as $mentionedUser) { + + if(!($mentionedUser === $userid)){ - $pdo->beginTransaction(); + $pdo->beginTransaction(); - try { - $touserid = $mentionedUser; - $datetime = date("Y-m-d H:i:s"); - $msg = "" . $ueuse . ""; - $title = "" . $username . "さんにメンションされました!"; - $url = "/!" . $uniqid . "~" . $userid . ""; - $userchk = 'none'; + try { + $touserid = $mentionedUser; + $datetime = date("Y-m-d H:i:s"); + $msg = "" . $ueuse . ""; + $title = "" . $username . "さんにメンションされました!"; + $url = "/!" . $uniqid . "~" . $userid . ""; + $userchk = 'none'; - // 通知用SQL作成 - $stmt = $pdo->prepare("INSERT INTO notification (touserid, msg, url, datetime, userchk, title) VALUES (:touserid, :msg, :url, :datetime, :userchk, :title)"); + // 通知用SQL作成 + $stmt = $pdo->prepare("INSERT INTO notification (touserid, msg, url, datetime, userchk, title) VALUES (:touserid, :msg, :url, :datetime, :userchk, :title)"); - $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(':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); + $stmt->bindParam(':datetime', $datetime, PDO::PARAM_STR); - // SQLクエリの実行 - $res = $stmt->execute(); + // SQLクエリの実行 + $res = $stmt->execute(); - // コミット - $res = $pdo->commit(); + // コミット + $res = $pdo->commit(); - } catch(Exception $e) { + } catch(Exception $e) { - // エラーが発生した時はロールバック - $pdo->rollBack(); + // エラーが発生した時はロールバック + $pdo->rollBack(); + } } } diff --git a/user/inbox/index.php b/user/inbox/index.php new file mode 100644 index 0000000..48005b1 --- /dev/null +++ b/user/inbox/index.php @@ -0,0 +1,22 @@ + "https://www.w3.org/ns/activitystreams", + "summary" => "inbox of ".$userid."", + "type" => "OrderedCollection", + "totalItems" => 0, + "orderedItems" => [], + ); + + echo json_encode($item, JSON_UNESCAPED_UNICODE); +} +?> \ No newline at end of file diff --git a/user/index.php b/user/index.php index 3bc0a4f..90c6fe0 100644 --- a/user/index.php +++ b/user/index.php @@ -2,6 +2,8 @@ $servernamefile = "../server/servername.txt"; +$domain = $_SERVER['HTTP_HOST']; + function createUniqId(){ list($msec, $sec) = explode(" ", microtime()); $hashCreateTime = $sec.floor($msec*1000000); @@ -47,7 +49,7 @@ try { if(isset($_SESSION['admin_login']) && $_SESSION['admin_login'] === true) { - $passQuery = $pdo->prepare("SELECT username,userid,loginid,admin,role,sacinfo FROM account WHERE userid = :userid"); + $passQuery = $pdo->prepare("SELECT username,userid,loginid,admin,role,sacinfo,blocklist FROM account WHERE userid = :userid"); $passQuery->bindValue(':userid', htmlentities($_SESSION['userid'])); $passQuery->execute(); $res = $passQuery->fetch(); @@ -61,6 +63,7 @@ if(isset($_SESSION['admin_login']) && $_SESSION['admin_login'] === true) { $loginid = htmlentities($res["loginid"]); $role = htmlentities($res["role"]); $sacinfo = htmlentities($res["sacinfo"]); + $myblocklist = htmlentities($res["blocklist"]); $_SESSION['admin_login'] = true; $_SESSION['userid'] = $userid; $_SESSION['username'] = $username; @@ -93,7 +96,7 @@ if(isset($_SESSION['admin_login']) && $_SESSION['admin_login'] === true) { } elseif (isset($_COOKIE['admin_login']) && $_COOKIE['admin_login'] == true) { - $passQuery = $pdo->prepare("SELECT username,userid,loginid,admin,role,sacinfo FROM account WHERE userid = :userid"); + $passQuery = $pdo->prepare("SELECT username,userid,loginid,admin,role,sacinfo,blocklist FROM account WHERE userid = :userid"); $passQuery->bindValue(':userid', htmlentities($_COOKIE['userid'])); $passQuery->execute(); $res = $passQuery->fetch(); @@ -107,6 +110,7 @@ if(isset($_SESSION['admin_login']) && $_SESSION['admin_login'] === true) { $loginid = htmlentities($res["loginid"]); $role = htmlentities($res["role"]); $sacinfo = htmlentities($res["sacinfo"]); + $myblocklist = htmlentities($res["blocklist"]); $_SESSION['admin_login'] = true; $_SESSION['userid'] = $userid; $_SESSION['username'] = $username; @@ -173,7 +177,9 @@ if( !empty($pdo) ) { PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => true, )); - $uwuzuid = htmlentities(str_replace('@', '', $_GET['uwuzuid'])); + $uwuzuid2 = htmlentities(str_replace('@', '', $_GET['uwuzuid'])); + + $uwuzuid = htmlentities(str_replace('@'.$domain, '', $uwuzuid2)); // ユーズ内の絵文字を画像に置き換える function replaceEmojisWithImages($postText) { @@ -237,7 +243,7 @@ if( !empty($pdo) ) { return $postText; } - $userQuery = $dbh->prepare("SELECT username, userid, profile, role, follower FROM account WHERE userid = :userid"); + $userQuery = $dbh->prepare("SELECT username, userid, profile, role, follower, blocklist FROM account WHERE userid = :userid"); $userQuery->bindValue(':userid', $uwuzuid); $userQuery->execute(); $userData = $userQuery->fetch(); @@ -248,7 +254,7 @@ if( !empty($pdo) ) { $roles = explode(',', $userData["role"]); // カンマで区切られたロールを配列に分割 - $rerole = $dbh->prepare("SELECT follow, follower, username, userid, password, mailadds, profile, iconname, headname, role, datetime FROM account WHERE userid = :userid"); + $rerole = $dbh->prepare("SELECT follow, follower,blocklist, username, userid, password, mailadds, profile, iconname, headname, role, datetime FROM account WHERE userid = :userid"); $rerole->bindValue(':userid', $uwuzuid); // SQL実行 @@ -289,10 +295,24 @@ if( !empty($pdo) ) { $profileText = htmlentities($userData['profile'], ENT_QUOTES, 'UTF-8'); + + $allueuse = $dbh->prepare("SELECT account FROM ueuse WHERE account = :userid"); + $allueuse->bindValue(':userid', $uwuzuid); + $allueuse->execute(); + $ueuse_cnt = $allueuse->rowCount(); + + + }else{ $userData["userid"] = "none"; $userData['username'] = "ゆーざーなし"; + + $ueuse_cnt = "zero"; + $followCount = "zero"; + $followerCount = "zero"; } + + } if (!empty($_POST['follow'])) { @@ -393,6 +413,71 @@ if (!empty($_POST['follow'])) { } +if (!empty($_POST['send_block_submit'])) { + + $updateQuery = $pdo->prepare("UPDATE account SET blocklist = CONCAT_WS(',', blocklist, :blocklist) WHERE userid = :userid"); + $updateQuery->bindValue(':blocklist', $userData["userid"], PDO::PARAM_STR); + $updateQuery->bindValue(':userid', $userid, PDO::PARAM_STR); + $res_block = $updateQuery->execute(); + + // フォロー解除ボタンが押された場合の処理 + $followerList = explode(',', $userdata['follower']); + if (in_array($userid, $followerList)) { + // 自分が相手をフォローしている場合、相手のfollowerカラムと自分のfollowカラムを更新 + $followerList = array_diff($followerList, array($userid)); + $newFollowerList = implode(',', $followerList); + + // UPDATE文を実行してフォロー情報を更新 + $updateQuery = $pdo->prepare("UPDATE account SET follower = :follower WHERE userid = :userid"); + $updateQuery->bindValue(':follower', $newFollowerList, PDO::PARAM_STR); + $updateQuery->bindValue(':userid', $userData['userid'], PDO::PARAM_STR); + $res = $updateQuery->execute(); + + $deluserid = ",".$userdata["userid"]; + // 自分のfollowカラムから相手のユーザーIDを削除 + $updateQuery = $pdo->prepare("UPDATE account SET follow = REPLACE(follow, :follow, '') WHERE userid = :userid"); + $updateQuery->bindValue(':follow', $deluserid, PDO::PARAM_STR); + $updateQuery->bindValue(':userid', $userid, PDO::PARAM_STR); + $res_follow = $updateQuery->execute(); + + if ($res && $res_follow) { + $url = (empty($_SERVER['HTTPS']) ? 'http://' : 'https://') . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; + header("Location:" . $url); + exit; + } else { + $error_message[] = '更新に失敗しました。'; + } + + $stmt = null; + } + + if ($res_block) { + $url = (empty($_SERVER['HTTPS']) ? 'http://' : 'https://') . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; + header("Location:" . $url); + exit; + } else { + $error_message[] = '更新に失敗しました。'; + } + +} elseif (!empty($_POST['send_un_block_submit'])) { + + $deluserid = ",".$userdata["userid"]; + // 自分のfollowカラムから相手のユーザーIDを削除 + $updateQuery = $pdo->prepare("UPDATE account SET blocklist = REPLACE(blocklist, :blocklist, '') WHERE userid = :userid"); + $updateQuery->bindValue(':blocklist', $deluserid, PDO::PARAM_STR); + $updateQuery->bindValue(':userid', $userid, PDO::PARAM_STR); + $res_block = $updateQuery->execute(); + + if ($res_block) { + $url = (empty($_SERVER['HTTPS']) ? 'http://' : 'https://') . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; + header("Location:" . $url); + exit; + } else { + $error_message[] = '更新に失敗しました。'; + } +} + + require('../logout/logout.php'); @@ -455,7 +540,6 @@ $pdo = null;

    紀元前3000年からuwuzuを利用しています。いるわけねぇだろ()

    -

    フォロー数:ない フォロワー数:いない

    @@ -466,7 +550,7 @@ $pdo = null;

    -

    @

    +

    @

    @@ -480,21 +564,40 @@ $pdo = null;
    -
    -

    -
    + +
    +

    +
    + +
    +

    ブロックしているためプロフィールは表示されません。

    +
    +

    からuwuzuを利用しています。

    -

    フォロー数: フォロワー数:

    +

    + + + + + + + + + @@ -504,22 +607,24 @@ $pdo = null;
    -
    -
    + +
    @@ -536,6 +641,21 @@ $pdo = null;
    +
    +
    +
    ユーズ数
    +

    +
    +
    +
    フォロー数
    +

    +
    +
    +
    フォロワー数
    +

    +
    +
    +
    @@ -543,15 +663,20 @@ $pdo = null;

    -
    -
    + +
    +
    +
    +
    + + -
    + +

    さんをブロックしているため投稿の閲覧は出来ません。

    + - + + + + @@ -808,9 +955,6 @@ $(document).ready(function() { }); - - - var modal = document.getElementById('myDelModal'); var deleteButton = document.getElementById('deleteButton'); var cancelButton = document.getElementById('cancelButton'); // 追加 @@ -923,6 +1067,60 @@ $(document).ready(function() { } }); }); + + var modal2 = document.getElementById('account_BlockModal'); + var deleteButton2 = document.getElementById('deleteButton2'); + var cancelButton2 = document.getElementById('cancelButton2'); // 追加 + var modalMain = $('.modal-content'); + + $('#block').click(function() { + modal2.style.display = 'block'; + modalMain.addClass("slideUp"); + modalMain.removeClass("slideDown"); + + deleteButton2.addEventListener('click', () => { + modalMain.removeClass("slideUp"); + modalMain.addClass("slideDown"); + window.setTimeout(function(){ + modal2.style.display = 'none'; + }, 150); + }); + + cancelButton2.addEventListener('click', () => { // 追加 + modalMain.removeClass("slideUp"); + modalMain.addClass("slideDown"); + window.setTimeout(function(){ + modal2.style.display = 'none'; + }, 150); + }); + }); + + var modal3 = document.getElementById('account_un_BlockModal'); + var deleteButton3 = document.getElementById('deleteButton3'); + var cancelButton3 = document.getElementById('cancelButton3'); // 追加 + var modalMain = $('.modal-content'); + + $('#un_block').click(function() { + modal3.style.display = 'block'; + modalMain.addClass("slideUp"); + modalMain.removeClass("slideDown"); + + deleteButton3.addEventListener('click', () => { + modalMain.removeClass("slideUp"); + modalMain.addClass("slideDown"); + window.setTimeout(function(){ + modal3.style.display = 'none'; + }, 150); + }); + + cancelButton3.addEventListener('click', () => { // 追加 + modalMain.removeClass("slideUp"); + modalMain.addClass("slideDown"); + window.setTimeout(function(){ + modal3.style.display = 'none'; + }, 150); + }); + }); }); diff --git a/user/outbox/index.php b/user/outbox/index.php new file mode 100644 index 0000000..ac3e72e --- /dev/null +++ b/user/outbox/index.php @@ -0,0 +1,131 @@ + 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(); + } + + $user = htmlentities($_GET['actor']); + + $userid = str_replace('@','', str_replace('@'.$domain.'', '', $user)); + if( !empty($pdo) ) { + + $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, + )); + $userQuery = $dbh->prepare("SELECT username, userid, profile, follower, iconname FROM account WHERE userid = :userid"); + $userQuery->bindValue(':userid', $userid); + $userQuery->execute(); + $userData = $userQuery->fetch(); + + $messageQuery = $dbh->prepare("SELECT * FROM ueuse WHERE account = :userid AND rpuniqid = '' ORDER BY datetime DESC"); + $messageQuery->bindValue(':userid', $userid); + $messageQuery->execute(); + $message_array = $messageQuery->fetchAll(); + + $messages = array(); + foreach ($message_array as $row) { + $messages[] = $row; + } + } + if(!(isset($_GET['page']))){ + if(!empty($userData)){ + if(!empty($messages)){ + $item = array( + "@context" => "https://www.w3.org/ns/activitystreams", + "id" => "https://".$domain."/user/outbox/?actor=@".$userid."", + "type" => "OrderedCollection", + "totalItems" => count($messages), + "last" => "https://".$domain."/user/outbox/?actor=@".$userid."&page=true", + ); + + }else{ + $item = array( + "item_not_found", + ); + } + echo json_encode($item, JSON_UNESCAPED_UNICODE); + }else{ + $item = array( + "user_not_found", + ); + echo json_encode($item, JSON_UNESCAPED_UNICODE); + } + }elseif(htmlentities($_GET['page']) === "true"){ + if (!empty($userData)) { + if (!empty($messages)) { + $orderedItems = array(); + + foreach ($messages as $value) { + $activity = array( + "type" => "Create", + "@context" => "https://www.w3.org/ns/activitystreams", + "id" => "https://" . $domain . "/ueuse/activity/?ueuse=" . $value["uniqid"], + "url" => "https://" . $domain . "/ueuse/activity/?ueuse=" . $value["uniqid"], + "published" => date(DATE_ATOM, strtotime($value["datetime"])), + "to" => [ + "https://" . $domain . "/followers", + "https://www.w3.org/ns/activitystreams#Public", + ], + "actor" => "https://" . $domain . "/actor/?actor=@" . $userid, + "object" => array( + "type" => "Note", + "@context" => "https://www.w3.org/ns/activitystreams", + "id" => "https://" . $domain . "/notes/?note=" . $value["uniqid"], + "url" => "https://" . $domain . "/notes/?note=" . $value["uniqid"], + "published" => date(DATE_ATOM, strtotime($value["datetime"])), + "to" => [ + "https://" . $domain . "/followers", + "https://www.w3.org/ns/activitystreams#Public", + ], + "attributedTo" => "https://" . $domain . "/@" . $value["account"], + "content" => nl2br($value["ueuse"]), + ), + ); + + $orderedItems[] = $activity; + } + + $item = array( + "type" => "OrderedCollectionPage", + "@context" => "https://www.w3.org/ns/activitystreams", + "id" => "https://" . $domain . "/user/outbox/?actor=@" . $userid . "?page=true", + "partOf" => "https://" . $domain . "/user/outbox/?actor=@" . $userid, + "summary" => "outbox of " . $userid, + "totalItems" => count($messages), + "orderedItems" => $orderedItems, + ); + + echo json_encode($item, JSON_UNESCAPED_UNICODE); + } else { + $item = array( + "type" => "item_not_found", + ); + echo json_encode($item, JSON_UNESCAPED_UNICODE); + } + } else { + $item = array( + "type" => "user_not_found", + ); + echo json_encode($item, JSON_UNESCAPED_UNICODE); + } + } +} +?> \ No newline at end of file diff --git a/uwuzu_database.sql b/uwuzu_database.sql index 1ae87a8..38531a8 100644 --- a/uwuzu_database.sql +++ b/uwuzu_database.sql @@ -2,8 +2,8 @@ -- version 5.2.1 -- https://www.phpmyadmin.net/ -- --- ホスト: ひみつ☆ --- 生成日時: 2023-09-16 15:15:33 +-- ホスト: ひみつ +-- 生成日時: 2023-10-03 17:20:43 -- サーバのバージョン: 10.4.28-MariaDB -- PHP のバージョン: 8.2.4 @@ -42,6 +42,7 @@ CREATE TABLE `account` ( `datetime` datetime NOT NULL, `follow` text NOT NULL, `follower` text NOT NULL, + `blocklist` text NOT NULL, `admin` varchar(50) NOT NULL, `authcode` varchar(256) NOT NULL, `backupcode` varchar(256) NOT NULL,