/** * 対象レスの対象フィールドから、検索ワードを取得する * * @return string 検索ワード */ function _getReadFilterWord($host, $bbs, $key, $resnum, $field) { $word = null; $aThread = new ThreadRead(); $aThread->setThreadPathInfo($host, $bbs, $key); $aThread->readDat(); $resar = $aThread->explodeDatLine($aThread->datlines[$resnum - 1]); $resar = array_map('trim', $resar); $resar = array_map('strip_tags', $resar); switch ($field) { case 'name': $word = $resar[0]; break; case 'mail': $word = $resar[1]; break; case 'date': $word = preg_replace("/^(.*)ID:([0-9a-zA-Z\\/\\.\\+]+)(.*)\$/", "\\1 \\3", $resar[2]); $word = preg_replace("/^.*(\\d{2,4}\\/\\d{1,2}\\/\\d{1,2}).*\$/", "\\1", $word); break; case 'id': $word = preg_replace("/^.*ID:([0-9a-zA-Z\\/\\.\\+]+).*\$/", "\\1", $resar[2]); break; case 'rres': $_GET['field'] = 'msg'; $_GET['method'] = 'regex'; //$word = '>' . $resnum . '[^\d]'; // [^\d-] //$word = "(>|>|<|<|)|〉|》|≫){1,2}\s*\.?(\d+,)*" . $resnum . "\D"; require_once P2_LIB_DIR . '/ShowThread.php'; $word = ShowThread::getAnchorRegex('%prefix%(.+%delimiter%)?' . $resnum . '(?!\\d|%range_delimiter%)'); } return $word; }
function _read_filter_setup() { $host = $_GET['host']; $bbs = $_GET['bbs']; $key = $_GET['key']; $resnum = (int) $_GET['resnum']; $field = $_GET['field']; $aThread = new ThreadRead(); $aThread->setThreadPathInfo($host, $bbs, $key); $aThread->readDat($aThread->keydat); $i = $resnum - 1; if (!($i >= 0 && $i < count($aThread->datlines) && isset($_GET['rf']) && is_array($_GET['rf']))) { P2Util::pushInfoHtml('<p>フィルタリングの指定が変です。</p>'); unset($_GET['rf'], $_REQUEST['rf']); return; } $ares = $aThread->datlines[$i]; $resar = $aThread->explodeDatLine($ares); $name = $resar[0]; $mail = $resar[1]; $date_id = $resar[2]; $msg = $resar[3]; $params = $_GET['rf']; $include = ResFilter::INCLUDE_NONE; $fields = explode(':', $field); $field = array_shift($fields); if (in_array('refs', $fields)) { $include |= ResFilter::INCLUDE_REFERENCES; } if (in_array('refed', $fields)) { $include |= ResFilter::INCLUDE_REFERENCED; } $params['field'] = $field; $params['include'] = $include; $resFilter = ResFilter::configure($params); $target = $resFilter->getTarget($ares, $resnum, $name, $mail, $date_id, $msg); if ($field == 'date') { $date_part = explode(' ', trim($target)); $word = $date_part[0]; } else { $word = $target; } $params['word'] = $word; $_REQUEST['rf'] = $params; }
//===================================================== // スレッド情報 //===================================================== $host = $_GET['host']; $bbs = $_GET['bbs']; $key = $_GET['key']; $resid = $_GET['copy']; $quote = !empty($_GET['inyou']); if (isset($_SERVER['HTTP_REFERER'])) { $back_link = '<a href="' . htmlspecialchars($_SERVER['HTTP_REFERER'], ENT_QUOTES) . '" title="戻る">戻る</a> '; } //================================================= // レス読み込み //================================================= $aThread = new ThreadRead(); $aThread->setThreadPathInfo($host, $bbs, $key); if (file_exists($aThread->keydat)) { // スレッド情報 $aThread->readDat($aThread->keydat); $one = $aThread->explodeDatLine($aThread->datlines[0]); $ttitle = trim($one[4]); $ttitle_en = UrlSafeBase64::encode($ttitle); $ttitle_ht = htmlspecialchars($ttitle, ENT_QUOTES); $url_txt = $aThread->getMotoThread(true); $url_k_txt = $aThread->getMotoThread(); if ($quote) { $url_txt .= $resid; $url_k_txt .= $resid; } if ($url_txt != $url_k_txt) { $url_k_ht = "<input type=\"text\" name=\"url_k_txt\" value=\"{$url_k_txt}\"><br>";
/** * オフライン購読用データを生成する * * @param string $host; * @param string $bbs; * @param int $key * @param int $from * @return bool */ function httpcmd_make_offline_data($host, $bbs, $key, $from) { if (!is_numeric($from) || ($from = intval($from)) < 1) { return false; } $data = array(); $aThread = new ThreadRead(); $aThread->setThreadPathInfo($host, $bbs, $key); return false; }
/** * @return array */ function _getExplodedDatLine($host, $bbs, $key, $resnum) { require_once P2_LIB_DIR . '/Thread.php'; require_once P2_LIB_DIR . '/ThreadRead.php'; $ThreadRead = new ThreadRead(); $ThreadRead->setThreadPathInfo($host, $bbs, $key); $ThreadRead->readDat($ThreadRead->keydat); $explodedDatLine = $ThreadRead->explodeDatLine($ThreadRead->datlines[$resnum - 1]); return array_map('trim', $explodedDatLine); }
if ($stalker->isEnabled()) { header("Content-Type: image/png"); readfile(P2_PLUGIN_DIR . '/stalker/stalker.png'); } else { header("Content-Type: image/gif"); readfile('./img/spacer.gif'); } exit; } else { if ($stalker->isEnabled()) { $id = null; if (!empty($_GET['id'])) { $id = $_GET['id']; } elseif (!empty($_GET['key']) && !empty($_GET['resnum'])) { $aThread = new ThreadRead(); $aThread->setThreadPathInfo($_GET['host'], $_GET['bbs'], $_GET['key']); $aThread->readDat(); $resnum = $_GET['resnum']; if (isset($aThread->datlines[$resnum - 1])) { $ares = $aThread->datlines[$resnum - 1]; $resar = $aThread->explodeDatLine($ares); $m = array(); if (preg_match('<(ID: ?| )([0-9A-Za-z/.+]{8,11})(?=[^0-9A-Za-z/.+]|$)>', $resar[2], $m)) { $id = $m[2]; } } } if ($id) { $stalker->id = $id; } else { P2Util::printSimpleHtml('何かが足りないようです。');