/** * 登録されているRSS一覧を表示 */ function print_rss_list() { global $_conf; echo "<div class=\"menu_cate\">\n"; echo "<b class=\"menu_cate\" onclick=\"showHide('c_rss');\">RSS</b>\n"; echo "[<a href=\"editrss.php\" target=\"subject\">編集</a>]\n"; // RSS切り替え if ($_conf['expack.misc.multi_favs']) { echo "<br>\n"; echo FavSetManager::makeFavSetSwitchElem('m_rss_set', 'RSS', true, "replaceMenuItem('c_rss', 'm_rss_set', this.options[this.selectedIndex].value);"); } echo "\t<div class=\"itas\" id=\"c_rss\">\n"; if ($rss_list = FileCtl::file_read_lines($_conf['expack.rss.setting_path'], FILE_IGNORE_NEW_LINES)) { foreach ($rss_list as $rss_info) { $p = explode("\t", $rss_info); if (count($p) > 1) { $site = $p[0]; $xml = $p[1]; if (!empty($p[2])) { $atom = 1; $atom_q = '&atom=1'; } else { $atom = 0; $atom_q = ''; } $localpath = rss_get_save_path($xml); if (PEAR::isError($localpath)) { echo "\t " . $site . ' ' . $localpath->getMessage() . "<br>\n"; } else { $mtime = file_exists($localpath) ? filemtime($localpath) : 0; $site_en = UrlSafeBase64::encode($site); $xml_en = rawurlencode($xml); $rss_q = sprintf('?xml=%s&site_en=%s%s&mt=%d', $xml_en, $site_en, $atom_q, $mtime); $rss_q_ht = p2h($rss_q); echo "\t <a href=\"subject_rss.php{$rss_q_ht}\">{$site}</a><br>\n"; } flush(); } } } else { echo "\t\t (空っぽ)\n"; } echo "\t</div>\n"; echo "</div>\n"; flush(); }
//============================================================== if ($_conf['expack.rss.enabled']) { require_once P2EX_LIB_DIR . '/rss/menu.inc.php'; } flush(); //============================================================== // ■特別 //============================================================== $norefresh_q = '&norefresh=true'; echo <<<EOP <div class="menu_cate"><b><a class="menu_cate" href="javascript:void(0);" onclick="showHide('c_spacial');" target="_self">特別</a></b> EOP; if ($_conf['expack.misc.multi_favs']) { $favlist_onchange = "openFavList('{$_conf['subject_php']}', this.options[this.selectedIndex].value, window.top.subject);"; echo "<br>\n"; echo FavSetManager::makeFavSetSwitchElem('m_favlist_set', 'お気にスレ', FALSE, $favlist_onchange); } echo <<<EOP <div class="itas" id="c_spacial"> EOP; // ■新着数を表示する場合 if ($_conf['enable_menu_new'] == 1 && $_GET['new']) { // 並列ダウンロードの設定 if ($_conf['expack.use_pecl_http'] == 1) { P2HttpExt::activate(); $GLOBALS['expack.subject.multi-threaded-download.done'] = true; } elseif ($_conf['expack.use_pecl_http'] == 2) { $GLOBALS['expack.subject.multi-threaded-download.done'] = true; } // {{{ お気にスレ // ダウンロード
/** * お気にスレ、お気に板、RSSのセットリストを切り替えるフォームを生成する * * @param string $set_name * @param string $set_title * @param string $script * @param bool $inline * @param array $hidden_values * @return string */ public static function makeFavSetSwitchForm($set_name, $set_title, $script = null, $target = null, $inline = false, array $hidden_values = null) { global $_conf; // 変数初期化 if (!$script) { $script = $_SERVER['SCRIPT_NAME']; } if (!$target) { $target = '_self'; } $style = $inline ? ' style="display:inline;"' : ''; // フォーム作成 $form_ht = "<form method=\"get\" action=\"{$script}\" target=\"{$target}\"{$style}>"; $form_ht .= $_conf['k_input_ht']; if (is_array($hidden_values)) { foreach ($hidden_values as $key => $value) { $value = p2h($value); $form_ht .= "<input type=\"hidden\" name=\"{$key}\" value=\"{$value}\">"; } } $form_ht .= FavSetManager::makeFavSetSwitchElem($set_name, $set_title, true); $submit_value = $_conf['ktai'] ? 'セット切替' : 'セット切替'; $form_ht .= "<input type=\"submit\" value=\"{$submit_value}\"></form>\n"; return $form_ht; }
/** * お気に板をプリントする */ public function printFavIta() { global $_conf, $matome_i, $STYLE; $menu_php_ht = p2h(isset($GLOBALS['menu_php_self']) ? $GLOBALS['menu_php_self'] : $_SERVER['SCRIPT_NAME']); echo <<<EOP <div class="menu_cate"> <b><a class="menu_cate" href="javascript:void(0);" onclick="showHide('c_favita');" target="_self">お気に板</a></b> [<a href="editfavita.php" target="subject">編集</a>] EOP; // お気に板切り替え if ($_conf['expack.misc.multi_favs']) { echo "<br>\n"; echo FavSetManager::makeFavSetSwitchElem('m_favita_set', 'お気に板', true, "replaceMenuItem('c_favita', 'm_favita_set', this.options[this.selectedIndex].value);"); } if ($_conf['expack.misc.multi_favs']) { $favset_title = FavSetManager::getFavSetPageTitleHt('m_favita_set', 'お気に板'); } else { $favset_title = 'お気に板'; } echo " <div class=\"itas\" id=\"c_favita\">\n"; if ($_conf['merge_favita']) { echo <<<EOP <a href="{$_conf['subject_php']}?spmode=merge_favita{$_conf['m_favita_set_at_a']}">{$favset_title} (まとめ)</a><br> EOP; } // favita読み込み $favitas = array(); if ($lines = FileCtl::file_read_lines($_conf['favita_brd'], FILE_IGNORE_NEW_LINES)) { foreach ($lines as $l) { if (preg_match("/^\t?(.+)\t(.+)\t(.+)\$/", $l, $matches)) { $favitas[] = array('host' => $matches[1], 'bbs' => $matches[2], 'itaj' => $matches[3]); } } } if ($favitas) { // 新着数を表示する場合・まとめてプリフェッチ if ($_conf['enable_menu_new'] && !empty($_GET['new'])) { 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; } } } foreach ($favitas as $favita) { extract($favita); $itaj_view = p2h($itaj); $itaj_en = UrlSafeBase64::encode($itaj); $itaj_js = addslashes($itaj_view); $p_htm['star'] = <<<EOP <a href="{$menu_php_ht}?host={$host}&bbs={$bbs}&setfavita=0{$_conf['m_favita_set_at_a']}" target="_self" class="fav" title="「{$itaj_view}」をお気に板から外す" onclick="return window.confirm('「{$itaj_js}」をお気に板から外してよろしいですか?');">★</a> EOP; // onclick="return confirmSetFavIta('{$itaj_ht}');" // 新着数を表示する場合 if ($_conf['enable_menu_new'] && !empty($_GET['new'])) { $matome_i++; $spmode = null; // $shinchaku_num, $_newthre_num をセット include P2_LIB_DIR . '/subject_new.inc.php'; if ($shinchaku_num > 0) { $class_newres_num = ' class="newres_num"'; } else { $class_newres_num = ' class="newres_num_zero"'; } if ($_newthre_num) { $newthre_ht = "{$_newthre_num}"; } else { $newthre_ht = ''; } echo <<<EOP {$p_htm['star']} <a href="{$_conf['subject_php']}?host={$host}&bbs={$bbs}&itaj_en={$itaj_en}" onclick="chMenuColor({$matome_i});">{$itaj_view}</a> <span id="newthre{$matome_i}" class="newthre_num">{$newthre_ht}</span> (<a href="{$_conf['read_new_php']}?host={$host}&bbs={$bbs}" target="read" id="un{$matome_i}" onclick="chUnColor({$matome_i});"{$class_newres_num}>{$shinchaku_num}</a>)<br> EOP; // 新着数を表示しない場合 } else { echo <<<EOP {$p_htm['star']} <a href="{$_conf['subject_php']}?host={$host}&bbs={$bbs}&itaj_en={$itaj_en}">{$itaj_view}</a><br> EOP; } flush(); } // foreach // 空っぽなら } else { echo ' (空っぽ)'; } echo " </div>\n</div>\n"; }