summaryrefslogtreecommitdiffstats
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
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
-rw-r--r--include/common.h6
-rw-r--r--include/modes.h1
-rw-r--r--mbbsd/bbs.c60
-rw-r--r--mbbsd/more.c22
-rw-r--r--mbbsd/pmore.c48
5 files changed, 73 insertions, 64 deletions
diff --git a/include/common.h b/include/common.h
index 982a1dd6..b3228ac5 100644
--- a/include/common.h
+++ b/include/common.h
@@ -64,8 +64,8 @@
#define MSG_SURE_NY "請您確定(Y/N)?[N] "
#define MSG_SURE_YN "請您確定(Y/N)?[Y] "
-#define MSG_BID "請輸入看板名稱:"
-#define MSG_UID "請輸入使用者代號:"
+#define MSG_BID "請輸入看板名稱: "
+#define MSG_UID "請輸入使用者代號: "
#define MSG_PASSWD "請輸入您的密碼: "
#define MSG_BIG_BOY "我是大帥哥! ^o^Y"
@@ -97,7 +97,7 @@
/* LONG MESSAGES */
#define MSG_SELECT_BOARD ANSI_COLOR(7) "【 選擇看板 】" ANSI_RESET "\n" \
- "請輸入看板名稱(按空白鍵自動搜尋):"
+ "請輸入看板名稱(按空白鍵自動搜尋): "
#define MSG_POSTER_LEN (78)
#define MSG_POSTER ANSI_COLOR(34;46) " 文章選讀 "\
diff --git a/include/modes.h b/include/modes.h
index 18eb9487..6984468c 100644
--- a/include/modes.h
+++ b/include/modes.h
@@ -21,6 +21,7 @@
#define RET_DOREPLY (999)
#define RET_DORECOMMEND (998)
#define RET_DOQUERYINFO (997)
+#define RET_DOSYSOPEDIT (996)
/* user 操作狀態與模式 */
#define IDLE 0
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':