diff options
author | victor <victor@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2003-05-18 21:42:55 +0800 |
---|---|---|
committer | victor <victor@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2003-05-18 21:42:55 +0800 |
commit | ddb92d02a7e7a542047595519b6ad9e600751d69 (patch) | |
tree | a232b7b97950ef29584a7041dfe621048cc5e262 /mbbsd | |
parent | 41a12b6307802cd368d52072a9c2d2c010eda060 (diff) | |
download | pttbbs-ddb92d02a7e7a542047595519b6ad9e600751d69.tar pttbbs-ddb92d02a7e7a542047595519b6ad9e600751d69.tar.gz pttbbs-ddb92d02a7e7a542047595519b6ad9e600751d69.tar.bz2 pttbbs-ddb92d02a7e7a542047595519b6ad9e600751d69.tar.lz pttbbs-ddb92d02a7e7a542047595519b6ad9e600751d69.tar.xz pttbbs-ddb92d02a7e7a542047595519b6ad9e600751d69.tar.zst pttbbs-ddb92d02a7e7a542047595519b6ad9e600751d69.zip |
1. never mark a non-exist post
2. avoid incorrect sequence after rebuilder
if there is any edited post
git-svn-id: http://opensvn.csie.org/pttbbs/pttbbs/trunk/pttbbs@865 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd')
-rw-r--r-- | mbbsd/bbs.c | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/mbbsd/bbs.c b/mbbsd/bbs.c index bd0e82a4..01324b22 100644 --- a/mbbsd/bbs.c +++ b/mbbsd/bbs.c @@ -1,4 +1,4 @@ -/* $Id: bbs.c,v 1.93 2003/05/14 08:31:29 in2 Exp $ */ +/* $Id: bbs.c,v 1.94 2003/05/18 13:42:55 victor Exp $ */ #include "bbs.h" static int recommend(int ent, fileheader_t * fhdr, char *direct); @@ -714,11 +714,12 @@ reply_post(int ent, fileheader_t * fhdr, char *direct) static int edit_post(int ent, fileheader_t * fhdr, char *direct) { + int num; char fpath[80], fpath0[80]; char genbuf[200]; fileheader_t postfile; - boardheader_t *bp; - bp = getbcache(currbid); + boardheader_t *bp = getbcache(currbid); + if (strcmp(bp->brdname, "Security") == 0) return DONOTHING; @@ -742,15 +743,25 @@ edit_post(int ent, fileheader_t * fhdr, char *direct) lock_substitute_record(direct, fhdr, sizeof(*fhdr), ent, LOCK_EX); setbpath(fpath, currboard); stampfile(fpath, &postfile); - unlink(fpath); + strlcpy(genbuf, fhdr->filename, strlen(genbuf)); setbfile(fpath0, currboard, fhdr->filename); + for(num = 2; genbuf[num] != NULL; num++){ + if(genbuf[num] == '.'){ + genbuf[num] = 0; + break; + } + } + + sprintf(postfile.filename, "%s.A.%3.3X", genbuf, rand() & 0xFFF); + setdirpath(fpath, fpath, postfile.filename); + unlink(fpath); + Rename(fpath0, fpath); /* rocker.011018: fix 串接模式改文章後文章就不見的bug */ if ((currmode & MODE_SELECT) && (fhdr->money & FHR_REFERENCE)) { fileheader_t hdr; - int num; num = fhdr->money & ~FHR_REFERENCE; setbdir(fpath0, currboard); @@ -1293,10 +1304,17 @@ recommend(int ent, fileheader_t * fhdr, char *direct) static int mark_post(int ent, fileheader_t * fhdr, char *direct) { + char buf[STRLEN], fpath[STRLEN]; if (!(currmode & MODE_BOARD)) return DONOTHING; + setbpath(fpath, currboard); + sprintf(buf, "%s/%s", fpath, fhdr->filename); + + if(access(buf, F_OK) < 0) + return DONOTHING; + fhdr->filemode ^= FILE_MARKED; substitute_record(direct, fhdr, sizeof(*fhdr), ent); substitute_check(fhdr); |