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('''

''' + load_lang('basic_set') + '''

''' + load_lang('wiki_name') + '''

(''' + load_lang('wiki_logo') + ''')
''' + load_lang('main_page') + '''

''' + load_lang('tls_method') + '''

''' + load_lang('domain') + ''' (EX : 2du.pythonanywhere.com) (''' + load_lang('off') + ''' : ''' + load_lang('empty') + ''')

''' + load_lang('wiki_host') + '''

''' + load_lang('wiki_port') + '''

''' + load_lang('wiki_secret_key') + '''

''' + load_lang('encryption_method') + '''

''' + load_lang('set_wiki_access_password_need') + ''' (''' + load_lang('restart_required') + ''')
''' + load_lang('set_wiki_access_password') + ''' (''' + load_lang('restart_required') + ''')

''' + load_lang('authority_use_list') + '''

''' + load_lang('authority_use_list_off') + '''
''' + load_lang('authority_use_list_expiration_date') + ''' (''' + load_lang('day') + ''') (''' + load_lang('off') + ''' : ''' + load_lang('empty') + ''')

''' + load_lang('communication_set') + '''

''' + load_lang('enable_comment_function') + ''' (''' + load_lang('not_working') + ''')
''' + load_lang('enable_challenge_function') + ''' (''' + load_lang('not_working') + ''')
''' + load_lang('display_level_in_user_name') + '''

''' + load_lang('design_set') + '''

''' + load_lang('wiki_skin') + '''

''' + load_lang('render_set') + '''

''' + load_lang('namumark_fully_compatible_mode') + '''
''' + load_lang('link_case_insensitive') + '''

''' + load_lang('login_set') + '''

''' + load_lang('no_register') + '''
''' + load_lang('hide_ip') + '''
''' + load_lang('hide_user_name') + '''
''' + load_lang('requires_approval') + '''
''' + load_lang('password_min_length') + ''' (''' + load_lang('off') + ''' : ''' + load_lang('empty') + ''')

''' + load_lang('ua') + '''

''' + load_lang('ua_get_off') + '''
''' + load_lang('ua_expiration_date') + ''' (''' + load_lang('day') + ''') (''' + load_lang('off') + ''' : ''' + load_lang('empty') + ''')

''' + load_lang('server_set') + '''

''' + load_lang('update_branch') + '''

''' + load_lang('backup') + ''' (''' + load_lang('sqlite_only') + ''')

''' + load_lang('backup_warning') + ''' (EX : data_YYYYMMDDHHMMSS.db)

''' + load_lang('backup_interval') + ''' (''' + load_lang('hour') + ''') (''' + load_lang('off') + ''' : ''' + load_lang('empty') + ''')

''' + load_lang('backup_where') + ''' (''' + load_lang('default') + ''' : ''' + load_lang('empty') + ''') (''' + load_lang('example') + ''' : ./data/backup.db)

''' + load_lang('backup_count') + ''' (''' + load_lang('default') + ''' : ''' + load_lang('empty') + ''')

''' + load_lang('edit_set') + '''

''' + load_lang('slow_edit') + ''' (''' + load_lang('second') + ''') (''' + load_lang('off') + ''' : ''' + load_lang('empty') + ''')

''' + load_lang('edit_bottom_compulsion') + '''
''' + load_lang('title_max_length') + ''' (''' + load_lang('off') + ''' : ''' + load_lang('empty') + ''')

''' + load_lang('title_topic_max_length') + ''' (''' + load_lang('off') + ''' : ''' + load_lang('empty') + ''')

''' + load_lang('max_file_size') + ''' (MB)

''' + load_lang('set_history_recording_off') + '''
''' + load_lang('move_with_redirect') + ''' (''' + load_lang('not_working') + ''')
''' + load_lang('slow_thread') + ''' (''' + load_lang('second') + ''') (''' + load_lang('off') + ''' : ''' + load_lang('empty') + ''')

''' + load_lang('edit_timeout') + ''' (''' + load_lang('second') + ''') (''' + load_lang('off') + ''' : ''' + load_lang('empty') + ''') (''' + load_lang('linux_only') + ''')

''' + load_lang('document_content_max_length') + ''' (''' + load_lang('off') + ''' : ''' + load_lang('empty') + ''')

'''), menu = [['setting', load_lang('return')]] ))