svnno****@sourc*****
svnno****@sourc*****
2010年 1月 26日 (火) 01:57:05 JST
Revision: 806 http://sourceforge.jp/projects/p2-php/svn/view?view=rev&revision=806 Author: rsk Date: 2010-01-26 01:57:05 +0900 (Tue, 26 Jan 2010) Log Message: ----------- expack: - æ¬å®¶rep2ããSPMã®éåç §æ©è½ãã¤ã³ãã¼ãã - è¨å®ç®¡ç > ã¦ã¼ã¶ã¼è¨å®ç·¨é > æ¡å¼µããã¯è¨å® > SPM > expack.spm.filter_target ã®å¤ããHTMLãããã¢ãããã«ããã¨ãSPMã®ãã£ã«ã¿ãªã³ã°çµæ (éåç §ãå«ã) ã HTMLãããã¢ãã表示ã§ããããã«ããã Modified Paths: -------------- p2ex/trunk/conf/conf_admin_ex.inc.php p2ex/trunk/conf/conf_user_def_ex.inc.php p2ex/trunk/js/smartpopup.js p2ex/trunk/lib/ShowThread.php p2ex/trunk/read_filter.php p2ex/trunk/read_filter_k.php p2ex/trunk/style/post_css.inc -------------- next part -------------- Modified: p2ex/trunk/conf/conf_admin_ex.inc.php =================================================================== --- p2ex/trunk/conf/conf_admin_ex.inc.php 2010-01-25 14:10:15 UTC (rev 805) +++ p2ex/trunk/conf/conf_admin_ex.inc.php 2010-01-25 16:57:05 UTC (rev 806) @@ -17,7 +17,7 @@ // Zend Framework (Zend GdataÅàÂ) ÌlibraryfBNgÖÌpX $_conf['expack.zf_path'] = ""; // ("") -// pecl_http ªpÅ«éêAHttpRequestPool ÉæéÀñ_E[hðLøÉ·é +// pecl_http ªpÅ«éêAHttpRequestPool ÉæéÀñ_E[hðLøÉ·é // (off:0, on:1, R}hCÅÀs:2) $_conf['expack.use_pecl_http'] = 1; // (1) Modified: p2ex/trunk/conf/conf_user_def_ex.inc.php =================================================================== --- p2ex/trunk/conf/conf_user_def_ex.inc.php 2010-01-25 14:10:15 UTC (rev 805) +++ p2ex/trunk/conf/conf_user_def_ex.inc.php 2010-01-25 16:57:05 UTC (rev 806) @@ -91,7 +91,14 @@ $conf_user_rad['expack.spm.filter'] = array('1' => '\¦', '0' => 'ñ\¦'); // tB^OÊðJt[ܽÍEChE -$conf_user_def['expack.spm.filter_target'] = "read"; // ("read") +$conf_user_def['expack.spm.filter_target'] = "_popup"; // ("_popup") +$conf_user_sel['expack.spm.filter_target'] = array( + '_popup' => 'HTML|bvAbv', + '_blank' => 'VKEChE', + '_self' => '¯¶t[', + //'_parent' => 'et[', + //'_top' => '¯¶EChE', +); // }}} // {{{ ANeBui[ Modified: p2ex/trunk/js/smartpopup.js =================================================================== --- p2ex/trunk/js/smartpopup.js 2010-01-25 14:10:15 UTC (rev 805) +++ p2ex/trunk/js/smartpopup.js 2010-01-25 16:57:05 UTC (rev 806) @@ -16,8 +16,7 @@ /** * X}[g|bvAbvj [𶬷é */ -SPM.init = function(aThread) -{ +SPM.init = function (aThread) { var threadId = aThread.objName; if (document.getElementById(threadId + '_spm')) { return false; @@ -28,14 +27,13 @@ var spm = document.createElement('div'); spm.id = threadId + '_spm'; spm.className = 'spm'; - spm.appendItem = function() - { + spm.appendItem = function() { this.appendChild(SPM.createMenuItem.apply(this, arguments)); }; SPM.setOnPopUp(spm, spm.id, false); // RsyptH[ - spm.appendItem('XRs[', (function(){ + spm.appendItem('XRs[', (function () { SPM.invite(aThread); })); @@ -46,7 +44,7 @@ } // ±±ÜÅÇñ¾ - spm.appendItem('±±ÜÅÇñ¾', (function(){ + spm.appendItem('±±ÜÅÇñ¾', (function () { SPM.httpcmd('setreadnum', aThread, SPM.callbacks.setreadnum); })); @@ -76,9 +74,14 @@ var SpmFilter = false; } + // tQÆ + spm.appendItem('tQÆ', (function (event) { + SPM.openFilter(aThread, 'rres', 'on', event); + })); + // ANeBui[ if (opt[4] == 1) { - spm.appendItem('AAptHg', (function(){ + spm.appendItem('AAptHg', (function () { activeMona(SPM.getBlockID()); })); } @@ -89,7 +92,7 @@ } // PRE - /*spm.appendItem('PRE', (function(){ + /*spm.appendItem('PRE', (function () { var msg = document.getElementById(SPM.getBlockID()); if (msg.style.whiteSpace == 'pre') { msg.style.whiteSpace = 'normal'; @@ -124,11 +127,11 @@ } // \¦Eñ\¦\bhðÝè - aThread.show = (function(resnum, resid, evt){ - SPM.show(aThread, resnum, resid, evt); + aThread.show = (function(resnum, resid, event){ + SPM.show(aThread, resnum, resid, event); }); - aThread.hide = (function(evt){ - SPM.hide(aThread, evt); + aThread.hide = (function(event){ + SPM.hide(aThread, event); }); return false; @@ -137,11 +140,10 @@ /** * X}[g|bvAbvj [ð|bvAbv\¦·é */ -SPM.show = function(aThread, resnum, resid, evt) -{ - var evt = (evt) ? evt : ((window.event) ? event : null); +SPM.show = function (aThread, resnum, resid, event) { + event = event || window.event; if (spmResNum != resnum || spmBlockID != resid) { - SPM.hideImmediately(aThread, evt); + SPM.hideImmediately(aThread, event); } spmResNum = resnum; spmBlockID = resid; @@ -150,16 +152,15 @@ } else if (document.selection) { spmSelected = document.selection.createRange().text; } - showResPopUp(aThread.objName + '_spm' ,evt); + showResPopUp(aThread.objName + '_spm' ,event); return false; }; /** * X}[g|bvAbvj [ð¶é */ -SPM.hide = function(aThread, evt) -{ - var evt = (evt) ? evt : ((window.event) ? event : null); +SPM.hide = function (aThread, event) { + event = event || window.event; hideResPopUp(aThread.objName + '_spm'); return false; }; @@ -167,9 +168,8 @@ /** * X}[g|bvAbvj [ðx[Ŷé */ -SPM.hideImmediately = function(aThread, evt) -{ - var evt = (evt) ? evt : ((window.event) ? event : null); +SPM.hideImmediately = function (aThread, event) { + event = event || window.event; document.getElementById(aThread.objName + '_spm').style.visibility = 'hidden'; return false; }; @@ -177,21 +177,18 @@ /** * N[W©çO[oÏ spmBlockID ðæ¾·é½ßÌÖ */ -SPM.getBlockID = function() -{ +SPM.getBlockID = function() { return spmBlockID; }; /** * NbNÉÀs³êéÖ (|bvAbvEChEðJ) ðÝè·é */ -SPM.setOnClick = function(obj, aThread, inUrl) -{ +SPM.setOnClick = function (obj, aThread, inUrl) { var option = (arguments.length > 3) ? arguments[3] : ''; - obj.onclick = function(evt) - { - evt = (evt) ? evt : ((window.event) ? window.event : null); - if (evt) { + obj.onclick = function (event) { + event = event || window.event; + if (event) { return SPM.openSubWin(aThread, inUrl, option); } return false; @@ -201,21 +198,18 @@ /** * }EXI[o[/AEgÉÀs³êéÖ (j [Ì\¦/ñ\¦) ðÝè·é */ -SPM.setOnPopUp = function(obj, targetId, isSubMenu) -{ +SPM.setOnPopUp = function (obj, targetId, isSubMenu) { // [I[o[ - obj.onmouseover = function(evt) - { - evt = (evt) ? evt : ((window.event) ? window.event : null); - if (evt) { - showResPopUp(targetId, evt); + obj.onmouseover = function (event) { + event = event || window.event; + if (event) { + showResPopUp(targetId, event); } }; // [AEg - obj.onmouseout = function(evt) - { - evt = (evt) ? evt : ((window.event) ? window.event : null); - if (evt) { + obj.onmouseout = function (event) { + event = event || window.event; + if (event) { hideResPopUp(targetId); } } @@ -224,11 +218,12 @@ /** * AJ[𶬷é */ -SPM.createMenuItem = function(txt) -{ +SPM.createMenuItem = function (txt) { var anchor = document.createElement('a'); anchor.href = 'javascript:void(null)'; - anchor.onclick = function() { return false; }; + anchor.onclick = function() { + return false; + }; anchor.appendChild(document.createTextNode(txt)); // NbN³ê½Æ«ÌCxgnhðÝè @@ -254,13 +249,11 @@ /** * Ú[ñ/NGTuj [𶬷é */ -SPM.createNgAbornSubMenu = function(menuId, aThread, mode) -{ +SPM.createNgAbornSubMenu = function (menuId, aThread, mode) { var amenu = document.createElement('div'); amenu.id = menuId; amenu.className = 'spm'; - amenu.appendItem = function() - { + amenu.appendItem = function () { this.appendChild(SPM.createMenuItem.apply(this, arguments)); }; SPM.setOnPopUp(amenu, amenu.id, true); @@ -276,23 +269,17 @@ /** * tB^OTuj [𶬷é */ -SPM.createFilterSubMenu = function(menuId, aThread) -{ - this.getOnClick = function(field, match) - { - return (function(evt){ - evt = (evt) ? evt : ((window.event) ? window.event : null); - if (evt) { - SPM.openFilter(aThread, field, match); - } +SPM.createFilterSubMenu = function (menuId, aThread) { + this.getOnClick = function (field, match) { + return (function (event) { + SPM.openFilter(aThread, field, match, event); }); } var fmenu = document.createElement('div'); fmenu.id = menuId; fmenu.className = 'spm'; - fmenu.appendItem = function() - { + fmenu.appendItem = function() { this.appendChild(SPM.createMenuItem.apply(this, arguments)); }; SPM.setOnPopUp(fmenu, fmenu.id, true); @@ -318,8 +305,7 @@ /** * URIÌðµA|bvAbvEChEðJ */ -SPM.openSubWin = function(aThread, inUrl, option) -{ +SPM.openSubWin = function (aThread, inUrl, option) { var inWidth = 650; // |bvAbvEChEÌ var inHeight = 350; // |bvAbvEChE̳ var boolS = 1; // XN[o[ð\¦ioff:0, on:1j @@ -367,28 +353,31 @@ /** * URIÌðµAtB^OÊð\¦·é */ -SPM.openFilter = function(aThread, field, match) -{ +SPM.openFilter = function (aThread, field, match, event) { var inUrl = 'read_filter.php?bbs=' + aThread.bbs + '&key=' + aThread.key + '&host=' + aThread.host; inUrl += '&rescount=' + aThread.rc + '&ttitle_en=' + aThread.ttitle_en + '&resnum=' + spmResNum; inUrl += '&ls=all&field=' + field + '&method=just&match=' + match + '&offline=1'; switch (spmFlexTarget) { + case '_popup': + showHtmlPopUp(inUrl, event || window.event, 0); + SPM.hideImmediately(aThread, event); + break; + case '_blank': + window.open(inUrl, '', ''); + break; case '_self': - location.href = inUrl; + window.self.location.href = inUrl; break; case '_parent': - parent.location.href = inUrl; + window.parent.location.href = inUrl; break; case '_top': - top.location.href = inUrl; + window.top.location.href = inUrl; break; - case '_blank': - window.open(inUrl, '', ''); - break; default: - if (parent.spmFlexTarget.location.href) { - parent.spmFlexTarget.location.href = inUrl; + if (window.parent != window.self && typeof window.parent[spmFlexTarget] !== 'undefined') { + window.parent[spmFlexTarget].location.href = inUrl; } else { window.open(inUrl, spmFlexTarget, '') } @@ -400,16 +389,14 @@ /** * RsypÉXîñð|bvAbv·é (for SPM) */ -SPM.invite = function(aThread) -{ +SPM.invite = function (aThread) { Invite(aThread.title, aThread.url, aThread.host, aThread.bbs, aThread.key, spmResNum); }; /** * httpcmd.phpÌbp[ */ -SPM.httpcmd = function(cmd, aThread, callback) -{ +SPM.httpcmd = function (cmd, aThread, callback) { var num = spmResNum; var url = 'httpcmd.php?host=' + aThread.host + '&bbs=' + aThread.bbs + '&key=' + aThread.key + '&cmd=' + cmd + '&' + cmd + '=' + num; @@ -422,8 +409,7 @@ /** * u±±ÜÅÇñ¾vNGXgãÉÀs·éR[obNÖ */ -SPM.callbacks.setreadnum = function(result, cmd, aThread, num, url) -{ +SPM.callbacks.setreadnum = function (result, cmd, aThread, num, url) { var msg = 'Xbhg' + aThread.title + 'hÌùÇð'; if (result == '1') { msg += ' ' + num + ' ÉZbgµÜµ½B'; Modified: p2ex/trunk/lib/ShowThread.php =================================================================== --- p2ex/trunk/lib/ShowThread.php 2010-01-25 14:10:15 UTC (rev 805) +++ p2ex/trunk/lib/ShowThread.php 2010-01-25 16:57:05 UTC (rev 806) @@ -12,7 +12,7 @@ /** * NƵĵ¤p^[ * - * @type string + * @var string */ const LINK_REGEX = '{ (?P<link>(<[Aa][ ].+?>)(.*?)(</[Aa]>)) # NiPCREÌÁ«ãAK¸±Ìp^[ðÅÉs·éj @@ -41,7 +41,7 @@ /** * _CN^ÌíÞ * - * @type int + * @var int */ const REDIRECTOR_NONE = 0; const REDIRECTOR_IMENU = 1; @@ -51,7 +51,7 @@ /** * NG Ú[ñÌíÞ * - * @type int + * @var int */ const ABORN = -1; const NG_NONE = 0; @@ -69,31 +69,45 @@ /** * ÜÆßÇÝ[hÌXbh * - * @type int + * @var int */ static private $_matome_count = 0; /** * {¶ÈOªNG Ú[ñÉqbgµ½ * - * @type int + * @var int */ static protected $_ngaborns_head_hits = 0; /** * {¶ªNG Ú[ñÉqbgµ½ * - * @type int + * @var int */ static protected $_ngaborns_body_hits = 0; + /** + * getAnchorRegex() ÌLbV + * + * @var array + */ + static private $_anchorRegexes = array(); + + /** + * _getAnchorRegexParts() ÌLbV + * + * @var array + */ + static private $_anchorRegexParts = null; + // }}} // {{{ properties /** * ÜÆßÇÝ[hÌXbhÔ * - * @type int + * @var int */ protected $_matome; @@ -101,7 +115,7 @@ * URLð·éÖE\bh¼ÈÇði[·ézñ * (gÝÝ) * - * @type array + * @var array */ protected $_url_handlers; @@ -109,21 +123,21 @@ * URLð·éÖE\bh¼ÈÇði[·ézñ * ([Uè`AgÝÝÌàÌæèDæ) * - * @type array + * @var array */ protected $_user_url_handlers; /** * poIDð Ú[ñ·é * - * @type bool + * @var bool */ protected $_ngaborn_frequent; /** * NG or Ú[ñXª é©Ç¤© * - * @type bool + * @var bool */ protected $_has_ngaborns; @@ -131,7 +145,7 @@ * Ú[ñXÔ¨æÑNGXÔði[·ézñ * array_intersect()ðø¦æs¤½ßAY·éXÔͶñÉLXgµÄi[·é * - * @type array + * @var array */ protected $_aborn_nums; protected $_ng_nums; @@ -139,28 +153,28 @@ /** * _CN^ÌíÞ * - * @type int + * @var int */ protected $_redirector; /** * XbhIuWFNg * - * @type ThreadRead + * @var ThreadRead */ public $thread; /** * ANeBui[EIuWFNg * - * @type ActiveMona + * @var ActiveMona */ public $activeMona; /** * ANeBui[ªLø©Û© * - * @type bool + * @var bool */ public $am_enabled = false; @@ -1012,6 +1026,139 @@ } // }}} + // {{{ getAnchorRegex() + + /** + * AJ[̳K\»ðÔ· + * + * @param string $pattern ex)'/%full%/' + * @return string + */ + static public function getAnchorRegex($pattern) + { + if (!array_key_exists($pattern, self::$_anchorRegexes)) { + self::$_anchorRegexes[$pattern] = strtr($pattern, self::_getAnchorRegexParts()); + // å·ÍÈ¢ª compileMobile2chUriCallBack() Ìæ¤É preg_relplace_callback()µÄࢢ©àB + } + return self::$_anchorRegexes[$pattern]; + } + + // }}} + // {{{ _getAnchorRegexParts() + + /** + * AJ[Ì\¬vfi³K\»p[cÌzñjðÔ· + * + * @param void + * @return string + */ + static private function _getAnchorRegexParts() + { + if (!is_null(self::$_anchorRegexParts)) { + return self::$_anchorRegexParts; + } + + $anchor = array(); + + // AJ[Ì\¬vfi³K\»p[cÌzñj + + // ó¶ + $anchor_space = '(?:[ ]|@)'; + //$anchor[' '] = ''; + + // AJ[øpq >> + $anchor['prefix'] = "(?:>||<||r|t|â){1,2}{$anchor_space}*\.?"; + + // + $anchor['a_digit'] = '(?:\\d|O|P|Q|R|S|T|U|V|W|X)'; + /* + $anchor[0] = '(?:0|O)'; + $anchor[1] = '(?:1|P)'; + $anchor[2] = '(?:2|Q)'; + $anchor[3] = '(?:3|R)'; + $anchor[4] = '(?:4|S)'; + $anchor[5] = '(?:5|T)'; + $anchor[6] = '(?:6|U)'; + $anchor[7] = '(?:7|V)'; + $anchor[8] = '(?:8|W)'; + $anchor[9] = '(?:9|X)'; + */ + + // ÍÍwèq + $anchor['range_delimiter'] = "(?:-|]|\x81\\x5b)"; // [ + + // ñwèq + $anchor['delimiter'] = "{$anchor_space}?(?:[,=+]|A|E||C){$anchor_space}?"; + + // Ú[ñpAJ[øpq + //$anchor['prefix_abon'] = ">{1,2}{$anchor_space}?"; + + // XÔ + $anchor['a_num'] = sprintf('%s{1,4}', $anchor['a_digit']); + + // XÍÍ + /* + $anchor['a_range'] = sprintf("%s(?:%s%s)?", + $anchor['a_num'], $anchor['range_delimiter'], $anchor['a_num'] + ); + */ + $anchor['a_range'] = sprintf("%s(?:%s(?:%s)?%s)?", + $anchor['a_num'], $anchor['range_delimiter'], $anchor['prefix'], $anchor['a_num'] + ); + + // XÍÍÌñ + $anchor['ranges'] = sprintf('%s(?:%s%s)*(?!%s)', + $anchor['a_range'], $anchor['delimiter'], $anchor['a_range'], $anchor['a_digit'] + ); + + // XÔÌñ + $anchor['nums'] = sprintf("%s(?:%s%s)*(?!%s)", + $anchor['a_num'], $anchor['delimiter'], $anchor['a_num'], $anchor['a_digit'] + ); + + // AJ[SÌ + $anchor['full'] = sprintf('(%s)(%s)', $anchor['prefix'], $anchor['ranges']); + + // getAnchorRegex() Ì strtr() u·pÉkeyð '%key%' ÉÏ··é + foreach ($anchor as $k => $v) { + $anchor['%' . $k . '%'] = $v; + unset($anchor[$k]); + } + + self::$_anchorRegexParts = $anchor; + + return self::$_anchorRegexParts; + } + + // }}} + // {{{_buildStrToLinkRegex() + + /** + * NƵĵ¤p^[ðÔ· + * + * @param void + * @return string + */ + static protected function _buildStrToLinkRegex() + { + return '{' + . '(?P<link>(<[Aa] .+?>)(.*?)(</[Aa]>))' // NiPCREÌÁ«ãAK¸±Ìp^[ðÅÉs·éj + . '|' + . '(?:' + . '(?P<quote>' // øp + . $this->getAnchorRegex('%full%') + . ')' + . '|' + . '(?P<url>' + . '(ftp|h?ttps?|tps?)://([0-9A-Za-z][\\w!#%&+*,\\-./:;=?@\\[\\]^~]+)' // URL + . ')' + . '|' + . '(?P<id>ID: ?([0-9A-Za-z/.+]{8,11})(?=[^0-9A-Za-z/.+]|$))' // IDi8,10 +PC/gѯÊtOj + . ')' + . '}'; + } + + // }}} } // }}} Modified: p2ex/trunk/read_filter.php =================================================================== --- p2ex/trunk/read_filter.php 2010-01-25 14:10:15 UTC (rev 805) +++ p2ex/trunk/read_filter.php 2010-01-25 16:57:05 UTC (rev 806) @@ -45,7 +45,15 @@ $msg = $resar[3]; $aShowThread = new ShowThreadPc($aThread); - $word = $aShowThread->getFilterTarget($ares, $resnum, $name, $mail, $date_id, $msg); + if ($field == 'rres') { + $_REQUEST['field'] = 'msg'; + $_REQUEST['method'] = 'regex'; + $word = ShowThread::getAnchorRegex( + '%prefix%(.+%delimiter%)?' . $resnum . '(?!\\d|%range_delimiter%)' + ); + } else { + $word = $aShowThread->getFilterTarget($ares, $resnum, $name, $mail, $date_id, $msg); + } if (strlen($word) == 0) { unset($word); } else { Modified: p2ex/trunk/read_filter_k.php =================================================================== --- p2ex/trunk/read_filter_k.php 2010-01-25 14:10:15 UTC (rev 805) +++ p2ex/trunk/read_filter_k.php 2010-01-25 16:57:05 UTC (rev 806) @@ -54,7 +54,7 @@ <meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS"> <meta name="ROBOTS" content="NOINDEX, NOFOLLOW"> {$_conf['extra_headers_ht']} -<title>p2 - Xàõ</title> +<title>rep2 - Xàõ</title> </head> <body{$_conf['k_colors']}> <p>{$ttitle_back}</p> Modified: p2ex/trunk/style/post_css.inc =================================================================== --- p2ex/trunk/style/post_css.inc 2010-01-25 14:10:15 UTC (rev 805) +++ p2ex/trunk/style/post_css.inc 2010-01-25 16:57:05 UTC (rev 806) @@ -6,6 +6,8 @@ if($STYLE['a_underline_none'] == 2){ $thre_title_underline_css = "a.thre_title{text-decoration:none;}"; +} else { + thre_title_underline_css = ''; } echo <<<EOSTYLE