#==========================================================================#
# ■ B.Forum Ver.1.01                                                      #
# ■ プラグインSDK(list)                                                   #
# □ Encode = EUC                                                          #
# □ Hiroaki,Sakuma (sakuma@beetas.org)                                    #
#                                                                          #
# このアプリケーションはオープンソースウェアです.                          #
# 無料で使用することができます.                                            #
# なお, 詳細な使用条件/最新情報については下記サイトをご覧下さい.           #
# http://www.beetas.org/                                                   #
#                                                                          #
# ------------------------------------------------------------------------ #
# Copyright 2001-2002 Hiroaki,Sakuma All Rights Reserved.                  #
# Copyright 2001-2002 BEETAS.org All Rights Reserved.                      #
#                                                                          #
#==========================================================================#
package list;

use Exporter;
use strict;

@ISA = qw(Exporter);
@EXPORT = qw(version status require_min require_max main);

my (%in %SET);

sub version {
	# バージョン(要変更)
	$version = "Plugin SDK(list) 1.01(0055-0058)";
	return $version;
}

sub status {
	return 1;
}

sub require_min {
	# 最低動作バージョン(要変更)
	$require_min = "0055";
	return $require_min;
}

sub require_max {
	# 最高動作バージョン(要変更)
	$require_max = "0058";
	return $require_max;
}

sub main ($$$@) {

	# 変更の必要なし
	my $head = $_[0];
	my $foot = $_[1];
	%in = %{$_[2]};
	splice (@_,0,3);
	%SET = %Bforum::SET;



	# ここから変更

	my ($tmp1,$tmp2,$tmp3);

	if (!&Bforum::_indexcheck) { &about; }

	if ($in{'s'} < 1) { &about; }
	$in{'s'} ||= 1;
	$Bforum::line = 0;
	foreach (reverse ((($in{'s'} - 1) * $SET{'LIST_NUMBER'} + 1) .. ($in{'s'} * $SET{'LIST_NUMBER'}))) {
		if (&Bforum::_analysis(\%list,&Bforum::_open(undef,"$SET{'USER_DIR'}/$in{'id'}/$in{'t'}/$_"))) {

			$Bforum::line++;

			$list{'new'} = "";
			if ($list{'date'} + $SET{'NEW_TIME'} > time) {
				$list{'new'} = $SET{'NEW_ELEM'};
			}
			&Bforum::_time($list{'date'});
			if ($list =~ /{date:(.+?)}/o) { $list{"date:$1"} = &Bforum::_time($list{'date'},$1); }
			if ($list{'delete'} || !&Bforum::_listcheck($_)) {
				$list{'title'} = '(削除)' . $list{'title'};
				&Bforum::_analysis(\%list,&Bforum::_open(undef,"$SET{'USER_DIR'}/$in{'id'}/BF.delete$Bforum::browser->{browser}","$SET{'USER_DIR'}/BF.delete$Bforum::browser->{browser}"));
				$list{'email'} = $SET{'ADDRESS'};
			}
			if ($list =~ /{title:(.+?)}/o && $1 =~ /^\d*$/o) { $list{"title:$1"} = &Bforum::_link("id=$in{'id'}&t=$in{'t'}&v=$list{'no'}",&Bforum::_cut($list{'full_title'},$1,'...')); }
			$list{'title:nl'} = $list{'full_title'};
			$list{'title'} = &Bforum::_link("id=$in{'id'}&t=$in{'t'}&v=$list{'no'}",$list{'title'});

			$tmp1 = $Bforum::list;
			&Bforum::do($tmp1);
			&Bforum::change($tmp1,\%list);

			$tmp2 .= $tmp1;

		}
	}

	if ((($in{'s'} - 1) * $SET{'LIST_NUMBER'}) > (&Bforum::_open('line',"$SET{'USER_DIR'}/$in{'id'}/$in{'t'}/list") + 1)) { &about; }

	if ($in{'s'} == 1) {
		$print{'back'} = $SET{'DISP_LIST_BACK_NL'};
	} else {
		$print{'back'} = &Bforum::_link("id=$in{'id'}&t=$in{'t'}&v=list&s=" . ($in{'s'} - 1),$SET{'DISP_LIST_BACK'});
	}
	if ($in{'s'} > int(&Bforum::_open('line',"$SET{'USER_DIR'}/$in{'id'}/$in{'t'}/list") / $SET{'LIST_NUMBER'})) {
		$print{'next'} = $SET{'DISP_LIST_NEXT_NL'};
	} else {
		$print{'next'} = &Bforum::_link("id=$in{'id'}&t=$in{'t'}&v=list&s=" . ($in{'s'} + 1),$SET{'DISP_LIST_NEXT'});
	}

	if ($in{'v'} eq 'list') { $print{'list'} = $SET{'DISP_LIST_NL'}; }
	if (!$Bforum::num) { $print{'tree'} = $SET{'DISP_TREE_NL'}; }

	$tmp3 = $head . $tmp2 . $foot;
	&Bforum::change($tmp3,\%print);
	undef %print;

	return $tmp3;

}

sub about {
	close (NULL);
	&Bforum::about((caller)[2] . '@' . &version);
}

1;

