-#!/usr/bin/perl\r
-################################################################################\r
-#\r
-# FSWiki Lite - źÉÕ¥Õ¥¡¥¤¥ë¤ò¥À¥¦¥ó¥í¡¼¥É¤¹¤ë¤¿¤á¤ÎCGI¥¹¥¯¥ê¥×¥È\r
-#\r
-################################################################################\r
-require "./lib/common.pl";\r
-#==============================================================================\r
-# ¥Ñ¥é¥á¡¼¥¿¤ò¼õ¤±¼è¤ë\r
-#==============================================================================\r
-&ReadParse();\r
-my $page = $in{"p"};\r
-my $file = $in{"f"};\r
-\r
-#==============================================================================\r
-# ¥¨¥é¡¼¥Á¥§¥Ã¥¯\r
-#==============================================================================\r
-if($page eq ""){\r
- &Util::error("¥Ú¡¼¥¸¤¬»ØÄꤵ¤ì¤Æ¤¤¤Þ¤»¤ó¡£");\r
-}\r
-if($file eq ""){\r
- &Util::error("¥Õ¥¡¥¤¥ë¤¬»ØÄꤵ¤ì¤Æ¤¤¤Þ¤»¤ó¡£");\r
-}\r
-#==============================================================================\r
-# ¥À¥¦¥ó¥í¡¼¥É\r
-#==============================================================================\r
-my $filename = sprintf("$main::ATTACH_DIR/%s.%s",&Util::url_encode($page),&Util::url_encode($file));\r
-unless(-e $filename){\r
- &Util::error("»ØÄꤵ¤ì¤¿¥Õ¥¡¥¤¥ë¤Ï¸ºß¤·¤Þ¤»¤ó¡£");\r
-}\r
-\r
-my $contenttype = &get_mime_type($file);\r
-my $ua = $ENV{"HTTP_USER_AGENT"};\r
-my $disposition = ($contenttype =~ /^image\// && $ua !~ /MSIE/ ? "inline" : "attachment");\r
-\r
-&jcode::convert(\$file,'sjis');\r
-\r
-print "Content-Type: $contenttype\n";\r
-print "Content-Disposition: $disposition;filename=\"$file\"\n\n";\r
-open(DATA,$filename);\r
-binmode(DATA);\r
-while(<DATA>){\r
- print $_;\r
-}\r
-close(DATA);\r
-\r
-\r
-#==============================================================================\r
-# MIME¥¿¥¤¥×¤ò¼èÆÀ¤·¤Þ¤¹\r
-#==============================================================================\r
-sub get_mime_type {\r
- my $file = shift;\r
- my $type = lc(substr($file,rindex($file,".")));\r
- my $ctype;\r
- \r
- if ($type eq ".gif" ){ $ctype = "image/gif"; }\r
- elsif($type eq ".txt" ){ $ctype = "text/plain"; }\r
- elsif($type eq ".rb" ){ $ctype = "text/plain"; }\r
- elsif($type eq ".pl" ){ $ctype = "text/plain"; }\r
- elsif($type eq ".java"){ $ctype = "text/plain"; }\r
-# elsif($type eq ".html"){ $ctype = "text/html"; }\r
-# elsif($type eq ".htm" ){ $ctype = "text/html"; }\r
- elsif($type eq ".css" ){ $ctype = "text/css"; }\r
- elsif($type eq ".jpeg"){ $ctype = "image/jpeg"; }\r
- elsif($type eq ".jpg" ){ $ctype = "image/jpeg"; }\r
- elsif($type eq ".png" ){ $ctype = "image/png"; }\r
- elsif($type eq ".bmp" ){ $ctype = "image/bmp"; }\r
- elsif($type eq ".doc" ){ $ctype = "application/msword"; }\r
- elsif($type eq ".xls" ){ $ctype = "application/vnd.ms-excel"; }\r
- else { $ctype = "application/octet-stream"; }\r
- \r
- return $ctype;\r
-}\r
+#!/usr/bin/perl
+################################################################################
+#
+# FSWiki Lite - źÉÕ¥Õ¥¡¥¤¥ë¤ò¥À¥¦¥ó¥í¡¼¥É¤¹¤ë¤¿¤á¤ÎCGI¥¹¥¯¥ê¥×¥È
+#
+################################################################################
+require "./lib/common.pl";
+#==============================================================================
+# ¥Ñ¥é¥á¡¼¥¿¤ò¼õ¤±¼è¤ë
+#==============================================================================
+&ReadParse();
+my $page = $in{"p"};
+my $file = $in{"f"};
+
+#==============================================================================
+# ¥¨¥é¡¼¥Á¥§¥Ã¥¯
+#==============================================================================
+if($page eq ""){
+ &Util::error("¥Ú¡¼¥¸¤¬»ØÄꤵ¤ì¤Æ¤¤¤Þ¤»¤ó¡£");
+}
+if($file eq ""){
+ &Util::error("¥Õ¥¡¥¤¥ë¤¬»ØÄꤵ¤ì¤Æ¤¤¤Þ¤»¤ó¡£");
+}
+#==============================================================================
+# ¥À¥¦¥ó¥í¡¼¥É
+#==============================================================================
+my $filename = sprintf("$main::ATTACH_DIR/%s.%s",&Util::url_encode($page),&Util::url_encode($file));
+unless(-e $filename){
+ &Util::error("»ØÄꤵ¤ì¤¿¥Õ¥¡¥¤¥ë¤Ï¸ºß¤·¤Þ¤»¤ó¡£");
+}
+
+my $contenttype = &get_mime_type($file);
+my $ua = $ENV{"HTTP_USER_AGENT"};
+my $disposition = ($contenttype =~ /^image\// && $ua !~ /MSIE/ ? "inline" : "attachment");
+
+&jcode::convert(\$file,'sjis');
+
+print "Content-Type: $contenttype\n";
+print "Content-Disposition: $disposition;filename=\"$file\"\n\n";
+open(DATA,$filename);
+binmode(DATA);
+while(<DATA>){
+ print $_;
+}
+close(DATA);
+
+
+#==============================================================================
+# MIME¥¿¥¤¥×¤ò¼èÆÀ¤·¤Þ¤¹
+#==============================================================================
+sub get_mime_type {
+ my $file = shift;
+ my $type = lc(substr($file,rindex($file,".")));
+ my $ctype;
+
+ if ($type eq ".gif" ){ $ctype = "image/gif"; }
+ elsif($type eq ".txt" ){ $ctype = "text/plain"; }
+ elsif($type eq ".rb" ){ $ctype = "text/plain"; }
+ elsif($type eq ".pl" ){ $ctype = "text/plain"; }
+ elsif($type eq ".java"){ $ctype = "text/plain"; }
+# elsif($type eq ".html"){ $ctype = "text/html"; }
+# elsif($type eq ".htm" ){ $ctype = "text/html"; }
+ elsif($type eq ".css" ){ $ctype = "text/css"; }
+ elsif($type eq ".jpeg"){ $ctype = "image/jpeg"; }
+ elsif($type eq ".jpg" ){ $ctype = "image/jpeg"; }
+ elsif($type eq ".png" ){ $ctype = "image/png"; }
+ elsif($type eq ".bmp" ){ $ctype = "image/bmp"; }
+ elsif($type eq ".doc" ){ $ctype = "application/msword"; }
+ elsif($type eq ".xls" ){ $ctype = "application/vnd.ms-excel"; }
+ else { $ctype = "application/octet-stream"; }
+
+ return $ctype;
+}