summaryrefslogtreecommitdiffstats
path: root/mbbsd/more.c
blob: d506754a8d5fd2dc8fa34aa546a1dcfd661de4b0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
/* $Id$ */
#include "bbs.h"

/* use new pager: piaip's more. */
int more(char *fpath, int promptend)
{
    int r = pmore(fpath, promptend);

    switch(r)
    {

    case RET_DOSYSOPEDIT:
        r = FULLUPDATE;

        if (!HasUserPerm(PERM_SYSOP) ||
            strcmp(fpath, "etc/ve.hlp") == 0)
        break;

#ifdef GLOBAL_SECURITY
        if (strcmp(currboard, GLOBAL_SECURITY) == 0)
        break;
#endif // GLOBAL_SECURITY

        log_filef("log/security", LOG_CREAT,
            "%u %24.24s %d %s admin edit file=%s\n", 
            (int)now, ctime4(&now), getpid(), cuser.userid, fpath);

        // no need to allow anything...
        // at least, no need to change title.
        vedit2(fpath, NA, NULL, 0);
        break;

    case RET_SELECTBRD:
        r = FULLUPDATE;
        if (HasUserPerm(PERM_BASIC))
        {
        if (currstat == READING)
            return Select();
        }
        break;

    case RET_COPY2TMP:
        r = FULLUPDATE;
        if (HasUserPerm(PERM_BASIC))
        {
        char buf[PATHLEN];
        getdata(b_lines - 1, 0, "把這篇文章收入到暫存檔?[y/N] ",
            buf, 4, LCECHO);
        if (buf[0] != 'y')
            break;
        setuserfile(buf, ask_tmpbuf(b_lines - 1));
        Copy(fpath, buf);
        }
        break;

    case RET_DOCHESSREPLAY:
        r = FULLUPDATE;
        if (HasUserPerm(PERM_BASIC))
        {
        ChessReplayGame(fpath);
        }
        break;

#if defined(USE_BBSLUA)
    case RET_DOBBSLUA:
        r = FULLUPDATE;
        if (HasUserPerm(PERM_BASIC))
        {
        bbslua(fpath);
        }
        break;
#endif
    }

    return r;
}