<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">#webliberty::App::List.pm (2006/03/13)
#Copyright(C) 2002-2006 Knight, All rights reserved.

package webliberty::App::List;

use strict;
use base qw(webliberty::Basis);
use webliberty::Date;
use webliberty::Skin;
use webliberty::App::Diary;

### ã‚³ãƒ³ã‚¹ãƒˆãƒ©ã‚¯ã‚¿
sub new {
	my $class = shift;

	my $self = {
		init   =&gt; shift,
		config =&gt; shift,
		query  =&gt; shift,
		field  =&gt; undef,
		index  =&gt; undef,
		past   =&gt; undef,
		html   =&gt; undef
	};
	bless $self, $class;

	my $i;

	open(FH, "$self-&gt;{init}-&gt;{data_dir}$self-&gt;{init}-&gt;{data_field}") or $self-&gt;error("Read Error : $self-&gt;{init}-&gt;{data_dir}$self-&gt;{init}-&gt;{data_field}");
	while (&lt;FH&gt;) {
		chomp;

		$self-&gt;{field}-&gt;{++$i} = $_;
	}
	close(FH);

	open(FH, "$self-&gt;{init}-&gt;{data_dir}$self-&gt;{init}-&gt;{data_diary_dir}$self-&gt;{init}-&gt;{data_diary_index}") or $self-&gt;error("Read Error : $self-&gt;{init}-&gt;{data_dir}$self-&gt;{init}-&gt;{data_diary_dir}$self-&gt;{init}-&gt;{data_diary_index}");
	while (&lt;FH&gt;) {
		chomp;
		my($date, $no, $id, $stat, $field, $name) = split(/\t/);

		if ($stat and $self-&gt;{query}-&gt;{no} == $no) {
			$self-&gt;{index}-&gt;{date} = $date;
			$self-&gt;{index}-&gt;{no}   = $no;
		} elsif ($stat and $self-&gt;{index}-&gt;{size} == $self-&gt;{query}-&gt;{page} * $self-&gt;{config}-&gt;{page_size}) {
			$self-&gt;{index}-&gt;{date} = $date;
			$self-&gt;{index}-&gt;{no}   = $no;
		}

		if ($stat and (!$self-&gt;{query}-&gt;{field} or $field =~ /^$self-&gt;{field}-&gt;{$self-&gt;{query}-&gt;{field}}(&lt;|$)/)) {
			$self-&gt;{index}-&gt;{size}++;
		}

		if ($field =~ /&lt;&gt;/) {
			$self-&gt;{index}-&gt;{field}-&gt;{$field}++;
			$self-&gt;{index}-&gt;{field}-&gt;{(split(/&lt;&gt;/, $field))[0]}++;
		} else {
			$self-&gt;{index}-&gt;{field}-&gt;{$field}++;
		}

		if ($stat and $date =~ /^(\d\d\d\d)(\d\d)(\d\d)\d\d\d\d$/) {
			$self-&gt;{index}-&gt;{calendar}-&gt;{"$1$2$3"} = 1;
			$self-&gt;{past}-&gt;{"$1$2"}                = 1;
		}
	}
	close(FH);

	return $self;
}

### ãƒ¡ã‚¤ãƒ³å‡¦ç†
sub run {
	my $self = shift;

	$self-&gt;output_list;

	return;
}

