\n";
print "
\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 "
";
#print "";
#exit;
if($_COOKIE['pass'] && $Mpass == $_COOKIE['pass'] && $JumpPass){
$MASTER=1; $_POST{'epass'} = crypt($Mpass); Master(); exit;
}
$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 .= "
";
}
/*====================================================================
* 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("/(