示例#1
0
 }
 if ($new_user != '') {
     $user = DB::fetch_first("SELECT uid, adminid FROM " . DB::table('common_member') . " WHERE username='******'");
     $uid = $user['uid'];
     if (empty($user)) {
         $adderror = 1;
     } elseif ($user['adminid'] && $_G['adminid'] != 1) {
         $adderror = 2;
     } else {
         $access = DB::fetch_first("SELECT * FROM " . DB::table('forum_access') . " WHERE fid='{$_G['fid']}' AND uid='{$uid}'");
         if ($deleteaccess) {
             if ($access && $_G['adminid'] != 1 && inwhitelist($access)) {
                 $adderror = 3;
             } else {
                 $successed = true;
                 $access && delete_access($uid, $_G['fid']);
             }
         } elseif ($new_view || $new_post || $new_reply || $new_getattach || $new_postattach || $new_postimage) {
             if ($new_view == -1) {
                 $new_view = $new_post = $new_reply = $new_getattach = $new_postattach = $new_postimage = -1;
             } else {
                 $new_view = 0;
                 $new_post = $new_post ? -1 : 0;
                 $new_reply = $new_reply ? -1 : 0;
                 $new_getattach = $new_getattach ? -1 : 0;
                 $new_postattach = $new_postattach ? -1 : 0;
                 $new_postimage = $new_postimage ? -1 : 0;
             }
             if (empty($access)) {
                 $successed = true;
                 DB::query("INSERT INTO " . DB::table('forum_access') . " SET\n\t\t\t\t\t\tuid='{$uid}', fid='{$_G['fid']}', allowview='{$new_view}', allowpost='{$new_post}', allowreply='{$new_reply}',\n\t\t\t\t\t\tallowpostattach='{$new_postattach}', allowgetattach='{$new_getattach}', allowpostimage='{$new_postimage}', adminuser='******'uid']}', dateline='{$_G['timestamp']}'");
 $deleteaccess = isset($deleteaccess) ? 1 : 0;
 if ($new_user != '') {
     $user = $db->fetch_first("SELECT uid, adminid FROM {$tablepre}members WHERE username='******'");
     $uid = $user['uid'];
     if (empty($user)) {
         $adderror = 1;
     } elseif ($user['adminid'] && $adminid != 1) {
         $adderror = 2;
     } else {
         $access = $db->fetch_first("SELECT * FROM {$tablepre}access WHERE fid='{$fid}' AND uid='{$uid}'");
         if ($deleteaccess) {
             if ($access && $adminid != 1 && inwhitelist($access)) {
                 $adderror = 3;
             } else {
                 $successed = true;
                 $access && delete_access($user['uid'], $fid);
             }
         } elseif (!(empty($new_view) && empty($new_post) && empty($new_reply) && empty($new_getattach) && empty($new_postattach))) {
             if ($new_view == -1) {
                 $new_view = $new_post = $new_reply = $new_getattach = $new_postattach = -1;
             } else {
                 $new_view = 0;
                 $new_post = $new_post ? -1 : 0;
                 $new_reply = $new_reply ? -1 : 0;
                 $new_getattach = $new_getattach ? -1 : 0;
                 $new_postattach = $new_postattach ? -1 : 0;
             }
             if (empty($access)) {
                 $successed = true;
                 $db->query("INSERT INTO {$tablepre}access SET\n\t\t\t\t\t\tuid='{$uid}', fid='{$fid}', allowview='{$new_view}', allowpost='{$new_post}', allowreply='{$new_reply}',\n\t\t\t\t\t\tallowpostattach='{$new_postattach}', allowgetattach='{$new_getattach}', adminuser='******', dateline='{$timestamp}'");
                 $db->query("UPDATE {$tablepre}members SET accessmasks='1' WHERE uid='{$uid}'", 'UNBUFFERED');