static int full_user_list(struct user_info *uentp, struct fulluserlistarg* arg,int count) { struct user_info userinfo=*uentp; struct userec *lookupuser; zval* element; if (!userinfo.active || !userinfo.pid) { return 0; } if (!HAS_PERM(getCurrentUser(), PERM_SEECLOAK) && userinfo.invisible && strcmp(userinfo.userid, getCurrentUser()->userid)) { /*Haohmaru.99.4.24.让隐身者能看见自己 */ return 0; } if (count+1<arg->start) return COUNT; if (count+1-arg->start>=arg->num) return QUIT; MAKE_STD_ZVAL ( element ); array_init ( element ); add_assoc_bool ( element, "invisible", userinfo.invisible ); add_assoc_long ( element, "pid", userinfo.pid ); add_assoc_bool ( element, "isfriend", isfriend(userinfo.userid) ); add_assoc_string ( element, "userid", userinfo.userid, 1 ); add_assoc_string ( element, "username", userinfo.username, 1 ); if( getuser(userinfo.userid, &lookupuser) == 0 ) lookupuser=NULL; add_assoc_string ( element, "userfrom", HAS_PERM(getCurrentUser(), PERM_SYSOP)? userinfo.from: SHOW_USERIP(lookupuser, userinfo.from), 1 ); add_assoc_string ( element, "mode", ModeType(userinfo.mode), 1 ); add_assoc_long ( element, "idle", (long)(time(0) - userinfo.freshtime)/60 ); zend_hash_index_update(Z_ARRVAL_P(arg->return_value), count+1-arg->start, (void *) &element, sizeof(zval *), NULL); return COUNT; }
void u_exit(char *mode) { userec_t xuser; int diff = (time(0) - login_start_time) / 60; passwd_query(usernum, &xuser); auto_backup(); setflags(PAGER_FLAG, currutmp->pager != 1); setflags(CLOAK_FLAG, currutmp->invisible); xuser.invisible = currutmp->invisible % 2; xuser.pager = currutmp->pager % 5; if(!(HAS_PERM(PERM_SYSOP) && HAS_PERM(PERM_DENYPOST))) do_aloha("<<下站通知>> -- 我走囉!"); purge_utmp(currutmp); if((cuser.uflag != enter_uflag) || (currmode & MODE_DIRTY) || !diff) { xuser.uflag = cuser.uflag; xuser.numposts = cuser.numposts; if(!diff && cuser.numlogins) xuser.numlogins = --cuser.numlogins; /* Leeym 上站停留時間限制式 */ reload_money(); passwd_update(usernum, &xuser); } log_usies(mode, NULL); }
int main() { FILE *fp; char board[80], dir[80], *ptr, flag[80]; struct shortfile *x1; struct fileheader x; int i, start, total, my_t_lines=0, chart=0, showhead=0; init_all(); strsncpy(board, getparm("board"), 32); my_t_lines=atoi(getparm("my_t_lines")); if(my_t_lines<10 || my_t_lines>40) my_t_lines=20; x1=getbcache(board); if(x1==0) http_fatal("错误的讨论区"); strcpy(board, x1->filename); board_ban_ip(board); if (!canenterboard (currentuser.userid, board) && !HAS_PERM(PERM_SYSOP)) http_fatal ("您已经被取消进入本板的权限"); if(!has_read_perm(¤tuser, board) && !HAS_PERM(PERM_SYSOP)) http_fatal("错误的讨论区"); if(!has_BM_perm(¤tuser, board)) http_fatal("您没有权限访问本页"); modify_mode(u_info,READING); //bluetent sprintf(dir, "boards/%s/.DIR", board); fp=fopen(dir, "r"); if(fp==0) http_fatal("错误的讨论区目录"); total=file_size(dir)/sizeof(struct fileheader); start=atoi(getparm("start")); if(strlen(getparm("start"))==0 || start>total-my_t_lines) start=total-my_t_lines; if(start<0) start=0; printf("<nobr><center>\n"); strcpy(u_info->board, board); /* printf("%s -- [讨论区: %s] 板主[%s] 文章数[%d]<hr color=green>\n", BBSNAME, board, userid_str(x1->BM), total); if(total<=0) http_fatal("本讨论区目前没有文章"); printf("<form name=form1 method=post action=bbsman>\n"); printf("<table width=613>\n"); printf("<tr><td>序号<td>管理<td>状态<td>作者<td>日期<td>标题\n"); fseek(fp, start*sizeof(struct fileheader), SEEK_SET);*/ printf("<script language=JavaScript>\ \ function MM_jumpMenu(selObj){\ eval(\"window.location='\"+selObj.options[selObj.selectedIndex].value+\"'\");\ }\ function SubmitFlag(flagmode){\ document.form1.mode.value=flagmode;\ document.form1.submit();\ }\ function selrange(x)\ {if(event.shiftKey){var min=x;var max=document.getElementById('lastsel').value;if(min>max){var tmp=min;min=max;max=tmp;}var stt=document.getElementById('chk'+x).checked;for(var i=min;i<=max;i++)document.getElementById('chk'+i).checked=stt;}document.getElementById('lastsel').value=x;}\ </script>\
int user_switchcase() { char newuserid[IDLEN+2]; modify_user_mode(USERDEF); clear(); if (count_user( )>1) { move(1,0); prints("��Ŀǰ��login��ֹһ��,���˳�����login������һ��\n"); pressreturn(); clear(); return 1; } if(HAS_PERM(PERM_BOARDS)){ move(1,0); prints("�Բ���Ŀǰ��֧�ְ������û�����Сд��������ϵ����������Ա,\n"); prints("�������а���Ȼ������ģ���������������"); pressreturn(); clear(); return 1; } getdata(0, 0, "�������µ��ʺ����� (Enter User ID): ", newuserid, IDLEN + 1, DOECHO, YEA); if(newuserid[0] == '\0'){ clear(); return 0; } if(!strcmp(currentuser.userid, newuserid)){ clear(); return 0; } if(strcasecmp(currentuser.userid, newuserid)){ move(1,0); prints("�µ��ʺ����ƺ�ԭ���ʺŲ�ͬ������ܸı��ʺŵĴ�Сд��"); pressreturn(); clear(); return 1; } if(HAS_PERM(PERM_PERSONAL)) dig_user_switchcase(newuserid); sprintf(genbuf,"mv %s/home/%C/%s %s/home/%C/%s", BBSHOME, toupper(currentuser.userid[0]),currentuser.userid, BBSHOME, toupper(newuserid[0]), newuserid); system(genbuf); sprintf(genbuf,"mv %s/mail/%C/%s %s/mail/%C/%s", BBSHOME, toupper(currentuser.userid[0]),currentuser.userid, BBSHOME, toupper(newuserid[0]), newuserid); system(genbuf); strcpy(currentuser.userid, newuserid); strcpy(uinfo.userid, newuserid); substitute_record(PASSFILE, ¤tuser, sizeof(currentuser), usernum); move(5,10); prints("���ʺŴ�Сд�ɹ���"); pressreturn(); return 0; }
char * modestring(user_info *uentp, int simple) { static char modestr[40]; static char *notonline="不在站上"; register int mode = uentp->mode; register char *word; word = ModeTypeTable[mode]; if (!(HAS_PERM(PERM_SYSOP) || HAS_PERM(PERM_SEECLOAK)) && (uentp->invisible || (is_rejected(uentp) & HRM))) return (notonline); else if (mode == EDITING) { sprintf(modestr, "E:%s", ModeTypeTable[uentp->destuid < EDITING ? uentp->destuid : EDITING]); word = modestr; } else if (!mode && *uentp->chatid == 1) { if (!simple) sprintf(modestr, "回應 %s", getuserid(uentp->destuid)); else sprintf(modestr, "回應呼叫"); } else if (!mode && *uentp->chatid == 3) sprintf(modestr, "水球準備中"); else if (!mode) return (uentp->destuid == 6) ? uentp->chatid : IdleTypeTable[(0 <= uentp->destuid & uentp->destuid < 6) ? uentp->destuid: 0]; else if (simple) return (word); else if (uentp->in_chat & mode == CHATING) sprintf(modestr, "%s (%s)", word, uentp->chatid); else if (mode == TALK) { if (is_hidden(getuserid(uentp->destuid))) /* Leeym 對方(紫色)隱形 */ sprintf(modestr, "%s", "自言自語中"); /* Leeym 大家自己發揮吧! */ else sprintf(modestr, "%s %s", word, getuserid(uentp->destuid)); } else if (mode != PAGE && mode != QUERY) return (word); else sprintf(modestr, "%s %s", word, getuserid(uentp->destuid)); return (modestr); }
void u_exit(char *mode) { extern void auto_backup(); /* 編輯器自動備份 */ userec xuser; int diff = (time(0) - login_start_time) / 60; rec_get(fn_passwd, &xuser, sizeof(xuser), usernum); auto_backup(); setflags(PAGER_FLAG, currutmp->pager != 1); setflags(CLOAK_FLAG, currutmp->invisible); xuser.pager = currutmp->pager; /* 記錄pager狀態, add by wisely */ xuser.invisible = currutmp->invisible; /* 紀錄隱形狀態 by wildcat */ xuser.totaltime += time(0) - update_time; xuser.numposts = cuser.numposts; xuser.feeling[4] = '\0'; if (!HAS_PERM(PERM_DENYPOST) && !currutmp->invisible) { char buf [256]; time_t now; time(&now); sprintf(buf, "<<下站通知>> -- 我走囉! - %s", Etime(&now)); do_aloha(buf); } purge_utmp(currutmp); if (!diff && cuser.numlogins > 1 && strcmp(cuser.userid, STR_GUEST)) xuser.numlogins = --cuser.numlogins; /* Leeym 上站停留時間限制式 */ substitute_record(fn_passwd, &xuser, sizeof(userec), usernum); log_usies(mode, NULL); }
static void show_statuses(session_basic_info_t *res) { if (session_basic_info_count(res) > 0) //% prints("目前状态如下:\n"); prints("\xc4\xbf\xc7\xb0\xd7\xb4\xcc\xac\xc8\xe7\xcf\xc2\xa3\xba\n"); for (int i = 0; i < session_basic_info_count(res); ++i) { bool visible = session_basic_info_visible(res, i); if (!visible && !HAS_PERM(PERM_SEECLOAK)) continue; session_id_t sid = session_basic_info_sid(res, i); bool web = session_basic_info_web(res, i); int status = get_user_status(sid); int idle = (time(NULL) - session_get_idle(sid)) / 60; const char *color = session_status_color(status, visible, web); prints("\033[1m%s%s\033[m", color, session_status_descr(status)); if (idle >= 1 && status != ST_BBSNET) prints("[%d] ", idle); else prints(" "); if ((i + 1) % 5 == 0) outc('\n'); } outc('\n'); }
void call_kickoff(chatcontext * pthis, const char *arg) { /* kick ID off BBS, by Luzi, 97.11.1 */ char msg[STRLEN]; struct user_info *uin; if (!HAS_PERM(getCurrentUser(), PERM_SYSOP)) { printchatline(pthis, "*** 你不是站长 ***"); return; } if (!*arg) { printchatline(pthis, "*** 请输入你要踢下站的 ID ***"); return; } else if (!strcasecmp(arg, getCurrentUser()->userid)) sprintf(msg, "*** Faint!你要把自己踢下站啊?***"); else { uin = t_search(arg, false); if (uin == NULL) { sprintf(msg, "%s 并没有上站", arg); } else { bbslog("user", "kick %s out of bbs", uin->userid); kill(uin->pid, SIGHUP); return; } } printchatline(pthis, msg); }
/* int printuserent(chatcontext * pthis, struct user_info *uentp) { static char uline[256]; static int cnt; char pline[50]; if (!uentp) { if (cnt) printchatline(pthis, uline); bzero(uline, 256); cnt = 0; return 0; } if (!uentp->active || !uentp->pid) return 0; if (!HAS_PERM(getCurrentUser(), PERM_SEECLOAK) && uentp->invisible) return 0; #if 0 if (kill(uentp->pid, 0) == -1) return 0; #endif sprintf(pline, " %s%-13s\033[m%c%-10s", myfriend(uentp->uid, NULL) ? "\033[32m" : "", uentp->userid, uentp->invisible ? '#' : ' ', modestring(uentp->mode, uentp->destuid, 0, NULL)); if (cnt < 2) strcat(pline, "│"); strcat(uline, pline); if (++cnt == 3) { printchatline(pthis, uline); memset(uline, 0, 256); cnt = 0; } return 0; } */ int print_friend_ent(struct user_info *uentp, chatcontext * pthis, int pos) { /* print one user & status if he is a friend */ char pline[50],buf[80]; if (!uentp->active || !uentp->pid) return 0; if (!HAS_PERM(getCurrentUser(), PERM_SEECLOAK) && uentp->invisible) return 0; #if 0 if (kill(uentp->pid, 0) == -1) return 0; #endif /* */ if (!myfriend(uentp->uid, NULL,getSession())) return 0; sprintf(pline, " %-13s%c%-10s", uentp->userid, uentp->invisible ? '#' : ' ', modestring(buf,uentp->mode, uentp->destuid, 0, NULL)); if (pthis->apply_count < 2) strcat(pline, "│"); strcat(pthis->apply_buf, pline); if (pthis->apply_count == 2) { printchatline(pthis, pthis->apply_buf); memset(pthis->apply_buf, 0, 256); pthis->apply_count = 0; } else pthis->apply_count++; return COUNT; }
/** * Create directory when browsing favorites. * @param cp browsing status. * @return update status. */ static int tui_goodbrd_mkdir(choose_t *cp) { choose_board_t *cbrd = cp->data; if (!HAS_PERM(PERM_LOGIN) || !cbrd->goodbrd) return DONOTHING; if (cbrd->parent == 0) { if (cbrd->gnum >= GOOD_BRC_NUM) { presskeyfor("收藏夹已满", t_lines - 1); return MINIUPDATE; } char name[STRLEN]; char title[STRLEN]; name[0] = '\0'; getdata(t_lines - 1, 0, "创建自定义目录: ", name, 17, DOECHO, NA); if (name[0] != '\0') { strlcpy(title, "自定义目录", sizeof(title)); getdata(t_lines - 1, 0, "自定义目录描述: ", title, 21, DOECHO, NA); if (goodbrd_mkdir(cbrd, name, title, 0) == 0) { cp->valid = false; return PARTUPDATE; } } return MINIUPDATE; } return DONOTHING; }
static int kick_out(online_users_t *up, online_user_info_t *ip) { char buf[STRLEN]; if (!HAS_PERM(PERM_USER) && !streq(ip->name, currentuser.userid)) return DONOTHING; if (streq(currentuser.userid, "guest")) return DONOTHING; if (ip->sid == session_get_id()) //% strlcpy(buf, "您要把【自己】踢出去吗", sizeof(buf)); strlcpy(buf, "\xc4\xfa\xd2\xaa\xb0\xd1\xa1\xbe\xd7\xd4\xbc\xba\xa1\xbf\xcc\xdf\xb3\xf6\xc8\xa5\xc2\xf0", sizeof(buf)); else //% snprintf(buf, sizeof(buf), "你要把 %s 踢出站外吗", ip->name); snprintf(buf, sizeof(buf), "\xc4\xe3\xd2\xaa\xb0\xd1 %s \xcc\xdf\xb3\xf6\xd5\xbe\xcd\xe2\xc2\xf0", ip->name); if (!askyn(buf, false, true)) return MINIUPDATE; if (bbs_kill(ip->sid, ip->pid, SIGHUP) == 0) { //% snprintf(buf, sizeof(buf), "%s 已被踢出站外", ip->name); snprintf(buf, sizeof(buf), "%s \xd2\xd1\xb1\xbb\xcc\xdf\xb3\xf6\xd5\xbe\xcd\xe2", ip->name); up->uptime = 0; return PARTUPDATE; } else { //% snprintf(buf, sizeof(buf), "%s 无法踢出站外", ip->name); snprintf(buf, sizeof(buf), "%s \xce\xde\xb7\xa8\xcc\xdf\xb3\xf6\xd5\xbe\xcd\xe2", ip->name); return MINIUPDATE; } }
static void _fill_session_array(tui_list_t *p, int i) { online_users_t *up = p->data; db_res_t *res = up->res; bool visible = db_get_bool(res, i, 3); if (!visible && !HAS_PERM(PERM_SEECLOAK)) return; session_id_t sid = db_get_session_id(res, i, 0); if (up->bid && session_get_board(sid) != up->bid) return; online_user_info_t *ip = up->users + up->num; memset(ip, 0, sizeof(*ip)); ip->sid = sid; ip->name = db_get_value(res, i, 2); ip->host = db_get_value(res, i, 4); ip->note = up->follow ? db_get_value(res, i, 6) : NULL; ip->uid = db_get_user_id(res, i, 1); ip->flag = (db_get_bool(res, i, 5) ? SESSION_FLAG_WEB : 0) | (visible ? 0 : SESSION_FLAG_INVISIBLE); ++up->num; }
static int help_key(struct _select_def *conf, int key) { switch(key){ case 's': { clear(); move(5,0); prints("\033[1;32m提示:\033[m 在帮助主界面中按f可以取消搜索显示当前所有的帮助"); getdata(6,0, "请输入搜索内容:", help_search, 21, DOECHO, NULL, false); if( help_search[0] ){ conf->pos = 1; conf->page_pos = 1; return SHOW_DIRCHANGE; } return SHOW_REFRESH; } case 'a': if( HAS_PERM(getCurrentUser(), PERM_SYSOP) ){ if( add_help(*((int *)conf->arg), -1) < 0 ) return SHOW_REFRESH; return SHOW_DIRCHANGE; } case 'e': if( HAS_PERM(getCurrentUser(), PERM_SYSOP) ){ if( add_help(*((int *)conf->arg), conf->pos - conf->page_pos) < 0 ) return SHOW_REFRESH; return SHOW_DIRCHANGE; } case 'd': if( HAS_PERM(getCurrentUser(), PERM_SYSOP) ){ if( del_help(s_help[conf->pos-conf->page_pos].id) < 0 ) return SHOW_REFRESH; return SHOW_DIRCHANGE; } case 'f': if( help_search[0] ){ help_search[0]=0; return SHOW_DIRCHANGE; } return SHOW_CONTINUE; default: break; } return SHOW_CONTINUE; }
/******************************************************************* * 張貼文章 * * 佈告、信件 通用 * * return: WebRespondType *******************************************************************/ int PostArticle(char *pbuf, BOARDHEADER * board, POST_FILE * pf) { BOOL tonews = FALSE; char *p; unsigned char flag = 0x00; FILE *fp; int sign_num, URLParaType = request_rec->URLParaType; char fname[PATHLEN], post_path[PATHLEN], address[STRLEN], post_source[STRLEN], subject[STRLEN]; char buffer[STRLEN * 3]; if (URLParaType == PostSend || URLParaType == TreaSend) { if (PSCorrect == gLogin) /* guest */ { if (!strstr(_STR_BOARD_GUEST, board->filename)) return WEB_GUEST_NOT_ALLOW; else get_passwd(&curuser, username); } if ((curuser.userlevel < board->level)) { sprintf(WEBBBS_ERROR_MESSAGE, "%s 無權張貼文章於 %s 一般區<BR>理由: 使用者等級 < %d", username, board->filename, board->level); return WEB_ERROR; } if ((board->brdtype & BRD_IDENT) && (curuser.ident != 7)) { sprintf(WEBBBS_ERROR_MESSAGE, "%s 無權張貼文章於 %s 一般區<BR>理由: 未通過身份認證", username, board->filename); return WEB_ERROR; } #if 0 make_treasure_folder(direct, title, NULL) #endif /* treapost */ if (URLParaType == TreaSend) { if (!HAS_PERM(PERM_SYSOP) && strcmp(username, board->owner)) { sprintf(WEBBBS_ERROR_MESSAGE, "%s 無權張貼文章於 %s 精華區", username, board->filename); return WEB_ERROR; } settreafile(post_path, board->filename, pf->POST_NAME); } } else /* Send Mail */ {
int haspostperm(char* bname) { register int i; if (digestmode) return 0; if ( deny_me(bname) && !HAS_PERM(PERM_SYSOP)) return 0; if (strcmp(bname, DEFAULTBOARD) == 0) return 1; if ( (!strcmp(bname, "Appeal")||(!strcmp(bname,"Complain"))) && strcmp(lookupuser.userid,"guest") && HAS_PERM(PERM_LOGINOK)) return 1; if ((i = getbnum(bname)) == 0) return 0; set_safe_record(); if (!HAS_PERM(PERM_POST)) return 0; return (HAS_PERM((bcache[i - 1].level & ~PERM_NOZAP) & ~PERM_POSTMASK)); }
static choose_display_t choose_board_display(choose_t *cp) { choose_board_t *cbrd = cp->data; board_data_t *ptr; char tmpBM[BM_LEN - 1]; char cate[7], title[STRLEN]; int n; for (n = cp->start; n < cp->start + BBS_PAGESIZE; n++) { if (n >= cbrd->num) { prints("\n"); continue; } ptr = cbrd->brds + n; if (ptr->total == -1) { refresh(); check_newpost(ptr); } if (!cbrd->newflag) prints(" %5d", n + 1); else if (ptr->flag & BOARD_DIR_FLAG) prints(" 目录"); else prints(" %5d", ptr->total); if (ptr->flag & BOARD_DIR_FLAG) prints(" +"); else prints(" %s", ptr->unread ? "◆" : "◇"); if (!(ptr->flag & BOARD_CUSTOM_FLAG)) strcpy(tmpBM, ptr->BM); strlcpy(cate, ptr->title + 1, sizeof(cate)); strlcpy(title, ptr->title + 11, sizeof(title)); ellipsis(title, 20); prints("%c%-17s %s%s%6s %-20s %c ", (ptr->zap && !(ptr->flag & BOARD_NOZAP_FLAG)) ? '*' : ' ', ptr->name, (ptr->flag & BOARD_VOTE_FLAG) ? "\033[1;31mV\033[m" : " ", (ptr->flag & BOARD_CLUB_FLAG) ? (ptr->flag & BOARD_READ_FLAG) ? "\033[1;31mc\033[m" : "\033[1;33mc\033[m" : " ", cate, title, HAS_PERM (PERM_POST) ? ptr->property : ' '); if (ptr->flag & BOARD_DIR_FLAG) prints("[目录]\n"); else prints("%-12s %4d\n", ptr->BM[0] <= ' ' ? "诚征版主中" : strtok(tmpBM, " "), brdshm->bstatus[ptr->pos].inboard); } return 0; }
static void start_client() { extern struct commands_t cmdlist[]; int nreg; /* system init */ currmode = 0; signal(SIGHUP, abort_bbs); signal(SIGTERM, abort_bbs); signal(SIGPIPE, abort_bbs); signal(SIGINT, abort_bbs_debug); signal(SIGQUIT, abort_bbs_debug); signal(SIGILL, abort_bbs_debug); signal(SIGABRT, abort_bbs_debug); signal(SIGFPE, abort_bbs_debug); signal(SIGBUS, abort_bbs_debug); signal(SIGSEGV, abort_bbs_debug); signal_restart(SIGUSR1, talk_request); signal_restart(SIGUSR2, write_request); dup2(0, 1); do_term_init(); signal(SIGALRM, abort_bbs); alarm(600); login_query(); /* Ptt 加上login time out */ user_login(); m_init(); #if FORCE_PROCESS_REGISTER_FORM if (HAS_PERM(PERM_SYSOP) && (nreg = dashs(fn_register)/163) > 100) { char cpu_load[30]; if(cpuload(cpu_load) > MAX_CPULOAD*2/3) /* DickG: 根據目前的 load 來 */ scan_register_form(fn_register, 1, nreg/20); /* 決定要審核的數目 */ else scan_register_form(fn_register, 1, nreg/10); } #endif if(HAVE_PERM(PERM_SYSOP | PERM_BM)) b_closepolls(); if(!(cuser.uflag & COLOR_FLAG)) showansi = 0; #ifdef DOTIMEOUT /* init_alarm();*/ // cause strange logout with saving post. signal(SIGALRM, SIG_IGN); #else signal(SIGALRM, SIG_IGN); #endif if(chkmailbox()) m_read(); domenu(MMENU, "主功\能表", (chkmail(0) ? 'M' : 'C'), cmdlist); }
void chat_sendmsg(chatcontext * pthis, const char *arg) { /* send msg in chatroom , by alex, 96.9.5 */ char userid[IDLEN + 1]; char msg[STRLEN * 2]; struct user_info *uin; int state; nextword(&arg, userid, sizeof(userid)); if (!userid[0]) { printchatline(pthis, "\x1b[37m*** \x1b[32m请输入你要发消息的 ID\x1b[37m ***\x1b[m"); return; } else if (!*arg) { printchatline(pthis, "\x1b[37m*** \x1b[32m请输入你要发的消息\x1b[37m ***\x1b[m"); return; } else if (!HAS_PERM(getCurrentUser(), PERM_PAGE)) { /* Leeward 98.07.30 */ sprintf(msg, "\x1b[32m你没有发信息的权限\x1b[m"); } else { uin = t_search(userid, false); if (uin == NULL) { sprintf(msg, "\x1b[32m%s\x1b[37m 并没有上站\x1b[m", userid); } else if (LOCKSCREEN == uin->mode) /* Leeward 98.02.28 */ sprintf(msg, "\x1b[32m%s\x1b[37m已经锁定屏幕,请稍候再发或给他(她)写信.\n", uin->userid); else { if (!canmsg(getCurrentUser(), uin)) sprintf(msg, "\x1b[32m%s\x1b[37m已经关闭接受讯息的呼叫器.\n", uin->userid); else if (false == canIsend2(getCurrentUser(),uin->userid)) sprintf(msg, "\x1b[32m%s\x1b[37m拒绝接受你的讯息.\n", uin->userid); /*Haohmaru.99.6.6,检查是否被ignore */ else { if (get_unreadcount(uin->userid) > MAXMESSAGE) sprintf(msg, "对方尚有一些讯息未处理,请稍候再发或给他(她)写信...\n"); else { /* 保存所发msg的目的uid 1998.7.5 by dong */ strcpy(getSession()->MsgDesUid, uin->userid); state = do_sendmsg(uin, arg, 2); if (state == 1) sprintf(msg, "\x1b[37m已经发消息给 \x1b[32m%s\x1b[37m 了\x1b[m", uin->userid); else if (state == -2) sprintf(msg, "\x1b[37m对方已经离线了...\x1b[m"); else sprintf(msg, "\033[37对方不接受你的消息...\033[m"); } } } } printchatline(pthis, msg); }
int apply_boards(int (*func)()) { register int i; resolve_boards(); for (i = 0; i < numboards; i++) if (bcache[i].level & PERM_POSTMASK || HAS_PERM(bcache[i].level) || (bcache[i].level & PERM_NOZAP)) if ((*func) (&bcache[i]) == QUIT) return QUIT; return 0; }
void tui_update_status_line(void) { extern time_t login_start_time; //main.c char date[STRLEN]; screen_move_clear(-1); if (!DEFINE(DEF_ENDLINE)) return; fb_time_t now = fb_time(); int cur_sec = now % 10; if (cur_sec < 5) { strlcpy(date, format_time(now, TIME_FORMAT_UTF8_ZH), sizeof(date)); } else { if (resolve_boards() >= 0) convert_g2u(brdshm->date, date); else date[0] = '\0'; } if (cur_sec >= 5 && is_birth(¤tuser)) { screen_printf("\033[0;1;33;44m[\033[36m " "啦啦~~生日快乐!记得要请客哟 :P" " \033[33m]\033[m"); } else { int stay = (now - login_start_time) / 60; char stay_str[20]; describe_stay(stay, stay_str, sizeof(stay_str)); char notice[128]; notice_string(notice, sizeof(notice)); int notice_width = screen_display_width(notice, true); screen_printf("\033[1;44;33m[\033[36m%29s\033[33m]" "[\033[36m%5d\033[33m人\033[36m%3d\033[33m友]", date, session_count_online(), session_count_online_followed(!HAS_PERM(PERM_SEECLOAK))); // 剩下35列 if (notice_width) { int space = 33 - notice_width; if (space > 0) tui_repeat_char(' ', space); screen_printf("[\033[%d;36m%s\033[m\033[1;33;44m]\033[m", _suppress_notice ? 1 : 5, notice); } else { int space = 27 - strlen(currentuser.userid); tui_repeat_char(' ', space); prints("[\033[36m%s\033[33m]%s\033[m", currentuser.userid, stay_str); } } }
static int habit_from() { if(HAS_PERM(PERM_FROM)) { char fbuf[50]; sprintf(fbuf, "故鄉 [%s]:", currutmp->from); if(getdata(b_lines, 0, fbuf, currutmp->from, 17, DOECHO,0)) currutmp->from_alias=0; } }
int rcmd_postno(int ent, FILEHEADER *finfo, char *direct) { if (HAS_PERM(PERM_SYSOP)) { msg("filename:[%s] postno:[%d] owner:[%s]", finfo->filename, finfo->postno, finfo->owner); getkey(); return C_FOOT; } return C_NONE; }
static bool session_msgable(online_user_info_t *oui) { if (streq(oui->name, currentuser.userid)) return false; if ((oui->flag & SESSION_FLAG_INVISIBLE) && !HAS_PERM(PERM_SEECLOAK)) return false; if ((oui->flag & SESSION_FLAG_WEB)) return false; if (oui->status == ST_BBSNET || oui->status == ST_LOCKSCREEN) return false; return true; }
static int check_user_maxmail(struct userec currentuser) { int currsize, maxsize; if(HAS_PERM(PERM_SYSOP|PERM_OBOARDS)) return 0; currsize = 0; maxsize = get_user_max_mail_size(¤tuser); currsize = get_user_mail_size(currentuser.userid); return (currsize > (maxsize + 20)); }
static void u_enter(void) { if (!HAS_PERM(PERM_CLOAK)) currentuser.flags[0] &= ~CLOAK_FLAG; session_set_visibility(!(HAS_PERM(PERM_LOGINCLOAK) && (currentuser.flags[0] & CLOAK_FLAG))); chk_giveupbbs(); digestmode = NA; session_new(NULL, NULL, 0, session_uid(), currentuser.userid, fromhost, SESSION_TELNET, #ifdef ENABLE_SSH SESSION_SECURE #else SESSION_PLAIN #endif , session_visible(), 0); int pager = load_pager(); set_pager(pager); }
/** * Copy board when browsing favorites. * @param cp browsing status. * @return update status. */ static int tui_goodbrd_copy(choose_t *cp) { choose_board_t *cbrd = cp->data; if (!HAS_PERM(PERM_LOGIN) || !cbrd->goodbrd) return DONOTHING; if (cbrd->brds[cp->cur].flag & BOARD_CUSTOM_FLAG) return DONOTHING; cbrd->copy_bnum = cbrd->brds[cp->cur].pos + 1; presskeyfor("版面已复制 请按P粘贴", t_lines - 1); return MINIUPDATE; }
static const char *get_host(const online_user_info_t *ip, const struct userec *user) { const char *host; if (HAS_PERM(PERM_OCHAT)) { host = ip->host; } else { if (HAS_DEFINE(user->userdefine, DEF_NOTHIDEIP)) host = mask_host(ip->host); else host = "......"; } return host; }
/** * Paste copied board when browsing favorites. * @param cp browsing status. * @return update status. */ static int tui_goodbrd_paste(choose_t *cp) { choose_board_t *cbrd = cp->data; if (!HAS_PERM(PERM_LOGIN) || !cbrd->goodbrd) return DONOTHING; if (goodbrd_add(cbrd, cbrd->copy_bnum, cbrd->parent) == 0) { cbrd->copy_bnum = 0; cp->valid = false; return PARTUPDATE; } return DONOTHING; }
int bbs_auth(const char *name, const char *passwd) { if (!name || *name == '\0') return BBS_ENOUSR; if (currentuser.userid[0] == '\0') { if (session_count_online() > MAXACTIVE) return BBS_E2MANY; if (!dosearchuser(name, ¤tuser, &usernum)) return BBS_ENOUSR; } if (!passwd_check(currentuser.userid, passwd)) { log_attempt(currentuser.userid, fromhost, "telnet"); return BBS_EWPSWD; } if (strcasecmp(currentuser.userid, "guest") && !HAS_PERM(PERM_LOGIN)) { if (chk_giveupbbs()) return BBS_EGIVEUP; if (currentuser.userlevel == 0) { return BBS_ESUICIDE; } else { return BBS_EBANNED; } } #ifdef CHECK_FREQUENTLOGIN if (!HAS_PERM(PERM_SYSOPS) && strcasecmp(currentuser.userid, "guest") != 0 && abs(time(NULL) - currentuser.lastlogin) < 10) { return BBS_ELFREQ; } #endif session_set_uid(get_user_id(name)); return 0; }
int main() { char user[32], title3[80], title[80], title2[80]; int day; init_all(); printf("<body background=%s bgproperties=fixed>",mytheme.bgpath); modify_mode(u_info,READING+20000); //bluetent strsncpy(user, getparm("user"), 13); strsncpy(title, getparm("title"), 50); strsncpy(title2, getparm("title2"), 50); strsncpy(title3, getparm("title3"), 50); day=atoi(getparm("day")); if(day==0||(!strlen(user)&&!(strlen(title)))) {//huangxu@060406:禁止空查询 // printf("%s -- 站内文章查询<hr color=green>\n", BBSNAME); printf("<center><img src=/search_b.gif></center><hr color=green>"); printf("<form name=bbsfind action=bbsfind>\n"); printf("文章作者: <input maxlength=12 size=12 type=text name=user> (不填查找所有作者)<br>\n"); printf("标题含有: <input maxlength=60 size=20 type=text name=title>"); printf(" AND <input maxlength=60 size=20 type=text name=title2><br>\n"); printf("标题不含: <input maxlength=60 size=20 type=text name=title3><br>\n"); printf("查找最近: <input maxlength=5 size=5 type=text name=day value=7> 天以内的文章<br><br>\n"); if (HAS_PERM(PERM_SYSOP)||HAS_PERM(PERM_DENYPOST)&&HAS_PERM(PERM_OBOARDS))//huangxu@060406 { printf("<p><input type='radio' checked name='adminmode' value='0' />一般查找</p>"); printf("<p><input type='radio' name='adminmode' value='1' />查找文章以便删除</p>"); printf("<p><input type='radio' name='adminmode' value='2' />查找回收站</p>"); } printf("<input type=submit value=提交查询></form><script language=javascript>bbsfind.user.focus()</script>\n"); } else { search(user, title, title2, title3, day*86400); } printf("</body>"); http_quit(); }