// {{{ 削除 if (!empty($_GET['dele']) || isset($_POST['submit']) && $_POST['submit'] == $deletelog_st) { if ($host && $bbs) { require_once P2_LIB_DIR . '/dele.inc.php'; if (isset($_POST['checkedkeys'])) { $dele_keys = $_POST['checkedkeys']; } else { $dele_keys = array($_GET['key']); } deleteLogs($host, $bbs, $dele_keys); } // }}} // お気に入りスレッド } elseif (isset($_GET['setfav']) && !empty($_GET['key']) && $host && $bbs) { require_once P2_LIB_DIR . '/setfav.inc.php'; setFav($host, $bbs, $_GET['key'], $_GET['setfav'], isset($_GET['ttitle_en']) ? UrlSafeBase64::decode($_GET['ttitle_en']) : null); // 殿堂入り } elseif (isset($_GET['setpal']) && $_GET['key'] && $host && $bbs) { require_once P2_LIB_DIR . '/setpalace.inc.php'; setPal($host, $bbs, $_GET['key'], $_GET['setpal']); // あぼーんスレッド解除 } elseif (isset($_POST['submit']) && $_POST['submit'] == $abornoff_st && $host && $bbs && $_POST['checkedkeys']) { require_once P2_LIB_DIR . '/settaborn_off.inc.php'; settaborn_off($host, $bbs, $_POST['checkedkeys']); // スレッドあぼーん } elseif (isset($_GET['taborn']) && !is_null($_GET['key']) && $host && $bbs) { require_once P2_LIB_DIR . '/settaborn.inc.php'; settaborn($host, $bbs, $_GET['key'], $_GET['taborn']); } // お気に板をマージ if ($spmode == 'merge_favita') {
<?php /** * rep2 - 携帯版レスフィルタリング */ require_once __DIR__ . '/../init.php'; $_login->authorize(); // ユーザ認証 /** * スレッド情報 */ $host = $_GET['host']; $bbs = $_GET['bbs']; $key = $_GET['key']; $ttitle = UrlSafeBase64::decode($_GET['ttitle_en']); $ttitle_back = isset($_SERVER['HTTP_REFERER']) ? '<a href="' . p2h($_SERVER['HTTP_REFERER']) . '" title="戻る">' . $ttitle . '</a>' : $ttitle; $hidden_fields_ht = ResFilterElement::getHiddenFields($host, $bbs, $key); if ($_conf['iphone']) { $word_field_ht = ResFilterElement::getWordField(array('autocorrect' => 'off', 'autocapitalize' => 'off')); } else { $word_field_ht = ResFilterElement::getWordField(); } $field_field_ht = ResFilterElement::getFieldField(); $method_field_ht = ResFilterElement::getMethodField(); $match_field_ht = ResFilterElement::getMatchField(); $include_field_ht = ResFilterElement::getIncludeField(); /** * 検索フォームを表示 */ P2Util::header_nocache(); echo $_conf['doctype'];
// {{{ デフォルトに戻すボタンが押されていたら } elseif (!empty($_POST['submit_default'])) { if (file_exists($_conf['conf_user_file']) and unlink($_conf['conf_user_file'])) { P2Util::pushInfoHtml('<p>○設定をデフォルトに戻しました</p>'); // 変更があれば、内部データも更新しておく $_conf = array_merge($_conf, $conf_user_def); if (is_array($conf_save)) { $_conf = array_merge($_conf, $conf_save); } } } // }}} // {{{ 携帯で表示するグループ if ($_conf['ktai']) { if (isset($_REQUEST['edit_conf_user_group_en'])) { $selected_group = UrlSafeBase64::decode($_REQUEST['edit_conf_user_group_en']); } elseif (isset($_REQUEST['edit_conf_user_group'])) { $selected_group = $_REQUEST['edit_conf_user_group']; } else { $selected_group = null; } } else { $selected_group = 'all'; if (isset($_REQUEST['active_tab1'])) { $active_tab1 = $_REQUEST['active_tab1']; $active_tab1_ht = p2h($active_tab1); $active_tab1_js = "'" . StrCtl::toJavaScript($active_tab1) . "'"; } else { $active_tab1 = null; $active_tab1_ht = ''; $active_tab1_js = 'null';
/** * カンマ区切り+@区切りのリストからお気に板をセットする * * @param string $list * @param int|null $setnum * @return bool */ function setFavItaByList($list, $setnum = null) { global $_conf; // 記録データ設定 $rec_lines = array(); foreach (explode(',', $list) as $aList) { list($host, $bbs, $itaj_en) = explode('@', $aList); $rec_lines[] = "\t{$host}\t{$bbs}\t" . UrlSafeBase64::decode($itaj_en); } $script = <<<EOJS <script type="text/javascript"> //<![CDATA[ if (parent.menu) { parent.menu.location.href = '{$_conf['menu_php']}?nr=1'; } //]]> </script> EOJS; P2Util::pushInfoHtml($script); $cont = ''; if (!empty($rec_lines)) { foreach ($rec_lines as $l) { $cont .= $l . "\n"; } } // 書き込む if (FileCtl::file_write_contents(setFavItaGetBrdPath($setnum), $cont) === false) { p2die('cannot write file.'); } return true; }
// 引数エラー p2die('host が指定されていません'); } else { $host = $_GET['host']; } $bbs = isset($_GET['bbs']) ? $_GET['bbs'] : ''; $key = isset($_GET['key']) ? $_GET['key'] : ''; $rescount = isset($_GET['rescount']) ? intval($_GET['rescount']) : 1; $popup = isset($_GET['popup']) ? intval($_GET['popup']) : 0; $itaj = P2Util::getItaName($host, $bbs); if (!$itaj) { $itaj = $bbs; } $itaj_hd = htmlspecialchars($itaj, ENT_QUOTES, 'Shift_JIS', false); $ttitle_en = isset($_GET['ttitle_en']) ? $_GET['ttitle_en'] : ''; $ttitle = strlen($ttitle_en) > 0 ? UrlSafeBase64::decode($ttitle_en) : ''; $ttitle_hd = htmlspecialchars($ttitle, ENT_QUOTES); $key_idx = P2Util::idxDirOfHostBbs($host, $bbs) . $key . '.idx'; // フォームのオプション読み込み include P2_LIB_DIR . '/post_form_options.inc.php'; // 表示指定 if (!$_conf['ktai']) { $class_ttitle = ' class="thre_title"'; $target_read = ' target="read"'; $sub_size_at = ' size="40"'; } else { $class_ttitle = ''; $target_read = ''; $sub_size_at = ''; } // {{{ スレ立てなら
// {{{ ブックマーク // }}} // {{{ ブックマーク case 'bookmark': if (isset($host) && isset($bbs) && isset($key) && isset($_REQUEST['resnum']) && isset($_REQUEST['bookmark'])) { if (!function_exists('setbookmark')) { include P2_LIB_DIR . '/setbookmark.inc.php'; } if (is_numeric($_REQUEST['resnum'])) { $resnum = intval($_REQUEST['resnum']); } else { $resnum = null; } $set = (bool) $_REQUEST['bookmark']; if (isset($_REQUEST['ttitle_en'])) { $ttitle = UrlSafeBase64::decode($_REQUEST['ttitle_en']); } elseif (isset($_REQUEST['ttitle'])) { $ttitle = $_REQUEST['ttitle']; } else { $ttitle = null; } if (isset($_REQUEST['memo'])) { $memo = $_REQUEST['memo']; } else { $memo = null; } $r = setbookmark($host, $bbs, $key, $resnum, $set, $ttitle, $memo); if (empty($r)) { $r_msg = '0'; // 失敗 } elseif ($r == 1) {
P2Util::pushInfoHtml($script); unset($site, $xml, $atom, $m, $matches, $fp); return; } } $setrss = isset($_REQUEST['setrss']) ? trim($_REQUEST['setrss']) : ''; $xml = isset($_REQUEST['xml']) ? trim($_REQUEST['xml']) : ''; $site = isset($_REQUEST['site']) ? trim($_REQUEST['site']) : ''; $site_en = isset($_REQUEST['site_en']) ? trim($_REQUEST['site_en']) : ''; $atom = empty($_REQUEST['atom']) ? 0 : 1; // feedスキームをhttpスキームで置換 $xml = preg_replace('|^feed://|', 'http://', $xml); // RSSのタイトル設定 if ($site === '') { if ($site_en !== '') { $site = UrlSafeBase64::decode($site_en); } else { $purl = @parse_url($xml); if (is_array($purl)) { if (array_key_exists('host', $purl)) { $site .= $purl['host']; } if (array_key_exists('path', $purl)) { $site .= '.' . basename($purl['path']); } if (array_key_exists('query', $purl)) { $site .= '?' . $purl['query']; } } $site = basename($xml); $rss = p2GetRSS($xml);
$aborn_str = UrlSafeBase64::decode($aborn_str_en); } elseif (isset($_GET['aborn_str'])) { $aborn_str = $_GET['aborn_str']; } if (isset($_GET['aborn_id'])) { $aborn_id = $_GET['aborn_id']; } // +Wiki if (isset($_GET['aborn_be'])) { $aborn_be = $_GET['aborn_be']; } $itaj = P2Util::getItaName($host, $bbs); if (!$itaj) { $itaj = $bbs; } $ttitle_name = is_string($ttitle_en) ? UrlSafeBase64::decode($ttitle_en) : ''; $thread_url = "{$_conf['read_php']}?host={$host}&bbs={$bbs}&key={$key}{$_conf['k_at_a']}"; if (!$_conf['ktai']) { $target_edit_at = ' target="editfile"'; $target_read_at = ' target="read"'; $target_sb_at = ' target="sbject"'; } else { $target_edit_at = ''; $target_read_at = ''; $target_sb_at = ''; } //===================================================== // データファイルの読み書き //===================================================== if (preg_match('/^(aborn|ng)_/', $mode)) { $path = $_conf['pref_dir'] . '/p2_' . $mode . '.txt';
/** * スレッド情報を取得する * * @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; }
} if ($mtime) { $mtime_q = '&mt=' . $mtime; } else { $mtime_q = ''; } // }}} // {{{ ツールバー if ($rss_parse_success) { // タイトル画像をポップアップ表示 $onmouse_popup = ''; $popup_header = ''; // ツールバー共通部品 $matomeyomi = ''; if (rss_item_exists($items, 'content:encoded') || rss_item_exists($items, 'description')) { $all_en = UrlSafeBase64::encode(UrlSafeBase64::decode($site_en) . ' の 概要まとめ読み'); $matomeyomi = <<<EOP <a class="toolanchor" href="read_rss.php?xml={$xml_en}&title_en={$all_en}&num=all{$atom_q}" target="read">概要まとめ読み</a> EOP; } $ch_link = P2Util::throughIme($channel['link']); $ch_dscr_all = str_replace(array('&', '>', '<', '"'), array('&', '>', '<', '"'), strip_tags($channel['description'])); $ch_dscr = mb_strwidth($ch_dscr_all) > 36 ? mb_strcut($ch_dscr_all, 0, 36) . '...' : $ch_dscr_all; $ch_dscr_all = htmlspecialchars($ch_dscr_all, ENT_QUOTES); $ch_dscr = htmlspecialchars($ch_dscr, ENT_QUOTES); $rss_toolbar_ht = <<<EOP <span class="itatitle"><a class="aitatitle" href="{$ch_link}" title="{$ch_dscr_all}"{$onmouse_popup}><b>{$title}</b></a></span> <span class="time">{$ch_dscr}</span></td> <td class="toolbar-update" width="100%"> <form class="toolbar" method="get" action="subject_rss.php" target="_self"> <input type="hidden" name="xml" value="{$xml}">
//================================================================= // メイン //================================================================= $aThread = new Thread(); // hostを分解してidxファイルのパスを求める $aThread->setThreadPathInfo($host, $bbs, $key); $key_line = $aThread->getThreadInfoFromIdx(); $aThread->getDatBytesFromLocalDat(); // $aThread->length をset if (!($aThread->itaj = P2Util::getItaName($aThread->host, $aThread->bbs))) { $aThread->itaj = $aThread->bbs; } $hc['itaj'] = $aThread->itaj; if (!$aThread->ttitle) { if (isset($ttitle_en)) { $aThread->setTtitle(UrlSafeBase64::decode($ttitle_en)); } else { $aThread->setTitleFromLocal(); } } if (!$ttitle_en) { if ($aThread->ttitle) { $ttitle_en = UrlSafeBase64::encode($aThread->ttitle); //$ttitle_urlen = rawurlencode($ttitle_en); } } if ($ttitle_en) { $ttitle_en_q = '&ttitle_en=' . $ttitle_en; } else { $ttitle_en_q = ''; }
// 変数 //================================================================ $newtime = date('gis'); $post_param_keys = array('bbs', 'key', 'time', 'FROM', 'mail', 'MESSAGE', 'subject', 'submit'); $post_internal_keys = array('host', 'sub', 'popup', 'rescount', 'ttitle_en'); $post_optional_keys = array('newthread', 'beres', 'p2res', 'from_read_new', 'maru', 'csrfid'); $post_p2_flag_keys = array('b', 'p2_post_confirm_cookie'); foreach ($post_param_keys as $pk) { ${$pk} = isset($_POST[$pk]) ? $_POST[$pk] : ''; } foreach ($post_internal_keys as $pk) { ${$pk} = isset($_POST[$pk]) ? $_POST[$pk] : ''; } if (!isset($ttitle)) { if ($ttitle_en) { $ttitle = UrlSafeBase64::decode($ttitle_en); } elseif ($subject) { $ttitle = $subject; } else { $ttitle = ''; } } //$MESSAGE = rtrim($MESSAGE); // {{{ ソースコードがきれいに再現されるように変換 if (!empty($_POST['fix_source'])) { // タブをスペースに $MESSAGE = tab2space($MESSAGE); // 特殊文字を実体参照に $MESSAGE = htmlspecialchars($MESSAGE, ENT_QUOTES, 'Shift_JIS'); // 自動URLリンク回避 $MESSAGE = str_replace('tp://', 'tp://', $MESSAGE);