/** * お気に入りセットリストを更新する * * @return boolean 更新に成功したらTRUE, 失敗したらFALSE */ function updateFavSetList() { global $_conf; if (file_exists($_conf['expack.misc.favset_file'])) { $setlist_titles = FavSetManager::getFavSetTitles(); } else { FileCtl::make_datafile($_conf['expack.misc.favset_file']); } if (empty($setlist_titles)) { $setlist_titles = array(); } $setlist_names = array('m_favlist_set', 'm_favita_set', 'm_rss_set'); foreach ($setlist_names as $setlist_name) { if (isset($_POST["{$setlist_name}_titles"]) && is_array($_POST["{$setlist_name}_titles"])) { $setlist_titles[$setlist_name] = array(); for ($i = 0; $i <= $_conf['expack.misc.favset_num']; $i++) { if (!isset($_POST["{$setlist_name}_titles"][$i])) { $setlist_titles[$setlist_name][$i] = ''; continue; } $newname = trim($_POST["{$setlist_name}_titles"][$i]); $newname = preg_replace('/\\r\\n\\t/', ' ', $newname); $newname = htmlspecialchars($newname, ENT_QUOTES); $setlist_titles[$setlist_name][$i] = $newname; } } } $newdata = serialize($setlist_titles); if (FileCtl::file_write_contents($_conf['expack.misc.favset_file'], $newdata) === FALSE) { P2Util::pushInfoHtml("<p>p2 error: {$_conf['expack.misc.favset_file']} にお気に入りセット設定を書き込めませんでした。"); return FALSE; } return TRUE; }
} else { $favita[$no] = $name = $no ? "お気に板{$no}" : 'お気に板'; } echo "<li><a href=\"#favita{$no}\">{$name}</a></li>"; } echo "</ul>\n"; $orig_favita_brd = $_conf['favita_brd']; foreach ($favita as $no => $name) { $_conf['favita_brd'] = $_conf['pref_dir'] . DIRECTORY_SEPARATOR . ($no ? "p2_favita{$no}.brd" : 'p2_favita.brd'); menu_iphone_show_favorite_boards($name, $no); } $_conf['favita_brd'] = $orig_favita_brd; // }}} // {{{ RSS if ($_conf['expack.rss.enabled']) { $rss = FavSetManager::getFavSetTitles('m_rss_set'); if (!$rss) { $rss = array(); } echo '<ul id="rss" title="RSS">'; for ($no = 0; $no <= $_conf['expack.misc.favset_num']; $no++) { if (isset($rss[$no]) && strlen($rss[$no]) > 0) { $name = $rss[$no]; } else { $rss[$no] = $name = $no ? "RSS{$no}" : 'RSS'; } echo "<li><a href=\"#rss{$no}\">{$name}</a></li>"; } echo "</ul>\n"; $orig_rss_setting_path = $_conf['expack.rss.setting_path']; foreach ($rss as $no => $name) {
<input type="hidden" name="bbs" value="{$aThread->bbs}"> <input type="hidden" name="key" value="{$aThread->key}"> <input type="text" size="7" name="ls" value="{$aThread->ls}"> {$_conf['k_input_ht']} <input type="submit" value="go"> </form> GOTO; //==================================================================== // HTMLプリント //==================================================================== // ツールバー部分HTML ======= // お気にマーク設定 $similar_q = '&itaj_en=' . UrlSafeBase64::encode($aThread->itaj) . '&method=similar&word=' . rawurlencode($aThread->ttitle_hc) . '&refresh=1'; $itaj_hd = p2h($aThread->itaj); if ($_conf['expack.misc.multi_favs']) { $favlist_titles = FavSetManager::getFavSetTitles('m_favlist_set'); $toolbar_setfav_ht = 'お気に['; $favdo = !empty($aThread->favs[0]) ? 0 : 1; $favdo_q = '&setfav=' . $favdo; $favmark = $favdo ? '+' : '★'; $favtitle = (!isset($favlist_titles[0]) || $favlist_titles[0] == '' ? 'お気にスレ' : $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', 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 = (!isset($favlist_titles[$i]) || $favlist_titles[$i] == '' ? 'お気にスレ' . $i : $favlist_titles[$i]) . ($favdo ? 'に追加' : 'から外す'); $setnum_q = '&setnum=' . $i;
/** * お気にスレ、お気に板、RSSのセットリストを切り替えるselect要素を生成する * * @param string $set_name * @param string $set_title * @param bool $set_selected * @param string $onchange * @return string */ public static function makeFavSetSwitchElem($set_name, $set_title, $set_selected = false, $onchange = null) { global $_conf; // 変数初期化 $i = isset($_SESSION[$set_name]) ? (int) $_SESSION[$set_name] : 0; if ($onchange) { $onchange_ht = " onchange=\"{$onchange}\""; } else { $onchange_ht = ''; } // ユーザ設定タイトルを読み込む if (!($titles = FavSetManager::getFavSetTitles($set_name))) { $titles = array(); } // SELECT要素作成 $select_ht = "<select name=\"{$set_name}\"{$onchange_ht}>"; if (!$set_selected) { $select_ht .= "<option value=\"{$i}\" selected>[{$set_title}]</option>"; } for ($j = 0; $j <= $_conf['expack.misc.favset_num']; $j++) { if (!isset($titles[$j]) || strlen($titles[$j]) == 0) { $titles[$j] = $j == 0 ? $set_title : $set_title . $j; } // 全角英数スペースカナを半角に if ($_conf['ktai'] && $_conf['mobile.save_packet']) { $titles[$j] = mb_convert_kana($titles[$j], 'rnsk'); } $selected = $set_selected && $i == $j ? ' selected' : ''; $select_ht .= "<option value=\"{$j}\"{$selected}>{$titles[$j]}</option>"; } $select_ht .= "</select>\n"; return $select_ht; }
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 string $key * @return object スレッド情報 */ function get_thread_info($host, $bbs, $key) { global $_conf; $group = P2Util::getHostGroupName($host); $info = new stdClass(); $info->type = 'thread'; $info->group = $group; $info->host = $host; $info->bbs = $bbs; $info->key = $key; $aThread = new Thread(); // hostを分解してidxファイルのパスを求める $aThread->setThreadPathInfo($host, $bbs, $key); $key_line = $aThread->getThreadInfoFromIdx(); // $aThread->length をset $aThread->getDatBytesFromLocalDat(); // 板名を取得 $aThread->itaj = P2Util::getItaName($host, $bbs); if (!$aThread->itaj) { if (isset($_GET['itaj_en'])) { $aThread->itaj = UrlSafeBase64::decode($_GET['itaj_en']); } else { $aThread->itaj = $bbs; } } $info->itaj = $aThread->itaj; // スレタイトルを取得 if (!$aThread->ttitle) { if (isset($_GET['ttitle_en'])) { $aThread->setTtitle(UrlSafeBase64::decode($_GET['ttitle_en'])); } else { $aThread->setTitleFromLocal(); } } $info->ttitle = $aThread->ttitle; // お気にスレ登録状況を取得 $favs = array(); if ($_conf['expack.misc.multi_favs']) { $favlist_titles = FavSetManager::getFavSetTitles('m_favlist_set'); for ($i = 0; $i <= $_conf['expack.misc.favset_num']; $i++) { if (!isset($favlist_titles[$i]) || $favlist_titles[$i] == '') { if ($i == 0) { $favtitle = 'お気にスレ'; } else { $favtitle = "お気にスレ{$i}"; } } else { $favtitle = $favlist_titles[$i]; } $favs[$i] = array('title' => $favtitle, 'set' => !empty($aThread->favs[$i])); } } else { $favs[0] = array('title' => 'お気にスレ', 'set' => !empty($aThread->fav)); } $info->favs = $favs; // 殿堂チェック $info->palace = false; if ($pallines = FileCtl::file_read_lines($_conf['palace_idx'], FILE_IGNORE_NEW_LINES)) { foreach ($pallines as $l) { $palarray = explode('<>', $l); if ($aThread->key == $palarray[1] && $aThread->bbs == $palarray[11]) { if (P2Util::getHostGroupName($palarray[10]) == $group) { $info->palace = true; break; } } } } // スレッドあぼーんチェック $info->taborn = false; $taborn_idx = P2Util::idxDirOfHostBbs($host, $bbs) . 'p2_threads_aborn.idx'; if ($tabornlines = FileCtl::file_read_lines($taborn_idx, FILE_IGNORE_NEW_LINES)) { foreach ($tabornlines as $l) { $tabornarray = explode('<>', $l); if ($key == $tabornarray[1]) { $info->taborn = true; break; } } } // ログ関連 $hasLog = false; if (file_exists($aThread->keydat)) { $info->keydat = $aThread->keydat; $info->length = $aThread->length; $hasLog = true; } else { $info->keydat = null; $info->length = -1; } if (file_exists($aThread->keyidx)) { $info->keyidx = $aThread->keyidx; $hasLog = true; } else { $info->keyidx = null; } if ($aThread->gotnum) { $info->gotnum = $aThread->gotnum; } elseif ($hasLog) { $info->gotnum = 0; } else { $info->gotnum = -1; } return $info; }