diff options
-rw-r--r-- | include/proto.h | 3 | ||||
-rw-r--r-- | mbbsd/bbs.c | 9 | ||||
-rw-r--r-- | mbbsd/record.c | 1 |
3 files changed, 11 insertions, 2 deletions
diff --git a/include/proto.h b/include/proto.h index bbe7d787..06e22315 100644 --- a/include/proto.h +++ b/include/proto.h @@ -423,6 +423,9 @@ int get_records(char *fpath, void *rptr, int size, int id, int number); void stamplink(char *fpath, fileheader_t *fh); int delete_record(char fpath[], int size, int id); int delete_files(char* dirname, int (*filecheck)(), int record); +#ifdef SAFE_ARTICLE_DELETE +int safe_article_delete(int ent, fileheader_t *fhdr, char *direct); +#endif int delete_file(char *dirname, int size, int ent, int (*filecheck)()); int delete_range(char *fpath, int id1, int id2); int apply_record(char *fpath, int (*fptr)(), int size); diff --git a/mbbsd/bbs.c b/mbbsd/bbs.c index 659e6544..49f62ae2 100644 --- a/mbbsd/bbs.c +++ b/mbbsd/bbs.c @@ -1656,16 +1656,21 @@ recommend(int ent, fileheader_t * fhdr, char *direct) return FULLUPDATE; } if (!(currmode & MODE_POST) || bp->brdattr & BRD_VOTEBOARD || fhdr->filemode & FILE_VOTE) { - vmsg("您因權限不足!"); + vmsg("您權限不足, 無法推薦!"); return FULLUPDATE; } +#ifdef SAFE_ARTICLE_DELETE + if( fhdr->filename[0] == '.' ){ + vmsg("本文已刪除"); + return FULLUPDATE; + } +#endif if( fhdr->filemode & FILE_BID){ return do_bid(ent, fhdr, bp, direct, ptime); } setdirpath(path, direct, fhdr->filename); - if (fhdr->recommend == 0 && strcmp(cuser.userid, fhdr->owner) == 0){ vmsg("警告! 本人不能推薦第一次!"); return FULLUPDATE; diff --git a/mbbsd/record.c b/mbbsd/record.c index c28a0c6d..e1388abe 100644 --- a/mbbsd/record.c +++ b/mbbsd/record.c @@ -408,6 +408,7 @@ safe_article_delete(int ent, fileheader_t *fhdr, char *direct) memcpy(&newfhdr, fhdr, sizeof(fileheader_t)); sprintf(newfhdr.title, "(本文已被刪除)"); strcpy(newfhdr.filename, ".deleted"); + strcpy(newfhdr.owner, "-"); substitute_record(direct, &newfhdr, sizeof(newfhdr), ent); return 0; } |