/** * ファイルをダウンロード保存する */ public static function fileDownload($url, $localfile, $disp_error = true, $trace_redirection = false) { global $_conf; $perm = isset($_conf['dl_perm']) ? $_conf['dl_perm'] : 0606; if (file_exists($localfile)) { $modified = http_date(filemtime($localfile)); } else { $modified = false; } // DL $wap_ua = new WapUserAgent(); $wap_ua->setTimeout($_conf['http_conn_timeout'], $_conf['http_read_timeout']); $wap_ua->setAtFsockopen(true); $wap_req = new WapRequest(); $wap_req->setUrl($url); $wap_req->setModified($modified); if ($_conf['proxy_use']) { $wap_req->setProxy($_conf['proxy_host'], $_conf['proxy_port']); } $wap_res = $wap_ua->request($wap_req); // 1段階だけリダイレクトを追跡 if ($wap_res->isRedirect() && array_key_exists('Location', $wap_res->headers) && ($trace_redirection === true || $trace_redirection == $wap_res->code)) { $wap_req->setUrl($wap_res->headers['Location']); $wap_res = $wap_ua->request($wap_req); } // エラーメッセージを設定 if ($wap_res->isError() && $disp_error) { $url_t = self::throughIme($wap_req->url); $info_msg_ht = "<p class=\"info-msg\">Error: {$wap_res->code} {$wap_res->message}<br>"; if ($wap_res->isRedirect() && array_key_exists('Location', $wap_res->headers)) { $location = $wap_res->headers['Location']; $location_ht = htmlspecialchars($location, ENT_QUOTES); $location_t = self::throughIme($location); $info_msg_ht .= "Location: <a href=\"{$location_t}\"{$_conf['ext_win_target_at']}>{$location_ht}</a><br>"; } $info_msg_ht .= "rep2 info: <a href=\"{$url_t}\"{$_conf['ext_win_target_at']}>{$wap_req->url}</a> に接続できませんでした。</p>"; self::pushInfoHtml($info_msg_ht); } // 更新されていたら if ($wap_res->isSuccess() && $wap_res->code != 304) { if (FileCtl::file_write_contents($localfile, $wap_res->content) === false) { p2die('cannot write file.'); } chmod($localfile, $perm); } return $wap_res; }
/** * fsockopenでSSL接続して2chログインのSIDを得る(証明書検証なし) * * @access private * @return string|false */ function _getAuth2chWithOpenSSL($login2chID, $login2chPW, $auth2ch_url, $x_2ch_ua, $dolib2ch) { global $_conf; $wap_ua = new WapUserAgent(); $wap_ua->setAgent($dolib2ch); $wap_ua->setTimeout($_conf['fsockopen_time_limit']); $wap_req = new WapRequest(); $wap_req->setMethod('POST'); $wap_req->post['ID'] = $login2chID; $wap_req->post['PW'] = $login2chPW; $wap_req->setHeaders($x_2ch_ua . "\r\n"); $wap_req->setUrl($auth2ch_url); if ($_conf['proxy_use']) { $wap_req->setProxy($_conf['proxy_host'], $_conf['proxy_port']); } // futen.cgiの仕様か、それともテスト環境のPHPがおかしいのか、 // とにかく●ログインではPOSTする文字列をURLエンコードしていると失敗する $wap_req->setNoUrlencodePost(true); $wap_res = $wap_ua->request($wap_req); //P2Util::pushInfoHtml(Var_Dump::display(array($wap_ua, $wap_req, $wap_res), TRUE)); if (!$wap_res or !$wap_res->is_success()) { return false; } return $wap_res->content; }
/** * 2chのdatを取得できなかった原因を返す * * @access private * @param string|null $reason * @return string エラーメッセージHTML(原因がわからない場合は空で返す) */ function get2chDatError($reason = null, $read_cgi = 'read.cgi') { global $_conf; // ホスト移転検出で変更したホストを元に戻す if (!empty($this->old_host)) { $this->host = $this->old_host; $this->old_host = null; } $read_url = "http://{$this->host}/test/{$read_cgi}/{$this->bbs}/{$this->key}/"; // {{{ read.cgi からHTMLを取得 $read_response_html = ''; if (!$reason) { require_once P2_LIB_DIR . '/wap.class.php'; $wap_ua = new WapUserAgent(); // ここは、"Monazilla/" をつけるとNG $wap_ua->setAgent(P2Util::getP2UA($withMonazilla = false)); $wap_ua->setTimeout($_conf['fsockopen_time_limit']); $wap_req = new WapRequest(); $wap_req->setUrl($read_url); if ($_conf['proxy_use']) { $wap_req->setProxy($_conf['proxy_host'], $_conf['proxy_port']); } $wap_res = $wap_ua->request($wap_req); if (!$wap_res or !$wap_res->is_success()) { $atag = P2View::tagA(P2Util::throughIme($wap_req->url), hs($wap_req->url), array('target' => $_conf['ext_win_target'])); $msg = sprintf('<div>Error: %s %s<br>p2 info - %s に接続できませんでした。</div>', hs($wap_res->code), hs($wap_res->message), $atag); P2Util::pushInfoHtml($msg); } else { $read_response_html = $wap_res->content; } unset($wap_ua, $wap_req, $wap_res); } // read.htmlの場合はread.soで再試行する // http://sports11.2ch.net/test/read.cgi/bicycle/1206427705/ // (正常に表示されない場合は、URL 中の read.cgi を read.so に変えて下さい。 // あるいは、掲示板トップにある「read.cgi モード切替」のリンクから「CGI モード」に設定して下さい) // JavaScript が有効でないと見られません。。。 if (preg_match('/read.cgi を read.so/', $read_response_html)) { return $this->get2chDatError($reason, $read_cgi = 'read.so'); } // }}} // {{{ 取得したHTML($read_response_html)を解析して、原因を見つける $dat_response_status = ''; $dat_response_msg_ht = ''; $kakosoko_match = '/このスレッドは過去ログ倉庫に格.{1,2}されています/'; $vip2ch_kakosoko_match = '/過去ログ倉庫に格.{1,2}されています/'; $naidesu_match = "{<title>そんな板orスレッドないです。</title>}"; $error3939_match = "{<title>2ちゃんねる error 3939</title>}"; // 過去ログ倉庫でhtml化の時(他にもあるかも、よく知らない) //<a href="http://qb5.2ch.net/sec2chd/kako/1091/10916/1091634596.html"> //<a href="../../../../mac/kako/1004/10046/1004680972.html"> //$kakohtml_match = "{<a href=\"\.\./\.\./\.\./\.\./([^/]+/kako/\d+(/\d+)?/(\d+)).html\">}"; $kakohtml_match = "{/([^/]+/kako/\\d+(/\\d+)?/(\\d+)).html\">}"; $waithtml_match = "/html化されるのを待っているようです。/"; // // <title>がこのスレッドは過去ログ倉庫に // if ($reason == 'datochi' or preg_match($kakosoko_match, $read_response_html, $matches)) { $dat_response_status = "このスレッドは過去ログ倉庫に格納されています。"; $marutori_ht = ''; //if (file_exists($_conf['idpw2ch_php']) || file_exists($_conf['sid2ch_php'])) { $marutori_ht = ' ' . $this->getMarutoriHtml(); //} else { // $marutori_ht = "<a href=\"login2ch.php?b={$_conf['b']}\" target=\"subject\">●IDログイン</a>"; //} $dat_response_msg_ht = "<p>2ch info - このスレッドは過去ログ倉庫に格納されています。 {$marutori_ht}</p>"; // // <title>がそんな板orスレッドないです。or error 3939 // } elseif (preg_match($naidesu_match, $read_response_html, $matches) || preg_match($error3939_match, $read_response_html, $matches) || preg_match($vip2ch_kakosoko_match, $read_response_html, $matches)) { if (preg_match($kakohtml_match, $read_response_html, $matches)) { $dat_response_status = "隊長! 過去ログ倉庫で、html化されたスレッドを発見しました。"; $kakolog_uri = "http://{$this->host}/{$matches[1]}"; $read_kako_url = $this->getReadKakologUri($kakolog_uri); $soko_atag = P2View::tagA($kakolog_uri . '.html', 'スレッド ' . $matches[3] . '.html', array('target' => $_conf['bbs_win_target'])); $dat_response_msg_ht = sprintf('<p>2ch info - 隊長! 過去ログ倉庫で、%s を発見しました。 [<a href="%s">p2に取り込んで読む</a>]</p>', $soko_atag, hs($read_kako_url)); } elseif (preg_match($waithtml_match, $read_response_html, $matches)) { $dat_response_status = "隊長! スレッドはhtml化されるのを待っているようです。"; $marutori_ht = ' ' . $this->getMarutoriHtml(); $dat_response_msg_ht = "<p>2ch info - 隊長! スレッドはhtml化されるのを待っているようです。 {$marutori_ht}</p>"; } else { if (!empty($_GET['kakolog'])) { $dat_response_status = "そんな板orスレッドないです。"; $kako_html_url = $_GET['kakolog'] . ".html"; $read_kako_url = $this->getReadKakologUri($_GET['kakolog']); $attrs = array(); if ($_conf['bbs_win_target']) { $attrs['target'] = $_conf['bbs_win_target']; } $read_kako_atag = P2View::tagA($kako_html_url, null, $attrs); $read_by_p2_atag = P2View::tagA($read_kako_url, 'p2にログを取り込んで読む'); $dat_response_msg_ht = "<p>2ch info - そんな板orスレッドないです。</p>"; $dat_response_msg_ht .= "<p>{$read_kako_atag} [{$read_by_p2_atag}]</p>"; } else { $dat_response_status = "そんな板orスレッドないです。"; $dat_response_msg_ht = "<p>2ch info - そんな板orスレッドないです。</p>"; } } // 原因が分からない場合でも、とりあえず過去ログ取り込みのリンクを維持している。と思う。あまり覚えていない 2005/2/27 aki } elseif (!empty($_GET['kakolog'])) { $dat_response_status = ''; $kako_html_url = $_GET['kakolog'] . '.html'; $read_kako_url = $this->getReadKakologUri($_GET['kakolog']); $attrs = array(); if ($_conf['bbs_win_target']) { $attrs['target'] = $_conf['bbs_win_target']; } $read_kako_atag = P2View::tagA($kako_html_url, null, $attrs); $read_by_p2_atag = P2View::tagA($read_kako_url, 'p2にログを取り込んで読む'); $dat_response_msg_ht = "<p>{$read_kako_atag} [{$read_by_p2_atag}]</p>"; } // }}} return $dat_response_msg_ht; }
/** * 2chのdatを取得できなかった原因を返す * * @return string エラーメッセージ(原因がわからない場合は空で返す) */ public function get2chDatError($code = null) { global $_conf; // ホスト移転検出で変更したホストを元に戻す if (!empty($this->old_host)) { $this->host = $this->old_host; $this->old_host = null; } $reason = null; if ($code == '302') { $body203 = $this->_get2ch203Body(); if ($body203 !== false && preg_match('/過去ログ ★/', $body203)) { $this->getdat_error_body = $body203; if (preg_match('/このスレッドは過去ログ倉庫に格.{1,2}されています/', $body203)) { $reason = 'datochi'; $this->setDatochiResiduums(); } else { if (preg_match('{http://[^/]+/[^/]+/kako/\\d+(/\\d+)?/(\\d+)\\.html}', $body203, $matches)) { $reason = 'kakohtml'; } } } } $read_url = "http://{$this->host}/test/read.cgi/{$this->bbs}/{$this->key}/"; // {{{ read.cgi からHTMLを取得 $read_response_html = ''; if (!$reason) { $wap_ua = new WapUserAgent(); $wap_ua->setAgent($_conf['p2ua']); // ここは、"Monazilla/" をつけるとNG $wap_ua->setTimeout($_conf['http_conn_timeout'], $_conf['http_read_timeout']); $wap_req = new WapRequest(); $wap_req->setUrl($read_url); if ($_conf['proxy_use']) { $wap_req->setProxy($_conf['proxy_host'], $_conf['proxy_port']); } $wap_res = $wap_ua->request($wap_req); if ($wap_res->isError()) { $url_t = P2Util::throughIme($wap_req->url); $info_msg_ht = "<p class=\"info-msg\">Error: {$wap_res->code} {$wap_res->message}<br>"; $info_msg_ht .= "rep2 info: <a href=\"{$url_t}\"{$_conf['ext_win_target_at']}>{$wap_req->url}</a> に接続できませんでした。</p>"; P2Util::pushInfoHtml($info_msg_ht); } else { $read_response_html = $wap_res->content; } unset($wap_ua, $wap_req, $wap_res); } // }}} // {{{ 取得したHTML($read_response_html)を解析して、原因を見つける $dat_response_status = ""; $dat_response_msg = ""; $kakosoko_match = "/このスレッドは過去ログ倉庫に格.{1,2}されています/"; $naidesu_match = "/<title>そんな板orスレッドないです。<\\/title>/"; $error3939_match = "{<title>2ちゃんねる error 3939</title>}"; // 過去ログ倉庫でhtml化の時(他にもあるかも、よく知らない) //<a href="http://qb5.2ch.net/sec2chd/kako/1091/10916/1091634596.html"> //<a href="../../../../mac/kako/1004/10046/1004680972.html"> //$kakohtml_match = "{<a href=\"\.\./\.\./\.\./\.\./([^/]+/kako/\d+(/\d+)?/(\d+)).html\">}"; $kakohtml_match = "{/([^/]+/kako/\\d+(/\\d+)?/(\\d+)).html\">}"; $waithtml_match = "/html化されるのを待っているようです。/"; // // <title>がこのスレッドは過去ログ倉庫に // if ($reason == 'datochi' or preg_match($kakosoko_match, $read_response_html, $matches)) { $dat_response_status = "このスレッドは過去ログ倉庫に格納されています。"; //if (file_exists($_conf['idpw2ch_php']) || file_exists($_conf['sid2ch_php'])) { $marutori_ht = " [<a href=\"{$_conf['read_php']}?host={$this->host}&bbs={$this->bbs}&key={$this->key}&ls={$this->ls}&maru=true{$_conf['k_at_a']}\">●IDでrep2に取り込む</a>]"; //} else { // $marutori_ht = " [<a href=\"login2ch.php\" target=\"subject\">●IDログイン</a>]"; //} // +Wiki if ($_GET['plugin']) { $datplugin =& new DatPluginCtl(); $datplugin->load(); foreach ($datplugin->data as $v) { if (preg_match('{' . $v['match'] . '}', $read_url)) { $replace = @preg_replace('{' . $v['match'] . '}', $v['replace'], $read_url); $code = P2UtilWiki::getResponseCode($replace); if ($code == 200) { $code = '○' . $code; } else { $code = '×' . $code; } $plugin_ht .= " <option value=\"{$replace}\">{$code}:{$v['title']}</option>\n"; } } if ($plugin_ht) { $plugin_ht = '<select size=1 name="kakolog">' . $plugin_ht . '</select>'; } else { $plugin_ht = '<input type="text" name="kakolog" size="64">'; } $plugin_ht .= 'から<input type="submit" name="kakoget" value="取得">'; } else { $plugin_ht = '<input type="submit" name="plugin" value="DATを探す">'; } $plugin_ht = <<<EOP <form method="get" action="{$_conf['read_php']}"> <input type="hidden" name="host" value="{$this->host}"> <input type="hidden" name="bbs" value="{$this->bbs}"> <input type="hidden" name="key" value="{$this->key}"> <input type="hidden" name="ls" value="{$this->ls}"> <input type="hidden" name="kakoget" value="2"> {$_conf['k_input_ht']} {$plugin_ht} </form> EOP; $moritori_ht = $this->_generateMoritapoDatLink(); $dat_response_msg = "<p>2ch info - このスレッドは過去ログ倉庫に格納されています。{$marutori_ht}{$moritori_ht}{$plugin_ht}</p>"; // // <title>がそんな板orスレッドないです。or error 3939 // } elseif ($reason == 'kakohtml' or preg_match($naidesu_match, $read_response_html, $matches) || preg_match($error3939_match, $read_response_html, $matches)) { if ($reason == 'kakohtml' or preg_match($kakohtml_match, $read_response_html, $matches)) { if ($reason == 'kakohtml') { preg_match('{/([^/]+/kako/\\d+(/\\d+)?/(\\d+)).html}', $this->getdat_error_body, $matches); } $dat_response_status = "隊長! 過去ログ倉庫で、html化されたスレッドを発見しました。"; $kakolog_uri = "http://{$this->host}/{$matches[1]}"; $kakolog_url_en = rawurlencode($kakolog_uri); $read_kako_url = "{$_conf['read_php']}?host={$this->host}&bbs={$this->bbs}&key={$this->key}&ls={$this->ls}&kakolog={$kakolog_url_en}&kakoget=1"; $dat_response_msg = "<p>2ch info - 隊長! 過去ログ倉庫で、<a href=\"{$kakolog_uri}.html\"{$_conf['bbs_win_target_at']}>スレッド {$matches[3]}.html</a> を発見しました。 [<a href=\"{$read_kako_url}\">rep2に取り込んで読む</a>]</p>"; } elseif (preg_match($waithtml_match, $read_response_html, $matches)) { $dat_response_status = "隊長! スレッドはhtml化されるのを待っているようです。"; $marutori_ht = " [<a href=\"{$_conf['read_php']}?host={$this->host}&bbs={$this->bbs}&key={$this->key}&ls={$this->ls}&maru=true{$_conf['k_at_a']}\">●IDでrep2に取り込む</a>]"; $moritori_ht = $this->_generateMoritapoDatLink(); $dat_response_msg = "<p>2ch info - 隊長! スレッドはhtml化されるのを待っているようです。{$marutori_ht}{$moritori_ht}</p>"; } else { if (!empty($_GET['kakolog'])) { $dat_response_status = 'そんな板orスレッドないです。'; $kako_html_url = htmlspecialchars($_GET['kakolog'] . '.html', ENT_QUOTES); $kakolog_query = rawurlencode($_GET['kakolog']); $read_kako_url = "{$_conf['read_php']}?host={$this->host}&bbs={$this->bbs}&key={$this->key}&ls={$this->ls}&kakolog={$kakolog_query}&kakoget=1"; $dat_response_msg = '<p>2ch info - そんな板orスレッドないです。</p>'; $dat_response_msg .= "<p><a href=\"{$kako_html_url}\"{$_conf['bbs_win_target_at']}>{$kako_html_url}</a> [<a href=\"{$read_kako_url}\">rep2にログを取り込んで読む</a>]</p>"; } else { $dat_response_status = 'そんな板orスレッドないです。'; $dat_response_msg = '<p>2ch info - そんな板orスレッドないです。</p>'; } } // 原因が分からない場合でも、とりあえず過去ログ取り込みのリンクを維持している。と思う。あまり覚えていない 2005/2/27 aki } elseif (!empty($_GET['kakolog'])) { $dat_response_status = ''; $kako_html_url = htmlspecialchars($_GET['kakolog'] . '.html', ENT_QUOTES); $kakolog_query = rawurlencode($_GET['kakolog']); $read_kako_url = "{$_conf['read_php']}?host={$this->host}&bbs={$this->bbs}&key={$this->key}&ls={$this->ls}&kakolog={$kakolog_query}&kakoget=1"; $dat_response_msg = "<p><a href=\"{$kako_html_url}\"{$_conf['bbs_win_target_at']}>{$kako_html_url}</a> [<a href=\"{$read_kako_url}\">rep2にログを取り込んで読む</a>]</p>"; } // }}} return $dat_response_msg; }
/** * ファイルをダウンロード保存する * * @access public * @param $options array('disp_error' => true, 'use_tmp_file' => false, 'modified' = null) * @return WapResponse|false */ function fileDownload($url, $localfile, $options = array()) { global $_conf; $me = __CLASS__ . '::' . __FUNCTION__ . '()'; $disp_error = isset($options['disp_error']) ? $options['disp_error'] : true; $use_tmp_file = isset($options['use_tmp_file']) ? $options['use_tmp_file'] : false; $modified = isset($options['modified']) ? $options['modified'] : null; if (strlen($localfile) == 0) { trigger_error("{$me}, localfile is null", E_USER_WARNING); return false; } $perm = isset($_conf['dl_perm']) ? $_conf['dl_perm'] : 0606; // {{{ modifiedの指定 // 指定なし(null)なら、ファイルの更新時間 if (is_null($modified) && file_exists($localfile)) { $modified = gmdate("D, d M Y H:i:s", filemtime($localfile)) . " GMT"; // UNIX TIME } elseif (is_numeric($modified)) { $modified = gmdate("D, d M Y H:i:s", $modified) . " GMT"; // 日付時間文字列 } elseif (is_string($modified)) { // $modified はそのまま } else { // modified ヘッダはなし $modified = false; } // }}} // DL require_once P2_LIB_DIR . '/wap.class.php'; $wap_ua = new WapUserAgent(); $wap_ua->setTimeout($_conf['fsockopen_time_limit']); $wap_req = new WapRequest(); $wap_req->setUrl($url); $modified and $wap_req->setModified($modified); if ($_conf['proxy_use']) { $wap_req->setProxy($_conf['proxy_host'], $_conf['proxy_port']); } $wap_res = $wap_ua->request($wap_req); if (!$wap_res or !$wap_res->is_success() && $disp_error) { $url_t = P2Util::throughIme($wap_req->url); $atag = P2View::tagA($url_t, hs($wap_req->url), array('target' => $_conf['ext_win_target'])); $msgHtml = sprintf('<div>Error: %s %s<br>p2 info - %s に接続できませんでした。</div>', hs($wap_res->code), hs($wap_res->message), $atag); P2Util::pushInfoHtml($msgHtml); } // 更新されていたらファイルに保存 if ($wap_res->is_success() && $wap_res->code != '304') { if ($use_tmp_file) { if (!is_dir($_conf['tmp_dir'])) { if (!FileCtl::mkdirR($_conf['tmp_dir'])) { die("Error: {$me}, cannot mkdir."); return false; } } if (false === FileCtl::filePutRename($localfile, $wap_res->content)) { trigger_error("{$me}, FileCtl::filePutRename() return false. " . $localfile, E_USER_WARNING); die("Error: {$me}, cannot write file."); return false; } } else { if (false === file_put_contents($localfile, $wap_res->content, LOCK_EX)) { die("Error: {$me}, cannot write file."); return false; } } chmod($localfile, $perm); } return $wap_res; }
/** * 2chのdatを取得できなかった原因を返す * * @return string エラーメッセージ(原因がわからない場合は空で返す) */ public function get2chDatError() { global $_conf; // ホスト移転検出で変更したホストを元に戻す if (!empty($this->old_host)) { $this->host = $this->old_host; $this->old_host = null; } $read_url = "http://{$this->host}/test/read.cgi/{$this->bbs}/{$this->key}/"; // {{{ read.cgi からHTMLを取得 $read_response_html = ''; $wap_ua = new WapUserAgent(); $wap_ua->setAgent($_conf['p2ua']); // ここは、"Monazilla/" をつけるとNG $wap_ua->setTimeout($_conf['http_conn_timeout'], $_conf['http_read_timeout']); $wap_req = new WapRequest(); $wap_req->setUrl($read_url); if ($_conf['proxy_use']) { $wap_req->setProxy($_conf['proxy_host'], $_conf['proxy_port']); } $wap_res = $wap_ua->request($wap_req); if ($wap_res->isError()) { $url_t = P2Util::throughIme($wap_req->url); $info_msg_ht = "<p class=\"info-msg\">Error: {$wap_res->code} {$wap_res->message}<br>"; $info_msg_ht .= "rep2 info: <a href=\"{$url_t}\"{$_conf['ext_win_target_at']}>{$wap_req->url}</a> に接続できませんでした。</p>"; P2Util::pushInfoHtml($info_msg_ht); } else { $read_response_html = $wap_res->content; } unset($wap_ua, $wap_req, $wap_res); // }}} // {{{ 取得したHTML($read_response_html)を解析して、原因を見つける $dat_response_status = ""; $dat_response_msg = ""; $kakosoko_match = "/このスレッドは過去ログ倉庫に格.{1,2}されています/"; $naidesu_match = "/<title>そんな板orスレッドないです。<\\/title>/"; $error3939_match = "{<title>2ちゃんねる error 3939</title>}"; // 過去ログ倉庫でhtml化の時(他にもあるかも、よく知らない) //<a href="http://qb5.2ch.net/sec2chd/kako/1091/10916/1091634596.html"> //<a href="../../../../mac/kako/1004/10046/1004680972.html"> //$kakohtml_match = "{<a href=\"\.\./\.\./\.\./\.\./([^/]+/kako/\d+(/\d+)?/(\d+)).html\">}"; $kakohtml_match = "{/([^/]+/kako/\\d+(/\\d+)?/(\\d+)).html\">}"; $waithtml_match = "/html化されるのを待っているようです。/"; // // <title>がこのスレッドは過去ログ倉庫に // if (preg_match($kakosoko_match, $read_response_html, $matches)) { $dat_response_status = "このスレッドは過去ログ倉庫に格納されています。"; //if (file_exists($_conf['idpw2ch_php']) || file_exists($_conf['sid2ch_php'])) { $marutori_ht = " [<a href=\"{$_conf['read_php']}?host={$this->host}&bbs={$this->bbs}&key={$this->key}&ls={$this->ls}&maru=true{$_conf['k_at_a']}\">●IDでrep2に取り込む</a>]"; //} else { // $marutori_ht = " [<a href=\"login2ch.php\" target=\"subject\">●IDログイン</a>]"; //} $moritori_ht = $this->_generateMoritapoDatLink(); $dat_response_msg = "<p>2ch info - このスレッドは過去ログ倉庫に格納されています。{$marutori_ht}{$moritori_ht}</p>"; // // <title>がそんな板orスレッドないです。or error 3939 // } elseif (preg_match($naidesu_match, $read_response_html, $matches) || preg_match($error3939_match, $read_response_html, $matches)) { if (preg_match($kakohtml_match, $read_response_html, $matches)) { $dat_response_status = "隊長! 過去ログ倉庫で、html化されたスレッドを発見しました。"; $kakolog_uri = "http://{$this->host}/{$matches[1]}"; $kakolog_url_en = rawurlencode($kakolog_uri); $read_kako_url = "{$_conf['read_php']}?host={$this->host}&bbs={$this->bbs}&key={$this->key}&ls={$this->ls}&kakolog={$kakolog_url_en}&kakoget=1"; $dat_response_msg = "<p>2ch info - 隊長! 過去ログ倉庫で、<a href=\"{$kakolog_uri}.html\"{$_conf['bbs_win_target_at']}>スレッド {$matches[3]}.html</a> を発見しました。 [<a href=\"{$read_kako_url}\">rep2に取り込んで読む</a>]</p>"; } elseif (preg_match($waithtml_match, $read_response_html, $matches)) { $dat_response_status = "隊長! スレッドはhtml化されるのを待っているようです。"; $marutori_ht = " [<a href=\"{$_conf['read_php']}?host={$this->host}&bbs={$this->bbs}&key={$this->key}&ls={$this->ls}&maru=true{$_conf['k_at_a']}\">●IDでrep2に取り込む</a>]"; $moritori_ht = $this->_generateMoritapoDatLink(); $dat_response_msg = "<p>2ch info - 隊長! スレッドはhtml化されるのを待っているようです。{$marutori_ht}{$moritori_ht}</p>"; } else { if (!empty($_GET['kakolog'])) { $dat_response_status = 'そんな板orスレッドないです。'; $kako_html_url = htmlspecialchars($_GET['kakolog'] . '.html', ENT_QUOTES); $kakolog_query = rawurlencode($_GET['kakolog']); $read_kako_url = "{$_conf['read_php']}?host={$this->host}&bbs={$this->bbs}&key={$this->key}&ls={$this->ls}&kakolog={$kakolog_query}&kakoget=1"; $dat_response_msg = '<p>2ch info - そんな板orスレッドないです。</p>'; $dat_response_msg .= "<p><a href=\"{$kako_html_url}\"{$_conf['bbs_win_target_at']}>{$kako_html_url}</a> [<a href=\"{$read_kako_url}\">rep2にログを取り込んで読む</a>]</p>"; } else { $dat_response_status = 'そんな板orスレッドないです。'; $dat_response_msg = '<p>2ch info - そんな板orスレッドないです。</p>'; } } // 原因が分からない場合でも、とりあえず過去ログ取り込みのリンクを維持している。と思う。あまり覚えていない 2005/2/27 aki } elseif (!empty($_GET['kakolog'])) { $dat_response_status = ''; $kako_html_url = htmlspecialchars($_GET['kakolog'] . '.html', ENT_QUOTES); $kakolog_query = rawurlencode($_GET['kakolog']); $read_kako_url = "{$_conf['read_php']}?host={$this->host}&bbs={$this->bbs}&key={$this->key}&ls={$this->ls}&kakolog={$kakolog_query}&kakoget=1"; $dat_response_msg = "<p><a href=\"{$kako_html_url}\"{$_conf['bbs_win_target_at']}>{$kako_html_url}</a> [<a href=\"{$read_kako_url}\">rep2にログを取り込んで読む</a>]</p>"; } // }}} return $dat_response_msg; }