diff --git a/.well-known/host-meta/index.php b/.well-known/host-meta/index.php index a790b9d..892af78 100644 --- a/.well-known/host-meta/index.php +++ b/.well-known/host-meta/index.php @@ -1,10 +1,12 @@ getMessage(); } + if(isset($_GET['resource'])){ + $user = htmlentities($_GET['resource']); - $user = htmlentities($_GET['resource']); + $userid = str_replace('acct:','', str_replace('@'.$domain.'', '', $user)); - $userid = str_replace('acct:','', str_replace('@'.$domain.'', '', $user)); + $item = array( + "subject" => "acct:".$userid.'@'.$domain.'', + "links" => [ + array( + "rel" => "self", + "type" => "application/activity+json", + "href" => "https://".$domain."/actor/?actor=@".$userid.'', + ), + ], + ); - $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); + echo json_encode($item, JSON_UNESCAPED_UNICODE); + } }else{ header("HTTP/1.1 410 Gone"); } diff --git a/README.md b/README.md deleted file mode 100644 index 8f2c176..0000000 --- a/README.md +++ /dev/null @@ -1,142 +0,0 @@ -# 注意:結構脆弱です。導入後はローカルな環境で使うことをおすすめします。 - -# uwuzu -あたらしいSNSです!!! -右側のReleaseからDLして導入していただけます! -AGPLライセンスです!!! - -導入方法は以下のとおりです! - - -## 5. サーバーの建て方 -まず、Apache2とPHP 8とmysql Ver 15が導入されているサーバーを準備します! -PHP 8では事前にGDを有効化しておいてください!(QRコードの生成に必要です。) -次にSQLを設定します。(InnoDB) -まず、お好きな名前でDBを作成し、その中に、account,emoji,notice,role,ueuse,notification,ads,reportとテーブルを作成します。 -テーブルの中身は以下のとおりです。 -照合順序は全て標準でutf8mb4_general_ciです。 - -## 簡単に構築できるようSQLの構造ファイルがリリースに添付されています!そちらをインポートしていただけますと大幅に簡単に導入できます! -(userロールとofficialロールとiceロールの設定は別途必要です。お手数ですがそこの設定だけよろしくお願いいたします。) - - -### account -- sysid(INT)(AUTO_INCREMENT ) アカウントが追加されるとカウントされるシステム用ID -- username(varchar(500)) ユーザーネーム保存用 -- userid(varchar(500)) ユーザーID保存用 -- password(varchar(1024)) パスワード保存用(ハッシュ化されます) -- loginid(varchar(256)) 自動ログイン時に本人アカウントか確認 -- mailadds(varchar(500)) メールアドレス保存用 -- profile(TEXT) プロフィールテキスト保存用 -- iconname(varchar(256)) アイコン画像リンク保存用 -- headname(varchar(256)) ヘッダー画像リンク保存用 -- role(varchar(1024)) 「user」のようなロール保存用 -- datetime(datetime) アカウント作成日時保存用 -- follow(text) アカウントがフォローしている人保存用 -- follower(text) アカウントがフォローされている人保存用 -- blocklist(text) ブロックしている人保存用 -- admin(varchar(25)) 管理者アカウントなら「yes」、それ以外なら「none」と入力。 -- authcode(varchar(256)) 二段階認証用キー保存用 -- backupcode(varchar(256)) 二段階認証のバックアップコード保存用 -- sacinfo(varchar(256)) 特殊アカウント識別用 - -### emoji -- sysid(INT)(AUTO_INCREMENT) アカウントが追加されるとカウントされるシステム用ID -- emojifile(varchar(512)) 絵文字ファイルパス保存用 -- emojiname(varchar(512)) 「:emoji:」のような絵文字名保存用 -- emojiinfo(text) 絵文字についての説明保存用 -- emojidate(datetime) 絵文字登録日時保存用 - -### notice -- sysid(INT)(AUTO_INCREMENT) うんえいからのおしらせが追加されるとカウントされるシステム用ID -- title(varchar(1024)) お知らせのタイトル保存用 -- note(text) お知らせの内容保存用 -- account(varchar(500)) 編集者ID保存用 -- emojidate(datetime) お知らせ登録日時保存用 - -### role -- sysid(INT)(AUTO_INCREMENT) ロールが追加されるとカウントされるシステム用ID -- rolename(varchar(512)) ロール表示名保存用 -- roleauth(varchar(256)) ロールの権限保存用 -- rolecolor(varchar(25)) ロールの色保存用 -- roleidname(varchar(512)) 「user」のようなロール指定用 - -### ueuse -- sysid(INT)(AUTO_INCREMENT) 投稿されるとカウントされるシステム用ID -- account(varchar(256)) 投稿者ID保存用 -- uniqid(varchar(256)) 投稿ID保存用 -- rpuniqid(varchar(256)) リプライ先ID保存用 -- ueuse(text) 投稿内容保存用 -- photo1(varchar(512)) 投稿に添付されたファイルの保存ディレクトリ保存用 -- photo2(varchar(512)) 投稿に添付されたファイルの保存ディレクトリ保存用 -- photo3(varchar(512)) 投稿に添付されたファイルの保存ディレクトリ保存用 -- photo4(varchar(512)) 投稿に添付されたファイルの保存ディレクトリ保存用 -- video1(varchar(512)) 投稿に添付されたファイルの保存ディレクトリ保存用 -- datetime(datetime) 投稿日時保存用 -- favorite(text) いいね保存用 -- abi(text) 投稿者の追記保存用 -- abidate(datetime) 追記日時保存用 -- nsfw(varchar(25)) NSFW指定有無保存用 - -### notification -- sysid(INT)(AUTO_INCREMENT) 通知されるとカウントされるシステム用ID -- touserid(varchar(512)) 通知先ID保存用 -- title(varchar(1024)) 通知のタイトル -- msg(text) 通知の内容 -- datetime(datetime) 通知日時 -- userchk(varchar(25)) 通知の既読確認 - -### invitation -- sysid(INT)(AUTO_INCREMENT) 追加されるとカウントされるシステム用ID -- code(varchar(512)) 招待コード -- used(varchar(25)) 使用済みかそうでないか -- datetime(datetime) 招待コード仕様日時更新用 - -### 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からその動作ディレクトリを指定し、動作ディレクトリ内のdb.phpにDBのログイン情報を書き込んであとはApacheとphpとMy SQLを起動するだけ! -起動したらまずDBのroleにphpmyadminから「user」ロールと「official」ロールと「ice」ロールを追加、権限は「user」と「official」と「ice」でOK。ロール名はとりあえず「一般ユーザー」とか適当でOK、ロールの色はHEXコード(#を除く)で000000のように指定。(この3つのロールがないとエラーが発生します。) -そしたら普通にuwuzuにアクセスして自分のアカウントを登録。 -## 管理者アカウント登録機能が追加されました。【[domain]/admin/】より設定できるのでそちらをご利用ください。 -なお、管理者アカウントを導入後に登録した場合サーバーを止めてuwuzu動作ディレクトリ内のserverフォルダ内のファイルを設定する必要はございません。 -管理者アカウント作成後にログインし、サーバー設定より以下の項目が簡単に設定できます。 - -- 404imagepath.txt : 404ページに表示する画像パス保存用 -- 503imagepath.txt : 503ページに表示する画像パス保存用 -- banurldomain.txt : 投稿禁止URLドメイン -- banuserid.txt : 登録禁止ユーザーid -- info.txt : サーバー登録時に表示されるメッセージ(好きな内容) -- privacypolicy.txt : プライバシーポリシー(サーバーのプライバシーポリシーを記載) -- serverstop.txt : サーバー停止ページで表示するメッセージ -- terms.txt : 利用規約(サーバーの利用規約を記載) -- textsize.txt : 最大文字数 -- serversettings.ini : サーバー情報保存ファイル -- uwuzuabout.txt : このファイル(uwuzuを改造した場合は書き換え) -- uwuzuinfo.txt : uwuzuのバージョン等記載(uwuzuを改造した場合は書き換え) -- uwuzurelease.txt : uwuzuのバージョン等記載(uwuzuを改造した場合は書き換え) -- onlyuser.txt : 招待コード機能をオンにするかどうか、「true」でオン、「false」でオフ。招待コードはDBに直接追加。 - -### これでサーバーは完成!!! -脆弱だから自己責任で楽しんでね~() - -### uwuzuを改変する人へ -基本的にReleaseより最新のコードをDLして改変してください。 -Githubのmain内のコードは信頼しないほうがいいです。なぜなら私だいちまるがGithubの使い方をいまいち理解していないからです() -ご迷惑をおかけしますがどうぞよろしくお願いいたします。 diff --git a/UPUL_License.txt b/UPUL_License.txt new file mode 100644 index 0000000..5abee4d --- /dev/null +++ b/UPUL_License.txt @@ -0,0 +1,55 @@ +------------------ + +ライセンス名 : uwuzu公衆利用ライセンス(英: uwuzu Public Use License) +バージョン : 1.0.0 +ライセンス著作権 : uwuzu +本ライセンス使用著作者帰属先 : daichimarukana,putonfps +本ライセンス使用著作者連絡先 : support@uwuzu.com,daichimarukana@gmail.com + +この文書を完全にコピーして利用、2-15以降に追記することは許可されていますが、この文書の2-14以前の改変、保存・利用することは許可されていません。 + + +0. まえがき +uwuzu公衆利用ライセンスは本ライセンスを使用する全ての著作物の利用条件を明確にするためのライセンスです。 +主にコンピューターで実行されるソフトウェアに対して使用しやすいように作成されています。 + +本ライセンスでは、ソフトウェアの作成者、利用者、改変者、それぞれが負担なく利用できるように考えられています。 + +1. 定義 +ここにある定義はこの文書全体に適用されます。 +「本ライセンス」とはuwuzu公衆利用ライセンス バージョン1.0.0を指します。 +「著作権」とはベルヌ条約で示されている著作権及び各国の法律により示されている著作権を指します。 +「著作物」とは上記の著作権に基づく作成された物を指します。 +「著作者」とは本ライセンスの適用されている著作物を作成した人物を指します。 + +2. 利用条件 + 2-1. 本ライセンスが適用されている著作物は完全無料で閲覧・利用・改変が可能なものとします。 + 2-1-1. 改変し、公開する場合、本ライセンスが適用されている著作物のライセンスを変更することはできないものとします。 + 2-1-2. 改変する場合、著作物の原型を残す必要があります。 + 2-1-3. 改変する場合、「本ライセンス使用著作者帰属先」「本ライセンス使用著作者連絡先」を含め、本文書を引き継いで適用し、著作者の情報を削除しない必要があります。 + 2-1-3-1. 改変者の情報を追記することが可能ですが、著作者の権利を侵害しない範囲に限ります。 + 2-2. 本ライセンスが適用されている著作物を改変した場合、改変者は著作者による内容の開示を請求された場合に開示する必要があります。 + 2-2-1. 改変者は、改変した著作物を自身で公開する場合、著作者の同意を得る必要はありません。 + 2-3. 本ライセンスが適用されている著作物を改変して自身で利用する場合は、改変内容を開示する必要はありません。ただし、著作者から開示要求があった場合は、これに応じる必要があります。 + 2-3-1. 改変してから改変者が著作者以外の他人に譲渡・共有・配布する際は改変した著作物を誰でも使用できるものとします。 + 2-3-2. もし改変者が改変済の著作物を他人に譲渡・共有・配布せずに改変者自身で利用してサービスを提供する場合はサービス利用者に改変した著作物を公開する必要はありません。 + 2-4. 本ライセンスが適用されている著作物を二次配布したり改変したものを配布することは可能とします。 + 2-5. 本ライセンスはいかなる著作物にも著作者が適用することが可能です。 + 2-6. 著作物に本ライセンスを適用した著作者はいつでもこのライセンスの適用を取り消し、別のライセンスに変更することが可能なものとします。 + 2-6-1. 本ライセンスを適用した著作物のライセンスを変更した場合著作者はライセンスを変更したことを著作物内に明記する必要があります。 + 2-7. 本ライセンスが適用されている場合でも著作権は著作者に帰属します。 + 2-7-1. 著作者が本ライセンスが適用されている著作物の著作権の放棄を明記しない限り著作権は保護されます。 + 2-8. 著作者は本文書の「本ライセンス使用著作者帰属先」欄に著作者を判別できる文字列を記入する必要があります。 + 2-8-1. 可能であれば著作者は本文書の「本ライセンス使用著作者連絡先」に連絡先を記入する必要があります。 + 2-9. 本ライセンスが適用されている著作物の取り扱いは本ライセンス及び法律に則って扱う必要があります。 + 2-10. 本ライセンスが適用されている著作物を著作者が公開を停止し、著作者が利用者・改変者などに削除を求める旨の文章を公開していて、利用者・改変者などの関係者がそれに気づくことができた場合は削除する必要があるものとします。 + 2-11. 本ライセンスが適用されている著作物を使用し、何らかの損害が発生した場合に著作者は責任を負う必要はありません。 + 2-11-1. 本ライセンスが適用されている著作物を使用する際の責任は全て使用者にあるものとします。 + 2-12. 本ライセンスが適用されている著作物から本ライセンスを無効化するには著作者の許可、もしくは著作者によるライセンス変更が必要となります。 + 2-13. 本ライセンスが適用されている著作物は、営利目的を含む、いかなる利用目的であっても利用が可能です。 + 2-14. 本ライセンスはどなたでも自由にご利用いただけます。 + 2-15. 著作者は本ライセンスに追記して独自の規約を作成することが可能なものとし、利用者・改変者はその規約に従う必要があるものとします。 +/----------(以下追記欄)----------/ +独自の規約はありません。 +上記の利用条件に従って利用してください。 +-------------------<以上>------------------- \ No newline at end of file diff --git a/actor/index.php b/actor/index.php index ddb3a84..3138f78 100644 --- a/actor/index.php +++ b/actor/index.php @@ -2,7 +2,9 @@ $serversettings_file = "../server/serversettings.ini"; $serversettings = parse_ini_file($serversettings_file, true); if(htmlspecialchars($serversettings["serverinfo"]["server_activitypub"], ENT_QUOTES, 'UTF-8') === "true"){ - header("Content-Type: application/json; charset=utf-8"); + header("Content-Type: application/json"); + header("charset=utf-8"); + header("Access-Control-Allow-Origin: *"); $domain = $_SERVER['HTTP_HOST']; @@ -70,6 +72,12 @@ if(htmlspecialchars($serversettings["serverinfo"]["server_activitypub"], ENT_QUO "mediaType" => "image/".$icon_kakucho_ci."", "url" => "https://".$domain."/".$userData["headname"]."", ), + + /*"publicKey" => array( + "id" => "https://".$domain."/actor/?actor=@".$userid."#main-key", + "owner" => "https://".$domain."/actor/?actor=@".$userid."", + "publicKeyPem" => "ここにHTTP-Signature", + ),*/ ); echo json_encode($item, JSON_UNESCAPED_UNICODE); }else{ diff --git a/addauthcode.php b/addauthcode.php index c4c15b6..df9f9c6 100644 --- a/addauthcode.php +++ b/addauthcode.php @@ -163,14 +163,14 @@ if( !empty($_POST['btn_submit']) ) { header('Location: ' . $url, true, 303); exit; } else { - $error_message[] = '更新に失敗しました。'; + $error_message[] = '更新に失敗しました。(REGISTERED_DAME)'; } // プリペアドステートメントを削除 $stmt = null; } } else { - $error_message[] = "二段階認証が出来ませんでした。再度お試しください。"; + $error_message[] = "二段階認証が出来ませんでした。再度お試しください。(AUTHCODE_CHECK_DAME)"; } } @@ -184,8 +184,8 @@ $pdo = null; - - + + @@ -204,7 +204,7 @@ $pdo = null; diff --git a/admin/addadmin.php b/admin/addadmin.php index 9da5a57..9ce9688 100644 --- a/admin/addadmin.php +++ b/admin/addadmin.php @@ -10,6 +10,9 @@ function createUniqId(){ } require('../db.php'); +//関数呼び出し +//- EXIF +require('../function/function.php'); $serversettings_file = "../server/serversettings.ini"; $serversettings = parse_ini_file($serversettings_file, true); @@ -88,15 +91,6 @@ if( !empty($_POST['btn_submit']) ) { $invitationcode = $_POST['invitationcode']; } - //cookieに保存 - setcookie("username",$username,time()+60*60*24*14); - setcookie("userid",$userid,time()+60*60*24*14); - - setcookie("password",$password,time()+60*60*24*14); - setcookie("mailadds",$mailadds,time()+60*60*24*14); - - setcookie("profile",$profile,time()+60*60*24*14); - //----------------[icon image]------------------------------- if (empty($_FILES['image']['name'])) { $localFilePathhead = '../img/deficon/icon.png'; @@ -138,8 +132,11 @@ if( !empty($_POST['btn_submit']) ) { $uploadedPath = 'usericons/' . $newFilename; // ファイルを移動 - $result = move_uploaded_file($uploadedFile['tmp_name'], '../'.$uploadedPath); + $result = move_uploaded_file($uploadedFile['tmp_name'], $uploadedPath); + // EXIF削除 + delete_exif($extension, $uploadedPath); + if ($result) { $iconName = $uploadedPath; // 保存されたファイルのパスを使用 } else { @@ -204,14 +201,14 @@ if( !empty($_POST['btn_submit']) ) { // 招待コードの入力チェック if( empty($invitationcode) ) { - $error_message[] = '招待コードを入力してください。'; + $error_message[] = '招待コードを入力してください。(INVITATION_CODE_INPUT_PLEASE)'; } else { if($result > 0){ if($result["used"] === "true"){ - $error_message[] = 'この招待コード('.$invitationcode.')は既に使用されています。'; + $error_message[] = 'この招待コード('.$invitationcode.')は既に使用されています。(INVITATION_CODE_SHIYOUZUMI)'; } }else{ - $error_message[] = 'この招待コード('.$invitationcode.')は使えません。'; + $error_message[] = 'この招待コード('.$invitationcode.')は使えません。(INVITATION_CODE_DEAD)'; } } @@ -227,33 +224,33 @@ if( !empty($_POST['btn_submit']) ) { // ユーザーネームの入力チェック if( empty($username) ) { - $error_message[] = '表示名を入力してください。'; + $error_message[] = '表示名を入力してください。(USERNAME_INPUT_PLEASE)'; } else { // 文字数を確認 if( 25 < mb_strlen($username, 'UTF-8') ) { - $error_message[] = 'ユーザーネームは25文字以内で入力してください。'; + $error_message[] = 'ユーザーネームは50文字以内で入力してください。(USERNAME_OVER_MAX_COUNT)'; } } // IDの入力チェック if( empty($userid) ) { - $error_message[] = 'ユーザーIDを入力してください。'; + $error_message[] = 'ユーザーIDを入力してください。(USERID_INPUT_PLEASE)'; } else { // 文字数を確認 if( 20 < mb_strlen($userid, 'UTF-8') ) { - $error_message[] = 'IDは20文字以内で入力してください。'; + $error_message[] = 'IDは20文字以内で入力してください。(USERID_OVER_MAX_COUNT)'; } if($result > 0){ - $error_message[] = 'このID('.$userid.')は既に使用されています。他のIDを作成してください。'; //このE-mailは既に使用されています。 + $error_message[] = 'このID('.$userid.')は既に使用されています。他のIDを作成してください。(USERID_SHIYOUZUMI)'; } } // パスワードの入力チェック if( empty($password) ) { - $error_message[] = 'パスワードを入力してください。'; + $error_message[] = 'パスワードを入力してください。(PASSWORD_INPUT_PLEASE)'; } else { $weakPasswords = array( @@ -323,27 +320,21 @@ if( !empty($_POST['btn_submit']) ) { return in_array($passwords, $weakPasswords); } - // テスト用のパスワード(実際にはユーザー入力などから取得することになります。 - if (isWeakPassword($password)) { - $error_message[] = "パスワードが弱いです。セキュリティ上変更してください。"; - } else { - + $error_message[] = "パスワードが弱いです。セキュリティ上変更してください。(PASSWORD_ZEIJAKU)"; } - if ($chkpass == $password ){ - - }else{ - $error_message[] = '確認用パスワードが違います。'; + if (!($chkpass == $password)){ + $error_message[] = '確認用パスワードが違います。(PASSWORD_CHIGAUYANKE)'; } if( 4 > mb_strlen($password, 'UTF-8') ) { - $error_message[] = 'パスワードは4文字以上である必要があります。'; + $error_message[] = 'パスワードは4文字以上である必要があります。(PASSWORD_TODOITENAI_MIN_COUNT)'; } // 文字数を確認 if( 100 < mb_strlen($password, 'UTF-8') ) { - $error_message[] = 'パスワードは100文字以内で入力してください。'; + $error_message[] = 'パスワードは100文字以内で入力してください。(PASSWORD_OVER_MAX_COUNT)'; } } @@ -386,7 +377,7 @@ if( !empty($_POST['btn_submit']) ) { // コミット $res = $pdo->commit(); - if($onlyuser === "true"){ + if(htmlspecialchars($serversettings["serverinfo"]["server_invitation"], ENT_QUOTES, 'UTF-8') === "true"){ $pdo->beginTransaction(); $stmt = $pdo->prepare("UPDATE invitation SET used = :used, datetime = :datetime WHERE code = :code;"); @@ -419,7 +410,7 @@ if( !empty($_POST['btn_submit']) ) { // すべての出力を終了 exit; } else { - $error_message[] = '登録に失敗しました。'; + $error_message[] = '登録に失敗しました。(REGISTERED_DAME)'; } // プリペアドステートメントを削除 @@ -435,8 +426,8 @@ $pdo = null; - - + + diff --git a/admin/index.php b/admin/index.php index 720a8b2..3472a37 100644 --- a/admin/index.php +++ b/admin/index.php @@ -83,9 +83,9 @@ $pdo = null; - - - + + + diff --git a/admin/success.php b/admin/success.php index a795e38..22e0e1c 100644 --- a/admin/success.php +++ b/admin/success.php @@ -78,9 +78,9 @@ if(!(empty($_SESSION['backupcode']))){ - - - + + + diff --git a/api/bot-api.php b/api/bot-api.php index 03c43b2..6fc92e1 100644 --- a/api/bot-api.php +++ b/api/bot-api.php @@ -11,7 +11,9 @@ $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: *;"); +header("Content-Type: application/json"); +header("charset=utf-8"); +header("Access-Control-Allow-Origin: *"); function createUniqId(){ list($msec, $sec) = explode(" ", microtime()); @@ -21,7 +23,13 @@ function createUniqId(){ return base_convert($hashCreateTime,10,36); } - +function decode_yajirushi($postText){ + $postText = str_replace('←', '←', $postText); + $postText = str_replace('↓', '↓', $postText); + $postText = str_replace('↑', '↑', $postText); + $postText = str_replace('→', '→', $postText); + return $postText; +} function get_mentions_userid($postText) { // @useridを検出する $usernamePattern = '/@(\w+)/'; @@ -77,14 +85,16 @@ if(isset($_GET['token'])&&isset($_GET['type'])) { } // 禁止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(!($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; + } } } } @@ -201,7 +211,7 @@ if(isset($_GET['token'])&&isset($_GET['type'])) { // コミット $res = $pdo->commit(); - $mentionedUsers = get_mentions_userid($ueuse); + $mentionedUsers = array_unique(get_mentions_userid($ueuse)); foreach ($mentionedUsers as $mentionedUser) { @@ -266,7 +276,7 @@ if(isset($_GET['token'])&&isset($_GET['type'])) { // プリペアドステートメントを削除 $stmt = null; }else{ - $err = "over_rate_limit "; + $err = "over_rate_limit"; $response = array( 'error_code' => $err, ); @@ -309,14 +319,16 @@ if(isset($_GET['token'])&&isset($_GET['type'])) { } // 禁止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(!($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; + } } } } @@ -472,7 +484,7 @@ if(isset($_GET['token'])&&isset($_GET['type'])) { // コミット $res = $pdo->commit(); - $mentionedUsers = get_mentions_userid($ueuse); + $mentionedUsers = array_unique(get_mentions_userid($ueuse)); foreach ($mentionedUsers as $mentionedUser) { @@ -490,13 +502,13 @@ if(isset($_GET['token'])&&isset($_GET['type'])) { $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(':touserid', decode_yajirushi(htmlspecialchars_decode($touserid), PDO::PARAM_STR)); + $stmt->bindParam(':msg', decode_yajirushi(htmlspecialchars_decode($msg), PDO::PARAM_STR)); + $stmt->bindParam(':url', decode_yajirushi(htmlspecialchars_decode($url), PDO::PARAM_STR)); + $stmt->bindParam(':userchk', decode_yajirushi(htmlspecialchars_decode($userchk), PDO::PARAM_STR)); + $stmt->bindParam(':title', decode_yajirushi(htmlspecialchars_decode($title), PDO::PARAM_STR)); - $stmt->bindParam(':datetime', htmlentities($datetime), PDO::PARAM_STR); + $stmt->bindParam(':datetime', decode_yajirushi(htmlspecialchars_decode($datetime), PDO::PARAM_STR)); // SQLクエリの実行 $res = $stmt->execute(); @@ -647,16 +659,16 @@ if(isset($_GET['token'])&&isset($_GET['type'])) { $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"]), + 'user_name' => decode_yajirushi(htmlspecialchars_decode($userdata["username"])), + 'user_id' => decode_yajirushi(htmlspecialchars_decode($userdata["userid"])), + 'profile' => decode_yajirushi(htmlspecialchars_decode($userdata["profile"])), + 'user_icon' => decode_yajirushi(htmlspecialchars_decode("https://".$domain."/".$userdata["iconname"])), + 'user_header' => decode_yajirushi(htmlspecialchars_decode("https://".$domain."/".$userdata["headname"])), + 'registered_date' => decode_yajirushi(htmlspecialchars_decode($userdata["datetime"])), + 'follow' => decode_yajirushi(htmlspecialchars_decode($userdata["follow"])), + 'follow_cnt' => decode_yajirushi(htmlspecialchars_decode($userdata["follow_cnt"])), + 'follower' => decode_yajirushi(htmlspecialchars_decode($userdata["follower"])), + 'follower_cnt' => decode_yajirushi(htmlspecialchars_decode($userdata["follower_cnt"])), ); } echo json_encode($response, JSON_UNESCAPED_UNICODE);; diff --git a/api/ltl-api.php b/api/ltl-api.php index 7335c02..5b1213b 100644 --- a/api/ltl-api.php +++ b/api/ltl-api.php @@ -1,11 +1,19 @@ htmlentities($ueusedata["account"]), - 'username' => htmlentities($ueusedata["username"]), - 'uniqid' => htmlentities($ueusedata["uniqid"]), - 'ueuse' => htmlentities($ueusedata["ueuse"]), - 'photo1' => htmlentities(str_replace('../', '' . $_SERVER['HTTP_HOST'] . '/', $ueusedata["photo1"])), - 'photo2' => htmlentities(str_replace('../', '' . $_SERVER['HTTP_HOST'] . '/', $ueusedata["photo2"])), - 'video1' => htmlentities(str_replace('../', '' . $_SERVER['HTTP_HOST'] . '/', $ueusedata["video1"])), - 'favorite' => htmlentities($ueusedata["favorite"]), - 'favorite_cnt' => htmlentities($ueusedata["favorite_cnt"]), - 'datetime' => htmlentities($ueusedata["datetime"]), - 'abi' => htmlentities($ueusedata["abi"]), - 'abidatetime' => htmlentities($ueusedata["abidate"]), - 'nsfw' => htmlentities($ueusedata["nsfw"]), + 'account' => decode_yajirushi(htmlspecialchars_decode($ueusedata["account"])), + 'username' => decode_yajirushi(htmlspecialchars_decode($ueusedata["username"])), + 'uniqid' => decode_yajirushi(htmlspecialchars_decode($ueusedata["uniqid"])), + 'ueuse' => decode_yajirushi(htmlspecialchars_decode($ueusedata["ueuse"])), + 'photo1' => decode_yajirushi(htmlspecialchars_decode(str_replace('../', '' . $_SERVER['HTTP_HOST'] . '/', $ueusedata["photo1"]))), + 'photo2' => decode_yajirushi(htmlspecialchars_decode(str_replace('../', '' . $_SERVER['HTTP_HOST'] . '/', $ueusedata["photo2"]))), + 'video1' => decode_yajirushi(htmlspecialchars_decode(str_replace('../', '' . $_SERVER['HTTP_HOST'] . '/', $ueusedata["video1"]))), + 'favorite' => decode_yajirushi(htmlspecialchars_decode($ueusedata["favorite"])), + 'favorite_cnt' => decode_yajirushi(htmlspecialchars_decode($ueusedata["favorite_cnt"])), + 'datetime' => decode_yajirushi(htmlspecialchars_decode($ueusedata["datetime"])), + 'abi' => decode_yajirushi(htmlspecialchars_decode($ueusedata["abi"])), + 'abidatetime' => decode_yajirushi(htmlspecialchars_decode($ueusedata["abidate"])), + 'nsfw' => decode_yajirushi(htmlspecialchars_decode($ueusedata["nsfw"])), ]; $response[$ueusedata["uniqid"]] = $item; // ループ内で $response にデータを追加 diff --git a/api/serverinfo-api.php b/api/serverinfo-api.php index fcca074..f7f9863 100644 --- a/api/serverinfo-api.php +++ b/api/serverinfo-api.php @@ -1,5 +1,7 @@ htmlentities($value['title']), - "note" => htmlentities($value['note']), - "editor" => htmlentities($value['account']), - "datetime" => htmlentities($value['datetime']), + "title" => decode_yajirushi(htmlspecialchars_decode($value['title'])), + "note" => decode_yajirushi(htmlspecialchars_decode($value['note'])), + "editor" => decode_yajirushi(htmlspecialchars_decode($value['account'])), + "datetime" => decode_yajirushi(htmlspecialchars_decode($value['datetime'])), ); $notice[] = $notices; diff --git a/api/ueuse-api.php b/api/ueuse-api.php index 9eec954..cdcf142 100644 --- a/api/ueuse-api.php +++ b/api/ueuse-api.php @@ -1,6 +1,14 @@ htmlentities($ueusedata["account"]), - 'user_name' => htmlentities($ueusedata["username"]), - 'uniqid' => htmlentities($ueusedata["uniqid"]), - 'ueuse' => htmlentities($ueusedata["ueuse"]), - 'photo1' => htmlentities(str_replace('../', ''.$_SERVER['HTTP_HOST'].'/', $ueusedata["photo1"])), - 'photo2' => htmlentities(str_replace('../', ''.$_SERVER['HTTP_HOST'].'/', $ueusedata["photo2"])), - 'video1' => htmlentities(str_replace('../', ''.$_SERVER['HTTP_HOST'].'/', $ueusedata["video1"])), - 'favorite' => htmlentities($ueusedata["favorite"]), - 'favorite_cnt' => htmlentities($ueusedata["favorite_cnt"]), - 'datetime' => htmlentities($ueusedata["datetime"]), - 'abi' => htmlentities($ueusedata["abi"]), - 'abidatetime' => htmlentities($ueusedata["abidate"]), + 'userid' => decode_yajirushi(htmlspecialchars_decode($ueusedata["account"])), + 'user_name' => decode_yajirushi(htmlspecialchars_decode($ueusedata["username"])), + 'uniqid' => decode_yajirushi(htmlspecialchars_decode($ueusedata["uniqid"])), + 'ueuse' => decode_yajirushi(htmlspecialchars_decode($ueusedata["ueuse"])), + 'photo1' => decode_yajirushi(htmlspecialchars_decode(str_replace('../', ''.$_SERVER['HTTP_HOST'].'/', $ueusedata["photo1"]))), + 'photo2' => decode_yajirushi(htmlspecialchars_decode(str_replace('../', ''.$_SERVER['HTTP_HOST'].'/', $ueusedata["photo2"]))), + 'video1' => decode_yajirushi(htmlspecialchars_decode(str_replace('../', ''.$_SERVER['HTTP_HOST'].'/', $ueusedata["video1"]))), + 'favorite' => decode_yajirushi(htmlspecialchars_decode($ueusedata["favorite"])), + 'favorite_cnt' => decode_yajirushi(htmlspecialchars_decode($ueusedata["favorite_cnt"])), + 'datetime' => decode_yajirushi(htmlspecialchars_decode($ueusedata["datetime"])), + 'abi' => decode_yajirushi(htmlspecialchars_decode($ueusedata["abi"])), + 'abidatetime' => decode_yajirushi(htmlspecialchars_decode($ueusedata["abidate"])), ); } echo json_encode($response, JSON_UNESCAPED_UNICODE);; diff --git a/api/userdata-api.php b/api/userdata-api.php index 0ee50cd..4e664f0 100644 --- a/api/userdata-api.php +++ b/api/userdata-api.php @@ -1,6 +1,14 @@ 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"]), + 'user_name' => decode_yajirushi(htmlspecialchars_decode($userdata["username"])), + 'user_id' => decode_yajirushi(htmlspecialchars_decode($userdata["userid"])), + 'profile' => decode_yajirushi(htmlspecialchars_decode($userdata["profile"])), + 'user_icon' => decode_yajirushi(htmlspecialchars_decode("https://".$domain."/".$userdata["iconname"])), + 'user_header' => decode_yajirushi(htmlspecialchars_decode("https://".$domain."/".$userdata["headname"])), + 'registered_date' => decode_yajirushi(htmlspecialchars_decode($userdata["datetime"])), + 'follow' => decode_yajirushi(htmlspecialchars_decode($userdata["follow"])), + 'follow_cnt' => decode_yajirushi(htmlspecialchars_decode($userdata["follow_cnt"])), + 'follower' => decode_yajirushi(htmlspecialchars_decode($userdata["follower"])), + 'follower_cnt' => decode_yajirushi(htmlspecialchars_decode($userdata["follower_cnt"])), ); } echo json_encode($response, JSON_UNESCAPED_UNICODE); diff --git a/api/v1/index.php b/api/v1/index.php new file mode 100644 index 0000000..dcb90ac --- /dev/null +++ b/api/v1/index.php @@ -0,0 +1,5 @@ + \ No newline at end of file diff --git a/api/v1/instance.php b/api/v1/instance.php new file mode 100644 index 0000000..5af0c3c --- /dev/null +++ b/api/v1/instance.php @@ -0,0 +1,63 @@ + $domain, + "email" => $contactfile, + "title" => "uwuzu", + "version" =>str_replace("\r", '', $uwuzuinfo[1]), + "thumbnail" => $server_head, + "description" => $serverinfo, + ); + + echo json_encode($item, JSON_UNESCAPED_UNICODE); +}else{ + header("HTTP/1.1 410 Gone"); +} +?> \ No newline at end of file diff --git a/authcodechk.php b/authcodechk.php index 2af25c7..ee9acb3 100644 --- a/authcodechk.php +++ b/authcodechk.php @@ -129,8 +129,8 @@ $pdo = null; - - + + @@ -149,7 +149,7 @@ $pdo = null; diff --git a/authlogin.php b/authlogin.php index b75a264..2b9bdbd 100644 --- a/authlogin.php +++ b/authlogin.php @@ -123,8 +123,9 @@ if( !empty($_POST['btn_submit']) ) { $url = '/settings'; $userchk = 'none'; // 通知用SQL作成 - $stmt = $pdo->prepare("INSERT INTO notification (touserid, msg, url, datetime, userchk, title) VALUES (:touserid, :msg, :url, :datetime, :userchk, :title)"); + $stmt = $pdo->prepare("INSERT INTO notification (fromuserid, touserid, msg, url, datetime, userchk, title) VALUES (:fromuserid, :touserid, :msg, :url, :datetime, :userchk, :title)"); + $stmt->bindParam(':fromuserid', htmlentities("uwuzu-fromsys"), PDO::PARAM_STR); $stmt->bindParam(':touserid', htmlentities($touserid), PDO::PARAM_STR); $stmt->bindParam(':msg', htmlentities($msg), PDO::PARAM_STR); $stmt->bindParam(':url', htmlentities($url), PDO::PARAM_STR); @@ -159,7 +160,7 @@ if( !empty($_POST['btn_submit']) ) { // すべての出力を終了 exit; }else{ - $error_message[] = "そのバックアップコードは使用できません。"; + $error_message[] = "そのバックアップコードは使用できません。(BACKUPCODE_DAME)"; } }else{ @@ -173,7 +174,7 @@ if( !empty($_POST['btn_submit']) ) { $userauthcode = $_POST['usercode']; if(empty($userauthcode)){ - $error_message[] = "コードを入力してください。"; + $error_message[] = "コードを入力してください。(AUTHCODE_INPUT_PLEASE)"; }else{ $discrepancy = 2; @@ -190,8 +191,9 @@ if( !empty($_POST['btn_submit']) ) { $url = '/settings'; $userchk = 'none'; // 通知用SQL作成 - $stmt = $pdo->prepare("INSERT INTO notification (touserid, msg, url, datetime, userchk, title) VALUES (:touserid, :msg, :url, :datetime, :userchk, :title)"); + $stmt = $pdo->prepare("INSERT INTO notification (fromuserid, touserid, msg, url, datetime, userchk, title) VALUES (:fromuserid, :touserid, :msg, :url, :datetime, :userchk, :title)"); + $stmt->bindParam(':fromuserid', htmlentities("uwuzu-fromsys"), PDO::PARAM_STR); $stmt->bindParam(':touserid', htmlentities($touserid), PDO::PARAM_STR); $stmt->bindParam(':msg', htmlentities($msg), PDO::PARAM_STR); $stmt->bindParam(':url', htmlentities($url), PDO::PARAM_STR); @@ -268,11 +270,11 @@ if( !empty($_POST['btn_submit']) ) { exit; }else { - $error_message[] = '二段階認証が出来ませんでした。再度お試しください。'; + $error_message[] = '二段階認証が出来ませんでした。再度お試しください。(AUTHCODE_CHECK_DAME)'; } } }else{ - $error_message[] = 'データの取得が出来ませんでした。再度お試しください。'; + $error_message[] = 'データの取得が出来ませんでした。再度お試しください。(AUTHCODE_GET_ACCOUNT_NOT_FOUND)'; } } @@ -286,8 +288,8 @@ $pdo = null; - - + + @@ -304,7 +306,7 @@ $pdo = null; diff --git a/bookmark/bookmark.php b/bookmark/bookmark.php new file mode 100644 index 0000000..6443157 --- /dev/null +++ b/bookmark/bookmark.php @@ -0,0 +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(); + } + + // データベース接続の設定 + $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); + + // Bookmark情報を取得 + $stmt = $pdo->prepare("SELECT bookmark FROM account WHERE userid = :userid"); + $stmt->bindValue(':userid', $userId, PDO::PARAM_STR); + $stmt->execute(); + $post = $stmt->fetch(PDO::FETCH_ASSOC); + + if ($post) { + $bookmarkList = explode(',', $post['bookmark']); + $index = array_search($postUniqid, $bookmarkList); + + if ($index === false) { + // ユーザーIDを追加 + $bookmarkList[] = $postUniqid; + } else { + // ユーザーIDを削除 + array_splice($bookmarkList, $index, 1); + } + + // 新しいいいね情報を更新 + $newbookmark = implode(',', $bookmarkList); + $updateQuery = $pdo->prepare("UPDATE account SET bookmark = :bookmark WHERE userid = :userid"); + $updateQuery->bindValue(':bookmark', $newbookmark, PDO::PARAM_STR); + $updateQuery->bindValue(':userid', $userId, PDO::PARAM_STR); + $res = $updateQuery->execute(); + + if ($res) { + echo json_encode(['success' => true, 'newbookmark' => 'success']); + exit; + } else { + echo json_encode(['success' => false, 'error' => 'いいねの更新に失敗しました。']); + exit; + } + + + } else { + echo json_encode(['success' => false, 'error' => 'アカウントが見つかりません。']); + exit; + } + } catch(PDOException $e) { + echo json_encode(['success' => false, 'error' => 'データベースエラー:' . $e->getMessage()]); + exit; + } + } + } else { + echo json_encode(['success' => false, 'error' => '必要なパラメータが提供されていません。']); + exit; + } +?> diff --git a/bookmark/index.php b/bookmark/index.php new file mode 100644 index 0000000..c6d6ecc --- /dev/null +++ b/bookmark/index.php @@ -0,0 +1,617 @@ + PDO::ERRMODE_EXCEPTION, + PDO::MYSQL_ATTR_MULTI_STATEMENTS => false + ); + $pdo = new PDO('mysql:charset=UTF8;dbname='.DB_NAME.';host='.DB_HOST , DB_USER, DB_PASS, $option); + +} catch(PDOException $e) { + + // 接続エラーのときエラー内容を取得する + $error_message[] = $e->getMessage(); +} + +if(isset($_SESSION['admin_login']) && $_SESSION['admin_login'] == true) { + + $passQuery = $pdo->prepare("SELECT username,userid,loginid,follow,admin,role,sacinfo,blocklist FROM account WHERE userid = :userid"); + $passQuery->bindValue(':userid', htmlentities($_SESSION['userid'])); + $passQuery->execute(); + $res = $passQuery->fetch(); + if(empty($res["userid"])){ + header("Location: ../login.php"); + exit; + }elseif($_SESSION['loginid'] === $res["loginid"] && $_SESSION['userid'] == $res["userid"]){ + // セッションに値をセット + $userid = htmlentities($res['userid']); // セッションに格納されている値をそのままセット + $username = htmlentities($res['username']); // セッションに格納されている値をそのままセット + $loginid = htmlentities($res["loginid"]); + $role = htmlentities($res["role"]); + $sacinfo = htmlentities($res["sacinfo"]); + $myblocklist = htmlentities($res["blocklist"]); + $myfollowlist = htmlentities($res["follow"]); + $_SESSION['admin_login'] = true; + $_SESSION['userid'] = $userid; + $_SESSION['username'] = $username; + $_SESSION['loginid'] = $res["loginid"]; + setcookie('userid', $userid, [ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + 'secure' => true, + 'httponly' => true, + ]); + setcookie('username', $username,[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + 'secure' => true, + 'httponly' => true, + ]); + setcookie('loginid', $res["loginid"],[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + 'secure' => true, + 'httponly' => true, + ]); + setcookie('admin_login', true,[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + 'secure' => true, + 'httponly' => true, + ]); + }else{ + header("Location: ../login.php"); + exit; + } + + +} elseif (isset($_COOKIE['admin_login']) && $_COOKIE['admin_login'] == true) { + + $passQuery = $pdo->prepare("SELECT username,userid,loginid,follow,admin,role,sacinfo,blocklist FROM account WHERE userid = :userid"); + $passQuery->bindValue(':userid', htmlentities($_COOKIE['userid'])); + $passQuery->execute(); + $res = $passQuery->fetch(); + if(empty($res["userid"])){ + header("Location: ../login.php"); + exit; + }elseif($_COOKIE['loginid'] === $res["loginid"] && $_COOKIE['userid'] == $res["userid"]){ + // セッションに値をセット + $userid = htmlentities($res['userid']); // クッキーから取得した値をセット + $username = htmlentities($res['username']); // クッキーから取得した値をセット + $loginid = htmlentities($res["loginid"]); + $role = htmlentities($res["role"]); + $sacinfo = htmlentities($res["sacinfo"]); + $myblocklist = htmlentities($res["blocklist"]); + $myfollowlist = htmlentities($res["follow"]); + $_SESSION['admin_login'] = true; + $_SESSION['userid'] = $userid; + $_SESSION['username'] = $username; + $_SESSION['loginid'] = $res["loginid"]; + setcookie('userid', $userid,[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + 'secure' => true, + 'httponly' => true, + ]); + setcookie('username', $username,[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + 'secure' => true, + 'httponly' => true, + ]); + setcookie('loginid', $res["loginid"],[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + 'secure' => true, + 'httponly' => true, + ]); + setcookie('admin_login', true,[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + 'secure' => true, + 'httponly' => true, + ]); + }else{ + header("Location: ../login.php"); + exit; + } + + +} else { + // ログインが許可されていない場合、ログインページにリダイレクト + header("Location: ../login.php"); + exit; +} +if(empty($userid)){ + header("Location: ../login.php"); + exit; +} +if(empty($username)){ + header("Location: ../login.php"); + exit; +} +$notiQuery = $pdo->prepare("SELECT COUNT(*) as notification_count FROM notification WHERE touserid = :userid AND userchk = 'none'"); +$notiQuery->bindValue(':userid', $userid); +$notiQuery->execute(); +$notiData = $notiQuery->fetch(PDO::FETCH_ASSOC); + +$notificationcount = $notiData['notification_count']; + +require('../logout/logout.php'); + +if( !empty($_POST['delete_all_bookmark']) ) { + $updateQuery = $pdo->prepare("UPDATE account SET bookmark = :bookmark WHERE userid = :userid"); + $updateQuery->bindValue(':bookmark', '', PDO::PARAM_STR); + $updateQuery->bindValue(':userid', $userid, PDO::PARAM_STR); + $res = $updateQuery->execute(); + if ($res) { + $url = (empty($_SERVER['HTTPS']) ? 'http://' : 'https://') . $_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME'];; + header("Location:".$url.""); + exit; + } else { + $error_message[] = "BOOKMARK_NOT_DELETED"; + } +} + +// データベースの接続を閉じる +$pdo = null; + +?> + + + + + + + + + + + +ブックマーク - <?php echo htmlspecialchars($serversettings["serverinfo"]["server_name"], ENT_QUOTES, 'UTF-8');?> + + + + + +
+ + + + + +
+

