Пример #1
0
Файл: read.php Проект: poppen/p2
    if (searching) {
        searching.innerHTML = n;
    }
}
-->
</script>
<?php 
    }
    $debug && $profiler->enterSection('datToHtml');
    if ($aThread->rescount) {
        if (UA::isIPhoneGroup()) {
            require_once P2_IPHONE_LIB_DIR . '/ShowThreadPc.php';
        } else {
            require_once P2_LIB_DIR . '/ShowThreadPc.php';
        }
        $aShowThread = new ShowThreadPc($aThread);
        $res1 = $aShowThread->quoteOne();
        // >>1ポップアップ用
        echo $res1['q'];
        $aShowThread->datToHtml();
    } else {
        $res1 = array();
    }
    $debug && $profiler->leaveSection('datToHtml');
    // フィルタ結果を表示
    if ($word && $aThread->rescount) {
        ?>
<script type="text/javascript">
<!--
var filerstart = document.getElementById('filerstart');
if (filerstart) {
Пример #2
0
 function _coloredIdStrClassed($idstr, $id)
 {
     $ret = array();
     foreach ($arr = explode(':', $idstr) as $i => $str) {
         if ($i == 0 || $i == 1) {
             $ret[] = '<span class="' . ShowThreadPc::cssClassedId($id) . ($i == 0 ? '-l' : '-b') . '">' . $str . '</span>';
         } else {
             $ret[] = $str;
         }
     }
     return implode(':', $ret);
 }
Пример #3
0
} else {
    // ヘッダ 表示
    include READ_HEADER_INC_PHP;
    flush();
    //===========================================================
    // ローカルDatを変換してHTML表示
    //===========================================================
    // レスがあり、検索指定があれば
    if ($resFilter && $resFilter->hasWord() && $aThread->rescount) {
        $all = $aThread->rescount;
        $GLOBALS['filter_hits'] = 0;
        echo "<p><b id=\"filterstart\">{$all}レス中 <span id=\"searching\">n</span>レスがヒット</b></p>\n";
    }
    //$GLOBALS['debug'] && $GLOBALS['profiler']->enterSection("datToHtml");
    if ($aThread->rescount) {
        $aShowThread = new ShowThreadPc($aThread);
        if ($_conf['expack.spm.enabled']) {
            echo $aShowThread->getSpmObjJs();
        }
        $res1 = $aShowThread->quoteOne();
        // >>1ポップアップ用
        echo $res1['q'];
        $aShowThread->datToHtml();
    }
    //$GLOBALS['debug'] && $GLOBALS['profiler']->leaveSection("datToHtml");
    // フィルタ結果を表示
    if ($resFilter && $resFilter->hasWord() && $aThread->rescount) {
        echo <<<EOP
<script type="text/javascript">
//<![CDATA[
var filterstart = document.getElementById('filterstart');
Пример #4
0
function readNew($aThread)
{
    global $_conf, $newthre_num, $STYLE;
    global $word;
    static $favlist_titles = null;
    if ($_conf['expack.misc.multi_favs'] && is_null($favlist_titles)) {
        $favlist_titles = FavSetManager::getFavSetTitles('m_favlist_set');
        if (empty($favlist_titles)) {
            $favlist_titles = array();
        }
        if (!isset($favlist_titles[0]) || $favlist_titles[0] == '') {
            $favlist_titles[0] = 'お気にスレ';
        }
        for ($i = 1; $i <= $_conf['expack.misc.favset_num']; $i++) {
            if (!isset($favlist_titles[$i]) || $favlist_titles[$i] == '') {
                $favlist_titles[$i] = 'お気にスレ' . $i;
            }
        }
    }
    $newthre_num++;
    //==========================================================
    //  idxの読み込み
    //==========================================================
    // hostを分解してidxファイルのパスを求める
    $aThread->setThreadPathInfo($aThread->host, $aThread->bbs, $aThread->key);
    // FileCtl::mkdirFor($aThread->keyidx); // 板ディレクトリが無ければ作る // この操作はおそらく不要
    $aThread->itaj = P2Util::getItaName($aThread->host, $aThread->bbs);
    if (!$aThread->itaj) {
        $aThread->itaj = $aThread->bbs;
    }
    // idxファイルがあれば読み込む
    if ($lines = FileCtl::file_read_lines($aThread->keyidx, FILE_IGNORE_NEW_LINES)) {
        $data = explode('<>', $lines[0]);
    } else {
        $data = array_fill(0, 12, '');
    }
    $aThread->getThreadInfoFromIdx();
    //==================================================================
    // DATのダウンロード
    //==================================================================
    if (!($word and file_exists($aThread->keydat))) {
        $aThread->downloadDat();
    }
    // DATを読み込み
    $aThread->readDat();
    $aThread->setTitleFromLocal();
    // ローカルからタイトルを取得して設定
    //===========================================================
    // 表示レス番の範囲を設定
    //===========================================================
    // 取得済みなら
    if ($aThread->isKitoku()) {
        $from_num = $aThread->readnum + 1 - $_conf['respointer'] - $_conf['before_respointer_new'];
        if ($from_num > $aThread->rescount) {
            $from_num = $aThread->rescount - $_conf['respointer'] - $_conf['before_respointer_new'];
        }
        if ($from_num < 1) {
            $from_num = 1;
        }
        //if (!$aThread->ls) {
        $aThread->ls = "{$from_num}-";
        //}
    }
    $aThread->lsToPoint();
    //==================================================================
    // ヘッダ 表示
    //==================================================================
    $motothre_url = $aThread->getMotoThread(false, '');
    $ttitle_en = UrlSafeBase64::encode($aThread->ttitle);
    $ttitle_en_q = '&amp;ttitle_en=' . $ttitle_en;
    $bbs_q = '&amp;bbs=' . $aThread->bbs;
    $key_q = '&amp;key=' . $aThread->key;
    $host_bbs_key_q = 'host=' . $aThread->host . $bbs_q . $key_q;
    $popup_q = '&amp;popup=1';
    // require_once P2_LIB_DIR . '/read_header.inc.php';
    $prev_thre_num = $newthre_num - 1;
    $next_thre_num = $newthre_num + 1;
    if ($prev_thre_num != 0) {
        $prev_thre_ht = "<a href=\"#ntt{$prev_thre_num}\">▲</a>";
    } else {
        $prev_thre_ht = '';
    }
    $next_thre_ht = "<a id=\"ntta{$next_thre_num}\" href=\"#ntt{$next_thre_num}\">▼</a>";
    P2Util::printInfoHtml();
    // ヘッダ部分HTML
    $read_header_ht = <<<EOP
<table id="ntt{$newthre_num}" class="toolbar">
    <tr>
        <td class="lblock"><h3 class="thread_title">{$aThread->ttitle_hd}</h3></td>
        <td class="rblock">{$prev_thre_ht} {$next_thre_ht}</td>
    </tr>
</table>

EOP;
    //==================================================================
    // ローカルDatを読み込んでHTML表示
    //==================================================================
    $aThread->resrange['nofirst'] = true;
    $GLOBALS['newres_to_show_flag'] = false;
    if ($aThread->rescount) {
        $aShowThread = new ShowThreadPc($aThread, true);
        if ($_conf['expack.spm.enabled']) {
            $read_header_ht .= $aShowThread->getSpmObjJs();
        }
        $res1 = $aShowThread->quoteOne();
        $read_cont_ht = $res1['q'];
        $read_cont_ht .= $aShowThread->getDatToHtml();
        // レス追跡カラー
        if ($_conf['backlink_coloring_track']) {
            $read_cont_ht .= $aShowThread->getResColorJs();
        }
        // IDカラーリング
        if ($_conf['coloredid.enable'] > 0 && $_conf['coloredid.click'] > 0) {
            $read_header_ht .= $aShowThread->getIdColorJs();
        }
        // 外部ツール
        $pluswiki_js = '';
        if ($_conf['wiki.idsearch.spm.mimizun.enabled']) {
            require_once './plugin/mimizun/mimizun.class.php';
            $mimizun = new mimizun();
            $mimizun->host = $aThread->host;
            $mimizun->bbs = $aThread->bbs;
            if ($mimizun->isEnable()) {
                $pluswiki_js .= "WikiTools.addMimizun({$aShowThread->spmObjName});";
            }
        }
        if ($_conf['wiki.idsearch.spm.hissi.enabled']) {
            require_once './plugin/hissi/hissi.class.php';
            $hissi = new hissi();
            $hissi->host = $aThread->host;
            $hissi->bbs = $aThread->bbs;
            if ($hissi->isEnable()) {
                $pluswiki_js .= "WikiTools.addHissi({$aShowThread->spmObjName});";
            }
        }
        if ($_conf['wiki.idsearch.spm.stalker.enabled']) {
            require_once './plugin/stalker/stalker.class.php';
            $stalker = new stalker();
            $stalker->host = $aThread->host;
            $stalker->bbs = $aThread->bbs;
            if ($stalker->isEnable()) {
                $pluswiki_js .= "WikiTools.addStalker({$aShowThread->spmObjName});";
            }
        }
        if ($pluswiki_js) {
            $read_header_ht .= <<<EOP
<script type="text/javascript">
//<![CDATA[
{$pluswiki_js}
//]]>
</script>
EOP;
        }
        unset($aShowThread);
    }
    //==================================================================
    // フッタ 表示
    //==================================================================
    // $read_footer_navi_new  続きを読む 新着レスの表示
    $newtime = date("gis");
    // リンクをクリックしても再読込しない仕様に対抗するダミークエリー
    $info_st = '情報';
    $delete_st = '削除';
    $prev_st = '前';
    $next_st = '次';
    $dores_st = '書込';
    $read_footer_navi_new = "<a href=\"{$_conf['read_php']}?{$host_bbs_key_q}&amp;ls={$aThread->rescount}-&amp;nt={$newtime}#r{$aThread->rescount}\">新着レスの表\示</a>";
    if (!empty($_conf['disable_res'])) {
        $dores_ht = <<<EOP
          <a href="{$motothre_url}" target="_blank">{$dores_st}</a>
EOP;
    } else {
        $dores_ht = <<<EOP
        <a href="post_form.php?{$host_bbs_key_q}&amp;rescount={$aThread->rescount}{$ttitle_en_q}" target='_self' onclick="return OpenSubWin('post_form.php?{$host_bbs_key_q}&amp;rescount={$aThread->rescount}{$ttitle_en_q}{$popup_q}&amp;from_read_new=1',{$STYLE['post_pop_size']},1,0)">{$dores_st}</a>
EOP;
    }
    // ツールバー部分HTML =======
    // お気にマーク設定
    $itaj_hd = htmlspecialchars($aThread->itaj, ENT_QUOTES);
    $similar_q = '&amp;itaj_en=' . UrlSafeBase64::encode($aThread->itaj) . '&amp;method=similar&amp;word=' . rawurlencode($aThread->ttitle_hc);
    if ($_conf['expack.misc.multi_favs']) {
        $toolbar_setfav_ht = 'お気に[';
        $favdo = !empty($aThread->favs[0]) ? 0 : 1;
        $favdo_q = '&amp;setfav=' . $favdo;
        $favmark = $favdo ? '+' : '★';
        $favtitle = $favlist_titles[0] . ($favdo ? 'に追加' : 'から外す');
        $setnum_q = '&amp;setnum=0';
        $toolbar_setfav_ht .= <<<EOP
<span class="favdo set0"><a href="info.php?{$host_bbs_key_q}{$ttitle_en_q}{$favdo_q}{$setnum_q}" target="info" onclick="return setFavJs('{$host_bbs_key_q}{$ttitle_en_q}', '{$favdo}', {$STYLE['info_pop_size']}, 'read_new', this, '0');" title="{$favtitle}">{$favmark}</a></span>
EOP;
        for ($i = 1; $i <= $_conf['expack.misc.favset_num']; $i++) {
            $favdo = !empty($aThread->favs[$i]) ? 0 : 1;
            $favdo_q = '&amp;setfav=' . $favdo;
            $favmark = $favdo ? $i : '★';
            $favtitle = $favlist_titles[$i] . ($favdo ? 'に追加' : 'から外す');
            $setnum_q = '&amp;setnum=' . $i;
            $toolbar_setfav_ht .= <<<EOP
|<span class="favdo set{$i}"><a href="info.php?{$host_bbs_key_q}{$ttitle_en_q}{$favdo_q}{$setnum_q}" target="info" onclick="return setFavJs('{$host_bbs_key_q}{$ttitle_en_q}', '{$favdo}', {$STYLE['info_pop_size']}, 'read_new', this, '{$i}');" title="{$favtitle}">{$favmark}</a></span>
EOP;
        }
        $toolbar_setfav_ht .= ']';
    } else {
        $favdo = !empty($aThread->fav) ? 0 : 1;
        $favdo_q = '&amp;setfav=' . $favdo;
        $favmark = $favdo ? '+' : '★';
        $favtitle = $favdo ? 'お気にスレに追加' : 'お気にスレから外す';
        $toolbar_setfav_ht = <<<EOP
<span class="favdo"><a href="info.php?{$host_bbs_key_q}{$ttitle_en_q}{$favdo_q}" target="info" onclick="return setFavJs('{$host_bbs_key_q}{$ttitle_en_q}', '{$favdo}', {$STYLE['info_pop_size']}, 'read_new', this, '0');" title="{$favtitle}">お気に{$favmark}</a></span>
EOP;
    }
    $toolbar_right_ht = <<<EOTOOLBAR
            <a href="{$_conf['subject_php']}?{$host_bbs_key_q}" target="subject" title="板を開く">{$itaj_hd}</a>
            <a href="info.php?{$host_bbs_key_q}{$ttitle_en_q}" target="info" onclick="return OpenSubWin('info.php?{$host_bbs_key_q}{$ttitle_en_q}{$popup_q}',{$STYLE['info_pop_size']},1,0)" title="スレッド情報を表\示">{$info_st}</a>
            {$toolbar_setfav_ht}
            <span><a href="info.php?{$host_bbs_key_q}{$ttitle_en_q}&amp;dele=true" target="info" onclick="return deleLog('{$host_bbs_key_q}{$ttitle_en_q}', {$STYLE['info_pop_size']}, 'read_new', this);" title="ログを削除する">{$delete_st}</a></span>
<!--            <a href="info.php?{$host_bbs_key_q}{$ttitle_en_q}&amp;taborn=2" target="info" onclick="return OpenSubWin('info.php?{$host_bbs_key_q}{$ttitle_en_q}&amp;popup=2&amp;taborn=2',{$STYLE['info_pop_size']},0,0)" title="スレッドのあぼーん状態をトグルする">あぼん</a> -->
            <a href="{$motothre_url}" title="板サーバ上のオリジナルスレを表\示" onmouseover="showMotoLsPopUp(event, this)" onmouseout="hideMotoLsPopUp()">元スレ</a>
            <a href="{$_conf['subject_php']}?{$host_bbs_key_q}{$similar_q}" target="subject" title="タイトルが似ているスレッドを検索">似スレ</a>
EOTOOLBAR;
    // レスのすばやさ
    $spd_ht = "";
    if ($spd_st = $aThread->getTimePerRes() and $spd_st != "-") {
        $spd_ht = '<span class="spd" title="すばやさ=時間/レス">' . "" . $spd_st . "" . '</span>';
    }
    // datサイズ
    if (file_exists($aThread->keydat) && ($dsize_ht = filesize($aThread->keydat))) {
        $dsize_ht = sprintf('<span class="spd" title="%s">%01.1fKB</span> |', 'datサイズ', $dsize_ht / 1024);
    } else {
        $dsize_ht = '';
    }
    // IC2リンク、件数
    if ($_conf['expack.ic2.enabled'] && $_conf['expack.ic2.thread_imagelink']) {
        $spanid = 'ic2_count_' . sprintf('%u', crc32($aThread->keydat));
        $ic2navi = '<a href="iv2.php?field=memo&amp;key=' . rawurlencode($aThread->ttitle) . '" target="_blank">キャッシュ画像' . ($_conf['expack.ic2.thread_imagecount'] ? '<span id="ic2_count_' . sprintf('%u', crc32($aThread->keydat)) . '"></span>' : '') . '</a> ';
    }
    // フッタ部分HTML
    $read_footer_ht = <<<EOP
<table class="toolbar">
    <tr>
        <td class="lblock">{$res1['body']} | <a href="{$_conf['read_php']}?{$host_bbs_key_q}&amp;offline=1&amp;rescount={$aThread->rescount}#r{$aThread->rescount}">{$aThread->ttitle_hd}</a> | {$dores_ht} {$dsize_ht} {$spd_ht}</td>
        <td class="rblock">{$ic2navi}{$toolbar_right_ht}</td>
        <td class="rblock"><a href="#ntt{$newthre_num}">▲</a></td>
    </tr>
</table>

EOP;
    // 透明あぼーんで表示がない場合はスキップ
    if ($GLOBALS['newres_to_show_flag']) {
        echo '<div style="width:100%;">' . "\n";
        // ほぼIE ActiveXのGray()のためだけに囲ってある
        echo $read_header_ht;
        echo $read_cont_ht;
        echo $read_footer_ht;
        echo '</div>' . "\n\n";
        echo '<hr>' . "\n\n";
    }
    //==================================================================
    // key.idx の値設定
    //==================================================================
    if ($aThread->rescount) {
        $aThread->readnum = min($aThread->rescount, max(0, $data[5], $aThread->resrange['to']));
        $newline = $aThread->readnum + 1;
        // $newlineは廃止予定だが、旧互換用に念のため
        $sar = array($aThread->ttitle, $aThread->key, $data[2], $aThread->rescount, $aThread->modified, $aThread->readnum, $data[6], $data[7], $data[8], $newline, $data[10], $data[11], $aThread->datochiok);
        P2Util::recKeyIdx($aThread->keyidx, $sar);
        // key.idxに記録
    }
}
Пример #5
0
                $pluswiki_js .= "WikiTools.addStalker({$aShowThread->spmObjName});";
            }
        }
        if ($pluswiki_js) {
            echo <<<EOP
<script type="text/javascript">
//<![CDATA[
{$pluswiki_js}
//]]>
</script>
EOP;
        }
    } else {
        if ($aThread->diedat && count($aThread->datochi_residuums) > 0) {
            require_once P2_LIB_DIR . '/ShowThreadPc.php';
            $aShowThread = new ShowThreadPc($aThread);
            echo $aShowThread->getDatochiResiduums();
        }
    }
    //$GLOBALS['debug'] && $GLOBALS['profiler']->leaveSection("datToHtml");
    // フィルタ結果を表示
    if ($resFilter && $resFilter->hasWord() && $aThread->rescount) {
        echo <<<EOP
<script type="text/javascript">
//<![CDATA[
var filterstart = document.getElementById('filterstart');
if (filterstart) {
    filterstart.style.backgroundColor = 'yellow';
    filterstart.style.fontWeight = 'bold';
}
//]]>
Пример #6
0
 /**
  * >>1をプレビューでスレッドデータが見つからなかったときに呼び出される
  */
 public function previewOneNotFound($code = null)
 {
     global $_conf;
     $this->diedat = true;
     // 2ch, bbspink ならread.cgiで確認
     if (P2Util::isHost2chs($this->host)) {
         $this->getdat_error_msg_ht = $this->get2chDatError($code);
         if (count($this->datochi_residuums)) {
             if ($_conf['ktai']) {
                 $aShowThread = new ShowThreadK($this);
                 $aShowThread->am_autong = false;
             } else {
                 $aShowThread = new ShowThreadPc($this);
             }
             $this->onthefly = true;
             $body = "<div><span class=\"onthefly\">on the fly</span></div>\n";
             $body .= "<div class=\"thread\">\n";
             $res = $aShowThread->transRes($this->datochi_residuums[1], 1);
             $body .= is_array($res) ? $res['body'] . $res['q'] : $res;
             $body .= "</div>\n";
             return $body;
         }
     }
     return false;
 }
Пример #7
0
// string "256n" => integer 256
$rp = $rn - 1;
$aThread->lsToPoint();
//===============================================================
// プリント
//===============================================================
$ptitle_ht = htmlspecialchars($aThread->itaj, ENT_QUOTES) . ' / ' . $aThread->ttitle_hd;
// {{{ HTTPヘッダとXML宣言
P2Util::header_nocache();
header('Content-Type: text/html; charset=Shift_JIS');
// }}}
// {{{ 本体生成
$node = 'ないぽ。';
if ($aThread->rescount) {
    //$aShowThread = new ShowThreadTree($aThread);
    $aShowThread = new ShowThreadPc($aThread);
    if (isset($aShowThread->thread->datlines[$rp])) {
        $ares = $aShowThread->thread->datlines[$rp];
        $part = $aShowThread->thread->explodeDatLine($ares);
        switch ($mode) {
            // レスポップアップ
            case 1:
                $node = $aShowThread->qRes($ares, $rn);
                break;
                // コピペ
            // コピペ
            case 2:
                $node = $rn;
                $node .= ' :' . strip_tags($part[0]);
                $node .= ' :' . strip_tags($part[1]);
                $node .= ' :' . strip_tags($part[2]) . "\n";
Пример #8
0
 /**
  * >>1のみをプレビューする
  */
 public function previewOne()
 {
     global $_conf;
     if (!($this->host && $this->bbs && $this->key)) {
         return false;
     }
     // ローカルdatから取得
     if (is_readable($this->keydat)) {
         $fd = fopen($this->keydat, "rb");
         $first_line = fgets($fd, 32800);
         fclose($fd);
         // be.2ch.net ならEUC→SJIS変換
         if (P2Util::isHostBe2chNet($this->host)) {
             $first_line = mb_convert_encoding($first_line, 'CP932', 'CP51932');
         }
         $first_datline = rtrim($first_line);
         if (strpos($first_datline, '<>') !== false) {
             $datline_sepa = "<>";
         } else {
             $datline_sepa = ",";
             $this->dat_type = "2ch_old";
         }
         $d = explode($datline_sepa, $first_datline);
         $this->setTtitle($d[4]);
     }
     // ローカルdatなければオンラインから
     if (!$first_line) {
         $method = 'GET';
         $url = "http://{$this->host}/{$this->bbs}/dat/{$this->key}.dat";
         $purl = parse_url($url);
         // URL分解
         if (isset($purl['query'])) {
             // クエリー
             $purl['query'] = '?' . $purl['query'];
         } else {
             $purl['query'] = '';
         }
         // プロキシ
         if ($_conf['proxy_use']) {
             $send_host = $_conf['proxy_host'];
             $send_port = $_conf['proxy_port'];
             $send_path = $url;
         } else {
             $send_host = $purl['host'];
             $send_port = $purl['port'];
             $send_path = $purl['path'] . $purl['query'];
         }
         if (!$send_port) {
             $send_port = 80;
         }
         // デフォルトを80
         $request = "{$method} {$send_path} HTTP/1.0\r\n";
         $request .= "Host: {$purl['host']}\r\n";
         $request .= "User-Agent: Monazilla/1.00 ({$_conf['p2ua']})\r\n";
         // $request .= "Range: bytes={$from_bytes}-\r\n";
         // Basic認証用のヘッダ
         if (isset($purl['user']) && isset($purl['pass'])) {
             $request .= "Authorization: Basic " . base64_encode($purl['user'] . ":" . $purl['pass']) . "\r\n";
         }
         $request .= "Connection: Close\r\n";
         $request .= "\r\n";
         // WEBサーバへ接続
         $fp = @fsockopen($send_host, $send_port, $errno, $errstr, $_conf['http_conn_timeout']);
         if (!$fp) {
             self::_pushInfoConnectFailed($url, $errno, $errstr);
             $this->diedat = true;
             return false;
         }
         stream_set_timeout($fp, $_conf['http_read_timeout'], 0);
         fputs($fp, $request);
         $start_here = false;
         while (!p2_stream_eof($fp, $timed_out)) {
             if ($start_here) {
                 if ($code == "200") {
                     $first_line = fgets($fp, 32800);
                     break;
                 } else {
                     fclose($fp);
                     return $this->previewOneNotFound();
                 }
             } else {
                 $l = fgets($fp, 32800);
                 //echo $l."<br>";// for debug
                 if (preg_match("/^HTTP\\/1\\.\\d (\\d+) (.+)\r\n/", $l, $matches)) {
                     // ex) HTTP/1.1 304 Not Modified
                     $code = $matches[1];
                     if ($code == "200") {
                     } else {
                         fclose($fp);
                         return $this->previewOneNotFound();
                     }
                 } elseif (preg_match("/^Content-Length: ([0-9]+)/", $l, $matches)) {
                     $onbytes = $matches[1];
                 } elseif ($l == "\r\n") {
                     $start_here = true;
                 }
             }
         }
         fclose($fp);
         // be.2ch.net ならEUC→SJIS変換
         if (P2Util::isHostBe2chNet($this->host)) {
             $first_line = mb_convert_encoding($first_line, 'CP932', 'CP51932');
         }
         $first_datline = rtrim($first_line);
         if (strpos($first_datline, '<>') !== false) {
             $datline_sepa = "<>";
         } else {
             $datline_sepa = ",";
             $this->dat_type = "2ch_old";
         }
         $d = explode($datline_sepa, $first_datline);
         $this->setTtitle($d[4]);
         $this->onthefly = true;
     } else {
         // 便宜上
         if (!$this->readnum) {
             $this->readnum = 1;
         }
     }
     if ($_conf['ktai']) {
         $aShowThread = new ShowThreadK($this);
         $aShowThread->am_autong = false;
     } else {
         $aShowThread = new ShowThreadPc($this);
     }
     $body = '';
     if ($this->onthefly) {
         $body .= "<div><span class=\"onthefly\">on the fly</span></div>\n";
     }
     $body .= "<div class=\"thread\">\n";
     $body .= $aShowThread->transRes($first_line, 1);
     // 1を表示
     $body .= "</div>\n";
     return $body;
 }
Пример #9
0
/**
 * スレッドの新着部分を読み込んで表示する
 *
 * @return  void
 */
function _readNew(&$aThread)
{
    global $_conf, $_newthre_num, $STYLE, $sid_q;
    $_newthre_num++;
    //==========================================================
    // idxの読み込み
    //==========================================================
    // hostを分解してidxファイルのパスを求める
    $aThread->setThreadPathInfo($aThread->host, $aThread->bbs, $aThread->key);
    // FileCtl::mkdirFor($aThread->keyidx); // 板ディレクトリが無ければ作る // この操作はおそらく不要
    $aThread->itaj = P2Util::getItaName($aThread->host, $aThread->bbs);
    if (!$aThread->itaj) {
        $aThread->itaj = $aThread->bbs;
    }
    // idxファイルがあれば読み込む
    if (file_exists($aThread->keyidx)) {
        $lines = file($aThread->keyidx);
        $data = explode('<>', rtrim($lines[0]));
    }
    $aThread->getThreadInfoFromIdx();
    // DATのダウンロード
    if (!(isset($GLOBALS['word']) && file_exists($aThread->keydat))) {
        $aThread->downloadDat();
    }
    // DATを読み込み
    $aThread->readDat();
    $aThread->setTitleFromLocal();
    // ローカルからタイトルを取得して設定
    // {{{ 表示レス番の範囲を設定
    // 取得済みなら
    if ($aThread->isKitoku()) {
        $from_num = $aThread->readnum + 1 - $_conf['respointer'] - $_conf['before_respointer_new'];
        if ($from_num > $aThread->rescount) {
            $from_num = $aThread->rescount - $_conf['respointer'] - $_conf['before_respointer_new'];
        }
        if ($from_num < 1) {
            $from_num = 1;
        }
        //if (!$aThread->ls) {
        $aThread->ls = "{$from_num}-";
        //}
    }
    $aThread->lsToPoint();
    // }}}
    //==================================================================
    // ヘッダ 表示
    //==================================================================
    $motothre_url = $aThread->getMotoThread();
    $ttitle_en = base64_encode($aThread->ttitle);
    $popup_q = "&amp;popup=1";
    // require_once P2_LIB_DIR . '/read_header.inc.php';
    $prev_thre_num = $_newthre_num - 1;
    $next_thre_num = $_newthre_num + 1;
    $prev_thre_ht = '';
    if ($prev_thre_num != 0) {
        $prev_thre_ht = "<a href=\"#ntt{$prev_thre_num}\">▲</a>";
    }
    $next_thre_ht = "<a href=\"#ntt{$next_thre_num}\">▼</a> ";
    // スマートポップアップメニュー
    if ($_conf['enable_spm']) {
        $aThread->showSmartPopUpMenuJs();
    }
    P2Util::printInfoHtml();
    // ヘッダ部分HTML
    $read_header_ht = <<<EOP
\t<table id="ntt{$_newthre_num}" class="toolbar" width="100%" style="padding:0px 10px 0px 0px;">
\t\t<tr>
\t\t\t<td align="left">
\t\t\t\t<h3 class="thread_title">{$aThread->ttitle_hs} </h3>
\t\t\t</td>
\t\t\t<td align="right">
\t\t\t\t{$prev_thre_ht}
\t\t\t\t{$next_thre_ht}
\t\t\t</td>
\t\t</tr>
\t</table>

EOP;
    //==================================================================
    // ローカルDatを読み込んでHTML表示
    //==================================================================
    $aThread->resrange['nofirst'] = true;
    $GLOBALS['newres_to_show_flag'] = false;
    if ($aThread->rescount) {
        // $aThread->datToHtml(); // dat を html に変換表示
        require_once P2_LIB_DIR . '/ShowThreadPc.php';
        $aShowThread = new ShowThreadPc($aThread);
        $res1 = $aShowThread->quoteOne();
        $read_cont_ht = $res1['q'];
        $read_cont_ht .= $aShowThread->getDatToHtml();
        unset($aShowThread);
    }
    //==================================================================
    // フッタ 表示
    //==================================================================
    // require_once P2_LIB_DIR . '/read_footer.inc.php';
    //----------------------------------------------
    // $read_footer_navi_new_ht  続きを読む 新着レスの表示
    $newtime = date("gis");
    // リンクをクリックしても再読込しない仕様に対抗するダミークエリー
    $info_st = "情報";
    $dele_st = "削除";
    $prev_st = "前";
    $next_st = "次";
    $thread_qs = array('host' => $aThread->host, 'bbs' => $aThread->bbs, 'key' => $aThread->key, UA::getQueryKey() => UA::getQueryValue());
    $sid_qs = array();
    if (defined('SID') && strlen(SID)) {
        $sid_qs[session_name()] = session_id();
    }
    /*
    $read_footer_navi_new_ht = P2View::tagA(
        UriUtil::buildQueryUri($_conf['read_php'],
            array_merge($thread_qs, array(
                'ls'   => "$aThread->rescount-",
                'nt'   => $newtime
            ))
        ) . '#r' . rawurlencode($aThread->rescount),
        '新着レスの表示'
    );
    */
    if ($_conf['disable_res']) {
        $dores_ht = P2View::tagA($motothre_url, '書込', array('target' => '_blank'));
    } else {
        $post_form_uri = UriUtil::buildQueryUri('post_form.php', array_merge($thread_qs, array('rescount' => $aThread->rescount, 'ttitle_en' => $ttitle_en)));
        $post_form_uri_hs = hs($post_form_uri);
        $post_from_openwin_uri = UriUtil::buildQueryUri('post_form.php', array_merge($thread_qs, array('rescount' => $aThread->rescount, 'ttitle_en' => $ttitle_en, 'popup' => '1', 'from_read_new' => '1'), $sid_qs));
        $post_from_openwin_uri_hs = hs($post_from_openwin_uri);
        $dores_ht = <<<EOP
        <a href="{$post_form_uri_hs}" target='_self' onClick="return !openSubWin('{$post_from_openwin_uri_hs}',{$STYLE['post_pop_size']},1,0)">書込</a>
EOP;
    }
    $dores_ht = '<span style="white-space: nowrap;">' . $dores_ht . '</span>';
    // ツールバー部分HTML =======
    // お気にマーク設定
    $favmark = !empty($aThread->fav) ? '★' : '+';
    $favvalue = !empty($aThread->fav) ? 0 : 1;
    $favtitle = $favvalue ? 'お気にスレに追加' : 'お気にスレから外す';
    $setfav_q = '&amp;setfav=' . $favvalue;
    $itaj_hs = hs($aThread->itaj);
    $similar_qs = array('detect_hint' => '◎◇', 'itaj_en' => base64_encode($aThread->itaj), 'method' => 'similar', 'word' => $aThread->ttitle_hc);
    $b_qs = array(UA::getQueryKey() => UA::getQueryValue());
    $info_qs = array_merge($thread_qs, $b_qs, array('ttitle_en' => $ttitle_en));
    $ita_atag = P2View::tagA(UriUtil::buildQueryUri($_conf['subject_php'], array_merge($thread_qs, $b_qs)), hs($aThread->itaj), array('style' => 'white-space: nowrap;', 'target' => 'subject', 'title' => '板を開く'));
    $similar_atag = P2View::tagA(UriUtil::buildQueryUri($_conf['subject_php'], array_merge($similar_qs, $thread_qs, $b_qs, array('refresh' => 1))), hs('似スレ'), array('style' => 'white-space: nowrap;', 'target' => 'subject', 'title' => '同じ板からタイトルが似ているスレッドを検索する'));
    $info_url = UriUtil::buildQueryUri('info.php', $info_qs);
    $info_url_hs = hs($info_url);
    $info_hs = hs($info_st);
    $js_q_hs = hs(UriUtil::buildQuery(array_merge($info_qs, $sid_qs)));
    $motothre_atag = P2View::tagA($motothre_url, '元スレ', array('style' => 'white-space: nowrap;', 'title' => '板サーバ上のオリジナルスレを表\示'));
    $toolbar_right_ht = <<<EOTOOLBAR
            {$ita_atag}
            {$similar_atag}

\t\t<a style="white-space: nowrap;" href="{$info_url_hs}" target="info" onClick="return !openSubWin('{$info_url_hs}{$popup_q}{$sid_q}',{$STYLE['info_pop_size']},0,0)" title="スレッド情報を表\示">{$info_hs}</a>

\t\t<span class="setfav" style="white-space: nowrap;"><a href="{$info_url_hs}{$setfav_q}{$sid_q}" target="info" onClick="return setFavJs('{$js_q_hs}', '{$favvalue}', {$STYLE['info_pop_size']}, 'read_new', this);" title="{$favtitle}">お気に{$favmark}</a></span>

\t\t<span style="white-space: nowrap;"><a href="{$info_url_hs}&amp;dele=1" target="info" onClick="return !deleLog('{$js_q_hs}', {$STYLE['info_pop_size']}, 'read_new',  this);" title="ログを削除する。自動で「お気にスレ」「殿堂」からも外れます。">{$dele_st}</a></span>

<!--\t\t<a style="white-space: nowrap;" href="{$info_url_hs}&amp;taborn=2" target="info" onClick="return !openSubWin('{$info_url_hs}&amp;popup=2&amp;taborn=2{$sid_q}',{$STYLE['info_pop_size']},0,0)" title="スレッドのあぼーん状態をトグルする">あぼん</a> -->

\t\t{$motothre_atag}
EOTOOLBAR;
    // レスのすばやさ
    $spd_ht = "";
    if ($spd_st = $aThread->getTimePerRes() and $spd_st != "-") {
        $spd_ht = '<span class="spd" style="white-space: nowrap;" title="すばやさ=時間/レス">' . $spd_st . '</span>';
    }
    // フッタ部分HTML
    $read_atag = P2View::tagA(UriUtil::buildQueryUri($_conf['read_php'], array_merge($thread_qs, array('offline' => '1', 'rescount' => $aThread->rescount))) . '#r' . rawurlencode($aThread->rescount), hs($aThread->ttitle_hc));
    $read_footer_ht = <<<EOP
\t<table class="toolbar" width="100%" style="padding:0px 10px 0px 0px;">
\t\t<tr>
\t\t\t<td align="left">
\t\t\t\t{$res1['body']} | {$read_atag} | {$dores_ht} {$spd_ht}
\t\t\t</td>
\t\t\t<td align="right">
\t\t\t\t{$toolbar_right_ht}
\t\t\t</td>
\t\t\t<td align="right">
\t\t\t\t<a href="#ntt{$_newthre_num}">▲</a>
\t\t\t</td>
\t\t</tr>
\t</table>

EOP;
    // 透明あぼーんで表示がない場合はスキップ
    if ($GLOBALS['newres_to_show_flag']) {
        echo '<div style="width:100%;">' . "\n";
        // ほぼIE ActiveXのGray()のためだけに囲ってある
        echo $read_header_ht;
        echo $read_cont_ht;
        echo $read_footer_ht;
        echo '</div>' . "\n\n";
        echo '<hr>' . "\n\n";
    }
    // key.idx の値設定
    if ($aThread->rescount) {
        $aThread->readnum = min($aThread->rescount, max(0, $data[5], $aThread->resrange['to']));
        $newline = $aThread->readnum + 1;
        // $newlineは廃止予定だが、後方互換用に念のため
        $sar = array($aThread->ttitle, $aThread->key, $data[2], $aThread->rescount, $aThread->modified, $aThread->readnum, $data[6], $data[7], $data[8], $newline, $data[10], $data[11], $aThread->datochiok);
        P2Util::recKeyIdx($aThread->keyidx, $sar);
        // key.idx に記録
    }
    unset($aThread);
}