svnno****@sourc*****
svnno****@sourc*****
2010年 1月 22日 (金) 17:57:57 JST
Revision: 797 http://sourceforge.jp/projects/p2-php/svn/view?view=rev&revision=797 Author: rsk Date: 2010-01-22 17:57:56 +0900 (Fri, 22 Jan 2010) Log Message: ----------- expack: - ã¯ã©ã¤ã¢ã³ããiã¢ã¼ããã©ã¦ã¶2.xãã©ãããå¤å®ããã¡ã½ãã UA::isIModeBrowser2() ã追å ã -- DoCoMo端æ«ã§ãiã¢ã¼ããã©ã¦ã¶2.xã®ã¨ãã¯Cookieã使ãããã«å¤æ´ã - URLã²ã¼ãã¦ã§ã¤å¤æã®å®è£ ãP2Util::througIme()ããæ°ããã¯ã©ã¹P2Imeã«åé¢ã -- å¤æå¦çã¯ããã¾ã§ã©ããP2Util::througIme()ã使ãã - ã¦ã¼ã¶ã¼è¨å®ç·¨éã§å¤æ´ã確å®å¾ããå¤æ´åã®ã¿ãã復å ããããã«ããã ( - è¨å®ç®¡ç > ã¦ã¼ã¶è¨å®ç·¨é > rep2åºæ¬è¨å® > ETC > through_ime_http_only ã ãHTTPSã§ã¯ç´ãã«è¨å®ããã¨ãHTTPSã§ã¢ã¯ã»ã¹ãã¦ããã¨ãã¯å¤é¨URLã²ã¼ãã éããªãããã«ãããæ¢å®å¤ã¯ããã¾ã§ã¨åãã常ã«éããã (æè¿ã®Webãã©ã¦ã¶ã®å¤ã㯠https â http ã®é·ç§»ã§Refererãéåºããªããã) Modified Paths: -------------- p2ex/trunk/conf/conf.inc.php p2ex/trunk/conf/conf_user_def.inc.php p2ex/trunk/edit_conf_user.php p2ex/trunk/js/edit_conf_user.js p2ex/trunk/lib/P2Util.php p2ex/trunk/lib/ShowThreadPc.php p2ex/trunk/lib/UA.php p2ex/trunk/lib/bootstrap.php Added Paths: ----------- p2ex/trunk/lib/P2Ime.php -------------- next part -------------- Modified: p2ex/trunk/conf/conf.inc.php =================================================================== --- p2ex/trunk/conf/conf.inc.php 2010-01-21 11:39:53 UTC (rev 796) +++ p2ex/trunk/conf/conf.inc.php 2010-01-22 08:57:56 UTC (rev 797) @@ -90,7 +90,7 @@ $_conf['expack.download_url'] = 'http://page2.skr.jp/rep2/downloads.html'; $_conf['expack.history_url'] = 'http://page2.skr.jp/rep2/history.html'; $_conf['expack.tgrep_url'] = 'http://page2.xrea.jp/tgrep/search'; - $_conf['expack.ime_url'] = 'http://page2.skr.jp/gate.php'; + $_conf['expack.gate_php'] = 'http://page2.skr.jp/gate.php'; $_conf['menu_php'] = 'menu.php'; $_conf['subject_php'] = 'subject.php'; $_conf['read_php'] = 'read.php'; @@ -125,7 +125,7 @@ ini_set('arg_separator.output', '&'); // Windows Èç - if (strncasecmp(PHP_OS, 'WIN', 3) == 0) { + if (strncasecmp(PHP_OS, 'WIN', 3) === 0) { // Windows defined('PATH_SEPARATOR') or define('PATH_SEPARATOR', ';'); defined('DIRECTORY_SEPARATOR') or define('DIRECTORY_SEPARATOR', '\\'); @@ -136,6 +136,13 @@ define('P2_OS_WINDOWS', 0); } + // HTTPSÚ±Èç + if (array_key_exists('HTTPS', $_SERVER) && strcasecmp($_SERVER['HTTPS'], 'on') === 0) { + define('P2_HTTPS_CONNECTION', 1); + } else { + define('P2_HTTPS_CONNECTION', 0); + } + // koCgè // mbstring.script_encoding = SJIS-win ¾Æ // "\0", "\x00" È~ªJbg³êéÌÅAchr()Öðg¤ Modified: p2ex/trunk/conf/conf_user_def.inc.php =================================================================== --- p2ex/trunk/conf/conf_user_def.inc.php 2010-01-21 11:39:53 UTC (rev 796) +++ p2ex/trunk/conf/conf_user_def.inc.php 2010-01-22 08:57:56 UTC (rev 797) @@ -337,6 +337,10 @@ 'google' => 'Google', ); +// HTTPSÅANZXµÄ¢éÆ«ÍOURLQ[gðʳȢiHTTPSÅͼ:1, íÉÊ·:0j +$conf_user_def['through_ime_http_only'] = 0; // (0) +$conf_user_rad['through_ime_http_only'] = array('1' => 'HTTPSÅͼ', '0' => 'íÉÊ·'); + // Q[gÅ©®]µÈ¢g£qiJ}æØèÅAg£qÌOÌsIhÍsvj $conf_user_def['ime_manual_ext'] = "exe,zip"; // ("exe,zip") Modified: p2ex/trunk/edit_conf_user.php =================================================================== --- p2ex/trunk/edit_conf_user.php 2010-01-21 11:39:53 UTC (rev 796) +++ p2ex/trunk/edit_conf_user.php 2010-01-22 08:57:56 UTC (rev 797) @@ -86,19 +86,49 @@ // {{{ gÑÅ\¦·éO[v if ($_conf['ktai']) { - if (isset($_POST['edit_conf_user_group_en'])) { - $selected_group = UrlSafeBase64::decode($_POST['edit_conf_user_group_en']); - } elseif (isset($_POST['edit_conf_user_group'])) { - $selected_group = $_POST['edit_conf_user_group']; - } elseif (isset($_GET['edit_conf_user_group_en'])) { - $selected_group = UrlSafeBase64::decode($_GET['edit_conf_user_group_en']); - } elseif (isset($_GET['edit_conf_user_group'])) { - $selected_group = $_GET['edit_conf_user_group']; + 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 = htmlspecialchars($active_tab1, ENT_QUOTES); + $active_tab1_js = "'" . StrCtl::toJavaScript($active_tab1) . "'"; + } else { + $active_tab1 = null; + $active_tab1_ht = ''; + $active_tab1_js = 'null'; + } + if (isset($_REQUEST['active_tab2'])) { + $active_tab2 = $_REQUEST['active_tab2']; + $active_tab2_ht = htmlspecialchars($active_tab2, ENT_QUOTES); + $active_tab2_js = "'" . StrCtl::toJavaScript($active_tab2) . "'"; + } else { + $active_tab2 = null; + $active_tab2_ht = ''; + $active_tab2_js = 'null'; + } + $parent_tabs_js = "['" . implode("','", array( + StrCtl::toJavaScript('rep2î{Ýè'), + StrCtl::toJavaScript('gÑ[Ýè'), + StrCtl::toJavaScript('g£pbNÝè'), + )) . "']"; + $active_tab_hidden_ht = <<<EOP +<input type="hidden" id="active_tab1" name="active_tab1" value="{$active_tab1_ht}"> +<input type="hidden" id="active_tab2" name="active_tab2" value="{$active_tab2_ht}"> +<script type="text/javascript"> +// <![CDATA[ +_EDIT_CONF_USER_JS_PARENT_TABS = $parent_tabs_js; +_EDIT_CONF_USER_JS_ACTIVE_TAB1 = $active_tab1_js; +_EDIT_CONF_USER_JS_ACTIVE_TAB2 = $active_tab2_js; +// ]]> +</script> +EOP; } $groups = array(); @@ -173,6 +203,7 @@ // PCp\¦ if (!$_conf['ktai']) { + echo $active_tab_hidden_ht; echo <<<EOP <div class="tabber"> <div class="tabbertab" title="rep2î{Ýè"> @@ -335,6 +366,7 @@ array('res_hist_rec_num', '«ÝðÌL^'), array('res_write_rec', '«ÝàeOðL^'), array('through_ime', 'OURLWv·éÛÉÊ·Q[g<br>u¼ÚvÅàCookieªg¦È¢[ÅÍ gate.php ðÊ·'), + array('through_ime_http_only', ' HTTPSÅANZXµÄ¢éÆ«ÍOURLQ[gðʳȢ<br>(ÅßÌWebuEUÌ½Í https ¨ http ÌJÚÅRefererðoµÜ¹ñªA<br>uHTTPSÅͼvÉ·éêÍA¨g¢ÌuEUÌdlðmFµÄ¾³¢)'), array('ime_manual_ext', 'Q[gÅ©®]µÈ¢g£qiJ}æØèÅAg£qÌOÌsIhÍsvj'), array('join_favrank', '<a href="http://akid.s17.xrea.com/favrank/favrank.html" target="_blank">¨CÉX¤L</a>ÉQÁ'), array('merge_favita', '¨CÉÂÌXêðÜÆßÄ\¦ (¨CÉÂÌÉæÁÄÍÉÔª©©é)'), Modified: p2ex/trunk/js/edit_conf_user.js =================================================================== --- p2ex/trunk/js/edit_conf_user.js 2010-01-21 11:39:53 UTC (rev 796) +++ p2ex/trunk/js/edit_conf_user.js 2010-01-22 08:57:56 UTC (rev 797) @@ -2,6 +2,13 @@ * rep2expack - [UÝèÇÌUIð^u»·é */ +// {{{ GLOBALS + +var _EDIT_CONF_USER_JS_PARENT_TABS = []; +var _EDIT_CONF_USER_JS_ACTIVE_TAB1 = null; +var _EDIT_CONF_USER_JS_ACTIVE_TAB2 = null; + +// }}} // {{{ _edit_conf_user_js_onload() var _edit_conf_user_js_onload = function() { @@ -29,7 +36,8 @@ // PÂÚÌ 'tabbernav' ÉMEZbgpÌ^uðÇÁ·é var tabs = document.getElementsByTagName('ul'); - for (var i = 0; i < tabs.length; i++) { + var i, l = tabs.length; + for (i = 0; i < l; i++) { if (tabs[i].className != 'tabbernav') { continue; } @@ -68,8 +76,56 @@ tabs[i].appendChild(document.createElement('li')).appendChild(saveTab); tabs[i].appendChild(document.createElement('li')).appendChild(resetTab); tabs[i].appendChild(document.createElement('li')).appendChild(defaultTab); - return; + break; } + + // ^uðANeBx[g + var anchors, anchor, callback, title, group, group1, group2, j, k; + + k = _EDIT_CONF_USER_JS_PARENT_TABS.length; + group1 = document.getElementById('active_tab1'); + group2 = document.getElementById('active_tab2'); + + anchors = document.evaluate('.//ul[contains(concat(" ", @class, " "), " tabbernav ")]' + + '//a[@href = "javascript:void(null);" and @title]', + document.body, null, + XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null); + l = anchors.snapshotLength; + + for (i = 0; i < l; i++) { + anchor = anchors.snapshotItem(i); + if (typeof anchor.onclick === 'function') { + title = anchor.getAttribute('title'); + + if (title == _EDIT_CONF_USER_JS_ACTIVE_TAB1 || + title == _EDIT_CONF_USER_JS_ACTIVE_TAB2) + { + anchor.onclick(); + } + + group = group2; + for (j = 0; j < k; j++) { + if (title === _EDIT_CONF_USER_JS_PARENT_TABS[j]) { + group = group1; + break; + } + } + + if (group) { + callback = (function(field, title) { + return function() { + field.value = title; + }; + })(group, title); + + if (typeof anchor.addEventListener === 'function') { + anchor.addEventListener('click', callback, false); + } else if (typeof anchor.attachEvent === 'function') { + anchor.attachEvent('click', callback); + } + } + } + } }; // }}} Added: p2ex/trunk/lib/P2Ime.php =================================================================== --- p2ex/trunk/lib/P2Ime.php (rev 0) +++ p2ex/trunk/lib/P2Ime.php 2010-01-22 08:57:56 UTC (rev 797) @@ -0,0 +1,305 @@ +<?php + +// {{{ P2Ime + +/** + * rep2 - URLQ[gEFCÏ·NX + */ +class P2Ime +{ + // {{{ properties + + /** + * througth() ©çÄÑo³êéAÀÛÌURLÏ·\bh¼ + * + * @var string + */ + protected $_method; + + /** + * ©®]µÈ¢áOg£qÌXg + * + * @var array + */ + protected $_exceptions; + + /** + * ©®]µÈ¢áOg£qÌÅåÌ·³ + * + * @var int + */ + protected $_maxExceptionLength; + + /** + * httpvgRÌNÍQ[gðʳȢ + * + * @var bool + */ + protected $_ignoreHttp; + + /** + * Q[gÌURL + * + * @var string + */ + protected $_gateUrl; + + /** + * ©®]ÌÒ¿Ô (b) + * ÌêÍè®] + * + * @var int + */ + protected $_delay; + + // }}} + // {{{ __construct() + + /** + * RXgN^ + * + * @param string $type + * @param array $exceptions + * @param bool $ignoreHttp + */ + public function __construct($type = null, array $exceptions = null, $ignoreHttp = null) + { + global $_conf; + + // {{{ p[^Ìú» + + // Q[gEFC^Cv + if ($type === null) { + $type = $_conf['through_ime']; + // Cookieª³ø (URIÉZbVIDðÜÞ) Ìƫͧ + if (!$type && !$_conf['use_cookies']) { + $type = 'ex'; + } + } + + // pÌÝè®] + if ($type == 'p2pm') { + $type = 'p2'; + } elseif ($type == 'expm') { + $type = 'ex'; + } + + // ©®]µÈ¢g£q + if ($exceptions === null) { + if ($_conf['ime_manual_ext']) { + $this->_exceptions = explode(',', strtolower(trim($_conf['ime_manual_ext']))); + } else { + $this->_exceptions = array(); + } + } else { + $this->_exceptions = array_map('strtolower', $exceptions); + } + if ($this->_exceptions) { + $this->_maxExceptionLength = max(array_map('strlen', $this->_exceptions)); + } else { + $this->_maxExceptionLength = 0; + } + + // httpÌNÍʳȢ + if ($ignoreHttp === null) { + // $_conf['through_ime_http_only'] ª 1 ÅA + // ZL AÈÚ±ÅACookieªLø (URIÉZbVIDðÜÜÈ¢) ÌÆ«A + // httpvgRÌNÍQ[gðʳȢB + if ($_conf['through_ime_http_only'] && P2_HTTPS_CONNECTION && $_conf['use_cookies']) { + $this->_ignoreHttp = true; + } else { + $this->_ignoreHttp = false; + } + } else { + $this->_ignoreHttp = (bool)$ignoreHttp; + } + + // ©®]ÌÒ¿ÔÌùèl + $this->_delay = -1; + + // }}} + // {{{ Q[gEFC»è + + switch ($type) { + // {{{ p2ime + case 'p2': // ©®] + case 'p2m': // è®] + $this->_method = '_throughP2Ime'; + if ($type == 'p2m') { + $this->_delay = -1; + } else { + $this->_delay = 0; + } + $this->_gateUrl = $_conf['p2ime_url']; + break; + // }}} + // {{{ gate.php + case 'ex': // ©®]1b + case 'exq': // ©®]0b + case 'exm': // è®] + $this->_method = '_throughGatePhp'; + if ($type == 'exm') { + $this->_delay = -1; + } elseif ($type == 'exq') { + $this->_delay = 0; + } else { + $this->_delay = 1; + } + $this->_gateUrl = $_conf['expack.gate_php']; + break; + // }}} + // {{{ Google + case 'google': + $this->_method = '_throughGoogleGateway'; + if ($_conf['ktai'] && !$_conf['iphone']) { + $this->_gateUrl = 'http://www.google.co.jp/gwt/x?u='; + } else { + $this->_gateUrl = 'http://www.google.co.jp/url?q='; + } + break; + // }}} + default: + $this->_method = '_passThrough'; + $this->_gateUrl = null; + } + + // }}} + } + + // }}} + // {{{ through() + + /** + * URLðÏ··é + * + * @param string $url + * @param int $delay + * @param bool $escape + * @return string + */ + public function through($url, $delay = null, $escape = true) + { + if ($delay === null) { + if ($this->_isExceptionUrl($url)) { + $delay = -1; + } else { + $delay = $this->_delay; + } + } + + if (!($this->_ignoreHttp && preg_match('!^http://!', $url))) { + $url = $this->{$this->_method}($url, $delay); + } + if ($escape) { + return htmlspecialchars($url, ENT_QUOTES, 'Shift_JIS', false); + } else { + return $url; + } + } + + // }}} + // {{{ _throughP2Ime() + + /** + * p2imeðÊ·æ¤ÉURLðÏ··é + * + * p2imeÍAenc, m, url ÌøªÅè³êÄ¢éÌÅÓ + * + * @param string $url + * @param int $delay + * @return string + */ + protected function _throughP2Ime($url, $delay) + { + if ($delay < 0) { + return $this->_gateUrl . '?enc=1&url=' . rawurlencode($url); + } else { + return $this->_gateUrl . '?enc=1&m=1&url=' . rawurlencode($url); + } + } + + // }}} + // {{{ _throughGatePhp() + + /** + * gate.phpðÊ·æ¤ÉURLðÏ··é + * + * @param string $url + * @param int $delay + * @return string + */ + protected function _throughGatePhp($url, $delay) + { + return sprintf('%s?u=%s&d=%d', $this->_gateUrl, rawurlencode($url), $delay); + } + + // }}} + // {{{ _throughGoogleGateway() + + /** + * GoogleÌURLQ[gEFCðÊ·æ¤ÉURLðÏ··é + * + * @param string $url + * @param int $delay (unused) + * @return string + */ + protected function _throughGoogleGateway($url, $delay) + { + return $this->_gateUrl . rawurlencode($url); + } + + // }}} + // {{{ _passThrough() + + /** + * URLð»ÌÜÜÔ· + * + * @param string $url + * @param int $delay (unused) + * @return string + */ + protected function _passThrough($url, $delay) + { + return $url; + } + + // }}} + // {{{ _isExceptionUrl() + + /** + * ©®]ÌáOURL»è + * + * @param string $url + * @return bool + */ + protected function _isExceptionUrl($url) + { + if ($this->_exceptions) { + if (false !== ($pos = strrpos($url, '.'))) { + $pos++; + if (strlen($url) - $pos <= $this->_maxExceptionLength) { + $extension = strtolower(substr($url, $pos)); + if (in_array($extension, $this->_exceptions)) { + return false; + } + } + } + } + return false; + } + + // }}} +} + +// }}} + +/* + * Local Variables: + * mode: php + * coding: cp932 + * tab-width: 4 + * c-basic-offset: 4 + * indent-tabs-mode: nil + * End: + */ +// vim: set syn=php fenc=cp932 ai et ts=4 sw=4 sts=4 fdm=marker: Modified: p2ex/trunk/lib/P2Util.php =================================================================== --- p2ex/trunk/lib/P2Util.php 2010-01-21 11:39:53 UTC (rev 796) +++ p2ex/trunk/lib/P2Util.php 2010-01-22 08:57:56 UTC (rev 797) @@ -54,12 +54,19 @@ static private $_hostIsJbbsShitaraba = array(); /** - * ²ÆÌ«ÝÝè¨æÑXbh²ÆÌ«Ýf[^ðÛ¶·éf[^x[X + * P2ImeIuWFNg * - * @var P2KeyValueStore + * @var P2Ime */ - static private $_postDataStore = null; + static private $_ime = null; + /** + * P2ImeÅ©®]µÈ¢g£qÌXg + * + * @var array + */ + static private $_imeMenualExtensions = null; + // }}} // {{{ getMyHost() @@ -101,7 +108,7 @@ // zñwèpÉA[]¾¯»ÌÜÜcµÄAURLGR[hð©¯é return $key_urlen = preg_replace_callback( '/[^\\[\\]]+/', - array(__CLASS__, 'rawurldecodeCallback'), + array(__CLASS__, 'rawurlencodeCallback'), $key ); } @@ -694,73 +701,35 @@ /** * pQ[gðÊ·½ßÌURLÏ· + * + * @param string $url + * @param int $delay ÌêÍè®]A»êÈOÍQ[gÌdlÉæé + * @return string */ - static public function throughIme($url) + static public function throughIme($url, $delay = null) { - global $_conf; - static $manual_exts = null; - - if (is_null($manual_exts)) { - if ($_conf['ime_manual_ext']) { - $manual_exts = explode(',', trim($_conf['ime_manual_ext'])); - } else { - $manual_exts = array(); - } + if (self::$_ime === null) { + self::configureIme(); } - $url_en = rawurlencode($url); + return self::$_ime->through($url, $delay); + } - $gate = $_conf['through_ime']; - if ($manual_exts && - false !== ($ppos = strrpos($url, '.')) && - in_array(substr($url, $ppos + 1), $manual_exts) && - ($gate == 'p2' || $gate == 'ex') - ) { - $gate .= 'm'; - } + // }}} + // {{{ configureIme() - // p2imeÍAenc, m, url ÌøªÅè³êÄ¢éÌÅÓ - switch ($gate) { - /* - case '2ch': // ime.nu - $url_r = preg_replace('|^(\w+)://(.+)$|', '$1://ime.nu/$2', $url); - break; - */ - case 'p2': // ©®] - case 'p2pm': // pÌÝè®] - $url_r = $_conf['p2ime_url'] . '?enc=1&url=' . $url_en; - break; - case 'p2m': // è®] - $url_r = $_conf['p2ime_url'] . '?enc=1&m=1&url=' . $url_en; - break; - case 'ex': // ©®]1b - case 'expm': // pÌÝè®] - $url_r = $_conf['expack.ime_url'] . '?u=' . $url_en . '&d=1'; - break; - case 'exq': // ©®]0b - $url_r = $_conf['expack.ime_url'] . '?u=' . $url_en . '&d=0'; - break; - case 'exm': // è®] - $url_r = $_conf['expack.ime_url'] . '?u=' . $url_en; - break; - case 'google': - $url_r = 'http://www.google.co.jp/'; - if ($_conf['ktai'] && !$_conf['iphone']) { - $url_r .= 'gwt/x?u='; - } else { - $url_r .= 'url?q='; - } - $url_r .= $url_en; - break; - default: - if ($_conf['use_cookies']) { - $url_r = $url; - } else { - $url_r = $_conf['expack.ime_url'] . '?u=' . $url_en; - } - } - - return $url_r; + /** + * URLÏ·ÌÝèð·é + * + * @param string $type + * @param array $exceptions + * @param boolean $ignoreHttp + * @return void + * @see P2Ime::__construct() + */ + static public function configureIme($type = null, array $exceptions = null, $ignoreHttp = null) + { + self::$_ime = new P2Ime($type, $exceptions, $ignoreHttp); } // }}} @@ -1983,16 +1952,16 @@ } // }}} - // {{{ rawurldecodeCallback() + // {{{ rawurlencodeCallback() /** * preg_replace_callback()ÌR[obNÖÆµÄ - * }b`ÓSÌÉrawurldecode()ð©¯é + * }b`ÓSÌÉrawurlencode()ð©¯é * * @param array $m * @return string */ - static public function rawurldecodeCallback(array $m) + static public function rawurlencodeCallback(array $m) { return rawurlencode($m[0]); } Modified: p2ex/trunk/lib/ShowThreadPc.php =================================================================== --- p2ex/trunk/lib/ShowThreadPc.php 2010-01-21 11:39:53 UTC (rev 796) +++ p2ex/trunk/lib/ShowThreadPc.php 2010-01-22 08:57:56 UTC (rev 797) @@ -1024,11 +1024,9 @@ // HTML|bvAbv if ($_conf['iframe_popup'] && $is_http) { - // p2pm/expm wèÌêÌÝAÁÊÉè®]wèðÇÁ·é - if ($_conf['through_ime'] == 'p2pm') { - $pop_url = preg_replace('/\\?(enc=1&)url=/', '?$1m=1&url=', $link_url); - } elseif ($_conf['through_ime'] == 'expm') { - $pop_url = preg_replace('/(&d=-?\d+)?$/', '&d=-1', $link_url); + // *pm wèÌêÌÝAÁÊÉè®]wèðÇÁ·é + if (substr($_conf['through_ime'], -2) == 'pm') { + $pop_url = P2Util::throughIme($purl[0], -1); } else { $pop_url = $link_url; } @@ -1044,6 +1042,7 @@ } else { $brocra_checker_url = rtrim($_conf['brocra_checker_url'], '/') . '/' . $url; } + $brocra_checker_url_orig = $brocra_checker_url; // uN`FbJEime if ($_conf['through_ime']) { $brocra_checker_url = P2Util::throughIme($brocra_checker_url); @@ -1053,11 +1052,9 @@ $check_mark_suffix = ']'; // uN`FbJEHTML|bvAbv if ($_conf['iframe_popup']) { - // p2pm/expm wèÌêÌÝAÁÊÉè®]wèðÇÁ·é - if ($_conf['through_ime'] == 'p2pm') { - $brocra_pop_url = preg_replace('/\\?(enc=1&)url=/', '?$1m=1&url=', $brocra_checker_url); - } elseif ($_conf['through_ime'] == 'expm') { - $brocra_pop_url = $brocra_checker_url . '&d=-1'; + // *pm wèÌêÌÝAÁÊÉè®]wèðÇÁ·é + if (substr($_conf['through_ime'], -2) == 'pm') { + $brocra_checker_url = P2Util::throughIme($brocra_checker_url_orig, -1); } else { $brocra_pop_url = $brocra_checker_url; } Modified: p2ex/trunk/lib/UA.php =================================================================== --- p2ex/trunk/lib/UA.php 2010-01-21 11:39:53 UTC (rev 796) +++ p2ex/trunk/lib/UA.php 2010-01-22 08:57:56 UTC (rev 797) @@ -104,7 +104,7 @@ } $isMobile = false; - if ($nuam = &self::getNet_UserAgent_Mobile($ua)) { + if ($nuam = self::getNet_UserAgent_Mobile($ua)) { if (!$nuam->isNonMobile()) { $isMobile = true; } @@ -504,6 +504,25 @@ } // }}} + // {{{ isIModeBrowser2() + + /** + * UAªi[huEU2.xÈç true ðÔ· + * + * @param string $ua UAðwè·éÈç + * @return boolean + */ + static public function isIModeBrowser2($ua = null) + { + $nuam = self::getNet_UserAgent_Mobile($ua); + if ($nuam->isDoCoMo() && preg_match('!^DoCoMo/2\\.!', $nuam->getUserAgent())) { + return true; + } else { + return false; + } + } + + // }}} } // }}} Modified: p2ex/trunk/lib/bootstrap.php =================================================================== --- p2ex/trunk/lib/bootstrap.php 2010-01-21 11:39:53 UTC (rev 796) +++ p2ex/trunk/lib/bootstrap.php 2010-01-22 08:57:56 UTC (rev 797) @@ -189,7 +189,11 @@ // NTT docomo i[h if ($mobile->isDoCoMo()) { - $_conf['use_cookies'] = false; + if (UA::isIModeBrowser2()) { + $_conf['use_cookies'] = true; + } else { + $_conf['use_cookies'] = false; + } // au EZweb //} elseif ($mobile->isEZweb()) {