ブックマーク

+
+
+
+
+
+ + +
+
+ + + + + + + + + + + + + +
+ + + + + + + + + + \ No newline at end of file diff --git a/check.php b/check.php index 91a74b5..cf5bb63 100644 --- a/check.php +++ b/check.php @@ -147,8 +147,9 @@ if( !empty($_POST['btn_submit']) ) { $url = '/settings'; $userchk = 'none'; // 通知用SQL作成 - $stmt = $pdo->prepare("INSERT INTO notification (touserid, msg, url, datetime, userchk, title) VALUES (:touserid, :msg, :url, :datetime, :userchk, :title)"); + $stmt = $pdo->prepare("INSERT INTO notification (fromuserid, touserid, msg, url, datetime, userchk, title) VALUES (:fromuserid, :touserid, :msg, :url, :datetime, :userchk, :title)"); + $stmt->bindParam(':fromuserid', htmlentities("uwuzu-fromsys"), PDO::PARAM_STR); $stmt->bindParam(':touserid', htmlentities($touserid), PDO::PARAM_STR); $stmt->bindParam(':msg', htmlentities($msg), PDO::PARAM_STR); $stmt->bindParam(':url', htmlentities($url), PDO::PARAM_STR); @@ -241,6 +242,31 @@ if( !empty($_POST['btn_submit2']) ) { +// プロフィールの絵文字対応 +function replaceProfileEmojiImages($postText) { + // プロフィール名で絵文字名(:emoji:)を検出して画像に置き換える + $emojiPattern = '/:(\w+):/'; + $postTextWithImages = preg_replace_callback($emojiPattern, function($matches) { + $emojiName = $matches[1]; + //絵文字path取得 + $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, + )); + $emoji_Query = $dbh->prepare("SELECT emojifile, emojiname FROM emoji WHERE emojiname = :emojiname"); + $emoji_Query->bindValue(':emojiname', $emojiName); + $emoji_Query->execute(); + $emoji_row = $emoji_Query->fetch(); + if(empty($emoji_row["emojifile"])){ + $emoji_path = "img/sysimage/errorimage/emoji_404.png"; + }else{ + $emoji_path = $emoji_row["emojifile"]; + } + return ":$emojiName:"; + }, $postText); + return $postTextWithImages; +} // データベースの接続を閉じる $pdo = null; @@ -250,8 +276,8 @@ $pdo = null; - - + + @@ -268,14 +294,14 @@ $pdo = null;

確認

-

あなたは ですか?

+

あなたは ですか?

へようこそ!

- -
- "> -
+ + + +
+ "> +
+ + +
+ +
+ "> +
+
+
+ + "> +
+
+
+
+ +
+
-
-
- -
-
- + +

rowCount() > 0) { @@ -151,14 +151,14 @@ if( !empty($_POST['btn_submit']) ) { } } else{ - $error_message[] = 'IDまたはパスワードが違います'; + $error_message[] = 'IDまたはパスワードが違います(PASS_AND_ID_CHIGAUYANKE)'; } }else{ - $error_message[] = 'IDまたはパスワードが違います'; + $error_message[] = 'IDまたはパスワードが違います(PASS_AND_ID_CHIGAUYANKE)'; } } else { - $error_message[] = 'IDまたはパスワードが違います'; + $error_message[] = 'IDまたはパスワードが違います(PASS_AND_ID_CHIGAUYANKE)'; } } @@ -190,8 +190,8 @@ $pdo = null; "/> - - + + @@ -208,7 +208,7 @@ $pdo = null;

