function readNew($aThread) { global $_conf, $newthre_num, $STYLE; global $spmode, $word, $newtime; $orig_no_label = !empty($_conf['expack.iphone.toolbars.no_label']); $_conf['expack.iphone.toolbars.no_label'] = true; $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(); $ttitle_en = UrlSafeBase64::encode($aThread->ttitle); $ttitle_en_q = '&ttitle_en=' . $ttitle_en; $bbs_q = '&bbs=' . $aThread->bbs; $key_q = '&key=' . $aThread->key; $host_bbs_key_q = 'host=' . $aThread->host . $bbs_q . $key_q; $popup_q = '&popup=1'; $itaj_hd = htmlspecialchars($aThread->itaj, ENT_QUOTES, 'Shift_JIS'); if ($spmode) { $read_header_itaj_ht = "({$itaj_hd})"; } else { $read_header_itaj_ht = ''; } if ($_conf['iphone']) { if ($read_header_itaj_ht !== '') { $read_header_itaj_ht = "<span class=\"btitle\">{$read_header_itaj_ht}</span>"; } $read_header_ht = <<<EOP <div class="ntoolbar mtoolbar mtoolbar_top" id="ntt{$newthre_num}"> <h2 class="ttitle">{$aThread->ttitle_hd} {$read_header_itaj_ht}</h2> EOP; $read_header_ht .= '<div class="mover">'; $read_header_ht .= toolbar_i_standard_button('img/gp2-down.png', '', sprintf('#ntt%d', $newthre_num + 1)); $read_header_ht .= '</div>'; $info_ht = P2Util::getInfoHtml(); if (strlen($info_ht)) { $read_header_ht .= "<div class=\"info\">{$info_ht}</div>"; } $read_header_ht .= '</div>'; } else { P2Util::printInfoHtml(); $read_header_ht = <<<EOP <hr><div id="ntt{$newthre_num}" name="ntt{$newthre_num}"><font color="{$STYLE['mobile_read_ttitle_color']}"><b>{$aThread->ttitle_hd}</b></font> {$read_header_itaj_ht} <a href="#ntt_bt{$newthre_num}">▼</a></div><hr> EOP; } //================================================================== // ローカルDatを読み込んでHTML表示 //================================================================== $aThread->resrange['nofirst'] = true; $GLOBALS['newres_to_show_flag'] = false; $read_cont_ht = ''; if ($aThread->rescount) { $aShowThread = new ShowThreadK($aThread, true); if ($_conf['iphone'] && $_conf['expack.spm.enabled']) { $read_cont_ht .= $aShowThread->getSpmObjJs(); } $read_cont_ht .= $aShowThread->getDatToHtml(); unset($aShowThread); } //================================================================== // フッタ 表示 //================================================================== // 表示範囲 if ($aThread->resrange['start'] == $aThread->resrange['to']) { $read_range_on = $aThread->resrange['start']; } else { $read_range_on = "{$aThread->resrange['start']}-{$aThread->resrange['to']}"; } $read_range_ht = "{$read_range_on}/{$aThread->rescount}"; // ツールバー部分HTML ======= if ($spmode) { $toolbar_itaj_ht = "(<a href=\"{$_conf['subject_php']}?{$host_bbs_key_q}{$_conf['k_at_a']}\">{$itaj_hd}</a>)"; } else { $toolbar_itaj_ht = ''; } if ($_conf['iphone']) { if ($toolbar_itaj_ht !== '') { $toolbar_itaj_ht = "<span class=\"btitle\">{$toolbar_itaj_ht}</span>"; } $read_footer_ht = <<<EOP <div class="ntoolbar mtoolbar mtoolbar_bottom" id="ntt_btm{$newthre_num}"> <table><tbody><tr> EOP; // 情報 $read_footer_ht .= '<td>'; $escaped_url = "info.php?{$host_bbs_key_q}{$ttitle_en_q}{$_conf['k_at_a']}"; $read_footer_ht .= toolbar_i_opentab_button('img/gp5-info.png', '', $escaped_url); $read_footer_ht .= '</td>'; // 表示範囲 $read_footer_ht .= "<td colspan=\"3\"><span class=\"large\">{$read_range_ht}</span></td>"; // ツール $read_footer_ht .= '<td>'; $escaped_url = "spm_k.php?{$host_bbs_key_q}&ls={$aThread->ls}&spm_default={$aThread->resrange['to']}{$_conf['k_at_a']}"; $read_footer_ht .= toolbar_i_opentab_button('img/glyphish/icons2/20-gear2.png', '', $escaped_url); $read_footer_ht .= '</td>'; // タイトル等 $read_footer_ht .= <<<EOP </tr></tbody></table> <div class="ttitle"><a href="{$_conf['read_php']}?{$host_bbs_key_q}&offline=1&rescount={$aThread->rescount}{$_conf['k_at_a']}" target="_blank">{$aThread->ttitle_hd}</a> {$toolbar_itaj_ht}</div> <div class="mover"> EOP; $read_footer_ht .= toolbar_i_standard_button('img/gp1-up.png', '', "#ntt{$newthre_num}"); $read_footer_ht .= '</div></div>'; } else { $read_footer_ht = <<<EOP <div id="ntt_bt{$newthre_num}" name="ntt_bt{$newthre_num}" class="read_new_toolbar"> {$read_range_ht} <a href="info.php?{$host_bbs_key_q}{$ttitle_en_q}{$_conf['k_at_a']}">情</a> <a href="spm_k.php?{$host_bbs_key_q}&ls={$aThread->ls}&spm_default={$aThread->resrange['to']}&from_read_new=1{$_conf['k_at_a']}">特</a> <br> <a href="{$_conf['read_php']}?{$host_bbs_key_q}&offline=1&rescount={$aThread->rescount}{$_conf['k_at_a']}#r{$aThread->rescount}">{$aThread->ttitle_hd}</a> {$toolbar_itaj_ht} <a href="#ntt{$newthre_num}">▲</a> </div> <hr> EOP; } // 透明あぼーんや表示数制限で新しいレス表示がない場合はスキップ if ($GLOBALS['newres_to_show_flag']) { echo $read_header_ht; echo $read_cont_ht; echo $read_footer_ht; } //================================================================== // 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に記録 } $_conf['expack.iphone.toolbars.no_label'] = $orig_no_label; }
/** * お気にスレをセットする * * @param string $host * @param string $bbs * @param string $key * @param int|string $setfavita 0(解除), 1(追加), 2(トグル), top, up, down, bottom * @param string $ttitle * @param int|null $setnum * @return bool */ function setFav($host, $bbs, $key, $setfav, $ttitle = null, $setnum = null) { global $_conf; //================================================================== // key.idx //================================================================== // idxfileのパスを求めて $idxfile = P2Util::idxDirOfHostBbs($host, $bbs) . $key . '.idx'; // 板ディレクトリが無ければ作る // FileCtl::mkdirFor($idxfile); // 既にidxデータがあるなら読み込む if ($lines = FileCtl::file_read_lines($idxfile, FILE_IGNORE_NEW_LINES)) { $data = explode('<>', $lines[0]); } else { $data = array_fill(0, 12, ''); if (is_string($ttitle) && strlen($ttitle)) { $data[0] = p2h($ttitle, false); } } // {{{ スレッド.idx 記録 if (($setfav == '0' || $setfav == '1') && $_conf['favlist_idx'] == $_conf['orig_favlist_idx']) { // お気にスレから外した結果、idxの意味がなくなれば削除する if ($setfav == '0' and !$data[3] && !$data[4] && $data[9] <= 1) { @unlink($idxfile); } else { $sar = array($data[0], $key, $data[2], $data[3], $data[4], $data[5], $setfav, $data[7], $data[8], $data[9], $data[10], $data[11], $data[12]); P2Util::recKeyIdx($idxfile, $sar); } } // }}} //================================================================== // favlist.idx //================================================================== if (!is_null($setnum) && $_conf['expack.misc.multi_favs']) { if (0 < $setnum && $setnum <= $_conf['expack.misc.favset_num']) { $favlist_idx = $_conf['pref_dir'] . sprintf('/p2_favlist%d.idx', $setnum); } else { $favlist_idx = $_conf['orig_favlist_idx']; } } else { $favlist_idx = $_conf['favlist_idx']; } // favlistファイルがなければ生成 FileCtl::make_datafile($favlist_idx); // favlist読み込み $favlines = FileCtl::file_read_lines($favlist_idx, FILE_IGNORE_NEW_LINES); //================================================ // 処理 //================================================ $neolines = array(); $before_line_num = 0; $was_set = false; // 最初に重複要素を削除しておく if (!empty($favlines)) { $i = -1; foreach ($favlines as $l) { $i++; $lar = explode('<>', $l); // 重複回避 if ($lar[1] == $key && $lar[11] == $bbs) { $before_line_num = $i; // 移動前の行番号をセット $was_set = true; continue; // keyのないものは不正データなのでスキップ } elseif (!$lar[1]) { continue; } else { $neolines[] = $l; } } } if ($setfav == 2) { $setfav = $was_set ? 0 : 1; } // 記録データ設定 if ($setfav) { if (!function_exists('getSetPosLines')) { include P2_LIB_DIR . '/getsetposlines.inc.php'; } $newdata = "{$data[0]}<>{$key}<>{$data[2]}<>{$data[3]}<>{$data[4]}<>{$data[5]}<>1<>{$data[7]}<>{$data[8]}<>{$data[9]}<>{$host}<>{$bbs}"; $rec_lines = getSetPosLines($neolines, $newdata, $before_line_num, $setfav); } else { $rec_lines = $neolines; } $cont = ''; if (!empty($rec_lines)) { foreach ($rec_lines as $l) { $cont .= $l . "\n"; } } // 書き込む if (FileCtl::file_write_contents($favlist_idx, $cont) === false) { p2die('cannot write file.'); } //================================================ // お気にスレ共有 //================================================ if ($_conf['join_favrank'] && $_conf['favlist_idx'] == $_conf['orig_favlist_idx']) { if ($setfav == "0") { $act = "out"; } elseif ($setfav == "1") { $act = "add"; } else { return; } $itaj = P2Util::getItaName($host, $bbs); $post = array("host" => $host, "bbs" => $bbs, "key" => $key, "ttitle" => $data[0], "ita" => $itaj, "act" => $act); postFavRank($post); } return true; }
/** * スレッドの新着部分を読み込んで表示する */ function _readNew(&$aThread) { global $_conf, $_newthre_num, $STYLE; global $spmode; $_newthre_num++; $hr = P2View::getHrHtmlK(); //========================================================== // 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 (is_readable($aThread->keyidx)) { $lines = file($aThread->keyidx); $data = explode('<>', rtrim($lines[0])); } $aThread->getThreadInfoFromIdx(); //$aThread->readDatInfoFromFile(); // DATのダウンロード if (!(strlen(geti($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(); $ttitle_en = base64_encode($aThread->ttitle); $ttitle_en_q = "&ttitle_en=" . $ttitle_en; $bbs_q = "&bbs=" . $aThread->bbs; $key_q = "&key=" . $aThread->key; $popup_q = "&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>"; } //$next_thre_ht = "<a href=\"#ntt{$next_thre_num}\">▼</a> "; $next_thre_ht = "<a class=\"button\" href=\"#ntt_bt{$_newthre_num}\">▼</a> "; if ($spmode) { $read_header_itaj_ht = sprintf(' (%s)', hs($aThread->itaj)); if ($_conf['k_save_packet']) { $read_header_itaj_ht = mb_convert_kana($read_header_itaj_ht, 'rnsk'); } } // スマートポップアップメニュー JavaScriptコード if ($_conf['enable_spm']) { // フォントサイズ等 conf_user_style.inc.php をいじるとPCも変わるのでここで書き換え $STYLE['respop_color'] = "#FFFFFF"; // ("#000") レスポップアップのテキスト色 $STYLE['respop_bgcolor'] = ""; // ("#ffffcc") レスポップアップの背景色 $STYLE['respop_fontsize'] = '13px'; $aThread->showSmartPopUpMenuJs(); } P2Util::printInfoHtml(); $ttitle_hs = hs($aThread->ttitle_hc); if ($_conf['k_save_packet']) { $ttitle_hs = mb_convert_kana($ttitle_hs, 'rnsk'); } $read_header_ht = <<<EOP \t<p id="ntt{$_newthre_num}" name="ntt{$_newthre_num}"><font color="{$STYLE['read_k_thread_title_color']}"><b>{$ttitle_hs}</b></font>{$read_header_itaj_ht} {$next_thre_ht}</p> \t{$hr} EOP; // {{{ ローカルDatを読み込んでHTML表示 $aThread->resrange['nofirst'] = true; $GLOBALS['newres_to_show_flag'] = false; $read_cont_ht = ''; if ($aThread->rescount) { //$aThread->datToHtml(); // dat を html に変換表示 require_once P2_IPHONE_LIB_DIR . '/ShowThreadK.php'; $aShowThread = new ShowThreadK($aThread); $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 = "次"; // 表示範囲 if ($aThread->resrange['start'] == $aThread->resrange['to']) { $read_range_on = $aThread->resrange['start']; } else { $read_range_on = "{$aThread->resrange['start']}-{$aThread->resrange['to']}"; } $read_range_ht = "{$read_range_on}/{$aThread->rescount}<br>"; /* $read_footer_navi_new_ht = P2View::tagA( UriUtil::buildQueryUri( $_conf['read_php'], array( 'host' => $aThread->host, 'bbs' => $aThread->bbs, 'key' => $aThread->key, 'ls' => "$aThread->rescount-", 'nt' => $newtime, UA::getQueryKey() => UA::getQueryValue() ) . "#r{$aThread->rescount}" ), '新着レスの表示' ); $dores_ht _getDoResATag($aThread, $motothre_url); */ // {{{ ツールバー部分HTML if ($spmode) { $ita_atag = _getItaATag($aThread); $toolbar_itaj_ht = " ({$ita_atag})"; if ($_conf['k_save_packet']) { $toolbar_itaj_ht = mb_convert_kana($toolbar_itaj_ht, 'rnsk'); } } /* $info_atag = _getInfoATag($aThread, $info_st); $dele_atag = _getDeleATag($aThread, $dele_st); $motothre_atag = P2View::tagA($motothre_url, '元スレ') $toolbar_right_ht = "{$info_atag} {$dele_atag} {$motothre_atag}\n"; */ // }}} $read_atag = _getReadATag($aThread); $read_footer_ht = <<<EOP <div id="ntt_bt{$_newthre_num}" name="ntt_bt{$_newthre_num}"> {$read_range_ht} {$read_atag}{$toolbar_itaj_ht} <a href="#ntt{$_newthre_num}">▲</a> </div> EOP; // 透明あぼーんや表示数制限で新しいレス表示がない場合はスキップ if ($GLOBALS['newres_to_show_flag']) { echo $read_header_ht; echo $read_cont_ht; echo $read_footer_ht; } // {{{ 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->readnum, $data[6], $data[7], $data[8], $newline, $data[10], $data[11], $aThread->datochiok); P2Util::recKeyIdx($aThread->keyidx, $sar); // key.idxに記録 } // }}} unset($aThread); }
} //================================= // 後処理 //================================= // {{{ idxの値を設定、記録 if ($aThread->rescount) { // 検索の時は、既読数を更新しない if (strlen($GLOBALS['word'])) { $aThread->readnum = $idx_data[5]; } else { $aThread->readnum = min($aThread->rescount, max(0, $idx_data[5], $aThread->resrange_readnum)); } $newline = $aThread->readnum + 1; // $newlineは廃止予定だが、後方互換用に念のため // key.idxに記録 P2Util::recKeyIdx($aThread->keyidx, array($aThread->ttitle, $aThread->key, $idx_data[2], $aThread->rescount, '', $aThread->readnum, $idx_data[6], $idx_data[7], $idx_data[8], $newline, $idx_data[10], $idx_data[11], $aThread->datochiok)); } // }}} // 履歴を記録 if ($aThread->rescount) { _recRecent(array($aThread->ttitle, $aThread->key, $idx_data[2], '', '', $aThread->readnum, $idx_data[6], $idx_data[7], $idx_data[8], $newline, $aThread->host, $aThread->bbs)); } // NGあぼーんを記録 NgAbornCtl::saveNgAborns(); exit; //=============================================================================== // 関数 (このファイル内でのみ利用) //=============================================================================== /** * スレッドを指定する *
/** * @access private * @return array 読み込んだkeyデータ */ function _setFavToKeyIdx($host, $bbs, $key, $setfav) { $idxfile = P2Util::getKeyIdxFilePath($host, $bbs, $key); // FileCtl::mkdirFor($idxfile); $data = array(); // 既にidxデータがあるなら読み込む if (file_exists($idxfile) and $lines = file($idxfile)) { $l = rtrim($lines[0]); $data = explode('<>', $l); } // スレッド.idx 記録 if ($setfav == '0' || $setfav == '1') { // お気にスレから外した結果、idxの意味がなくなれば削除する if ($setfav == '0' and empty($data[3]) && empty($data[4]) && geti($data[9]) <= 1) { @unlink($idxfile); } else { P2Util::recKeyIdx($idxfile, array(geti($data[0]), $key, geti($data[2]), geti($data[3]), geti($data[4]), geti($data[5]), $setfav, geti($data[7]), geti($data[8]), geti($data[9]), $host, $bbs, geti($data[12]))); } } return $data; }
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 = '&ttitle_en=' . $ttitle_en; $bbs_q = '&bbs=' . $aThread->bbs; $key_q = '&key=' . $aThread->key; $host_bbs_key_q = 'host=' . $aThread->host . $bbs_q . $key_q; $popup_q = '&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}&ls={$aThread->rescount}-&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}&rescount={$aThread->rescount}{$ttitle_en_q}" target='_self' onclick="return OpenSubWin('post_form.php?{$host_bbs_key_q}&rescount={$aThread->rescount}{$ttitle_en_q}{$popup_q}&from_read_new=1',{$STYLE['post_pop_size']},1,0)">{$dores_st}</a> EOP; } // ツールバー部分HTML ======= // お気にマーク設定 $itaj_hd = htmlspecialchars($aThread->itaj, ENT_QUOTES); $similar_q = '&itaj_en=' . UrlSafeBase64::encode($aThread->itaj) . '&method=similar&word=' . rawurlencode($aThread->ttitle_hc); if ($_conf['expack.misc.multi_favs']) { $toolbar_setfav_ht = 'お気に['; $favdo = !empty($aThread->favs[0]) ? 0 : 1; $favdo_q = '&setfav=' . $favdo; $favmark = $favdo ? '+' : '★'; $favtitle = $favlist_titles[0] . ($favdo ? 'に追加' : 'から外す'); $setnum_q = '&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 = '&setfav=' . $favdo; $favmark = $favdo ? $i : '★'; $favtitle = $favlist_titles[$i] . ($favdo ? 'に追加' : 'から外す'); $setnum_q = '&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 = '&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}&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}&taborn=2" target="info" onclick="return OpenSubWin('info.php?{$host_bbs_key_q}{$ttitle_en_q}&popup=2&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&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}&offline=1&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に記録 } }
/** * 既読数をセットする * * @param string $host; * @param string $bbs; * @param int $key * @param int $readnum * @return bool */ function httpcmd_set_readnum($host, $bbs, $key, $readnum) { if (!is_numeric($readnum) || ($readnum = intval($readnum)) < 0) { return false; } $aThread = new Thread(); $aThread->setThreadPathInfo($host, $bbs, $key); $lines = FileCtl::file_read_lines($aThread->keyidx, FILE_IGNORE_NEW_LINES); if (!$lines) { return false; } $idx_data = explode('<>', $lines[0]); if (count($idx_data) < 12) { return false; } $idx_data[5] = $readnum; $idx_data[9] = $readnum > 0 ? $readnum - 1 : 0; P2Util::recKeyIdx($aThread->keyidx, $idx_data); return true; }
/** * key.idxに名前とメールを保存する * * @return void */ function _recKeyIdx($host, $bbs, $key, $tagCsvF) { if (!($host && $bbs && $key)) { return; } $keyidx = P2Util::getKeyIdxFilePath($host, $bbs, $key); $akeyline = array(); if (file_exists($keyidx) and $keylines = file($keyidx)) { $akeyline = explode('<>', rtrim($keylines[0])); } $sar = array($akeyline[0], $akeyline[1], $akeyline[2], $akeyline[3], $akeyline[4], $akeyline[5], $akeyline[6], $tagCsvF['FROM'], $tagCsvF['mail'], $akeyline[9], $akeyline[10], $akeyline[11], $akeyline[12]); P2Util::recKeyIdx($keyidx, $sar); }
} // フッタHTML 表示 require_once P2_IPHONE_LIB_DIR . '/read_footer.inc.php'; } // {{{ idxの値を設定、記録 if ($aThread->rescount) { // 検索の時は、既読数を更新しない if (isset($GLOBALS['word']) and strlen($GLOBALS['word']) > 0) { $aThread->readnum = $idx_data[5]; } else { $aThread->readnum = min($aThread->rescount, max(0, $idx_data[5], $aThread->resrange_readnum)); } $newline = $aThread->readnum + 1; // $newlineは廃止予定だが、旧互換用に念のため $sar = array($aThread->ttitle, $aThread->key, $idx_data[2], $aThread->rescount, '', $aThread->readnum, $idx_data[6], $idx_data[7], $idx_data[8], $newline, $idx_data[10], $idx_data[11], $aThread->datochiok); P2Util::recKeyIdx($aThread->keyidx, $sar); // key.idxに記録 } // }}} // 履歴を記録 if ($aThread->rescount) { $newdata = "{$aThread->ttitle}<>{$aThread->key}<>{$idx_data['2']}<><><>{$aThread->readnum}<>{$idx_data['6']}<>{$idx_data['7']}<>{$idx_data['8']}<>{$newline}<>{$aThread->host}<>{$aThread->bbs}"; recRecent($newdata); } // NGあぼーんを記録 NgAbornCtl::saveNgAborns(); exit; //=============================================================================== // 関数 (このファイル内でのみ利用) //=============================================================================== /**
/** * ■ readList メソッド */ public function readList() { global $_conf; //$GLOBALS['debug'] && $GLOBALS['profiler']->enterSection('readList()'); switch ($this->spmode) { // ローカルの履歴ファイル 読み込み case 'recent': if ($lines = FileCtl::file_read_lines($_conf['recent_idx'])) { //P2Util::pushInfoHtml('<p>履歴は空っぽです</p>'); //return false; } break; // ローカルの書き込み履歴ファイル 読み込み // ローカルの書き込み履歴ファイル 読み込み case 'res_hist': if ($lines = FileCtl::file_read_lines($_conf['res_hist_idx'])) { //P2Util::pushInfoHtml('<p>書き込み履歴は空っぽです</p>'); //return false; } break; //ローカルのお気にファイル 読み込み //ローカルのお気にファイル 読み込み case 'fav': if ($lines = FileCtl::file_read_lines($_conf['favlist_idx'])) { //P2Util::pushInfoHtml('<p>お気にスレは空っぽです</p>'); //return false; } break; // お気に板をまとめて読み込み // お気に板をまとめて読み込み case 'merge_favita': $favitas = array(); if (file_exists($_conf['favita_brd'])) { foreach (file($_conf['favita_brd']) as $l) { if (preg_match("/^\t?(.+?)\t(.+?)\t.+?\$/", rtrim($l), $m)) { $favitas[] = array('host' => $m[1], 'bbs' => $m[2]); } } } if (empty($_REQUEST['norefresh']) && !(empty($_REQUEST['refresh']) && isset($_REQUEST['word']))) { if ($_conf['expack.use_pecl_http'] == 1) { P2HttpExt::activate(); P2HttpRequestPool::fetchSubjectTxt($favitas); $GLOBALS['expack.subject.multi-threaded-download.done'] = true; } elseif ($_conf['expack.use_pecl_http'] == 2) { if (P2CommandRunner::fetchSubjectTxt('merge_favita', $_conf)) { $GLOBALS['expack.subject.multi-threaded-download.done'] = true; } } } $lines = array(); $i = 0; foreach ($favitas as $ita) { $aSubjectTxt = new SubjectTxt($ita['host'], $ita['bbs']); $k = (double) sprintf('0.%d', ++$i); if (is_array($aSubjectTxt->subject_lines)) { $j = 0; foreach ($aSubjectTxt->subject_lines as $l) { if (preg_match('/^([0-9]+)\\.(?:dat|cgi)(?:,|<>)(.+) ?(?:\\(|()([0-9]+)(?:\\)|))/', $l, $m)) { $lines[] = array('key' => $m[1], 'ttitle' => rtrim($m[2]), 'rescount' => (int) $m[3], 'host' => $ita['host'], 'bbs' => $ita['bbs'], 'torder' => ++$j + $k); } } } } break; // p2_threads_aborn.idx 読み込み // p2_threads_aborn.idx 読み込み case 'taborn': $taborn_file = $this->getIdxDir() . 'p2_threads_aborn.idx'; $lines = FileCtl::file_read_lines($taborn_file); break; // spmodeがdat倉庫の場合 // spmodeがdat倉庫の場合 case 'soko': $dat_host_bbs_dir = $this->getDatDir(false); $idx_host_bbs_dir = $this->getIdxDir(false); $lines = array(); //$GLOBALS['debug'] && $GLOBALS['profiler']->enterSection('dat'); // datログディレクトリを走査して孤立datにidx付加 if ($cdir = dir($dat_host_bbs_dir)) { // or die ("ログディレクトリがないよ!"); // ディレクトリ走査 while ($entry = $cdir->read()) { if (preg_match('/([0-9]+)\\.dat$/', $entry, $matches)) { $theidx = $idx_host_bbs_dir . DIRECTORY_SEPARATOR . $matches[1] . '.idx'; if (!file_exists($theidx)) { $thedat = $dat_host_bbs_dir . DIRECTORY_SEPARATOR . $entry; if ($datlines = FileCtl::file_read_lines($thedat, FILE_IGNORE_NEW_LINES)) { $firstdatline = $datlines[0]; if (strpos($firstdatline, '<>') !== false) { $datline_sepa = '<>'; } else { $datline_sepa = ','; } $d = explode($datline_sepa, $firstdatline); $atitle = $d[4]; $gotnum = sizeof($datlines); $readnum = $gotnum; $anewline = $readnum + 1; $data = array($atitle, $matches[1], '', $gotnum, '', $readnum, '', '', '', $anewline, '', '', ''); P2Util::recKeyIdx($theidx, $data); } } // array_push($lines, $idl[0]); } } $cdir->close(); } //$GLOBALS['debug'] && $GLOBALS['profiler']->leaveSection('dat'); //$GLOBALS['debug'] && $GLOBALS['profiler']->enterSection('idx'); // {{{ idxログディレクトリを走査してidx情報を抽出してリスト化 if ($cdir = dir($idx_host_bbs_dir)) { // or die ("ログディレクトリがないよ!"); // ディレクトリ走査 while ($entry = $cdir->read()) { if (preg_match('/([0-9]+)\\.idx$/', $entry)) { $thedix = $idx_host_bbs_dir . DIRECTORY_SEPARATOR . $entry; $idl = FileCtl::file_read_lines($thedix); if (is_array($idl)) { array_push($lines, $idl[0]); } } } $cdir->close(); } // }}} //$GLOBALS['debug'] && $GLOBALS['profiler']->leaveSection('idx'); break; // スレの殿堂の場合 // p2_palace.idx 読み込み // スレの殿堂の場合 // p2_palace.idx 読み込み case 'palace': if ($lines = FileCtl::file_read_lines($_conf['palace_idx'])) { //P2Util::pushInfoHtml('<p>殿堂はがらんどうです</p>'); //return false; } break; // オンライン上の subject.txt を読み込む(spmodeでない場合) // オンライン上の subject.txt を読み込む(spmodeでない場合) default: if (!$this->spmode) { $aSubjectTxt = new SubjectTxt($this->host, $this->bbs); $lines = $aSubjectTxt->subject_lines; } } //$GLOBALS['debug'] && $GLOBALS['profiler']->leaveSection('readList()'); return $lines; }
// key.idx 保存 //============================================= // <> を外す。。 $tag_rec['FROM'] = str_replace('<>', '', $FROM); $tag_rec['mail'] = str_replace('<>', '', $mail); // 名前とメール、空白時は P2NULL を記録 $tag_rec_n['FROM'] = $tag_rec['FROM'] == '' ? 'P2NULL' : $tag_rec['FROM']; $tag_rec_n['mail'] = $tag_rec['mail'] == '' ? 'P2NULL' : $tag_rec['mail']; if ($host && $bbs && $key) { $keyidx = P2Util::idxDirOfHostBbs($host, $bbs) . $key . '.idx'; // 読み込み if ($keylines = FileCtl::file_read_lines($keyidx, FILE_IGNORE_NEW_LINES)) { $akeyline = explode('<>', $keylines[0]); } $sar = array($akeyline[0], $akeyline[1], $akeyline[2], $akeyline[3], $akeyline[4], $akeyline[5], $akeyline[6], $tag_rec_n['FROM'], $tag_rec_n['mail'], $akeyline[9], $akeyline[10], $akeyline[11], $akeyline[12]); P2Util::recKeyIdx($keyidx, $sar); // key.idxに記録 } //============================================= // 書き込み履歴 //============================================= if (empty($posted)) { exit; } if ($host && $bbs && $key) { $lock = new P2Lock($_conf['res_hist_idx'], false); FileCtl::make_datafile($_conf['res_hist_idx'], $_conf['res_write_perm']); // なければ生成 $lines = FileCtl::file_read_lines($_conf['res_hist_idx'], FILE_IGNORE_NEW_LINES); $neolines = array(); // {{{ 最初に重複要素を削除しておく
/** * スレッドの新着部分を読み込んで表示する */ function readNew(&$aThread) { global $_conf, $_newthre_num, $STYLE; global $spmode; $_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 (is_readable($aThread->keyidx)) { $lines = file($aThread->keyidx); $data = explode('<>', rtrim($lines[0])); } $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(); $ttitle_en = base64_encode($aThread->ttitle); $ttitle_en_q = "&ttitle_en=" . $ttitle_en; $bbs_q = "&bbs=" . $aThread->bbs; $key_q = "&key=" . $aThread->key; $popup_q = "&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>"; } //$next_thre_ht = "<a href=\"#ntt{$next_thre_num}\">▼</a> "; $next_thre_ht = "<a class=\"button\" href=\"#ntt_bt{$_newthre_num}\">▼</a> "; $itaj_hs = htmlspecialchars($aThread->itaj, ENT_QUOTES); if ($spmode) { $read_header_itaj_ht = " ({$itaj_hs})"; } P2Util::printInfoHtml(); $read_header_ht = <<<EOP <p id="ntt{$_newthre_num}" name="ntt{$_newthre_num}"><font color="{$STYLE['read_k_thread_title_color']}"><b>{$aThread->ttitle_hd}</b></font>{$read_header_itaj_ht} {$next_thre_ht}</p> 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 . '/showthread.class.php'; require_once P2_IPHONE_LIB_DIR . '/showthreadk.class.php'; $aShowThread =& new ShowThreadK($aThread); $read_cont_ht .= $aShowThread->getDatToHtml(); unset($aShowThread); } //================================================================== // フッタ 表示 //================================================================== //include $read_footer_inc; //---------------------------------------------- // $read_footer_navi_new 続きを読む 新着レスの表示 $newtime = date("gis"); // リンクをクリックしても再読込しない仕様に対抗するダミークエリー $info_st = "情"; $delete_st = "削"; $prev_st = "前"; $next_st = "次"; // 表示範囲 if ($aThread->resrange['start'] == $aThread->resrange['to']) { $read_range_on = $aThread->resrange['start']; } else { $read_range_on = "{$aThread->resrange['start']}-{$aThread->resrange['to']}"; } $read_range_ht = "{$read_range_on}/{$aThread->rescount}<br>"; $read_footer_navi_new = "<a href=\"{$_conf['read_php']}?host={$aThread->host}{$bbs_q}{$key_q}&ls={$aThread->rescount}-&nt={$newtime}{$_conf['k_at_a']}#r{$aThread->rescount}\">新着レスの表\示</a>"; if (!empty($_conf['disable_res'])) { $dores_ht = <<<EOP <a href="{$motothre_url}" target="_blank">レス</a> EOP; } else { $dores_ht = <<<EOP <a href="post_form.php_i?host={$aThread->host}{$bbs_q}{$key_q}&rescount={$aThread->rescount}{$ttitle_en_q}{$_conf['k_at_a']}">レス</a> EOP; } // ツールバー部分HTML ======= if ($spmode) { $toolbar_itaj_ht = <<<EOP (<a href="{$_conf['subject_php']}?host={$aThread->host}{$bbs_q}{$key_q}{$_conf['k_at_a']}">{$itaj_hs}</a>) EOP; } $toolbar_right_ht .= <<<EOTOOLBAR <a href="info.php_i?host={$aThread->host}{$bbs_q}{$key_q}{$ttitle_en_q}{$_conf['k_at_a']}">{$info_st}</a> <a href="info.php_i?host={$aThread->host}{$bbs_q}{$key_q}{$ttitle_en_q}&dele=true{$_conf['k_at_a']}">{$delete_st}</a> <a href="{$motothre_url}">元スレ</a> EOTOOLBAR; $read_footer_ht = <<<EOP <a class="button" id="backbutton"href="{$_conf['read_php']}?host={$aThread->host}{$bbs_q}{$key_q}&offline=1&rescount={$aThread->rescount}{$_conf['k_at_a']}#r{$aThread->rescount}">{$aThread->ttitle_hd}</a> EOP; // 透明あぼーんや表示数制限で新しいレス表示がない場合はスキップ if ($GLOBALS['newres_to_show_flag']) { echo $read_header_ht; echo $read_cont_ht; echo $read_footer_ht; } //================================================================== // 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); }
/** * readList * * @access public * @return array */ function readList() { global $_conf; $GLOBALS['debug'] && $GLOBALS['profiler']->enterSection('readList()'); $lines = array(); // spmodeの場合 if ($this->spmode) { // ローカルの履歴ファイル 読み込み if ($this->spmode == "recent") { file_exists($_conf['recent_file']) and $lines = file($_conf['recent_file']); // ローカルの書き込み履歴ファイル 読み込み } elseif ($this->spmode == "res_hist") { file_exists($_conf['res_hist_idx']) and $lines = file($_conf['res_hist_idx']); // ローカルのお気にファイル 読み込み } elseif ($this->spmode == "fav") { file_exists($_conf['favlist_file']) and $lines = file($_conf['favlist_file']); // ニュース系サブジェクト読み込み } elseif ($this->spmode == "news") { unset($news); $news[] = array(host => "news2.2ch.net", bbs => "newsplus"); // ニュース速報+ $news[] = array(host => "news2.2ch.net", bbs => "liveplus"); // ニュース実況 $news[] = array(host => "book.2ch.net", bbs => "bizplus"); // ビジネスニュース速報+ $news[] = array(host => "live2.2ch.net", bbs => "news"); // ニュース速報 $news[] = array(host => "news3.2ch.net", bbs => "news2"); // ニュース議論 foreach ($news as $n) { require_once P2_LIB_DIR . '/SubjectTxt.php'; $aSubjectTxt = new SubjectTxt($n['host'], $n['bbs']); if (is_array($aSubjectTxt->subject_lines)) { foreach ($aSubjectTxt->subject_lines as $l) { if (preg_match("/^([0-9]+)\\.(dat|cgi)(,|<>)(.+) ?(\\(|()([0-9]+)(\\)|))/", $l, $matches)) { //$this->isonline = true; unset($al); $al['key'] = $matches[1]; $al['ttitle'] = rtrim($matches[4]); $al['rescount'] = $matches[6]; $al['host'] = $n['host']; $al['bbs'] = $n['bbs']; $lines[] = $al; } } } } // p2_threads_aborn.idx 読み込み } elseif ($this->spmode == 'taborn') { $file = P2Util::getThreadAbornFile($this->host, $this->bbs); if (file_exists($file)) { $lines = file($file); } // {{{ spmodeがdat倉庫の場合 @todo ページング用に数を制限できるようにしたい } elseif ($this->spmode == 'soko') { $dat_bbs_dir = P2Util::datDirOfHostBbs($this->host, $this->bbs, false); $idx_bbs_dir = P2Util::idxDirOfHostBbs($this->host, $this->bbs, false); $dat_pattern = '/([0-9]+)\\.dat$/'; $idx_pattern = '/([0-9]+)\\.idx$/'; // {{{ datログディレクトリを走査して孤立datにidx付加する $GLOBALS['debug'] && $GLOBALS['profiler']->enterSection('dat'); if ($cdir = dir($dat_bbs_dir)) { // or die ("ログディレクトリがないよ!"); while ($entry = $cdir->read()) { if (preg_match($dat_pattern, $entry, $matches)) { $theidx = $idx_bbs_dir . DIRECTORY_SEPARATOR . $matches[1] . '.idx'; if (!file_exists($theidx)) { if ($datlines = file($dat_bbs_dir . DIRECTORY_SEPARATOR . $entry)) { $firstdatline = rtrim($datlines[0]); if (strstr($firstdatline, '<>')) { $datline_sepa = '<>'; } else { $datline_sepa = ','; } $d = explode($datline_sepa, $firstdatline); $atitle = $d[4]; $gotnum = sizeof($datlines); $readnum = $gotnum; $anewline = $readnum + 1; $data = array($atitle, $matches[1], '', $gotnum, '', $readnum, '', '', '', $anewline, '', '', ''); P2Util::recKeyIdx($theidx, $data); } } // array_push($lines, $idl[0]); } } $cdir->close(); } $GLOBALS['debug'] && $GLOBALS['profiler']->leaveSection('dat'); // }}} // {{{ idxログディレクトリを走査してidx情報を抽出してリスト化 // オンラインも倉庫もまとめて抽出している。オンラインを外すのは subject.php で行っている。 $GLOBALS['debug'] && $GLOBALS['profiler']->enterSection('idx'); if ($cdir = dir($idx_bbs_dir)) { // or die ("ログディレクトリがないよ!"); $limit = 1000; // ひとまず簡易制限 $i = 0; while ($entry = $cdir->read()) { if (preg_match($idx_pattern, $entry)) { if ($idl = file($idx_bbs_dir . DIRECTORY_SEPARATOR . $entry)) { array_push($lines, $idl[0]); $i++; if ($i >= $limit) { P2Util::pushInfoHtml("<p>p2 info: idxログ数が、表\示処理可能\数である{$limit}件をオーバーしています。</p>"); break; } } } } $cdir->close(); } $GLOBALS['debug'] && $GLOBALS['profiler']->leaveSection('idx'); // }}} // }}} // スレの殿堂の場合 // p2_palace.idx 読み込み } elseif ($this->spmode == "palace") { $palace_idx = $_conf['pref_dir'] . '/p2_palace.idx'; file_exists($palace_idx) and $lines = file($palace_idx); } // オンライン上の subject.txt を読み込む(spmodeでない場合) } else { require_once P2_LIB_DIR . '/SubjectTxt.php'; $aSubjectTxt = new SubjectTxt($this->host, $this->bbs); $lines = $aSubjectTxt->subject_lines; } $GLOBALS['debug'] && $GLOBALS['profiler']->leaveSection('readList()'); return $lines; }
/** * スレッドの新着部分を読み込んで表示する * * @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 = "&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 = '&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}&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}&taborn=2" target="info" onClick="return !openSubWin('{$info_url_hs}&popup=2&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); }