関連ツリー\n"; $n_tree_to = "
\n"; //ツリー一括時ツリー開始・終了タグ $all_tree_st = "
No.{id}に関するツリー"; $all_tree_to = "
\n"; class tree{ var $logarr = array(); var $id = array(); var $thread = array(); var $root = array(); var $tree_arr = array(); var $mode = ""; var $error = ""; /* 設定ここから */ // ツリー記号 var $i_gif = "│"; var $t_gif = "├"; var $l_gif = "└"; var $nogif = " "; // ログファイル名 var $logfile = "/home/inet/keiba/bbsdata/all.log"; // ログ最大行 var $max_log = 200; // 過去ログファイル名(まだ・・ var $pastfile = "/home/inet/keiba/bbsdata/all.past"; // コメント最大行 var $max_line = 25; // 連続投稿制限秒 var $renzoku = 10; // 最新?時間内の投稿にNew記号 var $expire = 24; // ツリーの深さ制限 var $max_depth = 35; // ツリー時の一行表示文字数(記号+題名+文字を半角で) var $cut_size = 70; // 許可するタグ(本文のみ) var $allow_tag = "

"; // 禁止する文字(**に変換) var $bad_word = "死ね|氏ね"; // >がついた時の色 var $quote = "#aaaaaa"; // 投稿があると管理人にメールで通知する場合のアドレス(不要なら空) var $adm_mail = ""; // 管理人に来るメールのsubject({id},{subj}使用可) var $adm_subj = "[BBS-{id} {subj} ]"; // 表示件数の初期状態 var $page_tree = 10; var $page_expn = 5; var $page_root = 15; var $page_dump = 20; // クッキー保存名 var $cookie_n = "treebbs_cookie"; var $cookie_s = "treebbs_setting"; // ヘッダ部分 var $head = ' 無料競馬ゲーム「inet-keiba」なんでも掲示板

なんでも掲示板

'; /** 変数説明 * {id}-記事No {subj}-題名 {name}-投稿者 {date}-投稿日 {com}-本文 {host}-ホスト {time}-投稿time * {n}-単独記事表示リンク {all}-ツリー一覧表示リンク {reply}-返信リンク {nl}で\n(''で囲った時用) * {new}で新着$new_msg表示 {email}で以下の$if_email文字にリンク {url}で以下の$if_url文字にリンク */ // タイトル表示ヘッダ var $root_head = "
\n"; // タイトル表示本文 var $root_msg = "\n"; // タイトル表示フッタ var $root_foot = "
No.タイトル投稿者レス投稿日
{id}{subj}{name}{res}{date}

\n"; // ツリー表示ヘッダ var $tree_head = "
"; // ツリー表示親記事 var $tree_oya = "
-{subj} [{name}] ({date}) {new}"; // ツリー表示子記事 var $tree_res = "{subj} [{name}] ({date}) {new}"; // ツリー表示フッタ var $tree_foot = "

\n"; // 展開表示親記事 var $expn_oya = "
[{id}] {subj}
Name: {name}
Date: {date}
{com}
    \n"; // 展開表示子記事 var $expn_res = "
    [{id}] {subj}
    Name: {name} {url}
    Date: {date}
    {com}
    \n"; // 展開表示テーブル閉じ var $expn_bott = "

\n"; // 一覧・単独表示 var $dump_msg = "
[{id}] {subj}
Name: {name} {url}
Date: {date}
{com}

返信する

