", $skin_data); //第一変換 $tmp_formfoot = $form . $delimiter .$foot; changeForm($tmp_formfoot); changeFoot($tmp_formfoot, $oyacnt, $fin); if($_POST['mode'] == 'last') $tmp_formfoot = preg_replace("/
]*?>.*?<\/form>/is", "", $tmp_formfoot, 1); list($form, $foot) = explode($delimiter, $tmp_formfoot); print $head . $form; if($_POST['mode'] != "main"){ $foot = preg_replace("/.*?/s", "", $foot, 1); } if($_POST['mode'] == "form"){ print $foot; exit; } foreach ($lines as $line) { $dt = new dt($line); if($dt->no == $dt->oyano){$count++;} if($count < $start ) { continue; } if($count > $fin ) { break; } /*-----記事表示-----*/ if($dt->no == $dt->oyano){#親記事 changeFootData($tmp_rfoot, $lastname, $lastdate, $rescnt); print $tmp_rfoot; $tmp_rheadfoot = $rhead . $delimiter . $rfoot;#コピー, $passを区切り文字に使わせてもらう changeData($tmp_rheadfoot, $dt); list($tmp_rhead, $tmp_rfoot) = explode("$delimiter", $tmp_rheadfoot); print $tmp_rhead; $rescnt = 0; } else { $tmp_rbody = $rbody; changeData($tmp_rbody, $dt); print $tmp_rbody; $rescnt++; } $lastname = $dt->name; $lastdate = $dt->date; } if($count) { changeFootData($tmp_rfoot, $lastname, $lastdate, $rescnt); print $tmp_rfoot; } print $foot; } #============================================================================ # setValue #============================================================ # = # $strはform領域の文字列で、$nameで与えられたname属性値の = # value属性を$typeの形式によって、$valueが初期値として与え = # られるようにセットしてやる。 = # = #============================================================ function setValue (&$str, $name, $value, $type) { if($type == 0){ $str = preg_replace("/(name=\"$name\")/","$1 value=\"$value\"",$str,1); } else if ($type == 1) { if(!$value) $value = '[^"]*?'; $str = preg_replace("/(name=\"$name\" value=\"$value\")/","$1 checked",$str,1); } else { $str = preg_replace("/(\n", $tmp_formfoot, 1); $tmp_formfoot = preg_replace("/.*?/s", $resstr, $tmp_formfoot, 1); if($Form_pos == "bottom" && !$ownskin) if(preg_match("/]*?>.*?<\/form>/is", $tmp_formfoot, $matches)) $tmp_formfoot = str_replace($matches[0],"",$tmp_formfoot); $tmp_formfoot = preg_replace("/.*?/s", "$matches[0]", $tmp_formfoot, 1); if($ownskin) $tmp_formfoot = str_replace("\$no\$", $_POST['no'], $tmp_formfoot); if($Re_sub) $tmp_formfoot = str_replace("name=\"sub\"", "name=\"sub\" value=\"$Re_sub{$_POST['free']}\"", $tmp_formfoot); changeForm($tmp_formfoot); list ($form, $foot) = explode($delimiter, $tmp_formfoot); foreach ($lines as $_) { $dt = new dt($_); if ($dt->oyano == $_POST['no']){ if($dt->no == $dt->oyano && !$flag){ $tmp_rheadfoot = $rhead . $delimiter .$rfoot; changeData($tmp_rheadfoot, $dt); list($rhead, $rfoot) = split($delimiter, $tmp_rheadfoot); changeFootData($rfoot,'','','');#<=================attention $bodies .= $rhead; $flag = 1; } else { $tmp_rbody = $rbody; changeData($tmp_rbody, $dt); $bodies .= $tmp_rbody; } } else if ($flag) { break; } } if(!$flag) Error("記事が存在しません", 0); print $head; print $form; print $bodies; print $rfoot; print $foot; exit; } #============================================================================ # CheckAndChanging 未入力チェック & 長さcheck & 題名置換 &
置換 #=================== function CheckAndChanging() { global $Need_name, $Need_msg, $Need_mail, $Need_sub, $Need_url, $No_name, $No_sub, $Max_name, $Max_sub, $Max_msg, $Auto_link, $MASTER, $SU, $Free, $No_icon,$Auto_lstr; if($Need_name && !$_POST['name']){ Error("名前未入力", 0); } if($Need_msg && !$_POST['msg'] ){ Error("記事未入力", 0); } if($Need_sub && !$_POST['sub']) { Error("題名未記入", 0); } if($Need_mail && !$_POST['mail']){ Error("MAIL未記入", 0); } if($Need_url && !$_POST['url'] ){ Error("URL未入力", 0); } if(!$_POST['name']){ $_POST['name'] = $No_name;} if(!$_POST['sub']) { $_POST['sub'] = $No_sub; } if(!$_POST['icon']){ $_POST['icon'] = $No_icon;} if(strlen($_POST['name']) > $Max_name) { Error("名前:半角 $Max_name 字以上不可", 0);} if(strlen($_POST['sub']) > $Max_sub) { Error("題名:半角 $Max_sub 字以上不可", 0);} if(strlen($_POST['msg']) > $Max_msg) { Error("半角 $Max_msg 字以上投稿不可", 0);} if(strlen($_POST['mail']) > 100) { Error("mailが長すぎます。", 0);} if(strlen($_POST['url']) > 200) { Error("urlが長すぎます。", 0);} if (get_magic_quotes_gpc()) {//¥を削除 $_POST['name'] = stripslashes($_POST['name']); $_POST['sub'] = stripslashes($_POST['sub']); $_POST['msg'] = stripslashes($_POST['msg']); if(count($Free)){ foreach($Free as $f){ $_POST[$f[0]] = stripslashes($_POST[$f[0]]); } } } Tag(); while(list($key, $val) = each($_POST)) ChangeBr($_POST[$key]); reset($_POST); if($Auto_link){ $txx = ($Auto_lstr) ? $Auto_lstr : "\$1"; $_POST['msg'] = preg_replace("/(s?https?:\/\/[-_.!~*'()a-zA-Z0-9;\/?:@&=+$,%#]+)/", "$txx", $_POST['msg']); } $_POST['url'] = preg_replace("/^http:\/\//","",$_POST['url'],1); if(preg_match("/^master/", $_POST['icon']) && !$MASTER){ Error("そのアイコンは管理人専用です。");} while(list ($key, $val) = each($_FILES)) { if($MasterOnlyResUp && $_POST['no'] && !$MASTER && $_FILES[$key]['tmp_name']){ Error("アップロードは禁止されています");} if($MasterOnlyUp && !$_POST['no'] && !$MASTER && $_FILES[$key]['tmp_name']){ Error("アップロードは禁止されています");} }reset($_FILES); } #============================================================================ # Write #=================== function Write() { global $MASTER,$MasterOnlyRes, $MasterOnlyThre, $AvoidExpiration, $SU, $MasterOnlyUp, $MasterOnlyResUp,$File_check,$Usrsort,$Mpass, //2005.12.26 mpass追加 $Log_file, $Up_dir, $Upsort, $Datesort, $Max_thre, $Self, $AvoidExpiration, $Max_wait,$Free,$FileType,$MASTER,$Max_upsz,$Wrt_jump,$Res_jump,$Mail_func,$Mail_mode; $pasts = array(); $lines = array("a"); $times = time(); if($MasterOnlyRes && $_POST['no'] && !$MASTER){ Error("書き込みは禁止されています");} if($MasterOnlyThre && !$_POST['no'] && !$MASTER){ Error("書き込みは禁止されています");} CheckAndChanging(); /*.....日付処理....................................*/ $w_year = date("y"); $w_mon = date("m"); $w_day = date("d"); $w_week = date("w"); $w_hour = date("H"); $w_min = date("i"); $w_sec = date("s"); $w_year = ($Datesort && $_POST['year']) ? $_POST['year'] : $w_year; $w_mon = ($Datesort && $_POST['mon']) ? $_POST['mon'] : $w_mon; $w_day = ($Datesort && $_POST['day']) ? $_POST['day'] : $w_day; $w_day = sprintf("%02d", $w_day); $w_mon = sprintf("%02d", $w_mon); $w_year = sprintf("%02d", $w_year); if($Datesort && !$_POST['no']){ if(!DateExists($w_year+2000,$w_mon,$w_day)) Error("その日付は存在しません"); $w_week = GetWeek($w_year+2000,$w_mon,$w_day); } $w_date = "$w_year/$w_mon/$w_day/$w_week/$w_hour/$w_min/$w_sec/"; $w_dateline = "$w_year$w_mon$w_day$w_week$w_hour$w_min$w_sec"; Lock(); /*-----ログの読み込み-----*/ $lines = file($Log_file); /*.....ヘッダ読み込み.....*/ list(,$lastno, $oyacnt, $past_no, $last_sec, $last_ip,) = explode(",",array_shift($lines)); $lastno++; $oyano = !$_POST['no'] ? $lastno : $_POST['no']; /*.....連続投稿時間制限.....*/ $ip = getenv("REMOTE_ADDR"); $host = gethostbyaddr($ip); if(!$MASTER && $last_ip == $ip && ($waitsec = ($Max_wait - $times + $last_sec)) > 0){ Error("連続投稿制限中 (残り $waitsec 秒)");#<---------------! } /*.....spam block.....*/ $strcntaad = $_POST['msg']; if (mb_detect_encoding($strcntaad)=="ASCII"){ Error("半角英数字のみの投稿はできません。"); } /*.....spam block2.....*/ $r = check_mb_str($strcntaad); if ($_POST[alss]!="xmd"){ Error("不正な投稿はできません。"); } /*.....spam block3.....*/ // 投稿されたくない語句をカンマ区切りで設定 $spamword = "zkebrz.com,idcsmw.com,sex,urpcga.com,gfekqc.com,urpcga.com,blogspot.com,ktfvqe.com,mbyqwo.com,aaeikl.com,acsrhg.com,
,
,$Max_upsz)Error("$Max_upsz KB以上は許可されません.{$_FILES[$i]['size']}"); list($w, $h, $type, $attr) = getimagesize($_FILES[$i]['tmp_name']); if( $type < 1 || $type > 3){ $w = $h = -1; } $img[$i] = "$ext/$w/$h"; if(!move_uploaded_file($_FILES[$i]['tmp_name'], "$Up_dir$lastno-$i-$rand.$ext")){ Error("{$_FILES[$i]['tmp_name']}は、有効ではありません"); } } } /*-----自由変数登録処理-----*/ for($i=0; $i", $line); $dateline = join('', explode('/',$date)); if($w_dateline >= $dateline && $no == $oyano) break; $cnt++; } array_splice($lines, $cnt, 0, $new_line); } #..... はみ出し分......# if(count($lines) > $Max_thre){ while(1){ $line = array_pop($lines); list ($no, $oyano) = explode("<>", $line); array_unshift($pasts, $line); if($no == $oyano){#..もし親記事なら $inc--; if(count($lines) <= $Max_thre || !count($lines)) break; } } } #.....親記事数更新.....# $oyacnt += ++$inc; #//////// レス記事書き込み ////////////////////////# } else { if($Usrsort && !$Datesort){ $Upsort = ($_POST['upsort'] == '') ? $Upsort : $_POST['upsort']; } if($Upsort) { $linecnt = count($lines); $moves = array(); for($i=0; $i<$linecnt; $i++){ list($no, $oyano) = explode("<>", $lines[$i]); if($oyano == $_POST['no']){ array_push($moves, $lines[$i]); $lines[$i] = ''; $flag = 1; } else if ($flag) { break; } $cnt++; } if(!$flag) Error('記事は存在しません'); array_push ($moves, $new_line); array_splice($lines, 0, 0, $moves); } else { foreach($lines as $line){ list($no, $oyano) = explode("<>", $line); if($oyano == (int) $_POST['no']){ $flag = 1; } else if ($flag) { break; } $cnt++; } if(!$flag) Error('記事は存在しません'); array_splice($lines, $cnt, 0, $new_line); } } $past_no = MakePast($pasts, $past_no); /*.....最終処理.....*/ array_unshift ($lines, "\n"); $fp = fopen("$Log_file", "wb"); foreach ($lines as $_) { fputs($fp, $_);} fclose($fp); Unlock(); /*-----sendmail-----*/ if($Mail_func && ($Mail_mode || !$MASTER) ){ sendmail("$ip ($host)"); } /*-----COOKIE発行-----*/ $expire = time() + 3600 * 24 * 30; @setcookie("name", $_POST['name'], $expire); @setcookie("url", $_POST['url'], $expire); @setcookie("mail", $_POST['mail'], $expire); @setcookie("color", $_POST['color'],$expire); @setcookie("icon", $_POST['icon'], $expire); @setcookie("pass", $MASTER ? $Mpass : $_POST['pass'], $expire); //2005.12.26 $_COOKIE['name'] = $_POST['name']; $_COOKIE['url'] = $_POST['url']; $_COOKIE['mail'] = $_POST['mail']; $_COOKIE['color'] = $_POST['color']; $_COOKIE['icon'] = $_POST['icon']; $_COOKIE['pass'] = $_POST['pass']; //自由変数 if(count($Free)){ foreach($Free as $f){ @setcookie($f[0], $_POST[$f[0]], $expire); $_COOKIE['$f[0]'] = $_POST[$f[0]]; } } if($SU){ if($AvoidExpiration){ header("Location: $Self?mode=master&page={$_POST['page']}&epass={$_POST['epass']}&su=1\n\n"); exit(0); } Master(); } if($_POST['no'] && $Res_jump){ if($Res_jump == 'res') {res(); exit;} header("Location: $Res_jump"); exit; } if($Wrt_jump){ header("Location: $Wrt_jump"); exit; } if($AvoidExpiration){ header("Location: $Self"); exit; } } function sendmail($host){ global $Mailto, $Selfname; $tmpmessage = preg_replace("/
/i", "\n", $_POST['msg']); $subject = "[ $Selfname ] {$_POST['sub']}"; $message = <<", $lines[$j]); if($no == $del || ($oyano == $del && $flag)){ if(decry($_POST['pass'],$pass) || $MASTER){ $flag = $find = 1; if($SU || $CompleteDel){ $lines[$j] = ""; if($oyano == $no) $dec++; } else { $lines[$j]="$no<>$oyano<><>///////<><><>(この記事は削除されました)<><><><><>none.gif<><><><>\n"; $flag=0; } $error=0; for($i=0;$i<=3;$i++){#--------画像の削除処理 list ($ext,,) = split("/",$img[$i]); if($ext) {unlink("$Up_dir$no-$i-$rand.$ext");} }#------------------------------------------------ } } } if(!$find){ Error("指定記事は存在しません");} if($error){ Error("Password不正です");} $h = array(); $h = split(",",$head); $h[2] -= $dec; array_unshift ($lines, join(',',$h)); $fp = fopen("$Log_file", "wb"); foreach ($lines as $_) { fputs($fp, $_);} fclose($fp); Unlock(); if($SU) { Master();} if($Del_jump) { header("Location: $Del_jump"); exit; } } #============================================================================ # Edit #=================== function Edit() { global $MasterOnlyEdit, $MASTER, $Log_file, $SU; $flag = 0; $lines = array(); if($MasterOnlyEdit && !$MASTER){ Error("記事編集は禁止されています"); } Lock(); $lines = file("$Log_file"); for ($j=1; $jno != $_POST['no']) continue; if(!decry($_POST['pass'], $dt->pass) && !$MASTER) {Error("password 不正");} //編集画面 if($_POST['mode'] == 'edit'){ if(!$SU){ Editform($dt); } else { MasterEditform($dt); } //編集更新 } else { EditWrite($lines, $j, $dt); $flag=1; break; } $flag = 1; } if (!$flag){ Error("記事 No.{$_POST['no']}は存在しません"); } } function Editform(&$dt) { global $Self, $Skin_edit, $Img_dir, $Max_up, $Auto_Eskin, $Delfile_view, $Use_Extracut, $Free, $Ctype, $Itype, $Eskin_from, $Edit_back, $Edit_target; $back = (!$Edit_back) ? "$Self" : $Edit_back; $from = ($Eskin_from) ? $Eskin_from : 'edit'; $ownskin = ($from == 'edit'); $editstr = "

No.{$_POST['no']} の編集 "; if($Edit_target) {$editstr .= "[ 戻る ]";} $editstr .= "

"; /*-----削除checkbox-----*/ for($i=1;$i<=$Max_up;$i++) { if($dt->img[$i]){ list ($ext, $w, $h ) = explode("/", $dt->img[$i]); $img_del_txt[$i] .= "削除 "; if($Delfile_view){ $img_del_txt[$i] .= "[no-$i-$dt->rand.$ext\" target=\"_blank\">view] ";} } } /*-----スキン読み込み-----*/ $skin_data = openSkin($from); list ($head, $form, $rhead, $rbody, $rfoot, $foot) = explode("", $skin_data); $tmp_formfoot = $form . $foot; /*---- 領域カット -----*/ $tmp_formfoot = preg_replace("/(name=\"mode\" value=)\"write\">/i", "$1\"ewrite\">\nno}\">\n", $tmp_formfoot, 1); $tmp_formfoot = preg_replace("/.*?/s", $editstr, $tmp_formfoot, 1); $tmp_formfoot = preg_replace("/.*?/s", "", $tmp_formfoot, 1); $tmp_formfoot = str_replace ("\$self\$", $Self, $tmp_formfoot); if($Use_Extracut) $tmp_formfoot = preg_replace("/.*?/s", "", $tmp_formfoot); if($ownskin) $tmp_formfoot = str_replace("\$no\$", $_POST['no'], $tmp_formfoot); $dt->msg = str_replace("
", "\n", $dt->msg); /*-----フォーム置換-----*/ setValue($tmp_formfoot, "name", $dt->name, 0); setValue($tmp_formfoot, "sub", $dt->sub, 0); setValue($tmp_formfoot, "url", "http://{$dt->url}",0); setValue($tmp_formfoot, "mail", $dt->mail, 0); setValue($tmp_formfoot, "color", $dt->color, $Ctype); setValue($tmp_formfoot, "icon", $dt->icon, $Itype); setValue($tmp_formfoot, "pass", $_POST['pass'], 0); $tmp_formfoot = str_replace(">", ">{$dt->msg}", $tmp_formfoot); for($i=1; $i<=$Max_up; $i++) { $tmp_formfoot = str_replace("", $img_del_txt[$i], $tmp_formfoot); } //自由変数 if(count($Free)){ $i = 0; $frees = array(); if($dt->freeline){ $frees = explode("\t", $dt->freeline); } foreach($Free as $f){ setValue($tmp_formfoot, $f[0], $frees[$i], $f[1]); $i++; } } print $head . $tmp_formfoot; Unlock(); exit; } function EditWrite (&$lines, $j, &$dt) { global $Self, $Log_file, $Up_dir, $Free, $AvoidExpiration, $SU,$FileType,$Max_up,$MASTER,$Max_upsz,$Edit_jump,$File_check; $mode = ($_POST['mode'] == 'ewrite') ? 1 : 0; $rand = time(); if($mode){ CheckAndChanging(); #///// 画像処理 ////////////////////// for($i=1;$i<=$Max_up;$i++){ $ext =''; //消去 if($_POST["delimg-$i"]||$_FILES[$i]['tmp_name']){ list($ext,,) = explode("/", $dt->img[$i]); @unlink("$Up_dir{$dt->no}-$i-{$dt->rand}.$ext"); } $ext = ''; //保存 if($_FILES[$i]['tmp_name']){ //ファイル書き込み if(count($FileType)){ foreach($FileType as $ft){ if(preg_match("/\.($ft)$/i",$_FILES[$i]['name'])){ $ext = $ft; break; } }} if(!$ext) Error("許可されないファイル形式です"); if($_FILES[$i]['size']/1024>$Max_upsz)Error("$Max_upsz KB以上は許可されません."); list($w, $h, $type, $attr) = getimagesize($_FILES[$i]['tmp_name']); if( $type < 1 || $type > 3){ $w = $h = -1; } $img[$i] = "$ext/$w/$h"; if(!move_uploaded_file($_FILES[$i]['tmp_name'], "$Up_dir$dt->no-$i-$dt->rand.$ext")){ Error("{$_FILES[$i]['tmp_name']}は、有効ではありません"); } } else { $img[$i] = $_POST["delimg-$i"] ? '' : $dt->img[$i]; } } #///// 自由変数 ///////////////////// for($i=0; $iaccept)); $lines[$j] = "{$dt->no}<>{$dt->oyano}<>{$dt->pass}<>{$dt->date}<>{$_POST['sub']}<>{$_POST['name']}<>{$_POST['msg']}<>{$_POST['mail']}<>{$_POST['url']}<>{$_POST['color']}<>{$_POST['icon']}<>$freeline<>{$img[1]}<>{$img[2]}<>{$img[3]}<>$dt->rand<>$accept<>{$dt->close}<>{$dt->ip}<><>\n"; } else { $lines[$j] = "{$dt->no}<>{$dt->oyano}<>{$dt->pass}<>{$dt->date}<>{$dt->sub}<>{$dt->name}<>{$dt->msg}<>{$dt->mail}<>{$dt->url}<>{$dt->color}<>{$dt->icon}<>$freeline<>{$dt->img[1]}<>{$dt->img[2]}<>{$dt->img[3]}<>{$dt->rand}<>{$_POST['free']}<>{$dt->close}<>{$dt->ip}<><>\n"; } $fp = fopen("$Log_file", "wb"); foreach ($lines as $line) { fputs($fp, $line);} fclose($fp); Unlock(); if($SU){ if($AvoidExpiration){ header("Location: $Self?mode=master&page={$_POST['page']}&epass={$_POST['epass']}&su=1\n\n"); exit(0); } else { Master(); } } if($Edit_jump) { header("Location: $Edit_jump");exit; } if($AvoidExpiration){ header("Location: $Self"); exit; } else { Index(); exit; } } #============================================================================ # decry #=================== function decry($a, $b) { if(crypt($a, $b) == $b) return 1; else return 0; } #============================================================================ # MasterHead #=================== function MasterHead() { global $m_font_c, $m_font, $m_font_sz, $m_bgc, $m_txt_bgc,$m_bdr_c; print << EOT; } #============================================================================ # Master #=================== function Master() { global $MASTER, $M_View, $SU, $Up_dir, $Log_file, $m_tbl_bgc,$m_tbl_tbgc; if (!$MASTER) Error("パスワード不正"); if (!$SU && $_POST['editedit']) $e=0; #編集した後 $start = $M_View * $_POST['page']; #editformから戻るときに使うので、local $fin = $start + $M_View - 1; MasterHead(); Masterform(new dt(""), 0); /*-----$img_dir内のサイズ取得・ログファイルのサイズ取得-----*/ $files = array(); $dir = opendir($Up_dir); while($tmp = readdir($dir)){ array_push($files, $tmp); } closedir($dir); array_shift($files); array_shift($files); foreach($files as $file){$img_sz += filesize("$Up_dir$file")/1000;} $log_sz = filesize("$Log_file")/1000; print <<
現行ログのサイズ: $log_sz KB    [ 記事数補正 ]
画像の合計サイズ: $img_sz KB

EOT; #-----記事表示繰り返し部の出力--------------------------------------------------------------------------------- $lines = file($Log_file); array_shift($lines); #ヘッダの除去 $i = 0; foreach ($lines as $_) { $dt = new dt($_); if($dt->no == $dt->oyano){$count++;} if($count < $start ) { continue; } if( $count > $fin ) { break; } if($dt->no == $dt->oyano){#親記事 if($count>1){ print "\n"; } #最初の親記事以外は前の記事のフッタを出力 MasterTable($dt, 1); } else { MasterTable($dt, 0); } } print "
no 日付 題名 名前
(ip)
投稿内容 ファイル 一覧
返信
";#---------------------------------------- $next_page = $_POST['page'] + 1; $prev_page = $_POST['page'] - 1; print "

"; if($_POST['page']>0){ print "<< Prev  "; } if($count>$fin){ print "  Next >>"; } print "


"; ##############? print "
"; print "[ skin-init置換 ] "; print "[ iconリストのスキン適用操作 ]
"; print "








"; print "\n\n"; exit; print "

\n\n"; exit; } #============================================================================ # MasterTable #=================== function MasterTable (&$dt, $flag) { global $Img_dir, $Re_sub, $m_tbl_bgc, $m_tbl_rbgc, $Str_week; $dt->msg = str_replace("
", " ", $dt->msg); $dt->msg = htmlspecialchars($dt->msg); cutStr($dt->msg, 50); cutStr($dt->sub, 10); list ($year, $mon, $day, $week, $hour, $min, $sec) = explode("/", $dt->date); list ($dt->ip) = explode(",", $dt->ip); $res = ($flag) ? "no','{$_POST['page']}','$Re_sub{$dt->sub}')\">詳細" : "↑"; $col = ($flag) ? $m_tbl_bgc : $m_tbl_rbgc; print ""; print "{$dt->no}"; print "no}','{$_POST['page']}','');\">消"; print "no}','{$_POST['page']}','')\">$year/$mon/$day"; print "{$dt->sub}{$dt->name}
({$dt->ip}) {$dt->msg}"; print ""; if($dt->img[1]){list($a,$w) = split("/",$dt->img[1]);print "no-1-$dt->rand.$a\" target=\"_blank\">";print $w>0 ? "○" : "□"; print "";} print""; print ""; if($dt->img[2]){list($a,$w) = split("/",$dt->img[2]);print "no-2-$dt->rand.$a\" target=\"_blank\">";print $w>0 ? "○" : "□"; print "";} print""; print ""; if($dt->img[3]){list($a,$w) = split("/",$dt->img[3]);print "no-3-$dt->rand.$a\" target=\"_blank\">";print $w>0 ? "○" : "□"; print "";} print""; print ""; if(!$dt->accept && ($dt->img[1]||$dt->img[2]||$dt->img[3])){ print "no}','{$_POST['page']}','1')\">未"; } else if(($dt->img[1]||$dt->img[2]||$dt->img[3]) ){ print "no}','{$_POST['page']}','0')\">済"; } print ""; print "$res"; print ""; } #============================================================================ # MasterForm #=================== # 0:$no 1:$date # $img_name # $e # $r # $name $sub $date $ # $Datesort # $cbox1 # $cbox2 # $icon # $Str_week function Masterform(&$dt, $nre) { #$mode 0:normal 1:res 2:edit << n r e global $Datesort, $Cbox, $Ibox, $Str_week, $Img_dir, $Self, $Mas_back, $Mas_target,$Self; $back = (!$Mas_back) ? $Self : $Mas_back; if($nre == 2){//edit for($i=1; $i<=3; $i++){ list($ext,,) = explode("/", $dt->img[$i]); $img_del_txt[$i] = $ext ? "[no-$i-$dt->rand.$ext\" target=\"_blank\">view]削除" : ""; } list($year,$mon,$day) = explode("/",$dt->date); $writemode = "ewrite"; } else {//normal and respons $dt->name =$_COOKIE['name']; $dt->sub =$Re_sub . $_POST['free']; $dt->mail =$_COOKIE['mail']; $dt->url =$_COOKIE['url']; $dt->color =$_COOKIE['color']; $dt->icon =$_COOKIE['icon']; $year = date("y"); $mon = date("m"); $day = date("d"); $writemode = "write"; } if($nre > 0 ){//edit and res print "[ 戻る ]"; } else {//normal print "[ トップ ]"; } print "
\n"; print "
\n"; print "\n"; print "\n"; print "\n"; if($nre > 0){//edit and res print "\n"; } print ""; if($Datesort){ if($nre == 2) { print "\n";} else { print "\n";} } print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; /*-----色1のフォーム-----*/ print ""; /*-----アイコンのフォーム-----*/ print ""; print "\n
記事No.$no $year/$mon/$day の編集
Date
Namename}\">
Titlesub}\">
タグを使用【改行は有効】
Mailmail}\">
Urlurl}\">
{$img_del_txt[1]}
{$img_del_txt[2]}
{$img_del_txt[3]}
"; if(count($Cbox)){ foreach ($Cbox as $cbox) { print "color){print " checked";} print ">"; } } print "
アイコン"; print "
\n
\n"; } #============================================================================ # MasterResform #=================== function MasterResform() { global $Log_file, $Max_up, $Img_dir, $m_tbl_bgc, $m_tbl_rbgc,$Str_week; $lines = array(); /*-----ログ読み込み-----*/ $lines = file("$Log_file"); array_shift($lines); MasterHead(); $flag = 0; print "
"; foreach ($lines as $_ ) { $dt = new dt($_); for($j=1;$j<=3;$j++){#画像のサイズ取得 list ($ext[$j], $w[$j], $h[$j]) = explode("/",$dt->img[$j]); reviseSize($w[$j], $h[$j], $gomi); } list ($year, $mon, $day, $week, $hour, $min,$sec) = explode("/",$dt->date); if ($dt->oyano == $_POST['no']){ if($dt->no == $dt->oyano && !$flag){ print "
\n"; print "
名前 : $dt->name [ $dt->ip ]
題名 : $dt->sub
mail : $dt->mail
url : http://$dt->url
日時 : 20$year/$mon/$day ($Str_week[$week]) $hour:$min:$sec
{$dt->msg}\n
\n"; for($j=1;$j<=$Max_up; $j++){ if($dt->img[$j]) print "no-$j-$dt->rand.$ext[$j] width=$w[$j] height=$h[$j]> "; } print "

