svnno****@sourc*****
svnno****@sourc*****
2011年 9月 28日 (水) 00:53:37 JST
Revision: 923 http://sourceforge.jp/projects/p2-php/svn/view?view=rev&revision=923 Author: akid Date: 2011-09-28 00:53:37 +0900 (Wed, 28 Sep 2011) Log Message: ----------- p2/ - PHPè¨å® mbstring.func_overload æå¹æã®ä¸å ·åãä¿®æ£ããã Thanks â http://hibari.2ch.net/test/read.cgi/software/1306160232/515 - Windows Phone 7åãIE9ã§ã®è¡¨ç¤ºã«å°ã対å¿ããã Thanks â http://hibari.2ch.net/test/read.cgi/software/1306160232/510 - Androidã¯youtubeãªã³ã¯å¤æã®å¯¾è±¡å¤ã¨ããã - cookieã®IPåä¸æ§ãã§ãã¯ã®ããã©ã«ããå¤æ´ããã°ã¤ã³ãã©ã¼ã ã®ãã§ãã¯ããã¯ã¹ãCookieèªè¨¼æã«IPã®åä¸æ§ããã§ãã¯ããªããããCookieãã°ã¤ã³æãIPã®åä¸æ§ããã§ãã¯ãããã«å¤æ´ããã ï¼$_COOKIE['ignore_cip'] â $_COOKIE['check_cip']ï¼ - gzipå§ç¸®è»¢éã®è¨å®ã追å ãããããã©ã«ãã§ã¯æºå¸¯ã®ã¿æå¹ã ï¼conf_admin.inc.php ã® $_conf['enable_ob_gzhandler']ï¼ Modified Paths: -------------- p2/trunk/conf/conf.inc.php p2/trunk/conf/conf_admin.inc.php p2/trunk/iphone/ShowThreadK.php p2/trunk/iphone/js/respopup.iPhone.js p2/trunk/iphone/js/smartpopup.iPhone.js p2/trunk/iphone/read_header_k.inc.php p2/trunk/iui/iui.css p2/trunk/lib/BbsMap.php p2/trunk/lib/FileCtl.php p2/trunk/lib/Login.php p2/trunk/lib/P2Util.php p2/trunk/lib/SettingTxt.php p2/trunk/lib/ShowThreadPc.php p2/trunk/lib/SubjectTxt.php p2/trunk/lib/ThreadRead.php p2/trunk/lib/UA.php p2/trunk/lib/login_first.inc.php p2/trunk/read_new_i.php p2/trunk/title.php -------------- next part -------------- Modified: p2/trunk/conf/conf.inc.php =================================================================== --- p2/trunk/conf/conf.inc.php 2011-09-25 16:23:46 UTC (rev 922) +++ p2/trunk/conf/conf.inc.php 2011-09-27 15:53:37 UTC (rev 923) @@ -100,31 +100,9 @@ $_conf['k_filter_marker'] = null; } +_obStart(); -$_conf['output_callback'] = null; -// ob_start('mb_output_handler'); - -if (UA::isK() //&& $mobile && $mobile->isWillcom() - // gzipÂ\©Ç¤©ÍPHPŻʵÄêé͸ - //&& !ini_get('zlib.output_compression') // T[o[ÌÝèÅ©®gzip³kªLøÉÈÁĢȢ - //&& strstr($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') // uEUªgzipðfR[hÅ«é -) { - !defined('SID') || !strlen(SID) and $_conf['output_callback'] = 'ob_gzhandler'; -} - -// gzip³k·éÆoÍÍūȳ»¤ -//!defined('SID') || !strlen(SID) and $_conf['output_callback'] = 'ob_gzhandler'; - -if ($_conf['output_callback']) { - ob_start($_conf['output_callback']); -} - -// ob_gzhandler pAobt@ª éóÔÅAflush()µÄµÜ¤Ægzip]ÉÈçÈÈéB¼OÉob_flush()ðüêéÆOKB -//ob_flush(); -//print_r(ob_list_handlers()); -//print_r(getallheaders()); - //====================================================================== // ÏÝè //====================================================================== @@ -291,7 +269,7 @@ } /** - * @return void + * @return void|die */ function _prepareFileSession() { @@ -322,6 +300,34 @@ P2Util::session_gc(); } +/** + * @return void + */ +function _obStart() +{ + global $_conf; + + // gzipÂ\©Ç¤©ÍPHPŻʵÄêéÁÛ¢¯Ç + if ($_conf['enable_ob_gzhandler'] + && !ini_get('zlib.output_compression') // T[o[ÌÝèÅ©®gzip³kªLøÉÈÁĢȢ + && strstr($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') // uEUªgzipðfR[hÅ«é + ) { + //if (!defined('SID') || !strlen(SID)) { + if ($_conf['enable_ob_gzhandler'] != 2 || UA::isK()) { + ob_start('ob_gzhandler'); + } + //} + } + + + // ob_start('mb_output_handler'); + + // ob_gzhandler pAobt@ª éóÔÅAflush()µÄµÜ¤Ægzip]ÉÈçÈÈéB¼OÉob_flush()ðüêéÆOKB + //ob_flush(); + //print_r(ob_list_handlers()); + //print_r(getallheaders()); +} + /* * Local Variables: * mode: php Modified: p2/trunk/conf/conf_admin.inc.php =================================================================== --- p2/trunk/conf/conf_admin.inc.php 2011-09-25 16:23:46 UTC (rev 922) +++ p2/trunk/conf/conf_admin.inc.php 2011-09-27 15:53:37 UTC (rev 923) @@ -54,7 +54,8 @@ // }}} // ---------------------------------------------------------------------- -// ZbVðg¤êÍAPHPÌÝèÅ session.use_trans_sid ðLøÉ·é±Æð§·é +// ZbVðgp·éêÍAPHPÌÝèÅ session.use_trans_sid ðLøÉ·é±Æð§B +// ¦$_conf['use_session']ð0É·éÆdocomoÌÅL[FØÍg¦ÈÈéÌÅÓB $_conf['use_session'] = 2; // (2) ZbVðpi·é:1, µÈ¢:0, cookieFتp³êĢȢÌÝ·é:2j $_conf['session_save'] = 'p2'; // ('p2') sessionf[^ÌÛ¶Ç (PHPftHg:'', p2Åt@CÇ:'p2') @@ -143,6 +144,7 @@ // }}} +$_conf['enable_ob_gzhandler'] = 2; // gzip³k]ðLøÉ·é©i¦LøÉ·éÆ\¦ªÅ«ÈÈéji·é:1, µÈ¢:0, gѾ¯:2j /* * Local Variables: Modified: p2/trunk/iphone/ShowThreadK.php =================================================================== --- p2/trunk/iphone/ShowThreadK.php 2011-09-25 16:23:46 UTC (rev 922) +++ p2/trunk/iphone/ShowThreadK.php 2011-09-27 15:53:37 UTC (rev 923) @@ -250,7 +250,7 @@ foreach ($quote_res_nums as $rnv) { if (empty($this->quote_res_nums_done[$rnv]) and $rnv < count($this->thread->datlines)) { $ds = $this->qRes($this->thread->datlines[$rnv-1], $rnv, 'q' . $rnv . 'of' . $this->thread->key); - $onPopUp_at = " onMouseover=\"showResPopUp('q{$rnv}of{$this->thread->key}',event,true)\""; + $onPopUp_at = " onmouseup=\"showResPopUp('q{$rnv}of{$this->thread->key}',event,true)\""; $rpop .= "<span id=\"q{$rnv}of{$this->thread->key}\" class=\"respopup\"{$onPopUp_at}>" . $ds . "</span>\n"; $this->quote_res_nums_done[$rnv] = true; } @@ -325,10 +325,10 @@ // iphonep // X}[g|bvAbvj [iread_newÍ¢ÎÆ·éj if ($_conf['enable_spm'] and empty($GLOBALS['_read_new_html'])) { - //$onPopUp_at = " onmouseover=\"showSPM({$this->thread->spmObjName},{$i},'{$id}',event,this)\" onmouseout=\"hideResPopUp('{$this->thread->spmObjName}_spm')\""; + //$onPopUp_at = " onmouseup=\"showSPM({$this->thread->spmObjName},{$i},'{$id}',event,this)\" onmouseout=\"hideResPopUp('{$this->thread->spmObjName}_spm')\""; // onmouseout="hideResPopUp()" ÍO·Kvª é - $onPopUp_at = " onmouseover=\"showSPM({$this->thread->spmObjName},{$i},'{$id}',event,this)\""; + $onPopUp_at = " onmouseup=\"showSPM({$this->thread->spmObjName},{$i},'{$id}',event,this)\""; $is = "<a href=\"javascript:void(0);\" class=\"resnum\"{$onPopUp_at}>{$i}</a>"; } else { $is = $i; @@ -976,7 +976,7 @@ $attributes = array(); if ($_conf['quote_res_view']) { $attributes = array( - 'onmouseover' => "showResPopUp('q{$qnum}of{$this->thread->key}',event)", + 'onmouseup' => "showResPopUp('q{$qnum}of{$this->thread->key}',event)", // d=1Í_~[BȺ©return false¾¯¾ÆøʪȢæ¤ÌÅB 'onclick' => 'var dummy=1; return false;' //'onmouseout' => "hideResPopUp('q{$qnum}of{$this->thread->key}')" @@ -1299,6 +1299,11 @@ { global $_conf; + // AndroidÍ youtube:NÉñÎ + if (UA::isAndroidWebKit()) { + return false; + } + // http://www.youtube.com/watch?v=Mn8tiFnAUAI // 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)) { Modified: p2/trunk/iphone/js/respopup.iPhone.js =================================================================== --- p2/trunk/iphone/js/respopup.iPhone.js 2011-09-25 16:23:46 UTC (rev 922) +++ p2/trunk/iphone/js/respopup.iPhone.js 2011-09-27 15:53:37 UTC (rev 923) @@ -261,10 +261,10 @@ /** * X|bvAbvð\¦^C}[·é * - * øpXÔÉ onMouseover ÅÄÑo³êé + * øpXÔÉ onmouseup ÅÄÑo³êé * [memo] æêøðeventIuWFNgɵ½ûªæ¢¾ë¤©B * - * @param boolean onPopSpace |bvAbvXy[XÖÌonmouseoverÅÌÄÑoµÈçBd¡ÄÑoµñð̽ßB + * @param boolean onPopSpace |bvAbvXy[XÖÌ onmouseup ÅÌÄÑoµÈçBd¡ÄÑoµñð̽ßB */ function showResPopUp(popId, ev, onPopSpace) { Modified: p2/trunk/iphone/js/smartpopup.iPhone.js =================================================================== --- p2/trunk/iphone/js/smartpopup.iPhone.js 2011-09-25 16:23:46 UTC (rev 922) +++ p2/trunk/iphone/js/smartpopup.iPhone.js 2011-09-27 15:53:37 UTC (rev 923) @@ -183,9 +183,9 @@ spmPopUpDelay = "delaySec=0;"; } //[I[o[ - var spmPopUpEvent = " onmouseover=\"" + spmPopUpDelay + "showResPopUp('" + popup_id + "',event,true);\""; + var spmPopUpEvent = " onmouseup=\"" + spmPopUpDelay + "showResPopUp('" + popup_id + "',event,true);\""; //[AEg - spmPopUpEvent += " onmouseout=\"" + spmPopUpDelay + "hideResPopUp('" + popup_id + "');\""; + // spmPopUpEvent += " onmouseout=\"" + spmPopUpDelay + "hideResPopUp('" + popup_id + "');\""; return spmPopUpEvent; } Modified: p2/trunk/iphone/read_header_k.inc.php =================================================================== --- p2/trunk/iphone/read_header_k.inc.php 2011-09-25 16:23:46 UTC (rev 922) +++ p2/trunk/iphone/read_header_k.inc.php 2011-09-27 15:53:37 UTC (rev 923) @@ -374,7 +374,7 @@ // X}[g|bvAbvj [ JavaScriptR[h if ($_conf['enable_spm']) { // smartpopup.iPhone.js needs post_form.js's popUpFootbarFormIPhone(). - ?><script type="text/javascript" src="iphone/js/smartpopup.iPhone.js?v=20070308"></script><?php + ?><script type="text/javascript" src="iphone/js/smartpopup.iPhone.js?v=20110715"></script><?php $aThread->showSmartPopUpMenuJs(); } Modified: p2/trunk/iui/iui.css =================================================================== --- p2/trunk/iui/iui.css 2011-09-25 16:23:46 UTC (rev 922) +++ p2/trunk/iui/iui.css 2011-09-27 15:53:37 UTC (rev 923) @@ -47,7 +47,8 @@ } */ /* c[o[AãÌƱ */ -body > .toolbar { +/* body > .toolbar { */ +body .toolbar { box-sizing: border-box; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; @@ -59,7 +60,8 @@ } /* c[o[Ì^ñ̶ */ -.toolbar > h1 { +/* .toolbar > h1 { */ +.toolbar h1#pageTitle { position: absolute; overflow: hidden; left: 50%; @@ -75,7 +77,8 @@ color: #FFFFFF; } -.toolbar > h1 > a { +/* .toolbar > h1 > a { */ +.toolbar h1 a { color:white; } @@ -156,7 +159,8 @@ j [ÌêâXêÈÇ ¶Ì嫳ͱ±Å */ -body > ul > li { +/* body > ul > li { */ +body ul li { position: relative; margin: 0; border-bottom: 1px solid #E0E0E0; @@ -171,7 +175,8 @@ êÌO[v¼ topÅÍuj [vuÂõvÆ\¦³êÄéƱë */ -body > ul > li.group { +/* body > ul > li.group { */ +body ul li.group { position: relative; /* top: -1px; margin-bottom: -2px; */ @@ -185,7 +190,8 @@ color: #FFFFFF; } -body > ul > li.group:first-child { +/* body > ul > li.group:first-child { */ +body ul li.group:first-child { top: 0; border-top: none; } @@ -279,7 +285,8 @@ margin-left: 0px; padding: 0px; } -form > ul > li.group { +/* form > ul > li.group { */ +form ul li.group { position: relative; top: -1px; margin-left: 0px; @@ -295,7 +302,8 @@ color: #FFFFFF; } -form > ul > li.group:first-child { +/* form > ul > li.group:first-child { */ +form ul li.group:first-child { top: 0; border-top: none; } @@ -364,7 +372,8 @@ /************************************************************************************************/ -body > .panel { +/* body > .panel { */ +body .panel { box-sizing: border-box; -webkit-box-sizing: border-box; padding: 10px; @@ -531,7 +540,8 @@ margin: 0; } -.foot_sure>span { +/* .foot_sure > span { */ +.foot_sure span { width: 64px; height: 50px; overflow: hidden; Modified: p2/trunk/lib/BbsMap.php =================================================================== --- p2/trunk/lib/BbsMap.php 2011-09-25 16:23:46 UTC (rev 922) +++ p2/trunk/lib/BbsMap.php 2011-09-27 15:53:37 UTC (rev 923) @@ -319,7 +319,9 @@ return $map; } } else { - FileCtl::mkdirFor($map_cache_path); + if (false === FileCtl::mkdirFor($map_cache_path)) { + return false; + } } touch($map_cache_path); clearstatcache(); Modified: p2/trunk/lib/FileCtl.php =================================================================== --- p2/trunk/lib/FileCtl.php 2011-09-25 16:23:46 UTC (rev 922) +++ p2/trunk/lib/FileCtl.php 2011-09-27 15:53:37 UTC (rev 923) @@ -78,6 +78,7 @@ /** * mkdirR() ÌÀðs¤ + * [todo] die͵½È¢ * * @access private * @param integer $rtimes ÄAÄÑoµ³êÄ¢é»Ýñ @@ -114,7 +115,7 @@ } // e©çæÉÄAÀs - if (!FileCtl::_mkdirR(dirname($dir), $perm, $die, ++$rtimes)) { + if (false === FileCtl::_mkdirR(dirname($dir), $perm, $die, ++$rtimes)) { $die and die('Error: FileCtl::_mkdirR()'); return false; } @@ -183,17 +184,54 @@ function getGzFileContents($filepath) { if (is_readable($filepath)) { + /* + ob_implicit_flush(false); ob_start(); readgzfile($filepath); $contents = ob_get_contents(); ob_end_clean(); return $contents; + */ + return implode('', gzfile($filepath)); } return false; } - + /** + * VXeR}hÅt@CÌgzipððs¤ihoge.txt.gz ¨ hoge.txtj + * + * @static + * @access public + * @return boolean + */ + function ungzipWithSystemCommand($gzfile, $bakfile) + { + // ungzt@CªùɶݷéÈçêIÉobNAbvµÄÞð + $ungzfile = rtrim($gzfile, '.gz'); + if (file_exists($ungzfile)) { + file_exists($bakfile) and unlink($bakfile); + rename($ungzfile, $bakfile); + } + + // ð·éihoge.txt.gz ª hoge.txt ÉÏ·³êéj + $rcode = 1; + system(sprintf('gzip -d %s', escapeshellarg($gzfile)), $rcode); + + // ð¸sÈçobNAbvðß· + if ($rcode != 0) { + if (file_exists($bakfile)) { + file_exists($ungzfile) and unlink($ungzfile); // Ï·¸sµ½t@Cðí·é + rename($bakfile, $ungzfile); + } + return false; + } + // ð¬÷ + file_exists($bakfile) and unlink($bakfile); + return true; + } + + /** * WindowsÅÍã«Ì rename() ÅG[ªoéæ¤ÈÌÅA»ÌG[ðñðµ½rename() * ¦½¾µAunlink() Æ rename() ÌÔÅêuÌÔªóÌÅ®SÅÍÈ¢B * Ql http://ns1.php.gr.jp/pipermail/php-users/2005-October/027827.html @@ -213,53 +251,59 @@ } return rename($src_file, $dest_file); } - + /** - * «ÝÌs®SÈt@CàeªÇÝæçêé±ÆÌÈ¢æ¤ÉAêt@CÉ«ñÅ©çl[·é - * ¦½¾µAWindowsÌêÍAã«renameªs®SÆÈéÌżګޱÆÆ·é + * «ÝÌs®SÈt@CàeªÇÝæçêé±ÆÌÈ¢æ¤ÉAêt@CÉ«ñÅ©çl[·éB + * ¦½¾µAWindowsÌêÍAã«renameªs®SÆÈéÌżګޱÆÆ·éB + * $tmp_pathÅêt@CpXðwèµÈ¢êA¯É«Ýª éÆL^ÌÍÛسêÈ¢B * * @static * @access public - * @param string $tmp_dir êÛ¶fBNg - * @return boolean Às¬Û i¬÷É«ÝoCgðÔ·Ó¡ÁÄÙÆñÇÈ¢Cª·éj + * @param string $tmp_dir êÛ¶fBNgÌwèB + * @param string $tmp_path ifBNgðÜß½jêÛ¶t@CpX̾¦wèB±êðwèµ½êA$tmp_dir ͳøÆÈéB + * @return boolean Às¬Û i¬÷É«ÝoCgðÔ·Ó¡ÍÙÆñÇÈ¢Æv¤j */ - function filePutRename($file, $cont, $tmp_dir = null) + function filePutRename($file, $cont, $tmp_dir = null, $tmp_path = null) { - if (strlen($file) == 0) { + if (!strlen($file)) { trigger_error(__CLASS__ . '::' . __FUNCTION__ . '(), file is null', E_USER_WARNING); return false; } $win = (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') ? true : false; - // êt@CpXðßé - $prefix = 'rename_'; - // êfBNg̾¦wèª éê - if ($tmp_dir) { // strlen($tmp_dir) > 0 Ʒ׫Ʊ뾪AÞµë"0"àȵƢ¤±ÆɵÄÝé - if (!is_dir($tmp_dir)) { - trigger_error(__FUNCTION__ . "() -> is_dir($tmp_dir) failed.", E_USER_WARNING); - return false; - } - + if (strlen($tmp_path)) { + $write_file = $win ? $file : $tmp_path; + } else { - if (isset($GLOBALS['_conf']['tmp_dir'])) { - $tmp_dir = $GLOBALS['_conf']['tmp_dir']; + // êfBNg̾¦wèª éê + if (strlen($tmp_dir)) { if (!is_dir($tmp_dir)) { - FileCtl::mkdirR($tmp_dir); + trigger_error(__FUNCTION__ . "() -> is_dir($tmp_dir) failed.", E_USER_WARNING); + return false; } } else { - // 2006/10/05 php_get_tmpdir() Í might be only in CVS - if (function_exists('php_get_tmpdir')) { - $tmp_dir = php_get_tmpdir(); + if (isset($GLOBALS['_conf']['tmp_dir'])) { + $tmp_dir = $GLOBALS['_conf']['tmp_dir']; + if (!is_dir($tmp_dir)) { + if (false === FileCtl::mkdirR($tmp_dir)) { + return false; + } + } } else { - // ±êÅ®ìÍ·éªAnullwèÅàåäv©ÈB2007/01/22 WinÅÍNG?¢mF + // 2006/10/05 php_get_tmpdir() Í might be only in CVS + // $tmp_dir = php_get_tmpdir(); + + // nullÅà''ÅàAtempnam()ÅVXeÌe|fBNgªgp³êéªA±êÅ¢¢àÌ©B + // 2007/01/22 WinÅÍNG?¢mF $tmp_dir = null; } } + + // tempnam()Å쬵½t@CÌp[~bVÍ0600ÉÈé + $write_file = $win ? $file : tempnam($tmp_dir, $prefix = 'rename_'); } - - $write_file = $win ? $file : tempnam($tmp_dir, $prefix); if (false === $r = file_put_contents($write_file, $cont, LOCK_EX)) { return false; Modified: p2/trunk/lib/Login.php =================================================================== --- p2/trunk/lib/Login.php 2011-09-25 16:23:46 UTC (rev 922) +++ p2/trunk/lib/Login.php 2011-09-27 15:53:37 UTC (rev 923) @@ -754,11 +754,11 @@ if (!empty($_REQUEST['ctl_regist_cookie'])) { if ($_REQUEST['regist_cookie'] == '1') { - $ignore_cip = false; - if (!empty($_POST['ignore_cip'])) { - $ignore_cip = true; + $check_cip = false; + if (!empty($_POST['check_cip'])) { + $check_cip = true; } - $r = $this->setCookieCid($this->user_u, $this->pass_x, $ignore_cip); + $r = $this->setCookieCid($this->user_u, $this->pass_x, $check_cip); } else { // NbL[ðNA $r = $this->clearCookieAuth(); @@ -777,7 +777,7 @@ { $r = P2Util::unsetCookie('cid'); - $_COOKIE = array(); + //$_COOKIE = array(); return $r; } @@ -788,21 +788,21 @@ * @access protected * @return boolean */ - function setCookieCid($user_u, $pass_x, $ignore_cip = null) + function setCookieCid($user_u, $pass_x, $check_cip = null) { global $_conf; $time = time() + 60*60*24 * $_conf['cid_expire_day']; - if (!is_null($ignore_cip)) { - if ($ignore_cip) { - P2Util::setCookie('ignore_cip', '1', time() + 60*60*24*365); // ±±ÍúÀª·Äà\íÈ¢ - $_COOKIE['ignore_cip'] = '1'; - } else { - P2Util::unsetCookie('ignore_cip'); - // O̽ßhCwèȵà - setcookie('ignore_cip', '', time() - 3600); - } + if (!is_null($check_cip)) { + //if ($check_cip) { + P2Util::setCookie('check_cip', (int)$check_cip, time() + 60*60*24*365); // ±±ÍúÀª·Äà\íÈ¢ + $_COOKIE['check_cip'] = (int)$check_cip; + //} else { + // P2Util::unsetCookie('check_cip'); + // // O̽ßhCwèȵà + // setcookie('check_cip', '', time() - 3600); + //} } if ($cid = $this->makeCid($user_u, $pass_x)) { @@ -953,9 +953,7 @@ || HostCheck::isAddrIbis() ) { ; - } elseif (!empty($_COOKIE['ignore_cip'])) { - ; - } else { + } elseif (!empty($_COOKIE['check_cip'])) { $now_ips = explode('.', $_SERVER['REMOTE_ADDR']); $seed .= $now_ips[0]; } Modified: p2/trunk/lib/P2Util.php =================================================================== --- p2/trunk/lib/P2Util.php 2011-09-25 16:23:46 UTC (rev 922) +++ p2/trunk/lib/P2Util.php 2011-09-27 15:53:37 UTC (rev 923) @@ -390,7 +390,20 @@ } } - if (is_array($cArray) or setcookie("$key", '', time() - 3600, $path, $domain)) { + // 2011/07/16 softbank 821SCÅØ + // setcookie()Ålð''ÉZbgÅ«È¢B³³êéB + // úÀðß time()-1 ÅZbgÅ«È¢A³³êéBtime() ũ뤶ÄOK¾Á½B + // OOÁÄݽª¯l̺ÍÈ©Á½B±Ì@í(821SC)¾¯H½©ÁêÈP[XH + + if (UA::isSoftBank()) { + $replace = $_COOKIE[$key]; + $timelimit = time(); + } else { + $replace = ''; + $timelimit = time() - 3600; + } + + if (is_array($cArray) or setcookie("$key", $replace, $timelimit, $path, $domain)) { if ($cakey) { eval("unset(\$_COOKIE{$cakey});"); } else { @@ -830,7 +843,7 @@ if ($use_tmp_file) { if (!is_dir($_conf['tmp_dir'])) { - if (!FileCtl::mkdirR($_conf['tmp_dir'])) { + if (false === FileCtl::mkdirR($_conf['tmp_dir'])) { die("Error: $me, cannot mkdir."); return false; } Modified: p2/trunk/lib/SettingTxt.php =================================================================== --- p2/trunk/lib/SettingTxt.php 2011-09-25 16:23:46 UTC (rev 922) +++ p2/trunk/lib/SettingTxt.php 2011-09-27 15:53:37 UTC (rev 923) @@ -78,7 +78,9 @@ $perm = $_conf['dl_perm'] ? $_conf['dl_perm'] : 0606; - FileCtl::mkdirFor($this->setting_txt); // ÂfBNgª³¯êÎìé + if (false === FileCtl::mkdirFor($this->setting_txt)) { + return false; + } $modified = null; if (file_exists($this->setting_srd) && file_exists($this->setting_txt)) { Modified: p2/trunk/lib/ShowThreadPc.php =================================================================== --- p2/trunk/lib/ShowThreadPc.php 2011-09-25 16:23:46 UTC (rev 922) +++ p2/trunk/lib/ShowThreadPc.php 2011-09-27 15:53:37 UTC (rev 923) @@ -364,7 +364,7 @@ $qpop_ht = ''; $dummy_msg = ''; - $quote_res_nums = $this->checkQuoteResNums(0, '1', $dummy_msg); + $quote_res_nums = $this->checkQuoteResNums(1, '1', $dummy_msg); foreach ($quote_res_nums as $rnv) { if (empty($this->quote_res_nums_done[$rnv])) { $q_ht = ''; Modified: p2/trunk/lib/SubjectTxt.php =================================================================== --- p2/trunk/lib/SubjectTxt.php 2011-09-25 16:23:46 UTC (rev 922) +++ p2/trunk/lib/SubjectTxt.php 2011-09-27 15:53:37 UTC (rev 923) @@ -110,8 +110,9 @@ $modified = false; if ($this->storage == 'file') { - FileCtl::mkdirFor($this->subject_file); // ÂfBNgª³¯êÎìé - + if (false === FileCtl::mkdirFor($this->subject_file)) { + return false; + } if (file_exists($this->subject_file)) { // t@CLbV ª êÎADL§ÀÔð©¯é Modified: p2/trunk/lib/ThreadRead.php =================================================================== --- p2/trunk/lib/ThreadRead.php 2011-09-25 16:23:46 UTC (rev 922) +++ p2/trunk/lib/ThreadRead.php 2011-09-27 15:53:37 UTC (rev 923) @@ -427,7 +427,8 @@ flock($fp, LOCK_EX); if (0 === fseek($fp, $from_bytes)) { if (false !== fwrite($fp, $body)) { - ftruncate($fp, $from_bytes + strlen($body)); + // mbstring.func_overloadðl¶µÄAstrlen($body) ÅÍÈA(strlen(bin2hex($body)) / 2) ƵĢéB + ftruncate($fp, $from_bytes + (strlen(bin2hex($body)) / 2)); $done = true; } } @@ -587,14 +588,14 @@ $code = $h['code']; // Partial Content - if ($code == "200") { + if ($code == '200') { // OKB½àµÈ¢ // Found - } elseif ($code == "304") { + } elseif ($code == '304') { fclose($fp); //$this->isonline = true; - return "304 Not Modified"; + return '304 Not Modified'; // \úµÈ¢HTTPR[hBÈ©Á½Æ»f·é } else { @@ -633,57 +634,39 @@ } fclose($fp); - $done_gunzip = false; + $made_keydat = false; // gzip³kÈç if ($isGzip) { - // gzip tempt@CÉÛ¶ - $gztempfile = $this->keydat . '.gz'; - FileCtl::mkdirFor($gztempfile); - if (file_put_contents($gztempfile, $body, LOCK_EX) === false) { + // êt@C(dat.gz)ÉÛ¶ + $keydatgzfile = $this->keydat . '.gz'; + if (false === FileCtl::mkdirFor($keydatgzfile)) { + return false; + } + if (false === file_put_contents($keydatgzfile, $body, LOCK_EX)) { die("Error: cannot write file. downloadDat2chMaru()"); return false; } // PHPÅðÇÝÝ if (extension_loaded('zlib')) { - $body = FileCtl::getGzFileContents($gztempfile); - // R}hCÅð + $body = FileCtl::getGzFileContents($keydatgzfile); + + // R}hCgzipÅðÛ¶ } else { - // ùɶݷéÈçêdatðobNAbvÞð - $keydat_bak = $this->keydat . '.bak'; - if (file_exists($this->keydat)) { - if (file_exists($keydat_bak)) { - unlink($keydat_bak); - } - rename($this->keydat, $keydat_bak); - } - $rcode = 1; - // ð·é - system("gzip -d $gztempfile", $rcode); - // ð¸sÈçobNAbvðß· - if ($rcode != 0) { - if (file_exists($keydat_bak)) { - file_exists($this->keydat) and unlink($this->keydat); - rename($keydat_bak, $this->keydat); - } + if (!FileCtl::ungzipWithSystemCommand($keydatgzfile, $this->keydat . '.bak')) { + // ¸sÈç + // êt@C(dat.gz)ðÌÄé + file_exists($keydatgzfile) and unlink($keydatgzfile); $this->pushDownloadDatErrorMsgHtml("<p>p2 info - 2¿áñËéßOqÉ©çÌXbhæèÝÍAPHPÌ<a href=\"http://www.php.net/manual/ja/ref.zlib.php\">zlibg£W [</a>ªÈ¢©AsystemÅgzipR}hªgpÂ\ÅȯêÎūܹñB</p>"); - // gztempt@CðÌÄé - file_exists($gztempfile) and unlink($gztempfile); - $this->diedat = true; return false; - - // ð¬÷Èç - } else { - file_exists($keydat_bak) and unlink($keydat_bak); - - $done_gunzip = true; } - + $made_keydat = true; + $body = file_get_contents($this->keydat); } - // gzip tempt@CðÌÄé - file_exists($gztempfile) and unlink($gztempfile); + // êt@C(dat.gz)ðÌÄé + file_exists($keydatgzfile) and unlink($keydatgzfile); } /* @@ -699,9 +682,9 @@ return $this->downloadDat2chKako($kakolog, '.dat'); } - if (!$done_gunzip) { + if (!$made_keydat) { FileCtl::make_datafile($this->keydat, $_conf['dat_perm']); - if (file_put_contents($this->keydat, $body, LOCK_EX) === false) { + if (false === file_put_contents($this->keydat, $body, LOCK_EX)) { die("Error: cannot write file. downloadDat2chMaru()"); return false; } @@ -726,7 +709,7 @@ } } FileCtl::make_datafile($this->keydat, $_conf['dat_perm']); - if (file_put_contents($this->keydat, $cont, LOCK_EX) === false) { + if (false === file_put_contents($this->keydat, $cont, LOCK_EX)) { die("Error: cannot write file. downloadDat2chMaru()"); return false; } @@ -849,14 +832,14 @@ $code = $h['code']; // Partial Content - if ($code == "200") { + if ($code == '200') { // OKB½àµÈ¢ // Not Modified - } elseif ($code == "304") { + } elseif ($code == '304') { fclose($fp); //$this->isonline = true; - return "304 Not Modified"; + return '304 Not Modified'; // \úµÈ¢HTTPR[hBÈ©Á½Æ»f } else { @@ -890,56 +873,42 @@ } fclose($fp); - $done_gunzip = false; + $made_keydat = false; + // gzip³kÈç if ($isGzip) { - $gztempfile = $this->keydat . '.gz'; - FileCtl::mkdirFor($gztempfile); - if (file_put_contents($gztempfile, $body, LOCK_EX) === false) { + // êt@C(dat.gz)ÉÛ¶ + $keydatgzfile = $this->keydat . '.gz'; + if (false === FileCtl::mkdirFor($keydatgzfile)) { + return false; + } + if (file_put_contents($keydatgzfile, $body, LOCK_EX) === false) { die("Error: cannot write file. downloadDat2chKako()"); return false; } + + // PHPÅðÇÝÝ if (extension_loaded('zlib')) { - $body = FileCtl::getGzFileContents($gztempfile); + $body = FileCtl::getGzFileContents($keydatgzfile); + + // R}hCgzipÅðÛ¶ } else { - // ùɶݷéÈçêobNAbvÞð - $keydat_bak = $this->keydat . '.bak'; - if (file_exists($this->keydat)) { - if (file_exists($keydat_bak)) { - unlink($keydat_bak); - } - rename($this->keydat, $keydat_bak); - } - $rcode = 1; - // ð - system("gzip -d $gztempfile", $rcode); - if ($rcode != 0) { - if (file_exists($keydat_bak)) { - if (file_exists($this->keydat)) { - unlink($this->keydat); - } - // ¸sÈçobNAbvß· - rename($keydat_bak, $this->keydat); - } + if (!FileCtl::ungzipWithSystemCommand($keydatgzfile, $this->keydat . '.bak')) { + // ¸sÈç + // êt@C(dat.gz)ðÌÄé + file_exists($keydatgzfile) and unlink($keydatgzfile); $this->pushDownloadDatErrorMsgHtml("<p>p2 info - 2¿áñËéßOqÉ©çÌXbhæèÝÍAPHPÌ<a href=\"http://www.php.net/manual/ja/ref.zlib.php\">zlibg£W [</a>ªÈ¢©AsystemÅgzipR}hªgpÂ\ÅȯêÎūܹñB</p>"); - // gztempt@CðÌÄé - file_exists($gztempfile) and unlink($gztempfile); $this->diedat = true; return false; - - } else { - if (file_exists($keydat_bak)) { - unlink($keydat_bak); - } - $done_gunzip = true; } - + $made_keydat = true; + //$body = file_get_contents($this->keydat); } - // tempt@CðÌÄé - file_exists($gztempfile) and unlink($gztempfile); + // êt@C(dat.gz)ðÌÄé + file_exists($keydatgzfile) and unlink($keydatgzfile); } - if (!$done_gunzip) { + if (!$made_keydat) { FileCtl::make_datafile($this->keydat, $_conf['dat_perm']); if (false === file_put_contents($this->keydat, $body, LOCK_EX)) { die("Error: cannot write file. downloadDat2chKako()"); Modified: p2/trunk/lib/UA.php =================================================================== --- p2/trunk/lib/UA.php 2011-09-25 16:23:46 UTC (rev 922) +++ p2/trunk/lib/UA.php 2011-09-27 15:53:37 UTC (rev 923) @@ -420,6 +420,22 @@ } /** + * UAªisSoftBankÈçtrueðÔ· + * + * @static + * @access public + * @param string $ua UAðwè·éÈç + * @return boolean + */ + function isSoftBank($ua = null) + { + if ($nuam = &UA::getNet_UserAgent_Mobile($ua)) { + return $nuam->isSoftBank(); + } + return false; + } + + /** * UAªNetFrontigÑAPDAAPSPjÈçtrueðÔ· * * @static Modified: p2/trunk/lib/login_first.inc.php =================================================================== --- p2/trunk/lib/login_first.inc.php 2011-09-25 16:23:46 UTC (rev 922) +++ p2/trunk/lib/login_first.inc.php 2011-09-27 15:53:37 UTC (rev 923) @@ -303,19 +303,21 @@ $regist_cookie_checked = ''; } } - $ignore_cip_checked = ''; + + $check_cip_checked = ''; if (isset($_POST['submit_newuser']) || isset($_POST['submit_userlogin'])) { - if (geti($_POST['ignore_cip']) == '1') { - $ignore_cip_checked = ' checked'; + if (!empty($_POST['check_cip'])) { + $check_cip_checked = ' checked'; } } else { - if (geti($_COOKIE['ignore_cip']) == '1') { - $ignore_cip_checked = ' checked'; + if (array_key_exists('check_cip', $_COOKIE) && $_COOKIE['check_cip']) { + $check_cip_checked = ' checked'; } } + $auth_sub_input_ht = '<input type="hidden" name="ctl_regist_cookie" value="1">' - . sprintf('<input type="checkbox" id="regist_cookie" name="regist_cookie" value="1"%s><label for="regist_cookie">OCîñðCookieÉÛ¶·éi§j</label><br>', $regist_cookie_checked) - . sprintf('<input type="checkbox" id="ignore_cip" name="ignore_cip" value="1"%s><label for="ignore_cip">CookieFØÉIP̯ê«ð`FbNµÈ¢</label><br>', $ignore_cip_checked); + . sprintf('<input type="checkbox" id="regist_cookie" name="regist_cookie" value="1"%s><label for="regist_cookie">OCîñðCookieÉÛ¶·é</label><br>', $regist_cookie_checked) + . sprintf('<input type="checkbox" id="check_cip" name="check_cip" value="1"%s><label for="check_cip">CookieOCAIP̯ê«ð`FbN·éiæèÀSj</label><br>', $check_cip_checked); } return $auth_sub_input_ht; Modified: p2/trunk/read_new_i.php =================================================================== --- p2/trunk/read_new_i.php 2011-09-25 16:23:46 UTC (rev 922) +++ p2/trunk/read_new_i.php 2011-09-27 15:53:37 UTC (rev 923) @@ -164,7 +164,7 @@ <script type="text/javascript" src="iphone/js/setfavjs.js?v=20090428"></script> <script type="text/javascript" src="js/post_form.js?v=20090724"></script> <?php // smartpopup.iPhone.js needs post_form.js's popUpFootbarFormIPhone(). ?> - <script type="text/javascript" src="iphone/js/smartpopup.iPhone.js?v=20090724"></script> + <script type="text/javascript" src="iphone/js/smartpopup.iPhone.js?v=20110715"></script> <script type="text/javascript"> <!-- gExistWord = false; Modified: p2/trunk/title.php =================================================================== --- p2/trunk/title.php 2011-09-25 16:23:46 UTC (rev 922) +++ p2/trunk/title.php 2011-09-27 15:53:37 UTC (rev 923) @@ -149,7 +149,7 @@ /** * ICãÌrep2ÅVÅð`FbN·é * - * @return string HTML + * @return string|false HTML */ function _checkUpdatan() { @@ -159,7 +159,9 @@ $ver_txt_url = $_conf['p2web_url'] . 'p2status.txt'; $cachefile = P2Util::cacheFileForDL($ver_txt_url); - FileCtl::mkdirFor($cachefile); + if (false === FileCtl::mkdirFor($cachefile)) { + return false; + } if (file_exists($cachefile)) { // LbV ÌXVªwèÔÈàÈç