[\s\S]+?\<\/div\>/', '', $text);
$allowed = [
'!doctype',
'a', 'abbr', 'acronym', 'address', 'applet', 'area', 'article', 'aside', /*'audio',*/
'b', 'base', 'basefont', 'bb', 'bdo', 'big', 'blockquote', 'body', 'br', 'button',
'canvas', 'caption', 'center', 'cite', 'code', 'col', 'colgroup', 'command',
'datagrid', 'datalist', 'dd', 'del', 'details', 'dfn', 'dialog', 'dir', 'div', 'dl', 'dt',
'em', 'embed', 'eventsource',
'fieldset', 'figcaption', 'figure', 'font', 'footer', 'form', 'frame', 'frameset',
'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', /*'html',*/
'i', /*'iframe',*/ 'img', 'input', 'ins', 'isindex', 'kbd', 'keygen',
'label', 'legend', 'li', 'link',
'map', 'mark', 'menu', 'meta', 'meter',
'nav', 'noframes', 'noscript',
'object', 'ol', 'optgroup', 'option', 'output',
'p', 'param', 'pre', 'progress',
'q',
'rp', 'rt', 'ruby',
's', 'samp', /*'script',*/ 'section', 'select', 'small', 'source', 'span', 'strike', 'strong', 'style', 'sub', 'sup',
'table', 'tbody', 'td', 'textarea', 'tfoot', 'th', 'thead', 'time', 'title', 'tr', 'track', 'tt',
'u', 'ul',
'var', /*'video',*/
'wbr'
];
return strip_tags($text, $allowed);
}
function sanitize_archive ($path) {
$file = file_get_contents(urldecode($path)); // ファイルの開く
$file = striptags($file); // 危険なタグの削除
// ヘッダーの追加
$file = "
保存サイトでアーカイブしました。Archived with Hozon Site.
トップページへ".$file.'
';
// 保存
file_put_contents(urldecode($path), $file);
}
if (count($_POST) > 0) {
// HTTPかHTTPSじゃない場合
if (!str_starts_with($_POST['hozonsite'], 'https://') && !str_starts_with($_POST['hozonsite'], 'http://')) {
$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.'*';
$fullurl = 'archive/'.time();
$exists = glob('archive/*/'.$url);
if ($exists) {
$tmp = [];
foreach ($exists as $k => $v) {
$tmp[$k] = explode('/', $v)[1];
}
$exists = $tmp;
unset($tmp);
}
if (count($exists) == 0 || (count($exists) > 0 && isset($_POST['agree']))) {
if (!mkdir('./'.$fullurl, 0755, true)) die('エラー'); // ダイレクトリーを作成出来なければ、死ね
$url = archiving('./'.$fullurl); // ウエブページのダウンロード
sanitize_archive($url); // 危険なタグの削除
header('Location: '.$url); // 移転
die();
}
}
}
?>
保存サイト
注意:JavsScriptはONです。安全・安心の為、JavaScriptをOFFにしてお願い致します。
保存サイト
トップ |
β版です。バグの報告はこちらです。
0 && count($exists) > 0) {
?>
既に保存されたページ:
'.date('Y年m月d日 H:i:s', $e).'';
echo "
";
}
?>
このページが既に保存されているみたいです。
本当に手続きましょうか?
どのページを保存しますか?