[P2-php-svn] [811] expack:

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2010年 1月 26日 (火) 21:05:30 JST


Revision: 811
          http://sourceforge.jp/projects/p2-php/svn/view?view=rev&revision=811
Author:   rsk
Date:     2010-01-26 21:05:30 +0900 (Tue, 26 Jan 2010)

Log Message:
-----------
expack:
- まちBBSのdat読み込みでofflaw.cgiにアクセスするように変更。
-- read.cgiのHTML解析では日付・ID欄にIPアドレスが含まれていたが、
   offlaw.cgiのdatには存在しない。
- StrSjisクラスにShift_JIS用正規表現パターンをUnicode用に変換するメソッド
  toUnicodePattern() を追加。
- RSSでImageCache2が使えない不具合を修正。
- 変数名のミス等を修正。
- E_NOTICE削減中。

Modified Paths:
--------------
    p2ex/trunk/info.php
    p2ex/trunk/iv2.php
    p2ex/trunk/lib/FileCtl.php
    p2ex/trunk/lib/ShowThread.php
    p2ex/trunk/lib/StrSjis.php
    p2ex/trunk/lib/ThreadRead.php
    p2ex/trunk/lib/expack/rss/getimage.inc.php
    p2ex/trunk/lib/read_footer.inc.php
    p2ex/trunk/lib/read_shitaraba.inc.php
    p2ex/trunk/lib/startup.funcs.php
    p2ex/trunk/style/fitimage_css.inc
    p2ex/trunk/style/info_css.inc
    p2ex/trunk/style/iv2_css.inc
    p2ex/trunk/style/menu_css.inc
    p2ex/trunk/style/post_css.inc
    p2ex/trunk/style/read_css.inc
    p2ex/trunk/style/style_css.inc
    p2ex/trunk/style/subject_css.inc

Removed Paths:
-------------
    p2ex/trunk/lib/read_machibbs.inc.php


-------------- next part --------------
Modified: p2ex/trunk/info.php
===================================================================
--- p2ex/trunk/info.php	2010-01-25 23:56:27 UTC (rev 810)
+++ p2ex/trunk/info.php	2010-01-26 12:05:30 UTC (rev 811)
@@ -290,7 +290,7 @@
 }
 
 