### è¨˜äº‹è¡¨ç¤º
sub output_list {
	my $self = shift;

	my $start_file;
	if ($self-&gt;{query}-&gt;{date} =~ /^(\d\d\d\d)(\d\d)/) {
		$start_file = "$self-&gt;{init}-&gt;{data_dir}$self-&gt;{init}-&gt;{data_diary_dir}$1$2\.$self-&gt;{init}-&gt;{data_ext}";
	} elsif ($self-&gt;{index}-&gt;{date} =~ /^(\d\d\d\d)(\d\d)\d\d\d\d\d\d$/) {
		$start_file = "$self-&gt;{init}-&gt;{data_dir}$self-&gt;{init}-&gt;{data_diary_dir}$1$2\.$self-&gt;{init}-&gt;{data_ext}";
	}

	my $skin_ins = new webliberty::Skin;
	$skin_ins-&gt;parse_skin("$self-&gt;{init}-&gt;{skin_dir}$self-&gt;{init}-&gt;{skin_header}");
	$skin_ins-&gt;parse_skin("$self-&gt;{init}-&gt;{skin_dir}$self-&gt;{init}-&gt;{skin_diary}");
	$skin_ins-&gt;parse_skin("$self-&gt;{init}-&gt;{skin_dir}$self-&gt;{init}-&gt;{skin_navigation}");
	$skin_ins-&gt;parse_skin("$self-&gt;{init}-&gt;{skin_dir}$self-&gt;{init}-&gt;{skin_footer}");

	my $diary_ins = new webliberty::App::Diary($self-&gt;{init}, $self-&gt;{config}, $self-&gt;{query});

	$skin_ins-&gt;replace_skin(
		$diary_ins-&gt;info
	);

	$self-&gt;{html}-&gt;{header} = $skin_ins-&gt;get_data('header');

	if (!$self-&gt;{query}-&gt;{no}) {
		$self-&gt;{html}-&gt;{logs_head} = $skin_ins-&gt;get_data('logs_head');
	}

	$self-&gt;_diary_list($skin_ins, $diary_ins, $start_file);

	if (!$self-&gt;{query}-&gt;{no} and !$self-&gt;{query}-&gt;{date}) {
		$self-&gt;_page_list($skin_ins);
		$self-&gt;_navi_list($skin_ins);
	}
	if (!$self-&gt;{query}-&gt;{no}) {
		$self-&gt;{html}-&gt;{logs_foot} = $skin_ins-&gt;get_data('logs_foot');
	}

	if (!$self-&gt;{query}-&gt;{no}) {
		$self-&gt;{html}-&gt;{navigation_head} = $skin_ins-&gt;get_data('navigation_head');
		$self-&gt;{html}-&gt;{navigation_foot} = $skin_ins-&gt;get_data('navigation_foot');

		$self-&gt;{html}-&gt;{information_head} = $skin_ins-&gt;get_data('information_head');
		$self-&gt;{html}-&gt;{information_foot} = $skin_ins-&gt;get_data('information_foot');

		$self-&gt;_calendar_navi($skin_ins);
		$self-&gt;_menu_navi($skin_ins);
		$self-&gt;_field_navi($skin_ins);
		$self-&gt;_search_navi($skin_ins);
		$self-&gt;_record_navi($skin_ins, $diary_ins);
		$self-&gt;_comment_navi($skin_ins, $diary_ins);
		$self-&gt;_trackback_navi($skin_ins, $diary_ins);
		$self-&gt;_past_navi($skin_ins, $diary_ins);
		$self-&gt;_link_navi($skin_ins);
		$self-&gt;_profile_navi($skin_ins, $diary_ins);
	}

	$self-&gt;{html}-&gt;{footer} = $skin_ins-&gt;get_data('footer');

	if (*STDOUT eq "*main::STDOUT") {
		print $self-&gt;header;
	}
	foreach ($skin_ins-&gt;get_list) {
		print $self-&gt;{html}-&gt;{$_};
	}

	return;
}

