$list = array('pagelink' => '', 'data' => array()); if ($num = DB::result_first("SELECT COUNT(*) FROM " . DB::table('forum_access') . " WHERE 1=1 {$fidadd} {$useradd}")) { $page = $page > ceil($num / $ppp) ? ceil($num / $ppp) : $page; $start_limit = ($page - 1) * $ppp; $list['pagelink'] = multi($num, $ppp, $page, "forum.php?mod=modcp&fid={$_G['fid']}&action={$_G['gp_action']}"); $query = DB::query("SELECT * FROM " . DB::table('forum_access') . " WHERE 1=1 {$fidadd} {$useradd} ORDER BY dateline DESC LIMIT {$start_limit}, {$ppp}"); $uidarray = array(); while ($access = DB::fetch($query)) { $uidarray[$access['uid']] = $access['uid']; $uidarray[$access['adminuser']] = $access['adminuser']; $access['allowview'] = accessimg($access['allowview']); $access['allowpost'] = accessimg($access['allowpost']); $access['allowreply'] = accessimg($access['allowreply']); $access['allowpostattach'] = accessimg($access['allowpostattach']); $access['allowgetattach'] = accessimg($access['allowgetattach']); $access['allowpostimage'] = accessimg($access['allowpostimage']); $access['dateline'] = dgmdate($access['dateline'], 'd'); $access['forum'] = '<a href="forum.php?mod=forumdisplay&fid=' . $access['fid'] . '" target="_blank">' . strip_tags($_G['cache']['forums'][$access['fid']]['name']) . '</a>'; $list['data'][] = $access; } $users = array(); if ($uids = dimplode($uidarray)) { $query = DB::query("SELECT uid, username FROM " . DB::table('common_member') . " WHERE uid IN ({$uids})"); while ($user = DB::fetch($query)) { $users[$user['uid']] = $user['username']; } } } function delete_access($uid, $fid) { DB::query("DELETE FROM " . DB::table('forum_access') . " WHERE uid='{$uid}' AND fid='{$fid}'");
} elseif ($operation == 'access') { require_once libfile('function/forumlist'); $forumlist = '<SELECT name="addfid">' . forumselect(FALSE, 0, 0, TRUE) . '</select>'; loadcache('forums'); if (!submitcheck('accesssubmit')) { shownav('user', 'members_access_edit'); showsubmenu('members_access_edit'); showtips('members_access_tips'); showtableheader(cplang('members_access_now') . ' - ' . $member['username'], 'nobottom fixpadding'); showsubtitle(array('forum', 'members_access_view', 'members_access_post', 'members_access_reply', 'members_access_getattach', 'members_access_getimage', 'members_access_postattach', 'members_access_postimage', 'members_access_adminuser', 'members_access_dateline')); $accessmasks = C::t('forum_access')->fetch_all_by_uid($_GET['uid']); foreach ($accessmasks as $id => $access) { $adminuser = C::t('common_member' . $tableext)->fetch($access['adminuser']); $access['dateline'] = $access['dateline'] ? dgmdate($access['dateline']) : ''; $forum = $_G['cache']['forums'][$id]; showtablerow('', '', array(($forum['type'] == 'forum' ? '' : '|-----') . " <a href=\"" . ADMINSCRIPT . "?action=forums&operation=edit&fid={$forum['fid']}&anchor=perm\">{$forum['name']}</a>", accessimg($access['allowview']), accessimg($access['allowpost']), accessimg($access['allowreply']), accessimg($access['allowgetattach']), accessimg($access['allowgetimage']), accessimg($access['allowpostattach']), accessimg($access['allowpostimage']), $adminuser['username'], $access['dateline'])); } if (empty($accessmasks)) { showtablerow('', '', array('-', '-', '-', '-', '-', '-', '-', '-', '-', '-')); } showtablefooter(); showformheader("members&operation=access&uid={$_GET['uid']}"); showtableheader(cplang('members_access_add'), 'notop fixpadding'); showsetting('members_access_add_forum', '', '', $forumlist); foreach (array('view', 'post', 'reply', 'getattach', 'getimage', 'postattach', 'postimage') as $perm) { showsetting('members_access_add_' . $perm, array('allow' . $perm . 'new', array(array(0, cplang('default')), array(1, cplang('members_access_allowed')), array(-1, cplang('members_access_disallowed'))), TRUE), 0, 'mradio'); } showsubmit('accesssubmit', 'submit'); showtablefooter(); showformfooter(); } else {
$ppp = 10; $list = array('pagelink' => '', 'data' => array()); if ($num = $db->result_first("SELECT COUNT(*) FROM {$tablepre}access WHERE 1=1 {$fidadd} {$useradd}")) { $page = $page > ceil($num / $ppp) ? ceil($num / $ppp) : $page; $start_limit = ($page - 1) * $ppp; $list['pagelink'] = multi($num, $ppp, $page, "modcp.php?fid={$fid}&action={$action}"); $query = $db->query("SELECT * FROM {$tablepre}access WHERE 1=1 {$fidadd} {$useradd} ORDER BY dateline DESC LIMIT {$start_limit}, {$ppp}"); $uidarray = array(); while ($access = $db->fetch_array($query)) { $uidarray[$access['uid']] = $access['uid']; $uidarray[$access['adminuser']] = $access['adminuser']; $access['allowview'] = accessimg($access['allowview']); $access['allowpost'] = accessimg($access['allowpost']); $access['allowreply'] = accessimg($access['allowreply']); $access['allowpostattach'] = accessimg($access['allowpostattach']); $access['allowgetattach'] = accessimg($access['allowgetattach']); $access['dateline'] = gmdate("{$dateformat}", $access['dateline'] + $timeoffset * 3600); $access['forum'] = '<a href="forumdisplay.php?fid=' . $access['fid'] . '" target="_blank">' . strip_tags($_DCACHE['forums'][$access['fid']]['name']) . '</a>'; $list['data'][] = $access; } $users = array(); if ($uids = implodeids($uidarray)) { $query = $db->query("SELECT uid, username FROM {$tablepre}members WHERE uid IN ({$uids})"); while ($user = $db->fetch_array($query)) { $users[$user['uid']] = $user['username']; } } } function delete_access($uid, $fid) { global $db, $tablepre;