From f3c3e1901f8d8a060f619522edd9c1a71a901d84 Mon Sep 17 00:00:00 2001 From: piaip Date: Mon, 7 Nov 2011 05:59:27 +0000 Subject: Alert if board name is invalid. git-svn-id: http://opensvn.csie.org/pttbbs/trunk@5457 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- pttbbs/mbbsd/admin.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/pttbbs/mbbsd/admin.c b/pttbbs/mbbsd/admin.c index f49763fb..fdfc2f13 100644 --- a/pttbbs/mbbsd/admin.c +++ b/pttbbs/mbbsd/admin.c @@ -620,7 +620,10 @@ m_mod_board(char *bname) while (getdata(9, 0, "新看板名稱:", genbuf, IDLEN + 1, DOECHO)) { if (getbnum(genbuf)) { mvouts(10, 0, "錯誤: 此新看板名已存在\n"); - } else if ( is_valid_brdname(genbuf) ){ + } else if ( !is_valid_brdname(genbuf) ) { + mvouts(10, 0, "錯誤: 無法使用此名稱。" + "請使用英數字或 _-. 且開頭不得為數字。\n"); + } else { if (genbuf[0] != bh.brdname[0]) { // change to 0 if you want to force permission when renaming // with different initial character. @@ -812,7 +815,11 @@ m_newbrd(int whatclass, int recover) if (!getdata(3, 0, msg_bid, newboard.brdname, sizeof(newboard.brdname), DOECHO)) return -1; - } while (!is_valid_brdname(newboard.brdname)); + if (is_valid_brdname(newboard.brdname)) + break; + // some i* need to be acknowledged + vmsg("無法使用此名稱,請使用英數字或 _-. 且開頭不得為數字。"); + } while (true); do { getdata(6, 0, "看板類別:", genbuf, 5, DOECHO); @@ -821,7 +828,6 @@ m_newbrd(int whatclass, int recover) } while (1); strcpy(newboard.title, genbuf); - newboard.title[4] = ' '; getdata(8, 0, "看板主題:", genbuf, BTLEN + 1, DOECHO); -- cgit v1.2.3