### ã‚«ãƒ¬ãƒ³ãƒ€ãƒ¼
sub _calendar_navi {
	my $self     = shift;
	my $skin_ins = shift;

	if (!$self-&gt;{config}-&gt;{show_calendar}) {
		return;
	}

	my $info_path;
	if ($self-&gt;{init}-&gt;{script_file} =~ /([^\/\\]*)$/) {
		$info_path = "$self-&gt;{config}-&gt;{site_url}$1";
	}

	my $this_year;
	my $this_month;
	my $this_day;
	if ($self-&gt;{query}-&gt;{date} =~ /^(\d\d\d\d)(\d\d)(\d\d)$/) {
		$this_year  = $1;
		$this_month = $2;
		$this_day   = $3;
	} elsif ($self-&gt;{query}-&gt;{date} =~ /^(\d\d\d\d)(\d\d)$/) {
		$this_year  = $1;
		$this_month = $2;
		$this_day   = 1;
	} elsif ($self-&gt;{query}-&gt;{date} =~ /^(\d\d\d\d)$/) {
		$this_year  = $1;
		$this_month = 1;
		$this_day   = 1;
	} else {
		my($sec, $min, $hour, $day, $mon, $year) = localtime(time);
		$this_year  = $year + 1900;
		$this_month = $mon + 1;
		$this_day   = $day;
	}

	my $prev_month = $this_month - 1;
	my $prev_year  = $this_year;
	if ($prev_month &lt; 1) {
		$prev_month = 12;
		$prev_year--;
	}

	my $next_month = $this_month + 1;
	my $next_year  = $this_year;
	if ($next_month &gt; 12) {
		$next_month = 1;
		$next_year++;
	}

	$skin_ins-&gt;replace_skin(
		CALENDAR_THIS_YEAR  =&gt; int($this_year),
		CALENDAR_THIS_MONTH =&gt; int($this_month),
		CALENDAR_THIS_DAY   =&gt; int($this_day),
		CALENDAR_PREV_YEAR  =&gt; sprintf("%04d", $prev_year),
		CALENDAR_PREV_MONTH =&gt; sprintf("%02d", $prev_month),
		CALENDAR_NEXT_YEAR  =&gt; sprintf("%04d", $next_year),
		CALENDAR_NEXT_MONTH =&gt; sprintf("%02d", $next_month)
	);

	my $day_ins  = new webliberty::Date;
	my $week_key = $day_ins-&gt;get_week($this_year, $this_month, 1);
	my $last_day = (31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31)[$this_month - 1] + ($this_month == 2 and (($this_year % 4 == 0 and $this_year % 100 != 0) or $this_year % 400 == 0));
	$self-&gt;{html}-&gt;{calendar_head} = $skin_ins-&gt;get_data('calendar_head');

	my($show_flag, $holi_flag, $stat, $day, $week_number);

	foreach (1 .. 42) {
		if (($_ - 1) % 7 == $week_key) {
			$show_flag = 1;
		}
		if ($day == $last_day) {
			$show_flag = 0;
		}

		if ($_ % 7 == 1) {
			$self-&gt;{html}-&gt;{calendar_head} .= $skin_ins-&gt;get_data('calendar_weekhead');
		}

		if ($show_flag) {
			$day++;

			my $date = sprintf("%04d%02d%02d", $this_year, $this_month, $day);

			if ($_ % 7 == 1) {
				$stat = 'sunday';
			} elsif ($_ % 7 == 0) {
				$stat = 'satday';
			} else {
				$stat = 'day';
			}
			if ($holi_flag) {
				$stat = 'sunday';
				$holi_flag = 0;
			} else {
				foreach my $holiday (@{$self-&gt;{init}-&gt;{days_holiday}}) {
					if ((sprintf("%02d", $this_month) . sprintf("%02d", $day)) eq $holiday) {
						if ($_ % 7 == 1) {
							$holi_flag = 1;
						}
						$stat = 'sunday';
						last;
					}
				}
				while (my($month, $week) = each(%{$self-&gt;{init}-&gt;{weeks_holiday}})) {
					if ($_ % 7 == 2 and sprintf("%02d", $this_month) eq $month and $week_number eq $week) {
						$stat = 'sunday';
						last;
					}
				}
			}

			my($day_start, $day_end);
			if ($self-&gt;{index}-&gt;{calendar}-&gt;{$date}) {
				$day_start = "&lt;a href=\"$info_path?date=$date\"&gt;";
				$day_end   = "&lt;/a&gt;";
			} else {
				$day_start = '';
				$day_end   = '';
			}

			if ($stat eq 'sunday') {
				$self-&gt;{html}-&gt;{calendar_head} .= $skin_ins-&gt;get_replace_data(
					'calendar_sunday',
					CALENDAR_DAY       =&gt; $day,
					CALENDAR_DAY_START =&gt; $day_start,
					CALENDAR_DAY_END   =&gt; $day_end
				);
			} elsif ($stat eq 'satday') {
				$self-&gt;{html}-&gt;{calendar_head} .= $skin_ins-&gt;get_replace_data(
					'calendar_satday',
					CALENDAR_DAY       =&gt; $day,
					CALENDAR_DAY_START =&gt; $day_start,
					CALENDAR_DAY_END   =&gt; $day_end
				);
			} else {
				$self-&gt;{html}-&gt;{calendar_head} .= $skin_ins-&gt;get_replace_data(
					'calendar_day',
					CALENDAR_DAY       =&gt; $day,
					CALENDAR_DAY_START =&gt; $day_start,
					CALENDAR_DAY_END   =&gt; $day_end
				);
			}
		} else {
			$self-&gt;{html}-&gt;{calendar_head} .= $skin_ins-&gt;get_data('calendar_void');
		}

		if ($_ % 7 == 1 and $show_flag) {
			$week_number++;
		}
		if ($_ % 7 == 0) {
			$self-&gt;{html}-&gt;{calendar_head} .= $skin_ins-&gt;get_data('calendar_weekfoot');
		}
	}

	$self-&gt;{html}-&gt;{calendar_head} .= $skin_ins-&gt;get_data('calendar_foot');

	return;
}

### ã‚³ãƒ³ãƒ†ãƒ³ãƒ„ä¸€è¦§
sub _menu_navi {
	my $self     = shift;
	my $skin_ins = shift;

	if (!$self-&gt;{config}-&gt;{show_menu}) {
		return;
	}

	$self-&gt;{html}-&gt;{menu} = $skin_ins-&gt;get_data('menulist_head');

	open(FH, "$self-&gt;{init}-&gt;{data_dir}$self-&gt;{init}-&gt;{data_menu}") or $self-&gt;error("Read Error : $self-&gt;{init}-&gt;{data_dir}$self-&gt;{init}-&gt;{data_menu}");
	my @menus = &lt;FH&gt;;
	close(FH);

	foreach (@menus) {
		chomp;
		my($field, $name, $url) = split(/\t/);

		if (!$field) {
			$self-&gt;{html}-&gt;{menu} .= $skin_ins-&gt;get_replace_data(
				'menu',
				MENU_NAME =&gt; $name,
				MENU_URL  =&gt; $url
			);
		}
	}

	foreach my $menu_list (split(/&lt;&gt;/, $self-&gt;{config}-&gt;{menu_list})) {
		$self-&gt;{html}-&gt;{menu} .= $skin_ins-&gt;get_replace_data(
			'menulist_field',
			MENU_FIELD =&gt; $menu_list
		);

		foreach (@menus) {
			chomp;
			my($field, $name, $url) = split(/\t/);

			if ($menu_list eq $field) {
				$self-&gt;{html}-&gt;{menu} .= $skin_ins-&gt;get_data('menu_head');

				$self-&gt;{html}-&gt;{menu} .= $skin_ins-&gt;get_replace_data(
					'menu',
					MENU_NAME =&gt; $name,
					MENU_URL  =&gt; $url
				);

				$self-&gt;{html}-&gt;{menu} .= $skin_ins-&gt;get_data('menu_foot');
			}
		}

		$self-&gt;{html}-&gt;{menu} .= $skin_ins-&gt;get_data('menulist_delimiter');
	}

	$self-&gt;{html}-&gt;{menu} .= $skin_ins-&gt;get_data('menulist_foot');

	return;
}

