&size(18){''このページは最新のrep2およびそれに準ずる拡張パックの類を対象にしています。''};~ &size(18){''公開するpatchファイル名には、対応するp2のバージョン番号を含めるとわかりやすくて良いです。''}; [[ユーザカスタマイズ]] #contents ***892@part32さんのrep2実況モード (+live) http://m-st.xrea.jp/plus/ ***+Wikiパッチ 下記に載っているパッチがほぼ全て入り、さらにプラグイン機能を備えたp2のパッチです。~ 設定フォームで有効/無効を切り替えてください。~ ~ #ref(wiki_061125_0215.zip) ~ 対応バージョン:+live_061029_0420~ パッチバージョン:061125_0215~ ~ 機能 -プラグイン(find.2ch.net, 2ken.net, みみずん検索など) -スレッドあぼーんワード -[[単語]]をWikipedia/Wapediaのリンクに変換 -この期間、NG/あぼーんネーム/メール/メッセージ/ID/スレ都度にHITしなければ、登録ワードを自動的に外す -「さぼり」「はきだめ」(あぼーんされたレスの表示) -一定個数以上の新着があるスレッドをまとめ読みから除外 -投稿フォームに定型文メニューを追加 -名前をクリックすると名前でフィルタリング -メールをクリックするとメールでフィルタリング -表示位置の移動をドロップダウンメニューにする(PC) -SPMをクリックで出す(PC) -レス番号にSPMをつける(携帯) -あぼーんされたレスを隠す(携帯) -任意のスレッドのまとめ読み -過去ログを各種DAT保管サイトから取得(プラグイン) -スレッド一覧のフィルタリングでAND/OR・本文検索を可能にする(携帯) -書き込みフォームの幅(携帯) -書き込みフォームの高さ(携帯) -RSS内2chリンクをp2で開く(携帯) -AAを自動で判定し、NGワードにする。(PC) -スレッド番号でinfoを開く(携帯) -スレッドあぼーんトグルスイッチをつける -「ここから新着」を挿入 -書き込みフォームをダブルクリックするとテキストボックスを自動調整(PC) ***[[単語]]の形式でWikipediaに飛ぶ Wikipedia系のスレッドで使われている[[単語]]([]は半角)の表記でWikipediaに飛びます。~ なお、rep2モバイルではモバイル用のWapediaに飛ぶようにオリジナルから改造してあります。~ (元ネタ:本スレpart35の760-779) ~ ~ まず、lib/showthread.class.phpの一番下(?>のすぐ上)に以下のように追記するんだぜ? function wikipedia($msg) { // [[語句]]があった時にWikipediaへ自動リンクするんだぜ? global $_conf; $msg = mb_convert_encoding($msg, "UTF-8", "SJIS_win"); // SJISはうざいからUTF-8に変換するんだぜ? if($_conf['ktai']){ $wikipedia = "http://ja.wapedia.org/"; // WapediaのURLなんだぜ? }else{ $wikipedia = "http://ja.wikipedia.org/wiki/"; // WikipediaのURLなんだぜ? } $search = "/\[\[[^\[\]\n<>]+\]\]+/"; // 目印となる正規表現なんだぜ? preg_match_all($search, $msg, $matches); // [[語句]]を探すんだぜ? $matched = preg_replace("/^\[\[|\]\]$/", "", $matches[0]); // いったん"[["と"]]"を取るんだぜ? foreach ($matched as $value) { // リンクに変換するんだぜ? $replaced[] = "[[<a href=?"" . P2Util::throughIme($wikipedia . rawurlencode($value)) . "?"" . $_conf['ext_win_target_at'] . ">$value</a>]]"; // しっかりimeを通すんだぜ? } $msg = str_replace($matches[0], $replaced, $msg); // 変換後の本文を戻すんだぜ? $msg = mb_convert_encoding($msg, "SJIS_win", "UTF-8"); // UTF-8からSJISに戻すんだぜ? return $msg; } んでもってlib/showthreadk.class.phpの488行目とかlib/showthreadpc.class.phpの586行目とかの $msg = preg_replace_callback($this->str_to_link_regex, array($this, 'link_callback'), $msg); と、その下の return $msg; return $msg; の間に $msg = wikipedia($msg); // Wikipediaへの自動リンクなんだぜ。 を追加しとくんだぜ? ***にくちゃんねる・みみずん検索からDATを取得 スレッドが過去ログに収納されているとき、DAT保管サイトからDATを取得します。~ なお、DATがなければデータがおかしくなります。~ 既得ログはいったん消してから取得した方が良いようです。~ 改造例(rep2-expack rev.060903.0030; based on rep2-1.7.29): #ref(nikutori_sample.zip) ~ threadread.class.php 84行目あたり: $this->downloadDat2ch($this->length); ↓ $this->downloadDat2ch($this->length,$_GET["dat"]); 96行目あたり: function downloadDat2ch($from_bytes) ↓ function downloadDat2ch($from_bytes,$dat) 120行目あたり: $url = 'http://' . $this->host . "/{$this->bbs}/dat/{$this->key}.dat"; ↓ switch($dat){ case 1: if(strpos($this->host,"bbspink")){ $niku_host = "bbspink-"; }else{ $niku_host = ""; } $niku_host .= substr($this->host,0,strpos($this->host,".")); $url = 'http://makimo.to/cgi-bin/html2dat/html2dat.cgi?' . $niku_host . "_{$this->bbs}/" .substr($this->key,0,4) . "/{$this->key}.html"; break; case 2: $url = "http://mimizun.com:81/log/2ch/{$this->bbs}/{$this->host}/{$this->bbs}/kako/" .substr($this->key,0,4) . "/" . substr($this->key,0,5) . "/{$this->key}.dat"; break; default: $url = 'http://' . $this->host . "/{$this->bbs}/dat/{$this->key}.dat"; break; } 804行目あたり: $dat_response_msg = "<p>2ch info - このスレッドは過去ログ倉庫に格納されています。 [{$marutori_ht}]</p>"; ↓ $ktai = $_conf['ktai'] ? "&b=k" : ""; $nikutori_ht = "<a href=\"{$_conf['read_php']}?host={$this->host}&bbs={$this->bbs}&key={$this->key}&ls={$this->ls}&dat=1{$ktai}\">にくちゃんねるからp2に取り込む</a>"; $mimitori_ht = "<a href=\"{$_conf['read_php']}?host={$this->host}&bbs={$this->bbs}&key={$this->key}&ls={$this->ls}&dat=2{$ktai}\">みみずん検索からp2に取り込む</a>"; $dat_response_msg = "<p>2ch info - このスレッドは過去ログ倉庫に格納されています。 [{$marutori_ht}] [{$nikutori_ht}] [{$mimitori_ht}]</p>"; ***必死チェッカー(スレッド用) スレッドのレスに必死チェッカーへのリンクボタン([check])を追加します。~ 必死チェッカーに対応していない板・IDがない場合はボタンを表示しません。~ 〜yyyy/mm/dd〜以外の日付形式ではボタンを生成しません。 なお、対応板リストは変更になったらその都度書き換えて下さい。~ rep2-expack rev.060903.0030; based on rep2-1.7.29と+live 通常モードで確認。~ ~ 2006/10/28:もう一度VIPの佐賀に対応・大幅に軽い正規表現にした 2006/10/26:p2imeを通すようにした・検索PHPを通さず直でHTMLにアクセスするようにした・ポップアップするようにした~ ~ 無印:lib/showthreadpc.class.phpの$tores .= "</dt>\n";の上~(287行目あたり)~ expack ASAP:lib/showthreadpc.class.phpの$tores .= "</dt>";の上~(425行目あたり)~ live 通常モード:lib/live/default_view.inc.phpの$tores .= "</dt>";の上~(67行目あたり)~ live 実況モードA:lib/live/live_view.inc.phpの116行目あたり~ live 実況モードB:lib/live/live_view.inc.phpの110行目あたり~ の上に $board=array('ghard', 'gamenews', 'famicom', 'gamerpg', 'gamesrpg', 'handygame', 'gamerobo', 'ff', 'game', 'gamef', 'arc', 'wifi', 'gamechara', 'gamestg', 'gamemusic', 'gamefight', 'gal', 'gsaloon', 'gline', 'newsplus', 'news', 'mnewsplus', 'bizplus', 'news2', 'news4plus', 'aasaloon', 'occult', 'sfx', 'korea', 'av', 'pav', 'stock', 'market', 'baby', 'ms', 'campus', 'livevenus', 'livenhk', 'liveetv', 'liventv', 'livetbs', 'livecx', 'liveanb', 'livetx', 'livemarket1', 'livemarket2', 'jsaloon', 'kouri', 'dog', 'bike', 'f1', 'base', 'mlb', 'hsb', 'soccer', 'football', 'wres', 'keiba', 'ogame', 'ogame2', 'ogame3', 'netgame', 'mmo', 'mmominor', 'anime', 'anime2', 'voice', 'voiceactor', 'doujin', 'comic', 'wcomic', 'musicnews', 'musicj', 'musice', 'jisaku', 'software', 'swf', 'download', 'net', 'news4vip', 'neet4vip'); if($id && ereg("^[a-zA-Z0-9]+\.2ch\.net$",$this->thread->host)){ if(array_search($this->thread->bbs,$board)){ preg_match("/(\d{4})\/(\d{2})\/(\d{2})/i",$date_id,$date_array); $date = $date_array[1].$date_array[2].$date_array[3]; if($date){ $hissi_url=P2Util::throughIme("http://hissi.dyndns.ws/read.php/{$this->thread->bbs}/{$date}/".base64_encode($id).".html"); $tores.= "<a href=\"{$hissi_url}\" onmouseover=\"showHtmlPopUp('{$hissi_url}',event,0.2)\" onmouseout=\"offHtmlPopUp()\" target=\"_blank\"><img src=\"img/check.png\"></a>"; } } } を追加。 ***必死チェッカー(板用) 板(スレッド一覧)の下に必死チェッカーへのリンクをつけます。~ p2imeを通します。~ ~ lib/sb_footer.inc.phpの46行目あたり echo "</table>\n"; echo "</table>\n"; の上に if(ereg("^[a-zA-Z0-9]+\.2ch\.net$",$aThreadList->host)){ $board=array('ghard', 'gamenews', 'famicom', 'gamerpg', 'gamesrpg', 'handygame', 'gamerobo', 'ff', 'game', 'gamef', 'arc', 'wifi', 'gamechara', 'gamestg', 'gamemusic', 'gamefight', 'gal', 'gsaloon', 'gline', 'newsplus', 'news', 'mnewsplus', 'bizplus', 'news2', 'news4plus', 'aasaloon', 'occult', 'sfx', 'korea', 'av', 'pav', 'stock', 'market', 'baby', 'ms', 'campus', 'livevenus', 'livenhk', 'liveetv', 'liventv', 'livetbs', 'livecx', 'liveanb', 'livetx', 'livemarket1', 'livemarket2', 'jsaloon', 'kouri', 'dog', 'bike', 'f1', 'base', 'mlb', 'hsb', 'soccer', 'football', 'wres', 'keiba', 'ogame', 'ogame2', 'ogame3', 'netgame', 'mmo', 'mmominor', 'anime', 'anime2', 'voice', 'voiceactor', 'doujin', 'comic', 'wcomic', 'musicnews', 'musicj', 'musice', 'jisaku', 'software', 'swf', 'download', 'net', 'news4vip', 'neet4vip'); if(array_search($aThreadList->bbs,$board)){ require_once P2_LIBRARY_DIR . '/filectl.class.php'; $hissi_url=P2Util::throughIme("http://hissi.dyndns.ws/read.php/{$aThreadList->bbs}/"); $hissi_ht = <<<EOP | <a href="{$hissi_url}" target="read">必死チェッカー</a> EOP; } } を追加。~ 80行目あたりの echo "</p>"; echo "</p>"; の上に echo $hissi_ht; を追加。 ***被参照レス そのレスにレスしているレスを検索してポップアップします。~ 範囲指定(>>1-10のような形式)のレスは検索しません。~ [Re:]という画像が追加されているので、それをポイントすると(>|>)(\d+,)*レス番号\Dが含まれたレスがポップアップされます。~ rep2-expack rev.060903.0030; based on rep2-1.7.29および+live 通常モードで確認。~ なお、re.pngは+liveに同梱されている画像です。~ ~ 無印:lib/showthreadpc.class.phpの$tores .= "</dt>\n";の上~(287行目あたり)~ expack ASAP:lib/showthreadpc.class.phpの$tores .= "</dt>";の上~(425行目あたり)~ live 通常モード:lib/live/default_view.inc.phpの$tores .= "</dt>";の上~(67行目あたり)~ live 実況モードA:lib/live/live_view.inc.phpの116行目あたり~ live 実況モードB:lib/live/live_view.inc.phpの110行目あたり~ に $url_res = "read.php\bbs={$this->thread->bbs}&key={$this->thread->key}&host={$this->thread->host}&ls=all&offline=1&field=msg&word=%28%3E%7C%81%84%29%28%5Cd%2B%2C%29*{$i}%5CD&method=regex&match=on&submit_filter=%83t%83B%83%8B%83%5E%95%5C%8E%A6"; $tores .="\n<a href=\"{$url_res}\" onmouseover=\"showHtmlPopUp('{$url_res},renzokupop=true',event,0.2)\" onmouseout=\"offHtmlPopUp()\"><img src=\"img/re.png\"></a>"; を追加。 ***スレッドあぼーんワード スレッドに特定の単語が入っていると、自動的に非表示にするようにします。~ スレッドにあぼーん属性がつくわけではありません。~ ピンポイントあぼーんが実装されているrep2-expackであれば使えるはずです。~ 変更箇所が多いので、変更箇所を書いたテキストとrep2-expack rev.060903.003用のファイルをまとめておきました。~ #ref(thread_aborn_word_rep2ex-060903-0030.zip) ***AAを自動で判定し、NGワードにする。(PC) 携帯AA自動NGのPC版です。~ アクティブモナーをonにして使用してください。~ #ref(rep2-expack rev.060903.0030_AAautoNg.diff) ***モバイルモードでもレス番号にSPM モバイルモードでレス番号にSPMへのリンクをつけます。~ SPMを生成するkspformを使っているわけではないので、SPMの仕様が変わった場合はその都度書き換えて下さい。~ rep2-expack rev.060903.0030; based on rep2-1.7.29で確認。~ ~ showthreadk.class.phpの~ 375行目あたり $tores .= "<div id=\"r{$i}\" name=\"r{$i}\">[<font color=\"{$STYLE['mobile_read_newres_color']}\">{$i}</font>]"; を $tores .= "<div id=\"r{$i}\" name=\"r{$i}\">[<font color=\"{$STYLE['mobile_read_newres_color']}\"><a href=\"spm2_k.php\b=k&host={$this->thread->host}&bbs={$this->thread->bbs}&key={$this->thread->key}&offline=1&ktool_value={$i}\">{$i}</a></font>]"; に変更。~ 378行目あたり $tores .= "<div id=\"r{$i}\" name=\"r{$i}\">[{$i}]"; を $tores .= "<div id=\"r{$i}\" name=\"r{$i}\">[<a href=\"spm2_k.php\b=k&host={$this->thread->host}&bbs={$this->thread->bbs}&key={$this->thread->key}&offline=1&ktool_value={$i}\">{$i}</a>]"; に変更。~ spm2_k.zipをダウンロードし、spm2_k.phpをp2のルートディレクトリ(read.phpがあるところ)に入れる。 #ref(spm2_k.zip) ***モバイルモードの板内スレッド検索を強化 lib/sb_header.inc.phpの // フィルタ検索 ================================================== と // チェックフォーム ===================================== の間のソースコードを全てコピーし、lib/sb_header_k.inc.phpの // フィルタ検索 ================================================== と // 検索結果 の間のソースコードに置き換える。 ***あぼーんされたレスを表示 showthread.class.phpの function ngAbornCheck(略) { の下に if($_GET['aborn']) return FALSE; を追加。~ read.php?〜&aborn=1であぼーん・NGされたレスも表示する。 ~read.phpにリンクをつけたい場合、以下の操作も行う。~ read_footer.inc.php:~ // ■プリント の上あたりに $htm['showaborn']="<a href=\"read.php?aborn=1&".$_SERVER["QUERY_STRING"]."\">さぼり</a>"; を追加。~ | {$htm['dores']} の上あたりに | {$htm['showaborn']} を追加。~ read_header_k.inc.php:~ <a href="{$motothre_url}">{$moto_thre_st}</a> の上あたりに <a href="read.php?aborn=1&{$_SERVER["QUERY_STRING"]}">怠</a> を追加。(この場合は「怠」があぼーん表示リンク) ***新着レスが多いスレッドをまとめ読みから除外 read_new.phpの250行目あたりに以下を追加 if (!$aThreadList->spmode and $sb_view == "shinchaku" and !$_GET['word']) { if ($aThread->unum >= 件数) { unset($aThread); continue; } } 件数に除外する件数を追加。(件数=100なら100件以上で除外) ***スレッド表示であぼーんトグル 釣りスレ等を開いたときに。~ ~ PCの場合はread_header.inc.phpの168行目あたりのあぼーんトグル云々のコメントを外すだけ。~ 携帯の場合はread_header_k.inc.phpの159行目あたり <a href="{$motothre_url}">{$moto_thre_st}</a> の上に <a href="info.php?host={$aThread->host}{$bbs_q}{$key_q}{$ttitle_en_q}&taborn=2{$_conf['k_at_a']}">あぼーん</a> を追加。(あぼーんの部分はお好みで) ***find.2ch.netをp2で使う find.2ch.netをフィルタを通し、p2で使えるようにします。~ ~ <? $before= file_get_contents("http://find.2ch.net/?".$_SERVER["QUERY_STRING"]); //処理は適当 for($i=0;$i<=50;$i++){ $after=ereg_replace("<dt><a href=\"(.*)\"><b>","<dt><a target=\"read\" href=\"read.php?url=\\1\"><b>",$before); if($before==$after){ break; }else{ $before=$after; } } echo $after; ?> を適当な名前(find2ch.php等)でread.phpがあるところに保存する。~ lib/menu.inc.phpの <a href="http://find.2ch.net/" target="_blank" title="2ch公式検索">find.2ch.net</a><br> を <a href="find2ch.php" target="subject" title="2ch公式検索">find.2ch.net</a><br> に置き換える。 *** o2onとdatを共有する p2のdatは基本的にo2onと同じ形式ですが、もしかしたら違うかもしれないので注意して下さい。~ →dat形式は完全に同じのようなので問題なさそうです。 datは自分で移動すること。~ 1.7.29系列であれば利用可能ですが、多少改変すれば1.8.xでも利用可能です。~ 注意:ファイルの読み込みエラーが起きる場合があるので、やらないほうがいいでしょう。~ thread.class.php 151行目あたり $this->keydat = $dat_host_dir . '/' . $this->bbs . '/' . $this->key . '.dat'; ↓ $this->keydat = $dat_host_dir . '/' . $this->bbs . '/' . substr($this->key,0,4) . '/' . $this->key . '.dat'; dele.inc.php $adat = $dat_host_dir . '/' . $this->bbs . '/' . $this->key . '.dat'; ↓ $adat = $dat_host_dir . '/' . $this->bbs . '/' . substr($key,0,4) . '/' . $this->key . '.dat'; import.php $dat_path = P2Util::datDirOfHost($host) . '/' . $bbs . '/' . $dat_name; ↓ $dat_path = P2Util::datDirOfHost($host) . '/' . $bbs . '/' . substr($key,0,4) . '/' . $dat_name; threadlist.class.php while ($entry = $ddir->read()) { if (preg_match($dat_pattern, $entry2, $matches)) { $theidx = $idx_bbs_dir."/".$matches[1].".idx"; if (!file_exists($theidx)) { if ($datlines = @file($dat_bbs_dir."/".$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]); } } ↓ if( $entry=='.' || $entry=='..' ) continue; if(is_dir($dat_bbs_dir.'/'.$entry)){ $ddir = dir($dat_bbs_dir.'/'.$entry); while ($entry2 = $ddir->read()) { if (preg_match($dat_pattern, $entry2, $matches)) { $theidx = $idx_bbs_dir."/".$matches[1].".idx"; if (!file_exists($theidx)) { if ($datlines = @file($dat_bbs_dir."/".$entry2)) { $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]); } } $ddir->close(); } p2util.class.phpのdatDirOfHost~ function datDirOfHost($host) { global $_conf; // bbspink if( P2Util::isHostBbsPink($host)) { $dat_host_dir = $_conf['dat_dir']."/bbspink.com"; }else if (P2Util::isHost2chs($host)) { $dat_host_dir = $_conf['dat_dir']."/2ch.net"; // machibbs.com } elseif (P2Util::isHostMachiBbs($host)) { $dat_host_dir = $_conf['dat_dir']."/machi.to"; } elseif (preg_match('/[^.0-9A-Za-z.\\-_]/', $host) && !P2Util::isHostJbbsShitaraba($host)) { $dat_host_dir = $_conf['dat_dir']."/".rawurlencode($host); $old_dat_host_dir = $_conf['dat_dir']."/".$host; if (is_dir($old_dat_host_dir)) { rename($old_dat_host_dir, $dat_host_dir); clearstatcache(); } } else { $dat_host_dir = $_conf['dat_dir']."/".$host; } return $dat_host_dir; } *** rep2→o2onコンバータ(手抜き) #ref(rep2too2on.zip) rep2のディレクトリ構造をo2onのディレクトリ構造に変換します。~ 2chとbbspinkの分離や2channel→2ch.netのディレクトリ名変更といったことまではしません。~ exeなので注意。 ***pita.stとimepita.jpに対応 lib/showthreadpc.class.php /** * ImageCache2サムネイル変換 */ function plugin_imageCache2($url, $purl, $str) { global $_conf; global $pre_thumb_unlimited, $pre_thumb_ignore_limit, $pre_thumb_limit; static $serial = 0; ////////ここから追加/////////////////////////// $pita =false; if (preg_match('{^https?://imepita.jp/.+?$}i', $url) && empty($purl['query'])) { $tok = explode("/", $url); $url = $tok[0]."//".$tok[2]."/img/trial/".$tok[3]."/".$tok[4].".jpg"; } elseif (preg_match('{^https?://[^\.]+?.pita.st/+?}i', $url) ) { $src = file_get_contents($url); if(preg_match('{<img src="(https?://image[0-9]+?.pita.st/[^"]+?)"}i', $src, $match)){ $url = $match[1]; $pita = true; } } ////////追加ここまで/////////////////////////// if (preg_match('{^https?://.+?\\.(jpe?g|gif|png)$}i', $url) && empty($purl['query'])) { を if ((preg_match('{^https?://.+?\\.(jpe?g|gif|png)$}i', $url) && empty($purl['query'])) || $pita == true) { へ *** あっぷろーど #attach -Commentary and archival information about Jenna Jameson from The New York Times - Jenna Jameson <a href="http://5341freeserver4you2558.00.dr.ag/jenna/jenna-jameson-hardcore.htm">hardcore</a> -- [[Luka]] &new{2007-02-08 (木) 15:37:51}; #comment