diff options
author | Benjamin Kellermann <Benjamin.Kellermann@gmx.de> | 2011-07-21 10:04:34 +0200 |
---|---|---|
committer | Benjamin Kellermann <Benjamin.Kellermann@gmx.de> | 2011-07-21 10:04:34 +0200 |
commit | 4902522900eceb90f09445c82948f4cb7bf8df5d (patch) | |
tree | a0a6a6ee74502126cc02fd57403759216734e653 /delete_poll.rb | |
parent | c8779b53ec10795c7d96530d541d42399015b3d9 (diff) |
disable example deletion
Diffstat (limited to '')
-rwxr-xr-x | delete_poll.rb | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/delete_poll.rb b/delete_poll.rb index 6f2e506..72c51a8 100755 --- a/delete_poll.rb +++ b/delete_poll.rb @@ -36,19 +36,25 @@ if $cgi.include?("confirmnumber") CONFIRM = $cgi["confirmnumber"].to_i if USERCONFIRM == QUESTIONS[CONFIRM] Dir.chdir("..") - FileUtils.cp_r($d.urlsuffix, "/tmp/#{$d.urlsuffix}.#{rand(9999999)}") - FileUtils.rm_r($d.urlsuffix) - if $cgi.include?("return") - $d.html.header["status"] = "REDIRECT" - $d.html.header["Cache-Control"] = "no-cache" - $d.html.header["Location"] = $conf.siteurl + $cgi["return"] - $d.out - exit - end + if $conf.examples.collect{|e| e[:url] }.include?($d.urlsuffix) + deleteconfirmstr = _("Example polls can not be deleted.") + accidentstr = "" + else + FileUtils.cp_r($d.urlsuffix, "/tmp/#{$d.urlsuffix}.#{rand(9999999)}") + FileUtils.rm_r($d.urlsuffix) + + if $cgi.include?("return") + $d.html.header["status"] = "REDIRECT" + $d.html.header["Cache-Control"] = "no-cache" + $d.html.header["Location"] = $conf.siteurl + $cgi["return"] + $d.out + exit + end - deleteconfirmstr = _("The poll was deleted successfully!") - accidentstr = _("If this was done by accident, please contact the administrator of the system. The poll can be recovered for an indeterministic amount of time, maybe it is already to late.") + deleteconfirmstr = _("The poll was deleted successfully!") + accidentstr = _("If this was done by accident, please contact the administrator of the system. The poll can be recovered for an indeterministic amount of time, maybe it is already to late.") + end nextthingsstr = _("Things you can do now are") homepagestr = _("Return to dudle home and schedule a new poll") wikipediastr = _("Browse Wikipedia") |