liquid_feedback_frontend

changeset 1222:a38df55525d6

Removed support for old WebMCP 1.x and clean up of example configuration
author bsw
date Tue Dec 01 13:59:16 2015 +0100 (2015-12-01)
parents e80c8790a1ca
children 526b8c82d5fb
files app/main/_prefork/10_init.lua config/devel.lua config/example.lua config/init.lua config/lf3.lua
line diff
     1.1 --- a/app/main/_prefork/10_init.lua	Tue Dec 01 02:10:40 2015 +0100
     1.2 +++ b/app/main/_prefork/10_init.lua	Tue Dec 01 13:59:16 2015 +0100
     1.3 @@ -1,3 +1,65 @@
     1.4 +config.app_version = "3.0.9"
     1.5 +
     1.6 +-- TODO abstraction
     1.7 +-- get record by id
     1.8 +function mondelefant.class_prototype:by_id(id)
     1.9 +  local selector = self:new_selector()
    1.10 +  selector:add_where{ 'id = ?', id }
    1.11 +  selector:optional_object_mode()
    1.12 +  return selector:exec()
    1.13 +end
    1.14 +
    1.15 +if not config.password_hash_algorithm then
    1.16 +  config.password_hash_algorithm = "crypt_sha512"
    1.17 +end
    1.18 +
    1.19 +if not config.password_hash_min_rounds then
    1.20 + config.password_hash_min_rounds = 10000
    1.21 +end
    1.22 +
    1.23 +if not config.password_hash_max_rounds then
    1.24 +  config.password_hash_max_rounds = 20000
    1.25 +end
    1.26 +
    1.27 +if config.enabled_languages == nil then
    1.28 +  config.enabled_languages = { 'en', 'de', 'ka' } --, 'eo', 'el', 'hu', 'it', 'nl', 'zh-Hans', 'zh-TW' }
    1.29 +end
    1.30 +
    1.31 +if config.default_lang == nil then
    1.32 +  config.default_lang = "en"
    1.33 +end
    1.34 +
    1.35 +if config.mail_subject_prefix == nil then
    1.36 +  config.mail_subject_prefix = "[LiquidFeedback] "
    1.37 +end
    1.38 +
    1.39 +if config.member_image_content_type == nil then
    1.40 +  config.member_image_content_type = "image/jpeg"
    1.41 +end
    1.42 +
    1.43 +if config.member_image_convert_func == nil then
    1.44 +  config.member_image_convert_func = {
    1.45 +    avatar = function(data) return extos.pfilter(data, "convert", "jpeg:-", "-thumbnail",   "48x48", "jpeg:-") end,
    1.46 +    photo =  function(data) return extos.pfilter(data, "convert", "jpeg:-", "-thumbnail", "240x240", "jpeg:-") end
    1.47 +  }
    1.48 +end
    1.49 +
    1.50 +if config.locked_profile_fields == nil then
    1.51 +  config.locked_profile_fields = {}
    1.52 +end
    1.53 +
    1.54 +if config.check_delegations_default == nil then
    1.55 +  config.check_delegations_default = "confirm"
    1.56 +end
    1.57 +
    1.58 +if config.ldap == nil then
    1.59 +  config.ldap = {}
    1.60 +end
    1.61 +
    1.62 +if not config.database then
    1.63 +  config.database = { engine='postgresql', dbname='liquid_feedback' }
    1.64 +end
    1.65 +
    1.66  if config.fork == nil then
    1.67    config.fork = {}
    1.68  end
    1.69 @@ -61,6 +123,10 @@
    1.70    listen_options[#listen_options+1] = { proto = "tcp", host = host, port = config.port }
    1.71  end
    1.72  
    1.73 +request.set_404_route{ module = 'index', view = '404' }
    1.74 +
    1.75 +request.set_absolute_baseurl(config.absolute_base_url)
    1.76 +
    1.77  listen(listen_options)
    1.78  
    1.79  listen{
     2.1 --- a/config/devel.lua	Tue Dec 01 02:10:40 2015 +0100
     2.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.3 @@ -1,290 +0,0 @@
     2.4 --- ========================================================================
     2.5 --- MANDATORY (MUST BE CAREFULLY CHECKED AND PROPERLY SET!)
     2.6 --- ========================================================================
     2.7 -
     2.8 --- Name of this instance, defaults to name of config file
     2.9 --- ------------------------------------------------------------------------
    2.10 -config.instance_name = "Public Software Group e.V."
    2.11 -
    2.12 -
    2.13 --- Information about service provider (HTML)
    2.14 --- ------------------------------------------------------------------------
    2.15 -config.app_service_provider = "Snake Oil<br/>10000 Berlin<br/>Germany"
    2.16 -
    2.17 -
    2.18 --- A HTML formatted text the user has to accept while registering
    2.19 --- ------------------------------------------------------------------------
    2.20 -config.use_terms = "<h1>Terms of Use</h1><p>Insert terms here</p>"
    2.21 -
    2.22 -
    2.23 --- Checkbox(es) the user has to accept while registering
    2.24 --- ------------------------------------------------------------------------
    2.25 -config.use_terms_checkboxes = {
    2.26 -  {
    2.27 -    name = "terms_of_use_v1",
    2.28 -    html = "I accept the terms of use.",
    2.29 -    not_accepted_error = "You have to accept the terms of use to be able to register."
    2.30 -  },
    2.31 ---  {
    2.32 ---    name = "extra_terms_of_use_v1",
    2.33 ---    html = "I accept the extra terms of use.",
    2.34 ---    not_accepted_error = "You have to accept the extra terms of use to be able to register."
    2.35 ---  }
    2.36 -}
    2.37 -
    2.38 -  
    2.39 --- Absolute base url of application
    2.40 --- ------------------------------------------------------------------------
    2.41 -config.absolute_base_url = "http://127.0.0.1:8080/"
    2.42 -
    2.43 -
    2.44 --- Connection information for the LiquidFeedback database
    2.45 --- ------------------------------------------------------------------------
    2.46 -config.database = { engine='postgresql', dbname='lf3' }
    2.47 -
    2.48 -
    2.49 --- Location of the rocketwiki binaries
    2.50 --- ------------------------------------------------------------------------
    2.51 -config.enforce_formatting_engine = "markdown2"
    2.52 -
    2.53 -config.formatting_engines = {
    2.54 -  { id = "markdown2",
    2.55 -    name = "python-markdown2",
    2.56 -    executable = "markdown2",
    2.57 -    args = {'-s', 'escape', '-x', 'nofollow,wiki-tables'},
    2.58 -    remove_images = true
    2.59 -  },
    2.60 -  { id = "markdown_py",
    2.61 -    name = "Python Markdown",
    2.62 -    executable = "markdown_py",
    2.63 -    args = {'-s', 'escape', '-x', 'extra', '-x', 'nl2br', '-x', 'sane_lists'},
    2.64 -    remove_images = true
    2.65 -  },
    2.66 -  { id = "rocketwiki",
    2.67 -    name = "RocketWiki",
    2.68 -    executable = "/opt/rocketwiki-lqfb/rocketwiki-lqfb",
    2.69 -    remove_images = false
    2.70 -  },
    2.71 -  { id = "compat",
    2.72 -    name = "Traditional WIKI syntax",
    2.73 -    executable = "/opt/rocketwiki-lqfb/rocketwiki-lqfb-compat",
    2.74 -    remove_images = false
    2.75 -  }
    2.76 -}
    2.77 -
    2.78 --- Public access level
    2.79 --- ------------------------------------------------------------------------
    2.80 --- Available options:
    2.81 --- "none" 
    2.82 ---     -> Closed user group, no public access at all
    2.83 ---        (except login/registration/password reset)
    2.84 --- "anonymous"
    2.85 ---     -> Shows only initiative/suggestions texts and aggregated
    2.86 ---        supporter/voter counts
    2.87 --- "authors_pseudonymous" 
    2.88 ---     -> Like anonymous, but shows screen names of authors
    2.89 --- "all_pseudonymous" 
    2.90 ---     -> Show everything a member can see, except profile pages
    2.91 --- "everything"
    2.92 ---     -> Show everything a member can see, including profile pages
    2.93 --- ------------------------------------------------------------------------
    2.94 -config.public_access = "all_pseudonymous"
    2.95 -
    2.96 -
    2.97 -
    2.98 --- ========================================================================
    2.99 --- OPTIONAL
   2.100 --- Remove leading -- to use a option
   2.101 --- ========================================================================
   2.102 -
   2.103 --- List of enabled languages, defaults to available languages
   2.104 --- ------------------------------------------------------------------------
   2.105 --- config.enabled_languages = { 'en', 'de', 'eo', 'el', 'hu', 'it', 'nl', 'zh-TW' }
   2.106 -
   2.107 --- Default language, defaults to "en"
   2.108 --- ------------------------------------------------------------------------
   2.109 --- config.default_lang = "de"
   2.110 -
   2.111 --- after how long is a user considered inactive and the trustee will see warning,
   2.112 --- notation is according to postgresql intervals, default: no warning at all
   2.113 --- ------------------------------------------------------------------------
   2.114 -config.delegation_warning_time = '1 hour'
   2.115 -
   2.116 --- after which time a user is suggested to (_soft) or forced to (_hard) 
   2.117 --- confirm unit and area delegations. default: no confirmation at all
   2.118 --- ------------------------------------------------------------------------
   2.119 --- config.check_delegations_interval_hard = "1 day"
   2.120 --- config.check_delegations_interval_soft = "3 seconds"
   2.121 -
   2.122 --- default options should be checked when confirming delegations
   2.123 --- options: "confirm", "revoke" and "none"
   2.124 --- ------------------------------------------------------------------------
   2.125 --- config.check_delegations_default = "confirm"
   2.126 -
   2.127 --- Prefix of all automatic mails, defaults to "[Liquid Feedback] "
   2.128 --- ------------------------------------------------------------------------
   2.129 --- config.mail_subject_prefix = "[LiquidFeedback] "
   2.130 -
   2.131 --- Sender of all automatic mails, defaults to system defaults
   2.132 --- ------------------------------------------------------------------------
   2.133 --- config.mail_envelope_from = "liquidfeedback@example.com"
   2.134 --- config.mail_from = { name = "LiquidFeedback", address = "liquidfeedback@example.com" }
   2.135 --- config.mail_reply_to = { name = "Support", address = "support@example.com" }
   2.136 -
   2.137 --- Configuration of password hashing algorithm (defaults to "crypt_sha512")
   2.138 --- ------------------------------------------------------------------------
   2.139 --- config.password_hash_algorithm = "crypt_sha512"
   2.140 --- config.password_hash_algorithm = "crypt_sha256"
   2.141 --- config.password_hash_algorithm = "crypt_md5"
   2.142 -
   2.143 --- Number of rounds for crypt_sha* algorithms, minimum and maximum
   2.144 --- (defaults to minimum 10000 and maximum 20000)
   2.145 --- ------------------------------------------------------------------------
   2.146 --- config.password_hash_min_rounds = 10000
   2.147 --- config.password_hash_max_rounds = 20000
   2.148 -
   2.149 --- Supply custom url for avatar/photo delivery
   2.150 --- ------------------------------------------------------------------------
   2.151 --- config.fastpath_url_func = nil
   2.152 -
   2.153 --- Local directory for database dumps offered for download
   2.154 --- ------------------------------------------------------------------------
   2.155 --- config.download_dir = nil
   2.156 -
   2.157 --- Special use terms for database dump download
   2.158 --- ------------------------------------------------------------------------
   2.159 --- config.download_use_terms = "=== Download use terms ===\n"
   2.160 -
   2.161 --- Use custom image conversion, defaults to ImageMagick's convert
   2.162 --- ------------------------------------------------------------------------
   2.163 ---config.member_image_content_type = "image/jpeg"
   2.164 ---config.member_image_convert_func = {
   2.165 ---  avatar = function(data) return extos.pfilter(data, "convert", "jpeg:-", "-thumbnail",   "48x48", "jpeg:-") end,
   2.166 ---  photo =  function(data) return extos.pfilter(data, "convert", "jpeg:-", "-thumbnail", "240x240", "jpeg:-") end
   2.167 ---}
   2.168 -
   2.169 -config.member_image_content_type = "image/jpeg"
   2.170 -config.member_image_convert_func = {
   2.171 -  avatar = function(data) return extos.pfilter(data, "convert",
   2.172 -    "jpeg:-",
   2.173 -    "-set", "option:distort:viewport", 
   2.174 -    "%[fx:min(w,h)]x%[fx:min(w,h)]+%[fx:max((w-h)/2,0)]+%[fx:max((h-w)/2,0)]",
   2.175 -    "-filter", "point",
   2.176 -    "-distort", "SRT", "0", 
   2.177 -    "+repage",
   2.178 -    "-define", "filter:filter=Sinc", 
   2.179 -    "-define", "filter:window=Jinc",
   2.180 -    "-define", "filter:lobes=3",
   2.181 -    "-thumbnail", "48x48",
   2.182 -    "jpeg:-"
   2.183 -  ) end,
   2.184 -  photo =  function(data) return extos.pfilter(data, "convert",
   2.185 -    "jpeg:-",
   2.186 -    "-define", "filter:filter=Sinc", 
   2.187 -    "-define", "filter:window=Jinc",
   2.188 -    "-define", "filter:lobes=3",
   2.189 -    "-thumbnail", "240x240",
   2.190 -    "jpeg:-"
   2.191 -  ) end
   2.192 -}
   2.193 -
   2.194 -
   2.195 --- Display a html formatted public message of the day
   2.196 --- ------------------------------------------------------------------------
   2.197 --- config.motd_public = "<h1>Message of the day (public)</h1><p>The MOTD is formatted with HTML</p>"
   2.198 -
   2.199 --- Display a html formatted internal message of the day
   2.200 --- ------------------------------------------------------------------------
   2.201 --- config.motd_intern = "<h1>Message of the day (intern)</h1><p>The MOTD is formatted with HTML</p>"
   2.202 -
   2.203 --- Automatic issue related discussion URL
   2.204 --- ------------------------------------------------------------------------
   2.205 --- config.issue_discussion_url_func = function(issue)
   2.206 ---   return "http://example.com/discussion/issue_" .. tostring(issue.id)
   2.207 --- end
   2.208 -
   2.209 --- Configuration of "tell others"
   2.210 --- ------------------------------------------------------------------------
   2.211 -config.tell_others = {
   2.212 -  initiative = function (initiative)
   2.213 -    local text = "i" .. initiative.id .. ": " .. initiative.name .. " " .. request.get_absolute_baseurl() .. "initiative/" .. initiative.id .. ".html"
   2.214 -    return {
   2.215 -      { content = "tweet this initiative", external = "https://twitter.com/intent/tweet?text=" .. encode.url_part(text) },
   2.216 -      { content = "send link with e-mail", external = "mailto:?subject=" .. encode.url_part(initiative.display_name) .. "&body=" .. encode.url_part(text) }
   2.217 -    }
   2.218 -  end
   2.219 -}
   2.220 -
   2.221 --- Integration of Etherpad, disabled by default
   2.222 --- ------------------------------------------------------------------------
   2.223 ---config.etherpad = {
   2.224 ---  base_url = "http://example.com:9001/",
   2.225 ---  api_base = "http://localhost:9001/",
   2.226 ---  api_key = "mysecretapikey",
   2.227 ---  group_id = "mygroupname",
   2.228 ---  cookie_path = "/"
   2.229 ---}
   2.230 -
   2.231 --- Free timings, may be used together with polling policies
   2.232 --- ------------------------------------------------------------------------
   2.233 --- This example expects a date string entered in the free timing field
   2.234 --- by the user creating a poll, interpreting it as target date for then
   2.235 --- poll and splits the remainig time at the ratio of 4:1:2
   2.236 --- Please note, polling policies never have an admission phase
   2.237 -
   2.238 -
   2.239 -config.free_timing = {
   2.240 -  calculate_func = function(policy, timing_string)
   2.241 -    local function interval_by_seconds(secs)
   2.242 -      local secs_per_day = 60 * 60 * 24
   2.243 -      local days
   2.244 -      days = math.floor(secs / secs_per_day)
   2.245 -      secs = secs - days * secs_per_day
   2.246 -      return days .. " days " .. secs .. " seconds"
   2.247 -    end
   2.248 -    local target_date = parse.date(timing_string, atom.date)
   2.249 -    if not target_date then
   2.250 -      return false
   2.251 -    end
   2.252 -    local target_timestamp = target_date.midday
   2.253 -    local now = atom.timestamp:get_current()
   2.254 -    trace.debug(target_timestamp, now)
   2.255 -    local duration = target_timestamp - now
   2.256 -    if duration < 0 then
   2.257 -      return false
   2.258 -    end
   2.259 -    return {
   2.260 -      discussion = interval_by_seconds(duration / 7 * 4),
   2.261 -      verification = interval_by_seconds(duration / 7 * 1),
   2.262 -      voting = interval_by_seconds(duration / 7 * 2)
   2.263 -    }
   2.264 -  end,
   2.265 -  available_func = function(policy)
   2.266 -    return { 
   2.267 -      { name = "End of 2013", id = '2013-12-31' },
   2.268 -      { name = "End of 2014", id = '2014-12-31' },
   2.269 -      { name = "End of 2015", id = '2015-12-31' }
   2.270 -    }
   2.271 -  end
   2.272 -}
   2.273 -
   2.274 -
   2.275 -config.enable_debug_trace = true
   2.276 -
   2.277 -config.fork = { pre = 64, max = 256, delay = 0.01 }
   2.278 -
   2.279 -
   2.280 --- WebMCP accelerator
   2.281 --- uncomment the following two lines to use C implementations of chosen
   2.282 --- functions and to disable garbage collection during the request, to
   2.283 --- increase speed:
   2.284 --- ------------------------------------------------------------------------
   2.285 --- require 'webmcp_accelerator'
   2.286 --- if cgi then collectgarbage("stop") end
   2.287 -
   2.288 -
   2.289 --- ========================================================================
   2.290 --- Do main initialisation (DO NOT REMOVE FOLLOWING SECTION)
   2.291 --- ========================================================================
   2.292 -
   2.293 -execute.config("init")
     3.1 --- a/config/example.lua	Tue Dec 01 02:10:40 2015 +0100
     3.2 +++ b/config/example.lua	Tue Dec 01 13:59:16 2015 +0100
     3.3 @@ -19,23 +19,25 @@
     3.4  
     3.5  -- Checkbox(es) the user has to accept while registering
     3.6  -- ------------------------------------------------------------------------
     3.7 +--[[
     3.8  config.use_terms_checkboxes = {
     3.9    {
    3.10      name = "terms_of_use_v1",
    3.11      html = "I accept the terms of use.",
    3.12      not_accepted_error = "You have to accept the terms of use to be able to register."
    3.13    },
    3.14 ---  {
    3.15 ---    name = "extra_terms_of_use_v1",
    3.16 ---    html = "I accept the extra terms of use.",
    3.17 ---    not_accepted_error = "You have to accept the extra terms of use to be able to register."
    3.18 ---  }
    3.19 +  {
    3.20 +    name = "extra_terms_of_use_v1",
    3.21 +    html = "I accept the extra terms of use.",
    3.22 +    not_accepted_error = "You have to accept the extra terms of use to be able to register."
    3.23 +  }
    3.24  }
    3.25 -
    3.26 +--]]
    3.27    
    3.28  -- Absolute base url of application
    3.29  -- ------------------------------------------------------------------------
    3.30  config.absolute_base_url = "http://example.com/"
    3.31 +config.localhost = false
    3.32  
    3.33  
    3.34  -- Connection information for the LiquidFeedback database
    3.35 @@ -219,6 +221,7 @@
    3.36  -- Please note, polling policies never have an admission phase
    3.37  -- The available_func is optional, if not set any target date is allowed
    3.38  
    3.39 +--[[
    3.40  config.free_timing = {
    3.41    calculate_func = function(policy, timing_string)
    3.42      local function interval_by_seconds(secs)
    3.43 @@ -253,13 +256,14 @@
    3.44      }
    3.45    end
    3.46  }
    3.47 -
    3.48 +--]]
    3.49  
    3.50  -- Configuration of lf4rcs
    3.51  -- ------------------------------------------------------------------------
    3.52 -config.lf4rc = {}
    3.53 +-- config.lf4rc = {}
    3.54  
    3.55  -- Example configuration for controlling a Git repository
    3.56 +--[[
    3.57  config.lf4rcs.git = {
    3.58    
    3.59    render_draft_reference = function(url, draft)
    3.60 @@ -364,7 +368,7 @@
    3.61  }
    3.62  
    3.63  lf4rcs.init()
    3.64 -
    3.65 +--]]
    3.66  
    3.67  -- External references
    3.68  -- ------------------------------------------------------------------------
    3.69 @@ -466,11 +470,8 @@
    3.70  -- if cgi then collectgarbage("stop") end
    3.71  
    3.72  -- Trace debug
    3.73 +-- ------------------------------------------------------------------------
    3.74  -- uncomment the following line to enable debug trace
    3.75  -- config.enable_debug_trace = true
    3.76  
    3.77 --- ========================================================================
    3.78 --- Do main initialisation (DO NOT REMOVE FOLLOWING SECTION)
    3.79 --- ========================================================================
    3.80  
    3.81 -execute.config("init")
     4.1 --- a/config/init.lua	Tue Dec 01 02:10:40 2015 +0100
     4.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.3 @@ -1,123 +0,0 @@
     4.4 --- ========================================================================
     4.5 --- DO NOT CHANGE ANYTHING IN THIS FILE
     4.6 --- (except when you really know what you are doing!)
     4.7 --- ========================================================================
     4.8 -
     4.9 -config.app_version = "3.0.9"
    4.10 -
    4.11 -if not config.password_hash_algorithm then
    4.12 -  config.password_hash_algorithm = "crypt_sha512"
    4.13 -end
    4.14 -
    4.15 -if not config.password_hash_min_rounds then
    4.16 - config.password_hash_min_rounds = 10000
    4.17 -end
    4.18 -
    4.19 -if not config.password_hash_max_rounds then
    4.20 -  config.password_hash_max_rounds = 20000
    4.21 -end
    4.22 -
    4.23 -if config.enabled_languages == nil then
    4.24 -  config.enabled_languages = { 'en', 'de', 'ka' } --, 'eo', 'el', 'hu', 'it', 'nl', 'zh-Hans', 'zh-TW' }
    4.25 -end
    4.26 -
    4.27 -if config.default_lang == nil then
    4.28 -  config.default_lang = "en"
    4.29 -end
    4.30 -
    4.31 -if config.mail_subject_prefix == nil then
    4.32 -  config.mail_subject_prefix = "[LiquidFeedback] "
    4.33 -end
    4.34 -
    4.35 -if config.member_image_content_type == nil then
    4.36 -  config.member_image_content_type = "image/jpeg"
    4.37 -end
    4.38 -
    4.39 -if config.member_image_convert_func == nil then
    4.40 -  config.member_image_convert_func = {
    4.41 -    avatar = function(data) return extos.pfilter(data, "convert", "jpeg:-", "-thumbnail",   "48x48", "jpeg:-") end,
    4.42 -    photo =  function(data) return extos.pfilter(data, "convert", "jpeg:-", "-thumbnail", "240x240", "jpeg:-") end
    4.43 -  }
    4.44 -end
    4.45 -
    4.46 -if config.locked_profile_fields == nil then
    4.47 -  config.locked_profile_fields = {}
    4.48 -end
    4.49 -
    4.50 -if config.check_delegations_default == nil then
    4.51 -  config.check_delegations_default = "confirm"
    4.52 -end
    4.53 -
    4.54 -if config.ldap == nil then
    4.55 -  config.ldap = {}
    4.56 -end
    4.57 -
    4.58 -if not config.database then
    4.59 -  config.database = { engine='postgresql', dbname='liquid_feedback' }
    4.60 -end
    4.61 -
    4.62 -request.set_404_route{ module = 'index', view = '404' }
    4.63 -
    4.64 -request.set_absolute_baseurl(config.absolute_base_url)
    4.65 -
    4.66 --- TODO abstraction
    4.67 --- get record by id
    4.68 -function mondelefant.class_prototype:by_id(id)
    4.69 -  local selector = self:new_selector()
    4.70 -  selector:add_where{ 'id = ?', id }
    4.71 -  selector:optional_object_mode()
    4.72 -  return selector:exec()
    4.73 -end
    4.74 -
    4.75 --- compatibility for WebMCP 1.2.6
    4.76 -if not listen then
    4.77 -  
    4.78 -  WEBMCP_BASE_PATH = request.get_app_basepath()
    4.79 -
    4.80 -  -- workaround bug in WebMCP 1.2.6
    4.81 -  if not string.find(WEBMCP_BASE_PATH, "/$") then
    4.82 -    WEBMCP_BASE_PATH = WEBMCP_BASE_PATH .. "/"
    4.83 -  end
    4.84 -  
    4.85 -  -- open and set default database handle
    4.86 -  _G.db = assert(mondelefant.connect(config.database))
    4.87 -
    4.88 -  function mondelefant.class_prototype:get_db_conn() return db end
    4.89 -
    4.90 -  -- close the database at exit
    4.91 -  at_exit(function() 
    4.92 -    db:close()
    4.93 -  end)
    4.94 -  
    4.95 -  function request.get_cookie(args)
    4.96 -    return cgi.cookies[args.name]
    4.97 -  end
    4.98 -  
    4.99 -  function request.get_param(args)
   4.100 -    if args.meta then
   4.101 -      return { content_type = cgi.post_types[image_type] }
   4.102 -    else
   4.103 -      return request.get_param_strings()[args.name]
   4.104 -    end
   4.105 -    
   4.106 -  end
   4.107 -  
   4.108 -  function request.add_header(key, value)
   4.109 -    print(key .. ": " .. value)
   4.110 -  end
   4.111 -  
   4.112 -  local request_redirect = request.redirect
   4.113 -  function request.redirect(args)
   4.114 -    if args.static then
   4.115 -      print('Location: ' .. encode.url{ static = args.static } .. '\n\n')
   4.116 -      exit()
   4.117 -    else
   4.118 -      request_redirect(args)
   4.119 -    end
   4.120 -  end
   4.121 -
   4.122 -  function request.allow_caching()
   4.123 -    request.add_header("Cache-Control", "max-age=3600");
   4.124 -  end
   4.125 -
   4.126 -end
     5.1 --- a/config/lf3.lua	Tue Dec 01 02:10:40 2015 +0100
     5.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.3 @@ -1,290 +0,0 @@
     5.4 --- ========================================================================
     5.5 --- MANDATORY (MUST BE CAREFULLY CHECKED AND PROPERLY SET!)
     5.6 --- ========================================================================
     5.7 -
     5.8 --- Name of this instance, defaults to name of config file
     5.9 --- ------------------------------------------------------------------------
    5.10 -config.instance_name = "Public Software Group e.V."
    5.11 -
    5.12 -
    5.13 --- Information about service provider (HTML)
    5.14 --- ------------------------------------------------------------------------
    5.15 -config.app_service_provider = [[
    5.16 -Public Software Group e. V.<br />
    5.17 -Johannisstr. 12<br />
    5.18 -10117 Berlin<br />
    5.19 -Germany<br /><br />
    5.20 -eingetragen im Vereinsregister des Amtsgerichtes Charlottenburg unter der
    5.21 -  Registernummer VR 28873 B<br />
    5.22 -vertreten durch die Vorstandsmitglieder Jan Behrens, Axel Kistner, Andreas
    5.23 -  Nitsche und Björn Swierczek jeweils mit Einzelvertretungsbefugnis
    5.24 -]]
    5.25 -
    5.26 -
    5.27 --- A HTML formatted text the user has to accept while registering
    5.28 --- ------------------------------------------------------------------------
    5.29 -config.use_terms = [[
    5.30 -<h1>Terms of Use</h1>
    5.31 -<p>
    5.32 -  All data display below and all data you enter later while using the system
    5.33 -  and all data you are submitting via the programming interface will be
    5.34 -  stored in the LiquidFeedback database and published. Every access to the
    5.35 -  system is subject of tracing and logging for development purposes.
    5.36 -</p>
    5.37 -<p>  
    5.38 -  Please notice, this is a **public test dedicated to developers**: serious
    5.39 -  errors can happen or private data unintentionally published.
    5.40 -</p>
    5.41 -<p>
    5.42 -  Everything is <b>ON YOUR OWN RISK</b>
    5.43 -</p>
    5.44 -]]
    5.45 -
    5.46 --- Checkbox(es) the user has to accept while registering
    5.47 --- ------------------------------------------------------------------------
    5.48 -config.use_terms_checkboxes = {
    5.49 -  {
    5.50 -    name = "terms_of_use_20140514",
    5.51 -    html = "I accept the terms of use.",
    5.52 -    not_accepted_error = "You have to accept the terms of use to be able to register."
    5.53 -  },
    5.54 ---  {
    5.55 ---    name = "extra_terms_of_use_v1",
    5.56 ---    html = "I accept the extra terms of use.",
    5.57 ---    not_accepted_error = "You have to accept the extra terms of use to be able to register."
    5.58 ---  }
    5.59 -}
    5.60 -
    5.61 -  
    5.62 --- Absolute base url of application
    5.63 --- ------------------------------------------------------------------------
    5.64 -config.absolute_base_url = "http://dev.liquidfeedback.org/lf3/"
    5.65 -
    5.66 -
    5.67 --- Connection information for the LiquidFeedback database
    5.68 --- ------------------------------------------------------------------------
    5.69 -config.database = { engine='postgresql', dbname='lf3' }
    5.70 -
    5.71 -
    5.72 --- Location of the rocketwiki binaries
    5.73 --- ------------------------------------------------------------------------
    5.74 -config.enforce_formatting_engine = "markdown2"
    5.75 -
    5.76 -config.formatting_engines = {
    5.77 -  { id = "markdown_py",
    5.78 -    name = "Python Markdown",
    5.79 -    executable = "markdown_py",
    5.80 -    args = {'/dev/stdin', '-s', 'escape', '-x', 'extra', '-x', 'nl2br', '-x', 'sane_lists'},
    5.81 -    remove_images = true
    5.82 -  },
    5.83 -  { id = "markdown2",
    5.84 -    name = "markdown2",
    5.85 -    executable = "markdown2",
    5.86 -    args = {'-s', 'escape', '-x', 'nofollow,wiki-tables'},
    5.87 -    remove_images = true
    5.88 -  },
    5.89 -  { id = "multimarkdown",
    5.90 -    name = "MultiMarkdown",
    5.91 -    executable = "multimarkdown",
    5.92 -    args = {'--filter-html', '--filter-styles', '--nolabels' ,'-x'}
    5.93 -  },
    5.94 -  { id = "rocketwiki",
    5.95 -    name = "RocketWiki",
    5.96 -    executable = "/opt/liquid_feedback3/rocketwiki-lqfb/rocketwiki-lqfb",
    5.97 -    remove_images = false
    5.98 -  },
    5.99 -  { id = "compat",
   5.100 -    name = "Traditional WIKI syntax",
   5.101 -    executable = "/opt/liquid_feedback3/rocketwiki-lqfb/rocketwiki-lqfb-compat",
   5.102 -    remove_images = false
   5.103 -  }
   5.104 -}
   5.105 -
   5.106 --- Public access level
   5.107 --- ------------------------------------------------------------------------
   5.108 --- Available options:
   5.109 --- "none" 
   5.110 ---     -> Closed user group, no public access at all
   5.111 ---        (except login/registration/password reset)
   5.112 --- "anonymous"
   5.113 ---     -> Shows only initiative/suggestions texts and aggregated
   5.114 ---        supporter/voter counts
   5.115 --- "authors_pseudonymous" 
   5.116 ---     -> Like anonymous, but shows screen names of authors
   5.117 --- "all_pseudonymous" 
   5.118 ---     -> Show everything a member can see, except profile pages
   5.119 --- "everything"
   5.120 ---     -> Show everything a member can see, including profile pages
   5.121 --- ------------------------------------------------------------------------
   5.122 -config.public_access = "none"
   5.123 -
   5.124 -
   5.125 -
   5.126 --- ========================================================================
   5.127 --- OPTIONAL
   5.128 --- Remove leading -- to use a option
   5.129 --- ========================================================================
   5.130 -
   5.131 --- List of enabled languages, defaults to available languages
   5.132 --- ------------------------------------------------------------------------
   5.133 --- config.enabled_languages = { 'en', 'de', 'eo', 'el', 'hu', 'it', 'nl', 'zh-TW' }
   5.134 -config.enabled_languages = { 'en', 'de' }
   5.135 -
   5.136 --- Default language, defaults to "en"
   5.137 --- ------------------------------------------------------------------------
   5.138 --- config.default_lang = "de"
   5.139 -
   5.140 --- after how long is a user considered inactive and the trustee will see warning,
   5.141 --- notation is according to postgresql intervals, default: no warning at all
   5.142 --- ------------------------------------------------------------------------
   5.143 -config.delegation_warning_time = '3 month'
   5.144 -
   5.145 --- after which time a user is suggested to (_soft) or forced to (_hard) 
   5.146 --- confirm unit and area delegations. default: no confirmation at all
   5.147 --- ------------------------------------------------------------------------
   5.148 --- config.check_delegations_interval_hard = "1 day"
   5.149 --- config.check_delegations_interval_soft = "3 seconds"
   5.150 -
   5.151 --- default options should be checked when confirming delegations
   5.152 --- options: "confirm", "revoke" and "none"
   5.153 --- ------------------------------------------------------------------------
   5.154 --- config.check_delegations_default = "confirm"
   5.155 -
   5.156 --- Prefix of all automatic mails, defaults to "[Liquid Feedback] "
   5.157 --- ------------------------------------------------------------------------
   5.158 -config.mail_subject_prefix = "[LiquidFeedback 3.0 Test] "
   5.159 -
   5.160 --- Sender of all automatic mails, defaults to system defaults
   5.161 --- ------------------------------------------------------------------------
   5.162 -config.mail_envelope_from = "lqfb-maintainers@public-software-group.org"
   5.163 -config.mail_from = { name = "LiquidFeedback", address = "lqfb-maintainers@public-software-group.org" }
   5.164 ---config.mail_reply_to = { name = "Support", address = "support@example.com" }
   5.165 -
   5.166 --- Configuration of password hashing algorithm (defaults to "crypt_sha512")
   5.167 --- ------------------------------------------------------------------------
   5.168 --- config.password_hash_algorithm = "crypt_sha512"
   5.169 --- config.password_hash_algorithm = "crypt_sha256"
   5.170 --- config.password_hash_algorithm = "crypt_md5"
   5.171 -
   5.172 --- Number of rounds for crypt_sha* algorithms, minimum and maximum
   5.173 --- (defaults to minimum 10000 and maximum 20000)
   5.174 --- ------------------------------------------------------------------------
   5.175 --- config.password_hash_min_rounds = 10000
   5.176 --- config.password_hash_max_rounds = 20000
   5.177 -
   5.178 --- Supply custom url for avatar/photo delivery
   5.179 --- ------------------------------------------------------------------------
   5.180 --- config.fastpath_url_func = nil
   5.181 -
   5.182 --- Local directory for database dumps offered for download
   5.183 --- ------------------------------------------------------------------------
   5.184 --- config.download_dir = nil
   5.185 -
   5.186 --- Special use terms for database dump download
   5.187 --- ------------------------------------------------------------------------
   5.188 --- config.download_use_terms = "=== Download use terms ===\n"
   5.189 -
   5.190 --- Use custom image conversion, defaults to ImageMagick's convert
   5.191 --- ------------------------------------------------------------------------
   5.192 ---config.member_image_content_type = "image/jpeg"
   5.193 ---config.member_image_convert_func = {
   5.194 ---  avatar = function(data) return extos.pfilter(data, "convert", "jpeg:-", "-thumbnail",   "48x48", "jpeg:-") end,
   5.195 ---  photo =  function(data) return extos.pfilter(data, "convert", "jpeg:-", "-thumbnail", "240x240", "jpeg:-") end
   5.196 ---}
   5.197 -
   5.198 --- Display a html formatted public message of the day
   5.199 --- ------------------------------------------------------------------------
   5.200 --- config.motd_public = "<h1>Message of the day (public)</h1><p>The MOTD is formatted with HTML</p>"
   5.201 -
   5.202 --- Display a html formatted internal message of the day
   5.203 --- ------------------------------------------------------------------------
   5.204 --- config.motd_public = "<h1>Message of the day (intern)</h1><p>The MOTD is formatted with HTML</p>"
   5.205 -
   5.206 --- Automatic issue related discussion URL
   5.207 --- ------------------------------------------------------------------------
   5.208 --- config.issue_discussion_url_func = function(issue)
   5.209 ---   return "http://example.com/discussion/issue_" .. tostring(issue.id)
   5.210 --- end
   5.211 -
   5.212 --- Configuration of "tell others"
   5.213 --- ------------------------------------------------------------------------
   5.214 -config.tell_others = {
   5.215 -  initiative = function (initiative)
   5.216 -    local text = "i" .. initiative.id .. ": " .. initiative.name .. " " .. request.get_absolute_baseurl() .. "initiative/show/" .. initiative.id .. ".html"
   5.217 -    return {
   5.218 -      { content = "Tweet this initiative", external = "https://twitter.com/intent/tweet?text=" .. encode.url_part(text) },
   5.219 -      { content = "Send an eMail", external = "mailto:?subject=" .. encode.url_part(initiative.display_name) .. "&body=" .. encode.url_part(text) }
   5.220 -    }
   5.221 -  end
   5.222 -}
   5.223 -
   5.224 --- Integration of Etherpad, disabled by default
   5.225 --- ------------------------------------------------------------------------
   5.226 ---config.etherpad = {
   5.227 ---  base_url = "http://example.com:9001/",
   5.228 ---  api_base = "http://localhost:9001/",
   5.229 ---  api_key = "mysecretapikey",
   5.230 ---  group_id = "mygroupname",
   5.231 ---  cookie_path = "/"
   5.232 ---}
   5.233 -
   5.234 --- Free timings, may be used together with polling policies
   5.235 --- ------------------------------------------------------------------------
   5.236 --- This example expects a date string entered in the free timing field
   5.237 --- by the user creating a poll, interpreting it as target date for then
   5.238 --- poll and splits the remainig time at the ratio of 4:1:2
   5.239 --- Please note, polling policies never have an admission phase
   5.240 -
   5.241 -
   5.242 -config.free_timing = {
   5.243 -  calculate_func = function(policy, timing_string)
   5.244 -    function interval_by_seconds(secs)
   5.245 -      local secs_per_day = 60 * 60 * 24
   5.246 -      local days
   5.247 -      days = math.floor(secs / secs_per_day)
   5.248 -      secs = secs - days * secs_per_day
   5.249 -      return days .. " days " .. secs .. " seconds"
   5.250 -    end
   5.251 -    local target_date = parse.date(timing_string, atom.date)
   5.252 -    if not target_date then
   5.253 -      return false
   5.254 -    end
   5.255 -    local target_timestamp = target_date.midday
   5.256 -    local now = atom.timestamp:get_current()
   5.257 -    trace.debug(target_timestamp, now)
   5.258 -    local duration = target_timestamp - now
   5.259 -    if duration < 0 then
   5.260 -      return false
   5.261 -    end
   5.262 -    return {
   5.263 -      discussion = interval_by_seconds(duration / 7 * 4),
   5.264 -      verification = interval_by_seconds(duration / 7 * 1),
   5.265 -      voting = interval_by_seconds(duration / 7 * 2)
   5.266 -    }
   5.267 -  end,
   5.268 -  available_func = function(policy)
   5.269 -    return { 
   5.270 -      { name = "End of 2014", id = '2014-12-31' },
   5.271 -      { name = "End of 2015", id = '2015-12-31' },
   5.272 -      { name = "End of 2016", id = '2016-12-31' }
   5.273 -    }
   5.274 -  end
   5.275 -}
   5.276 -
   5.277 -
   5.278 -config.enable_debug_trace = true
   5.279 -
   5.280 --- WebMCP accelerator
   5.281 --- uncomment the following two lines to use C implementations of chosen
   5.282 --- functions and to disable garbage collection during the request, to
   5.283 --- increase speed:
   5.284 --- ------------------------------------------------------------------------
   5.285 --- require 'webmcp_accelerator'
   5.286 --- if cgi then collectgarbage("stop") end
   5.287 -
   5.288 -
   5.289 --- ========================================================================
   5.290 --- Do main initialisation (DO NOT REMOVE FOLLOWING SECTION)
   5.291 --- ========================================================================
   5.292 -
   5.293 -execute.config("init")

Impressum / About Us