From 51d7d84b6366b9cf716fd713036099c66c243f64 Mon Sep 17 00:00:00 2001 From: daichimarukana Date: Wed, 20 Dec 2023 22:36:44 +0900 Subject: [PATCH] uwuzu version 1.2.28 --- .well-known/host-meta/index.php | 7 +- .well-known/nodeinfo/index.php | 5 +- .well-known/webfinger/index.php | 5 +- README.md | 11 +- actor/index.php | 5 +- addauthcode.php | 27 +- admin/addadmin.php | 20 +- admin/index.php | 15 +- admin/success.php | 15 +- api/bot-api.php | 445 ++++++++++++++------------ api/ltl-api.php | 3 +- api/serverinfo-api.php | 26 +- authcodechk.php | 24 +- authlogin.php | 28 +- check.php | 30 +- css/home.css | 116 ++++++- emoji/addemoji.php | 127 ++++++-- emoji/index.php | 41 ++- errorpage/400.php | 19 +- errorpage/401.php | 19 +- errorpage/403.php | 19 +- errorpage/404.php | 18 +- errorpage/500.php | 18 +- errorpage/503.php | 19 +- errorpage/serverstop.php | 13 +- home/ftl.php | 47 ++- home/index.php | 52 ++- img/sysimage/errorimage/emoji_404.png | Bin 0 -> 10935 bytes img/sysimage/errorimage/image_404.png | Bin 0 -> 36568 bytes index.php | 51 ++- js/unsupported.js | 11 +- login.php | 43 +-- logout/index.php | 11 +- new.php | 51 ++- nextpage/ftlpage.php | 210 ++++++------ nextpage/nextpage.php | 176 +++++----- nextpage/notification.php | 98 +++--- nextpage/notificationview.php | 59 +++- nextpage/searchpage.php | 200 +++++++----- nextpage/ueusepage.php | 210 +++++++----- nextpage/userlikepage.php | 203 +++++++----- nextpage/usermediapage.php | 215 +++++++------ nextpage/userpage.php | 201 +++++++----- nextpage/view.php | 81 ++++- nodeinfo/2.1/index.php | 5 +- notice/addnotice.php | 37 ++- notification/index.php | 41 ++- others/index.php | 59 ++-- others/token.php | 40 ++- passrecovery/badrecovery.php | 20 +- passrecovery/donerecovery.php | 20 +- passrecovery/index.php | 21 +- passrecovery/startrecovery.php | 21 +- require/botbox.php | 1 - require/leftbox.php | 13 +- require/rightbox.php | 61 ++-- rule/privacypolicy.php | 29 +- rule/releasenotes.php | 27 +- rule/serverabout.php | 45 +-- rule/terms.php | 29 +- rule/uwuzuabout.php | 27 +- search/index.php | 41 ++- server/serversettings.ini | 18 ++ server/uwuzuabout.txt | 14 +- server/uwuzuinfo.txt | 4 +- server/uwuzurelease.txt | 27 ++ settings/addauthcode.php | 41 ++- settings/index.php | 48 ++- settings/success.php | 40 ++- settings_admin/ad_admin.php | 57 ++-- settings_admin/codeadmin.php | 57 ++-- settings_admin/customize_admin.php | 44 ++- settings_admin/maintenance_admin.php | 40 ++- settings_admin/moderation_admin.php | 46 +-- settings_admin/overview_admin.php | 61 ++-- settings_admin/role_admin.php | 57 ++-- settings_admin/serveradmin.php | 194 ++++------- settings_admin/useradmin.php | 57 ++-- settings_admin/userinfo.php | 57 ++-- success.php | 20 +- ueuse/activity/index.php | 5 +- ueuse/index.php | 45 ++- unsupported.php | 17 +- user/inbox/index.php | 5 +- user/index.php | 144 ++++++--- user/outbox/index.php | 5 +- user/report.php | 85 ++++- user/success.php | 38 ++- uwuzu_database.sql | 11 +- 89 files changed, 2770 insertions(+), 1998 deletions(-) create mode 100644 img/sysimage/errorimage/emoji_404.png create mode 100644 img/sysimage/errorimage/image_404.png create mode 100644 server/serversettings.ini diff --git a/.well-known/host-meta/index.php b/.well-known/host-meta/index.php index 13f99f0..a790b9d 100644 --- a/.well-known/host-meta/index.php +++ b/.well-known/host-meta/index.php @@ -1,6 +1,9 @@ - - + + -アカウント登録 - <?php echo file_get_contents($servernamefile);?> +アカウント登録 - <?php echo htmlspecialchars($serversettings["serverinfo"]["server_name"], ENT_QUOTES, 'UTF-8');?> @@ -207,9 +198,9 @@ $pdo = null;
- + - +

