[P2-php-svn] [980] p2/ for version 1.8.104

Zurück zum Archiv-Index

svnno****@sourc***** svnno****@sourc*****
2015年 1月 17日 (土) 12:57:30 JST


Revision: 980
          http://sourceforge.jp/projects/p2-php/scm/svn/commits/980
Author:   akid
Date:     2015-01-17 12:57:30 +0900 (Sat, 17 Jan 2015)
Log Message:
-----------
p2/ for version 1.8.104

Modified Paths:
--------------
    p2/trunk/conf/conf_system.inc.php
    p2/trunk/conf/conf_user_def.inc.php
    p2/trunk/doc/ChangeLog.txt
    p2/trunk/edit_aborn_word.php
    p2/trunk/iphone/sb_header_k.inc.php
    p2/trunk/lib/BbsMap.php
    p2/trunk/lib/FileCtl.php
    p2/trunk/lib/HostCheck.php
    p2/trunk/lib/NgAbornCtl.php
    p2/trunk/lib/P2Util.php
    p2/trunk/lib/SettingTxt.php
    p2/trunk/lib/SubjectTxt.php
    p2/trunk/lib/ThreadRead.php
    p2/trunk/lib/UA.php
    p2/trunk/read.php

-------------- next part --------------
Modified: p2/trunk/conf/conf_system.inc.php
===================================================================
--- p2/trunk/conf/conf_system.inc.php	2014-05-15 00:32:14 UTC (rev 979)
+++ p2/trunk/conf/conf_system.inc.php	2015-01-17 03:57:30 UTC (rev 980)
@@ -3,7 +3,7 @@
 // \x82\xB1\x82̃t\x83@\x83C\x83\x8B\x82́A\x93\xC1\x82ɗ\x9D\x97R\x82̖\xB3\x82\xA2\x8C\xC0\x82\xE8\x95ύX\x82\xB5\x82Ȃ\xA2\x82ʼn\xBA\x82\xB3\x82\xA2\x81B
 // include from conf.inc.php
 
-$_conf['p2version'] = '1.8.103'; // rep2\x82̃o\x81[\x83W\x83\x87\x83\x93
+$_conf['p2version'] = '1.8.104'; // rep2\x82̃o\x81[\x83W\x83\x87\x83\x93
 
 $_conf['p2name'] = 'rep2';    // rep2\x82̖\xBC\x91O\x81B
 

Modified: p2/trunk/conf/conf_user_def.inc.php
===================================================================
--- p2/trunk/conf/conf_user_def.inc.php	2014-05-15 00:32:14 UTC (rev 979)
+++ p2/trunk/conf/conf_user_def.inc.php	2015-01-17 03:57:30 UTC (rev 980)
@@ -319,7 +319,7 @@
 // {{{ \x81\xA1ETC
 
 // \x94ƒ\x81\x83j\x83\x85\x81[\x81i\x83t\x83\x8C\x81[\x83\x80\x8D\xB6\x81jmenu \x82̕\\x8E\xA6\x95\x9D
-$conf_user_def['frame_menu_width'] = "164"; // ("164")
+$conf_user_def['frame_menu_width'] = "166"; // ("166")
 
 // \x83X\x83\x8C\x88ꗗ\x81i\x83t\x83\x8C\x81[\x83\x80\x89E\x8F\xE3\x81jsubject \x82̕\\x8E\xA6\x95\x9D
 $conf_user_def['frame_subject_width'] = "40%"; // ("40%")

Modified: p2/trunk/doc/ChangeLog.txt
===================================================================
--- p2/trunk/doc/ChangeLog.txt	2014-05-15 00:32:14 UTC (rev 979)
+++ p2/trunk/doc/ChangeLog.txt	2015-01-17 03:57:30 UTC (rev 980)
@@ -1,3 +1,12 @@
+2015/01/17
+	* rep2 version 1.8.104
+
+	[\x8DX\x90V] Willcom(Y!mobile)\x82\xC6au\x82\xCCIP\x83A\x83h\x83\x8C\x83X\x91ш\xE6\x82\xF0\x8DX\x90V\x82\xB5\x82\xBD\x81B
+	[\x8DX\x90V] iOS\x82\xCCUA\x94\xBB\x92\xE8\x82\xF0\x8DX\x90V\x82\xB5\x82\xBD\x81B
+	[\x8DX\x90V] \x8Dŋߓǂ񂾃X\x83\x8C\x82ŁAkey\x82\xC6bbs\x82\xAA\x93\xAF\x82\xB6\x8Fꍇ\x82ł\xE0host\x82\xAA\x88قȂ\xEA\x82Εʂ̃X\x83\x8C\x82Ƃ\xB5\x82Ĉ\xB5\x82\xA4\x82悤\x82ɂ\xB5\x82\xBD\x81B
+	[\x8DX\x90V] NG\x82\xA0\x82ځ[\x82\xF1\x82̐ݒ\xE8\x82Ŕ‚̎w\x92\xE8\x82̑啶\x8E\x9A\x82Ə\xAC\x95\xB6\x8E\x9A\x82\xF0\x8B\xE6\x95ʂ\xB5\x82Ȃ\xA2\x82悤\x82ɂ\xB5\x82\xBD\x81B
+	[\x8DX\x90V] \x83t\x83@\x83C\x83\x8B\x8F\x88\x97\x9D\x82\xF0\x82\xE6\x82蒚\x8Fd\x82ɂ\xB5\x82\xBD\x81BupdateArraySrdFile()
+
 2014/05/15
 	* rep2 version 1.8.103
 

Modified: p2/trunk/edit_aborn_word.php
===================================================================
--- p2/trunk/edit_aborn_word.php	2014-05-15 00:32:14 UTC (rev 979)
+++ p2/trunk/edit_aborn_word.php	2015-01-17 03:57:30 UTC (rev 980)
@@ -102,59 +102,10 @@
 }
 
 // }}}
