|
|
@@ -6,7 +6,7 @@ from .go_api_topic import api_topic_thread_make, api_topic_thread_pre_render
|
|
|
|
|
|
from .edit import edit_editor
|
|
|
|
|
|
-def bbs_w_post_comment(user_id, sub_code, comment_num, bbs_num_str, post_num_str):
|
|
|
+def bbs_w_post_comment(conn, user_id, sub_code, comment_num, bbs_num_str, post_num_str):
|
|
|
comment_data = ''
|
|
|
comment_select = ''
|
|
|
|
|
|
@@ -28,15 +28,15 @@ def bbs_w_post_comment(user_id, sub_code, comment_num, bbs_num_str, post_num_str
|
|
|
margin_count = sub_code_check.count('-')
|
|
|
|
|
|
date = ''
|
|
|
- date += '<a href="javascript:opennamu_change_comment(\'' + sub_code_check + '\');">(' + load_lang('comment') + ')</a> '
|
|
|
- date += '<a href="/bbs/tool/' + bbs_num_str + '/' + post_num_str + '/' + sub_code_check + '">(' + load_lang('tool') + ')</a> '
|
|
|
+ date += '<a href="javascript:opennamu_change_comment(\'' + sub_code_check + '\');">(' + get_lang(conn, 'comment') + ')</a> '
|
|
|
+ date += '<a href="/bbs/tool/' + bbs_num_str + '/' + post_num_str + '/' + sub_code_check + '">(' + get_lang(conn, 'tool') + ')</a> '
|
|
|
date += temp_dict['comment_date']
|
|
|
|
|
|
comment_data += '<span style="padding-left: 20px;"></span>' * margin_count
|
|
|
comment_data += api_topic_thread_make(
|
|
|
- ip_pas(temp_dict['comment_user_id']),
|
|
|
+ ip_pas(conn, temp_dict['comment_user_id']),
|
|
|
date,
|
|
|
- render_set(doc_data = temp_dict['comment']),
|
|
|
+ render_set(conn, doc_data = temp_dict['comment']),
|
|
|
sub_code_check,
|
|
|
color = color,
|
|
|
add_style = 'width: calc(100% - ' + str(margin_count * 20) + 'px);'
|
|
|
@@ -48,7 +48,7 @@ def bbs_w_post_comment(user_id, sub_code, comment_num, bbs_num_str, post_num_str
|
|
|
|
|
|
comment_select += '<option value="' + sub_code_check + '" ' + comment_default + '>' + sub_code_check + '</option>'
|
|
|
|
|
|
- temp_data = bbs_w_post_comment(user_id, sub_code + '-' + temp_dict['code'], comment_num, bbs_num_str, post_num_str)
|
|
|
+ temp_data = bbs_w_post_comment(conn, user_id, sub_code + '-' + temp_dict['code'], comment_num, bbs_num_str, post_num_str)
|
|
|
|
|
|
comment_data += temp_data[0]
|
|
|
comment_select += temp_data[1]
|
|
|
@@ -63,32 +63,32 @@ def bbs_w_post(bbs_num = '', post_num = ''):
|
|
|
curs.execute(db_change('select set_data from bbs_set where set_id = ? and set_name = "bbs_name"'), [bbs_num])
|
|
|
db_data_3 = curs.fetchall()
|
|
|
if not db_data_3:
|
|
|
- return redirect('/bbs/main')
|
|
|
+ return redirect(conn, '/bbs/main')
|
|
|
|
|
|
bbs_name = db_data_3[0][0]
|
|
|
|
|
|
bbs_num_str = str(bbs_num)
|
|
|
post_num_str = str(post_num)
|
|
|
- bbs_comment_acl = acl_check(bbs_num_str, 'bbs_comment')
|
|
|
+ bbs_comment_acl = acl_check(conn, bbs_num_str, 'bbs_comment')
|
|
|
ip = ip_check()
|
|
|
|
|
|
temp_dict = json.loads(api_bbs_w_post(bbs_num_str + '-' + post_num_str).data)
|
|
|
if temp_dict == {}:
|
|
|
- return redirect('/bbs/main')
|
|
|
+ return redirect(conn, '/bbs/main')
|
|
|
|
|
|
curs.execute(db_change('select set_data from bbs_set where set_id = ? and set_name = "bbs_type"'), [bbs_num])
|
|
|
db_data_2 = curs.fetchall()
|
|
|
if not db_data_2:
|
|
|
- return redirect('/bbs/main')
|
|
|
+ return redirect(conn, '/bbs/main')
|
|
|
elif db_data_2[0][0] == 'thread':
|
|
|
if flask.request.method == 'POST':
|
|
|
if bbs_comment_acl == 1:
|
|
|
- return redirect('/bbs/set/' + bbs_num_str)
|
|
|
+ return redirect(conn, '/bbs/set/' + bbs_num_str)
|
|
|
|
|
|
- if captcha_post(flask.request.form.get('g-recaptcha-response', flask.request.form.get('g-recaptcha', ''))) == 1:
|
|
|
- return re_error('/error/13')
|
|
|
+ if captcha_post(conn, flask.request.form.get('g-recaptcha-response', flask.request.form.get('g-recaptcha', ''))) == 1:
|
|
|
+ return re_error(conn, '/error/13')
|
|
|
else:
|
|
|
- captcha_post('', 0)
|
|
|
+ captcha_post(conn, '', 0)
|
|
|
|
|
|
set_id = bbs_num_str + '-' + post_num_str
|
|
|
|
|
|
@@ -99,7 +99,7 @@ def bbs_w_post(bbs_num = '', post_num = ''):
|
|
|
data = flask.request.form.get('content', '')
|
|
|
if data == '':
|
|
|
# re_error로 대체 예정
|
|
|
- return redirect('/bbs/w/' + bbs_num_str + '/' + post_num_str)
|
|
|
+ return redirect(conn, '/bbs/w/' + bbs_num_str + '/' + post_num_str)
|
|
|
|
|
|
data = data.replace('\r', '')
|
|
|
data = api_topic_thread_pre_render(curs, data, id_data, ip, set_id, bbs_name, temp_dict['title'], 'post')
|
|
|
@@ -110,14 +110,14 @@ def bbs_w_post(bbs_num = '', post_num = ''):
|
|
|
curs.execute(db_change("insert into bbs_data (set_name, set_code, set_id, set_data) values ('comment_date', ?, ?, ?)"), [id_data, set_id, date])
|
|
|
curs.execute(db_change("insert into bbs_data (set_name, set_code, set_id, set_data) values ('comment_user_id', ?, ?, ?)"), [id_data, set_id, ip])
|
|
|
|
|
|
- add_alarm(temp_dict['user_id'], ip, 'BBS <a href="/bbs/w/' + bbs_num_str + '/' + post_num_str + '#' + id_data + '">' + html.escape(bbs_name) + ' - ' + html.escape(temp_dict['title']) + '#' + id_data + '</a>')
|
|
|
+ add_alarm(conn, temp_dict['user_id'], ip, 'BBS <a href="/bbs/w/' + bbs_num_str + '/' + post_num_str + '#' + id_data + '">' + html.escape(bbs_name) + ' - ' + html.escape(temp_dict['title']) + '#' + id_data + '</a>')
|
|
|
|
|
|
conn.commit()
|
|
|
|
|
|
- return redirect('/bbs/w/' + bbs_num_str + '/' + post_num_str + '#' + id_data)
|
|
|
+ return redirect(conn, '/bbs/w/' + bbs_num_str + '/' + post_num_str + '#' + id_data)
|
|
|
else:
|
|
|
- if acl_check(bbs_num_str, 'bbs_view') == 1:
|
|
|
- return re_error('/ban')
|
|
|
+ if acl_check(conn, bbs_num_str, 'bbs_view') == 1:
|
|
|
+ return re_error(conn, '/ban')
|
|
|
|
|
|
text = ''
|
|
|
|
|
|
@@ -127,9 +127,9 @@ def bbs_w_post(bbs_num = '', post_num = ''):
|
|
|
data = ''
|
|
|
data += '<h2>' + html.escape(temp_dict['title']) + '</h2>'
|
|
|
data += api_topic_thread_make(
|
|
|
- ip_pas(temp_dict['user_id']),
|
|
|
+ ip_pas(conn, temp_dict['user_id']),
|
|
|
date,
|
|
|
- render_set(doc_data = temp_dict['data'], data_type = 'thread'),
|
|
|
+ render_set(conn, doc_data = temp_dict['data'], data_type = 'thread'),
|
|
|
'0',
|
|
|
color = 'green'
|
|
|
)
|
|
|
@@ -146,13 +146,13 @@ def bbs_w_post(bbs_num = '', post_num = ''):
|
|
|
color = 'default'
|
|
|
|
|
|
date = ''
|
|
|
- date += '<a href="/bbs/tool/' + bbs_num_str + '/' + post_num_str + '/' + str(count) + '">(' + load_lang('tool') + ')</a> '
|
|
|
+ date += '<a href="/bbs/tool/' + bbs_num_str + '/' + post_num_str + '/' + str(count) + '">(' + get_lang(conn, 'tool') + ')</a> '
|
|
|
date += temp_dict['comment_date']
|
|
|
|
|
|
data += api_topic_thread_make(
|
|
|
- ip_pas(temp_dict['comment_user_id']),
|
|
|
+ ip_pas(conn, temp_dict['comment_user_id']),
|
|
|
date,
|
|
|
- render_set(doc_data = temp_dict['comment'], data_type = 'thread'),
|
|
|
+ render_set(conn, doc_data = temp_dict['comment'], data_type = 'thread'),
|
|
|
str(count),
|
|
|
color = color
|
|
|
)
|
|
|
@@ -163,21 +163,21 @@ def bbs_w_post(bbs_num = '', post_num = ''):
|
|
|
</form>
|
|
|
'''
|
|
|
|
|
|
- return easy_minify(flask.render_template(skin_check(),
|
|
|
- imp = [bbs_name, wiki_set(), wiki_custom(), wiki_css(['(' + load_lang('bbs') + ')', 0])],
|
|
|
+ return easy_minify(conn, flask.render_template(skin_check(conn),
|
|
|
+ imp = [bbs_name, wiki_set(conn), wiki_custom(conn), wiki_css(['(' + get_lang(conn, 'bbs') + ')', 0])],
|
|
|
data = data,
|
|
|
- menu = [['bbs/w/' + bbs_num_str, load_lang('return')], ['bbs/edit/' + bbs_num_str + '/' + post_num_str, load_lang('edit')], ['bbs/tool/' + bbs_num_str + '/' + post_num_str, load_lang('tool')]]
|
|
|
+ menu = [['bbs/w/' + bbs_num_str, get_lang(conn, 'return')], ['bbs/edit/' + bbs_num_str + '/' + post_num_str, get_lang(conn, 'edit')], ['bbs/tool/' + bbs_num_str + '/' + post_num_str, get_lang(conn, 'tool')]]
|
|
|
))
|
|
|
else:
|
|
|
# db_data_2[0][0] == 'comment'
|
|
|
if flask.request.method == 'POST':
|
|
|
if bbs_comment_acl == 1:
|
|
|
- return redirect('/bbs/set/' + bbs_num_str)
|
|
|
+ return redirect(conn, '/bbs/set/' + bbs_num_str)
|
|
|
|
|
|
- if captcha_post(flask.request.form.get('g-recaptcha-response', flask.request.form.get('g-recaptcha', ''))) == 1:
|
|
|
- return re_error('/error/13')
|
|
|
+ if captcha_post(conn, flask.request.form.get('g-recaptcha-response', flask.request.form.get('g-recaptcha', ''))) == 1:
|
|
|
+ return re_error(conn, '/error/13')
|
|
|
else:
|
|
|
- captcha_post('', 0)
|
|
|
+ captcha_post(conn, '', 0)
|
|
|
|
|
|
select = flask.request.form.get('comment_select', '0')
|
|
|
select = '' if select == '0' else select
|
|
|
@@ -191,7 +191,7 @@ def bbs_w_post(bbs_num = '', post_num = ''):
|
|
|
db_data_6 = curs.fetchall()
|
|
|
if not db_data_6:
|
|
|
# re_error로 변경 예정
|
|
|
- return redirect('/bbs/w/' + bbs_num_str + '/' + post_num_str)
|
|
|
+ return redirect(conn, '/bbs/w/' + bbs_num_str + '/' + post_num_str)
|
|
|
else:
|
|
|
set_id = bbs_num_str + '-' + post_num_str + '-' + select_split[0]
|
|
|
comment_user_name = db_data_6[0][0]
|
|
|
@@ -199,7 +199,7 @@ def bbs_w_post(bbs_num = '', post_num = ''):
|
|
|
curs.execute(db_change('select set_data from bbs_data where set_name = "comment_user_id" and set_id = ? and set_code = ? limit 1'), [bbs_num_str + '-' + post_num_str + '-' + '-'.join(select_split[0:len(select_split) - 1]), select_split[len(select_split) - 1]])
|
|
|
db_data_7 = curs.fetchall()
|
|
|
if not db_data_7:
|
|
|
- return redirect('/bbs/w/' + bbs_num_str + '/' + post_num_str)
|
|
|
+ return redirect(conn, '/bbs/w/' + bbs_num_str + '/' + post_num_str)
|
|
|
else:
|
|
|
set_id = bbs_num_str + '-' + post_num_str + '-' + '-'.join(select_split)
|
|
|
comment_user_name = db_data_7[0][0]
|
|
|
@@ -213,7 +213,7 @@ def bbs_w_post(bbs_num = '', post_num = ''):
|
|
|
data = flask.request.form.get('content', '')
|
|
|
if data == '':
|
|
|
# re_error로 대체 예정
|
|
|
- return redirect('/bbs/w/' + bbs_num_str + '/' + post_num_str)
|
|
|
+ return redirect(conn, '/bbs/w/' + bbs_num_str + '/' + post_num_str)
|
|
|
|
|
|
date = get_time()
|
|
|
|
|
|
@@ -230,28 +230,28 @@ def bbs_w_post(bbs_num = '', post_num = ''):
|
|
|
set_id += '-' if set_id != '' else ''
|
|
|
end_id = set_id + id_data
|
|
|
|
|
|
- add_alarm(temp_dict['user_id'], ip, 'BBS <a href="/bbs/w/' + bbs_num_str + '/' + post_num_str + '#' + end_id + '">' + html.escape(bbs_name) + ' - ' + html.escape(temp_dict['title']) + '#' + end_id + '</a>')
|
|
|
+ add_alarm(conn, temp_dict['user_id'], ip, 'BBS <a href="/bbs/w/' + bbs_num_str + '/' + post_num_str + '#' + end_id + '">' + html.escape(bbs_name) + ' - ' + html.escape(temp_dict['title']) + '#' + end_id + '</a>')
|
|
|
if comment_user_name != '':
|
|
|
- add_alarm(comment_user_name, ip, 'BBS <a href="/bbs/w/' + bbs_num_str + '/' + post_num_str + '#' + end_id + '">' + html.escape(bbs_name) + ' - ' + html.escape(temp_dict['title']) + '#' + end_id + '</a>')
|
|
|
+ add_alarm(conn, comment_user_name, ip, 'BBS <a href="/bbs/w/' + bbs_num_str + '/' + post_num_str + '#' + end_id + '">' + html.escape(bbs_name) + ' - ' + html.escape(temp_dict['title']) + '#' + end_id + '</a>')
|
|
|
|
|
|
- return redirect('/bbs/w/' + bbs_num_str + '/' + post_num_str + '#' + end_id)
|
|
|
+ return redirect(conn, '/bbs/w/' + bbs_num_str + '/' + post_num_str + '#' + end_id)
|
|
|
else:
|
|
|
- if acl_check(bbs_num_str, 'bbs_view') == 1:
|
|
|
- return re_error('/ban')
|
|
|
+ if acl_check(conn, bbs_num_str, 'bbs_view') == 1:
|
|
|
+ return re_error(conn, '/ban')
|
|
|
|
|
|
text = ''
|
|
|
comment_num = ''
|
|
|
|
|
|
date = ''
|
|
|
- date += '<a href="javascript:opennamu_change_comment(\'0\');">(' + load_lang('comment') + ')</a> '
|
|
|
+ date += '<a href="javascript:opennamu_change_comment(\'0\');">(' + get_lang(conn, 'comment') + ')</a> '
|
|
|
date += temp_dict['date']
|
|
|
|
|
|
data = ''
|
|
|
data += '<h2>' + html.escape(temp_dict['title']) + '</h2>'
|
|
|
data += api_topic_thread_make(
|
|
|
- ip_pas(temp_dict['user_id']),
|
|
|
+ ip_pas(conn, temp_dict['user_id']),
|
|
|
date,
|
|
|
- render_set(doc_data = temp_dict['data']),
|
|
|
+ render_set(conn, doc_data = temp_dict['data']),
|
|
|
'0',
|
|
|
color = 'red'
|
|
|
)
|
|
|
@@ -260,12 +260,12 @@ def bbs_w_post(bbs_num = '', post_num = ''):
|
|
|
comment_data = ''
|
|
|
|
|
|
comment_select = '<select id="opennamu_comment_select" name="comment_select">'
|
|
|
- comment_select += '<option value="0">' + load_lang('normal') + '</option>'
|
|
|
+ comment_select += '<option value="0">' + get_lang(conn, 'normal') + '</option>'
|
|
|
|
|
|
comment_count = 0
|
|
|
comment_add_count = 0
|
|
|
|
|
|
- temp_data = bbs_w_post_comment(user_id, bbs_num_str + '-' + post_num_str, comment_num, bbs_num_str, post_num_str)
|
|
|
+ temp_data = bbs_w_post_comment(conn, user_id, bbs_num_str + '-' + post_num_str, comment_num, bbs_num_str, post_num_str)
|
|
|
|
|
|
comment_data += temp_data[0]
|
|
|
comment_select += temp_data[1]
|
|
|
@@ -278,8 +278,8 @@ def bbs_w_post(bbs_num = '', post_num = ''):
|
|
|
|
|
|
comment_select += '</select>'
|
|
|
if comment_data != '':
|
|
|
- data += load_lang('comment') + ' : ' + str(comment_count) + '<hr class="main_hr">'
|
|
|
- data += load_lang('reply') + ' : ' + str(comment_add_count) + '<hr class="main_hr">'
|
|
|
+ data += get_lang(conn, 'comment') + ' : ' + str(comment_count) + '<hr class="main_hr">'
|
|
|
+ data += get_lang(conn, 'reply') + ' : ' + str(comment_add_count) + '<hr class="main_hr">'
|
|
|
data += comment_data
|
|
|
else:
|
|
|
data += '<hr class="main_hr">'
|
|
|
@@ -287,7 +287,7 @@ def bbs_w_post(bbs_num = '', post_num = ''):
|
|
|
bbs_comment_form = ''
|
|
|
if bbs_comment_acl == 0:
|
|
|
bbs_comment_form += '''
|
|
|
- ''' + comment_select + ''' <a href="javascript:opennamu_return_comment();">(''' + load_lang('return') + ''')</a>
|
|
|
+ ''' + comment_select + ''' <a href="javascript:opennamu_return_comment();">(''' + get_lang(conn, 'return') + ''')</a>
|
|
|
<hr class="main_hr">
|
|
|
|
|
|
''' + edit_editor(curs, ip, text, 'bbs_comment') + '''
|
|
|
@@ -300,8 +300,8 @@ def bbs_w_post(bbs_num = '', post_num = ''):
|
|
|
<script src="/views/main_css/js/route/bbs_w_post.js''' + cache_v() + '''"></script>
|
|
|
'''
|
|
|
|
|
|
- return easy_minify(flask.render_template(skin_check(),
|
|
|
- imp = [bbs_name, wiki_set(), wiki_custom(), wiki_css(['(' + load_lang('bbs') + ')', 0])],
|
|
|
+ return easy_minify(conn, flask.render_template(skin_check(conn),
|
|
|
+ imp = [bbs_name, wiki_set(conn), wiki_custom(conn), wiki_css(['(' + get_lang(conn, 'bbs') + ')', 0])],
|
|
|
data = data,
|
|
|
- menu = [['bbs/w/' + bbs_num_str, load_lang('return')], ['bbs/edit/' + bbs_num_str + '/' + post_num_str, load_lang('edit')], ['bbs/tool/' + bbs_num_str + '/' + post_num_str, load_lang('tool')]]
|
|
|
+ menu = [['bbs/w/' + bbs_num_str, get_lang(conn, 'return')], ['bbs/edit/' + bbs_num_str + '/' + post_num_str, get_lang(conn, 'edit')], ['bbs/tool/' + bbs_num_str + '/' + post_num_str, get_lang(conn, 'tool')]]
|
|
|
))
|