| 730 |
long i; |
long i; |
| 731 |
long ret = 0; |
long ret = 0; |
| 732 |
int topic_locked = 0; |
int topic_locked = 0; |
| 733 |
|
char msg[BBS_msg_max_len]; |
| 734 |
|
char msg_f[BBS_msg_max_len * 2 + 1]; |
| 735 |
|
int len_msg; |
| 736 |
|
|
| 737 |
if (p_section == NULL || p_article == NULL) |
if (p_section == NULL || p_article == NULL) |
| 738 |
{ |
{ |
| 1171 |
goto cleanup; |
goto cleanup; |
| 1172 |
} |
} |
| 1173 |
|
|
| 1174 |
|
// Notify the authors of the topic / article which is replyed. |
| 1175 |
|
snprintf(sql, sizeof(sql), |
| 1176 |
|
"SELECT DISTINCT UID FROM bbs WHERE (AID = %d OR AID = %d) " |
| 1177 |
|
"AND visible AND reply_note AND UID <> %d", |
| 1178 |
|
p_article->tid, p_article->aid, BBS_priv.uid); |
| 1179 |
|
|
| 1180 |
|
if (mysql_query(db, sql) != 0) |
| 1181 |
|
{ |
| 1182 |
|
log_error("Read reply info error: %s\n", mysql_error(db)); |
| 1183 |
|
ret = -1; |
| 1184 |
|
goto cleanup; |
| 1185 |
|
} |
| 1186 |
|
if ((rs = mysql_store_result(db)) == NULL) |
| 1187 |
|
{ |
| 1188 |
|
log_error("Get reply info failed\n"); |
| 1189 |
|
ret = -1; |
| 1190 |
|
goto cleanup; |
| 1191 |
|
} |
| 1192 |
|
|
| 1193 |
|
while ((row = mysql_fetch_row(rs))) |
| 1194 |
|
{ |
| 1195 |
|
// Send notification message |
| 1196 |
|
len_msg = snprintf(msg, BBS_msg_max_len, |
| 1197 |
|
"[hide]SYS_Reply_Article[/hide]有人回复了您所发表/回复的文章,快来" |
| 1198 |
|
"[article %d]看看[/article]《%s》吧!\n", |
| 1199 |
|
p_article_new->aid, title_f); |
| 1200 |
|
|
| 1201 |
|
mysql_real_escape_string(db, msg_f, msg, (unsigned long)len_msg); |
| 1202 |
|
|
| 1203 |
|
snprintf(sql, sizeof(sql), |
| 1204 |
|
"INSERT INTO bbs_msg(fromUID, toUID, content, send_dt, send_ip) " |
| 1205 |
|
"VALUES(%d, %d, '%s', NOW(), '%s')", |
| 1206 |
|
BBS_sys_id, atoi(row[0]), msg_f, hostaddr_client); |
| 1207 |
|
|
| 1208 |
|
if (mysql_query(db, sql) != 0) |
| 1209 |
|
{ |
| 1210 |
|
log_error("Insert msg error: %s\n", mysql_error(db)); |
| 1211 |
|
ret = -1; |
| 1212 |
|
goto cleanup; |
| 1213 |
|
} |
| 1214 |
|
} |
| 1215 |
|
mysql_free_result(rs); |
| 1216 |
|
rs = NULL; |
| 1217 |
|
|
| 1218 |
// Add exp |
// Add exp |
| 1219 |
if (checkpriv(&BBS_priv, p_section->sid, S_GETEXP)) // Except in test section |
if (checkpriv(&BBS_priv, p_section->sid, S_GETEXP)) // Except in test section |
| 1220 |
{ |
{ |