\n"; // フッタ部分 var $foot = "\n
"; // 新着記事記号 var $new_msg = "New!"; // E-Mailがあるとき{email}のリンク文字(空なら名前にリンク) var $if_email = ""; // URLがあるとき{url}のリンク文字 var $if_url = "(HOME)"; /*** * コンストラクタ * */ function tree($mode){ global ${$this->cookie_s}; $this->mode = "tree"; if(${$this->cookie_s}){ list($view,$pagetree,$pageexpn,$pageroot,$pagedump)=explode(",",${$this->cookie_s}); $this->mode = $view; $this->page_tree = $pagetree; $this->page_expn = $pageexpn; $this->page_root = $pageroot; $this->page_dump = $pagedump; } if($mode) $this->mode = $mode; $this->logarr = file($this->logfile); } /*** * なびめにゅう表示 * */ function show_navi(){ global $PHP_SELF,$all,$n; $form = ($this->mode == "form" && !$all && !$n) ? "新規投稿" : "
新規投稿"; $tree = ($this->mode == "tree" && !$all && !$n) ? "ツリー" : "ツリー"; $expn = ($this->mode == "expn" && !$all && !$n) ? "スレッド" : "スレッド"; $root = ($this->mode == "root" && !$all && !$n) ? "タイトル" : "タイトル"; $dump = ($this->mode == "dump" && !$all && !$n) ? "一覧" : "一覧"; $search = ($this->mode == "search") ? "検索" : "検索"; $setup = ($this->mode == "setup") ? "設定" : "設定"; $html = "
 ${form} | ${tree} | ${expn} | ${root} | ${dump} | ${search} | ${setup} 

\n"; return $html; } /*** * 改ページ表示 * */ function show_jump($offset, $limit, $total){ global $PHP_SELF; $num_page = ceil($total/$limit); $prev = $offset - 1; $next = $offset + 1; if($prev >= 1){ $prev_st = ""; $prev_to = ""; } if($next <= $num_page){ $next_st = ""; $next_to =""; } $html.= "
[ ${prev_st}前の $limit 件${prev_to} | ${offset} /${num_page}ページ | ${next_st}次の $limit 件${next_to} ]
\n"; return $html; } /*** * ヘッドライン表示 * */ function show_headline($offset,$limit){ global $PHP_SELF; $st = ($offset-1) * $limit; if($st < 0) $st = 0; $html = "
"; for($i = $st; $i < $st+$limit*5; $i++){ $id = $this->root[$i]; if(!$id) continue; $resc = 0; foreach($this->thread[$id] as $kidno){ $resc += count($kidno); } list(,,,$subj,) = explode("\t", $this->id[$id]); if($i < $st+$limit) $html.= "".$id.": ".$subj."(".$resc.") \n"; else $html.= "".$id.": ".$subj."(".count($this->thread[$id]).") "; } $html.= "

\n"; return $html; } /*** * 投稿フォーム表示 * */ function show_form($root=0, $oya=0, $subj='', $com='', $inyo=0){ global $PHP_AUTH_USER,$PHP_SELF,$n,${$this->cookie_n}; if(ereg("Re\[([0-9]+)\]:", $subj, $reg)){ $reg[1]++; $r_sub=ereg_replace("Re\[([0-9]+)\]:", "Re[$reg[1]]:", $subj); }elseif(ereg("^Re:", $subj)){ $r_sub=ereg_replace("^Re:", "Re[2]:", $subj); }elseif($subj){ $r_sub = "Re:$subj"; } if($com){ $r_com = ">$com"; // $r_com = str_replace('\\', '\\\\', $r_com); $r_com = str_replace("'", "\'", $r_com); $r_com = str_replace(">", ">", $r_com); $r_com = str_replace("<", "<", $r_com); $r_com = eregi_replace("", "
", $r_com); } list($c_name,$c_email,$c_url,$c_pass) = explode(",", stripslashes(${$this->cookie_n})); if($this->allow_tag) $tag = "タグ使用可 ".htmlspecialchars($this->allow_tag); $html.= ' '; $html.= "
 "; $html.= ($root) ? "返信フォーム [引用]" : "新規投稿フォーム"; $html.= "

 名前 $PHP_AUTH_USER
 E-Mail
 題名 *
 URL
 Pass $tag
レスが付けば上記のEmailアドレスにメールで知らせる

