bsw@734: -- ======================================================================== bsw@734: -- DO NOT CHANGE ANYTHING IN THIS FILE bsw@734: -- (except when you really know what you are doing!) bsw@734: -- ======================================================================== bsw@734: bsw@1205: config.app_version = "3.0.8" bsw@731: bsw@905: if not config.password_hash_algorithm then bsw@905: config.password_hash_algorithm = "crypt_sha512" bsw@905: end bsw@905: bsw@905: if not config.password_hash_min_rounds then bsw@905: config.password_hash_min_rounds = 10000 bsw@905: end bsw@905: bsw@905: if not config.password_hash_max_rounds then bsw@905: config.password_hash_max_rounds = 20000 bsw@905: end bsw@905: bsw@731: if config.enabled_languages == nil then bsw@1128: config.enabled_languages = { 'en', 'de', 'ka' } --, 'eo', 'el', 'hu', 'it', 'nl', 'zh-Hans', 'zh-TW' } bsw@731: end bsw@731: bsw@731: if config.default_lang == nil then bsw@731: config.default_lang = "en" bsw@731: end bsw@731: bsw@731: if config.mail_subject_prefix == nil then bsw@731: config.mail_subject_prefix = "[LiquidFeedback] " bsw@731: end bsw@731: bsw@731: if config.member_image_content_type == nil then bsw@731: config.member_image_content_type = "image/jpeg" bsw@731: end bsw@731: bsw@731: if config.member_image_convert_func == nil then bsw@731: config.member_image_convert_func = { bsw@731: avatar = function(data) return extos.pfilter(data, "convert", "jpeg:-", "-thumbnail", "48x48", "jpeg:-") end, bsw@731: photo = function(data) return extos.pfilter(data, "convert", "jpeg:-", "-thumbnail", "240x240", "jpeg:-") end bsw@731: } bsw@731: end bsw@731: bsw@736: if config.locked_profile_fields == nil then bsw@736: config.locked_profile_fields = {} bsw@736: end bsw@736: bsw@988: if config.check_delegations_default == nil then bsw@988: config.check_delegations_default = "confirm" bsw@988: end bsw@988: bsw@1071: if config.ldap == nil then bsw@1071: config.ldap = {} bsw@1071: end bsw@1071: bsw@732: if not config.database then bsw@732: config.database = { engine='postgresql', dbname='liquid_feedback' } bsw@732: end bsw@732: bsw@729: request.set_404_route{ module = 'index', view = '404' } bsw@729: bsw@729: request.set_absolute_baseurl(config.absolute_base_url) bsw@729: bsw@729: -- TODO abstraction bsw@729: -- get record by id bsw@729: function mondelefant.class_prototype:by_id(id) bsw@729: local selector = self:new_selector() bsw@729: selector:add_where{ 'id = ?', id } bsw@729: selector:optional_object_mode() bsw@729: return selector:exec() bsw@729: end bsw@729: bsw@1145: -- compatibility for WebMCP 1.2.6 bsw@1145: if not listen then bsw@1145: bsw@1160: WEBMCP_BASE_PATH = request.get_app_basepath() bsw@1161: bsw@1161: -- workaround bug in WebMCP 1.2.6 bsw@1161: if not string.find(WEBMCP_BASE_PATH, "/$") then bsw@1161: WEBMCP_BASE_PATH = WEBMCP_BASE_PATH .. "/" bsw@1161: end bsw@1160: bsw@1145: -- open and set default database handle bsw@1145: _G.db = assert(mondelefant.connect(config.database)) bsw@1145: bsw@1145: function mondelefant.class_prototype:get_db_conn() return db end bsw@1145: bsw@1145: -- close the database at exit bsw@1145: at_exit(function() bsw@1145: db:close() bsw@1145: end) bsw@1145: bsw@1145: function request.get_cookie(args) bsw@1145: return cgi.cookies[args.name] bsw@1145: end bsw@1145: bsw@1145: function request.get_param(args) bsw@1176: if args.meta then bsw@1176: return { content_type = cgi.post_types[image_type] } bsw@1176: else bsw@1176: return request.get_param_strings()[args.name] bsw@1176: end bsw@1176: bsw@1145: end bsw@1145: bsw@1145: function request.add_header(key, value) bsw@1145: print(key .. ": " .. value) bsw@1145: end bsw@1145: bsw@1145: local request_redirect = request.redirect bsw@1145: function request.redirect(args) bsw@1145: if args.static then bsw@1145: print('Location: ' .. encode.url{ static = args.static } .. '\n\n') bsw@1145: exit() bsw@1145: else bsw@1145: request_redirect(args) bsw@1145: end bsw@1145: end bsw@1145: bsw@1147: function request.allow_caching() bsw@1147: request.add_header("Cache-Control", "max-age=3600"); bsw@1147: end bsw@1147: jbe@1167: end