Removed lua.cgi wrapper; HTTP_ACCEPT_LANGUAGE is now obtained from Request
authorTimm S. Mueller <tmueller@neoscientists.org>
Mon, 20 Oct 2008 00:56:02 +0200
changeset 2492407b197ed8b
parent 248 d00981e0d1de
child 250 5107767c6c1e
Removed lua.cgi wrapper; HTTP_ACCEPT_LANGUAGE is now obtained from Request
object; minor cleanup
Makefile
cgi-bin/lua.cgi
cgi-bin/tek/class/cgi/request.lua
cgi-bin/tek/class/loona.lua
     1.1 --- a/Makefile	Fri Oct 10 18:00:45 2008 +0200
     1.2 +++ b/Makefile	Mon Oct 20 00:56:02 2008 +0200
     1.3 @@ -67,7 +67,7 @@
     1.4  	chmod -R 664 *
     1.5  	chown -R :$(GROUP) *
     1.6  	find . -type d | xargs chmod ugo+x
     1.7 -	chmod ugo+x $(CGIDIR)/loona.cgi $(CGIDIR)/loona_fastcgi.lua $(CGIDIR)/lua.cgi
     1.8 +	chmod ugo+x $(CGIDIR)/loona.cgi $(CGIDIR)/loona_fastcgi.lua
     1.9  	chown -R $(WWWUSER) $(VARDIR)/sessions $(VARDIR)/htmlcache
    1.10  	chown -R $(WWWUSER) $(CONTENTDIR) $(HTDIR)
    1.11  	find . -name CVS -type d | xargs -r chmod g+rw
    1.12 @@ -84,3 +84,8 @@
    1.13  
    1.14  fastcgi-run:
    1.15  	$(MAKE) -C cgi-bin $@
    1.16 +
    1.17 +
    1.18 +kdiff:
    1.19 +	-(a=$$(mktemp -du) && hg clone $$PWD $$a && kdiff3 $$a $$PWD; rm -rf $$a)
    1.20 +
     2.1 --- a/cgi-bin/lua.cgi	Fri Oct 10 18:00:45 2008 +0200
     2.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.3 @@ -1,6 +0,0 @@
     2.4 -#!/usr/local/bin/lua
     2.5 ---
     2.6 ---	Mini CGI wrapper -
     2.7 ---	Executes the addressed Lua script
     2.8 ---
     2.9 -dofile(os.getenv("PATH_TRANSLATED"))
     3.1 --- a/cgi-bin/tek/class/cgi/request.lua	Fri Oct 10 18:00:45 2008 +0200
     3.2 +++ b/cgi-bin/tek/class/cgi/request.lua	Mon Oct 20 00:56:02 2008 +0200
     3.3 @@ -19,7 +19,7 @@
     3.4  local io = io
     3.5  
     3.6  module("tek.class.cgi.request", tek.class)
     3.7 -_VERSION = "Request 5.5"
     3.8 +_VERSION = "Request 5.6"
     3.9  
    3.10  -------------------------------------------------------------------------------
    3.11  --	Request class:
    3.12 @@ -45,6 +45,7 @@
    3.13  	self.REQUEST_URI = self.getenv("REQUEST_URI")
    3.14  	self.SCRIPT_FILENAME = self.getenv("SCRIPT_FILENAME")
    3.15  	self.PATH_INFO = self.PATH_INFO or getenv("PATH_INFO") or false
    3.16 +	self.HTTP_ACCEPT_LANGUAGE = self.getenv("HTTP_ACCEPT_LANGUAGE") or false
    3.17  	return Class.new(class, self)
    3.18  end
    3.19  
     4.1 --- a/cgi-bin/tek/class/loona.lua	Fri Oct 10 18:00:45 2008 +0200
     4.2 +++ b/cgi-bin/tek/class/loona.lua	Mon Oct 20 00:56:02 2008 +0200
     4.3 @@ -37,7 +37,7 @@
     4.4  -------------------------------------------------------------------------------
     4.5  
     4.6  module("tek.class.loona", tek.class)
     4.7 -_VERSION = "LOona Class 5.6"
     4.8 +_VERSION = "LOona Class 5.7"
     4.9  
    4.10  -------------------------------------------------------------------------------
    4.11  --	Markup:
    4.12 @@ -1234,7 +1234,7 @@
    4.13  
    4.14  	local l = self.requestlang or self.args.lang
    4.15  	self.langs = { l and l:match("^%w+$") }
    4.16 -	local s = getenv("HTTP_ACCEPT_LANGUAGE")
    4.17 +	local s = self.request.HTTP_ACCEPT_LANGUAGE
    4.18  	while s do
    4.19  		local l, r = s:match("^([%w.=]+)[,;](.*)$")
    4.20  		l = l or s
    4.21 @@ -1612,6 +1612,11 @@
    4.22  end
    4.23  
    4.24  
    4.25 +local function checkpermission(self, perm)
    4.26 +	return self.session.data.permissions:find(perm) and true or false
    4.27 +end
    4.28 +
    4.29 +
    4.30  function Loona.new(class, self)
    4.31  
    4.32  	local parsed, msg
    4.33 @@ -1742,14 +1747,14 @@
    4.34  		self.authuser_debug = false
    4.35  		self.authuser_seeall = false
    4.36  	else
    4.37 -		self.authuser_edit = self.session.data.permissions:find("e") and true
    4.38 -		self.authuser_menu = self.session.data.permissions:find("m") and true
    4.39 -		self.authuser_publish = self.session.data.permissions:find("p") and true
    4.40 +		self.authuser_edit = checkpermission(self, "e")
    4.41 +		self.authuser_menu = checkpermission(self, "m")
    4.42 +		self.authuser_publish = checkpermission(self, "p")
    4.43  		self.authuser_profile = self.authuser_publish or
    4.44 -			self.session.data.permissions:find("c") and true
    4.45 -		self.authuser_visible = self.session.data.permissions:find("v") and true
    4.46 -		self.authuser_debug = self.session.data.permissions:find("d") and true
    4.47 -		self.authuser_seeall = self.session.data.permissions:find("a") and true
    4.48 +			checkpermission(self, "c")
    4.49 +		self.authuser_visible = checkpermission(self, "v")
    4.50 +		self.authuser_debug = checkpermission(self, "d")
    4.51 +		self.authuser_seeall = checkpermission(self, "a")
    4.52  	end
    4.53  
    4.54  	self = Class.new(class, self)