### åˆ†é¡žä¸€è¦§
sub _field_navi {
	my $self     = shift;
	my $skin_ins = shift;

	if (!$self-&gt;{config}-&gt;{show_field}) {
		return;
	}

	$self-&gt;{html}-&gt;{field} = $skin_ins-&gt;get_data('field_head');

	my($parent_flag, $child_flag, $i);

	open(FH, "$self-&gt;{init}-&gt;{data_dir}$self-&gt;{init}-&gt;{data_field}") or $self-&gt;error("Read Error : $self-&gt;{init}-&gt;{data_dir}$self-&gt;{init}-&gt;{data_field}");
	while (&lt;FH&gt;) {
		chomp;

		if ($_ =~ /^(.+)&lt;&gt;(.+)$/) {
			if (!$child_flag) {
				$self-&gt;{html}-&gt;{field} .= $skin_ins-&gt;get_data('child_head');
				$child_flag = 1;
			}

			$self-&gt;{html}-&gt;{field} .= $skin_ins-&gt;get_replace_data(
				'child',
				FIELD_NAME   =&gt; $2,
				FIELD_PARENT =&gt; $1,
				FIELD_NO     =&gt; ++$i,
				FIELD_SIZE   =&gt; $self-&gt;{index}-&gt;{field}-&gt;{$_} || 0
			);
		} else {
			if ($child_flag) {
				$self-&gt;{html}-&gt;{field} .= $skin_ins-&gt;get_data('child_foot');
				$child_flag = 0;
			}
			if ($parent_flag) {
				$self-&gt;{html}-&gt;{field} .= $skin_ins-&gt;get_data('field_delimiter');
			}

			$self-&gt;{html}-&gt;{field} .= $skin_ins-&gt;get_replace_data(
				'field',
				FIELD_NAME =&gt; $_,
				FIELD_NO   =&gt; ++$i,
				FIELD_SIZE =&gt; $self-&gt;{index}-&gt;{field}-&gt;{$_} || 0
			);

			$parent_flag = 1;
		}
	}
	close(FH);

	if ($child_flag) {
		$self-&gt;{html}-&gt;{field} .= $skin_ins-&gt;get_data('child_foot');
	}
	$self-&gt;{html}-&gt;{field} .= $skin_ins-&gt;get_data('field_delimiter');
	$self-&gt;{html}-&gt;{field} .= $skin_ins-&gt;get_data('field_foot');

	return;
}

### æ¤œç´¢ãƒ•ã‚©ãƒ¼ãƒ&nbsp;
sub _search_navi {
	my $self     = shift;
	my $skin_ins = shift;

	if (!$self-&gt;{config}-&gt;{show_search}) {
		return;
	}

	$self-&gt;{html}-&gt;{search} = $skin_ins-&gt;get_data('search');

	return;
}

### æœ€è¿‘ã®è¨˜äº‹ä¸€è¦§
sub _record_navi {
	my $self       = shift;
	my $skin_ins   = shift;
	my $diary_ins  = shift;

	if (!$self-&gt;{config}-&gt;{list_size}) {
		return;
	}

	opendir(DIR, "$self-&gt;{init}-&gt;{data_dir}$self-&gt;{init}-&gt;{data_diary_dir}") or $self-&gt;error("Read Error : $self-&gt;{init}-&gt;{data_dir}$self-&gt;{init}-&gt;{data_diary_dir}");
	my @dir = sort { $b &lt;=&gt; $a } readdir(DIR);
	closedir(DIR);

	my $flag = 1;
	my $i;

	$self-&gt;{html}-&gt;{list} = $skin_ins-&gt;get_data('list_head');

	foreach my $entry (@dir) {
		if ($entry !~ /^\d\d\d\d\d\d\.$self-&gt;{init}-&gt;{data_ext}$/) {
			next;
		}
		if ($flag) {
			open(FH, "$self-&gt;{init}-&gt;{data_dir}$self-&gt;{init}-&gt;{data_diary_dir}$entry") or $self-&gt;error("Read Error : $self-&gt;{init}-&gt;{data_dir}$self-&gt;{init}-&gt;{data_diary_dir}$entry");
			while (&lt;FH&gt;) {
				chomp;
				my($no, $id, $stat, $break, $comt, $tb, $field, $date, $name, $subj, $text, $color, $icon, $file, $host) = split(/\t/);

				if (!$stat) {
					next;
				}

				$i++;
				if ($i &gt; $self-&gt;{config}-&gt;{list_size}) {
					$flag = 0;
					last;
				}

				$self-&gt;{html}-&gt;{list} .= $skin_ins-&gt;get_replace_data(
					'list',
					$diary_ins-&gt;diary_article($no, $id, $stat, $break, $comt, $tb, $field, $date, $name, $subj, $text, $color, $icon, $file, $host)
				);
			}
			close(FH);
		}
	}

	$self-&gt;{html}-&gt;{list} .= $skin_ins-&gt;get_data('list_foot');

	return;
}

