from .tool.func import * def main_setting_main(db_set): with get_db_connect() as conn: curs = conn.cursor() if admin_check() != 1: return re_error('/ban') setting_list = { 0 : ['name', 'Wiki'], 2 : ['frontpage', 'FrontPage'], 4 : ['upload', '2'], 5 : ['skin', ''], 7 : ['reg', ''], 8 : ['ip_view', ''], 9 : ['back_up', ''], 10 : ['port', '3000'], 11 : ['key', load_random_key()], 12 : ['update', 'stable'], 15 : ['encode', 'sha3'], 16 : ['host', '0.0.0.0'], 19 : ['slow_edit', ''], 20 : ['requires_approval', ''], 21 : ['backup_where', ''], 22 : ['domain', ''], 23 : ['ua_get', ''], 24 : ['enable_comment', ''], 25 : ['enable_challenge', ''], 26 : ['edit_bottom_compulsion', ''], 27 : ['http_select', 'http'], 28 : ['title_max_length', ''], 29 : ['title_topic_max_length', ''], 30 : ['password_min_length', ''], 31 : ['wiki_access_password_need', ''], 32 : ['wiki_access_password', ''], 33 : ['history_recording_off', ''], 34 : ['namumark_compatible', ''], 35 : ['user_name_view', ''], 36 : ['link_case_insensitive', ''], 37 : ['move_with_redirect', ''], 38 : ['slow_thread', ''], 39 : ['edit_timeout', '5'], 40 : ['document_content_max_length', ''], 41 : ['backup_count', ''], 42 : ['ua_expiration_date', ''], 43 : ['auth_history_expiration_date', ''], 44 : ['auth_history_off', ''], 45 : ['user_name_level', ''] } if flask.request.method == 'POST': for i in setting_list: curs.execute(db_change("update other set data = ? where name = ?"), [ flask.request.form.get(setting_list[i][0], setting_list[i][1]), setting_list[i][0] ]) conn.commit() admin_check(None, 'edit_set (main)') return redirect('/setting/main') else: d_list = {} for i in setting_list: curs.execute(db_change('select data from other where name = ?'), [setting_list[i][0]]) db_data = curs.fetchall() if not db_data: curs.execute(db_change('insert into other (name, data, coverage) values (?, ?, "")'), [setting_list[i][0], setting_list[i][1]]) d_list[i] = db_data[0][0] if db_data else setting_list[i][1] else: conn.commit() init_set_list = get_init_set_list() # 언어도 변경 가능하도록 필요 encode_select = '' encode_select_data = init_set_list['encode']['list'] + ['sha256'] for encode_select_one in encode_select_data: if encode_select_one == d_list[15]: encode_select = '' + encode_select else: encode_select += '' tls_select = '' tls_select_data = ['http', 'https'] for tls_select_one in tls_select_data: if tls_select_one == d_list[27]: tls_select = '' + tls_select else: tls_select += '' check_box_div = [7, 8, '', 20, 23, 24, 25, 26, 31, 33, 34, 35, 36, 37, 44, 45] for i in range(0, len(check_box_div)): acl_num = check_box_div[i] if acl_num != '' and d_list[acl_num]: check_box_div[i] = 'checked="checked"' else: check_box_div[i] = '' branch_div = '' branch_list = ['stable', 'dev', 'beta'] for i in branch_list: if d_list[12] == i: branch_div = '' + branch_div else: branch_div += '' sqlite_only = 'style="display:none;"' if db_set != 'sqlite' else '' return easy_minify(flask.render_template(skin_check(), imp = [load_lang('main_setting'), wiki_set(), wiki_custom(), wiki_css([0, 0])], data = render_simple_set('''
'''), menu = [['setting', load_lang('return')]] ))