#!/usr/bin/env ruby ################################ # Author: Benjamin Kellermann # # License: CC-by-sa 3.0 # # see License # ################################ require "yaml" require "cgi" if __FILE__ == $0 $cgi = CGI.new $header = {} $header["type"] = "text/html" #$header["type"] = "application/xhtml+xml" $header["charset"] = "utf-8" $htmlout = <
HEAD olddir = File.expand_path(".") Dir.chdir("..") load "charset.rb" load "config.rb" require "poll" require "datepoll" require "timepoll" Dir.chdir(olddir) # BUGFIX for Time.parse, which handles the zone indeterministically class << Time alias_method :old_parse, :parse def Time.parse(date, now=self.now) Time.old_parse("2009-10-25 00:30") Time.old_parse(date) end end acusers = {} if $cgi.include?("revision") REVISION=$cgi["revision"].to_i table = YAML::load(VCS.cat(REVISION, "data.yaml")) VCS.cat(REVISION,".htdigest").each_line{|l| v,k = l.scan(/^(.*):(.*):.*$/).flatten acusers[k] = v } else table = YAML::load_file("data.yaml") File.open(".htdigest","r").each_line{|l| v,k = l.scan(/^(.*):(.*):.*$/).flatten acusers[k] = v } if $cgi.include?("add_participant") if $cgi.include?("delete_participant") table.delete($cgi["olduser"]) else table.add_participant($cgi["olduser"],$cgi["add_participant"],{}) end end table.edit_column($cgi["new_columnname"],$cgi["columndescription"],$cgi["old_columnname"]) if $cgi.include?("new_columnname") table.delete_column($cgi["delete_column"]) if $cgi.include?("delete_column") def writehtaccess(acusers) File.open(".htaccess","w"){|htaccess| if acusers["admin"] htaccess << <