diff options
author | Benjamin Kellermann <Benjamin.Kellermann@gmx.de> | 2008-10-30 20:54:34 +0100 |
---|---|---|
committer | Benjamin Kellermann <Benjamin.Kellermann@gmx.de> | 2008-10-30 20:54:34 +0100 |
commit | a618c050e2694f4ea437c5583d8dc763e4bd8780 (patch) | |
tree | 44e1477609c00f270a1567c00c4fccd94a04806d /index.cgi | |
parent | 43b72ebc81a6cd2edfc90435a6b32a29b0bd1e36 (diff) |
use cgi to print out
Diffstat (limited to 'index.cgi')
-rwxr-xr-x | index.cgi | 18 |
1 files changed, 10 insertions, 8 deletions
@@ -8,14 +8,14 @@ if __FILE__ == $0 $cgi = CGI.new -CONTENTTYPE = "text/html; charset=utf-8" +TYPE = "text/html" +CHARSET = "utf-8" #CONTENTTYPE = "application/xhtml+xml; charset=utf-8" -puts "Content-type: #{CONTENTTYPE}" -puts "Cache-Control: no-cache" - +utfcookie = CGI::Cookie.new("utf", "true") +utfcookie.path = "/" if ($cgi.include?("utf") || $cgi.cookies["utf"][0]) && !$cgi.include?("ascii") - puts "Set-Cookie: utf=true; path=/; expires=#{(Time.now+1*60*60*24*365).getgm.strftime("%a, %d %b %Y %H:%M:%S %Z")}" + utfcookie.expires = Time.now+1*60*60*24*365 UTFASCII = "<a href='?ascii' style='text-decoration:none'>ASCII</a>" BACK = CGI.escapeHTML("↩") @@ -29,7 +29,7 @@ if ($cgi.include?("utf") || $cgi.cookies["utf"][0]) && !$cgi.include?("ascii") MONTHFORWARD = CGI.escapeHTML("→") YEARFORWARD = CGI.escapeHTML("↠") else - puts "Set-Cookie: utf=true; path=/; expires=#{(Time.now-1*60*60*24*365).getgm.strftime("%a, %d %b %Y %H:%M:%S %Z")}" + utfcookie.expires = Time.now-1*60*60*24*36 UTFASCII = "<a href='?utf' style='text-decoration:none'>#{CGI.escapeHTML('↩✔✘?–↞←→↠')}</a>" BACK = CGI.escapeHTML("<-") @@ -44,8 +44,7 @@ else YEARFORWARD = CGI.escapeHTML(">>") end -puts <<HEAD - +$htmlout = <<HEAD <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> @@ -56,4 +55,7 @@ if File.exist?("data.yaml") else load "overview.rb" end + +$cgi.out("type" => TYPE ,"charset" => CHARSET,"cookie" => utfcookie, "Cache-Control" => "no-cache"){$htmlout} end + |