aboutsummaryrefslogtreecommitdiff
path: root/index.cgi
diff options
context:
space:
mode:
authorBenjamin Kellermann <Benjamin.Kellermann@gmx.de>2019-01-07 21:06:47 +0100
committerBenjamin Kellermann <Benjamin.Kellermann@gmx.de>2019-01-07 21:06:47 +0100
commit771e5cbfe743a81c00a4cbf89cd869e3b6a28bb2 (patch)
tree06b3ddd7e6997dbfb444cb1bb1880110340f2b12 /index.cgi
parenteabdbd545ed474ebcf63c3e839f2e50e40ddb379 (diff)
change constants to variables
Diffstat (limited to 'index.cgi')
-rwxr-xr-xindex.cgi28
1 files changed, 14 insertions, 14 deletions
diff --git a/index.cgi b/index.cgi
index 6e26ebb..b96a358 100755
--- a/index.cgi
+++ b/index.cgi
@@ -27,29 +27,29 @@ require_relative "dudle"
$d = Dudle.new
if $cgi.include?("create_poll") && $cgi.include?("poll_url")
- POLLTITLE=$cgi["create_poll"]
- if POLLTITLE == ""
+ polltitle=$cgi["create_poll"]
+ if polltitle == ""
createnotice = _("Please enter a descriptive title.")
else
if $cgi["poll_url"] == ""
- guessurl = POLLTITLE.gsub(" ","_").gsub(/[\?\!\.]/,"")
+ guessurl = polltitle.gsub(" ","_").gsub(/[\?\!\.]/,"")
if guessurl =~ /^[a-zA-Z0-9_-]+$/ && !File.exist?(guessurl)
- POLLURL = guessurl
+ pollurl = guessurl
else
chars = ("a".."z").to_a + ("1".."9").to_a
- POLLURL = Array.new(8){chars[rand(chars.size)]}.join
+ pollurl = Array.new(8){chars[rand(chars.size)]}.join
end
else
- POLLURL=$cgi["poll_url"]
+ pollurl=$cgi["poll_url"]
end
- if !(POLLURL =~ /\A[\w\-_]*\Z/)
+ if !(pollurl =~ /\A[\w\-_]*\Z/)
createnotice = _("Custom address may only contain letters, numbers, and dashes.")
- elsif File.exist?(POLLURL)
+ elsif File.exist?(pollurl)
createnotice = _("A poll with this address already exists.")
- else Dir.mkdir(POLLURL)
- Dir.chdir(POLLURL)
+ else Dir.mkdir(pollurl)
+ Dir.chdir(pollurl)
begin
VCS.init
File.symlink("../participate.rb","index.cgi")
@@ -60,16 +60,16 @@ if $cgi.include?("create_poll") && $cgi.include?("poll_url")
File.open(f,"w").close
VCS.add(f)
}
- Poll.new(CGI.escapeHTML(POLLTITLE),$cgi["poll_type"])
+ Poll.new(CGI.escapeHTML(polltitle),$cgi["poll_type"])
Dir.chdir("..")
$d.html.header["status"] = "REDIRECT"
$d.html.header["Cache-Control"] = "no-cache"
- $d.html.header["Location"] = $conf.siteurl + POLLURL + "/edit_columns.cgi"
- $d << _("The poll was created successfully. The link to your new poll is: %{link}") % {:link => "<br /><a href=\"#{POLLURL}\">#{POLLURL}</a>"}
+ $d.html.header["Location"] = $conf.siteurl + pollurl + "/edit_columns.cgi"
+ $d << _("The poll was created successfully. The link to your new poll is: %{link}") % {:link => "<br /><a href=\"#{pollurl}\">#{pollurl}</a>"}
rescue WrongPollTypeError # should only happen in case of hacking
Dir.chdir("..")
require "fileutils"
- FileUtils.rm_r(POLLURL)
+ FileUtils.rm_r(pollurl)
$d.html.header["status"] = "REDIRECT"
$d.html.header["Cache-Control"] = "no-cache"
$d.html.header["Location"] = "http://localhost/"