-if (!is_null($title_msg)) {
+if (isset($title_msg)) {
     $hc['title'] = $title_msg;
 } else {
     $hc['title'] = "info - {$hc['ttitle_name']}";

Modified: p2ex/trunk/iv2.php
===================================================================
--- p2ex/trunk/iv2.php	2010-01-25 23:56:27 UTC (rev 810)
+++ p2ex/trunk/iv2.php	2010-01-26 12:05:30 UTC (rev 811)
@@ -384,7 +384,7 @@
 $removed_files = array();
 
 // 臒l‚ŃtƒBƒ‹ƒ^ƒŠƒ“ƒO
-if (!($threshold == -1 && $compate == '>=')) {
+if (!($threshold == -1 && $compare == '>=')) {
     $icdb->whereAddQuoted('rank', $compare, $threshold);
 }
 

Modified: p2ex/trunk/lib/FileCtl.php
===================================================================
--- p2ex/trunk/lib/FileCtl.php	2010-01-25 23:56:27 UTC (rev 810)
+++ p2ex/trunk/lib/FileCtl.php	2010-01-26 12:05:30 UTC (rev 811)
@@ -53,7 +53,7 @@
 
         if (!file_exists($file)) {
             // eƒfƒBƒŒƒNƒgƒŠ‚ª–³‚¯‚ê‚΍ì‚é
-            self::mkdir_for($file) or p2die("cannot make parent dirs. ({$file})");
+            self::mkdirFor($file) or p2die("cannot make parent dirs. ({$file})");
             touch($file) or p2die("cannot touch. ({$file})");
             chmod($file, $perm);
         } else {
@@ -70,7 +70,7 @@
     }
 
     // }}}
-    // {{{ mkdir_for()
+    // {{{ mkdirFor()
 
     /**
      * eƒfƒBƒŒƒNƒgƒŠ‚ª‚È‚¯‚ê‚ΐ¶¬‚µ‚ăp[ƒ~ƒbƒVƒ‡ƒ“‚𒲐®‚·‚é
@@ -79,7 +79,7 @@
      * @param int $perm
      * @return bool
      */
-    static public function mkdir_for($apath, $perm = null)
+    static public function mkdirFor($apath, $perm = null)
     {
         global $_conf;
 
@@ -103,7 +103,7 @@
             if ($i > $dir_limit) {
                 p2die("cannot mkdir. ({$parentdir})", 'ŠK‘w‚ðã‚ª‚è‰ß‚¬‚½‚̂ŁAƒXƒgƒbƒv‚µ‚Ü‚µ‚½B');
             }
-            self::mkdir_for($parentdir);
+            self::mkdirFor($parentdir);
             mkdir($parentdir, $perm) or p2die("cannot mkdir. ({$parentdir})");
             chmod($parentdir, $perm);
             $i++;
@@ -112,7 +112,7 @@
     }
 
     // }}}
-    // {{{ mkdir_r()
+    // {{{ mkdirRecursive()
 
     /**
      * ƒfƒBƒŒƒNƒgƒŠ‚ª‚È‚¯‚ê‚ΐ¶¬‚µ‚ăp[ƒ~ƒbƒVƒ‡ƒ“‚𒲐®‚·‚é
@@ -121,9 +121,39 @@
      * @param int $perm
      * @return bool
      */
+    static public function mkdirRecursive($apath, $perm = null)
+    {
+        return self::mkdirFor($apath . DIRECTORY_SEPARATOR . '_', $perm);
+    }
+
+    // }}}
+    // {{{ mkdir_for()
+
+    /**
+     * mkdirFor() ‚̃GƒCƒŠƒAƒX
+     *
+     * @param string $apath
+     * @param int $perm
+     * @return bool
+     */
+    static public function mkdir_for($apath, $perm = null)
+    {
+        return self::mkdirFor($apath, $perm);
+    }
+
+    // }}}
+    // {{{ mkdir_r()
+
+    /**
+     * mkdirRecursive() ‚̃GƒCƒŠƒAƒX
+     *
+     * @param string $apath
+     * @param int $perm
+     * @return bool
+     */
     static public function mkdir_r($apath, $perm = null)
     {
-        return self::mkdir_for($apath . DIRECTORY_SEPARATOR . '_', $perm);
+        return self::mkdirRecursive($apath, $perm);
     }
 
     // }}}

Modified: p2ex/trunk/lib/ShowThread.php
===================================================================
--- p2ex/trunk/lib/ShowThread.php	2010-01-25 23:56:27 UTC (rev 810)
+++ p2ex/trunk/lib/ShowThread.php	2010-01-26 12:05:30 UTC (rev 811)
@@ -268,6 +268,8 @@
         $to = $this->thread->resrange['to'];
         $nofirst = $this->thread->resrange['nofirst'];
 
+        $count = count($this->thread->datlines);
+
         $buf = $is_fragment ? '' : "<div class=\"thread\">\n";
 
         // ‚Ü‚¸ 1 ‚ð•\Ž¦
@@ -277,7 +279,8 @@
 
         // ˜A½‚Ì‚½‚߁A”͈͊O‚ÌNG‚ ‚ځ[‚ñƒ`ƒFƒbƒN
         if ($_conf['ngaborn_chain_all'] && empty($_GET['nong'])) {
-            for ($i = ($nofirst) ? 0 : 1; $i < $start; $i++) {
+            $pre = min($count, $start);
+            for ($i = ($nofirst) ? 0 : 1; $i < $pre; $i++) {
                 list($name, $mail, $date_id, $msg) = $this->thread->explodeDatLine($this->thread->datlines[$i]);
                 if (($id = $this->thread->ids[$i]) !== null) {
                     $date_id = str_replace($this->thread->idp[$i] . $id, $idstr, $date_id);
@@ -287,14 +290,11 @@
         }
 
         // Žw’è”͈͂ð•\Ž¦
-        for ($i = $start - 1; $i < $to; $i++) {
+        $end = min($count, $to);
+        for ($i = $start - 1; $i < $end; $i++) {
             if (!$nofirst and $i == 0) {
                 continue;
             }
-            if (!$this->thread->datlines[$i]) {
-                $this->thread->readnum = $i;
-                break;
-            }
             $buf .= $this->transRes($this->thread->datlines[$i], $i + 1);
             if (!$capture && $i % 10 == 0) {
                 echo $buf;
@@ -302,6 +302,9 @@
                 $buf = '';
             }
         }
+        if ($this->thread->readnum < $end) {
+            $this->thread->readnum = $end;
+        }
 
         if (!$is_fragment) {
             $buf .= "</div>\n";
@@ -1032,14 +1035,18 @@
      * ƒAƒ“ƒJ[‚̐³‹K•\Œ»‚ð•Ô‚·
      *
      * @param   string  $pattern  ex)'/%full%/'
+     * @param   boolean $unicode
      * @return  string
      */
-    static public function getAnchorRegex($pattern)
+    static public function getAnchorRegex($pattern, $unicode = false)
     {
         if (!array_key_exists($pattern, self::$_anchorRegexes)) {
             self::$_anchorRegexes[$pattern] = strtr($pattern, self::_getAnchorRegexParts());
             // ‘卷‚Í‚È‚¢‚ª compileMobile2chUriCallBack() ‚̂悤‚É preg_relplace_callback()‚µ‚Ä‚à‚¢‚¢‚©‚àB
         }
+        if ($unicode) {
+            return StrSjis::toUnicodePattern($_anchorRegexes[$pattern]);
+        }
         return self::$_anchorRegexes[$pattern];
     }
 

Modified: p2ex/trunk/lib/StrSjis.php
===================================================================
--- p2ex/trunk/lib/StrSjis.php	2010-01-25 23:56:27 UTC (rev 810)
+++ p2ex/trunk/lib/StrSjis.php	2010-01-26 12:05:30 UTC (rev 811)
@@ -122,6 +122,64 @@
     }
 
     // }}}
+    // {{{ getUnicodePattern()
+
+    /**
+     * Shift_JIS‚Ì•¶Žš‚ðŠÜ‚ސ³‹K•\Œ»ƒpƒ^[ƒ“‚ð
+     * PCRE‚ÌUnicodeƒ‚[ƒh—p³‹K•\Œ»ƒpƒ^[ƒ“‚É•ÏŠ·‚·‚é
+     *
+     * @param   string  $pattern
+     * @return  string
+     */
+    static public function toUnicodePattern($pattern)
+    {
+        $sjis_char_class_1st = '[\\x81-\\x9F\\xE0-\\xFC]';
+        $sjis_char_class_2nd = '[\\x40-\\x7E\\x80-\\xFC]';
+        $sjis_char_regex_1st = '\\\\x(8[1-9A-F]|[9E][0-9A-F]|F[0-9A-C])';
+        $sjis_char_regex_2nd = '\\\\x([45689A-E][0-9A-F]|7[0-9A-E]|F[0-9A-C])';
+
+        $pattern = preg_replace_callback("/{$sjis_char_class_1st}{$sjis_char_class_2nd}/",
+                                         array(__CLASS__, '_sjisStringToUnicodePatternCb'),
+                                         $pattern);
+        $pattern = preg_replace_callback("/{$sjis_char_regex_1st}{$sjis_char_regex_2nd}/i",
+                                         array(__CLASS__, '_sjisPatternToUnicodePatternCb'),
+                                         $pattern);
+        return $pattern;
+    }
+
+    // }}}
+    // {{{ _sjisStringToUnicodePattern()
+
+    /**
+     * Shift_JIS‚Ì2ƒoƒCƒg•¶Žš‚ð
+     * Unicode•¶Žš‚Ƀ}ƒbƒ`‚·‚鐳‹K•\Œ»ƒpƒ^[ƒ“‚É•ÏŠ·‚·‚é
+     *
+     * @param   array   $m
+     * @return  string
+     */
+    static protected function _sjisStringToUnicodePatternCb($m)
+    {
+        $u = unpack('C2', mb_convert_encoding($m[0], 'UCS-2BE', 'SJIS-win'));
+        return sprintf('\\x{%02X%02X}', $u[1], $u[2]);
+    }
+
+    // }}}
+    // {{{ _sjisCodeToUnicodePattern()
+
+    /**
+     * Shift_JIS‚Ì2ƒoƒCƒg•¶Žš‚Ƀ}ƒbƒ`‚·‚鐳‹K•\Œ»ƒpƒ^[ƒ“‚ð
+     * Unicode•¶Žš‚Ƀ}ƒbƒ`‚·‚鐳‹K•\Œ»ƒpƒ^[ƒ“‚É•ÏŠ·‚·‚é
+     *
+     * @param   array   $m
+     * @return  string
+     */
+    static protected function _sjisPatternToUnicodePatternCb($m)
+    {
+        $s = pack('C2', hexdec($m[1]), hexdec($m[2]));
+        return self::_sjisStringToUnicodePatternCb(array($s));
+    }
+
+    // }}}
 }
 
 // }}}

Modified: p2ex/trunk/lib/ThreadRead.php
===================================================================
--- p2ex/trunk/lib/ThreadRead.php	2010-01-25 23:56:27 UTC (rev 810)
+++ p2ex/trunk/lib/ThreadRead.php	2010-01-26 12:05:30 UTC (rev 811)
@@ -52,12 +52,13 @@
 
         // ‚Ü‚¿BBS
         if (P2Util::isHostMachiBbs($this->host)) {
-            require_once P2_LIB_DIR . '/read_machibbs.inc.php';
-            machiDownload();
+            DownloadDatMachiBbs::invoke($this);
         // JBBS@‚µ‚½‚ç‚Î
         } elseif (P2Util::isHostJbbsShitaraba($this->host)) {
-            require_once P2_LIB_DIR . '/read_shitaraba.inc.php';
-            shitarabaDownload();
+            if (!function_exists('shitarabaDownload')) {
+                include P2_LIB_DIR . '/read_shitaraba.inc.php';
+            }
+            shitarabaDownload($this);
 
         // 2chŒn
         } else {
@@ -70,7 +71,9 @@
                     !empty($_REQUEST['relogin2ch']) ||
                     (filemtime($_conf['sid2ch_php']) < time() - 60*60*24))
                 {
-                    require_once P2_LIB_DIR . '/login2ch.inc.php';
+                    if (!function_exists('login2ch')) {
+                        include P2_LIB_DIR . '/login2ch.inc.php';
+                    }
                     if (!login2ch()) {
                         $this->getdat_error_msg_ht .= $this->get2chDatError();
                         $this->diedat = true;
@@ -191,7 +194,7 @@
         // WEBƒT[ƒo‚֐ڑ±
         $fp = @fsockopen($send_host, $send_port, $errno, $errstr, $_conf['http_conn_timeout']);
         if (!$fp) {
-            $this->_pushInfoConnectionTimedOut($url, $errno, $errstr);
+            self::_pushInfoConnectFailed($url, $errno, $errstr);
             $this->diedat = true;
             return false;
         }
@@ -211,7 +214,7 @@
                     }
 
                     if ($timed_out) {
-                        $this->_pushInfoReadTimedOut($url);
+                        self::_pushInfoReadTimedOut($url);
                         $this->diedat = true;
                         fclose($fp);
                         return false;
@@ -329,7 +332,7 @@
 
         fclose($fp);
         if ($timed_out) {
-            $this->_pushInfoReadTimedOut($url);
+            self::_pushInfoReadTimedOut($url);
             $this->diedat = true;
             return false;
         } else {
@@ -419,7 +422,7 @@
         // WEBƒT[ƒo‚֐ڑ±
         $fp = @fsockopen($send_host, $send_port, $errno, $errstr, $_conf['http_conn_timeout']);
         if (!$fp) {
-            $this->_pushInfoConnectionTimedOut($url, $errno, $errstr);
+            self::_pushInfoConnectFailed($url, $errno, $errstr);
             $this->diedat = true;
             return false;
         }
@@ -439,7 +442,7 @@
                     }
 
                     if ($timed_out) {
-                        $this->_pushInfoReadTimedOut($url);
+                        self::_pushInfoReadTimedOut($url);
                         //$this->diedat = true;
                         fclose($fp);
                         return false;
@@ -447,7 +450,7 @@
 
                     // gzipˆ³k‚È‚ç
                     if ($isGzip) {
-                        $body = $this->_decodeGzip($body, $url);
+                        $body = self::_decodeGzip($body, $url);
                         if ($body === null) {
                             //$this->diedat = true;
                             fclose($fp);
@@ -605,7 +608,7 @@
         // WEBƒT[ƒo‚֐ڑ±
         $fp = @fsockopen($send_host, $send_port, $errno, $errstr, $_conf['http_conn_timeout']);
         if (!$fp) {
-            $this->_pushInfoConnectionTimedOut($url, $errno, $errstr);
+            self::_pushInfoConnectFailed($url, $errno, $errstr);
             return false;
         }
         stream_set_timeout($fp, $_conf['http_read_timeout'], 0);
@@ -624,14 +627,14 @@
                     }
 
                     if ($timed_out) {
-                        $this->_pushInfoReadTimedOut($url);
+                        self::_pushInfoReadTimedOut($url);
                         $this->diedat = true;
                         fclose($fp);
                         return false;
                     }
 
                     if ($isGzip) {
-                        $body = $this->_decodeGzip($body, $url);
+                        $body = self::_decodeGzip($body, $url);
                         if ($body === null) {
                             $this->diedat = true;
                             fclose($fp);
@@ -901,7 +904,7 @@
             // WEBƒT[ƒo‚֐ڑ±
             $fp = @fsockopen($send_host, $send_port, $errno, $errstr, $_conf['http_conn_timeout']);
             if (!$fp) {
-                $this->_pushInfoConnectionTimedOut($url, $errno, $errstr);
+                self::_pushInfoConnectFailed($url, $errno, $errstr);
                 $this->diedat = true;
                 return false;
             }
@@ -1459,7 +1462,7 @@
      * @param   string  $caller
      * @return  string
      */
-    protected function _decodeGzip($body, $url)
+    static protected function _decodeGzip($body, $url)
     {
         global $_conf;
 
@@ -1491,46 +1494,47 @@
         }
 
         if (is_null($body)) {
-            $msg = '<p class="info-msg">gzip“WŠJƒGƒ‰[<br>';
-            $msg .= sprintf('rep2 error: <a href="%s"%s>%s</a> ‚ðgzipƒfƒR[ƒh‚Å‚«‚Ü‚¹‚ñ‚Å‚µ‚½B',
-                            P2Util::throughIme($url),
-                            $_conf['ext_win_target_at'],
-                            htmlspecialchars($url, ENT_QUOTES, 'Shift_JIS', false));
-            $msg .= '</p>';
-
-            P2Util::pushInfoHtml($msg);
+            $summary = 'gzip“WŠJƒGƒ‰[';
+            $description = self::_urlToAnchor($url) . ' ‚ðgzipƒfƒR[ƒh‚Å‚«‚Ü‚¹‚ñ‚Å‚µ‚½B';
+            self::_pushInfoMessage($summary, $description);
         }
 
         return $body;
     }
 
     // }}}
-    // {{{ _pushInfoConnectionTimedOut()
+    // {{{ _pushInfoMessage()
 
     /**
-     * Ú‘±‚ªƒ^ƒCƒ€ƒAƒEƒg‚µ‚½Ž|‚̃ƒbƒZ[ƒW‚ðƒvƒbƒVƒ…‚·‚é
+     * î•ñƒƒbƒZ[ƒW‚ðƒvƒbƒVƒ…‚·‚é
      *
+     * @param   string  $summary
+     * @param   string  $description
+     * @return  void
+     */
+    static protected function _pushInfoMessage($summary, $description)
+    {
+        $message = '<p class="info-msg">' . $summary . '<br>rep2 info: ' . $description . '</p>';
+        P2Util::pushInfoHtml($message);
+    }
+
+
+    // }}}
+    // {{{ _pushInfoConnectFailed()
+
+    /**
+     * Ú‘±‚ÉŽ¸”s‚µ‚½Ž|‚̃ƒbƒZ[ƒW‚ðƒvƒbƒVƒ…‚·‚é
+     *
      * @param   string  $url
      * @param   int     $errno
      * @param   string  $errstr
      * @return  void
      */
-    protected function _pushInfoConnectionTimedOut($url, $errno, $errstr)
+    static protected function _pushInfoConnectFailed($url, $errno, $errstr)
     {
-        global $_conf;
-
-        $msg = '<p class="info-msg">';
-        $msg .= sprintf('HTTPÚ‘±ƒGƒ‰[ (%d) %s',
-                        $errno,
-                        htmlspecialchars($errstr, ENT_QUOTES));
-        $msg .= '<br>';
-        $msg .= sprintf('rep2 info: <a href="%s"%s>%s</a> ‚ɐڑ±‚Å‚«‚Ü‚¹‚ñ‚Å‚µ‚½B',
-                        P2Util::throughIme($url),
-                        $_conf['ext_win_target_at'],
-                        htmlspecialchars($url, ENT_QUOTES, 'Shift_JIS', false));
-        $msg .= '</p>';
-
-        P2Util::pushInfoHtml($msg);
+        $summary = sprintf('HTTPÚ‘±ƒGƒ‰[ (%d) %s', $errno, $errstr);
+        $description = self::_urlToAnchor($url) . ' ‚ɐڑ±‚Å‚«‚Ü‚¹‚ñ‚Å‚µ‚½B';
+        self::_pushInfoMessage($summary, $description);
     }
 
 
@@ -1543,21 +1547,51 @@
      * @param   string  $url
      * @return  void
      */
-    protected function _pushInfoReadTimedOut($url)
+    static protected function _pushInfoReadTimedOut($url)
     {
-        global $_conf;
+        $summary = 'HTTPÚ‘±ƒ^ƒCƒ€ƒAƒEƒg';
+        $description = self::_urlToAnchor($url) . ' ‚ð“ǂݍž‚ÝŠ®—¹‚Å‚«‚Ü‚¹‚ñ‚Å‚µ‚½B';
+        self::_pushInfoMessage($summary, $description);
+    }
 
-        $msg = '<p class="info-msg">HTTPÚ‘±ƒ^ƒCƒ€ƒAƒEƒg<br>';
-        $msg .= sprintf('rep2 info: <a href="%s"%s>%s</a> ‚ð“ǂݍž‚ÝŠ®—¹‚Å‚«‚Ü‚¹‚ñ‚Å‚µ‚½B',
-                        P2Util::throughIme($url),
-                        $_conf['ext_win_target_at'],
-                        htmlspecialchars($url, ENT_QUOTES, 'Shift_JIS', false));
-        $msg .= '</p>';
+    // }}}
+    // {{{ _pushInfoHttpError()
 
-        P2Util::pushInfoHtml($msg);
+    /**
+     * HTTPƒGƒ‰[‚̃ƒbƒZ[ƒW‚ðƒvƒbƒVƒ…‚·‚é
+     *
+     * @param   string  $url
+     * @param   int     $errno
+     * @param   string  $errstr
+     * @return void
+     */
+    static protected function _pushInfoHttpError($url, $errno, $errstr)
+    {
+        $summary = sprintf('HTTP %d %s', $errno, $errstr);
+        $description = self::_urlToAnchor($url) . ' ‚ð“ǂݍž‚ß‚Ü‚¹‚ñ‚Å‚µ‚½B';
+        self::_pushInfoMessage($summary, $description);
     }
 
     // }}}
+    // {{{ _urlToAnchor()
+
+    /**
+     * _pushInfoŒnƒƒ\ƒbƒh—p‚ÉURL‚ðƒAƒ“ƒJ[‚É•ÏŠ·‚·‚é
+     *
+     * @param   string  $url
+     * @return  string
+     */
+    static protected function _urlToAnchor($url)
+    {
+        global $_conf;
+
+        return sprintf('<a href="%s"%s>%s</a>',
+                       P2Util::throughIme($url),
+                       $_conf['ext_win_target_at'],
+                       htmlspecialchars($url, ENT_QUOTES));
+    }
+
+    // }}}
 }
 
 // }}}

Modified: p2ex/trunk/lib/expack/rss/getimage.inc.php
===================================================================
--- p2ex/trunk/lib/expack/rss/getimage.inc.php	2010-01-25 23:56:27 UTC (rev 810)
+++ p2ex/trunk/lib/expack/rss/getimage.inc.php	2010-01-26 12:05:30 UTC (rev 811)
@@ -3,7 +3,7 @@
  * rep2expck - RSS‰æ‘œƒLƒƒƒbƒVƒ…
  */
 
-require_once P2EX_LIB_DIR . '/bootstrap.php';
+require_once P2EX_LIB_DIR . '/ic2/bootstrap.php';
 
 // {{{ rss_get_image()
 

Modified: p2ex/trunk/lib/read_footer.inc.php
===================================================================
--- p2ex/trunk/lib/read_footer.inc.php	2010-01-25 23:56:27 UTC (rev 810)
+++ p2ex/trunk/lib/read_footer.inc.php	2010-01-26 12:05:30 UTC (rev 811)
@@ -58,22 +58,29 @@
         }
 
         $res_form_ht_pb = $res_form_ht;
+    } else {
+        $htm['dores'] = '';
+        $res_form_ht_pb = '';
     }
 
     if ($res1['body']) {
         $q_ichi = $res1['body']." | ";
+    } else {
+        $q_ichi = '';
     }
 
     // ƒŒƒX‚Ì‚·‚΂₳
-    $htm['spd'] = '';
     if ($spd_st = $aThread->getTimePerRes() and $spd_st != '-') {
         $htm['spd'] = '<span class="spd" title="‚·‚΂₳ŽžŠÔ/ƒŒƒX">' . $spd_st . '</span>';
+    } else {
+        $htm['spd'] = '';
     }
 
     // datƒTƒCƒY
-    $htm['dsize'] = '';
     if (file_exists($aThread->keydat) && $dsize_ht = filesize($aThread->keydat)) {
         $htm['dsize'] = sprintf('<span class="spd" title="%s">%01.1fKB</span> |', 'datƒTƒCƒY', $dsize_ht / 1024);
+    } else {
+        $htm['dsize'] = '';
     }
 
     // ƒŒƒX”ÔŽw’èˆÚ“®

Deleted: p2ex/trunk/lib/read_machibbs.inc.php
===================================================================
--- p2ex/trunk/lib/read_machibbs.inc.php	2010-01-25 23:56:27 UTC (rev 810)
+++ p2ex/trunk/lib/read_machibbs.inc.php	2010-01-26 12:05:30 UTC (rev 811)
@@ -1,168 +0,0 @@
-<?php
-/**
- * rep2 - ‚Ü‚¿BBS—p‚̊֐”
- */
-
-// {{{ machiDownload()
-
-/**
- * ‚Ü‚¿BBS‚Ì read.cgi ‚ð“Ç‚ñ‚Å dat‚É•Û‘¶‚·‚é
- */
-function machiDownload()
-{
-    global $aThread;
-
-    $GLOBALS['machi_latest_num'] = '';
-
-    // {{{ Šù“¾dat‚̎擾ƒŒƒX”‚ª“K«‚©‚Ç‚¤‚©‚ð”O‚Ì‚½‚߃`ƒFƒbƒN
-    if (file_exists($aThread->keydat)) {
-        $dls = FileCtl::file_read_lines($aThread->keydat);
-        if (!$dls || sizeof($dls) != $aThread->gotnum) {
-            // echo 'bad size!<br>';
-            unlink($aThread->keydat);
-            $aThread->gotnum = 0;
-        }
-    } else {
-        $aThread->gotnum = 0;
-    }
-    // }}}
-
-    if ($aThread->gotnum == 0) {
-        $file_append = false;
-        $START = 1;
-    } else {
-        $file_append = true;
-        $START = $aThread->gotnum + 1;
-    }
-
-    // ‚Ü‚¿BBS
-    $machiurl = "http://{$aThread->host}/bbs/read.cgi?BBS={$aThread->bbs}&KEY={$aThread->key}&START={$START}";
-
-    $tempfile = $aThread->keydat.'.html.temp';
-
-    FileCtl::mkdir_for($tempfile);
-    $machiurl_res = P2Util::fileDownload($machiurl, $tempfile);
-
-    if ($machiurl_res->isError()) {
-        $aThread->diedat = true;
-        return false;
-    }
-
-    $mlines = FileCtl::file_read_lines($tempfile);
-
-    // ˆêŽžƒtƒ@ƒCƒ‹‚ðíœ‚·‚é
-    unlink($tempfile);
-
-    // i‚Ü‚¿BBSj<html>error</html>
-    if (trim($mlines[0]) == '<html>error</html>') {
-        $aThread->getdat_error_msg_ht .= 'error';
-        $aThread->diedat = true;
-        return false;
-    }
-
-    // {{{ DAT‚ð‘‚«ž‚Þ
-    if ($mdatlines = machiHtmltoDatLines($mlines)) {
-
-        $file_append = ($file_append) ? FILE_APPEND : 0;
-
-        $cont = '';
-        for ($i = $START; $i <= $GLOBALS['machi_latest_num']; $i++) {
-            if ($mdatlines[$i]) {
-                $cont .= $mdatlines[$i];
-            } else {
-                $cont .= "‚ ‚ځ[‚ñ<>‚ ‚ځ[‚ñ<>‚ ‚ځ[‚ñ<>‚ ‚ځ[‚ñ<>\n";
-            }
-        }
-        if (FileCtl::file_write_contents($aThread->keydat, $cont, $file_append) === false) {
-            p2die('cannot write file.');
-        }
-    }
-    // }}}
-
-    $aThread->isonline = true;
-
-    return true;
-}
-
-// }}}
-// {{{ machiHtmltoDatLines()
-
-/**
- * ‚Ü‚¿BBS‚Ìread.cgi‚œǂݍž‚ñ‚¾HTML‚ðdat‚É•ÏŠ·‚·‚é
- *
- * @see machiDownload()
- */
-function machiHtmltoDatLines($mlines)
-{
-    if (!$mlines) {
-        $retval = false;
-        return $retval;
-    }
-    $mdatlines = "";
-
-    foreach ($mlines as $ml) {
-        $ml = rtrim($ml);
-        if (!$tuduku) {
-            unset($order, $mail, $name, $date, $ip, $body);
-        }
-
-        if ($tuduku) {
-            if (preg_match('{^ \\]</font><br><dd>(.*) <br><br>$}i', $ml, $matches)) {
-                $body = $matches[1];
-            } else {
-                unset($tuduku);
-                continue;
-            }
-        } elseif (preg_match('{^<dt>(?:<a[^>]+?>)?(\\d+)(?:</a>)? –¼‘OF(<font color="#.+?">|<a href="mailto:(.*)">)<b> (.+) </b>(</font>|</a>) “Še“úF (.+)<br><dd>(.*) <br><br>$}i', $ml, $matches)) {
-            $order = $matches[1];
-            $mail = $matches[3];
-            $name = preg_replace('{<font color="?#.+?"?>(.+)</font>}i', '\\1', $matches[4]);
-            $date = $matches[6];
-            $body = $matches[7];
-        } elseif (preg_match('{<title>(.*)</title>}i', $ml, $matches)) {
-            $mtitle = $matches[1];
-            continue;
-        } elseif (preg_match('{^<dt>(?:<a[^>]+?>)?(\\d+)(?:</a>)? –¼‘OF(<font color="#.+?">|<a href="mailto:(.*)">)<b> (.+) </b>(</font>|</a>) “Še“úF (.+) <font size=1>\\[ ?(.*)$}i', $ml, $matches)) {
-            $order = $matches[1];
-            $mail = $matches[3];
-            $name = preg_replace('{<font color="?#.+?"?>(.+)</font>}i', '\\1', $matches[4]);
-            $date = $matches[6];
-            $ip = $matches[7];
-            $tuduku = true;
-            continue;
-        }
-
-        if ($ip) {
-            $date = "$date [$ip]";
-        }
-
-        // ƒŠƒ“ƒNŠO‚µ
-        $body = preg_replace('{<a href="(https?://[-_.!~*\'()0-9A-Za-z;/?:@&=+\$,%#]+)" target="_blank">(https?://[-_.!~*\'()0-9A-Za-z;/?:@&=+\$,%#]+)</a>}i', '$1', $body);
-
-        if ($order == 1) {
-            $datline = $name.'<>'.$mail.'<>'.$date.'<>'.$body.'<>'.$mtitle."\n";
-        } else {
-            $datline = $name.'<>'.$mail.'<>'.$date.'<>'.$body.'<>'."\n";
-        }
-        $mdatlines[$order] = $datline;
-        if ($order > $GLOBALS['machi_latest_num']) {
-            $GLOBALS['machi_latest_num'] = $order;
-        }
-        unset($tuduku);
-    }
-
-    return $mdatlines;
-}
-
-// }}}
-
-/*
- * 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/read_shitaraba.inc.php
===================================================================
--- p2ex/trunk/lib/read_shitaraba.inc.php	2010-01-25 23:56:27 UTC (rev 810)
+++ p2ex/trunk/lib/read_shitaraba.inc.php	2010-01-26 12:05:30 UTC (rev 811)
@@ -10,10 +10,8 @@
 /**
  * ‚µ‚½‚ç‚ÎJBBS‚Ì rawmode.cgi ‚ð“Ç‚ñ‚ŁAdat‚É•Û‘¶‚·‚éi2ch•—‚ɐ®Œ`j
  */
-function shitarabaDownload()
+function shitarabaDownload(ThreadRead $aThread)
 {
-    global $aThread;
-
     $GLOBALS['machi_latest_num'] = '';
 
     // {{{ Šù“¾dat‚̎擾ƒŒƒX”‚ª“K«‚©‚Ç‚¤‚©‚ð”O‚Ì‚½‚߃`ƒFƒbƒN

Modified: p2ex/trunk/lib/startup.funcs.php
===================================================================
--- p2ex/trunk/lib/startup.funcs.php	2010-01-25 23:56:27 UTC (rev 810)
+++ p2ex/trunk/lib/startup.funcs.php	2010-01-26 12:05:30 UTC (rev 811)
@@ -155,6 +155,7 @@
             BrdCtl |
             BrdMenu(?:Cate|Ita)? |
             DataPhp |
+            DownloadDat[0-9A-Z][0-9A-Za-z]* |
             FavSetManager |
             FileCtl |
             HostCheck |

Modified: p2ex/trunk/style/fitimage_css.inc
===================================================================
--- p2ex/trunk/style/fitimage_css.inc	2010-01-25 23:56:27 UTC (rev 810)
+++ p2ex/trunk/style/fitimage_css.inc	2010-01-26 12:05:30 UTC (rev 811)
@@ -5,9 +5,9 @@
  */
 
 if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false) {
-	$button_position = 'absolute';
+    $button_position = 'absolute';
 } else {
-	$button_position = 'fixed';
+    $button_position = 'fixed';
 }
 
 echo <<<EOSTYLE

Modified: p2ex/trunk/style/info_css.inc
===================================================================
--- p2ex/trunk/style/info_css.inc	2010-01-25 23:56:27 UTC (rev 810)
+++ p2ex/trunk/style/info_css.inc	2010-01-26 12:05:30 UTC (rev 811)
@@ -4,8 +4,10 @@
  * for info.php î•ñƒEƒBƒ“ƒhƒE
  */
 
-if($STYLE['a_underline_none'] == 2){
-	$thre_title_underline_css = "a.thre_title{text-decoration:none;}";
+if ($STYLE['a_underline_none'] == 2) {
+    $thre_title_underline_css = 'a.thre_title { text-decoration:none; }';
+} else {
+    $thre_title_underline_css = '';
 }
 
 echo <<<EOSTYLE

Modified: p2ex/trunk/style/iv2_css.inc
===================================================================
--- p2ex/trunk/style/iv2_css.inc	2010-01-25 23:56:27 UTC (rev 810)
+++ p2ex/trunk/style/iv2_css.inc	2010-01-26 12:05:30 UTC (rev 811)
@@ -4,16 +4,16 @@
  * for ImageCache2:iv2.php
  */
 
-if ($STYLE['fontfamily_bold']) {
-	$boldstyle = "font-family: \"{$STYLE['fontfamily_bold']}\";";
-	if (!empty($STYLE['fontstyle_bold'])) {
-		$boldstyle .= "font-style: {$STYLE['fontstyle_bold']};";
-	}
-	if (!empty($STYLE['fontweight_bold'])) {
-		$boldstyle .= "font-weight: {$STYLE['fontweight_bold']};";
-	}
+if (!empty($STYLE['fontfamily_bold'])) {
+    $boldstyle = "font-family: \"{$STYLE['fontfamily_bold']}\";";
+    if (!empty($STYLE['fontstyle_bold'])) {
+        $boldstyle .= "font-style: {$STYLE['fontstyle_bold']};";
+    }
+    if (!empty($STYLE['fontweight_bold'])) {
+        $boldstyle .= "font-weight: {$STYLE['fontweight_bold']};";
+    }
 } else {
-	$boldstyle = 'font-weight: bold;';
+    $boldstyle = 'font-weight: bold;';
 }
 
 echo <<<EOSTYLE

Modified: p2ex/trunk/style/menu_css.inc
===================================================================
--- p2ex/trunk/style/menu_css.inc	2010-01-25 23:56:27 UTC (rev 810)
+++ p2ex/trunk/style/menu_css.inc	2010-01-26 12:05:30 UTC (rev 811)
@@ -5,11 +5,11 @@
  */
 
 if ($STYLE['a_underline_none'] == 1) {
-	$cate_underline_css = '';
-	$fav_underline_css = '';
+    $cate_underline_css = '';
+    $fav_underline_css = '';
 } else {
-	$cate_underline_css = 'b.menu_cate{text-decoration:underline;}';
-	$fav_underline_css = 'span.fav{text-decoration:underline;}';
+    $cate_underline_css = 'b.menu_cate { text-decoration:underline; }';
+    $fav_underline_css = 'span.fav { text-decoration:underline; }';
 }
 
 echo <<<EOSTYLE

Modified: p2ex/trunk/style/post_css.inc
===================================================================
--- p2ex/trunk/style/post_css.inc	2010-01-25 23:56:27 UTC (rev 810)
+++ p2ex/trunk/style/post_css.inc	2010-01-26 12:05:30 UTC (rev 811)
@@ -4,10 +4,10 @@
  * for post.php î•ñƒEƒBƒ“ƒhƒE
  */
 
-if($STYLE['a_underline_none'] == 2){
-	$thre_title_underline_css = "a.thre_title{text-decoration:none;}";
+if ($STYLE['a_underline_none'] == 2) {
+    $thre_title_underline_css = 'a.thre_title { text-decoration:none; }';
 } else {
-    thre_title_underline_css = '';
+    $thre_title_underline_css = '';
 }
 
 echo <<<EOSTYLE

Modified: p2ex/trunk/style/read_css.inc
===================================================================
--- p2ex/trunk/style/read_css.inc	2010-01-25 23:56:27 UTC (rev 810)
+++ p2ex/trunk/style/read_css.inc	2010-01-26 12:05:30 UTC (rev 811)
@@ -4,7 +4,7 @@
  * for read.php
  */
 
-if (!isset($STYLE['respop_bgcolor']))	{ $STYLE['respop_bgcolor'] = '#ffffcc'; }
+if (!isset($STYLE['respop_bgcolor']))    { $STYLE['respop_bgcolor'] = '#ffffcc'; }
 if (!isset($STYLE['respop_background'])) { $STYLE['respop_background'] = ''; }
 $respop_background = "background:{$STYLE['respop_bgcolor']} {$STYLE['respop_background']};";
 
@@ -13,15 +13,16 @@
 if (!isset($STYLE['respop_b_color'])) { $STYLE['respop_b_color'] = 'black'; }
 $respop_border = "border:{$STYLE['respop_b_style']} {$STYLE['respop_b_width']} {$STYLE['respop_b_color']};";
 
-$respop_color = '';
 if (isset($STYLE['respop_color']) && strlen($STYLE['respop_color']) > 0) {
-	$respop_color = "color:{$STYLE['respop_color']};";
+    $respop_color = "color: {$STYLE['respop_color']};";
+} else {
+    $respop_color = '';
 }
 
 if ($STYLE['fontfamily_bold']) {
-	$fontstyle_bold = empty($STYLE['fontstyle_bold']) ? 'normal' : $STYLE['fontstyle_bold'];
-	$fontweight_bold = empty($STYLE['fontweight_bold']) ? 'normal' : $STYLE['fontweight_bold'];
-	echo <<<EOSTYLE
+    $fontstyle_bold = empty($STYLE['fontstyle_bold']) ? 'normal' : $STYLE['fontstyle_bold'];
+    $fontweight_bold = empty($STYLE['fontweight_bold']) ? 'normal' : $STYLE['fontweight_bold'];
+    echo <<<EOSTYLE
 
 h3, h4 {
 	font-family:"{$STYLE['fontfamily_bold']}";

Modified: p2ex/trunk/style/style_css.inc
===================================================================
--- p2ex/trunk/style/style_css.inc	2010-01-25 23:56:27 UTC (rev 810)
+++ p2ex/trunk/style/style_css.inc	2010-01-26 12:05:30 UTC (rev 811)
@@ -4,9 +4,10 @@
  * ‘S”Ê
  */
 
-$a_underline_none_css = '';
 if ($STYLE['a_underline_none'] == 1) {
-	$a_underline_none_css = "a{text-decoration:none;}";
+    $a_underline_none_css = "a{text-decoration:none;}";
+} else {
+    $a_underline_none_css = '';
 }
 
 // ƒuƒ‰ƒEƒU‚ª Camino ‚È‚ç

Modified: p2ex/trunk/style/subject_css.inc
===================================================================
--- p2ex/trunk/style/subject_css.inc	2010-01-25 23:56:27 UTC (rev 810)
+++ p2ex/trunk/style/subject_css.inc	2010-01-26 12:05:30 UTC (rev 811)
@@ -5,13 +5,13 @@
  */
 
 if ($STYLE['a_underline_none'] == 2) {
-	$thre_title_underline_css = <<<EOSTYLE
+    $thre_title_underline_css = <<<EOSTYLE
 a.thre_title, a.thre_title_new, a.thre_title_fav {
 	text-decoration: none;
 }
 EOSTYLE;
 } else {
-	$thre_title_underline_css = '';
+    $thre_title_underline_css = '';
 }
 
 echo <<<EOSTYLE



P2-php-svn メーリングリストの案内
Back to archive index