diff --git a/www/index.php b/www/index.php index 8e77280..fe7c892 100644 --- a/www/index.php +++ b/www/index.php @@ -9,10 +9,13 @@ $ex = explode('/', parse_url($_POST['hozonsite'])['path']); $ex = $ex[array_key_last($ex)]; + if (null !== parse_url($_POST['hozonsite'])['query']) $ex .= '@'.parse_url($_POST['hozonsite'])['query']; if ($ex == '') $ex = 'index.html'; $basename = isset(parse_url($_POST['hozonsite'])['path']) ? $ex : 'index.html'; unset($ex); $ex = explode('/', $p); + $ex[array_key_last($ex)] = str_replace('?', '@', $ex[array_key_last($ex)]); + $ex[array_key_last($ex)] = parse_url($ex[array_key_last($ex)])['path']; if ($ex[array_key_last($ex)] == $basename) { unset($ex[array_key_last($ex)]); @@ -25,10 +28,13 @@ return $p.'/'.$basename; } - function archiving (string $url): string { - system("cd ".$url." && wget -LpExk --no-check-certificate --max-redirect=3 --default-page=index.html --reject js,json,mp4,mov,mkv,mp3,ogg,ogv ".$_POST['hozonsite']); + function archiving (string $url): array { + system("cd ".$url." && wget -LpExk --no-check-certificate --restrict-file-names=windows --max-redirect=3 --default-page=index.html --reject js,json,mp4,mov,mkv,mp3,ogg,ogv ".$_POST['hozonsite']); + if (count(array_diff(scandir($url), array('..', '.'))) == 0) { + return ['code' => 0, 'err' => '保存に失敗しました。']; + } - return $url.'/'.geturl(); + return ['code' => 1, 'url' => $url.'/'.geturl()]; } function striptags (string $text): string { @@ -69,7 +75,7 @@ $file = striptags($file); // 危険なタグの削除 // ヘッダーの追加 - $file = "