forked from unpush/p2-php
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathread_new.php
793 lines (679 loc) · 28.6 KB
/
read_new.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
<?php
/**
* rep2 - スレッド表示スクリプト - 新着まとめ読み
* フレーム分割画面、右下部分
*/
require_once './conf/conf.inc.php';
require_once P2_LIB_DIR . '/NgAbornCtl.php';
require_once P2_LIB_DIR . '/ThreadList.php';
require_once P2_LIB_DIR . '/ThreadRead.php';
require_once P2_LIB_DIR . '/ShowThreadPc.php';
require_once P2_LIB_DIR . '/read_new.inc.php';
$_login->authorize(); // ユーザ認証
// まとめよみのキャッシュ読み
if (!empty($_GET['cview'])) {
$cnum = (isset($_GET['cnum'])) ? intval($_GET['cnum']) : NULL;
if ($cont = getMatomeCache($cnum)) {
echo $cont;
} else {
header('Content-Type: text/plain; charset=Shift_JIS');
echo 'p2 error: 新着まとめ読みのキャッシュがないよ';
}
exit;
}
// +Wiki
require_once P2_LIB_DIR . '/wiki/read.inc.php';
// 省メモリ設定
// 1 にするとキャッシュをメモリでなく一時ファイルに保持する
// (どちらでも最終的にはファイルに書き込まれる)
if (!defined('P2_READ_NEW_SAVE_MEMORY')) {
define('P2_READ_NEW_SAVE_MEMORY', 0);
}
//==================================================================
// 変数
//==================================================================
if (isset($_conf['rnum_all_range']) and $_conf['rnum_all_range'] > 0) {
$GLOBALS['rnum_all_range'] = $_conf['rnum_all_range'];
}
$sb_view = "shinchaku";
$newtime = date("gis");
$online_num = 0;
$newthre_num = 0;
$sid_q = (defined('SID')) ? '&'.strip_tags(SID) : '';
//=================================================
// 板の指定
//=================================================
if (isset($_GET['host'])) { $host = $_GET['host']; }
if (isset($_POST['host'])) { $host = $_POST['host']; }
if (isset($_GET['bbs'])) { $bbs = $_GET['bbs']; }
if (isset($_POST['bbs'])) { $bbs = $_POST['bbs']; }
if (isset($_GET['spmode'])) { $spmode = $_GET['spmode']; }
if (isset($_POST['spmode'])) { $spmode = $_POST['spmode']; }
if ((!isset($host) || !isset($bbs)) && !isset($spmode)) {
p2die('必要な引数が指定されていません');
}
//=================================================
// あぼーん&NGワード設定読み込み
//=================================================
$GLOBALS['ngaborns'] = NgAbornCtl::loadNgAborns();
//====================================================================
// メイン
//====================================================================
if (P2_READ_NEW_SAVE_MEMORY) {
register_shutdown_function('saveMatomeCacheFromTmpFile');
$read_new_tmp_fh = tmpfile();
if (!is_resource($read_new_tmp_fh)) {
p2die('cannot make tmpfile.');
}
} else {
register_shutdown_function('saveMatomeCache');
$read_new_html = '';
}
ob_start();
$aThreadList = new ThreadList();
// 板とモードのセット===================================
$ta_keys = array();
if ($spmode) {
if ($spmode == 'taborn' or $spmode == 'soko') {
$aThreadList->setIta($host, $bbs, P2Util::getItaName($host, $bbs));
}
$aThreadList->setSpMode($spmode);
} else {
$aThreadList->setIta($host, $bbs, P2Util::getItaName($host, $bbs));
// スレッドあぼーんリスト読込
$taborn_file = $aThreadList->getIdxDir() . 'p2_threads_aborn.idx';
if ($tabornlines = FileCtl::file_read_lines($taborn_file, FILE_IGNORE_NEW_LINES)) {
$ta_num = sizeof($tabornlines);
foreach ($tabornlines as $l) {
$tarray = explode('<>', $l);
$ta_keys[ $tarray[1] ] = true;
}
}
}
// ソースリスト読込
if ($spmode == 'merge_favita') {
if ($_conf['expack.misc.multi_favs'] && !empty($_conf['m_favita_set'])) {
$merged_faivta_read_idx = $_conf['pref_dir'] . '/p2_favita' . $_conf['m_favita_set'] . '_read.idx';
} else {
$merged_faivta_read_idx = $_conf['pref_dir'] . '/p2_favita_read.idx';
}
$lines = FileCtl::file_read_lines($merged_faivta_read_idx);
if (is_array($lines)) {
$have_merged_faivta_read_idx = true;
} else {
$have_merged_faivta_read_idx = false;
$lines = $aThreadList->readList();
}
} else {
$lines = $aThreadList->readList();
}
// ページヘッダ表示 ===================================
$ptitle_hd = htmlspecialchars($aThreadList->ptitle, ENT_QUOTES);
$ptitle_ht = "{$ptitle_hd} の 新着まとめ読み";
if ($aThreadList->spmode) {
$sb_ht = <<<EOP
<a href="{$_conf['subject_php']}?host={$aThreadList->host}&bbs={$aThreadList->bbs}&spmode={$aThreadList->spmode}" target="subject">{$ptitle_hd}</a>
EOP;
} else {
$sb_ht = <<<EOP
<a href="{$_conf['subject_php']}?host={$aThreadList->host}&bbs={$aThreadList->bbs}" target="subject">{$ptitle_hd}</a>
EOP;
}
// require_once P2_LIB_DIR . '/read_header.inc.php';
echo $_conf['doctype'];
echo <<<EOHEADER
<html lang="ja">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS">
<meta http-equiv="Content-Style-Type" content="text/css">
<meta http-equiv="Content-Script-Type" content="text/javascript">
<meta name="ROBOTS" content="NOINDEX, NOFOLLOW">
{$_conf['extra_headers_ht']}
<title>{$ptitle_ht}</title>
<link rel="stylesheet" type="text/css" href="css.php?css=style&skin={$skin_en}">
<link rel="stylesheet" type="text/css" href="css.php?css=read&skin={$skin_en}">
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico">
<script type="text/javascript" src="js/basic.js?{$_conf['p2_version_id']}"></script>
<script type="text/javascript" src="js/respopup.js?{$_conf['p2_version_id']}"></script>
<script type="text/javascript" src="js/ngabornctl.js?{$_conf['p2_version_id']}"></script>
<script type="text/javascript" src="js/setfavjs.js?{$_conf['p2_version_id']}"></script>
<script type="text/javascript" src="js/delelog.js?{$_conf['p2_version_id']}"></script>\n
EOHEADER;
if ($_conf['iframe_popup_type'] == 1) {
echo <<<EOP
<script type="text/javascript" src="./js/yui-ext/yui.js"></script>
<script type="text/javascript" src="./js/yui-ext/yui-ext-nogrid.js"></script>
<link rel="stylesheet" type="text/css" href="./js/yui-ext/resources/css/resizable.css">
<script type="text/javascript" src="js/htmlpopup_resizable.js?{$_conf['p2_version_id']}"></script>
EOP;
} else {
echo <<<EOP
<script type="text/javascript" src="js/htmlpopup.js?{$_conf['p2_version_id']}"></script>
EOP;
}
if ($_conf['link_youtube'] == 2 || $_conf['link_niconico'] == 2) {
echo <<<EOP
<script type="text/javascript" src="js/preview_video.js?{$_conf['p2_version_id']}"></script>\n
EOP;
}
if ($_conf['expack.am.enabled']) {
echo <<<EOP
<script type="text/javascript" src="js/asciiart.js?{$_conf['p2_version_id']}"></script>\n
EOP;
}
/*if ($_conf['expack.misc.async_respop']) {
echo <<<EOP
<script type="text/javascript" src="js/async.js?{$_conf['p2_version_id']}"></script>\n
EOP;
}*/
if ($_conf['expack.spm.enabled']) {
echo <<<EOP
<script type="text/javascript" src="js/invite.js?{$_conf['p2_version_id']}"></script>
<script type="text/javascript" src="js/smartpopup.js?{$_conf['p2_version_id']}"></script>\n
EOP;
}
if ($_conf['expack.ic2.enabled']) {
echo <<<EOP
<script type="text/javascript" src="js/json2.js?{$_conf['p2_version_id']}"></script>
<script type="text/javascript" src="js/loadthumb.js?{$_conf['p2_version_id']}"></script>
<script type="text/javascript" src="js/ic2_getinfo.js?{$_conf['p2_version_id']}"></script>
<script type="text/javascript" src="js/ic2_popinfo.js?{$_conf['p2_version_id']}"></script>
<link rel="stylesheet" type="text/css" href="css/ic2_popinfo.css?{$_conf['p2_version_id']}">\n
EOP;
}
if ($_conf['coloredid.enable'] > 0 && $_conf['coloredid.click'] > 0) {
echo <<<EOP
<script type="text/javascript" src="js/colorLib.js?{$_conf['p2_version_id']}"></script>
<script type="text/javascript" src="js/coloredId.js?{$_conf['p2_version_id']}"></script>
EOP;
}
$onload_script = '';
if ($_conf['iframe_popup_type'] == 1) {
$fade = empty($_GET['fade']) ? 'false' : 'true';
$onload_script .= "gFade = {$fade};";
$bodyadd = ' onclick="hideHtmlPopUp(event);"';
EOP;
}
if ($_conf['backlink_coloring_track']) {
$onload_script .= '(function() { for(var i=0; i<rescolObjs.length; i++) {rescolObjs[i].setUp(); }})();';
echo <<<EOP
<script type="text/javascript" src="js/backlink_color.js?{$_conf['p2_version_id']}"></script>
EOP;
}
if ($_conf['expack.ic2.enabled'] && $_conf['expack.ic2.thread_imagelink'] && $_conf['expack.ic2.thread_imagecount']) {
echo <<<EOP
<script type="text/javascript" src="js/ic2_getcount.js?{$_conf['p2_version_id']}"></script>
EOP;
$onload_script .= <<<EOHEADER
window.setWindowOnLoad(ic2_setcount_new);
EOHEADER;
}
// pageLoaded()が他のJavaScriptでも定義されたロード時のイベントハンドラとかぶらないようにする。
// 古いブラウザでDOMContentLoadedと同等のタイミングにはこだわらない。
// rep2はフレーム前提なのでjQuery.bindReady()のような技は使えない(ぽい)。
echo <<<EOHEADER
<script type="text/javascript">
//<![CDATA[
gIsPageLoaded = false;
function pageLoaded()
{
gIsPageLoaded = true;
{$onload_script}
setWinTitle();
}
(function(){
if (typeof window.p2BindReady == 'undefined') {
window.setTimeout(arguments.callee, 100);
} else {
window.p2BindReady(pageLoaded, 'js/defer/pageLoaded.js');
}
})();
//]]>
</script>\n
EOHEADER;
echo <<<EOP
</head>
<body{$bodyadd}><div id="popUpContainer"></div>\n
EOP;
echo $_info_msg_ht;
$_info_msg_ht = "";
//echo $ptitle_ht."<br>";
//==============================================================
// それぞれの行解析
//==============================================================
$linesize = sizeof($lines);
$subject_txts = array();
for ($x = 0; $x < $linesize ; $x++) {
if (isset($GLOBALS['rnum_all_range']) and $GLOBALS['rnum_all_range'] <= 0) {
break;
}
$l = $lines[$x];
$aThread = new ThreadRead();
$aThread->torder = $x + 1;
// データ読み込み
// spmodeなら
if ($aThreadList->spmode) {
switch ($aThreadList->spmode) {
case "recent": // 履歴
$aThread->getThreadInfoFromExtIdxLine($l);
break;
case "res_hist": // 書き込み履歴
$aThread->getThreadInfoFromExtIdxLine($l);
break;
case "fav": // お気に
$aThread->getThreadInfoFromExtIdxLine($l);
break;
case "taborn": // スレッドあぼーん
$aThread->getThreadInfoFromExtIdxLine($l);
$aThread->host = $aThreadList->host;
$aThread->bbs = $aThreadList->bbs;
break;
case "palace": // スレの殿堂
$aThread->getThreadInfoFromExtIdxLine($l);
break;
case "merge_favita": // お気に板をマージ
if ($have_merged_faivta_read_idx) {
$aThread->getThreadInfoFromExtIdxLine($l);
} else {
$aThread->key = $l['key'];
$aThread->setTtitle($l['ttitle']);
$aThread->rescount = $l['rescount'];
$aThread->host = $l['host'];
$aThread->bbs = $l['bbs'];
$aThread->torder = $l['torder'];
}
break;
}
// subject (not spmode)の場合
} else {
$aThread->getThreadInfoFromSubjectTxtLine($l);
$aThread->host = $aThreadList->host;
$aThread->bbs = $aThreadList->bbs;
}
// hostもbbsも不明ならスキップ
if (!($aThread->host && $aThread->bbs)) {
unset($aThread);
continue;
}
$subject_id = $aThread->host . '/' . $aThread->bbs;
$aThread->setThreadPathInfo($aThread->host, $aThread->bbs, $aThread->key);
// 既得スレッドデータをidxから取得
$aThread->getThreadInfoFromIdx();
// 新着のみ(for subject) =========================================
if (!$aThreadList->spmode && $sb_view == 'shinchaku' && empty($_GET['word'])) {
if ($aThread->unum < 1) {
unset($aThread);
continue;
}
}
// スレッドあぼーんチェック =====================================
if ($aThreadList->spmode != 'taborn' && !empty($ta_keys[$aThread->key])) {
unset($ta_keys[$aThread->key]);
continue; // あぼーんスレはスキップ
}
// spmode(殿堂入りを除く)なら ====================================
if ($aThreadList->spmode && $sb_view != "edit") {
// subject.txt が未DLなら落としてデータを配列に格納
if (empty($subject_txts[$subject_id])) {
if (!class_exists('SubjectTxt', false)) {
require P2_LIB_DIR . '/SubjectTxt.php';
}
$aSubjectTxt = new SubjectTxt($aThread->host, $aThread->bbs);
$subject_txts[$subject_id] = $aSubjectTxt->subject_lines;
}
// スレ情報取得 =============================
if (!empty($subject_txts[$subject_id])) {
$thread_key = (string)$aThread->key;
$thread_key_len = strlen($thread_key);
foreach ($subject_txts[$subject_id] as $l) {
if (strncmp($l, $thread_key, $thread_key_len) == 0) {
$aThread->getThreadInfoFromSubjectTxtLine($l); // subject.txt からスレ情報取得
break;
}
}
}
// 新着のみ(for spmode) ===============================
if ($sb_view == 'shinchaku' && empty($_GET['word'])) {
if ($aThread->unum < 1) {
unset($aThread);
continue;
}
}
}
if ($aThread->isonline) { $online_num++; } // 生存数set
echo $_info_msg_ht;
$_info_msg_ht = '';
if (P2_READ_NEW_SAVE_MEMORY) {
fwrite($read_new_tmp_fh, ob_get_flush());
} else {
$read_new_html .= ob_get_flush();
}
ob_start();
if (($aThread->readnum < 1) || $aThread->unum) {
if ($_conf['expack.ic2.enabled'] && $_conf['expack.ic2.thread_imagelink'] && $_conf['expack.ic2.thread_imagecount']) {
$threads[] = array($aThread->ttitle, $aThread->keydat);
}
readNew($aThread);
} elseif ($aThread->diedat) {
echo $aThread->getdat_error_msg_ht;
echo "<hr>\n";
}
if (P2_READ_NEW_SAVE_MEMORY) {
fwrite($read_new_tmp_fh, ob_get_flush());
} else {
$read_new_html .= ob_get_flush();
}
ob_start();
// リストに追加 ========================================
// $aThreadList->addThread($aThread);
$aThreadList->num++;
unset($aThread);
}
// IC2画像数をセットするJS
if ($_conf['expack.ic2.enabled'] && $_conf['expack.ic2.thread_imagelink'] && $_conf['expack.ic2.thread_imagecount']) {
$ic2_count_js = '';
if (is_array($threads)) {
foreach ($threads as $_ttitle) {
list($_ttl, $_kdat) = $_ttitle;
$spanid = 'ic2_count_' . sprintf('%u', crc32($_kdat));
$ic2_count_js .= "ic2_setcount('" . rawurlencode($_ttl) .
"', '{$spanid}');";
}
}
echo <<<EOP
<script type="text/javascript">
function ic2_setcount_new() {
{$ic2_count_js}
return;
}
</script>
EOP;
}
// $aThread = new ThreadRead();
//======================================================================
// スレッドの新着部分を読み込んで表示する
//======================================================================
function readNew($aThread)
{
global $_conf, $newthre_num, $STYLE;
global $_info_msg_ht, $sid_q, $word;
static $favlist_titles = null;
if ($_conf['expack.misc.multi_favs'] && is_null($favlist_titles)) {
$favlist_titles = FavSetManager::getFavSetTitles('m_favlist_set');
if (empty($favlist_titles)) {
$favlist_titles = array();
}
if (!isset($favlist_titles[0]) || $favlist_titles[0] == '') {
$favlist_titles[0] = 'お気にスレ';
}
for ($i = 1; $i <= $_conf['expack.misc.favset_num']; $i++) {
if (!isset($favlist_titles[$i]) || $favlist_titles[$i] == '') {
$favlist_titles[$i] = 'お気にスレ' . $i;
}
}
}
$newthre_num++;
//==========================================================
// idxの読み込み
//==========================================================
// hostを分解してidxファイルのパスを求める
$aThread->setThreadPathInfo($aThread->host, $aThread->bbs, $aThread->key);
// FileCtl::mkdir_for($aThread->keyidx); // 板ディレクトリが無ければ作る // この操作はおそらく不要
$aThread->itaj = P2Util::getItaName($aThread->host, $aThread->bbs);
if (!$aThread->itaj) { $aThread->itaj = $aThread->bbs; }
// idxファイルがあれば読み込む
if ($lines = FileCtl::file_read_lines($aThread->keyidx, FILE_IGNORE_NEW_LINES)) {
$data = explode('<>', $lines[0]);
} else {
$data = array_fill(0, 12, '');
}
$aThread->getThreadInfoFromIdx();
//==================================================================
// DATのダウンロード
//==================================================================
if (!($word and file_exists($aThread->keydat))) {
$aThread->downloadDat();
}
// DATを読み込み
$aThread->readDat();
$aThread->setTitleFromLocal(); // ローカルからタイトルを取得して設定
//===========================================================
// 表示レス番の範囲を設定
//===========================================================
// 取得済みなら
if ($aThread->isKitoku()) {
$from_num = $aThread->readnum +1 - $_conf['respointer'] - $_conf['before_respointer_new'];
if ($from_num > $aThread->rescount) {
$from_num = $aThread->rescount - $_conf['respointer'] - $_conf['before_respointer_new'];
}
if ($from_num < 1) {
$from_num = 1;
}
//if (!$aThread->ls) {
$aThread->ls = "$from_num-";
//}
}
$aThread->lsToPoint();
//==================================================================
// ヘッダ 表示
//==================================================================
$motothre_url = $aThread->getMotoThread();
$ttitle_en = base64_encode($aThread->ttitle);
$ttitle_urlen = rawurlencode($ttitle_en);
$ttitle_en_q ="&ttitle_en=".$ttitle_urlen;
$bbs_q = "&bbs=".$aThread->bbs;
$key_q = "&key=".$aThread->key;
$popup_q = "&popup=1";
// require_once P2_LIB_DIR . '/read_header.inc.php';
$prev_thre_num = $newthre_num - 1;
$next_thre_num = $newthre_num + 1;
if ($prev_thre_num != 0) {
$prev_thre_ht = "<a href=\"#ntt{$prev_thre_num}\">▲</a>";
} else {
$prev_thre_ht = '';
}
$next_thre_ht = "<a id=\"ntta{$next_thre_num}\" href=\"#ntt{$next_thre_num}\">▼</a>";
echo $_info_msg_ht;
$_info_msg_ht = "";
// ヘッダ部分HTML
$read_header_ht = <<<EOP
<table id="ntt{$newthre_num}" width="100%" style="padding:0px 10px 0px 0px;">
<tr>
<td align="left"><h3 class="thread_title">{$aThread->ttitle_hd}</h3></td>
<td align="right">{$prev_thre_ht} {$next_thre_ht}</td>
</tr>
</table>\n
EOP;
//==================================================================
// ローカルDatを読み込んでHTML表示
//==================================================================
$aThread->resrange['nofirst'] = true;
$GLOBALS['newres_to_show_flag'] = false;
if ($aThread->rescount) {
$aShowThread = new ShowThreadPc($aThread, true);
if ($_conf['expack.spm.enabled']) {
$read_header_ht .= $aShowThread->getSpmObjJs();
}
$res1 = $aShowThread->quoteOne();
$read_cont_ht = $res1['q'];
$read_cont_ht .= $aShowThread->getDatToHtml();
// レス追跡カラー
if ($_conf['backlink_coloring_track']) {
$read_cont_ht .= $aShowThread->getResColorJs();
}
// IDカラーリング
if ($_conf['coloredid.enable'] > 0 && $_conf['coloredid.click'] > 0) {
$read_header_ht .= $aShowThread->getIdColorJs();
}
unset($aShowThread);
}
//==================================================================
// フッタ 表示
//==================================================================
// $read_footer_navi_new 続きを読む 新着レスの表示
$newtime = date("gis"); // リンクをクリックしても再読込しない仕様に対抗するダミークエリー
$info_st = "情報";
$delete_st = "削除";
$prev_st = "前";
$next_st = "次";
$read_footer_navi_new = "<a href=\"{$_conf['read_php']}?host={$aThread->host}{$bbs_q}{$key_q}&ls={$aThread->rescount}-&nt=$newtime#r{$aThread->rescount}\">新着レスの表示</a>";
if (!empty($_conf['disable_res'])) {
$dores_ht = <<<EOP
<a href="{$motothre_url}" target="_blank">レス</a>
EOP;
} else {
$dores_ht = <<<EOP
<a href="post_form.php?host={$aThread->host}{$bbs_q}{$key_q}&rescount={$aThread->rescount}{$ttitle_en_q}" target='_self' onclick="return OpenSubWin('post_form.php?host={$aThread->host}{$bbs_q}{$key_q}&rescount={$aThread->rescount}{$ttitle_en_q}{$popup_q}&from_read_new=1{$sid_q}',{$STYLE['post_pop_size']},1,0)">レス</a>
EOP;
}
// ツールバー部分HTML =======
// お気にマーク設定
$itaj_hd = htmlspecialchars($aThread->itaj, ENT_QUOTES);
$similar_q = '&itaj_en=' . rawurlencode(base64_encode($aThread->itaj)) . '&method=similar&word=' . rawurlencode($aThread->ttitle_hc);
if ($_conf['expack.misc.multi_favs']) {
$toolbar_setfav_ht = 'お気に[';
$favdo = (!empty($aThread->favs[0])) ? 0 : 1;
$favdo_q = '&setfav=' . $favdo;
$favmark = $favdo ? '+' : '★';
$favtitle = $favlist_titles[0] . ($favdo ? 'に追加' : 'から外す');
$setnum_q = '&setnum=0';
$toolbar_setfav_ht .= <<<EOP
<span class="favdo set0"><a href="info.php?host={$aThread->host}{$bbs_q}{$key_q}{$ttitle_en_q}{$favdo_q}{$setnum_q}{$sid_q}" target="info" onclick="return setFavJs('host={$aThread->host}{$bbs_q}{$key_q}{$ttitle_en_q}{$sid_q}', '{$favdo}', {$STYLE['info_pop_size']}, 'read_new', this, '0');" title="{$favtitle}">{$favmark}</a></span>
EOP;
for ($i = 1; $i <= $_conf['expack.misc.favset_num']; $i++) {
$favdo = (!empty($aThread->favs[$i])) ? 0 : 1;
$favdo_q = '&setfav=' . $favdo;
$favmark = $favdo ? $i : '★';
$favtitle = $favlist_titles[$i] . ($favdo ? 'に追加' : 'から外す');
$setnum_q = '&setnum=' . $i;
$toolbar_setfav_ht .= <<<EOP
|<span class="favdo set{$i}"><a href="info.php?host={$aThread->host}{$bbs_q}{$key_q}{$ttitle_en_q}{$favdo_q}{$setnum_q}{$sid_q}" target="info" onclick="return setFavJs('host={$aThread->host}{$bbs_q}{$key_q}{$ttitle_en_q}{$sid_q}', '{$favdo}', {$STYLE['info_pop_size']}, 'read_new', this, '{$i}');" title="{$favtitle}">{$favmark}</a></span>
EOP;
}
$toolbar_setfav_ht .= ']';
} else {
$favdo = (!empty($aThread->fav)) ? 0 : 1;
$favdo_q = '&setfav=' . $favdo;
$favmark = $favdo ? '+' : '★';
$favtitle = $favdo ? 'お気にスレに追加' : 'お気にスレから外す';
$toolbar_setfav_ht = <<<EOP
<span class="favdo"><a href="info.php?host={$aThread->host}{$bbs_q}{$key_q}{$ttitle_en_q}{$favdo_q}{$sid_q}" target="info" onclick="return setFavJs('host={$aThread->host}{$bbs_q}{$key_q}{$ttitle_en_q}{$sid_q}', '{$favdo}', {$STYLE['info_pop_size']}, 'read_new', this, '0');" title="{$favtitle}">お気に{$favmark}</a></span>
EOP;
}
$toolbar_right_ht = <<<EOTOOLBAR
<a href="{$_conf['subject_php']}?host={$aThread->host}{$bbs_q}{$key_q}" target="subject" title="板を開く">{$itaj_hd}</a>
<a href="info.php?host={$aThread->host}{$bbs_q}{$key_q}{$ttitle_en_q}{$sid_q}" target="info" onclick="return OpenSubWin('info.php?host={$aThread->host}{$bbs_q}{$key_q}{$ttitle_en_q}{$popup_q}{$sid_q}',{$STYLE['info_pop_size']},1,0)" title="スレッド情報を表示">{$info_st}</a>
{$toolbar_setfav_ht}
<span><a href="info.php?host={$aThread->host}{$bbs_q}{$key_q}{$ttitle_en_q}&dele=true" target="info" onclick="return deleLog('host={$aThread->host}{$bbs_q}{$key_q}{$ttitle_en_q}{$sid_q}', {$STYLE['info_pop_size']}, 'read_new', this);" title="ログを削除する">{$delete_st}</a></span>
<!-- <a href="info.php?host={$aThread->host}{$bbs_q}{$key_q}{$ttitle_en_q}&taborn=2" target="info" onclick="return OpenSubWin('info.php?host={$aThread->host}{$bbs_q}&key={$aThread->key}{$ttitle_en_q}&popup=2&taborn=2{$sid_q}',{$STYLE['info_pop_size']},0,0)" title="スレッドのあぼーん状態をトグルする">あぼん</a> -->
<a href="{$motothre_url}" title="板サーバ上のオリジナルスレを表示">元スレ</a>
<a href="{$_conf['subject_php']}?host={$aThread->host}{$bbs_q}{$key_q}{$similar_q}" target="subject" title="タイトルが似ているスレッドを検索">似スレ</a>
EOTOOLBAR;
// レスのすばやさ
$spd_ht = "";
if ($spd_st = $aThread->getTimePerRes() and $spd_st != "-") {
$spd_ht = '<span class="spd" title="すばやさ=時間/レス">'."" . $spd_st."".'</span>';
}
// datサイズ
if (file_exists($aThread->keydat) && $dsize_ht = filesize($aThread->keydat)) {
$dsize_ht = sprintf('<span class="spd" title="%s">%01.1fKB</span> |', 'datサイズ', $dsize_ht / 1024);
} else {
$dsize_ht = '';
}
// IC2リンク、件数
if ($_conf['expack.ic2.enabled'] && $_conf['expack.ic2.thread_imagelink']) {
$spanid = 'ic2_count_' . sprintf('%u', crc32($aThread->keydat));
$ic2navi = '<a href="iv2.php?field=memo&key=' .
rawurlencode($aThread->ttitle) .
'" target="_blank">キャッシュ画像' .
($_conf['expack.ic2.thread_imagecount'] ?
'<span id="ic2_count_' .
sprintf('%u', crc32($aThread->keydat)) .
'"></span>' : '') .
'</a>';
}
// フッタ部分HTML
$read_footer_ht = <<<EOP
<table width="100%" style="padding:0px 10px 0px 0px;">
<tr>
<td align="left">
{$res1['body']} | <a href="{$_conf['read_php']}?host={$aThread->host}{$bbs_q}{$key_q}&offline=1&rescount={$aThread->rescount}#r{$aThread->rescount}">{$aThread->ttitle_hd}</a> | {$dores_ht} {$dsize_ht} {$spd_ht}
</td>
<td align="right">
{$ic2navi}{$toolbar_right_ht}
</td>
<td align="right">
<a href="#ntt{$newthre_num}">▲</a>
</td>
</tr>
</table>\n
EOP;
// 透明あぼーんで表示がない場合はスキップ
if ($GLOBALS['newres_to_show_flag']) {
echo '<div style="width:100%;">'."\n"; // ほぼIE ActiveXのGray()のためだけに囲ってある
echo $read_header_ht;
echo $read_cont_ht;
echo $read_footer_ht;
echo '</div>'."\n\n";
echo '<hr>'."\n\n";
}
//==================================================================
// key.idx の値設定
//==================================================================
if ($aThread->rescount) {
$aThread->readnum = min($aThread->rescount, max(0, $data[5], $aThread->resrange['to']));
$newline = $aThread->readnum + 1; // $newlineは廃止予定だが、旧互換用に念のため
$sar = array($aThread->ttitle, $aThread->key, $data[2], $aThread->rescount, $aThread->modified,
$aThread->readnum, $data[6], $data[7], $data[8], $newline,
$data[10], $data[11], $aThread->datochiok);
P2Util::recKeyIdx($aThread->keyidx, $sar); // key.idxに記録
}
}
//==================================================================
// ページフッタ表示
//==================================================================
$newthre_num++;
if (!$aThreadList->num) {
$GLOBALS['matome_naipo'] = TRUE;
echo "新着レスはないぽ";
echo "<hr>";
}
$shinchaku_matome_url = "{$_conf['read_new_php']}?host={$aThreadList->host}&bbs={$aThreadList->bbs}&spmode={$aThreadList->spmode}&nt={$newtime}";
if ($aThreadList->spmode == 'merge_favita') {
$shinchaku_matome_url .= $_conf['m_favita_set_at_a'];
}
if (!isset($GLOBALS['rnum_all_range']) or $GLOBALS['rnum_all_range'] > 0 or !empty($GLOBALS['limit_to_eq_to'])) {
if (!empty($GLOBALS['limit_to_eq_to'])) {
$str = '新着まとめ読みの更新/続き';
} else {
$str = '新着まとめ読みを更新';
}
} else {
$str = '新着まとめ読みの続き';
$shinchaku_matome_url .= '&norefresh=1';
}
echo <<<EOP
<div id="ntt{$newthre_num}" align="center">{$sb_ht} の <a href="{$shinchaku_matome_url}">{$str}</a></div>\n
EOP;
if ($_conf['expack.ic2.enabled']) {
echo "<script type=\"text/javascript\" src=\"js/ic2_popinfo.js\"></script>";
include P2EX_LIB_DIR . '/ic2/templates/info.tpl.html';
}
echo '</body></html>';
if (P2_READ_NEW_SAVE_MEMORY) {
fwrite($read_new_tmp_fh, ob_get_flush());
} else {
$read_new_html .= ob_get_flush();
}
// NGあぼーんを記録
NgAbornCtl::saveNgAborns();
/*
* 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: