diff --git a/README.md b/README.md index 90eb81a..410a929 100644 --- a/README.md +++ b/README.md @@ -9,15 +9,15 @@ AGPLライセンスです!!! ## 5. サーバーの建て方 -※MySQLの設定結構めんどいです。 まず、Apache2とPHP 8とmysql Ver 15が導入されているサーバーを準備します! +PHP 8では事前にGDを有効化しておいてください!(QRコードの生成に必要です。) 次にSQLを設定します。(InnoDB) -まず、お好きな名前でDBを作成し、その中に、account,emoji,notice,role,ueuse,notificationとテーブルを作成します。 +まず、お好きな名前でDBを作成し、その中に、account,emoji,notice,role,ueuse,notification,ads,reportとテーブルを作成します。 テーブルの中身は以下のとおりです。 照合順序は全て標準でutf8mb4_general_ciです。 -【お知らせ!!!】 -バージョン1.2.15よりSQLの構造ファイルを公開したので今までと比べて大幅に簡単にuwuzuサーバーの構築ができるようになりました!!! -なお、ロールは自動で追加されませんのでuser、officialロールはご自身で追加してください! + +## 簡単に構築できるようSQLの構造ファイルがリリースに添付されています!そちらをインポートしていただけますと大幅に簡単に導入できます! +(userロールとofficialロールとiceロールの設定は別途必要です。お手数ですがそこの設定だけよろしくお願いいたします。) ### account - sysid(INT)(AUTO_INCREMENT ) アカウントが追加されるとカウントされるシステム用ID @@ -88,37 +88,30 @@ AGPLライセンスです!!! - used(varchar(25)) 使用済みかそうでないか - datetime(datetime) 招待コード仕様日時更新用 -すべて作成完了したらGithubよりuwuzuのファイルをDLし、解凍し、それをサーバーの動作ディレクトリに置き、Apacheのhttpd.confからその動作ディレクトリを指定し、あとはApacheとphpとMy SQLを起動するだけ! -起動したらまずDBのroleにphpmyadminから「user」ロールと「official」ロールを追加、権限は「user」と「official」でOK。ロール名はとりあえず「一般ユーザー」ロールの色はHEXコード(#を除く)で000000のように指定。(この2つのロールがないとエラーが発生します。) -そしたら普通にuwuzuにアクセスして自分のアカウントを登録。 -それが終わったら一度サーバーを止め、uwuzuの動作ディレクトリ内のserverフォルダ内のファイルを各自設定 -ファイルの機能は以下の通り! -- admininfo.txt : 管理者名(てすとまる/@sampledayo) -- contact.txt : 管理者への連絡用メアド(sample@test.com) -- info.txt : サーバー登録時に表示されるメッセージ(好きな内容) -- privacypolicy.txt : プライバシーポリシー(サーバーのプライバシーポリシーを記載) -- servername.txt : サーバー名(てすとさば) -- terms.txt : 利用規約(サーバーの利用規約を記載) -- uwuzuabout.txt : このファイル(uwuzuを改造した場合は書き換え) -- uwuzuinfo.txt : uwuzuのバージョン等記載(uwuzuを改造した場合は書き換え) -- uwuzurelease.txt : uwuzuのバージョン等記載(uwuzuを改造した場合は書き換え) -- onlyuser.txt : 招待コード機能をオンにするかどうか、「true」でオン、「false」でオフ。招待コードはDBに直接追加。 +### report +- sysid(INT)(AUTO_INCREMENT) 追加されるとカウントされるシステム用ID +- uniqid(varchar(256)) 通報ID保存用 +- userid(varchar(500)) 通報先ユーザーID保存用 +- report_userid(varchar(500)) 通報元ユーザーID保存用 +- msg(text) サービス管理者宛メッセージ保存用 +- datetime(datetime) 通報日時保存用 +- admin_chk(varchar(25)) 解決済みかどうか確認用 +### ads +- sysid(INT)(AUTO_INCREMENT) 追加されるとカウントされるシステム用ID +- uniqid(varchar(512)) 広告ID保存用 +- url(varchar(512)) 広告のクリック先URL保存用 +- image_url(varchar(512)) 広告に表示する画像URL保存用 +- memo(text) 広告にマウスオーバーしたときに表示されるメッセージ保存用 +- start_date(datetime) 広告配信開始日時保存用 +- limit_date(datetime) 広告配信終了日時保存用 +- datetime(datetime) 広告追加日時保存用 -すべて作成完了したらGithubよりuwuzuのファイルをDLし、解凍し、それをサーバーの動作ディレクトリに置き、Apacheのhttpd.confからその動作ディレクトリを指定し、あとはApacheとphpとMy SQLを起動するだけ! -起動したらまずDBのroleにphpmyadminから「user」ロールを追加権限は「user」でOK。ロール名はとりあえず「一般ユーザー」ロールの色はHEXコード(#を除く)で000000のように指定。 +すべて作成完了したらGithubよりuwuzuのファイルをDLし、解凍し、それをサーバーの動作ディレクトリに置き、Apacheのhttpd.confからその動作ディレクトリを指定し、動作ディレクトリ内のdb.phpにDBのログイン情報を書き込んであとはApacheとphpとMy SQLを起動するだけ! +起動したらまずDBのroleにphpmyadminから「user」ロールと「official」ロールと「ice」ロールを追加、権限は「user」と「official」と「ice」でOK。ロール名はとりあえず「一般ユーザー」とか適当でOK、ロールの色はHEXコード(#を除く)で000000のように指定。(この3つのロールがないとエラーが発生します。) そしたら普通にuwuzuにアクセスして自分のアカウントを登録。 -それが終わったら一度サーバーを止め、uwuzuの動作ディレクトリ内のserverフォルダ内のファイルを各自設定 -ファイルの機能は以下の通り! -- admininfo.txt : 管理者名(てすとまる/@sampledayo) -- contact.txt : 管理者への連絡用メアド(sample @test.com) -- info.txt : サーバー登録時に表示されるメッセージ(好きな内容) -- privacypolicy.txt : プライバシーポリシー(サーバーのプライバシーポリシーを記載) -- servername.txt : サーバー名(てすとさば) -- terms.txt : 利用規約(サーバーの利用規約を記載) -- uwuzuabout.txt : このファイル(uwuzuを改造した場合は書き換え) -- uwuzuinfo.txt : uwuzuのバージョン等記載(uwuzuを改造した場合は書き換え) -- uwuzurelease.txt : uwuzuのバージョン等記載(uwuzuを改造した場合は書き換え) +## 管理者アカウント登録機能が追加されました。【[domain]/admin/】より設定できるのでそちらをご利用ください。 +なお、管理者アカウントを導入後に登録した場合サーバーを止めてuwuzu動作ディレクトリ内のserverフォルダ内のファイルを設定する必要はございません。 ### これでサーバーは完成!!! 脆弱だから自己責任で楽しんでね~() diff --git a/abi/addabi.php b/abi/addabi.php index 22e2d9c..2b73520 100644 --- a/abi/addabi.php +++ b/abi/addabi.php @@ -1,105 +1,142 @@ PDO::ERRMODE_EXCEPTION, - PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC, - PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => true, - )); + preg_replace_callback($usernamePattern, function($matches) use (&$mentionedUsers) { + $mention_username = $matches[1]; + + $dbh = new PDO('mysql:charset=utf8mb4;dbname='.DB_NAME.';host='.DB_HOST, DB_USER, DB_PASS, array( + PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, + PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC, + PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => true, + )); + + $mention_userQuery = $dbh->prepare("SELECT username, userid FROM account WHERE userid = :userid"); + $mention_userQuery->bindValue(':userid', $mention_username); + $mention_userQuery->execute(); + $mention_userData = $mention_userQuery->fetch(); - $mention_userQuery = $dbh->prepare("SELECT username, userid FROM account WHERE userid = :userid"); - $mention_userQuery->bindValue(':userid', $mention_username); - $mention_userQuery->execute(); - $mention_userData = $mention_userQuery->fetch(); - - if (!empty($mention_userData)) { - $mentionedUsers[] = $mention_username; - } - }, $postText); + if (!empty($mention_userData)) { + $mentionedUsers[] = $mention_username; + } + }, $postText); - return $mentionedUsers; - } + return $mentionedUsers; + } - try { - $pdo = new PDO('mysql:charset=utf8mb4;dbname='.DB_NAME.';host='.DB_HOST , DB_USER, DB_PASS); + // データベース接続の設定 + $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, + )); - $pdo->beginTransaction(); + $query = $dbh->prepare('SELECT * FROM ueuse WHERE uniqid = :uniqid limit 1'); - $stmt = $pdo->prepare("UPDATE ueuse SET abi = :abi, abidate = :abidate WHERE uniqid = :uniqid AND account = :userid"); - $stmt->bindValue(':abi', $abitext, PDO::PARAM_STR); - $stmt->bindValue(':abidate', $abidate, PDO::PARAM_STR); - $stmt->bindValue(':uniqid', $postUniqid, PDO::PARAM_STR); - $stmt->bindValue(':userid', $ses_userid, PDO::PARAM_STR); - - // SQLクエリの実行 - $res = $stmt->execute(); + $query->execute(array(':uniqid' => $postUniqid)); - // コミット - $pdo->commit(); + $result = $query->fetch(); - $mentionedUsers = get_mentions_userid($abitext); + if($result["account"] === $userid){ + // データベース接続の設定 + $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, + )); + + $query = $dbh->prepare('SELECT * FROM account WHERE userid = :userid limit 1'); + + $query->execute(array(':userid' => $userid)); + + $result2 = $query->fetch(); + + if($result2["loginid"] === $loginid){ + + try { + $pdo = new PDO('mysql:charset=utf8mb4;dbname='.DB_NAME.';host='.DB_HOST , DB_USER, DB_PASS); - foreach ($mentionedUsers as $mentionedUser) { - $pdo->beginTransaction(); - try { - $touserid = $mentionedUser; - $datetime = date("Y-m-d H:i:s"); - $msg = "" . $abitext . ""; - $title = "" . $username . "さんにメンションされました!"; - $url = "/!" . $uniqid . "~" . $userid . ""; - $userchk = 'none'; + $stmt = $pdo->prepare("UPDATE ueuse SET abi = :abi, abidate = :abidate WHERE uniqid = :uniqid AND account = :userid"); + $stmt->bindValue(':abi', $abitext, PDO::PARAM_STR); + $stmt->bindValue(':abidate', $abidate, PDO::PARAM_STR); + $stmt->bindValue(':uniqid', $postUniqid, PDO::PARAM_STR); - // 通知用SQL作成 - $stmt = $pdo->prepare("INSERT INTO notification (touserid, msg, url, datetime, userchk, title) VALUES (:touserid, :msg, :url, :datetime, :userchk, :title)"); + $stmt->bindValue(':userid', $userid, PDO::PARAM_STR); + + // SQLクエリの実行 + $res = $stmt->execute(); + + // コミット + $pdo->commit(); + + $mentionedUsers = get_mentions_userid($abitext); + + foreach ($mentionedUsers as $mentionedUser) { + + $pdo->beginTransaction(); + + try { + $touserid = $mentionedUser; + $datetime = date("Y-m-d H:i:s"); + $msg = "" . $abitext . ""; + $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(':touserid', $touserid, PDO::PARAM_STR); + $stmt->bindParam(':msg', $msg, PDO::PARAM_STR); + $stmt->bindParam(':url', $url, PDO::PARAM_STR); + $stmt->bindParam(':userchk', $userchk, PDO::PARAM_STR); + $stmt->bindParam(':title', $title, PDO::PARAM_STR); - $stmt->bindParam(':datetime', $datetime, PDO::PARAM_STR); + $stmt->bindParam(':datetime', $datetime, PDO::PARAM_STR); - // SQLクエリの実行 - $res2 = $stmt->execute(); + // SQLクエリの実行 + $res2 = $stmt->execute(); - // コミット - $res2 = $pdo->commit(); + // コミット + $res2 = $pdo->commit(); - } catch(Exception $e) { + } catch(Exception $e) { - // エラーが発生した時はロールバック - $pdo->rollBack(); + // エラーが発生した時はロールバック + $pdo->rollBack(); + } + + if ($res2) { + header('Content-Type: application/json'); + echo json_encode(['success' => true]); + exit; + } else { + header('Content-Type: application/json'); + echo json_encode(['success' => false, 'error' => '追加に失敗しました。']); + exit; + } + } - if ($res2) { + if ($res) { header('Content-Type: application/json'); echo json_encode(['success' => true]); exit; @@ -108,22 +145,11 @@ if (htmlentities(isset($_POST['uniqid'])) && htmlentities(isset($_POST['abitext' echo json_encode(['success' => false, 'error' => '追加に失敗しました。']); exit; } - - } - - if ($res) { + } catch(PDOException $e) { header('Content-Type: application/json'); - echo json_encode(['success' => true]); - exit; - } else { - header('Content-Type: application/json'); - echo json_encode(['success' => false, 'error' => '追加に失敗しました。']); + echo json_encode(['success' => false, 'error' => 'データベースエラー:' . $e->getMessage()]); exit; } - } catch(PDOException $e) { - header('Content-Type: application/json'); - echo json_encode(['success' => false, 'error' => 'データベースエラー:' . $e->getMessage()]); - exit; } } } diff --git a/api/bot-api.php b/api/bot-api.php index 0ecc09c..49ed2c4 100644 --- a/api/bot-api.php +++ b/api/bot-api.php @@ -42,6 +42,22 @@ if(isset($_GET['token'])&&isset($_GET['ueuse'])) { $token = htmlentities($_GET['token']); $ueuse = nl2br(htmlentities($_GET['ueuse'])); + if($token === 'ice'){ + $err = "input_error"; + $response = array( + 'error_code' => $err, + ); + + echo json_encode($response, JSON_UNESCAPED_UNICODE); + }elseif($token === ''){ + $err = "input_error"; + $response = array( + 'error_code' => $err, + ); + + echo json_encode($response, JSON_UNESCAPED_UNICODE); + } + require('../db.php'); $datetime = array(); diff --git a/css/home.css b/css/home.css index 6affa0c..f5dd0f5 100644 --- a/css/home.css +++ b/css/home.css @@ -677,6 +677,7 @@ main h1{ border: none; display: block; width:120px; + height: 24px; padding: 8px auto; margin-left: auto; @@ -754,6 +755,56 @@ main h1{ width:115px; } + +.fzone .follow .report{ + cursor: pointer; + border: none; + display: block; + padding: 6px; + + width:24px; + height: 24px; + + margin-left: auto; + margin-right: 12px; + margin-top: 12px; + margin-bottom: 12px; + + background-color: #FFFAE6; + + border-radius: 50px; + color:#FFC832; + border: 1px solid #FFC832; + font-size: 16px; + font-family: 'Zen Maru Gothic', sans-serif; + font-weight: normal; + text-decoration:none; + text-align: center; + transition: box-shadow 250ms ease-in-out; + transition: width 250ms ease-out; + transition: all 250ms ease-out; +} +.fzone .follow .report:hover{ + background-color: #ffebeb; + color: #ff4848; + border: 1px solid #ff4848; + box-shadow:0 0px 48px 0 rgba(0, 0, 0, .2); + width:32px; +} +.fzone .follow .report:active{ + box-shadow:0 0px 48px 0 rgba(0, 0, 0, .05); + width:22px; +} +.fzone .follow .report svg{ + width: 24px; + height: 24px; + margin-left: auto; + margin-right: auto; + margin-top: auto; + margin-bottom: 6px; + fill: currentColor; +} + .fzone .time{ margin-top: auto; margin-bottom: 0px; @@ -763,6 +814,7 @@ main h1{ .fzone .time p{ margin-top: 0px; margin-bottom: 0px; + margin-right: 32px; text-align: left; font-size: 12px; color:#999; @@ -828,7 +880,41 @@ main h1{ border-bottom: 1px solid #FFC832; } - +.ads{ + display: block; + position: relative; + animation: slideInY 0.5s cubic-bezier(0.25, 1, 0.5, 1) 1 forwards; + margin: 12px; + border-radius: 10px; + padding: 0px; + overflow:hidden; + background-color: #F5F5F5; + border: 1px solid #EEE; + width: auto; +} +@keyframes slideInY { + 0% { + transform: translateY(24px); + opacity: 0; + } + 100% { + transform: translateY(0px); + } + 40%,100% { + opacity: 1; + } +} +.ads a{ + margin: 0px; + padding: 0px; +} +.ads a img{ + object-fit: cover; + margin: 0px; + width: 100%; + height: 10dvh; + vertical-align:top; +} .ueuse{ animation: slideInY 0.5s cubic-bezier(0.25, 1, 0.5, 1) 1 forwards; margin: 12px; @@ -1413,7 +1499,14 @@ main h1{ transition: width 250ms ease-out; transition: all 250ms ease-out; } - +.ueuse .favbox .addabi svg { + margin-top: -12px; + margin-right: 0px; + width: 24px; + height: 24px; + fill: currentColor; + transition: all 250ms ease-out; +} .ueuse .favbox img{ margin-left: 0px; @@ -1945,6 +2038,7 @@ label>input { font-size: 18px; } .modal-content p{ + line-height: 20px; font-size: 16px; color:#252525; text-decoration: none; @@ -2260,6 +2354,7 @@ label>input { margin-left: 12px; margin-right: 12px; width: 24%; + height: 92.5dvh; background-color: #fff; padding: 12px; box-shadow:0 0px 48px 0 rgba(0, 0, 0, .05); @@ -2279,7 +2374,7 @@ label>input { .rightbox .noticearea{ width: auto; - height: 52dvh; + height: 50dvh; overflow: scroll; border-radius: 10px; } @@ -2370,7 +2465,7 @@ label>input { .rightbox .btmbox{ position: absolute; bottom: 12px; /*下に固定*/ - height: 31dvh; + height: 35dvh; width: 90%; } @@ -3026,6 +3121,13 @@ hr{ margin-left: 0px; } + +summary { + font-weight: bold; + margin: -0.5em -0.5em 0; + padding: 0.5em; +} + .server_code{ animation: slideInY 0.5s cubic-bezier(0.25, 1, 0.5, 1) 1 forwards; margin-top: 12px; @@ -3034,14 +3136,15 @@ hr{ padding-left: 12px; padding-right: 12px; padding-top: 8px; - padding-bottom: 8px; + padding-bottom: 4px; background-color: #F5F5F5; border: 1px solid #EEE; width: auto; } -.server_code h1{ - margin-top: 4px; - margin-bottom: 4px; +.server_code details { + padding: 0px; + margin-top: 0px; + margin-bottom: 0px; text-align: left; color:#252525; font-family: 'BIZ UDGothic', sans-serif; @@ -3050,6 +3153,28 @@ hr{ line-height: 22px; font-weight: bold; } +.server_code summary { + display: block; + list-style: none; +} +.server_code summary::-webkit-details-marker { + display: none; +} +.server_code details[open] p{ + animation: slideInYopen 0.5s cubic-bezier(0.25, 1, 0.5, 1); +} +@keyframes slideInYopen { + 0% { + transform: translateY(-16px); + opacity: 0; + } + 100% { + transform: translateY(0px); + } + 40%,100% { + opacity: 1; + } +} .server_code p{ margin-top: 4px; margin-bottom: 4px; @@ -3061,7 +3186,328 @@ hr{ line-height: 22px; font-weight: bold; } +.delbox { + margin: 0px; + padding: 0px; + display: flex; +} +.delbox p{ + margin-top: auto; + margin-bottom: auto; + text-align: left; + color:#252525; + font-family: 'BIZ UDGothic', sans-serif; + word-wrap: break-word; + font-size: 14px; + line-height: 22px; + font-weight: bold; +} +.delbox .delbtn{ + cursor: pointer; + border: none; + display: block; + width:60px; + padding: 8px auto; + margin-left: auto; + margin-right: 0px; + margin-top: 2px; + margin-bottom: 6px; + padding-top: 2px; + padding-bottom: 2px; + background-color: #F5F5F5; + border-radius: 50px; + color:#FF4848; + font-size: 16px; + font-family: 'Zen Maru Gothic', sans-serif; + font-weight: normal; + text-decoration:none; + text-align: center; + transition: box-shadow 250ms ease-in-out; + transition: width 250ms ease-out; + transition: all 250ms ease-out; +} +.delbox .delbtn:hover{ + background-color: #FF4848; + color: #f5f5f5;; + transition: box-shadow 250ms ease-in-out; + transition: width 250ms ease-out; + transition: all 250ms ease-out; +} + +.admin_settings{ + display: flex; +} +.admin_settings .admin_right{ + margin-right: 0px; + width: 70%; +} +.admin_settings .admin_left{ + position: sticky; + top: 0; + margin-left: 0px; + padding: 12px; + width: 30%; + height: 92.5dvh; + border-right: 1px solid #EEE; +} +.admin_leftbtn{ + cursor: pointer; + border: none; + display: flex; + width:80%; + margin: 8px; + padding: 8px auto; + margin-left: auto; + margin-right: auto; + + padding-left: 12px; + padding-top: 4px; + padding-bottom: 4px; + + + background-color: #FFFFFF; + + border-radius: 50px; + color:#FFC832; + font-size: 18px; + font-family: 'Zen Maru Gothic', sans-serif; + font-weight: normal; + text-decoration:none; + text-align: left; + transition: box-shadow 250ms ease-in-out; + transition: width 250ms ease-out; + transition: all 250ms ease-out; +} +.admin_leftbtn:hover{ + background-color: #FFC832; + color: #FFFAE6; + box-shadow:0 0px 48px 0 rgba(0, 0, 0, .2); + width:85%; +} +.admin_leftbtn:active{ + box-shadow:0 0px 48px 0 rgba(0, 0, 0, .05); + width:75%; +} + +.admin_userinfo{ + padding: 12px; +} +.admin_userinfo .icon{ + display: flex; + vertical-align: middle; +} +.admin_userinfo .icon img{ + object-fit: cover; + margin-top: 12px; + text-align: left; + width: 128px; + height:128px; + border-radius: 50%; + box-shadow:0 0px 48px 0 rgba(0, 0, 0, .05); +} +.admin_userinfo .icon .tatext{ + display: block; + margin-top: auto; + margin-bottom: auto; +} +.admin_userinfo .icon .tatext h2{ + word-wrap: break-word; + margin-left: 12px; + margin-top: 12px; + margin-bottom: auto; + color:#252525; + font-size: 32px; + font-family: 'BIZ UDPGothic', sans-serif; + font-weight: 900; +} +.admin_userinfo .icon .tatext p{ + word-wrap: break-word; + margin-left: 12px; + margin-right: auto; + margin-top: auto; + margin-bottom: 14px; + color: #999; + font-size: 18px; + font-family: 'BIZ UDPGothic', sans-serif; + font-weight: 900; +} + +.admin_userinfo .profile p{ + text-align: left; + margin-top: 12px; + margin-bottom: auto; + margin-left: 0px; + margin-right: 0px; + word-wrap: break-word; + font-size: 18px; + color:#252525; + text-decoration: none; + font-family: 'BIZ UDPGothic', sans-serif; + font-weight: bold; +} +.admin_userinfo .roleboxes{ + margin-top: 12px; + margin-left: 0px; + display: flex; + padding: 0px; + flex-wrap : wrap; +} +.admin_userinfo .rolebox{ + margin-top: 0px; + margin-bottom: 12px; + margin-left: 0px; + margin-right: 12px; + width: auto; + padding-left: auto; + padding-right: auto; + background-color: #fff; + border: 1px solid #FFC832; + border-radius: 25px; + box-shadow:0 0px 48px 0 rgba(0, 0, 0, .15); +} +.admin_userinfo .rolebox p{ + color:#FFC832; + margin-top: 2px; + margin-bottom: 2px; + margin-left: 10px; + margin-right: 10px; + font-size: 16px; + font-family: 'Zen Maru Gothic', sans-serif; + font-weight: normal; +} +.admin_userinfo .about{ + display: block; +} +.admin_userinfo .p2{ + margin-top: 0px; + margin-bottom: 10px; + word-wrap: break-word; + line-height: 20px; + color: #868686; + font-size: 12px; + font-family: 'BIZ UDPGothic', sans-serif; + font-weight: normal; +} +.admin_userinfo .about p{ + word-wrap: break-word; + margin-left: 0px; + margin-right: auto; + margin-top: auto; + margin-bottom: 14px; + color: #252525; + font-size: 18px; + font-family: 'BIZ UDPGothic', sans-serif; + font-weight: 900; +} +.admin_userinfo .banzone{ + display: flex; +} +.admin_userinfo .banzone .banbtn{ + cursor: pointer; + border: none; + display: block; + width:25%; + margin: 12px; + padding: 8px 5%; + margin-left: auto; + margin-right: auto; + + padding-top: 8px; + padding-bottom: 8px; + + background-color: #ff4848; + + text-align: center; + border-radius: 50px; + color:#fff; + font-size: 22px; + font-family: 'Zen Maru Gothic', sans-serif; + font-weight: normal; + text-decoration:none; + text-align: center; + box-shadow:0 0px 48px 0 rgba(0, 0, 0, .15); + transition: box-shadow 250ms ease-in-out; + transition: width 250ms ease-out; +} +.admin_userinfo .banzone .banbtn:hover{ + box-shadow:0 0px 48px 0 rgba(0, 0, 0, .2); + width:30%; +} +.admin_userinfo .banzone .banbtn:active{ + box-shadow:0 0px 48px 0 rgba(0, 0, 0, .05); + width:20%; +} +.admin_userinfo .banzone .waterbtn{ + cursor: pointer; + border: none; + display: block; + width:25%; + margin: 12px; + padding: 8px 5%; + margin-left: auto; + margin-right: auto; + + padding-top: 8px; + padding-bottom: 8px; + + background-color: #FFFAE6; + + text-align: center; + border-radius: 50px; + color:#FFC832; + font-size: 22px; + font-family: 'Zen Maru Gothic', sans-serif; + font-weight: normal; + text-decoration:none; + text-align: center; + box-shadow:0 0px 48px 0 rgba(0, 0, 0, .15); + transition: box-shadow 250ms ease-in-out; + transition: width 250ms ease-out; +} +.admin_userinfo .banzone .waterbtn:hover{ + box-shadow:0 0px 48px 0 rgba(0, 0, 0, .2); + width:30%; +} +.admin_userinfo .banzone .waterbtn:active{ + box-shadow:0 0px 48px 0 rgba(0, 0, 0, .05); + width:20%; +} +.admin_userinfo .banzone .icebtn{ + cursor: pointer; + border: none; + display: block; + width:25%; + margin: 12px; + padding: 8px 5%; + margin-left: auto; + margin-right: auto; + + padding-top: 8px; + padding-bottom: 8px; + + background-color: #ffbc0d; + + text-align: center; + border-radius: 50px; + color:#fff; + font-size: 22px; + font-family: 'Zen Maru Gothic', sans-serif; + font-weight: normal; + text-decoration:none; + text-align: center; + box-shadow:0 0px 48px 0 rgba(0, 0, 0, .15); + transition: box-shadow 250ms ease-in-out; + transition: width 250ms ease-out; +} +.admin_userinfo .banzone .icebtn:hover{ + box-shadow:0 0px 48px 0 rgba(0, 0, 0, .2); + width:30%; +} +.admin_userinfo .banzone .icebtn:active{ + box-shadow:0 0px 48px 0 rgba(0, 0, 0, .05); + width:20%; +} /*------------------------------------------------------------------------------------------------------------*/ /*--------------------------------------------------スマホ向け--------------------------------------------------*/ /*--------------------------------------------------ここから--------------------------------------------------*/ @@ -3486,6 +3932,16 @@ hr{ transition: width 250ms ease-out; transition: all 250ms ease-out; } + + .ueuse .favbox .addabi svg { + margin-top: -8px; + margin-right: 0px; + margin-bottom: 2px; + width: 24px; + height: 24px; + fill: currentColor; + transition: all 250ms ease-out; + } .ueuse{ animation: slideInY 0.5s cubic-bezier(0.25, 1, 0.5, 1) 1 forwards; @@ -4191,6 +4647,59 @@ hr{ text-align: left; } + .admin_settings{ + display: block; + } + .admin_settings .admin_right{ + width: 100%; + } + .admin_settings .admin_left{ + background-color: #fff; + position:relative; + width: 100%; + height: auto; + padding: 0px; + border-right: 1px solid #EEE; + } + .admin_leftbtn{ + cursor: pointer; + border: none; + display: block; + width:80%; + margin: 8px; + padding: 8px auto; + margin-left: auto; + margin-right: auto; + + padding-left: 12px; + padding-top: 4px; + padding-bottom: 4px; + + + background-color: #FFFFFF; + + border-radius: 50px; + color:#FFC832; + font-size: 18px; + font-family: 'Zen Maru Gothic', sans-serif; + font-weight: normal; + text-decoration:none; + text-align: left; + transition: box-shadow 250ms ease-in-out; + transition: width 250ms ease-out; + transition: all 250ms ease-out; + } + .admin_leftbtn:hover{ + background-color: #FFC832; + color: #FFFAE6; + box-shadow:0 0px 48px 0 rgba(0, 0, 0, .2); + width:85%; + } + .admin_leftbtn:active{ + box-shadow:0 0px 48px 0 rgba(0, 0, 0, .05); + width:75%; + } + } /*------------------------------------------------------------------------------------------------------------*/ @@ -4408,6 +4917,18 @@ hr{ color:#FFFAE6; } + .fzone .follow .report{ + background-color: #0c0c0c; + color:#FFC832; + border: 1px solid #FFC832; + } + .fzone .follow .report:hover{ + background-color: #302c2c; + color: #ff4848; + border: 1px solid #ff4848; + } + + .rightbox{ background-color: #0c0c0c; @@ -4580,7 +5101,7 @@ hr{ border: none; width: auto; } - .server_code h1{ + .server_code details{ color: #CCC; } .server_code p{ @@ -4732,4 +5253,49 @@ hr{ color: #FFC832; border-bottom: 1px solid #FFC832; } + + .admin_settings .admin_left{ + background-color: #0c0c0c; + border-right: none; + } + .admin_leftbtn{ + background-color: #0c0c0c; + color:#FFC832; + } + .admin_leftbtn:hover{ + background-color: #FFC832; + color: #0c0c0c; + } + + .admin_userinfo .icon .tatext h2{ + color:#FFF; + } + .admin_userinfo .icon .tatext p{ + color: #CCC; + } + .admin_userinfo .profile p{ + color:#CCC; + } + .admin_userinfo .rolebox{ + background-color: #0c0c0c; + border: 1px solid #FFC832; + } + .admin_userinfo .rolebox p{ + color:#FFC832; + } + .admin_userinfo .p2{ + color: #CCC; + } + .admin_userinfo .about p{ + color: #FFF; + } + .delbox .delbtn{ + background-color: #302c2c; + color:#FF4848; + } + + .delbox .delbtn:hover{ + background-color: #FF4848; + color: #F5F5F5; + } } \ No newline at end of file diff --git a/delete/delete.php b/delete/delete.php index 99982eb..b6ee1f7 100644 --- a/delete/delete.php +++ b/delete/delete.php @@ -1,27 +1,35 @@ 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(); - } + 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(); + } + // データベース接続の設定 + $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, + )); + + $query = $dbh->prepare('SELECT * FROM ueuse WHERE uniqid = :uniqid limit 1'); + + $query->execute(array(':uniqid' => $postUniqid)); + + $result = $query->fetch(); + + if($result["account"] === $postUserid){ // データベース接続の設定 $dbh = new PDO('mysql:charset=utf8mb4;dbname='.DB_NAME.';host='.DB_HOST, DB_USER, DB_PASS, array( PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, @@ -29,20 +37,20 @@ if (isset($_POST['uniqid']) && isset($_POST['userid'])){ PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => true, )); - $query = $dbh->prepare('SELECT * FROM ueuse WHERE uniqid = :uniqid limit 1'); + $query = $dbh->prepare('SELECT * FROM account WHERE userid = :userid limit 1'); - $query->execute(array(':uniqid' => $postUniqid)); - - $result = $query->fetch(); + $query->execute(array(':userid' => $postUserid)); - if($result["account"] === $postUserid){ + $result2 = $query->fetch(); + + if($result2["loginid"] === $loginid){ try { $pdo = new PDO('mysql:charset=utf8mb4;dbname='.DB_NAME.';host='.DB_HOST , DB_USER, DB_PASS); // 削除クエリを実行 $deleteQuery = $pdo->prepare("DELETE FROM ueuse WHERE uniqid = :uniqid AND account = :userid"); $deleteQuery->bindValue(':uniqid', $postUniqid, PDO::PARAM_STR); - $deleteQuery->bindValue(':userid', $userid, PDO::PARAM_STR); + $deleteQuery->bindValue(':userid', $postUserid, PDO::PARAM_STR); $res = $deleteQuery->execute(); if ($res) { @@ -57,6 +65,12 @@ if (isset($_POST['uniqid']) && isset($_POST['userid'])){ exit; } } + }else{ + echo json_encode(['success' => false, 'error' => '削除に失敗しました。(userid_err)']); + exit; } +}else{ + echo json_encode(['success' => false, 'error' => '削除に失敗しました。(sess_err)']); + exit; } ?> diff --git a/emoji/addemoji.php b/emoji/addemoji.php index 1f6fb75..5664311 100644 --- a/emoji/addemoji.php +++ b/emoji/addemoji.php @@ -57,6 +57,7 @@ if(isset($_SESSION['admin_login']) && $_SESSION['admin_login'] === true) { // セッションに値をセット $userid = $_SESSION['userid']; // セッションに格納されている値をそのままセット $username = $_SESSION['username']; // セッションに格納されている値をそのままセット + $loginid = $res["loginid"]; $_SESSION['admin_login'] = true; $_SESSION['userid'] = $userid; $_SESSION['username'] = $username; @@ -100,6 +101,7 @@ if(isset($_SESSION['admin_login']) && $_SESSION['admin_login'] === true) { // セッションに値をセット $userid = $_COOKIE['userid']; // クッキーから取得した値をセット $username = $_COOKIE['username']; // クッキーから取得した値をセット + $loginid = $res["loginid"]; $_SESSION['admin_login'] = true; $_SESSION['userid'] = $userid; $_SESSION['username'] = $username; diff --git a/emoji/index.php b/emoji/index.php index 0579f0f..5968bb7 100644 --- a/emoji/index.php +++ b/emoji/index.php @@ -55,6 +55,7 @@ if(isset($_SESSION['admin_login']) && $_SESSION['admin_login'] === true) { // セッションに値をセット $userid = $_SESSION['userid']; // セッションに格納されている値をそのままセット $username = $_SESSION['username']; // セッションに格納されている値をそのままセット + $loginid = $res["loginid"]; $_SESSION['admin_login'] = true; $_SESSION['userid'] = $userid; $_SESSION['username'] = $username; @@ -98,6 +99,7 @@ if(isset($_SESSION['admin_login']) && $_SESSION['admin_login'] === true) { // セッションに値をセット $userid = $_COOKIE['userid']; // クッキーから取得した値をセット $username = $_COOKIE['username']; // クッキーから取得した値をセット + $loginid = $res["loginid"]; $_SESSION['admin_login'] = true; $_SESSION['userid'] = $userid; $_SESSION['username'] = $username; diff --git a/favorite/favorite.php b/favorite/favorite.php index 9e7aa93..6adb8da 100644 --- a/favorite/favorite.php +++ b/favorite/favorite.php @@ -1,65 +1,85 @@ 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(); + } - // 投稿のいいね情報を取得 - $stmt = $pdo->prepare("SELECT favorite FROM ueuse WHERE uniqid = :uniqid"); - $stmt->bindValue(':uniqid', $postUniqid, PDO::PARAM_STR); - $stmt->execute(); - $post = $stmt->fetch(PDO::FETCH_ASSOC); + // データベース接続の設定 + $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, + )); + + $query = $dbh->prepare('SELECT * FROM account WHERE userid = :userid limit 1'); + + $query->execute(array(':userid' => $userId)); + + $result2 = $query->fetch(); + + if($result2["loginid"] === $loginid){ + + try { + $pdo = new PDO('mysql:charset=utf8mb4;dbname='.DB_NAME.';host='.DB_HOST , DB_USER, DB_PASS); + + // 投稿のいいね情報を取得 + $stmt = $pdo->prepare("SELECT favorite FROM ueuse WHERE uniqid = :uniqid"); + $stmt->bindValue(':uniqid', $postUniqid, PDO::PARAM_STR); + $stmt->execute(); + $post = $stmt->fetch(PDO::FETCH_ASSOC); + + if ($post) { + $favoriteList = explode(',', $post['favorite']); + $index = array_search($userId, $favoriteList); + + if ($index === false) { + // ユーザーIDを追加 + $favoriteList[] = $userId; + } else { + // ユーザーIDを削除 + array_splice($favoriteList, $index, 1); + } + + // 新しいいいね情報を更新 + $newFavorite = implode(',', $favoriteList); + $updateQuery = $pdo->prepare("UPDATE ueuse SET favorite = :favorite WHERE uniqid = :uniqid"); + $updateQuery->bindValue(':favorite', $newFavorite, PDO::PARAM_STR); + $updateQuery->bindValue(':uniqid', $postUniqid, PDO::PARAM_STR); + $res = $updateQuery->execute(); + + if ($res) { + echo json_encode(['success' => true, 'newFavorite' => $newFavorite]); + exit; + } else { + echo json_encode(['success' => false, 'error' => 'いいねの更新に失敗しました。']); + exit; + } - if ($post) { - $favoriteList = explode(',', $post['favorite']); - $index = array_search($userId, $favoriteList); - if ($index === false) { - // ユーザーIDを追加 - $favoriteList[] = $userId; } else { - // ユーザーIDを削除 - array_splice($favoriteList, $index, 1); - } - - // 新しいいいね情報を更新 - $newFavorite = implode(',', $favoriteList); - $updateQuery = $pdo->prepare("UPDATE ueuse SET favorite = :favorite WHERE uniqid = :uniqid"); - $updateQuery->bindValue(':favorite', $newFavorite, PDO::PARAM_STR); - $updateQuery->bindValue(':uniqid', $postUniqid, PDO::PARAM_STR); - $res = $updateQuery->execute(); - - if ($res) { - echo json_encode(['success' => true, 'newFavorite' => $newFavorite]); - exit; - } else { - echo json_encode(['success' => false, 'error' => 'いいねの更新に失敗しました。']); + echo json_encode(['success' => false, 'error' => '投稿が見つかりません。']); exit; } - - - } else { - echo json_encode(['success' => false, 'error' => '投稿が見つかりません。']); + } catch(PDOException $e) { + echo json_encode(['success' => false, 'error' => 'データベースエラー:' . $e->getMessage()]); exit; } - } catch(PDOException $e) { - echo json_encode(['success' => false, 'error' => 'データベースエラー:' . $e->getMessage()]); - exit; } + } else { + echo json_encode(['success' => false, 'error' => '必要なパラメータが提供されていません。']); + exit; } -} else { - echo json_encode(['success' => false, 'error' => '必要なパラメータが提供されていません。']); - exit; -} ?> diff --git a/home/ftl.php b/home/ftl.php index e2651f7..5ec2d23 100644 --- a/home/ftl.php +++ b/home/ftl.php @@ -42,9 +42,10 @@ try { $error_message[] = $e->getMessage(); } + if(isset($_SESSION['admin_login']) && $_SESSION['admin_login'] === true) { - $passQuery = $pdo->prepare("SELECT username,userid,loginid,admin FROM account WHERE userid = :userid"); + $passQuery = $pdo->prepare("SELECT username,userid,loginid,admin,role FROM account WHERE userid = :userid"); $passQuery->bindValue(':userid', $_SESSION['userid']); $passQuery->execute(); $res = $passQuery->fetch(); @@ -55,6 +56,8 @@ if(isset($_SESSION['admin_login']) && $_SESSION['admin_login'] === true) { // セッションに値をセット $userid = $_SESSION['userid']; // セッションに格納されている値をそのままセット $username = $_SESSION['username']; // セッションに格納されている値をそのままセット + $loginid = $res["loginid"]; + $role = $res["role"]; $_SESSION['admin_login'] = true; $_SESSION['userid'] = $userid; $_SESSION['username'] = $username; @@ -87,7 +90,7 @@ if(isset($_SESSION['admin_login']) && $_SESSION['admin_login'] === true) { } elseif (isset($_COOKIE['admin_login']) && $_COOKIE['admin_login'] == true) { - $passQuery = $pdo->prepare("SELECT username,userid,loginid,admin FROM account WHERE userid = :userid"); + $passQuery = $pdo->prepare("SELECT username,userid,loginid,admin,role FROM account WHERE userid = :userid"); $passQuery->bindValue(':userid', $_COOKIE['userid']); $passQuery->execute(); $res = $passQuery->fetch(); @@ -98,6 +101,8 @@ if(isset($_SESSION['admin_login']) && $_SESSION['admin_login'] === true) { // セッションに値をセット $userid = $_COOKIE['userid']; // クッキーから取得した値をセット $username = $_COOKIE['username']; // クッキーから取得した値をセット + $loginid = $res["loginid"]; + $role = $res["role"]; $_SESSION['admin_login'] = true; $_SESSION['userid'] = $userid; $_SESSION['username'] = $username; @@ -448,28 +453,30 @@ if ("serviceWorker" in navigator) { -