/[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.8 by sysadm, Sat Jun 14 09:20:13 2025 UTC Revision 1.12 by sysadm, Sat Jun 14 12:30:15 2025 UTC
# Line 63  int article_post(const SECTION_LIST *p_s Line 63  int article_post(const SECTION_LIST *p_s
63                  log_error("NULL pointer error\n");                  log_error("NULL pointer error\n");
64          }          }
65    
66            if (!checkpriv(&BBS_priv, p_section->sid, S_POST))
67            {
68                    clearscr();
69                    moveto(1, 1);
70                    prints("您没有权限在本版块发表文章\n");
71                    press_any_key();
72    
73                    return 0;
74            }
75    
76          p_article_new->title[0] = '\0';          p_article_new->title[0] = '\0';
77          title_input[0] = '\0';          title_input[0] = '\0';
78          p_article_new->transship = 0;          p_article_new->transship = 0;
# Line 410  int article_modify(const SECTION_LIST *p Line 420  int article_modify(const SECTION_LIST *p
420                  return 0;                  return 0;
421          }          }
422    
423            if (!checkpriv(&BBS_priv, p_section->sid, S_POST))
424            {
425                    clearscr();
426                    moveto(1, 1);
427                    prints("您没有权限在本版块发表文章\n");
428                    press_any_key();
429    
430                    return 0;
431            }
432    
433          db = db_open();          db = db_open();
434          if (db == NULL)          if (db == NULL)
435          {          {
# Line 655  int article_reply(const SECTION_LIST *p_ Line 675  int article_reply(const SECTION_LIST *p_
675                  log_error("NULL pointer error\n");                  log_error("NULL pointer error\n");
676          }          }
677    
678            if (!checkpriv(&BBS_priv, p_section->sid, S_POST))
679            {
680                    clearscr();
681                    moveto(1, 1);
682                    prints("您没有权限在本版块发表文章\n");
683                    press_any_key();
684    
685                    return 0;
686            }
687    
688          if (p_article->lock) // Reply is not allowed          if (p_article->lock) // Reply is not allowed
689          {          {
690                  clearscr();                  clearscr();
# Line 731  int article_reply(const SECTION_LIST *p_ Line 761  int article_reply(const SECTION_LIST *p_
761                          memcpy(content + len, content_f + line_offsets[i], (size_t)(line_offsets[i + 1] - line_offsets[i]));                          memcpy(content + len, content_f + line_offsets[i], (size_t)(line_offsets[i + 1] - line_offsets[i]));
762                          len += (line_offsets[i + 1] - line_offsets[i]);                          len += (line_offsets[i + 1] - line_offsets[i]);
763                  }                  }
764                    if (content[len - 1] != '\n') // Appennd \n if not exist
765                    {
766                            content[len] = '\n';
767                            len++;
768                    }
769                  content[len] = '\0';                  content[len] = '\0';
770    
771                  free(content_f);                  free(content_f);
# Line 970  int article_reply(const SECTION_LIST *p_ Line 1005  int article_reply(const SECTION_LIST *p_
1005          snprintf(sql, sizeof(sql),          snprintf(sql, sizeof(sql),
1006                           "INSERT INTO bbs(SID, TID, UID, username, nickname, title, CID, transship, "                           "INSERT INTO bbs(SID, TID, UID, username, nickname, title, CID, transship, "
1007                           "sub_dt, sub_ip, reply_note, exp, last_reply_dt, icon, length) "                           "sub_dt, sub_ip, reply_note, exp, last_reply_dt, icon, length) "
1008                           "VALUES(%d, 0, %d, '%s', '%s', '%s', %d, 0, NOW(), '%s', 1, %d, NOW(), 1, %ld)",                           "VALUES(%d, %d, %d, '%s', '%s', '%s', %d, 0, NOW(), '%s', 1, %d, NOW(), 1, %ld)",
1009                           p_section->sid, BBS_priv.uid, BBS_username, nickname_f, title_f,                           p_section->sid, (p_article->tid == 0 ? p_article->aid : p_article->tid),
1010                             BBS_priv.uid, BBS_username, nickname_f, title_f,
1011                           p_article_new->cid, hostaddr_client, BBS_user_exp, len_content);                           p_article_new->cid, hostaddr_client, BBS_user_exp, len_content);
1012    
1013          if (mysql_query(db, sql) != 0)          if (mysql_query(db, sql) != 0)
# Line 987  int article_reply(const SECTION_LIST *p_ Line 1023  int article_reply(const SECTION_LIST *p_
1023          snprintf(sql, sizeof(sql),          snprintf(sql, sizeof(sql),
1024                           "UPDATE bbs SET reply_count = reply_count + 1, "                           "UPDATE bbs SET reply_count = reply_count + 1, "
1025                           "last_reply_dt = NOW(), last_reply_UID=%d, last_reply_username = '%s', "                           "last_reply_dt = NOW(), last_reply_UID=%d, last_reply_username = '%s', "
1026                           "last_reply_nickname = '%s' WHERE Aid = %d",                           "last_reply_nickname = '%s' WHERE AID = %d",
1027                           BBS_priv.uid, BBS_username, nickname_f, p_article->aid);                           BBS_priv.uid, BBS_username, nickname_f,
1028                             (p_article->tid == 0 ? p_article->aid : p_article->tid));
1029    
1030            if (mysql_query(db, sql) != 0)
1031            {
1032                    log_error("Update topic article error: %s\n", mysql_error(db));
1033                    ret = -1;
1034                    goto cleanup;
1035            }
1036    
1037          // Link content to article          // Link content to article
1038          snprintf(sql, sizeof(sql),          snprintf(sql, sizeof(sql),


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

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