### ã‚³ãƒ¡ãƒ³ãƒˆä¸€è¦§
sub _comment_navi {
	my $self      = shift;
	my $skin_ins  = shift;
	my $diary_ins = shift;

	if (!$self-&gt;{config}-&gt;{cmtlist_size}) {
		return;
	}

	$self-&gt;{html}-&gt;{cmtlist} = $skin_ins-&gt;get_data('cmtlist_head');

	my($index_size, $i);

	open(FH, "$self-&gt;{init}-&gt;{data_dir}$self-&gt;{init}-&gt;{data_comt_dir}$self-&gt;{init}-&gt;{data_comt_index}") or $self-&gt;error("Read Error : $self-&gt;{init}-&gt;{data_dir}$self-&gt;{init}-&gt;{data_comt_dir}$self-&gt;{init}-&gt;{data_comt_index}");
	while (&lt;FH&gt;) {
		$index_size++;
	}
	seek(FH, 0, 0);
	while (&lt;FH&gt;) {
		chomp;
		my($no, $pno, $stat, $date, $name, $subj, $host) = split(/\t/);

		$i++;
		if ($i &gt; $self-&gt;{config}-&gt;{cmtlist_size}) {
			last;
		}

		$self-&gt;{html}-&gt;{cmtlist} .= $skin_ins-&gt;get_replace_data(
			'cmtlist',
			$diary_ins-&gt;comment_article($no, $pno, $stat, $date, $name, '', '', $subj, '', '', '', '', '', '', $host)
		);
	}
	close(FH);

	$self-&gt;{html}-&gt;{cmtlist} .= $skin_ins-&gt;get_data('cmtlist_foot');

	return;
}

### ãƒˆãƒ©ãƒƒã‚¯ãƒãƒƒã‚¯ä¸€è¦§
sub _trackback_navi {
	my $self      = shift;
	my $skin_ins  = shift;
	my $diary_ins = shift;

	if (!$self-&gt;{config}-&gt;{tblist_size}) {
		return;
	}

	$self-&gt;{html}-&gt;{tblist} = $skin_ins-&gt;get_data('tblist_head');

	my($index_size, $i);

	open(FH, "$self-&gt;{init}-&gt;{data_dir}$self-&gt;{init}-&gt;{data_tb_dir}$self-&gt;{init}-&gt;{data_tb_index}") or $self-&gt;error("Read Error : $self-&gt;{init}-&gt;{data_dir}$self-&gt;{init}-&gt;{data_tb_dir}$self-&gt;{init}-&gt;{data_tb_index}");
	while (&lt;FH&gt;) {
		$index_size++;
	}
	seek(FH, 0, 0);
	while (&lt;FH&gt;) {
		chomp;
		my($no, $pno, $stat, $date, $blog, $title, $url) = split(/\t/);

		$i++;
		if ($i &gt; $self-&gt;{config}-&gt;{tblist_size}) {
			last;
		}

		$self-&gt;{html}-&gt;{tblist} .= $skin_ins-&gt;get_replace_data(
			'tblist',
			$diary_ins-&gt;trackback_article($no, $pno, $stat, $date, $blog, $title, $url, '')
		);
	}
	close(FH);

	$self-&gt;{html}-&gt;{tblist} .= $skin_ins-&gt;get_data('tblist_foot');

	return;
}

### éŽåŽ»ãƒ­ã‚°ä¸€è¦§
sub _past_navi {
	my $self       = shift;
	my $skin_ins   = shift;
	my $diary_ins  = shift;

	if (!$self-&gt;{config}-&gt;{show_past}) {
		return;
	}

	$self-&gt;{html}-&gt;{past} = $skin_ins-&gt;get_data('past_head');

	foreach my $past (sort { $b &lt;=&gt; $a } keys %{$self-&gt;{past}}) {
		if ($past =~ /^(\d\d\d\d)(\d\d)$/) {
			my $past_year  = $1;
			my $past_month = $2;

			$self-&gt;{html}-&gt;{past} .= $skin_ins-&gt;get_replace_data(
				'past',
				PAST_YEAR  =&gt; $past_year,
				PAST_MONTH =&gt; $past_month
			);
		}
	}

	$self-&gt;{html}-&gt;{past} .= $skin_ins-&gt;get_data('past_foot');

	return;
}

