summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwens <wens@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2006-09-28 21:32:34 +0800
committerwens <wens@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2006-09-28 21:32:34 +0800
commitdfe040bf4ad27abe77951f778c7b822c346e4556 (patch)
tree5a6b5124dd76c9dc090dc7180ccc8597a057bb52
parent79d83827832f47bce28465646d89d3b76ddbbe99 (diff)
downloadpttbbs-dfe040bf4ad27abe77951f778c7b822c346e4556.tar
pttbbs-dfe040bf4ad27abe77951f778c7b822c346e4556.tar.gz
pttbbs-dfe040bf4ad27abe77951f778c7b822c346e4556.tar.bz2
pttbbs-dfe040bf4ad27abe77951f778c7b822c346e4556.tar.lz
pttbbs-dfe040bf4ad27abe77951f778c7b822c346e4556.tar.xz
pttbbs-dfe040bf4ad27abe77951f778c7b822c346e4556.tar.zst
pttbbs-dfe040bf4ad27abe77951f778c7b822c346e4556.zip
* police logs
* lock article confirmation * change permission of police actions (BMs are not allowed) * remove police info from lock article git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3432 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--include/proto.h1
-rw-r--r--mbbsd/bbs.c31
-rw-r--r--mbbsd/syspost.c14
3 files changed, 34 insertions, 12 deletions
diff --git a/include/proto.h b/include/proto.h
index b128cc85..41c5a416 100644
--- a/include/proto.h
+++ b/include/proto.h
@@ -652,6 +652,7 @@ int post_file(const char *bname, const char *title, const char *filename, const
void post_newboard(const char *bgroup, const char *bname, const char *bms);
void post_violatelaw(const char *crime, const char *police, const char *reason, const char *result);
void post_change_perm(int oldperm, int newperm, const char *sysopid, const char *userid);
+void post_policelog(const char *bname, const char *atitle, const char *action, const int toggle);
/* talk */
#define iswritable(uentp) \
diff --git a/mbbsd/bbs.c b/mbbsd/bbs.c
index 9c51281f..e8d0c887 100644
--- a/mbbsd/bbs.c
+++ b/mbbsd/bbs.c
@@ -2673,24 +2673,31 @@ lock_post(int ent, fileheader_t * fhdr, const char *direct)
{
char fn1[MAXPATHLEN];
struct tm *ptime = localtime4(&now);
- if(!(currmode & MODE_BOARD) &&
- !HasUserPerm(PERM_SYSOP | PERM_POLICE)) return DONOTHING;
- if(fhdr->filename[0]=='M')
- {
- setbfile(fn1, currboard, fhdr->filename);
+ if (!(currmode & MODE_BOARD) && !HasUserPerm(PERM_SYSOP | PERM_POLICE))
+ return DONOTHING;
+
+ if (fhdr->filename[0]=='M') {
+ if (!HasUserPerm(PERM_SYSOP | PERM_POLICE))
+ return DONOTHING;
+
+ if (getans("要將文章鎖定嗎(y/N)?") != 'y')
+ return FULLUPDATE;
+ setbfile(fn1, currboard, r->filename);
fhdr->filename[0] = 'L';
- log_file(fn1, LOG_CREAT | LOG_VF, "\n※ Locked by: %s (%s) %d/%d",
- cuser.userid, fromhost, ptime->tm_mon + 1, ptime->tm_mday);
+ log_file(fn1, LOG_CREAT | LOG_VF, "\n※ Locked on: %d/%d",
+ ptime->tm_mon + 1, ptime->tm_mday);
}
- else if(fhdr->filename[0]=='L')
- {
+ else if (fhdr->filename[0]=='L') {
+ if (getans("要將文章鎖定解除嗎(y/N)?") != 'y')
+ return FULLUPDATE;
fhdr->filename[0] = 'M';
setbfile(fn1, currboard, fhdr->filename);
- log_file(fn1, LOG_CREAT | LOG_VF, "\n※ Unlocked by: %s (%s) %d/%d",
- cuser.userid, fromhost, ptime->tm_mon + 1, ptime->tm_mday);
+ log_file(fn1, LOG_CREAT | LOG_VF, "\n※ Unlocked by: %d/%d",
+ ptime->tm_mon + 1, ptime->tm_mday);
}
substitute_ref_record(direct, fhdr, ent);
+ post_policelog(currboard, fhdr->title, "鎖文", fhdr->filename[0] == 'L' ? 1 : 0);
return FULLUPDATE;
}
@@ -3442,7 +3449,6 @@ change_cooldown(void)
boardheader_t *bp = getbcache(currbid);
if (!(HasUserPerm(PERM_SYSOP | PERM_POLICE) ||
- (currmode & MODE_BOARD) ||
(HasUserPerm(PERM_SYSSUPERSUBOP) && GROUPOP())))
return DONOTHING;
@@ -3459,6 +3465,7 @@ change_cooldown(void)
}
assert(0<=currbid-1 && currbid-1<MAX_BOARD);
substitute_record(fn_board, bp, sizeof(boardheader_t), currbid);
+ post_policelog(bp->brdname, NULL, "冷靜", bp->brdattr & BRD_COOLDOWN);
pressanykey();
return FULLUPDATE;
}
diff --git a/mbbsd/syspost.c b/mbbsd/syspost.c
index 447e00e3..36148543 100644
--- a/mbbsd/syspost.c
+++ b/mbbsd/syspost.c
@@ -128,3 +128,17 @@ post_newboard(const char *bgroup, const char *bname, const char *bms)
post_msg("Record", title, genbuf, "[系統]");
}
+
+void
+post_policelog(const char *bname, const char *atitle, const char *action, const int toggle)
+{
+ char genbuf[256], title[TTLEN+1];
+
+ snprintf(title, sizeof(title), "[%s] %s by %s", action, bname, cuser.userid);
+ snprintf(genbuf, sizeof(genbuf),
+ "%s (%s) %s %s 看板 %s 功能\n%s%s\n",
+ cuser.userid, fromhost, toggle ? "開啟" : "關閉", bname, action,
+ atitle ? "文章標題" : "", atitle ? atitle : "");
+
+ post_msg("PoliceLog", title, genbuf, "[系統]");
+}