p2/ for version 1.8.104
@@ -56,7 +56,7 @@ | ||
56 | 56 | // }}} |
57 | 57 | // {{{ ページタイトル部分HTML設定 |
58 | 58 | |
59 | -$ptitle_hs = hs($aThreadList->ptitle); | |
59 | +$ptitle = $aThreadList->ptitle; | |
60 | 60 | |
61 | 61 | if ($aThreadList->spmode == 'taborn') { |
62 | 62 | $ptitle_ht = <<<EOP |
@@ -67,9 +67,9 @@ | ||
67 | 67 | <a href="{$ptitle_url}"><b>{$aThreadList->itaj_hs}</b></a>(dat倉庫) |
68 | 68 | EOP; |
69 | 69 | } elseif (!empty($ptitle_url)) { |
70 | - $ptitle_ht = sprintf('<a href="%s"><b>%s</b></a>', $ptitle_url, $ptitle_hs); | |
70 | + $ptitle_ht = sprintf('<a href="%s"><b>%s</b></a>', $ptitle_url, hs($ptitle)); | |
71 | 71 | } else { |
72 | - $ptitle_ht = "<b>{$ptitle_hs}</b>"; | |
72 | + $ptitle_ht = sprintf('<b>%s</b>', hs($ptitle)); | |
73 | 73 | } |
74 | 74 | |
75 | 75 | // }}} |
@@ -149,7 +149,7 @@ | ||
149 | 149 | } |
150 | 150 | // --> |
151 | 151 | </script> |
152 | -<title><?php eh($aThreadList->ptitle) ?></title> | |
152 | +<title><?php eh($ptitle) ?></title> | |
153 | 153 | </head> |
154 | 154 | <body id="subject"> |
155 | 155 |
@@ -156,7 +156,7 @@ | ||
156 | 156 | <?php $index_uri = UriUtil::buildQueryUri('index.php', array(UA::getQueryKey() => UA::getQueryValue())); ?> |
157 | 157 | <p><a id="backButton" class="tbutton" href="<?php eh($index_uri); ?>">TOP</a></p> |
158 | 158 | |
159 | -<div class="toolbar"><h1 class="pageTitle"><?php eh($aThreadList->ptitle) ?></h1></div> | |
159 | +<div class="toolbar"><h1 class="pageTitle"><?php eh($ptitle) ?></h1></div> | |
160 | 160 | <?php |
161 | 161 | |
162 | 162 | P2Util::printInfoHtml(); |
@@ -102,59 +102,10 @@ | ||
102 | 102 | } |
103 | 103 | |
104 | 104 | // }}} |
105 | -// {{{ リスト読み込み | |
106 | 105 | |
107 | -$formdata = array(); | |
108 | -if (file_exists($path)) { | |
109 | - $lines = file($path); | |
110 | - $i = 0; | |
111 | - foreach ($lines as $line) { | |
112 | - $lar = explode("\t", rtrim($line, "\r\n")); | |
113 | - if (strlen($lar[0]) == 0) { | |
114 | - continue; | |
115 | - } | |
116 | - $ar = array( | |
117 | - 'cond' => $lar[0], // 検索条件 | |
118 | - 'word' => $lar[0], // 対象文字列 | |
119 | - 'ht' => geti($lar[1]), // 最後にHITした時間 | |
120 | - 'hn' => geti($lar[2], 0), // HIT回数 | |
121 | - 're' => '', // 正規表現 | |
122 | - 'ic' => '', // 大文字小文字を無視 | |
123 | - 'bbs' => '', // 板 | |
124 | - 'tt' => '', // タイトル | |
125 | - ); | |
126 | - // 板縛り | |
127 | - if (preg_match('!<bbs>(.+?)</bbs>!', $ar['word'], $matches)) { | |
128 | - $ar['bbs'] = $matches[1]; | |
129 | - } | |
130 | - $ar['word'] = preg_replace('!<bbs>(.*)</bbs>!', '', $ar['word']); | |
131 | - // タイトル縛り | |
132 | - if (preg_match('!<title>(.+?)</title>!', $ar['word'], $matches)) { | |
133 | - $ar['tt'] = $matches[1]; | |
134 | - } | |
135 | - $ar['word'] = preg_replace('!<title>(.*)</title>!', '', $ar['word']); | |
136 | - // 正規表現 | |
137 | - if (preg_match('/^<(mb_ereg|preg_match|regex)(:[imsxeADSUXu]+)?>(.*)$/', $ar['word'], $m)) { | |
138 | - $ar['word'] = $m[3]; | |
139 | - $ar['re'] = ' checked'; | |
140 | - // 大文字小文字を無視 | |
141 | - if ($m[2] && false !== strpos($m[2], 'i')) { | |
142 | - $ar['ic'] = ' checked'; | |
143 | - } | |
144 | - // 大文字小文字を無視 | |
145 | - } elseif (preg_match('/^<i>(.*)$/', $ar['word'], $m)) { | |
146 | - $ar['word'] = $m[1]; | |
147 | - $ar['ic'] = ' checked'; | |
148 | - } | |
149 | - if (strlen($ar['word']) == 0) { | |
150 | - continue; | |
151 | - } | |
152 | - $formdata[$i++] = $ar; | |
153 | - } | |
154 | -} | |
106 | +// NGあぼーんリスト読み込み | |
107 | +$formdata = _loadNgAbornDataForEdit($path); | |
155 | 108 | |
156 | -// }}} | |
157 | - | |
158 | 109 | //===================================================================== |
159 | 110 | // プリント設定 |
160 | 111 | //===================================================================== |
@@ -305,7 +256,7 @@ | ||
305 | 256 | echo $htm['form_submit']; |
306 | 257 | ?><br><?php |
307 | 258 | |
308 | -if (!empty($formdata)) { | |
259 | +if ($formdata) { | |
309 | 260 | foreach ($formdata as $k => $v) { |
310 | 261 | printf($row_format, |
311 | 262 | $k, |
@@ -347,6 +298,70 @@ | ||
347 | 298 | </body></html> |
348 | 299 | <?php |
349 | 300 | |
301 | +// このファイル内の処理はここまで | |
302 | + | |
303 | +//================================================================================= | |
304 | +// 関数 | |
305 | +//================================================================================= | |
306 | +/** | |
307 | + * NGあぼーんリストを読み込む | |
308 | + * | |
309 | + * @return array | |
310 | + */ | |
311 | +function _loadNgAbornDataForEdit($path) | |
312 | +{ | |
313 | + $formdata = array(); | |
314 | + if (!file_exists($path)) { | |
315 | + return $formdata; | |
316 | + } | |
317 | + $lines = file($path); | |
318 | + $i = 0; | |
319 | + foreach ($lines as $line) { | |
320 | + $lar = explode("\t", rtrim($line, "\r\n")); | |
321 | + if (strlen($lar[0]) == 0) { | |
322 | + continue; | |
323 | + } | |
324 | + $ar = array( | |
325 | + 'cond' => $lar[0], // 検索条件 | |
326 | + 'word' => $lar[0], // 対象文字列 | |
327 | + 'ht' => geti($lar[1]), // 最後にHITした時間 | |
328 | + 'hn' => geti($lar[2], 0), // HIT回数 | |
329 | + 're' => '', // 正規表現 | |
330 | + 'ic' => '', // 大文字小文字を無視 | |
331 | + 'bbs' => '', // 板 | |
332 | + 'tt' => '', // タイトル | |
333 | + ); | |
334 | + // 板縛り | |
335 | + if (preg_match('!<bbs>(.+?)</bbs>!', $ar['word'], $matches)) { | |
336 | + $ar['bbs'] = $matches[1]; | |
337 | + } | |
338 | + $ar['word'] = preg_replace('!<bbs>(.*)</bbs>!', '', $ar['word']); | |
339 | + // タイトル縛り | |
340 | + if (preg_match('!<title>(.+?)</title>!', $ar['word'], $matches)) { | |
341 | + $ar['tt'] = $matches[1]; | |
342 | + } | |
343 | + $ar['word'] = preg_replace('!<title>(.*)</title>!', '', $ar['word']); | |
344 | + // 正規表現 | |
345 | + if (preg_match('/^<(mb_ereg|preg_match|regex)(:[imsxeADSUXu]+)?>(.*)$/', $ar['word'], $m)) { | |
346 | + $ar['word'] = $m[3]; | |
347 | + $ar['re'] = ' checked'; | |
348 | + // 大文字小文字を無視 | |
349 | + if ($m[2] && false !== strpos($m[2], 'i')) { | |
350 | + $ar['ic'] = ' checked'; | |
351 | + } | |
352 | + // 大文字小文字を無視 | |
353 | + } elseif (preg_match('/^<i>(.*)$/', $ar['word'], $m)) { | |
354 | + $ar['word'] = $m[1]; | |
355 | + $ar['ic'] = ' checked'; | |
356 | + } | |
357 | + if (strlen($ar['word']) == 0) { | |
358 | + continue; | |
359 | + } | |
360 | + $formdata[$i++] = $ar; | |
361 | + } | |
362 | + return $formdata; | |
363 | +} | |
364 | + | |
350 | 365 | /* |
351 | 366 | * Local Variables: |
352 | 367 | * mode: php |
@@ -644,7 +644,7 @@ | ||
644 | 644 | if (!$lar[1] || !strlen($lar[11])) { // 不正データを削除 |
645 | 645 | continue; |
646 | 646 | } |
647 | - if ($lar[1] == $key && $lar[11] == $bbs) { // key, bbsで重複回避 | |
647 | + if ($lar[1] == $key && $lar[11] == $bbs && $lar[10] == $host) { // key, bbs, hostで重複回避 | |
648 | 648 | continue; |
649 | 649 | } |
650 | 650 | $newlines[] = $line; |
@@ -1,3 +1,12 @@ | ||
1 | +2015/01/17 | |
2 | + * rep2 version 1.8.104 | |
3 | + | |
4 | + [更新] Willcom(Y!mobile)とauのIPアドレス帯域を更新した。 | |
5 | + [更新] iOSのUA判定を更新した。 | |
6 | + [更新] 最近読んだスレで、keyとbbsが同じ場合でもhostが異なれば別のスレとして扱うようにした。 | |
7 | + [更新] NGあぼーんの設定で板の指定の大文字と小文字を区別しないようにした。 | |
8 | + [更新] ファイル処理をより丁重にした。updateArraySrdFile() | |
9 | + | |
1 | 10 | 2014/05/15 |
2 | 11 | * rep2 version 1.8.103 |
3 | 12 |
@@ -176,12 +176,12 @@ | ||
176 | 176 | |
177 | 177 | // iPod touch |
178 | 178 | // 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 |
179 | - if (preg_match('/(iPhone|iPod);/', $ua)) {// || UA::isAndroidWebKit($ua)) { // androidを含めていないのはなんでだっけ? | |
179 | + if (preg_match('/(iPhone|iPod)(?:;| )/', $ua)) {// || UA::isAndroidWebKit($ua)) { // androidを含めていないのはなんでだっけ? | |
180 | 180 | $isiPhoneGroup = true; |
181 | 181 | |
182 | 182 | // iPad 2010/5/29 |
183 | 183 | // 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 |
184 | - } elseif (preg_match('/iPad;/', $ua)) { | |
184 | + } elseif (preg_match('/iPad(?:;| )/', $ua)) { | |
185 | 185 | $isiPhoneGroup = true; |
186 | 186 | } |
187 | 187 |
@@ -298,7 +298,8 @@ | ||
298 | 298 | { |
299 | 299 | global $_conf; |
300 | 300 | |
301 | - if (!P2Util::isHost2chs($host)) { | |
301 | + // SETTING.TXT対応サイト以外はnullを返す | |
302 | + if (!P2Util::isHost2chs($host) && !P2Util::isHost2chSc($host)) { | |
302 | 303 | return null; |
303 | 304 | } |
304 | 305 |
@@ -315,7 +316,24 @@ | ||
315 | 316 | $hr->sendRequest(); |
316 | 317 | return $hr->getResponseCode(); |
317 | 318 | } |
318 | - | |
319 | + | |
320 | + /** | |
321 | + * 2chのSETTING.TXTの有無でホストの移転を確認する | |
322 | + * | |
323 | + * @return boolean | |
324 | + */ | |
325 | + function check2chHostMovedBySettingTxt($new_host, $old_host, $bbs) | |
326 | + { | |
327 | + if (!in_array( | |
328 | + SettingTxt::get2chSettingTxtResponseCode($old_host, $bbs), | |
329 | + array(200, null), true | |
330 | + ) | |
331 | + and 200 === SettingTxt::get2chSettingTxtResponseCode($new_host, $bbs) | |
332 | + ) { | |
333 | + return true; | |
334 | + } | |
335 | + return false; | |
336 | + } | |
319 | 337 | } |
320 | 338 | |
321 | 339 | // }}} |
@@ -178,8 +178,17 @@ | ||
178 | 178 | } |
179 | 179 | |
180 | 180 | // 板チェック |
181 | - if (strlen($bbs) and isset($v['bbs']) && in_array($bbs, $v['bbs']) == false) { | |
182 | - continue; | |
181 | + if (strlen($bbs) and isset($v['bbs'])) { | |
182 | + $bbsmatch = false; | |
183 | + foreach ($v['bbs'] as $b) { | |
184 | + if (strtolower($b) == strtolower($bbs)) { | |
185 | + $bbsmatch = true; | |
186 | + continue; | |
187 | + } | |
188 | + } | |
189 | + if (!$bbsmatch) { | |
190 | + continue; | |
191 | + } | |
183 | 192 | } |
184 | 193 | |
185 | 194 | // タイトルチェック |
@@ -22,8 +22,23 @@ | ||
22 | 22 | /** |
23 | 23 | * @constructor |
24 | 24 | */ |
25 | - function SubjectTxt($host, $bbs) | |
25 | + function SubjectTxt(&$host, $bbs) | |
26 | 26 | { |
27 | + $this->initProperties($host, $bbs); | |
28 | + | |
29 | + // subject.txtをダウンロード&セットする | |
30 | + $this->dlAndSetSubject(); | |
31 | + | |
32 | + // downloadSubject()内のホスト移転検知時に書き換えられた新しいhost情報を反映する | |
33 | + $host = $this->host; | |
34 | + } | |
35 | + | |
36 | + /** | |
37 | + * @access private | |
38 | + * @return void | |
39 | + */ | |
40 | + function initProperties($host, $bbs) | |
41 | + { | |
27 | 42 | $this->host = $host; |
28 | 43 | $this->bbs = $bbs; |
29 | 44 |
@@ -38,9 +53,6 @@ | ||
38 | 53 | |
39 | 54 | $this->subject_file = $this->getSubjectFile($this->host, $this->bbs); |
40 | 55 | $this->subject_url = $this->getSubjectUrl($this->host, $this->bbs); |
41 | - | |
42 | - // subject.txtをダウンロード&セットする | |
43 | - $this->dlAndSetSubject(); | |
44 | 56 | } |
45 | 57 | |
46 | 58 | /** |
@@ -171,33 +183,38 @@ | ||
171 | 183 | } else { |
172 | 184 | $code = $req->getResponseCode(); |
173 | 185 | // 302 Found (Redirection 転送) |
174 | - if ($code == 302) { | |
186 | + // 2010/08/05 「もうずっと人大杉 」でも302を返すことに注意(Location: http://www2.2ch.net/live.html) | |
187 | + // 301 Moved Permanently | |
188 | + if (P2Util::isHost2chs($this->host) and in_array($code, array(302, 301))) { // sc非対応のため2chに絞る | |
175 | 189 | // ホストの移転を追跡 |
176 | 190 | require_once P2_LIB_DIR . '/BbsMap.php'; |
177 | - $new_host = BbsMap::getCurrentHost($this->host, $this->bbs); | |
178 | 191 | require_once P2_LIB_DIR . '/SettingTxt.php'; |
192 | + $new_host = null; | |
193 | + if ($location = $req->getResponseHeader('Location')) { | |
194 | + if (preg_match('{https?://(.+?)/[^/]+/subject\\.txt$}', $location, $m)) { | |
195 | + $new_host = $m[1]; | |
196 | + } | |
197 | + } | |
198 | + if (!$new_host) { | |
199 | + $new_host = BbsMap::getCurrentHost($this->host, $this->bbs); | |
200 | + } | |
179 | 201 | if ( |
180 | 202 | $new_host != $this->host |
181 | 203 | // SETTING.TXTの有無で板移転を確認 |
182 | - // 2010/08/05 「もうずっと人大杉 」でも302を返す | |
183 | - and !in_array( | |
184 | - SettingTxt::get2chSettingTxtResponseCode($this->host, $this->bbs), | |
185 | - array(200, null), true | |
186 | - ) | |
187 | - and 200 === SettingTxt::get2chSettingTxtResponseCode($new_host, $this->bbs) | |
204 | + and SettingTxt::check2chHostMovedBySettingTxt($new_host, $this->host, $this->bbs) | |
188 | 205 | ) { |
189 | - BbsMap::getCurrentHost($this->host, $this->bbs, true); // autosync | |
190 | - $aNewSubjectTxt = new SubjectTxt($new_host, $this->bbs); | |
191 | - return $aNewSubjectTxt->downloadSubject(); | |
206 | + BbsMap::syncHost($new_host, $this->bbs, $this->host); | |
207 | + $this->initProperties($new_host, $this->bbs); | |
208 | + return $this->downloadSubject(); | |
192 | 209 | } |
193 | 210 | } |
194 | - if (!($code == 200 || $code == 206 || $code == 304)) { | |
211 | + if (!in_array($code, array(200, 206, 304))) { | |
195 | 212 | //var_dump($req->getResponseHeader()); |
196 | 213 | $error_msg = $code; |
197 | 214 | } |
198 | 215 | } |
199 | 216 | |
200 | - if (!is_null($error_msg) && strlen($error_msg) > 0) { | |
217 | + if (!is_null($error_msg) && strlen($error_msg)) { | |
201 | 218 | $attrs = array(); |
202 | 219 | if ($_conf['ext_win_target']) { |
203 | 220 | $attrs['target'] = $_conf['ext_win_target']; |
@@ -232,6 +232,33 @@ | ||
232 | 232 | } |
233 | 233 | |
234 | 234 | /** |
235 | + * 共有ロックをかけて、ファイル内容を読み込む | |
236 | + * | |
237 | + * @static | |
238 | + * @access public | |
239 | + * @return string|false | |
240 | + */ | |
241 | + function fileGetContents($file) | |
242 | + { | |
243 | + if (!$fp = fopen($file, 'rb')) { | |
244 | + return false; | |
245 | + } | |
246 | + $bytes = 12000; | |
247 | + $cont = ''; | |
248 | + flock($fp, LOCK_SH); | |
249 | + while (!feof($fp)) { | |
250 | + $line = fgets($fp, $bytes); | |
251 | + if (strlen($line)) { | |
252 | + $cont .= $line; | |
253 | + } | |
254 | + } | |
255 | + flock($fp, LOCK_UN); | |
256 | + fclose($fp); | |
257 | + | |
258 | + return $cont; | |
259 | + } | |
260 | + | |
261 | + /** | |
235 | 262 | * Windowsでは上書きの rename() でエラーが出るようなので、そのエラーを回避したrename() |
236 | 263 | * ※ただし、unlink() と rename() の間で一瞬の間が空くので完全ではない。 |
237 | 264 | * 参考 http://ns1.php.gr.jp/pipermail/php-users/2005-October/027827.html |
@@ -37,11 +37,7 @@ | ||
37 | 37 | $new_host = $map[$type][$bbs]['host']; |
38 | 38 | if ($host != $new_host && $autosync && !$synced) { |
39 | 39 | // 移転を検出したらお気に板、お気にスレ、最近読んだスレを自動で同期 |
40 | - $msg_fmt = '<p>p2 info: ホストの移転を検出しました。(%s/%s → %s/%s)<br>'; | |
41 | - $msg_fmt .= 'お気に板、お気にスレ、最近読んだスレを自動で同期します。</p>'; | |
42 | - $msg = sprintf($msg_fmt, $host, $bbs, $new_host, $bbs); | |
43 | - P2Util::pushInfoHtml($msg); | |
44 | - BbsMap::syncFav(); | |
40 | + BbsMap::syncHost($new_host, $bbs, $host); | |
45 | 41 | $synced = true; |
46 | 42 | } |
47 | 43 | $host = $new_host; |
@@ -49,9 +45,24 @@ | ||
49 | 45 | |
50 | 46 | return $host; |
51 | 47 | } |
52 | - | |
48 | + | |
49 | + /** | |
50 | + * @static | |
51 | + * @access public | |
52 | + * @return void | |
53 | + */ | |
54 | + function syncHost($new_host, $bbs, $old_host) | |
55 | + { | |
56 | + $msg_fmt = '<p>p2 info: ホストの移転を検出しました。(%s/%s → %s/%s)<br>'; | |
57 | + $msg_fmt .= 'お気に板、お気にスレ、最近読んだスレを自動で同期します。</p>'; | |
58 | + $msg = sprintf($msg_fmt, $old_host, $bbs, $new_host, $bbs); | |
59 | + P2Util::pushInfoHtml($msg); | |
60 | + | |
61 | + BbsMap::syncFavs($new_host, $bbs, $old_host); | |
62 | + } | |
63 | + | |
53 | 64 | // }}} |
54 | - | |
65 | + | |
55 | 66 | /** |
56 | 67 | * 2chの板名からホスト名を取得する |
57 | 68 | * |
@@ -116,7 +127,7 @@ | ||
116 | 127 | * @param boolean $noMsg 結果メッセージのpushを抑制するならtrue |
117 | 128 | * @return void |
118 | 129 | */ |
119 | - function syncBrd($brd_path, $noMsg = false) | |
130 | + function syncBrd($brd_path, $noMsg = false, $sethost = null, $setbbs = null, $old_host = null) | |
120 | 131 | { |
121 | 132 | global $_conf; |
122 | 133 | static $done = array(); |
@@ -126,14 +137,17 @@ | ||
126 | 137 | if (array_key_exists($brd_path, $done)) { |
127 | 138 | return; |
128 | 139 | } |
129 | - $lines = BbsMap::_readData($brd_path); | |
130 | - if (!$lines) { | |
140 | + | |
141 | + if (!$lines = BbsMap::_readData($brd_path)) { | |
131 | 142 | return; |
132 | 143 | } |
133 | - $map = BbsMap::_getMapping(); | |
134 | - if (!$map) { | |
144 | + | |
145 | + if ($sethost && $setbbs && $old_host) { | |
146 | + $settype = BbsMap::_detectHostType($old_host); | |
147 | + } elseif (!$map = BbsMap::_getMapping()) { | |
135 | 148 | return; |
136 | 149 | } |
150 | + | |
137 | 151 | $neolines = array(); |
138 | 152 | $updated = false; |
139 | 153 |
@@ -149,7 +163,13 @@ | ||
149 | 163 | $itaj = $data[3]; |
150 | 164 | $type = BbsMap::_detectHostType($host); |
151 | 165 | |
152 | - if (isset($map[$type]) && isset($map[$type][$bbs])) { | |
166 | + $newhost = $host; | |
167 | + | |
168 | + if ($settype) { | |
169 | + if ($type == $settype && $bbs == $setbbs) { | |
170 | + $newhost = $sethost; | |
171 | + } | |
172 | + } elseif (isset($map[$type]) && isset($map[$type][$bbs])) { | |
153 | 173 | $newhost = $map[$type][$bbs]['host']; |
154 | 174 | if ($itaj === '') { |
155 | 175 | $itaj = $map[$type][$bbs]['itaj']; |
@@ -159,8 +179,6 @@ | ||
159 | 179 | $itaj = ''; |
160 | 180 | } |
161 | 181 | } |
162 | - } else { | |
163 | - $newhost = $host; | |
164 | 182 | } |
165 | 183 | |
166 | 184 | if ($host != $newhost || $setitaj) { |
@@ -199,7 +217,7 @@ | ||
199 | 217 | * @param boolean $noMsg 結果メッセージのpushを抑制するならtrue |
200 | 218 | * @return void |
201 | 219 | */ |
202 | - function syncIdx($idx_path, $noMsg = false) | |
220 | + function syncIdx($idx_path, $noMsg = false, $sethost = null, $setbbs = null, $old_host = null) | |
203 | 221 | { |
204 | 222 | global $_conf; |
205 | 223 | static $done = array(); |
@@ -209,14 +227,17 @@ | ||
209 | 227 | if (isset($done[$idx_path])) { |
210 | 228 | return; |
211 | 229 | } |
212 | - $lines = BbsMap::_readData($idx_path); | |
213 | - if (!$lines) { | |
230 | + | |
231 | + if (!$lines = BbsMap::_readData($idx_path)) { | |
214 | 232 | return; |
215 | 233 | } |
216 | - $map = BbsMap::_getMapping(); | |
217 | - if (!$map) { | |
234 | + | |
235 | + if ($sethost && $setbbs && $old_host) { | |
236 | + $settype = BbsMap::_detectHostType($old_host); | |
237 | + } elseif (!$map = BbsMap::_getMapping()) { | |
218 | 238 | return; |
219 | 239 | } |
240 | + | |
220 | 241 | $neolines = array(); |
221 | 242 | $updated = false; |
222 | 243 |
@@ -229,10 +250,14 @@ | ||
229 | 250 | $bbs = $data[11]; |
230 | 251 | $type = BbsMap::_detectHostType($host); |
231 | 252 | |
232 | - if (isset($map[$type]) && isset($map[$type][$bbs])) { | |
253 | + $newhost = $host; | |
254 | + | |
255 | + if ($settype) { | |
256 | + if ($type == $settype && $bbs == $setbbs) { | |
257 | + $newhost = $sethost; | |
258 | + } | |
259 | + } elseif (isset($map[$type]) && isset($map[$type][$bbs])) { | |
233 | 260 | $newhost = $map[$type][$bbs]['host']; |
234 | - } else { | |
235 | - $newhost = $host; | |
236 | 261 | } |
237 | 262 | |
238 | 263 | if ($host != $newhost) { |
@@ -267,18 +292,18 @@ | ||
267 | 292 | * お気に板、お気にスレ、最近読んだスレを同期する |
268 | 293 | * |
269 | 294 | * @return void |
270 | - * @access public | |
295 | + * @access private | |
271 | 296 | * @static |
272 | 297 | */ |
273 | - function syncFav() | |
298 | + function syncFavs($new_host, $bbs, $old_host) | |
274 | 299 | { |
275 | 300 | global $_conf; |
276 | 301 | |
277 | 302 | $noMsg = UA::isK() ? true : false; |
278 | 303 | |
279 | - BbsMap::syncBrd($_conf['favita_path'], $noMsg); | |
280 | - BbsMap::syncIdx($_conf['favlist_file'], $noMsg); | |
281 | - BbsMap::syncIdx($_conf['recent_file'], $noMsg); | |
304 | + BbsMap::syncBrd($_conf['favita_path'], $noMsg, $new_host, $bbs, $old_host); | |
305 | + BbsMap::syncIdx($_conf['favlist_file'], $noMsg, $new_host, $bbs, $old_host); | |
306 | + BbsMap::syncIdx($_conf['recent_file'], $noMsg, $new_host, $bbs, $old_host); | |
282 | 307 | } |
283 | 308 | |
284 | 309 | // }}} |
@@ -483,7 +483,7 @@ | ||
483 | 483 | //$regHost = '/^wb\d+proxy\d\d\.ezweb\.ne\.jp$/'; |
484 | 484 | $regHost = '/\.ezweb\.ne\.jp$/'; |
485 | 485 | |
486 | - // @updated 2013/12/01 | |
486 | + // @updated 2015/01/17 | |
487 | 487 | $bands = array( |
488 | 488 | // EZ兼PCSV。統一されたってことはPCSVもHTTP_X_UP_SUBNOを送信するんだろうか? |
489 | 489 | '111.107.116.64/26', |
@@ -498,9 +498,23 @@ | ||
498 | 498 | '61.117.2.40/29', |
499 | 499 | '219.108.158.40/29', |
500 | 500 | '111.86.142.0/26', |
501 | - '111.86.141.64/26', | |
502 | - '111.86.141.128/26', | |
503 | 501 | '111.86.141.192/26', |
502 | + '27.90.136.0/27', | |
503 | + '27.90.136.32/27', | |
504 | + '27.90.136.64/27', | |
505 | + '27.90.136.96/27', | |
506 | + '27.90.136.128/27', | |
507 | + '27.90.136.160/27', | |
508 | + '27.90.136.192/27', | |
509 | + '27.90.137.192/27', | |
510 | + '27.90.137.224/27', | |
511 | + '27.90.136.224/27', | |
512 | + '27.90.137.0/27', | |
513 | + '27.90.137.32/27', | |
514 | + '27.90.137.64/27', | |
515 | + '27.90.137.96/27', | |
516 | + '27.90.137.128/27', | |
517 | + '27.90.137.160/27', | |
504 | 518 | '111.86.143.192/27', |
505 | 519 | '111.86.143.224/27', |
506 | 520 | '111.86.147.0/27', |
@@ -517,7 +531,7 @@ | ||
517 | 531 | '111.86.147.160/27', |
518 | 532 | '111.86.147.192/27', |
519 | 533 | '111.86.147.224/27' |
520 | - | |
534 | + | |
521 | 535 | // PCSVは含めず |
522 | 536 | ); |
523 | 537 | return HostCheck::isAddrInBand($addr, $bands, $regHost); |
@@ -635,9 +649,9 @@ | ||
635 | 649 | } |
636 | 650 | |
637 | 651 | /** |
638 | - * IPは WILLCOM? | |
652 | + * IPは WILLCOM? (Y!mobile) | |
639 | 653 | * |
640 | - * @link http://www.willcom-inc.com/ja/service/contents_service/club_air_edge/for_phone/ip/index.html | |
654 | + * @link http://www.ymobile.jp/service/contents_service/create/center_info/index.html | |
641 | 655 | * @return boolean |
642 | 656 | * @access public |
643 | 657 | * @static |
@@ -650,7 +664,7 @@ | ||
650 | 664 | |
651 | 665 | $regHost = '/^[Pp]\d{12}\.ppp\.prin\.ne\.jp$/'; |
652 | 666 | |
653 | - // @updated 2013/12/01 | |
667 | + // @updated 2015/01/17 | |
654 | 668 | $bands = array( |
655 | 669 | '114.20.49.0/24', |
656 | 670 | '114.20.50.0/24', |
@@ -671,6 +685,7 @@ | ||
671 | 685 | '114.20.65.0/24', |
672 | 686 | '114.20.66.0/24', |
673 | 687 | '114.20.67.0/24', |
688 | + '114.20.71.0/24', | |
674 | 689 | '114.20.128.0/17', |
675 | 690 | '114.21.128.0/24', |
676 | 691 | '114.21.129.0/24', |
@@ -694,6 +709,7 @@ | ||
694 | 709 | '114.21.147.0/24', |
695 | 710 | '114.21.148.0/24', |
696 | 711 | '114.21.149.0/24', |
712 | + '114.21.151.0/24', | |
697 | 713 | '221.109.128.0/18' |
698 | 714 | ); |
699 | 715 | return HostCheck::isAddrInBand($addr, $bands, $regHost); |
@@ -313,14 +313,10 @@ | ||
313 | 313 | if ( |
314 | 314 | $new_host != $this->host |
315 | 315 | // SETTING.TXTの有無で板移転を確認 |
316 | - and !in_array( | |
317 | - SettingTxt::get2chSettingTxtResponseCode($this->host, $this->bbs), | |
318 | - array(200, null), true | |
319 | - ) | |
320 | - and 200 === SettingTxt::get2chSettingTxtResponseCode($new_host, $this->bbs) | |
316 | + and SettingTxt::check2chHostMovedBySettingTxt($new_host, $this->host, $this->bbs) | |
321 | 317 | ) { |
322 | 318 | fclose($fp); |
323 | - BbsMap::getCurrentHost($this->host, $this->bbs, true); // autosync | |
319 | + BbsMap::syncHost($new_host, $this->bbs, $this->host); | |
324 | 320 | $this->old_host = $this->host; |
325 | 321 | $this->host = $new_host; |
326 | 322 | return $this->downloadDat2ch($from_bytes); |
@@ -1618,6 +1618,17 @@ | ||
1618 | 1618 | } |
1619 | 1619 | |
1620 | 1620 | /** |
1621 | + * host が 2ch.sc なら true を返す | |
1622 | + * | |
1623 | + * @access public | |
1624 | + * @return boolean | |
1625 | + */ | |
1626 | + function isHost2chSc($host) | |
1627 | + { | |
1628 | + return (bool)preg_match('/\\.(2ch\\.sc)$/', $host); | |
1629 | + } | |
1630 | + | |
1631 | + /** | |
1621 | 1632 | * host が find.2ch.net(こっそりアンケート) なら true を返す |
1622 | 1633 | * |
1623 | 1634 | * @access public |
@@ -2306,13 +2317,21 @@ | ||
2306 | 2317 | */ |
2307 | 2318 | function updateArraySrdFile($data, $file) |
2308 | 2319 | { |
2309 | - // 既存のデータをマージ取得 | |
2320 | + // 既存のデータ(配列)を取得してマージ | |
2310 | 2321 | if (file_exists($file)) { |
2311 | - if ($cont = file_get_contents($file)) { | |
2312 | - $array = unserialize($cont); | |
2313 | - if (is_array($array)) { | |
2314 | - $data = array_merge($array, $data); | |
2322 | + if (false === $cont = FileCtl::fileGetContents($file)) { | |
2323 | + return false; | |
2324 | + } | |
2325 | + if (strlen($cont)) { | |
2326 | + if (false === $array = unserialize($cont)) { | |
2327 | + trigger_error('false === unserialize(), file: ' . hs($file) , E_USER_WARNING); | |
2328 | + return false; | |
2315 | 2329 | } |
2330 | + if (!is_array($array)) { | |
2331 | + trigger_error('not array, file: ' . hs($file) , E_USER_WARNING); | |
2332 | + return false; | |
2333 | + } | |
2334 | + $data = array_merge($array, $data); | |
2316 | 2335 | } |
2317 | 2336 | } |
2318 | 2337 |
@@ -319,7 +319,7 @@ | ||
319 | 319 | // {{{ ■ETC |
320 | 320 | |
321 | 321 | // 板メニュー(フレーム左)menu の表示幅 |
322 | -$conf_user_def['frame_menu_width'] = "164"; // ("164") | |
322 | +$conf_user_def['frame_menu_width'] = "166"; // ("166") | |
323 | 323 | |
324 | 324 | // スレ一覧(フレーム右上)subject の表示幅 |
325 | 325 | $conf_user_def['frame_subject_width'] = "40%"; // ("40%") |
@@ -3,7 +3,7 @@ | ||
3 | 3 | // このファイルは、特に理由の無い限り変更しないで下さい。 |
4 | 4 | // include from conf.inc.php |
5 | 5 | |
6 | -$_conf['p2version'] = '1.8.103'; // rep2のバージョン | |
6 | +$_conf['p2version'] = '1.8.104'; // rep2のバージョン | |
7 | 7 | |
8 | 8 | $_conf['p2name'] = 'rep2'; // rep2の名前。 |
9 | 9 |