|
|
|
@ -1,4 +1,16 @@
|
|
|
|
|
<?php
|
|
|
|
|
$lang = isset($_COOKIE['lang']) ? $_COOKIE['lang'] : 'ja';
|
|
|
|
|
|
|
|
|
|
if (isset($_POST['langchange'])) {
|
|
|
|
|
$lang = null !== $_COOKIE['lang'] && $_COOKIE['lang'] == 'en' ? 'ja' : 'en';
|
|
|
|
|
setcookie('lang', $lang);
|
|
|
|
|
unset($_POST['langchange']);
|
|
|
|
|
header('Location: /');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
include('../lang/'.$lang.'.php');
|
|
|
|
|
include('../config.php');
|
|
|
|
|
|
|
|
|
|
$err = '';
|
|
|
|
|
$exists = [];
|
|
|
|
|
$url = '';
|
|
|
|
@ -31,7 +43,7 @@
|
|
|
|
|
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 ['code' => 0, 'err' => LOC_ERROR_HOZON_NI_SIPPAI];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return ['code' => 1, 'url' => $url.'/'.geturl()];
|
|
|
|
@ -75,7 +87,7 @@
|
|
|
|
|
$file = striptags($file); // 危険なタグの削除
|
|
|
|
|
|
|
|
|
|
// ヘッダーの追加
|
|
|
|
|
$file = "<!DOCTYPE html><html><head><meta charset=\"utf-8\" /><head><body><div style=\"background-color: #320202 !important; display: block !important; border: 4px #ff3b3b groove !important; color: #ea8181 !important; padding: 10px !important; z-index: 999999 !important; position: fixed !important; left: 0 !important; top: 0 !important; font-size: 14px !important; font-family: unset !important; width: 100% !important;\">保存サイトでアーカイブしました。Archived with Hozon Site.<br /><a style=\"color: #ffeb3b !important;\" href=\"/\">トップページへ</a></div><div style=\"padding-top: 74px !important;\">".$file.'</div></body></html>';
|
|
|
|
|
$file = "<!DOCTYPE html><html><head><meta charset=\"utf-8\" /><head><body><div style=\"background-color: #320202 !important; display: block !important; border: 4px #ff3b3b groove !important; color: #ea8181 !important; padding: 10px !important; z-index: 999999 !important; position: fixed !important; left: 0 !important; top: 0 !important; font-size: 14px !important; font-family: unset !important; width: 100% !important;\">保存サイトでアーカイブしました。Archived with Hozon Site.<br /><a style=\"color: #ffeb3b !important;\" href=\"/\">トップページへ To toppage</a></div><div style=\"padding-top: 74px !important;\">".$file.'</div></body></html>';
|
|
|
|
|
|
|
|
|
|
// 保存
|
|
|
|
|
file_put_contents(urldecode($path), $file);
|
|
|
|
@ -84,7 +96,7 @@
|
|
|
|
|
if (count($_POST) > 0) {
|
|
|
|
|
// HTTPかHTTPSじゃない場合
|
|
|
|
|
if (!str_starts_with($_POST['hozonsite'], 'https://') && !str_starts_with($_POST['hozonsite'], 'http://')) {
|
|
|
|
|
$err = 'URLは「http://」又は「https://」で始めます。';
|
|
|
|
|
$err = LOC_ERROR_URL_HTTP_HTTPS;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
$url = geturl();
|
|
|
|
@ -101,7 +113,7 @@
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (count($exists) == 0 || (count($exists) > 0 && isset($_POST['agree']))) {
|
|
|
|
|
if (!mkdir('./'.$fullurl, 0755, true)) die('エラー'); // ダイレクトリーを作成出来なければ、死ね
|
|
|
|
|
if (!mkdir('./'.$fullurl, 0755, true)) die(LOC_ERROR_KYOKA); // ダイレクトリーを作成出来なければ、死ね
|
|
|
|
|
$url = archiving('./'.$fullurl); // ウエブページのダウンロード
|
|
|
|
|
if ($url['code'] == 0) {
|
|
|
|
|
$err = $url['err'];
|
|
|
|
@ -122,53 +134,55 @@
|
|
|
|
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja">
|
|
|
|
|
<head>
|
|
|
|
|
<meta content="text/html; charset=utf-8" http-equiv="content-type" />
|
|
|
|
|
<meta name="title" content="保存サイト || Hozon Site" />
|
|
|
|
|
<meta name="description" content="世界初FOSS系ウエブアーカイバーです。 || World's First FOSS Web Archiver" />
|
|
|
|
|
<meta name="title" content="<?php echo $lang == 'en' ? SITE_NAME_EN : SITE_NAME_JA ?>" />
|
|
|
|
|
<meta name="description" content="<?php echo $lang == 'en' ? SITE_DESC_EN : SITE_DESC_JA?>" />
|
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
|
|
|
<title>保存サイト</title>
|
|
|
|
|
<title><?php echo $lang == 'en' ? SITE_NAME_EN : SITE_NAME_JA ?></title>
|
|
|
|
|
<link rel="stylesheet" type="text/css" href="/style.css" />
|
|
|
|
|
</head>
|
|
|
|
|
<body>
|
|
|
|
|
<?php if ($err != '') { ?><div class="error"><?php echo $err; ?></div> <?php } ?>
|
|
|
|
|
<h1><img class="headerimg" src="/logo.jpg" alt="ロゴ" /></h1>
|
|
|
|
|
<h1><img class="headerimg" src="/logo.jpg" alt="<?php echo LOC_LOGO; ?>" /></h1>
|
|
|
|
|
<div class="body">
|
|
|
|
|
<p>
|
|
|
|
|
<a href="/">トップ</a> |
|
|
|
|
|
β版です。<a href="https://gitler.moe/TechnicalSuwako/hozon.site/issues">バグの報告はこちらです。</a>
|
|
|
|
|
<a href="/"><?php echo LOC_TOP; ?></a> |
|
|
|
|
|
<?php echo LOC_BETA_BAN1; ?><a href="https://gitler.moe/TechnicalSuwako/hozon.site/issues"><?php echo LOC_BETA_BAN2; ?></a>
|
|
|
|
|
</p>
|
|
|
|
|
<form method="post" action="/">
|
|
|
|
|
<div class="submit">
|
|
|
|
|
<input class="langchange" type="submit" name="langchange" value="<?php echo $lang == 'en' ? '日本語に更新' : 'Change to English'; ?>" />
|
|
|
|
|
</div>
|
|
|
|
|
</form>
|
|
|
|
|
<hr />
|
|
|
|
|
<div class="central">
|
|
|
|
|
<?php
|
|
|
|
|
if (count($_POST) > 0 && count($exists) > 0) {
|
|
|
|
|
?>
|
|
|
|
|
<h3><?php echo $url; ?></h3>
|
|
|
|
|
既に保存されたページ:<br />
|
|
|
|
|
<?php echo LOC_SUDENI_HOZONSARETA_PAGE; ?><br />
|
|
|
|
|
<?php
|
|
|
|
|
foreach ($exists as $e) {
|
|
|
|
|
echo '<a href="/archive/'.$e.'/'.$url.'">'.date('Y年m月d日 H:i:s', $e).'</a>';
|
|
|
|
|
echo "<br />";
|
|
|
|
|
}
|
|
|
|
|
?>
|
|
|
|
|
<p>
|
|
|
|
|
このページが既に保存されているみたいです。<br />
|
|
|
|
|
本当に手続きましょうか?
|
|
|
|
|
</p>
|
|
|
|
|
<p><?php echo LOC_HONTONI_TETUDUKI; ?></p>
|
|
|
|
|
<form action="/" method="post">
|
|
|
|
|
<input type="hidden" name="hozonsite" value="<?php echo $_POST['hozonsite']; ?>" />
|
|
|
|
|
<input type="hidden" name="agree" value="1" />
|
|
|
|
|
<div class="submit">
|
|
|
|
|
<input type="submit" name="submit" value="はい、保存して下さい!!" />
|
|
|
|
|
<input type="submit" name="submit" value="<?php echo LOC_HAI_HOZONSITEKUDASAI; ?>" />
|
|
|
|
|
</div>
|
|
|
|
|
</form>
|
|
|
|
|
<?php
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
?>
|
|
|
|
|
どのページを保存しますか?
|
|
|
|
|
<?php echo LOC_DONO_PAGE_HOZON; ?>
|
|
|
|
|
<form action="/" method="post">
|
|
|
|
|
<input type="text" name="hozonsite" value="" />
|
|
|
|
|
<div class="submit">
|
|
|
|
|
<input type="submit" name="submit" value="保存" />
|
|
|
|
|
<input type="submit" name="submit" value="<?php echo LOC_HOZON; ?>" />
|
|
|
|
|
</div>
|
|
|
|
|
</form>
|
|
|
|
|
<?php
|
|
|
|
@ -177,7 +191,7 @@
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="submit">
|
|
|
|
|
<a href="https://gitler.moe/TechnicalSuwako/hozon.site"><img src="/git.png" alt="ソースコード" /></a> | <a href="https://076.moe">匿名自営業076</a>
|
|
|
|
|
<a href="https://gitler.moe/TechnicalSuwako/hozon.site"><img src="/git.png" alt="<?php echo LOC_SOURCE_CODE; ?>" /></a> | <a href="https://076.moe"><?php echo LOC_076_AIB; ?></a>
|
|
|
|
|
</div>
|
|
|
|
|
</body>
|
|
|
|
|
</html>
|
|
|
|
|