--- rep2ex-080917-0800/rep2/lib/ShowThreadPC.php 2008-09-13 18:32:00.000000000 +0900 +++ rep2/lib/ShowThreadPC.php 2009-02-12 02:40:52.000000000 +0900 @@ -15,6 +15,9 @@ class ShowThreadPc extends ShowThread { + + var $BBS_NONAME_NAME = ''; // +live (live.bbs_noname) 用 + // {{{ properties static private $_spm_objects = array(); @@ -49,6 +52,20 @@ 'plugin_link2chKako', 'plugin_link2chSubject', ); + + // +live (live.bbs_noname) 用 + if ($_GET['live']) { + if (empty($_conf['live.bbs_noname'])) { + require_once P2_LIB_DIR . '/SettingTxt.php'; + $st = new SettingTxt($this->thread->host, $this->thread->bbs); + $st->setSettingArray(); + if (!empty($st->setting_array['BBS_NONAME_NAME'])) { + $this->BBS_NONAME_NAME = $st->setting_array['BBS_NONAME_NAME']; + } + } + + } + if (P2_IMAGECACHE_AVAILABLE == 2) { $this->_url_handlers[] = 'plugin_imageCache2'; } elseif ($_conf['preview_thumbnail']) { @@ -120,6 +137,11 @@ $id = $this->thread->ids[$i]; + // +live (live.bbs_noname) 用 + if (!empty($this->BBS_NONAME_NAME) and $this->BBS_NONAME_NAME == $name) { + $name = ''; + } + // {{{ フィルタリング if (isset($_REQUEST['word']) && strlen($_REQUEST['word']) > 0) { if (strlen($GLOBALS['word_fm']) <= 0) { @@ -174,7 +196,7 @@ } // 連鎖あぼーん - if ($_conf['ngaborn_chain'] && preg_match_all('/(?:>|>)([1-9][0-9\\-,]*)/', $msg, $matches)) { + if ($_conf['ngaborn_chain'] && preg_match_all("/{$this->anchor_prefix_abon}([1-9][0-9\\-,]*)/", $msg, $matches)) { $chain_nums = array_unique(array_map('intval', split('[-,]+', trim(implode(',', $matches[1]), '-,')))); if (array_intersect($chain_nums, $this->_aborn_nums)) { if ($_conf['ngaborn_chain'] == 1) { @@ -215,7 +237,7 @@ // あぼーんメール if ($this->ngAbornCheck('aborn_mail', $mail) !== false) { - $ngaborns_hits['aborn_mal']++; + $ngaborns_hits['aborn_mail']++; $this->_aborn_nums[] = $i; return $this->_abornedRes($res_id); } @@ -268,6 +290,9 @@ $ng_msg_info[] = sprintf('NGワード:%s', htmlspecialchars($a_ng_msg, ENT_QUOTES)); } + // +live ハイライトワードチェック + include (P2_LIB_DIR . '/live/live_highlight_ctl.inc.php'); + // AA 判定 if ($this->am_autodetect && $this->activeMona->detectAA($msg)) { $msg_class .= ' ActiveMona'; @@ -353,6 +378,9 @@ } + // +live ハイライトワード変換 + include (P2_LIB_DIR . '/live/live_highlight_word.inc.php'); + /* //「ここから新着」画像を挿入 if ($i == $this->thread->readnum +1) { @@ -370,50 +398,9 @@ $spmeh = ''; } - $tores .= "
\n"; - - if ($this->thread->onthefly) { - $GLOBALS['newres_to_show_flag'] = true; - //番号(オンザフライ時) - $tores .= "
{$i} : "; - } elseif ($i > $this->thread->readnum) { - $GLOBALS['newres_to_show_flag'] = true; - // 番号(新着レス時) - $tores .= "
{$i} : "; - } elseif ($_conf['expack.spm.enabled']) { - // 番号(SPM) - $tores .= "
{$i} : "; - } else { - // 番号 - $tores .= "
{$i} : "; - } - // 名前 - $tores .= preg_replace('{[ ]*}i', '', "{$name} : "); - - // メール - if ($mail) { - if (strpos($mail, 'sage') !== false && $STYLE['read_mail_sage_color']) { - $tores .= "{$mail} : "; - } elseif ($STYLE['read_mail_color']) { - $tores .= "{$mail} : "; - } else { - $tores .= $mail . ' : '; - } - } - - // IDフィルタ - if ($_conf['flex_idpopup'] == 1 && $id && $this->thread->idcount[$id] > 1) { - $date_id = preg_replace_callback('|ID: ?([0-9A-Za-z/.+]{8,11})|', array($this, 'idfilter_callback'), $date_id); - } + // +live スレッド内容表示切替 + include (P2_LIB_DIR . '/live/live_view_ctl.inc.php'); - $tores .= $date_id; // 日付とID - if ($this->am_side_of_id) { - $tores .= ' ' . $this->activeMona->getMona($msg_id); - } - $tores .= "
\n"; - $tores .= "
{$msg}
\n"; // 内容 - $tores .= "
\n"; - $tores .= $rpop; // レスポップアップ用引用 /*if ($_conf['expack.am.enabled'] == 2) { $tores .= << @@ -540,9 +527,13 @@ // $toresにまとめて出力 $tores .= '
'; $tores .= "{$i} : "; // 番号 - $tores .= preg_replace('{[ ]*}i', '', "{$name} : "); + $tores .= preg_replace('{[ ]*}i', '', "{$name} : "); if ($mail) { - $tores .= $mail . ' : '; // メール + if (preg_match ("(^(\s| )*sage(\s| )*$)", $mail)) { + $tores .= "$mail"." :"; + } else { + $tores .= "$mail"." :"; + } } $tores .= $date_id; // 日付とID if ($this->am_side_of_id) { @@ -577,7 +568,7 @@ // 数字を引用レスポップアップリンク化 if ($_conf['quote_res_view']) { - $name = preg_replace_callback('/^( ?(?:>|>)* ?)?([1-9]\\d{0,3})(?=\\D|$)/', + $name = preg_replace_callback("/^( ?{$this->anchor_prefix})?({$this->anchor_num})(?=\\D|$)/", array($this, 'quote_res_callback'), $name, 1); } @@ -681,6 +672,11 @@ global $_conf; list($full, $qsign, $appointed_num) = $s; +// print("full={$full},qsign={$qsign},appointed_num={$appointed_num}"); + if (preg_match("/\D/",$appointed_num)) { + $appointed_num=preg_replace("/\D+/","-",$appointed_num); + return $this->quote_res_range_callback(array($full,$qsign, $appointed_num)); + } $qnum = intval($appointed_num); if ($qnum < 1 || $qnum > sizeof($this->thread->datlines)) { return $s[0]; @@ -856,6 +852,311 @@ $id = substr($id, 0, -1); } */ + + // Version.20081211 色が重複したときの処理が重かったので修正 + // Version.20081211.1 修正した部分が微妙におかしかったので再修正。 + // Version.20081211.2 色の付いたIDに枠をつけた。 + // Version.20081211.3 color2idをcolorUsedに変更。その他いろいろ変更。 + // Version.20081212 + // 文字色を指定しなかった場合は、背景色の赤・緑成分を見て、文字色を白黒いずれかにする。 + // 必死チェッカー搭載。 + // ボーダー部分をコメントアウト。 + // Version.20081212.1 + // リロード時に色が変わることを防ぐため、重複していないIDにも色を割り振るようにした。 + // その結果、設置場所が移動した。 + + // Version.20081215 + // ID本体とは別に、ID:の部分に別の背景色を適用 + // 色変換処理をcolorchange.phpにまとめた。 + // その他、こまごまとした修正 + // Version.20081216 + // HSV,HLSに加え、L*C*h表色系にも対応(ライブラリも修正) + // Version.20081224 設定で変換前と変換後のカラーコードを表示できるようにした(デバッグ用?) + // Version.20081228 色パラメータ設定を色空間別に個別化 + + require_once P2_LIB_DIR . '/colorchange.php'; + + $this->first++; + if (!$this->first) { + $this->first++; + print "
\n"; + for ($mode=2;$mode<3;$mode++) { + print "mode={$mode}"; + switch ($mode) { + case 0 : print "(HSV)"; break; + case 1 : print "(HLS)"; break; + case 2 : print "(L*C*h)"; break; + } + print "
"; + for ($L=0;$L<100;$L+=5) { + $V=$L/100; + print "L*={$L}
"; + + $Cx=5; + + for ($C=0;$C<=300;$C+=$Cx*(1+0.05*$C)/(1-0.025*$Cx)) { +// for ($a=-120;$a<=200;$a+=40) { + $Hx=5; + $count=0; + $dH=0; + for ($H=0;$H<360;$H+=$C==0 ? 360 : + $dH=2*rad2deg( + asin($Hx*(1+0.0176*$C)/ + (2*$C) + ) + ) + ) { +// for ($b=120;$b>=-120;$b-=40) { // L:[0..100],a:[-134..220],b:[-140..122] +// if ($mode==2) {print "h=";} +// else {print "H=";} +// print substr("00".strval($H),-3,3); + + $FC=0.972360 + -0.267730*cos(deg2rad($H +70)) + -0.090280*cos(deg2rad($H*2-35)) + -0.048056*cos(deg2rad($H*3-100)) + -0.021171*cos(deg2rad($H*4+60)); + + $colorcode=$rgb['color']; + $prev_param=""; if ($mode==2) { + $rgb=LCh2RGB(array($V*100,$C,$H)); +// $rgb=Lab2RGB(array($L,$a,$b)); + $colorcode=$rgb['color']; + if ($rgb[3]<0 || $rgb[4]<0 || $rgb[5]<0 || + $rgb[3]>0.9504 || $rgb[4]>1 || $rgb[5]>1.0889 + || $rgb[0]<0 || $rgb[1]<0 || $rgb[2]<0 || + $rgb[0]>255 || $rgb[1]>255 || $rgb[2]>255 + ) { + $colorcode="N/A"; + $rgb['color']="#ffffff"; +// break; + } + } else { + $rgb=$mode + ? HLS2RGB(array($H,$V,$S)) + : HSV2RGB(array($H,$S,$V)) + ; + } + +// if ($colorcode==$preb_param) {break;} + $preb_param=$colorcode; + $bcolor="background-color:{$rgb['color']};"; + switch ($rgb['type']) { + case 'L*C*h' : + $h=substr("00".strval($rgb[11]),-3,3); +// $colorcode= "{$rgb[10]}"; + //$colorcode.= ",(L*={$rgb[9]},C*={$rgb[10]},h={$rgb[11]})"; + //$colorcode.= ",(X={$rgb[3]},Y={$rgb[4]},Z={$rgb[5]})"; + break; + } + // $colorcode.= ",(R={$rgb[0]},G={$rgb[1]},B={$rgb[2]})"; +// if ($rgb['type']!='L*C*h') { +// list($L)=RGB2LCh($rgb); +// } else {$L=$V*100;} + if ($L>60) {$bcolor.="color:#000;";} + else {$bcolor.="color:#fff;";} + $space=round($H/6)-round(($H-$dH)/6)-1; + if ($space>=1) { + print str_repeat("□",$space); + } + $count++; + if ($colorcode != "N/A") { + print ""; + } else { + print "□"; + } + } + print "
\n"; + } + print "L*={$L}
"; + } + } + print "

\n"; + } + + if (isset($this->thread->idcount[$id]) && $this->thread->idcount[$id] >= 2) { + //[$id] >= 2 ココの数字でスレに何個以上同じIDが出た時に背景色を変えるか決まる + if (isset($this->id2idstr[$id])) { + $idstr=$this->id2idstr[$id]; + } else { + // IDから色の元を抽出 + $coldiv=9; // 色相環の分割数 + $raw = base64_decode(substr($id, 0, 8)); + $arr = unpack('v', substr($raw, 0, 4)); + $color=$arr[1] % ($coldiv*2); + $color2=floor($arr[1] / ($coldiv*2)) % $coldiv; + + // HSV(またはHLS)パラメータ設定 + // レス数が増えるほど、色が濃く、暗くなる + + // 色相H:値域0〜360(角度) + $h= $color*360/$coldiv; + $vividness=floor($color/$coldiv); + $h2=$color2*360/$coldiv; + /* + // 彩度S(HSV):値域0(淡い)〜1(濃い) + // (HLS):値域0(灰色)〜1(純色) + // 彩度C*(L*C*h):値域0(灰色)〜1(純色) + $s=0.1 +0.4*sin(deg2rad($this->thread->idcount[$id]*180/40)); + // p2die($this->thread->idcount[$id]."=>".sin(deg2rad($this->thread->idcount[$id]*180/40))*0.4 + // ."=>[$s}"); + if ($s<0.1) {$s=0.1;} + + // 明度V(HSV):値域0(暗い)〜1(明るい) + // 輝度L(HLS):値域0(黒)〜0.5(純色)〜1(白) + // 明度L*(L*C*h):値域0(黒)〜0.5(純色)〜1(白) + $v=0.9 -$this->thread->idcount[$id]*0.02; + if ($v<0.1) {$v=0.1;} + */ + + $colorMode=1; // 0:HSV,1:HSL,2:L*C*h + switch ($colorMode) { + case 0: // HSV色空間 + // 彩度S(HSV):値域0(淡い)〜1(濃い) + $S=$this->thread->idcount[$id]*0.05; + if ($S>1) {$S=1;} + + // 明度V(HSV):値域0(暗い)〜1(明るい) + $V=1 -$this->thread->idcount[$id]*0.025; + if ($L<0.1) {$L=0.1;} + + $color_param=array( + array($h,$S,$V,$colorMode), // 背景色(ID本体) + array($h2,1,0.6,$colorMode) // 背景色(ID:部分) + ); + break; + case 1: // HLS色空間 + // 輝度L(HLS):値域0(黒)〜0.5(純色)〜1(白) + // 彩度S(HLS):値域0(灰色)〜1(純色) + if ($vividness) { + $L=0.5; + $S=0.8; + } else { + $h+=180/$coldiv; + $L=0.8; + $S=0.5; + } +/* $L=0.75 -$this->thread->idcount[$id]*0.01; + if ($L<0.3) {$L=0.3;} + + $S=0.5+$this->thread->idcount[$id]*0.05; + if ($S>1) {$S=1;}*/ + + $color_param=array( + array($h,$L,$S,$colorMode), // 背景色(ID本体) + array($h2,0.6,0.7,$colorMode) // 背景色(ID:部分) + ); + break; + case 2: // L*C*h色空間 + // 明度L*(L*C*h):値域0(黒)〜50(純色)〜100(白) + $L=80 -$this->thread->idcount[$id]*2.5; + if ($L<10) {$L=10;} + + // 彩度C*(L*C*h):値域0(灰色)〜100(純色) + $C=35+floor(40*sin(deg2rad($this->thread->idcount[$id]*180/50))); + if ($C<5) {$C=5;} + + $color_param=array( + array($L,$C,$h,$colorMode), // 背景色(ID本体) + array(60,60,$h2,$colorMode) // 背景色(ID:部分) + ); + break; + } + + // 色空間に関する参考資料 + // HSV,HLS色空間 http://tt.sakura.ne.jp/~hiropon/lecture/color.html + // L*C*h表色系 http://konicaminolta.jp/instruments/colorknowledge/part1/08.html + // L*a*b*表色系 http://konicaminolta.jp/instruments/colorknowledge/part1/07.html + // RGBに変換 + $rgb=array(); + for($key=0;$key40) { + $LCh[$i][0]-=30; + $rgb[$i]=LCh2RGB($LCh[$i]); + }*/ + } + $colorcode=$rgb[$i]['color']; + + $bcolor[$i]="background-color:{$colorcode};"; + + + + if ($LCh[$i][0]>60) {$bcolor[$i].="color:#000;";} + else //if ($LCh[$i][0]<40) + {$bcolor[$i].="color:#fff;";} + } + + if ($this->thread->idcount[$id]>=25 ) { // 必死チェッカー発動 + $uline.="text-decoration:blink;"; + } +// if (isset($rgb[1])) { +// $border="border:medium {$rgb[1]['color']} outset ;"; +// } + $idstr2[1]="{$idstr2[1]}"; +// $colorprint=1; // 1にすると、色の変換結果が表示される + + if ($colorprint) { + for ($i=0;$i<1;$i++) { + switch ($rgb[$i]['type']) { + case 'L*C*h' : + $idstr2[1].= "(L*={$rgb[$i][9]},C*={$rgb[$i][10]},h={$rgb[$i][11]})"; + $X=$rgb[$i][3]; + $Y=$rgb[$i][4]; + $Z=$rgb[$i][5]; + if ($X>0.9504 || $X<0) {$X="{$X}";} + if ($Y>1 || $Y<0) {$Y="{$Y}";} + if ($Z>1.0889 || $Z<0) {$Z="{$Z}";} + $idstr2[1].= ",(X={$X},Y={$Y},Z={$Z})"; + + break; + case 'HSV' :$idstr2[1].= "(H={$rgb[$i][3]},S={$rgb[$i][4]},V={$rgb[$i][5]})"; + break; + case 'HLS' :$idstr2[1].= "(H={$rgb[$i][3]},L={$rgb[$i][4]},S={$rgb[$i][5]})"; + break; + } + + $R=$rgb[$i][0]; + $G=$rgb[$i][1]; + $B=$rgb[$i][2]; + if ($R>255 || $R<0) {$R="{$R}";} + if ($G>255 || $G<0) {$G="{$G}";} + if ($B>255 || $B<0) {$B="{$B}";} + $idstr2[1].= ",(R={$R},G={$G},B={$B}),{$rgb[$i]['color']}"; + } + // $idstr2[1].= join(",",$rgb[0]); + } + + if (isset($rgb[1])) { + $idstr2[0]="{$idstr2[0]}"; + } + $idstr=join('',$idstr2); + $this->id2idstr[$id]=$idstr; + } + } + $num_ht = ''; if (isset($this->thread->idcount[$id]) && $this->thread->idcount[$id] > 0) { $num = (string) $this->thread->idcount[$id]; @@ -869,7 +1170,6 @@ } else { return $idstr; } - $word = rawurlencode($id); $filter_url = "{$_conf['read_php']}?bbs={$this->thread->bbs}&key={$this->thread->key}&host={$this->thread->host}&ls=all&field=id&word={$word}&method=just&match=on&idpopup=1&offline=1"; @@ -930,8 +1230,7 @@ $msg = preg_replace('{<[Aa] .+?>(>>[1-9][\\d\\-]*)}', '$1', $msg); //echo $msg; - if (preg_match_all('/(?:>|>)+ ?([1-9](?:[0-9\\- ,=.]|、)*)/', $msg, $out, PREG_PATTERN_ORDER)) { - + if (preg_match_all("/{$this->anchor_prefix}([1-9](?:[0-9\\- ,=.]|、)*)/", $msg, $out, PREG_PATTERN_ORDER)) { foreach ($out[1] as $numberq) { //echo $numberq; if (preg_match_all('/[1-9]\\d*/', $numberq, $matches, PREG_PATTERN_ORDER)) { @@ -1234,13 +1533,14 @@ { global $_conf; - if (preg_match('{^http://(\\w+\\.(?:2ch\\.net|bbspink\\.com))/test/read\\.cgi/([^/]+)/([0-9]+)(?:/([^/]+)?)?$}', $url, $m)) { - if (!isset($m[4])) { - $m[4] = ''; + if (preg_match('{^http://(.+/)?(\\w+\\.(?:2ch\\.net|bbspink\\.com))/(test/read\\.cgi/)?([^/]+)/([0-9]+)(?:/([^/]+)?)?$}', $url, $m)) { + if ($m[1]!="" xor $m[3]!="") { + if (!isset($m[6])) { + $m[6] = ''; } - $read_url = "{$_conf['read_php']}?host={$m[1]}&bbs={$m[2]}&key={$m[3]}&ls={$m[4]}"; + $read_url = "{$_conf['read_php']}?host={$m[2]}&bbs={$m[4]}&key={$m[5]}&ls={$m[6]}"; if ($_conf['iframe_popup']) { - if (preg_match('/^[0-9\\-n]+$/', $m[4])) { + if (preg_match('/^[0-9\\-n]+$/', $m[6])) { $pop_url = $url; } else { $pop_url = $read_url . '&one=true'; @@ -1249,6 +1549,7 @@ } return "{$str}"; } + } return FALSE; } @@ -1350,9 +1651,20 @@ { global $_conf; + // +live YouTubeプレビュー表示のサイズ指定 + if ($_conf['live.youtube_winsize'] == 1) { + $youtube_winsize = "width=\"212\" height=\"175\""; // ハーフ + } else { + $youtube_winsize = "width=\"425\" height=\"350\""; // ノーマル + } + // http://www.youtube.com/watch?v=Mn8tiFnAUAI - if (preg_match('{^http://(www|jp)\\.youtube\\.com/watch\\?v=([0-9a-zA-Z_\\-]+)}', $url, $m)) { + // http://m.youtube.com/watch?v=OhcX0xJsDK8&client=mv-google&gl=JP&hl=ja&guid=ON&warned=True + if (preg_match('{^http://(www|jp|m)\\.youtube\\.com/watch\\?v=([0-9a-zA-Z_\\-]+)}', $url, $m)) { // ime + if ($m[1]=="m") { + $url="http://www.youtube.com/watch?v={$m[2]}"; + } if ($_conf['through_ime']) { $link_url = P2Util::throughIme($url); } else { @@ -1375,7 +1687,13 @@ EOP; } else { return <<
+{$link}
+ + + + + +
EOP; } } @@ -1506,14 +1824,29 @@ return false; } - if (preg_match('{^https?://.+?\\.(jpe?g|gif|png)$}i', $url) && empty($purl['query'])) { + // wikiより pita.stとimepita.jpに対応 + $pita =false; + $ref = ""; + 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"; + $ref = "&ref=" . urlencode($url); + $url = $tok[0]."//".$tok[2]."/image/".$tok[3]."/".$tok[4]; + $pita = true; + } elseif (preg_match('{^https?://[^\.]+?.pita.st/+?}i', $url) ) { + $pita = true; + $url_pita = preg_replace('{(^https?://image)[^\.]+?(.pita.st/\?[^\&]+)\&.*$}i','$1__$2',$url); + } + + // wikiより pita.stとimepita.jpに対応 + if ((preg_match('{^https?://.+?\\.(jpe?g|gif|png)$}i', $url) && empty($purl['query'])) || $pita == true) { // 準備 $serial++; $thumb_id = 'thumbs' . $serial . $this->thumb_id_suffix; $tmp_thumb = './img/ic_load.png'; $url_ht = $url; $url = str_replace('&', '&', $url); - $url_en = rawurlencode($url); + $url_en = rawurlencode($url).$ref; $icdb = new IC2_DataObject_Images; @@ -1522,8 +1855,16 @@ $img_url = 'ic2.php?r=1&uri=' . $url_en; $thumb_url = 'ic2.php?r=1&t=1&uri=' . $url_en; + //pita + if ($url_pita !="") { + $icdb->whereAddQuoted('uri', 'like', $url_pita.'%'); + $icdb_result = $icdb->find(TRUE); + } else { + $icdb_result = $icdb->get($url); + } + // DBに画像情報が登録されていたとき - if ($icdb->get($url)) { + if ($icdb_result) { // ウィルスに感染していたファイルのとき if ($icdb->mime == 'clamscan/infected') { @@ -1637,6 +1978,31 @@ // }}} // }}} + + /* + * imepita複数画像対応 + */ + function pita_expansion($url){ + + $purl = @parse_url($url); + if (FALSE != ($result = $this->plugin_linkURL($url,$purl,$url))) + $strret = $result.'
'; + + $src = file_get_contents($url); + + $match_cnt = preg_match_all('{plugin_imageCache2($link[1],$purl,$link[1]))) + $strret .= $result.'
'; + } + return $strret; + } + } // }}}