'ふたばmay',
'https://img.2chan.net/b/' => 'ふたばimg',
'https://nijiurachan.net/' => 'あいもげ',
);
$config['keyword_list'] = array(
'フィギュア',
'模型',
);
# ---- 設定ここまで ----
chdir(__DIR__);
@include_once 'instance-config.php';
# @include_once 'testdata.php';
/**
* utf8でメールを送信します。
*
* さくらインターネットだとsendmailコマンドによって送るメールには
* 各種署名と認証がつく。
* phpのmail関数は内部でsendmailを呼ぶため署名と認証を期待できる。
*/
function sendmail_utf8($to, $subject, $msg) {
function bw($text) {
return '=?UTF-8?B?'.base64_encode($text).'?=';
};
function bo($text) {
return base64_encode($text);
};
$sender_name = basename(__FILE__);
$sender_name_en = bw($sender_name);
$subject_en = bw($subject);
$msg_en = bo(str_replace(PHP_EOL, "\r\n", $msg));
return mail($to, $subject_en, $msg_en, array(
'From' => $sender_name_en.'<'.$to.'>',
'X-Mailer' => 'sendmail_utf8_on_php',
'MIME-Version' => '1.0',
'Content-Transfer-Encoding' => 'base64',
'Content-Type' => 'text/plain; charset=UTF-8'
));
};
# polyfil for PHP versions < 8.4
if ( ! function_exists("http_get_last_response_headers") ) {
function http_get_last_response_headers() {
if ( ! isset($http_response_header) ) {
return null;
};
return $http_response_header;
};
};
$undefined_array_key_to_error = function($errno, $errstr, $errfile, $errline) {
if (strpos($errstr, 'Undefined array key') !== false) {
throw new \ErrorException($errstr, $errno, 0, $errfile, $errline);
}
return false;
};
# ふたば用
function encode_for_url($k) {
global $config;
$co = mb_convert_encoding($k, $config['futaba_remote_coding']);
return urlencode($co);
};
# ふたば用
function decode_from_remote($k) {
global $config;
return mb_convert_encoding($k, 'UTF-8', $config['futaba_remote_coding']);
};
function futaba_pick_json($html) {
$json = $html;
$part = '