diff --git a/css/home.css b/css/home.css
index 4a43c03..d67891c 100644
--- a/css/home.css
+++ b/css/home.css
@@ -389,14 +389,16 @@ body{
}
.leftbutton .notipod{
- width: 25px;
+ width: auto;
height: 25px;
margin-left: auto;
margin-right: 20px;
margin-top: auto;
margin-bottom: auto;
+ padding-left: 9px;
+ padding-right: 9px;
background-color: #FF4444;
- border-radius: 50%;
+ border-radius: 25px;
transition: all 250ms ease-out;
}
.leftbutton .notipod p{
@@ -911,6 +913,29 @@ main h1{
font-weight: bold;
}
+.ueuse .mta{
+ line-height: 30px;
+ background-color: #FFFAE6;
+ padding: 6px;
+ border-radius: 25px;
+ margin-top: auto;
+ margin-bottom: auto;
+ margin-left: 3px;
+ margin-right: 3px;
+ font-size: 14px;
+ color:#FFC832;
+ text-decoration: none;
+ font-family: 'BIZ UDPGothic', sans-serif;
+ font-weight: bold;
+ transition: all 250ms ease-out;
+}
+.ueuse .mta:hover{
+ font-size: 14px;
+ background-color: #FFC832;
+ color:#FFFAE6;
+ box-shadow:0 0px 48px 0 rgba(0, 0, 0, .2);
+}
+
.ueuse a{
margin-top: auto;
margin-bottom: auto;
@@ -2680,13 +2705,15 @@ hr{
}
.userheader .icon{
- margin-left: 24px;
+ margin-left: 12px;
+ margin-right: 12px;
display: block;
width: auto;
}
.userheader .roleboxes{
- margin-left: 24px;
+ margin-left: 12px;
+ margin-right: 12px;
display: flex;
padding: 0px;
flex-wrap : wrap;
@@ -2712,6 +2739,16 @@ hr{
flex-wrap : wrap;
}
+ .userheader .profile p{
+ margin-left: 12px;
+ margin-right: 12px;
+ }
+
+ .fzone{
+ margin-left: 12px;
+ margin-right: 12px;
+ }
+
main{
height: 93.7dvh;
overflow: auto;
@@ -2852,12 +2889,19 @@ hr{
border: none;
}
.btmbutton:hover{
- background-color: #FFC832;
- color: #FFFAE6;
+ background-color: #FFFFFF;
+ color: #FFC832;
box-shadow:none;
}
- .btmbutton:active{
+ .btmbutton:active svg{
box-shadow:none;
+ margin-left: auto;
+ margin-right: auto;
+ margin-top: auto;
+ margin-bottom: auto;
+ fill: currentColor;
+ width: 4.7dvh;
+ height: 4.7dvh;
}
svg {
width: 5dvh;
@@ -2867,6 +2911,7 @@ hr{
margin-top: auto;
margin-bottom: auto;
fill: currentColor;
+ transition: all 250ms ease-out;
}
@@ -3067,6 +3112,34 @@ hr{
border: 1px solid #EEE;
width: auto;
}
+
+ .ueuse .flebox{
+ display: flex;
+ flex-wrap: wrap;
+ }
+
+ .ueuse .flebox a {
+ flex-shrink: 0;
+ margin-top: auto;
+ margin-bottom: auto;
+ margin-left: 12px;
+ font-size: 18px;
+ color: #252525;
+ text-decoration: none;
+ font-family: 'BIZ UDPGothic', sans-serif;
+ font-weight: bold;
+ }
+
+ .ueuse .flebox .time{
+ margin-top: 6px;
+ margin-bottom: 6px;
+ margin-left: auto;
+ margin-right: 12px;
+ text-align: right;
+ font-size: 12px;
+ color:#999;
+ font-family: 'BIZ UDPGothic', sans-serif;
+ }
.leftbox{
display: block;
@@ -3812,6 +3885,9 @@ hr{
.formarea p{
color:#CCC;
}
+ .formarea li{
+ color:#CCC;
+ }
.modal-content {
@@ -3989,4 +4065,14 @@ hr{
.tokonone p{
color:#CCC;
}
+
+ .ueuse .mta{
+ background-color: #302c2c;
+ }
+ .ueuse .mta:hover{
+ font-size: 14px;
+ background-color: #FFC832;
+ color:#0c0c0c;
+ box-shadow:0 0px 48px 0 rgba(0, 0, 0, .2);
+ }
}
\ No newline at end of file
diff --git a/home/index.php b/home/index.php
index 4faa00e..36949ba 100644
--- a/home/index.php
+++ b/home/index.php
@@ -116,6 +116,32 @@ $notiData = $notiQuery->fetch(PDO::FETCH_ASSOC);
$notificationcount = $notiData['notification_count'];
//-------------------------------------------
+function get_mentions_userid($postText) {
+ // @useridを検出する
+ $usernamePattern = '/@(\w+)/';
+ $mentionedUsers = [];
+
+ preg_replace_callback($usernamePattern, function($matches) use (&$mentionedUsers) {
+ $mention_username = $matches[1];
+
+ $dbh = new PDO('mysql:charset=utf8mb4;dbname='.DB_NAME.';host='.DB_HOST, DB_USER, DB_PASS, array(
+ PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
+ PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
+ PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => true,
+ ));
+
+ $mention_userQuery = $dbh->prepare("SELECT username, userid FROM account WHERE userid = :userid");
+ $mention_userQuery->bindValue(':userid', $mention_username);
+ $mention_userQuery->execute();
+ $mention_userData = $mention_userQuery->fetch();
+
+ if (!empty($mention_userData)) {
+ $mentionedUsers[] = $mention_username;
+ }
+ }, $postText);
+
+ return $mentionedUsers;
+}
if( !empty($_POST['btn_submit']) ) {
@@ -279,6 +305,46 @@ if( !empty($_POST['btn_submit']) ) {
// コミット
$res = $pdo->commit();
+ $mentionedUsers = get_mentions_userid($ueuse);
+
+ foreach ($mentionedUsers as $mentionedUser) {
+
+ $pdo->beginTransaction();
+
+ try {
+ $touserid = $mentionedUser;
+ $datetime = date("Y-m-d H:i:s");
+ $msg = "" . $ueuse . "";
+ $title = "" . $username . "さんにメンションされました!";
+ $url = "/!" . $uniqid . "~" . $userid . "";
+ $userchk = 'none';
+
+ // 通知用SQL作成
+ $stmt = $pdo->prepare("INSERT INTO notification (touserid, msg, url, datetime, userchk, title) VALUES (:touserid, :msg, :url, :datetime, :userchk, :title)");
+
+
+ $stmt->bindParam(':touserid', $touserid, PDO::PARAM_STR);
+ $stmt->bindParam(':msg', $msg, PDO::PARAM_STR);
+ $stmt->bindParam(':url', $url, PDO::PARAM_STR);
+ $stmt->bindParam(':userchk', $userchk, PDO::PARAM_STR);
+ $stmt->bindParam(':title', $title, PDO::PARAM_STR);
+
+ $stmt->bindParam(':datetime', $datetime, PDO::PARAM_STR);
+
+ // SQLクエリの実行
+ $res = $stmt->execute();
+
+ // コミット
+ $res = $pdo->commit();
+
+ } catch(Exception $e) {
+
+ // エラーが発生した時はロールバック
+ $pdo->rollBack();
+ }
+
+ }
+
} catch(Exception $e) {
// エラーが発生した時はロールバック
@@ -619,6 +685,10 @@ $(document).ready(function() {
});
});
+ // 10秒後に実行
+ setTimeout(() => {
+ console.log("Execution 10sec"); // Execution 10sec
+ }, 10000);
});
diff --git a/home/tlimage.php b/home/tlimage.php
deleted file mode 100644
index 0119323..0000000
--- a/home/tlimage.php
+++ /dev/null
@@ -1,78 +0,0 @@
- 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);
-
-
-//$row['userid'] = "daichimarukn";
-
-$userid = htmlentities($_GET['account']);
-
-
-$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,
-);
-
-if( empty($userid) ) {
- $filePath = 'img/deficon/icon.png';
- $data = file_get_contents($filePath);
- header('Content-type: image/png');
- //データを出力
- echo $data;
- exit();
-}else{
- $dbh = new PDO('mysql:charset=UTF8;dbname='.DB_NAME.';host='.DB_HOST , DB_USER, DB_PASS, $option);
-
-
- $result = $dbh->prepare("SELECT iconname, iconcontent, icontype, iconsize profile FROM account WHERE userid = :userid");
-
- $result->bindValue(':userid', $userid);
- // SQL実行
- $result->execute();
-
-
- $row = $result->fetch(); // ここでデータベースから取得した値を $row に代入する
-
-
-
- header('Content-type: ' . $row['icontype']);
- echo $row['iconcontent'];
- exit();
-}
\ No newline at end of file
diff --git a/image.php b/image.php
deleted file mode 100644
index e40c66d..0000000
--- a/image.php
+++ /dev/null
@@ -1,77 +0,0 @@
- 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);
-
-
-//$row['userid'] = "daichimarukn";
-
-$userid = $_SESSION['userid'];
-
-
-$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,
-);
-
-if( empty($userid) ) {
- $filePath = 'img/deficon/icon.png';
- $data = file_get_contents($filePath);
- header('Content-type: image/png');
- //データを出力
- echo $data;
- exit();
-}else{
- $dbh = new PDO('mysql:charset=utf8mb4;dbname='.DB_NAME.';host='.DB_HOST , DB_USER, DB_PASS, $option);
-
-
- $result = $dbh->prepare("SELECT iconname, iconcontent, icontype, iconsize profile FROM account WHERE userid = :userid");
-
- $result->bindValue(':userid', $userid);
- // SQL実行
- $result->execute();
-
-
- $row = $result->fetch(); // ここでデータベースから取得した値を $row に代入する
-
-
-
- header('Content-type: ' . $row['icontype']);
- echo $row['iconcontent'];
- exit();
-}
\ No newline at end of file
diff --git a/logout/index.php b/logout/index.php
index 94d824d..e261dea 100644
--- a/logout/index.php
+++ b/logout/index.php
@@ -19,7 +19,6 @@ if (isset($_SERVER['HTTP_COOKIE'])) {
setcookie($name, '', time()-1000, '/user');
}
}
-session_destroy();
?>
diff --git a/new.php b/new.php
index 9d73d5e..d87d319 100644
--- a/new.php
+++ b/new.php
@@ -124,27 +124,89 @@ if( !empty($_POST['btn_submit']) ) {
setcookie("profile",$profile,time()+60*60*24*14);
- if (!empty($_FILES['image']['name'])) {
- $img = $_FILES['image'];
- }else{
- $localFilePath = 'img/deficon/icon.png';
- $img = [
- 'name' => 'deficon.png',
- 'type' => 'image/png', // 仮の Content-Type を指定(必要に応じて適切なものに変更してください)
- 'tmp_name' => $localFilePath,
- 'error' => 0,
- 'size' => filesize($localFilePath)
- ];
- }
+ //----------------[icon image]-------------------------------
+ if (empty($_FILES['image']['name'])) {
+ $localFilePathhead = 'img/deficon/icon.png';
+
+ // 新しいファイル名を生成(uniqid + 拡張子)
+ $newFilename = uniqid() . '-'.$userid.'.png';
+
+ // 保存先のパスを生成
+ $uploadedPath = 'usericons/' . $newFilename;
+
+ // ファイルを移動
+ $result = copy($localFilePathhead, $uploadedPath);
+
+ if ($result) {
+ $iconName = $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[] = 'アップロード失敗!(1)エラーコード:' .$uploadedFile['error'].'';
+ }
+ } else {
+ // アップロードされたファイル情報
+ $uploadedFile = $_FILES['image'];
+
+ // アップロードされたファイルの拡張子を取得
+ $extension = pathinfo($uploadedFile['name'], PATHINFO_EXTENSION);
+
+ // 新しいファイル名を生成(uniqid + 拡張子)
+ $newFilename = uniqid() . '-'.$userid.'.' . $extension;
+
+ // 保存先のパスを生成
+ $uploadedPath = 'usericons/' . $newFilename;
+
+ // ファイルを移動
+ $result = move_uploaded_file($uploadedFile['tmp_name'], $uploadedPath);
+
+ if ($result) {
+ $iconName = $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[] = 'アップロード失敗!(1)エラーコード:' .$uploadedFile['error'].'';
+ }
+ }
+
+ //----------------[header image]-------------------------------
$localFilePathhead = 'img/defhead/head.png';
- $headimg = [
- 'name' => 'defhead.png',
- 'type' => 'image/png', // 仮の Content-Type を指定(必要に応じて適切なものに変更してください)
- 'tmp_name' => $localFilePathhead,
- 'error' => 0,
- 'size' => filesize($localFilePathhead)
- ];
+
+ // 新しいファイル名を生成(uniqid + 拡張子)
+ $newFilename = uniqid() . '-'.$userid.'.png';
+
+ // 保存先のパスを生成
+ $uploadedPath = 'userheads/' . $newFilename;
+
+ // ファイルを移動
+ $result = copy($localFilePathhead, $uploadedPath);
+
+ if ($result) {
+ $headName = $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)エラーコード:' .$uploadedFile['error'].'';
+ }
@@ -213,6 +275,15 @@ if( !empty($_POST['btn_submit']) ) {
if($userid === 'uwuzu_official'){
$error_message[] = 'そのIDは登録禁止になっています。';
}
+ if($userid === 'uwuzu'){
+ $error_message[] = 'そのIDは登録禁止になっています。';
+ }
+ if($userid === 'admin'){
+ $error_message[] = 'そのIDは登録禁止になっています。';
+ }
+ if($userid === 'root'){
+ $error_message[] = 'そのIDは登録禁止になっています。';
+ }
if($result > 0){
$error_message[] = 'このID('.$userid.')は既に使用されています。他のIDを作成してください。'; //このE-mailは既に使用されています。
@@ -329,30 +400,13 @@ if( !empty($_POST['btn_submit']) ) {
$loginid = sha1(uniqid(mt_rand(), true));
// SQL作成
- $stmt = $pdo->prepare("INSERT INTO account (username, userid, password, loginid, mailadds, profile, iconname, iconcontent, icontype, iconsize, headname, headcontent, headtype, headsize, role, datetime, admin) VALUES (:username, :userid, :password, :loginid, :mailadds, :profile, :iconname, :iconcontent, :icontype, :iconsize, :headname, :headcontent, :headtype, :headsize, :role, :datetime, :admin )");
+ $stmt = $pdo->prepare("INSERT INTO account (username, userid, password, loginid, mailadds, profile, iconname, headname, role, datetime, admin) VALUES (:username, :userid, :password, :loginid, :mailadds, :profile, :iconname, :headname, :role, :datetime, :admin )");
- $iconName = $img['name'];
- $iconType = $img['type'];
- $iconContent = file_get_contents($img['tmp_name']);
- $iconSize = $img['size'];
-
- // アイコン画像のバインド
+ // アイコン画像
$stmt->bindValue(':iconname', $iconName, PDO::PARAM_STR);
- $stmt->bindValue(':icontype', $iconType, PDO::PARAM_STR);
- $stmt->bindValue(':iconcontent', $iconContent, PDO::PARAM_STR);
- $stmt->bindValue(':iconsize', $iconSize, PDO::PARAM_INT);
- // ヘッダー画像関連の処理
- $headName = $headimg['name'];
- $headType = $headimg['type'];
- $headContent = file_get_contents($headimg['tmp_name']);
- $headSize = $headimg['size'];
-
- // ヘッダー画像のバインド
+ // ヘッダー画像
$stmt->bindValue(':headname', $headName, PDO::PARAM_STR);
- $stmt->bindValue(':headtype', $headType, PDO::PARAM_STR);
- $stmt->bindValue(':headcontent', $headContent, PDO::PARAM_STR);
- $stmt->bindValue(':headsize', $headSize, PDO::PARAM_INT);
// 他の値をセット
$stmt->bindParam(':username', $username, PDO::PARAM_STR);
@@ -456,7 +510,7 @@ $pdo = null;
-

+
', $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', '
', $markdownText);
+
+ // 空行の前に何もない行をHTMLのpタグに変換
+ $markdownText = preg_replace('/(^\s*)(?!\s)(.*)/m', '$1
$2
', $markdownText);
+
+ return $markdownText;
+}
+
+// ユーズ内の絵文字を画像に置き換える
+function replaceEmojisWithImages($postText) {
+ // ユーズ内で絵文字名(:emoji:)を検出して画像に置き換える
+ $emojiPattern = '/:(\w+):/';
+ $postTextWithImages = preg_replace_callback($emojiPattern, function($matches) {
+ $emojiName = $matches[1];
+ return "
 . ")
";
+ }, $postText);
+
+ // @username を検出してリンクに置き換える
+ $usernamePattern = '/@(\w+)/';
+ $postTextWithImagesAndUsernames = preg_replace_callback($usernamePattern, function($matches) {
+ $username = $matches[1];
+
+ $dbh = new PDO('mysql:charset=utf8mb4;dbname='.DB_NAME.';host='.DB_HOST, DB_USER, DB_PASS, array(
+ PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
+ PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
+ PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => true,
+ ));
+
+ $mentionsuserQuery = $dbh->prepare("SELECT username, userid FROM account WHERE userid = :userid");
+ $mentionsuserQuery->bindValue(':userid', $username);
+ $mentionsuserQuery->execute();
+ $mentionsuserData = $mentionsuserQuery->fetch();
+
+ if(empty($mentionsuserData)){
+ return "@$username";
+ }else{
+ return "
@".$mentionsuserData["username"]."";
+ }
+ }, $postTextWithImages);
+
+ return $postTextWithImagesAndUsernames;
+}
+
+function replaceURLsWithLinks($postText) {
+ // URLを正規表現を使って検出
+ $pattern = '/(https?:\/\/[^\s]+)/';
+ preg_match_all($pattern, $postText, $matches);
+
+ // 検出したURLごとに処理を行う
+ foreach ($matches[0] as $url) {
+ // ドメイン部分を抽出
+ $parsedUrl = parse_url($url);
+ $domain = isset($parsedUrl['host']) ? $parsedUrl['host'] : '';
+
+ // ドメインのみを表示するaタグを生成
+ $link = "
$domain";
+
+ // URLをドメインのみを表示するaタグで置き換え
+ $postText = str_replace($url, $link, $postText);
+ }
+
+ return $postText;
+}
+
class MessageDisplay {
private $value;
private $userid;
@@ -10,6 +86,7 @@ class MessageDisplay {
}
public function display() {
+
if (empty($this->value)) {
echo '
';
} else {
@@ -19,7 +96,7 @@ class MessageDisplay {
}
echo '
';
- echo '
 . ')
';
+ echo '
 . ')
';
echo '
' . htmlentities($this->value['username']) . '';
echo '
';
- echo '
' . replaceEmojisWithImages(replaceURLsWithLinks(nl2br($this->value['ueuse']))) . '
';
+ echo '
' . processMarkdownAndWrapEmptyLines(replaceEmojisWithImages(replaceURLsWithLinks(nl2br($this->value['ueuse'])))) . '
';
if (!empty($this->value['photo2']) && $this->value['photo2'] !== 'none') {
echo '
';
diff --git a/others/index.php b/others/index.php
index fd1dcb5..ddb5340 100644
--- a/others/index.php
+++ b/others/index.php
@@ -177,6 +177,30 @@ if( !empty($_POST['btn_submit']) ) {
unlink($file2); // ファイルを削除
}
}
+
+ $folderPath3 = "../usericons/"; // フォルダのパス
+
+ // 指定したフォルダ内でユーザーIDを含むファイルを検索
+ $filesToDelete3 = glob($folderPath3 . "*-$userId.*"); // 「-ユーザーID.拡張子」というパターンを検索
+
+ // ファイルを順に削除
+ foreach ($filesToDelete3 as $file3) {
+ if (is_file($file3)) {
+ unlink($file3); // ファイルを削除
+ }
+ }
+
+ $folderPath4 = "../userheads/"; // フォルダのパス
+
+ // 指定したフォルダ内でユーザーIDを含むファイルを検索
+ $filesToDelete4 = glob($folderPath4 . "*-$userId.*"); // 「-ユーザーID.拡張子」というパターンを検索
+
+ // ファイルを順に削除
+ foreach ($filesToDelete4 as $file4) {
+ if (is_file($file4)) {
+ unlink($file4); // ファイルを削除
+ }
+ }
try {
@@ -422,9 +446,6 @@ require('../logout/logout.php');
https://[ドメイン名(uwuzu.netなど)]/api/ltl-api?limit=[取得件数]&page=[ページ切り替え]
これにより投稿内容(ueuse)と、ユーザーネーム(user_name)、ユーザーID(userid)、投稿ID(uniqid)、写真・動画URL(photo1,photo2,video1)、いいねした人一覧(favorite)、いいね数(favorite_cnt)、投稿日時(datetime)、追記内容(abi)、追記日時(abidatetime)が取得できます。
page=は指定しなくても動作します。(https://[ドメイン名(uwuzu.netなど)]/api/ltl-api?limit=[取得件数])
-
ローカルタイムライン投稿取得API
-
https://[ドメイン名(uwuzu.netなど)]/api/ltl-api?limit=[取得件数]&page=[ページ切り替え]
-
投稿API
https://[ドメイン名(uwuzu.netなど)]/api/bot-api?token=[アクセストークン]&ueuse=[投稿の内容]
diff --git a/server/uwuzuabout.txt b/server/uwuzuabout.txt
index 8ee62bd..eb5022d 100644
--- a/server/uwuzuabout.txt
+++ b/server/uwuzuabout.txt
@@ -25,7 +25,7 @@ daichimarukana < 「うぃずゆー(With you)」「うぃじゅー(witzou)」「
## 4. 開発言語は?
uwuzuはPHPとJS、HTML(プログラミング言語じゃないか)、CSSで作られています!
-ライブラリはjQueryを導入しています!
+ライブラリはjQuery、Reactを導入しています!
## 5. サーバーの建て方
※MySQLの設定結構めんどいです。
@@ -42,14 +42,8 @@ uwuzuはPHPとJS、HTML(プログラミング言語じゃないか)、CSSで作
- loginid(varchar(256)) 自動ログイン時に本人アカウントか確認
- mailadds(varchar(500)) メールアドレス保存用
- profile(TEXT) プロフィールテキスト保存用
-- iconname(varchar(256)) アイコン画像名保存用
-- iconcontent(mediumblob) アイコン画像保存用
-- icontype(varchar(256)) アイコン画像拡張子保存用
-- iconsize(INT) アイコン画像サイズ保存用
-- headname(varchar(256)) ヘッダー画像名保存用
-- headcontent(mediumblob) ヘッダー画像保存用
-- headtype(varchar(256)) ヘッダー画像拡張子保存用
-- headsize(INT) ヘッダー画像サイズ保存用
+- iconname(varchar(256)) アイコン画像リンク保存用
+- headname(varchar(256)) ヘッダー画像リンク保存用
- role(varchar(1024)) 「user」のようなロール保存用
- datetime(datetime) アカウント作成日時保存用
- follow(text) アカウントがフォローしている人保存用
diff --git a/server/uwuzuinfo.txt b/server/uwuzuinfo.txt
index 8384445..429e4a1 100644
--- a/server/uwuzuinfo.txt
+++ b/server/uwuzuinfo.txt
@@ -1,4 +1,4 @@
uwuzu
-1.2.10
-2023/08/23
+1.2.11
+2023/08/25
daichimarukana,putonfps
\ No newline at end of file
diff --git a/server/uwuzurelease.txt b/server/uwuzurelease.txt
index 9ca1331..ce06a31 100644
--- a/server/uwuzurelease.txt
+++ b/server/uwuzurelease.txt
@@ -1,6 +1,14 @@
## リリースノートだぜぇぇぇぇぇぇい!!!!!!!
ここにはuwuzuの更新情報を載せてくぜぇ~!(いやまてテンションおかしいだろ...)
+## Version 1.2.11
+リリース日:2023/08/25
+モバイル向けUIを変更しました。
+Markdown記法に一部対応しました。
+メンション機能を追加しました。
+アイコン・ヘッダーのファイルの保存形式を変更することにより動作を軽くしました!
+※アイコン・ヘッダーはアカウント削除まで内部保存が次々されていきます。上書きはされません。
+
## Version 1.2.10
リリース日:2023/08/23
モバイル向けUIを変更しました。
diff --git a/settings/index.php b/settings/index.php
index 3867007..f6f04d9 100644
--- a/settings/index.php
+++ b/settings/index.php
@@ -410,7 +410,34 @@ if( !empty($_POST['logout']) ) {
if( !empty($_POST['img1btn_submit']) ) {
if (!empty($_FILES['image2s']['name'])) {
- $headimg = $_FILES['image2s'];
+ // アップロードされたファイル情報
+ $uploadedFile = $_FILES['image2s'];
+
+ // アップロードされたファイルの拡張子を取得
+ $extension = pathinfo($uploadedFile['name'], PATHINFO_EXTENSION);
+
+ // 新しいファイル名を生成(uniqid + 拡張子)
+ $newFilename = uniqid() . '-'.$userid.'.' . $extension;
+
+ // 保存先のパスを生成
+ $uploadedPath = 'userheads/' . $newFilename;
+
+ // ファイルを移動
+ $result = move_uploaded_file($uploadedFile['tmp_name'], '../'.$uploadedPath);
+
+ if ($result) {
+ $headName = $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[] = 'ヘッダー画像を選択してください';
}
@@ -444,19 +471,10 @@ if( !empty($_POST['img1btn_submit']) ) {
try {
// SQL作成
- $stmt = $pdo->prepare("UPDATE account SET headname = :headname, headtype = :headtype, headcontent = :headcontent, headsize = :headsize WHERE userid = :userid");
-
- // ヘッダー画像関連の処理
- $headName = $headimg['name'];
- $headType = $headimg['type'];
- $headContent = file_get_contents($headimg['tmp_name']);
- $headSize = $headimg['size'];
+ $stmt = $pdo->prepare("UPDATE account SET headname = :headname WHERE userid = :userid");
// ヘッダー画像のバインド
$stmt->bindValue(':headname', $headName, PDO::PARAM_STR);
- $stmt->bindValue(':headtype', $headType, PDO::PARAM_STR);
- $stmt->bindValue(':headcontent', $headContent, PDO::PARAM_STR);
- $stmt->bindValue(':headsize', $headSize, PDO::PARAM_INT);
// ユーザーIDのバインド(WHERE句に必要)
$stmt->bindValue(':userid', $userid, PDO::PARAM_STR);
@@ -491,7 +509,34 @@ if( !empty($_POST['img1btn_submit']) ) {
if( !empty($_POST['img2btn_submit']) ) {
if (!empty($_FILES['image']['name'])) {
- $img = $_FILES['image'];
+ // アップロードされたファイル情報
+ $uploadedFile = $_FILES['image'];
+
+ // アップロードされたファイルの拡張子を取得
+ $extension = pathinfo($uploadedFile['name'], PATHINFO_EXTENSION);
+
+ // 新しいファイル名を生成(uniqid + 拡張子)
+ $newFilename = uniqid() . '-'.$userid.'.' . $extension;
+
+ // 保存先のパスを生成
+ $uploadedPath = 'usericons/' . $newFilename;
+
+ // ファイルを移動
+ $result = move_uploaded_file($uploadedFile['tmp_name'], '../'.$uploadedPath);
+
+ if ($result) {
+ $iconName = $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[] = 'アイコン画像を選択してください';
}
@@ -526,18 +571,10 @@ if( !empty($_POST['img2btn_submit']) ) {
try {
// SQL作成
- $stmt = $pdo->prepare("UPDATE account SET iconname = :iconname, icontype = :icontype, iconcontent = :iconcontent, iconsize = :iconsize WHERE userid = :userid");
-
- $iconName = $img['name'];
- $iconType = $img['type'];
- $iconContent = file_get_contents($img['tmp_name']);
- $iconSize = $img['size'];
+ $stmt = $pdo->prepare("UPDATE account SET iconname = :iconname WHERE userid = :userid");
// アイコン画像のバインド
$stmt->bindValue(':iconname', $iconName, PDO::PARAM_STR);
- $stmt->bindValue(':icontype', $iconType, PDO::PARAM_STR);
- $stmt->bindValue(':iconcontent', $iconContent, PDO::PARAM_STR);
- $stmt->bindValue(':iconsize', $iconSize, PDO::PARAM_INT);
// ユーザーIDのバインド(WHERE句に必要)
$stmt->bindValue(':userid', $userid, PDO::PARAM_STR);
@@ -654,11 +691,11 @@ $pdo = null;