\n"; $flag=1; } else { print "
 \n"; print "
名前 : $dt->name [ $dt->ip ]
日時 : 20$year/$mon/$day ($Str_week[$week]) $hour:$min:$sec
題名 : $dt->sub
mail : $dt->mail
url : http://$dt->url
{$dt->msg}\n
\n"; for($j=1; $j<=$Max_up; $j++){ if($dt->img[$j]) print "no-$j-$dt->rand.$ext[$j] width=$w[$j] height=$h[$j]> "; } print "

\n"; } } elseif ($flag) { break; } #flagがたったらbreak; } print "
\n"; Masterform(new dt(""), 1); exit; } #============================================================================ # date_exists #=================== function DateExists($year,$mon,$day) { if($year<1 || $day<1){Error("値が不正です");} if($mon==1 || $mon==3 || $mon==5 || $mon==7 || $mon==8 || $mon==10 || $mon==12){ if($day<32){return 1;} }elseif ($mon==4 || $mon==6 || $mon==9 || $mon==11){ if($day<31){return 1;} }elseif($mon==2){ if(!($year % 4)){ if($day<30){return 1;} }else { if($day<29){return 1;} } }else{return 0;} return 0; } #============================================================================ # get_week #=================== function GetWeek($year,$mon,$day) { if($year == 1582) { if($mon < 10) { return -1; } elseif($mon == 10) { if($day < 15) { return -1; } } } elseif($year < 1582) { return -1; } if($mon == 1 || $mon == 2) { $year --; $mon += 12; } $week = ($year + intval($year/4) - intval($year/100) + intval($year/400) + intval((13*$mon+8)/5) + $day) % 7; return $week; } function Lock() { global $LOCK, $Lock_file; $LOCK=fopen("$Lock_file","w"); if(!flock($LOCK, 2)) Error("Lock is busy.."); } function Unlock() { global $LOCK; fclose($LOCK); } function ChangeBr(&$str) { $str = str_replace("\r\n","
",$str); $str = str_replace("\r","
",$str); $str = str_replace("\n","
",$str); } function Tag() { global $Tag_accept, $SU; while(list ($key, $val) = each($_POST)) if(!($Tag_accept || $_POST['tag'] && $SU)) $_POST[$key] = htmlspecialchars($_POST[$key]); reset($_POST); } #============================================================================ # MakePast #=================== function MakePast ($past, $past_no) { global $Past_func, $Past_dir, $Max_psize; $plines = array(); if(!$Past_func || !count($past)){ return $past_no; } $past_file = $Past_dir . $past_no . ".php"; if (@filesize($past_file) > $Max_psize * 1024) {#過去ログファイルのサイズ評価 $past_no++; $past_file = "$Past_dir$past_no.php"; } if (file_exists($past_file)){ $plines = file($past_file); } else { array_push($past, "\n"); } $plines = array_merge($past, $plines); $fp = fopen("$past_file", "wb"); foreach ($plines as $_) { fputs($fp, $_);} fclose($fp); return $past_no; } function Admin() { global $Mpass, $MASTER, $JumpPass; #if($_COOKIE['pass'] && $Mpass == $_COOKIE['pass'] && $JumpPass){ # $MASTER=1; $_POST['epass'] = crypt($Mpass); Master(); #} #MasterHead(); #print "
"; #print "

