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

uwuzu version 1.2.24

This commit is contained in:
daichimarukana
2023-10-04 00:30:38 +09:00
parent e8ddcb9921
commit 0ecf4b9fb1
41 changed files with 2000 additions and 429 deletions
+13
View File
@@ -0,0 +1,13 @@
<?php
$activitypub_file = "../../server/activitypub.txt";
if(file_get_contents($activitypub_file) === "true"){
header("Content-Type: application/xml; charset=UTF-8");
$domain = $_SERVER['HTTP_HOST'];
echo '<?xml version="1.0" encoding="UTF-8"?>';
echo '<XRD xmlns="http://docs.oasis-open.org/ns/xri/xrd-1.0">';
echo '<Link rel="lrdd" type="application/xrd+xml" template="https://'.$domain.'/.well-known/webfinger?resource={uri}"/>';
echo '</XRD>';
}
?>
+19
View File
@@ -0,0 +1,19 @@
<?php
$activitypub_file = "../../server/activitypub.txt";
if(file_get_contents($activitypub_file) === "true"){
header("Content-Type: application/json; charset=utf-8");
$domain = $_SERVER['HTTP_HOST'];
$item = array(
"links" => [
array(
"rel" => "http://nodeinfo.diaspora.software/ns/schema/2.1",
"href" => "https://".$domain."/nodeinfo/2.1",
),
],
);
echo json_encode($item, JSON_UNESCAPED_UNICODE);
}
?>
+39
View File
@@ -0,0 +1,39 @@
<?php
$activitypub_file = "../../server/activitypub.txt";
if(file_get_contents($activitypub_file) === "true"){
header("Content-Type: application/json; charset=utf-8");
$domain = $_SERVER['HTTP_HOST'];
require('../../db.php');
// データベースに接続
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();
}
$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);
}
?>
+2 -1
View File
@@ -34,6 +34,7 @@ PHP 8では事前にGDを有効化しておいてください!(QRコードの
- datetime(datetime) アカウント作成日時保存用 - datetime(datetime) アカウント作成日時保存用
- follow(text) アカウントがフォローしている人保存用 - follow(text) アカウントがフォローしている人保存用
- follower(text) アカウントがフォローされている人保存用 - follower(text) アカウントがフォローされている人保存用
- blocklist(text) ブロックしている人保存用
- admin(varchar(25)) 管理者アカウントなら「yes」、それ以外なら「none」と入力。 - admin(varchar(25)) 管理者アカウントなら「yes」、それ以外なら「none」と入力。
- authcode(varchar(256)) 二段階認証用キー保存用 - authcode(varchar(256)) 二段階認証用キー保存用
- backupcode(varchar(256)) 二段階認証のバックアップコード保存用 - backupcode(varchar(256)) 二段階認証のバックアップコード保存用
@@ -119,10 +120,10 @@ PHP 8では事前にGDを有効化しておいてください!(QRコードの
- 404imagepath.txt : 404ページに表示する画像パス保存用 - 404imagepath.txt : 404ページに表示する画像パス保存用
- 503imagepath.txt : 503ページに表示する画像パス保存用 - 503imagepath.txt : 503ページに表示する画像パス保存用
- activitypub.txt : ActivityPub機能のオンオフ(trueまたはfalse)
- admininfo.txt : 管理者名(てすとまる/@sampledayo) - admininfo.txt : 管理者名(てすとまる/@sampledayo)
- banurldomain.txt : 投稿禁止URLドメイン - banurldomain.txt : 投稿禁止URLドメイン
- banuserid.txt : 登録禁止ユーザーid - banuserid.txt : 登録禁止ユーザーid
- admininfo.txt : 管理者名(てすとまる/@sampledayo)
- contact.txt : 管理者への連絡用メアド(sample@test.com) - contact.txt : 管理者への連絡用メアド(sample@test.com)
- info.txt : サーバー登録時に表示されるメッセージ(好きな内容) - info.txt : サーバー登録時に表示されるメッセージ(好きな内容)
- privacypolicy.txt : プライバシーポリシー(サーバーのプライバシーポリシーを記載) - privacypolicy.txt : プライバシーポリシー(サーバーのプライバシーポリシーを記載)
+27
View File
@@ -1,4 +1,10 @@
<?php <?php
$mojisizefile = "../server/textsize.txt";
$banurldomainfile = "../server/banurldomain.txt";
$banurl_info = file_get_contents($banurldomainfile);
$banurl = preg_split("/\r\n|\n|\r/", $banurl_info);
require('../db.php'); require('../db.php');
if (htmlentities(isset($_POST['uniqid'])) && htmlentities(isset($_POST['abitext'])) && htmlentities(isset($_POST['userid'])) && htmlentities(isset($_POST['account_id']))) { if (htmlentities(isset($_POST['uniqid'])) && htmlentities(isset($_POST['abitext'])) && htmlentities(isset($_POST['userid'])) && htmlentities(isset($_POST['account_id']))) {
@@ -68,6 +74,27 @@ if (htmlentities(isset($_POST['uniqid'])) && htmlentities(isset($_POST['abitext'
if($result2["loginid"] === $loginid){ if($result2["loginid"] === $loginid){
// 文字数を確認
if( (int)htmlspecialchars(file_get_contents($mojisizefile), ENT_QUOTES, 'UTF-8') < mb_strlen($abitext, '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($abitext, 'https://'.$banurl[$i])) {
$err = "contains_prohibited_url";
$response = array(
'error_code' => $err,
);
echo json_encode($response, JSON_UNESCAPED_UNICODE);
exit;
}
}
try { try {
$pdo = new PDO('mysql:charset=utf8mb4;dbname='.DB_NAME.';host='.DB_HOST , DB_USER, DB_PASS); $pdo = new PDO('mysql:charset=utf8mb4;dbname='.DB_NAME.';host='.DB_HOST , DB_USER, DB_PASS);
+81
View File
@@ -0,0 +1,81 @@
<?php
$activitypub_file = "../server/activitypub.txt";
if(file_get_contents($activitypub_file) === "true"){
header("Content-Type: application/json; charset=utf-8");
$domain = $_SERVER['HTTP_HOST'];
require('../db.php');
// データベースに接続
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();
}
$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);
}
}
?>
+389 -10
View File
@@ -1,4 +1,7 @@
<?php <?php
$domain = $_SERVER['HTTP_HOST'];
$mojisizefile = "../server/textsize.txt"; $mojisizefile = "../server/textsize.txt";
$banurldomainfile = "../server/banurldomain.txt"; $banurldomainfile = "../server/banurldomain.txt";
@@ -43,9 +46,13 @@ function get_mentions_userid($postText) {
return $mentionedUsers; return $mentionedUsers;
} }
if(isset($_GET['token'])&&isset($_GET['ueuse'])) { if(isset($_GET['token'])&&isset($_GET['type'])) {
$token = htmlentities($_GET['token']); $token = htmlentities($_GET['token']);
$type = htmlentities($_GET['type']);
if($type === "post" || $type === "ueuse"){
if(isset($_GET['ueuse'])) {
$ueuse = nl2br(htmlentities($_GET['ueuse'])); $ueuse = nl2br(htmlentities($_GET['ueuse']));
if( empty($ueuse) ) { if( empty($ueuse) ) {
@@ -53,7 +60,6 @@ if(isset($_GET['token'])&&isset($_GET['ueuse'])) {
$response = array( $response = array(
'error_code' => $err, 'error_code' => $err,
); );
echo json_encode($response, JSON_UNESCAPED_UNICODE); echo json_encode($response, JSON_UNESCAPED_UNICODE);
exit; exit;
} else { } else {
@@ -63,7 +69,6 @@ if(isset($_GET['token'])&&isset($_GET['ueuse'])) {
$response = array( $response = array(
'error_code' => $err, 'error_code' => $err,
); );
echo json_encode($response, JSON_UNESCAPED_UNICODE); echo json_encode($response, JSON_UNESCAPED_UNICODE);
exit; exit;
} }
@@ -82,7 +87,7 @@ if(isset($_GET['token'])&&isset($_GET['ueuse'])) {
} }
if($token === 'ice'){ if($token === 'ice'){
$err = "input_error"; $err = "this_account_has_been_frozen";
$response = array( $response = array(
'error_code' => $err, 'error_code' => $err,
); );
@@ -90,7 +95,7 @@ if(isset($_GET['token'])&&isset($_GET['ueuse'])) {
echo json_encode($response, JSON_UNESCAPED_UNICODE); echo json_encode($response, JSON_UNESCAPED_UNICODE);
exit; exit;
}elseif($token === ''){ }elseif($token === ''){
$err = "input_error"; $err = "token_input_error";
$response = array( $response = array(
'error_code' => $err, 'error_code' => $err,
); );
@@ -107,20 +112,16 @@ if(isset($_GET['token'])&&isset($_GET['ueuse'])) {
session_start(); session_start();
try { try {
$option = array( $option = array(
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::MYSQL_ATTR_MULTI_STATEMENTS => false PDO::MYSQL_ATTR_MULTI_STATEMENTS => false
); );
$pdo = new PDO('mysql:charset=utf8mb4;dbname='.DB_NAME.';host='.DB_HOST , DB_USER, DB_PASS, $option); $pdo = new PDO('mysql:charset=utf8mb4;dbname='.DB_NAME.';host='.DB_HOST , DB_USER, DB_PASS, $option);
} catch(PDOException $e) { } catch(PDOException $e) {
// 接続エラーのときエラー内容を取得する // 接続エラーのときエラー内容を取得する
$error_message[] = $e->getMessage(); $error_message[] = $e->getMessage();
} }
if( !empty($pdo) ) { if( !empty($pdo) ) {
// データベース接続の設定 // データベース接続の設定
@@ -130,7 +131,7 @@ if(isset($_GET['token'])&&isset($_GET['ueuse'])) {
PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => true, PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => true,
)); ));
$userQuery = $dbh->prepare("SELECT username, userid FROM account WHERE token = :token"); $userQuery = $dbh->prepare("SELECT username, userid, role FROM account WHERE token = :token");
$userQuery->bindValue(':token', $token); $userQuery->bindValue(':token', $token);
$userQuery->execute(); $userQuery->execute();
$userData = $userQuery->fetch(); $userData = $userQuery->fetch();
@@ -140,8 +141,16 @@ if(isset($_GET['token'])&&isset($_GET['ueuse'])) {
$response = array( $response = array(
'error_code' => $err, '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); echo json_encode($response, JSON_UNESCAPED_UNICODE);
exit;
}else{ }else{
// 書き込み日時を取得 // 書き込み日時を取得
$username = $userData["username"]; $username = $userData["username"];
@@ -227,6 +236,7 @@ if(isset($_GET['token'])&&isset($_GET['ueuse'])) {
if( $res ) { if( $res ) {
$response = array( $response = array(
'uniqid' => $uniqid, 'uniqid' => $uniqid,
'userid' => $userid,
); );
echo json_encode($response, JSON_UNESCAPED_UNICODE); echo json_encode($response, JSON_UNESCAPED_UNICODE);
@@ -243,6 +253,375 @@ if(isset($_GET['token'])&&isset($_GET['ueuse'])) {
$stmt = null; $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 {
// 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', $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);
$stmt->bindParam(':title', $title, PDO::PARAM_STR);
$stmt->bindParam(':datetime', $datetime, 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 = "post_not_found";
$response = array(
'error_code' => $err,
);
echo json_encode($response, JSON_UNESCAPED_UNICODE);
exit;
}
}
}
}else{
$err = "input_not_found";
$response = array(
'error_code' => $err,
);
echo json_encode($response, JSON_UNESCAPED_UNICODE);
exit;
}
}
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(
'error_code' => "critical_error_userdata_not_found",
);
}else{
$followcnts = explode(',', $userdata["follow"]);
$userdata["follow_cnt"] = count($followcnts)-1;
$followercnts = explode(',', $userdata["follower"]);
$userdata["follower_cnt"] = count($followercnts)-1;
$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"]),
'follower' => htmlentities($userdata["follower"]),
'follower_cnt' => htmlentities($userdata["follower_cnt"]),
);
}
echo json_encode($response, JSON_UNESCAPED_UNICODE);;
}
}
}
}else{ }else{
+6 -2
View File
@@ -5,6 +5,7 @@ if(isset($_GET['userid'])) {
$search = htmlentities($_GET['userid']); $search = htmlentities($_GET['userid']);
$domain = $_SERVER['HTTP_HOST'];
require('../db.php'); require('../db.php');
@@ -36,7 +37,7 @@ session_start();
PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => true, 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->bindValue(':userid', $search);
$userQuery->execute(); $userQuery->execute();
$userdata = $userQuery->fetch(); $userdata = $userQuery->fetch();
@@ -54,7 +55,10 @@ if (empty($userdata)){
$response = array( $response = array(
'user_name' => htmlentities($userdata["username"]), 'user_name' => htmlentities($userdata["username"]),
'user_id' => htmlentities($userdata["userid"]),
'profile' => htmlentities($userdata["profile"]), 'profile' => htmlentities($userdata["profile"]),
'user_icon' => htmlentities("https://".$domain."/".$userdata["iconname"]),
'user_header' => htmlentities("https://".$domain."/".$userdata["headname"]),
'registered_date' => htmlentities($userdata["datetime"]), 'registered_date' => htmlentities($userdata["datetime"]),
'follow' => htmlentities($userdata["follow"]), 'follow' => htmlentities($userdata["follow"]),
'follow_cnt' => htmlentities($userdata["follow_cnt"]), 'follow_cnt' => htmlentities($userdata["follow_cnt"]),
@@ -62,7 +66,7 @@ if (empty($userdata)){
'follower_cnt' => htmlentities($userdata["follower_cnt"]), 'follower_cnt' => htmlentities($userdata["follower_cnt"]),
); );
} }
echo json_encode($response, JSON_UNESCAPED_UNICODE);; echo json_encode($response, JSON_UNESCAPED_UNICODE);
}else{ }else{
+232 -19
View File
@@ -466,7 +466,7 @@ main{
margin-top: 12px; margin-top: 12px;
margin-left: 12px; margin-left: 12px;
margin-right: 12px; margin-right: 12px;
width: 62%; width: 60%;
background-color: var(--tl-color-color); background-color: var(--tl-color-color);
box-shadow:0 0px 48px 0 rgba(0, 0, 0, .05); box-shadow:0 0px 48px 0 rgba(0, 0, 0, .05);
border: 1px solid var(--main-color); border: 1px solid var(--main-color);
@@ -537,6 +537,18 @@ main h1{
font-weight: 900; 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{ .userheader .profile p{
text-align: left; text-align: left;
margin-top: 12px; margin-top: 12px;
@@ -1599,6 +1611,100 @@ main h1{
filter: brightness(100%) blur(0px) saturate(100%); 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{ .tokonone p{
text-align: center; text-align: center;
margin-top: 64px; margin-top: 64px;
@@ -1674,9 +1780,10 @@ main h1{
cursor: pointer; cursor: pointer;
border: none; border: none;
display: block; display: block;
width:6%; width: 24px;
height: 24px; height: 24px;
padding: 8px auto; padding: 6px 6px;
margin-left: 6px; margin-left: 6px;
margin-right: 6px; margin-right: 6px;
@@ -1701,11 +1808,9 @@ main h1{
background-color: var(--main-color); background-color: var(--main-color);
color: var(--sub-color); color: var(--sub-color);
box-shadow:0 0px 48px 0 rgba(0, 0, 0, .2); box-shadow:0 0px 48px 0 rgba(0, 0, 0, .2);
width:7%;
} }
.sendbox label:active{ .sendbox label:active{
box-shadow:0 0px 48px 0 rgba(0, 0, 0, .05); box-shadow:0 0px 48px 0 rgba(0, 0, 0, .05);
width:5%;
} }
.sendbox label svg{ .sendbox label svg{
margin: auto; margin: auto;
@@ -1749,7 +1854,7 @@ main h1{
background-color: var(--main-color); background-color: var(--main-color);
width: auto; width: auto;
height: auto; height: auto;
color: var(--background-color); color: var(--sub-color);
position: relative; position: relative;
border-radius: 50px; border-radius: 50px;
transition: all 250ms ease-out; transition: all 250ms ease-out;
@@ -2476,7 +2581,7 @@ label>input {
margin-top: 12px; margin-top: 12px;
margin-left: 12px; margin-left: 12px;
margin-right: 12px; margin-right: 12px;
width: 24%; width: 260px;
height: 92.5dvh; height: 92.5dvh;
background-color: var(--background-color); background-color: var(--background-color);
padding: 12px; padding: 12px;
@@ -2534,6 +2639,7 @@ label>input {
font-weight: normal; font-weight: normal;
font-size: 16px; font-size: 16px;
text-align: left; text-align: left;
overflow-wrap:break-word;
color: var(--text-color); color: var(--text-color);
} }
@@ -2587,7 +2693,7 @@ label>input {
.rightbox .btmbox{ .rightbox .btmbox{
position: absolute; position: absolute;
bottom: 12px; /*下に固定*/ bottom: 36px; /*下に固定*/
height: 320px; height: 320px;
width: 90%; width: 90%;
} }
@@ -3741,6 +3847,41 @@ summary {
box-shadow:0 0px 48px 0 rgba(0, 0, 0, .05); 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{ .sendbox label{
cursor: pointer;
border: none;
display: block; display: block;
flex-shrink: 0; width: 24px;
text-align: center; height: 24px;
width:10%; padding: 6px 6px;
padding: 6px 2.6px;
margin-left: 6px; margin-left: 6px;
margin-right: 6px; margin-right: 6px;
padding-top: 6px; padding-top: 6px;
padding-bottom: 6px; padding-bottom: 6px;
}
.sendbox label:hover{
width:11%; background-color: var(--main-color);
} text-align: center;
.sendbox label:active{
width:9%;
} }
.sendbox label img{ .sendbox label img{
vertical-align:bottom; vertical-align:bottom;
@@ -4234,6 +4376,46 @@ summary {
font-family: 'BIZ UDPGothic', sans-serif; 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{ .leftbox{
display: block; display: block;
border-radius: 17px; border-radius: 17px;
@@ -4241,7 +4423,7 @@ summary {
margin-left: 12px; margin-left: 12px;
margin-right: 12px; margin-right: 12px;
margin-bottom: 12px; margin-bottom: 12px;
background-color: var(--background-color)FFF; background-color: var(--background-color);
width: 18%; width: 18%;
height: 100%; height: 100%;
margin-left: 0px; margin-left: 0px;
@@ -5183,6 +5365,27 @@ summary {
border: none; 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{ .userheader h2{
color:var(--sub-color); color:var(--sub-color);
} }
@@ -5191,6 +5394,10 @@ summary {
color: var(--dark-subtext-color); color: var(--dark-subtext-color);
} }
.userheader span{
color: var(--subtext-color);
}
.userheader .profile p{ .userheader .profile p{
color:var(--sub-color); color:var(--sub-color);
} }
@@ -5664,4 +5871,10 @@ summary {
.servericon img{ .servericon img{
box-shadow:none; box-shadow:none;
} }
.f_c_area{
background-color: var(--dark-background-color);
}
.f_c_area .fcnt p{
color: var(--dark-text-color);
}
} }
+2 -2
View File
@@ -1,8 +1,8 @@
<?php // データベースの接続情報 <?php // データベースの接続情報
define( 'DB_HOST', 'localhost'); define( 'DB_HOST', 'localhost');
define( 'DB_USER', 'root'); define( 'DB_USER', 'rood');
define( 'DB_PASS', 'root'); define( 'DB_PASS', 'root');
define( 'DB_NAME', 'uwuzu'); define( 'DB_NAME', 'account');
// タイムゾーン設定 // タイムゾーン設定
date_default_timezone_set('Asia/Tokyo'); date_default_timezone_set('Asia/Tokyo');
+14 -7
View File
@@ -1,12 +1,19 @@
<?php
$serverstopfile = "../server/serverstop.txt";
$servernamefile = "../server/servername.txt";
$domain = $_SERVER['HTTP_HOST'];
?>
<!DOCTYPE html> <!DOCTYPE html>
<html lang="ja"> <html lang="ja">
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<link rel="stylesheet" href="home.css"> <link rel="stylesheet" href="/css/home.css">
<script src="../js/console_notice.js"></script> <script src="/js/console_notice.js"></script>
<meta name="viewport" content="width=device-width,initial-scale=1"> <meta name="viewport" content="width=device-width,initial-scale=1">
<title>サーバー停止 - ゆずさば</title> <title>サーバー停止 - </title>
</head> </head>
@@ -14,20 +21,20 @@
<div class="topbox"> <div class="topbox">
<div class="logo"> <div class="logo">
<img src="uwuzulogo.svg"> <img src="/img/uwuzulogo.svg">
</div> </div>
</div> </div>
<div class="terms"> <div class="terms">
<div class="p3">ゆずさば</div> <div class="p3"><?php echo file_get_contents($servernamefile);?></div>
<div class="p2c">uwuzu.net</div> <div class="p2c"><?php echo $domain;?></div>
<div class="err404"> <div class="err404">
<h1>サーバー停止中</h1> <h1>サーバー停止中</h1>
<p>(/´・ヮ・`\)<br>現在サーバーが管理者によって停止されています...<br>停止の理由は以下の通りです。</p> <p>(/´・ヮ・`\)<br>現在サーバーが管理者によって停止されています...<br>停止の理由は以下の通りです。</p>
<hr> <hr>
<p>あまりにも脆弱すぎたためサービスを止めさせていただきました。<br>復旧の目処はたっておりません。</p> <p><?php if( !empty(file_get_contents($serverstopfile)) ){ echo htmlspecialchars(file_get_contents($serverstopfile), ENT_QUOTES, 'UTF-8'); } ?></p>
</div> </div>
+1
View File
@@ -1,4 +1,5 @@
<?php <?php
$servernamefile = "../server/servername.txt"; $servernamefile = "../server/servername.txt";
$mojisizefile = "../server/textsize.txt"; $mojisizefile = "../server/textsize.txt";
+1
View File
@@ -0,0 +1 @@
<svg id="block" xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path d="M480-80q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-80q54 0 104-17.5t92-50.5L228-676q-33 42-50.5 92T160-480q0 134 93 227t227 93Zm252-124q33-42 50.5-92T800-480q0-134-93-227t-227-93q-54 0-104 17.5T284-732l448 448Z"/></svg>

After

Width:  |  Height:  |  Size: 468 B

+1
View File
@@ -0,0 +1 @@
<svg id="block" xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path d="M480-80q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q65 0 123 19t107 53l-58 59q-38-24-81-37.5T480-800q-133 0-226.5 93.5T160-480q0 133 93.5 226.5T480-160q133 0 226.5-93.5T800-480q0-18-2-36t-6-35l65-65q11 32 17 66t6 70q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm-56-216L254-466l56-56 114 114 400-401 56 56-456 457Z"/></svg>

After

Width:  |  Height:  |  Size: 478 B

+10 -1
View File
@@ -27,6 +27,12 @@ try {
$userid = htmlentities($_GET['userid']); $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ページあたりのユーズ数 $itemsPerPage = 15; // 1ページあたりのユーズ数
$pageNumber = htmlentities(isset($_GET['page'])) ? htmlentities(intval($_GET['page'])) : 1; $pageNumber = htmlentities(isset($_GET['page'])) ? htmlentities(intval($_GET['page'])) : 1;
$offset = ($pageNumber - 1) * $itemsPerPage; $offset = ($pageNumber - 1) * $itemsPerPage;
@@ -110,7 +116,8 @@ if (!empty($pdo)) {
if(!empty($messages)){ if(!empty($messages)){
foreach ($messages as $value) { foreach ($messages as $value) {
if (false === strpos($myblocklist, ','.htmlentities($value['account'], ENT_QUOTES, 'UTF-8'))) {
if(!($value["role"] === "ice")){
$fav = $value['favorite']; // コンマで区切られたユーザーIDを含む変数 $fav = $value['favorite']; // コンマで区切られたユーザーIDを含む変数
// コンマで区切って配列に分割し、要素数を数える // コンマで区切って配列に分割し、要素数を数える
@@ -120,6 +127,8 @@ if (!empty($pdo)) {
$messageDisplay = new MessageDisplay($value, $userid); // $userid をコンストラクタに渡す $messageDisplay = new MessageDisplay($value, $userid); // $userid をコンストラクタに渡す
$messageDisplay->display(); $messageDisplay->display();
} }
}
}
if($message['ads'] === "true"){ if($message['ads'] === "true"){
echo '<div class="ads"><a href = "' . htmlentities($message['ads_url']) . '"><img src="' . htmlentities($message['ads_img_url']) . '" title="' . htmlentities($message['ads_memo']) . '"></a></div>'; echo '<div class="ads"><a href = "' . htmlentities($message['ads_url']) . '"><img src="' . htmlentities($message['ads_img_url']) . '" title="' . htmlentities($message['ads_memo']) . '"></a></div>';
} }
+10 -1
View File
@@ -27,6 +27,12 @@ try {
$userid = htmlentities($_GET['userid']); $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ページあたりのユーズ数 $itemsPerPage = 15; // 1ページあたりのユーズ数
$pageNumber = htmlentities(isset($_GET['page'])) ? htmlentities(intval($_GET['page'])) : 1; $pageNumber = htmlentities(isset($_GET['page'])) ? htmlentities(intval($_GET['page'])) : 1;
$offset = ($pageNumber - 1) * $itemsPerPage; $offset = ($pageNumber - 1) * $itemsPerPage;
@@ -87,7 +93,8 @@ if (!empty($pdo)) {
if(!empty($messages)){ if(!empty($messages)){
foreach ($messages as $value) { foreach ($messages as $value) {
if (false === strpos($myblocklist, ','.htmlentities($value['account'], ENT_QUOTES, 'UTF-8'))) {
if(!($value["role"] === "ice")){
$fav = $value['favorite']; // コンマで区切られたユーザーIDを含む変数 $fav = $value['favorite']; // コンマで区切られたユーザーIDを含む変数
// コンマで区切って配列に分割し、要素数を数える // コンマで区切って配列に分割し、要素数を数える
@@ -97,6 +104,8 @@ if (!empty($pdo)) {
$messageDisplay = new MessageDisplay($value, $userid); // $userid をコンストラクタに渡す $messageDisplay = new MessageDisplay($value, $userid); // $userid をコンストラクタに渡す
$messageDisplay->display(); $messageDisplay->display();
} }
}
}
if($message['ads'] === "true"){ if($message['ads'] === "true"){
echo '<div class="ads"><a href = "' . htmlentities($message['ads_url']) . '"><img src="' . htmlentities($message['ads_img_url']) . '" title="' . htmlentities($message['ads_memo']) . '"></a></div>'; echo '<div class="ads"><a href = "' . htmlentities($message['ads_url']) . '"><img src="' . htmlentities($message['ads_img_url']) . '" title="' . htmlentities($message['ads_memo']) . '"></a></div>';
} }
+30 -1
View File
@@ -13,6 +13,8 @@ require('../db.php');
require('view.php'); require('view.php');
require('user_view.php');
// データベースに接続 // データベースに接続
try { try {
$option = array( $option = array(
@@ -32,6 +34,7 @@ $userid = htmlentities($_GET['userid']);
$messages = array(); $messages = array();
if (!empty($pdo)) { if (!empty($pdo)) {
if (!empty($keyword)) {
$dbh = new PDO('mysql:charset=utf8mb4;dbname='.DB_NAME.';host='.DB_HOST, DB_USER, DB_PASS, array( $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_ERRMODE => PDO::ERRMODE_EXCEPTION,
@@ -56,6 +59,16 @@ if (!empty($pdo)) {
$message_array = $messageQuery->fetchAll(); $message_array = $messageQuery->fetchAll();
} }
$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;
}
$messages = array(); $messages = array();
foreach ($message_array as $row) { foreach ($message_array as $row) {
@@ -86,6 +99,20 @@ if (!empty($pdo)) {
} }
} }
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)){ if(!empty($messages)){
foreach ($messages as $value) { foreach ($messages as $value) {
@@ -103,7 +130,9 @@ if (!empty($pdo)) {
} }
$pdo = null; $pdo = null;
}else{
echo '<div class="tokonone" id="noueuse"><p>検索ワードを入力してください。</p></div>';
}
} }
?> ?>
+8
View File
@@ -27,6 +27,12 @@ try {
$userid = htmlentities($_GET['userid']); $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']) : ''; $ueuseid = htmlentities(isset($_GET['id'])) ? htmlentities($_GET['id']) : '';
$itemsPerPage = 15; // 1ページあたりの投稿数 $itemsPerPage = 15; // 1ページあたりの投稿数
@@ -104,6 +110,7 @@ if (!empty($pdo)) {
if(!empty($messages)){ if(!empty($messages)){
foreach ($messages as $value) { foreach ($messages as $value) {
if (false === strpos($myblocklist, ','.htmlentities($value['account'], ENT_QUOTES, 'UTF-8'))) {
$fav = $value['favorite']; // コンマで区切られたユーザーIDを含む変数 $fav = $value['favorite']; // コンマで区切られたユーザーIDを含む変数
// コンマで区切って配列に分割し、要素数を数える // コンマで区切って配列に分割し、要素数を数える
@@ -113,6 +120,7 @@ if (!empty($pdo)) {
$messageDisplay = new MessageDisplay($value, $userid); $messageDisplay = new MessageDisplay($value, $userid);
$messageDisplay->display(); $messageDisplay->display();
} }
}
if($message['ads'] === "true"){ if($message['ads'] === "true"){
echo '<div class="ads"><a href = "' . htmlentities($message['ads_url']) . '"><img src="' . htmlentities($message['ads_img_url']) . '" title="' . htmlentities($message['ads_memo']) . '"></a></div>'; echo '<div class="ads"><a href = "' . htmlentities($message['ads_url']) . '"><img src="' . htmlentities($message['ads_img_url']) . '" title="' . htmlentities($message['ads_memo']) . '"></a></div>';
} }
+54
View File
@@ -0,0 +1,54 @@
<?php
class UserdataDisplay {
private $uservalue;
private $userid;
public function __construct($uservalue, $userid) {
$this->value = $uservalue;
$this->userid = $userid;
}
public function display() {
if (empty($this->value)) {
echo '<div class="tokonone" id="noueuse"><p>ユーザーがいません</p></div>';
} else {
echo '<div class="ueuse">';
echo '<div class="headbox">';
echo ' <a href="/@' . htmlentities($this->value['userid']) . '"><img src="'. htmlentities('../'.$this->value['headname']) . '"></a>';
echo '</div>';
echo '<div class="flebox">';
echo ' <div class="user">';
echo ' <a href="/@' . htmlentities($this->value['userid']) . '"><img src="'. htmlentities('../'.$this->value['iconname']) . '"></a>';
echo ' <a href="/@' . htmlentities($this->value['userid']) . '">' . htmlentities($this->value['username']) . '</a>';
echo ' <div class="idbox">';
echo ' <a href="/@' . htmlentities($this->value['userid']) . '">@' . htmlentities($this->value['userid']) . '</a>';
echo ' </div>';
if(!empty($this->value['sacinfo'])){
if($this->value['sacinfo'] === "bot"){
echo '<div class="bot">Bot</div>';
}
}
if (false !== strpos($this->value['role'], 'official')) {
echo ' <div class="checkicon">';
echo ' <div class="check" />';
echo ' </div>';
echo '</div>';
}
echo '</div>';
echo '</div>';
echo '<div class="profilebox">';
echo ' <p>' .replaceEmojisWithImages(replaceURLsWithLinks(nl2br($this->value['profile']))) . '</h1></h2></h3></font></center></p>';
echo '</div>';
echo '</div>';
}
}
}
?>
+8
View File
@@ -29,6 +29,12 @@ try {
$uwuzuid = htmlentities(isset($_GET['id'])) ? htmlentities($_GET['id']) : ''; $uwuzuid = htmlentities(isset($_GET['id'])) ? htmlentities($_GET['id']) : '';
$userid = htmlentities($_GET['userid']); $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ページあたりのユーズ数 $itemsPerPage = 15; // 1ページあたりのユーズ数
$pageNumber = htmlentities(isset($_GET['page'])) ? htmlentities(intval($_GET['page'])) : 1; $pageNumber = htmlentities(isset($_GET['page'])) ? htmlentities(intval($_GET['page'])) : 1;
$offset = ($pageNumber - 1) * $itemsPerPage; $offset = ($pageNumber - 1) * $itemsPerPage;
@@ -102,6 +108,7 @@ if (!empty($pdo)) {
if(!empty($messages)){ if(!empty($messages)){
foreach ($messages as $value) { foreach ($messages as $value) {
if (false === strpos($myblocklist, ','.htmlentities($value['account'], ENT_QUOTES, 'UTF-8'))) {
$fav = $value['favorite']; // コンマで区切られたユーザーIDを含む変数 $fav = $value['favorite']; // コンマで区切られたユーザーIDを含む変数
@@ -112,6 +119,7 @@ if (!empty($pdo)) {
$messageDisplay = new MessageDisplay($value, $userid); $messageDisplay = new MessageDisplay($value, $userid);
$messageDisplay->display(); $messageDisplay->display();
} }
}
if($message['ads'] === "true"){ if($message['ads'] === "true"){
echo '<div class="ads"><a href = "' . htmlentities($message['ads_url']) . '"><img src="' . htmlentities($message['ads_img_url']) . '" title="' . htmlentities($message['ads_memo']) . '"></a></div>'; echo '<div class="ads"><a href = "' . htmlentities($message['ads_url']) . '"><img src="' . htmlentities($message['ads_img_url']) . '" title="' . htmlentities($message['ads_memo']) . '"></a></div>';
} }
+8 -1
View File
@@ -29,6 +29,12 @@ try {
$uwuzuid = htmlentities(isset($_GET['id'])) ? htmlentities($_GET['id']) : ''; $uwuzuid = htmlentities(isset($_GET['id'])) ? htmlentities($_GET['id']) : '';
$userid = htmlentities($_GET['userid']); $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ページあたりのユーズ数 $itemsPerPage = 15; // 1ページあたりのユーズ数
$pageNumber = htmlentities(isset($_GET['page'])) ? htmlentities(intval($_GET['page'])) : 1; $pageNumber = htmlentities(isset($_GET['page'])) ? htmlentities(intval($_GET['page'])) : 1;
$offset = ($pageNumber - 1) * $itemsPerPage; $offset = ($pageNumber - 1) * $itemsPerPage;
@@ -102,7 +108,7 @@ if (!empty($pdo)) {
if(!empty($messages)){ if(!empty($messages)){
foreach ($messages as $value) { foreach ($messages as $value) {
if (false === strpos($myblocklist, ','.htmlentities($value['account'], ENT_QUOTES, 'UTF-8'))) {
$fav = $value['favorite']; // コンマで区切られたユーザーIDを含む変数 $fav = $value['favorite']; // コンマで区切られたユーザーIDを含む変数
// コンマで区切って配列に分割し、要素数を数える // コンマで区切って配列に分割し、要素数を数える
@@ -112,6 +118,7 @@ if (!empty($pdo)) {
$messageDisplay = new MessageDisplay($value, $userid); $messageDisplay = new MessageDisplay($value, $userid);
$messageDisplay->display(); $messageDisplay->display();
} }
}
if($message['ads'] === "true"){ if($message['ads'] === "true"){
echo '<div class="ads"><a href = "' . htmlentities($message['ads_url']) . '"><img src="' . htmlentities($message['ads_img_url']) . '" title="' . htmlentities($message['ads_memo']) . '"></a></div>'; echo '<div class="ads"><a href = "' . htmlentities($message['ads_url']) . '"><img src="' . htmlentities($message['ads_img_url']) . '" title="' . htmlentities($message['ads_memo']) . '"></a></div>';
} }
+8 -1
View File
@@ -29,6 +29,12 @@ try {
$uwuzuid = htmlentities(isset($_GET['id'])) ? htmlentities($_GET['id']) : ''; $uwuzuid = htmlentities(isset($_GET['id'])) ? htmlentities($_GET['id']) : '';
$userid = htmlentities($_GET['userid']); $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ページあたりのユーズ数 $itemsPerPage = 15; // 1ページあたりのユーズ数
$pageNumber = htmlentities(isset($_GET['page'])) ? htmlentities(intval($_GET['page'])) : 1; $pageNumber = htmlentities(isset($_GET['page'])) ? htmlentities(intval($_GET['page'])) : 1;
$offset = ($pageNumber - 1) * $itemsPerPage; $offset = ($pageNumber - 1) * $itemsPerPage;
@@ -102,7 +108,7 @@ if (!empty($pdo)) {
if(!empty($messages)){ if(!empty($messages)){
foreach ($messages as $value) { foreach ($messages as $value) {
if (false === strpos($myblocklist, ','.htmlentities($value['account'], ENT_QUOTES, 'UTF-8'))) {
$fav = $value['favorite']; // コンマで区切られたユーザーIDを含む変数 $fav = $value['favorite']; // コンマで区切られたユーザーIDを含む変数
// コンマで区切って配列に分割し、要素数を数える // コンマで区切って配列に分割し、要素数を数える
@@ -112,6 +118,7 @@ if (!empty($pdo)) {
$messageDisplay = new MessageDisplay($value, $userid); $messageDisplay = new MessageDisplay($value, $userid);
$messageDisplay->display(); $messageDisplay->display();
} }
}
if($message['ads'] === "true"){ if($message['ads'] === "true"){
echo '<div class="ads"><a href = "' . htmlentities($message['ads_url']) . '"><img src="' . htmlentities($message['ads_img_url']) . '" title="' . htmlentities($message['ads_memo']) . '"></a></div>'; echo '<div class="ads"><a href = "' . htmlentities($message['ads_url']) . '"><img src="' . htmlentities($message['ads_img_url']) . '" title="' . htmlentities($message['ads_memo']) . '"></a></div>';
} }
+105
View File
@@ -0,0 +1,105 @@
<?php
$activitypub_file = "../../server/activitypub.txt";
if(file_get_contents($activitypub_file) === "true"){
header("Content-Type: application/json; charset=utf-8");
$mojisizefile = "../../server/textsize.txt";
$adminfile = "../../server/admininfo.txt";
$servernamefile = "../../server/servername.txt";
$serverinfofile = '../../server/info.txt';
$serverinfo = file_get_contents($serverinfofile);
$contactfile = "../../server/contact.txt";
$domain = $_SERVER['HTTP_HOST'];
$softwarefile = "../../server/uwuzuinfo.txt";
$softwaredata = file_get_contents($softwarefile);
$onlyuserfile = "../../server/onlyuser.txt";
$onlyuser = file_get_contents($onlyuserfile);
$softwaredata = explode( "\n", $softwaredata );
$cnt = count( $softwaredata );
for( $i=0;$i<$cnt;$i++ ){
$uwuzuinfo[$i] = ($softwaredata[$i]);
}
require('../../db.php');
// データベースに接続
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();
}
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);
}
?>
+9 -3
View File
@@ -493,15 +493,21 @@ require('../logout/logout.php');
<p>これにより投稿内容(ueuse)と、ユーザーネーム(user_name)、ユーザーID(userid)、投稿ID(uniqid)、写真・動画URL(photo1,photo2,video1)、いいねした人一覧(favorite)、いいね数(favorite_cnt)、投稿日時(datetime)、追記内容(abi)、追記日時(abidatetime)が取得できます。<br>page=は指定しなくても動作します。(https://[ドメイン名(uwuzu.netなど)]/api/ltl-api?limit=[取得件数])</p> <p>これにより投稿内容(ueuse)と、ユーザーネーム(user_name)、ユーザーID(userid)、投稿ID(uniqid)、写真・動画URL(photo1,photo2,video1)、いいねした人一覧(favorite)、いいね数(favorite_cnt)、投稿日時(datetime)、追記内容(abi)、追記日時(abidatetime)が取得できます。<br>page=は指定しなくても動作します。(https://[ドメイン名(uwuzu.netなど)]/api/ltl-api?limit=[取得件数])</p>
<hr> <hr>
<li>投稿API</li> <li>投稿API</li>
<p>https://[ドメイン名(uwuzu.netなど)]/api/bot-api?token=[アクセストークン]&ueuse=[投稿の内容]</p> <p>https://[ドメイン名(uwuzu.netなど)]/api/bot-api?token=[アクセストークン]&type=post&ueuse=[投稿の内容]</p>
<hr>
<li>アクセストークンからユーザー情報取得API</li>
<p>https://[ドメイン名(uwuzu.netなど)]/api/bot-api?token=[アクセストークン]&type=getuser</p>
<hr>
<li>返信API</li>
<p>https://[ドメイン名(uwuzu.netなど)]/api/bot-api?token=[アクセストークン]&type=reply&uniqid=[返信先のuniqid]&ueuse=[返信の内容]</p>
<hr>
<?php <?php
if(empty($userData['token'])){ if(empty($userData['token'])){
?> ?>
<p>以下のボタンよりアクセストークンを取得すると使用できます。<br>アクセストークンは一度発行すると作り直すまで再度確認はできません。また、絶対に他人に知られないように保護してください。<p> <p>以下のボタンよりアクセストークンを取得すると使用できます。<br>アクセストークンは一度発行すると作り直すまで再度確認はできません。また、絶対に他人に知られないように保護してください。<p>
<input type="submit" class = "irobutton" name="token_submit" value="アクセストークン発行"> <input type="submit" class = "irobutton" name="token_submit" value="アクセストークン発行">
<?php }elseif($userData['token']==='ice'){ ?> <?php }elseif($userData['token']==='ice'){ ?>
<p>アカウントが凍結されているため発行できません。</p> <p>クセストークンはアカウントが凍結されているため発行できません。</p>
<?php }else{ ?> <?php }else{ ?>
<p>以下のボタンよりアクセストークンを削除できます。ボタンを押すとすぐに削除されますのでご注意ください。</p> <p>以下のボタンよりアクセストークンを削除できます。ボタンを押すとすぐに削除されますのでご注意ください。</p>
<input type="submit" class = "irobutton" name="token_off_submit" value="アクセストークン削除"> <input type="submit" class = "irobutton" name="token_off_submit" value="アクセストークン削除">
+1
View File
@@ -0,0 +1 @@
false
+3 -2
View File
@@ -53,6 +53,7 @@ PHP 8では事前にGDを有効化しておいてください!(QRコードの
- datetime(datetime) アカウント作成日時保存用 - datetime(datetime) アカウント作成日時保存用
- follow(text) アカウントがフォローしている人保存用 - follow(text) アカウントがフォローしている人保存用
- follower(text) アカウントがフォローされている人保存用 - follower(text) アカウントがフォローされている人保存用
- blocklist(text) ブロックしている人保存用
- admin(varchar(25)) 管理者アカウントなら「yes」、それ以外なら「none」と入力。 - admin(varchar(25)) 管理者アカウントなら「yes」、それ以外なら「none」と入力。
- authcode(varchar(256)) 二段階認証用キー保存用 - authcode(varchar(256)) 二段階認証用キー保存用
- backupcode(varchar(256)) 二段階認証のバックアップコード保存用 - backupcode(varchar(256)) 二段階認証のバックアップコード保存用
@@ -142,10 +143,10 @@ PHP 8では事前にGDを有効化しておいてください!(QRコードの
- 404imagepath.txt : 404ページに表示する画像パス保存用 - 404imagepath.txt : 404ページに表示する画像パス保存用
- 503imagepath.txt : 503ページに表示する画像パス保存用 - 503imagepath.txt : 503ページに表示する画像パス保存用
- activitypub.txt : ActivityPub機能のオンオフ(trueまたはfalse)
- admininfo.txt : 管理者名(てすとまる/@sampledayo) - admininfo.txt : 管理者名(てすとまる/@sampledayo)
- banurldomain.txt : 投稿禁止URLドメイン - banurldomain.txt : 投稿禁止URLドメイン
- banuserid.txt : 登録禁止ユーザーid - banuserid.txt : 登録禁止ユーザーid
- admininfo.txt : 管理者名(てすとまる/@sampledayo)
- contact.txt : 管理者への連絡用メアド(sample@test.com) - contact.txt : 管理者への連絡用メアド(sample@test.com)
- info.txt : サーバー登録時に表示されるメッセージ(好きな内容) - info.txt : サーバー登録時に表示されるメッセージ(好きな内容)
- privacypolicy.txt : プライバシーポリシー(サーバーのプライバシーポリシーを記載) - privacypolicy.txt : プライバシーポリシー(サーバーのプライバシーポリシーを記載)
@@ -182,4 +183,4 @@ daichimarukanaと一緒に開発したいよ~って人は私のHPからメー
編集者 : daichimarukana 編集者 : daichimarukana
最終更新日 : 2023/09/10 18:15 最終更新日 : 2023/10/04 00:07
+2 -2
View File
@@ -1,4 +1,4 @@
uwuzu uwuzu
1.2.23 1.2.24
2023/09/16 2023/10/04
daichimarukana,putonfps daichimarukana,putonfps
+61 -1
View File
@@ -1,6 +1,66 @@
## リリースノートだぜぇぇぇぇぇぇい!!!!!!! ## リリースノートだぜぇぇぇぇぇぇい!!!!!!!
ここにはuwuzuの更新情報を載せてくぜぇ~!(いやまてテンションおかしいだろ...) ここには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 ## Version 1.2.23
リリース日:2023/09/16 リリース日:2023/09/16
アカウント登録ができない問題を修正しました。 アカウント登録ができない問題を修正しました。
@@ -19,7 +79,7 @@ UIを一部変更しました。
サーバーアイコン機能を実装しました! サーバーアイコン機能を実装しました!
アカウント登録画面をダークモード対応にしました! アカウント登録画面をダークモード対応にしました!
DBに変更があるためaccountにsacinfo[varchar(256)]を、ueuseにnsfw[varchar(25)]を追加してください。 DBに変更があるためaccountにsacinfo[varchar(256)]を、ueuseにnsfw[varchar(25)]を追加してください。
uwuzu-database.sqlも更新済みです。 uwuzu_database.sqlも更新済みです。
## Version 1.2.22 ## Version 1.2.22
リリース日:2023/09/12 リリース日:2023/09/12
+21 -21
View File
@@ -282,32 +282,22 @@ if( !empty($_POST['btn_submit']) ) {
if( !empty($_POST['pass_submit']) ) { if( !empty($_POST['pass_submit']) ) {
$pass_chk = htmlentities($_POST['passchk_userid']);
$password = $_POST['password']; $password = $_POST['password'];
$hashpassword = password_hash($password, PASSWORD_DEFAULT); $hashpassword = password_hash($password, PASSWORD_DEFAULT);
$options = array( if(empty($pass_chk)){
// SQL実行失敗時に例外をスルー $error_message[] = 'ユーザーidを入力してください。';
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, }else{
// デフォルトフェッチモードを連想配列形式に設定 if(!($pass_chk === $userData["userid"])){
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC, $error_message[] = 'ユーザーidが不正です。';
// バッファードクエリを使う(一度に結果セットを全て取得し、サーバー負荷を軽減) }
// 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($password) ) { if( empty($password) ) {
$error_message[] = 'パスワードを入力してください。'; $error_message[] = '新しいパスワードを入力してください。';
} else { } else {
$weakPasswords = array( $weakPasswords = array(
@@ -394,6 +384,7 @@ if( !empty($_POST['pass_submit']) ) {
} }
} }
if( empty($error_message) ) { if( empty($error_message) ) {
// トランザクション開始 // トランザクション開始
$pdo->beginTransaction(); $pdo->beginTransaction();
@@ -401,7 +392,7 @@ if( !empty($_POST['pass_submit']) ) {
try { try {
// SQL作成 // 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); $stmt->bindParam(':password', $hashpassword, PDO::PARAM_STR);
@@ -748,6 +739,10 @@ $pdo = null;
<div class="iconimg"> <div class="iconimg">
<img src="<?php echo htmlentities('../'.$userdata['iconname']); ?>"> <img src="<?php echo htmlentities('../'.$userdata['iconname']); ?>">
</div> </div>
<?php if($role === "ice"){?>
<p>お使いのアカウントは凍結されているため設定を変更できません</p>
<?php }else{?>
<label class="imgbtn" for="file_upload">アイコン選択 <label class="imgbtn" for="file_upload">アイコン選択
<input type="file" id="file_upload" name="image" accept="image/*"> <input type="file" id="file_upload" name="image" accept="image/*">
</label> </label>
@@ -795,9 +790,14 @@ $pdo = null;
<input type="submit" class = "irobutton" name="btn_submit" value="情報更新"> <input type="submit" class = "irobutton" name="btn_submit" value="情報更新">
<?php }?>
<hr> <hr>
<div> <div>
<p>パスワード</p> <p>ユーザーid</p>
<input id="passchk_userid" type="text" class="inbox" name="passchk_userid" oncopy="return false" onpaste="return false" oncontextmenu="return false" style="-webkit-text-security:disc;" value="">
</div>
<div>
<p>新しいパスワード</p>
<input id="password" type="text" class="inbox" name="password" oncopy="return false" onpaste="return false" oncontextmenu="return false" style="-webkit-text-security:disc;" value=""> <input id="password" type="text" class="inbox" name="password" oncopy="return false" onpaste="return false" oncontextmenu="return false" style="-webkit-text-security:disc;" value="">
</div> </div>
+1 -1
View File
@@ -268,7 +268,7 @@ require('../logout/logout.php');
<div> <div>
<p>CSS</p> <p>CSS</p>
<div class="p2">ここで指定されている色が適用されます。<br>もし適用されなかった場合はキャッシュを削除し再読み込みしてください。<br>表示がおかしくなってしまった場合はカラーコードを再度確認してください。</div> <div class="p2">ここで指定されている色が適用されます。<br>もし適用されなかった場合はキャッシュを削除し再読み込みしてください。<br>表示がおかしくなってしまった場合はカラーコードを再度確認してください。</div>
<textarea id="colordata" placeholder="uwuzu" class="inbox" type="text" name="colordata"><?php $sinfo = explode("\n", $color_info); foreach ($sinfo as $info) { echo $info; }?></textarea> <textarea id="colordata" placeholder="uwuzu" class="inbox" type="text" name="colordata"><?php $sinfo = explode("\r", $color_info); foreach ($sinfo as $info) { echo $info; }?></textarea>
</div> </div>
<input type="submit" class = "irobutton" name="btn_submit" value="保存&更新"> <input type="submit" class = "irobutton" name="btn_submit" value="保存&更新">
+2 -2
View File
@@ -287,13 +287,13 @@ require('../logout/logout.php');
<div> <div>
<p>登録禁止ユーザーid</p> <p>登録禁止ユーザーid</p>
<div class="p2">ここに入力してあるユーザーidは登録できません。<br>改行で禁止するユーザーidを指定できます。<br>すでにあるアカウントは影響を受けません。</div> <div class="p2">ここに入力してあるユーザーidは登録できません。<br>改行で禁止するユーザーidを指定できます。<br>すでにあるアカウントは影響を受けません。</div>
<textarea id="banuserid" placeholder="uwuzu" class="inbox" type="text" name="banuserid"><?php $sinfo = explode("\n", $banuserid_info); foreach ($sinfo as $info) { echo $info; }?></textarea> <textarea id="banuserid" placeholder="uwuzu" class="inbox" type="text" name="banuserid"><?php $sinfo = explode("\r", $banuserid_info); foreach ($sinfo as $info) { echo $info; }?></textarea>
</div> </div>
<div> <div>
<p>投稿禁止URLドメイン</p> <p>投稿禁止URLドメイン</p>
<div class="p2">ここに入力してあるドメインが含まれる投稿をしようとすると投稿が拒否されます。<br>なお、この機能はまだ確実な動作が保証されないためベータ版です。<br>位置情報特定サイトなどの対策等にご利用ください。</div> <div class="p2">ここに入力してあるドメインが含まれる投稿をしようとすると投稿が拒否されます。<br>なお、この機能はまだ確実な動作が保証されないためベータ版です。<br>位置情報特定サイトなどの対策等にご利用ください。</div>
<textarea id="banurldomain" placeholder="" class="inbox" type="text" name="banurldomain"><?php $sinfo = explode("\n", $banurldomain_info); foreach ($sinfo as $info) { echo $info; }?></textarea> <textarea id="banurldomain" placeholder="" class="inbox" type="text" name="banurldomain"><?php $sinfo = explode("\r", $banurldomain_info); foreach ($sinfo as $info) { echo $info; }?></textarea>
</div> </div>
<div> <div>
+1 -1
View File
@@ -243,7 +243,7 @@ require('../logout/logout.php');
<p><?php if( !empty(file_get_contents($servernamefile)) ){ echo htmlspecialchars(file_get_contents($servernamefile), ENT_QUOTES, 'UTF-8'); } ?></p> <p><?php if( !empty(file_get_contents($servernamefile)) ){ echo htmlspecialchars(file_get_contents($servernamefile), ENT_QUOTES, 'UTF-8'); } ?></p>
<hr> <hr>
<p>サーバー紹介メッセージ</p> <p>サーバー紹介メッセージ</p>
<p><?php $sinfo = explode("\n", $serverinfo); foreach ($sinfo as $info) { echo htmlspecialchars($info); }?></p> <p><?php $sinfo = explode("\n", $serverinfo); foreach ($sinfo as $info) { echo nl2br(htmlspecialchars($info)); }?></p>
<hr> <hr>
<p>サーバー管理者の名前</p> <p>サーバー管理者の名前</p>
<p><?php if( !empty(file_get_contents($adminfile)) ){ echo htmlspecialchars(file_get_contents($adminfile), ENT_QUOTES, 'UTF-8'); } ?></p> <p><?php if( !empty(file_get_contents($adminfile)) ){ echo htmlspecialchars(file_get_contents($adminfile), ENT_QUOTES, 'UTF-8'); } ?></p>
+30
View File
@@ -20,6 +20,8 @@ $serverstopfile = "../server/serverstop.txt";
$onlyuserfile = "../server/onlyuser.txt"; $onlyuserfile = "../server/onlyuser.txt";
$activitypub_file = "../server/activitypub.txt";
$err404imagefile = "../server/404imagepath.txt"; $err404imagefile = "../server/404imagepath.txt";
$robots = "../robots.txt"; $robots = "../robots.txt";
@@ -261,6 +263,14 @@ if( !empty($_POST['btn_submit']) ) {
fclose($file); fclose($file);
} }
$activitypub = $_POST['activitypub'];
if($activitypub === "true"){
$saveactivitypub = "true";
}else{
$saveactivitypub = "false";
}
$serverterms = $_POST['serverterms']; $serverterms = $_POST['serverterms'];
@@ -304,6 +314,12 @@ if( !empty($_POST['btn_submit']) ) {
fputs($file, $data); fputs($file, $data);
fclose($file); fclose($file);
//ActivityPub
$file = fopen($activitypub_file, 'w');
$data = $saveactivitypub;
fputs($file, $data);
fclose($file);
//利用規約 //利用規約
$file = fopen($servertermsfile, 'w'); $file = fopen($servertermsfile, 'w');
$data = $serverterms; $data = $serverterms;
@@ -419,6 +435,20 @@ require('../logout/logout.php');
</div> </div>
</div> </div>
<div>
<p>ActivityPubサーバーとして認識されるようにするか</p>
<div class="p2">ActivityPubの仮実装をオンにするかです。inboxに入ってきた内容には今現在これといったレスポンスを返しません。<br>また、publicKeyも返却しません。<br>現状ActivityPubサーバーと連合を組むことは出来ません。(リモートユーザーの確認程度なら出来ます。)</div>
<div class="switch_button">
<?php if(file_get_contents($activitypub_file) === "true"){?>
<input id="activitypub" class="switch_input" type='checkbox' name="activitypub" value="true" checked/>
<label for="activitypub" class="switch_label"></label>
<?php }else{?>
<input id="activitypub" class="switch_input" type='checkbox' name="activitypub" value="true" />
<label for="activitypub" class="switch_label"></label>
<?php }?>
</div>
</div>
<div> <div>
<p>利用規約</p> <p>利用規約</p>
<textarea id="serverterms" placeholder="しっかり書きましょう" class="inbox" type="text" name="serverterms"><?php $sinfo = explode("\n", $serverterms); foreach ($sinfo as $info) { echo $info; }?></textarea> <textarea id="serverterms" placeholder="しっかり書きましょう" class="inbox" type="text" name="serverterms"><?php $sinfo = explode("\n", $serverterms); foreach ($sinfo as $info) { echo $info; }?></textarea>
+1 -1
View File
@@ -299,7 +299,7 @@ if( !empty($_POST['send_water_submit']) ) {
$newrole = "user"; $newrole = "user";
$newtoken = ""; $newtoken = "";
$newadmin = "user"; $newadmin = "none";
// トランザクション開始 // トランザクション開始
$pdo->beginTransaction(); $pdo->beginTransaction();
+94
View File
@@ -0,0 +1,94 @@
<?php
$activitypub_file = "../../server/activitypub.txt";
if(file_get_contents($activitypub_file) === "true"){
header("Content-Type: application/json; charset=utf-8");
$domain = $_SERVER['HTTP_HOST'];
require('../../db.php');
// データベースに接続
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();
}
$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);
}
}
?>
+7 -2
View File
@@ -53,7 +53,7 @@ try {
if(isset($_SESSION['admin_login']) && $_SESSION['admin_login'] === true) { 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->bindValue(':userid', htmlentities($_SESSION['userid']));
$passQuery->execute(); $passQuery->execute();
$res = $passQuery->fetch(); $res = $passQuery->fetch();
@@ -67,6 +67,7 @@ if(isset($_SESSION['admin_login']) && $_SESSION['admin_login'] === true) {
$loginid = htmlentities($res["loginid"]); $loginid = htmlentities($res["loginid"]);
$role = htmlentities($res["role"]); $role = htmlentities($res["role"]);
$sacinfo = htmlentities($res["sacinfo"]); $sacinfo = htmlentities($res["sacinfo"]);
$myblocklist = htmlentities($res["blocklist"]);
$_SESSION['admin_login'] = true; $_SESSION['admin_login'] = true;
$_SESSION['userid'] = $userid; $_SESSION['userid'] = $userid;
$_SESSION['username'] = $username; $_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) { } 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->bindValue(':userid', htmlentities($_COOKIE['userid']));
$passQuery->execute(); $passQuery->execute();
$res = $passQuery->fetch(); $res = $passQuery->fetch();
@@ -113,6 +114,7 @@ if(isset($_SESSION['admin_login']) && $_SESSION['admin_login'] === true) {
$loginid = htmlentities($res["loginid"]); $loginid = htmlentities($res["loginid"]);
$role = htmlentities($res["role"]); $role = htmlentities($res["role"]);
$sacinfo = htmlentities($res["sacinfo"]); $sacinfo = htmlentities($res["sacinfo"]);
$myblocklist = htmlentities($res["blocklist"]);
$_SESSION['admin_login'] = true; $_SESSION['admin_login'] = true;
$_SESSION['userid'] = $userid; $_SESSION['userid'] = $userid;
$_SESSION['username'] = $username; $_SESSION['username'] = $username;
@@ -414,6 +416,8 @@ if( !empty($_POST['btn_submit']) ) {
foreach ($mentionedUsers as $mentionedUser) { foreach ($mentionedUsers as $mentionedUser) {
if(!($mentionedUser === $userid)){
$pdo->beginTransaction(); $pdo->beginTransaction();
try { try {
@@ -447,6 +451,7 @@ if( !empty($_POST['btn_submit']) ) {
// エラーが発生した時はロールバック // エラーが発生した時はロールバック
$pdo->rollBack(); $pdo->rollBack();
} }
}
} }
+22
View File
@@ -0,0 +1,22 @@
<?php
$activitypub_file = "../../server/activitypub.txt";
if(file_get_contents($activitypub_file) === "true"){
header("Content-Type: application/json; charset=utf-8");
$domain = $_SERVER['HTTP_HOST'];
$user = htmlentities($_GET['actor']);
$userid = str_replace('@','', str_replace('@'.$domain.'', '', $user));
$item = array(
"@context" => "https://www.w3.org/ns/activitystreams",
"summary" => "inbox of ".$userid."",
"type" => "OrderedCollection",
"totalItems" => 0,
"orderedItems" => [],
);
echo json_encode($item, JSON_UNESCAPED_UNICODE);
}
?>
+209 -11
View File
@@ -2,6 +2,8 @@
$servernamefile = "../server/servername.txt"; $servernamefile = "../server/servername.txt";
$domain = $_SERVER['HTTP_HOST'];
function createUniqId(){ function createUniqId(){
list($msec, $sec) = explode(" ", microtime()); list($msec, $sec) = explode(" ", microtime());
$hashCreateTime = $sec.floor($msec*1000000); $hashCreateTime = $sec.floor($msec*1000000);
@@ -47,7 +49,7 @@ try {
if(isset($_SESSION['admin_login']) && $_SESSION['admin_login'] === true) { 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->bindValue(':userid', htmlentities($_SESSION['userid']));
$passQuery->execute(); $passQuery->execute();
$res = $passQuery->fetch(); $res = $passQuery->fetch();
@@ -61,6 +63,7 @@ if(isset($_SESSION['admin_login']) && $_SESSION['admin_login'] === true) {
$loginid = htmlentities($res["loginid"]); $loginid = htmlentities($res["loginid"]);
$role = htmlentities($res["role"]); $role = htmlentities($res["role"]);
$sacinfo = htmlentities($res["sacinfo"]); $sacinfo = htmlentities($res["sacinfo"]);
$myblocklist = htmlentities($res["blocklist"]);
$_SESSION['admin_login'] = true; $_SESSION['admin_login'] = true;
$_SESSION['userid'] = $userid; $_SESSION['userid'] = $userid;
$_SESSION['username'] = $username; $_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) { } 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->bindValue(':userid', htmlentities($_COOKIE['userid']));
$passQuery->execute(); $passQuery->execute();
$res = $passQuery->fetch(); $res = $passQuery->fetch();
@@ -107,6 +110,7 @@ if(isset($_SESSION['admin_login']) && $_SESSION['admin_login'] === true) {
$loginid = htmlentities($res["loginid"]); $loginid = htmlentities($res["loginid"]);
$role = htmlentities($res["role"]); $role = htmlentities($res["role"]);
$sacinfo = htmlentities($res["sacinfo"]); $sacinfo = htmlentities($res["sacinfo"]);
$myblocklist = htmlentities($res["blocklist"]);
$_SESSION['admin_login'] = true; $_SESSION['admin_login'] = true;
$_SESSION['userid'] = $userid; $_SESSION['userid'] = $userid;
$_SESSION['username'] = $username; $_SESSION['username'] = $username;
@@ -173,7 +177,9 @@ if( !empty($pdo) ) {
PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => true, 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) { function replaceEmojisWithImages($postText) {
@@ -237,7 +243,7 @@ if( !empty($pdo) ) {
return $postText; 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->bindValue(':userid', $uwuzuid);
$userQuery->execute(); $userQuery->execute();
$userData = $userQuery->fetch(); $userData = $userQuery->fetch();
@@ -248,7 +254,7 @@ if( !empty($pdo) ) {
$roles = explode(',', $userData["role"]); // カンマで区切られたロールを配列に分割 $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); $rerole->bindValue(':userid', $uwuzuid);
// SQL実行 // SQL実行
@@ -289,10 +295,24 @@ if( !empty($pdo) ) {
$profileText = htmlentities($userData['profile'], ENT_QUOTES, 'UTF-8'); $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{ }else{
$userData["userid"] = "none"; $userData["userid"] = "none";
$userData['username'] = "ゆーざーなし"; $userData['username'] = "ゆーざーなし";
$ueuse_cnt = "zero";
$followCount = "zero";
$followerCount = "zero";
} }
} }
if (!empty($_POST['follow'])) { 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'); require('../logout/logout.php');
@@ -455,7 +540,6 @@ $pdo = null;
<div class="fzone"> <div class="fzone">
<div class="time"> <div class="time">
<p>紀元前3000年からuwuzuを利用して<s>います。</s>いるわけねぇだろ()</p> <p>紀元前3000年からuwuzuを利用して<s>います。</s>いるわけねぇだろ()</p>
<p>フォロー数:ない フォロワー数:いない</p>
</div> </div>
</div> </div>
<!--ここまで!---> <!--ここまで!--->
@@ -466,7 +550,7 @@ $pdo = null;
<div class="icon"> <div class="icon">
<img src="<?php echo htmlentities('../'.$userdata['iconname']); ?>"> <img src="<?php echo htmlentities('../'.$userdata['iconname']); ?>">
<h2><?php echo htmlentities($userData['username'], ENT_QUOTES, 'UTF-8'); ?></h2> <h2><?php echo htmlentities($userData['username'], ENT_QUOTES, 'UTF-8'); ?></h2>
<p>@<?php echo htmlentities($userData['userid'], ENT_QUOTES, 'UTF-8'); ?></p> <p>@<?php echo htmlentities($userData['userid'], ENT_QUOTES, 'UTF-8'); ?><!--<span>@<?php /*echo htmlentities($domain, ENT_QUOTES, 'UTF-8'); */?></span>--></p>
</div> </div>
<div class="roleboxes"> <div class="roleboxes">
@@ -480,21 +564,40 @@ $pdo = null;
<?php endforeach; ?> <?php endforeach; ?>
</div> </div>
<?php if (false === strpos($myblocklist, ','.htmlentities($userData['userid'], ENT_QUOTES, 'UTF-8'))) {?>
<div class="profile"> <div class="profile">
<p><?php echo replaceEmojisWithImages(replaceURLsWithLinks(nl2br($profileText))); ?></p> <p><?php echo replaceEmojisWithImages(replaceURLsWithLinks(nl2br($profileText))); ?></p>
</div> </div>
<?php }else{?>
<div class="profile">
<p>ブロックしているためプロフィールは表示されません。</p>
</div>
<?php }?>
</div> </div>
<div class="fzone"> <div class="fzone">
<div class="time"> <div class="time">
<p><?php echo date('Y年m月d日 H:i:s', strtotime($userdata['datetime'])); ?>からuwuzuを利用しています。</p> <p><?php echo date('Y年m月d日 H:i:s', strtotime($userdata['datetime'])); ?>からuwuzuを利用しています。</p>
<p>フォロー数:<?php echo $followCount;?> フォロワー数:<?php echo $followerCount;?></p> <p><?php if(htmlentities($userdata['role']) === "ice"){echo"このアカウントは凍結されています。";}; ?></p>
</div> </div>
<?php if(!empty($follow_yes)){?> <?php if(!empty($follow_yes)){?>
<div class="follow_yes"> <div class="follow_yes">
<p><?php echo $follow_yes;?></p> <p><?php echo $follow_yes;?></p>
</div> </div>
<?php }?> <?php }?>
<?php if ($userid !== htmlentities($userData['userid'], ENT_QUOTES, 'UTF-8')) {?>
<?php if (false !== strpos($myblocklist, ','.htmlentities($userData['userid'], ENT_QUOTES, 'UTF-8'))) {?>
<div class="follow">
<a id="un_block" href="javascript:void(0);" class="report" title="ブロック解除"><svg><use xlink:href="../img/sysimage/unblock_1.svg#block"></use></svg></a>
</div>
<?php }else{?>
<div class="follow">
<a id="block" href="javascript:void(0);" class="report" title="ブロック"><svg><use xlink:href="../img/sysimage/block_1.svg#block"></use></svg></a>
</div>
<?php }?>
<?php }?>
<div class="follow"> <div class="follow">
<a href="/user/report?q=<?php echo htmlentities($userData['userid'], ENT_QUOTES, 'UTF-8'); ?>" class="report" title="通報"><svg><use xlink:href="../img/sysimage/report_1.svg#report"></use></svg></a> <a href="/user/report?q=<?php echo htmlentities($userData['userid'], ENT_QUOTES, 'UTF-8'); ?>" class="report" title="通報"><svg><use xlink:href="../img/sysimage/report_1.svg#report"></use></svg></a>
</div> </div>
@@ -504,6 +607,7 @@ $pdo = null;
</div> </div>
<?php } else { ?> <?php } else { ?>
<?php if (false === strpos($myblocklist, ','.htmlentities($userData['userid'], ENT_QUOTES, 'UTF-8'))) {?>
<form method="post"> <form method="post">
<div class="follow"> <div class="follow">
<?php <?php
@@ -522,6 +626,7 @@ $pdo = null;
</form> </form>
<?php } ?> <?php } ?>
<?php } ?> <?php } ?>
<?php } ?>
</div> </div>
<?php if(!($role === "ice")){?> <?php if(!($role === "ice")){?>
@@ -536,6 +641,21 @@ $pdo = null;
</div> </div>
<?php }?> <?php }?>
<hr> <hr>
<div class="f_c_area">
<div class="fcnt">
<div class="p2">ユーズ数</div>
<p><?php echo $ueuse_cnt;?></p>
</div>
<div class="fcnt">
<div class="p2">フォロー数</div>
<p><?php echo $followCount;?></p>
</div>
<div class="fcnt">
<div class="p2">フォロワー数</div>
<p><?php echo $followerCount;?></p>
</div>
</div>
<hr>
<div class="select_utl"> <div class="select_utl">
<button class="btn" id="all_ueuse_btn">ユーズ</button> <button class="btn" id="all_ueuse_btn">ユーズ</button>
<button class="btn" id="media_ueuse_btn">メディア</button> <button class="btn" id="media_ueuse_btn">メディア</button>
@@ -543,6 +663,7 @@ $pdo = null;
</div> </div>
<hr> <hr>
<?php if (false === strpos($myblocklist, ','.htmlentities($userData['userid'], ENT_QUOTES, 'UTF-8'))) {?>
<section class="inner"> <section class="inner">
<div id="postContainer"> <div id="postContainer">
@@ -552,6 +673,10 @@ $pdo = null;
<div id="loading" class="loading" style="display: none;"> <div id="loading" class="loading" style="display: none;">
🤔 🤔
</div> </div>
<?php }else{?>
<div class="tokonone" id="noueuse"><p><?php echo htmlentities($userData['username'], ENT_QUOTES, 'UTF-8'); ?>さんをブロックしているため投稿の閲覧は出来ません。</p></div>
<?php }?>
<div id="error" class="error" style="display: none;"> <div id="error" class="error" style="display: none;">
<h1>エラー</h1> <h1>エラー</h1>
<p>サーバーの応答がなかったか不完全だったようです。<br>ネットワークの接続が正常かを確認の上再読み込みしてください。</p> <p>サーバーの応答がなかったか不完全だったようです。<br>ネットワークの接続が正常かを確認の上再読み込みしてください。</p>
@@ -581,6 +706,28 @@ $pdo = null;
</div> </div>
</div> </div>
<div id="account_BlockModal" class="modal">
<div class="modal-content">
<h1><?php echo htmlentities($userdata['username'], ENT_QUOTES, 'UTF-8'); ?>さんをブロックしますか?</h1>
<p><?php echo htmlentities($userdata['username'], ENT_QUOTES, 'UTF-8'); ?>さんのアカウントをブロックしますか?<br>ブロックするとフォローが解除され、検索以外のLTL、FTL等で<?php echo htmlentities($userdata['username'], ENT_QUOTES, 'UTF-8'); ?>さんの投稿が表示されなくなります。<br>また、相手からこのアカウントを閲覧することもできなくなります。<br>※ブロックしたことは相手には通知されません。<br><br>ブロックを解除するときはこのアカウントのユーザーページ(このページ)から解除を行ってください。</p>
<form class="btn_area" method="post">
<input type="submit" id="deleteButton2" class="fbtn_no" name="send_block_submit" value="ブロック">
<input type="button" id="cancelButton2" class="fbtn" value="キャンセル">
</form>
</div>
</div>
<div id="account_un_BlockModal" class="modal">
<div class="modal-content">
<h1><?php echo htmlentities($userdata['username'], ENT_QUOTES, 'UTF-8'); ?>さんのブロックを解除しますか?</h1>
<p><?php echo htmlentities($userdata['username'], ENT_QUOTES, 'UTF-8'); ?>さんのアカウントをブロック解除しますか?<br>ブロック解除すると<?php echo htmlentities($userdata['username'], ENT_QUOTES, 'UTF-8'); ?>さんの投稿の閲覧が可能になりフォローすることもできるようになります。</p>
<form class="btn_area" method="post">
<input type="submit" id="deleteButton3" class="fbtn_no" name="send_un_block_submit" value="ブロック解除">
<input type="button" id="cancelButton3" class="fbtn" value="キャンセル">
</form>
</div>
</div>
</main> </main>
@@ -808,9 +955,6 @@ $(document).ready(function() {
}); });
var modal = document.getElementById('myDelModal'); var modal = document.getElementById('myDelModal');
var deleteButton = document.getElementById('deleteButton'); var deleteButton = document.getElementById('deleteButton');
var cancelButton = document.getElementById('cancelButton'); // 追加 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);
});
});
}); });
</script> </script>
+131
View File
@@ -0,0 +1,131 @@
<?php
$activitypub_file = "../../server/activitypub.txt";
if(file_get_contents($activitypub_file) === "true"){
header("Content-Type: application/json; charset=utf-8");
$domain = $_SERVER['HTTP_HOST'];
require('../../db.php');
// データベースに接続
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();
}
$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);
}
}
}
?>
+3 -2
View File
@@ -2,8 +2,8 @@
-- version 5.2.1 -- version 5.2.1
-- https://www.phpmyadmin.net/ -- https://www.phpmyadmin.net/
-- --
-- ホスト: ひみつ -- ホスト: ひみつ
-- 生成日時: 2023-09-16 15:15:33 -- 生成日時: 2023-10-03 17:20:43
-- サーバのバージョン: 10.4.28-MariaDB -- サーバのバージョン: 10.4.28-MariaDB
-- PHP のバージョン: 8.2.4 -- PHP のバージョン: 8.2.4
@@ -42,6 +42,7 @@ CREATE TABLE `account` (
`datetime` datetime NOT NULL, `datetime` datetime NOT NULL,
`follow` text NOT NULL, `follow` text NOT NULL,
`follower` text NOT NULL, `follower` text NOT NULL,
`blocklist` text NOT NULL,
`admin` varchar(50) NOT NULL, `admin` varchar(50) NOT NULL,
`authcode` varchar(256) NOT NULL, `authcode` varchar(256) NOT NULL,
`backupcode` varchar(256) NOT NULL, `backupcode` varchar(256) NOT NULL,