-// {{{ \x83\x8A\x83X\x83g\x93ǂݍ\x9E\x82\xDD
 
-$formdata = array();
-if (file_exists($path)) {
-    $lines = file($path);
-    $i = 0;
-    foreach ($lines as $line) {
-        $lar = explode("\t", rtrim($line, "\r\n"));
-        if (strlen($lar[0]) == 0) {
-            continue;
-        }
-        $ar = array(
-            'cond' => $lar[0], // \x8C\x9F\x8D\xF5\x8F\xF0\x8C\x8F
-            'word' => $lar[0], // \x91Ώە\xB6\x8E\x9A\x97\xF1
-            'ht'   => geti($lar[1]), // \x8DŌ\xE3\x82\xC9HIT\x82\xB5\x82\xBD\x8E\x9E\x8A\xD4
-            'hn'   => geti($lar[2], 0), // HIT\x89\xF1\x90\x94
-            're'   => '', // \x90\xB3\x8BK\x95\\x8C\xBB
-            'ic'   => '', // \x91啶\x8E\x9A\x8F\xAC\x95\xB6\x8E\x9A\x82𖳎\x8B
-            'bbs'  => '', // \x94\xC2
-            'tt'   => '', // \x83^\x83C\x83g\x83\x8B
-        );
-        // \x94”\x9B\x82\xE8
-        if (preg_match('!<bbs>(.+?)</bbs>!', $ar['word'], $matches)) {
-            $ar['bbs'] = $matches[1];
-        }
-        $ar['word'] = preg_replace('!<bbs>(.*)</bbs>!', '', $ar['word']);
-        // \x83^\x83C\x83g\x83\x8B\x94\x9B\x82\xE8
-        if (preg_match('!<title>(.+?)</title>!', $ar['word'], $matches)) {
-            $ar['tt'] = $matches[1];
-        }
-        $ar['word'] = preg_replace('!<title>(.*)</title>!', '', $ar['word']);
-        // \x90\xB3\x8BK\x95\\x8C\xBB
-        if (preg_match('/^<(mb_ereg|preg_match|regex)(:[imsxeADSUXu]+)?>(.*)$/', $ar['word'], $m)) {
-            $ar['word'] = $m[3];
-            $ar['re'] = ' checked';
-            // \x91啶\x8E\x9A\x8F\xAC\x95\xB6\x8E\x9A\x82𖳎\x8B
-            if ($m[2] && false !== strpos($m[2], 'i')) {
-                $ar['ic'] = ' checked';
-            }
-        // \x91啶\x8E\x9A\x8F\xAC\x95\xB6\x8E\x9A\x82𖳎\x8B
-        } elseif (preg_match('/^<i>(.*)$/', $ar['word'], $m)) {
-            $ar['word'] = $m[1];
-            $ar['ic'] = ' checked';
-        }
-        if (strlen($ar['word']) == 0) {
-            continue;
-        }
-        $formdata[$i++] = $ar;
-    }
-}
+// NG\x82\xA0\x82ځ[\x82񃊃X\x83g\x93ǂݍ\x9E\x82\xDD
+$formdata = _loadNgAbornDataForEdit($path);
 
-// }}}
-
 //=====================================================================
 // \x83v\x83\x8A\x83\x93\x83g\x90ݒ\xE8
 //=====================================================================
@@ -305,7 +256,7 @@
 echo $htm['form_submit'];
 ?><br><?php
 