管理人モード


"; #print "
\n"; #print "Pass


"; #print "
"; #exit; if($_COOKIE['pass'] && $Mpass == $_COOKIE['pass'] && $JumpPass){ $MASTER=1; $_POST{'epass'} = crypt($Mpass); Master(); exit; } $msg .= "

\n"; $msg .= "管理者専用

[ 戻る ]

"; onlyComment($msg); exit; } /*==================================================================== * Searchform (fileline) *====================================================================*/ function Searchform($files, &$str) { global $Self, $Past_dir, $Log_file; $select = ($_POST['log'] == 'log') ? "selected" : ""; $check1 = ($_POST['cond'] == 'and') ? "selected" : ""; $check2 = ($_POST['cond'] == 'or') ? "selected" : ""; $matches= array(); $str .= "

"; $str .= ""; $str .= "範囲:"; $str .= "  条件:"; $str .= "  ワード: "; $str .= "

"; } /*==================================================================== * Searchform (fileline) *====================================================================*/ function SearchView() { global $Srch_View, $Skin_srch, $Log_file, $Past_dir, $Self, $Sskin_from, $Match_c, $Use_Extracut, $Srch_back, $Srch_target; $count = 0; $skin_data; $mode = (!$_POST['word']) ? 0 : ((!$_POST['no']) ? 1 : 2); $from = ($Sskin_from) ? $Sskin_from : 'search'; $ownskin = ($from == 'search'); #0:閲覧 1:検索 2:関連記事 $start = $Srch_View * ($_POST['page']) + 1; $fin = $start + $Srch_View -1;#?????????????? $lines = array(); $strs = array(); $files = array(); $delimiter = time(); if(preg_match("/^(\d+)$/", $_POST['log'], $matches)){ $srh_log = $Past_dir . $matches[0] . ".php"; } else if ($_POST['log']) { $srh_log = $Log_file; } #.....スキン読み込み..... $skin_data = openSkin($from); list ($head, $form, $rhead, $rbody, $rfoot, $foot) = explode("", $skin_data); /* 前処理 */ $_POST['word'] = htmlspecialchars($_POST['word']); $_ = $_POST['word']; $_ = preg_replace("/ +/", " ", $_); $_ = preg_replace("/ +/", " ", $_); $strs = explode(" ", $_); #.....検索の場合..... if($mode == 1){ if($srh_log && file_exists($srh_log)){ $fp = fopen($srh_log,"r"); if($srh_log == $Log_file){fgets($fp, 9182);} } else {/* Error("Can't open {$_POST['log']}");*/} while (!feof($fp) && $tmp = fgets($fp, 9182)){ $flag = 0; if(count($strs)) foreach ($strs as $str) { if(strstr($tmp, $str) != false){ $flag=1; if($_POST['cond'] =='or'){ break; } } else if ($_POST['and'] == 'and') { $flag=0; break; } } if($flag){ array_push($lines, $tmp); $flag=0;} } fclose($fp); if($srh_log != $Log_file) array_pop($lines); #.....閲覧・記事一覧の場合.....# } else { if($srh_log && file_exists($srh_log)){ $lines = file($srh_log); if($srh_log == $Log_file){ array_shift($lines); } else { array_pop($lines); } } else { /*Error("Can't open {$_POST['log']}");*/} } $finds = count($lines); /* 過去ログファイル展開 */ $dir = opendir($Past_dir); while($tmp = readdir($dir)){ array_push($files, $tmp); } sort($files,SORT_NUMERIC); closedir($dir); print $head; $tmp_formfoot = $form . $delimiter .$foot; if(!$ownskin){ $back = (!$Srch_back) ? $Self : $Srch_back; $tmp_formfoot = preg_replace("/(
]*?>.*?<\/form>)/is", "", $tmp_formfoot, 1); $tmpstr = "