diff --git a/logout/index.php b/logout/index.php index cd0d291..ad8a584 100644 --- a/logout/index.php +++ b/logout/index.php @@ -33,8 +33,8 @@ $_SESSION = null; - - + + @@ -47,9 +47,15 @@ $_SESSION = null;
- + + + + +

ログアウト完了

diff --git a/new.php b/new.php index 988a803..63a63ab 100644 --- a/new.php +++ b/new.php @@ -15,6 +15,9 @@ function createUniqId(){ } require('db.php'); +//関数呼び出し +//- EXIF +require('function/function.php'); $serversettings_file = "server/serversettings.ini"; $serversettings = parse_ini_file($serversettings_file, true); @@ -91,39 +94,6 @@ if(isset($_SESSION['admin_login']) && $_SESSION['admin_login'] === true && isset } } -function rotate($image, $exif) -{ - $orientation = $exif['Orientation'] ?? 1; - - switch ($orientation) { - case 1: //no rotate - break; - case 2: //FLIP_HORIZONTAL - imageflip($image, IMG_FLIP_HORIZONTAL); - break; - case 3: //ROTATE 180 - $image = imagerotate($image, 180, 0); - break; - case 4: //FLIP_VERTICAL - imageflip($image, IMG_FLIP_VERTICAL); - break; - case 5: //ROTATE 270 FLIP_HORIZONTAL - $image = imagerotate($image, 270, 0); - imageflip($image, IMG_FLIP_HORIZONTAL); - break; - case 6: //ROTATE 90 - $image = imagerotate($image, 270, 0); - break; - case 7: //ROTATE 90 FLIP_HORIZONTAL - $image = imagerotate($image, 90, 0); - imageflip($image, IMG_FLIP_HORIZONTAL); - break; - case 8: //ROTATE 270 - $image = imagerotate($image, 90, 0); - break; - } - return $image; -} if( !empty($_POST['btn_submit']) ) { @@ -144,15 +114,6 @@ if( !empty($_POST['btn_submit']) ) { $invitationcode = $_POST['invitationcode']; } - //cookieに保存 - setcookie("username",$username,time()+60*60*24*14); - setcookie("userid",$userid,time()+60*60*24*14); - - setcookie("password",$password,time()+60*60*24*14); - setcookie("mailadds",$mailadds,time()+60*60*24*14); - - setcookie("profile",$profile,time()+60*60*24*14); - //----------------[icon image]------------------------------- if (empty($_FILES['image']['name'])) { $localFilePathhead = 'img/deficon/icon.png'; @@ -197,17 +158,7 @@ if( !empty($_POST['btn_submit']) ) { $result = move_uploaded_file($uploadedFile['tmp_name'], $uploadedPath); // EXIF削除 - if($extension == "jpg" || $extension == "jpeg"){ - $gd = imagecreatefromjpeg($uploadedPath); - $w = imagesx($gd); - $h = imagesy($gd); - $gd_out = imagecreatetruecolor($w,$h); - imagecopyresampled($gd_out, $gd, 0,0,0,0, $w,$h,$w,$h); - $exif = exif_read_data($uploadedPath); - $gd_out = rotate($gd_out, $exif); - imagejpeg($gd_out, $uploadedPath); - imagedestroy($gd_out); - } + delete_exif($extension, $uploadedPath); if ($result) { $iconName = $uploadedPath; // 保存されたファイルのパスを使用 @@ -273,14 +224,14 @@ if( !empty($_POST['btn_submit']) ) { // 招待コードの入力チェック if( empty($invitationcode) ) { - $error_message[] = '招待コードを入力してください。'; + $error_message[] = '招待コードを入力してください。(INVITATION_CODE_INPUT_PLEASE)'; } else { if($result > 0){ if($result["used"] === "true"){ - $error_message[] = 'この招待コード('.$invitationcode.')は既に使用されています。'; + $error_message[] = 'この招待コード('.$invitationcode.')は既に使用されています。(INVITATION_CODE_SHIYOUZUMI)'; } }else{ - $error_message[] = 'この招待コード('.$invitationcode.')は使えません。'; + $error_message[] = 'この招待コード('.$invitationcode.')は使えません。(INVITATION_CODE_DEAD)'; } } @@ -296,37 +247,37 @@ if( !empty($_POST['btn_submit']) ) { // ユーザーネームの入力チェック if( empty($username) ) { - $error_message[] = '表示名を入力してください。'; + $error_message[] = '表示名を入力してください。(USERNAME_INPUT_PLEASE)'; } else { // 文字数を確認 if( 50 < mb_strlen($username, 'UTF-8') ) { - $error_message[] = 'ユーザーネームは50文字以内で入力してください。'; + $error_message[] = 'ユーザーネームは50文字以内で入力してください。(USERNAME_OVER_MAX_COUNT)'; } } // IDの入力チェック if( empty($userid) ) { - $error_message[] = 'ユーザーIDを入力してください。'; + $error_message[] = 'ユーザーIDを入力してください。(USERID_INPUT_PLEASE)'; } else { // 文字数を確認 if( 20 < mb_strlen($userid, 'UTF-8') ) { - $error_message[] = 'IDは20文字以内で入力してください。'; + $error_message[] = 'IDは20文字以内で入力してください。(USERID_OVER_MAX_COUNT)'; } if(in_array($userid, $banuserid) === true ){ - $error_message[] = 'そのIDは登録禁止になっています。'; + $error_message[] = 'そのIDは登録禁止になっています。(USERID_CONTAINS_PROHIBITED)'; } if($result > 0){ - $error_message[] = 'このID('.$userid.')は既に使用されています。他のIDを作成してください。'; //このE-mailは既に使用されています。 + $error_message[] = 'このID('.$userid.')は既に使用されています。他のIDを作成してください。(USERID_SHIYOUZUMI)'; //このE-mailは既に使用されています。 } } // パスワードの入力チェック if( empty($password) ) { - $error_message[] = 'パスワードを入力してください。'; + $error_message[] = 'パスワードを入力してください。(PASSWORD_INPUT_PLEASE)'; } else { $weakPasswords = array( @@ -396,27 +347,21 @@ if( !empty($_POST['btn_submit']) ) { return in_array($passwords, $weakPasswords); } - // テスト用のパスワード(実際にはユーザー入力などから取得することになります。 - if (isWeakPassword($password)) { - $error_message[] = "パスワードが弱いです。セキュリティ上変更してください。"; - } else { - + $error_message[] = "パスワードが弱いです。セキュリティ上変更してください。(PASSWORD_ZEIJAKU)"; } - if ($chkpass == $password ){ - - }else{ - $error_message[] = '確認用パスワードが違います。'; + if (!($chkpass == $password)){ + $error_message[] = '確認用パスワードが違います。(PASSWORD_CHIGAUYANKE)'; } if( 4 > mb_strlen($password, 'UTF-8') ) { - $error_message[] = 'パスワードは4文字以上である必要があります。'; + $error_message[] = 'パスワードは4文字以上である必要があります。(PASSWORD_TODOITENAI_MIN_COUNT)'; } // 文字数を確認 if( 100 < mb_strlen($password, 'UTF-8') ) { - $error_message[] = 'パスワードは100文字以内で入力してください。'; + $error_message[] = 'パスワードは100文字以内で入力してください。(PASSWORD_OVER_MAX_COUNT)'; } } @@ -459,7 +404,7 @@ if( !empty($_POST['btn_submit']) ) { // コミット $res = $pdo->commit(); - if($onlyuser === "true"){ + if(htmlspecialchars($serversettings["serverinfo"]["server_invitation"], ENT_QUOTES, 'UTF-8') === "true"){ $pdo->beginTransaction(); $stmt = $pdo->prepare("UPDATE invitation SET used = :used, datetime = :datetime WHERE code = :code;"); @@ -492,7 +437,7 @@ if( !empty($_POST['btn_submit']) ) { // すべての出力を終了 exit; } else { - $error_message[] = '登録に失敗しました。'; + $error_message[] = '登録に失敗しました。(REGISTERED_DAME)'; } // プリペアドステートメントを削除 @@ -520,8 +465,8 @@ $pdo = null; "/> - - + + @@ -540,7 +485,7 @@ $pdo = null;
diff --git a/nextpage/bookmark.php b/nextpage/bookmark.php new file mode 100644 index 0000000..860fa25 --- /dev/null +++ b/nextpage/bookmark.php @@ -0,0 +1,179 @@ + 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 (isset($_GET['userid']) && isset($_GET['account_id'])) { + $userid = htmlentities($_GET['userid']); + $loginid = htmlentities($_GET['account_id']); + + // データベース接続の設定 + $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(!(empty($result2["loginid"]))){ + if($result2["loginid"] === $loginid){ + $userid = htmlentities($_GET['userid']); + + $aduserinfoQuery = $pdo->prepare("SELECT username,userid,loginid,admin,role,sacinfo,blocklist,bookmark FROM account WHERE userid = :userid"); + $aduserinfoQuery->bindValue(':userid', htmlentities($userid)); + $aduserinfoQuery->execute(); + $res = $aduserinfoQuery->fetch(); + $myblocklist = htmlentities($res["blocklist"]); + $mybookmark = htmlentities($res["bookmark"]); + + $itemsPerPage = 15; // 1ページあたりのユーズ数 + $pageNumber = htmlentities(isset($_GET['page'])) ? htmlentities(intval($_GET['page'])) : 1; + $offset = ($pageNumber - 1) * $itemsPerPage; + + $messages = array(); + + 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, + )); + + // フォローしているユーザーIDを取得し、カンマで区切る + $bookmarkQuery = $dbh->prepare("SELECT bookmark FROM account WHERE userid = :userid"); + $bookmarkQuery->bindValue(':userid', $userid); + $bookmarkQuery->execute(); + $bookmarkData = $bookmarkQuery->fetch(); + $bookmark = $bookmarkData['bookmark']; + $bookmarkList = explode(',', $bookmark); + + // フォローしているユーザーの投稿を取得し、日時順に並び替える + $messages = array(); // 初期化 + + foreach ($bookmarkList as $bookmarkUniqId) { + $sql = "SELECT ueuse.* + FROM ueuse + LEFT JOIN account ON ueuse.account = account.userid + WHERE uniqid = :bookmarkUniqId AND account.role != 'ice' + ORDER BY ueuse.datetime DESC + LIMIT :offset, :itemsPerPage"; + + $stmt = $pdo->prepare($sql); + $stmt->bindValue(':bookmarkUniqId', $bookmarkUniqId, PDO::PARAM_STR); + $stmt->bindValue(':offset', $offset, PDO::PARAM_INT); + $stmt->bindValue(':itemsPerPage', $itemsPerPage, PDO::PARAM_INT); + $stmt->execute(); + + while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) { + $messages[] = $row; + } + } + $messages = array_reverse($messages); + // ユーザー情報を取得して、$messages内のusernameをuserDataのusernameに置き換える + foreach ($messages as &$message) { + $userQuery = $pdo->prepare("SELECT username, userid, profile, role, iconname, headname, sacinfo FROM account WHERE userid = :userid"); + $userQuery->bindValue(':userid', $message["account"]); + $userQuery->execute(); + $userData = $userQuery->fetch(); + + if ($userData) { + $message['iconname'] = $userData['iconname']; + $message['headname'] = $userData['headname']; + $message['username'] = $userData['username']; + $message['sacinfo'] = $userData['sacinfo']; + $message['role'] = $userData['role']; + } + + $rpQuery = $pdo->prepare("SELECT COUNT(*) as reply_count FROM ueuse WHERE rpuniqid = :rpuniqid"); + $rpQuery->bindValue(':rpuniqid', $message['uniqid']); + $rpQuery->execute(); + $rpData = $rpQuery->fetch(PDO::FETCH_ASSOC); + + if ($rpData){ + $message['reply_count'] = $rpData['reply_count']; + } + } + //adsystem------------------ + + $message['ads'] = "false"; + + $today = date("Y-m-d H:i:s"); + + $adsQuery = $pdo->prepare("SELECT * FROM ads WHERE start_date < :today AND limit_date > :today ORDER BY rand()"); + $adsQuery->bindValue(':today', $today); + $adsQuery->execute(); + $adsresult = $adsQuery->fetch(); + if(!(empty($adsresult))){ + $message['ads'] = "true"; + $message['ads_url'] = $adsresult["url"]; + $message['ads_img_url'] = $adsresult["image_url"]; + $message['ads_memo'] = $adsresult["memo"]; + } + //-------------------------- + + if(!empty($messages)){ + foreach ($messages as $value) { + if (false === strpos($myblocklist, ','.htmlentities($value['account'], ENT_QUOTES, 'UTF-8'))) { + if(!($value["role"] === "ice")){ + $value["bookmark"] = $mybookmark; + + $fav = $value['favorite']; // コンマで区切られたユーザーIDを含む変数 + + // コンマで区切って配列に分割し、要素数を数える + $favIds = explode(',', $fav); + $value["favcnt"] = count($favIds)-1; + + $messageDisplay = new MessageDisplay($value, $userid); // $userid をコンストラクタに渡す + $messageDisplay->display(); + } + } + } + if($message['ads'] === "true"){ + echo '
'; + } + }else{ + echo '

ユーズがありません

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

取得に失敗しました。

'; + } + }else{ + echo '

取得に失敗しました。

'; + } +}else{ +echo '

取得に失敗しました。

'; +} +?> diff --git a/nextpage/ftlpage.php b/nextpage/ftlpage.php index 7d1de7f..34aa298 100644 --- a/nextpage/ftlpage.php +++ b/nextpage/ftlpage.php @@ -47,11 +47,12 @@ if (isset($_GET['userid']) && isset($_GET['account_id'])) { if($result2["loginid"] === $loginid){ $userid = htmlentities($_GET['userid']); - $aduserinfoQuery = $pdo->prepare("SELECT username,userid,loginid,admin,role,sacinfo,blocklist FROM account WHERE userid = :userid"); + $aduserinfoQuery = $pdo->prepare("SELECT username,userid,loginid,admin,role,sacinfo,blocklist,bookmark FROM account WHERE userid = :userid"); $aduserinfoQuery->bindValue(':userid', htmlentities($userid)); $aduserinfoQuery->execute(); $res = $aduserinfoQuery->fetch(); $myblocklist = htmlentities($res["blocklist"]); + $mybookmark = htmlentities($res["bookmark"]); $itemsPerPage = 15; // 1ページあたりのユーズ数 $pageNumber = htmlentities(isset($_GET['page'])) ? htmlentities(intval($_GET['page'])) : 1; @@ -79,11 +80,19 @@ if (isset($_GET['userid']) && isset($_GET['account_id'])) { $messages = array(); // 初期化 foreach ($followList as $followUserId) { - $sql = "SELECT * FROM ueuse WHERE rpuniqid = '' AND account = :follow_account ORDER BY datetime DESC LIMIT $offset, $itemsPerPage"; + $sql = "SELECT ueuse.* + FROM ueuse + LEFT JOIN account ON ueuse.account = account.userid + WHERE ueuse.rpuniqid = '' AND account.role != 'ice' AND ueuse.account = :follow_account + ORDER BY ueuse.datetime DESC + LIMIT :offset, :itemsPerPage"; - $stmt = $dbh->prepare($sql); + $stmt = $pdo->prepare($sql); + $stmt->bindValue(':offset', $offset, PDO::PARAM_INT); + $stmt->bindValue(':itemsPerPage', $itemsPerPage, PDO::PARAM_INT); $stmt->bindValue(':follow_account', $followUserId, PDO::PARAM_STR); $stmt->execute(); + $message_array = $stmt; while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) { $messages[] = $row; @@ -138,6 +147,8 @@ if (isset($_GET['userid']) && isset($_GET['account_id'])) { foreach ($messages as $value) { if (false === strpos($myblocklist, ','.htmlentities($value['account'], ENT_QUOTES, 'UTF-8'))) { if(!($value["role"] === "ice")){ + $value["bookmark"] = $mybookmark; + $fav = $value['favorite']; // コンマで区切られたユーザーIDを含む変数 // コンマで区切って配列に分割し、要素数を数える diff --git a/nextpage/newueuse_chk.php b/nextpage/newueuse_chk.php new file mode 100644 index 0000000..ebc30ea --- /dev/null +++ b/nextpage/newueuse_chk.php @@ -0,0 +1,92 @@ + 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 (isset($_POST['userid']) && isset($_POST['account_id'])) { + $userid = htmlentities($_POST['userid']); + $loginid = htmlentities($_POST['account_id']); + + // データベース接続の設定 + $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(!(empty($result2["loginid"]))){ + if($result2["loginid"] === $loginid){ + $loading_dt = htmlentities($_POST['loading_dt']); + + $messages = array(); + + if (!empty($pdo)) { + + $sql = "SELECT * FROM ueuse WHERE rpuniqid = '' ORDER BY datetime DESC LIMIT 1"; + $message_array = $pdo->query($sql); + + while ($row = $message_array->fetch(PDO::FETCH_ASSOC)) { + + $messages[] = $row; + } + + if(!empty($messages)){ + foreach ($messages as $value) { + $now_time = strtotime($loading_dt); + $loadtime = strtotime($value["datetime"]); + $time_sa = $loadtime - $now_time; + if($time_sa > 0){ + echo json_encode(['success' => true, 'info' => 'ueuse_true']); + exit; + }else{ + echo json_encode(['success' => false, 'info' => 'ueuse_none']); + exit; + } + } + }else{ + echo json_encode(['success' => false, 'info' => 'ueuse_none']); + exit; + } + + $pdo = null; + + } + }else{ + echo json_encode(['success' => false, 'info' => 'not_access1']); + exit; + } + }else{ + echo json_encode(['success' => false, 'info' => 'not_access2']); + exit; + } +}else{ + echo json_encode(['success' => false, 'info' => 'not_access3']); + exit; +} +?> diff --git a/nextpage/nextpage.php b/nextpage/nextpage.php index 8d96ab8..a971efd 100644 --- a/nextpage/nextpage.php +++ b/nextpage/nextpage.php @@ -45,11 +45,12 @@ if (isset($_GET['userid']) && isset($_GET['account_id'])) { if(!(empty($result2["loginid"]))){ if($result2["loginid"] === $loginid){ - $aduserinfoQuery = $pdo->prepare("SELECT username,userid,loginid,admin,role,sacinfo,blocklist FROM account WHERE userid = :userid"); + $aduserinfoQuery = $pdo->prepare("SELECT username,userid,loginid,admin,role,sacinfo,blocklist,bookmark FROM account WHERE userid = :userid"); $aduserinfoQuery->bindValue(':userid', htmlentities($userid)); $aduserinfoQuery->execute(); $res = $aduserinfoQuery->fetch(); $myblocklist = htmlentities($res["blocklist"]); + $mybookmark = htmlentities($res["bookmark"]); $itemsPerPage = 15; // 1ページあたりのユーズ数 $pageNumber = htmlentities(isset($_GET['page'])) ? htmlentities(intval($_GET['page'])) : 1; @@ -59,8 +60,18 @@ if (isset($_GET['userid']) && isset($_GET['account_id'])) { if (!empty($pdo)) { - $sql = "SELECT * FROM ueuse WHERE rpuniqid = '' ORDER BY datetime DESC LIMIT $offset, $itemsPerPage"; - $message_array = $pdo->query($sql); + $sql = "SELECT ueuse.* + FROM ueuse + LEFT JOIN account ON ueuse.account = account.userid + WHERE ueuse.rpuniqid = '' AND account.role != 'ice' + ORDER BY ueuse.datetime DESC + LIMIT :offset, :itemsPerPage"; + + $stmt = $pdo->prepare($sql); + $stmt->bindValue(':offset', $offset, PDO::PARAM_INT); + $stmt->bindValue(':itemsPerPage', $itemsPerPage, PDO::PARAM_INT); + $stmt->execute(); + $message_array = $stmt; while ($row = $message_array->fetch(PDO::FETCH_ASSOC)) { @@ -118,6 +129,8 @@ if (isset($_GET['userid']) && isset($_GET['account_id'])) { // コンマで区切って配列に分割し、要素数を数える $favIds = explode(',', $fav); $value["favcnt"] = count($favIds)-1; + + $value["bookmark"] = $mybookmark; $messageDisplay = new MessageDisplay($value, $userid); // $userid をコンストラクタに渡す $messageDisplay->display(); diff --git a/nextpage/notification.php b/nextpage/notification.php index f329bd4..85a6877 100644 --- a/nextpage/notification.php +++ b/nextpage/notification.php @@ -9,6 +9,9 @@ function createUniqId() { return base_convert($hashCreateTime, 10, 36); } +$serversettings_file = "../server/serversettings.ini"; +$serversettings = parse_ini_file($serversettings_file, true); + require('../db.php'); require('notificationview.php'); @@ -59,7 +62,7 @@ if (isset($_GET['userid']) && isset($_GET['account_id'])) { PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => true, )); - $messageQuery = $dbh->prepare("SELECT title,msg,url,datetime,userchk FROM notification WHERE touserid = :userid ORDER BY datetime DESC LIMIT $offset, $itemsPerPage"); + $messageQuery = $dbh->prepare("SELECT fromuserid,title,msg,url,datetime,userchk FROM notification WHERE touserid = :userid ORDER BY datetime DESC LIMIT $offset, $itemsPerPage"); $messageQuery->bindValue(':userid', $userid); $messageQuery->execute(); $message_array = $messageQuery->fetchAll(); @@ -77,6 +80,17 @@ if (isset($_GET['userid']) && isset($_GET['account_id'])) { if (!empty($message_array)) { foreach ($message_array as $value) { + $value["servericon"] = htmlspecialchars($serversettings["serverinfo"]["server_icon"], ENT_QUOTES, 'UTF-8'); + if(!(empty($value['fromuserid']))){ + if(!($value['fromuserid'] == "uwuzu-fromsys")){ + $userQuery = $dbh->prepare("SELECT username,iconname FROM account WHERE userid = :userid"); + $userQuery->bindValue(':userid', $value['fromuserid']); + $userQuery->execute(); + $user_array = $userQuery->fetch(); + $value['fromusericon'] = "../".$user_array["iconname"]; + $value['fromusername'] = $user_array["username"]; + } + } $messageDisplay = new MessageDisplay($value); // userid を渡さない $messageDisplay->display(); } diff --git a/nextpage/notificationview.php b/nextpage/notificationview.php index 1d6d2bb..a54852f 100644 --- a/nextpage/notificationview.php +++ b/nextpage/notificationview.php @@ -1,4 +1,42 @@ $1', $markdownText);//ぶるぶる + + $markdownText = preg_replace('/(^|[^`])`([^`\n]+)`($|[^`])/m', '$1$2$3', $markdownText);//Inline Code + + $markdownText = preg_replace('/\*\*\*(.*?)\*\*\*/', '$1', $markdownText);//太字&斜体の全部のせセット + $markdownText = preg_replace('/\_\_\_(.*?)\_\_\_/', '$1', $markdownText);//太字&斜体の全部のせセット + + $markdownText = preg_replace('/\*\*(.*?)\*\*/', '$1', $markdownText);//太字 + $markdownText = preg_replace('/\_\_(.*?)\_\_/', '$1', $markdownText);//太字 + + $markdownText = preg_replace('/\*(.*?)\*/', '$1', $markdownText);//斜体 + $markdownText = preg_replace('/\_(.*?)\_/', '$1', $markdownText);//斜体 + + $markdownText = preg_replace('/\~\~(.*?)\~\~/m', '$1', $markdownText);//打ち消し線 + + $markdownText = preg_replace('/>>> (.*)/m', '$1', $markdownText);//>>> 引用 + + $markdownText = preg_replace('/\|\|(.*)\|\|/m', '$1', $markdownText);//黒塗り + + // タイトル(#、##、###)をHTMLのhタグに変換 + $markdownText = preg_replace('/^# (.+)/m', '