-if (!empty($formdata)) {
+if ($formdata) {
     foreach ($formdata as $k => $v) {
         printf($row_format,
             $k,
@@ -347,6 +298,70 @@
 </body></html>
 <?php
 
+// \x82\xB1\x82̃t\x83@\x83C\x83\x8B\x93\xE0\x82̏\x88\x97\x9D\x82͂\xB1\x82\xB1\x82܂\xC5
+
+//=================================================================================
+// \x8A֐\x94
+//=================================================================================
+/**
+ * NG\x82\xA0\x82ځ[\x82񃊃X\x83g\x82\xF0\x93ǂݍ\x9E\x82\xDE
+ *
+ * @return  array
+ */
+function _loadNgAbornDataForEdit($path)
+{
+    $formdata = array();
+    if (!file_exists($path)) {
+        return $formdata;
+    }
+    $lines = file($path);
+    $i = 0;
+    foreach ($lines as $line) {
+        $lar = explode("\t", rtrim($line, "\r\n"));
+        if (strlen($lar[0]) == 0) {
+            continue;
+        }
+        $ar = array(
+            'cond' => $lar[0], // \x8C\x9F\x8D\xF5\x8F\xF0\x8C\x8F
+            'word' => $lar[0], // \x91Ώە\xB6\x8E\x9A\x97\xF1
+            'ht'   => geti($lar[1]), // \x8DŌ\xE3\x82\xC9HIT\x82\xB5\x82\xBD\x8E\x9E\x8A\xD4
+            'hn'   => geti($lar[2], 0), // HIT\x89\xF1\x90\x94
+            're'   => '', // \x90\xB3\x8BK\x95\\x8C\xBB
+            'ic'   => '', // \x91啶\x8E\x9A\x8F\xAC\x95\xB6\x8E\x9A\x82𖳎\x8B
+            'bbs'  => '', // \x94\xC2
+            'tt'   => '', // \x83^\x83C\x83g\x83\x8B
+        );
+        // \x94”\x9B\x82\xE8
+        if (preg_match('!<bbs>(.+?)</bbs>!', $ar['word'], $matches)) {
+            $ar['bbs'] = $matches[1];
+        }
+        $ar['word'] = preg_replace('!<bbs>(.*)</bbs>!', '', $ar['word']);
+        // \x83^\x83C\x83g\x83\x8B\x94\x9B\x82\xE8
+        if (preg_match('!<title>(.+?)</title>!', $ar['word'], $matches)) {
+            $ar['tt'] = $matches[1];
+        }
+        $ar['word'] = preg_replace('!<title>(.*)</title>!', '', $ar['word']);
+        // \x90\xB3\x8BK\x95\\x8C\xBB
+        if (preg_match('/^<(mb_ereg|preg_match|regex)(:[imsxeADSUXu]+)?>(.*)$/', $ar['word'], $m)) {
+            $ar['word'] = $m[3];
+            $ar['re'] = ' checked';
+            // \x91啶\x8E\x9A\x8F\xAC\x95\xB6\x8E\x9A\x82𖳎\x8B
+            if ($m[2] && false !== strpos($m[2], 'i')) {
+                $ar['ic'] = ' checked';
+            }
+        // \x91啶\x8E\x9A\x8F\xAC\x95\xB6\x8E\x9A\x82𖳎\x8B
+        } elseif (preg_match('/^<i>(.*)$/', $ar['word'], $m)) {
+            $ar['word'] = $m[1];
+            $ar['ic'] = ' checked';
+        }
+        if (strlen($ar['word']) == 0) {
+            continue;
+        }
+        $formdata[$i++] = $ar;
+    }
+    return $formdata;
+}
+
 /*
  * Local Variables:
  * mode: php

Modified: p2/trunk/iphone/sb_header_k.inc.php
===================================================================
--- p2/trunk/iphone/sb_header_k.inc.php	2014-05-15 00:32:14 UTC (rev 979)
+++ p2/trunk/iphone/sb_header_k.inc.php	2015-01-17 03:57:30 UTC (rev 980)
@@ -56,7 +56,7 @@
 // }}}
 // {{{ \x83y\x81[\x83W\x83^\x83C\x83g\x83\x8B\x95\x94\x95\xAAHTML\x90ݒ\xE8
 
-$ptitle_hs = hs($aThreadList->ptitle);
+$ptitle = $aThreadList->ptitle;
 
 if ($aThreadList->spmode == 'taborn') {
     $ptitle_ht = <<<EOP
@@ -67,9 +67,9 @@
 	<a href="{$ptitle_url}"><b>{$aThreadList->itaj_hs}</b></a>\x81idat\x91q\x8CɁj
 EOP;
 } elseif (!empty($ptitle_url)) {
-    $ptitle_ht = sprintf('<a href="%s"><b>%s</b></a>', $ptitle_url, $ptitle_hs);
+    $ptitle_ht = sprintf('<a href="%s"><b>%s</b></a>', $ptitle_url, hs($ptitle));
 } else {
-    $ptitle_ht = "<b>{$ptitle_hs}</b>";
+    $ptitle_ht = sprintf('<b>%s</b>', hs($ptitle));
 }
 
 // }}}
@@ -149,14 +149,14 @@
 } 
 // --> 
 </script> 
-<title><?php eh($aThreadList->ptitle) ?></title>
+<title><?php eh($ptitle) ?></title>
 </head>
 <body id="subject">
 
 <?php $index_uri = UriUtil::buildQueryUri('index.php', array(UA::getQueryKey() => UA::getQueryValue())); ?>
 <p><a id="backButton" class="tbutton" href="<?php eh($index_uri); ?>">TOP</a></p>
 
-<div class="toolbar"><h1 class="pageTitle"><?php eh($aThreadList->ptitle) ?></h1></div>
+<div class="toolbar"><h1 class="pageTitle"><?php eh($ptitle) ?></h1></div>
 <?php
 
 P2Util::printInfoHtml();

Modified: p2/trunk/lib/BbsMap.php
===================================================================
--- p2/trunk/lib/BbsMap.php	2014-05-15 00:32:14 UTC (rev 979)
+++ p2/trunk/lib/BbsMap.php	2015-01-17 03:57:30 UTC (rev 980)
@@ -37,11 +37,7 @@
             $new_host = $map[$type][$bbs]['host'];
             if ($host != $new_host && $autosync && !$synced) {
                 // \x88ړ]\x82\xF0\x8C\x9F\x8Fo\x82\xB5\x82\xBD\x82炨\x8BC\x82ɔA\x82\xA8\x8BC\x82ɃX\x83\x8C\x81A\x8Dŋߓǂ񂾃X\x83\x8C\x82\xF0\x8E\xA9\x93\xAE\x82œ\xAF\x8A\xFA
-                $msg_fmt = '<p>p2 info: \x83z\x83X\x83g\x82̈ړ]\x82\xF0\x8C\x9F\x8Fo\x82\xB5\x82܂\xB5\x82\xBD\x81B(%s/%s \x81\xA8 %s/%s)<br>';
-                $msg_fmt .= '\x82\xA8\x8BC\x82ɔA\x82\xA8\x8BC\x82ɃX\x83\x8C\x81A\x8Dŋߓǂ񂾃X\x83\x8C\x82\xF0\x8E\xA9\x93\xAE\x82œ\xAF\x8A\xFA\x82\xB5\x82܂\xB7\x81B</p>';
-                $msg = sprintf($msg_fmt, $host, $bbs, $new_host, $bbs);
-                P2Util::pushInfoHtml($msg);
-                BbsMap::syncFav();
+                BbsMap::syncHost($new_host, $bbs, $host);
                 $synced = true;
             }
             $host = $new_host;
@@ -49,9 +45,24 @@
 
         return $host;
     }
-
+    
+    /**
+     * @static
+     * @access  public
+     * @return  void
+     */
+    function syncHost($new_host, $bbs, $old_host)
+    {
+        $msg_fmt = '<p>p2 info: \x83z\x83X\x83g\x82̈ړ]\x82\xF0\x8C\x9F\x8Fo\x82\xB5\x82܂\xB5\x82\xBD\x81B(%s/%s \x81\xA8 %s/%s)<br>';
+        $msg_fmt .= '\x82\xA8\x8BC\x82ɔA\x82\xA8\x8BC\x82ɃX\x83\x8C\x81A\x8Dŋߓǂ񂾃X\x83\x8C\x82\xF0\x8E\xA9\x93\xAE\x82œ\xAF\x8A\xFA\x82\xB5\x82܂\xB7\x81B</p>';
+        $msg = sprintf($msg_fmt, $old_host, $bbs, $new_host, $bbs);
+        P2Util::pushInfoHtml($msg);
+        
+        BbsMap::syncFavs($new_host, $bbs, $old_host);
+    }
+    
     // }}}
-
+    
     /**
      * 2ch\x82̔–\xBC\x82\xA9\x82\xE7\x83z\x83X\x83g\x96\xBC\x82\xF0\x8E擾\x82\xB7\x82\xE9
      *
@@ -116,7 +127,7 @@
      * @param   boolean $noMsg      \x8C\x8B\x89ʃ\x81\x83b\x83Z\x81[\x83W\x82\xCCpush\x82\xF0\x97}\x90\xA7\x82\xB7\x82\xE9\x82Ȃ\xE7true
      * @return  void
      */
-    function syncBrd($brd_path, $noMsg = false)
+    function syncBrd($brd_path, $noMsg = false, $sethost = null, $setbbs = null, $old_host = null)
     {
         global $_conf;
         static $done = array();
@@ -126,14 +137,17 @@
         if (array_key_exists($brd_path, $done)) {
             return;
         }
-        $lines = BbsMap::_readData($brd_path);
-        if (!$lines) {
+
+        if (!$lines = BbsMap::_readData($brd_path)) {
             return;
         }
-        $map = BbsMap::_getMapping();
-        if (!$map) {
+        
+        if ($sethost && $setbbs && $old_host) {
+            $settype = BbsMap::_detectHostType($old_host);
+        } elseif (!$map = BbsMap::_getMapping()) {
             return;
         }
+        
         $neolines = array();
         $updated = false;
 
@@ -149,7 +163,13 @@
             $itaj = $data[3];
             $type = BbsMap::_detectHostType($host);
 
-            if (isset($map[$type]) && isset($map[$type][$bbs])) {
+            $newhost = $host;
+            
+            if ($settype) {
+                if ($type == $settype && $bbs == $setbbs) {
+                    $newhost = $sethost;
+                }
+            } elseif (isset($map[$type]) && isset($map[$type][$bbs])) {
                 $newhost = $map[$type][$bbs]['host'];
                 if ($itaj === '') {
                     $itaj = $map[$type][$bbs]['itaj'];
@@ -159,8 +179,6 @@
                         $itaj = '';
                     }
                 }
-            } else {
-                $newhost = $host;
             }
 
             if ($host != $newhost || $setitaj) {
@@ -199,7 +217,7 @@
      * @param   boolean $noMsg      \x8C\x8B\x89ʃ\x81\x83b\x83Z\x81[\x83W\x82\xCCpush\x82\xF0\x97}\x90\xA7\x82\xB7\x82\xE9\x82Ȃ\xE7true
      * @return  void
      */
-    function syncIdx($idx_path, $noMsg = false)
+    function syncIdx($idx_path, $noMsg = false, $sethost = null, $setbbs = null, $old_host = null)
     {
         global $_conf;
         static $done = array();
@@ -209,14 +227,17 @@
         if (isset($done[$idx_path])) {
             return;
         }
-        $lines = BbsMap::_readData($idx_path);
-        if (!$lines) {
+
+        if (!$lines = BbsMap::_readData($idx_path)) {
             return;
         }
-        $map = BbsMap::_getMapping();
-        if (!$map) {
+        
+        if ($sethost && $setbbs && $old_host) {
+            $settype = BbsMap::_detectHostType($old_host);
+        } elseif (!$map = BbsMap::_getMapping()) {
             return;
         }
+        
         $neolines = array();
         $updated = false;
 
@@ -229,10 +250,14 @@
             $bbs  = $data[11];
             $type = BbsMap::_detectHostType($host);
 
-            if (isset($map[$type]) && isset($map[$type][$bbs])) {
+            $newhost = $host;
+            
+            if ($settype) {
+                if ($type == $settype && $bbs == $setbbs) {
+                    $newhost = $sethost;
+                }
+            } elseif (isset($map[$type]) && isset($map[$type][$bbs])) {
                 $newhost = $map[$type][$bbs]['host'];
-            } else {
-                $newhost = $host;
             }
 
             if ($host != $newhost) {
@@ -267,18 +292,18 @@
      * \x82\xA8\x8BC\x82ɔA\x82\xA8\x8BC\x82ɃX\x83\x8C\x81A\x8Dŋߓǂ񂾃X\x83\x8C\x82𓯊\xFA\x82\xB7\x82\xE9
      *
      * @return  void
-     * @access  public
+     * @access  private
      * @static
      */
-    function syncFav()
+    function syncFavs($new_host, $bbs, $old_host)
     {
         global $_conf;
         
         $noMsg = UA::isK() ? true : false;
         
-        BbsMap::syncBrd($_conf['favita_path'], $noMsg);
-        BbsMap::syncIdx($_conf['favlist_file'], $noMsg);
-        BbsMap::syncIdx($_conf['recent_file'], $noMsg);
+        BbsMap::syncBrd($_conf['favita_path'], $noMsg, $new_host, $bbs, $old_host);
+        BbsMap::syncIdx($_conf['favlist_file'], $noMsg, $new_host, $bbs, $old_host);
+        BbsMap::syncIdx($_conf['recent_file'], $noMsg, $new_host, $bbs, $old_host);
     }
 
     // }}}

Modified: p2/trunk/lib/FileCtl.php
===================================================================
--- p2/trunk/lib/FileCtl.php	2014-05-15 00:32:14 UTC (rev 979)
+++ p2/trunk/lib/FileCtl.php	2015-01-17 03:57:30 UTC (rev 980)
@@ -232,6 +232,33 @@
     }
     
     /**
+     * \x8B\xA4\x97L\x83\x8D\x83b\x83N\x82\xF0\x82\xA9\x82\xAF\x82āA\x83t\x83@\x83C\x83\x8B\x93\xE0\x97e\x82\xF0\x93ǂݍ\x9E\x82\xDE
+     *
+     * @static
+     * @access  public
+     * @return  string|false
+     */
+    function fileGetContents($file)
+    {
+        if (!$fp = fopen($file, 'rb')) {
+            return false;
+        }
+        $bytes = 12000;
+        $cont = '';
+        flock($fp, LOCK_SH);
+        while (!feof($fp)) {
+            $line = fgets($fp, $bytes);
+            if (strlen($line)) {
+                $cont .= $line;
+            }
+        }
+        flock($fp, LOCK_UN);
+        fclose($fp);
+
+        return $cont;
+    }
+    
+    /**
      * Windows\x82ł͏㏑\x82\xAB\x82\xCC rename() \x82ŃG\x83\x89\x81[\x82\xAA\x8Fo\x82\xE9\x82悤\x82Ȃ̂ŁA\x82\xBB\x82̃G\x83\x89\x81[\x82\xF0\x89\xF1\x94\xF0\x82\xB5\x82\xBDrename()
      * \x81\xA6\x82\xBD\x82\xBE\x82\xB5\x81Aunlink() \x82\xC6 rename() \x82̊Ԃň\xEA\x8Fu\x82̊Ԃ\xAA\x8B󂭂̂Ŋ\xAE\x91S\x82ł͂Ȃ\xA2\x81B
      * \x8EQ\x8Dl http://ns1.php.gr.jp/pipermail/php-users/2005-October/027827.html

Modified: p2/trunk/lib/HostCheck.php
===================================================================
--- p2/trunk/lib/HostCheck.php	2014-05-15 00:32:14 UTC (rev 979)
+++ p2/trunk/lib/HostCheck.php	2015-01-17 03:57:30 UTC (rev 980)
@@ -483,7 +483,7 @@
         //$regHost = '/^wb\d+proxy\d\d\.ezweb\.ne\.jp$/';
         $regHost = '/\.ezweb\.ne\.jp$/';
         
-        // @updated 2013/12/01
+        // @updated 2015/01/17
         $bands = array(
            // EZ\x8C\x93PCSV\x81B\x93\x9D\x88ꂳ\x82ꂽ\x82\xC1\x82Ă\xB1\x82Ƃ\xCDPCSV\x82\xE0HTTP_X_UP_SUBNO\x82𑗐M\x82\xB7\x82\xE9\x82񂾂낤\x82\xA9\x81H
             '111.107.116.64/26',
@@ -498,9 +498,23 @@
             '61.117.2.40/29',
             '219.108.158.40/29',
             '111.86.142.0/26',
-            '111.86.141.64/26',
-            '111.86.141.128/26',
             '111.86.141.192/26',
+            '27.90.136.0/27',
+            '27.90.136.32/27',
+            '27.90.136.64/27',
+            '27.90.136.96/27',
+            '27.90.136.128/27',
+            '27.90.136.160/27',
+            '27.90.136.192/27',
+            '27.90.137.192/27',
+            '27.90.137.224/27',
+            '27.90.136.224/27',
+            '27.90.137.0/27',
+            '27.90.137.32/27',
+            '27.90.137.64/27',
+            '27.90.137.96/27',
+            '27.90.137.128/27',
+            '27.90.137.160/27',
             '111.86.143.192/27',
             '111.86.143.224/27',
             '111.86.147.0/27',
@@ -517,7 +531,7 @@
             '111.86.147.160/27',
             '111.86.147.192/27',
             '111.86.147.224/27'
-           
+
            // PCSV\x82͊܂߂\xB8
         );
         return HostCheck::isAddrInBand($addr, $bands, $regHost);
@@ -635,9 +649,9 @@
     }
     
     /**
-     * IP\x82\xCD WILLCOM?
+     * IP\x82\xCD WILLCOM? (Y!mobile)
      *
-     * @link http://www.willcom-inc.com/ja/service/contents_service/club_air_edge/for_phone/ip/index.html
+     * @link http://www.ymobile.jp/service/contents_service/create/center_info/index.html
      * @return  boolean
      * @access  public
      * @static
@@ -650,7 +664,7 @@
         
         $regHost = '/^[Pp]\d{12}\.ppp\.prin\.ne\.jp$/';
         
-        // @updated 2013/12/01
+        // @updated 2015/01/17
         $bands = array(
             '114.20.49.0/24',
             '114.20.50.0/24',
@@ -671,6 +685,7 @@
             '114.20.65.0/24',
             '114.20.66.0/24',
             '114.20.67.0/24',
+            '114.20.71.0/24',
             '114.20.128.0/17',
             '114.21.128.0/24',
             '114.21.129.0/24',
@@ -694,6 +709,7 @@
             '114.21.147.0/24',
             '114.21.148.0/24',
             '114.21.149.0/24',
+            '114.21.151.0/24',
             '221.109.128.0/18'
         );
         return HostCheck::isAddrInBand($addr, $bands, $regHost);

Modified: p2/trunk/lib/NgAbornCtl.php
===================================================================
--- p2/trunk/lib/NgAbornCtl.php	2014-05-15 00:32:14 UTC (rev 979)
+++ p2/trunk/lib/NgAbornCtl.php	2015-01-17 03:57:30 UTC (rev 980)
@@ -178,8 +178,17 @@
                 }
                 
                 // \x94ƒ`\x83F\x83b\x83N
-                if (strlen($bbs) and isset($v['bbs']) && in_array($bbs, $v['bbs']) == false) {
-                    continue;
+                if (strlen($bbs) and isset($v['bbs'])) {
+                    $bbsmatch = false;
+                    foreach ($v['bbs'] as $b) {
+                        if (strtolower($b) == strtolower($bbs)) {
+                            $bbsmatch = true;
+                            continue;
+                        }
+                    }
+                    if (!$bbsmatch) {
+                        continue;
+                    }
                 }
 
                 // \x83^\x83C\x83g\x83\x8B\x83`\x83F\x83b\x83N

Modified: p2/trunk/lib/P2Util.php
===================================================================
--- p2/trunk/lib/P2Util.php	2014-05-15 00:32:14 UTC (rev 979)
+++ p2/trunk/lib/P2Util.php	2015-01-17 03:57:30 UTC (rev 980)
@@ -1618,6 +1618,17 @@
     }
     
     /**
+     * host \x82\xAA 2ch.sc \x82Ȃ\xE7 true \x82\xF0\x95Ԃ\xB7
+     *
+     * @access  public
+     * @return  boolean
+     */
+    function isHost2chSc($host)
+    {
+        return (bool)preg_match('/\\.(2ch\\.sc)$/', $host);
+    }
+    
+    /**
      * host \x82\xAA find.2ch.net\x81i\x82\xB1\x82\xC1\x82\xBB\x82\xE8\x83A\x83\x93\x83P\x81[\x83g\x81j \x82Ȃ\xE7 true \x82\xF0\x95Ԃ\xB7
      *
      * @access  public
@@ -2306,13 +2317,21 @@
      */
     function updateArraySrdFile($data, $file)
     {
-        // \x8A\xF9\x91\xB6\x82̃f\x81[\x83^\x82\xF0\x83}\x81[\x83W\x8E擾
+        // \x8A\xF9\x91\xB6\x82̃f\x81[\x83^\x81i\x94z\x97\xF1\x81j\x82\xF0\x8E擾\x82\xB5\x82ă}\x81[\x83W
         if (file_exists($file)) {
-            if ($cont = file_get_contents($file)) {
-                $array = unserialize($cont);
-                if (is_array($array)) {
-                    $data = array_merge($array, $data);
+            if (false === $cont = FileCtl::fileGetContents($file)) {
+                return false;
+            }
+            if (strlen($cont)) {
+                if (false === $array = unserialize($cont)) {
+                    trigger_error('false === unserialize(), file: ' . hs($file) , E_USER_WARNING);
+                    return false;
                 }
+                if (!is_array($array)) {
+                    trigger_error('not array, file: ' . hs($file) , E_USER_WARNING);
+                    return false;
+                }
+                $data = array_merge($array, $data);
             }
         }
         

Modified: p2/trunk/lib/SettingTxt.php
===================================================================
--- p2/trunk/lib/SettingTxt.php	2014-05-15 00:32:14 UTC (rev 979)
+++ p2/trunk/lib/SettingTxt.php	2015-01-17 03:57:30 UTC (rev 980)
@@ -298,7 +298,8 @@
     {
         global $_conf;
         
-        if (!P2Util::isHost2chs($host)) {
+        // SETTING.TXT\x91Ή\x9E\x83T\x83C\x83g\x88ȊO\x82\xCDnull\x82\xF0\x95Ԃ\xB7
+        if (!P2Util::isHost2chs($host) && !P2Util::isHost2chSc($host)) {
             return null;
         }
         
@@ -315,7 +316,24 @@
         $hr->sendRequest();
         return $hr->getResponseCode();
     }
-
+    
+    /**
+     * 2ch\x82\xCCSETTING.TXT\x82̗L\x96\xB3\x82Ńz\x83X\x83g\x82̈ړ]\x82\xF0\x8Am\x94F\x82\xB7\x82\xE9
+     *
+     * @return  boolean
+     */
+    function check2chHostMovedBySettingTxt($new_host, $old_host, $bbs)
+    {
+        if (!in_array(
+                SettingTxt::get2chSettingTxtResponseCode($old_host, $bbs),
+                array(200, null), true
+            )
+            and 200 === SettingTxt::get2chSettingTxtResponseCode($new_host, $bbs)
+        ) {
+            return true;
+        }
+        return false;
+    }
 }
 
 // }}}

Modified: p2/trunk/lib/SubjectTxt.php
===================================================================
--- p2/trunk/lib/SubjectTxt.php	2014-05-15 00:32:14 UTC (rev 979)
+++ p2/trunk/lib/SubjectTxt.php	2015-01-17 03:57:30 UTC (rev 980)
@@ -22,8 +22,23 @@
     /**
      * @constructor
      */
-    function SubjectTxt($host, $bbs)
+    function SubjectTxt(&$host, $bbs)
     {
+        $this->initProperties($host, $bbs);
+        
+        // subject.txt\x82\xF0\x83_\x83E\x83\x93\x83\x8D\x81[\x83h\x81\x95\x83Z\x83b\x83g\x82\xB7\x82\xE9
+        $this->dlAndSetSubject();
+        
+        // downloadSubject()\x93\xE0\x82̃z\x83X\x83g\x88ړ]\x8C\x9F\x92m\x8E\x9E\x82ɏ\x91\x82\xAB\x8A\xB7\x82\xA6\x82\xE7\x82ꂽ\x90V\x82\xB5\x82\xA2host\x8F\xEE\x95\xF1\x82𔽉f\x82\xB7\x82\xE9
+        $host = $this->host;
+    }
+    
+    /**
+     * @access  private
+     * @return  void
+     */
+    function initProperties($host, $bbs)
+    {
         $this->host = $host;
         $this->bbs =  $bbs;
         
@@ -38,9 +53,6 @@
         
         $this->subject_file = $this->getSubjectFile($this->host, $this->bbs);
         $this->subject_url = $this->getSubjectUrl($this->host, $this->bbs);
-        
-        // subject.txt\x82\xF0\x83_\x83E\x83\x93\x83\x8D\x81[\x83h\x81\x95\x83Z\x83b\x83g\x82\xB7\x82\xE9
-        $this->dlAndSetSubject();
     }
     
     /**
@@ -171,33 +183,38 @@
         } else {
             $code = $req->getResponseCode();
             // 302 Found (Redirection \x93]\x91\x97)
-            if ($code == 302) {
+            // 2010/08/05 \x81u\x82\xE0\x82\xA4\x82\xB8\x82\xC1\x82Ɛl\x91吙 \x81v\x82ł\xE0302\x82\xF0\x95Ԃ\xB7\x82\xB1\x82Ƃɒ\x8D\x88ӁiLocation: http://www2.2ch.net/live.html\x81j
+            // 301 Moved Permanently
+            if (P2Util::isHost2chs($this->host) and in_array($code, array(302, 301))) { // sc\x94\xF1\x91Ή\x9E\x82̂\xBD\x82\xDF2ch\x82ɍi\x82\xE9
                 // \x83z\x83X\x83g\x82̈ړ]\x82\xF0\x92ǐ\xD5
                 require_once P2_LIB_DIR . '/BbsMap.php';
-                $new_host = BbsMap::getCurrentHost($this->host, $this->bbs);
                 require_once P2_LIB_DIR . '/SettingTxt.php';
+                $new_host = null;
+                if ($location = $req->getResponseHeader('Location')) {
+                    if (preg_match('{https?://(.+?)/[^/]+/subject\\.txt$}', $location, $m)) {
+                        $new_host = $m[1];
+                    }
+                }
+                if (!$new_host) {
+                    $new_host = BbsMap::getCurrentHost($this->host, $this->bbs);
+                }
                 if (
                     $new_host != $this->host
                     // SETTING.TXT\x82̗L\x96\xB3\x82Ŕˆړ]\x82\xF0\x8Am\x94F
-                    // 2010/08/05 \x81u\x82\xE0\x82\xA4\x82\xB8\x82\xC1\x82Ɛl\x91吙 \x81v\x82ł\xE0302\x82\xF0\x95Ԃ\xB7
-                    and !in_array(
-                        SettingTxt::get2chSettingTxtResponseCode($this->host, $this->bbs),
-                        array(200, null), true
-                    )
-                    and 200 === SettingTxt::get2chSettingTxtResponseCode($new_host, $this->bbs)
+                    and SettingTxt::check2chHostMovedBySettingTxt($new_host, $this->host, $this->bbs)
                 ) {
-                    BbsMap::getCurrentHost($this->host, $this->bbs, true); // autosync
-                    $aNewSubjectTxt = new SubjectTxt($new_host, $this->bbs);
-                    return $aNewSubjectTxt->downloadSubject();
+                    BbsMap::syncHost($new_host, $this->bbs, $this->host);
+                    $this->initProperties($new_host, $this->bbs);
+                    return $this->downloadSubject();
                 }
             }
-            if (!($code == 200 || $code == 206 || $code == 304)) {
+            if (!in_array($code, array(200, 206, 304))) {
                 //var_dump($req->getResponseHeader());
                 $error_msg = $code;
             }
         }
     
-        if (!is_null($error_msg) && strlen($error_msg) > 0) {
+        if (!is_null($error_msg) && strlen($error_msg)) {
             $attrs = array();
             if ($_conf['ext_win_target']) {
                 $attrs['target'] = $_conf['ext_win_target'];

Modified: p2/trunk/lib/ThreadRead.php
===================================================================
--- p2/trunk/lib/ThreadRead.php	2014-05-15 00:32:14 UTC (rev 979)
+++ p2/trunk/lib/ThreadRead.php	2015-01-17 03:57:30 UTC (rev 980)
@@ -313,14 +313,10 @@
             if (
                 $new_host != $this->host
                 // SETTING.TXT\x82̗L\x96\xB3\x82Ŕˆړ]\x82\xF0\x8Am\x94F
-                and !in_array(
-                    SettingTxt::get2chSettingTxtResponseCode($this->host, $this->bbs),
-                    array(200, null), true
-                )
-                and 200 === SettingTxt::get2chSettingTxtResponseCode($new_host, $this->bbs)
+                and SettingTxt::check2chHostMovedBySettingTxt($new_host, $this->host, $this->bbs)
             ) {
                 fclose($fp);
-                BbsMap::getCurrentHost($this->host, $this->bbs, true); // autosync
+                BbsMap::syncHost($new_host, $this->bbs, $this->host);
                 $this->old_host = $this->host;
                 $this->host = $new_host;
                 return $this->downloadDat2ch($from_bytes);

Modified: p2/trunk/lib/UA.php
===================================================================
--- p2/trunk/lib/UA.php	2014-05-15 00:32:14 UTC (rev 979)
+++ p2/trunk/lib/UA.php	2015-01-17 03:57:30 UTC (rev 980)
@@ -176,12 +176,12 @@
 
         // iPod touch
         // Mozilla/5.0 (iPod; U; CPU like Mac OS X; ja-jp) AppleWebKit/420.1 (KHTML, like Gecko) Version/3.0 Mobile/3A110a Safari/419.3
-        if (preg_match('/(iPhone|iPod);/', $ua)) {// || UA::isAndroidWebKit($ua)) { // android\x82\xF0\x8A܂߂Ă\xA2\x82Ȃ\xA2\x82̂͂Ȃ\xF1\x82ł\xBE\x82\xC1\x82\xAF\x81H
+        if (preg_match('/(iPhone|iPod)(?:;| )/', $ua)) {// || UA::isAndroidWebKit($ua)) { // android\x82\xF0\x8A܂߂Ă\xA2\x82Ȃ\xA2\x82̂͂Ȃ\xF1\x82ł\xBE\x82\xC1\x82\xAF\x81H
             $isiPhoneGroup = true;
         
         // iPad 2010/5/29
         // Mozilla/5.0 (iPad; U; CPU OS 3_2 like Mac OS X; ja-jp) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B367 Safari/531.21.10
-        } elseif (preg_match('/iPad;/', $ua)) {
+        } elseif (preg_match('/iPad(?:;| )/', $ua)) {
             $isiPhoneGroup = true;
         }
         

Modified: p2/trunk/read.php
===================================================================
--- p2/trunk/read.php	2014-05-15 00:32:14 UTC (rev 979)
+++ p2/trunk/read.php	2015-01-17 03:57:30 UTC (rev 980)
@@ -644,7 +644,7 @@
             if (!$lar[1] || !strlen($lar[11])) { // \x95s\x90\xB3\x83f\x81[\x83^\x82\xF0\x8D폜
                 continue;
             }
-            if ($lar[1] == $key && $lar[11] == $bbs) { // key, bbs\x82ŏd\x95\xA1\x89\xF1\x94\xF0
+            if ($lar[1] == $key && $lar[11] == $bbs && $lar[10] == $host) { // key, bbs, host\x82ŏd\x95\xA1\x89\xF1\x94\xF0
                 continue;
             }
             $newlines[] = $line;



P2-php-svn メーリングリストの案内
Zurück zum Archiv-Index