HEAD
load "charset.rb"
if File.exists?("config.rb")
load "config.rb"
else
puts "\nPlease configure me in the file config.rb"
exit
end
require "poll"
$htmlout += <
dudle
HEAD
$htmlout += '' if File.exists?("atom.cgi")
$htmlout += "
dudle
"
if $cgi.include?("create_poll")
SITE=$cgi["create_poll"]
if SITE.include?("/")
createnotice = "
Error: The character '/' is not allowed.
"
elsif File.exist?(SITE)
createnotice = "
Error: This poll already exists!
"
else Dir.mkdir(SITE)
Dir.chdir(SITE)
VCS.init
File.symlink("../participate.rb","index.cgi")
File.symlink("../atom.rb","atom.cgi")
File.symlink("../config_poll.rb","config.cgi")
File.symlink("../remove_poll.rb","remove.cgi")
["index.cgi","atom.cgi","config.cgi","remove.cgi"].each{|f|
VCS.add(f)
}
["data.yaml",".htaccess",".htdigest"].each{|f|
File.open(f,"w").close
VCS.add(f)
}
Poll.new(SITE,$cgi["poll_type"])
Dir.chdir("..")
escapedsite = SITEURL + CGI.escapeHTML(CGI.escape(SITE)) + "/"
escapedsite.gsub!("+"," ")
$header["status"] = "REDIRECT"
$header["Location"] = escapedsite
$htmlout = "The poll was created successfully. The link to your new poll is: #{escapedsite}"
end
end
unless $header["status"] == "REDIRECT"
$htmlout += <
CHARSET
$htmlout += <
CREATE
$htmlout += NOTICE
$htmlout += ""
$htmlout += ""
end
$header["Cache-Control"] = "no-cache"
$cgi.out($header){$htmlout}
end