### ãƒªãƒ³ã‚¯é›†
sub _link_navi {
	my $self     = shift;
	my $skin_ins = shift;

	if (!$self-&gt;{config}-&gt;{show_link}) {
		return;
	}

	$self-&gt;{html}-&gt;{link} = $skin_ins-&gt;get_data('linklist_head');

	open(FH, "$self-&gt;{init}-&gt;{data_dir}$self-&gt;{init}-&gt;{data_link}") or $self-&gt;error("Read Error : $self-&gt;{init}-&gt;{data_dir}$self-&gt;{init}-&gt;{data_link}");
	my @links = &lt;FH&gt;;
	close(FH);

	foreach (@links) {
		chomp;
		my($field, $name, $url) = split(/\t/);

		if (!$field) {
			$self-&gt;{html}-&gt;{link} .= $skin_ins-&gt;get_replace_data(
				'link',
				LINK_NAME =&gt; $name,
				LINK_URL  =&gt; $url
			);
		}
	}

	foreach my $link_list (split(/&lt;&gt;/, $self-&gt;{config}-&gt;{link_list})) {
		$self-&gt;{html}-&gt;{link} .= $skin_ins-&gt;get_replace_data(
			'linklist_field',
			LINK_FIELD =&gt; $link_list
		);

		foreach (@links) {
			chomp;
			my($field, $name, $url) = split(/\t/);

			if ($link_list eq $field) {
				$self-&gt;{html}-&gt;{link} .= $skin_ins-&gt;get_data('link_head');

				$self-&gt;{html}-&gt;{link} .= $skin_ins-&gt;get_replace_data(
					'link',
					LINK_NAME =&gt; $name,
					LINK_URL  =&gt; $url
				);

				$self-&gt;{html}-&gt;{link} .= $skin_ins-&gt;get_data('link_foot');
			}
		}

		$self-&gt;{html}-&gt;{link} .= $skin_ins-&gt;get_data('linklist_delimiter');
	}

	$self-&gt;{html}-&gt;{link} .= $skin_ins-&gt;get_data('linklist_foot');

	return;
}

### ãƒ—ãƒ­ãƒ•ã‚£ãƒ¼ãƒ«ä¸€è¦§
sub _profile_navi {
	my $self     = shift;
	my $skin_ins = shift;

	if (!$self-&gt;{config}-&gt;{show_profile}) {
		return;
	}

	$self-&gt;{html}-&gt;{profile} = $skin_ins-&gt;get_data('profile_head');

	open(FH, "$self-&gt;{init}-&gt;{data_dir}$self-&gt;{init}-&gt;{data_profile}") or $self-&gt;error("Read Error : $self-&gt;{init}-&gt;{data_dir}$self-&gt;{init}-&gt;{data_profile}");
	while (&lt;FH&gt;) {
		chomp;
		my($user, $name, $text) = split(/\t/);

		$self-&gt;{html}-&gt;{profile} .= $skin_ins-&gt;get_replace_data(
			'profile',
			PROFILE_USER =&gt; $user,
			PROFILE_NAME =&gt; $name,
			PROFILE_TEXT =&gt; $text
		);
	}
	close(FH);

	$self-&gt;{html}-&gt;{profile} .= $skin_ins-&gt;get_data('profile_foot');

	return;
}

