[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Debian JP master SVN www commits (rev.119)



=======================================================
Repository: /org/svn.debian.or.jp/repos
  Revision: 119
  Commiter: kmuto
      Date: 2007-01-04 23:55:18 +0900 (木, 04  1月 2007)
=======================================================
Log:

add blosxom data

=======================================================
Changed:

A   www/trunk/blosxom/
A   www/trunk/blosxom/data/
A   www/trunk/blosxom/data/flavours/
A   www/trunk/blosxom/data/flavours/content_type.html
A   www/trunk/blosxom/data/flavours/content_type.rss
A   www/trunk/blosxom/data/flavours/date.html
A   www/trunk/blosxom/data/flavours/foot.html
A   www/trunk/blosxom/data/flavours/head.html
A   www/trunk/blosxom/data/flavours/maketemplate.pl
A   www/trunk/blosxom/data/flavours/story.html
A   www/trunk/blosxom/data/test.d
A   www/trunk/blosxom/plugins/
A   www/trunk/blosxom/plugins/dynamic_cache
U   www/trunk/include/page

Added: www/trunk/blosxom/data/flavours/content_type.html
===================================================================
--- www/trunk/blosxom/data/flavours/content_type.html	2007-01-04 14:04:40 UTC (rev 118)
+++ www/trunk/blosxom/data/flavours/content_type.html	2007-01-04 14:55:18 UTC (rev 119)
@@ -0,0 +1 @@
+text/html; charset=euc-jp


Property changes on: www/trunk/blosxom/data/flavours/content_type.html
___________________________________________________________________
Name: svn:mime-type
   + text/plain; charset=euc-jp

Added: www/trunk/blosxom/data/flavours/content_type.rss
===================================================================
--- www/trunk/blosxom/data/flavours/content_type.rss	2007-01-04 14:04:40 UTC (rev 118)
+++ www/trunk/blosxom/data/flavours/content_type.rss	2007-01-04 14:55:18 UTC (rev 119)
@@ -0,0 +1 @@
+application/xml; charset=euc-jp

Added: www/trunk/blosxom/data/flavours/date.html
===================================================================
--- www/trunk/blosxom/data/flavours/date.html	2007-01-04 14:04:40 UTC (rev 118)
+++ www/trunk/blosxom/data/flavours/date.html	2007-01-04 14:55:18 UTC (rev 119)
@@ -0,0 +1 @@
+<h3>$yr年$mo_num月$da日</h3>


Property changes on: www/trunk/blosxom/data/flavours/date.html
___________________________________________________________________
Name: svn:mime-type
   + text/plain; charset=euc-jp

Added: www/trunk/blosxom/data/flavours/foot.html
===================================================================
--- www/trunk/blosxom/data/flavours/foot.html	2007-01-04 14:04:40 UTC (rev 118)
+++ www/trunk/blosxom/data/flavours/foot.html	2007-01-04 14:55:18 UTC (rev 119)
@@ -0,0 +1,22 @@
+ </div>
+</div>
+
+<hr>
+<div class="footer">
+	<p>
+	このページに関するご感想・ご質問は
+	<a href="../project/index.html#webadmin">webadmin at debian.or.jp</a>
+	までお送りください。</p>
+	<p>
+	<span class="copyright">Copyright &copy;</span>
+	Debian JP Project / 
+	<a href="../project/license.html">ライセンス条項</a>を見る。</p>
+	<p>
+	<a href="http://www.debian.org/";><img src="../image/debian.gif" width="80" height="15" title="Debian" alt="powered by Debian"></a>
+	<a href="http://validator.w3.org/check?uri=referer";>
+	<img src="../image/slogo_html401.png" width="80" height="15" title="HTML 4.01" alt="Valid HTML 4.01!"></a>
+	<a href="http://jigsaw.w3.org/css-validator/";>
+	<img src="../image/w3c_validcssb.png" width="80" height="15" title="CSS" alt="Valid CSS!"></a></p>
+</div>
+</body>
+</html>
\ No newline at end of file


Property changes on: www/trunk/blosxom/data/flavours/foot.html
___________________________________________________________________
Name: svn:mime-type
   + text/plain; charset=euc-jp

Added: www/trunk/blosxom/data/flavours/head.html
===================================================================
--- www/trunk/blosxom/data/flavours/head.html	2007-01-04 14:04:40 UTC (rev 118)
+++ www/trunk/blosxom/data/flavours/head.html	2007-01-04 14:55:18 UTC (rev 119)
@@ -0,0 +1,92 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd";>
+<html lang="ja">
+<head>
+ <meta http-equiv="Keywords" content="Debian JP Project">
+ <meta http-equiv="Content-Type" content="text/html; charset=EUC-JP">
+ <meta http-equiv="Content-Style-Type" content="text/css">
+ <link rel="INDEX" href="../index.html">
+ <link rel="Debian-JP icon" href="../favicon.ico">
+<link rel="alternate" type="application/rss+xml" title="RSS" href="$url/index.rss" />
+ <link rel="stylesheet" type="text/css" href="../css/debianjp.css" media="all">
+
+ <link rev="made" href="webadmin at debian.or.jp">
+ <title>Debian JP Project - 最近の話題</title>
+</head>
+<body>
+<div class="header">
+<H1>
+<a href="../."><img src="../image/JPLogo2.1.jpg" width="222" height="79" alt="Debian JP Project"></a>
+</H1>
+
+<p style="font-size: 80%">(for vocal browsers: <a href="#TOC">toc</a>, <a href="#MAIN">main</a>)
+</p>
+
+<!-- SiteSearch Google -->
+<form method="GET" action="http://www.google.co.jp/search";>
+<table><tr valign=top><td>
+<a href="http://www.google.co.jp/";>
+<img src="http://www.google.com/logos/Logo_25wht.gif";
+class="google" alt="Google"></A>
+</td>
+<td class="google">
+<input type="text" name="q" size="31" maxlength="255" value="">
+<input type="hidden" name="hl" value="ja">
+<input type="hidden" name="ie" value="EUC-JP">
+<input type="submit" name="btnG" value="Google 検索">
+<input type="hidden" name="domains" value="www.debian.or.jp"><br><input type="radio" name="sitesearch" value=""> WWW 全体 <input type="radio" name="sitesearch" value="www.debian.or.jp" checked> www.debian.or.jp 検索
+</td></tr></table>
+</form>
+<!-- SiteSearch Google -->
+</div>
+
+<div class="menu">
+[ <a href="../index.html">トップ</a>
+ | 
+  <a href="../using/">導入と利用</a>
+ | 
+  <a href="../community/">コミュニティ</a>
+ | 
+  <a href="../project/">Debian JP Project</a>
+ ]
+</div>
+<hr>
+<div class="sidebar" id="TOC">
+ <div class="section">
+ <h2>おしらせ</h2>
+ <ul>
+<li><a href="../blog/">最近の話題</a></li>
+  <li><a href="http://www.jp.debian.org/News/weekly/";>Debian ウィークリーニュース</a></li>
+ </ul>
+
+ <h2>Debian の導入と利用</h2>
+ <ul>
+<li><a href="../using/">始めの一歩</a></li>
+  <li><a href="../using/release.html">リリース情報</a></li>
+  <li><a href="../using/book.html">書籍情報</a></li>
+  <li><a href="../using/">&raquo;</a></li>
+ </ul>
+
+ <h2>コミュニティ</h2>
+ <ul>
+<li><a href="../community/">概要</a></li>
+  <li><a href="../community/ml/">メーリングリスト</a></li>
+  <li><a href="../community/irc.html">IRC</a></li>
+  <li><a href="../community/bugreport.html">バグ報告</a></li>
+  <li><a href="../community/events/">イベント</a></li>
+  <li><a href="../community/devel/">開発者のコーナー</a></li>
+  <li><a href="../community/translate/">執筆者/翻訳者のコーナー</a></li>
+  <li><a href="../community/">&raquo;</a></li>
+ </ul>
+
+ <h2>Debian JP Project</h2>
+ <ul>
+<li><a href="../project/">Project について</a></li>
+  <li><a href="../project/organization.html">組織構成</a></li>
+  <li><a href="../project/join.html">参加しませんか?</a></li>
+  <li><a href="../project/donations.html">支援/スポンサー</a></li>
+  <li><a href="../project/">&raquo;</a></li>
+ </ul>
+ </div>
+</div>
+<div class="content" id="MAIN"> <div class="section">
+<h2>最近の話題</h2>


Property changes on: www/trunk/blosxom/data/flavours/head.html
___________________________________________________________________
Name: svn:mime-type
   + text/plain; charset=euc-jp

Added: www/trunk/blosxom/data/flavours/maketemplate.pl
===================================================================
--- www/trunk/blosxom/data/flavours/maketemplate.pl	2007-01-04 14:04:40 UTC (rev 118)
+++ www/trunk/blosxom/data/flavours/maketemplate.pl	2007-01-04 14:55:18 UTC (rev 119)
@@ -0,0 +1,43 @@
+#!/usr/bin/perl -w
+#  Make head/foot file from www.debian.or.jp
+use strict;
+
+my($dest) = "";
+my($ref) = "/blog/dummy.html";
+my($flag) = 0;
+
+open(F, "../../ttreerc") || die "Can't open ttreerc: $!\n";
+while (<F>) {
+    if (/^dest = (.*)/) {
+	$dest = $1 . $ref;
+	last;
+    }
+}
+close(F);
+open(HEAD, ">head.html") || die "Can't create head.html: $!\n";
+open(FOOT, ">foot.html") || die "Can't create foot.html: $!\n";
+
+open(F, "$dest") || die "Can't open $dest: $!\n";
+while (<F>) {
+    if (/^\-\- BEGIN ARTICLE \-\-/) {
+	$flag = 1;
+	print HEAD "<h2>最近の話題</h2>\n";
+	next;
+    }
+    if (/^\-\- END ARTICLE \-\-/) {
+	$flag = 2;
+	next;
+    }
+
+    if ($flag == 0) {
+	print HEAD;
+	if (/<link rel="Debian-JP icon" /) {
+	    print HEAD "<link rel=\"alternate\" type=\"application/rss+xml\" title=\"RSS\" href=\"\$url/index.rss\" />";
+	}
+    } elsif ($flag == 2) {
+	print FOOT;
+    }
+}
+close(F);
+close(HEAD);
+close(FOOT);


Property changes on: www/trunk/blosxom/data/flavours/maketemplate.pl
___________________________________________________________________
Name: svn:executable
   + *

Added: www/trunk/blosxom/data/flavours/story.html
===================================================================
--- www/trunk/blosxom/data/flavours/story.html	2007-01-04 14:04:40 UTC (rev 118)
+++ www/trunk/blosxom/data/flavours/story.html	2007-01-04 14:55:18 UTC (rev 119)
@@ -0,0 +1,9 @@
+<div class="blogbody">
+<a name="$fn"><h4>$title</h4></a>
+
+$body
+
+<p class="right">
+<i><span class="date">$yr/$mo_num/$da $hh</span> <a href="$url/$path/$fn.html">リンク</a></i>
+</p>
+</div>


Property changes on: www/trunk/blosxom/data/flavours/story.html
___________________________________________________________________
Name: svn:mime-type
   + text/plain; charset=euc-jp

Added: www/trunk/blosxom/data/test.d
===================================================================
--- www/trunk/blosxom/data/test.d	2007-01-04 14:04:40 UTC (rev 118)
+++ www/trunk/blosxom/data/test.d	2007-01-04 14:55:18 UTC (rev 119)
@@ -0,0 +1,3 @@
+abc
+
+abc!

Added: www/trunk/blosxom/plugins/dynamic_cache
===================================================================
--- www/trunk/blosxom/plugins/dynamic_cache	2007-01-04 14:04:40 UTC (rev 118)
+++ www/trunk/blosxom/plugins/dynamic_cache	2007-01-04 14:55:18 UTC (rev 119)
@@ -0,0 +1,202 @@
+# Blosxom Plugin: dynamic_cache
+# Author: MayimMayim
+# Version: 2004-09-05
+
+package dynamic_cache;
+
+use strict;
+use CGI::Carp qw(fatalsToBrowser);       #エラー時にブラウザへ表示
+
+# --- Configurable variables -----------
+my $cache_dir = "$blosxom::static_dir/caches";		#キャッシュ保存先
+my $redirect_url = '/blog/caches';					#キャッシュリダイレクト先URL(空ならファイルを読み込み表示)
+my $log_filename = "$blosxom::plugin_state_dir/dynamic_cache.log";	#ログファイル名
+my $log_filemax = 0;						#ログファイル最大サイズ(0なら作成しない)
+my $target_flavour = 'html rss htm';			#キャッシュ対象フレーバー
+my %replace_flavour = (							#置換するフレーバー
+	'comment' => 'htm',
+);
+my $post_recache_all = '1';						#POST時に全キャッシュクリア(0=OFF, 1=ON)
+my %post_recache = (							#POST時のrecacheパラメータをflavour毎に定義
+	'htm' => 'page,index',
+	'trackback' => 'page,index',
+	'wikieditish' => 'page,index',
+);
+# --------------------------------------
+
+use CGI qw(:standard);
+use FileHandle;
+my $fh = new FileHandle;
+my $cachefile;
+
+sub start {
+	my $recache = CGI::param('recache');	# 再キャッシュパラメータ
+	my ($path, $file, $ext) = (' 'x200, ' 'x128, ' 'x32);	#パス分解用
+
+	# flavour置換 (廃止した旧flavourへのアクセスを置き換える)
+	foreach my $old_flavour (keys %replace_flavour) {
+		($blosxom::flavour eq $old_flavour) 
+			and $blosxom::path_info =~s/$blosxom::flavour$/$replace_flavour{$old_flavour}/
+			and $blosxom::flavour = $replace_flavour{$old_flavour}
+			and last;
+	}
+
+	# ロボット対策 (reindex/recacheの実行や対象外flavourへのアクセスを拒否)
+	my ($agent,$uri,$method) = ($ENV{HTTP_USER_AGENT}, $ENV{REQUEST_URI}, request_method());
+	if( $agent=~/(msnbot)|(Googlebot)|(Yahoo! Slurp)|(NaverBot)|(Ask Jeeves)|(inktomi)|(InfoSeek)/i
+		 && (CGI::param('reindex') || $recache ne'' || $target_flavour!~/$blosxom::flavour/ || $method eq 'POST')
+	){
+		print "Status: 403 Forbidden\nContent-type:text/html\n\n";
+		print "<h3>403 Forbidden</h3><p>You don't have permission to access this file.</p>";
+		logput("DENY ");
+		exit(0);
+	}
+
+	# recache指定が無い、かつPOST時、既定のrecacheパラメータを適用
+	if($recache eq'' && $method eq 'POST') {
+		($post_recache_all eq '1') and $recache ='all'
+		or defined $post_recache{$blosxom::flavour} and $recache = $post_recache{$blosxom::flavour};
+	}
+
+	# キャッシュ全クリア
+	# 【flavourの記述例】<input type="hidden" name="recache" value="all">
+	if($recache=~/all/i){
+		require File::Path;
+		File::Path::rmtree($cache_dir) and logput("CLEAR","ALL");
+	}
+
+	# キャッシュ対象ファイルパス (日付指定もパスとみなしキャッシュ対象とする)
+	$cachefile = $blosxom::path_info;
+	defined $blosxom::path_info_yr and $cachefile .="/$blosxom::path_info_yr"
+		and defined $blosxom::path_info_mo_num and $cachefile .="/$blosxom::path_info_mo_num"
+		and defined $blosxom::path_info_da and $cachefile .="/$blosxom::path_info_da";
+	unless ($blosxom::path_info =~ /\.$blosxom::flavour$/) {
+		$cachefile =~ s!/$!!;
+		$cachefile .= "/index.$blosxom::flavour";
+	}
+
+	# 投稿エントリのキャッシュを削除
+	# 【flavourの記述例】<input type="hidden" name="recache" value="page">
+	if($recache =~/page/i || $method eq 'POST') {
+		($path, $file, $ext) = ($cachefile =~m!(?:(.*)/)?(.+)(\..+)!)
+			and delete_cache($path, $file, 0);
+	}
+
+	# index.*のキャッシュを探して削除
+	# 【flavourの記述例】<input type="hidden" name="recache" value="page,index">
+	if($recache =~/index/i){
+		($path, $file, $ext) = ($cachefile =~m!(?:(.*)/)?(.+)(\..+)!)
+			and delete_cache($path, 'index', 1);
+	}
+
+	# 日付パスのindex.*のキャッシュを削除
+	# 【flavourの記述例】<input type="hidden" name="recache_date" value="$yr/$mo_num/$da">
+	if(param('recache_date') =~/(\d{4})\/(\d{2})\/(\d{2})/) {
+		delete_cache("/$1/$2/$3", 'index', 1);
+	}
+
+	# 指定キャッシュの削除(;区切りで複数可)
+	# 【flavourの記述例】<input type="hidden" name="recache_entries" value="foo.wikieditish;foo/bar.wikieditish">
+	if(param('recache_entries')) {
+		my @recache_entries = split(/;/, param('recache_entries'));
+		foreach my $entry (@recache_entries) {
+			($entry ne'' && $entry!~/\.\./)
+				and ($path, $file, $ext) = ($entry =~m!(?:(.*)/)?(.+)(\..+)!)
+					and delete_cache($path, $file, 0);
+		}
+	}
+
+	# キャッシュしないケース
+	if( $ENV{'QUERY_STRING'} ne '' || $target_flavour!~/$blosxom::flavour/) {
+		logput("PASS ");
+		$cachefile ='';
+		return 0;
+	}
+
+	# キャッシュがすでに存在する?
+	if(-f "$cache_dir/$cachefile"){
+		if($redirect_url eq''){		#ファイルを読み込んで出力
+			if($fh->open("< $cache_dir/$cachefile")){
+				print join('', <$fh>);
+				$fh->close;
+				logput("HIT! ");
+				exit(0);
+			}
+		}else{						#リダイレクトを使用
+			my $redirect = "$redirect_url/$cachefile";
+#			print redirect($redirect);
+			print header(-Location=>$redirect);		# keep url
+			logput("HIT! ");
+			exit(0);
+		}
+	}
+
+	return 1;
+}
+
+sub last {
+	#リダイレクトを使用する場合は、コンテンツのみファイル保存
+	($redirect_url ne'') and ($cachefile ne'' && %blosxom::files) and save_cache();
+}
+
+sub end {
+	#ファイルを読み込んで出力する場合は、content-typeを含めてファイル保存
+	($redirect_url eq'') and ($cachefile ne'' && %blosxom::files) and save_cache();
+}
+
+# pathを上位に遡ってファイル名が一致するキャッシュを削除する
+sub delete_cache {
+	my ($path, $fn, $up) = @_;
+	return 0 if($fn eq'');
+	$path =~ m!^/! or $path = "/$path";
+	$path =~ s!/$!!;
+
+	do{
+		opendir(DIR, "$cache_dir$path")
+		and grep { /^${fn}\.[^\.]+$/ && unlink("$cache_dir$path/$_") && logput("CLEAR","$path/$_") } readdir(DIR)
+		and closedir(DIR);
+	} while ($up and $path =~ s/(\/*[^\/]*)$// and $1);
+	1;
+}
+
+# $blosxom::outputの内容をキャッシュに保存する
+sub save_cache {
+
+	# ディレクトリ作成
+	my ($path, $file, $ext) = ($cachefile =~m!(?:(.*)/)?(.+)(\..+)!);
+	if($path ne ''){
+		require File::Path;
+		File::Path::mkpath("$cache_dir/$path",0,0755);
+	}
+
+	# キャッシュファイル出力
+	if ($fh->open("> $cache_dir/$cachefile")) {
+		print $fh $blosxom::output;
+		close $fh;
+		logput("SAVE ");
+	}
+}
+
+# ログ出力
+sub logput{
+	return 1 unless($log_filemax>0);
+
+	my ($msg, $text) = @_;
+	$text eq'' and $text = "$ENV{REQUEST_URI}\t$ENV{HTTP_USER_AGENT}\t$ENV{HTTP_REFERER}";
+
+	# 最大サイズ時バックアップ作成
+	if( (stat($log_filename))[7] > $log_filemax){
+		unlink "$log_filename.bak";
+		rename $log_filename,"$log_filename.bak";
+	}
+
+	#ログ書き込み
+	if($fh->open(">> $log_filename"))
+	{
+		print $fh "$msg: $text\n";
+		$fh->close;
+	}
+	1;
+}
+
+1;

Modified: www/trunk/include/page
===================================================================
--- www/trunk/include/page	2007-01-04 14:04:40 UTC (rev 118)
+++ www/trunk/include/page	2007-01-04 14:55:18 UTC (rev 119)
@@ -29,6 +29,7 @@
 [% END %]
 [%- content -%]
 [%- IF template.name != "index.tt2" -%]
+
  </div>
 </div>
 [% END %]