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

package webliberty::App::Trackback;

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

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

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

	return $self;
}

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

	$self-&gt;output_list;

	return;
}

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

	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_trackback}");
	$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_footer}");

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

	if (!$self-&gt;{config}-&gt;{site_url}) {
		$self-&gt;error('ã‚µã‚¤ãƒˆã®URLãŒè¨­å®šã•ã‚Œã¦ã„ã¾ã›ã‚“ã€‚');
	}

	$skin_ins-&gt;replace_skin(
		$diary_ins-&gt;info,
		INFO_NO =&gt; $self-&gt;{query}-&gt;{no}
	);

	my($index_date, $index_no, $flag);

	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 ($self-&gt;{query}-&gt;{no} == $no) {
			$index_date = $date;
			$index_no   = $no;

			$flag = 1;

			last;
		}
	}
	close(FH);

	if (!$flag) {
		$self-&gt;error('æŒ‡å®šã•ã‚ŒãŸè¨˜äº‹ã¯å­˜åœ¨ã—ã¾ã›ã‚“ã€‚');
	}

	my $data_file;
	if ($index_date =~ /^(\d\d\d\d)(\d\d)(\d\d)(\d\d)(\d\d)$/) {
		$data_file = "$1$2\.$self-&gt;{init}-&gt;{data_ext}";
	}

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

	open(FH, "$self-&gt;{init}-&gt;{data_dir}$self-&gt;{init}-&gt;{data_diary_dir}$data_file") or $self-&gt;error("Read Error : $self-&gt;{init}-&gt;{data_dir}$self-&gt;{init}-&gt;{data_diary_dir}$data_file");
	while (&lt;FH&gt;) {
		chomp;
		my($no, $id, $stat, $break, $comt, $tb, $field, $date, $name, $subj, $text, $color, $icon, $file, $host) = split(/\t/);

		if ($index_no == $no) {
			if (!$tb) {
				$self-&gt;error('ã“ã®è¨˜äº‹ã«ãƒˆãƒ©ãƒƒã‚¯ãƒãƒƒã‚¯ã‚’é€ä¿¡ã™ã‚‹ã“ã¨ã¯ã§ãã¾ã›ã‚“ã€‚');
			}

			last;
		}
	}
	close(FH);

	if (-e "$self-&gt;{init}-&gt;{data_dir}$self-&gt;{init}-&gt;{data_tb_dir}$self-&gt;{query}-&gt;{no}\.$self-&gt;{init}-&gt;{data_ext}") {
		$self-&gt;{html}-&gt;{contents} .= $skin_ins-&gt;get_replace_data(
			'trackback_head',
			ARTICLE_TRACKBACK_START =&gt; '&lt;!--',
			ARTICLE_TRACKBACK_END   =&gt; '--&gt;',
		);

		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;{contents} .= $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;{contents} .= $skin_ins-&gt;get_replace_data(
			'trackback_foot',
			ARTICLE_TRACKBACK_START =&gt; '&lt;!--',
			ARTICLE_TRACKBACK_END   =&gt; '--&gt;',
		);
	}

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

	print $self-&gt;header;
	foreach ($skin_ins-&gt;get_list) {
		print $self-&gt;{html}-&gt;{$_};
	}

	return;
}

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