rtoss - Blame information for rev 5

Subversion Repositories:
Rev:
Rev Author Line No. Line
5 roytam 1 <?php
2 require_once "./conf.php";
3 require_once "./bb2html.php";
4 require_once "./lib_pte.php";
5  
6 $arg = array();
7  
8 $arg['main'] = true;
9  
10 $arg['dir_path'] = $dir_path;
11 $arg['tit'] = $tit;
12 $arg['rmes'] = $rmes;
13 $arg['tmes'] = $tmes;
14 $arg['kanban'] = $kanban;
15 $arg['pc_index'] = $pc_index;
16 $arg['NIch_index'] = $NIch_index;
17 $arg['read_def'] = $read_def;
18 // スレ読み込み
19 $subject = @file($subj_file);
20 $sub_num = sizeof($subject);
21  
22 $st = 0;
23 $page = 1;
24 // ヘッドライン
25 $headto = ($thre_def < count($subject)) ? $thre_def : count($subject);
26 $n = 1;
27 for($h = $st;$h < $headto;$h++, $n++) {
28 list($kdate, $title1) = explode(",", $subject[$h]);
29 list($kdate,) = explode(".", $kdate);
30 $title = "";
31 $hno = $h + 1;
32 // $resnum = chop($resnum);
33 // if(strlen($title1) > $thre_cut) $title = substr($title1,0,$thre_cut) ."..";
34 // else
35 $title = trim($title1);
36 $tr = ($n % 3 == 0) ? true : false;
37 if ($hno <= ($page - 1) * $page_def + $page_def) {
38 $arg['head'][] = array('title' => $title, 'key' => $kdate, 'no' => $hno, 'tr' => $tr);
39 } else {
40 $arg['over'][] = array('title' => $title, 'key' => $kdate, 'no' => $hno, 'tr' => $tr);
41 }
42 }
43 // メインループ
44 for($i = $st;$i < $st + $page_def;$i++) {
45 $res = array(); $skip=0; $stopped=0;
46 if ($subject[$i] == "") break;
47 list($key_dat, $title) = explode(",", $subject[$i]);
48 list($key,) = explode(".", $key_dat);
49 $logfile = $ddir . $key_dat;
50 if (!file_exists($logfile)) $main .= "ファイルが見つかりません";
51 if (!is_writable($logfile)) $stopped = 1;
52 $log = file($logfile);
53 $resnum = count($log);
54 list($fname, $femail, $fdate, $fcom, $fsub, $fhost) = explode(",", $log[0]); //親
55 $no = $i + 1;
56 $next = $no + 1;
57 $prev = $no - 1;
58 $fcom = bb2html($fcom);
59 $fmaillink = ($femail != "") ? true : false;
60 /* レス */
61 if ($resnum > $res_def) {
62 $rst = $resnum - $res_def + 1;
63 $skip = $rst - 2;
64 } else {
65 $rst = 2;
66 }
67 for($j = $rst;$j <= $resnum; $j++) {
68 $over = false;$show = true;
69 if ($log[$j-1] == "") break;
70 list($name, $email, $now, $com, , $host) = explode(",", $log[$j-1]);
71 if($taborn > 1 && $now == $aborn) $show = false;
72 if($taborn > 0 && $now == $aborn && trim($com) == $aborn) $show = false;
73 if (substr_count($com, "<br>") > $viewline) {
74 $comarr = explode("<br>", $com);
75 $com = "";
76 for($br = 0; $br < $viewline; $br++) { // 投稿行数オーバー
77 $com .= $comarr[$br] . "<br>";
78 }
79 $over = true;
80 }
81 if (strlen($com) > $viewbyte) { // 投稿文字数オーバー
82 $com = substr($com, 0, $viewbyte) . "...";
83 $over = true;
84 }
85 $com = bb2html($com);
86 $maillink = ($email != "") ? true : false;
87 // レスHTML
88 $resarr = compact('name', 'email', 'now', 'com', 'host', 'maillink', 'over', 'show', 'key');
89 $resarr['no'] = $j;
90 $res[] = $resarr;
91 }
92 // メインHTML
93 $oya = compact('fname', 'femail', 'fdate', 'fcom', 'fsub', 'fhost', 'fmaillink', 'next', 'prev', 'no', 'key', 'resnum', 'skip', 'res', 'stopped');
94 $arg['oya'][] = $oya;
95 }
96  
97 function outputHTML($skin,$file,$args) {
98 $PTE=new PTELibrary($skin);
99 $tmp_html=$PTE->ParseBlock('MAIN',$args);
100 $fp = fopen($file, "w") or error("Cannot open Index file $file");
101 fputs($fp, $tmp_html);
102 fclose($fp);
103 @chmod($file,0666);
104 }
105  
106 $pteargs=toPTEargs($arg);
107  
108 outputHTML($bbs_skin_mb,$mb_index,toPTEargs($arg,$utf82sjis));
109 outputHTML($bbs_skin_pc,$pc_index, $pteargs);
110 outputHTML($NIch_skin_pc,$NIch_index,$pteargs);
111  
112 // header("Location: index.html");
113  
114 ?>