$1

', $markdownText); + $markdownText = preg_replace('/^## (.+)/m', '

$1

', $markdownText); + $markdownText = preg_replace('/^### (.+)/m', '

$1

', $markdownText); + + // 箇条書き(-)をHTMLのul/liタグに変換 + $markdownText = preg_replace('/^- (.+)/m', '

・ $1

', $markdownText); + + // 空行の前に何もない行をHTMLのpタグに変換 + $markdownText = preg_replace('/(^\s*)(?!\s)(.*)/m', '$1

$2

', $markdownText); + + return $markdownText; +} //Profile function replaceProfileEmojiImages($postText) { // プロフィール名で絵文字名(:emoji:)を検出して画像に置き換える @@ -88,7 +126,7 @@ class MessageDisplay { public function display() { if($this->value['userchk'] === "none"){ - echo '
'; + echo '
'; }else{ echo '
'; } @@ -106,8 +144,28 @@ class MessageDisplay { echo '
'; // 投稿内のHTMLコードを表示する部分 + if(!(empty($this->value['fromuserid']))){ + echo '
'; + echo '
'; + if(($this->value['fromuserid'] == "uwuzu-fromsys")){ + if(!(empty($this->value["servericon"]))){ + echo ' '; + }else{ + echo ' '; + } + }else{ + echo ' '; + } + echo '
'; + if(($this->value['fromuserid'] == "uwuzu-fromsys")){ + echo ' '; + }else{ + echo ' '; + } + echo '
'; + } echo '

' . replaceEmojisWithImages($this->value['title']) . '

'; - echo '

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

'; + echo '

' . processMarkdownAndWrapEmptyLines(replaceEmojisWithImages(nl2br($this->value['msg']))) . '

'; echo ' 詳細をみる'; echo '
'; diff --git a/nextpage/searchpage.php b/nextpage/searchpage.php index c9e1f6d..8540984 100644 --- a/nextpage/searchpage.php +++ b/nextpage/searchpage.php @@ -53,6 +53,12 @@ if (isset($_GET['userid']) && isset($_GET['account_id'])) { if (!empty($pdo)) { if (!empty($keyword)) { + $aduserinfoQuery = $pdo->prepare("SELECT username,userid,loginid,admin,role,sacinfo,blocklist,bookmark FROM account WHERE userid = :userid"); + $aduserinfoQuery->bindValue(':userid', htmlentities($userid)); + $aduserinfoQuery->execute(); + $res = $aduserinfoQuery->fetch(); + $myblocklist = htmlentities($res["blocklist"]); + $mybookmark = htmlentities($res["bookmark"]); $dbh = new PDO('mysql:charset=utf8mb4;dbname='.DB_NAME.';host='.DB_HOST, DB_USER, DB_PASS, array( PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, @@ -133,6 +139,7 @@ if (isset($_GET['userid']) && isset($_GET['account_id'])) { } if(!empty($messages)){ foreach ($messages as $value) { + $value["bookmark"] = $mybookmark; $fav = $value['favorite']; // コンマで区切られたユーザーIDを含む変数 diff --git a/nextpage/ueusepage.php b/nextpage/ueusepage.php index 23b49ca..a90dcb4 100644 --- a/nextpage/ueusepage.php +++ b/nextpage/ueusepage.php @@ -45,11 +45,12 @@ if (isset($_GET['userid']) && isset($_GET['account_id'])) { if($result2["loginid"] === $loginid){ $userid = htmlentities($_GET['userid']); - $aduserinfoQuery = $pdo->prepare("SELECT username,userid,loginid,admin,role,sacinfo,blocklist FROM account WHERE userid = :userid"); + $aduserinfoQuery = $pdo->prepare("SELECT username,userid,loginid,admin,role,sacinfo,blocklist,bookmark FROM account WHERE userid = :userid"); $aduserinfoQuery->bindValue(':userid', htmlentities($userid)); $aduserinfoQuery->execute(); $res = $aduserinfoQuery->fetch(); $myblocklist = htmlentities($res["blocklist"]); + $mybookmark = htmlentities($res["bookmark"]); $ueuseid = htmlentities(isset($_GET['id'])) ? htmlentities($_GET['id']) : ''; @@ -70,9 +71,11 @@ if (isset($_GET['userid']) && isset($_GET['account_id'])) { )); // 投稿内容の取得(新しい順に取得) - $messageQuery = $dbh->prepare("SELECT * FROM ueuse WHERE uniqid = :ueuseid OR rpuniqid = :rpueuseid ORDER BY datetime ASC LIMIT $offset, $itemsPerPage"); - $messageQuery->bindValue(':ueuseid', $ueuseid); - $messageQuery->bindValue(':rpueuseid', $ueuseid); + $messageQuery = $dbh->prepare("SELECT * FROM ueuse WHERE uniqid = :ueuseid OR rpuniqid = :rpueuseid ORDER BY datetime ASC LIMIT :offset, :itemsPerPage"); + $messageQuery->bindValue(':ueuseid', $ueuseid, PDO::PARAM_STR); + $messageQuery->bindValue(':rpueuseid', $ueuseid, PDO::PARAM_STR); + $messageQuery->bindValue(':offset', $offset, PDO::PARAM_INT); + $messageQuery->bindValue(':itemsPerPage', $itemsPerPage, PDO::PARAM_INT); $messageQuery->execute(); $message_array = $messageQuery->fetchAll(); @@ -84,8 +87,10 @@ if (isset($_GET['userid']) && isset($_GET['account_id'])) { foreach ($message_array as $row) { if(!(empty($row["rpuniqid"]))){ if(!($row["rpuniqid"] == $ueuseid)){ - $up_messageQuery = $pdo->prepare("SELECT * FROM ueuse WHERE uniqid = :ueuseid ORDER BY datetime ASC LIMIT $offset, $itemsPerPage"); + $up_messageQuery = $pdo->prepare("SELECT * FROM ueuse WHERE uniqid = :ueuseid ORDER BY datetime ASC LIMIT :offset, :itemsPerPage"); $up_messageQuery->bindValue(':ueuseid', $row["rpuniqid"]); + $up_messageQuery->bindValue(':offset', $offset, PDO::PARAM_INT); + $up_messageQuery->bindValue(':itemsPerPage', $itemsPerPage, PDO::PARAM_INT); $up_messageQuery->execute(); $up_messageData = $up_messageQuery->fetchAll(); if(!(empty($up_messageData))){ @@ -145,6 +150,8 @@ if (isset($_GET['userid']) && isset($_GET['account_id'])) { if(!empty($messages)){ foreach ($messages as $value) { if (false === strpos($myblocklist, ','.htmlentities($value['account'], ENT_QUOTES, 'UTF-8'))) { + $value["bookmark"] = $mybookmark; + $fav = $value['favorite']; // コンマで区切られたユーザーIDを含む変数 // コンマで区切って配列に分割し、要素数を数える diff --git a/nextpage/userlikepage.php b/nextpage/userlikepage.php index 2b2009a..54d6712 100644 --- a/nextpage/userlikepage.php +++ b/nextpage/userlikepage.php @@ -47,11 +47,12 @@ if (isset($_GET['userid']) && isset($_GET['account_id'])) { $uwuzuid = htmlentities(isset($_GET['id'])) ? htmlentities($_GET['id']) : ''; $userid = htmlentities($_GET['userid']); - $aduserinfoQuery = $pdo->prepare("SELECT username,userid,loginid,admin,role,sacinfo,blocklist FROM account WHERE userid = :userid"); + $aduserinfoQuery = $pdo->prepare("SELECT username,userid,loginid,admin,role,sacinfo,blocklist,bookmark FROM account WHERE userid = :userid"); $aduserinfoQuery->bindValue(':userid', htmlentities($userid)); $aduserinfoQuery->execute(); $res = $aduserinfoQuery->fetch(); $myblocklist = htmlentities($res["blocklist"]); + $mybookmark = htmlentities($res["bookmark"]); $itemsPerPage = 15; // 1ページあたりのユーズ数 $pageNumber = htmlentities(isset($_GET['page'])) ? htmlentities(intval($_GET['page'])) : 1; @@ -71,12 +72,20 @@ if (isset($_GET['userid']) && isset($_GET['account_id'])) { $userQuery->bindValue(':userid', $uwuzuid); $userQuery->execute(); $userData = $userQuery->fetch(); - - $messageQuery = $dbh->prepare("SELECT * FROM ueuse WHERE favorite LIKE :userid ORDER BY datetime DESC LIMIT $offset, $itemsPerPage"); - $messageQuery->bindValue(':userid', '%,' . $uwuzuid . '%', PDO::PARAM_STR); - - $messageQuery->execute(); - $message_array = $messageQuery->fetchAll(); + + $sql = "SELECT ueuse.* + FROM ueuse + LEFT JOIN account ON ueuse.account = account.userid + WHERE ueuse.favorite LIKE :userid AND account.role != 'ice' + ORDER BY ueuse.datetime DESC + LIMIT :offset, :itemsPerPage"; + + $stmt = $pdo->prepare($sql); + $stmt->bindValue(':userid', '%,' . $uwuzuid . '%', PDO::PARAM_STR); + $stmt->bindValue(':offset', $offset, PDO::PARAM_INT); + $stmt->bindValue(':itemsPerPage', $itemsPerPage, PDO::PARAM_INT); + $stmt->execute(); + $message_array = $stmt->fetchAll(); $messages = array(); foreach ($message_array as $row) { @@ -127,6 +136,7 @@ if (isset($_GET['userid']) && isset($_GET['account_id'])) { if(!empty($messages)){ foreach ($messages as $value) { if (false === strpos($myblocklist, ','.htmlentities($value['account'], ENT_QUOTES, 'UTF-8'))) { + $value["bookmark"] = $mybookmark; $fav = $value['favorite']; // コンマで区切られたユーザーIDを含む変数 diff --git a/nextpage/usermediapage.php b/nextpage/usermediapage.php index 1af0a75..78ce842 100644 --- a/nextpage/usermediapage.php +++ b/nextpage/usermediapage.php @@ -47,11 +47,12 @@ if (isset($_GET['userid']) && isset($_GET['account_id'])) { $uwuzuid = htmlentities(isset($_GET['id'])) ? htmlentities($_GET['id']) : ''; $userid = htmlentities($_GET['userid']); - $aduserinfoQuery = $pdo->prepare("SELECT username,userid,loginid,admin,role,sacinfo,blocklist FROM account WHERE userid = :userid"); + $aduserinfoQuery = $pdo->prepare("SELECT username,userid,loginid,admin,role,sacinfo,blocklist,bookmark FROM account WHERE userid = :userid"); $aduserinfoQuery->bindValue(':userid', htmlentities($userid)); $aduserinfoQuery->execute(); $res = $aduserinfoQuery->fetch(); $myblocklist = htmlentities($res["blocklist"]); + $mybookmark = htmlentities($res["bookmark"]); $itemsPerPage = 15; // 1ページあたりのユーズ数 $pageNumber = htmlentities(isset($_GET['page'])) ? htmlentities(intval($_GET['page'])) : 1; @@ -78,9 +79,11 @@ if (isset($_GET['userid']) && isset($_GET['account_id'])) { (photo3 IS NOT NULL AND photo3 != '' AND photo3 != 'none') OR (photo4 IS NOT NULL AND photo4 != '' AND photo4 != 'none') OR (video1 IS NOT NULL AND video1 != '' AND video1 != 'none') - ) ORDER BY datetime DESC LIMIT $offset, $itemsPerPage"); + ) ORDER BY datetime DESC LIMIT :offset, :itemsPerPage"); $messageQuery->bindValue(':userid', $uwuzuid); + $messageQuery->bindValue(':offset', $offset, PDO::PARAM_INT); + $messageQuery->bindValue(':itemsPerPage', $itemsPerPage, PDO::PARAM_INT); $messageQuery->execute(); $message_array = $messageQuery->fetchAll(); @@ -134,6 +137,8 @@ if (isset($_GET['userid']) && isset($_GET['account_id'])) { if(!empty($messages)){ foreach ($messages as $value) { if (false === strpos($myblocklist, ','.htmlentities($value['account'], ENT_QUOTES, 'UTF-8'))) { + $value["bookmark"] = $mybookmark; + $fav = $value['favorite']; // コンマで区切られたユーザーIDを含む変数 // コンマで区切って配列に分割し、要素数を数える diff --git a/nextpage/userpage.php b/nextpage/userpage.php index 597ae0b..9ca263e 100644 --- a/nextpage/userpage.php +++ b/nextpage/userpage.php @@ -47,11 +47,12 @@ if (isset($_GET['userid']) && isset($_GET['account_id'])) { $uwuzuid = htmlentities(isset($_GET['id'])) ? htmlentities($_GET['id']) : ''; $userid = htmlentities($_GET['userid']); - $aduserinfoQuery = $pdo->prepare("SELECT username,userid,loginid,admin,role,sacinfo,blocklist FROM account WHERE userid = :userid"); + $aduserinfoQuery = $pdo->prepare("SELECT username,userid,loginid,admin,role,sacinfo,blocklist,bookmark FROM account WHERE userid = :userid"); $aduserinfoQuery->bindValue(':userid', htmlentities($userid)); $aduserinfoQuery->execute(); $res = $aduserinfoQuery->fetch(); $myblocklist = htmlentities($res["blocklist"]); + $mybookmark = htmlentities($res["bookmark"]); $itemsPerPage = 15; // 1ページあたりのユーズ数 $pageNumber = htmlentities(isset($_GET['page'])) ? htmlentities(intval($_GET['page'])) : 1; @@ -72,8 +73,10 @@ if (isset($_GET['userid']) && isset($_GET['account_id'])) { $userQuery->execute(); $userData = $userQuery->fetch(); - $messageQuery = $dbh->prepare("SELECT * FROM ueuse WHERE account = :userid AND rpuniqid = ''ORDER BY datetime DESC LIMIT $offset, $itemsPerPage"); + $messageQuery = $dbh->prepare("SELECT * FROM ueuse WHERE account = :userid AND rpuniqid = ''ORDER BY datetime DESC LIMIT :offset, :itemsPerPage"); $messageQuery->bindValue(':userid', $uwuzuid); + $messageQuery->bindValue(':offset', $offset, PDO::PARAM_INT); + $messageQuery->bindValue(':itemsPerPage', $itemsPerPage, PDO::PARAM_INT); $messageQuery->execute(); $message_array = $messageQuery->fetchAll(); @@ -127,6 +130,8 @@ if (isset($_GET['userid']) && isset($_GET['account_id'])) { if(!empty($messages)){ foreach ($messages as $value) { if (false === strpos($myblocklist, ','.htmlentities($value['account'], ENT_QUOTES, 'UTF-8'))) { + $value["bookmark"] = $mybookmark; + $fav = $value['favorite']; // コンマで区切られたユーザーIDを含む変数 // コンマで区切って配列に分割し、要素数を数える diff --git a/nextpage/view.php b/nextpage/view.php index c9f2148..9136037 100644 --- a/nextpage/view.php +++ b/nextpage/view.php @@ -2,7 +2,33 @@ $1

