Ejemplo n.º 1
0
/**
 * 対象レスの対象フィールドから、検索ワードを取得する
 *
 * @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;
}
Ejemplo n.º 2
0
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;
}
Ejemplo n.º 3
0
$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>";
    }
    // 投稿フォームへのリンク
    $post_url = "post_form.php?host={$host}&amp;bbs={$bbs}&amp;key={$key}";
Ejemplo n.º 4
0
/**
 * @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);
}
Ejemplo n.º 5
0
    $preview = $aThread->previewOne();
    $ptitle_ht = htmlspecialchars($aThread->itaj, ENT_QUOTES) . ' / ' . $aThread->ttitle_hd;
    include READ_HEADER_INC_PHP;
    echo $preview;
    include READ_FOOTER_INC_PHP;
    return;
}
//===========================================================
// DATのダウンロード
//===========================================================
$offline = !empty($_GET['offline']);
if (!$offline) {
    $aThread->downloadDat();
}
// DATを読み込み
$aThread->readDat();
// オフライン指定でもログがなければ、改めて強制読み込み
if (empty($aThread->datlines) && $offline) {
    $aThread->downloadDat();
    $aThread->readDat();
}
// タイトルを取得して設定
$aThread->setTitleFromLocal();
//===========================================================
// 表示レス番の範囲を設定
//===========================================================
if ($_conf['ktai']) {
    $before_respointer = $_conf['mobile.before_respointer'];
} else {
    $before_respointer = $_conf['before_respointer'];
}
Ejemplo n.º 6
0
        if (isset($_GET[$name])) {
            ${$name} = $_GET[$name];
            settype(${$name}, $type);
        } else {
            $errors[] = 'レスの特定に必要な値が足りません。';
            break;
        }
    }
    $inline = !empty($_GET['inline']);
    $rotate = !empty($_GET['rotate']);
}
// レス読み込み
if (empty($errors) && $_SERVER['REQUEST_METHOD'] != 'POST') {
    $aThread = new ThreadRead();
    $aThread->setThreadPathInfo($host, $bbs, $key);
    if (!$aThread->readDat()) {
        $errors[] = 'datが読み込めませんでした。';
    } else {
        $offset = $resnum - 1;
        if (!isset($aThread->datlines[$offset])) {
            $errors[] = 'このスレッドの >>' . $resnum . ' は存在していないか、取得していません。';
        } else {
            $parts = $aThread->explodeDatLine($aThread->datlines[$offset]);
            $text = $parts[3];
            $text = strip_tags($text, '<br><hr>');
            $text = preg_replace('/\\s*<br[^<>]*>\\s*/i', "\n", $text);
            $text = preg_replace('/\\s*<hr[^<>]*>\\s*/i', "\n------------------------\n", $text);
            $text = trim($text);
        }
    }
}