| rev | line source | 
| bsw@734 | 1 -- ======================================================================== | 
| bsw@734 | 2 -- DO NOT CHANGE ANYTHING IN THIS FILE | 
| bsw@734 | 3 -- (except when you really know what you are doing!) | 
| bsw@734 | 4 -- ======================================================================== | 
| bsw@734 | 5 | 
| bsw@991 | 6 config.app_version = "2.2.3" | 
| bsw@731 | 7 | 
| bsw@905 | 8 if not config.password_hash_algorithm then | 
| bsw@905 | 9   config.password_hash_algorithm = "crypt_sha512" | 
| bsw@905 | 10 end | 
| bsw@905 | 11 | 
| bsw@905 | 12 if not config.password_hash_min_rounds then | 
| bsw@905 | 13  config.password_hash_min_rounds = 10000 | 
| bsw@905 | 14 end | 
| bsw@905 | 15 | 
| bsw@905 | 16 if not config.password_hash_max_rounds then | 
| bsw@905 | 17   config.password_hash_max_rounds = 20000 | 
| bsw@905 | 18 end | 
| bsw@905 | 19 | 
| bsw@731 | 20 if config.enabled_languages == nil then | 
| bsw@876 | 21   config.enabled_languages = { 'en', 'de', 'eo', 'el', 'hu', 'it', 'nl', 'zh-Hans', 'zh-TW' } | 
| bsw@731 | 22 end | 
| bsw@731 | 23 | 
| bsw@731 | 24 if config.default_lang == nil then | 
| bsw@731 | 25   config.default_lang = "en" | 
| bsw@731 | 26 end | 
| bsw@731 | 27 | 
| bsw@731 | 28 if config.mail_subject_prefix == nil then | 
| bsw@731 | 29   config.mail_subject_prefix = "[LiquidFeedback] " | 
| bsw@731 | 30 end | 
| bsw@731 | 31 | 
| bsw@731 | 32 if config.member_image_content_type == nil then | 
| bsw@731 | 33   config.member_image_content_type = "image/jpeg" | 
| bsw@731 | 34 end | 
| bsw@731 | 35 | 
| bsw@731 | 36 if config.member_image_convert_func == nil then | 
| bsw@731 | 37   config.member_image_convert_func = { | 
| bsw@731 | 38     avatar = function(data) return extos.pfilter(data, "convert", "jpeg:-", "-thumbnail",   "48x48", "jpeg:-") end, | 
| bsw@731 | 39     photo =  function(data) return extos.pfilter(data, "convert", "jpeg:-", "-thumbnail", "240x240", "jpeg:-") end | 
| bsw@731 | 40   } | 
| bsw@731 | 41 end | 
| bsw@731 | 42 | 
| bsw@736 | 43 if config.locked_profile_fields == nil then | 
| bsw@736 | 44   config.locked_profile_fields = {} | 
| bsw@736 | 45 end | 
| bsw@736 | 46 | 
| bsw@988 | 47 if config.check_delegations_default == nil then | 
| bsw@988 | 48   config.check_delegations_default = "confirm" | 
| bsw@988 | 49 end | 
| bsw@988 | 50 | 
| bsw@732 | 51 if not config.database then | 
| bsw@732 | 52   config.database = { engine='postgresql', dbname='liquid_feedback' } | 
| bsw@732 | 53 end | 
| bsw@732 | 54 | 
| bsw@868 | 55 if not config.enable_debug_trace then | 
| bsw@868 | 56   trace.disable() | 
| bsw@868 | 57 else | 
| bsw@868 | 58   slot.put_into('trace_button', '<div id="trace_show" onclick="document.getElementById(\'trace_content\').style.display=\'block\';this.style.display=\'none\';">TRACE</div>') | 
| bsw@868 | 59 end | 
| bsw@868 | 60 | 
| bsw@868 | 61 | 
| bsw@729 | 62 request.set_404_route{ module = 'index', view = '404' } | 
| bsw@729 | 63 | 
| bsw@729 | 64 -- open and set default database handle | 
| bsw@734 | 65 db = assert(mondelefant.connect(config.database)) | 
| bsw@729 | 66 at_exit(function() | 
| bsw@729 | 67   db:close() | 
| bsw@729 | 68 end) | 
| bsw@729 | 69 function mondelefant.class_prototype:get_db_conn() return db end | 
| bsw@729 | 70 | 
| bsw@729 | 71 -- enable output of SQL commands in trace system | 
| bsw@729 | 72 function db:sql_tracer(command) | 
| bsw@729 | 73   return function(error_info) | 
| bsw@729 | 74     local error_info = error_info or {} | 
| bsw@729 | 75     trace.sql{ command = command, error_position = error_info.position } | 
| bsw@729 | 76   end | 
| bsw@729 | 77 end | 
| bsw@729 | 78 | 
| bsw@729 | 79 request.set_absolute_baseurl(config.absolute_base_url) | 
| bsw@729 | 80 | 
| bsw@729 | 81 | 
| bsw@729 | 82 -- TODO abstraction | 
| bsw@729 | 83 -- get record by id | 
| bsw@729 | 84 function mondelefant.class_prototype:by_id(id) | 
| bsw@729 | 85   local selector = self:new_selector() | 
| bsw@729 | 86   selector:add_where{ 'id = ?', id } | 
| bsw@729 | 87   selector:optional_object_mode() | 
| bsw@729 | 88   return selector:exec() | 
| bsw@729 | 89 end | 
| bsw@729 | 90 |