### è¨˜äº‹ä¸€è¦§
sub _diary_list {
	my $self       = shift;
	my $skin_ins   = shift;
	my $diary_ins  = shift;
	my $start_file = shift;

	my $no_ins    = new webliberty::String($self-&gt;{query}-&gt;{no});
	my $date_ins  = new webliberty::String($self-&gt;{query}-&gt;{date});
	my $field_ins = new webliberty::String($self-&gt;{query}-&gt;{field});

	$no_ins-&gt;create_number;
	$date_ins-&gt;create_number;
	$field_ins-&gt;create_number;

	opendir(DIR, "$self-&gt;{init}-&gt;{data_dir}$self-&gt;{init}-&gt;{data_diary_dir}") or $self-&gt;error("Read Error : $self-&gt;{init}-&gt;{data_dir}$self-&gt;{init}-&gt;{data_diary_dir}");
	my @dir = sort { $b &lt;=&gt; $a } readdir(DIR);
	closedir(DIR);

	my($dir_flag, $file_flag, $show_flag, $comt_flag, $tb_flag, $i);

	$self-&gt;{html}-&gt;{diary} = $skin_ins-&gt;get_data('diary_head');

	foreach my $entry (@dir) {
		if ($entry !~ /^\d\d\d\d\d\d\.$self-&gt;{init}-&gt;{data_ext}$/) {
			next;
		}
		if ($start_file eq "$self-&gt;{init}-&gt;{data_dir}$self-&gt;{init}-&gt;{data_diary_dir}$entry") {
			$dir_flag = 1;
		}
		if ($dir_flag) {
			open(FH, "$self-&gt;{init}-&gt;{data_dir}$self-&gt;{init}-&gt;{data_diary_dir}$entry") or $self-&gt;error("Read Error : $self-&gt;{init}-&gt;{data_dir}$self-&gt;{init}-&gt;{data_diary_dir}$entry");
			while (&lt;FH&gt;) {
				chomp;
				my($no, $id, $stat, $break, $comt, $tb, $field, $date, $name, $subj, $text, $color, $icon, $file, $host) = split(/\t/);

				if ($date_ins-&gt;get_string or $no == $self-&gt;{index}-&gt;{no}) {
					$file_flag = 1;
				}
				if ($file_flag and $stat) {
					if ($no_ins-&gt;get_string and $no != $no_ins-&gt;get_string) {
						next;
					}
					if ($date_ins-&gt;get_string and $date !~ /^$self-&gt;{query}-&gt;{date}/) {
						next;
					}
					if ($field_ins-&gt;get_string and $field !~ /^$self-&gt;{field}-&gt;{$self-&gt;{query}-&gt;{field}}(&lt;|$)/) {
						next;
					}
					if (!$field_ins-&gt;get_string or $field =~ /^$self-&gt;{field}-&gt;{$self-&gt;{query}-&gt;{field}}(&lt;|$)/) {
						$i++;
					}

					$self-&gt;{html}-&gt;{diary} .= $skin_ins-&gt;get_replace_data(
						'diary',
						$diary_ins-&gt;diary_article($no, $id, $stat, $break, $comt, $tb, $field, $date, $name, $subj, $text, $color, $icon, $file, $host)
					);

					$show_flag = 1;

					if (!$date_ins-&gt;get_string and ($no_ins-&gt;get_string or $i &gt;= $self-&gt;{config}-&gt;{page_size})) {
						if ($no_ins-&gt;get_string) {
							$comt_flag = $comt;
							$tb_flag   = $tb;
						}

						$dir_flag  = 0;
						$file_flag = 0;

						last;
					}
				}
			}
			close(FH);
		}
	}
	if (!$show_flag) {
		$self-&gt;{html}-&gt;{diary} .= $skin_ins-&gt;get_replace_data(
			'diary',
			$diary_ins-&gt;diary_article(0, '', 1, 1, 0, 0, 'æœªåˆ†é¡ž', '', '', 'No Data', 'è©²å½“ã™ã‚‹è¨˜äº‹ã¯ã‚ã‚Šã¾ã›ã‚“ã€‚', '', '', '', '')
		);
	}

	if ($show_flag and $no_ins-&gt;get_string and $tb_flag) {
		$self-&gt;{html}-&gt;{trackback_head} = $skin_ins-&gt;get_replace_data(
			'trackback_head',
			ARTICLE_NO =&gt; $no_ins-&gt;get_string
		);

		if (-e "$self-&gt;{init}-&gt;{data_dir}$self-&gt;{init}-&gt;{data_tb_dir}" . $no_ins-&gt;get_string . "\.$self-&gt;{init}-&gt;{data_ext}") {
			open(FH, "$self-&gt;{init}-&gt;{data_dir}$self-&gt;{init}-&gt;{data_tb_dir}$self-&gt;{query}-&gt;{no}\.$self-&gt;{init}-&gt;{data_ext}") or $self-&gt;error("Read Error : $self-&gt;{init}-&gt;{data_dir}$self-&gt;{init}-&gt;{data_tb_dir}$self-&gt;{query}-&gt;{no}\.$self-&gt;{init}-&gt;{data_ext}");
			while (&lt;FH&gt;) {
				chomp;
				my($no, $pno, $stat, $date, $blog, $title, $url, $excerpt) = split(/\t/);

				$self-&gt;{html}-&gt;{trackback} .= $skin_ins-&gt;get_replace_data(
					'trackback',
					$diary_ins-&gt;trackback_article($no, $pno, $stat, $date, $blog, $title, $url, $excerpt)
				);
			}
			close(FH);
		}

		$self-&gt;{html}-&gt;{trackback_foot} = $skin_ins-&gt;get_data('trackback_foot');
	}

	if ($show_flag and $no_ins-&gt;get_string and $comt_flag) {
		$self-&gt;{html}-&gt;{comment} = $skin_ins-&gt;get_replace_data(
			'comment_head',
			ARTICLE_NO =&gt; $no_ins-&gt;get_string
		);

		if (-e "$self-&gt;{init}-&gt;{data_dir}$self-&gt;{init}-&gt;{data_comt_dir}" . $no_ins-&gt;get_string . "\.$self-&gt;{init}-&gt;{data_ext}") {
			open(FH, "$self-&gt;{init}-&gt;{data_dir}$self-&gt;{init}-&gt;{data_comt_dir}$self-&gt;{query}-&gt;{no}\.$self-&gt;{init}-&gt;{data_ext}") or $self-&gt;error("Read Error : $self-&gt;{init}-&gt;{data_dir}$self-&gt;{init}-&gt;{data_comt_dir}$self-&gt;{query}-&gt;{no}\.$self-&gt;{init}-&gt;{data_ext}");
			while (&lt;FH&gt;) {
				chomp;
				my($no, $pno, $stat, $date, $name, $mail, $url, $subj, $text, $color, $icon, $file, $rank, $pwd, $host) = split(/\t/);

				$self-&gt;{html}-&gt;{comment} .= $skin_ins-&gt;get_replace_data(
					'comment',
					$diary_ins-&gt;comment_article($no, $pno, $stat, $date, $name, $mail, $url, $subj, $text, $color, $icon, $file, $rank, $pwd, $host)
				);
			}
			close(FH);
		}

		$self-&gt;{html}-&gt;{comment} .= $skin_ins-&gt;get_data('comment_foot');
	}

	$self-&gt;{html}-&gt;{diary} .= $skin_ins-&gt;get_data('diary_foot');

	return;
}

