From c70f0e7a4ce1c4ed6de49a5aec35f4b02456908d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=83=86=E3=82=AF=E3=83=8B=E3=82=AB=E3=83=AB=E8=AB=8F?= =?UTF-8?q?=E8=A8=AA=E5=AD=90?= Date: Thu, 11 Aug 2022 21:42:21 +0900 Subject: [PATCH] =?UTF-8?q?=E6=97=A2=E3=81=AB=E4=BF=9D=E5=AD=98=E3=81=95?= =?UTF-8?q?=E3=82=8C=E3=81=9F=E3=83=9A=E3=83=BC=E3=82=B8=E3=81=AEURL?= =?UTF-8?q?=E3=81=AE=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- www/index.php | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/www/index.php b/www/index.php index e5a73f8..c4c8988 100644 --- a/www/index.php +++ b/www/index.php @@ -3,12 +3,10 @@ $exists = []; $url = ''; - function archiving ($url) { + function geturl (): string { $p = str_replace('https://', '', $_POST['hozonsite']); $p = str_replace('http://', '', $p); - 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']); - $ex = explode('/', parse_url($_POST['hozonsite'])['path']); $ex = $ex[array_key_last($ex)]; if ($ex == '') $ex = 'index.html'; @@ -24,7 +22,13 @@ unset($ex); $basename .= (!str_ends_with($basename, '.html') && !str_ends_with($basename, '.htm') && !str_ends_with($basename, '.xhtml') ? '.html' : ''); - return $url.'/'.$p.'/'.$basename; + 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']); + + return $url.'/'.geturl(); } function striptags (string $text): string { @@ -77,17 +81,7 @@ $err = 'URLは「http://」又は「https://」で始めます。'; } else { - $url = str_replace('https://', '', $_POST['hozonsite']); - $url = str_replace('http://', '', $url); - if ( - !str_ends_with($url, '.html') && - !str_ends_with($url, '\/') && - !str_ends_with($url, '.htm') && - !str_ends_with($url, '.xhtml') && - !str_ends_with($url, '.php') && - !str_ends_with($url, '.asp') && - !str_ends_with($url, '.aspx') - ) $url = $url.'*'; + $url = geturl(); $fullurl = 'archive/'.time(); $exists = glob('archive/*/'.$url);