|
|
@@ -82,24 +82,49 @@ def topic(topic_num = 0):
|
|
|
cate_re = re.compile(r'\[\[((?:분류|category):(?:(?:(?!\]\]).)*))\]\]', re.I)
|
|
|
data = cate_re.sub('[br]', flask.request.form.get('content', 'Test').replace('\r', ''))
|
|
|
|
|
|
- for rd_data in re.findall(r"(?: |\n|^)(#(?:[0-9]+))(?: |\n|$)", data):
|
|
|
- curs.execute(db_change("select ip from topic where code = ? and id = ?"), [topic_num, rd_data])
|
|
|
- ip_data = curs.fetchall()
|
|
|
- if ip_data and ip_or_user(ip_data[0][0]) == 0:
|
|
|
- add_alarm(ip_data[0][0], ip + ' | <a href="/thread/' + topic_num + '#' + num + '">' + name + ' | ' + sub + ' | #' + num + '</a>')
|
|
|
-
|
|
|
- for rd_data in re.findall(r"(?: |\n|^)@((?:[^ ]+))(?: |\n|$)", data):
|
|
|
- curs.execute(db_change("select ip from history where ip = ? limit 1"), [rd_data])
|
|
|
- ip_data = curs.fetchall()
|
|
|
- if not ip_data:
|
|
|
- curs.execute(db_change("select ip from topic where ip = ? limit 1"), [rd_data])
|
|
|
+ call_thread_regex = r"( |\n|^)(?:#([0-9]+))( |\n|$)"
|
|
|
+ call_thread_count = len(re.findall(call_thread_regex, data)) * 3
|
|
|
+ while 1:
|
|
|
+ rd_data = re.search(call_thread_regex, data)
|
|
|
+ if call_thread_count < 0:
|
|
|
+ break
|
|
|
+ elif not rd_data:
|
|
|
+ break
|
|
|
+ else:
|
|
|
+ rd_data = rd_data.groups()
|
|
|
+
|
|
|
+ curs.execute(db_change("select ip from topic where code = ? and id = ?"), [topic_num, rd_data[1]])
|
|
|
ip_data = curs.fetchall()
|
|
|
+ if ip_data and ip_or_user(ip_data[0][0]) == 0 and ip != ip_data[0][0]:
|
|
|
+ add_alarm(ip_data[0][0], ip + ' | <a href="/thread/' + topic_num + '#' + num + '">' + name + ' | ' + sub + ' | #' + num + '</a>')
|
|
|
+
|
|
|
+ data = re.sub(call_thread_regex, rd_data[0] + '<topic_a>#' + rd_data[1] + '</topic_a>' + rd_data[2], data, 1)
|
|
|
+
|
|
|
+ call_thread_count -= 1
|
|
|
+
|
|
|
+ call_user_regex = r"( |\n|^)(?:@([^ ]+))( |\n|$)"
|
|
|
+ call_user_count = len(re.findall(call_user_regex, data)) * 3
|
|
|
+ while 1:
|
|
|
+ rd_data = re.search(call_user_regex, data)
|
|
|
+ if call_user_count < 0:
|
|
|
+ break
|
|
|
+ elif not rd_data:
|
|
|
+ break
|
|
|
+ else:
|
|
|
+ rd_data = rd_data.groups()
|
|
|
+
|
|
|
+ curs.execute(db_change("select ip from history where ip = ? limit 1"), [rd_data[1]])
|
|
|
+ ip_data = curs.fetchall()
|
|
|
+ if not ip_data:
|
|
|
+ curs.execute(db_change("select ip from topic where ip = ? limit 1"), [rd_data[1]])
|
|
|
+ ip_data = curs.fetchall()
|
|
|
+
|
|
|
+ if ip_data and ip_or_user(ip_data[0][0]) == 0 and ip != ip_data[0][0]:
|
|
|
+ add_alarm(ip_data[0][0], ip + ' | <a href="/thread/' + topic_num + '#' + num + '">' + name + ' | ' + sub + ' | #' + num + '</a>')
|
|
|
|
|
|
- if ip_data and ip_or_user(ip_data[0][0]) == 0:
|
|
|
- add_alarm(ip_data[0][0], ip + ' | <a href="/thread/' + topic_num + '#' + num + '">' + name + ' | ' + sub + ' | #' + num + '</a>')
|
|
|
+ data = re.sub(call_user_regex, rd_data[0] + '<topic_call>@' + rd_data[1] + '</topic_call>' + rd_data[2], data, 1)
|
|
|
|
|
|
- data = re.sub(r"( |\n|^)(#(?:[0-9]+))( |\n|$)", '\g<1><topic_a>\g<2></topic_a>\g<3>', data)
|
|
|
- data = re.sub(r"( |\n|^)(@(?:[^ ]+))( |\n|$)", '\g<1><topic_call>\g<2></topic_call>\g<3>', data)
|
|
|
+ call_user_count -= 1
|
|
|
|
|
|
do_add_thread(
|
|
|
topic_num,
|
|
|
@@ -143,17 +168,18 @@ def topic(topic_num = 0):
|
|
|
<hr class="main_hr">
|
|
|
<form style="''' + display + '''" method="post">
|
|
|
''' + data_input_topic_name + '''
|
|
|
- <textarea id="textarea_edit_view" class="opennamu_comment_textarea" placeholder="''' + topic_text + '''" name="content"></textarea>
|
|
|
+ <textarea id="opennamu_js_edit_textarea" class="opennamu_comment_textarea" placeholder="''' + topic_text + '''" name="content"></textarea>
|
|
|
<hr class="main_hr">
|
|
|
''' + captcha_get() + (ip_warning() if display == '' else '') + '''
|
|
|
<input style="display: none;" name="topic" value="''' + name + '''">
|
|
|
<input style="display: none;" name="title" value="''' + sub + '''">
|
|
|
<button id="opennamu_js_save" type="submit">''' + load_lang('send') + '''</button>
|
|
|
- <button id="opennamu_js_preview" type="button" onclick="load_preview(\'\')">''' + load_lang('preview') + '''</button>
|
|
|
+ <button id="opennamu_js_preview" type="button">''' + load_lang('preview') + '''</button>
|
|
|
</form>
|
|
|
<hr class="main_hr">
|
|
|
- <div id="see_preview"></div>
|
|
|
+ <div id="opennamu_js_preview_area"></div>
|
|
|
<!-- JS : opennamu_do_thread_make -->
|
|
|
+ <!-- JS : edit.js -->
|
|
|
''',
|
|
|
menu = [['topic/' + url_pas(name), load_lang('list')]]
|
|
|
))
|