liquid_feedback_frontend
view config/init.lua @ 782:e370594368e8
Optical enhancements
author | bsw |
---|---|
date | Fri Jun 29 00:10:17 2012 +0200 (2012-06-29) |
parents | 6d651f83a64b |
children | f5c6d8b75ec3 |
line source
1 -- ========================================================================
2 -- DO NOT CHANGE ANYTHING IN THIS FILE
3 -- (except when you really know what you are doing!)
4 -- ========================================================================
7 config.app_version = "2.beta12"
9 if config.enabled_languages == nil then
10 config.enabled_languages = { 'en', 'de', 'eo', 'el', 'hu' }
11 end
13 if config.default_lang == nil then
14 config.default_lang = "en"
15 end
17 if config.mail_subject_prefix == nil then
18 config.mail_subject_prefix = "[LiquidFeedback] "
19 end
21 if config.member_image_content_type == nil then
22 config.member_image_content_type = "image/jpeg"
23 end
25 if config.member_image_convert_func == nil then
26 config.member_image_convert_func = {
27 avatar = function(data) return extos.pfilter(data, "convert", "jpeg:-", "-thumbnail", "48x48", "jpeg:-") end,
28 photo = function(data) return extos.pfilter(data, "convert", "jpeg:-", "-thumbnail", "240x240", "jpeg:-") end
29 }
30 end
32 if config.public_access == nil then
33 config.public_access = "full"
34 end
36 if config.locked_profile_fields == nil then
37 config.locked_profile_fields = {}
38 end
40 if not config.database then
41 config.database = { engine='postgresql', dbname='liquid_feedback' }
42 end
44 request.set_404_route{ module = 'index', view = '404' }
46 -- open and set default database handle
47 db = assert(mondelefant.connect(config.database))
48 at_exit(function()
49 db:close()
50 end)
51 function mondelefant.class_prototype:get_db_conn() return db end
53 -- enable output of SQL commands in trace system
54 function db:sql_tracer(command)
55 return function(error_info)
56 local error_info = error_info or {}
57 trace.sql{ command = command, error_position = error_info.position }
58 end
59 end
61 request.set_absolute_baseurl(config.absolute_base_url)
64 -- TODO abstraction
65 -- get record by id
66 function mondelefant.class_prototype:by_id(id)
67 local selector = self:new_selector()
68 selector:add_where{ 'id = ?', id }
69 selector:optional_object_mode()
70 return selector:exec()
71 end