/[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.14 by sysadm, Sun Jun 15 02:04:18 2025 UTC Revision 1.16 by sysadm, Sun Jun 15 03:16:44 2025 UTC
# Line 81  int article_post(const SECTION_LIST *p_s Line 81  int article_post(const SECTION_LIST *p_s
81          if (p_editor_data == NULL)          if (p_editor_data == NULL)
82          {          {
83                  log_error("editor_data_load() error\n");                  log_error("editor_data_load() error\n");
84                  return -2;                  ret = -1;
85                    goto cleanup;
86          }          }
87    
88          // Set title and sign          // Set title and sign
# Line 212  int article_post(const SECTION_LIST *p_s Line 213  int article_post(const SECTION_LIST *p_s
213          if (len_content < 0)          if (len_content < 0)
214          {          {
215                  log_error("editor_data_save() error\n");                  log_error("editor_data_save() error\n");
216                  ret = -2;                  ret = -1;
217                  goto cleanup;                  goto cleanup;
218          }          }
219    
# Line 429  int article_modify(const SECTION_LIST *p Line 430  int article_modify(const SECTION_LIST *p
430                  return 0;                  return 0;
431          }          }
432    
         if (!checkpriv(&BBS_priv, p_section->sid, S_POST))  
         {  
                 clearscr();  
                 moveto(1, 1);  
                 prints("您没有权限在本版块发表文章\n");  
                 press_any_key();  
   
                 return 0;  
         }  
   
433          db = db_open();          db = db_open();
434          if (db == NULL)          if (db == NULL)
435          {          {
436                  log_error("db_open() error: %s\n", mysql_error(db));                  log_error("db_open() error: %s\n", mysql_error(db));
437                  return -1;                  ret = -1;
438                    goto cleanup;
439          }          }
440    
441          snprintf(sql, sizeof(sql),          snprintf(sql, sizeof(sql),
# Line 455  int article_modify(const SECTION_LIST *p Line 447  int article_modify(const SECTION_LIST *p
447          if (mysql_query(db, sql) != 0)          if (mysql_query(db, sql) != 0)
448          {          {
449                  log_error("Query article content error: %s\n", mysql_error(db));                  log_error("Query article content error: %s\n", mysql_error(db));
450                  ret = -2;                  ret = -1;
451                  goto cleanup;                  goto cleanup;
452          }          }
453          if ((rs = mysql_use_result(db)) == NULL)          if ((rs = mysql_use_result(db)) == NULL)
454          {          {
455                  log_error("Get article content data failed\n");                  log_error("Get article content data failed\n");
456                  ret = -2;                  ret = -1;
457                  goto cleanup;                  goto cleanup;
458          }          }
459    
# Line 485  int article_modify(const SECTION_LIST *p Line 477  int article_modify(const SECTION_LIST *p
477                  if (p_editor_data == NULL)                  if (p_editor_data == NULL)
478                  {                  {
479                          log_error("editor_data_load(aid=%d, cid=%d) error\n", p_article->aid, atoi(row[0]));                          log_error("editor_data_load(aid=%d, cid=%d) error\n", p_article->aid, atoi(row[0]));
480                          ret = -3;                          ret = -1;
481                          goto cleanup;                          goto cleanup;
482                  }                  }
483    
# Line 544  int article_modify(const SECTION_LIST *p Line 536  int article_modify(const SECTION_LIST *p
536          if (len_content < 0)          if (len_content < 0)
537          {          {
538                  log_error("editor_data_save() error\n");                  log_error("editor_data_save() error\n");
539                  ret = -2;                  ret = -1;
540                  goto cleanup;                  goto cleanup;
541          }          }
542    
# Line 623  int article_modify(const SECTION_LIST *p Line 615  int article_modify(const SECTION_LIST *p
615    
616          // Update article          // Update article
617          snprintf(sql, sizeof(sql),          snprintf(sql, sizeof(sql),
618                           "UPDATE bbs SET CID = %d, length = %ld WHERE AID = %d",                           "UPDATE bbs SET CID = %d, length = %ld, excerption = 0 WHERE AID = %d", // Set excerption = 0 explictly in case of rare condition
619                           p_article_new->cid, len_content, p_article->aid);                           p_article_new->cid, len_content, p_article->aid);
620    
621          if (mysql_query(db, sql) != 0)          if (mysql_query(db, sql) != 0)
# Line 731  int article_reply(const SECTION_LIST *p_ Line 723  int article_reply(const SECTION_LIST *p_
723          if (db == NULL)          if (db == NULL)
724          {          {
725                  log_error("db_open() error: %s\n", mysql_error(db));                  log_error("db_open() error: %s\n", mysql_error(db));
726                  return -1;                  ret = -1;
727                    goto cleanup;
728          }          }
729    
730          snprintf(sql, sizeof(sql),          snprintf(sql, sizeof(sql),
# Line 741  int article_reply(const SECTION_LIST *p_ Line 734  int article_reply(const SECTION_LIST *p_
734          if (mysql_query(db, sql) != 0)          if (mysql_query(db, sql) != 0)
735          {          {
736                  log_error("Query article status error: %s\n", mysql_error(db));                  log_error("Query article status error: %s\n", mysql_error(db));
737                  return -2;                  ret = -1;
738                    goto cleanup;
739          }          }
740          if ((rs = mysql_store_result(db)) == NULL)          if ((rs = mysql_store_result(db)) == NULL)
741          {          {
742                  log_error("Get article status data failed\n");                  log_error("Get article status data failed\n");
743                  return -2;                  ret = -1;
744                    goto cleanup;
745          }          }
746    
747          if ((row = mysql_fetch_row(rs)))          if ((row = mysql_fetch_row(rs)))
# Line 778  int article_reply(const SECTION_LIST *p_ Line 773  int article_reply(const SECTION_LIST *p_
773          if (mysql_query(db, sql) != 0)          if (mysql_query(db, sql) != 0)
774          {          {
775                  log_error("Query article content error: %s\n", mysql_error(db));                  log_error("Query article content error: %s\n", mysql_error(db));
776                  return -2;                  ret = -1;
777                    goto cleanup;
778          }          }
779          if ((rs = mysql_use_result(db)) == NULL)          if ((rs = mysql_use_result(db)) == NULL)
780          {          {
781                  log_error("Get article content data failed\n");                  log_error("Get article content data failed\n");
782                  return -2;                  ret = -1;
783                    goto cleanup;
784          }          }
785    
786          if ((row = mysql_fetch_row(rs)))          if ((row = mysql_fetch_row(rs)))
# Line 837  int article_reply(const SECTION_LIST *p_ Line 834  int article_reply(const SECTION_LIST *p_
834                  if (p_editor_data == NULL)                  if (p_editor_data == NULL)
835                  {                  {
836                          log_error("editor_data_load(aid=%d, cid=%d) error\n", p_article->aid, atoi(row[0]));                          log_error("editor_data_load(aid=%d, cid=%d) error\n", p_article->aid, atoi(row[0]));
837                          ret = -3;                          ret = -1;
838                          goto cleanup;                          goto cleanup;
839                  }                  }
840    
# Line 972  int article_reply(const SECTION_LIST *p_ Line 969  int article_reply(const SECTION_LIST *p_
969          if (len_content < 0)          if (len_content < 0)
970          {          {
971                  log_error("editor_data_save() error\n");                  log_error("editor_data_save() error\n");
972                  ret = -2;                  ret = -1;
973                  goto cleanup;                  goto cleanup;
974          }          }
975    


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

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