', $markdownText);//←ここ!!!!!!!!!!!!!! + //\___________________[注意]__________________\ + // \____ここの順番を変えるとうまく動かなくなります___\ + // \______Markdownうまく動くところを探すべし______\ + + $markdownText = preg_replace('/\[\[buruburu (.+)\]\]/m', '$1', $markdownText);//ぶるぶる + + $markdownText = preg_replace('/(^|[^`])`([^`\n]+)`($|[^`])/m', '$1$2$3', $markdownText);//Inline Code + + /*$markdownText = preg_replace_callback('/^\[\[time (\d+)\]\]/m', function($matches) { + $timestamp = $matches[1]; + return '' . date("Y/m/d H:i:s", $timestamp) . ''; + }, $markdownText);*/ + + $markdownText = preg_replace('/\*\*\*(.*?)\*\*\*/', '$1', $markdownText);//太字&斜体の全部のせセット + $markdownText = preg_replace('/\_\_\_(.*?)\_\_\_/', '$1', $markdownText);//太字&斜体の全部のせセット + + $markdownText = preg_replace('/\*\*(.*?)\*\*/', '$1', $markdownText);//太字 + $markdownText = preg_replace('/\_\_(.*?)\_\_/', '$1', $markdownText);//太字 + + $markdownText = preg_replace('/\*(.*?)\*/', '$1', $markdownText);//斜体 + $markdownText = preg_replace('/\_(.*?)\_/', '$1', $markdownText);//斜体 + + $markdownText = preg_replace('/\~\~(.*?)\~\~/m', '$1', $markdownText);//打ち消し線 + + $markdownText = preg_replace('/>>> (.*)/m', '$1', $markdownText);//>>> 引用 + + $markdownText = preg_replace('/\|\|(.*)\|\|/m', '$1', $markdownText);//黒塗り // タイトル(#、##、###)をHTMLのhタグに変換 $markdownText = preg_replace('/^# (.+)/m', '

$1

', $markdownText); @@ -11,7 +37,7 @@ function processMarkdownAndWrapEmptyLines($markdownText){ // 箇条書き(-)をHTMLのul/liタグに変換 $markdownText = preg_replace('/^- (.+)/m', '

・ $1

', $markdownText); - + // 空行の前に何もない行をHTMLのpタグに変換 $markdownText = preg_replace('/(^\s*)(?!\s)(.*)/m', '$1

$2

', $markdownText); @@ -147,7 +173,7 @@ function YouTube_and_nicovideo_Links($postText) { foreach ($matches[0] as $url) { // ドメイン部分を抽出 $parsedUrl = parse_url($url); - if($parsedUrl['host'] == "youtube.com" || $parsedUrl['host'] == "youtu.be" || $parsedUrl['host'] == "www.youtube.com"){ + if($parsedUrl['host'] == "youtube.com" || $parsedUrl['host'] == "youtu.be" || $parsedUrl['host'] == "www.youtube.com" || $parsedUrl['host'] == "m.youtube.com"){ if (isset($parsedUrl['query'])) { if(false !== strpos($parsedUrl['query'], 'v=')) { @@ -237,12 +263,15 @@ class MessageDisplay { echo '
'; $datetime = strtotime(htmlentities($this->value['datetime'])); $today = strtotime(date("Y-m-d")); + $tomorrow = date('Y-m-d', strtotime('+1 day')); if (date("md", $datetime) == "0101") { if (date("Y", $datetime) == date("Y")) { echo "元日 " . date("H:i", $datetime); } else { echo date("Y年m月d日 H:i", $datetime); } + } elseif ($datetime >= $tomorrow) { + echo date("Y年m月d日 H:i", $datetime) . " (未来)"; } elseif ($datetime >= $today) { echo "今日 " . date("H:i", $datetime); } elseif (date("Y", $datetime) == date("Y")) { @@ -325,6 +354,14 @@ class MessageDisplay { } echo ''.htmlentities($this->value['reply_count']).''; echo ''; + + $bookmarkList = explode(',', $this->value['bookmark']); + if (in_array($this->value['uniqid'], $bookmarkList)) { + echo ''; + }else{ + echo ''; + } + if($this->value['account'] === $this->userid){ if(!($this->value['role'] === "ice")){ if($this->value['abi'] === "none"){ diff --git a/nodeinfo/2.1/index.php b/nodeinfo/2.1/index.php index f0d190d..2a8c259 100644 --- a/nodeinfo/2.1/index.php +++ b/nodeinfo/2.1/index.php @@ -1,27 +1,35 @@ array( "name" => "uwuzu", "version" => "".str_replace("\r", '', $uwuzuinfo[1])."", + "homepage" => "https://www.uwuzu.com/", "repository" => "https://github.com/Daichimarukana/uwuzu", ), "protocols" => [ @@ -85,11 +94,11 @@ if(htmlspecialchars($serversettings["serverinfo"]["server_activitypub"], ENT_QUO "localPosts" => $count2, ], "metadata" => [ - "nodeName" => file_get_contents($servernamefile), + "nodeName" => $servernamefile, "nodeDescription" => $serverinfo, "maintainer" => array( - "name" => file_get_contents($adminfile), - "email" => file_get_contents($contactfile), + "name" => $adminfile, + "email" => $contactfile, ), "langs" => array( "ja", diff --git a/notice/addnotice.php b/notice/addnotice.php index c6c93b6..4a3c355 100644 --- a/notice/addnotice.php +++ b/notice/addnotice.php @@ -213,21 +213,36 @@ if( !empty($pdo) ) { if( !empty($_POST['btn_submit']) ) { + //$level = $_POST['notice_level']; $title = $_POST['title']; $note = $_POST['note']; // IDの入力チェック if( empty($title) ) { - $error_message[] = 'タイトルを入力してください!'; + $error_message[] = 'タイトルを入力してください!(INPUT_PLEASE)'; } else { // 文字数を確認 if( 1024 < mb_strlen($title, 'UTF-8') ) { - $error_message[] = 'タイトルは1024文字以内で入力してください。'; + $error_message[] = 'タイトルは1024文字以内で入力してください。(INPUT_OVER_MAX_COUNT)'; } } + /*if( empty($level) ) { + $error_message[] = '緊急度レベルを指定してください!(INPUT_PLEASE)'; + } else { + if($level == 'normal'){ + $notice_level = 'normal'; + }elseif($level == 'warning'){ + $notice_level = 'warning'; + }elseif($level == 'danger'){ + $notice_level = 'danger'; + }else{ + $error_message[] = '緊急度レベルが正しく指定されていません!(ERROR)'; + } + }*/ + if( empty($error_message) ) { // 書き込み日時を取得 @@ -243,6 +258,7 @@ if( !empty($_POST['btn_submit']) ) { // 値をセット + //$stmt->bindParam( ':level', $notice_level, PDO::PARAM_STR); $stmt->bindParam( ':title', $title, PDO::PARAM_STR); $stmt->bindParam( ':note', $note, PDO::PARAM_STR); @@ -267,7 +283,7 @@ if( !empty($_POST['btn_submit']) ) { header("Location:".$url.""); exit; } else { - $error_message[] = '配信に失敗しました。'; + $error_message[] = '配信に失敗しました。(REGISTERED_DAME)'; } // プリペアドステートメントを削除 @@ -290,9 +306,9 @@ $pdo = null; - - - + + + @@ -319,7 +335,21 @@ $pdo = null;

タイトルと内容を入力して配信してください。
削除と編集はここからは出来ません。
DB管理画面から行ってください。

- + +

タイトル

diff --git a/notice/index.php b/notice/index.php new file mode 100644 index 0000000..493f70b --- /dev/null +++ b/notice/index.php @@ -0,0 +1,290 @@ + PDO::ERRMODE_EXCEPTION, + PDO::MYSQL_ATTR_MULTI_STATEMENTS => false + ); + $pdo = new PDO('mysql:charset=UTF8;dbname='.DB_NAME.';host='.DB_HOST , DB_USER, DB_PASS, $option); + +} catch(PDOException $e) { + + // 接続エラーのときエラー内容を取得する + $error_message[] = $e->getMessage(); +} + + +if(isset($_SESSION['admin_login']) && $_SESSION['admin_login'] == true) { + + $passQuery = $pdo->prepare("SELECT username,userid,loginid,follow,admin,role,sacinfo,blocklist FROM account WHERE userid = :userid"); + $passQuery->bindValue(':userid', htmlentities($_SESSION['userid'])); + $passQuery->execute(); + $res = $passQuery->fetch(); + if(empty($res["userid"])){ + header("Location: ../login.php"); + exit; + }elseif($_SESSION['loginid'] === $res["loginid"] && $_SESSION['userid'] == $res["userid"]){ + // セッションに値をセット + $userid = htmlentities($res['userid']); // セッションに格納されている値をそのままセット + $username = htmlentities($res['username']); // セッションに格納されている値をそのままセット + $loginid = htmlentities($res["loginid"]); + $role = htmlentities($res["role"]); + $sacinfo = htmlentities($res["sacinfo"]); + $myblocklist = htmlentities($res["blocklist"]); + $myfollowlist = htmlentities($res["follow"]); + $_SESSION['admin_login'] = true; + $_SESSION['userid'] = $userid; + $_SESSION['username'] = $username; + $_SESSION['loginid'] = $res["loginid"]; + setcookie('userid', $userid, [ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + 'secure' => true, + 'httponly' => true, + ]); + setcookie('username', $username,[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + 'secure' => true, + 'httponly' => true, + ]); + setcookie('loginid', $res["loginid"],[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + 'secure' => true, + 'httponly' => true, + ]); + setcookie('admin_login', true,[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + 'secure' => true, + 'httponly' => true, + ]); + }else{ + header("Location: ../login.php"); + exit; + } + + +} elseif (isset($_COOKIE['admin_login']) && $_COOKIE['admin_login'] == true) { + + $passQuery = $pdo->prepare("SELECT username,userid,loginid,follow,admin,role,sacinfo,blocklist FROM account WHERE userid = :userid"); + $passQuery->bindValue(':userid', htmlentities($_COOKIE['userid'])); + $passQuery->execute(); + $res = $passQuery->fetch(); + if(empty($res["userid"])){ + header("Location: ../login.php"); + exit; + }elseif($_COOKIE['loginid'] === $res["loginid"] && $_COOKIE['userid'] == $res["userid"]){ + // セッションに値をセット + $userid = htmlentities($res['userid']); // クッキーから取得した値をセット + $username = htmlentities($res['username']); // クッキーから取得した値をセット + $loginid = htmlentities($res["loginid"]); + $role = htmlentities($res["role"]); + $sacinfo = htmlentities($res["sacinfo"]); + $myblocklist = htmlentities($res["blocklist"]); + $myfollowlist = htmlentities($res["follow"]); + $_SESSION['admin_login'] = true; + $_SESSION['userid'] = $userid; + $_SESSION['username'] = $username; + $_SESSION['loginid'] = $res["loginid"]; + setcookie('userid', $userid,[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + 'secure' => true, + 'httponly' => true, + ]); + setcookie('username', $username,[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + 'secure' => true, + 'httponly' => true, + ]); + setcookie('loginid', $res["loginid"],[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + 'secure' => true, + 'httponly' => true, + ]); + setcookie('admin_login', true,[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + 'secure' => true, + 'httponly' => true, + ]); + }else{ + header("Location: ../login.php"); + exit; + } + + +} else { + // ログインが許可されていない場合、ログインページにリダイレクト + header("Location: ../login.php"); + exit; +} +if(empty($userid)){ + header("Location: ../login.php"); + exit; +} +if(empty($username)){ + header("Location: ../login.php"); + exit; +} +$notiQuery = $pdo->prepare("SELECT COUNT(*) as notification_count FROM notification WHERE touserid = :userid AND userchk = 'none'"); +$notiQuery->bindValue(':userid', $userid); +$notiQuery->execute(); +$notiData = $notiQuery->fetch(PDO::FETCH_ASSOC); + +$notificationcount = $notiData['notification_count']; + +//------------------通知-------------- +function replaceURLsWithLinks_forNotice($postText) { + $postText = str_replace(''', '\'', $postText); + + // URLを正規表現を使って検出 + $pattern = '/(https:\/\/[^\s<>\[\]\'"]+)/'; // 改良された正規表現 + preg_match_all($pattern, $postText, $matches); + + // 検出したURLごとに処理を行う + foreach ($matches[0] as $url) { + // ドメイン部分を抽出 + $parsedUrl = parse_url($url); + if (!isset($parsedUrl['path'])) { + $parsedUrl['path'] = ''; + } + if (!isset($parsedUrl['query'])) { + $parsedUrl['query'] = ''; + } + + $nochk_domain = $parsedUrl['host'].$parsedUrl['path'].$parsedUrl['query']; + + if(strlen($nochk_domain) > 47){ + $domain = mb_substr($nochk_domain, 0, 48, "UTF-8")."..."; + }else{ + $domain = $nochk_domain; + } + + // 不要な文字を削除してaタグを生成 + $urlWithoutSpaces = preg_replace('/\s+/', '', $url); + $link = "$domain"; + + // URLをドメインのみを表示するaタグで置き換え + $postText = preg_replace('/' . preg_quote($url, '/') . '/', $link, $postText); + } + + return $postText; +} + +$sql = "SELECT title, note, account, datetime FROM notice ORDER BY datetime DESC"; +$notice_array = $pdo->query($sql); + +while ($row = $notice_array->fetch(PDO::FETCH_ASSOC)) { + + $notices[] = $row; +} + +//------------------------------------------------------ + +require('../logout/logout.php'); + + +// データベースの接続を閉じる +$pdo = null; + +?> + + + + + + + + + + + +お知らせ - <?php echo htmlspecialchars($serversettings["serverinfo"]["server_name"], ENT_QUOTES, 'UTF-8');?> + + + + + +
+ +
    + +

    + +
+ + +
+
+

お知らせ

+
+ +
+ +
+
+
+
+

+
+

+

編集者 : @

+
+ +
+ +
+ +
+ + + + + + + \ No newline at end of file diff --git a/notification/index.php b/notification/index.php index a86a364..d7fbf07 100644 --- a/notification/index.php +++ b/notification/index.php @@ -187,9 +187,9 @@ $pdo = null; - - - + + + @@ -209,6 +209,10 @@ $pdo = null; +
+

通知

+
+
diff --git a/others/index.php b/others/index.php index 36a6fde..ba80e92 100644 --- a/others/index.php +++ b/others/index.php @@ -202,7 +202,7 @@ if( !empty($_POST['btn_submit']) ) { $chkuserid = htmlentities($_POST['chkuserid']); if( empty($chkuserid) ) { - $error_message[] = '確認用ユーザーIDを入力してください。'; + $error_message[] = '確認用ユーザーIDを入力してください。(USERID_CHECK_INPUT_PLEASE)'; } else { if($chkuserid === $userData["userid"]){ $userId = $userData["userid"]; // 削除対象のユーザーID @@ -348,14 +348,14 @@ if( !empty($_POST['btn_submit']) ) { header("Location:../index.php"); exit; } else { - $error_message[] = 'アカウント削除に失敗しました。'; + $error_message[] = 'アカウント削除に失敗しました。(ACCOUNT_DELETE_DAME)'; } // プリペアドステートメントを削除 $stmt = null; }else{ - $error_message[] = '確認用ユーザーIDが違います'; + $error_message[] = '確認用ユーザーIDが違います。(USERID_CHIGAUYANKE)'; } } @@ -402,7 +402,7 @@ if( !empty($_POST['session_submit']) ) { // すべての出力を終了 exit; } else { - $error_message[] = 'セッションの終了に失敗しました。'; + $error_message[] = 'セッションの終了に失敗しました。(END_OF_SESSION_DAME)'; } } @@ -439,7 +439,7 @@ if( !empty($_POST['token_submit']) ) { header('Location: ' . $url, true, 303); exit; } else { - $error_message[] = 'トークンの発行に失敗しました。'; + $error_message[] = 'トークンの発行に失敗しました。(CREATE_TOKEN_DAME)'; } } @@ -473,7 +473,7 @@ if( !empty($_POST['token_off_submit']) ) { header("Location:".$url.""); exit; } else { - $error_message[] = 'トークンの削除に失敗しました。'; + $error_message[] = 'トークンの削除に失敗しました。(TOKEN_DELETE_DAME)'; } } @@ -487,9 +487,9 @@ require('../logout/logout.php'); - - - + + + diff --git a/others/token.php b/others/token.php index 50c7531..24d2233 100644 --- a/others/token.php +++ b/others/token.php @@ -179,10 +179,10 @@ require('../logout/logout.php'); - + - - + + アクセストークン発行完了 - <?php echo htmlspecialchars($serversettings["serverinfo"]["server_name"], ENT_QUOTES, 'UTF-8');?> diff --git a/passrecovery/badrecovery.php b/passrecovery/badrecovery.php index 4249f1c..f727aa2 100644 --- a/passrecovery/badrecovery.php +++ b/passrecovery/badrecovery.php @@ -9,15 +9,15 @@ $serversettings = parse_ini_file($serversettings_file, true); - - + + 残念なお知らせ - <?php echo htmlspecialchars($serversettings["serverinfo"]["server_name"], ENT_QUOTES, 'UTF-8');?> - + diff --git a/passrecovery/donerecovery.php b/passrecovery/donerecovery.php index a780855..a34b03b 100644 --- a/passrecovery/donerecovery.php +++ b/passrecovery/donerecovery.php @@ -9,15 +9,15 @@ $serversettings = parse_ini_file($serversettings_file, true); - - + + パスワード変更完了 - <?php echo htmlspecialchars($serversettings["serverinfo"]["server_name"], ENT_QUOTES, 'UTF-8');?> - + diff --git a/passrecovery/index.php b/passrecovery/index.php index 3ac2dda..c8569c4 100644 --- a/passrecovery/index.php +++ b/passrecovery/index.php @@ -79,11 +79,11 @@ if( !empty($_POST['btn_submit']) ) { // ... (前略) // IDの入力チェック if( empty($userid) ) { - $error_message[] = 'ユーザーIDを入力してください。'; + $error_message[] = 'ユーザーIDを入力してください。(USERID_INPUT_PLEASE)'; } else { if( empty($mailadds) ) { - $error_message[] = 'メールアドレスを入力してください。'; + $error_message[] = 'メールアドレスを入力してください。(INPUT_PLEASE)'; } else { if($result->rowCount() > 0) { @@ -109,14 +109,14 @@ if( !empty($_POST['btn_submit']) ) { } } else{ - $error_message[] = 'IDまたはメールアドレスが違います'; + $error_message[] = 'IDまたはメールアドレスが違います(ID_OR_MAILADDS_CHIGAUYANKE)'; } }else{ - $error_message[] = 'IDまたはメールアドレスが違います'; + $error_message[] = 'IDまたはメールアドレスが違います(ID_OR_MAILADDS_CHIGAUYANKE)'; } } else { - $error_message[] = 'IDまたはメールアドレスが違います'; + $error_message[] = 'IDまたはメールアドレスが違います(ID_OR_MAILADDS_CHIGAUYANKE)'; } } @@ -136,15 +136,15 @@ $pdo = null; - - + + パスワードの復元 - <?php echo htmlspecialchars($serversettings["serverinfo"]["server_name"], ENT_QUOTES, 'UTF-8');?> - +
diff --git a/passrecovery/startrecovery.php b/passrecovery/startrecovery.php index 5d8d89f..54b5440 100644 --- a/passrecovery/startrecovery.php +++ b/passrecovery/startrecovery.php @@ -77,7 +77,7 @@ if( !empty($_POST['btn_submit']) ) { $password = $_POST['password']; if(empty($userauthcode)){ - $error_message[] = "コードを入力してください。"; + $error_message[] = "コードを入力してください。(AUTHCODE_INPUT_PLEASE)"; }else{ $discrepancy = 2; @@ -87,7 +87,7 @@ if( !empty($_POST['btn_submit']) ) { // パスワードの入力チェック if( empty($password) ) { - $error_message[] = 'パスワードを入力してください。'; + $error_message[] = 'パスワードを入力してください。(PASSWORD_INPUT_PLEASE)'; } else { $weakPasswords = array( @@ -160,18 +160,18 @@ if( !empty($_POST['btn_submit']) ) { // テスト用のパスワード(実際にはユーザー入力などから取得することになります。 if (isWeakPassword($password)) { - $error_message[] = "パスワードが弱いです。セキュリティ上変更してください。"; + $error_message[] = "パスワードが弱いです。セキュリティ上変更してください。(PASSWORD_ZEIJAKU)"; } else { } if( 4 > mb_strlen($password, 'UTF-8') ) { - $error_message[] = 'パスワードは4文字以上である必要があります。'; + $error_message[] = 'パスワードは4文字以上である必要があります。(PASSWORD_TODOITENAI_MIN_COUNT)'; } // 文字数を確認 if( 100 < mb_strlen($password, 'UTF-8') ) { - $error_message[] = 'パスワードは100文字以内で入力してください。'; + $error_message[] = 'パスワードは100文字以内で入力してください。(PASSWORD_OVER_MAX_COUNT)'; } } @@ -211,12 +211,12 @@ if( !empty($_POST['btn_submit']) ) { // すべての出力を終了 exit; } else { - $error_message[] = 'パスワードの更新に失敗しました。'; + $error_message[] = 'パスワードの更新に失敗しました。(REGISTERED_DAME)'; } } }else { - $error_message[] = '二段階認証が出来ませんでした。再度お試しください。'; + $error_message[] = '二段階認証が出来ませんでした。再度お試しください。(AUTHCODE_CHECK_DAME)'; } // プリペアドステートメントを削除 @@ -233,15 +233,15 @@ $pdo = null; - - + + ログイン - <?php echo htmlspecialchars($serversettings["serverinfo"]["server_name"], ENT_QUOTES, 'UTF-8');?> - +
diff --git a/require/botbox.php b/require/botbox.php index ebb0546..dba78a0 100644 --- a/require/botbox.php +++ b/require/botbox.php @@ -16,15 +16,19 @@ + + +

広告がありません

-
diff --git a/settings_admin/addemoji_admin.php b/settings_admin/addemoji_admin.php new file mode 100644 index 0000000..c0cb821 --- /dev/null +++ b/settings_admin/addemoji_admin.php @@ -0,0 +1,449 @@ + PDO::ERRMODE_EXCEPTION, + PDO::MYSQL_ATTR_MULTI_STATEMENTS => false + ); + $pdo = new PDO('mysql:charset=UTF8;dbname='.DB_NAME.';host='.DB_HOST , DB_USER, DB_PASS, $option); + +} catch(PDOException $e) { + + // 接続エラーのときエラー内容を取得する + $error_message[] = $e->getMessage(); +} + +if(isset($_SESSION['admin_login']) && $_SESSION['admin_login'] == true) { + + $passQuery = $pdo->prepare("SELECT username,userid,loginid,follow,admin,role,sacinfo,blocklist FROM account WHERE userid = :userid"); + $passQuery->bindValue(':userid', htmlentities($_SESSION['userid'])); + $passQuery->execute(); + $res = $passQuery->fetch(); + if(empty($res["userid"])){ + header("Location: ../login.php"); + exit; + }elseif($_SESSION['loginid'] === $res["loginid"] && $_SESSION['userid'] == $res["userid"]){ + // セッションに値をセット + $userid = htmlentities($res['userid']); // セッションに格納されている値をそのままセット + $username = htmlentities($res['username']); // セッションに格納されている値をそのままセット + $loginid = htmlentities($res["loginid"]); + $role = htmlentities($res["role"]); + $sacinfo = htmlentities($res["sacinfo"]); + $myblocklist = htmlentities($res["blocklist"]); + $myfollowlist = htmlentities($res["follow"]); + $_SESSION['admin_login'] = true; + $_SESSION['userid'] = $userid; + $_SESSION['username'] = $username; + $_SESSION['loginid'] = $res["loginid"]; + setcookie('userid', $userid, [ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + 'secure' => true, + 'httponly' => true, + ]); + setcookie('username', $username,[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + 'secure' => true, + 'httponly' => true, + ]); + setcookie('loginid', $res["loginid"],[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + 'secure' => true, + 'httponly' => true, + ]); + setcookie('admin_login', true,[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + 'secure' => true, + 'httponly' => true, + ]); + }else{ + header("Location: ../login.php"); + exit; + } + + +} elseif (isset($_COOKIE['admin_login']) && $_COOKIE['admin_login'] == true) { + + $passQuery = $pdo->prepare("SELECT username,userid,loginid,follow,admin,role,sacinfo,blocklist FROM account WHERE userid = :userid"); + $passQuery->bindValue(':userid', htmlentities($_COOKIE['userid'])); + $passQuery->execute(); + $res = $passQuery->fetch(); + if(empty($res["userid"])){ + header("Location: ../login.php"); + exit; + }elseif($_COOKIE['loginid'] === $res["loginid"] && $_COOKIE['userid'] == $res["userid"]){ + // セッションに値をセット + $userid = htmlentities($res['userid']); // クッキーから取得した値をセット + $username = htmlentities($res['username']); // クッキーから取得した値をセット + $loginid = htmlentities($res["loginid"]); + $role = htmlentities($res["role"]); + $sacinfo = htmlentities($res["sacinfo"]); + $myblocklist = htmlentities($res["blocklist"]); + $myfollowlist = htmlentities($res["follow"]); + $_SESSION['admin_login'] = true; + $_SESSION['userid'] = $userid; + $_SESSION['username'] = $username; + $_SESSION['loginid'] = $res["loginid"]; + setcookie('userid', $userid,[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + 'secure' => true, + 'httponly' => true, + ]); + setcookie('username', $username,[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + 'secure' => true, + 'httponly' => true, + ]); + setcookie('loginid', $res["loginid"],[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + 'secure' => true, + 'httponly' => true, + ]); + setcookie('admin_login', true,[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + 'secure' => true, + 'httponly' => true, + ]); + }else{ + header("Location: ../login.php"); + exit; + } + + +} else { + // ログインが許可されていない場合、ログインページにリダイレクト + header("Location: ../login.php"); + exit; +} +if(empty($userid)){ + header("Location: ../login.php"); + exit; +} +if(empty($username)){ + header("Location: ../login.php"); + exit; +} + +if(!($res["admin"] === "yes")){ + header("Location: ../login.php"); + exit; +} +$notiQuery = $pdo->prepare("SELECT COUNT(*) as notification_count FROM notification WHERE touserid = :userid AND userchk = 'none'"); +$notiQuery->bindValue(':userid', $userid); +$notiQuery->execute(); +$notiData = $notiQuery->fetch(PDO::FETCH_ASSOC); + +$notificationcount = $notiData['notification_count']; + +if( !empty($pdo) ) { + + // データベース接続の設定 + $dbh = new PDO('mysql:charset=UTF8;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, role FROM account WHERE userid = :userid"); + $userQuery->bindValue(':userid', $userid); + $userQuery->execute(); + $userData = $userQuery->fetch(); + + $role = $userData["role"]; + + $dbh = new PDO('mysql:charset=UTF8;dbname='.DB_NAME.';host='.DB_HOST , DB_USER, DB_PASS, $option); + + $rerole = $dbh->prepare("SELECT username, userid, password, mailadds, profile, iconname, headname, role, datetime FROM account WHERE userid = :userid"); + + $rerole->bindValue(':userid', $userid); + // SQL実行 + $rerole->execute(); + + $userdata = $rerole->fetch(); // ここでデータベースから取得した値を $role に代入する + + +} + +if( !empty($_POST['btn_submit']) ) { + $emojiname = $_POST['emojiname']; + $emojiinfo = $_POST['emojiinfo']; + + if (!empty($_FILES['image']['name'])) { + // アップロードされたファイル情報 + $uploadedFile = $_FILES['image']; + + // アップロードされたファイルの拡張子を取得 + $extension = pathinfo($uploadedFile['name'], PATHINFO_EXTENSION); + + // 新しいファイル名を生成(uniqid + 拡張子) + $newFilename = uniqid() . '.' . $extension; + + // 保存先のパスを生成 + $uploadedPath = 'emojiimage/' . $newFilename; + + // ファイルを移動 + $result = move_uploaded_file($uploadedFile['tmp_name'], '../'.$uploadedPath); + + // EXIF削除 + delete_exif($extension2, $uploadedPath2); + + if ($result) { + $emoji_path = $uploadedPath; // 保存されたファイルのパスを使用 + } else { + $errnum = $uploadedFile['error']; + if($errnum === 1){$errcode = "FILE_DEKASUGUI_PHP_INI_KAKUNIN";} + if($errnum === 2){$errcode = "FILE_DEKASUGUI_HTML_KAKUNIN";} + if($errnum === 3){$errcode = "FILE_SUKOSHIDAKE_UPLOAD";} + if($errnum === 4){$errcode = "FILE_UPLOAD_DEKINAKATTA";} + if($errnum === 6){$errcode = "TMP_FOLDER_NAI";} + if($errnum === 7){$errcode = "FILE_KAKIKOMI_SIPPAI";} + if($errnum === 8){$errcode = "PHPINFO()_KAKUNIN";} + $error_message[] = 'アップロード失敗!(2)エラーコード:' .$errcode.''; + } + }else{ + $error_message[] = '画像を選択してください'; + } + + + + $options = array( + // SQL実行失敗時に例外をスルー + PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, + // デフォルトフェッチモードを連想配列形式に設定 + PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC, + // バッファードクエリを使う(一度に結果セットを全て取得し、サーバー負荷を軽減) + // SELECTで得た結果に対してもrowCountメソッドを使えるようにする + PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => true, + ); + + $dbh = new PDO('mysql:charset=UTF8;dbname='.DB_NAME.';host='.DB_HOST , DB_USER, DB_PASS, $option); + + + $query = $dbh->prepare('SELECT * FROM emoji WHERE emojiname = :emojiname limit 1'); + + $query->execute(array(':emojiname' => $emojiname)); + + $result = $query->fetch(); + + // IDの入力チェック + if( empty($emojiname) ) { + $error_message[] = '絵文字IDを入力してください!(EMOJI_ID_INPUT_PLEASE)'; + } else { + + // 文字数を確認 + if( 20 < mb_strlen($emojiname, 'UTF-8') ) { + $error_message[] = 'IDは20文字以内で入力してください。(EMOJI_ID_OVER_MAX_COUNT)'; + } + + if($result > 0){ + $error_message[] = 'このID('.$emojiname.')は既に使用されています。他のIDを作成してください。(EMOJI_ID_SHIYOUZUMI)'; //このE-mailは既に使用されています。 + } + + } + + if( empty($error_message) ) { + + // 書き込み日時を取得 + $datetime = date("Y-m-d H:i:s"); + + // トランザクション開始 + $pdo->beginTransaction(); + + try { + + // SQL作成 + $stmt = $pdo->prepare("INSERT INTO emoji (emojifile, emojiname, emojiinfo, emojidate) VALUES ( :emojifile, :emojiname, :emojiinfo, :emojidate)"); + + $stmt->bindValue(':emojifile', $emoji_path, PDO::PARAM_STR); + + // 値をセット + $stmt->bindParam( ':emojiname', $emojiname, PDO::PARAM_STR); + $stmt->bindParam( ':emojiinfo', $emojiinfo, PDO::PARAM_STR); + + $stmt->bindParam( ':emojidate', $datetime, PDO::PARAM_STR); + + // SQLクエリの実行 + $res = $stmt->execute(); + + // コミット + $res = $pdo->commit(); + + } catch(Exception $e) { + + // エラーが発生した時はロールバック + $pdo->rollBack(); + } + + if( $res ) { + $url = (empty($_SERVER['HTTPS']) ? 'http://' : 'https://') . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; + header("Location:".$url.""); + exit; + } else { + $error_message[] = '登録に失敗しました。(REGISTERED_DAME)'; + } + + // プリペアドステートメントを削除 + $stmt = null; + + + } + +} + + +require('../logout/logout.php'); + + + +// データベースの接続を閉じる +$pdo = null; + +?> + + + + + + + + + + + +絵文字登録 - <?php echo htmlspecialchars($serversettings["serverinfo"]["server_name"], ENT_QUOTES, 'UTF-8');?> + + + + + +
+
+ + +
+ + +
    + +

    + +
+ + +
+ +

絵文字登録

+ +

絵文字登録です。

+ +
+ + +
+ + +
+

EmojiID

+ +
+ +
+

この絵文字について

+ +
+ +
+ + +
+ +
+ +
+
+
+ + + + + + + \ No newline at end of file diff --git a/settings_admin/codeadmin.php b/settings_admin/codeadmin.php index 92aa025..d0a64a7 100644 --- a/settings_admin/codeadmin.php +++ b/settings_admin/codeadmin.php @@ -262,7 +262,7 @@ if( !empty($_POST['code_btn_submit']) ) { header("Location:".$url.""); exit; } else { - $error_message[] = '発行に失敗しました。'; + $error_message[] = '発行に失敗しました。(REGISTERED_DAME)'; } // プリペアドステートメントを削除 @@ -274,10 +274,10 @@ require('../logout/logout.php'); - + - - + + diff --git a/settings_admin/customize_admin.php b/settings_admin/customize_admin.php index 4492180..e9478ae 100644 --- a/settings_admin/customize_admin.php +++ b/settings_admin/customize_admin.php @@ -261,10 +261,10 @@ require('../logout/logout.php'); - + - - + + diff --git a/settings_admin/maintenance_admin.php b/settings_admin/maintenance_admin.php index d7c292a..be57fc2 100644 --- a/settings_admin/maintenance_admin.php +++ b/settings_admin/maintenance_admin.php @@ -283,10 +283,10 @@ require('../logout/logout.php'); - + - - + + diff --git a/settings_admin/moderation_admin.php b/settings_admin/moderation_admin.php index 6527aa7..1570ffd 100644 --- a/settings_admin/moderation_admin.php +++ b/settings_admin/moderation_admin.php @@ -268,10 +268,10 @@ require('../logout/logout.php'); - + - - + + @@ -311,7 +311,7 @@ require('../logout/logout.php');

投稿の最大文字数

-
ここで設定した文字数までの投稿が可能です。
なお、データベースより最大文字数を設定している場合そちらが優先されて使用されます。
1文字から16777216文字の間で設定が可能です。
+
ここで設定した文字数までの投稿が可能です。
なお、データベースより最大文字数を設定している場合そちらが優先されて使用されます。
1文字から16777216文字の間で設定が可能です。
※uwuzu version 1.3.0以前にuwuzuを導入された方はuwuzuのDB内のtext型を全てmediumtext型にしてください。
diff --git a/settings_admin/overview_admin.php b/settings_admin/overview_admin.php index bf1a864..fd7b446 100644 --- a/settings_admin/overview_admin.php +++ b/settings_admin/overview_admin.php @@ -214,10 +214,10 @@ require('../logout/logout.php'); - + - - + + @@ -242,11 +242,24 @@ require('../logout/logout.php');

サーバー概要

- -
- "> -
+ + +
+ "> +
+ +
+ +
+ "> +
+ + "> + +
+ +

サーバー名


diff --git a/settings_admin/plugin_admin.php b/settings_admin/plugin_admin.php new file mode 100644 index 0000000..ec297e4 --- /dev/null +++ b/settings_admin/plugin_admin.php @@ -0,0 +1,363 @@ + PDO::ERRMODE_EXCEPTION, + PDO::MYSQL_ATTR_MULTI_STATEMENTS => false + ); + $pdo = new PDO('mysql:charset=UTF8;dbname='.DB_NAME.';host='.DB_HOST , DB_USER, DB_PASS, $option); + +} catch(PDOException $e) { + + // 接続エラーのときエラー内容を取得する + $error_message[] = $e->getMessage(); +} +if(isset($_SESSION['admin_login']) && $_SESSION['admin_login'] == true) { + + $passQuery = $pdo->prepare("SELECT username,userid,loginid,follow,admin,role,sacinfo,blocklist FROM account WHERE userid = :userid"); + $passQuery->bindValue(':userid', htmlentities($_SESSION['userid'])); + $passQuery->execute(); + $res = $passQuery->fetch(); + if(empty($res["userid"])){ + header("Location: ../login.php"); + exit; + }elseif($_SESSION['loginid'] === $res["loginid"] && $_SESSION['userid'] == $res["userid"]){ + // セッションに値をセット + $userid = htmlentities($res['userid']); // セッションに格納されている値をそのままセット + $username = htmlentities($res['username']); // セッションに格納されている値をそのままセット + $loginid = htmlentities($res["loginid"]); + $role = htmlentities($res["role"]); + $sacinfo = htmlentities($res["sacinfo"]); + $myblocklist = htmlentities($res["blocklist"]); + $myfollowlist = htmlentities($res["follow"]); + $_SESSION['admin_login'] = true; + $_SESSION['userid'] = $userid; + $_SESSION['username'] = $username; + $_SESSION['loginid'] = $res["loginid"]; + setcookie('userid', $userid, [ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + 'secure' => true, + 'httponly' => true, + ]); + setcookie('username', $username,[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + 'secure' => true, + 'httponly' => true, + ]); + setcookie('loginid', $res["loginid"],[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + 'secure' => true, + 'httponly' => true, + ]); + setcookie('admin_login', true,[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + 'secure' => true, + 'httponly' => true, + ]); + }else{ + header("Location: ../login.php"); + exit; + } + + +} elseif (isset($_COOKIE['admin_login']) && $_COOKIE['admin_login'] == true) { + + $passQuery = $pdo->prepare("SELECT username,userid,loginid,follow,admin,role,sacinfo,blocklist FROM account WHERE userid = :userid"); + $passQuery->bindValue(':userid', htmlentities($_COOKIE['userid'])); + $passQuery->execute(); + $res = $passQuery->fetch(); + if(empty($res["userid"])){ + header("Location: ../login.php"); + exit; + }elseif($_COOKIE['loginid'] === $res["loginid"] && $_COOKIE['userid'] == $res["userid"]){ + // セッションに値をセット + $userid = htmlentities($res['userid']); // クッキーから取得した値をセット + $username = htmlentities($res['username']); // クッキーから取得した値をセット + $loginid = htmlentities($res["loginid"]); + $role = htmlentities($res["role"]); + $sacinfo = htmlentities($res["sacinfo"]); + $myblocklist = htmlentities($res["blocklist"]); + $myfollowlist = htmlentities($res["follow"]); + $_SESSION['admin_login'] = true; + $_SESSION['userid'] = $userid; + $_SESSION['username'] = $username; + $_SESSION['loginid'] = $res["loginid"]; + setcookie('userid', $userid,[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + 'secure' => true, + 'httponly' => true, + ]); + setcookie('username', $username,[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + 'secure' => true, + 'httponly' => true, + ]); + setcookie('loginid', $res["loginid"],[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + 'secure' => true, + 'httponly' => true, + ]); + setcookie('admin_login', true,[ + 'expires' => time() + 60 * 60 * 24 * 14, + 'path' => '/', + 'samesite' => 'lax', + 'secure' => true, + 'httponly' => true, + ]); + }else{ + header("Location: ../login.php"); + exit; + } + + +} else { + // ログインが許可されていない場合、ログインページにリダイレクト + header("Location: ../login.php"); + exit; +} +if(empty($userid)){ + header("Location: ../login.php"); + exit; +} +if(empty($username)){ + header("Location: ../login.php"); + exit; +} + +if(!($res["admin"] === "yes")){ + header("Location: ../login.php"); + exit; +} +$notiQuery = $pdo->prepare("SELECT COUNT(*) as notification_count FROM notification WHERE touserid = :userid AND userchk = 'none'"); +$notiQuery->bindValue(':userid', $userid); +$notiQuery->execute(); +$notiData = $notiQuery->fetch(PDO::FETCH_ASSOC); + +$notificationcount = $notiData['notification_count']; + +if( !empty($_POST['btn_submit']) ) { + $N_MAIL_ONOFF = $_POST['mailchks_onoff']; + + $N_MAIL_ADDS = $_POST['N_MAIL_ADDS']; + $N_MAIL_HOST = $_POST['N_MAIL_HOST']; + $N_MAIL_PORT = $_POST['N_MAIL_PORT']; + $N_MAIL_USER = $_POST['N_MAIL_USER']; + $N_MAIL_PASS = $_POST['N_MAIL_PASS']; + + $N_MAIL_SSL_ = $_POST['ssl_tls_none']; + + $New_Mail_Settings = " + + "; + + //設定上書き + $file = fopen('plugin_settings/phpmailer_settings.php', 'w'); + $data = $New_Mail_Settings; + fputs($file, $data); + fclose($file); + + $url = (empty($_SERVER['HTTPS']) ? 'http://' : 'https://') . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; + header("Location:".$url.""); + exit; +} + +if( !empty($_POST['testmail_send_btn_submit']) ) { + $test_mail_adds = $_POST['test_sender_adds']; + + $mail_title = "Test email"; + $mail_text = "これはuwuzuのテストメールです。 問題なく受信できていますか?"; + + $error_message = send_html_mail($test_mail_adds,$mail_title,$mail_text,"../"); +} +require('../logout/logout.php'); +?> + + + + + + + + + + + +プラグイン - <?php echo htmlspecialchars($serversettings["serverinfo"]["server_name"], ENT_QUOTES, 'UTF-8');?> + + + + + +
+ + +
    + +

    + +
+ +
+ + +
+ +
+

プラグイン

+

PHPMailerなどとの連携が可能です。

+
+

自動メールプラグイン

+
PHPMailerと連携し、パスワードリセット時やログイン通知などを自動送信することができます。
SMTP送信のみ対応です。
pluginフォルダに解凍済みのPHPMailerのファイル一式が入っていることが必須要件になります。
plugin/PHPMailer/README.MDなど一式
+

自動メールプラグインのオンオフ

+
+ + + + + + + +
+
+

PHPMailer - メールサーバー設定

+
メールアドレス
+ +
ホスト名
+ +
ポート番号
+ +
ユーザー名
+ +
パスワード
+ + +
暗号化設定
+
+ > + + + > + + + > + +
+ + +
+
+ +
+ +
+
+

メールテスト送信

+ + +
+
+ + +
+
+
+ + + + + + + + \ No newline at end of file diff --git a/settings_admin/plugin_settings/phpmailer_sender.php b/settings_admin/plugin_settings/phpmailer_sender.php new file mode 100644 index 0000000..0cfffc8 --- /dev/null +++ b/settings_admin/plugin_settings/phpmailer_sender.php @@ -0,0 +1,105 @@ +ファイル名などをお間違いではありませんか?(PLUGIN_NOT_FOUND)"; + } + }else{ + $error_message[] = "メール送信プラグインは無効です。(PLUGIN_MUKOU)"; + } + + $serversettings = parse_ini_file("".$server_file_backslash."server/serversettings.ini", true); + + $domain = $_SERVER['HTTP_HOST']; + + $mail_adds = htmlentities($mailadds); + $mail_title = htmlentities($mailtitle); + $x_mailtext = htmlentities($mailtext); + $mail_text = str_replace( ' ', '
', $x_mailtext ); + + if(!(filter_var($mail_adds, FILTER_VALIDATE_EMAIL))){ + $error_message[] = 'メールアドレスが正しくありません...(MAILADDS_CHECK_DAME)'; + } + + if(empty($error_message)){ + if(htmlentities(MAIL_SSL_) == "NONE"){ + $Mail_SSL = false; + }elseif(htmlentities(MAIL_SSL_) == "SSL"){ + $Mail_SSL = "ssl"; + }elseif(htmlentities(MAIL_SSL_) == "TLS"){ + $Mail_SSL = "tls"; + } + $s_name = htmlspecialchars($serversettings['serverinfo']['server_name'], ENT_QUOTES, 'UTF-8'); + $now_date = date("Y-m-d H:i:s"); + $logo_path = htmlspecialchars($serversettings["serverinfo"]["server_logo_login"], ENT_QUOTES, 'UTF-8'); + if(empty($logo_path)){ + $logo_path = "https://".$domain."/img/uwuzulogo.svg"; + } + mb_language('uni'); + mb_internal_encoding('UTF-8'); + + $mail = new PHPMailer(true); + + $mail->CharSet = 'utf-8'; + + try { + // SMTPサーバの設定 + $mail->isSMTP(); // SMTPの使用宣言 + $mail->Host = htmlentities(MAIL_HOST); // SMTPサーバーを指定 + $mail->SMTPAuth = true; // SMTP authenticationを有効化 + $mail->Username = htmlentities(MAIL_USER); // SMTPサーバーのユーザ名 + $mail->Password = htmlentities(MAIL_PASS); // SMTPサーバーのパスワード + $mail->SMTPSecure = $Mail_SSL; // 暗号化を有効(tls or ssl)無効の場合はfalse + $mail->Port = (int)htmlentities(MAIL_PORT); // TCPポートを指定(tlsの場合は465や587) + + $mail->setFrom(htmlentities(MAIL_ADDS), htmlspecialchars($serversettings["serverinfo"]["server_name"], ENT_QUOTES, 'UTF-8')); // 送信者 + $mail->addAddress(htmlentities($mail_adds)); // 宛先 + $mail->addReplyTo(htmlspecialchars($serversettings["serverinfo"]["server_admin_mailadds"], ENT_QUOTES, 'UTF-8'), 'お問い合わせ'); // 返信先 + $mail->Sender = htmlspecialchars($serversettings["serverinfo"]["server_admin_mailadds"], ENT_QUOTES, 'UTF-8'); // Return-path + + // 送信内容設定 + $mail->isHTML(true); + $mail->Subject = $mail_title; + $mail->Body = << + + + + + +
+ +
+ + +
+

{$mail_title}

+

{$mail_text}

+ {$s_name} +

{$now_date}

+
+ + EOD; + + // 送信 + $mail->send(); + + } catch (Exception $e) { + // エラーの場合 + $error_message[] = "PHPMailer Error:
".$mail->ErrorInfo.""; + } + } + return $error_message; +} +?> \ No newline at end of file diff --git a/settings_admin/plugin_settings/phpmailer_settings.php b/settings_admin/plugin_settings/phpmailer_settings.php new file mode 100644 index 0000000..e1a4981 --- /dev/null +++ b/settings_admin/plugin_settings/phpmailer_settings.php @@ -0,0 +1,12 @@ + + + \ No newline at end of file diff --git a/settings_admin/role_admin.php b/settings_admin/role_admin.php index 8cfbccb..a2c794c 100644 --- a/settings_admin/role_admin.php +++ b/settings_admin/role_admin.php @@ -195,16 +195,16 @@ if( !empty($_POST['role_btn_submit']) ) { $result3 = $query->fetch(); if(empty($rolename)){ - $error_message[] = "ロール名が入力されていません。"; + $error_message[] = "ロール名が入力されていません。(INPUT_PLEASE)"; } if(empty($roleid)){ - $error_message[] = "ロールのidが入力されていません。"; + $error_message[] = "ロールのidが入力されていません。(ROLE_ID_INPUT_PLEASE)"; }elseif($result3 > 0){ - $error_message[] = 'このロールのid('.$roleid.')は既に使用されています。他のidを作成してください。'; + $error_message[] = 'このロールのid('.$roleid.')は既に使用されています。他のidを作成してください。(ROLE_ID_SHIYOUZUMI)'; } if(empty($rolecolor)){ - $error_message[] = "ロールの色が入力されていません。"; + $error_message[] = "ロールの色が入力されていません。(INPUT_PLEASE)"; } if (!empty($pdo)) { @@ -260,17 +260,26 @@ if( !empty($_POST['role_del']) ) { $deleteQuery->bindValue(':roleid', $role_id, PDO::PARAM_STR); $res = $deleteQuery->execute(); - try{ + // ロールを削除したい全てのアカウントを取得 + $query = $pdo->prepare("SELECT * FROM account WHERE role LIKE :pattern1 OR role LIKE :pattern2 OR role LIKE :pattern3"); + $query->bindValue(':pattern1', "%,$role_id,%", PDO::PARAM_STR); + $query->bindValue(':pattern2', "%,$role_id", PDO::PARAM_STR); + $query->bindValue(':pattern3', "$role_id,%", PDO::PARAM_STR); + $query->execute(); + $accounts = $query->fetchAll(); + + foreach ($accounts as $account) { // フォローの更新 - $updateFollowQuery = $pdo->prepare("UPDATE account SET role = REPLACE(role, :roleid, '') WHERE role LIKE :pattern"); - $updateFollowQuery->bindValue(':roleid', ",$role_id", PDO::PARAM_STR); - $updateFollowQuery->bindValue(':pattern', "%,$role_id%", PDO::PARAM_STR); - $res = $updateFollowQuery->execute(); - - } catch (Exception $e) { - - // エラーが発生した時はロールバック - $pdo->rollBack(); + if (strpos($account['role'], ",$role_id,") !== false || strpos($account['role'], ",$role_id") !== false || strpos($account['role'], "$role_id,") !== false) { + $delrole_roleList = explode(',', $account['role']); + $delrole_roleList = array_diff($delrole_roleList, array($role_id)); + $new_delrole_roleList = implode(',', $delrole_roleList); + + $updateroleQuery = $pdo->prepare("UPDATE account SET role = :role WHERE userid = :userid"); + $updateroleQuery->bindValue(':role', $new_delrole_roleList, PDO::PARAM_STR); + $updateroleQuery->bindValue(':userid', $account['userid'], PDO::PARAM_STR); + $updateroleQuery->execute(); + } } } catch (Exception $e) { @@ -310,7 +319,7 @@ if( !empty($_POST['send_add_role_submit']) ) { if($result4 > 0 && $result5 > 0){ if (false !== strstr($result4["role"], ','.$add_roleid)) { - $error_message[] = "既に".$add_roleid."は付与済みです。"; + $error_message[] = "既に".$add_roleid."は付与済みです。(ROLE_HUYOZUMI)"; } $New_role_id = $result4["role"] . ',' . $add_roleid; @@ -342,7 +351,54 @@ if( !empty($_POST['send_add_role_submit']) ) { $stmt = null; } }else{ - $error_message[] = "ロールがないまたはユーザーがいません。"; + $error_message[] = "ロールがないまたはユーザーがいません。(ROLE_OR_USER_NOT_FOUND)"; + } +} +if( !empty($_POST['send_del_role_submit']) ) { + $del_userid = htmlentities($_POST['del_userid']); + $del_roleid = htmlentities($_POST['del_roleid']); + + $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' => $del_userid)); + $result4 = $query->fetch(); + + $dbh = new PDO('mysql:charset=utf8mb4;dbname='.DB_NAME.';host='.DB_HOST , DB_USER, DB_PASS, $option); + $query = $dbh->prepare('SELECT * FROM role WHERE roleidname = :roleid limit 1'); + $query->execute(array(':roleid' => $del_roleid)); + $result5 = $query->fetch(); + + if($result4 > 0 && $result5 > 0){ + $userQuery = $dbh->prepare("SELECT role FROM account WHERE userid = :userid"); + $userQuery->bindValue(':userid', $del_userid); + $userQuery->execute(); + $userData = $userQuery->fetch(); + + // ロール剥奪ボタンが押された場合の処理 + $roleList = explode(',', $userData['role']); + if (in_array($del_roleid, $roleList)) { + // 自分が相手をフォローしている場合、相手のfollowerカラムと自分のfollowカラムを更新 + $roleList = array_diff($roleList, array($del_roleid)); + $newroleList = implode(',', $roleList); + + // UPDATE文を実行してフォロー情報を更新 + $updateQuery = $pdo->prepare("UPDATE account SET role = :role WHERE userid = :userid"); + $updateQuery->bindValue(':role', $newroleList, PDO::PARAM_STR); + $updateQuery->bindValue(':userid', $del_userid, PDO::PARAM_STR); + $res = $updateQuery->execute(); + + if ($res) { + $url = (empty($_SERVER['HTTPS']) ? 'http://' : 'https://') . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; + header("Location:" . $url); + exit; + } else { + $error_message[] = '更新に失敗しました。(REGISTERED_DAME)'; + } + + $stmt = null; + } + }else{ + $error_message[] = "ロールがないまたはユーザーがいません。(ROLE_OR_USER_NOT_FOUND)"; } } @@ -363,10 +419,10 @@ if (!empty($pdo)) { - + - - + + @@ -405,7 +461,7 @@ if (!empty($pdo)) {

ロールの色

ロールの色です。
HEXコードで入力してください。(#はつけないでください。)
- +
@@ -416,6 +472,10 @@ if (!empty($pdo)) {

特定のユーザーにロール付与するときに使用してください。


+

ロール剥奪

+

特定のユーザーからロールを剥奪する時に使用してください。

+ +

ロール一覧

@@ -454,9 +514,9 @@ if (!empty($pdo)) {

ロール付与先のユーザーidと付与したいロールのidを入力してください。
なお、現時点ではここからロールの剥奪は出来ませんのでご注意ください。

付与先ユーザーid
- +
付与するロールid
- +
@@ -465,14 +525,30 @@ if (!empty($pdo)) {
+ + - \ No newline at end of file diff --git a/settings_admin/serveradmin.php b/settings_admin/serveradmin.php index dcd6735..2f7ee1b 100644 --- a/settings_admin/serveradmin.php +++ b/settings_admin/serveradmin.php @@ -239,6 +239,8 @@ if( !empty($_POST['btn_submit']) ) { $servericon = $_POST['servericon']; + $serverhead = $_POST['serverhead']; + $serverlogo_onoff = $_POST['serverlogo_onoff']; $serverlogo_light = $_POST['serverlogo_light']; @@ -296,6 +298,8 @@ if( !empty($_POST['btn_submit']) ) { server_name = "'.$servername.'" ;サーバーアイコンのアドレス server_icon = "'.$servericon.'" + ;サーバーヘッダーのアドレス + server_head = "'.$serverhead.'" ;サーバーロゴのアドレス server_logo_home = "'.$serverlogo_light.'" server_logo_login = "'.$serverlogo_dark.'" @@ -342,10 +346,10 @@ require('../logout/logout.php'); - + - - + + @@ -370,16 +374,34 @@ require('../logout/logout.php');

サーバー設定

- -
- "> + + +
+ ">
+ +
+ +
+ "> +
+ + "> + +
+ +

サーバーアイコン

-
サーバー登録画面などに表示されます。
自動的に角が丸くなります。
URLより設定してください。
+
サーバー登録画面などに表示されます。
自動的に角が丸くなります。
URLより設定してください。(設定しなくても大丈夫です。)
">
+
+

サーバーヘッダー

+
サーバー登録画面などに表示されます。
自動的に角が丸くなります。
URLより設定してください。(設定しなくても大丈夫です。)
+ "> +

サーバーロゴ機能のオンオフ

diff --git a/settings_admin/settings_left_menu.php b/settings_admin/settings_left_menu.php index b546717..0c9ead4 100644 --- a/settings_admin/settings_left_menu.php +++ b/settings_admin/settings_left_menu.php @@ -5,9 +5,11 @@ ユーザー管理 招待コード発行所 ロール + 絵文字登録 広告 モデレーション カスタマイズ メンテナンス + プラグイン
\ No newline at end of file diff --git a/settings_admin/useradmin.php b/settings_admin/useradmin.php index 2a50fab..f885242 100644 --- a/settings_admin/useradmin.php +++ b/settings_admin/useradmin.php @@ -187,7 +187,7 @@ $notificationcount = $notiData['notification_count']; if( !empty($_POST['btn_submit']) ) { // 空白除去 - $target_userid = $_POST['target_userid']; + $target_userid = htmlentities(str_replace('@', '', $_POST['target_userid'])); if (!empty($pdo)) { $dbh = new PDO('mysql:charset=utf8mb4;dbname='.DB_NAME.';host='.DB_HOST, DB_USER, DB_PASS, array( @@ -205,7 +205,7 @@ if( !empty($_POST['btn_submit']) ) { $userdata = $rerole->fetch(); // ここでデータベースから取得した値を $role に代入する if(empty($userdata)){ - $error_message[] = "ユーザーがいません"; + $error_message[] = "ユーザーがいません(USER_NOT_FOUND)"; }else{ $_SESSION['userdata'] = $userdata; @@ -254,11 +254,11 @@ if( !empty($_POST['report_done']) ) { header("Location:".$url.""); exit; } else { - $error_message[] = '発行に失敗しました。'; + $error_message[] = '発行に失敗しました。(REGISTERED_DAME)'; } } catch (Exception $e) { - $error_message[] = "えらー"; + $error_message[] = "えらー(ERROR)"; // エラーが発生した時はロールバック $pdo->rollBack(); } @@ -289,10 +289,10 @@ if (!empty($pdo)) { - + - - + + @@ -319,7 +319,6 @@ if (!empty($pdo)) {

ユーザー管理

ユーザーID

-
「@」は外してください。
diff --git a/settings_admin/userinfo.php b/settings_admin/userinfo.php index 4deb27e..329e72f 100644 --- a/settings_admin/userinfo.php +++ b/settings_admin/userinfo.php @@ -185,6 +185,10 @@ $notiData = $notiQuery->fetch(PDO::FETCH_ASSOC); $notificationcount = $notiData['notification_count']; +//phpmailer-------------------------------------------- +require('plugin_settings/phpmailer_settings.php'); +require('plugin_settings/phpmailer_sender.php'); +//------------------------------------------------------ if (!empty($pdo)) { $dbh = new PDO('mysql:charset=utf8mb4;dbname='.DB_NAME.';host='.DB_HOST, DB_USER, DB_PASS, array( @@ -255,6 +259,21 @@ if( !empty($_POST['send_ice_submit']) ) { $pdo->rollBack(); } + //凍結通知メール + if(false !== strpos($userdata["mail_settings"], 'important')) { + if(!empty(MAIL_CHKS && MAIL_CHKS == "true")){ + if( !empty($userdata["mailadds"]) ){ + if(filter_var($userdata["mailadds"], FILTER_VALIDATE_EMAIL)){ + $mail_title = "お使いの".htmlspecialchars($serversettings["serverinfo"]["server_name"], ENT_QUOTES, 'UTF-8')."アカウントは凍結されました"; + $mail_text = "".$userdata["username"]."(".$userdata["userid"].")さん いつもuwuzuをご利用いただきありがとうございます。 ご利用のアカウント(".$userdata["userid"].")が".htmlspecialchars($serversettings["serverinfo"]["server_name"], ENT_QUOTES, 'UTF-8')."管理者により凍結されたためお知らせいたします。 サービス管理者からのメッセージは以下のものです。 ". $notice_msg ." 異議申し立てする場合は[".htmlspecialchars($serversettings["serverinfo"]["server_admin_mailadds"], ENT_QUOTES, 'UTF-8')."]まで異議申し立てをする旨を記載し送信をしてください。"; + + send_html_mail($userdata["mailadds"],$mail_title,$mail_text,"../"); + } + } + } + } + //------------ + $pdo->beginTransaction(); try { @@ -266,9 +285,9 @@ if( !empty($_POST['send_ice_submit']) ) { $userchk = 'none'; // 通知用SQL作成 - $stmt = $pdo->prepare("INSERT INTO notification (touserid, msg, url, datetime, userchk, title) VALUES (:touserid, :msg, :url, :datetime, :userchk, :title)"); - + $stmt = $pdo->prepare("INSERT INTO notification (fromuserid, touserid, msg, url, datetime, userchk, title) VALUES (:fromuserid, :touserid, :msg, :url, :datetime, :userchk, :title)"); + $stmt->bindParam(':fromuserid', htmlentities("uwuzu-fromsys"), PDO::PARAM_STR); $stmt->bindParam(':touserid', htmlentities($touserid), PDO::PARAM_STR); $stmt->bindParam(':msg', htmlentities($msg), PDO::PARAM_STR); $stmt->bindParam(':url', htmlentities($url), PDO::PARAM_STR); @@ -293,7 +312,7 @@ if( !empty($_POST['send_ice_submit']) ) { header("Location:useradmin"); exit; } else { - $error_message[] = '凍結に失敗しました。'; + $error_message[] = '凍結に失敗しました。(USER_ICE_DAME)'; } } if( !empty($_POST['send_water_submit']) ) { @@ -323,11 +342,26 @@ if( !empty($_POST['send_water_submit']) ) { } catch (Exception $e) { - $error_message[] = "えらー"; + $error_message[] = "えらー(ERROR)"; // エラーが発生した時はロールバック $pdo->rollBack(); } + //凍結通知メール + if(false !== strpos($userdata["mail_settings"], 'important')) { + if(!empty(MAIL_CHKS && MAIL_CHKS == "true")){ + if( !empty($userdata["mailadds"]) ){ + if(filter_var($userdata["mailadds"], FILTER_VALIDATE_EMAIL)){ + $mail_title = "お使いの".htmlspecialchars($serversettings["serverinfo"]["server_name"], ENT_QUOTES, 'UTF-8')."アカウントは解凍されました!"; + $mail_text = "".$userdata["username"]."(".$userdata["userid"].")さん いつもuwuzuをご利用いただきありがとうございます。 ご利用のアカウント(".$userdata["userid"].")が解凍されたためお知らせいたします。 今後、ご利用のuwuzuアカウントは今まで通りご利用いただけます。 また、APIを使用している方はAPIのトークンがリセットされているため再度トークンを発行してご利用ください。"; + + send_html_mail($userdata["mailadds"],$mail_title,$mail_text,"../"); + } + } + } + } + //------------ + $pdo->beginTransaction(); try { @@ -339,9 +373,9 @@ if( !empty($_POST['send_water_submit']) ) { $userchk = 'none'; // 通知用SQL作成 - $stmt = $pdo->prepare("INSERT INTO notification (touserid, msg, url, datetime, userchk, title) VALUES (:touserid, :msg, :url, :datetime, :userchk, :title)"); - + $stmt = $pdo->prepare("INSERT INTO notification (fromuserid, touserid, msg, url, datetime, userchk, title) VALUES (:fromuserid, :touserid, :msg, :url, :datetime, :userchk, :title)"); + $stmt->bindParam(':fromuserid', htmlentities("uwuzu-fromsys"), PDO::PARAM_STR); $stmt->bindParam(':touserid', htmlentities($touserid), PDO::PARAM_STR); $stmt->bindParam(':msg', htmlentities($msg), PDO::PARAM_STR); $stmt->bindParam(':url', htmlentities($url), PDO::PARAM_STR); @@ -357,7 +391,7 @@ if( !empty($_POST['send_water_submit']) ) { $res2 = $pdo->commit(); } catch(Exception $e) { - $error_message[] = "えらー"; + $error_message[] = "えらー(ERROR)"; // エラーが発生した時はロールバック $pdo->rollBack(); } @@ -366,7 +400,7 @@ if( !empty($_POST['send_water_submit']) ) { header("Location:useradmin"); exit; } else { - $error_message[] = '解凍に失敗しました。'; + $error_message[] = '解凍に失敗しました。(USER_WATER_DAME)'; } } @@ -496,6 +530,21 @@ if( !empty($_POST['send_ban_submit']) ) { } } + //BAN通知メール + if(false !== strpos($userdata["mail_settings"], 'important')) { + if(!empty(MAIL_CHKS && MAIL_CHKS == "true")){ + if( !empty($userdata["mailadds"]) ){ + if(filter_var($userdata["mailadds"], FILTER_VALIDATE_EMAIL)){ + $mail_title = "お使いの".htmlspecialchars($serversettings["serverinfo"]["server_name"], ENT_QUOTES, 'UTF-8')."アカウントはBANされました"; + $mail_text = "".$userdata["username"]."(".$userdata["userid"].")さん いつもuwuzuをご利用いただきありがとうございます。 この度、ご利用のアカウント(".$userdata["userid"].")が".htmlspecialchars($serversettings["serverinfo"]["server_name"], ENT_QUOTES, 'UTF-8')."管理者によりBAN(削除)されたためお知らせいたします。 今後は今までご利用いただいた".htmlspecialchars($serversettings["serverinfo"]["server_name"], ENT_QUOTES, 'UTF-8')."アカウントは利用できません。 ".htmlspecialchars($serversettings["serverinfo"]["server_name"], ENT_QUOTES, 'UTF-8')."サーバー上から今までご利用いただいていたアカウントの情報は削除されたためログインなどもできません。 ご理解とご協力のほどよろしくお願いします。"; + + send_html_mail($userdata["mailadds"],$mail_title,$mail_text,"../"); + } + } + } + } + //------------ + } catch (Exception $e) { // エラーが発生した時はロールバック @@ -506,7 +555,7 @@ if( !empty($_POST['send_ban_submit']) ) { header("Location:useradmin"); exit; } else { - $error_message[] = 'アカウント削除に失敗しました。'; + $error_message[] = 'アカウント削除に失敗しました。(ACCOUNT_DELETE_DAME)'; } @@ -520,10 +569,10 @@ require('../logout/logout.php'); - + - - + + diff --git a/success.php b/success.php index bee9eb3..9924227 100644 --- a/success.php +++ b/success.php @@ -15,8 +15,8 @@ if(!(empty($_SESSION['backupcode']))){ - - + + @@ -35,7 +35,7 @@ if(!(empty($_SESSION['backupcode']))){
diff --git a/ueuse/activity/index.php b/ueuse/activity/index.php index cc53b54..93ef2d7 100644 --- a/ueuse/activity/index.php +++ b/ueuse/activity/index.php @@ -1,9 +1,10 @@ prepare("SELECT * FROM ueuse WHERE account = :userid AND TIME(datetime) BETWEEN :old_datetime AND :now_datetime"); + $rate_Query->bindValue(':userid', $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)){ + if (empty($_FILES['upload_images']['name'])) { + $photo1 = "none"; } else { - $errnum = $uploadedFile['error']; - if($errnum === 1){$errcode = "FILE_DEKASUGUI_PHP_INI_KAKUNIN";} - if($errnum === 2){$errcode = "FILE_DEKASUGUI_HTML_KAKUNIN";} - if($errnum === 3){$errcode = "FILE_SUKOSHIDAKE_UPLOAD";} - if($errnum === 4){$errcode = "FILE_UPLOAD_DEKINAKATTA";} - if($errnum === 6){$errcode = "TMP_FOLDER_NAI";} - if($errnum === 7){$errcode = "FILE_KAKIKOMI_SIPPAI";} - if($errnum === 8){$errcode = "PHPINFO()_KAKUNIN";} - $error_message[] = 'アップロード失敗!(2)エラーコード:' .$errcode.''; - } - } + // アップロードされたファイル情報 + $uploadedFile = $_FILES['upload_images']; - if (empty($_FILES['upload_images2']['name'])) { - $photo2 = "none"; - } else { - - if (empty($_FILES['upload_images']['name'])){ - $error_message[] = '画像1から画像を選択してください!!!'; - } - // アップロードされたファイル情報 - $uploadedFile2 = $_FILES['upload_images2']; - - if( 10000000 < $uploadedFile2["size"] ) { - $error_message[] = 'ファイルサイズが大きすぎます!'; - } - // アップロードされたファイルの拡張子を取得 - $extension2 = pathinfo($uploadedFile2['name'], PATHINFO_EXTENSION); - - // 新しいファイル名を生成(uniqid + 拡張子) - $newFilename2 = uniqid() . '-'.$userid.'.' . $extension2; - - // 保存先のパスを生成 - $uploadedPath2 = '../ueuseimages/' . $newFilename2; - - // ファイルを移動 - $result2 = move_uploaded_file($uploadedFile2['tmp_name'], $uploadedPath2); - - // EXIF削除 - if($extension2 == "jpg" || $extension2 == "jpeg"){ - $gd = imagecreatefromjpeg($uploadedPath2); - $w = imagesx($gd); - $h = imagesy($gd); - $gd_out = imagecreatetruecolor($w,$h); - imagecopyresampled($gd_out, $gd, 0,0,0,0, $w,$h,$w,$h); - $exif = exif_read_data($uploadedPath2); - $gd_out = rotate($gd_out, $exif); - imagejpeg($gd_out, $uploadedPath2); - imagedestroy($gd_out); - } - - if ($result2) { - $photo2 = $uploadedPath2; // 保存されたファイルのパスを使用 - } else { - $errnum = $uploadedFile2['error']; - if($errnum === 1){$errcode = "FILE_DEKASUGUI_PHP_INI_KAKUNIN";} - if($errnum === 2){$errcode = "FILE_DEKASUGUI_HTML_KAKUNIN";} - if($errnum === 3){$errcode = "FILE_SUKOSHIDAKE_UPLOAD";} - if($errnum === 4){$errcode = "FILE_UPLOAD_DEKINAKATTA";} - if($errnum === 6){$errcode = "TMP_FOLDER_NAI";} - if($errnum === 7){$errcode = "FILE_KAKIKOMI_SIPPAI";} - if($errnum === 8){$errcode = "PHPINFO()_KAKUNIN";} - $error_message[] = 'アップロード失敗!(2)エラーコード:' .$errcode.''; - } - } - - if (empty($_FILES['upload_images3']['name'])) { - $photo3 = "none"; - } else { - - if (empty($_FILES['upload_images2']['name'])){ - $error_message[] = '画像2から画像を選択してください!!!'; - } - // アップロードされたファイル情報 - $uploadedFile3 = $_FILES['upload_images3']; - - if( 10000000 < $uploadedFile3["size"] ) { - $error_message[] = 'ファイルサイズが大きすぎます!'; - } - // アップロードされたファイルの拡張子を取得 - $extension3 = pathinfo($uploadedFile3['name'], PATHINFO_EXTENSION); - - // 新しいファイル名を生成(uniqid + 拡張子) - $newFilename3 = uniqid() . '-'.$userid.'.' . $extension3; - - // 保存先のパスを生成 - $uploadedPath3 = '../ueuseimages/' . $newFilename3; - - // ファイルを移動 - $result3 = move_uploaded_file($uploadedFile3['tmp_name'], $uploadedPath3); - - // EXIF削除 - if($extension3 == "jpg" || $extension3 == "jpeg"){ - $gd = imagecreatefromjpeg($uploadedPath3); - $w = imagesx($gd); - $h = imagesy($gd); - $gd_out = imagecreatetruecolor($w,$h); - imagecopyresampled($gd_out, $gd, 0,0,0,0, $w,$h,$w,$h); - $exif = exif_read_data($uploadedPath3); - $gd_out = rotate($gd_out, $exif); - imagejpeg($gd_out, $uploadedPath3); - imagedestroy($gd_out); - } - - if ($result3) { - $photo3 = $uploadedPath3; // 保存されたファイルのパスを使用 - } else { - $errnum = $uploadedFile3['error']; - if($errnum === 1){$errcode = "FILE_DEKASUGUI_PHP_INI_KAKUNIN";} - if($errnum === 2){$errcode = "FILE_DEKASUGUI_HTML_KAKUNIN";} - if($errnum === 3){$errcode = "FILE_SUKOSHIDAKE_UPLOAD";} - if($errnum === 4){$errcode = "FILE_UPLOAD_DEKINAKATTA";} - if($errnum === 6){$errcode = "TMP_FOLDER_NAI";} - if($errnum === 7){$errcode = "FILE_KAKIKOMI_SIPPAI";} - if($errnum === 8){$errcode = "PHPINFO()_KAKUNIN";} - $error_message[] = 'アップロード失敗!(3)エラーコード:' .$errcode.''; - } - } - - if (empty($_FILES['upload_images4']['name'])) { - $photo4 = "none"; - } else { - - if (empty($_FILES['upload_images3']['name'])){ - $error_message[] = '画像3から画像を選択してください!!!'; - } - // アップロードされたファイル情報 - $uploadedFile4 = $_FILES['upload_images4']; - - if( 10000000 < $uploadedFile4["size"] ) { - $error_message[] = 'ファイルサイズが大きすぎます!'; - } - // アップロードされたファイルの拡張子を取得 - $extension4 = pathinfo($uploadedFile4['name'], PATHINFO_EXTENSION); - - // 新しいファイル名を生成(uniqid + 拡張子) - $newFilename4 = uniqid() . '-'.$userid.'.' . $extension4; - - // 保存先のパスを生成 - $uploadedPath4 = '../ueuseimages/' . $newFilename4; - - // ファイルを移動 - $result4 = move_uploaded_file($uploadedFile4['tmp_name'], $uploadedPath4); - - // EXIF削除 - if($extension4 == "jpg" || $extension4 == "jpeg"){ - $gd = imagecreatefromjpeg($uploadedPath4); - $w = imagesx($gd); - $h = imagesy($gd); - $gd_out = imagecreatetruecolor($w,$h); - imagecopyresampled($gd_out, $gd, 0,0,0,0, $w,$h,$w,$h); - $exif = exif_read_data($uploadedPath4); - $gd_out = rotate($gd_out, $exif); - imagejpeg($gd_out, $uploadedPath4); - imagedestroy($gd_out); - } - - if ($result4) { - $photo4 = $uploadedPath4; // 保存されたファイルのパスを使用 - } else { - $errnum = $uploadedFile4['error']; - if($errnum === 1){$errcode = "FILE_DEKASUGUI_PHP_INI_KAKUNIN";} - if($errnum === 2){$errcode = "FILE_DEKASUGUI_HTML_KAKUNIN";} - if($errnum === 3){$errcode = "FILE_SUKOSHIDAKE_UPLOAD";} - if($errnum === 4){$errcode = "FILE_UPLOAD_DEKINAKATTA";} - if($errnum === 6){$errcode = "TMP_FOLDER_NAI";} - if($errnum === 7){$errcode = "FILE_KAKIKOMI_SIPPAI";} - if($errnum === 8){$errcode = "PHPINFO()_KAKUNIN";} - $error_message[] = 'アップロード失敗!(4)エラーコード:' .$errcode.''; - } - } - - if (empty($_FILES['upload_videos1']['name'])) { - $video1 = "none"; - } else { - // アップロードされたファイル情報 - $uploadedFile3 = $_FILES['upload_videos1']; - - // アップロードされたファイルの拡張子を取得 - $extension3 = strtolower(pathinfo($uploadedFile3['name'], PATHINFO_EXTENSION)); // 小文字に変換 - - // サポートされている動画フォーマットの拡張子を配列で定義 - $supportedExtensions = array("mp4", "avi", "mov", "webm"); - - if (in_array($extension3, $supportedExtensions)) { - // 正しい拡張子の場合、新しいファイル名を生成 - $newFilename3 = uniqid() . '-'.$userid.'.' . $extension3; + // アップロードされたファイルの拡張子を取得 + $extension = pathinfo($uploadedFile['name'], PATHINFO_EXTENSION); + + // 新しいファイル名を生成(uniqid + 拡張子) + $newFilename = uniqid() . '-'.$userid.'.' . $extension; + // 保存先のパスを生成 - $uploadedPath3 = '../ueusevideos/' . $newFilename3; - + $uploadedPath = '../ueuseimages/' . $newFilename; + // ファイルを移動 - $result3 = move_uploaded_file($uploadedFile3['tmp_name'], $uploadedPath3); - - if ($result3) { - $video1 = $uploadedPath3; // 保存されたファイルのパスを使用 + $result = move_uploaded_file($uploadedFile['tmp_name'], $uploadedPath); + + // EXIF削除 + delete_exif($extension, $uploadedPath); + + if ($result) { + $photo1 = $uploadedPath; // 保存されたファイルのパスを使用 } else { - $errnum = $uploadedFile3['error']; + $errnum = $uploadedFile['error']; if($errnum === 1){$errcode = "FILE_DEKASUGUI_PHP_INI_KAKUNIN";} if($errnum === 2){$errcode = "FILE_DEKASUGUI_HTML_KAKUNIN";} if($errnum === 3){$errcode = "FILE_SUKOSHIDAKE_UPLOAD";} @@ -532,51 +309,216 @@ if( !empty($_POST['btn_submit']) ) { if($errnum === 8){$errcode = "PHPINFO()_KAKUNIN";} $error_message[] = 'アップロード失敗!(2)エラーコード:' .$errcode.''; } - } else { - $error_message[] = '対応していないファイル形式です!'; } - - - - } - if( empty($error_message) ) { - - // 書き込み日時を取得 - $datetime = date("Y-m-d H:i:s"); + if (empty($_FILES['upload_images2']['name'])) { + $photo2 = "none"; + } else { + + if (empty($_FILES['upload_images']['name'])){ + $error_message[] = '画像1から画像を選択してください!!!(PHOTO_SELECT_PLEASE)'; + } + // アップロードされたファイル情報 + $uploadedFile2 = $_FILES['upload_images2']; + + if( 10000000 < $uploadedFile2["size"] ) { + $error_message[] = 'ファイルサイズが大きすぎます!(PHOTO_OVER_MAX_SIZE)'; + } + // アップロードされたファイルの拡張子を取得 + $extension2 = pathinfo($uploadedFile2['name'], PATHINFO_EXTENSION); + + // 新しいファイル名を生成(uniqid + 拡張子) + $newFilename2 = uniqid() . '-'.$userid.'.' . $extension2; + + // 保存先のパスを生成 + $uploadedPath2 = '../ueuseimages/' . $newFilename2; + + // ファイルを移動 + $result2 = move_uploaded_file($uploadedFile2['tmp_name'], $uploadedPath2); + + // EXIF削除 + delete_exif($extension2, $uploadedPath2); + + if ($result2) { + $photo2 = $uploadedPath2; // 保存されたファイルのパスを使用 + } else { + $errnum = $uploadedFile2['error']; + if($errnum === 1){$errcode = "FILE_DEKASUGUI_PHP_INI_KAKUNIN";} + if($errnum === 2){$errcode = "FILE_DEKASUGUI_HTML_KAKUNIN";} + if($errnum === 3){$errcode = "FILE_SUKOSHIDAKE_UPLOAD";} + if($errnum === 4){$errcode = "FILE_UPLOAD_DEKINAKATTA";} + if($errnum === 6){$errcode = "TMP_FOLDER_NAI";} + if($errnum === 7){$errcode = "FILE_KAKIKOMI_SIPPAI";} + if($errnum === 8){$errcode = "PHPINFO()_KAKUNIN";} + $error_message[] = 'アップロード失敗!(2)エラーコード:' .$errcode.''; + } + } + + if (empty($_FILES['upload_images3']['name'])) { + $photo3 = "none"; + } else { + + if (empty($_FILES['upload_images2']['name'])){ + $error_message[] = '画像2から画像を選択してください!!!(PHOTO_SELECT_PLEASE)'; + } + // アップロードされたファイル情報 + $uploadedFile3 = $_FILES['upload_images3']; + + if( 10000000 < $uploadedFile3["size"] ) { + $error_message[] = 'ファイルサイズが大きすぎます!(PHOTO_OVER_MAX_SIZE)'; + } + // アップロードされたファイルの拡張子を取得 + $extension3 = pathinfo($uploadedFile3['name'], PATHINFO_EXTENSION); + + // 新しいファイル名を生成(uniqid + 拡張子) + $newFilename3 = uniqid() . '-'.$userid.'.' . $extension3; + + // 保存先のパスを生成 + $uploadedPath3 = '../ueuseimages/' . $newFilename3; + + // ファイルを移動 + $result3 = move_uploaded_file($uploadedFile3['tmp_name'], $uploadedPath3); + + // EXIF削除 + delete_exif($extension3, $uploadedPath3); + + if ($result3) { + $photo3 = $uploadedPath3; // 保存されたファイルのパスを使用 + } else { + $errnum = $uploadedFile3['error']; + if($errnum === 1){$errcode = "FILE_DEKASUGUI_PHP_INI_KAKUNIN";} + if($errnum === 2){$errcode = "FILE_DEKASUGUI_HTML_KAKUNIN";} + if($errnum === 3){$errcode = "FILE_SUKOSHIDAKE_UPLOAD";} + if($errnum === 4){$errcode = "FILE_UPLOAD_DEKINAKATTA";} + if($errnum === 6){$errcode = "TMP_FOLDER_NAI";} + if($errnum === 7){$errcode = "FILE_KAKIKOMI_SIPPAI";} + if($errnum === 8){$errcode = "PHPINFO()_KAKUNIN";} + $error_message[] = 'アップロード失敗!(3)エラーコード:' .$errcode.''; + } + } + + if (empty($_FILES['upload_images4']['name'])) { + $photo4 = "none"; + } else { + + if (empty($_FILES['upload_images3']['name'])){ + $error_message[] = '画像3から画像を選択してください!!!(PHOTO_SELECT_PLEASE)'; + } + // アップロードされたファイル情報 + $uploadedFile4 = $_FILES['upload_images4']; + + if( 10000000 < $uploadedFile4["size"] ) { + $error_message[] = 'ファイルサイズが大きすぎます!(PHOTO_OVER_MAX_SIZE)'; + } + // アップロードされたファイルの拡張子を取得 + $extension4 = pathinfo($uploadedFile4['name'], PATHINFO_EXTENSION); + + // 新しいファイル名を生成(uniqid + 拡張子) + $newFilename4 = uniqid() . '-'.$userid.'.' . $extension4; + + // 保存先のパスを生成 + $uploadedPath4 = '../ueuseimages/' . $newFilename4; + + // ファイルを移動 + $result4 = move_uploaded_file($uploadedFile4['tmp_name'], $uploadedPath4); + + // EXIF削除 + delete_exif($extension4, $uploadedPath4); + + if ($result4) { + $photo4 = $uploadedPath4; // 保存されたファイルのパスを使用 + } else { + $errnum = $uploadedFile4['error']; + if($errnum === 1){$errcode = "FILE_DEKASUGUI_PHP_INI_KAKUNIN";} + if($errnum === 2){$errcode = "FILE_DEKASUGUI_HTML_KAKUNIN";} + if($errnum === 3){$errcode = "FILE_SUKOSHIDAKE_UPLOAD";} + if($errnum === 4){$errcode = "FILE_UPLOAD_DEKINAKATTA";} + if($errnum === 6){$errcode = "TMP_FOLDER_NAI";} + if($errnum === 7){$errcode = "FILE_KAKIKOMI_SIPPAI";} + if($errnum === 8){$errcode = "PHPINFO()_KAKUNIN";} + $error_message[] = 'アップロード失敗!(4)エラーコード:' .$errcode.''; + } + } + + if (empty($_FILES['upload_videos1']['name'])) { + $video1 = "none"; + } else { + // アップロードされたファイル情報 + $uploadedFile3 = $_FILES['upload_videos1']; + + // アップロードされたファイルの拡張子を取得 + $extension3 = strtolower(pathinfo($uploadedFile3['name'], PATHINFO_EXTENSION)); // 小文字に変換 + + // サポートされている動画フォーマットの拡張子を配列で定義 + $supportedExtensions = array("mp4", "avi", "mov", "webm"); + + if (in_array($extension3, $supportedExtensions)) { + // 正しい拡張子の場合、新しいファイル名を生成 + $newFilename3 = uniqid() . '-'.$userid.'.' . $extension3; + // 保存先のパスを生成 + $uploadedPath3 = '../ueusevideos/' . $newFilename3; + + // ファイルを移動 + $result3 = move_uploaded_file($uploadedFile3['tmp_name'], $uploadedPath3); + + if ($result3) { + $video1 = $uploadedPath3; // 保存されたファイルのパスを使用 + } else { + $errnum = $uploadedFile3['error']; + if($errnum === 1){$errcode = "FILE_DEKASUGUI_PHP_INI_KAKUNIN";} + if($errnum === 2){$errcode = "FILE_DEKASUGUI_HTML_KAKUNIN";} + if($errnum === 3){$errcode = "FILE_SUKOSHIDAKE_UPLOAD";} + if($errnum === 4){$errcode = "FILE_UPLOAD_DEKINAKATTA";} + if($errnum === 6){$errcode = "TMP_FOLDER_NAI";} + if($errnum === 7){$errcode = "FILE_KAKIKOMI_SIPPAI";} + if($errnum === 8){$errcode = "PHPINFO()_KAKUNIN";} + $error_message[] = 'アップロード失敗!(2)エラーコード:' .$errcode.''; + } + } else { + $error_message[] = '対応していないファイル形式です!(SORRY_FILE_HITAIOU)'; + } + + + + } + + if( empty($error_message) ) { + + // 書き込み日時を取得 + $datetime = date("Y-m-d H:i:s"); $uniqid = createUniqId(); $abi = "none"; - // トランザクション開始 - $pdo->beginTransaction(); + // トランザクション開始 + $pdo->beginTransaction(); - try { + try { - // SQL作成 - $stmt = $pdo->prepare("INSERT INTO ueuse (username, account, uniqid, rpuniqid, ueuse, photo1, photo2, photo3, photo4, video1, datetime, abi, nsfw) VALUES (:username, :account, :uniqid, :rpuniqid, :ueuse, :photo1, :photo2, :photo3, :photo4, :video1, :datetime, :abi, :nsfw)"); - - $stmt->bindParam(':username', $username, PDO::PARAM_STR); - $stmt->bindParam(':account', $userid, PDO::PARAM_STR); + // SQL作成 + $stmt = $pdo->prepare("INSERT INTO ueuse (username, account, uniqid, rpuniqid, ueuse, photo1, photo2, photo3, photo4, video1, datetime, abi, nsfw) VALUES (:username, :account, :uniqid, :rpuniqid, :ueuse, :photo1, :photo2, :photo3, :photo4, :video1, :datetime, :abi, :nsfw)"); + + $stmt->bindParam(':username', $username, PDO::PARAM_STR); + $stmt->bindParam(':account', $userid, PDO::PARAM_STR); $stmt->bindParam(':uniqid', $uniqid, PDO::PARAM_STR); $stmt->bindParam(':rpuniqid', $ueuseid, PDO::PARAM_STR); - $stmt->bindParam(':ueuse', $ueuse, PDO::PARAM_STR); + $stmt->bindParam(':ueuse', $ueuse, PDO::PARAM_STR); $stmt->bindParam(':photo1', $photo1, PDO::PARAM_STR); $stmt->bindParam(':photo2', $photo2, PDO::PARAM_STR); $stmt->bindParam(':photo3', $photo3, PDO::PARAM_STR); $stmt->bindParam(':photo4', $photo4, PDO::PARAM_STR); $stmt->bindParam(':video1', $video1, PDO::PARAM_STR); - $stmt->bindParam(':datetime', $datetime, PDO::PARAM_STR); + $stmt->bindParam(':datetime', $datetime, PDO::PARAM_STR); $stmt->bindParam(':abi', $abi, PDO::PARAM_STR); $stmt->bindParam(':nsfw', $save_nsfw, PDO::PARAM_STR); - // SQLクエリの実行 - $res = $stmt->execute(); + // SQLクエリの実行 + $res = $stmt->execute(); - // コミット - $res = $pdo->commit(); + // コミット + $res = $pdo->commit(); $pdo->beginTransaction(); @@ -584,24 +526,24 @@ if( !empty($_POST['btn_submit']) ) { $title = ''.$userid.'さんが返信しました!'; $url = $_SERVER['REQUEST_URI']; $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); + // 通知用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); + $stmt->bindParam(':datetime', $datetime, PDO::PARAM_STR); - // SQLクエリの実行 - $res = $stmt->execute(); + // SQLクエリの実行 + $res = $stmt->execute(); - // コミット - $res = $pdo->commit(); + // コミット + $res = $pdo->commit(); - $mentionedUsers = get_mentions_userid($ueuse); + $mentionedUsers = array_unique(get_mentions_userid($ueuse)); foreach ($mentionedUsers as $mentionedUser) { @@ -644,22 +586,25 @@ if( !empty($_POST['btn_submit']) ) { } - } catch(Exception $e) { + } catch(Exception $e) { - // エラーが発生した時はロールバック - $pdo->rollBack(); - } + // エラーが発生した時はロールバック + $pdo->rollBack(); + } - if( $res ) { + if( $res ) { $url = (empty($_SERVER['HTTPS']) ? 'http://' : 'https://') . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; header("Location:".$url.""); exit; - } else { - $error_message[] = $e->getMessage(); - } + } else { + $error_message[] = $e->getMessage(); + } - // プリペアドステートメントを削除 - $stmt = null; + // プリペアドステートメントを削除 + $stmt = null; + } + }else{ + $error_message[] = "投稿回数のレート制限を超過しています。(OVER_RATE_LIMIT)"; } } @@ -691,11 +636,11 @@ $pdo = null; - + - - - + + + @@ -728,7 +673,6 @@ $pdo = null;
-

画像のEXIF情報(位置情報など)は削除されません。
情報漏洩に気をつけてくださいね…

-
- - -
+
+ + +
- +
+ +
@@ -766,9 +712,7 @@ $pdo = null; var file_reader = new FileReader(); // ファイルの読み込みを行ったら実行 file_reader.addEventListener('load', function(e) { - const element = document.querySelector('#videos1'); - const createElement = '

動画を選択しました。

'; - element.insertAdjacentHTML('afterend', createElement); + $('#videos1').addClass('label_set'); }); file_reader.readAsText(e.target.files[0]); }); @@ -776,9 +720,7 @@ $pdo = null; var file_reader = new FileReader(); // ファイルの読み込みを行ったら実行 file_reader.addEventListener('load', function(e) { - const element = document.querySelector('#images4'); - const createElement = '

画像を選択しました。

'; - element.insertAdjacentHTML('afterend', createElement); + $('#images4').addClass('label_set'); }); file_reader.readAsText(e.target.files[0]); }); @@ -787,9 +729,7 @@ $pdo = null; var file_reader = new FileReader(); // ファイルの読み込みを行ったら実行 file_reader.addEventListener('load', function(e) { - const element = document.querySelector('#images3'); - const createElement = '

画像を選択しました。

'; - element.insertAdjacentHTML('afterend', createElement); + $('#images3').addClass('label_set'); $("#images4").show(); }); file_reader.readAsText(e.target.files[0]); @@ -799,9 +739,7 @@ $pdo = null; var file_reader = new FileReader(); // ファイルの読み込みを行ったら実行 file_reader.addEventListener('load', function(e) { - const element = document.querySelector('#images2'); - const createElement = '

画像を選択しました。

'; - element.insertAdjacentHTML('afterend', createElement); + $('#images2').addClass('label_set'); $("#images3").show(); }); file_reader.readAsText(e.target.files[0]); @@ -810,13 +748,24 @@ $pdo = null; var file_reader = new FileReader(); // ファイルの読み込みを行ったら実行 file_reader.addEventListener('load', function(e) { - const element = document.querySelector('#images'); - const createElement = '

画像を選択しました。

'; - element.insertAdjacentHTML('afterend', createElement); + $('#images').addClass('label_set'); $("#images2").show(); }); file_reader.readAsText(e.target.files[0]); }); + $('#ueuse').on('input', function () { + var mojisize = ''; + var mojicount = Number(mojisize) - $(this).val().length; + if(mojicount >= 0){ + $('#moji_cnt').removeClass('red'); + $('#moji_cnt').html(mojicount); + $('#ueusebtn').prop('disabled', false); + }else{ + $('#moji_cnt').addClass('red'); + $('#moji_cnt').html(mojicount); + $('#ueusebtn').prop('disabled', true); + } + })

ユーズ

@@ -835,7 +784,7 @@ $pdo = null;
@@ -960,7 +909,41 @@ $(document).ready(function() { }); }); + $(document).on('click', '.bookmark, .bookmark_after', function(event) { + event.preventDefault(); + + var postUniqid = $(this).data('uniqid'); + var userid = ''; + var account_id = ''; + var likeCountElement = $(this).find('.like-count'); // いいね数を表示する要素 + + var isLiked = $(this).hasClass('bookmark_after'); // 現在のいいねの状態を判定 + + var $this = $(this); // ボタン要素を変数に格納 + + $.ajax({ + url: '../bookmark/bookmark.php', + method: 'POST', + data: { uniqid: postUniqid, userid: userid, account_id: account_id }, // ここに自分のユーザーIDを指定 + dataType: 'json', + success: function(response) { + if (response.success) { + // いいね成功時の処理 + if (isLiked) { + $this.removeClass('bookmark_after'); // クラスを削除していいねを取り消す + } else { + $this.addClass('bookmark_after'); // クラスを追加していいねを追加する + } + } else { + // いいね失敗時の処理 + } + }.bind(this), // コールバック内でthisが適切な要素を指すようにbindする + error: function() { + // エラー時の処理 + } + }); + }); diff --git a/unsupported.php b/unsupported.php index 0f66fae..4b4b716 100644 --- a/unsupported.php +++ b/unsupported.php @@ -76,7 +76,7 @@ if($errcode == "UNSUPPORTED_BROWSER"){
詳細は下記のリンクよりご確認ください。

- 詳細 + 詳細

エラー内容

diff --git a/user/inbox/index.php b/user/inbox/index.php index 53a2b5d..44f23b8 100644 --- a/user/inbox/index.php +++ b/user/inbox/index.php @@ -1,8 +1,10 @@ beginTransaction(); try { + $fromuserid = $userid; $touserid = $userData["userid"]; $datetime = date("Y-m-d H:i:s"); $msg = "".$userid."さんにフォローされました。"; @@ -463,9 +464,9 @@ if (!empty($_POST['follow'])) { $userchk = 'none'; // 通知用SQL作成 - $stmt = $pdo->prepare("INSERT INTO notification (touserid, msg, url, datetime, userchk, title) VALUES (:touserid, :msg, :url, :datetime, :userchk, :title)"); - + $stmt = $pdo->prepare("INSERT INTO notification (fromuserid, touserid, msg, url, datetime, userchk, title) VALUES (:fromuserid, :touserid, :msg, :url, :datetime, :userchk, :title)"); + $stmt->bindParam(':fromuserid', htmlentities($fromuserid), PDO::PARAM_STR); $stmt->bindParam(':touserid', htmlentities($touserid), PDO::PARAM_STR); $stmt->bindParam(':msg', htmlentities($msg), PDO::PARAM_STR); $stmt->bindParam(':url', htmlentities($url), PDO::PARAM_STR); @@ -491,7 +492,7 @@ if (!empty($_POST['follow'])) { header("Location:" . $url); exit; } else { - $error_message[] = '更新に失敗しました。'; + $error_message[] = '更新に失敗しました。(REGISTERED_DAME)'; } } @@ -524,7 +525,7 @@ if (!empty($_POST['follow'])) { header("Location:" . $url); exit; } else { - $error_message[] = '更新に失敗しました。'; + $error_message[] = '更新に失敗しました。(REGISTERED_DAME)'; } $stmt = null; @@ -566,7 +567,7 @@ if (!empty($_POST['send_block_submit'])) { header("Location:" . $url); exit; } else { - $error_message[] = '更新に失敗しました。'; + $error_message[] = '更新に失敗しました。(REGISTERED_DAME)'; } $stmt = null; @@ -577,7 +578,7 @@ if (!empty($_POST['send_block_submit'])) { header("Location:" . $url); exit; } else { - $error_message[] = '更新に失敗しました。'; + $error_message[] = '更新に失敗しました。(REGISTERED_DAME)'; } } elseif (!empty($_POST['send_un_block_submit'])) { @@ -596,7 +597,7 @@ if (!empty($_POST['send_block_submit'])) { header("Location:" . $url); exit; } else { - $error_message[] = '更新に失敗しました。'; + $error_message[] = '更新に失敗しました。(REGISTERED_DAME)'; } } @@ -615,9 +616,9 @@ $pdo = null; - - - + + + @@ -826,7 +827,7 @@ $pdo = null;