"; if($Srch_target){ $tmpstr .= "[ トップに戻る ]"; if($mode == 2){ $tmpstr .= "  [ 検索結果に戻る ]"; $tmp_formfoot = preg_replace("/.*?/s", "", $tmp_formfoot, 1); } } Searchform($files, $tmpstr); if($mode == 1){ $tmpstr .= "

検索結果 ( $finds 件 )

"; } else if($mode == 2) { $tmpstr .= "

No.{$_POST['no']} 関連記事

"; } if($Use_Extracut) $tmp_formfoot = preg_replace("/.*?/s", "", $tmp_formfoot); $tmp_formfoot = preg_replace("/.*?/s", $tmpstr, $tmp_formfoot, 1); list($form, $foot) = split($delimiter, $tmp_formfoot); print $form; /* 自作スキン */ } else { SearchformChanging($form); } $rescnt = 0; $lastname ; $bodies; if(count($lines)){ foreach($lines as $line){ $dt = new dt($line); /*事前条件*/ if($mode == 2 && $_POST['no'] != $dt->oyano) { continue; } if($mode == 1 || $dt->no == $dt->oyano) { $count++; } if($mode != 2 && ($count < $start || $count > $fin)){ continue; } if($dt->no == $dt->oyano || $mode == 1){ if($mode == 1){ $dt->msg .= "

