| 12345678910111213141516171819202122232425262728 |
- from .tool.func import *
- def topic_comment_notice(topic_num = 1, num = 1):
- with get_db_connect() as conn:
- curs = conn.cursor()
-
- topic_num = str(topic_num)
- num = str(num)
-
- if admin_check(conn, 3, 'notice (code ' + topic_num + '#' + num + ')') != 1:
- return re_error(conn, '/error/3')
- curs.execute(db_change("select code from topic where code = ? and id = ?"), [topic_num, num])
- if curs.fetchall():
- curs.execute(db_change("select top from topic where code = ? and id = ?"), [topic_num, num])
- top_data = curs.fetchall()
- if top_data:
- if top_data[0][0] == 'O':
- curs.execute(db_change("update topic set top = '' where code = ? and id = ?"), [topic_num, num])
- else:
- curs.execute(db_change("update topic set top = 'O' where code = ? and id = ?"), [topic_num, num])
- do_reload_recent_thread(conn,
- topic_num,
- get_time()
- )
- return redirect(conn, '/thread/' + topic_num + '#' + num)
|