招待コード

招待コードがないとこのサーバーには登録できません。
diff --git a/admin/index.php b/admin/index.php index b5b74e3..720a8b2 100644 --- a/admin/index.php +++ b/admin/index.php @@ -20,12 +20,11 @@ for( $i=0;$i<$cnt;$i++ ){ $uwuzuinfo[$i] = ($softwaredata[$i]); } -$servernamefile = "../server/servername.txt"; - -$onlyuserfile = "../server/onlyuser.txt"; -$onlyuser = file_get_contents($onlyuserfile); +$serversettings_file = "../server/serversettings.ini"; +$serversettings = parse_ini_file($serversettings_file, true); session_name('uwuzu_s_id'); +session_set_cookie_params(0, '', '', true, true); session_start(); // 変数の初期化 @@ -84,13 +83,13 @@ $pdo = null; - - - + + + -uwuzuへようこそ!!! - <?php echo file_get_contents($servernamefile);?> +uwuzuへようこそ!!! - <?php echo htmlspecialchars($serversettings["serverinfo"]["server_name"], ENT_QUOTES, 'UTF-8');?> diff --git a/admin/success.php b/admin/success.php index 9970802..a795e38 100644 --- a/admin/success.php +++ b/admin/success.php @@ -10,12 +10,11 @@ function createUniqId(){ require('../db.php'); -$servernamefile = "../server/servername.txt"; - -$onlyuserfile = "../server/onlyuser.txt"; -$onlyuser = file_get_contents($onlyuserfile); +$serversettings_file = "../server/serversettings.ini"; +$serversettings = parse_ini_file($serversettings_file, true); session_name('uwuzu_s_id'); +session_set_cookie_params(0, '', '', true, true); session_start(); // 変数の初期化 @@ -79,13 +78,13 @@ if(!(empty($_SESSION['backupcode']))){ - - - + + + -アカウント登録完了!!! - <?php echo file_get_contents($servernamefile);?> +アカウント登録完了!!! - <?php echo htmlspecialchars($serversettings["serverinfo"]["server_name"], ENT_QUOTES, 'UTF-8');?> diff --git a/api/bot-api.php b/api/bot-api.php index 367f7be..03c43b2 100644 --- a/api/bot-api.php +++ b/api/bot-api.php @@ -8,6 +8,9 @@ $banurldomainfile = "../server/banurldomain.txt"; $banurl_info = file_get_contents($banurldomainfile); $banurl = preg_split("/\r\n|\n|\r/", $banurl_info); +//投稿及び返信レート制限↓(分):デフォで60件/分まで +$max_ueuse_rate_limit = 60; + header("Content-Type: application/json; charset=utf-8; Access-Control-Allow-Origin: *;"); function createUniqId(){ @@ -152,105 +155,124 @@ if(isset($_GET['token'])&&isset($_GET['type'])) { echo json_encode($response, JSON_UNESCAPED_UNICODE); exit; }else{ - // 書き込み日時を取得 - $username = $userData["username"]; - $userid = $userData["userid"]; - $datetime = date("Y-m-d H:i:s"); - $uniqid = createUniqId(); - $abi = "none"; - $nones = "none"; - // トランザクション開始 - $pdo->beginTransaction(); - - try { - - // SQL作成 - $stmt = $pdo->prepare("INSERT INTO ueuse (username, account, uniqid, ueuse, photo1, photo2, video1, datetime, abi) VALUES (:username, :account, :uniqid, :ueuse, :photo1, :photo2, :video1, :datetime, :abi)"); - - $stmt->bindParam(':username', $username, PDO::PARAM_STR); - $stmt->bindParam(':account', $userid, PDO::PARAM_STR); - $stmt->bindParam(':uniqid', $uniqid, PDO::PARAM_STR); - $stmt->bindParam(':ueuse', $ueuse, PDO::PARAM_STR); - - $stmt->bindParam(':photo1', $nones, PDO::PARAM_STR); - $stmt->bindParam(':photo2', $nones, PDO::PARAM_STR); - $stmt->bindParam(':video1', $nones, PDO::PARAM_STR); - - $stmt->bindParam(':datetime', $datetime, PDO::PARAM_STR); - - $stmt->bindParam(':abi', $abi, PDO::PARAM_STR); - - // SQLクエリの実行 - $res = $stmt->execute(); - - // コミット - $res = $pdo->commit(); - - $mentionedUsers = get_mentions_userid($ueuse); - - foreach ($mentionedUsers as $mentionedUser) { - - $pdo->beginTransaction(); - - try { - $touserid = $mentionedUser; - $datetime = date("Y-m-d H:i:s"); - $msg = "" . $ueuse . ""; - $title = "" . $username . "さんにメンションされました!"; - $url = "/!" . $uniqid . "~" . $userid . ""; - $userchk = 'none'; - - // 通知用SQL作成 - $stmt = $pdo->prepare("INSERT INTO notification (touserid, msg, url, datetime, userchk, title) VALUES (:touserid, :msg, :url, :datetime, :userchk, :title)"); - - - $stmt->bindParam(':touserid', $touserid, PDO::PARAM_STR); - $stmt->bindParam(':msg', $msg, PDO::PARAM_STR); - $stmt->bindParam(':url', $url, PDO::PARAM_STR); - $stmt->bindParam(':userchk', $userchk, PDO::PARAM_STR); - $stmt->bindParam(':title', $title, PDO::PARAM_STR); - - $stmt->bindParam(':datetime', $datetime, PDO::PARAM_STR); - - // SQLクエリの実行 - $res = $stmt->execute(); - - // コミット - $res = $pdo->commit(); - - } catch(Exception $e) { - - // エラーが発生した時はロールバック - $pdo->rollBack(); - } + $old_datetime = date("Y-m-d H:i:00"); + $now_datetime = date("Y-m-d H:i:00",strtotime("+1 minute")); + $rate_Query = $dbh->prepare("SELECT * FROM ueuse WHERE account = :userid AND TIME(datetime) BETWEEN :old_datetime AND :now_datetime"); + $rate_Query->bindValue(':userid', $userData["userid"]); + $rate_Query->bindValue(':old_datetime', $old_datetime); + $rate_Query->bindValue(':now_datetime', $now_datetime); + $rate_Query->execute(); + $rate_count = $rate_Query->rowCount(); + if(!($rate_count > $max_ueuse_rate_limit-1)){ + // 書き込み日時を取得 + $username = $userData["username"]; + $userid = $userData["userid"]; + $datetime = date("Y-m-d H:i:s"); + $uniqid = createUniqId(); + $abi = "none"; + $nones = "none"; + + // トランザクション開始 + $pdo->beginTransaction(); + + try { + + // SQL作成 + $stmt = $pdo->prepare("INSERT INTO ueuse (username, account, uniqid, ueuse, photo1, photo2, video1, datetime, abi) VALUES (:username, :account, :uniqid, :ueuse, :photo1, :photo2, :video1, :datetime, :abi)"); + + $stmt->bindParam(':username', $username, PDO::PARAM_STR); + $stmt->bindParam(':account', $userid, PDO::PARAM_STR); + $stmt->bindParam(':uniqid', $uniqid, PDO::PARAM_STR); + $stmt->bindParam(':ueuse', $ueuse, PDO::PARAM_STR); + + $stmt->bindParam(':photo1', $nones, PDO::PARAM_STR); + $stmt->bindParam(':photo2', $nones, PDO::PARAM_STR); + $stmt->bindParam(':video1', $nones, PDO::PARAM_STR); + + $stmt->bindParam(':datetime', $datetime, PDO::PARAM_STR); + + $stmt->bindParam(':abi', $abi, PDO::PARAM_STR); + + // SQLクエリの実行 + $res = $stmt->execute(); + + // コミット + $res = $pdo->commit(); + + $mentionedUsers = get_mentions_userid($ueuse); + + foreach ($mentionedUsers as $mentionedUser) { + + $pdo->beginTransaction(); + + try { + $touserid = $mentionedUser; + $datetime = date("Y-m-d H:i:s"); + $msg = "" . $ueuse . ""; + $title = "" . $username . "さんにメンションされました!"; + $url = "/!" . $uniqid . "~" . $userid . ""; + $userchk = 'none'; + + // 通知用SQL作成 + $stmt = $pdo->prepare("INSERT INTO notification (touserid, msg, url, datetime, userchk, title) VALUES (:touserid, :msg, :url, :datetime, :userchk, :title)"); + + + $stmt->bindParam(':touserid', $touserid, PDO::PARAM_STR); + $stmt->bindParam(':msg', $msg, PDO::PARAM_STR); + $stmt->bindParam(':url', $url, PDO::PARAM_STR); + $stmt->bindParam(':userchk', $userchk, PDO::PARAM_STR); + $stmt->bindParam(':title', $title, PDO::PARAM_STR); + + $stmt->bindParam(':datetime', $datetime, PDO::PARAM_STR); + + // SQLクエリの実行 + $res = $stmt->execute(); + + // コミット + $res = $pdo->commit(); + + } catch(Exception $e) { + + // エラーが発生した時はロールバック + $pdo->rollBack(); + } + + } + + } catch(Exception $e) { + + // エラーが発生した時はロールバック + $pdo->rollBack(); } - } catch(Exception $e) { + 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); + } - // エラーが発生した時はロールバック - $pdo->rollBack(); - } - - if( $res ) { - $response = array( - 'uniqid' => $uniqid, - 'userid' => $userid, - ); - - echo json_encode($response, JSON_UNESCAPED_UNICODE); - } else { - $err = "db_error_".$e->getMessage(); + // プリペアドステートメントを削除 + $stmt = null; + }else{ + $err = "over_rate_limit "; $response = array( 'error_code' => $err, ); echo json_encode($response, JSON_UNESCAPED_UNICODE); } - - // プリペアドステートメントを削除 - $stmt = null; } } }else{ @@ -365,151 +387,170 @@ if(isset($_GET['token'])&&isset($_GET['type'])) { 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, )); + + $old_datetime = date("Y-m-d H:i:00"); + $now_datetime = date("Y-m-d H:i:00",strtotime("+1 minute")); + $rate_Query = $dbh->prepare("SELECT * FROM ueuse WHERE account = :userid AND TIME(datetime) BETWEEN :old_datetime AND :now_datetime"); + $rate_Query->bindValue(':userid', $userData["userid"]); + $rate_Query->bindValue(':old_datetime', $old_datetime); + $rate_Query->bindValue(':now_datetime', $now_datetime); + $rate_Query->execute(); + $rate_count = $rate_Query->rowCount(); + if(!($rate_count > $max_ueuse_rate_limit-1)){ - $resultQuery = $dbh->prepare("SELECT * FROM ueuse WHERE uniqid = :uniqid"); - $resultQuery->bindValue(':uniqid', $rpuniqid); - $resultQuery->execute(); - $resultData = $resultQuery->fetch(); + $resultQuery = $dbh->prepare("SELECT * FROM ueuse WHERE uniqid = :uniqid"); + $resultQuery->bindValue(':uniqid', $rpuniqid); + $resultQuery->execute(); + $resultData = $resultQuery->fetch(); - if($resultData > 0){ + if($resultData > 0){ - // 書き込み日時を取得 - $username = $userData["username"]; - $userid = $userData["userid"]; - $datetime = date("Y-m-d H:i:s"); - $uniqid = createUniqId(); - $abi = "none"; - $nones = "none"; + // 書き込み日時を取得 + $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(); + $touserid2 = $resultData["account"]; + // トランザクション開始 $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); + try { - $stmt->bindParam(':datetime', $datetime, PDO::PARAM_STR); + // 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); - // SQLクエリの実行 - $res = $stmt->execute(); + $stmt->bindParam(':photo1', $nones, PDO::PARAM_STR); + $stmt->bindParam(':photo2', $nones, PDO::PARAM_STR); + $stmt->bindParam(':video1', $nones, PDO::PARAM_STR); - // コミット - $res = $pdo->commit(); + $stmt->bindParam(':datetime', $datetime, PDO::PARAM_STR); - $mentionedUsers = get_mentions_userid($ueuse); + $stmt->bindParam(':abi', $abi, PDO::PARAM_STR); + + // SQLクエリの実行 + $res = $stmt->execute(); + + // コミット + $res = $pdo->commit(); - 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', htmlentities($touserid), PDO::PARAM_STR); - $stmt->bindParam(':msg', htmlentities($msg), PDO::PARAM_STR); - $stmt->bindParam(':url', htmlentities($url), PDO::PARAM_STR); - $stmt->bindParam(':userchk', htmlentities($userchk), PDO::PARAM_STR); - $stmt->bindParam(':title', htmlentities($title), PDO::PARAM_STR); - - $stmt->bindParam(':datetime', htmlentities($datetime), PDO::PARAM_STR); - - // SQLクエリの実行 - $res = $stmt->execute(); - - // コミット - $res = $pdo->commit(); - - } catch(Exception $e) { - - // エラーが発生した時はロールバック - $pdo->rollBack(); - } + $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', htmlentities($touserid), PDO::PARAM_STR); + $stmt->bindParam(':msg', htmlentities($msg), PDO::PARAM_STR); + $stmt->bindParam(':url', htmlentities($url), PDO::PARAM_STR); + $stmt->bindParam(':userchk', htmlentities($userchk), PDO::PARAM_STR); + $stmt->bindParam(':title', htmlentities($title), PDO::PARAM_STR); + + $stmt->bindParam(':datetime', htmlentities($datetime), PDO::PARAM_STR); + + // SQLクエリの実行 + $res = $stmt->execute(); + + // コミット + $res = $pdo->commit(); + + } catch(Exception $e) { + + // エラーが発生した時はロールバック + $pdo->rollBack(); + } + + } + + } catch(Exception $e) { + + // エラーが発生した時はロールバック + $pdo->rollBack(); } - } catch(Exception $e) { + 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; - // エラーが発生した時はロールバック - $pdo->rollBack(); - } - - if( $res ) { - $response = array( - 'uniqid' => $uniqid, - 'userid' => $userid, - ); - - echo json_encode($response, JSON_UNESCAPED_UNICODE); - } else { - $err = "db_error_".$e->getMessage(); + }else{ + $err = "post_not_found"; $response = array( 'error_code' => $err, - ); - + ); echo json_encode($response, JSON_UNESCAPED_UNICODE); + exit; } - // プリペアドステートメントを削除 - $stmt = null; - }else{ - $err = "post_not_found"; + $err = "over_rate_limit "; $response = array( 'error_code' => $err, - ); + ); + echo json_encode($response, JSON_UNESCAPED_UNICODE); - exit; } } } diff --git a/api/ltl-api.php b/api/ltl-api.php index 31c0d47..7335c02 100644 --- a/api/ltl-api.php +++ b/api/ltl-api.php @@ -36,7 +36,7 @@ if(isset($_GET['limit'])) { if (!empty($pdo)) { - $sql = "SELECT account, username, uniqid, rpuniqid, ueuse, datetime, photo1, photo2, video1, favorite, abi, abidate FROM ueuse WHERE rpuniqid = '' ORDER BY datetime DESC LIMIT " . intval($offset) . ", " . intval($itemsPerPage); + $sql = "SELECT account, username, uniqid, rpuniqid, ueuse, datetime, photo1, photo2, video1, favorite, abi, abidate, nsfw FROM ueuse WHERE rpuniqid = '' ORDER BY datetime DESC LIMIT " . intval($offset) . ", " . intval($itemsPerPage); $message_array = $pdo->query($sql); while ($row = $message_array->fetch(PDO::FETCH_ASSOC)) { @@ -77,6 +77,7 @@ if(isset($_GET['limit'])) { 'datetime' => htmlentities($ueusedata["datetime"]), 'abi' => htmlentities($ueusedata["abi"]), 'abidatetime' => htmlentities($ueusedata["abidate"]), + 'nsfw' => htmlentities($ueusedata["nsfw"]), ]; $response[$ueusedata["uniqid"]] = $item; // ループ内で $response にデータを追加 diff --git a/api/serverinfo-api.php b/api/serverinfo-api.php index a381b33..fcca074 100644 --- a/api/serverinfo-api.php +++ b/api/serverinfo-api.php @@ -3,25 +3,17 @@ header("Content-Type: application/json; charset=utf-8; Access-Control-Allow-Orig $mojisizefile = "../server/textsize.txt"; -$adminfile = "../server/admininfo.txt"; - -$servernamefile = "../server/servername.txt"; - -$servericonfile = "../server/servericon.txt"; +$serversettings_file = "../server/serversettings.ini"; +$serversettings = parse_ini_file($serversettings_file, true); $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++ ){ @@ -69,15 +61,15 @@ for( $i=0;$i<$cnt;$i++ ){ $notices[] = $row; } - if($onlyuser === "true"){ + if(htmlspecialchars($serversettings["serverinfo"]["server_icon"], ENT_QUOTES, 'UTF-8') === "true"){ $openregit = false; - }elseif($onlyuser === "false"){ + }elseif(htmlspecialchars($serversettings["serverinfo"]["server_icon"], ENT_QUOTES, 'UTF-8') === "false"){ $openregit = true; }else{ $openregit = false; } - if($onlyuser === "true"){ + if(htmlspecialchars($serversettings["serverinfo"]["server_icon"], ENT_QUOTES, 'UTF-8') === "true"){ $invitation_code = true; }else{ $invitation_code = false; @@ -96,13 +88,13 @@ for( $i=0;$i<$cnt;$i++ ){ $item = [ "server_info" => array( - "server_name" => file_get_contents($servernamefile), - "server_icon" => file_get_contents($servericonfile), + "server_name" => htmlspecialchars($serversettings["serverinfo"]["server_name"], ENT_QUOTES, 'UTF-8'), + "server_icon" => htmlspecialchars($serversettings["serverinfo"]["server_icon"], ENT_QUOTES, 'UTF-8'), "server_description" => $serverinfo, "adminstor" => array( - "name" => file_get_contents($adminfile), - "email" => file_get_contents($contactfile), + "name" => htmlspecialchars($serversettings["serverinfo"]["server_admin"], ENT_QUOTES, 'UTF-8'), + "email" => htmlspecialchars($serversettings["serverinfo"]["server_admin_mailadds"], ENT_QUOTES, 'UTF-8'), ), "terms_url" => "https://".$domain."/rule/terms", diff --git a/authcodechk.php b/authcodechk.php index 9e49a19..2af25c7 100644 --- a/authcodechk.php +++ b/authcodechk.php @@ -11,20 +11,12 @@ function createUniqId(){ require('db.php'); -$servernamefile = "server/servername.txt"; +$serversettings_file = "server/serversettings.ini"; +$serversettings = parse_ini_file($serversettings_file, true); -$serverlogofile = "server/serverlogo.txt"; -$serverlogodata = file_get_contents($serverlogofile); -$serverlogodata = explode( "\n", $serverlogodata ); -$cnt = count( $serverlogodata ); -for( $i=0;$i<$cnt;$i++ ){ - $serverlogo_link[$i] = ($serverlogodata[$i]); -} - -$onlyuserfile = "server/onlyuser.txt"; -$onlyuser = file_get_contents($onlyuserfile); session_name('uwuzu_s_id'); +session_set_cookie_params(0, '', '', true, true); session_start(); // 変数の初期化 @@ -137,12 +129,12 @@ $pdo = null; - - + + -アカウント登録 - <?php echo file_get_contents($servernamefile);?> +アカウント登録 - <?php echo htmlspecialchars($serversettings["serverinfo"]["server_name"], ENT_QUOTES, 'UTF-8');?> @@ -151,9 +143,9 @@ $pdo = null;
- +