[oyano}&log={$_POST['log']}&page={$_POST['page']}\"> 関連記事を表\示 ]"; if($dt->no != $dt->oyano){ $dt->sub = "Re:{$dt->oyano} - " . $dt->sub; } } #親記事後半領域の表示 changeFootData($tmp_rfoot, $lastname, $lastdate, $rescnt); $bodies .= $tmp_rfoot; $tmp_rheadfoot = $rhead . $delimiter . $rfoot; changeData($tmp_rheadfoot, $dt); list ($tmp_rhead, $tmp_rfoot) = explode($delimiter, $tmp_rheadfoot); #親記事前半領域の表示 $bodies .= $tmp_rhead; #.....子記事の表示.....# } else { $tmp_rbody = $rbody; changeData($tmp_rbody, $dt); $bodies .= $tmp_rbody; $rescnt++; } $lastname = $dt->name; $lastdate = $dt->date; } } if($count) { changeFootData($tmp_rfoot, $lastname, $lastdate, $rescnt); $bodies .= $tmp_rfoot; } if($Match_c) if(count($strs)){ $bodies = mb_convert_encoding($bodies,"EUC-JP","SJIS"); foreach($strs as $str){ if($str){ $str = mb_convert_encoding($str,"EUC-JP","SJIS"); $bodies = preg_replace("/((?:\G|>)[^<]*?)$str/","$1$str",$bodies); } } $bodies = mb_convert_encoding($bodies,"SJIS","EUC-JP"); } print $bodies; #.....フッタの表示..... changeFoot($foot, $count, $fin); print $foot; exit; } /*==================================================================== * Searchform (fileline) *====================================================================*/ function SearchformChange($sForm, $fileline,$finds){ global $Log_file, $Past_dir, $Self; preg_match("/