"; return $html; } /*** * 検索フォーム表示 * */ function show_search($word){ global $PHP_SELF; $html = "
[ 記事検索 ]



"; return $html; } /*** * 設定フォーム表示 * */ function show_setup(){ global $PHP_SELF,${$this->cookie_s}; list($view,) = explode(",", ${$this->cookie_s}); $$view = " selected"; if(!$view) $tree = " selected"; $html = "
[ 環境設定 ]

デフォルトの表示モード

ツリー表示時の1ページの表示数 page_tree>
展開表示時の1ページの表示数 page_expn>
タイトル表示時の1ページの表示数 page_root>
一覧表示時の1ページの表示数 page_dump>



"; return $html; } /*** * 削除フォーム * */ function show_del($n){ global $PHP_SELF,${$this->cookie_n}; list(,,,$pass) = explode(",", ${$this->cookie_n}); $html = "
Pass
"; return $html; } /*** * ログを配列に * */ function get_arr(){ for($i = 0; $i < count($this->logarr); $i++){ //記事番号\t親記事番号\t根記事番号 list($id, $oya, $root,) = explode("\t", $this->logarr[$i]); //$this->id : 記事番号をキーにしたログデータ配列 $this->id[$id] = $this->logarr[$i]; //$this->thread : スレッド構造の配列。値は記事番号 $this->thread[$root][$oya][] = $id; //$this->root : 根記事のみの配列。ログ順 if($oya==0) $this->root[] = $id; } //print_r($this->thread); } /*** * メインHTML生成処理 * */ function show_main($page){ if(!$page) $page = 1;//最初はページ1 //ヘッダ部分 switch($this->mode){ //タイトルモード case 'root': //ページング生成 $jump = tree::show_jump($page, $this->page_root, count($this->root)); //ヘッダHTML $html = $jump . $this->root_head; //1ページ表示数決定 $page_def = $this->page_root; break; //展開モード case 'expn': $jump = tree::show_jump($page, $this->page_expn, count($this->root)); //ヘッドライン $html = $jump . tree::show_headline($page, $this->page_expn); $page_def = $this->page_expn; break; //ツリーモード case 'tree': $jump = tree::show_jump($page, $this->page_tree, count($this->root)); $html = $jump . $this->tree_head; $page_def = $this->page_tree; break; //一覧モード case 'dump': $jump = tree::show_jump($page, $this->page_dump, count($this->id)); $html = $jump; //最新番号取得 list($st,) = explode("\t", $this->logarr[0]); //データ開始位置 $st = ($page) ? $st - ($page-1) * $this->page_dump : $st; //最新記事順に表示 for($i = $st; $i > $st-$this->page_dump; $i--){ $html.= tree::show_msg($i, $this->mode); } //フッタ表示で終了 $html.= "
" . $jump; return $html; break; } //データ開始位置 $st = ($page) ? ($page-1) * $page_def : 0; //親記事番号でループ for($i = $st; $i < $st+$page_def; $i++){ if($this->root[$i]=="") continue; switch($this->mode){ //タイトルモード case 'root': $html.= tree::show_msg($this->root[$i], 'root'); break; //展開モード case 'expn': //ツリー構造を初期化 $this->tree_arr = array(); //ツリー生成 tree::make_tree($this->root[$i]); //ツリー順に表示 foreach($this->tree_arr as $val){ $html.= tree::show_msg($val[0], 'expn'); } //テーブル閉じ $html.= $this->expn_bott; break; //ツリーモード case 'tree': $this->tree_arr = array(); tree::make_tree($this->root[$i]); foreach($this->tree_arr as $val){ $html.= tree::show_msg($val[0], 'tree', $val[1]); } break; } } //フッタ部分 switch($this->mode){ case 'root': $html.= $this->root_foot; break; case 'tree': $html.= $this->tree_foot; break; } //ページング表示 $html.= $jump; return $html; } /*** * ツリーの生成、並び替え * */ function make_tree($id, $oya=0, $pre="", $img=""){ //前ツリーがLならその下は空 if($img == $this->l_gif) $pre.= $this->nogif; //前ツリーがTならその下はI if($img == $this->t_gif) $pre.= $this->i_gif; //ツリー構造なら if(is_array($this->thread[$id][$oya])){ foreach($this->thread[$id][$oya] as $no){ //下ツリーがあればT記号終わってればL記号 $img = (next($this->thread[$id][$oya])) ? $this->t_gif : $this->l_gif; //子記事は後ろに送る $no = ($oya==0) ? array_shift($this->thread[$id][$oya]) : array_pop($this->thread[$id][$oya]); //ツリー構造と記号を配列に $this->tree_arr[] = array($no,"$pre$img"); //再帰 tree::make_tree($id,$no,$pre,$img); } return true; }else{ return false; } } /*** * HTML生成・テンプレ置換 * */ function show_msg($no, $mode="", $mark=""){ global $PHP_SELF,$all,$n; if(!$this->id[$no]) return false; list($id,$oya,$root,$subj,$name,$email,$date,$com,$url,$tim,$host,) = explode("\t", $this->id[$no]); switch($mode){ case 'root': if($oya == 0) $html = $this->root_msg; foreach($this->thread[$no] as $kidno){ $resc += count($kidno); } $html = str_replace('{res}', "$resc", $html); break; case 'expn': $html = ($oya == 0) ? $this->expn_oya : $this->expn_res; if($email && $this->if_email=="") $html = str_replace('{name}', "{name}", $html); elseif($email) $html = str_replace('{email}', "$this->if_email", $html); else $html = str_replace('{email}', "", $html); break; case 'tree': if($oya == 0){ $html = $this->tree_oya; }else{ $html = $mark . $this->tree_res; } if($id == $n) $html = ereg_replace("(]+)>)([^<]+)()","\\3", $html); if($all) $html = str_replace('{n}', "#$id", $html); if(!$all && !$n && (strlen($name)+strlen($subj)+strlen($mark) > $this->cut_size)){ if(strlen($name) > strlen($subj)){ $name = substr($name, 0, $this->cut_size-strlen($mark)+strlen($subj)) . ".."; }else{ $subj = substr($subj, 0, $this->cut_size-strlen($mark)+strlen($name)) . ".."; } } break; case 'dump': $html = $this->dump_msg; if($email && $this->if_email=="") $html = str_replace('{name}', "{name}", $html); elseif($email) $html = str_replace('{email}', "$this->if_email", $html); else $html = str_replace('{email}', "", $html); if($id == $n) $html = str_replace(''."([^<]+)", "", $html); } if($url) $html = str_replace('{url}',"$this->if_url", $html); else $html = str_replace('{url}', "", $html); // 自動リンク $com = tree::auto_link($com); // >がある時は色変更 $com = ereg_replace("(^|>)(>[^<]*)", "\\1quote>\\2", $com); $html = str_replace('{id}', $id, $html); $html = str_replace('{subj}', $subj, $html); $html = str_replace('{name}', $name, $html); $html = str_replace('{date}', $date, $html); $html = str_replace('{com}', $com, $html); $html = str_replace('{host}', $host, $html); $html = str_replace('{time}', $tim, $html); $html = str_replace('{n}', $PHP_SELF."?n=".$id, $html); $html = str_replace('{all}', $PHP_SELF."?all=".$root, $html); $html = str_replace('{reply}', $PHP_SELF."?n=".$id."#frm", $html); $html = str_replace('{nl}', "\n", $html); if(time() - $tim < $this->expire*3600) $html = str_replace('{new}', $this->new_msg, $html); else $html = str_replace('{new}', "", $html); return $html; } /*** * 書き込み * */ function add_msg($root=0, $oya=0, $name, $email, $subj, $com, $url, $pass, $email_reply){ global $REQUEST_METHOD,$PHP_SELF; if($REQUEST_METHOD != "POST") { $this->error = "不正な投稿をしないで下さい"; return false; } if($url && !ereg("^http://", $url)){ $this->error = "URLはhttp://から記入してください"; return false; } if($email && !ereg(".+@.+\\..+", $email)){ $this->error = "メールアドレスは正しく記入してください"; return false; } if($name=="" || ereg("^( | )*$",$name)){ $this->error = "名前が書き込まれていません"; return false; } if($subj=="" || ereg("^( | )*$",$subj)){ $this->error = "題名が書き込まれていません"; return false; } if($com=="" || ereg("^( | |[\r\n])*$",$com)){ $this->error = "本文が書き込まれていません"; return false; } // 親チェック、深さチェック if($root != 0){ if(!is_array($this->thread[$root])){ $this->error = "返信先の記事が見つかりませんでした"; return false; } if(count($this->thread[$root]) > $this->max_depth){ $this->error = "ツリー階層が深くなりすぎたので
これ以上返信できません"; return false; } } //現在時刻 $tim = time(); // ホスト名を取得 $host = gethostbyaddr(getenv("REMOTE_ADDR")); //同一ホストからの連続投稿禁止 list($lno,,,,$lname,,,$lcom,,$ltime,$lhost,) = explode("\t", $this->logarr[0]); if($this->renzoku && $host==$lhost && $tim - $ltime < $this->renzoku){ $this->error = "連続投稿はもうしばらく時間を置いてからお願い致します"; return false; } //メール用本文 $mailbody = $com; //時間のフォーマット $date = gmdate("m/d H:i",$tim+9*60*60); //url整形 $url = trim($url); $url = ereg_replace("^http://", "", $url); //PW暗号化 $pwd = substr(md5($pass),2,8); //テキスト整形 $subj = tree::CleanStr($subj); $name = tree::CleanStr($name); $email= tree::CleanStr($email); $url = tree::CleanStr($url); $com = tree::CleanStr($com,1); // 改行文字の統一。 $com = str_replace("\r\n", "\n", $com); $com = str_replace("\r", "\n", $com); if(substr_count($com, "\n") > $this->max_line){ $this->error = "コメント行数が長すぎます"; return false; } // 連続する空行を一行・\n→
\n→\n除去 $com = ereg_replace("\n(( | )*\n){3,}","\n",$com); $com = nl2br($com); $com = str_replace("\n", "", $com); // 二重投稿チェック if($name == $lname && $com == $lcom){ $this->error = "二重投稿は禁止です"; return false; } // 新NO、親は自分がroot $no = $lno + 1; if($root == 0) $root = $no; // クッキー保存 $cookvalue = implode(",", array($name,$email,$url,$pass)); setcookie ($this->cookie_n, $cookvalue,time()+14*24*3600); // データフォーマット $new_msg = "$no\t$oya\t$root\t$subj\t$name\t$email\t$date\t$com\t$url\t$tim\t$host\t$pwd\t$email_reply\n"; // 管理人にメール通知 if($this->adm_mail && ereg(".+@.+\\..+", $this->adm_mail)){ $subject = str_replace("{id}", "$no", $this->adm_subj); $subject = str_replace("{subj}", $subj, $subject); $body = "Date: $date\nHost: $host\n"; $body.= "---------------------------------------------\n"; $body.= $mailbody; tree::send_mail($name, $email, $this->adm_mail, $subject, $body); } // 新ログ配列生成 if($oya != 0){ // レスがあったらメール list(,,,,,$o_email,,,,,,,$reply) = explode("\t", $this->id[$oya]); if(rtrim($reply) == "y" && ereg(".+@.+\\..+", $o_email)){ $subject = "[inet-keiba:all]".$no."-".$subj; if (!$email){ $body = "(このメールには返信しないでください。管理人に届きます。)\n"; } $body.= "$name さんからのレス "; $body.= "Date: $date\n"; $body.= "---------------------------------------------\n"; $body.= $mailbody; tree::send_mail($name, $email, $o_email, $subject, $body); } for ($i = 0; $i < count($this->logarr); $i++) { list($id, $oy, $rt) = explode("\t", $this->logarr[$i]); if($root == $rt) $age[] = $this->logarr[$i]; else $buf[] = $this->logarr[$i]; } $this->logarr = array_merge($age, $buf); } array_unshift($this->logarr, $new_msg); // ログ数オーバーは過去ログに書き出す、、だけ if(count($this->logarr) > $this->max_log){ $back = array_pop($this->logarr); $backline[] = $back; list($bid, $boya, $broot) = explode("\t", $back); for ($j = count($this->logarr); $j >= 0; $j--){ list($id, $oy, $root) = explode("\t", $this->logarr[$j]); if($bid == $root){ array_unshift($backline, $this->logarr[$j]); array_pop($this->logarr); } } if(file_exists($this->pastfile)){ $past = file($this->pastfile); $backline = array_merge($backline, $past); } $fp = fopen($this->pastfile, "w"); flock($fp, LOCK_EX); fputs($fp, implode('', $backline)); fclose($fp); } // ログ書き込み $fp = fopen($this->logfile, "w"); flock($fp, LOCK_EX); fputs($fp, implode('', $this->logarr)); fclose($fp); return true; } /*** * タグ・¥除去 * */ function CleanStr($str,$com=0){ //先頭と末尾の空白除去 $str = trim($str); //区切り文字\t変換 $str = str_replace("\t", " ", $str); //¥を削除 if(get_magic_quotes_gpc()){ $str = stripslashes($str); } $str = ereg_replace($this->bad_word, "**", $str); //タグ変換 $str = htmlspecialchars($str); if($this->allow_tag && $com == 1){ //> <戻す $str = str_replace('"', '"', $str); $str = eregi_replace("<([^&]+)>","<\\1>",$str); //許可タグ以外除去 $str = strip_tags($str, $this->allow_tag); } //特殊文字 $str = str_replace("&#", "&#", $str); return $str; } /*** * 削除 * */ function del_msg($id, $pwd){ if(!isset($this->id[$id])){ $this->error = "該当記事が見つかりません"; return false; } list($no,$oya,$root,,,,,,,,,$pass,) = explode("\t", $this->id[$id]); if(substr(md5($pwd),2,8) != $pass){ $this->error = "パスワードが違います"; return false; } $this->id[$id] = "$no\t$oya\t$root\t削除\t-\t-\t-\tこの記事は削除されました\t-\t-\t-\t-\t\n"; $fp = fopen($this->logfile, "w"); flock($fp, LOCK_EX); fputs($fp, implode('', $this->id)); fclose($fp); return true; } /*** * 検索 * */ function search($word, $andor){ if(!isset($word)) return false; $keys = preg_split("/( | )+/", trim($word)); foreach($this->logarr as $line){ $find = FALSE; for($i = 0; $i < count($keys); $i++){ if($keys[$i]=="") continue; if(stristr($line,$keys[$i])){ $find = TRUE; list($id,) = explode("\t", $line); }elseif($andor == "and"){ $find = FALSE; break; } } if($find) $result[] = $id; } if(is_array($result)){ $html.= "
$word の検索結果 ".count($result)."件
\n"; foreach($result as $no){ $html.= tree::show_msg($no, 'dump'); } } return $html; } /*** * メール送信 * */ function send_mail($name, $from, $to, $subject, $body){ if($subject!="") $subject = tree::mime_enc($subject); $body = str_replace("\r\n", "\n", $body); $body = str_replace("\r", "\n", $body); $body = stripslashes($body); $name = tree::mime_enc($name); $froma = ($from) ? "inet-keiba-$name<$from>" : "inet-keiba-$name"; $reply = ($from) ? "inet-keiba-$name<$from>" : "inet-keiba-$name"; $head = "From: $froma\n"; $head.= "Reply-To: $reply\n"; $head.= "Errors-To: inet-keiba@mail.goo.ne.jp\n"; $head.= "X-REF: ".getenv("HTTP_REFERER"); @mail($to, $subject, $body, $head); } /*** * MIMEエンコ * */ function mime_enc($str){ // if(get_magic_quotes_gpc()) $str = stripslashes($str); $encode = "=?iso-2022-jp?B?" . base64_encode($str) . "?="; //Bヘッダ+エンコード return $encode; } /*** * ヘッダ取得 * */ function show_head(){ global $PHP_AUTH_USER; require('../../header.inc'); } /*** * フッタ取得 * */ function show_foot(){ $foot = str_replace("","

