from .tool.func import * async def main_setting_head(num, skin_name = '', set_preview = 0): with get_db_connect() as conn: curs = conn.cursor() if await acl_check('', 'owner_auth', '', '') == 1: return await re_error(conn, 0) if flask.request.method == 'POST' and set_preview == 0: if num == 4: info_d = 'body' end_r = 'body/top' coverage = '' elif num == 7: info_d = 'bottom_body' end_r = 'body/bottom' coverage = '' else: info_d = 'head' end_r = 'head' if skin_name == '': coverage = '' else: coverage = skin_name curs.execute(db_change("select name from other where name = ? and coverage = ?"), [info_d, coverage]) if curs.fetchall(): curs.execute(db_change("update other set data = ? where name = ? and coverage = ?"), [flask.request.form.get('content', ''), info_d, coverage]) else: curs.execute(db_change("insert into other (name, data, coverage) values (?, ?, ?)"), [info_d, flask.request.form.get('content', ''), coverage]) await acl_check(tool = 'owner_auth', memo = 'edit_set (' + info_d + ')') if skin_name == '': return redirect(conn, '/setting/' + end_r) else: return redirect(conn, '/setting/' + end_r + '/' + skin_name) else: title = '' start = '' form_action = '' data_preview = '' plus = '' if num == 4: curs.execute(db_change("select data from other where name = 'body'")) title = '_body' form_action = 'formaction="/setting/body/top"' data_preview = flask.request.form.get('content', '') if set_preview == 1 else '' plus = '''