liquid_feedback_frontend
view config/init.lua @ 800:e32827e5d304
Going to v2.0.0-rc3
author | bsw |
---|---|
date | Fri Jun 29 10:36:56 2012 +0200 (2012-06-29) |
parents | f7b21855d7d1 |
children | 82bbab02dd95 |
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.0.0-rc3"
8 if config.enabled_languages == nil then
9 config.enabled_languages = { 'en', 'de', 'eo', 'el', 'hu' }
10 end
12 if config.default_lang == nil then
13 config.default_lang = "en"
14 end
16 if config.mail_subject_prefix == nil then
17 config.mail_subject_prefix = "[LiquidFeedback] "
18 end
20 if config.member_image_content_type == nil then
21 config.member_image_content_type = "image/jpeg"
22 end
24 if config.member_image_convert_func == nil then
25 config.member_image_convert_func = {
26 avatar = function(data) return extos.pfilter(data, "convert", "jpeg:-", "-thumbnail", "48x48", "jpeg:-") end,
27 photo = function(data) return extos.pfilter(data, "convert", "jpeg:-", "-thumbnail", "240x240", "jpeg:-") end
28 }
29 end
31 if config.public_access == nil then
32 config.public_access = "full"
33 end
35 if config.locked_profile_fields == nil then
36 config.locked_profile_fields = {}
37 end
39 if not config.database then
40 config.database = { engine='postgresql', dbname='liquid_feedback' }
41 end
43 request.set_404_route{ module = 'index', view = '404' }
45 -- open and set default database handle
46 db = assert(mondelefant.connect(config.database))
47 at_exit(function()
48 db:close()
49 end)
50 function mondelefant.class_prototype:get_db_conn() return db end
52 -- enable output of SQL commands in trace system
53 function db:sql_tracer(command)
54 return function(error_info)
55 local error_info = error_info or {}
56 trace.sql{ command = command, error_position = error_info.position }
57 end
58 end
60 request.set_absolute_baseurl(config.absolute_base_url)
63 -- TODO abstraction
64 -- get record by id
65 function mondelefant.class_prototype:by_id(id)
66 local selector = self:new_selector()
67 selector:add_where{ 'id = ?', id }
68 selector:optional_object_mode()
69 return selector:exec()
70 end