/[LeafOK_CVS]/lbbs/src/article_post.c
ViewVC logotype

Diff of /lbbs/src/article_post.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.26 by sysadm, Sun Oct 5 05:00:50 2025 UTC Revision 1.28 by sysadm, Fri Oct 10 01:55:06 2025 UTC
# Line 118  int article_post(const SECTION_LIST *p_s Line 118  int article_post(const SECTION_LIST *p_s
118                          case 'T':                          case 'T':
119                                  moveto(24, 1);                                  moveto(24, 1);
120                                  clrtoeol();                                  clrtoeol();
121                                  len = get_data(24, 1, "标题: ", title_input, sizeof(title_input), TITLE_INPUT_MAX_LEN, DOECHO);                                  len = get_data(24, 1, "标题: ", title_input, sizeof(title_input), TITLE_INPUT_MAX_LEN);
122                                  for (p = title_input; *p == ' '; p++)                                  for (p = title_input; *p == ' '; p++)
123                                          ;                                          ;
124                                  for (q = title_input + len; q > p && *(q - 1) == ' '; q--)                                  for (q = title_input + len; q > p && *(q - 1) == ' '; q--)
# Line 730  int article_reply(const SECTION_LIST *p_ Line 730  int article_reply(const SECTION_LIST *p_
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          {          {
# Line 921  int article_reply(const SECTION_LIST *p_ Line 924  int article_reply(const SECTION_LIST *p_
924                          case 'T':                          case 'T':
925                                  moveto(24, 1);                                  moveto(24, 1);
926                                  clrtoeol();                                  clrtoeol();
927                                  len = get_data(24, 1, "标题: ", title_input, sizeof(title_input), TITLE_INPUT_MAX_LEN, DOECHO);                                  len = get_data(24, 1, "标题: ", title_input, sizeof(title_input), TITLE_INPUT_MAX_LEN);
928                                  for (p = title_input; *p == ' '; p++)                                  for (p = title_input; *p == ' '; p++)
929                                          ;                                          ;
930                                  for (q = title_input + len; q > p && *(q - 1) == ' '; q--)                                  for (q = title_input + len; q > p && *(q - 1) == ' '; q--)
# Line 1168  int article_reply(const SECTION_LIST *p_ Line 1171  int article_reply(const SECTION_LIST *p_
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          {          {


Legend:
Removed lines/characters  
Changed lines/characters
  Added lines/characters

webmaster@leafok.com
ViewVC Help
Powered by ViewVC 1.3.0-beta1