diff options
author | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2009-06-06 16:15:39 +0800 |
---|---|---|
committer | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2009-06-06 16:15:39 +0800 |
commit | f860729aeaacf1bacf196ee96362b58ddb6e3af1 (patch) | |
tree | fc24bd3121bf5433b8aae13fa399acf343e9b7bd /mbbsd/announce.c | |
parent | 6cd7ea49f5b5cb1542a4296d22bf5f477019ff2b (diff) | |
download | pttbbs-f860729aeaacf1bacf196ee96362b58ddb6e3af1.tar pttbbs-f860729aeaacf1bacf196ee96362b58ddb6e3af1.tar.gz pttbbs-f860729aeaacf1bacf196ee96362b58ddb6e3af1.tar.bz2 pttbbs-f860729aeaacf1bacf196ee96362b58ddb6e3af1.tar.lz pttbbs-f860729aeaacf1bacf196ee96362b58ddb6e3af1.tar.xz pttbbs-f860729aeaacf1bacf196ee96362b58ddb6e3af1.tar.zst pttbbs-f860729aeaacf1bacf196ee96362b58ddb6e3af1.zip |
- change deleted posts/dirs to backup in FN_JUNK instead of FN_DELETED for mail-man (users with PERM_EMAILLIMIT only), thanks to watch@ptt [PttBug]
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@4496 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd/announce.c')
-rw-r--r-- | mbbsd/announce.c | 33 |
1 files changed, 24 insertions, 9 deletions
diff --git a/mbbsd/announce.c b/mbbsd/announce.c index 97762e13..eb2e4786 100644 --- a/mbbsd/announce.c +++ b/mbbsd/announce.c @@ -787,6 +787,12 @@ a_delete(menu_t * pm) return; unlink(fpath); } else if (dashf(fpath)) { + + // XXX we also check PERM_MAILLIMIT here because RMAIL + // may be not trusted... + const char *save_bn = ( HasUserPerm(PERM_MAILLIMIT) && (currstat & RMAIL) ) ? + BN_JUNK : BN_DELETED; + getdata(b_lines - 1, 1, "您確定要刪除此檔案嗎(Y/N)?[N] ", ans, sizeof(ans), LCECHO); if (ans[0] != 'y') @@ -794,7 +800,8 @@ a_delete(menu_t * pm) if (delete_record(buf, FHSZ, pm->now + 1) == -1) return; - setbpath(buf, BN_DELETED); + + setbpath(buf, save_bn); stampfile(buf, &backup); strlcpy(backup.owner, cuser.userid, sizeof(backup.owner)); strlcpy(backup.title, @@ -802,12 +809,19 @@ a_delete(menu_t * pm) sizeof(backup.title)); snprintf(cmd, sizeof(cmd), - "mv -f %s %s", fpath, buf); + "mv -f %s %s", fpath, buf); system(cmd); - setbdir(buf, BN_DELETED); + setbdir(buf, save_bn); append_record(buf, &backup, sizeof(backup)); - setbtotal(getbnum(BN_DELETED)); + setbtotal(getbnum(save_bn)); + } else if (dashd(fpath)) { + + // XXX we also check PERM_MAILLIMIT here because RMAIL + // may be not trusted... + const char *save_bn = ( HasUserPerm(PERM_MAILLIMIT) && (currstat & RMAIL) ) ? + BN_JUNK : BN_DELETED; + getdata(b_lines - 1, 1, "您確定要刪除整個目錄嗎(Y/N)?[N] ", ans, sizeof(ans), LCECHO); if (ans[0] != 'y') @@ -815,23 +829,24 @@ a_delete(menu_t * pm) if (delete_record(buf, FHSZ, pm->now + 1) == -1) return; - setapath(buf, BN_DELETED); + setapath(buf, save_bn); stampdir(buf, &backup); snprintf(cmd, sizeof(cmd), - "rm -rf %s;/bin/mv -f %s %s", buf, fpath, buf); + "rm -rf %s;/bin/mv -f %s %s", buf, fpath, buf); system(cmd); strlcpy(backup.owner, cuser.userid, sizeof(backup.owner)); - strcpy(backup.title, "◆"); + strcpy(backup.title, "◆"); strlcpy(backup.title + 2, pm->header[pm->now - pm->page].title + 2, sizeof(backup.title) - 3); - /* merge setapath(buf, BN_DELETED); setadir(buf, buf); */ + /* merge setapath(buf, save_bn); setadir(buf, buf); */ snprintf(buf, sizeof(buf), "man/boards/%c/%s/" FN_DIR, - 'd', BN_DELETED); + *save_bn, save_bn); append_record(buf, &backup, sizeof(backup)); + } else { /* Ptt 損毀的項目 */ getdata(b_lines - 1, 1, "您確定要刪除此損毀的項目嗎(Y/N)?[N] ", ans, sizeof(ans), LCECHO); |