from .tool.func import * def setting_2(conn, num): curs = conn.cursor() if num != 0 and admin_check() != 1: return re_error('/ban') if num == 0: li_list = [ load_lang('main_setting'), load_lang('text_setting'), load_lang('main_head'), load_lang('main_body'), 'robots.txt', 'Google' ] x = 0 li_data = '' for li in li_list: x += 1 li_data += '
  • ' + li + '
  • ' return easy_minify(flask.render_template(skin_check(), imp = [load_lang('setting'), wiki_set(), custom(), other2([0, 0])], data = '

    ' + load_lang('list') + '

    ', menu = [['manager', load_lang('return')]] )) elif num == 1: i_list = { 0 : 'name', 1 : 'logo', 2 : 'frontpage', 3 : 'license', 4 : 'upload', 5 : 'skin', 6 : 'edit', 7 : 'reg', 8 : 'ip_view', 9 : 'back_up', 10 : 'port', 11 : 'key', 12 : 'update', 13 : 'email_have', 14 : 'discussion', 15 : 'encode', 16 : 'host' } n_list = { 0 : 'Wiki', 1 : '', 2 : 'FrontPage', 3 : 'CC 0', 4 : '2', 5 : '', 6 : 'normal', 7 : '', 8 : '', 9 : '0', 10 : '3000', 11 : 'test', 12 : 'stable', 13 : '', 14 : 'normal', 15 : 'sha3', 16 : '0.0.0.0' } if flask.request.method == 'POST': i = 0 for data in i_list: curs.execute("update other set data = ? where name = ?", [flask.request.form.get(data, n_list[i]), data]) i += 1 conn.commit() admin_check(None, 'edit_set') return redirect('/setting/1') else: d_list = [] x = 0 for i in i_list: curs.execute('select data from other where name = ?', [i]) sql_d = curs.fetchall() if sql_d: d_list += [sql_d[0][0]] else: curs.execute('insert into other (name, data) values (?, ?)', [i, n_list[x]]) d_list += [n_list[x]] x += 1 conn.commit() div = '' acl_list = [[load_lang('member'), 'login'], [load_lang('ip'), 'normal'], [load_lang('admin'), 'admin']] for i in acl_list: if i[1] == d_list[6]: div = '' + div else: div += '' div4 = '' for i in acl_list: if i[1] == d_list[14]: div4 = '' + div4 else: div4 += '' ch_1 = '' if d_list[7]: ch_1 = 'checked="checked"' ch_2 = '' if d_list[8]: ch_2 = 'checked="checked"' ch_3 = '' if d_list[13]: ch_3 = 'checked="checked"' div2 = load_skin(d_list[5]) div3 ='' if d_list[12] == 'stable': div3 += '' div3 += '' else: div3 += '' div3 += '' div5 ='' encode_data = ['sha256', 'sha3'] for i in encode_data: if d_list[15] == i: div5 = '' + div5 else: div5 += '' return easy_minify(flask.render_template(skin_check(), imp = [load_lang('main_setting'), wiki_set(), custom(), other2([0, 0])], data = '''
    ''' + load_lang('wiki_name') + '''

    ''' + load_lang('wiki_logo') + ''' (HTML)

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

    ''' + load_lang('bottom_text') + ''' (HTML)

    ''' + load_lang('max_file_size') + ''' [MB]

    ''' + load_lang('backup_interval') + ' [' + load_lang('hour') + '''] (off : 0) {restart}

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

    ''' + load_lang('default_acl') + '''

    ''' + load_lang('default_discussion_acl') + '''

    ''' + load_lang('no_register') + '''
    ''' + load_lang('hide_ip') + '''
    ''' + load_lang('email_required') + ''' {''' + load_lang('google_imap_required') + '''}
    ''' + load_lang('wiki_host') + '''

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

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

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

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

    ''', menu = [['setting', load_lang('return')]] )) elif num == 2: i_list = [ 'contract', 'no_login_warring', 'edit_bottom_text', 'check_key_text', 'email_title', 'email_text', 'email_insert_text', 'password_search_text', 'reset_user_text' ] if flask.request.method == 'POST': for i in i_list: curs.execute("update other set data = ? where name = ?", [ flask.request.form.get(i, ''), i ]) conn.commit() admin_check(None, 'edit_set') return redirect('/setting/2') else: d_list = [] for i in i_list: curs.execute('select data from other where name = ?', [i]) sql_d = curs.fetchall() if sql_d: d_list += [sql_d[0][0]] else: curs.execute('insert into other (name, data) values (?, ?)', [i, '']) d_list += [''] conn.commit() return easy_minify(flask.render_template(skin_check(), imp = [load_lang('text_setting'), wiki_set(), custom(), other2([0, 0])], data = '''
    ''' + load_lang('register_text') + ''' (HTML)

    ''' + load_lang('non_login_alert') + ''' (HTML)

    ''' + load_lang('edit_bottom_text') + ''' (HTML)

    ''' + load_lang('check_key_text') + ''' (HTML)

    ''' + load_lang('email_title') + '''

    ''' + load_lang('email_text') + '''

    ''' + load_lang('email_insert_text') + '''

    ''' + load_lang('password_search_text') + '''

    ''' + load_lang('reset_user_text') + '''

    ''', menu = [['setting', load_lang('return')]] )) elif num == 3 or num == 4: if flask.request.method == 'POST': if num == 4: info_d = 'body' end_r = '4' coverage = '' else: info_d = 'head' end_r = '3' if flask.request.args.get('skin', '') == '': coverage = '' else: coverage = flask.request.args.get('skin', '') curs.execute("select name from other where name = ? and coverage = ?", [info_d, coverage]) if curs.fetchall(): curs.execute("update other set data = ? where name = ? and coverage = ?", [ flask.request.form.get('content', ''), info_d, coverage ]) else: curs.execute("insert into other (name, data, coverage) values (?, ?, ?)", [info_d, flask.request.form.get('content', ''), coverage]) conn.commit() admin_check(None, 'edit_set') return redirect('/setting/' + end_r + '?skin=' + flask.request.args.get('skin', '')) else: if num == 4: curs.execute("select data from other where name = 'body'") title = '_body' start = '' else: curs.execute("select data from other where name = 'head' and coverage = ?", [flask.request.args.get('skin', '')]) title = '_head' start = '(' + load_lang('all') + ') ' + \ ' '.join(['(' + i + ')' for i in load_skin('', 1)]) + \ '''
    <style>CSS</style>
    <script>JS</script>

    ''' head = curs.fetchall() if head: data = head[0][0] else: data = '' return easy_minify(flask.render_template(skin_check(), imp = [load_lang(data = 'main' + title, safe = 1), wiki_set(), custom(), other2([0, 0])], data = '''
    ''' + start + '''
    ''', menu = [['setting', load_lang('return')]] )) elif num == 5: if flask.request.method == 'POST': curs.execute("select name from other where name = 'robot'") if curs.fetchall(): curs.execute("update other set data = ? where name = 'robot'", [flask.request.form.get('content', '')]) else: curs.execute("insert into other (name, data) values ('robot', ?)", [flask.request.form.get('content', '')]) conn.commit() fw = open('./robots.txt', 'w') fw.write(re.sub('\r\n', '\n', flask.request.form.get('content', ''))) fw.close() admin_check(None, 'edit_set') return redirect('/setting/4') else: curs.execute("select data from other where name = 'robot'") robot = curs.fetchall() if robot: data = robot[0][0] else: data = '' f = open('./robots.txt', 'r') lines = f.readlines() f.close() if not data or data == '': data = ''.join(lines) return easy_minify(flask.render_template(skin_check(), imp = ['robots.txt', wiki_set(), custom(), other2([0, 0])], data = ''' (view)

    ''', menu = [['setting', load_lang('return')]] )) elif num == 6: i_list = [ 'recaptcha', 'sec_re', 'g_email', 'g_pass' ] if flask.request.method == 'POST': for data in i_list: if data == 'g_email': into_data = re.sub('@.*$', '', flask.request.form.get(data, '')) else: into_data = flask.request.form.get(data, '') curs.execute("update other set data = ? where name = ?", [into_data, data]) conn.commit() admin_check(None, 'edit_set') return redirect('/setting/6') else: d_list = [] x = 0 for i in i_list: curs.execute('select data from other where name = ?', [i]) sql_d = curs.fetchall() if sql_d: d_list += [sql_d[0][0]] else: curs.execute('insert into other (name, data) values (?, ?)', [i, '']) d_list += [''] x += 1 conn.commit() return easy_minify(flask.render_template(skin_check(), imp = ['Google', wiki_set(), custom(), other2([0, 0])], data = '''

    recaptcha

    ''' + load_lang('recaptcha') + ''' (HTML)

    ''' + load_lang('recaptcha') + ' (' + load_lang('secret_key') + ''')

    ''' + load_lang('google_imap') + ' {' + load_lang('restart_required') + '''}

    ''' + load_lang('google_email') + '''

    ''' + load_lang('google_app_password') + '''

    ''', menu = [['setting', load_lang('return')]] )) else: return redirect()