diff options
author | kcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2005-03-19 21:00:13 +0800 |
---|---|---|
committer | kcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2005-03-19 21:00:13 +0800 |
commit | eadc8ca4ec8a2211cdb07386bfb133ab972ed874 (patch) | |
tree | 5e4bce7a7c97d9ddfa60a2e04d991965dfe391d1 /mbbsd | |
parent | bac35869a07ddf3307643c0a60399e2bdb5b98ea (diff) | |
download | pttbbs-eadc8ca4ec8a2211cdb07386bfb133ab972ed874.tar pttbbs-eadc8ca4ec8a2211cdb07386bfb133ab972ed874.tar.gz pttbbs-eadc8ca4ec8a2211cdb07386bfb133ab972ed874.tar.bz2 pttbbs-eadc8ca4ec8a2211cdb07386bfb133ab972ed874.tar.lz pttbbs-eadc8ca4ec8a2211cdb07386bfb133ab972ed874.tar.xz pttbbs-eadc8ca4ec8a2211cdb07386bfb133ab972ed874.tar.zst pttbbs-eadc8ca4ec8a2211cdb07386bfb133ab972ed874.zip |
less hard coded path/string.
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2634 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd')
-rw-r--r-- | mbbsd/admin.c | 6 | ||||
-rw-r--r-- | mbbsd/announce.c | 5 | ||||
-rw-r--r-- | mbbsd/cache.c | 2 | ||||
-rw-r--r-- | mbbsd/cal.c | 5 | ||||
-rw-r--r-- | mbbsd/edit.c | 2 | ||||
-rw-r--r-- | mbbsd/mbbsd.c | 2 | ||||
-rw-r--r-- | mbbsd/register.c | 3 | ||||
-rw-r--r-- | mbbsd/syspost.c | 8 | ||||
-rw-r--r-- | mbbsd/user.c | 13 | ||||
-rw-r--r-- | mbbsd/vote.c | 4 |
10 files changed, 26 insertions, 24 deletions
diff --git a/mbbsd/admin.c b/mbbsd/admin.c index ea175e90..c3d6ebf8 100644 --- a/mbbsd/admin.c +++ b/mbbsd/admin.c @@ -272,7 +272,7 @@ AddingChessCountryFiles(const char* apath) symlink("chess_ensign", symbolicname); strcpy(fh.title, "◇ 棋國國徽 (不能刪除,系統需要)"); - strcpy(fh.owner, "SYSOP"); + strcpy(fh.owner, str_sysop); append_record(adir, &fh, sizeof(fileheader_t)); /* creating member list */ @@ -292,7 +292,7 @@ AddingChessCountryFiles(const char* apath) symlink("chess_list", symbolicname); strcpy(fh.title, "◇ 棋國成員表 (不能刪除,系統需要)"); - strcpy(fh.owner, "SYSOP"); + strcpy(fh.owner, str_sysop); append_record(adir, &fh, sizeof(fileheader_t)); /* creating profession photos' dir */ @@ -304,7 +304,7 @@ AddingChessCountryFiles(const char* apath) symlink("chess_photo", symbolicname); strcpy(fh.title, "◆ 棋國照片檔 (不能刪除,系統需要)"); - strcpy(fh.owner, "SYSOP"); + strcpy(fh.owner, str_sysop); append_record(adir, &fh, sizeof(fileheader_t)); } #endif /* defined(CHESSCOUNTRY) */ diff --git a/mbbsd/announce.c b/mbbsd/announce.c index 927d999e..da88d20e 100644 --- a/mbbsd/announce.c +++ b/mbbsd/announce.c @@ -1196,12 +1196,13 @@ void BlogMain(int num) case 'C': case 'c': { fileheader_t item; char fpath[PATHLEN], adir[PATHLEN], buf[256]; - sprintf(fpath, "man/boards/%c/%s", currboard[0], currboard); + setapath(fpath, currboard); stampdir(fpath, &item); strlcpy(item.title, "◆ Blog", sizeof(item.title)); strlcpy(item.owner, cuser.userid, sizeof(item.owner)); - sprintf(adir, "man/boards/%c/%s/.DIR", currboard[0], currboard); + setapath(adir, currboard); + strcat(adir, "/.DIR"); append_record(adir, &item, FHSZ); snprintf(buf, sizeof(buf), diff --git a/mbbsd/cache.c b/mbbsd/cache.c index 7ec29f32..d1771d49 100644 --- a/mbbsd/cache.c +++ b/mbbsd/cache.c @@ -1005,7 +1005,7 @@ hbflreload(int bid) buf[i] = 0; break; } - if (strcasecmp("guest", buf) == 0 || + if (strcasecmp(STR_GUEST, buf) == 0 || (uid = searchuser(buf, NULL)) == 0) { --num; continue; diff --git a/mbbsd/cal.c b/mbbsd/cal.c index d2119f36..3485f99d 100644 --- a/mbbsd/cal.c +++ b/mbbsd/cal.c @@ -326,7 +326,8 @@ mail_redenvelop(const char *from, const char *to, int money, char mode) char genbuf[200]; fileheader_t fhdr; FILE *fp; - snprintf(genbuf, sizeof(genbuf), "home/%c/%s", to[0], to); + + sethomepath(genbuf, to); stampfile(genbuf, &fhdr); if (!(fp = fopen(genbuf, "w"))) return; @@ -343,7 +344,7 @@ mail_redenvelop(const char *from, const char *to, int money, char mode) if (mode == 'y') vedit(genbuf, NA, NULL); - snprintf(genbuf, sizeof(genbuf), "home/%c/%s/.DIR", to[0], to); + sethomedir(genbuf, to); append_record(genbuf, &fhdr, sizeof(fhdr)); } diff --git a/mbbsd/edit.c b/mbbsd/edit.c index 33bec6aa..6ce46305 100644 --- a/mbbsd/edit.c +++ b/mbbsd/edit.c @@ -1514,7 +1514,7 @@ write_file(char *fpath, int saveheader, int *islocal) addsignature(fp, curr_buf->ifuseanony); else if (currstat == REEDIT #ifndef ALL_REEDIT_LOG - && strcmp(currboard, "SYSOP") == 0 + && strcmp(currboard, str_sysop) == 0 #endif ) { ptime = localtime4(&now); diff --git a/mbbsd/mbbsd.c b/mbbsd/mbbsd.c index ba5d3c10..84c26470 100644 --- a/mbbsd/mbbsd.c +++ b/mbbsd/mbbsd.c @@ -607,7 +607,7 @@ login_query(void) outs(ERR_PASSWD); } else { logattempt(cuser.userid, ' '); - if (strcasecmp("SYSOP", cuser.userid) == 0){ + if (strcasecmp(str_sysop, cuser.userid) == 0){ #ifdef NO_SYSOP_ACCOUNT exit(0); #else /* 自動加上各個主要權限 */ diff --git a/mbbsd/register.c b/mbbsd/register.c index 246e1dad..0a2c9078 100644 --- a/mbbsd/register.c +++ b/mbbsd/register.c @@ -115,8 +115,7 @@ check_and_expire_account(int uid, const userec_t * urec) urec->numlogins, urec->numposts, val); if (val > -1 * 60 * 24 * 365) { log_usies("CLEAN", genbuf); - snprintf(genbuf, sizeof(genbuf), "home/%c/%s", urec->userid[0], - urec->userid); + sethomepath(genbuf, urec->userid); snprintf(genbuf2, sizeof(genbuf2), "tmp/%s", urec->userid); if (dashd(genbuf) && Rename(genbuf, genbuf2)) { snprintf(genbuf, sizeof(genbuf), diff --git a/mbbsd/syspost.c b/mbbsd/syspost.c index 42289ce4..9e02fc63 100644 --- a/mbbsd/syspost.c +++ b/mbbsd/syspost.c @@ -10,7 +10,7 @@ post_msg(const char *bname, const char *title, const char *msg, const char *auth char genbuf[256]; /* 在 bname 板發表新文章 */ - snprintf(genbuf, sizeof(genbuf), "boards/%c/%s", bname[0], bname); + setbpath(genbuf, bname); stampfile(genbuf, &fhdr); fp = fopen(genbuf, "w"); @@ -62,7 +62,7 @@ post_change_perm(int oldperm, int newperm, const char *sysopid, const char *user char genbuf[200], reason[30]; int i, flag = 0; - strlcpy(genbuf, "boards/S/Security", sizeof(genbuf)); + setbpath(genbuf, "Security"); stampfile(genbuf, &fhdr); if (!(fp = fopen(genbuf, "w"))) return; @@ -122,7 +122,7 @@ post_violatelaw(const char *crime, const char *police, const char *reason, const append_record("boards/S/Security/.DIR", &fhdr, sizeof(fhdr)); */ - strlcpy(genbuf, "boards/V/ViolateLaw", sizeof(genbuf)); + setbpath(genbuf, "ViolateLaw"); stampfile(genbuf, &fhdr); if (!(fp = fopen(genbuf, "w"))) return; @@ -161,7 +161,7 @@ give_money_post(const char *userid, int money) fileheader_t fhdr; char genbuf[200]; - strlcpy(genbuf, "boards/S/Security", sizeof(genbuf)); + setbpath(genbuf, "Security"); stampfile(genbuf, &fhdr); if (!(fp = fopen(genbuf, "w"))) return; diff --git a/mbbsd/user.c b/mbbsd/user.c index 8c17c443..52d2dd5e 100644 --- a/mbbsd/user.c +++ b/mbbsd/user.c @@ -177,7 +177,8 @@ mail_violatelaw(const char *crime, const char *police, const char *reason, const char genbuf[200]; fileheader_t fhdr; FILE *fp; - snprintf(genbuf, 200, "home/%c/%s", crime[0], crime); + + sethomepath(genbuf, crime); stampfile(genbuf, &fhdr); if (!(fp = fopen(genbuf, "w"))) return; @@ -191,7 +192,7 @@ mail_violatelaw(const char *crime, const char *police, const char *reason, const fclose(fp); strcpy(fhdr.title, "[報告] 違法判決報告"); strcpy(fhdr.owner, "[Ptt法院]"); - snprintf(genbuf, 200, "home/%c/%s/.DIR", crime[0], crime); + sethomedir(genbuf, crime); append_record(genbuf, &fhdr, sizeof(fhdr)); } @@ -232,7 +233,7 @@ violate_law(userec_t * u, int unum) return; if (ans[0] == '9') { char src[STRLEN], dst[STRLEN]; - snprintf(src, sizeof(src), "home/%c/%s", u->userid[0], u->userid); + sethomepath(src, u->userid); snprintf(dst, sizeof(dst), "tmp/%s", u->userid); friend_delete_all(u->userid, FRIEND_ALOHA); Rename(src, dst); @@ -722,7 +723,7 @@ uinfo_query(userec_t * u, int real, int unum) if (i == QUIT) { char src[STRLEN], dst[STRLEN]; - snprintf(src, sizeof(src), "home/%c/%s", x.userid[0], x.userid); + sethomepath(src, x.userid); snprintf(dst, sizeof(dst), "tmp/%s", x.userid); friend_delete_all(x.userid, FRIEND_ALOHA); Rename(src, dst); /* do not remove user home */ @@ -734,7 +735,7 @@ uinfo_query(userec_t * u, int real, int unum) setumoney(unum, x.money); passwd_update(unum, &x); if (money_change) { - strlcpy(genbuf, "boards/S/Security", sizeof(genbuf)); + setbpath(genbuf, "Security"); stampfile(genbuf, &fhdr); if (!(fp = fopen(genbuf, "w"))) return; @@ -1125,7 +1126,7 @@ toregister(char *email, char *genbuf, char *phone, char *career, snprintf(buf, sizeof(buf), "您在 " BBSNAME " 的認證碼: %s", getregcode(genbuf)); strlcpy(tmp, cuser.userid, sizeof(tmp)); - strlcpy(cuser.userid, "SYSOP", sizeof(cuser.userid)); + strlcpy(cuser.userid, str_sysop, sizeof(cuser.userid)); #ifdef HAVEMOBILE if (strcmp(email, "m") == 0 || strcmp(email, "M") == 0) mobile_message(mobile, buf); diff --git a/mbbsd/vote.c b/mbbsd/vote.c index e354f1d4..cf52228f 100644 --- a/mbbsd/vote.c +++ b/mbbsd/vote.c @@ -327,10 +327,10 @@ b_result_one(vote_buffer_t *vbuf, boardheader_t * fh, int ind, int *total) b_suckinfile(frp, b_newresults); fclose(frp); } - snprintf(inbuf, sizeof(inbuf), "boards/%c/%s", bname[0], bname); + setbpath(inbuf, bname); vote_report(bname, b_report, inbuf); if (!(fh->brdattr & BRD_NOCOUNT)) { - snprintf(inbuf, sizeof(inbuf), "boards/%c/%s", 'R', "Record"); + setbpath(inbuf, "Record"); vote_report(bname, b_report, inbuf); } unlink(b_report); |