diff --git a/function/function.php b/function/function.php index cd3ce8e..9c0711b 100644 --- a/function/function.php +++ b/function/function.php @@ -1394,20 +1394,26 @@ function val_OtherSettings($dataname, $jsontext){ //ユーザーのOther_Settings追加関数 function val_AddOtherSettings($dataname, $data, $jsontext){ $other_settings = json_decode($jsontext, true); - if(isset($dataname) && isset($data) && isset($jsontext)) { - if(is_bool($data) === true){ - $new_data = [$dataname=>$data]; - $ret = json_encode(array_merge($other_settings,$new_data)); - }elseif(is_int($data) === true){ - $new_data = [$dataname=>(int)$data]; - $ret = json_encode(array_merge($other_settings,$new_data)); - }elseif(is_string($data)){ - $new_data = [$dataname=>$data]; - $ret = json_encode(array_merge($other_settings,$new_data)); - } + if(empty($other_settings)){ + $new_data = [$dataname=>$data]; + $ret = json_encode($new_data); }else{ - $ret = false; + if(isset($dataname) && isset($data) && isset($jsontext)) { + if(is_bool($data) === true){ + $new_data = [$dataname=>$data]; + $ret = json_encode(array_merge($other_settings,$new_data)); + }elseif(is_int($data) === true){ + $new_data = [$dataname=>(int)$data]; + $ret = json_encode(array_merge($other_settings,$new_data)); + }elseif(is_string($data)){ + $new_data = [$dataname=>$data]; + $ret = json_encode(array_merge($other_settings,$new_data)); + } + }else{ + $ret = false; + } } + return $ret; } ?> \ No newline at end of file diff --git a/server/uwuzuinfo.txt b/server/uwuzuinfo.txt index 8bb6ecd..29f1579 100644 --- a/server/uwuzuinfo.txt +++ b/server/uwuzuinfo.txt @@ -1,4 +1,4 @@ uwuzu -1.4.7 +1.4.8 2024/11/14 daichimarukana,putonfps \ No newline at end of file diff --git a/server/uwuzurelease.txt b/server/uwuzurelease.txt index d3cedfb..8f3881d 100644 --- a/server/uwuzurelease.txt +++ b/server/uwuzurelease.txt @@ -1,6 +1,12 @@ ## リリースノートだぜぇぇぇぇぇぇい!!!!!!! ここにはuwuzuの更新情報を載せてくぜぇ~!(いやまてテンションおかしいだろ...) +## Version 1.4.8 (Funium) +2024/11/14 +fix: アップデート時にフォルダの階層が更新されない問題を修正しました!! +fix: 設定画面で重大なエラーが発生する問題を修正しました! +fix: 設定の保存ができない問題を修正しました! + ## Version 1.4.7 (Funium) 2024/11/14 fix: 未使用のライブラリのライセンス情報が表示されてしまう問題を修正しました。 diff --git a/settings/index.php b/settings/index.php index 1778fef..9d832cd 100644 --- a/settings/index.php +++ b/settings/index.php @@ -235,7 +235,12 @@ if( !empty($_POST['btn_submit']) ) { $mailadds = safetext($_POST['mailadds']); - $new_isAIBlock = safetext($_POST['isAIBlock']); + if( !empty($_POST['isAIBlock']) ) { + $new_isAIBlock = safetext($_POST['isAIBlock']); + }else{ + $new_isAIBlock = "false"; + } + if($new_isAIBlock === "true"){ $save_isAIBlock = true; }else{ @@ -243,7 +248,11 @@ if( !empty($_POST['btn_submit']) ) { } $other_settings_json = val_AddOtherSettings("isAIBlock", $save_isAIBlock, $userData["other_settings"]); - $new_isAIBMW = safetext($_POST['isAIBMW']); + if( !empty($_POST['isAIBMW']) ) { + $new_isAIBMW = safetext($_POST['isAIBMW']); + }else{ + $new_isAIBMW = "false"; + } if($new_isAIBMW === "true"){ $save_isAIBMW = true; }else{ diff --git a/settings_admin/update_admin.php b/settings_admin/update_admin.php index 57acf10..545abef 100644 --- a/settings_admin/update_admin.php +++ b/settings_admin/update_admin.php @@ -180,55 +180,63 @@ $notiData = $notiQuery->fetch(PDO::FETCH_ASSOC); $notificationcount = $notiData['notification_count']; -if( !empty($_POST['update_submit']) ) { - if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['extract_path'])) { - $extractPath = safetext($_POST['extract_path']); - - // JSONファイルの再読み込み - $jsonFile = $extractPath . '/update.json'; - if (file_exists($jsonFile)) { - $jsonData = json_decode(file_get_contents($jsonFile), true); - if (json_last_error() === JSON_ERROR_NONE) { - // 上書きファイルの処理 - if(!(empty($jsonData['files']['overwrite']))){ - foreach ($jsonData['files']['overwrite'] as $file) { - $sourceFile = $extractPath . '/' . $file; - $destinationFile = $_SERVER['DOCUMENT_ROOT'] . '/' . $file; - if (file_exists($sourceFile)) { - copy($sourceFile, $destinationFile); - }else{ - $error_message[] = "アップデート元のzipファイルに本来予定されていたファイルがありませんでしたが、アップデート作業は完了しました。(UPDATE_FILE_NOT_FOUND)"; - } - } - } - - // 削除ファイルの処理 - if(!(empty($jsonData['files']['delete']))){ - foreach ($jsonData['files']['delete'] as $file) { - $deleteFile = $_SERVER['DOCUMENT_ROOT'] . '/' . $file; - if (file_exists($deleteFile)) { - unlink($deleteFile); - }else{ - $error_message[] = "削除予定のファイルがありませんでしたが、アップデート作業は完了しました。(DELETE_FILE_NOT_FOUND)"; - } - } - } - } else { - $error_message[] = "update.jsonがうまく読み込めませんでした。(LOADING_ERROR)"; - } - } else { - $error_message[] = "update.jsonが見つかりませんでした。(LOADING_ERROR)"; - } +if (!empty($_POST['update_submit'])) { + if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['extract_path'])) { + $extractPath = safetext($_POST['extract_path']); + + // JSONファイルの再読み込み + $jsonFile = $extractPath . '/update.json'; + if (file_exists($jsonFile)) { + $jsonData = json_decode(file_get_contents($jsonFile), true); + if (json_last_error() === JSON_ERROR_NONE) { + // 上書きファイルの処理 + if (!(empty($jsonData['files']['overwrite']))) { + foreach ($jsonData['files']['overwrite'] as $file) { + $sourceFile = $extractPath . '/' . $file; + $destinationFile = $_SERVER['DOCUMENT_ROOT'] . '/' . $file; - if (file_exists($extractPath)) { - if (is_dir($extractPath)) { - deleteDirectory($extractPath); - } - } - } else { - $error_message[] = "不正なリクエストです。(BAD_REQUEST)"; - } + if (file_exists($sourceFile)) { + // ディレクトリが存在しない場合は作成 + $destinationDir = dirname($destinationFile); + if (!file_exists($destinationDir)) { + mkdir($destinationDir, 0775, true); + } + + copy($sourceFile, $destinationFile); + } else { + $error_message[] = "アップデート元のzipファイルに本来予定されていたファイルがありませんでしたが、アップデート作業は完了しました。(UPDATE_FILE_NOT_FOUND)"; + } + } + } + + // 削除ファイルの処理 + if (!(empty($jsonData['files']['delete']))) { + foreach ($jsonData['files']['delete'] as $file) { + $deleteFile = $_SERVER['DOCUMENT_ROOT'] . '/' . $file; + if (file_exists($deleteFile)) { + unlink($deleteFile); + } else { + $error_message[] = "削除予定のファイルがありませんでしたが、アップデート作業は完了しました。(DELETE_FILE_NOT_FOUND)"; + } + } + } + } else { + $error_message[] = "update.jsonがうまく読み込めませんでした。(LOADING_ERROR)"; + } + } else { + $error_message[] = "update.jsonが見つかりませんでした。(LOADING_ERROR)"; + } + + if (file_exists($extractPath)) { + if (is_dir($extractPath)) { + deleteDirectory($extractPath); + } + } + } else { + $error_message[] = "不正なリクエストです。(BAD_REQUEST)"; + } } + require('../logout/logout.php'); ?> diff --git a/update.json b/update.json index f8e9a74..808ade4 100644 --- a/update.json +++ b/update.json @@ -1,26 +1,14 @@ { "software": "uwuzu", - "version": "1.4.7", + "version": "1.4.8", "release_date": "2024-11-14", - "release_notes": "このアップデートではAI学習対策を中心に様々な新機能の追加がされています!\nまた、いくつかのバグ修正が含まれています!\nアップデートを推奨します!!", - "notices": "アップデートの前に、データベースの構造の更新をお忘れなく!\n合わせてデータのバックアップを行うことをおすすめします!", + "release_notes": "このアップデートでは設定画面で発生する重大なバグが修正されています。\n早急なアップデートを推奨します。", + "notices": "アップデートの前にデータのバックアップを行うことをおすすめします!", "files": { "overwrite": [ - "/abi/addabi.php", - "/actor/index.php", - "/css/home.css", - "/function/function.php", - "/function/reuse.php", - "/home/index.php", "/settings/index.php", - "/settings_admin/plugin_settings/aiblockwatermark_settings.php", - "/settings_admin/plugin_admin.php", - "/settings_admin/serveradmin.php", - "/ueuse/index.php", - "/user/followers/index.php", - "/user/following/index.php", - "/user/outbox/index.php", - "/user/index.php", + "/settings_admin/update_admin.php", + "/function/function.php", "/server/uwuzuabout.txt", "/server/uwuzuinfo.txt", "/server/uwuzurelease.txt"