cgi-bin/tek/class/loona.lua
changeset 249 2407b197ed8b
parent 248 d00981e0d1de
child 250 5107767c6c1e
     1.1 --- a/cgi-bin/tek/class/loona.lua	Fri Oct 10 18:00:45 2008 +0200
     1.2 +++ b/cgi-bin/tek/class/loona.lua	Mon Oct 20 00:56:02 2008 +0200
     1.3 @@ -37,7 +37,7 @@
     1.4  -------------------------------------------------------------------------------
     1.5  
     1.6  module("tek.class.loona", tek.class)
     1.7 -_VERSION = "LOona Class 5.6"
     1.8 +_VERSION = "LOona Class 5.7"
     1.9  
    1.10  -------------------------------------------------------------------------------
    1.11  --	Markup:
    1.12 @@ -1234,7 +1234,7 @@
    1.13  
    1.14  	local l = self.requestlang or self.args.lang
    1.15  	self.langs = { l and l:match("^%w+$") }
    1.16 -	local s = getenv("HTTP_ACCEPT_LANGUAGE")
    1.17 +	local s = self.request.HTTP_ACCEPT_LANGUAGE
    1.18  	while s do
    1.19  		local l, r = s:match("^([%w.=]+)[,;](.*)$")
    1.20  		l = l or s
    1.21 @@ -1612,6 +1612,11 @@
    1.22  end
    1.23  
    1.24  
    1.25 +local function checkpermission(self, perm)
    1.26 +	return self.session.data.permissions:find(perm) and true or false
    1.27 +end
    1.28 +
    1.29 +
    1.30  function Loona.new(class, self)
    1.31  
    1.32  	local parsed, msg
    1.33 @@ -1742,14 +1747,14 @@
    1.34  		self.authuser_debug = false
    1.35  		self.authuser_seeall = false
    1.36  	else
    1.37 -		self.authuser_edit = self.session.data.permissions:find("e") and true
    1.38 -		self.authuser_menu = self.session.data.permissions:find("m") and true
    1.39 -		self.authuser_publish = self.session.data.permissions:find("p") and true
    1.40 +		self.authuser_edit = checkpermission(self, "e")
    1.41 +		self.authuser_menu = checkpermission(self, "m")
    1.42 +		self.authuser_publish = checkpermission(self, "p")
    1.43  		self.authuser_profile = self.authuser_publish or
    1.44 -			self.session.data.permissions:find("c") and true
    1.45 -		self.authuser_visible = self.session.data.permissions:find("v") and true
    1.46 -		self.authuser_debug = self.session.data.permissions:find("d") and true
    1.47 -		self.authuser_seeall = self.session.data.permissions:find("a") and true
    1.48 +			checkpermission(self, "c")
    1.49 +		self.authuser_visible = checkpermission(self, "v")
    1.50 +		self.authuser_debug = checkpermission(self, "d")
    1.51 +		self.authuser_seeall = checkpermission(self, "a")
    1.52  	end
    1.53  
    1.54  	self = Class.new(class, self)