レッツPHP!",$this->foot);//消すな return $foot; } /*** * ツリー構造配列取得 * */ function get_tree(){ return $this->tree_arr; } /*** * 指定Noのデータ取得 * */ function get_line($no){ return explode("\t", $this->id[$no]); } /*** * クッキー名取得 * */ function cookie_s(){ return $this->cookie_s; } /*** * オートリンク * */ function auto_link($uri){ $uri = ereg_replace("(^|[^=\"'])(https?|ftp|news)(://[[:alnum:]\+\$\;\?\.%,!#~*/:@&=_-]+)","\\1\\2\\3",$uri); return $uri; } /*** * エラーメッセージ * */ function error_msg($msg='') { if(!$msg) $msg = $this->error; $html = "
[ エラー!! ]

$msg

戻る
\n"; return $html; } } /*-------------メイン------------*/ $d = new tree($mode); $d->get_arr(); if($act == 'post'){ if(!$d->add_msg($st, $re, $name, $email, $sub, $com, $url, $pass, $email_reply)){ echo $d->show_head(); echo $d->error_msg(); echo $d->show_foot(); }else{ echo ""; //header("Location: $PHP_SELF"); } exit; } if($act == 'del'){ if(!$d->del_msg($id, $pwd)){ echo $d->show_head(); echo $d->error_msg(); echo $d->show_foot(); }else{ header("Location: $PHP_SELF"); } exit; } if($act == 'setup_cookie'){ $cookvalue = implode(",", array($view,$pagetree,$pageexpn,$pageroot,$pagedump)); setcookie($d->cookie_s(), $cookvalue,time()+365*24*3600); header("Location: $PHP_SELF"); exit; } echo $d->show_head(); echo $d->show_navi(); /* 記事単独表示 */ if($n){ echo $d->show_msg($n,'dump'); list($id, $oya, $root,$subj,,,,$com) = $d->get_line($n); echo $n_tree_st; $d->make_tree($root); $trees = $d->get_tree(); foreach($trees as $val){ echo $d->show_msg($val[0],'tree',$val[1]); } echo $n_tree_to; echo $d->show_form($root, $id, $subj, $com, $re); echo $d->show_del($n); echo $d->show_foot(); exit; } /* ツリー単独表示 */ if($all){ $d->make_tree($all); $trees = $d->get_tree(); $all_tree_st = str_replace("{id}", "$all", $all_tree_st); echo $all_tree_st; foreach($trees as $val){ echo $d->show_msg($val[0],'tree',$val[1]); } echo $all_tree_to; $trees = $d->get_tree(); foreach($trees as $val){ echo $d->show_msg($val[0],'dump'); } echo $d->show_foot(); exit; } switch($mode){ case 'form': echo $d->show_form(); break; case 'search': echo $d->show_search($word); echo $d->search($word, $andor); break; case 'setup': echo $d->show_setup(); break; default: echo $d->show_main($page); } echo $d->show_navi(); echo $d->show_foot(); ?>