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

Diff of /lbbs/src/article_del.c

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

Revision 1.1 by sysadm, Sun Jun 15 04:45:13 2025 UTC Revision 1.11 by sysadm, Tue Nov 11 00:28:05 2025 UTC
# Line 1  Line 1 
1  /***************************************************************************  /* SPDX-License-Identifier: GPL-3.0-or-later */
2                                                  article_del.c  -  description  /*
3                                                           -------------------   * article_del
4          copyright            : (C) 2004-2025 by Leaflet   *   - user interactive feature to delete article
5          email                : leaflet@leafok.com   *
6   ***************************************************************************/   * Copyright (C) 2004-2025  Leaflet <leaflet@leafok.com>
7     */
8  /***************************************************************************  
9   *                                                                         *  #ifdef HAVE_CONFIG_H
10   *   This program is free software; you can redistribute it and/or modify  *  #include "config.h"
11   *   it under the terms of the GNU General Public License as published by  *  #endif
  *   the Free Software Foundation; either version 3 of the License, or     *  
  *   (at your option) any later version.                                   *  
  *                                                                         *  
  ***************************************************************************/  
12    
13  #include "article_del.h"  #include "article_del.h"
14  #include "database.h"  #include "database.h"
 #include "log.h"  
15  #include "io.h"  #include "io.h"
16    #include "log.h"
17  #include "screen.h"  #include "screen.h"
18  #include "user_priv.h"  #include "user_priv.h"
19    #include <ctype.h>
20  #include <stdlib.h>  #include <stdlib.h>
21    
22  int article_del(const SECTION_LIST *p_section, const ARTICLE *p_article)  int article_del(const SECTION_LIST *p_section, const ARTICLE *p_article)
# Line 39  int article_del(const SECTION_LIST *p_se Line 36  int article_del(const SECTION_LIST *p_se
36                  log_error("NULL pointer error\n");                  log_error("NULL pointer error\n");
37          }          }
38    
39            if (p_article->excerption) // Delete is not allowed
40            {
41                    clearscr();
42                    moveto(1, 1);
43                    prints("该文章无法被删除,请联系版主。");
44                    press_any_key();
45    
46                    return 0;
47            }
48    
49          clearscr();          clearscr();
50          moveto(1, 1);          moveto(1, 1);
51          prints("Ҫɾ£(Y), (N) [N]: ");          prints("真的要删除文章?(Y)是, (N)否 [N]: ");
52          iflush();          iflush();
53    
54          for (ch = 0; !SYS_server_exit; ch = igetch_t(MAX_DELAY_TIME))          for (ch = 0; !SYS_server_exit; ch = igetch_t(BBS_max_user_idle_time))
55          {          {
56                  switch (toupper(ch))                  switch (toupper(ch))
57                  {                  {
58                    case KEY_NULL:
59                    case KEY_TIMEOUT:
60                            goto cleanup;
61                  case CR:                  case CR:
                         igetch_reset();  
62                  case KEY_ESC:                  case KEY_ESC:
63                  case 'N':                  case 'N':
64                          goto cleanup;                          return 0;
65                  case 'Y':                  case 'Y':
66                          break;                          break;
67                  default: // Invalid selection                  default: // Invalid selection
# Line 62  int article_del(const SECTION_LIST *p_se Line 71  int article_del(const SECTION_LIST *p_se
71                  break;                  break;
72          }          }
73    
74            if (SYS_server_exit) // Do not save data on shutdown
75            {
76                    goto cleanup;
77            }
78    
79          db = db_open();          db = db_open();
80          if (db == NULL)          if (db == NULL)
81          {          {
# Line 117  int article_del(const SECTION_LIST *p_se Line 131  int article_del(const SECTION_LIST *p_se
131    
132                  clearscr();                  clearscr();
133                  moveto(1, 1);                  moveto(1, 1);
134                  prints("ѱɾԺˢб");                  prints("该文章已被删除,请稍后刷新列表。");
135                  press_any_key();                  press_any_key();
136    
137                  goto cleanup;                  goto cleanup;
# Line 127  int article_del(const SECTION_LIST *p_se Line 141  int article_del(const SECTION_LIST *p_se
141          {          {
142                  clearscr();                  clearscr();
143                  moveto(1, 1);                  moveto(1, 1);
144                  prints("޷ɾϵ");                  prints("该文章无法被删除,请联系版主。");
145                  press_any_key();                  press_any_key();
146    
147                  goto cleanup;                  goto cleanup;
# Line 211  int article_del(const SECTION_LIST *p_se Line 225  int article_del(const SECTION_LIST *p_se
225    
226          clearscr();          clearscr();
227          moveto(1, 1);          moveto(1, 1);
228          prints("ɾɹ%dˢб", BBS_section_list_load_interval);          prints("删除成功,请在%d秒后刷新列表。", BBS_section_list_load_interval);
229          press_any_key();          press_any_key();
230          ret = 1; // Success          ret = 1; // Success
231    


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

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