### ãƒšãƒ¼ã‚¸ç§»å‹•ãƒªãƒ³ã‚¯ä¸€è¦§
sub _page_list {
	my $self     = shift;
	my $skin_ins = shift;

	my $field_ins = new webliberty::String($self-&gt;{query}-&gt;{field});
	my $page_ins  = new webliberty::String($self-&gt;{query}-&gt;{page});

	$field_ins-&gt;create_number;
	$page_ins-&gt;create_number;

	my $info_path;
	if ($self-&gt;{init}-&gt;{script_file} =~ /([^\/\\]*)$/) {
		$info_path = "$self-&gt;{config}-&gt;{site_url}$1";
	}

	my($field_link, $prev_start, $prev_end, $next_start, $next_end);

	if ($field_ins-&gt;get_string) {
		$field_link = '&amp;amp;field=' . $field_ins-&gt;get_string;
	}

	if ($page_ins-&gt;get_string &gt; 0) {
		$prev_start = "&lt;a href=\"$info_path?page=" . ($page_ins-&gt;get_string - 1) . "$field_link\"&gt;";
		$prev_end   = "&lt;/a&gt;";
	}
	if (int(($self-&gt;{index}-&gt;{size} - 1) / $self-&gt;{config}-&gt;{page_size}) &gt; $page_ins-&gt;get_string) {
		$next_start = "&lt;a href=\"$info_path?page=" . ($page_ins-&gt;get_string + 1) . "$field_link\"&gt;";
		$next_end   = "&lt;/a&gt;";
	}

	$self-&gt;{html}-&gt;{page} = $skin_ins-&gt;get_replace_data(
		'page',
		PAGE_PREV_START =&gt; $prev_start,
		PAGE_PREV_END   =&gt; $prev_end,
		PAGE_NEXT_START =&gt; $next_start,
		PAGE_NEXT_END   =&gt; $next_end
	);

	return;
}

### ãƒŠãƒ“ã‚²ãƒ¼ã‚·ãƒ§ãƒ³ä¸€è¦§
sub _navi_list {
	my $self     = shift;
	my $skin_ins = shift;

	my $field_ins = new webliberty::String($self-&gt;{query}-&gt;{field});
	$field_ins-&gt;create_number;

	my $info_path;
	if ($self-&gt;{init}-&gt;{script_file} =~ /([^\/\\]*)$/) {
		$info_path = "$self-&gt;{config}-&gt;{site_url}$1";
	}

	$self-&gt;{html}-&gt;{navi} = $skin_ins-&gt;get_data('navi_head');

	foreach (0 .. int(($self-&gt;{index}-&gt;{size} - 1) / $self-&gt;{config}-&gt;{page_size})) {
		my($field_link, $prev_start, $prev_end);

		if ($field_ins-&gt;get_string) {
			$field_link = '&amp;amp;field=' . $field_ins-&gt;get_string;
		}

		if ($_ != $field_ins-&gt;get_string) {
			$prev_start = "&lt;a href=\"$info_path?page=$_$field_link\"&gt;";
			$prev_end   = "&lt;/a&gt;";
		}
		$self-&gt;{html}-&gt;{navi} .= $skin_ins-&gt;get_replace_data(
			'navi',
			NAVI_NO    =&gt; $_ + 1,
			NAVI_START =&gt; $prev_start,
			NAVI_END   =&gt; $prev_end,
		);
	}

	$self-&gt;{html}-&gt;{navi} .= $skin_ins-&gt;get_data('navi_foot');

	return;
}

1;
</pre></body></html>