summaryrefslogtreecommitdiffstats
path: root/mbbsd
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2008-01-03 20:54:30 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2008-01-03 20:54:30 +0800
commit74ceac39794d1f3744a4c14e0e48d787d538b5d0 (patch)
tree8f59926ff410f1efd6476df852e3f2492014cced /mbbsd
parentc910fdb835478291442032bf6523d41949aa68d9 (diff)
downloadpttbbs-74ceac39794d1f3744a4c14e0e48d787d538b5d0.tar
pttbbs-74ceac39794d1f3744a4c14e0e48d787d538b5d0.tar.gz
pttbbs-74ceac39794d1f3744a4c14e0e48d787d538b5d0.tar.bz2
pttbbs-74ceac39794d1f3744a4c14e0e48d787d538b5d0.tar.lz
pttbbs-74ceac39794d1f3744a4c14e0e48d787d538b5d0.tar.xz
pttbbs-74ceac39794d1f3744a4c14e0e48d787d538b5d0.tar.zst
pttbbs-74ceac39794d1f3744a4c14e0e48d787d538b5d0.zip
- re-enable sysop-edit in article list mode
- move sysop-edit log to more instead of pmore body git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3778 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd')
-rw-r--r--mbbsd/bbs.c60
-rw-r--r--mbbsd/more.c22
-rw-r--r--mbbsd/pmore.c48
3 files changed, 69 insertions, 61 deletions
diff --git a/mbbsd/bbs.c b/mbbsd/bbs.c
index 66fc4316..f8b500dc 100644
--- a/mbbsd/bbs.c
+++ b/mbbsd/bbs.c
@@ -1347,31 +1347,19 @@ edit_post(int ent, fileheader_t * fhdr, const char *direct)
edflags |= EXP_EDITPOST_TEXTONLY;
#endif
- assert(0<=currbid-1 && currbid-1<MAX_BOARD);
- if (strcmp(bp->brdname, GLOBAL_SECURITY) == 0)
- return DONOTHING;
-
-# ifdef GLOBAL_BBSMOVIE
- if (strcmp(bp->brdname, GLOBAL_BBSMOVIE) == 0)
- {
- edflags |= EDITFLAG_UPLOAD;
- edflags |= EDITFLAG_ALLOWLARGE;
- }
-# endif // GLOBAL_BBSMOVIE
+ assert(0<=currbid-1 && currbid-1<MAX_BOARD && bp);
- // XXX 不知何時起, edit_post 已經不會有 + 號了...
- // 全部都是 Sysop Edit 的原地形式。
- // 哪天有空找個人寫個 mode 是改名 edit 吧
+ // special modes (plus MODE_DIGEST?)
+ if( currmode & MODE_SELECT )
+ return DONOTHING;
- if ((bp->brdattr & BRD_VOTEBOARD) ||
- (fhdr->filemode & FILE_VOTE) ||
- !CheckPostPerm() ||
- strcmp(fhdr->owner, cuser.userid) != EQUSTR ||
- strcmp(cuser.userid, STR_GUEST) == EQUSTR)
+ // board check
+ if (strcmp(bp->brdname, GLOBAL_SECURITY) == EQUSTR ||
+ (bp->brdattr & BRD_VOTEBOARD))
return DONOTHING;
- // special modes (plus MODE_DIGEST?)
- if( currmode & MODE_SELECT )
+ // file check
+ if (fhdr->filemode & FILE_VOTE)
return DONOTHING;
#ifdef SAFE_ARTICLE_DELETE
@@ -1379,8 +1367,38 @@ edit_post(int ent, fileheader_t * fhdr, const char *direct)
return DONOTHING;
#endif
+ // user check
+ if (!HasUserPerm(PERM_BASIC) || // includeing guests
+ !CheckPostPerm() )
+ return DONOTHING;
+
+ if (strcmp(fhdr->owner, cuser.userid) != EQUSTR)
+ {
+ time4_t t = time4(NULL);
+ if (!HasUserPerm(PERM_SYSOP))
+ return DONOTHING;
+
+ // admin edit!
+ log_filef("log/security", LOG_CREAT,
+ "%d %24.24s %d %s admin edit (board) file=%s\n",
+ t, ctime4(&t), getpid(), cuser.userid, fpath);
+ }
+
+# ifdef GLOBAL_BBSMOVIE
+ if (strcmp(bp->brdname, GLOBAL_BBSMOVIE) == 0)
+ {
+ edflags |= EDITFLAG_UPLOAD;
+ edflags |= EDITFLAG_ALLOWLARGE;
+ }
+# endif // GLOBAL_BBSMOVIE
+
setutmpmode(REEDIT);
+
+ // XXX 不知何時起, edit_post 已經不會有 + 號了...
+ // 全部都是 Sysop Edit 的原地形式。
+ // 哪天有空找個人寫個 mode 是改名 edit 吧
+ //
// TODO 由於現在檔案都是直接蓋回原檔,
// 在原看板目錄開已沒有很大意義。 (效率稍高一點)
// 可以考慮改開在 user home dir
diff --git a/mbbsd/more.c b/mbbsd/more.c
index 0a94d506..40333264 100644
--- a/mbbsd/more.c
+++ b/mbbsd/more.c
@@ -4,6 +4,26 @@
/* use new pager: piaip's more. */
int more(char *fpath, int promptend)
{
- return pmore(fpath, promptend);
+ int r = pmore(fpath, promptend);
+
+ if (r == RET_DOSYSOPEDIT)
+ {
+ if (HasUserPerm(PERM_SYSOP) &&
+#ifdef GLOBAL_SECURITY
+ strcmp(currboard, GLOBAL_SECURITY) != 0 &&
+#endif // GLOBAL_SECURITY
+ strcmp(fpath, "etc/ve.hlp") != 0 &&
+ 1)
+ {
+ time4_t t = time4(NULL);
+ log_filef("log/security", LOG_CREAT,
+ "%d %24.24s %d %s admin edit file=%s\n",
+ t, ctime4(&t), getpid(), cuser.userid, fpath);
+ vedit(fpath, NA, NULL);
+ }
+ r = FULLUPDATE;
+ }
+
+ return r;
}
diff --git a/mbbsd/pmore.c b/mbbsd/pmore.c
index afb07ecd..7cab8cd0 100644
--- a/mbbsd/pmore.c
+++ b/mbbsd/pmore.c
@@ -2073,7 +2073,7 @@ pmore(char *fpath, int promptend)
/* igetch() will do refresh(); */
ch = igetch();
switch (ch) {
- /* ------------------ EXITING KEYS ------------------ */
+ /* -------------- NEW EXITING KEYS ------------------ */
#ifdef RET_DOREPLY
case 'r': case 'R':
case 'Y': case 'y':
@@ -2092,6 +2092,13 @@ pmore(char *fpath, int promptend)
flExit = 1, retval = RET_DOQUERYINFO;
break;
#endif
+#ifdef RET_DOSYSOPEDIT
+ case 'E':
+ flExit = 1, retval = RET_DOSYSOPEDIT;
+ break;
+#endif
+
+ /* ------------------ EXITING KEYS ------------------ */
case 'A':
flExit = 1, retval = AUTHOR_PREV;
break;
@@ -2105,17 +2112,8 @@ pmore(char *fpath, int promptend)
flExit = 1, retval = READ_PREV;
break;
case KEY_LEFT:
- /* because we have other keys to do so,
- * disable now.
- */
- /*
- if(mf.xpos > 0)
- {
- mf.xpos --;
- break;
- }
- */
flExit = 1, retval = FULLUPDATE;
+ break;
case 'q':
flExit = 1, retval = FULLUPDATE;
break;
@@ -2340,34 +2338,6 @@ pmore(char *fpath, int promptend)
MFDISP_DIRTY();
break;
- case 'E':
- // admin edit any files other than ve help file
- // and posts in Security board
- if ( HasUserPerm(PERM_SYSOP) &&
-#ifdef GLOBAL_SECURITY
- strcmp(currboard, GLOBAL_SECURITY) != 0 &&
-#endif // GLOBAL_SECURITY
- strcmp(fpath, "etc/ve.hlp") != 0 &&
- 1)
- {
-#ifdef PMORE_LOG_SYSOP_EDIT
- time4_t t = time4(NULL);
-
- log_filef("log/security", LOG_CREAT,
- "%d %24.24s %d %s admin edit file=%s\n",
- t, ctime4(&t), getpid(), cuser.userid, fpath);
-#endif // PMORE_LOG_SYSOP_EDIT
-
- mf_detach();
- vedit(fpath, NA, NULL);
-
- REENTRANT_RESTORE();
- return 0;
- }
- break;
-
-// uncomment me someday when everyone's faimiliar with new system.
-#define PMORE_NOTIFY_NEWPREF
#ifdef PMORE_NOTIFY_NEWPREF
//let's be backward compatible!
case 'l':