本文整理汇总了C++中HAS_PERM函数的典型用法代码示例。如果您正苦于以下问题:C++ HAS_PERM函数的具体用法?C++ HAS_PERM怎么用?C++ HAS_PERM使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了HAS_PERM函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: full_user_list
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;
}
示例2: u_exit
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);
}
示例3: main
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>\
示例4: user_switchcase
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;
}
示例5: modestring
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);
}
示例6: u_exit
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);
}
示例7: show_statuses
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');
}
示例8: call_kickoff
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);
}
示例9: printuserent
/*
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;
}
示例10: tui_goodbrd_mkdir
/**
* 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;
}
示例11: kick_out
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;
}
}
示例12: _fill_session_array
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;
}
示例13: help_key
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;
}
示例14: PostArticle
/*******************************************************************
* 張貼文章
*
* 佈告、信件 通用
*
* 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 */
{
示例15: haspostperm
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));
}