liquid_feedback_frontend
view config/init.lua @ 945:b865f87ea810
Work on robustification of JavaScript voting
author | jbe |
---|---|
date | Thu Nov 08 13:17:37 2012 +0100 (2012-11-08) |
parents | 403e8c211592 |
children | 589c81f5798a |
line source
1 -- ========================================================================
2 -- DO NOT CHANGE ANYTHING IN THIS FILE
3 -- (except when you really know what you are doing!)
4 -- ========================================================================
6 config.app_version = "2.1.2"
8 if not config.password_hash_algorithm then
9 config.password_hash_algorithm = "crypt_sha512"
10 end
12 if not config.password_hash_min_rounds then
13 config.password_hash_min_rounds = 10000
14 end
16 if not config.password_hash_max_rounds then
17 config.password_hash_max_rounds = 20000
18 end
20 if config.enabled_languages == nil then
21 config.enabled_languages = { 'en', 'de', 'eo', 'el', 'hu', 'it', 'nl', 'zh-Hans', 'zh-TW' }
22 end
24 if config.default_lang == nil then
25 config.default_lang = "en"
26 end
28 if config.mail_subject_prefix == nil then
29 config.mail_subject_prefix = "[LiquidFeedback] "
30 end
32 if config.member_image_content_type == nil then
33 config.member_image_content_type = "image/jpeg"
34 end
36 if config.member_image_convert_func == nil then
37 config.member_image_convert_func = {
38 avatar = function(data) return extos.pfilter(data, "convert", "jpeg:-", "-thumbnail", "48x48", "jpeg:-") end,
39 photo = function(data) return extos.pfilter(data, "convert", "jpeg:-", "-thumbnail", "240x240", "jpeg:-") end
40 }
41 end
43 if config.locked_profile_fields == nil then
44 config.locked_profile_fields = {}
45 end
47 if not config.database then
48 config.database = { engine='postgresql', dbname='liquid_feedback' }
49 end
51 if not config.enable_debug_trace then
52 trace.disable()
53 else
54 slot.put_into('trace_button', '<div id="trace_show" onclick="document.getElementById(\'trace_content\').style.display=\'block\';this.style.display=\'none\';">TRACE</div>')
55 end
58 request.set_404_route{ module = 'index', view = '404' }
60 -- open and set default database handle
61 db = assert(mondelefant.connect(config.database))
62 at_exit(function()
63 db:close()
64 end)
65 function mondelefant.class_prototype:get_db_conn() return db end
67 -- enable output of SQL commands in trace system
68 function db:sql_tracer(command)
69 return function(error_info)
70 local error_info = error_info or {}
71 trace.sql{ command = command, error_position = error_info.position }
72 end
73 end
75 request.set_absolute_baseurl(config.absolute_base_url)
78 -- TODO abstraction
79 -- get record by id
80 function mondelefant.class_prototype:by_id(id)
81 local selector = self:new_selector()
82 selector:add_where{ 'id = ?', id }
83 selector:optional_object_mode()
84 return selector:exec()
85 end