/** * 新着まとめ読み <a> * * @return string HTML */ function getShinchakuMatomeATag($aThreadList, $shinchaku_num) { global $_conf; static $upper_toolbar_done_ = false; $shinchaku_matome_atag = ''; // 倉庫なら新着まとめのリンクはなし if ($aThreadList->spmode == 'soko') { return $shinchaku_matome_atag = ''; } $attrs = array(); if (UA::isIPhoneGroup()) { $attrs['class'] = 'button'; } // 上下あるツールバーの下だけにアクセスキーをつける if ($upper_toolbar_done_) { $attrs[$_conf['accesskey_for_k']] = $_conf['k_accesskey']['matome']; } $upper_toolbar_done_ = true; $qs = array('host' => $aThreadList->host, 'bbs' => $aThreadList->bbs, 'spmode' => $aThreadList->spmode, 'nt' => date('gis'), UA::getQueryKey() => UA::getQueryValue()); $label = "{$_conf['k_accesskey']['matome']}.新まとめ"; if ($shinchaku_num) { $shinchaku_matome_atag = P2View::tagA(UriUtil::buildQueryUri($_conf['read_new_k_php'], array_merge($qs, array('norefresh' => '1'))), hs("{$label}({$shinchaku_num})"), $attrs); } else { $shinchaku_matome_atag = P2View::tagA(UriUtil::buildQueryUri($_conf['read_new_k_php'], $qs), hs($label), $attrs); } return $shinchaku_matome_atag; }
/** * ブラウザがiPhone, iPod Touch or Androidならtrueを返す */ public static function isBrowserIphone() { return UA::isIPhoneGroup(); }
/** * 元スレURLを返す * * @access public * @param boolean $original 携帯でも2chのスレURLを返す * @return string URL */ function getMotoThread($original = false) { global $_conf; // 携帯カスタマイズ指定 if ($_conf['ktai'] && !$original && $_conf['k_motothre_external']) { $motothre_url = $this->compileMobile2chUri(); // まちBBS } elseif (P2Util::isHostMachiBbs($this->host)) { // PC if (!$_conf['ktai'] || $original) { /* $motothre_url = sprintf( 'http://%s/bbs/read.cgi?BBS=%s&KEY=%s', $this->host, rawurlencode($this->bbs), rawurlencode($this->key) ); */ $motothre_url = "http://{$this->host}/bbs/read.cgi/{$this->bbs}/{$this->key}/{$this->ls}"; // 携帯 } else { $motothre_url = sprintf('http://%s/bbs/read.cgi?IMODE=TRUE&BBS=%s&KEY=%s', $this->host, rawurlencode($this->bbs), rawurlencode($this->key)); } // まちびねっと } elseif (P2Util::isHostMachiBbsNet($this->host)) { $motothre_url = sprintf('http://%s/test/read.cgi?bbs=%s&key=%s', $this->host, rawurlencode($this->bbs), rawurlencode($this->key)); // JBBSしたらば } elseif (P2Util::isHostJbbsShitaraba($this->host)) { $preg = '{(jbbs\\.shitaraba\\.com|jbbs\\.livedoor\\.com|jbbs\\.livedoor\\.jp)}'; $host_bbs_cgi = preg_replace($preg, '$1/bbs/read.cgi', $this->host); $motothre_url = "http://{$host_bbs_cgi}/{$this->bbs}/{$this->key}/{$this->ls}"; // $motothre_url = "http://{$this->host}/bbs/read.cgi?BBS={$this->bbs}&KEY={$this->key}"; // 2ch系 } elseif (P2Util::isHost2chs($this->host)) { // PC if (!UA::isK() || UA::isIPhoneGroup() || $original) { $motothre_url = "http://{$this->host}/test/read.cgi/{$this->bbs}/{$this->key}/{$this->ls}"; // 携帯 } else { // BBS PINK if (P2Util::isHostBbsPink($this->host)) { // r.iはもう使われていない //$motothre_url = "http://{$this->host}/test/r.i/{$this->bbs}/{$this->key}/{$this->ls}"; $motothre_url = "http://speedo.ula.cc/test/r.so/{$this->host}/{$this->bbs}/{$this->key}/{$this->ls}?guid=ON"; // 2ch(c.2ch) } else { $motothre_url = $this->compileMobile2chUri(); } } // その他 } else { $motothre_url = "http://{$this->host}/test/read.cgi/{$this->bbs}/{$this->key}/{$this->ls}"; } return $motothre_url; }
/** * お気に板をHTML表示する for 携帯 * * @access public * @return void */ function printFavItaHtml() { global $_conf; $csrfid = P2Util::getCsrfId(); $hr = P2View::getHrHtmlK(); $show_flag = false; if (file_exists($_conf['favita_path']) and $lines = file($_conf['favita_path'])) { echo 'お気に板 [<a href="editfavita.php?b=k">編集</a>]' . $hr; $i = 0; foreach ($lines as $l) { $i++; $l = rtrim($l); if (preg_match("/^\t?(.+)\t(.+)\t(.+)\$/", $l, $matches)) { $itaj = rtrim($matches[3]); $attr = array(); $key_num_st = ''; if ($i <= 9) { $attr[$_conf['accesskey_for_k']] = $i; $key_num_st = "{$i}."; } $atag = P2View::tagA(UriUtil::buildQueryUri($_conf['subject_php'], array('host' => $matches[1], 'bbs' => $matches[2], 'itaj_en' => base64_encode($itaj), UA::getQueryKey() => UA::getQueryValue())), UA::isIPhoneGroup() ? hs($itaj) : hs("{$key_num_st}{$itaj}"), $attr); if (UA::isIPhoneGroup()) { echo '<li>' . $atag . '</li>'; } else { echo $atag . '<br>'; } // [<a href="{$_SERVER['SCRIPT_NAME']}?host={$matches[1]}&bbs={$matches[2]}&setfavita=0&csrfid={$csrfid}&view=favita{$_conf['k_at_a']}">削</a>] $show_flag = true; } } if (UA::isIPhoneGroup()) { ?> </ul><?php } } if (!$show_flag) { ?> <p>お気に板はまだないようだ</p><?php } }
/** * preview >>1 * * @return void HTML出力 */ function _printPreview1Html(&$aThread, $params) { global $_conf, $STYLE, $_login; global $_filter_hits; // $res_filter extract($params); $aThread->ls = '1'; // 必ずしも正確ではないが便宜的に if (!isset($aThread->rescount) and !empty($_GET['rc'])) { $aThread->rescount = intval($_GET['rc']); $aThread->lsToPoint(); } $body = $aThread->previewOne(); $ptitle_ht = hs($aThread->itaj) . ' / ' . hs($aThread->ttitle_hc); if (UA::isIPhoneGroup()) { $read_header_inc_php = P2_IPHONE_LIB_DIR . '/read_header_k.inc.php'; $read_footer_inc_php = P2_IPHONE_LIB_DIR . '/read_footer_k.inc.php'; } elseif (UA::isK()) { $read_header_inc_php = P2_LIB_DIR . '/read_header_k.inc.php'; $read_footer_inc_php = P2_LIB_DIR . '/read_footer_k.inc.php'; } else { $read_header_inc_php = P2_LIB_DIR . '/read_header.inc.php'; $read_footer_inc_php = P2_LIB_DIR . '/read_footer.inc.php'; } require_once $read_header_inc_php; echo $body; require_once $read_footer_inc_php; }
EOP; } ?> </table> <a class='whiteButton' href="<?php eh($_SERVER['SCRIPT_NAME']); ?> ?setdef=1<?php echo $_conf['k_at_a']; ?> ">デフォルトに戻す</a> </filedset> </div> <?php // フッタHTMLを表示する if (UA::isK() && !UA::isIPhoneGroup()) { echo $hr . P2View::getBackToIndexKATag(); } ?> </body></html><?php exit; //====================================================================== // 関数(このファイル内でのみ利用) //====================================================================== /** * 携帯TOPメニューの順番を変更する関数 * * @access public * @param string $code * @param string $set top, up, down, bottom * @return boolean
} else { $_REQUEST = array(); } // }}} // {{{ 端末判定 $_conf['ktai'] = false; $_conf['iphone'] = false; $_conf['input_type_search'] = false; $_conf['accesskey'] = 'accesskey'; $_conf['accept_charset'] = 'Shift_JIS'; $_conf['extra_headers_ht'] = ''; $_conf['use_cookies'] = true; $userAgent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : null; $mobile = Net_UserAgent_Mobile::singleton($userAgent); // iPhone, iPod Touch or Android if (UA::isIPhoneGroup($userAgent)) { $_conf['ktai'] = true; $_conf['iphone'] = true; $_conf['input_type_search'] = true; $_conf['accept_charset'] = 'UTF-8'; // PC等 } elseif ($mobile->isNonMobile()) { // Safari if (UA::isSafariGroup($userAgent)) { $_conf['input_type_search'] = true; $_conf['accept_charset'] = 'UTF-8'; // Windows Mobile } elseif (P2Util::isClientOSWindowsCE()) { $_conf['ktai'] = true; // 携帯ゲーム機 } elseif (UA::isNintendoDS($userAgent) || UA::isPSP($userAgent)) {
/** * ツールバー部分HTML * * @return string HTML */ function _getToolbarRightHtml($aThread, $ttitle_en, $siml_thre_st, $info_st, $dele_st, $moto_thre_st) { global $_conf, $motothre_url; $thread_qs = array('host' => $aThread->host, 'bbs' => $aThread->bbs, 'key' => $aThread->key); $b_qs = array(UA::getQueryKey() => UA::getQueryValue()); $ita_atag = P2View::tagA(UriUtil::buildQueryUri($_conf['subject_php'], array_merge($thread_qs, $b_qs)), "{$_conf['k_accesskey']['up']}." . hs($aThread->itaj), array($_conf['accesskey_for_k'] => $_conf['k_accesskey']['up'])); $similar_qs = array('detect_hint' => '◎◇', 'itaj_en' => base64_encode($aThread->itaj), 'method' => 'similar', 'word' => $aThread->ttitle_hc); $similar_atag = P2View::tagA(UriUtil::buildQueryUri($_conf['subject_php'], array_merge($similar_qs, $thread_qs, $b_qs, array('refresh' => '1'))), $siml_thre_st); $info_php = UA::isIPhoneGroup() ? 'info_i.php' : 'info.php'; $info_atag = P2View::tagA(UriUtil::buildQueryUri($info_php, array_merge($thread_qs, $b_qs, array('ttitle_en' => $ttitle_en))), "{$_conf['k_accesskey']['info']}." . hs($info_st), array($_conf['accesskey_for_k'] => $_conf['k_accesskey']['info'])); $dele_atag = P2View::tagA(UriUtil::buildQueryUri($info_php, array_merge($thread_qs, $b_qs, array('ttitle_en' => $ttitle_en, 'dele' => 1))), "{$_conf['k_accesskey']['dele']}." . hs($dele_st), array($_conf['accesskey_for_k'] => $_conf['k_accesskey']['dele'])); $motothre_atag = P2View::tagA($motothre_url, hs($moto_thre_st)); return $toolbar_right_ht = "{$ita_atag} {$similar_atag} {$info_atag} {$dele_atag} {$motothre_atag}"; }
</div> <?php } // if (_isCalledAsStandAlone()) ?> <ul><li class="group">スレ情報</li></ul><div id="usage" class="panel"><?php P2Util::printInfoHtml(); ?> <h2><?php echo $hs['ttitle_name']; ?> </b></h2> <fieldset> <?php // 携帯なら冒頭で情報メッセージ表示 if (UA::isK() || UA::isIPhoneGroup()) { if (strlen($info_msg)) { printf('<p>%s</p>', hs($info_msg)); } } //printInfoTrHtml("元スレ", "<a href=\"{$motothre_url}\"{$target_read_at}>{$motothre_url}</a>"); //printInfoTrHtml("ホスト", $aThread->host); $dele_pre_ht = ''; $up_pre_ht = ''; $offrecent_ht = ''; if (checkRecent($aThread->host, $aThread->bbs, $aThread->key) || checkResHist($aThread->host, $aThread->bbs, $aThread->key)) { $offrecent_ht = sprintf(' / [%s]', _getOffRecentATag($aThread, $offrecent_accesskey = '', $ttitle_en)); } _printInfoTrHtml('元スレ', P2View::tagA($motothre_url, _addBrHtml($motothre_url), UA::isPC() ? array('target' => 'read') : array())); if (UA::isPC()) { _printInfoTrHtml("ホスト", $aThread->host);
/** * ソースコード補正用チェックボックス * * @return string HTML */ function _getSrcFixHtml($host) { global $_conf; $src_fix_ht = ''; if (UA::isPC() || UA::isIPhoneGroup()) { if ($_conf['editor_srcfix'] == 1 or $_conf['editor_srcfix'] == 2 && preg_match('/pc\\d+\\.2ch\\.net/', $host)) { $src_fix_ht = '<input type="checkbox" id="fix_source" name="fix_source" value="1">ソ\ースコード補正'; } } return $src_fix_ht; }
/** * @static * @access public * @return void HTML出力 */ function printHeadMetasHtml($frameset = false) { $metas = array(array('http-equiv' => 'Content-Type', 'content' => 'text/html; charset=Shift_JIS'), array('name' => 'ROBOTS', 'content' => 'NOINDEX, NOFOLLOW')); /* // 省略 if (UA::isPC() || UA::isIPhoneGroup()) { $metas[] = array( 'http-equiv' => 'Content-Style-Type', 'content' => 'text/css' ); $metas[] = array( 'http-equiv' => 'Content-Script-Type', 'content' => 'text/javascript' ); } */ if (!$frameset) { if (UA::isIPhoneGroup() || UA::isIPhoneGroup(geti($_SERVER['HTTP_USER_AGENT']))) { ?> <link rel="apple-touch-icon" href="img/p2iphone.png"><?php // <meta name="viewport" content="width=device-width, initial-scale=1.0"> // initial-scale=1.0, maximum-scale=1.0 // initial-scale=1.0 とすると、縦→横と向きを変えた時に、拡大率が大きい状態になってしまう。 $metas[] = array('name' => 'viewport', 'content' => 'width=device-width'); // <meta name="format-detection" content="telephone=no"> $metas[] = array('name' => 'format-detection', 'content' => 'telephone=no'); } } foreach ($metas as $meta) { $attrs = array(); foreach ($meta as $k => $v) { $attrs[] = hs($k) . '="' . hs($v) . '"'; } printf('<meta %s>' . "\n", implode(' ', $attrs)); } }
if ($palarray[0]) { $aThread->setTtitle($palarray[0]); } break; } } } $palUrl = UriUtil::buildQueryUri('info.php', array('host' => $aThread->host, 'bbs' => $aThread->bbs, 'key' => $aThread->key, 'setpal' => (int) (!$isPalace), 'popup' => (int) (bool) geti($_GET['popup']), 'ttitle' => $ttitle_en, UA::getQueryKey() => UA::getQueryValue())); $pal_ht = P2View::tagA($palUrl, hs($isPalace ? '★' : '+'), array('title' => 'DAT落ちしたスレ用のお気に入り')); // }}} // {{{ スレッドあぼーんチェック // スレッドあぼーんリスト読込 $ta_keys = P2Util::getThreadAbornKeys($aThread->host, $aThread->bbs); $isTaborn = empty($ta_keys[$aThread->key]) ? false : true; $taborndo_title_attrs = array(); if (UA::isPC() || UA::isIPhoneGroup() and !$isTaborn) { $taborndo_title_attrs = array('title' => 'スレッド一覧で非表\示にします'); } $taborn_ht = sprintf('%s [%s]', hs($isTaborn ? 'あぼーん中' : '通常'), P2View::tagA(UriUtil::buildQueryUri('info.php', array('host' => $aThread->host, 'bbs' => $aThread->bbs, 'key' => $aThread->key, 'taborn' => $isTaborn ? 0 : 1, 'popup' => (int) (bool) geti($_GET['popup']), 'ttitle_en' => $ttitle_en, UA::getQueryKey() => UA::getQueryValue())), sprintf('%s%s', hs(UA::isK() ? $taborn_accesskey . '.' : ''), hs($isTaborn ? 'あぼーん解除する' : 'あぼーんする')), array_merge($taborndo_title_attrs, array('accesskey' => $taborn_accesskey)))); // }}} // ログありなしフラグセット $existsLog = false; if (file_exists($aThread->keydat) || file_exists($aThread->keyidx)) { $existsLog = true; } //================================================================= // HTMLプリント //================================================================= $motothre_url = $aThread->getMotoThread(); $motothre_org_url = $aThread->getMotoThread(true); if ($title_msg) {
/** * スレッド一覧を表示する (<tr>〜</tr>) * * @access public * @return void */ function sb_print_k(&$aThreadList) { global $_conf, $sb_view, $p2_setting, $STYLE; global $sb_view; if (!$aThreadList->threads) { if ($aThreadList->spmode == 'fav' && $sb_view == 'shinchaku') { if (UA::isIPhoneGroup()) { ?> <p>お気にスレに新着なかったぽ</p><?php } else { ?> <p>お気にスレに新着なかったぽ</p><?php } } else { if (UA::isIPhoneGroup()) { ?> <p>該当サブジェクトはなかったぽ</p><?php } else { ?> <p>該当サブジェクトはなかったぽ</p><?php } } return; } // 変数 ================================================ // >>1 表示 $onlyone_bool = false; /* // ニュース系の板なら適用 if (ereg('news', $aThreadList->bbs) || $aThreadList->bbs == 'bizplus' || $aThreadList->spmode == 'news') { // 倉庫は除く if ($aThreadList->spmode != "soko") { $onlyone_bool = true; } } */ // 板名 if ($aThreadList->spmode and $aThreadList->spmode != "taborn" and $aThreadList->spmode != "soko") { $ita_name_bool = true; } else { $ita_name_bool = false; } /* // {{{ 新着ソート(現在未使用) $qs = array( 'sort' => 'midoku', 'norefresh' => '1', UA::getQueryKey() => UA::getQueryValue() ); // スペシャルモード時 if ($aThreadList->spmode) { $qs['spmode'] = $aThreadList->spmode; // あぼーんなら if ($aThreadList->spmode == "taborn" or $aThreadList->spmode == "soko") { $qs['host'] = $aThreadList->host; $qs['bbs'] = $aThreadList->bbs; } } else { $qs['host'] = $aThreadList->host; $qs['bbs'] = $aThreadList->bbs; } $midoku_sort_ht = P2View::tagA( UriUtil::buildQueryUri($_conf['subject_php'], $qs), '新着' ); // }}} */ //===================================================== // ボディ //===================================================== // spmodeがあればクエリー追加 if ($aThreadList->spmode) { $spmode_q = "&spmode={$aThreadList->spmode}"; } $i = 0; foreach ($aThreadList->threads as $aThread) { $i++; $midoku_ari = ""; $anum_ht = ""; // #r1 $bbs_q = "&bbs=" . $aThread->bbs; $key_q = "&key=" . $aThread->key; if ($aThreadList->spmode != "taborn") { if (!$aThread->torder) { $aThread->torder = $i; } } // {{{ 新着レス数 $unum_ht = ''; // 既得済み if ($aThread->isKitoku()) { $unum_ht = "{$aThread->unum}"; $anum = $aThread->rescount - $aThread->unum + 1 - $_conf['respointer']; if ($anum > $aThread->rescount) { $anum = $aThread->rescount; } $anum_ht = "#r{$anum}"; // 新着あり if ($aThread->unum > 0) { $midoku_ari = true; if (UA::isIPhoneGroup()) { $unum_ht = "{$aThread->unum}"; } else { $unum_ht = "<font color=\"#ff6600\">{$aThread->unum}</font>"; } } // subject.txtにない時 if (!$aThread->isonline) { // 誤動作防止のためログ削除操作をロック $unum_ht = "-"; } if (UA::isIPhoneGroup()) { $unum_ht = '<font class="unum">' . $unum_ht . '</font>'; } else { $unum_ht = '[' . $unum_ht . ']'; } } // }}} // 新規スレ $unum_new_ht = ''; if ($aThread->new) { if (UA::isIPhoneGroup()) { // $unum_ht = '<font color="#0000ff">●</font>'; $unum_ht = ''; $unum_new_ht = '<img class="unew" src="iui/icon_new.png">'; } else { $unum_ht = '<font color="#ff0000">新</font>'; } } // {{{ 板名 $ita_name_ht = ''; if ($ita_name_bool) { $ita_name = $aThread->itaj ? $aThread->itaj : $aThread->bbs; // 全角英数カナスペースを半角に if ($_conf['k_save_packet']) { $ita_name = mb_convert_kana($ita_name, 'rnsk'); } /* $ita_name_ht = sprintf('(%s)', P2View::tagA( UriUtil::buildQueryUri($_conf['subject_php'], array( 'host' => $aThread->host, 'bbs' => $aThread->bbs, UA::getQueryKey() => UA::getQueryValue() ) ), hs($ita_name) ) ); */ if (UA::isIPhoneGroup()) { $ita_name_ht = sprintf(' <span class="ita">(%s)</span>', hs($ita_name)); } else { $ita_name_ht = sprintf('(%s)', hs($ita_name)); } } // }}} // torder(info) ================================================= /* // お気にスレ if ($aThread->fav) { $torder_st = "<b>{$aThread->torder}</b>"; } else { $torder_st = $aThread->torder; } $torder_ht = "<a id=\"to{$i}\" class=\"info\" href=\"info.php?host={$aThread->host}{$bbs_q}{$key_q}{$_conf['k_at_a']}\">{$torder_st}</a>"; */ $torder_ht = $aThread->torder; // title ========================================================= $rescount_qs = array('rc' => $aThread->rescount); $offline_qs = array(); // dat倉庫 or 殿堂なら if ($aThreadList->spmode == 'soko' || $aThreadList->spmode == 'palace') { $rescount_qs = array(); $offline_qs = array('offline' => '1'); $anum_ht = ''; } // タイトル未取得なら if (!$aThread->ttitle_ht) { // 見かけ上のタイトルなので携帯対応URLである必要はない //if (P2Util::isHost2chs($aThread->host)) { // $aThread->ttitle_ht = "http://c.2ch.net/z/-/{$aThread->bbs}/{$aThread->key}/"; //} else { $aThread->ttitle_ht = "http://{$aThread->host}/test/read.cgi/{$aThread->bbs}/{$aThread->key}/"; //} } // 全角英数カナスペースを半角に if ($_conf['k_save_packet']) { $aThread->ttitle_ht = mb_convert_kana($aThread->ttitle_ht, 'rnsk'); } // 総レス数 if (UA::isIPhoneGroup()) { $rescount_ht = '<font class="sbnum"> ' . $aThread->rescount . '</font>'; } else { $rescount_ht = ' (' . $aThread->rescount . ')'; } $similarity_ht = ''; if ($aThread->similarity) { $similarity_ht = sprintf(' %0.1f%%', $aThread->similarity * 100); } // 新規スレ if ($aThread->new) { $classtitle_q = ' class="thre_title_new"'; } else { $classtitle_q = ' class="thre_title"'; } $thre_url = UriUtil::buildQueryUri($_conf['read_php'], array_merge(array('host' => $aThread->host, 'bbs' => $aThread->bbs, 'key' => $aThread->key, UA::getQueryKey() => UA::getQueryValue()), $rescount_qs, $offline_qs)) . $anum_ht; // オンリー>>1 $onlyone_url = UriUtil::buildQueryUri($_conf['read_php'], array_merge(array('host' => $aThread->host, 'bbs' => $aThread->bbs, 'key' => $aThread->key, 'onlyone' => '1', 'k_continue' => '1', UA::getQueryKey() => UA::getQueryValue()), $rescount_qs)); if ($onlyone_bool) { $one_ht = "<a href=\"{$onlyone_url}\">>>1</a>"; } if (P2Util::isHost2chs($aThreadList->host) and !$aThread->isKitoku()) { if ($GLOBALS['_conf']['k_sb_show_first'] == 1) { $thre_url = $onlyone_url; } elseif ($GLOBALS['_conf']['k_sb_show_first'] == 2) { $thre_url .= '&ls=1-'; } } // アクセスキー /* $access_ht = ""; if ($aThread->torder >= 1 and $aThread->torder <= 9) { $access_ht = " {$_conf['accesskey_for_k']}=\"{$aThread->torder}\""; } */ if (UA::isIPhoneGroup()) { // お気にマーク設定 $favvalue = !empty($aThread->fav) ? 0 : 1; $favtitle = $favvalue ? 'お気にスレに追加' : 'お気にスレから外す'; $itaj_hs = htmlspecialchars($aThread->itaj, ENT_QUOTES); $favmark = !empty($aThread->fav) ? '★' : '+'; if ($favmark == '★') { $favmark = '<img src="iui/icon_del.png">'; } else { $favmark = '<img src="iui/icon_add.png">'; } $sid_qs = array(); $sid_q = ''; if (defined('SID') && strlen(SID)) { $sid_qs[session_name()] = session_id(); $sid_q = hs('&' . session_name() . '=' . session_id()); } $setFavUri = UriUtil::buildQueryUri('info_i.php', array_merge(array('host' => $aThread->host, 'bbs' => $aThread->bbs, 'key' => $aThread->key, 'ttitle_en' => base64_encode($aThread->ttitle), 'setfav' => $favvalue), $sid_qs)); $setFavUri_hs = hs($setFavUri); } //==================================================================================== // スレッド一覧 table ボディ HTMLプリント <tr></tr> //==================================================================================== if (UA::isIPhoneGroup()) { ?> <li><?php echo "<span class=\"plus\" id=\"{$aThread->torder}\" ><a href=\"{$setFavUri_hs}\" target=\"info\" onClick=\"return setFavJsNoStr('host={$aThread->host}{$bbs_q}{$key_q}{$ttitle_en_q}{$sid_q}', '{$favvalue}', {$STYLE['info_pop_size']}, 'read', 'this',{$aThread->torder});\" title=\"{$favtitle}\">{$favmark}</a></span>"; // ボディ echo <<<EOP <a href="{$thre_url}" class="ttitle">{$unum_new_ht}{$aThread->ttitle_ht}{$ita_name_ht}{$rescount_ht}{$similarity_ht}</a>{$unum_ht}</li> EOP; } else { echo <<<EOP <div> {$unum_ht}{$aThread->torder}.<a href="{$thre_url}">{$aThread->ttitle_ht}{$rescount_ht}{$similarity_ht}</a>{$ita_name_ht} </div> EOP; } } }
/** * 端末判定 * * @return void */ function _checkBrowser() { global $_conf; // 基本(PC) $_conf['ktai'] = false; $_conf['disable_cookie'] = false; if (UA::isSafariGroup()) { $_conf['accept_charset'] = 'UTF-8'; } else { $_conf['accept_charset'] = 'Shift_JIS'; } $mobile =& Net_UserAgent_Mobile::singleton(); if (PEAR::isError($mobile)) { trigger_error($mobile->toString(), E_USER_WARNING); // UAが携帯なら } elseif ($mobile and !$mobile->isNonMobile()) { $_conf['ktai'] = true; $_conf['disable_cookie'] = false; $_conf['accept_charset'] = 'Shift_JIS'; // ベンダ判定 // docomo i-Mode if ($mobile->isDoCoMo()) { // [todo] docomoの新しいのはCookieも使える… $_conf['disable_cookie'] = true; // EZweb (au or Tu-Ka) } elseif ($mobile->isEZweb()) { $_conf['disable_cookie'] = false; // SoftBank(旧Vodafone Live!) } elseif ($mobile->isSoftBank()) { //$_conf['accesskey_for_k'] = 'DIRECTKEY'; // W型端末と3GC型端末はCookieが使える if ($mobile->isTypeW() || $mobile->isType3GC()) { $_conf['disable_cookie'] = false; } else { $_conf['disable_cookie'] = true; } // WILLCOM(旧AirH"Phone) } elseif ($mobile->isWillcom()) { $_conf['disable_cookie'] = false; } } // iPhone指定 if (UA::isIPhoneGroup()) { $_conf['ktai'] = true; UA::setForceMode(UA::getMobileQuery()); define('P2_IPHONE_LIB_DIR', './iphone'); $_conf['subject_php'] = 'subject_i.php'; $_conf['read_new_k_php'] = 'read_new_i.php'; $_conf['menu_k_php'] = 'menu_i.php'; $_conf['editpref_php'] = 'editpref_i.php'; } }
/** * datのレスメッセージをHTML表示用メッセージに変換して返す * * @access private * @param string $msg * @param integer $resnum レス番号 * @param ref bool $has_aa AAを含んでいるかどうか。この渡し方はイマイチぽ。レス単位でオブジェクトにした方がいいかな。 * @return string HTML */ function transMsg($msg, $resnum, &$has_aa) { global $_conf; global $res_filter, $word_fm; $this->str_to_link_rest = $this->str_to_link_limit; $ryaku = false; // 2ch旧形式のdat if ($this->thread->dat_type == '2ch_old') { $msg = str_replace('@`', ',', $msg); $msg = preg_replace('/&([^;])/', '&$1', $msg); } // DAT中にある>>1のリンクHTMLを取り除く $msg = $this->removeResAnchorTagInDat($msg); // AAチェック $has_aa = $this->detectAA($msg); // {{{ 大きさ制限 // AAの強制省略。 $aa_ryaku_flag = false; if ($_conf['k_aa_ryaku_size'] && strlen($msg) > $_conf['k_aa_ryaku_size'] and $has_aa == 2) { $aa_ryaku_flag = true; } if (!(UA::isIPhoneGroup() && !$aa_ryaku_flag) and empty($_GET['k_continue']) and $_conf['ktai_res_size'] && strlen($msg) > $_conf['ktai_res_size'] || $aa_ryaku_flag) { // <br>以外のタグを除去し、長さを切り詰める $msg = strip_tags($msg, '<br>'); if ($aa_ryaku_flag) { $ryaku_size = min($_conf['k_aa_ryaku_size'], $_conf['ktai_ryaku_size']); $ryaku_st = 'AA略'; } else { $ryaku_size = $_conf['ktai_ryaku_size']; $ryaku_st = '略'; } $msg = mb_strcut($msg, 0, $ryaku_size); $msg = preg_replace('/ *<[^>]*$/i', '', $msg); // >>1, >1, >1, >>1を引用レスポップアップリンク化 $msg = preg_replace_callback($this->getAnchorRegex('/%full%/'), array($this, 'quote_msg_callback'), $msg); $msg .= P2View::tagA(UriUtil::buildQueryUri($_conf['read_php'], array('host' => $this->thread->host, 'bbs' => $this->thread->bbs, 'key' => $this->thread->key, 'ls' => $resnum, 'k_continue' => '1', 'offline' => '1', UA::getQueryKey() => UA::getQueryValue())), $ryaku_st); return $msg; } // }}} // 引用やURLなどをリンク $msg = preg_replace_callback($this->str_to_link_regex, array($this, 'link_callback'), $msg, $this->str_to_link_limit); // 2ch BEアイコン if (in_array($_conf['show_be_icon'], array(1, 3))) { $msg = preg_replace('{sssp://(img\\.2ch\\.net/ico/[\\w\\d()\\-]+\\.[a-z]+)}', '<img src="http://$1" border="0">', $msg); } return $msg; }
?> </title> <?php P2View::printIncludeCssHtml('style'); P2View::printIncludeCssHtml('read'); ?> <link rel="shortcut icon" href="favicon.ico" type="image/x-icon"> <script type="text/javascript" src="js/basic.js?v=20100127"></script> <script type="text/javascript" src="js/respopup.js?v=20061206"></script> <script type="text/javascript" src="js/htmlpopup.js?v=20061206"></script> <script type="text/javascript" src="js/setfavjs.js?v=20090428"></script> <script type="text/javascript" src="js/delelog.js?v=20100127"></script> <script type="text/javascript" src="js/showhide.js?v=20090416"></script> <?php if (!UA::isIPhoneGroup()) { ?> <script type="text/javascript" src="./js/yui-ext/yui.js"></script> <script type="text/javascript" src="./js/yui-ext/yui-ext-nogrid.js"></script> <link rel="stylesheet" type="text/css" href="./js/yui-ext/resources/css/resizable.css"> <?php } $onload_script = ''; if ($_conf['bottom_res_form']) { ?> <script type="text/javascript" src="js/post_form.js?v=20090724"></script><?php $onload_script .= "checkSage();"; } if (empty($_GET['onlyone'])) { $onload_script .= "setWinTitle();"; }
/** * p2 - 最初のログイン画面をHTML表示する関数 * * @access public * @return void */ function printLoginFirst(&$_login) { global $STYLE, $_conf; global $_login_failed_flag, $_p2session; // データ保存ディレクトリに書き込み権限がなければ注意を表示セットする P2Util::checkDirsWritable(array($_conf['dat_dir'], $_conf['idx_dir'], $_conf['pref_dir'])); // 前処理 $_login->cleanInvalidAuthUserFile(); clearstatcache(); // 外部からの変数 $post['form_login_id'] = isset($_POST['form_login_id']) ? $_POST['form_login_id'] : null; $post['form_login_pass'] = isset($_POST['form_login_pass']) ? $_POST['form_login_pass'] : null; //========================================================= // 書き出し用変数 //========================================================= if (UA::isIPhoneGroup()) { $ptitle = $_conf['p2name'] . 'iPhone'; } else { $ptitle = $_conf['p2name']; } $ptitle_ht = hs($ptitle); if (!empty($GLOBALS['brazil'])) { $ptitle_ht = 'p2.2ch.net'; if (!(UA::isK() || UA::isIPhoneGroup())) { $ptitle_ht = '<a href="http://p2.2ch.net/">' . $ptitle_ht . '</a>'; } } $myname = basename($_SERVER['SCRIPT_NAME']); $body_ht = ''; $show_login_form_flag = false; $p_str = array('user' => 'ユーザ', 'password' => 'パスワード'); if (!empty($GLOBALS['brazil'])) { $p_str['user'] = '******'; } // 携帯用表示文字列全角→半角変換 if (!UA::isIPhoneGroup() && UA::isK() && function_exists('mb_convert_kana')) { foreach ($p_str as $k => $v) { $p_str[$k] = mb_convert_kana($v, 'rnsk'); } } // 補助認証 require_once P2_LIB_DIR . '/HostCheck.php'; $mobile = Net_UserAgent_Mobile::singleton(); $auth_sub_input_ht = _getAuthSubInputHtml($mobile); // ログインフォームからの指定 $form_login_id_hs = ''; if ($_login->validLoginId($_login->user_u)) { $form_login_id_hs = hs($_login->user_u); } elseif ($_login->validLoginId($post['form_login_id'])) { $form_login_id_hs = hs($post['form_login_id']); } $form_login_pass_hs = ''; if ($_login->validLoginPass($post['form_login_pass'])) { $form_login_pass_hs = hs($post['form_login_pass']); } // docomoの固有端末認証(セッション利用時のみ有効) $docomo_utn_ht = ''; //if ($_conf['use_session'] && $_login->user_u && $mobile->isDoCoMo()) { if ($_conf['use_session'] && $mobile->isDoCoMo()) { $uri = $myname . '?guid=ON&user='******'<p><a href="' . hs($uri) . '" utn>docomo固有端末認証</a></p>'; } // docomoならリトライ時にパスワード入力を password → text とする // (docomoはpassword入力が完全マスクされるUIで、入力エラーがわかりにく過ぎる) if (isset($post['form_login_pass']) and $mobile->isDoCoMo()) { $type = "text"; } else { $type = "password"; } // {{{ ログイン用フォームを生成 $ruri = $_SERVER['REQUEST_URI']; if (UA::isDoCoMo()) { $ruri = UriUtil::addQueryToUri($ruri, array('guid' => 'ON')); } $REQUEST_URI_hs = hs($ruri); if (!empty($GLOBALS['brazil']) or file_exists($_conf['auth_user_file'])) { $submit_ht = '<input type="submit" name="submit_userlogin" value="ユーザログイン">'; } else { $submit_ht = '<input type="submit" name="submit_newuser" value="新規登録">'; } $login_form_ht = <<<EOP {$docomo_utn_ht} <form id="login" method="POST" action="{$REQUEST_URI_hs}" target="_self" utn> {$_conf['k_input_ht']} {$p_str['user']}: <input type="text" name="form_login_id" value="{$form_login_id_hs}" istyle="3" size="32" autocorrect="off" autocapitalize="off"><br> {$p_str['password']}: <input type="{$type}" name="form_login_pass" value="{$form_login_pass_hs}" istyle="3" autocorrect="off" autocapitalize="off"><br> {$auth_sub_input_ht} <br> {$submit_ht} </form> EOP; // }}} //================================================================= // 新規ユーザ登録処理 //================================================================= $isAllowedNewUser = empty($GLOBALS['brazil']) ? true : false; if ($isAllowedNewUser and !file_exists($_conf['auth_user_file']) && !$_login_failed_flag and !empty($_POST['submit_newuser']) && $post['form_login_id'] && $post['form_login_pass']) { // {{{ 入力エラーをチェック、判定 if (!$_login->validLoginId($post['form_login_id']) || !$_login->validLoginPass($post['form_login_pass'])) { P2Util::pushInfoHtml(sprintf('<p class="infomsg">p2 error: 「%s」名と「%s」は半角英数字で入力して下さい。</p>', hs($p_str['user']), hs($p_str['password']))); $show_login_form_flag = true; // }}} // {{{ 登録処理 } else { $_login->makeUser($post['form_login_id'], $post['form_login_pass']); // 新規登録成功 $form_login_id_hs = hs($post['form_login_id']); $body_ht .= "<p class=\"infomsg\">○ 認証{$p_str['user']}「{$form_login_id_hs}」を登録しました</p>"; $body_ht .= "<p><a href=\"{$myname}?form_login_id={$form_login_id_hs}{$_conf['k_at_a']}\">{$_conf['p2name']} start</a></p>"; $_login->setUser($post['form_login_id']); $_login->setPassX(sha1($post['form_login_pass'])); // セッションが利用されているなら、セッションを更新 if (isset($_p2session)) { // ユーザ名とパスXを更新 $_SESSION['login_user'] = $_login->user_u; $_SESSION['login_pass_x'] = $_login->pass_x; } // 要求があれば、補助認証を登録 $_login->registCookie(); $_login->registKtaiId(); } // }}} // {{{ ログインエラーがある } else { if (isset($_POST['submit_newuser']) || isset($_POST['submit_userlogin'])) { $msg_ht = '<p class="infomsg">'; if (!$post['form_login_id']) { $msg_ht .= "p2 error: 「{$p_str['user']}」が入力されていません。" . "<br>"; } elseif (!$_login->validLoginId($post['form_login_id'])) { $msg_ht .= "p2 error: 「{$p_str['user']}」文字列が不正です。" . "<br>"; } if (!$post['form_login_pass']) { $msg_ht .= "p2 error: 「{$p_str['password']}」が入力されていません。"; } $msg_ht .= '</p>'; P2Util::pushInfoHtml($msg_ht); } $show_login_form_flag = true; } // }}} //========================================================= // HTML表示出力 //========================================================= P2Util::headerNoCache(); P2View::printDoctypeTag(); ?> <html lang="ja"> <head> <?php P2View::printExtraHeadersHtml(); ?> <title><?php eh($ptitle); ?> </title> <?php if (UA::isIPhoneGroup()) { ?> <style type="text/css" media="screen">@import "./iui/iui.css";</style><?php } if (UA::isPC() && !UA::isIPhoneGroup()) { // ユーザは未決定 //P2View::printIncludeCssHtml('style'); //P2View::printIncludeCssHtml('login_first'); ?> <link rel="stylesheet" href="style/login_first.css" type="text/css"> <link rel="shortcut icon" href="favicon.ico" type="image/x-icon"> <?php } ?> </head><body><?php if (UA::isIPhoneGroup()) { ?> <div class="toolbar"><h1 id="pageTitle"><?php echo $ptitle_ht; ?> </h1></div><?php ?> <div id="usage" class="panel"><filedset><?php } else { ?> <h3><?php echo $ptitle_ht; ?> </h3><?php } P2Util::printInfoHtml(); echo $body_ht; if ($show_login_form_flag) { echo $login_form_ht; if (empty($GLOBALS['brazil']) and !(HostCheck::isAddrLocal() || HostCheck::isAddrPrivate())) { ?> <p> <font size="-1" color="gray">※このページはプライベート利用のためのシステムです。<br> 部外者によるログイン試行は、<br> 不正アクセスとして記録されます。<br> このページへのアクセスURLを部外者が<br> 不特定多数に公知することを禁止します。</font></p><?php } } if (!empty($GLOBALS['brazil']) and UA::isK() || UA::isIPhoneGroup()) { ?> <br><hr size="1"><div align="center"><a href="http://p2.2ch.net/">p2.2ch.net</a></div><?php } if (UA::isIPhoneGroup()) { ?> <br><br><br><br><br><br></filedset></div><?php } ?> </body></html><?php }
?> <script type="text/javascript" src="js/basic.js?v=20090429"></script> <link rel="shortcut icon" href="favicon.ico" type="image/x-icon"> <?php P2View::printIncludeCssHtml('style'); P2View::printIncludeCssHtml('edit_conf_user'); } ?> </head> <body onLoad="top.document.title=self.document.title;"<?php echo P2View::getBodyAttrK(); ?> > <?php // PC用表示 if (UA::isPC() || UA::isIPhoneGroup()) { ?> <p id="pan_menu"><a href="<?php eh($_conf['editpref_php']); ?> ">設定管理</a> > <?php eh($ptitle); ?> (<a href="<?php eh(UriUtil::getMyUri(false, null, $add_sid = true)); ?> ">リロード</a>)</p> <?php } // PC用表示 if (UA::isPC()) {